@wix/bookings 1.0.1796 → 1.0.1798

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/build/cjs/context-booking-checkout.d.ts +3 -37
  2. package/build/cjs/context-booking-checkout.js +1350 -1340
  3. package/build/cjs/context-booking-checkout.js.map +1 -1
  4. package/build/cjs/context-categories.d.ts +1 -3
  5. package/build/cjs/context-categories.js +20 -43
  6. package/build/cjs/context-categories.js.map +1 -1
  7. package/build/cjs/context-locations.d.ts +1 -1
  8. package/build/cjs/context-locations.js +20 -43
  9. package/build/cjs/context-locations.js.map +1 -1
  10. package/build/cjs/context-service-addons.d.ts +1 -15
  11. package/build/cjs/context-service-addons.js +20 -43
  12. package/build/cjs/context-service-addons.js.map +1 -1
  13. package/build/cjs/context-service.d.ts +1 -65
  14. package/build/cjs/context-service.js +363 -386
  15. package/build/cjs/context-service.js.map +1 -1
  16. package/build/cjs/context-services.d.ts +1 -23
  17. package/build/cjs/context-services.js +542 -566
  18. package/build/cjs/context-services.js.map +1 -1
  19. package/build/cjs/context-time-slots.d.ts +1 -21
  20. package/build/cjs/context-time-slots.js +588 -615
  21. package/build/cjs/context-time-slots.js.map +1 -1
  22. package/build/es/context-booking-checkout.d.mts +3 -37
  23. package/build/es/context-booking-checkout.mjs +1350 -1340
  24. package/build/es/context-booking-checkout.mjs.map +1 -1
  25. package/build/es/context-categories.d.mts +1 -3
  26. package/build/es/context-categories.mjs +20 -43
  27. package/build/es/context-categories.mjs.map +1 -1
  28. package/build/es/context-locations.d.mts +1 -1
  29. package/build/es/context-locations.mjs +20 -43
  30. package/build/es/context-locations.mjs.map +1 -1
  31. package/build/es/context-service-addons.d.mts +1 -15
  32. package/build/es/context-service-addons.mjs +20 -43
  33. package/build/es/context-service-addons.mjs.map +1 -1
  34. package/build/es/context-service.d.mts +1 -65
  35. package/build/es/context-service.mjs +363 -386
  36. package/build/es/context-service.mjs.map +1 -1
  37. package/build/es/context-services.d.mts +1 -23
  38. package/build/es/context-services.mjs +542 -566
  39. package/build/es/context-services.mjs.map +1 -1
  40. package/build/es/context-time-slots.d.mts +1 -21
  41. package/build/es/context-time-slots.mjs +588 -615
  42. package/build/es/context-time-slots.mjs.map +1 -1
  43. package/build/internal/cjs/context-booking-checkout.d.ts +3 -37
  44. package/build/internal/cjs/context-categories.d.ts +1 -3
  45. package/build/internal/cjs/context-locations.d.ts +1 -1
  46. package/build/internal/cjs/context-service-addons.d.ts +1 -15
  47. package/build/internal/cjs/context-service.d.ts +1 -65
  48. package/build/internal/cjs/context-services.d.ts +1 -23
  49. package/build/internal/cjs/context-time-slots.d.ts +1 -21
  50. package/build/internal/es/context-booking-checkout.d.mts +3 -37
  51. package/build/internal/es/context-categories.d.mts +1 -3
  52. package/build/internal/es/context-locations.d.mts +1 -1
  53. package/build/internal/es/context-service-addons.d.mts +1 -15
  54. package/build/internal/es/context-service.d.mts +1 -65
  55. package/build/internal/es/context-services.d.mts +1 -23
  56. package/build/internal/es/context-time-slots.d.mts +1 -21
  57. package/context-runtime/context-booking-checkout/runtime.d.ts +3 -38
  58. package/context-runtime/context-booking-checkout/runtime.js +3 -3
  59. package/context-runtime/context-categories/runtime.d.ts +1 -4
  60. package/context-runtime/context-categories/runtime.js +2 -2
  61. package/context-runtime/context-locations/runtime.d.ts +1 -2
  62. package/context-runtime/context-locations/runtime.js +2 -2
  63. package/context-runtime/context-service/runtime.d.ts +1 -66
  64. package/context-runtime/context-service/runtime.js +3 -3
  65. package/context-runtime/context-service-addons/runtime.d.ts +1 -16
  66. package/context-runtime/context-service-addons/runtime.js +2 -2
  67. package/context-runtime/context-services/runtime.d.ts +1 -24
  68. package/context-runtime/context-services/runtime.js +3 -3
  69. package/context-runtime/context-time-slots/runtime.d.ts +1 -22
  70. package/context-runtime/context-time-slots/runtime.js +3 -3
  71. package/package.json +4 -4
@@ -20,11 +20,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // context-time-slots.ts
21
21
  var context_time_slots_exports = {};
22
22
  __export(context_time_slots_exports, {
23
- TimeSlotsContextProvider: () => fu,
24
- default: () => fu,
25
- injectAccessTokenGetter: () => gu,
26
- timeSlotsContext: () => su,
27
- useTimeSlotsContext: () => cu
23
+ TimeSlotsContextProvider: () => gu,
24
+ default: () => gu,
25
+ injectAccessTokenGetter: () => bu,
26
+ timeSlotsContext: () => du,
27
+ useTimeSlotsContext: () => fu
28
28
  });
29
29
  module.exports = __toCommonJS(context_time_slots_exports);
30
30
 
@@ -222,7 +222,7 @@ function L(e2, t2, n2) {
222
222
  break;
223
223
  }
224
224
  let a2 = r2[e3 + 1];
225
- (!(t3 in i2) || i2[t3] == null || typeof i2[t3] != `object` || i2[t3] === null) && (i2[t3] = typeof a2 == `number` ? [] : {}), i2 = i2[t3];
225
+ t3 in i2 && i2[t3] != null && typeof i2[t3] == `object` && i2[t3] !== null || (i2[t3] = typeof a2 == `number` ? [] : {}), i2 = i2[t3];
226
226
  }
227
227
  return e2;
228
228
  }
@@ -289,11 +289,8 @@ var xe = class {
289
289
  return;
290
290
  }
291
291
  let a3 = Te(e3);
292
- if (a3 && a3 in t3) {
293
- r2.push(a3), n2 = t3[a3];
294
- return;
295
- }
296
- throw Error(`Cannot find key '${e3}' or its transformations at path ${this.buildPathString(r2)}`);
292
+ if (a3 && a3 in t3) r2.push(a3), n2 = t3[a3];
293
+ else throw Error(`Cannot find key '${e3}' or its transformations at path ${this.buildPathString(r2)}`);
297
294
  }, o2 = (e3, t3) => {
298
295
  r2.push(e3), n2 = t3[e3];
299
296
  };
@@ -304,11 +301,7 @@ var xe = class {
304
301
  }
305
302
  if (typeof n2 != `object` || !n2) throw Error(`Cannot access property '${e3}' on ${typeof n2} at path ${this.buildPathString(r2)}`);
306
303
  let t3 = n2;
307
- if (e3 in n2) {
308
- o2(e3, t3);
309
- continue;
310
- }
311
- a2(e3, t3);
304
+ e3 in n2 ? o2(e3, t3) : a2(e3, t3);
312
305
  }
313
306
  return { [this.buildPathString(r2)]: n2 };
314
307
  }
@@ -454,30 +447,30 @@ function je(e2) {
454
447
  return s2.transformations.toREST(await c2(s2.transformations.fromREST(e3)));
455
448
  } } };
456
449
  }
457
- var Me = `X-Wix-Consistent`;
458
- function Ne(e2) {
450
+ var R = `X-Wix-Consistent`;
451
+ function Me(e2) {
459
452
  let t2 = e2.headers || { Authorization: `` }, n2 = { getAuthHeaders: (e3) => Promise.resolve({ headers: {} }) }, r2 = e2.auth, i2 = typeof r2 == `function` ? r2 : () => r2 ?? n2, a2 = () => i2().getAuthHeaders(e2.host), o2 = () => e2.fetch ?? fetch, s2 = async (n3, r3) => {
460
- let i3 = o2(), s3 = await a2(), c3 = { ...r3?.headers ?? {}, ...s3.headers, ...e2.host?.essentials?.passThroughHeaders, ...t2[`X-Wix-Consistent`] ? { [Me]: t2[Me] } : {} }, l3 = e2.host?.getErrorHandler?.();
453
+ let i3 = o2(), s3 = await a2(), c3 = { ...r3?.headers ?? {}, ...s3.headers, ...e2.host?.essentials?.passThroughHeaders, ...t2[`X-Wix-Consistent`] ? { [R]: t2[R] } : {} }, l3 = e2.host?.getErrorHandler?.();
461
454
  try {
462
455
  if (typeof n3 == `string` || n3 instanceof URL) {
463
456
  let e3 = await i3(n3, { ...r3, headers: c3 });
464
457
  l3?.handleError(e3, { requestOptions: { url: n3.toString(), method: r3?.method } });
465
- let a3 = Pe(e3);
466
- return a3 && (t2[Me] = a3), e3;
458
+ let a3 = Ne(e3);
459
+ return a3 && (t2[R] = a3), e3;
467
460
  }
468
461
  {
469
462
  for (let [e4, t3] of Object.entries(c3)) typeof t3 == `string` && n3.headers.set(e4, t3);
470
463
  let e3 = await i3(n3, r3);
471
464
  l3?.handleError(e3, { requestOptions: { url: n3.url, method: r3?.method } });
472
- let a3 = Pe(e3);
473
- return a3 && (t2[Me] = a3), e3;
465
+ let a3 = Ne(e3);
466
+ return a3 && (t2[R] = a3), e3;
474
467
  }
475
468
  } catch (e3) {
476
469
  throw l3?.handleError(e3, { requestOptions: { url: typeof n3 == `string` || n3 instanceof URL ? n3.toString() : n3.url, method: r3?.method } }), e3;
477
470
  }
478
471
  }, { client: c2, initModule: l2 } = je(i2), { client: u2, initModule: d2 } = ke(i2), f2 = async (n3, r3) => {
479
- let i3 = o2(), s3 = await a2(), c3 = w(r3), l3 = await i3(n3, { ...r3, headers: { ...c3, ...t2, ...s3?.headers, ...r3?.headers, ...e2.host?.essentials?.passThroughHeaders, ...t2[`X-Wix-Consistent`] ? { [Me]: t2[Me] } : {} } }), u3 = Pe(l3);
480
- return u3 && (t2[Me] = u3), l3;
472
+ let i3 = o2(), s3 = await a2(), c3 = w(r3), l3 = await i3(n3, { ...r3, headers: { ...c3, ...t2, ...s3?.headers, ...r3?.headers, ...e2.host?.essentials?.passThroughHeaders, ...t2[`X-Wix-Consistent`] ? { [R]: t2[R] } : {} } }), u3 = Ne(l3);
473
+ return u3 && (t2[R] = u3), l3;
481
474
  }, p2 = (t3, n3) => {
482
475
  if (De(t3)) return d2(t3);
483
476
  if (Ae(t3)) return l2(t3);
@@ -509,19 +502,19 @@ function Ne(e2) {
509
502
  return { data: o3 ?? {}, errors: s3 };
510
503
  }, webhooks: u2, servicePlugins: c2 };
511
504
  }
512
- function Pe(e2) {
505
+ function Ne(e2) {
513
506
  return e2.headers?.get(`X-Wix-Consistent`) ?? e2.headers?.get(`x-wix-consistent`);
514
507
  }
515
- var Fe = { _id: `id`, _createdDate: `createdDate`, _updatedDate: `updatedDate` };
516
- var Ie = { id: `_id`, createdDate: `_createdDate`, updatedDate: `_updatedDate` };
517
- function Le(e2, t2) {
508
+ var Pe = { _id: `id`, _createdDate: `createdDate`, _updatedDate: `updatedDate` };
509
+ var Fe = { id: `_id`, createdDate: `_createdDate`, updatedDate: `_updatedDate` };
510
+ function Ie(e2, t2) {
518
511
  return e2?.split(`.`).map((e3) => t2?.[e3] ?? e3).join(`.`);
519
512
  }
520
- var Re = `sort.fieldName`;
521
- function ze(e2, t2, n2) {
522
- return (e2 === Re || e2.endsWith(`.${Re}`)) && typeof t2 == `string` ? Le(t2, n2) : t2;
513
+ var Le = `sort.fieldName`;
514
+ function z(e2, t2, n2) {
515
+ return (e2 === Le || e2.endsWith(`.${Le}`)) && typeof t2 == `string` ? Ie(t2, n2) : t2;
523
516
  }
524
- function Be(e2, t2, n2) {
517
+ function Re(e2, t2, n2) {
525
518
  let r2 = (e3) => n2.includes(e3), i2 = (e3, n3) => {
526
519
  if (Array.isArray(e3)) e3.forEach((e4) => {
527
520
  i2(e4, n3);
@@ -531,24 +524,24 @@ function Be(e2, t2, n2) {
531
524
  Object.keys(a2).forEach((e4) => {
532
525
  let o2 = n3 === `` ? e4 : `${n3}.${e4}`;
533
526
  if (r2(o2)) return;
534
- let s2 = Ve(e4, t2);
535
- s2 !== e4 && !(s2 in a2) && (a2[s2] = a2[e4], delete a2[e4]), a2[s2] = ze(o2, a2[s2], t2), i2(a2[s2], o2);
527
+ let s2 = ze(e4, t2);
528
+ s2 !== e4 && !(s2 in a2) && (a2[s2] = a2[e4], delete a2[e4]), a2[s2] = z(o2, a2[s2], t2), i2(a2[s2], o2);
536
529
  });
537
530
  }
538
531
  };
539
532
  return i2(e2, ``), e2;
540
533
  }
541
- function Ve(e2, t2) {
534
+ function ze(e2, t2) {
542
535
  let n2;
543
536
  return n2 = e2.includes(`.`) ? e2.split(`.`).map((e3) => t2[e3] ?? e3).join(`.`) : t2[e2] ?? e2, n2;
544
537
  }
545
- function R(e2, t2 = []) {
546
- return Be(e2, Fe, t2);
538
+ function Be(e2, t2 = []) {
539
+ return Re(e2, Pe, t2);
547
540
  }
548
- function He(e2, t2 = []) {
549
- return Be(e2, Ie, t2);
541
+ function Ve(e2, t2 = []) {
542
+ return Re(e2, Fe, t2);
550
543
  }
551
- function z(e2) {
544
+ function He(e2) {
552
545
  return e2?.toISOString();
553
546
  }
554
547
  function Ue(e2) {
@@ -562,29 +555,29 @@ function Ke(e2, t2) {
562
555
  let n2 = e2.get(t2);
563
556
  return n2 || (n2 = Ge(), e2.set(t2, n2)), n2;
564
557
  }
565
- function qe(e2, t2) {
558
+ function B(e2, t2) {
566
559
  return t2 === `*` ? (e2.anyField ??= Ge(), e2.anyField) : t2.endsWith(`{}`) ? (e2.mapFields ??= /* @__PURE__ */ new Map(), Ke(e2.mapFields, t2.slice(0, -2))) : (e2.fields ??= /* @__PURE__ */ new Map(), Ke(e2.fields, t2));
567
560
  }
568
- function Je(e2) {
561
+ function qe(e2) {
569
562
  let t2 = Ge();
570
563
  for (let n2 of e2) {
571
- let e3 = n2.path.split(`.`).reduce(qe, t2);
564
+ let e3 = n2.path.split(`.`).reduce(B, t2);
572
565
  e3.leaves ??= [], e3.leaves.push(n2);
573
566
  }
574
567
  return t2;
575
568
  }
576
- function Ye(e2) {
569
+ function Je(e2) {
577
570
  let t2 = We.get(e2);
578
- return t2 || (t2 = Je(e2), We.set(e2, t2)), t2;
571
+ return t2 || (t2 = qe(e2), We.set(e2, t2)), t2;
579
572
  }
580
- function B(e2) {
573
+ function Ye(e2) {
581
574
  return typeof e2 == `object` && !!e2;
582
575
  }
583
576
  function Xe(e2, { isRepeated: t2, isMap: n2 }, r2) {
584
- return t2 ? Array.isArray(e2) ? e2.map(r2) : e2 : n2 ? B(e2) ? Object.fromEntries(Object.entries(e2).map(([e3, t3]) => [e3, r2(t3)])) : e2 : r2(e2);
577
+ return t2 ? Array.isArray(e2) ? e2.map(r2) : e2 : n2 ? Ye(e2) ? Object.fromEntries(Object.entries(e2).map(([e3, t3]) => [e3, r2(t3)])) : e2 : r2(e2);
585
578
  }
586
579
  function Ze(e2, t2, n2) {
587
- B(e2) && et(e2, t2, n2);
580
+ Ye(e2) && et(e2, t2, n2);
588
581
  }
589
582
  function Qe(e2, t2, n2) {
590
583
  for (let [r2, i2] of t2) {
@@ -597,25 +590,25 @@ function Qe(e2, t2, n2) {
597
590
  function $e(e2, t2, n2) {
598
591
  for (let [r2, i2] of t2) {
599
592
  let t3 = e2[r2];
600
- B(t3) && Object.values(t3).forEach((e3) => Ze(e3, i2, n2));
593
+ Ye(t3) && Object.values(t3).forEach((e3) => Ze(e3, i2, n2));
601
594
  }
602
595
  }
603
596
  function et(e2, { fields: t2, mapFields: n2, anyField: r2 }, i2) {
604
597
  t2 && Qe(e2, t2, i2), n2 && $e(e2, n2, i2), r2 && Object.values(e2).forEach((e3) => Ze(e3, r2, i2));
605
598
  }
606
599
  function tt(e2, t2) {
607
- if (!B(e2)) return e2;
608
- for (let { paths: n2, transformFn: r2 } of t2) et(e2, Ye(n2), r2);
600
+ if (!Ye(e2)) return e2;
601
+ for (let { paths: n2, transformFn: r2 } of t2) et(e2, Je(n2), r2);
609
602
  return e2;
610
603
  }
611
604
  function nt(e2) {
612
- return st(e2).map((e3) => e3.toLocaleUpperCase()).join(`_`);
605
+ return V(e2).map((e3) => e3.toLocaleUpperCase()).join(`_`);
613
606
  }
614
607
  var rt = /([\p{Ll}\d])(\p{Lu})/gu;
615
608
  var it = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
616
609
  var at = `$1\0$2`;
617
610
  var ot = /[^\p{L}\d]+/giu;
618
- function st(e2) {
611
+ function V(e2) {
619
612
  let t2 = e2.trim();
620
613
  t2 = t2.replace(rt, at).replace(it, at), t2 = t2.replace(ot, `\0`);
621
614
  let n2 = 0, r2 = t2.length;
@@ -624,14 +617,14 @@ function st(e2) {
624
617
  for (; t2.charAt(r2 - 1) === `\0`; ) r2--;
625
618
  return t2.slice(n2, r2).split(/\0/g);
626
619
  }
627
- var ct = (e2) => `validationError` in (e2.response?.data?.details ?? {});
628
- var lt = (e2) => `applicationError` in (e2.response?.data?.details ?? {});
629
- var V = (e2) => (e2.response?.status ?? -1) >= 400 && (e2.response?.status ?? -1) < 500;
620
+ var st = (e2) => `validationError` in (e2.response?.data?.details ?? {});
621
+ var ct = (e2) => `applicationError` in (e2.response?.data?.details ?? {});
622
+ var lt = (e2) => (e2.response?.status ?? -1) >= 400 && (e2.response?.status ?? -1) < 500;
630
623
  function ut(e2, t2 = { explicitPathsToArguments: {}, spreadPathsToArguments: {}, singleArgumentUnchanged: false }, n2 = []) {
631
624
  if (typeof e2 != `object` || !e2) throw e2;
632
- if (ct(e2)) return dt(e2, t2, n2);
633
- if (lt(e2)) return pt(e2);
634
- if (V(e2)) {
625
+ if (st(e2)) return dt(e2, t2, n2);
626
+ if (ct(e2)) return pt(e2);
627
+ if (lt(e2)) {
635
628
  let t3 = e2.response?.status, n3 = e2.response?.statusText ?? `UNKNOWN`, r2 = e2.response?.data?.message ?? n3, i2 = { applicationError: { description: n3, code: nt(n3), data: {} }, requestId: e2.requestId };
636
629
  return ft(e2, { message: JSON.stringify({ message: r2, details: i2 }, null, 2), extraProperties: { details: i2, status: t3 } });
637
630
  }
@@ -711,25 +704,25 @@ function bt(e2, t2) {
711
704
  return r2 ? r2.initWixModules(e2, t2).apply(void 0, n2) : e2.apply(void 0, n2);
712
705
  };
713
706
  }
714
- function xt(e2, t2 = false) {
707
+ function H(e2, t2 = false) {
715
708
  return bt(e2, t2);
716
709
  }
717
- function St(e2, t2) {
718
- let n2 = H(e2), r2 = Object.entries(n2).some(([e3, t3]) => e3.includes(`.`) || Array.isArray(t3) && t3.some((e4) => typeof e4 == `object`));
710
+ function xt(e2, t2) {
711
+ let n2 = Ct(e2), r2 = Object.entries(n2).some(([e3, t3]) => e3.includes(`.`) || Array.isArray(t3) && t3.some((e4) => typeof e4 == `object`));
719
712
  return t2 && r2 ? new URLSearchParams({ ".r": Tt(JSON.stringify(e2)) }) : Object.entries(n2).reduce((e3, [t3, n3]) => ((Array.isArray(n3) ? n3 : [n3]).forEach((r3) => {
720
713
  r3 == null || Array.isArray(n3) && typeof r3 == `object` || e3.append(t3, r3);
721
714
  }), e3), new URLSearchParams());
722
715
  }
723
- function Ct(e2) {
716
+ function St(e2) {
724
717
  let t2 = Rt(It(e2.host), e2.domainToMappings);
725
- return qt(Wt(e2.protoPath, e2.data || {}), t2);
718
+ return Kt(Wt(e2.protoPath, e2.data || {}), t2);
726
719
  }
727
- function H(e2, t2 = ``) {
720
+ function Ct(e2, t2 = ``) {
728
721
  let n2 = {};
729
722
  return Object.entries(e2).forEach(([e3, r2]) => {
730
723
  let i2 = typeof r2 == `object` && !!r2 && !Array.isArray(r2), a2 = wt(t2, e3);
731
724
  if (i2) {
732
- let e4 = H(r2, a2);
725
+ let e4 = Ct(r2, a2);
733
726
  Object.assign(n2, e4);
734
727
  } else n2[a2] = r2;
735
728
  }), n2;
@@ -793,13 +786,13 @@ function Ht(e2) {
793
786
  }
794
787
  var Ut = `www._base_domain_`;
795
788
  function Wt(e2, t2) {
796
- return e2.split(`/`).map((e3) => Gt(e3, t2)).join(`/`);
789
+ return e2.split(`/`).map((e3) => U(e3, t2)).join(`/`);
797
790
  }
798
- function Gt(e2, t2) {
791
+ function U(e2, t2) {
799
792
  let n2 = e2.match(Nt) || [], r2 = n2[1];
800
- return r2 ? Kt(t2, r2, e2, e2.replace(n2[0], ``)) : e2;
793
+ return r2 ? Gt(t2, r2, e2, e2.replace(n2[0], ``)) : e2;
801
794
  }
802
- function Kt(e2, t2, n2, r2) {
795
+ function Gt(e2, t2, n2, r2) {
803
796
  let i2 = e2;
804
797
  for (let e3 of t2.split(`.`)) {
805
798
  if (!i2) return n2;
@@ -807,23 +800,23 @@ function Kt(e2, t2, n2, r2) {
807
800
  }
808
801
  return `${i2}${r2}`;
809
802
  }
810
- function qt(e2, t2) {
803
+ function Kt(e2, t2) {
811
804
  let n2 = t2?.find((t3) => e2.startsWith(t3.destPath));
812
805
  return n2 ? n2.srcPath + e2.slice(n2.destPath.length) : e2;
813
806
  }
814
- function U(e2) {
807
+ function qt(e2) {
815
808
  return e2 === `NaN` ? NaN : e2 === `Infinity` ? 1 / 0 : e2 === `-Infinity` ? -1 / 0 : e2;
816
809
  }
817
810
  var Jt = `x-wix-currency`;
818
811
  var Yt = () => {
819
- let e2 = nn(`currency`);
812
+ let e2 = W(`currency`);
820
813
  if (e2) return { [Jt]: e2 };
821
814
  };
822
815
  var Xt = `x-wix-linguist`;
823
816
  var Zt = `00000000-0000-0000-0000-000000000000`;
824
817
  var Qt = `false`;
825
818
  var $t = () => {
826
- let e2 = nn(`language`), t2 = nn(`locale`);
819
+ let e2 = W(`language`), t2 = W(`locale`);
827
820
  if (e2) return { [Xt]: [e2, t2 || e2, Qt, Zt].join(`|`) };
828
821
  };
829
822
  function en() {
@@ -833,16 +826,16 @@ function en() {
833
826
  }), resolve: e2, reject: t2 };
834
827
  }
835
828
  var tn = () => (typeof window < `u` ? window.commonConfig : void 0) ?? globalThis.commonConfig;
836
- var nn = (e2) => tn()?.[e2];
837
- var rn = ({ createHost: e2 }) => ({ __type: `host`, create: (e3) => ({}), host: (t2) => {
838
- let { applicationId: n2, componentId: r2 } = t2 ?? {}, i2 = typeof window < `u` ? window.wixEmbedsAPI : void 0, a2 = e2(t2), o2 = W();
839
- return { ...a2, apiBaseUrl: o2, getMonitoringClient: i2?.getMonitoringClientFunction?.(n2, r2), essentials: { language: nn(`language`), locale: nn(`locale`), get passThroughHeaders() {
829
+ var W = (e2) => tn()?.[e2];
830
+ var nn = ({ createHost: e2 }) => ({ __type: `host`, create: (e3) => ({}), host: (t2) => {
831
+ let { applicationId: n2, componentId: r2 } = t2 ?? {}, i2 = typeof window < `u` ? window.wixEmbedsAPI : void 0, a2 = e2(t2), o2 = an();
832
+ return { ...a2, apiBaseUrl: o2, getMonitoringClient: i2?.getMonitoringClientFunction?.(n2, r2), essentials: { language: W(`language`), locale: W(`locale`), get passThroughHeaders() {
840
833
  let e3 = { ...$t(), ...Yt() };
841
834
  return Object.keys(e3).length > 0 ? e3 : void 0;
842
835
  } } };
843
836
  }, auth: (e3) => {
844
837
  let t2 = typeof window < `u` ? window.wixEmbedsAPI : void 0;
845
- !e3 && an() && (e3 = t2?.getAccessTokenFunction?.());
838
+ !e3 && rn() && (e3 = t2?.getAccessTokenFunction?.());
846
839
  let n2 = false, { resolve: r2, promise: i2 } = en();
847
840
  return { getAuthHeaders: async () => {
848
841
  if (!e3 && n2 && (e3 = await i2), !e3) throw Error(`Failed to resolve auth token`);
@@ -851,10 +844,10 @@ var rn = ({ createHost: e2 }) => ({ __type: `host`, create: (e3) => ({}), host:
851
844
  r2(e4);
852
845
  }) };
853
846
  } });
854
- function an() {
847
+ function rn() {
855
848
  return typeof document < `u` && document.currentScript?.tagName === `SCRIPT`;
856
849
  }
857
- function W() {
850
+ function an() {
858
851
  let e2 = (typeof window < `u` ? window.wixEmbedsAPI : void 0)?.getExternalBaseUrl?.();
859
852
  if (!e2) return;
860
853
  let t2 = new URL(e2);
@@ -867,7 +860,7 @@ var on = ({ clientSdk: e2, applicationId: t2 }) => ({ invoke: async ({ namespace
867
860
  throw Error(`Not implemented`);
868
861
  }, observeState: () => ({ disconnect: () => {
869
862
  } }) });
870
- var sn = rn({ createHost: function(e2) {
863
+ var sn = nn({ createHost: function(e2) {
871
864
  let t2 = (typeof $wixContext < `u` ? $wixContext.clientSdk : void 0) ?? e2?.clientSdk ?? (typeof window < `u` ? window?.clientSdk : void 0), { applicationId: n2 } = e2 || {};
872
865
  if (!n2) throw Error(`"createHost" was called without a required field "applicationId"`);
873
866
  return { channel: on({ clientSdk: t2, applicationId: n2 }), close: () => {
@@ -875,7 +868,7 @@ var sn = rn({ createHost: function(e2) {
875
868
  } });
876
869
  var cn = (e2, t2) => {
877
870
  let n2 = sn.host({ applicationId: e2, componentId: t2 }), r2 = sn.auth();
878
- return Ne({ auth: r2, host: n2 }).enableContext(`module`), r2.getAccessTokenInjector();
871
+ return Me({ auth: r2, host: n2 }).enableContext(`module`), r2.getAccessTokenInjector();
879
872
  };
880
873
  var ln = (e2) => cn(`13d21c63-b5ec-5912-8397-c3a5ddb27a97`, e2);
881
874
  var un = [`ANY_FEMALE`, `ANY_MALE`];
@@ -891,10 +884,10 @@ var _n = ((e2) => {
891
884
  })(gn);
892
885
  var vn = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;
893
886
  var G = String.fromCharCode.bind(String);
894
- var yn = typeof Uint8Array.from == `function` ? Uint8Array.from.bind(Uint8Array) : (e2) => new Uint8Array(Array.prototype.slice.call(e2, 0));
895
- var bn = (e2) => e2.replace(/=/g, ``).replace(/[+\/]/g, (e3) => e3 == `+` ? `-` : `_`);
896
- var xn = (e2) => e2.replace(/[^A-Za-z0-9\+\/]/g, ``);
897
- var Sn = (e2) => {
887
+ var K = typeof Uint8Array.from == `function` ? Uint8Array.from.bind(Uint8Array) : (e2) => new Uint8Array(Array.prototype.slice.call(e2, 0));
888
+ var yn = (e2) => e2.replace(/=/g, ``).replace(/[+\/]/g, (e3) => e3 == `+` ? `-` : `_`);
889
+ var bn = (e2) => e2.replace(/[^A-Za-z0-9\+\/]/g, ``);
890
+ var xn = (e2) => {
898
891
  let t2, n2, r2, i2, a2 = ``, o2 = e2.length % 3;
899
892
  for (let o3 = 0; o3 < e2.length; ) {
900
893
  if ((n2 = e2.charCodeAt(o3++)) > 255 || (r2 = e2.charCodeAt(o3++)) > 255 || (i2 = e2.charCodeAt(o3++)) > 255) throw TypeError(`invalid character found`);
@@ -902,14 +895,14 @@ var Sn = (e2) => {
902
895
  }
903
896
  return o2 ? a2.slice(0, o2 - 3) + `===`.substring(o2) : a2;
904
897
  };
905
- var Cn = typeof btoa == `function` ? (e2) => btoa(e2) : pn ? (e2) => Buffer.from(e2, `binary`).toString(`base64`) : Sn;
906
- var wn = pn ? (e2) => Buffer.from(e2).toString(`base64`) : (e2) => {
898
+ var Sn = typeof btoa == `function` ? (e2) => btoa(e2) : pn ? (e2) => Buffer.from(e2, `binary`).toString(`base64`) : xn;
899
+ var Cn = pn ? (e2) => Buffer.from(e2).toString(`base64`) : (e2) => {
907
900
  let t2 = 4096, n2 = [];
908
901
  for (let r2 = 0, i2 = e2.length; r2 < i2; r2 += t2) n2.push(G.apply(null, e2.subarray(r2, r2 + t2)));
909
- return Cn(n2.join(``));
902
+ return Sn(n2.join(``));
910
903
  };
911
- var Tn = (e2, t2 = false) => t2 ? bn(wn(e2)) : wn(e2);
912
- var En = (e2) => {
904
+ var wn = (e2, t2 = false) => t2 ? yn(Cn(e2)) : Cn(e2);
905
+ var Tn = (e2) => {
913
906
  if (e2.length < 2) {
914
907
  var t2 = e2.charCodeAt(0);
915
908
  return t2 < 128 ? e2 : t2 < 2048 ? G(192 | t2 >>> 6) + G(128 | t2 & 63) : G(224 | t2 >>> 12 & 15) + G(128 | t2 >>> 6 & 63) + G(128 | t2 & 63);
@@ -917,12 +910,12 @@ var En = (e2) => {
917
910
  var t2 = 65536 + (e2.charCodeAt(0) - 55296) * 1024 + (e2.charCodeAt(1) - 56320);
918
911
  return G(240 | t2 >>> 18 & 7) + G(128 | t2 >>> 12 & 63) + G(128 | t2 >>> 6 & 63) + G(128 | t2 & 63);
919
912
  };
920
- var Dn = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;
921
- var On = (e2) => e2.replace(Dn, En);
922
- var kn = pn ? (e2) => Buffer.from(e2, `utf8`).toString(`base64`) : hn ? (e2) => wn(hn.encode(e2)) : (e2) => Cn(On(e2));
923
- var An = (e2, t2 = false) => t2 ? bn(kn(e2)) : kn(e2);
924
- var jn = (e2) => An(e2, true);
925
- var K = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;
913
+ var En = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;
914
+ var Dn = (e2) => e2.replace(En, Tn);
915
+ var On = pn ? (e2) => Buffer.from(e2, `utf8`).toString(`base64`) : hn ? (e2) => Cn(hn.encode(e2)) : (e2) => Sn(Dn(e2));
916
+ var kn = (e2, t2 = false) => t2 ? yn(On(e2)) : On(e2);
917
+ var An = (e2) => kn(e2, true);
918
+ var jn = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;
926
919
  var Mn = (e2) => {
927
920
  switch (e2.length) {
928
921
  case 4:
@@ -934,7 +927,7 @@ var Mn = (e2) => {
934
927
  return G((31 & e2.charCodeAt(0)) << 6 | 63 & e2.charCodeAt(1));
935
928
  }
936
929
  };
937
- var Nn = (e2) => e2.replace(K, Mn);
930
+ var Nn = (e2) => e2.replace(jn, Mn);
938
931
  var Pn = (e2) => {
939
932
  if (e2 = e2.replace(/\s+/g, ``), !vn.test(e2)) throw TypeError(`malformed base64.`);
940
933
  e2 += `==`.slice(2 - (e2.length & 3));
@@ -942,11 +935,11 @@ var Pn = (e2) => {
942
935
  for (let a2 = 0; a2 < e2.length; ) t2 = _n[e2.charAt(a2++)] << 18 | _n[e2.charAt(a2++)] << 12 | (n2 = _n[e2.charAt(a2++)]) << 6 | (r2 = _n[e2.charAt(a2++)]), n2 === 64 ? i2.push(G(t2 >> 16 & 255)) : r2 === 64 ? i2.push(G(t2 >> 16 & 255, t2 >> 8 & 255)) : i2.push(G(t2 >> 16 & 255, t2 >> 8 & 255, t2 & 255));
943
936
  return i2.join(``);
944
937
  };
945
- var Fn = typeof atob == `function` ? (e2) => atob(xn(e2)) : pn ? (e2) => Buffer.from(e2, `base64`).toString(`binary`) : Pn;
946
- var In = pn ? (e2) => yn(Buffer.from(e2, `base64`)) : (e2) => yn(Fn(e2).split(``).map((e3) => e3.charCodeAt(0)));
938
+ var Fn = typeof atob == `function` ? (e2) => atob(bn(e2)) : pn ? (e2) => Buffer.from(e2, `base64`).toString(`binary`) : Pn;
939
+ var In = pn ? (e2) => K(Buffer.from(e2, `base64`)) : (e2) => K(Fn(e2).split(``).map((e3) => e3.charCodeAt(0)));
947
940
  var Ln = (e2) => In(zn(e2));
948
941
  var Rn = pn ? (e2) => Buffer.from(e2, `base64`).toString(`utf8`) : mn ? (e2) => mn.decode(In(e2)) : (e2) => Nn(Fn(e2));
949
- var zn = (e2) => xn(e2.replace(/[-_]/g, (e3) => e3 == `-` ? `+` : `/`));
942
+ var zn = (e2) => bn(e2.replace(/[-_]/g, (e3) => e3 == `-` ? `+` : `/`));
950
943
  var Bn = (e2) => Rn(zn(e2));
951
944
  var Vn = (e2) => {
952
945
  if (typeof e2 != `string`) return false;
@@ -959,11 +952,11 @@ var Un = function() {
959
952
  e2(`fromBase64`, function() {
960
953
  return Bn(this);
961
954
  }), e2(`toBase64`, function(e3) {
962
- return An(this, e3);
955
+ return kn(this, e3);
963
956
  }), e2(`toBase64URI`, function() {
964
- return An(this, true);
957
+ return kn(this, true);
965
958
  }), e2(`toBase64URL`, function() {
966
- return An(this, true);
959
+ return kn(this, true);
967
960
  }), e2(`toUint8Array`, function() {
968
961
  return Ln(this);
969
962
  });
@@ -971,14 +964,14 @@ var Un = function() {
971
964
  var Wn = function() {
972
965
  let e2 = (e3, t2) => Object.defineProperty(Uint8Array.prototype, e3, Hn(t2));
973
966
  e2(`toBase64`, function(e3) {
974
- return Tn(this, e3);
967
+ return wn(this, e3);
975
968
  }), e2(`toBase64URI`, function() {
976
- return Tn(this, true);
969
+ return wn(this, true);
977
970
  }), e2(`toBase64URL`, function() {
978
- return Tn(this, true);
971
+ return wn(this, true);
979
972
  });
980
973
  };
981
- var Gn = { version: dn, VERSION: fn, atob: Fn, atobPolyfill: Pn, btoa: Cn, btoaPolyfill: Sn, fromBase64: Bn, toBase64: An, encode: An, encodeURI: jn, encodeURL: jn, utob: On, btou: Nn, decode: Bn, isValid: Vn, fromUint8Array: Tn, toUint8Array: Ln, extendString: Un, extendUint8Array: Wn, extendBuiltins: () => {
974
+ var Gn = { version: dn, VERSION: fn, atob: Fn, atobPolyfill: Pn, btoa: Sn, btoaPolyfill: xn, fromBase64: Bn, toBase64: kn, encode: kn, encodeURI: An, encodeURL: An, utob: Dn, btou: Nn, decode: Bn, isValid: Vn, fromUint8Array: wn, toUint8Array: Ln, extendString: Un, extendUint8Array: Wn, extendBuiltins: () => {
982
975
  Un(), Wn();
983
976
  } };
984
977
  var q = Uint8Array;
@@ -1567,22 +1560,22 @@ function ra(e2, t2) {
1567
1560
  var ia = [{ path: `bookingPolicyViolations.earliestBookingDate` }];
1568
1561
  var aa = [{ path: `timeSlots.bookingPolicyViolations.earliestBookingDate` }];
1569
1562
  function oa(e2) {
1570
- return Ct(Object.assign(e2, { domainToMappings: { "www.wixapis.com": [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }], "*.dev.wix-code.com": [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }], "manage._base_domain_": [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }], "www._base_domain_": [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }], _: [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }], "editor._base_domain_": [{ srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }], "blocks._base_domain_": [{ srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }], "create.editorx": [{ srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }], "editor.wixapps.net": [{ srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }] } }));
1563
+ return St(Object.assign(e2, { domainToMappings: { "www.wixapis.com": [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }], "*.dev.wix-code.com": [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }], "manage._base_domain_": [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }], "www._base_domain_": [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }], _: [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }], "editor._base_domain_": [{ srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }], "blocks._base_domain_": [{ srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }], "create.editorx": [{ srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }], "editor.wixapps.net": [{ srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }] } }));
1571
1564
  }
1572
1565
  var sa = `@wix/auto_sdk_bookings_availability-time-slots`;
1573
1566
  function ca(e2) {
1574
1567
  function t2({ host: t3 }) {
1575
- let n2 = tt(e2, [{ transformFn: z, paths: ia }]);
1568
+ let n2 = tt(e2, [{ transformFn: He, paths: ia }]);
1576
1569
  return { entityFqdn: `wix.bookings.availability.v2.time_slot`, method: `POST`, methodFqn: `com.wixpress.bookings.availability.v2.AvailabilityTimeSlots.ListAvailabilityTimeSlots`, packageName: sa, migrationOptions: { optInTransformResponse: true }, url: oa({ protoPath: `/v2/time-slots`, data: n2, host: t3 }), data: n2, transformResponse: (e3) => tt(e3, [{ transformFn: Ue, paths: aa }]) };
1577
1570
  }
1578
1571
  return t2;
1579
1572
  }
1580
1573
  async function la(e2) {
1581
- let { httpClient: t2, sideEffects: n2 } = arguments[1], r2 = ca(R({ serviceId: e2?.serviceId, fromLocalDate: e2?.fromLocalDate, toLocalDate: e2?.toLocalDate, timeZone: e2?.timeZone, locations: e2?.locations, includeResourceTypeIds: e2?.includeResourceTypeIds, bookable: e2?.bookable, bookingPolicyViolations: e2?.bookingPolicyViolations, timeSlotsPerDay: e2?.timeSlotsPerDay, cursorPaging: e2?.cursorPaging, customerChoices: e2?.customerChoices, resourceTypes: e2?.resourceTypes }));
1574
+ let { httpClient: t2, sideEffects: n2 } = arguments[1], r2 = ca(Be({ serviceId: e2?.serviceId, fromLocalDate: e2?.fromLocalDate, toLocalDate: e2?.toLocalDate, timeZone: e2?.timeZone, locations: e2?.locations, includeResourceTypeIds: e2?.includeResourceTypeIds, bookable: e2?.bookable, bookingPolicyViolations: e2?.bookingPolicyViolations, timeSlotsPerDay: e2?.timeSlotsPerDay, cursorPaging: e2?.cursorPaging, customerChoices: e2?.customerChoices, resourceTypes: e2?.resourceTypes }));
1582
1575
  n2?.onSiteCall?.();
1583
1576
  try {
1584
1577
  let e3 = await t2.request(r2);
1585
- return n2?.onSuccess?.(e3), He(e3.data);
1578
+ return n2?.onSuccess?.(e3), Ve(e3.data);
1586
1579
  } catch (e3) {
1587
1580
  let t3 = ut(e3, { spreadPathsToArguments: {}, explicitPathsToArguments: { serviceId: `$[0].serviceId`, fromLocalDate: `$[0].fromLocalDate`, toLocalDate: `$[0].toLocalDate`, timeZone: `$[0].timeZone`, locations: `$[0].locations`, includeResourceTypeIds: `$[0].includeResourceTypeIds`, bookable: `$[0].bookable`, bookingPolicyViolations: `$[0].bookingPolicyViolations`, timeSlotsPerDay: `$[0].timeSlotsPerDay`, cursorPaging: `$[0].cursorPaging`, customerChoices: `$[0].customerChoices`, resourceTypes: `$[0].resourceTypes` }, singleArgumentUnchanged: false }, [`options`]);
1588
1581
  throw n2?.onError?.(e3), t3;
@@ -1591,26 +1584,26 @@ async function la(e2) {
1591
1584
  function ua(e2) {
1592
1585
  return (t2) => la(t2, { httpClient: e2 });
1593
1586
  }
1594
- var da = xt(ua);
1587
+ var da = H(ua);
1595
1588
  var fa = [{ path: `bookingPolicyViolations.earliestBookingDate` }];
1596
1589
  var pa = [{ path: `timeSlots.bookingPolicyViolations.earliestBookingDate` }, { path: `schedulesInfo.firstSessionStart` }, { path: `schedulesInfo.lastSessionEnd` }, { path: `schedulesInfo.enrollmentViolations.earliestBookingDate` }];
1597
1590
  function ma(e2) {
1598
- return Ct(Object.assign(e2, { domainToMappings: { "www.wixapis.com": [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }], "*.dev.wix-code.com": [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }], "manage._base_domain_": [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }], "www._base_domain_": [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }], _: [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }], "editor._base_domain_": [{ srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }], "blocks._base_domain_": [{ srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }], "create.editorx": [{ srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }], "editor.wixapps.net": [{ srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }] } }));
1591
+ return St(Object.assign(e2, { domainToMappings: { "www.wixapis.com": [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }], "*.dev.wix-code.com": [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }], "manage._base_domain_": [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }], "www._base_domain_": [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }], _: [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }], "editor._base_domain_": [{ srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }], "blocks._base_domain_": [{ srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }], "create.editorx": [{ srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }], "editor.wixapps.net": [{ srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }] } }));
1599
1592
  }
1600
1593
  var ha = `@wix/auto_sdk_bookings_event-time-slots`;
1601
1594
  function ga(e2) {
1602
1595
  function t2({ host: t3 }) {
1603
- let n2 = tt(e2, [{ transformFn: z, paths: fa }]);
1596
+ let n2 = tt(e2, [{ transformFn: He, paths: fa }]);
1604
1597
  return { entityFqdn: `wix.bookings.availability.v2.time_slot`, method: `POST`, methodFqn: `com.wixpress.bookings.availability.v2.EventTimeSlots.ListEventTimeSlots`, packageName: ha, migrationOptions: { optInTransformResponse: true }, url: ma({ protoPath: `/v2/time-slots/event`, data: n2, host: t3 }), data: n2, transformResponse: (e3) => tt(e3, [{ transformFn: Ue, paths: pa }]) };
1605
1598
  }
1606
1599
  return t2;
1607
1600
  }
1608
1601
  async function _a(e2) {
1609
- let { httpClient: t2, sideEffects: n2 } = arguments[1], r2 = ga(R({ fromLocalDate: e2?.fromLocalDate, toLocalDate: e2?.toLocalDate, timeZone: e2?.timeZone, serviceIds: e2?.serviceIds, includeNonBookable: e2?.includeNonBookable, minBookableCapacity: e2?.minBookableCapacity, eventFilter: e2?.eventFilter, maxSlotsPerDay: e2?.maxSlotsPerDay, cursorPaging: e2?.cursorPaging, bookingPolicyViolations: e2?.bookingPolicyViolations }));
1602
+ let { httpClient: t2, sideEffects: n2 } = arguments[1], r2 = ga(Be({ fromLocalDate: e2?.fromLocalDate, toLocalDate: e2?.toLocalDate, timeZone: e2?.timeZone, serviceIds: e2?.serviceIds, includeNonBookable: e2?.includeNonBookable, minBookableCapacity: e2?.minBookableCapacity, eventFilter: e2?.eventFilter, maxSlotsPerDay: e2?.maxSlotsPerDay, cursorPaging: e2?.cursorPaging, bookingPolicyViolations: e2?.bookingPolicyViolations }));
1610
1603
  n2?.onSiteCall?.();
1611
1604
  try {
1612
1605
  let e3 = await t2.request(r2);
1613
- return n2?.onSuccess?.(e3), He(e3.data);
1606
+ return n2?.onSuccess?.(e3), Ve(e3.data);
1614
1607
  } catch (e3) {
1615
1608
  let t3 = ut(e3, { spreadPathsToArguments: {}, explicitPathsToArguments: { fromLocalDate: `$[0].fromLocalDate`, toLocalDate: `$[0].toLocalDate`, timeZone: `$[0].timeZone`, serviceIds: `$[0].serviceIds`, includeNonBookable: `$[0].includeNonBookable`, minBookableCapacity: `$[0].minBookableCapacity`, eventFilter: `$[0].eventFilter`, maxSlotsPerDay: `$[0].maxSlotsPerDay`, cursorPaging: `$[0].cursorPaging`, bookingPolicyViolations: `$[0].bookingPolicyViolations` }, singleArgumentUnchanged: false }, [`options`]);
1616
1609
  throw n2?.onError?.(e3), t3;
@@ -1619,26 +1612,26 @@ async function _a(e2) {
1619
1612
  function va(e2) {
1620
1613
  return (t2) => _a(t2, { httpClient: e2 });
1621
1614
  }
1622
- var ya = xt(va);
1615
+ var ya = H(va);
1623
1616
  var ba = [{ path: `bookingPolicyViolations.earliestBookingDate` }];
1624
1617
  var xa = [{ path: `timeSlots.bookingPolicyViolations.earliestBookingDate` }];
1625
1618
  function Sa(e2) {
1626
- return Ct(Object.assign(e2, { domainToMappings: { "www.wixapis.com": [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }], "*.dev.wix-code.com": [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }], "manage._base_domain_": [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }], "www._base_domain_": [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }], _: [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }], "editor._base_domain_": [{ srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }], "blocks._base_domain_": [{ srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }], "create.editorx": [{ srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }], "editor.wixapps.net": [{ srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }] } }));
1619
+ return St(Object.assign(e2, { domainToMappings: { "www.wixapis.com": [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }], "*.dev.wix-code.com": [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }], "manage._base_domain_": [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }], "www._base_domain_": [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }], _: [{ srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }], "editor._base_domain_": [{ srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }], "blocks._base_domain_": [{ srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }], "create.editorx": [{ srcPath: `/_api/service-availability/v2/multi-service-time-slots`, destPath: `/v2/multi-service-time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots`, destPath: `/v2/time-slots` }, { srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }], "editor.wixapps.net": [{ srcPath: `/_api/service-availability/v2/time-slots/event`, destPath: `/v2/time-slots/event` }] } }));
1627
1620
  }
1628
1621
  var Ca = `@wix/auto_sdk_bookings_multi-service-availability-time-slots`;
1629
1622
  function wa(e2) {
1630
1623
  function t2({ host: t3 }) {
1631
- let n2 = tt(e2, [{ transformFn: z, paths: ba }]);
1624
+ let n2 = tt(e2, [{ transformFn: He, paths: ba }]);
1632
1625
  return { entityFqdn: `wix.bookings.availability.v2.time_slot`, method: `POST`, methodFqn: `com.wixpress.bookings.availability.v2.MultiServiceAvailabilityTimeSlots.ListMultiServiceAvailabilityTimeSlots`, packageName: Ca, migrationOptions: { optInTransformResponse: true }, url: Sa({ protoPath: `/v2/multi-service-time-slots`, data: n2, host: t3 }), data: n2, transformResponse: (e3) => tt(e3, [{ transformFn: Ue, paths: xa }]) };
1633
1626
  }
1634
1627
  return t2;
1635
1628
  }
1636
1629
  async function Ta(e2) {
1637
- let { httpClient: t2, sideEffects: n2 } = arguments[1], r2 = wa(R({ services: e2?.services, fromLocalDate: e2?.fromLocalDate, toLocalDate: e2?.toLocalDate, timeZone: e2?.timeZone, location: e2?.location, bookable: e2?.bookable, bookingPolicyViolations: e2?.bookingPolicyViolations, timeSlotsPerDay: e2?.timeSlotsPerDay, cursorPaging: e2?.cursorPaging }));
1630
+ let { httpClient: t2, sideEffects: n2 } = arguments[1], r2 = wa(Be({ services: e2?.services, fromLocalDate: e2?.fromLocalDate, toLocalDate: e2?.toLocalDate, timeZone: e2?.timeZone, location: e2?.location, bookable: e2?.bookable, bookingPolicyViolations: e2?.bookingPolicyViolations, timeSlotsPerDay: e2?.timeSlotsPerDay, cursorPaging: e2?.cursorPaging }));
1638
1631
  n2?.onSiteCall?.();
1639
1632
  try {
1640
1633
  let e3 = await t2.request(r2);
1641
- return n2?.onSuccess?.(e3), He(e3.data);
1634
+ return n2?.onSuccess?.(e3), Ve(e3.data);
1642
1635
  } catch (e3) {
1643
1636
  let t3 = ut(e3, { spreadPathsToArguments: {}, explicitPathsToArguments: { services: `$[0].services`, fromLocalDate: `$[0].fromLocalDate`, toLocalDate: `$[0].toLocalDate`, timeZone: `$[0].timeZone`, location: `$[0].location`, bookable: `$[0].bookable`, bookingPolicyViolations: `$[0].bookingPolicyViolations`, timeSlotsPerDay: `$[0].timeSlotsPerDay`, cursorPaging: `$[0].cursorPaging` }, singleArgumentUnchanged: false }, [`options`]);
1644
1637
  throw n2?.onError?.(e3), t3;
@@ -1647,28 +1640,28 @@ async function Ta(e2) {
1647
1640
  function Ea(e2) {
1648
1641
  return (t2) => Ta(t2, { httpClient: e2 });
1649
1642
  }
1650
- var Da = xt(Ea);
1643
+ var Da = H(Ea);
1651
1644
  var Oa = ((e2) => (e2.UNKNOWN = `UNKNOWN`, e2.CUSTOM = `CUSTOM`, e2.STAFF_MEMBER = `STAFF_MEMBER`, e2.DURATION = `DURATION`, e2.DATE_TIME = `DATE_TIME`, e2.NUMBER_OF_PARTICIPANTS = `NUMBER_OF_PARTICIPANTS`, e2.LOCATION = `LOCATION`, e2.DURATION_RANGE = `DURATION_RANGE`, e2))(Oa || {});
1652
1645
  var ka = ((e2) => (e2.APPOINTMENT = `APPOINTMENT`, e2.CLASS = `CLASS`, e2.COURSE = `COURSE`, e2))(ka || {});
1653
1646
  var Aa = ((e2) => (e2.FIXED = `FIXED`, e2.CUSTOM = `CUSTOM`, e2.VARIED = `VARIED`, e2.NO_FEE = `NO_FEE`, e2.SUBSCRIPTION = `SUBSCRIPTION`, e2))(Aa || {});
1654
1647
  var ja = ((e2) => (e2.CUSTOM = `CUSTOM`, e2.BUSINESS = `BUSINESS`, e2.CUSTOMER = `CUSTOMER`, e2))(ja || {});
1655
1648
  var Ma = [{ path: `timeSlotsConfiguration.createdDate` }, { path: `timeSlotsConfiguration.updatedDate` }];
1656
1649
  function Na(e2) {
1657
- return Ct(Object.assign(e2, { domainToMappings: { _: [{ srcPath: `/_api/time-slots-config`, destPath: `` }], "manage._base_domain_": [{ srcPath: `/_api/time-slots-config`, destPath: `` }], "editor._base_domain_": [{ srcPath: `/_api/time-slots-config`, destPath: `` }], "blocks._base_domain_": [{ srcPath: `/_api/time-slots-config`, destPath: `` }], "create.editorx": [{ srcPath: `/_api/time-slots-config`, destPath: `` }], "apps._base_domain_": [{ srcPath: `/_api/time-slots-config`, destPath: `` }], "*.dev.wix-code.com": [{ srcPath: `/_api/time-slots-config`, destPath: `` }], "www.wixapis.com": [{ srcPath: `/_api/time-slots-config`, destPath: `` }] } }));
1650
+ return St(Object.assign(e2, { domainToMappings: { _: [{ srcPath: `/_api/time-slots-config`, destPath: `` }], "manage._base_domain_": [{ srcPath: `/_api/time-slots-config`, destPath: `` }], "editor._base_domain_": [{ srcPath: `/_api/time-slots-config`, destPath: `` }], "blocks._base_domain_": [{ srcPath: `/_api/time-slots-config`, destPath: `` }], "create.editorx": [{ srcPath: `/_api/time-slots-config`, destPath: `` }], "apps._base_domain_": [{ srcPath: `/_api/time-slots-config`, destPath: `` }], "*.dev.wix-code.com": [{ srcPath: `/_api/time-slots-config`, destPath: `` }], "www.wixapis.com": [{ srcPath: `/_api/time-slots-config`, destPath: `` }] } }));
1658
1651
  }
1659
1652
  var Pa = `@wix/auto_sdk_bookings_time-slots-configuration`;
1660
1653
  function Fa(e2) {
1661
1654
  function t2({ host: t3 }) {
1662
- return { entityFqdn: `wix.bookings.timeslots_configuration.v1.time_slots_configuration`, method: `GET`, methodFqn: `wix.bookings.timeslots.configuration.v1.TimeSlotsConfigurationService.GetTimeSlotsConfigurationByAppId`, packageName: Pa, migrationOptions: { optInTransformResponse: true }, url: Na({ protoPath: `/v1/time-slots-configurations/app/{appId}`, data: e2, host: t3 }), params: St(e2), transformResponse: (e3) => tt(e3, [{ transformFn: Ue, paths: Ma }]) };
1655
+ return { entityFqdn: `wix.bookings.timeslots_configuration.v1.time_slots_configuration`, method: `GET`, methodFqn: `wix.bookings.timeslots.configuration.v1.TimeSlotsConfigurationService.GetTimeSlotsConfigurationByAppId`, packageName: Pa, migrationOptions: { optInTransformResponse: true }, url: Na({ protoPath: `/v1/time-slots-configurations/app/{appId}`, data: e2, host: t3 }), params: xt(e2), transformResponse: (e3) => tt(e3, [{ transformFn: Ue, paths: Ma }]) };
1663
1656
  }
1664
1657
  return t2;
1665
1658
  }
1666
1659
  async function Ia(e2) {
1667
- let { httpClient: t2, sideEffects: n2 } = arguments[1], r2 = Fa(R({ appId: e2 }));
1660
+ let { httpClient: t2, sideEffects: n2 } = arguments[1], r2 = Fa(Be({ appId: e2 }));
1668
1661
  n2?.onSiteCall?.();
1669
1662
  try {
1670
1663
  let e3 = await t2.request(r2);
1671
- return n2?.onSuccess?.(e3), He(e3.data);
1664
+ return n2?.onSuccess?.(e3), Ve(e3.data);
1672
1665
  } catch (e3) {
1673
1666
  let t3 = ut(e3, { spreadPathsToArguments: {}, explicitPathsToArguments: { appId: `$[0]` }, singleArgumentUnchanged: false }, [`appId`]);
1674
1667
  throw n2?.onError?.(e3), t3;
@@ -1677,26 +1670,26 @@ async function Ia(e2) {
1677
1670
  function La(e2) {
1678
1671
  return (t2) => Ia(t2, { httpClient: e2 });
1679
1672
  }
1680
- var Ra = xt(La);
1673
+ var Ra = H(La);
1681
1674
  var za = [{ path: `bookingsSettings.createdDate` }, { path: `bookingsSettings.updatedDate` }];
1682
1675
  var Ba = [{ path: `bookingsSettings.siteProperties.address.coordinates.latitude` }, { path: `bookingsSettings.siteProperties.address.coordinates.longitude` }];
1683
1676
  function Va(e2) {
1684
- return Ct(Object.assign(e2, { domainToMappings: { "manage._base_domain_": [{ srcPath: `/_api/bookings-settings`, destPath: `` }], "dev._base_domain_": [{ srcPath: `/_api/bookings-settings`, destPath: `` }], "*.dev.wix-code.com": [{ srcPath: `/_api/bookings-settings`, destPath: `` }], "www.wixapis.com": [{ srcPath: `/_api/bookings-settings`, destPath: `` }], _: [{ srcPath: `/_api/bookings-settings`, destPath: `` }], "api._api_base_domain_": [{ srcPath: `/bookings-settings`, destPath: `` }], "editor._base_domain_": [{ srcPath: `/_api/bookings-settings`, destPath: `` }], "blocks._base_domain_": [{ srcPath: `/_api/bookings-settings`, destPath: `` }], "create.editorx": [{ srcPath: `/_api/bookings-settings`, destPath: `` }], "editor.wixapps.net": [{ srcPath: `/_api/bookings-settings`, destPath: `` }], "www._base_domain_": [{ srcPath: `/_api/bookings-settings`, destPath: `` }] } }));
1677
+ return St(Object.assign(e2, { domainToMappings: { "manage._base_domain_": [{ srcPath: `/_api/bookings-settings`, destPath: `` }], "dev._base_domain_": [{ srcPath: `/_api/bookings-settings`, destPath: `` }], "*.dev.wix-code.com": [{ srcPath: `/_api/bookings-settings`, destPath: `` }], "www.wixapis.com": [{ srcPath: `/_api/bookings-settings`, destPath: `` }], _: [{ srcPath: `/_api/bookings-settings`, destPath: `` }], "api._api_base_domain_": [{ srcPath: `/bookings-settings`, destPath: `` }], "editor._base_domain_": [{ srcPath: `/_api/bookings-settings`, destPath: `` }], "blocks._base_domain_": [{ srcPath: `/_api/bookings-settings`, destPath: `` }], "create.editorx": [{ srcPath: `/_api/bookings-settings`, destPath: `` }], "editor.wixapps.net": [{ srcPath: `/_api/bookings-settings`, destPath: `` }], "www._base_domain_": [{ srcPath: `/_api/bookings-settings`, destPath: `` }] } }));
1685
1678
  }
1686
1679
  var Ha = `@wix/auto_sdk_bookings_bookings-settings`;
1687
1680
  function Ua(e2) {
1688
1681
  function t2({ host: t3 }) {
1689
- return { entityFqdn: `wix.bookings.v2.bookings_settings`, method: `GET`, methodFqn: `wix.bookings.settings.v2.BookingsSettingsService.GetBookingsSettings`, packageName: Ha, migrationOptions: { optInTransformResponse: true }, url: Va({ protoPath: `/v2/settings`, data: e2, host: t3 }), params: St(e2), transformResponse: (e3) => tt(e3, [{ transformFn: Ue, paths: za }, { transformFn: U, paths: Ba }]), fallback: [{ method: `GET`, url: Va({ protoPath: `/v2/settings`, data: e2, host: t3 }), params: St(e2) }] };
1682
+ return { entityFqdn: `wix.bookings.v2.bookings_settings`, method: `GET`, methodFqn: `wix.bookings.settings.v2.BookingsSettingsService.GetBookingsSettings`, packageName: Ha, migrationOptions: { optInTransformResponse: true }, url: Va({ protoPath: `/v2/settings`, data: e2, host: t3 }), params: xt(e2), transformResponse: (e3) => tt(e3, [{ transformFn: Ue, paths: za }, { transformFn: qt, paths: Ba }]), fallback: [{ method: `GET`, url: Va({ protoPath: `/v2/settings`, data: e2, host: t3 }), params: xt(e2) }] };
1690
1683
  }
1691
1684
  return t2;
1692
1685
  }
1693
1686
  var Wa = ((e2) => (e2.BUSINESS_TIME_ZONE = `BUSINESS_TIME_ZONE`, e2.CUSTOMER_TIME_ZONE = `CUSTOMER_TIME_ZONE`, e2))(Wa || {});
1694
1687
  async function Ga() {
1695
- let { httpClient: e2, sideEffects: t2 } = arguments[0], n2 = Ua(R({}));
1688
+ let { httpClient: e2, sideEffects: t2 } = arguments[0], n2 = Ua(Be({}));
1696
1689
  t2?.onSiteCall?.();
1697
1690
  try {
1698
1691
  let r2 = await e2.request(n2);
1699
- return t2?.onSuccess?.(r2), He(r2.data)?.bookingsSettings;
1692
+ return t2?.onSuccess?.(r2), Ve(r2.data)?.bookingsSettings;
1700
1693
  } catch (e3) {
1701
1694
  let n3 = ut(e3, { spreadPathsToArguments: {}, explicitPathsToArguments: {}, singleArgumentUnchanged: false }, []);
1702
1695
  throw t2?.onError?.(e3), n3;
@@ -1705,7 +1698,7 @@ async function Ga() {
1705
1698
  function Ka(e2) {
1706
1699
  return () => Ga({ httpClient: e2 });
1707
1700
  }
1708
- var qa = xt(Ka);
1701
+ var qa = H(Ka);
1709
1702
  function Ja(e2) {
1710
1703
  return e2.business?._id ?? null;
1711
1704
  }
@@ -1862,7 +1855,7 @@ var To = class {
1862
1855
  };
1863
1856
  var Eo = (e2) => new To(e2);
1864
1857
  var Do = wo({ getMonitoringClient: (e2) => () => e2.getMonitoringClient ? e2.getMonitoringClient() : Eo(`Host monitoring client is not available on the current host. Make sure to use an updated version of the host initialization package.`) });
1865
- var $ = { service: `service`, services: `services`, categories: `categories`, locations: `locations`, sessions: `sessions`, timeSlots: `time-slots`, serviceAddOns: `service-addons`, bookingsSettings: `bookings-settings`, serviceCta: `service-cta`, preferences: `preferences`, bookingSummary: `booking-summary`, bookingCheckout: `booking-checkout`, formValues: `form-values`, paymentOptions: `payment-options`, seo: `seo`, warmup: `warmup`, reschedule: `reschedule` };
1858
+ var $ = { service: `service`, services: `services`, categories: `categories`, locations: `locations`, sessions: `sessions`, timeSlots: `time-slots`, serviceAddOns: `service-addons`, bookingsSettings: `bookings-settings`, serviceCta: `service-cta`, preferences: `preferences`, bookingSummary: `booking-summary`, bookingCheckout: `booking-checkout`, formValues: `form-values`, paymentOptions: `payment-options`, seo: `seo`, warmup: `warmup`, reschedule: `reschedule`, intakeForms: `intake-forms` };
1866
1859
  function Oo(e2) {
1867
1860
  try {
1868
1861
  let t2 = Do.getMonitoringClient?.();
@@ -1893,81 +1886,79 @@ function Mo(e2) {
1893
1886
  function No(e2) {
1894
1887
  return Mo({ bookableCapacity: e2.bookableCapacity ?? null, remainingCapacity: e2.remainingCapacity ?? null, waitlistCapacity: e2.eventInfo?.waitingList?.remainingCapacity ?? null, tooEarlyToBook: e2.bookingPolicyViolations?.tooEarlyToBook ?? false, tooLateToBook: e2.bookingPolicyViolations?.tooLateToBook ?? false });
1895
1888
  }
1896
- var Po = (e2) => {
1897
- let t2 = (e3) => e3 < 10 ? `0${e3}` : `${e3}`;
1898
- return `${e2.getFullYear()}-${t2(e2.getMonth() + 1)}-${t2(e2.getDate())}`;
1899
- };
1900
- var Fo = (e2) => /* @__PURE__ */ new Date(`${e2}T00:00:00`);
1901
- var Io = (e2, t2) => new Intl.DateTimeFormat(`en-CA`, { year: `numeric`, month: `2-digit`, day: `2-digit`, ...t2 ? { timeZone: t2 } : {} }).format(e2);
1902
- var Lo = (e2) => `${Po(e2)}T00:00:00`;
1903
- var Ro = (e2) => `${Po(e2)}T23:59:59`;
1904
- function zo(e2, t2) {
1905
- return `${Io(e2, t2)}T${new Intl.DateTimeFormat(`en-GB`, { timeZone: t2, hourCycle: `h23`, hour: `2-digit`, minute: `2-digit`, second: `2-digit` }).format(e2)}`;
1906
- }
1889
+ var Po = (e2) => e2 < 10 ? `0${e2}` : `${e2}`;
1890
+ var Fo = (e2) => `${e2.getFullYear()}-${Po(e2.getMonth() + 1)}-${Po(e2.getDate())}`;
1891
+ var Io = (e2) => /* @__PURE__ */ new Date(`${e2}T00:00:00`);
1892
+ var Lo = (e2, t2) => new Intl.DateTimeFormat(`en-CA`, { year: `numeric`, month: `2-digit`, day: `2-digit`, ...t2 ? { timeZone: t2 } : {} }).format(e2);
1893
+ var Ro = (e2) => `${Fo(e2)}T00:00:00`;
1894
+ var zo = (e2) => `${Fo(e2)}T23:59:59`;
1907
1895
  function Bo(e2, t2) {
1908
- let n2 = zo(new Date(Date.now()), t2);
1909
- return n2.slice(0, 10) === e2 ? n2 : `${e2}T00:00:00`;
1896
+ return `${Lo(e2, t2)}T${new Intl.DateTimeFormat(`en-GB`, { timeZone: t2, hourCycle: `h23`, hour: `2-digit`, minute: `2-digit`, second: `2-digit` }).format(e2)}`;
1910
1897
  }
1911
- var Vo = /^\d{4}-\d{2}-\d{2}$/;
1912
- var Ho = 864e5;
1913
- function Uo(e2) {
1914
- if (typeof e2 != `string` || !Vo.test(e2)) return false;
1915
- let t2 = Fo(e2);
1916
- return !Number.isNaN(t2.getTime()) && Po(t2) === e2;
1898
+ function Vo(e2, t2) {
1899
+ let n2 = Bo(new Date(Date.now()), t2);
1900
+ return n2.slice(0, 10) === e2 ? n2 : `${e2}T00:00:00`;
1917
1901
  }
1902
+ var Ho = /^\d{4}-\d{2}-\d{2}$/;
1903
+ var Uo = 864e5;
1918
1904
  function Wo(e2) {
1905
+ if (typeof e2 != `string` || !Ho.test(e2)) return false;
1906
+ let t2 = Io(e2);
1907
+ return !Number.isNaN(t2.getTime()) && Fo(t2) === e2;
1908
+ }
1909
+ function Go(e2) {
1919
1910
  if (!e2 || typeof e2 != `object`) return false;
1920
1911
  let { startDate: t2, endDate: n2 } = e2;
1921
- return Uo(t2) && Uo(n2) && t2 <= n2;
1912
+ return Wo(t2) && Wo(n2) && t2 <= n2;
1922
1913
  }
1923
- function Go(e2, t2) {
1924
- let n2 = Fo(e2);
1925
- return n2.setDate(n2.getDate() + t2), Po(n2);
1914
+ function Ko(e2, t2) {
1915
+ let n2 = Io(e2);
1916
+ return n2.setDate(n2.getDate() + t2), Fo(n2);
1926
1917
  }
1927
- function Ko({ startDate: e2, endDate: t2 }) {
1928
- let n2 = Fo(t2).getTime() - Fo(e2).getTime();
1929
- return Math.round(n2 / Ho) + 1;
1918
+ function qo({ startDate: e2, endDate: t2 }) {
1919
+ let n2 = Io(t2).getTime() - Io(e2).getTime();
1920
+ return Math.round(n2 / Uo) + 1;
1930
1921
  }
1931
- function qo(e2) {
1932
- let t2 = Fo(e2), n2 = new Date(t2.getFullYear(), t2.getMonth(), 1), r2 = new Date(t2.getFullYear(), t2.getMonth() + 1, 0);
1933
- return { startDate: Po(n2), endDate: Po(r2) };
1922
+ function Jo(e2) {
1923
+ let t2 = Io(e2), n2 = new Date(t2.getFullYear(), t2.getMonth(), 1), r2 = new Date(t2.getFullYear(), t2.getMonth() + 1, 0);
1924
+ return { startDate: Fo(n2), endDate: Fo(r2) };
1934
1925
  }
1935
- function Jo(e2, t2) {
1926
+ function Yo(e2, t2) {
1936
1927
  return e2 >= t2.startDate && e2 <= t2.endDate;
1937
1928
  }
1938
- function Yo(e2) {
1939
- let t2 = Fo(e2), n2 = new Date(t2.getFullYear(), t2.getMonth() + 2, 0).getDate(), r2 = Math.min(t2.getDate(), n2);
1940
- return Po(new Date(t2.getFullYear(), t2.getMonth() + 1, r2));
1941
- }
1942
1929
  function Xo(e2) {
1930
+ let t2 = Io(e2), n2 = new Date(t2.getFullYear(), t2.getMonth() + 2, 0).getDate(), r2 = Math.min(t2.getDate(), n2);
1931
+ return Fo(new Date(t2.getFullYear(), t2.getMonth() + 1, r2));
1932
+ }
1933
+ function Zo(e2) {
1943
1934
  let t2 = [], n2 = e2.startDate;
1944
1935
  for (; n2 <= e2.endDate; ) {
1945
- let r2 = Go(Yo(n2), -1), i2 = r2 < e2.endDate ? r2 : e2.endDate;
1946
- t2.push({ startDate: n2, endDate: i2 }), n2 = Go(i2, 1);
1936
+ let r2 = Ko(Xo(n2), -1), i2 = r2 < e2.endDate ? r2 : e2.endDate;
1937
+ t2.push({ startDate: n2, endDate: i2 }), n2 = Ko(i2, 1);
1947
1938
  }
1948
1939
  return t2;
1949
1940
  }
1950
- function Zo({ allowGenderSelection: e2, staffSelectionStrategy: t2 }) {
1941
+ function Qo({ allowGenderSelection: e2, staffSelectionStrategy: t2 }) {
1951
1942
  return e2 && t2 !== `CUSTOMER_CANNOT_CHOOSE`;
1952
1943
  }
1953
- async function Qo() {
1944
+ async function $o() {
1954
1945
  let e2 = await Ra(Ur);
1955
1946
  return { businessTimeZone: e2.timeSlotsConfiguration?.displayTimeZone?.timeZone || null, staffSelectionStrategy: e2.timeSlotsConfiguration?.staffSelection?.strategy ?? null, allowGenderSelection: e2.timeSlotsConfiguration?.staffSelection?.allowGenderSelection ?? false };
1956
1947
  }
1957
- function $o(e2) {
1948
+ function es(e2) {
1958
1949
  let t2 = e2.location?._id || (e2.location?.locationType ? `${e2.location.locationType}:${e2.location.formattedAddress ?? ``}` : ``);
1959
1950
  return `${e2.localStartDate ?? ``}|${e2.localEndDate ?? ``}|${t2}`;
1960
1951
  }
1961
- function es(e2) {
1962
- return e2.availableResources?.[0]?.resources?.[0]?._id ?? null;
1963
- }
1964
1952
  function ts(e2) {
1965
- return `${$o(e2)}|${es(e2) ?? ``}`;
1953
+ return e2.availableResources?.[0]?.resources?.[0]?._id ?? null;
1966
1954
  }
1967
1955
  function ns(e2) {
1956
+ return `${es(e2)}|${ts(e2) ?? ``}`;
1957
+ }
1958
+ function rs(e2) {
1968
1959
  let t2 = /* @__PURE__ */ new Map();
1969
1960
  for (let n2 of e2) {
1970
- let e3 = $o(n2), r2 = t2.get(e3);
1961
+ let e3 = es(n2), r2 = t2.get(e3);
1971
1962
  r2 ? r2.push(n2) : t2.set(e3, [n2]);
1972
1963
  }
1973
1964
  return [...t2.values()].map((e3) => {
@@ -1976,132 +1967,132 @@ function ns(e2) {
1976
1967
  return { ...n2[0], availableResources: n2.flatMap((e4) => e4.availableResources ?? []) };
1977
1968
  });
1978
1969
  }
1979
- function rs(e2) {
1970
+ function is(e2) {
1980
1971
  return e2 ? { locations: [{ _id: e2, locationType: `BUSINESS` }] } : {};
1981
1972
  }
1982
- function is(e2) {
1973
+ function as(e2) {
1983
1974
  return e2 ? { resourceTypes: [{ resourceTypeId: Kr, resourceIds: [e2] }] } : {};
1984
1975
  }
1985
- function as(e2) {
1976
+ function os(e2) {
1986
1977
  let { requestedGender: t2, ...n2 } = e2;
1987
1978
  return Object.keys(n2).length ? n2 : void 0;
1988
1979
  }
1989
- function os(e2, t2) {
1980
+ function ss(e2, t2) {
1990
1981
  if (!e2) return {};
1991
- let n2 = t2 ? as(e2) : e2;
1982
+ let n2 = t2 ? os(e2) : e2;
1992
1983
  return n2 ? { customerChoices: n2 } : {};
1993
1984
  }
1994
- var ss = `REQUESTED_GENDER_NOT_ALLOWED`;
1995
- function cs(e2) {
1996
- return bo(e2) === ss;
1985
+ var cs = `REQUESTED_GENDER_NOT_ALLOWED`;
1986
+ function ls(e2) {
1987
+ return bo(e2) === cs;
1997
1988
  }
1998
- var ls = false;
1999
- var us = /* @__PURE__ */ new Set();
2000
- function ds() {
2001
- return ls;
1989
+ var us = false;
1990
+ var ds = /* @__PURE__ */ new Set();
1991
+ function fs() {
1992
+ return us;
2002
1993
  }
2003
- function fs(e2) {
2004
- return us.add(e2), () => us.delete(e2);
1994
+ function ps(e2) {
1995
+ return ds.add(e2), () => ds.delete(e2);
2005
1996
  }
2006
- function ps() {
2007
- ls || (ls = true, us.forEach((e2) => e2()));
1997
+ function ms() {
1998
+ us || (us = true, ds.forEach((e2) => e2()));
2008
1999
  }
2009
- async function ms(e2) {
2000
+ async function hs(e2) {
2010
2001
  let { customerChoices: t2, ...n2 } = e2, r2 = (e3) => {
2011
- let t3 = as(e3);
2002
+ let t3 = os(e3);
2012
2003
  return da({ ...n2, ...t3 ? { customerChoices: t3 } : {} });
2013
2004
  };
2014
- if (ls && t2?.requestedGender) return r2(t2);
2005
+ if (us && t2?.requestedGender) return r2(t2);
2015
2006
  try {
2016
2007
  return await da(e2);
2017
2008
  } catch (e3) {
2018
- if (!t2?.requestedGender || !cs(e3)) throw e3;
2019
- return ko(e3, { feature: $.timeSlots, action: `requested-gender-rejected`, level: `warning` }), ps(), r2(t2);
2009
+ if (!t2?.requestedGender || !ls(e3)) throw e3;
2010
+ return ko(e3, { feature: $.timeSlots, action: `requested-gender-rejected`, level: `warning` }), ms(), r2(t2);
2020
2011
  }
2021
2012
  }
2022
- function hs(e2, t2, n2) {
2013
+ function gs(e2, t2, n2) {
2023
2014
  return { ...e2 ? { "location.id": e2 } : {}, ...t2 ? { "resources.id": { $hasSome: [t2] } } : {}, ...n2 ? { remainingCapacity: { $gte: n2 } } : {} };
2024
2015
  }
2025
- async function gs(e2) {
2016
+ async function _s(e2) {
2026
2017
  let t2 = await ya(e2);
2027
2018
  return { timeSlots: t2.timeSlots ?? [], timeZone: t2.timeZone ?? null, nextCursor: t2.pagingMetadata?.cursors?.next || null };
2028
2019
  }
2029
- function _s({ serviceId: e2, serviceType: t2, fromLocalDate: n2, toLocalDate: r2, timeZone: i2, locationId: a2, staffId: o2, onlyAvailableSlots: s2 = false, customerChoices: c2, minRemainingCapacity: l2, timeSlotsPerDay: u2, limit: d2, cursor: f2 }) {
2030
- return Za(t2) ? vs({ serviceId: e2, fromLocalDate: n2, toLocalDate: r2, timeZone: i2, locationId: a2, staffId: o2, onlyAvailableSlots: s2, customerChoices: c2, timeSlotsPerDay: u2, limit: d2, cursor: f2 }) : gs({ serviceIds: [e2], fromLocalDate: n2, ...r2 ? { toLocalDate: r2 } : {}, ...i2 ? { timeZone: i2 } : {}, includeNonBookable: !s2, eventFilter: { type: t2, ...hs(a2, o2, l2) }, cursorPaging: { limit: d2, ...f2 ? { cursor: f2 } : {} } });
2020
+ function vs({ serviceId: e2, serviceType: t2, fromLocalDate: n2, toLocalDate: r2, timeZone: i2, locationId: a2, staffId: o2, onlyAvailableSlots: s2 = false, customerChoices: c2, minRemainingCapacity: l2, timeSlotsPerDay: u2, limit: d2, cursor: f2 }) {
2021
+ return Za(t2) ? ys({ serviceId: e2, fromLocalDate: n2, toLocalDate: r2, timeZone: i2, locationId: a2, staffId: o2, onlyAvailableSlots: s2, customerChoices: c2, timeSlotsPerDay: u2, limit: d2, cursor: f2 }) : _s({ serviceIds: [e2], fromLocalDate: n2, ...r2 ? { toLocalDate: r2 } : {}, ...i2 ? { timeZone: i2 } : {}, includeNonBookable: !s2, eventFilter: { type: t2, ...gs(a2, o2, l2) }, cursorPaging: { limit: d2, ...f2 ? { cursor: f2 } : {} } });
2031
2022
  }
2032
- async function vs({ serviceId: e2, fromLocalDate: t2, toLocalDate: n2, timeZone: r2, locationId: i2, staffId: a2, onlyAvailableSlots: o2, customerChoices: s2, timeSlotsPerDay: c2, limit: l2, cursor: u2 }) {
2033
- let d2 = await ms({ serviceId: e2, fromLocalDate: t2, ...n2 ? { toLocalDate: n2 } : {}, ...r2 ? { timeZone: r2 } : {}, ...o2 ? { bookable: true } : {}, ...rs(i2), ...is(a2), ...os(s2, a2), includeResourceTypeIds: [Kr], ...c2 == null ? {} : { timeSlotsPerDay: c2 }, cursorPaging: { limit: l2, ...u2 ? { cursor: u2 } : {} } });
2023
+ async function ys({ serviceId: e2, fromLocalDate: t2, toLocalDate: n2, timeZone: r2, locationId: i2, staffId: a2, onlyAvailableSlots: o2, customerChoices: s2, timeSlotsPerDay: c2, limit: l2, cursor: u2 }) {
2024
+ let d2 = await hs({ serviceId: e2, fromLocalDate: t2, ...n2 ? { toLocalDate: n2 } : {}, ...r2 ? { timeZone: r2 } : {}, ...o2 ? { bookable: true } : {}, ...is(i2), ...as(a2), ...ss(s2, a2), includeResourceTypeIds: [Kr], ...c2 == null ? {} : { timeSlotsPerDay: c2 }, cursorPaging: { limit: l2, ...u2 ? { cursor: u2 } : {} } });
2034
2025
  return { timeSlots: d2.timeSlots ?? [], timeZone: d2.timeZone ?? null, nextCursor: d2.cursorPagingMetadata?.cursors?.next || null };
2035
2026
  }
2036
- var ys = 6;
2037
- var bs = 864e5;
2038
- function xs(e2) {
2039
- let t2 = e2 ? Fo(e2) : new Date(Date.now()), n2 = new Date(t2.getFullYear(), t2.getMonth() + ys + 1, 1), r2 = new Date(n2.getTime() - bs);
2040
- return { fromLocalDate: Lo(t2), toLocalDate: Ro(r2) };
2027
+ var bs = 6;
2028
+ var xs = 864e5;
2029
+ function Ss(e2) {
2030
+ let t2 = e2 ? Io(e2) : new Date(Date.now()), n2 = new Date(t2.getFullYear(), t2.getMonth() + bs + 1, 1), r2 = new Date(n2.getTime() - xs);
2031
+ return { fromLocalDate: Ro(t2), toLocalDate: zo(r2) };
2041
2032
  }
2042
- async function Ss({ serviceId: e2, serviceType: t2, timeZone: n2, limit: r2, onlyAvailableSlots: i2 = true, fromDate: a2, locationId: o2, staffId: s2, customerChoices: c2, minRemainingCapacity: l2 }) {
2043
- let { fromLocalDate: u2, toLocalDate: d2 } = xs(a2);
2033
+ async function Cs({ serviceId: e2, serviceType: t2, timeZone: n2, limit: r2, onlyAvailableSlots: i2 = true, fromDate: a2, locationId: o2, staffId: s2, customerChoices: c2, minRemainingCapacity: l2 }) {
2034
+ let { fromLocalDate: u2, toLocalDate: d2 } = Ss(a2);
2044
2035
  if (Qa(t2) || $a(t2)) {
2045
- let a3 = { ...$a(t2) ? { type: `COURSE` } : {}, ...hs(o2, s2, l2) }, c3 = await gs({ serviceIds: [e2], fromLocalDate: u2, toLocalDate: d2, ...n2 ? { timeZone: n2 } : {}, includeNonBookable: !i2, ...Object.keys(a3).length ? { eventFilter: a3 } : {}, ...r2 == null ? {} : { cursorPaging: { limit: r2 } } });
2036
+ let a3 = { ...$a(t2) ? { type: `COURSE` } : {}, ...gs(o2, s2, l2) }, c3 = await _s({ serviceIds: [e2], fromLocalDate: u2, toLocalDate: d2, ...n2 ? { timeZone: n2 } : {}, includeNonBookable: !i2, ...Object.keys(a3).length ? { eventFilter: a3 } : {}, ...r2 == null ? {} : { cursorPaging: { limit: r2 } } });
2046
2037
  return { timeSlots: c3.timeSlots, timeZone: c3.timeZone };
2047
2038
  }
2048
- let f2 = await ms({ serviceId: e2, fromLocalDate: u2, toLocalDate: d2, ...n2 ? { timeZone: n2 } : {}, ...i2 ? { bookable: true } : {}, ...rs(o2), ...is(s2), ...os(c2, s2), includeResourceTypeIds: [Kr], ...r2 == null ? {} : { cursorPaging: { limit: r2 } } });
2039
+ let f2 = await hs({ serviceId: e2, fromLocalDate: u2, toLocalDate: d2, ...n2 ? { timeZone: n2 } : {}, ...i2 ? { bookable: true } : {}, ...is(o2), ...as(s2), ...ss(c2, s2), includeResourceTypeIds: [Kr], ...r2 == null ? {} : { cursorPaging: { limit: r2 } } });
2049
2040
  return { timeSlots: f2.timeSlots ?? [], timeZone: f2.timeZone ?? null };
2050
2041
  }
2051
- var Cs = 1e3;
2052
- async function ws({ serviceId: e2, serviceType: t2, date: n2, timeZone: r2, onlyAvailableSlots: i2, locationId: a2, staffId: o2, customerChoices: s2, minRemainingCapacity: c2, keepWaitlistSlots: l2 = false, fromLocalDate: u2, toLocalDate: d2 }) {
2042
+ var ws = 1e3;
2043
+ async function Ts({ serviceId: e2, serviceType: t2, date: n2, timeZone: r2, onlyAvailableSlots: i2, locationId: a2, staffId: o2, customerChoices: s2, minRemainingCapacity: c2, keepWaitlistSlots: l2 = false, fromLocalDate: u2, toLocalDate: d2 }) {
2053
2044
  let f2 = `${n2}T00:00:00`, p2 = `${n2}T23:59:59`, m2 = $a(t2) ? `COURSE` : Qa(t2) ? `CLASS` : `APPOINTMENT`, h2 = l2 && i2 && m2 === `CLASS`, g2 = [], _2 = null, v2;
2054
2045
  do {
2055
- let t3 = await _s({ serviceId: e2, serviceType: m2, fromLocalDate: u2 && u2 > f2 ? u2 : f2, toLocalDate: d2 && d2 < p2 ? d2 : p2, timeZone: r2, locationId: a2, staffId: o2, onlyAvailableSlots: i2 && !h2, customerChoices: s2, minRemainingCapacity: c2, limit: Cs, cursor: v2 });
2046
+ let t3 = await vs({ serviceId: e2, serviceType: m2, fromLocalDate: u2 && u2 > f2 ? u2 : f2, toLocalDate: d2 && d2 < p2 ? d2 : p2, timeZone: r2, locationId: a2, staffId: o2, onlyAvailableSlots: i2 && !h2, customerChoices: s2, minRemainingCapacity: c2, limit: ws, cursor: v2 });
2056
2047
  g2.push(...h2 ? t3.timeSlots.filter((e3) => e3.bookable || No(e3)) : t3.timeSlots), _2 = t3.timeZone ?? _2, v2 = t3.nextCursor ?? void 0;
2057
2048
  } while (v2);
2058
2049
  return { timeSlots: g2, timeZone: _2 };
2059
2050
  }
2060
- function Ts(e2) {
2051
+ function Es(e2) {
2061
2052
  return { slotStart: e2.localStartDate, slotEnd: e2.localEndDate, eventId: e2.eventInfo?.eventId, scheduleId: e2.scheduleId ?? void 0, locationId: e2.location?._id ?? void 0, locationType: e2.location?.locationType ?? void 0 };
2062
2053
  }
2063
- function Es(e2) {
2054
+ function Ds(e2) {
2064
2055
  return e2?.options?.values?.[0]?.type === Oa.STAFF_MEMBER;
2065
2056
  }
2066
- function Ds(e2) {
2057
+ function Os(e2) {
2067
2058
  return e2.staffMemberDetails?.staffMembers ?? [];
2068
2059
  }
2069
- function Os(e2, t2) {
2060
+ function ks(e2, t2) {
2070
2061
  let n2 = e2.workingHoursLocationCoverage;
2071
2062
  return { staffMemberId: e2.staffMemberId ?? ``, name: e2.name ?? null, image: null, isSelected: t2 === e2.staffMemberId, ...n2 ? { locationCoverage: { availableAtAllLocations: n2.availableAtAllLocations ?? false, locationIds: n2.locationIds ?? [] } } : {} };
2072
2063
  }
2073
- function ks(e2, t2) {
2064
+ function As(e2, t2) {
2074
2065
  let n2 = e2.locationCoverage;
2075
2066
  return !n2 || n2.availableAtAllLocations || n2.locationIds.includes(t2);
2076
2067
  }
2077
- function As(e2, t2) {
2078
- return t2 ? e2.filter((e3) => ks(e3, t2)) : e2;
2079
- }
2080
2068
  function js(e2, t2) {
2069
+ return t2 ? e2.filter((e3) => As(e3, t2)) : e2;
2070
+ }
2071
+ function Ms(e2, t2) {
2081
2072
  let n2 = new Map(t2.map((e3) => [e3.staffMemberId, e3.locationCoverage]));
2082
2073
  return e2.choices.map((e3) => e3.choiceId).filter((e3) => e3 != null).map((e3) => ({ staffMemberId: e3, locationCoverage: n2.get(e3) }));
2083
2074
  }
2084
- function Ms(e2, t2, n2) {
2075
+ function Ns(e2, t2, n2) {
2085
2076
  if (e2?.type !== `STAFF_MEMBER` || !n2) return;
2086
- let r2 = As(js(e2, t2), n2);
2077
+ let r2 = js(Ms(e2, t2), n2);
2087
2078
  return r2.length === 1 ? r2[0].staffMemberId : void 0;
2088
2079
  }
2089
- function Ns(e2, t2) {
2080
+ function Ps(e2, t2) {
2090
2081
  if (t2.length === 0) return e2;
2091
- let n2 = e2.filter((e3) => As(t2, e3.id).length > 0);
2082
+ let n2 = e2.filter((e3) => js(t2, e3.id).length > 0);
2092
2083
  return n2.length > 0 ? n2 : e2;
2093
2084
  }
2094
- function Ps(e2) {
2095
- return Ds(e2).map((e3) => Os(e3, null));
2085
+ function Fs(e2) {
2086
+ return Os(e2).map((e3) => ks(e3, null));
2096
2087
  }
2097
- function Fs(e2, t2, n2 = false) {
2098
- let r2 = Is(e2), i2 = r2.length === 1 ? r2[0].id : void 0, a2 = n2 || !i2 || r2.some((e3) => e3.id === t2);
2088
+ function Is(e2, t2, n2 = false) {
2089
+ let r2 = Ls(e2), i2 = r2.length === 1 ? r2[0].id : void 0, a2 = n2 || !i2 || r2.some((e3) => e3.id === t2);
2099
2090
  return t2 && a2 ? t2 : i2;
2100
2091
  }
2101
- function Is(e2) {
2102
- return Ns(Xa(e2), Ps(e2));
2103
- }
2104
2092
  function Ls(e2) {
2093
+ return Ps(Xa(e2), Fs(e2));
2094
+ }
2095
+ function Rs(e2) {
2105
2096
  let t2 = e2;
2106
2097
  return t2.__state || (t2.__state = { status: `pending` }, t2.then((e3) => {
2107
2098
  t2.__state = { status: `fulfilled`, value: e3 };
@@ -2109,33 +2100,33 @@ function Ls(e2) {
2109
2100
  t2.__state = { status: `rejected`, reason: e3 };
2110
2101
  })), t2.__state;
2111
2102
  }
2112
- function Rs(e2) {
2113
- let t2 = Ls(e2);
2103
+ function zs(e2) {
2104
+ let t2 = Rs(e2);
2114
2105
  if (t2.status === `fulfilled`) return t2.value;
2115
2106
  throw t2.status === `rejected` ? t2.reason : e2;
2116
2107
  }
2117
- function zs(e2) {
2108
+ function Bs(e2) {
2118
2109
  let t2 = Promise.resolve(e2);
2119
2110
  return t2.__state = { status: `fulfilled`, value: e2 }, t2;
2120
2111
  }
2121
- var Bs = Lr(`@wix/site-service-warmup-data`);
2122
- function Vs() {
2112
+ var Vs = Lr(`@wix/site-service-warmup-data`);
2113
+ function Hs() {
2123
2114
  try {
2124
2115
  return (0, import_services_manager_react.useGetService)();
2125
2116
  } catch {
2126
2117
  return null;
2127
2118
  }
2128
2119
  }
2129
- function Hs(e2) {
2120
+ function Us(e2) {
2130
2121
  try {
2131
- return e2 ? e2(Bs) : null;
2122
+ return e2 ? e2(Vs) : null;
2132
2123
  } catch {
2133
2124
  return null;
2134
2125
  }
2135
2126
  }
2136
- function Us() {
2137
- let e2 = Hs(Vs()), t2 = typeof window > `u`;
2138
- return { scope: e2 ?? void 0, get: async (n2) => {
2127
+ function Ws() {
2128
+ let e2 = Us(Hs()), t2 = typeof window > `u`;
2129
+ return (0, import_react.useMemo)(() => ({ scope: e2 ?? void 0, get: async (n2) => {
2139
2130
  if (t2 || !e2) return null;
2140
2131
  try {
2141
2132
  return await e2.get(n2);
@@ -2147,59 +2138,59 @@ function Us() {
2147
2138
  e2.set(n2, r2);
2148
2139
  } catch {
2149
2140
  }
2150
- } };
2151
- }
2152
- var Ws = `bookings-uou`;
2153
- function Gs() {
2154
- return `${Ws}:bookings-settings`;
2141
+ } }), [e2, t2]);
2155
2142
  }
2143
+ var Gs = `bookings-uou`;
2156
2144
  function Ks() {
2157
- return `${Ws}:time-slots-configuration`;
2145
+ return `${Gs}:bookings-settings`;
2146
+ }
2147
+ function qs() {
2148
+ return `${Gs}:time-slots-configuration`;
2158
2149
  }
2159
- var qs = 5e3;
2160
- var Js = 100;
2161
- var Ys = `wix-warmup-data`;
2162
- var Xs = null;
2163
- function Zs(e2) {
2150
+ var Js = 5e3;
2151
+ var Ys = 100;
2152
+ var Xs = `wix-warmup-data`;
2153
+ var Zs = null;
2154
+ function Qs(e2) {
2164
2155
  if (typeof document < `u`) try {
2165
- let t2 = document.getElementById(Ys)?.textContent;
2166
- return t2 ? (Xs?.text !== t2 && (Xs = { text: t2, data: JSON.parse(t2).builderComponentsWarmupData ?? {} }), Xs.data[e2] ?? void 0) : void 0;
2156
+ let t2 = document.getElementById(Xs)?.textContent;
2157
+ return t2 ? (Zs?.text !== t2 && (Zs = { text: t2, data: JSON.parse(t2).builderComponentsWarmupData ?? {} }), Zs.data[e2] ?? void 0) : void 0;
2167
2158
  } catch {
2168
2159
  return;
2169
2160
  }
2170
2161
  }
2171
- var Qs = () => ({ promises: /* @__PURE__ */ new Map(), invalidatedWarmup: /* @__PURE__ */ new Set() });
2172
- var $s = Qs();
2173
- var ec = /* @__PURE__ */ new WeakMap();
2162
+ var $s = () => ({ promises: /* @__PURE__ */ new Map(), invalidatedWarmup: /* @__PURE__ */ new Set() });
2163
+ var ec = $s();
2174
2164
  var tc = /* @__PURE__ */ new WeakMap();
2175
- function nc(e2) {
2176
- if (!e2) return $s;
2177
- let t2 = ec.get(e2);
2178
- return t2 || (t2 = Qs(), ec.set(e2, t2)), t2;
2165
+ var nc = /* @__PURE__ */ new WeakMap();
2166
+ function rc(e2) {
2167
+ if (!e2) return ec;
2168
+ let t2 = tc.get(e2);
2169
+ return t2 || (t2 = $s(), tc.set(e2, t2)), t2;
2179
2170
  }
2180
- function rc({ key: e2, warmupData: t2, fetchData: n2, refresh: r2 = false }) {
2171
+ function ic({ key: e2, warmupData: t2, fetchData: n2, refresh: r2 = false }) {
2181
2172
  if (e2 === null) return n2();
2182
2173
  if (typeof window > `u`) {
2183
2174
  let r3 = () => n2().then((n3) => (t2.set(e2, n3), n3)), { scope: i3 } = t2;
2184
2175
  if (!i3) return r3();
2185
- let a3 = tc.get(i3);
2186
- a3 || (a3 = /* @__PURE__ */ new Map(), tc.set(i3, a3));
2176
+ let a3 = nc.get(i3);
2177
+ a3 || (a3 = /* @__PURE__ */ new Map(), nc.set(i3, a3));
2187
2178
  let o3 = a3.get(e2);
2188
2179
  if (o3) return o3;
2189
2180
  let s3 = r3();
2190
2181
  return a3.set(e2, s3), s3.catch(() => a3.delete(e2)), s3;
2191
2182
  }
2192
- let i2 = nc(t2.scope), a2 = Date.now();
2183
+ let i2 = rc(t2.scope), a2 = Date.now();
2193
2184
  for (let [e3, t3] of i2.promises) t3.expiresAt <= a2 && i2.promises.delete(e3);
2194
2185
  let o2 = i2.promises.get(e2);
2195
2186
  if (o2 && !r2) return o2.promise;
2196
2187
  r2 && i2.invalidatedWarmup.add(e2);
2197
2188
  let s2 = !i2.invalidatedWarmup.has(e2);
2198
2189
  if (s2) {
2199
- let t3 = Zs(e2);
2190
+ let t3 = Qs(e2);
2200
2191
  if (t3 !== void 0) {
2201
- let n3 = zs(t3);
2202
- return i2.promises.set(e2, { promise: n3, expiresAt: a2 + qs }), n3;
2192
+ let n3 = Bs(t3);
2193
+ return i2.promises.set(e2, { promise: n3, expiresAt: a2 + Js }), n3;
2203
2194
  }
2204
2195
  }
2205
2196
  let c2 = (async () => {
@@ -2209,48 +2200,48 @@ function rc({ key: e2, warmupData: t2, fetchData: n2, refresh: r2 = false }) {
2209
2200
  }
2210
2201
  return n2();
2211
2202
  })();
2212
- i2.promises.size >= Js && i2.promises.delete(i2.promises.keys().next().value);
2203
+ i2.promises.size >= Ys && i2.promises.delete(i2.promises.keys().next().value);
2213
2204
  let l2 = { promise: c2, expiresAt: 1 / 0 };
2214
2205
  return i2.promises.set(e2, l2), c2.then(() => {
2215
- l2.expiresAt = Date.now() + qs;
2206
+ l2.expiresAt = Date.now() + Js;
2216
2207
  }, () => {
2217
2208
  i2.promises.get(e2) === l2 && i2.promises.delete(e2);
2218
2209
  }), c2;
2219
2210
  }
2220
- var ic = { displayTimeZonePolicy: { basedOn: Wa.BUSINESS_TIME_ZONE, customerCanChange: false }, multiServiceAppointmentsEnabled: false };
2221
- async function ac() {
2211
+ var ac = { displayTimeZonePolicy: { basedOn: Wa.BUSINESS_TIME_ZONE, customerCanChange: false }, multiServiceAppointmentsEnabled: false };
2212
+ async function oc() {
2222
2213
  try {
2223
2214
  let e2 = await qa();
2224
2215
  return { displayTimeZonePolicy: { basedOn: e2.displayTimeZone?.basedOn ?? Wa.BUSINESS_TIME_ZONE, customerCanChange: e2.displayTimeZone?.customerCanChange ?? false }, multiServiceAppointmentsEnabled: e2.multiServiceAppointments?.enabled ?? false };
2225
2216
  } catch (e2) {
2226
- return ko(e2, { feature: $.bookingsSettings, action: `fetch-bookings-settings`, level: `warning` }), ic;
2217
+ return ko(e2, { feature: $.bookingsSettings, action: `fetch-bookings-settings`, level: `warning` }), ac;
2227
2218
  }
2228
2219
  }
2229
- var oc = { isLoading: true };
2230
- var sc = (0, import_react.createContext)(null);
2231
- var cc = `useBookingsSettingsContext must be used within BookingsSettingsProvider`;
2232
- function lc() {
2233
- let e2 = (0, import_react.useContext)(sc);
2234
- if (!e2) throw Error(cc);
2220
+ var sc = { isLoading: true };
2221
+ var cc = (0, import_react.createContext)(null);
2222
+ var lc = `useBookingsSettingsContext must be used within BookingsSettingsProvider`;
2223
+ function uc() {
2224
+ let e2 = (0, import_react.useContext)(cc);
2225
+ if (!e2) throw Error(lc);
2235
2226
  return e2;
2236
2227
  }
2237
- function uc(e2) {
2228
+ function dc(e2) {
2238
2229
  return e2.basedOn === Wa.CUSTOMER_TIME_ZONE ? Intl.DateTimeFormat().resolvedOptions().timeZone : void 0;
2239
2230
  }
2240
- function dc() {
2241
- let e2 = lc();
2242
- return e2.isLoading ? void 0 : uc(e2.displayTimeZonePolicy);
2231
+ function fc() {
2232
+ let e2 = uc();
2233
+ return e2.isLoading ? void 0 : dc(e2.displayTimeZonePolicy);
2243
2234
  }
2244
- function fc({ settingsPromise: e2, children: t2 }) {
2245
- let n2 = Rs(e2), r2 = (0, import_react.useMemo)(() => ({ isLoading: false, ...n2 }), [n2]);
2246
- return (0, import_jsx_runtime.jsx)(sc.Provider, { value: r2, children: t2 });
2235
+ function pc({ settingsPromise: e2, children: t2 }) {
2236
+ let n2 = zs(e2), r2 = (0, import_react.useMemo)(() => ({ isLoading: false, ...n2 }), [n2]);
2237
+ return (0, import_jsx_runtime.jsx)(cc.Provider, { value: r2, children: t2 });
2247
2238
  }
2248
- function pc({ bookingsSettings: e2, children: n2 }) {
2249
- let r2 = Us(), [i2] = (0, import_react.useState)(() => e2 ? null : rc({ key: Gs(), warmupData: r2, fetchData: ac }));
2250
- return e2 ? (0, import_jsx_runtime.jsx)(sc.Provider, { value: { isLoading: false, ...e2 }, children: n2 }) : (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: (0, import_jsx_runtime.jsx)(sc.Provider, { value: oc, children: n2 }), children: (0, import_jsx_runtime.jsx)(fc, { settingsPromise: i2, children: n2 }) });
2239
+ function mc({ bookingsSettings: e2, children: n2 }) {
2240
+ let r2 = Ws(), [i2] = (0, import_react.useState)(() => e2 ? null : ic({ key: Ks(), warmupData: r2, fetchData: oc }));
2241
+ return e2 ? (0, import_jsx_runtime.jsx)(cc.Provider, { value: { isLoading: false, ...e2 }, children: n2 }) : (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: (0, import_jsx_runtime.jsx)(cc.Provider, { value: sc, children: n2 }), children: (0, import_jsx_runtime.jsx)(pc, { settingsPromise: i2, children: n2 }) });
2251
2242
  }
2252
- var mc = 1e3;
2253
- var hc = class extends import_react.Component {
2243
+ var hc = 1e3;
2244
+ var gc = class extends import_react.Component {
2254
2245
  state = { hasError: false };
2255
2246
  static getDerivedStateFromError() {
2256
2247
  return { hasError: true };
@@ -2262,16 +2253,16 @@ var hc = class extends import_react.Component {
2262
2253
  return this.state.hasError ? this.props.fallback : this.props.children;
2263
2254
  }
2264
2255
  };
2265
- var gc = `appSectionParams`;
2266
- function _c(e2) {
2267
- let t2 = e2.searchParams.get(gc);
2256
+ var _c = `appSectionParams`;
2257
+ function vc(e2) {
2258
+ let t2 = e2.searchParams.get(_c);
2268
2259
  if (t2 === null) return e2;
2269
2260
  let n2 = new URL(e2);
2270
- n2.searchParams.delete(gc);
2271
- for (let [e3, r2] of Object.entries(vc(t2))) typeof r2 == `string` && !n2.searchParams.has(e3) && n2.searchParams.set(e3, r2);
2261
+ n2.searchParams.delete(_c);
2262
+ for (let [e3, r2] of Object.entries(yc(t2))) typeof r2 == `string` && !n2.searchParams.has(e3) && n2.searchParams.set(e3, r2);
2272
2263
  return n2;
2273
2264
  }
2274
- function vc(e2) {
2265
+ function yc(e2) {
2275
2266
  try {
2276
2267
  let t2 = JSON.parse(e2);
2277
2268
  return t2 && typeof t2 == `object` && !Array.isArray(t2) ? t2 : {};
@@ -2279,16 +2270,16 @@ function vc(e2) {
2279
2270
  return {};
2280
2271
  }
2281
2272
  }
2282
- var yc = `bookings-uou:url-change`;
2283
- var bc = (e2) => {
2273
+ var bc = `bookings-uou:url-change`;
2274
+ var xc = (e2) => {
2284
2275
  let t2 = new URL(e2);
2285
2276
  return t2.searchParams.sort(), t2.href;
2286
2277
  };
2287
- function xc(e2, { disableScrollToTop: t2, skipHistory: n2 } = {}) {
2278
+ function Sc(e2, { disableScrollToTop: t2, skipHistory: n2 } = {}) {
2288
2279
  let r2 = globalThis.window;
2289
2280
  if (!r2?.history) return;
2290
2281
  let i2 = new URL(r2.location.href);
2291
- if (bc(i2) === bc(e2)) return;
2282
+ if (xc(i2) === xc(e2)) return;
2292
2283
  let a2 = { scrollY: r2.scrollY };
2293
2284
  if (n2) r2.history.replaceState(a2, ``, e2.href);
2294
2285
  else {
@@ -2299,110 +2290,110 @@ function xc(e2, { disableScrollToTop: t2, skipHistory: n2 } = {}) {
2299
2290
  return;
2300
2291
  }
2301
2292
  }
2302
- r2.dispatchEvent(new Event(yc));
2293
+ r2.dispatchEvent(new Event(bc));
2303
2294
  }
2304
- function Sc(e2) {
2295
+ function Cc(e2) {
2305
2296
  let t2 = globalThis.window;
2306
- return t2 ? (t2.addEventListener(yc, e2), t2.addEventListener(`popstate`, e2), () => {
2307
- t2.removeEventListener(yc, e2), t2.removeEventListener(`popstate`, e2);
2297
+ return t2 ? (t2.addEventListener(bc, e2), t2.addEventListener(`popstate`, e2), () => {
2298
+ t2.removeEventListener(bc, e2), t2.removeEventListener(`popstate`, e2);
2308
2299
  }) : () => {
2309
2300
  };
2310
2301
  }
2311
- var Cc = (e2) => {
2302
+ var wc = (e2) => {
2312
2303
  try {
2313
2304
  return decodeURIComponent(e2);
2314
2305
  } catch {
2315
2306
  return e2;
2316
2307
  }
2317
2308
  };
2318
- function wc(e2, t2) {
2309
+ function Tc(e2, t2) {
2319
2310
  let n2 = t2 ? new URL(t2).pathname : `/`;
2320
- return `./${Cc(new URL(e2).pathname.replace(n2, ``).replace(/^\/|\/$/g, ``))}`;
2311
+ return `./${wc(new URL(e2).pathname.replace(n2, ``).replace(/^\/|\/$/g, ``))}`;
2321
2312
  }
2322
- function Tc() {
2323
- let e2 = (0, import_services_manager_react.useService)(Vr), t2 = (0, import_react.useCallback)(() => e2.currentUrl, [e2]), n2 = (0, import_react.useSyncExternalStore)(Sc, t2, t2), r2 = (0, import_react.useMemo)(() => _c(new URL(n2)), [n2]), a2 = e2.siteUrl.replace(/\/$/, ``);
2324
- return { pathname: r2.pathname, search: r2.search, searchParams: r2.searchParams, href: r2.href, getParsedUrl: () => _c(new URL(e2.currentUrl)), getRelativeUrl: () => wc(e2.currentUrl, a2), getExternalBaseUrl: () => a2, pushUrl: xc };
2313
+ function Ec() {
2314
+ let e2 = (0, import_services_manager_react.useService)(Vr), t2 = (0, import_react.useCallback)(() => e2.currentUrl, [e2]), n2 = (0, import_react.useSyncExternalStore)(Cc, t2, t2), r2 = (0, import_react.useMemo)(() => vc(new URL(n2)), [n2]), a2 = e2.siteUrl.replace(/\/$/, ``);
2315
+ return { pathname: r2.pathname, search: r2.search, searchParams: r2.searchParams, href: r2.href, getParsedUrl: () => vc(new URL(e2.currentUrl)), getRelativeUrl: () => Tc(e2.currentUrl, a2), getExternalBaseUrl: () => a2, pushUrl: Sc };
2325
2316
  }
2326
- var Ec = () => () => {
2317
+ var Dc = () => () => {
2327
2318
  };
2328
- function Dc() {
2319
+ function Oc() {
2329
2320
  let e2;
2330
2321
  return { inBrowser: () => e2 ??= false, onServer: () => e2 ??= true };
2331
2322
  }
2332
- function Oc() {
2333
- let [e2] = (0, import_react.useState)(Dc);
2334
- return (0, import_react.useSyncExternalStore)(Ec, e2.inBrowser, e2.onServer);
2335
- }
2336
- var kc = Symbol(`landing pending`);
2337
- function Ac() {
2338
- return !Oc();
2323
+ function kc() {
2324
+ let [e2] = (0, import_react.useState)(Oc);
2325
+ return (0, import_react.useSyncExternalStore)(Dc, e2.inBrowser, e2.onServer);
2339
2326
  }
2327
+ var Ac = Symbol(`landing pending`);
2340
2328
  function jc() {
2341
- let { searchParams: e2 } = Tc(), t2 = Ac(), [n2, i2] = (0, import_react.useState)(t2);
2329
+ return !kc();
2330
+ }
2331
+ function Mc() {
2332
+ let { searchParams: e2 } = Ec(), t2 = jc(), [n2, i2] = (0, import_react.useState)(t2);
2342
2333
  return (0, import_react.useEffect)(() => {
2343
2334
  (0, import_react.startTransition)(() => i2(true));
2344
- }, []), n2 ? ro(e2) : kc;
2335
+ }, []), n2 ? ro(e2) : Ac;
2345
2336
  }
2346
- function Mc(e2) {
2347
- let t2 = jc();
2348
- return e2 || t2 === kc ? null : t2;
2337
+ function Nc(e2) {
2338
+ let t2 = Mc();
2339
+ return e2 || t2 === Ac ? null : t2;
2349
2340
  }
2350
- var Nc = Lr(`@wix/site-service-business-logger`);
2351
- function Pc(e2) {
2341
+ var Pc = Lr(`@wix/site-service-business-logger`);
2342
+ function Fc(e2) {
2352
2343
  return { evid: 32, src: 16, endpoint: ``, params: e2 };
2353
2344
  }
2354
- function Fc(e2) {
2345
+ function Ic(e2) {
2355
2346
  return { evid: 33, src: 16, endpoint: ``, params: e2 };
2356
2347
  }
2357
- function Ic(e2) {
2348
+ function Lc(e2) {
2358
2349
  return { evid: 34, src: 16, endpoint: ``, params: e2 };
2359
2350
  }
2360
- var Lc = { SERVICES: `services_context`, SERVICE: `service_context`, TIME_SLOTS: `time_slots_context`, BOOKING_CHECKOUT: `booking_checkout_context`, CATEGORIES: `categories_context`, LOCATIONS: `locations_context`, SERVICE_ADD_ONS: `service_addons_context`, PREFERENCES: `preferences_context` };
2351
+ var Rc = { SERVICES: `services_context`, SERVICE: `service_context`, TIME_SLOTS: `time_slots_context`, BOOKING_CHECKOUT: `booking_checkout_context`, CATEGORIES: `categories_context`, LOCATIONS: `locations_context`, SERVICE_ADD_ONS: `service_addons_context`, PREFERENCES: `preferences_context` };
2361
2352
  qr.BOOK_ONLINE;
2362
- var Rc = `new_bookings_server`;
2363
- var zc = { LOAD: `load`, LOCATION_CHOSEN: `location chosen`, STAFF_CHOSEN: `staff chosen`, VARIANT_SELECTED: `variant selected`, ADD_ON_SELECTED: `add on selected`, ADD_ON_UNSELECTED: `add on unselected`, BACK: `back`, CLOSE: `close`, STAY: `stay`, ADD_SERVICE: `add service`, EDIT_BASKET_ITEM: `edit basket item`, EDIT_BASKET_ITEM_FROM_CALENDAR: `edit basket item from calendar`, CHANGE_STAFF_MEMBER: `change staff member`, REMOVE_BASKET_ITEM: `remove basket item`, SELECT_SERVICE: `select service`, SEARCH: `search`, CLEAR_SEARCH: `clear search` };
2364
- var Bc = { TIMEZONE_PICKER: `timezone_picker`, TIME_PICKER: `time_picker`, BOOKING_DETAILS: `booking_details`, RESCHEDULE_DIALOG: `reschedule_dialog`, JOIN_WAITLIST_DIALOG: `join_waitlist_dialog` };
2365
- var Vc = { DROPDOWN: `dropdown`, TIME_SLOT: `time_slot`, EXPAND: `expand`, COLLAPSE: `collapse` };
2366
- var Hc = (e2) => {
2367
- let { reportBi: t2 } = (0, import_services_manager_react.useService)(Nc);
2353
+ var zc = `new_bookings_server`;
2354
+ var Bc = { LOAD: `load`, LOCATION_CHOSEN: `location chosen`, STAFF_CHOSEN: `staff chosen`, VARIANT_SELECTED: `variant selected`, ADD_ON_SELECTED: `add on selected`, ADD_ON_UNSELECTED: `add on unselected`, BACK: `back`, CLOSE: `close`, STAY: `stay`, ADD_SERVICE: `add service`, EDIT_BASKET_ITEM: `edit basket item`, EDIT_BASKET_ITEM_FROM_CALENDAR: `edit basket item from calendar`, CHANGE_STAFF_MEMBER: `change staff member`, REMOVE_BASKET_ITEM: `remove basket item`, SELECT_SERVICE: `select service`, SEARCH: `search`, CLEAR_SEARCH: `clear search` };
2355
+ var Vc = { TIMEZONE_PICKER: `timezone_picker`, TIME_PICKER: `time_picker`, BOOKING_DETAILS: `booking_details`, RESCHEDULE_DIALOG: `reschedule_dialog`, JOIN_WAITLIST_DIALOG: `join_waitlist_dialog` };
2356
+ var Hc = { DROPDOWN: `dropdown`, TIME_SLOT: `time_slot`, EXPAND: `expand`, COLLAPSE: `collapse` };
2357
+ var Uc = (e2) => {
2358
+ let { reportBi: t2 } = (0, import_services_manager_react.useService)(Pc);
2368
2359
  return (0, import_react.useCallback)((n2) => {
2369
- t2({ widget_name: e2, bookingsPlatform: Rc, is_over_editor: false, ...n2.params, src: n2.src, evid: n2.evid }, { endpoint: n2.endpoint });
2360
+ t2({ widget_name: e2, bookingsPlatform: zc, is_over_editor: false, ...n2.params, src: n2.src, evid: n2.evid }, { endpoint: n2.endpoint });
2370
2361
  }, [t2, e2]);
2371
2362
  };
2372
- var Uc = (e2, t2 = true) => {
2373
- let n2 = Hc(e2), { getParsedUrl: r2 } = Tc(), i2 = (0, import_react.useRef)(false);
2363
+ var Wc = (e2, t2 = true) => {
2364
+ let n2 = Uc(e2), { getParsedUrl: r2 } = Ec(), i2 = (0, import_react.useRef)(false);
2374
2365
  (0, import_react.useEffect)(() => {
2375
- t2 && !i2.current && (i2.current = true, n2(Pc({ referralInfo: r2().searchParams.get(no.referral) ?? void 0 })));
2366
+ t2 && !i2.current && (i2.current = true, n2(Fc({ referralInfo: r2().searchParams.get(no.referral) ?? void 0 })));
2376
2367
  }, [t2, n2, r2]);
2377
2368
  };
2378
- function Wc(e2) {
2369
+ function Gc(e2) {
2379
2370
  return { evid: 1177, src: 16, endpoint: `wixboost-ugc`, params: e2 };
2380
2371
  }
2381
- function Gc(e2) {
2372
+ function Kc(e2) {
2382
2373
  return { evid: 596, src: 16, endpoint: `wixboost-ugc`, params: e2 };
2383
2374
  }
2384
- function Kc(e2, t2) {
2375
+ function qc(e2, t2) {
2385
2376
  let n2 = new Intl.DateTimeFormat(`en-US`, { timeZone: t2, hourCycle: `h23`, year: `numeric`, month: `2-digit`, day: `2-digit`, hour: `2-digit`, minute: `2-digit`, second: `2-digit` }).formatToParts(new Date(e2)), r2 = {};
2386
2377
  for (let e3 of n2) e3.type !== `literal` && (r2[e3.type] = Number(e3.value));
2387
2378
  return Date.UTC(r2.year, r2.month - 1, r2.day, r2.hour, r2.minute, r2.second) - e2;
2388
2379
  }
2389
- function qc(e2, t2) {
2380
+ function Jc(e2, t2) {
2390
2381
  let n2 = e2.match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2}))?/);
2391
2382
  if (!n2) return null;
2392
2383
  let [, r2, i2, a2, o2, s2, c2] = n2, l2 = Date.UTC(Number(r2), Number(i2) - 1, Number(a2), Number(o2), Number(s2), c2 ? Number(c2) : 0);
2393
2384
  if (Number.isNaN(l2)) return null;
2394
2385
  try {
2395
- let e3 = l2 - Kc(l2, t2);
2396
- return new Date(l2 - Kc(e3, t2));
2386
+ let e3 = l2 - qc(l2, t2);
2387
+ return new Date(l2 - qc(e3, t2));
2397
2388
  } catch {
2398
2389
  return null;
2399
2390
  }
2400
2391
  }
2401
- function Jc({ start: e2, end: t2, timeZone: n2, ...r2 }) {
2402
- let i2 = (e3) => e3 && n2 ? qc(e3, n2)?.getTime() : void 0;
2403
- return Ic({ bookingsServiceId: r2.serviceId, serviceType: r2.serviceType, startTime: i2(e2), endTime: i2(t2), isEligibleForFlowCompletion: r2.isEligibleForFlowCompletion });
2392
+ function Yc({ start: e2, end: t2, timeZone: n2, ...r2 }) {
2393
+ let i2 = (e3) => e3 && n2 ? Jc(e3, n2)?.getTime() : void 0;
2394
+ return Lc({ bookingsServiceId: r2.serviceId, serviceType: r2.serviceType, startTime: i2(e2), endTime: i2(t2), isEligibleForFlowCompletion: r2.isEligibleForFlowCompletion });
2404
2395
  }
2405
- function Yc({ nextAvailableSlotsCount: e2, isLoading: t2, hasError: n2, children: r2 }) {
2396
+ function Xc({ nextAvailableSlotsCount: e2, isLoading: t2, hasError: n2, children: r2 }) {
2406
2397
  let i2 = n2 ? `loadFailed` : null, a2 = (0, import_service.useServiceContext)(true), o2 = a2?.reschedule != null, s2 = { selectedDate: null, daysAvailabilityRange: null, daysAvailability: [], daysAvailabilityLoading: false, daysAvailabilityHasError: false, selectDate: async () => {
2407
2398
  }, setDaysAvailabilityRange: async () => {
2408
2399
  }, goToNextAvailableDate: async () => `cancelled`, canChangeTimeZone: false, isMultiService: false, isSelectionPending: a2?.isSelectionPending ?? false, availabilityRequestKey: null, needsServiceChoice: false, isRescheduling: o2, rescheduleValidUntil: null, staffFilterOptions: [], locationFilterOptions: [], selectedStaffFilter: null, requestedGender: null, genderSelectionAllowed: false, selectedLocationFilter: null, setStaffFilter: () => {
@@ -2416,115 +2407,115 @@ function Yc({ nextAvailableSlotsCount: e2, isLoading: t2, hasError: n2, children
2416
2407
  }, navigateToBookingForm: () => {
2417
2408
  }, timeSlotLimitPerDay: null, daysWithMore: /* @__PURE__ */ new Set(), loadingDate: null, loadAllTimeSlotsForDay: async () => {
2418
2409
  } };
2419
- return (0, import_jsx_runtime.jsx)(su.Provider, { value: s2, children: r2 });
2420
- }
2421
- function Xc({ nextAvailableSlotsCount: e2, children: t2 }) {
2422
- return (0, import_jsx_runtime.jsx)(Yc, { nextAvailableSlotsCount: e2, isLoading: true, hasError: false, children: t2 });
2410
+ return (0, import_jsx_runtime.jsx)(du.Provider, { value: s2, children: r2 });
2423
2411
  }
2424
2412
  function Zc({ nextAvailableSlotsCount: e2, children: t2 }) {
2425
- return (0, import_jsx_runtime.jsx)(Yc, { nextAvailableSlotsCount: e2, isLoading: false, hasError: true, children: t2 });
2413
+ return (0, import_jsx_runtime.jsx)(Xc, { nextAvailableSlotsCount: e2, isLoading: true, hasError: false, children: t2 });
2414
+ }
2415
+ function Qc({ nextAvailableSlotsCount: e2, children: t2 }) {
2416
+ return (0, import_jsx_runtime.jsx)(Xc, { nextAvailableSlotsCount: e2, isLoading: false, hasError: true, children: t2 });
2426
2417
  }
2427
- var Qc = 1e3;
2428
- function $c(e2, t2, { waitlistAvailable: n2 = false } = {}) {
2418
+ var $c = 1e3;
2419
+ function el(e2, t2, { waitlistAvailable: n2 = false } = {}) {
2429
2420
  let r2 = /* @__PURE__ */ new Map();
2430
2421
  for (let e3 of t2) {
2431
2422
  let t3 = e3.localStartDate?.slice(0, 10);
2432
2423
  t3 && (e3.bookable || n2 && No(e3) ? r2.set(t3, `available`) : r2.has(t3) || r2.set(t3, `unavailable`));
2433
2424
  }
2434
- let i2 = [], a2 = Ko(e2);
2425
+ let i2 = [], a2 = qo(e2);
2435
2426
  for (let t3 = 0; t3 < a2; t3 += 1) {
2436
- let n3 = Go(e2.startDate, t3);
2427
+ let n3 = Ko(e2.startDate, t3);
2437
2428
  i2.push({ date: n3, availability: r2.get(n3) ?? `none` });
2438
2429
  }
2439
2430
  return i2;
2440
2431
  }
2441
- function el(e2, t2) {
2442
- return { fromLocalDate: Bo(e2.startDate, t2), toLocalDate: Ro(Fo(e2.endDate)) };
2432
+ function tl(e2, t2) {
2433
+ return { fromLocalDate: Vo(e2.startDate, t2), toLocalDate: zo(Io(e2.endDate)) };
2443
2434
  }
2444
- async function tl(e2, t2, n2, r2, i2, a2) {
2445
- return (await ms({ serviceId: e2, ...el(n2, t2), timeZone: t2, ...rs(r2), ...is(i2), ...os(a2, i2), timeSlotsPerDay: 1, cursorPaging: { limit: Math.min(Ko(n2), Qc) } })).timeSlots ?? [];
2435
+ async function nl(e2, t2, n2, r2, i2, a2) {
2436
+ return (await hs({ serviceId: e2, ...tl(n2, t2), timeZone: t2, ...is(r2), ...as(i2), ...ss(a2, i2), timeSlotsPerDay: 1, cursorPaging: { limit: Math.min(qo(n2), $c) } })).timeSlots ?? [];
2446
2437
  }
2447
- async function nl(e2, t2, n2, r2, i2, a2, o2 = false) {
2448
- let s2 = { serviceIds: [e2], ...el(n2, t2), timeZone: t2, includeNonBookable: true, eventFilter: { type: `CLASS`, ...hs(r2, i2, a2) } };
2449
- if (!o2) return (await gs({ ...s2, maxSlotsPerDay: 1, cursorPaging: { limit: Math.min(Ko(n2), Qc) } })).timeSlots;
2438
+ async function rl(e2, t2, n2, r2, i2, a2, o2 = false) {
2439
+ let s2 = { serviceIds: [e2], ...tl(n2, t2), timeZone: t2, includeNonBookable: true, eventFilter: { type: `CLASS`, ...gs(r2, i2, a2) } };
2440
+ if (!o2) return (await _s({ ...s2, maxSlotsPerDay: 1, cursorPaging: { limit: Math.min(qo(n2), $c) } })).timeSlots;
2450
2441
  let c2 = [], l2;
2451
2442
  do {
2452
- let e3 = await gs({ ...s2, cursorPaging: { limit: Qc, ...l2 ? { cursor: l2 } : {} } });
2443
+ let e3 = await _s({ ...s2, cursorPaging: { limit: $c, ...l2 ? { cursor: l2 } : {} } });
2453
2444
  c2.push(...e3.timeSlots), l2 = e3.nextCursor ?? void 0;
2454
2445
  } while (l2);
2455
2446
  return c2;
2456
2447
  }
2457
- async function rl({ serviceId: e2, serviceType: t2, range: n2, fromDate: r2, timeZone: i2, locationId: a2, staffId: o2, customerChoices: s2, minRemainingCapacity: c2, keepWaitlistSlots: l2 = false }) {
2458
- if ($a(t2) || n2.endDate < r2) return $c(n2, []);
2459
- let u2 = { startDate: n2.startDate < r2 ? r2 : n2.startDate, endDate: n2.endDate }, d2 = Qa(t2) ? Xo(u2) : [u2];
2460
- return $c(n2, (await Promise.all(d2.map((n3) => Qa(t2) ? nl(e2, i2, n3, a2, o2, c2, l2) : tl(e2, i2, n3, a2, o2, s2)))).flat(), { waitlistAvailable: l2 && Qa(t2) });
2448
+ async function il({ serviceId: e2, serviceType: t2, range: n2, fromDate: r2, timeZone: i2, locationId: a2, staffId: o2, customerChoices: s2, minRemainingCapacity: c2, keepWaitlistSlots: l2 = false }) {
2449
+ if ($a(t2) || n2.endDate < r2) return el(n2, []);
2450
+ let u2 = { startDate: n2.startDate < r2 ? r2 : n2.startDate, endDate: n2.endDate }, d2 = Qa(t2) ? Zo(u2) : [u2];
2451
+ return el(n2, (await Promise.all(d2.map((n3) => Qa(t2) ? rl(e2, i2, n3, a2, o2, c2, l2) : nl(e2, i2, n3, a2, o2, s2)))).flat(), { waitlistAvailable: l2 && Qa(t2) });
2461
2452
  }
2462
- function il({ serviceId: e2, staff: t2, customerChoices: n2 }) {
2453
+ function al({ serviceId: e2, staff: t2, customerChoices: n2 }) {
2463
2454
  let r2 = t2 && !t2.anyResource ? t2.staffMemberId : void 0;
2464
- return { serviceId: e2, ...os(n2, r2), ...t2?.anyResource ? {} : { includeResourceTypeIds: [Kr] }, ...r2 ? { resourceTypes: [{ resourceTypeId: Kr, resourceIds: [r2] }] } : {} };
2455
+ return { serviceId: e2, ...ss(n2, r2), ...t2?.anyResource ? {} : { includeResourceTypeIds: [Kr] }, ...r2 ? { resourceTypes: [{ resourceTypeId: Kr, resourceIds: [r2] }] } : {} };
2465
2456
  }
2466
- function al({ services: e2, locationId: t2, locationType: n2, timeZone: r2 }) {
2467
- return { services: e2.map(il), timeZone: r2, location: { ...t2 ? { _id: t2 } : {}, locationType: n2 } };
2457
+ function ol({ services: e2, locationId: t2, locationType: n2, timeZone: r2 }) {
2458
+ return { services: e2.map(al), timeZone: r2, location: { ...t2 ? { _id: t2 } : {}, locationType: n2 } };
2468
2459
  }
2469
- function ol(e2) {
2470
- let { customerChoices: t2, ...n2 } = e2, r2 = t2 ? as(t2) : void 0;
2460
+ function sl(e2) {
2461
+ let { customerChoices: t2, ...n2 } = e2, r2 = t2 ? os(t2) : void 0;
2471
2462
  return r2 ? { ...n2, customerChoices: r2 } : n2;
2472
2463
  }
2473
- async function sl(e2) {
2474
- let t2 = e2.services ?? [], n2 = () => Da({ ...e2, services: t2.map(ol) }), r2 = t2.some((e3) => e3.customerChoices?.requestedGender);
2475
- if (r2 && ds()) return n2();
2464
+ async function cl(e2) {
2465
+ let t2 = e2.services ?? [], n2 = () => Da({ ...e2, services: t2.map(sl) }), r2 = t2.some((e3) => e3.customerChoices?.requestedGender);
2466
+ if (r2 && fs()) return n2();
2476
2467
  try {
2477
2468
  return await Da(e2);
2478
2469
  } catch (e3) {
2479
- if (!r2 || !cs(e3)) throw e3;
2480
- return ko(e3, { feature: $.timeSlots, action: `requested-gender-rejected`, level: `warning` }), ps(), n2();
2470
+ if (!r2 || !ls(e3)) throw e3;
2471
+ return ko(e3, { feature: $.timeSlots, action: `requested-gender-rejected`, level: `warning` }), ms(), n2();
2481
2472
  }
2482
2473
  }
2483
- var cl = 1e3;
2484
- async function ll({ range: e2, fromDate: t2, ...n2 }) {
2485
- if (e2.endDate < t2) return $c(e2, []);
2474
+ var ll = 1e3;
2475
+ async function ul({ range: e2, fromDate: t2, ...n2 }) {
2476
+ if (e2.endDate < t2) return el(e2, []);
2486
2477
  let r2 = { startDate: e2.startDate < t2 ? t2 : e2.startDate, endDate: e2.endDate };
2487
- return $c(e2, (await sl({ ...al(n2), fromLocalDate: Bo(r2.startDate, n2.timeZone), toLocalDate: Ro(Fo(r2.endDate)), timeSlotsPerDay: 1, cursorPaging: { limit: Math.min(Ko(r2), cl) } })).timeSlots ?? []);
2478
+ return el(e2, (await cl({ ...ol(n2), fromLocalDate: Vo(r2.startDate, n2.timeZone), toLocalDate: zo(Io(r2.endDate)), timeSlotsPerDay: 1, cursorPaging: { limit: Math.min(qo(r2), ll) } })).timeSlots ?? []);
2488
2479
  }
2489
- async function ul({ date: e2, onlyAvailableSlots: t2, fromLocalDate: n2, ...r2 }) {
2480
+ async function dl({ date: e2, onlyAvailableSlots: t2, fromLocalDate: n2, ...r2 }) {
2490
2481
  let i2 = `${e2}T00:00:00`, a2 = [], o2 = null, s2;
2491
2482
  do {
2492
- let c2 = await sl({ ...al(r2), fromLocalDate: n2 && n2 > i2 ? n2 : i2, toLocalDate: `${e2}T23:59:59`, ...t2 ? { bookable: true } : {}, cursorPaging: { limit: cl, ...s2 ? { cursor: s2 } : {} } });
2483
+ let c2 = await cl({ ...ol(r2), fromLocalDate: n2 && n2 > i2 ? n2 : i2, toLocalDate: `${e2}T23:59:59`, ...t2 ? { bookable: true } : {}, cursorPaging: { limit: ll, ...s2 ? { cursor: s2 } : {} } });
2493
2484
  a2.push(...c2.timeSlots ?? []), o2 = c2.timeZone ?? o2, s2 = c2.cursorPagingMetadata?.cursors?.next || void 0;
2494
2485
  } while (s2);
2495
2486
  return { timeSlots: a2, timeZone: o2 };
2496
2487
  }
2497
- async function dl({ fromDate: e2, ...t2 }) {
2498
- let n2 = await sl({ ...al(t2), ...xs(e2), bookable: true, cursorPaging: { limit: 1 } });
2488
+ async function fl({ fromDate: e2, ...t2 }) {
2489
+ let n2 = await cl({ ...ol(t2), ...Ss(e2), bookable: true, cursorPaging: { limit: 1 } });
2499
2490
  return { timeSlots: n2.timeSlots ?? [], timeZone: n2.timeZone ?? null };
2500
2491
  }
2501
- var fl = Lr(`@wix/site-service-experiments`);
2502
- function pl(e2) {
2492
+ var pl = Lr(`@wix/site-service-experiments`);
2493
+ function ml(e2) {
2503
2494
  try {
2504
2495
  return (0, import_services_manager_react.useService)(e2);
2505
2496
  } catch {
2506
2497
  return null;
2507
2498
  }
2508
2499
  }
2509
- function ml(e2, t2) {
2500
+ function hl(e2, t2) {
2510
2501
  try {
2511
2502
  return e2?.isOpen(t2) ?? false;
2512
2503
  } catch {
2513
2504
  return false;
2514
2505
  }
2515
2506
  }
2516
- function hl(e2) {
2517
- return ml(pl(fl), e2);
2507
+ function gl(e2) {
2508
+ return hl(ml(pl), e2);
2518
2509
  }
2519
- var gl = [];
2520
- function _l({ enabled: e2, serviceId: t2, serviceType: n2, multiServiceRequest: r2, timeZone: a2, today: u2, locationId: f2, staffId: p2, loadInitially: m2, customerChoices: h2, minRemainingCapacity: g2, onlyAvailableSlots: _2 }) {
2521
- let { service: v2 } = (0, import_service.useServiceContext)(), y2 = hl(`bookingsUouWaitlistInAvailableSlots`) && _2 && v2?.bookingPolicy?.waitlistPolicy?.enabled === true, [b2, x2] = (0, import_react.useState)(null), [S2, C2] = (0, import_react.useState)(m2), [w2, T2] = (0, import_react.useState)(gl), [E2, D2] = (0, import_react.useState)(false), [ee2, O2] = (0, import_react.useState)(false), k2 = (0, import_react.useRef)(0);
2510
+ var _l = [];
2511
+ function vl({ enabled: e2, serviceId: t2, serviceType: n2, multiServiceRequest: r2, timeZone: a2, today: u2, locationId: f2, staffId: p2, loadInitially: m2, customerChoices: h2, minRemainingCapacity: g2, onlyAvailableSlots: _2 }) {
2512
+ let { service: v2 } = (0, import_service.useServiceContext)(), y2 = gl(`bookingsUouWaitlistInAvailableSlots`) && _2 && v2?.bookingPolicy?.waitlistPolicy?.enabled === true, [b2, x2] = (0, import_react.useState)(null), [S2, C2] = (0, import_react.useState)(m2), [w2, T2] = (0, import_react.useState)(_l), [E2, D2] = (0, import_react.useState)(false), [ee2, O2] = (0, import_react.useState)(false), k2 = (0, import_react.useRef)(0);
2522
2513
  (0, import_react.useEffect)(() => {
2523
- b2 === null && u2 && x2(qo(u2));
2514
+ b2 === null && u2 && x2(Jo(u2));
2524
2515
  }, [b2, u2]), (0, import_react.useEffect)(() => {
2525
2516
  if (!S2 || !e2 || !(t2 || r2) || !a2 || !u2 || !b2 || !r2 && $a(n2)) return;
2526
2517
  let i2 = ++k2.current;
2527
- return D2(true), (r2 ? ll({ ...r2, range: b2, fromDate: u2, timeZone: a2 }) : rl({ serviceId: t2, serviceType: n2, range: b2, fromDate: u2, timeZone: a2, locationId: f2 ?? void 0, staffId: p2 ?? void 0, customerChoices: h2, minRemainingCapacity: g2, keepWaitlistSlots: y2 })).then((e3) => {
2518
+ return D2(true), (r2 ? ul({ ...r2, range: b2, fromDate: u2, timeZone: a2 }) : il({ serviceId: t2, serviceType: n2, range: b2, fromDate: u2, timeZone: a2, locationId: f2 ?? void 0, staffId: p2 ?? void 0, customerChoices: h2, minRemainingCapacity: g2, keepWaitlistSlots: y2 })).then((e3) => {
2528
2519
  i2 === k2.current && (T2(e3), O2(false), D2(false));
2529
2520
  }).catch((e3) => {
2530
2521
  i2 === k2.current && (ko(e3, { feature: $.timeSlots, action: `fetch-days-availability`, level: `warning` }), O2(true), D2(false));
@@ -2533,12 +2524,12 @@ function _l({ enabled: e2, serviceId: t2, serviceType: n2, multiServiceRequest:
2533
2524
  };
2534
2525
  }, [S2, e2, t2, n2, r2, a2, u2, b2, f2, p2, h2, g2, y2]);
2535
2526
  let A2 = (0, import_react.useCallback)(async (e3) => {
2536
- Wo(e3) && (x2(e3), C2(true));
2527
+ Go(e3) && (x2(e3), C2(true));
2537
2528
  }, []);
2538
2529
  return { range: b2, daysAvailability: (0, import_react.useMemo)(() => _2 ? w2.map((e3) => e3.availability === `unavailable` ? { ...e3, availability: `none` } : e3) : w2, [w2, _2]), isLoading: E2, hasError: ee2, setRange: A2 };
2539
2530
  }
2540
- function vl({ enabled: e2, serviceId: t2, serviceType: n2, multiServiceRequest: r2, timeZone: a2, today: s2, locationId: u2, staffId: d2, customerChoices: f2, minRemainingCapacity: p2, onlyAvailableSlots: m2, serviceLoading: h2 }) {
2541
- let g2 = hl(`bookingsUouWaitlistInAvailableSlots`), [_2, v2] = (0, import_react.useState)(null), [y2, b2] = (0, import_react.useState)(0), [x2, S2] = (0, import_react.useState)(null), [C2, w2] = (0, import_react.useState)(null), [T2, E2] = (0, import_react.useState)(null), [D2, ee2] = (0, import_react.useState)(false), O2 = (0, import_react.useRef)(0), k2 = (0, import_react.useRef)(0), A2 = (0, import_react.useRef)(0), j2 = (0, import_react.useCallback)(() => {
2531
+ function yl({ enabled: e2, serviceId: t2, serviceType: n2, multiServiceRequest: r2, timeZone: a2, today: s2, locationId: u2, staffId: d2, customerChoices: f2, minRemainingCapacity: p2, onlyAvailableSlots: m2, serviceLoading: h2 }) {
2532
+ let g2 = gl(`bookingsUouWaitlistInAvailableSlots`), [_2, v2] = (0, import_react.useState)(null), [y2, b2] = (0, import_react.useState)(0), [x2, S2] = (0, import_react.useState)(null), [C2, w2] = (0, import_react.useState)(null), [T2, E2] = (0, import_react.useState)(null), [D2, ee2] = (0, import_react.useState)(false), O2 = (0, import_react.useRef)(0), k2 = (0, import_react.useRef)(0), A2 = (0, import_react.useRef)(0), j2 = (0, import_react.useCallback)(() => {
2542
2533
  k2.current += 1, ee2(false);
2543
2534
  }, []);
2544
2535
  (0, import_react.useEffect)(() => {
@@ -2554,18 +2545,14 @@ function vl({ enabled: e2, serviceId: t2, serviceType: n2, multiServiceRequest:
2554
2545
  return;
2555
2546
  }
2556
2547
  if (!e2 || !(t2 || r2) || !a2) return;
2557
- if (s2 && _2.date < s2) {
2558
- v2(null);
2559
- return;
2560
- }
2561
- if (!r2 && $a(n2)) {
2548
+ if (s2 && _2.date < s2 || !r2 && $a(n2)) {
2562
2549
  v2(null);
2563
2550
  return;
2564
2551
  }
2565
- let i2 = zo(new Date(Date.now()), a2), o2 = ++O2.current;
2552
+ let i2 = Bo(new Date(Date.now()), a2), o2 = ++O2.current;
2566
2553
  S2(null), w2(null), E2(null);
2567
2554
  let c2 = i2.slice(0, 10) === _2.date ? i2 : void 0;
2568
- return (r2 ? ul({ ...r2, date: _2.date, timeZone: a2, onlyAvailableSlots: m2, fromLocalDate: c2 }) : ws({ serviceId: t2, serviceType: n2, date: _2.date, timeZone: a2, onlyAvailableSlots: m2, locationId: u2 ?? void 0, staffId: d2 ?? void 0, customerChoices: f2, minRemainingCapacity: p2, keepWaitlistSlots: g2, fromLocalDate: c2 })).then((e3) => {
2555
+ return (r2 ? dl({ ...r2, date: _2.date, timeZone: a2, onlyAvailableSlots: m2, fromLocalDate: c2 }) : Ts({ serviceId: t2, serviceType: n2, date: _2.date, timeZone: a2, onlyAvailableSlots: m2, locationId: u2 ?? void 0, staffId: d2 ?? void 0, customerChoices: f2, minRemainingCapacity: p2, keepWaitlistSlots: g2, fromLocalDate: c2 })).then((e3) => {
2569
2556
  o2 === O2.current && S2({ timeSlots: e3.timeSlots, timeZone: e3.timeZone ?? a2 });
2570
2557
  }).catch((e3) => {
2571
2558
  o2 === O2.current && (ko(e3, { feature: $.timeSlots, action: `fetch-day-time-slots`, level: `warning` }), w2(`timeSlotsLoadFailed`));
@@ -2574,14 +2561,14 @@ function vl({ enabled: e2, serviceId: t2, serviceType: n2, multiServiceRequest:
2574
2561
  };
2575
2562
  }, [_2, y2, e2, t2, h2, n2, r2, a2, s2, u2, d2, f2, p2, m2, g2, M2]);
2576
2563
  let te2 = (0, import_react.useCallback)(async (e3) => {
2577
- !r2 && $a(n2) || !Uo(e3) || s2 && e3 < s2 || (j2(), b2((e4) => e4 + 1), v2({ kind: `day`, date: e3 }));
2564
+ !r2 && $a(n2) || !Wo(e3) || s2 && e3 < s2 || (j2(), b2((e4) => e4 + 1), v2({ kind: `day`, date: e3 }));
2578
2565
  }, [n2, r2, s2, j2]), N2 = _2?.date ?? null, ne2 = (0, import_react.useCallback)(async () => {
2579
2566
  let i2 = !!(t2 || r2);
2580
2567
  if (!r2 && $a(n2) || !e2 || !i2 || !a2) return { outcome: `none` };
2581
2568
  let o2 = O2.current, c2 = ++k2.current, l2 = ++A2.current, m3 = () => o2 === O2.current && c2 === k2.current;
2582
2569
  ee2(true), E2(null);
2583
2570
  try {
2584
- let e3 = N2 ?? s2 ?? void 0, i3 = r2 ? await dl({ ...r2, timeZone: a2, fromDate: e3 }) : await Ss({ serviceId: t2, serviceType: n2, timeZone: a2, limit: 1, onlyAvailableSlots: true, fromDate: e3, locationId: u2 ?? void 0, staffId: d2 ?? void 0, customerChoices: f2, minRemainingCapacity: p2 });
2571
+ let e3 = N2 ?? s2 ?? void 0, i3 = r2 ? await fl({ ...r2, timeZone: a2, fromDate: e3 }) : await Cs({ serviceId: t2, serviceType: n2, timeZone: a2, limit: 1, onlyAvailableSlots: true, fromDate: e3, locationId: u2 ?? void 0, staffId: d2 ?? void 0, customerChoices: f2, minRemainingCapacity: p2 });
2585
2572
  if (!m3()) return { outcome: `cancelled` };
2586
2573
  let o3 = i3.timeSlots[0]?.localStartDate?.slice(0, 10) ?? null;
2587
2574
  return o3 ? { outcome: `found`, date: o3 } : { outcome: `none` };
@@ -2593,38 +2580,38 @@ function vl({ enabled: e2, serviceId: t2, serviceType: n2, multiServiceRequest:
2593
2580
  }, [e2, t2, n2, r2, a2, s2, u2, d2, f2, p2, N2]), P2 = T2 ?? C2;
2594
2581
  return { query: _2, selectedDate: N2, timeSlots: x2?.timeSlots ?? null, timeZone: x2?.timeZone ?? null, isLoading: D2 || _2 !== null && x2 === null && C2 === null, error: P2, selectDate: te2, findNextAvailableDate: ne2 };
2595
2582
  }
2596
- var yl = (e2) => e2?.type === `DATE_TIME`;
2597
- function bl(e2) {
2583
+ var bl = (e2) => e2?.type === `DATE_TIME`;
2584
+ function xl(e2) {
2598
2585
  let t2 = e2.schedule?.availabilityConstraints?.durations;
2599
2586
  if (!Za(e2.type) || !Array.isArray(t2)) return false;
2600
2587
  let n2 = t2.map((e3) => typeof e3 == `number` ? e3 : e3?.minutes);
2601
2588
  return new Set(n2).size > 1;
2602
2589
  }
2603
- function xl({ service: e2, multiServiceAppointmentsEnabled: t2, variants: n2, locationId: r2 }) {
2590
+ function Sl({ service: e2, multiServiceAppointmentsEnabled: t2, variants: n2, locationId: r2 }) {
2604
2591
  if (!Za(e2.type)) return false;
2605
- if (t2 || bl(e2) || to(e2)) return true;
2606
- if (!eo(e2) || yl(n2)) return false;
2607
- let i2 = Fs(e2, r2);
2608
- return r2 && i2 !== r2 ? true : !Ms(n2, Ps(e2), i2);
2592
+ if (t2 || xl(e2) || to(e2)) return true;
2593
+ if (!eo(e2) || bl(n2)) return false;
2594
+ let i2 = Is(e2, r2);
2595
+ return r2 && i2 !== r2 ? true : !Ns(n2, Fs(e2), i2);
2609
2596
  }
2610
- function Sl(e2, t2) {
2597
+ function Cl(e2, t2) {
2611
2598
  return !!Ir(e2)?.services.some((e3) => e3.serviceId === t2);
2612
2599
  }
2613
- function Cl({ blobParam: e2, ...t2 }) {
2614
- return !t2.service._id || Sl(e2, t2.service._id) ? false : xl({ ...t2, multiServiceAppointmentsEnabled: false });
2600
+ function wl({ blobParam: e2, ...t2 }) {
2601
+ return !t2.service._id || Cl(e2, t2.service._id) ? false : Sl({ ...t2, multiServiceAppointmentsEnabled: false });
2615
2602
  }
2616
- function wl(e2) {
2603
+ function Tl(e2) {
2617
2604
  return !!e2?._id;
2618
2605
  }
2619
- function Tl() {
2606
+ function El() {
2620
2607
  try {
2621
2608
  return (0, import_services_manager_react.useGetService)();
2622
2609
  } catch {
2623
2610
  return null;
2624
2611
  }
2625
2612
  }
2626
- function El() {
2627
- let e2 = Tl();
2613
+ function Dl() {
2614
+ let e2 = El();
2628
2615
  return (0, import_react.useCallback)((t2) => {
2629
2616
  if (!e2) return false;
2630
2617
  try {
@@ -2635,71 +2622,95 @@ function El() {
2635
2622
  }
2636
2623
  }, [e2]);
2637
2624
  }
2638
- function Dl(e2) {
2639
- let { service: t2, isLoading: n2, hasError: r2, bookingsSettingsLoading: i2, isLoadingServiceOptionsAndVariants: a2, pricingOption: s2, multiServiceAppointmentsEnabled: l2, isMultiServiceAppointment: u2, reschedule: f2, selection: p2, isSelectionPending: m2, openPreferences: h2, editingSurface: g2 } = (0, import_service.useServiceContext)(), _2 = El(), v2 = Hc(Lc.PREFERENCES), y2 = (0, import_react.useRef)(false), b2 = e2 && !m2 && !g2 && !n2 && !r2 && !i2 && !a2 && f2 == null && !u2 && wl(t2), x2 = p2.locationId ?? void 0, S2 = Mc(m2);
2625
+ function Ol(e2) {
2626
+ let { service: t2, isLoading: n2, hasError: r2, bookingsSettingsLoading: i2, isLoadingServiceOptionsAndVariants: a2, pricingOption: s2, multiServiceAppointmentsEnabled: l2, isMultiServiceAppointment: u2, reschedule: f2, selection: p2, isSelectionPending: m2, openPreferences: h2, editingSurface: g2 } = (0, import_service.useServiceContext)(), _2 = Dl(), v2 = Uc(Rc.PREFERENCES), y2 = (0, import_react.useRef)(false), b2 = e2 && !m2 && !g2 && !n2 && !r2 && !i2 && !a2 && f2 == null && !u2 && Tl(t2), x2 = p2.locationId ?? void 0, S2 = Nc(m2);
2640
2627
  (0, import_react.useEffect)(() => {
2641
- !y2.current && b2 && (y2.current = true, _2(qr.CALENDAR_PAGE) && Cl({ service: t2, multiServiceAppointmentsEnabled: l2, variants: s2, locationId: x2, blobParam: S2 }) && (jo({ message: `Calendar opens the preferences modal`, category: `navigation`, feature: $.timeSlots, data: { serviceId: t2._id ?? null, serviceType: t2.type ?? null } }), v2(Wc({ action: zc.EDIT_BASKET_ITEM_FROM_CALENDAR, numberOfServices: 1, isMultiFlow: l2 })), h2().then(() => Ao(`Preferences modal opened`, { feature: $.timeSlots, action: `auto-open-preferences`, tags: { serviceType: t2.type ?? `unknown` } }), (e3) => ko(e3, { feature: $.timeSlots, action: `open-preferences-lightbox` }))));
2628
+ !y2.current && b2 && (y2.current = true, _2(qr.CALENDAR_PAGE) && wl({ service: t2, multiServiceAppointmentsEnabled: l2, variants: s2, locationId: x2, blobParam: S2 }) && (jo({ message: `Calendar opens the preferences modal`, category: `navigation`, feature: $.timeSlots, data: { serviceId: t2._id ?? null, serviceType: t2.type ?? null } }), v2(Gc({ action: Bc.EDIT_BASKET_ITEM_FROM_CALENDAR, numberOfServices: 1, isMultiFlow: l2 })), h2().then(() => Ao(`Preferences modal opened`, { feature: $.timeSlots, action: `auto-open-preferences`, tags: { serviceType: t2.type ?? `unknown` } }), (e3) => ko(e3, { feature: $.timeSlots, action: `open-preferences-lightbox` }))));
2642
2629
  }, [b2, t2, l2, s2, x2, S2, _2, v2, h2]);
2643
2630
  }
2644
- function Ol(e2, t2) {
2631
+ function kl({ ready: e2, answer: t2, run: n2, rerunsOn: r2 }) {
2632
+ let [a2, s2] = (0, import_react.useState)(false), [u2, d2] = (0, import_react.useState)(0), f2 = (0, import_react.useRef)([]), p2 = (0, import_react.useRef)(false), m2 = (0, import_react.useRef)(0), h2 = (0, import_react.useRef)({ ready: e2, answer: t2, run: n2, rerunsOn: r2 });
2633
+ h2.current = { ready: e2, answer: t2, run: n2, rerunsOn: r2 };
2634
+ let g2 = (0, import_react.useCallback)(() => {
2635
+ s2(false);
2636
+ let e3 = f2.current;
2637
+ return f2.current = [], e3;
2638
+ }, []), _2 = (0, import_react.useCallback)((e3) => {
2639
+ let t3 = m2.current;
2640
+ p2.current = true, h2.current.run().then((n3) => {
2641
+ p2.current = false, h2.current.rerunsOn?.(n3) && t3 === m2.current ? (f2.current.unshift(...e3), s2(true)) : e3.forEach((e4) => e4(n3)), d2((e4) => e4 + 1);
2642
+ });
2643
+ }, []), v2 = (0, import_react.useCallback)(() => {
2644
+ let { ready: e3, answer: t3 } = h2.current;
2645
+ return t3 === void 0 ? new Promise((t4) => {
2646
+ e3 && !p2.current ? _2([...g2(), t4]) : (f2.current.push(t4), s2(true));
2647
+ }) : Promise.resolve(t3);
2648
+ }, [_2, g2]), y2 = (0, import_react.useCallback)((e3) => {
2649
+ m2.current += 1, g2().forEach((t3) => t3(e3));
2650
+ }, [g2]);
2651
+ return (0, import_react.useEffect)(() => {
2652
+ a2 && !p2.current && (t2 === void 0 ? e2 && _2(g2()) : g2().forEach((e3) => e3(t2)));
2653
+ }, [a2, u2, e2, t2, _2, g2]), { request: v2, cancel: y2, held: a2 };
2654
+ }
2655
+ function Al(e2, t2) {
2645
2656
  return t2 === void 0 ? false : !e2 || new Date(e2).getTime() <= t2;
2646
2657
  }
2647
- var kl = 864e5;
2648
- function Al({ serviceId: e2, serviceType: t2, lastSessionEnd: n2, timeZone: r2, now: i2, onlyAvailableSlots: a2, locationId: o2, staffId: s2, timeSlotLimitPerDay: c2, customerChoices: l2, minRemainingCapacity: u2 }) {
2649
- let d2 = { serviceId: e2, onlyAvailableSlots: a2, locationId: o2 ?? void 0, staffId: s2 ?? void 0, timeZone: r2, fromLocalDate: zo(new Date(i2), r2) };
2650
- return Qa(t2) ? { ...d2, serviceType: `CLASS`, minRemainingCapacity: u2 } : $a(t2) ? !n2 || Ol(n2, i2) ? void 0 : { ...d2, serviceType: `COURSE`, toLocalDate: zo(new Date(new Date(n2).getTime() + kl), r2) } : { ...d2, serviceType: `APPOINTMENT`, toLocalDate: xs().toLocalDate, timeSlotsPerDay: c2 + 1, customerChoices: l2 };
2658
+ var jl = 864e5;
2659
+ function Ml({ serviceId: e2, serviceType: t2, lastSessionEnd: n2, timeZone: r2, now: i2, onlyAvailableSlots: a2, locationId: o2, staffId: s2, timeSlotLimitPerDay: c2, customerChoices: l2, minRemainingCapacity: u2 }) {
2660
+ let d2 = { serviceId: e2, onlyAvailableSlots: a2, locationId: o2 ?? void 0, staffId: s2 ?? void 0, timeZone: r2, fromLocalDate: Bo(new Date(i2), r2) };
2661
+ return Qa(t2) ? { ...d2, serviceType: `CLASS`, minRemainingCapacity: u2 } : $a(t2) ? !n2 || Al(n2, i2) ? void 0 : { ...d2, serviceType: `COURSE`, toLocalDate: Bo(new Date(new Date(n2).getTime() + jl), r2) } : { ...d2, serviceType: `APPOINTMENT`, toLocalDate: Ss().toLocalDate, timeSlotsPerDay: c2 + 1, customerChoices: l2 };
2651
2662
  }
2652
- function jl({ isAppointment: e2, staffOnSlotCount: t2, hasStaffFilter: n2, hasRequestedGender: r2, hasStaffPricedVariants: i2, staffSelectionStrategy: a2 }) {
2663
+ function Nl({ isAppointment: e2, staffOnSlotCount: t2, hasStaffFilter: n2, hasRequestedGender: r2, hasStaffPricedVariants: i2, staffSelectionStrategy: a2 }) {
2653
2664
  return e2 && t2 > 1 && !n2 && !i2 && (a2 !== `CUSTOMER_MUST_CHOOSE` || r2);
2654
2665
  }
2655
- function Ml(e2, t2) {
2666
+ function Pl(e2, t2) {
2656
2667
  return e2.length ? e2.length === 1 ? { anyResource: false, staffMemberId: e2[0] } : t2 ? { anyResource: true } : null : null;
2657
2668
  }
2658
- function Nl(e2, t2, n2) {
2669
+ function Fl(e2, t2, n2) {
2659
2670
  return t2 && !t2.anyResource && e2.includes(t2.staffMemberId) ? { isComplete: true, resourceId: t2.staffMemberId } : t2?.anyResource && n2 ? { isComplete: true, resourceId: void 0 } : e2.length <= 1 ? { isComplete: true, resourceId: e2[0] } : { isComplete: n2, resourceId: void 0 };
2660
2671
  }
2661
- var Pl = { staff: null, requestedGender: null, locationId: null };
2662
- function Fl({ entry: e2, appointmentLike: t2, staffChoiceHidden: n2, staffPriced: r2, staffSelectionStrategy: i2, genderAllowed: a2, staffMemberIds: o2, locationIds: s2 }) {
2663
- if (!e2) return Pl;
2672
+ var Il = { staff: null, requestedGender: null, locationId: null };
2673
+ function Ll({ entry: e2, appointmentLike: t2, staffChoiceHidden: n2, staffPriced: r2, staffSelectionStrategy: i2, genderAllowed: a2, staffMemberIds: o2, locationIds: s2 }) {
2674
+ if (!e2) return Il;
2664
2675
  let c2 = e2.locationId && s2.includes(e2.locationId) ? e2.locationId : null, l2 = t2 && !n2 ? lo(e2) : null;
2665
- if (!l2) return { ...Pl, locationId: c2 };
2666
- if (!l2.anyResource) return o2.includes(l2.staffMemberId) ? { staff: l2, requestedGender: null, locationId: c2 } : { ...Pl, locationId: c2 };
2676
+ if (!l2) return { ...Il, locationId: c2 };
2677
+ if (!l2.anyResource) return o2.includes(l2.staffMemberId) ? { staff: l2, requestedGender: null, locationId: c2 } : { ...Il, locationId: c2 };
2667
2678
  let u2 = a2 ? e2.requestedGender ?? null : null;
2668
- return o2.length > 1 && !r2 && (i2 !== `CUSTOMER_MUST_CHOOSE` || u2 !== null) ? { staff: l2, requestedGender: u2, locationId: c2 } : { ...Pl, locationId: c2 };
2679
+ return o2.length > 1 && !r2 && (i2 !== `CUSTOMER_MUST_CHOOSE` || u2 !== null) ? { staff: l2, requestedGender: u2, locationId: c2 } : { ...Il, locationId: c2 };
2669
2680
  }
2670
- var Il = [];
2671
- function Ll({ sessions: e2, dayQuery: t2, daySlots: n2, staffFilter: r2, appointmentLike: i2, limitPerDay: a2, expandedDates: o2 }) {
2672
- let s2 = Kl(ql(e2, r2)), c2 = n2 ? ql(i2 ? ns(n2) : n2, r2) : Il;
2673
- return { rows: t2 ? c2 : Jl(s2, a2, o2), slotIdOf: t2 ? $o : ts, daysWithMore: Gl(s2, a2, o2) };
2681
+ var Rl = [];
2682
+ function zl({ sessions: e2, dayQuery: t2, daySlots: n2, staffFilter: r2, appointmentLike: i2, limitPerDay: a2, expandedDates: o2 }) {
2683
+ let s2 = Jl(Yl(e2, r2)), c2 = n2 ? Yl(i2 ? rs(n2) : n2, r2) : Rl;
2684
+ return { rows: t2 ? c2 : Xl(s2, a2, o2), slotIdOf: t2 ? es : ns, daysWithMore: ql(s2, a2, o2) };
2674
2685
  }
2675
- function Rl({ rows: e2, slotIdOf: t2 }, n2) {
2676
- return [...e2.filter((e3) => t2(e3) === n2)].sort((e3, t3) => Wl(t3) - Wl(e3))[0] ?? null;
2686
+ function Bl({ rows: e2, slotIdOf: t2 }, n2) {
2687
+ return [...e2.filter((e3) => t2(e3) === n2)].sort((e3, t3) => Kl(t3) - Kl(e3))[0] ?? null;
2677
2688
  }
2678
- function zl(e2, t2, n2, r2) {
2679
- return { slotId: n2(e2), slotStartTime: e2.localStartDate ?? null, slotEndTime: e2.localEndDate ?? null, bookable: e2.bookable ?? false, tooEarlyToBook: e2.bookingPolicyViolations?.tooEarlyToBook ?? false, tooLateToBook: e2.bookingPolicyViolations?.tooLateToBook ?? false, totalCapacity: e2.totalCapacity ?? null, remainingCapacity: e2.remainingCapacity ?? null, bookableCapacity: e2.bookableCapacity ?? null, eventId: e2.eventInfo?.eventId ?? null, eventTitle: e2.eventInfo?.eventTitle ?? null, waitlistCapacity: e2.eventInfo?.waitingList?.remainingCapacity ?? null, locationId: e2.location?._id ?? null, locationName: e2.location?.name || e2.location?.formattedAddress || null, durationMinutes: Ul(e2, t2), isAllDay: e2.allDay ?? false, staff: r2 ? [] : Bl(e2) };
2689
+ function Vl(e2, t2, n2, r2) {
2690
+ return { slotId: n2(e2), slotStartTime: e2.localStartDate ?? null, slotEndTime: e2.localEndDate ?? null, bookable: e2.bookable ?? false, tooEarlyToBook: e2.bookingPolicyViolations?.tooEarlyToBook ?? false, tooLateToBook: e2.bookingPolicyViolations?.tooLateToBook ?? false, totalCapacity: e2.totalCapacity ?? null, remainingCapacity: e2.remainingCapacity ?? null, bookableCapacity: e2.bookableCapacity ?? null, eventId: e2.eventInfo?.eventId ?? null, eventTitle: e2.eventInfo?.eventTitle ?? null, waitlistCapacity: e2.eventInfo?.waitingList?.remainingCapacity ?? null, locationId: e2.location?._id ?? null, locationName: e2.location?.name || e2.location?.formattedAddress || null, durationMinutes: Gl(e2, t2), isAllDay: e2.allDay ?? false, staff: r2 ? [] : Hl(e2) };
2680
2691
  }
2681
- function Bl(e2) {
2692
+ function Hl(e2) {
2682
2693
  let t2 = /* @__PURE__ */ new Map();
2683
2694
  for (let n2 of e2.availableResources ?? []) if (n2.resourceTypeId === `1cd44cf8-756f-41c3-bd90-3e2ffcaf1155`) for (let e3 of n2.resources ?? []) e3._id && !t2.has(e3._id) && t2.set(e3._id, e3.name ?? ``);
2684
2695
  return [...t2].map(([e3, t3]) => ({ staffMemberId: e3, name: t3 }));
2685
2696
  }
2686
- function Vl(e2) {
2687
- let t2 = Bl(e2);
2697
+ function Ul(e2) {
2698
+ let t2 = Hl(e2);
2688
2699
  if (t2.length) return t2.length === 1 ? t2[0].staffMemberId : null;
2689
2700
  }
2690
- function Hl(e2) {
2691
- return Bl(e2).map((e3) => e3.staffMemberId);
2701
+ function Wl(e2) {
2702
+ return Hl(e2).map((e3) => e3.staffMemberId);
2692
2703
  }
2693
- function Ul(e2, t2) {
2704
+ function Gl(e2, t2) {
2694
2705
  if (!e2.localStartDate || !e2.localEndDate) return null;
2695
- let n2 = e2.allDay ? `UTC` : t2 ?? `UTC`, r2 = qc(e2.localStartDate, n2), i2 = qc(e2.localEndDate, n2);
2706
+ let n2 = e2.allDay ? `UTC` : t2 ?? `UTC`, r2 = Jc(e2.localStartDate, n2), i2 = Jc(e2.localEndDate, n2);
2696
2707
  return !r2 || !i2 || i2 < r2 ? null : Math.round((i2.getTime() - r2.getTime()) / 6e4);
2697
2708
  }
2698
- function Wl(e2) {
2709
+ function Kl(e2) {
2699
2710
  let t2 = e2.bookableCapacity ?? e2.remainingCapacity;
2700
2711
  return (e2.eventInfo?.waitingList?.remainingCapacity ?? 0) > 0 && (t2 ?? 0) <= 0 ? 1 : e2.bookable ? 2 : 0;
2701
2712
  }
2702
- function Gl(e2, t2, n2) {
2713
+ function ql(e2, t2, n2) {
2703
2714
  let r2 = /* @__PURE__ */ new Map();
2704
2715
  for (let t3 of e2) {
2705
2716
  let e3 = (t3.localStartDate ?? ``).slice(0, 10);
@@ -2707,16 +2718,16 @@ function Gl(e2, t2, n2) {
2707
2718
  }
2708
2719
  return new Set([...r2].filter(([e3, r3]) => r3 > t2 && !n2.has(e3)).map(([e3]) => e3));
2709
2720
  }
2710
- function Kl(e2) {
2721
+ function Jl(e2) {
2711
2722
  return e2.flatMap((e3) => {
2712
2723
  let t2 = e3.availableResources?.find((e4) => e4.resourceTypeId === Kr), n2 = t2?.resources ?? [];
2713
2724
  return n2.length <= 1 ? [e3] : n2.map((n3) => ({ ...e3, availableResources: [{ ...t2, resources: [n3] }] }));
2714
2725
  });
2715
2726
  }
2716
- function ql(e2, t2) {
2727
+ function Yl(e2, t2) {
2717
2728
  return t2 ? e2.map((e3) => ({ ...e3, availableResources: e3.availableResources?.map((e4) => e4.resourceTypeId === `1cd44cf8-756f-41c3-bd90-3e2ffcaf1155` ? { ...e4, resources: e4.resources?.filter((e5) => e5._id === t2) } : e4) })) : e2;
2718
2729
  }
2719
- function Jl(e2, t2, n2) {
2730
+ function Xl(e2, t2, n2) {
2720
2731
  let r2 = /* @__PURE__ */ new Map();
2721
2732
  return e2.filter((e3) => {
2722
2733
  let i2 = (e3.localStartDate ?? ``).slice(0, 10);
@@ -2725,21 +2736,21 @@ function Jl(e2, t2, n2) {
2725
2736
  return r2.set(i2, a2 + 1), a2 < t2;
2726
2737
  });
2727
2738
  }
2728
- async function Yl() {
2739
+ async function Zl() {
2729
2740
  try {
2730
- return await Qo();
2741
+ return await $o();
2731
2742
  } catch (e2) {
2732
2743
  return ko(e2, { feature: $.timeSlots, action: `fetch-business-time-zone`, level: `warning` }), { businessTimeZone: null, staffSelectionStrategy: void 0, allowGenderSelection: false };
2733
2744
  }
2734
2745
  }
2735
- function Xl(e2) {
2736
- return rc({ key: Ks(), warmupData: e2, fetchData: Yl });
2746
+ function Ql(e2) {
2747
+ return ic({ key: qs(), warmupData: e2, fetchData: Zl });
2737
2748
  }
2738
- function Zl(e2) {
2749
+ function $l(e2) {
2739
2750
  return (e2.localStartDate ?? ``).slice(0, 10);
2740
2751
  }
2741
- var Ql = [];
2742
- function $l(e2, t2) {
2752
+ var eu = [];
2753
+ function tu(e2, t2) {
2743
2754
  let { serviceId: n2 = ``, serviceType: r2 = `CLASS`, fromLocalDate: i2 = ``, toLocalDate: a2, timeZone: s2, locationId: u2, staffId: d2, onlyAvailableSlots: f2 = false, customerChoices: p2, minRemainingCapacity: m2, timeSlotsPerDay: h2 } = t2 ?? {}, [g2, _2] = (0, import_react.useState)([]), [v2, y2] = (0, import_react.useState)([]), [b2, x2] = (0, import_react.useState)(1), [S2, C2] = (0, import_react.useState)(!!n2), [w2, T2] = (0, import_react.useState)(null), [E2, D2] = (0, import_react.useState)(null), [ee2, O2] = (0, import_react.useState)(/* @__PURE__ */ new Set()), [k2, A2] = (0, import_react.useState)(null), j2 = (0, import_react.useRef)(null), M2 = (0, import_react.useRef)(null);
2744
2755
  (0, import_react.useEffect)(() => {
2745
2756
  if (_2([]), y2([]), x2(1), D2(null), T2(null), O2(/* @__PURE__ */ new Set()), A2(null), C2(!!n2), !n2) return;
@@ -2757,7 +2768,7 @@ function $l(e2, t2) {
2757
2768
  let o3 = [], b3 = null, S3 = v4 ?? void 0, C3 = /* @__PURE__ */ new Set();
2758
2769
  do {
2759
2770
  S3 && C3.add(S3);
2760
- let c3 = await _s({ serviceId: n2, serviceType: r2, fromLocalDate: i2, toLocalDate: a2, timeZone: s2, locationId: u2, staffId: d2, onlyAvailableSlots: f2, customerChoices: p2, minRemainingCapacity: m2, timeSlotsPerDay: h2, limit: e2, cursor: S3 });
2771
+ let c3 = await vs({ serviceId: n2, serviceType: r2, fromLocalDate: i2, toLocalDate: a2, timeZone: s2, locationId: u2, staffId: d2, onlyAvailableSlots: f2, customerChoices: p2, minRemainingCapacity: m2, timeSlotsPerDay: h2, limit: e2, cursor: S3 });
2761
2772
  if (t3) return;
2762
2773
  if (o3.push(...c3.timeSlots), b3 = c3.nextCursor, b3 && C3.has(b3)) throw Error(`The session API repeated a page cursor`);
2763
2774
  S3 = b3 ?? void 0, D2(c3.timeZone ?? s2 ?? null);
@@ -2773,24 +2784,23 @@ function $l(e2, t2) {
2773
2784
  }
2774
2785
  async function v3(e3) {
2775
2786
  if (!(t3 || o2)) {
2776
- if (h2 == null) {
2777
- O2((t4) => /* @__PURE__ */ new Set([...t4, e3]));
2778
- return;
2779
- }
2780
- o2 = true, A2(e3), T2(null);
2781
- try {
2782
- let o3 = await ws({ serviceId: n2, serviceType: r2, date: e3, timeZone: s2, onlyAvailableSlots: f2, locationId: u2, staffId: d2, customerChoices: p2, minRemainingCapacity: m2, fromLocalDate: i2, toLocalDate: a2 });
2783
- if (t3) return;
2784
- let l3 = o3.timeSlots.filter((t4) => Zl(t4) === e3), h3 = Math.max(0, c2.findIndex((t4) => t4.some((t5) => Zl(t5) === e3)));
2785
- c2 = c2.map((t4, n3) => {
2786
- let r3 = t4.filter((t5) => Zl(t5) !== e3);
2787
- return n3 === h3 ? [...r3, ...l3] : r3;
2788
- }), _2(c2), O2((t4) => /* @__PURE__ */ new Set([...t4, e3]));
2789
- } catch (e4) {
2790
- if (t3) return;
2791
- ko(e4, { feature: $.sessions, action: `fetch-day` }), T2(e4 instanceof Error ? e4.message : `Failed to load sessions`);
2792
- } finally {
2793
- o2 = false, t3 || A2(null);
2787
+ if (h2 == null) O2((t4) => /* @__PURE__ */ new Set([...t4, e3]));
2788
+ else {
2789
+ o2 = true, A2(e3), T2(null);
2790
+ try {
2791
+ let o3 = await Ts({ serviceId: n2, serviceType: r2, date: e3, timeZone: s2, onlyAvailableSlots: f2, locationId: u2, staffId: d2, customerChoices: p2, minRemainingCapacity: m2, fromLocalDate: i2, toLocalDate: a2 });
2792
+ if (t3) return;
2793
+ let l3 = o3.timeSlots.filter((t4) => $l(t4) === e3), h3 = Math.max(0, c2.findIndex((t4) => t4.some((t5) => $l(t5) === e3)));
2794
+ c2 = c2.map((t4, n3) => {
2795
+ let r3 = t4.filter((t5) => $l(t5) !== e3);
2796
+ return n3 === h3 ? [...r3, ...l3] : r3;
2797
+ }), _2(c2), O2((t4) => /* @__PURE__ */ new Set([...t4, e3]));
2798
+ } catch (e4) {
2799
+ if (t3) return;
2800
+ ko(e4, { feature: $.sessions, action: `fetch-day` }), T2(e4 instanceof Error ? e4.message : `Failed to load sessions`);
2801
+ } finally {
2802
+ o2 = false, t3 || A2(null);
2803
+ }
2794
2804
  }
2795
2805
  }
2796
2806
  }
@@ -2798,7 +2808,7 @@ function $l(e2, t2) {
2798
2808
  t3 = true, j2.current = null, M2.current = null;
2799
2809
  };
2800
2810
  }, [n2, r2, i2, a2, s2, u2, d2, f2, p2, m2, h2, e2]);
2801
- let te2 = [...g2[b2 - 1] ?? Ql].sort((e3, t3) => (e3.localStartDate ?? ``).localeCompare(t3.localStartDate ?? ``)), N2 = g2[b2], ne2 = N2 ? N2.length > 0 : v2[b2 - 1] != null, P2 = b2 > 1;
2811
+ let te2 = [...g2[b2 - 1] ?? eu].sort((e3, t3) => (e3.localStartDate ?? ``).localeCompare(t3.localStartDate ?? ``)), N2 = g2[b2], ne2 = N2 ? N2.length > 0 : v2[b2 - 1] != null, P2 = b2 > 1;
2802
2812
  async function re2() {
2803
2813
  ne2 && !S2 && await j2.current?.(b2 + 1);
2804
2814
  }
@@ -2810,169 +2820,132 @@ function $l(e2, t2) {
2810
2820
  }
2811
2821
  return { isLoadingPage: S2, firstPageSettled: g2.length > 0 || w2 !== null, error: w2, timeZone: E2, sessions: te2, pageSize: e2, currentPage: b2, hasNextPage: ne2, hasPreviousPage: P2, nextPage: re2, previousPage: ie2, expandedDates: ee2, loadingDate: k2, loadAllSessionsForDay: ae2 };
2812
2822
  }
2813
- var eu = (e2) => e2?.onlineBooking?.enabled === true;
2814
- function tu(e2, t2) {
2823
+ var nu = (e2) => e2?.onlineBooking?.enabled === true;
2824
+ function ru(e2, t2) {
2815
2825
  return e2 ? e2.anyResource ? t2 ?? `` : e2.staffMemberId : null;
2816
2826
  }
2817
- var nu = [];
2818
- var ru = [];
2819
- var iu = un.map((e2) => ({ id: e2, gender: e2 }));
2820
- var au = () => {
2827
+ var iu = [];
2828
+ var au = [];
2829
+ var ou = un.map((e2) => ({ id: e2, gender: e2 }));
2830
+ var su = () => {
2821
2831
  };
2822
- var ou = async () => {
2832
+ var cu = async () => {
2823
2833
  };
2824
- var su = (0, import_react.createContext)(null);
2825
- function cu() {
2826
- let e2 = (0, import_react.useContext)(su);
2834
+ var lu = () => Promise.resolve();
2835
+ var uu = (e2) => e2 === `cancelled`;
2836
+ var du = (0, import_react.createContext)(null);
2837
+ function fu() {
2838
+ let e2 = (0, import_react.useContext)(du);
2827
2839
  if (!e2) throw Error(`useTimeSlotsContext must be used within TimeSlotsContextProvider`);
2828
2840
  return e2;
2829
2841
  }
2830
- function lu(e2, t2, n2) {
2842
+ function pu(e2, t2, n2) {
2831
2843
  e2 ? t2() : n2();
2832
2844
  }
2833
- var uu = { loginRequired: `rescheduleLoginRequired`, notFound: `rescheduleNotFound`, accessDenied: `rescheduleAccessDenied`, failed: `rescheduleNotFound`, wrongService: `rescheduleNotFound`, notReschedulable: `rescheduleNotReschedulable` };
2834
- function du(e2 = 3) {
2835
- return Math.min(Math.max(e2, 1), mc);
2845
+ var mu = { loginRequired: `rescheduleLoginRequired`, notFound: `rescheduleNotFound`, accessDenied: `rescheduleAccessDenied`, failed: `rescheduleNotFound`, wrongService: `rescheduleNotFound`, notReschedulable: `rescheduleNotReschedulable` };
2846
+ function hu(e2 = 3) {
2847
+ return Math.min(Math.max(e2, 1), hc);
2836
2848
  }
2837
- function fu(e2) {
2849
+ function gu(e2) {
2838
2850
  let { isLoading: n2, bookingsSettingsLoading: r2 } = (0, import_service.useServiceContext)();
2839
- Uc(Lc.TIME_SLOTS, !n2 && !r2);
2840
- let i2 = Us(), [a2] = (0, import_react.useState)(() => Xl(i2));
2841
- return (0, import_jsx_runtime.jsx)(pc, { children: (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: (0, import_jsx_runtime.jsx)(Xc, { nextAvailableSlotsCount: du(e2.nextAvailableSlotsCount), children: e2.children }), children: (0, import_jsx_runtime.jsx)(mu, { ...e2, configurationPromise: a2 }) }) });
2851
+ Wc(Rc.TIME_SLOTS, !n2 && !r2);
2852
+ let i2 = Ws(), [a2] = (0, import_react.useState)(() => Ql(i2));
2853
+ return (0, import_jsx_runtime.jsx)(mc, { children: (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: (0, import_jsx_runtime.jsx)(Zc, { nextAvailableSlotsCount: hu(e2.nextAvailableSlotsCount), children: e2.children }), children: (0, import_jsx_runtime.jsx)(vu, { ...e2, configurationPromise: a2 }) }) });
2842
2854
  }
2843
- function pu(e2) {
2855
+ function _u(e2) {
2844
2856
  let [t2, n2] = (0, import_react.useState)({ serviceId: e2, key: 0 });
2845
2857
  return e2 !== t2.serviceId && n2({ serviceId: e2, key: t2.serviceId ? t2.key + 1 : t2.key }), t2.key;
2846
2858
  }
2847
- function mu({ onlyAvailableSlots: e2 = true, nextAvailableSlotsCount: t2 = 3, loadDaysAvailabilityInitially: n2 = false, timeSlotLimitPerDay: r2 = 100, configurationPromise: i2, children: a2 }) {
2848
- let s2 = lc().isLoading, { searchParams: c2 } = Tc(), { reschedule: f2, isSelectionPending: p2 } = (0, import_service.useServiceContext)(), [h2] = (0, import_react.useState)(() => ({ locationId: c2.get(no.location), staffId: c2.get(no.resource), timeZone: c2.get(no.timezone) })), g2 = Mc(p2), _2 = () => (f2 ? null : Ir(g2)?.timezone) ?? null, [v2, y2] = (0, import_react.useState)(() => _2() ?? h2.timeZone), [b2, x2] = (0, import_react.useState)(p2);
2859
+ function vu({ onlyAvailableSlots: e2 = true, nextAvailableSlotsCount: t2 = 3, loadDaysAvailabilityInitially: n2 = false, timeSlotLimitPerDay: r2 = 100, configurationPromise: i2, children: a2 }) {
2860
+ let s2 = uc().isLoading, { searchParams: c2 } = Ec(), { reschedule: f2, isSelectionPending: p2 } = (0, import_service.useServiceContext)(), [h2] = (0, import_react.useState)(() => ({ locationId: c2.get(no.location), staffId: c2.get(no.resource), timeZone: c2.get(no.timezone) })), g2 = Nc(p2), _2 = () => (f2 ? null : Ir(g2)?.timezone) ?? null, [v2, y2] = (0, import_react.useState)(() => _2() ?? h2.timeZone), [b2, x2] = (0, import_react.useState)(p2);
2849
2861
  if (b2 && !p2) {
2850
2862
  x2(false);
2851
2863
  let e3 = _2();
2852
2864
  e3 && y2(e3);
2853
2865
  }
2854
- let S2 = du(t2), [C2, w2] = (0, import_react.useState)(false);
2866
+ let S2 = hu(t2), [C2, w2] = (0, import_react.useState)(false);
2855
2867
  (0, import_react.useEffect)(() => w2(true), []);
2856
2868
  let T2 = C2 && !s2 && !p2;
2857
- Dl(T2);
2858
- let E2 = Rs(i2), D2 = (0, import_react.useSyncExternalStore)(fs, ds, () => false), { serviceId: ee2 } = (0, import_service.useServiceContext)(), O2 = pu(ee2), k2 = Number.isFinite(r2) ? Math.max(1, Math.floor(r2)) : 100;
2859
- return (0, import_jsx_runtime.jsx)(hc, { fallback: (0, import_jsx_runtime.jsx)(Zc, { nextAvailableSlotsCount: S2, children: a2 }), feature: $.timeSlots, children: (0, import_jsx_runtime.jsx)(hu, { onlyAvailableSlots: e2, selectedTimeZone: v2, setSelectedTimeZone: y2, enabled: T2, nextAvailableSlotsCount: S2, loadDaysAvailabilityInitially: n2, timeSlotLimitPerDay: k2, landingLocationId: h2.locationId, landingStaffId: h2.staffId, businessTimeZone: E2.businessTimeZone, staffSelectionStrategy: E2.staffSelectionStrategy, allowGenderSelection: E2.allowGenderSelection, requestedGenderRejected: D2, children: a2 }) }, O2);
2860
- }
2861
- function hu({ onlyAvailableSlots: e2, selectedTimeZone: t2, setSelectedTimeZone: n2, enabled: r2, nextAvailableSlotsCount: a2, loadDaysAvailabilityInitially: u2, timeSlotLimitPerDay: f2, landingLocationId: p2, landingStaffId: h2, businessTimeZone: g2, staffSelectionStrategy: _2, allowGenderSelection: v2, requestedGenderRejected: y2, children: b2 }) {
2862
- let { service: x2, serviceId: S2, serviceType: C2, setSlot: w2, clearSlot: T2, setMultiServiceSlot: E2, clearMultiServiceSlot: D2, draftRevision: ee2, navigateToMultiServiceForm: O2, selection: k2, selectStaffMember: A2, clearSelection: j2, clearStaffMember: M2, withSelectionParam: te2, staffMembers: N2, serviceOptionsAndVariants: ne2, isLoading: P2, hasError: re2, multiServiceAppointmentServices: ie2 = ru, reschedule: ae2, isSelectionPending: oe2 } = (0, import_service.useServiceContext)(), F2 = ae2 != null, se2 = F2 && ae2.status !== `ready`, ce2 = F2 && ae2.status === `loading`, le2 = F2 ? uu[ae2.status] : void 0, ue2 = se2 ? null : ae2?.booking ?? null, de2 = ue2 ? ae2.validUntil : null, fe2 = wl(x2) && !eu(x2), I2 = fe2 || se2 ? null : S2, pe2 = Mc(oe2), me2 = F2 ? null : pe2, he2 = !F2 && oe2, ge2 = (0, import_react.useMemo)(() => so(Ir(me2)), [me2]), L2 = !S2 && !P2 && !re2 && (ge2.valid || ge2.reason !== `too-few-services`), _e2 = L2 && ge2.valid && ie2.some((e3) => !eu(e3) && ge2.services.some((t3) => t3.serviceId === e3._id)), ve2 = fe2 || _e2, ye2 = L2 && ge2.valid && !_e2 ? ge2.requestKey : null, be2 = (0, import_react.useMemo)(() => ye2 && ge2.valid ? { services: ge2.services, locationId: ge2.locationId, locationType: ge2.locationType } : null, [ye2]), xe2 = !!I2 || be2 !== null, Se2 = I2 || ye2, Ce2 = r2 && !P2 && !re2 && !xe2 && !ce2, we2 = dc(), Te2 = lc(), { navigate: Ee2, resolvePath: De2 } = yo(), [Oe2, ke2] = (0, import_react.useState)(null), [Ae2, je2] = (0, import_react.useState)(false), Me2 = (0, import_react.useRef)([]), Ne2 = (0, import_react.useRef)(false), Pe2 = (0, import_react.useCallback)(() => (je2(true), Ne2.current ? Promise.resolve() : new Promise((e3) => {
2863
- Me2.current.push(e3);
2864
- })), []), Fe2 = r2 ? Intl.DateTimeFormat().resolvedOptions().timeZone : null, Ie2 = Xa(x2), Le2 = (0, import_react.useRef)(null), Re2 = lo(k2), ze2 = (0, import_react.useRef)(Re2);
2865
- ze2.current = Re2;
2866
- let Be2 = Re2 && !Re2.anyResource ? Re2.staffMemberId : null, Ve2 = k2.requestedGender ?? null, R2 = !Qa(C2) && !$a(C2), He2 = R2 && !L2 && Es(ne2), z2 = L2 || R2 && _2 === `CUSTOMER_CANNOT_CHOOSE`, Ue2 = _2 !== void 0, We2 = Zo({ allowGenderSelection: v2, staffSelectionStrategy: _2 ?? null }) && R2 && !L2 && !He2, Ge2 = We2 && !y2, Ke2 = (0, import_react.useMemo)(() => I2 ? Ir(me2)?.services.find((e3) => e3.serviceId === I2) ?? null : null, [me2, I2]), qe2 = (N2 ?? []).map((e3) => e3.staffMemberId).join(`,`), Je2 = Ie2.map((e3) => e3.id).join(`,`), Ye2 = (0, import_react.useMemo)(() => Fl({ entry: Ke2, appointmentLike: R2, staffChoiceHidden: z2, staffPriced: He2, staffSelectionStrategy: _2, genderAllowed: Ge2, staffMemberIds: qe2.split(`,`), locationIds: Je2.split(`,`) }), [Ke2, R2, z2, He2, _2, Ge2, qe2, Je2]), B2 = Ye2.staff, Xe2 = Ye2.locationId, Ze2 = z2 || B2 !== null, [Qe2, $e2] = (0, import_react.useState)(null), [et2, tt2] = (0, import_react.useState)(p2 !== null || F2), nt2 = (0, import_react.useMemo)(() => x2 ? Ps(x2) : [], [x2]), rt2 = B2 && !B2.anyResource ? B2.staffMemberId : null, it2 = (0, import_react.useMemo)(() => {
2867
- if (!rt2) return nt2;
2868
- let e3 = nt2.find((e4) => e4.staffMemberId === rt2);
2869
- return e3 ? [e3] : nt2;
2870
- }, [nt2, rt2]), at2 = ue2?.locationId ?? null, ot2 = (0, import_react.useMemo)(() => {
2871
- let e3 = Ns(Ie2, it2);
2872
- return !at2 || e3.some((e4) => e4.id === at2) ? e3 : Ie2.filter((t3) => t3.id === at2 || e3.some((e4) => e4.id === t3.id));
2873
- }, [x2, it2, at2]), st2 = (e3) => !!e3 && ot2.some((t3) => t3.id === e3), ct2 = Qe2 ?? (et2 ? st2(at2) ? at2 : p2 : null), lt2 = Ie2.length > 1 && ot2.length === 1 ? ot2[0].id : null, V2 = Xe2 ?? (st2(ct2) ? ct2 : lt2), ut2 = (0, import_react.useMemo)(() => Xe2 ? [] : ot2.map((e3) => ({ id: e3.id, name: e3.label })), [ot2, Xe2]), dt2 = (0, import_react.useMemo)(() => new Map(nt2.map((e3) => [e3.staffMemberId, e3.locationCoverage])), [nt2]), ft2 = (0, import_react.useCallback)((e3, t3) => As([{ staffMemberId: e3, locationCoverage: dt2.get(e3) }], t3).length === 1, [dt2]), pt2 = (0, import_react.useMemo)(() => Ze2 ? [] : (N2 ?? []).filter((e3) => e3.name).map((e3) => ({ id: e3.staffMemberId, name: e3.name ?? ``, gender: null })), [N2, Ze2]), mt2 = (0, import_react.useMemo)(() => V2 ? pt2.filter((e3) => ft2(e3.id, V2)) : pt2, [pt2, V2, ft2]), ht2 = R2 && !Ue2 ? nu : mt2, gt2 = R2 && !Ue2 ? 0 : pt2.length, _t2 = Ge2 && gt2 > 1, vt2 = (0, import_react.useMemo)(() => _t2 ? [...iu, ...ht2] : ht2, [_t2, ht2]), [yt2, bt2] = (0, import_react.useState)(null), [xt2, St2] = (0, import_react.useState)(h2 !== null);
2874
- xt2 && h2 !== null && V2 !== null && !ft2(h2, V2) && St2(false);
2875
- let Ct2 = yt2 ?? (xt2 ? h2 : null), H2 = B2 ? B2.anyResource ? null : B2.staffMemberId : Ct2 !== null && mt2.some((e3) => e3.id === Ct2) ? Ct2 : null, wt2 = Re2?.anyResource ? Ve2 : null, [Tt2, Et2] = (0, import_react.useState)(wt2), [Dt2, Ot2] = (0, import_react.useState)(wt2);
2876
- !y2 && Re2?.anyResource && Ve2 !== Dt2 && (Ot2(Ve2), Et2(Ve2));
2877
- let kt2 = B2 ? Ye2.requestedGender : We2 && gt2 > 1 && H2 === null ? Tt2 : null, At2 = y2 ? null : kt2, jt2 = (0, import_react.useCallback)((e3) => {
2878
- ze2.current = e3, e3 ? e3.anyResource ? j2(At2 ?? void 0) : A2(e3.staffMemberId) : M2();
2879
- }, [M2, j2, A2, At2]), Mt2 = (0, import_react.useCallback)((e3) => jt2(e3 ? { anyResource: false, staffMemberId: e3 } : { anyResource: true }), [jt2]), Nt2 = (ue2?.addOnIds ?? []).filter((e3) => x2?.addOnGroups?.some((t3) => t3.addOnIds?.includes(e3))), Pt2 = ue2 && Qa(C2) ? ue2.participants : null, Ft2 = R2 ? io(k2) : null, { addOnIds: It2, ...Lt2 } = Ft2 ?? {}, Rt2 = R2 && ue2 ? Nt2.length ? { ...Lt2, addOnIds: Nt2 } : Lt2 : Ft2, zt2 = Rt2 ? as(Rt2) : void 0, Bt2 = JSON.stringify(kt2 ? { ...zt2, requestedGender: { gender: kt2 } } : zt2 ?? null), Vt2 = (0, import_react.useMemo)(() => JSON.parse(Bt2), [Bt2]), Ht2 = B2?.anyResource === true, Ut2 = (0, import_react.useCallback)((e3) => Ht2 || _2 !== void 0 && jl({ isAppointment: R2, staffOnSlotCount: e3, hasStaffFilter: H2 !== null, hasRequestedGender: At2 !== null, hasStaffPricedVariants: He2, staffSelectionStrategy: _2 }), [Ht2, R2, _2, H2, At2, He2]), Wt2 = (0, import_react.useCallback)((e3) => B2 ?? (z2 ? null : e3), [B2, z2]), Gt2 = (0, import_react.useCallback)((e3) => {
2880
- let t3 = e3 === null ? null : vt2.find((t4) => t4.id === e3);
2881
- t3 !== void 0 && (St2(false), bt2(t3 && !t3.gender ? t3.id : null), Et2(t3?.gender ?? null));
2882
- }, [vt2]), Kt2 = (0, import_react.useCallback)((e3) => {
2883
- (e3 === null || ot2.some((t3) => t3.id === e3)) && (tt2(false), $e2(e3), Ct2 !== null && e3 !== null && !ft2(Ct2, e3) && (bt2(null), St2(false)));
2884
- }, [ot2, Ct2, ft2]), qt2 = !!(r2 && !Te2.isLoading && Te2.displayTimeZonePolicy.customerCanChange && g2 && Fe2 && g2 !== Fe2), U2 = r2 ? qt2 && t2 && (t2 === g2 || t2 === Fe2) ? t2 : we2 ?? g2 ?? Fe2 : null, Jt2 = (0, import_react.useCallback)((e3) => {
2885
- qt2 && (e3 === g2 || e3 === Fe2) && n2(e3);
2886
- }, [qt2, g2, Fe2, n2]), Yt2 = (0, import_react.useMemo)(() => r2 && !P2 && xe2 ? Date.now() : void 0, [r2, P2, I2, be2, U2]), Xt2 = Yt2 !== void 0 && U2 ? Io(new Date(Yt2), U2) : null, { range: Zt2, daysAvailability: Qt2, isLoading: $t2, hasError: en2, setRange: tn2 } = _l({ enabled: r2, serviceId: I2, serviceType: C2, multiServiceRequest: be2, timeZone: U2, today: Xt2, locationId: V2, staffId: H2, customerChoices: Vt2, minRemainingCapacity: Pt2, loadInitially: u2, onlyAvailableSlots: e2 }), nn2 = de2?.slice(0, 10) ?? null, rn2 = (0, import_react.useMemo)(() => nn2 ? Qt2.map((e3) => e3.date > nn2 ? { ...e3, availability: `none` } : e3) : Qt2, [Qt2, nn2]), an2 = de2 && U2 ? zo(new Date(de2), U2) : null, { query: W2, selectedDate: on2, timeSlots: sn2, isLoading: cn2, error: ln2, selectDate: un2, findNextAvailableDate: dn2 } = vl({ enabled: r2, serviceId: I2, serviceType: C2, multiServiceRequest: be2, timeZone: U2, today: Xt2, locationId: V2, staffId: H2, customerChoices: Vt2, minRemainingCapacity: Pt2, onlyAvailableSlots: e2, serviceLoading: P2 || ce2 }), fn2 = (0, import_react.useRef)(true), pn2 = (0, import_react.useRef)(null);
2887
- (0, import_react.useEffect)(() => {
2888
- if (fn2.current) {
2889
- fn2.current = false;
2890
- return;
2891
- }
2892
- ke2(null), Le2.current && lu(I2, T2, D2), Le2.current = null, pn2.current = null;
2893
- }, [W2, be2, U2, V2, H2, Vt2, Pt2, e2, a2, f2, ee2]);
2894
- let mn2 = (0, import_react.useCallback)(async () => {
2895
- let e3 = await dn2();
2896
- return e3.outcome === `found` ? nn2 && e3.date > nn2 ? `none` : (await Promise.all([un2(e3.date), Zt2 && Jo(e3.date, Zt2) ? Promise.resolve() : tn2(qo(e3.date))]), `found`) : e3.outcome;
2897
- }, [dn2, nn2, un2, Zt2, tn2]), hn2 = !!(r2 && !P2 && xe2 && U2 && Xt2), gn2 = r2 && !P2 && !ce2 && !xe2, [_n2, vn2] = (0, import_react.useState)(false), [G2, yn2] = (0, import_react.useState)(0), bn2 = (0, import_react.useRef)(false), xn2 = (0, import_react.useRef)([]), Sn2 = (0, import_react.useRef)(0), Cn2 = (0, import_react.useCallback)(() => {
2898
- vn2(false);
2899
- let e3 = xn2.current;
2900
- return xn2.current = [], e3;
2901
- }, []), wn2 = (0, import_react.useCallback)(() => {
2902
- Sn2.current += 1, Cn2().forEach((e3) => e3(`cancelled`));
2903
- }, [Cn2]), Tn2 = (0, import_react.useCallback)((e3) => (wn2(), un2(e3)), [wn2, un2]), En2 = (0, import_react.useCallback)((e3) => {
2904
- let t3 = Sn2.current;
2905
- bn2.current = true, mn2().then((n3) => {
2906
- bn2.current = false, n3 === `cancelled` && t3 === Sn2.current ? (xn2.current.unshift(...e3), vn2(true)) : e3.forEach((e4) => e4(n3)), yn2((e4) => e4 + 1);
2907
- });
2908
- }, [mn2]), Dn2 = (0, import_react.useCallback)(() => gn2 ? Promise.resolve(`none`) : new Promise((e3) => {
2909
- if (hn2 && !bn2.current) {
2910
- En2([...Cn2(), e3]);
2911
- return;
2912
- }
2913
- xn2.current.push(e3), vn2(true);
2914
- }), [gn2, hn2, En2, Cn2]);
2869
+ Ol(T2);
2870
+ let E2 = zs(i2), D2 = (0, import_react.useSyncExternalStore)(ps, fs, () => false), { serviceId: ee2 } = (0, import_service.useServiceContext)(), O2 = _u(ee2), k2 = Number.isFinite(r2) ? Math.max(1, Math.floor(r2)) : 100;
2871
+ return (0, import_jsx_runtime.jsx)(gc, { fallback: (0, import_jsx_runtime.jsx)(Qc, { nextAvailableSlotsCount: S2, children: a2 }), feature: $.timeSlots, children: (0, import_jsx_runtime.jsx)(yu, { onlyAvailableSlots: e2, selectedTimeZone: v2, setSelectedTimeZone: y2, enabled: T2, nextAvailableSlotsCount: S2, loadDaysAvailabilityInitially: n2, timeSlotLimitPerDay: k2, landingLocationId: h2.locationId, landingStaffId: h2.staffId, businessTimeZone: E2.businessTimeZone, staffSelectionStrategy: E2.staffSelectionStrategy, allowGenderSelection: E2.allowGenderSelection, requestedGenderRejected: D2, children: a2 }) }, O2);
2872
+ }
2873
+ function yu({ onlyAvailableSlots: e2, selectedTimeZone: t2, setSelectedTimeZone: n2, enabled: r2, nextAvailableSlotsCount: a2, loadDaysAvailabilityInitially: u2, timeSlotLimitPerDay: f2, landingLocationId: p2, landingStaffId: h2, businessTimeZone: g2, staffSelectionStrategy: _2, allowGenderSelection: v2, requestedGenderRejected: y2, children: b2 }) {
2874
+ let { service: x2, serviceId: S2, serviceType: C2, setSlot: w2, clearSlot: T2, setMultiServiceSlot: E2, clearMultiServiceSlot: D2, draftRevision: ee2, navigateToMultiServiceForm: O2, selection: k2, selectStaffMember: A2, clearSelection: j2, clearStaffMember: M2, withSelectionParam: te2, staffMembers: N2, serviceOptionsAndVariants: ne2, isLoading: P2, hasError: re2, multiServiceAppointmentServices: ie2 = au, reschedule: ae2, isSelectionPending: oe2 } = (0, import_service.useServiceContext)(), F2 = ae2 != null, se2 = F2 && ae2.status !== `ready`, ce2 = F2 && ae2.status === `loading`, le2 = F2 ? mu[ae2.status] : void 0, ue2 = se2 ? null : ae2?.booking ?? null, de2 = ue2 ? ae2.validUntil : null, fe2 = Tl(x2) && !nu(x2), I2 = fe2 || se2 ? null : S2, pe2 = Nc(oe2), me2 = F2 ? null : pe2, he2 = !F2 && oe2, ge2 = (0, import_react.useMemo)(() => so(Ir(me2)), [me2]), L2 = !S2 && !P2 && !re2 && (ge2.valid || ge2.reason !== `too-few-services`), _e2 = L2 && ge2.valid && ie2.some((e3) => !nu(e3) && ge2.services.some((t3) => t3.serviceId === e3._id)), ve2 = fe2 || _e2, ye2 = L2 && ge2.valid && !_e2 ? ge2.requestKey : null, be2 = (0, import_react.useMemo)(() => ye2 && ge2.valid ? { services: ge2.services, locationId: ge2.locationId, locationType: ge2.locationType } : null, [ye2]), xe2 = !!I2 || be2 !== null, Se2 = I2 || ye2, Ce2 = r2 && !P2 && !re2 && !xe2 && !ce2, we2 = fc(), Te2 = uc(), { navigate: Ee2, resolvePath: De2 } = yo(), [Oe2, ke2] = (0, import_react.useState)(null), [Ae2, je2] = (0, import_react.useState)(false), R2 = r2 ? Intl.DateTimeFormat().resolvedOptions().timeZone : null, Me2 = Xa(x2), Ne2 = (0, import_react.useRef)(null), Pe2 = lo(k2), Fe2 = (0, import_react.useRef)(Pe2);
2875
+ Fe2.current = Pe2;
2876
+ let Ie2 = Pe2 && !Pe2.anyResource ? Pe2.staffMemberId : null, Le2 = k2.requestedGender ?? null, z2 = !Qa(C2) && !$a(C2), Re2 = z2 && !L2 && Ds(ne2), ze2 = L2 || z2 && _2 === `CUSTOMER_CANNOT_CHOOSE`, Be2 = _2 !== void 0, Ve2 = Qo({ allowGenderSelection: v2, staffSelectionStrategy: _2 ?? null }) && z2 && !L2 && !Re2, He2 = Ve2 && !y2, Ue2 = (0, import_react.useMemo)(() => I2 ? Ir(me2)?.services.find((e3) => e3.serviceId === I2) ?? null : null, [me2, I2]), We2 = (N2 ?? []).map((e3) => e3.staffMemberId).join(`,`), Ge2 = Me2.map((e3) => e3.id).join(`,`), Ke2 = (0, import_react.useMemo)(() => Ll({ entry: Ue2, appointmentLike: z2, staffChoiceHidden: ze2, staffPriced: Re2, staffSelectionStrategy: _2, genderAllowed: He2, staffMemberIds: We2.split(`,`), locationIds: Ge2.split(`,`) }), [Ue2, z2, ze2, Re2, _2, He2, We2, Ge2]), B2 = Ke2.staff, qe2 = Ke2.locationId, Je2 = ze2 || B2 !== null, [Ye2, Xe2] = (0, import_react.useState)(null), [Ze2, Qe2] = (0, import_react.useState)(p2 !== null || F2), $e2 = (0, import_react.useMemo)(() => x2 ? Fs(x2) : [], [x2]), et2 = B2 && !B2.anyResource ? B2.staffMemberId : null, tt2 = (0, import_react.useMemo)(() => {
2877
+ if (!et2) return $e2;
2878
+ let e3 = $e2.find((e4) => e4.staffMemberId === et2);
2879
+ return e3 ? [e3] : $e2;
2880
+ }, [$e2, et2]), nt2 = ue2?.locationId ?? null, rt2 = (0, import_react.useMemo)(() => {
2881
+ let e3 = Ps(Me2, tt2);
2882
+ return !nt2 || e3.some((e4) => e4.id === nt2) ? e3 : Me2.filter((t3) => t3.id === nt2 || e3.some((e4) => e4.id === t3.id));
2883
+ }, [x2, tt2, nt2]), it2 = (e3) => !!e3 && rt2.some((t3) => t3.id === e3), at2 = Ye2 ?? (Ze2 ? it2(nt2) ? nt2 : p2 : null), ot2 = Me2.length > 1 && rt2.length === 1 ? rt2[0].id : null, V2 = qe2 ?? (it2(at2) ? at2 : ot2), st2 = (0, import_react.useMemo)(() => qe2 ? [] : rt2.map((e3) => ({ id: e3.id, name: e3.label })), [rt2, qe2]), ct2 = (0, import_react.useMemo)(() => new Map($e2.map((e3) => [e3.staffMemberId, e3.locationCoverage])), [$e2]), lt2 = (0, import_react.useCallback)((e3, t3) => js([{ staffMemberId: e3, locationCoverage: ct2.get(e3) }], t3).length === 1, [ct2]), ut2 = (0, import_react.useMemo)(() => Je2 ? [] : (N2 ?? []).filter((e3) => e3.name).map((e3) => ({ id: e3.staffMemberId, name: e3.name ?? ``, gender: null })), [N2, Je2]), dt2 = (0, import_react.useMemo)(() => V2 ? ut2.filter((e3) => lt2(e3.id, V2)) : ut2, [ut2, V2, lt2]), ft2 = z2 && !Be2 ? iu : dt2, pt2 = z2 && !Be2 ? 0 : ut2.length, mt2 = He2 && pt2 > 1, ht2 = (0, import_react.useMemo)(() => mt2 ? [...ou, ...ft2] : ft2, [mt2, ft2]), [gt2, _t2] = (0, import_react.useState)(null), [vt2, yt2] = (0, import_react.useState)(h2 !== null);
2884
+ vt2 && h2 !== null && V2 !== null && !lt2(h2, V2) && yt2(false);
2885
+ let bt2 = gt2 ?? (vt2 ? h2 : null), H2 = B2 ? B2.anyResource ? null : B2.staffMemberId : bt2 !== null && dt2.some((e3) => e3.id === bt2) ? bt2 : null, xt2 = Pe2?.anyResource ? Le2 : null, [St2, Ct2] = (0, import_react.useState)(xt2), [wt2, Tt2] = (0, import_react.useState)(xt2);
2886
+ !y2 && Pe2?.anyResource && Le2 !== wt2 && (Tt2(Le2), Ct2(Le2));
2887
+ let Et2 = B2 ? Ke2.requestedGender : Ve2 && pt2 > 1 && H2 === null ? St2 : null, Dt2 = y2 ? null : Et2, Ot2 = (0, import_react.useCallback)((e3) => {
2888
+ Fe2.current = e3, e3 ? e3.anyResource ? j2(Dt2 ?? void 0) : A2(e3.staffMemberId) : M2();
2889
+ }, [M2, j2, A2, Dt2]), kt2 = (0, import_react.useCallback)((e3) => Ot2(e3 ? { anyResource: false, staffMemberId: e3 } : { anyResource: true }), [Ot2]), At2 = (ue2?.addOnIds ?? []).filter((e3) => x2?.addOnGroups?.some((t3) => t3.addOnIds?.includes(e3))), jt2 = ue2 && Qa(C2) ? ue2.participants : null, Mt2 = z2 ? io(k2) : null, { addOnIds: Nt2, ...Pt2 } = Mt2 ?? {}, Ft2 = z2 && ue2 ? At2.length ? { ...Pt2, addOnIds: At2 } : Pt2 : Mt2, It2 = Ft2 ? os(Ft2) : void 0, Lt2 = JSON.stringify(Et2 ? { ...It2, requestedGender: { gender: Et2 } } : It2 ?? null), Rt2 = (0, import_react.useMemo)(() => JSON.parse(Lt2), [Lt2]), zt2 = B2?.anyResource === true, Bt2 = (0, import_react.useCallback)((e3) => zt2 || _2 !== void 0 && Nl({ isAppointment: z2, staffOnSlotCount: e3, hasStaffFilter: H2 !== null, hasRequestedGender: Dt2 !== null, hasStaffPricedVariants: Re2, staffSelectionStrategy: _2 }), [zt2, z2, _2, H2, Dt2, Re2]), Vt2 = (0, import_react.useCallback)((e3) => B2 ?? (ze2 ? null : e3), [B2, ze2]), Ht2 = (0, import_react.useCallback)((e3) => {
2890
+ let t3 = e3 === null ? null : ht2.find((t4) => t4.id === e3);
2891
+ t3 !== void 0 && (yt2(false), _t2(t3 && !t3.gender ? t3.id : null), Ct2(t3?.gender ?? null));
2892
+ }, [ht2]), Ut2 = (0, import_react.useCallback)((e3) => {
2893
+ (e3 === null || rt2.some((t3) => t3.id === e3)) && (Qe2(false), Xe2(e3), bt2 !== null && e3 !== null && !lt2(bt2, e3) && (_t2(null), yt2(false)));
2894
+ }, [rt2, bt2, lt2]), Wt2 = !!(r2 && !Te2.isLoading && Te2.displayTimeZonePolicy.customerCanChange && g2 && R2 && g2 !== R2), U2 = r2 ? Wt2 && t2 && (t2 === g2 || t2 === R2) ? t2 : we2 ?? g2 ?? R2 : null, Gt2 = (0, import_react.useCallback)((e3) => {
2895
+ Wt2 && (e3 === g2 || e3 === R2) && n2(e3);
2896
+ }, [Wt2, g2, R2, n2]), Kt2 = (0, import_react.useMemo)(() => r2 && !P2 && xe2 ? Date.now() : void 0, [r2, P2, I2, be2, U2]), qt2 = Kt2 !== void 0 && U2 ? Lo(new Date(Kt2), U2) : null, { range: Jt2, daysAvailability: Yt2, isLoading: Xt2, hasError: Zt2, setRange: Qt2 } = vl({ enabled: r2, serviceId: I2, serviceType: C2, multiServiceRequest: be2, timeZone: U2, today: qt2, locationId: V2, staffId: H2, customerChoices: Rt2, minRemainingCapacity: jt2, loadInitially: u2, onlyAvailableSlots: e2 }), $t2 = de2?.slice(0, 10) ?? null, en2 = (0, import_react.useMemo)(() => $t2 ? Yt2.map((e3) => e3.date > $t2 ? { ...e3, availability: `none` } : e3) : Yt2, [Yt2, $t2]), tn2 = de2 && U2 ? Bo(new Date(de2), U2) : null, { query: W2, selectedDate: nn2, timeSlots: rn2, isLoading: an2, error: on2, selectDate: sn2, findNextAvailableDate: cn2 } = yl({ enabled: r2, serviceId: I2, serviceType: C2, multiServiceRequest: be2, timeZone: U2, today: qt2, locationId: V2, staffId: H2, customerChoices: Rt2, minRemainingCapacity: jt2, onlyAvailableSlots: e2, serviceLoading: P2 || ce2 }), ln2 = (0, import_react.useRef)(true), un2 = (0, import_react.useRef)(null);
2915
2897
  (0, import_react.useEffect)(() => {
2916
- if (_n2 && !bn2.current) {
2917
- if (gn2) {
2918
- Cn2().forEach((e3) => e3(`none`));
2919
- return;
2920
- }
2921
- hn2 && En2(Cn2());
2922
- }
2923
- }, [_n2, G2, hn2, gn2, En2, Cn2]);
2924
- let On2 = x2?.schedule?.lastSessionEnd, kn2 = R2 || Qa(C2) || $a(C2) && !Ol(On2, Yt2), An2 = !!(Ae2 && r2 && !P2 && I2 && U2 && Yt2 !== void 0), jn2 = An2 && I2 && U2 && Yt2 !== void 0 ? Al({ serviceId: I2, serviceType: C2, lastSessionEnd: On2, timeZone: U2, now: Yt2, onlyAvailableSlots: e2, locationId: V2, staffId: H2, timeSlotLimitPerDay: f2, customerChoices: Vt2, minRemainingCapacity: Pt2 }) : void 0, K2 = $l(a2, jn2), Mn2 = Ae2 && I2 && kn2 && !(Ae2 && I2 && kn2 && (!r2 || P2)) && !U2, Nn2 = ve2 ? `onlineBookingOff` : le2 ?? (K2.error === null ? Mn2 ? `timeZoneMissing` : null : `upcomingSlotsLoadFailed`), Pn2 = W2 !== null, Fn2 = (0, import_react.useMemo)(() => Ll({ sessions: K2.sessions, dayQuery: Pn2, daySlots: sn2, staffFilter: H2, appointmentLike: R2, limitPerDay: f2, expandedDates: K2.expandedDates }), [K2.sessions, Pn2, sn2, H2, R2, f2, K2.expandedDates]), { slotIdOf: In2 } = Fn2, Ln2 = Ae2 && (jn2 ? K2.firstPageSettled : An2 || r2 && !P2 && !I2 || Mn2);
2925
- Ne2.current = Ln2, (0, import_react.useEffect)(() => {
2926
- if (!Ln2) return;
2927
- let e3 = Me2.current;
2928
- Me2.current = [], e3.forEach((e4) => e4());
2929
- }, [Ln2]);
2930
- let Rn2 = Ae2 && !Ln2 || K2.isLoadingPage, zn2 = Nn2 !== null, Bn2 = W2 ? cn2 : Rn2 || cn2 || !r2 || xe2 && !U2 || _n2 || ce2, Vn2 = W2 ? ln2 : ln2 ?? Nn2, Hn2 = W2 ? ln2 !== null : zn2 || ln2 !== null, Un2 = Hc(Lc.TIME_SLOTS), Wn2 = (0, import_react.useRef)(false), Gn2 = (0, import_react.useCallback)((e3, t3) => {
2898
+ ln2.current ? ln2.current = false : (ke2(null), Ne2.current && pu(I2, T2, D2), Ne2.current = null, un2.current = null);
2899
+ }, [W2, be2, U2, V2, H2, Rt2, jt2, e2, a2, f2, ee2]);
2900
+ let dn2 = (0, import_react.useCallback)(async () => {
2901
+ let e3 = await cn2();
2902
+ return e3.outcome === `found` ? $t2 && e3.date > $t2 ? `none` : (await Promise.all([sn2(e3.date), Jt2 && Yo(e3.date, Jt2) ? Promise.resolve() : Qt2(Jo(e3.date))]), `found`) : e3.outcome;
2903
+ }, [cn2, $t2, sn2, Jt2, Qt2]), { request: fn2, cancel: pn2, held: mn2 } = kl({ ready: !!(r2 && !P2 && xe2 && U2 && qt2), answer: r2 && !P2 && !ce2 && !xe2 ? `none` : void 0, run: dn2, rerunsOn: uu }), hn2 = (0, import_react.useCallback)((e3) => (pn2(`cancelled`), sn2(e3)), [pn2, sn2]), gn2 = x2?.schedule?.lastSessionEnd, _n2 = z2 || Qa(C2) || $a(C2) && !Al(gn2, Kt2), vn2 = !!(Ae2 && r2 && !P2 && I2 && U2 && Kt2 !== void 0), G2 = vn2 && I2 && U2 && Kt2 !== void 0 ? Ml({ serviceId: I2, serviceType: C2, lastSessionEnd: gn2, timeZone: U2, now: Kt2, onlyAvailableSlots: e2, locationId: V2, staffId: H2, timeSlotLimitPerDay: f2, customerChoices: Rt2, minRemainingCapacity: jt2 }) : void 0, K2 = tu(a2, G2), yn2 = Ae2 && I2 && _n2 && !(Ae2 && I2 && _n2 && (!r2 || P2)) && !U2, bn2 = ve2 ? `onlineBookingOff` : le2 ?? (K2.error === null ? yn2 ? `timeZoneMissing` : null : `upcomingSlotsLoadFailed`), xn2 = W2 !== null, Sn2 = (0, import_react.useMemo)(() => zl({ sessions: K2.sessions, dayQuery: xn2, daySlots: rn2, staffFilter: H2, appointmentLike: z2, limitPerDay: f2, expandedDates: K2.expandedDates }), [K2.sessions, xn2, rn2, H2, z2, f2, K2.expandedDates]), { slotIdOf: Cn2 } = Sn2, wn2 = Ae2 && (G2 ? K2.firstPageSettled : vn2 || r2 && !P2 && !I2 || yn2), { request: Tn2 } = kl({ ready: wn2, run: lu }), En2 = (0, import_react.useCallback)(() => (je2(true), Tn2()), [Tn2]), Dn2 = Ae2 && !wn2 || K2.isLoadingPage, On2 = bn2 !== null, kn2 = W2 ? an2 : Dn2 || an2 || !r2 || xe2 && !U2 || mn2 || ce2, An2 = W2 ? on2 : on2 ?? bn2, jn2 = W2 ? on2 !== null : On2 || on2 !== null, Mn2 = Uc(Rc.TIME_SLOTS), Nn2 = (0, import_react.useRef)(false), Pn2 = (0, import_react.useCallback)((e3, t3) => {
2931
2904
  if (!t3.bookable) {
2932
- pn2.current = null;
2905
+ un2.current = null;
2933
2906
  return;
2934
2907
  }
2935
- if (e3 === pn2.current) return;
2936
- pn2.current = e3;
2908
+ if (e3 === un2.current) return;
2909
+ un2.current = e3;
2937
2910
  let n3 = I2 ?? t3.serviceId ?? t3.nestedTimeSlots?.[0]?.serviceId ?? void 0, r3 = C2 ?? ie2.find((e4) => e4._id === n3)?.type ?? void 0;
2938
- !Wn2.current && !F2 && Un2(Fc({ bookingsServiceId: n3, serviceType: r3, isEligibleForFlowCompletion: true })), Wn2.current = true, Un2(Gc({ component: Bc.TIME_PICKER, element: Vc.TIME_SLOT, properties: JSON.stringify({ selectedTime: t3.localStartDate }) }));
2939
- }, [Un2, I2, C2, ie2, F2]), q2 = (0, import_react.useCallback)((e3) => {
2911
+ !Nn2.current && !F2 && Mn2(Ic({ bookingsServiceId: n3, serviceType: r3, isEligibleForFlowCompletion: true })), Nn2.current = true, Mn2(Kc({ component: Vc.TIME_PICKER, element: Hc.TIME_SLOT, properties: JSON.stringify({ selectedTime: t3.localStartDate }) }));
2912
+ }, [Mn2, I2, C2, ie2, F2]), Fn2 = (0, import_react.useCallback)((e3) => {
2940
2913
  if (e3 === null) {
2941
- let e4 = Le2.current !== null;
2942
- Le2.current = null, pn2.current = null, ke2(null), e4 && lu(I2, T2, D2);
2914
+ let e4 = Ne2.current !== null;
2915
+ Ne2.current = null, un2.current = null, ke2(null), e4 && pu(I2, T2, D2);
2943
2916
  return;
2944
2917
  }
2945
- let t3 = Rl(Fn2, e3);
2918
+ let t3 = Bl(Sn2, e3);
2946
2919
  if (!t3) return;
2947
2920
  if (L2) {
2948
2921
  if (!E2(t3.nestedTimeSlots ?? [], U2 ?? void 0)) return;
2949
- Le2.current = t3, ke2(t3), Gn2(e3, t3);
2922
+ Ne2.current = t3, ke2(t3), Pn2(e3, t3);
2950
2923
  return;
2951
2924
  }
2952
- Le2.current = t3, ke2(t3), Gn2(e3, t3);
2953
- let n3 = Hl(t3);
2954
- if (w2(Ts(t3), { staffId: R2 ? void 0 : Vl(t3), timezone: U2 ?? void 0, bookable: t3.bookable, staffChoiceRequired: R2 && Ue2 && !z2 && n3.length > 1 && !Ut2(n3.length), rescheduleStaffId: R2 && (_2 !== `CUSTOMER_MAY_CHOOSE` || !Ut2(n3.length)) ? n3[0] : void 0 }), !R2) return;
2955
- let r3 = ze2.current, i2;
2956
- i2 = B2 || (H2 && n3.includes(H2) ? { anyResource: false, staffMemberId: H2 } : At2 !== null && Ut2(n3.length) ? { anyResource: true } : Ml(n3, Ue2 && Ut2(n3.length))), tu(i2, At2) !== tu(r3, Ve2) && jt2(i2);
2957
- }, [L2, I2, T2, D2, E2, w2, Fn2, Gn2, U2, R2, Ue2, _2, z2, Ut2, B2, H2, At2, Ve2, jt2]), Kn2 = (0, import_react.useCallback)(() => {
2958
- let e3 = Le2.current;
2925
+ Ne2.current = t3, ke2(t3), Pn2(e3, t3);
2926
+ let n3 = Wl(t3);
2927
+ if (w2(Es(t3), { staffId: z2 ? void 0 : Ul(t3), timezone: U2 ?? void 0, bookable: t3.bookable, staffChoiceRequired: z2 && Be2 && !ze2 && n3.length > 1 && !Bt2(n3.length), rescheduleStaffId: z2 && (_2 !== `CUSTOMER_MAY_CHOOSE` || !Bt2(n3.length)) ? n3[0] : void 0 }), !z2) return;
2928
+ let r3 = Fe2.current, i2;
2929
+ i2 = B2 || (H2 && n3.includes(H2) ? { anyResource: false, staffMemberId: H2 } : Dt2 !== null && Bt2(n3.length) ? { anyResource: true } : Pl(n3, Be2 && Bt2(n3.length))), ru(i2, Dt2) !== ru(r3, Le2) && Ot2(i2);
2930
+ }, [L2, I2, T2, D2, E2, w2, Sn2, Pn2, U2, z2, Be2, _2, ze2, Bt2, B2, H2, Dt2, Le2, Ot2]), In2 = (0, import_react.useCallback)(() => {
2931
+ let e3 = Ne2.current;
2959
2932
  if (!e3 || F2 || !e3.bookable) return;
2960
2933
  if (L2) {
2961
- O2(Un2);
2934
+ O2(Mn2);
2962
2935
  return;
2963
2936
  }
2964
2937
  if (!I2) return;
2965
2938
  let t3;
2966
- if (R2) {
2967
- let n4 = Hl(e3), r3 = Nl(n4, Wt2(ze2.current), Ut2(n4.length));
2939
+ if (z2) {
2940
+ let n4 = Wl(e3), r3 = Fl(n4, Vt2(Fe2.current), Bt2(n4.length));
2968
2941
  t3 = (r3.isComplete ? r3.resourceId : n4[0]) ?? (n4.length ? null : void 0);
2969
2942
  }
2970
2943
  let n3 = De2(`bookingForm`, { slug: x2?.mainSlug?.name ?? null, serviceId: I2 });
2971
- Un2(Jc({ serviceId: I2, serviceType: C2 ?? void 0, start: e3.localStartDate, end: e3.localEndDate, timeZone: U2 ?? void 0, isEligibleForFlowCompletion: !!n3 })), n3 && Ee2(te2(n3, { handoff: true, staffId: t3 }));
2972
- }, [Un2, L2, O2, U2, I2, C2, x2, R2, Wt2, Ut2, Ee2, De2, te2, F2]), qn2 = Oe2 ? Hl(Oe2) : null, Jn2 = qn2 ? L2 || !R2 || Nl(qn2, Wt2(Re2), Ut2(qn2.length)).isComplete : false, Yn2 = qn2 ? Ut2(qn2.length) : false, Xn2 = (0, import_react.useMemo)(() => !Oe2 || Ze2 ? [] : Bl(Oe2).map((e3) => ({ staffMemberId: e3.staffMemberId, name: e3.name || null, image: null, isSelected: e3.staffMemberId === Be2 })), [Oe2, Ze2, Be2]), Zn2 = (0, import_react.useMemo)(() => ({ isMultiService: L2, isSelectionPending: he2, availabilityRequestKey: Se2, needsServiceChoice: Ce2, isRescheduling: F2, rescheduleValidUntil: an2, businessTimeZone: g2, canChangeTimeZone: qt2, setTimeZone: Jt2, locationFilterOptions: ut2, selectedLocationFilter: V2, setLocationFilter: Kt2, staffFilterOptions: vt2, selectedStaffFilter: H2, setStaffFilter: Gt2, requestedGender: At2, genderSelectionAllowed: Ge2, currentTimeSlotsPage: W2 ? 1 : K2.currentPage, hasNextTimeSlotsPage: !W2 && K2.hasNextPage, hasPreviousTimeSlotsPage: !W2 && K2.hasPreviousPage, nextTimeSlotsPage: W2 ? ou : K2.nextPage, loadUpcomingTimeSlots: Pe2, upcomingTimeSlotsRequested: Ae2, previousTimeSlotsPage: W2 ? au : K2.previousPage, timeSlots: Fn2.rows.map((e3) => zl(e3, U2, In2, z2)), isLoading: Bn2, hasError: Hn2, errorCode: Vn2, selectedDate: on2, daysAvailabilityRange: Zt2, daysAvailability: rn2, daysAvailabilityLoading: $t2, daysAvailabilityHasError: en2, selectDate: Tn2, setDaysAvailabilityRange: tn2, goToNextAvailableDate: Dn2, nextAvailableSlotsCount: a2, timeZone: U2, staffFromSlots: Xn2, selectedResourceId: Be2, setSelectedResource: Mt2, canAutoAssignStaff: Yn2, isComplete: Jn2, selectedTimeSlot: Oe2 ? zl(Oe2, U2, In2, z2) : null, selectTimeSlot: q2, navigateToBookingForm: Kn2, timeSlotLimitPerDay: f2, daysWithMore: Fn2.daysWithMore, loadingDate: K2.loadingDate, loadAllTimeSlotsForDay: K2.loadAllSessionsForDay }), [L2, he2, Se2, Ce2, F2, an2, g2, U2, qt2, Jt2, K2, Pe2, Ae2, ut2, V2, Kt2, vt2, H2, Gt2, At2, Ge2, W2, Bn2, Vn2, Hn2, Fn2, on2, Zt2, rn2, $t2, en2, Tn2, tn2, Dn2, a2, Xn2, Be2, Mt2, Yn2, Jn2, Oe2, q2, Kn2, f2, In2, z2]);
2973
- return (0, import_jsx_runtime.jsx)(su.Provider, { value: Zn2, children: b2 });
2944
+ Mn2(Yc({ serviceId: I2, serviceType: C2 ?? void 0, start: e3.localStartDate, end: e3.localEndDate, timeZone: U2 ?? void 0, isEligibleForFlowCompletion: !!n3 })), n3 && Ee2(te2(n3, { handoff: true, staffId: t3 }));
2945
+ }, [Mn2, L2, O2, U2, I2, C2, x2, z2, Vt2, Bt2, Ee2, De2, te2, F2]), Ln2 = Oe2 ? Wl(Oe2) : null, Rn2 = Ln2 ? L2 || !z2 || Fl(Ln2, Vt2(Pe2), Bt2(Ln2.length)).isComplete : false, zn2 = Ln2 ? Bt2(Ln2.length) : false, Bn2 = (0, import_react.useMemo)(() => !Oe2 || Je2 ? [] : Hl(Oe2).map((e3) => ({ staffMemberId: e3.staffMemberId, name: e3.name || null, image: null, isSelected: e3.staffMemberId === Ie2 })), [Oe2, Je2, Ie2]), Vn2 = (0, import_react.useMemo)(() => ({ isMultiService: L2, isSelectionPending: he2, availabilityRequestKey: Se2, needsServiceChoice: Ce2, isRescheduling: F2, rescheduleValidUntil: tn2, businessTimeZone: g2, canChangeTimeZone: Wt2, setTimeZone: Gt2, locationFilterOptions: st2, selectedLocationFilter: V2, setLocationFilter: Ut2, staffFilterOptions: ht2, selectedStaffFilter: H2, setStaffFilter: Ht2, requestedGender: Dt2, genderSelectionAllowed: He2, currentTimeSlotsPage: W2 ? 1 : K2.currentPage, hasNextTimeSlotsPage: !W2 && K2.hasNextPage, hasPreviousTimeSlotsPage: !W2 && K2.hasPreviousPage, nextTimeSlotsPage: W2 ? cu : K2.nextPage, loadUpcomingTimeSlots: En2, upcomingTimeSlotsRequested: Ae2, previousTimeSlotsPage: W2 ? su : K2.previousPage, timeSlots: Sn2.rows.map((e3) => Vl(e3, U2, Cn2, ze2)), isLoading: kn2, hasError: jn2, errorCode: An2, selectedDate: nn2, daysAvailabilityRange: Jt2, daysAvailability: en2, daysAvailabilityLoading: Xt2, daysAvailabilityHasError: Zt2, selectDate: hn2, setDaysAvailabilityRange: Qt2, goToNextAvailableDate: fn2, nextAvailableSlotsCount: a2, timeZone: U2, staffFromSlots: Bn2, selectedResourceId: Ie2, setSelectedResource: kt2, canAutoAssignStaff: zn2, isComplete: Rn2, selectedTimeSlot: Oe2 ? Vl(Oe2, U2, Cn2, ze2) : null, selectTimeSlot: Fn2, navigateToBookingForm: In2, timeSlotLimitPerDay: f2, daysWithMore: Sn2.daysWithMore, loadingDate: K2.loadingDate, loadAllTimeSlotsForDay: K2.loadAllSessionsForDay }), [L2, he2, Se2, Ce2, F2, tn2, g2, U2, Wt2, Gt2, K2, En2, Ae2, st2, V2, Ut2, ht2, H2, Ht2, Dt2, He2, W2, kn2, An2, jn2, Sn2, nn2, Jt2, en2, Xt2, Zt2, hn2, Qt2, fn2, a2, Bn2, Ie2, kt2, zn2, Rn2, Oe2, Fn2, In2, f2, Cn2, ze2]);
2946
+ return (0, import_jsx_runtime.jsx)(du.Provider, { value: Vn2, children: b2 });
2974
2947
  }
2975
- var gu = ln(`4936242d-905c-48bf-80ce-5f56d075de4f`);
2948
+ var bu = ln(`4936242d-905c-48bf-80ce-5f56d075de4f`);
2976
2949
  // Annotate the CommonJS export names for ESM import in node:
2977
2950
  0 && (module.exports = {
2978
2951
  TimeSlotsContextProvider,