@gomusdev/web-components 1.40.0 → 1.42.0

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.
@@ -11020,7 +11020,7 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
11020
11020
  const max2 = Math.max(available - cartTotal - preCartTotal + item.quantity, 0);
11021
11021
  const ret = {
11022
11022
  max: max2,
11023
- min: seats.min,
11023
+ min: seats.min ?? 0,
11024
11024
  unavailable: seats.available === 0,
11025
11025
  bookedOut: max2 === 0
11026
11026
  };
@@ -11227,7 +11227,7 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
11227
11227
  throw new Error(`Unhandled case: ${_exhaustiveCheck}`);
11228
11228
  }
11229
11229
  }
11230
- function loadFromLocalStorage(cart) {
11230
+ function loadFromLocalStorage$1(cart) {
11231
11231
  let lsItems = [];
11232
11232
  let lsCoupons = [];
11233
11233
  try {
@@ -11259,7 +11259,7 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
11259
11259
  }
11260
11260
  }
11261
11261
  function syncCartToLocalStorage(cart) {
11262
- loadFromLocalStorage(cart);
11262
+ loadFromLocalStorage$1(cart);
11263
11263
  const storeCart = proxy(cart);
11264
11264
  effect_root(() => {
11265
11265
  user_effect(() => {
@@ -11275,7 +11275,7 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
11275
11275
  }
11276
11276
  let newLS = localStorage.getItem("go-cart");
11277
11277
  if (lastLS && lastLS !== newLS) {
11278
- loadFromLocalStorage(cart);
11278
+ loadFromLocalStorage$1(cart);
11279
11279
  }
11280
11280
  lastLS = newLS || "";
11281
11281
  },
@@ -11375,17 +11375,83 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
11375
11375
  dispatchCartEvents(cart);
11376
11376
  return cart;
11377
11377
  }
11378
+ function isLocalStorageAvailable() {
11379
+ return typeof window !== "undefined" && typeof localStorage !== "undefined";
11380
+ }
11381
+ function saveToLocalStorage(key, data) {
11382
+ if (!isLocalStorageAvailable()) return;
11383
+ try {
11384
+ localStorage.setItem(key, JSON.stringify(data));
11385
+ } catch (e) {
11386
+ console.warn(`Failed to save to localStorage (${key}):`, e);
11387
+ }
11388
+ }
11389
+ function loadFromLocalStorage(key) {
11390
+ if (!isLocalStorageAvailable()) return null;
11391
+ try {
11392
+ const item = localStorage.getItem(key);
11393
+ return item ? JSON.parse(item) : null;
11394
+ } catch (e) {
11395
+ console.warn(`Failed to load from localStorage (${key}):`, e);
11396
+ return null;
11397
+ }
11398
+ }
11399
+ function removeFromLocalStorage(key) {
11400
+ if (!isLocalStorageAvailable()) return;
11401
+ try {
11402
+ localStorage.removeItem(key);
11403
+ } catch (e) {
11404
+ console.warn(`Failed to remove from localStorage (${key}):`, e);
11405
+ }
11406
+ }
11407
+ const KEY$5 = "go-capacity";
11408
+ function saveCapacityToLocalStorage(allSeats, allQuotas) {
11409
+ const existing = loadFromLocalStorage(KEY$5);
11410
+ const merged = {
11411
+ allSeats: { ...existing?.allSeats || {}, ...allSeats },
11412
+ allQuotas: { ...existing?.allQuotas || {}, ...allQuotas }
11413
+ };
11414
+ saveToLocalStorage(KEY$5, merged);
11415
+ }
11416
+ function loadCapacityFromLocalStorage(manager) {
11417
+ const data = loadFromLocalStorage(KEY$5);
11418
+ if (!data) return;
11419
+ if (data.allSeats) {
11420
+ for (const dateId in data.allSeats) {
11421
+ const did = parseInt(dateId);
11422
+ manager.addSeats(did, data.allSeats[did], false);
11423
+ }
11424
+ }
11425
+ if (data.allQuotas) {
11426
+ manager.addQuotas(data.allQuotas, false);
11427
+ }
11428
+ }
11429
+ function syncCapacityAcrossTabs(manager) {
11430
+ if (!isLocalStorageAvailable()) return;
11431
+ window.addEventListener("storage", (event2) => {
11432
+ if (event2.key === KEY$5) {
11433
+ loadCapacityFromLocalStorage(manager);
11434
+ }
11435
+ if (event2.key === "go-cart") {
11436
+ const cart = loadFromLocalStorage("go-cart");
11437
+ const cartEmpty = !cart || !cart.items || cart.items.length === 0;
11438
+ if (cartEmpty) removeFromLocalStorage(KEY$5);
11439
+ }
11440
+ });
11441
+ }
11378
11442
  function createCapacityManager() {
11379
- return {
11443
+ const manager = {
11380
11444
  allSeats: {},
11381
11445
  allQuotas: {},
11382
11446
  quotaManager: createQuotaManager({}),
11383
- addQuotas(quotas) {
11447
+ addQuotas(quotas, saveToLocalStorage2 = true) {
11384
11448
  this.allQuotas = { ...this.allQuotas, ...quotas };
11385
11449
  this.quotaManager.addQuotas(quotas);
11450
+ if (saveToLocalStorage2) saveCapacityToLocalStorage(this.allSeats, this.allQuotas);
11386
11451
  },
11387
- addSeats(dateId, seats) {
11452
+ addSeats(dateId, seats, saveToLocalStorage2 = true) {
11388
11453
  this.allSeats[dateId] = seats;
11454
+ if (saveToLocalStorage2) saveCapacityToLocalStorage(this.allSeats, this.allQuotas);
11389
11455
  },
11390
11456
  capacityPolicy(item) {
11391
11457
  switch (item.type) {
@@ -11431,6 +11497,9 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
11431
11497
  return ret;
11432
11498
  }
11433
11499
  };
11500
+ loadCapacityFromLocalStorage(manager);
11501
+ syncCapacityAcrossTabs(manager);
11502
+ return manager;
11434
11503
  }
11435
11504
  function getCookie(name) {
11436
11505
  if (typeof document === "undefined") {
@@ -16451,7 +16520,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16451
16520
  host.replaceChildren(element);
16452
16521
  return element;
16453
16522
  }
16454
- var root_1$i = /* @__PURE__ */ from_html(`<go-all-fields></go-all-fields> <go-form-feedback><go-errors-feedback></go-errors-feedback> <go-success-feedback></go-success-feedback></go-form-feedback> <go-submit> </go-submit>`, 3);
16523
+ var root_1$j = /* @__PURE__ */ from_html(`<go-all-fields></go-all-fields> <go-form-feedback><go-errors-feedback></go-errors-feedback> <go-success-feedback></go-success-feedback></go-form-feedback> <go-submit> </go-submit>`, 3);
16455
16524
  function Form($$anchor, $$props) {
16456
16525
  push($$props, true);
16457
16526
  let formId = prop($$props, "formId", 7), custom2 = prop($$props, "custom", 7);
@@ -16494,7 +16563,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16494
16563
  var node = first_child(fragment);
16495
16564
  {
16496
16565
  var consequent = ($$anchor2) => {
16497
- var fragment_1 = root_1$i();
16566
+ var fragment_1 = root_1$j();
16498
16567
  var go_all_fields = first_child(fragment_1);
16499
16568
  var go_form_feedback = sibling(go_all_fields, 2);
16500
16569
  var go_submit = sibling(go_form_feedback, 2);
@@ -16641,8 +16710,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16641
16710
  [],
16642
16711
  []
16643
16712
  ));
16644
- var root_1$h = /* @__PURE__ */ from_html(`<span class="go-cart-item-date" data-testid="cart-item-date"> </span><span class="go-cart-item-time" data-testid="cart-item-time"> </span>`, 1);
16645
- var root$9 = /* @__PURE__ */ from_html(`<li data-go-cart-item-title=""><span class="go-cart-item-title" data-testid="cart-item-title"><span class="go-cart-item-title-event-title"> </span><span class="go-cart-item-title-ticket-title"> </span></span><!></li>`);
16713
+ var root_1$i = /* @__PURE__ */ from_html(`<span class="go-cart-item-date" data-testid="cart-item-date"> </span><span class="go-cart-item-time" data-testid="cart-item-time"> </span>`, 1);
16714
+ var root$9 = /* @__PURE__ */ from_html(`<span class="go-cart-item-title" data-testid="cart-item-title"><span class="go-cart-item-title-event-title"> </span><span class="go-cart-item-title-ticket-title"> </span></span><!>`, 1);
16646
16715
  function Event$2($$anchor, $$props) {
16647
16716
  push($$props, true);
16648
16717
  let cartItem = prop($$props, "cartItem", 7);
@@ -16657,8 +16726,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16657
16726
  flushSync();
16658
16727
  }
16659
16728
  };
16660
- var li = root$9();
16661
- var span = child(li);
16729
+ var fragment = root$9();
16730
+ var span = first_child(fragment);
16662
16731
  var span_1 = child(span);
16663
16732
  var text2 = child(span_1, true);
16664
16733
  reset(span_1);
@@ -16669,8 +16738,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16669
16738
  var node = sibling(span);
16670
16739
  {
16671
16740
  var consequent = ($$anchor2) => {
16672
- var fragment = root_1$h();
16673
- var span_3 = first_child(fragment);
16741
+ var fragment_1 = root_1$i();
16742
+ var span_3 = first_child(fragment_1);
16674
16743
  var text_2 = child(span_3, true);
16675
16744
  reset(span_3);
16676
16745
  var span_4 = sibling(span_3);
@@ -16686,24 +16755,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16686
16755
  () => formatTime(cartItem().time)
16687
16756
  ]
16688
16757
  );
16689
- append($$anchor2, fragment);
16758
+ append($$anchor2, fragment_1);
16690
16759
  };
16691
16760
  if_block(node, ($$render) => {
16692
16761
  if (cartItem().time) $$render(consequent);
16693
16762
  });
16694
16763
  }
16695
- reset(li);
16696
16764
  template_effect(() => {
16697
16765
  set_text(text2, product.event_title);
16698
16766
  set_text(text_1, product.title);
16699
16767
  });
16700
- append($$anchor, li);
16768
+ append($$anchor, fragment);
16701
16769
  return pop($$exports);
16702
16770
  }
16703
16771
  create_custom_element(Event$2, { cartItem: {} }, [], [], { mode: "open" });
16704
16772
  var root_2$p = /* @__PURE__ */ from_html(`<span class="go-cart-item-time" data-testid="cart-item-time"> </span>`);
16705
- var root_1$g = /* @__PURE__ */ from_html(`<span class="go-cart-item-date" data-testid="cart-item-date"> </span> <!>`, 1);
16706
- var root$8 = /* @__PURE__ */ from_html(`<li data-go-cart-item-title=""><span class="go-cart-item-title" data-testid="cart-item-title"> </span> <!></li>`);
16773
+ var root_1$h = /* @__PURE__ */ from_html(`<span class="go-cart-item-date" data-testid="cart-item-date"> </span> <!>`, 1);
16774
+ var root$8 = /* @__PURE__ */ from_html(`<span class="go-cart-item-title" data-testid="cart-item-title"> </span> <!>`, 1);
16707
16775
  function Ticket($$anchor, $$props) {
16708
16776
  push($$props, true);
16709
16777
  let cartItem = prop($$props, "cartItem", 7);
@@ -16716,15 +16784,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16716
16784
  flushSync();
16717
16785
  }
16718
16786
  };
16719
- var li = root$8();
16720
- var span = child(li);
16787
+ var fragment = root$8();
16788
+ var span = first_child(fragment);
16721
16789
  var text2 = child(span, true);
16722
16790
  reset(span);
16723
16791
  var node = sibling(span, 2);
16724
16792
  {
16725
16793
  var consequent_1 = ($$anchor2) => {
16726
- var fragment = root_1$g();
16727
- var span_1 = first_child(fragment);
16794
+ var fragment_1 = root_1$h();
16795
+ var span_1 = first_child(fragment_1);
16728
16796
  var text_1 = child(span_1, true);
16729
16797
  reset(span_1);
16730
16798
  var node_1 = sibling(span_1, 2);
@@ -16743,22 +16811,197 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16743
16811
  template_effect(($0) => set_text(text_1, $0), [
16744
16812
  () => formatDate(cartItem().time, { month: "numeric", day: "numeric" }, shop.locale)
16745
16813
  ]);
16746
- append($$anchor2, fragment);
16814
+ append($$anchor2, fragment_1);
16747
16815
  };
16748
16816
  if_block(node, ($$render) => {
16749
16817
  if (cartItem().time) $$render(consequent_1);
16750
16818
  });
16751
16819
  }
16752
- reset(li);
16753
16820
  template_effect(() => set_text(text2, cartItem().product.title));
16754
- append($$anchor, li);
16821
+ append($$anchor, fragment);
16755
16822
  return pop($$exports);
16756
16823
  }
16757
16824
  create_custom_element(Ticket, { cartItem: {} }, [], [], { mode: "open" });
16825
+ function generateQuantityOptions(min2, max2) {
16826
+ let options = [{ value: 0, label: "0" }];
16827
+ if (max2 === 0) {
16828
+ return options;
16829
+ }
16830
+ if (max2 < min2) {
16831
+ max2 = min2;
16832
+ options = [];
16833
+ }
16834
+ for (let quantity = min2; quantity <= max2; quantity++) {
16835
+ if (quantity == 0) continue;
16836
+ options.push({
16837
+ value: quantity,
16838
+ label: quantity.toString()
16839
+ });
16840
+ }
16841
+ return options;
16842
+ }
16843
+ var root_5$2 = /* @__PURE__ */ from_html(`<span> </span>`);
16844
+ var root_7$3 = /* @__PURE__ */ from_html(`<option> </option>`);
16845
+ var root_6$2 = /* @__PURE__ */ from_html(`<select></select>`);
16846
+ var root_8$2 = /* @__PURE__ */ from_html(`<li class="go-cart-item-remove" data-go-cart-item-remove=""><button>⨉</button></li>`);
16847
+ var root_1$g = /* @__PURE__ */ from_html(`<article><ul><li data-go-cart-item-title=""><!></li> <li class="go-cart-item-price" data-go-cart-item-price=""> </li> <li class="go-cart-item-count" data-go-cart-item-count=""><!></li> <!> <li class="go-cart-item-sum" data-go-cart-item-sum=""> </li></ul></article>`);
16848
+ function Item$1($$anchor, $$props) {
16849
+ push($$props, true);
16850
+ let cartItem = prop($$props, "cartItem", 7), cart = prop($$props, "cart", 7), preview = prop($$props, "preview", 7);
16851
+ let capacity = /* @__PURE__ */ state(void 0);
16852
+ const emptyCart = createCart();
16853
+ user_effect(() => {
16854
+ cart().items.map((i) => i.quantity);
16855
+ untrack(() => {
16856
+ set(capacity, shop.capacityManager.capacity(cart(), cartItem(), emptyCart), true);
16857
+ });
16858
+ });
16859
+ function update(ci, target) {
16860
+ const el = target;
16861
+ ci.quantity = parseInt(el.value);
16862
+ }
16863
+ var $$exports = {
16864
+ get cartItem() {
16865
+ return cartItem();
16866
+ },
16867
+ set cartItem($$value) {
16868
+ cartItem($$value);
16869
+ flushSync();
16870
+ },
16871
+ get cart() {
16872
+ return cart();
16873
+ },
16874
+ set cart($$value) {
16875
+ cart($$value);
16876
+ flushSync();
16877
+ },
16878
+ get preview() {
16879
+ return preview();
16880
+ },
16881
+ set preview($$value) {
16882
+ preview($$value);
16883
+ flushSync();
16884
+ }
16885
+ };
16886
+ var fragment = comment();
16887
+ var node = first_child(fragment);
16888
+ {
16889
+ var consequent_4 = ($$anchor2) => {
16890
+ var article = root_1$g();
16891
+ var ul = child(article);
16892
+ var li = child(ul);
16893
+ var node_1 = child(li);
16894
+ {
16895
+ var consequent = ($$anchor3) => {
16896
+ Ticket($$anchor3, {
16897
+ get cartItem() {
16898
+ return cartItem();
16899
+ }
16900
+ });
16901
+ };
16902
+ var alternate = ($$anchor3) => {
16903
+ var fragment_2 = comment();
16904
+ var node_2 = first_child(fragment_2);
16905
+ {
16906
+ var consequent_1 = ($$anchor4) => {
16907
+ Event$2($$anchor4, {
16908
+ get cartItem() {
16909
+ return cartItem();
16910
+ }
16911
+ });
16912
+ };
16913
+ if_block(
16914
+ node_2,
16915
+ ($$render) => {
16916
+ if (cartItem().product.product_type === "Event") $$render(consequent_1);
16917
+ },
16918
+ true
16919
+ );
16920
+ }
16921
+ append($$anchor3, fragment_2);
16922
+ };
16923
+ if_block(node_1, ($$render) => {
16924
+ if (cartItem().product.product_type === "Ticket") $$render(consequent);
16925
+ else $$render(alternate, false);
16926
+ });
16927
+ }
16928
+ reset(li);
16929
+ var li_1 = sibling(li, 2);
16930
+ var text2 = child(li_1, true);
16931
+ reset(li_1);
16932
+ var li_2 = sibling(li_1, 2);
16933
+ var node_3 = child(li_2);
16934
+ {
16935
+ var consequent_2 = ($$anchor3) => {
16936
+ var span = root_5$2();
16937
+ var text_1 = child(span, true);
16938
+ reset(span);
16939
+ template_effect(() => set_text(text_1, cartItem().quantity));
16940
+ append($$anchor3, span);
16941
+ };
16942
+ var alternate_1 = ($$anchor3) => {
16943
+ var select = root_6$2();
16944
+ select.__change = (e) => update(cartItem(), e.target);
16945
+ each(select, 21, () => generateQuantityOptions(get$2(capacity).min, get$2(capacity).max), (q) => q.value, ($$anchor4, q) => {
16946
+ var option = root_7$3();
16947
+ var text_2 = child(option, true);
16948
+ reset(option);
16949
+ var option_value = {};
16950
+ template_effect(() => {
16951
+ set_selected(option, cartItem().quantity === get$2(q).value);
16952
+ set_text(text_2, get$2(q).label);
16953
+ if (option_value !== (option_value = get$2(q).value)) {
16954
+ option.value = (option.__value = get$2(q).value) ?? "";
16955
+ }
16956
+ });
16957
+ append($$anchor4, option);
16958
+ });
16959
+ reset(select);
16960
+ append($$anchor3, select);
16961
+ };
16962
+ if_block(node_3, ($$render) => {
16963
+ if (preview()) $$render(consequent_2);
16964
+ else $$render(alternate_1, false);
16965
+ });
16966
+ }
16967
+ reset(li_2);
16968
+ var node_4 = sibling(li_2, 2);
16969
+ {
16970
+ var consequent_3 = ($$anchor3) => {
16971
+ var li_3 = root_8$2();
16972
+ var button = child(li_3);
16973
+ button.__click = () => cart().deleteItem(cartItem());
16974
+ reset(li_3);
16975
+ append($$anchor3, li_3);
16976
+ };
16977
+ if_block(node_4, ($$render) => {
16978
+ if (!preview()) $$render(consequent_3);
16979
+ });
16980
+ }
16981
+ var li_4 = sibling(node_4, 2);
16982
+ var text_3 = child(li_4, true);
16983
+ reset(li_4);
16984
+ reset(ul);
16985
+ reset(article);
16986
+ template_effect(() => {
16987
+ set_attribute(article, "data-testid", cartItem().uuid);
16988
+ set_text(text2, cartItem().final_price_formatted);
16989
+ set_text(text_3, cartItem().total_price_formatted);
16990
+ });
16991
+ append($$anchor2, article);
16992
+ };
16993
+ if_block(node, ($$render) => {
16994
+ if (get$2(capacity)) $$render(consequent_4);
16995
+ });
16996
+ }
16997
+ append($$anchor, fragment);
16998
+ return pop($$exports);
16999
+ }
17000
+ delegate(["change", "click"]);
17001
+ create_custom_element(Item$1, { cartItem: {}, cart: {}, preview: {} }, [], [], { mode: "open" });
16758
17002
  var root_2$o = /* @__PURE__ */ from_html(`<li class="go-cart-header-remove" data-go-cart-header-remove=""></li>`);
16759
- var root_7$3 = /* @__PURE__ */ from_html(`<li class="go-cart-item-remove" data-go-cart-item-remove=""><button>⨉</button></li>`);
16760
- var root_3$7 = /* @__PURE__ */ from_html(`<li class="go-cart-item" data-go-cart-item=""><article><ul><!> <li class="go-cart-item-price" data-go-cart-item-price=""> </li> <li class="go-cart-item-count" data-go-cart-item-count=""> </li> <!> <li class="go-cart-item-sum" data-go-cart-item-sum=""> </li></ul></article></li>`);
16761
- var root_8$2 = /* @__PURE__ */ from_html(`<li class="go-cart-footer-remove" data-go-cart-footer-remove=""></li>`);
17003
+ var root_3$7 = /* @__PURE__ */ from_html(`<li class="go-cart-item" data-go-cart-item=""><!></li>`);
17004
+ var root_4$6 = /* @__PURE__ */ from_html(`<li class="go-cart-footer-remove" data-go-cart-footer-remove=""></li>`);
16762
17005
  var root_1$f = /* @__PURE__ */ from_html(`<ol data-testid="cart"><li class="go-cart-header" data-go-cart-header="" data-testid="cart-header"><ul><li class="go-cart-header-title" data-go-cart-header-title=""> </li> <li class="go-cart-header-price" data-go-cart-header-price=""> </li> <li class="go-cart-header-count" data-go-cart-header-count=""> </li> <!> <li class="go-cart-header-sum" data-go-cart-header-sum=""> </li></ul></li> <!> <li class="go-cart-footer" data-go-cart-footer="" data-testid="cart-footer"><ul><li class="go-cart-footer-title" data-go-cart-footer-title=""></li> <li class="go-cart-footer-price" data-go-cart-footer-price=""></li> <li class="go-cart-footer-count" data-go-cart-footer-count=""></li> <!> <li class="go-cart-footer-sum" data-go-cart-footer-sum="" data-go-cart-sum=""> </li></ul></li></ol>`);
16763
17006
  function Cart($$anchor, $$props) {
16764
17007
  push($$props, true);
@@ -16776,7 +17019,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16776
17019
  var fragment = comment();
16777
17020
  var node = first_child(fragment);
16778
17021
  {
16779
- var consequent_5 = ($$anchor2) => {
17022
+ var consequent_2 = ($$anchor2) => {
16780
17023
  var ol = root_1$f();
16781
17024
  var li = child(ol);
16782
17025
  var ul = child(li);
@@ -16807,93 +17050,38 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16807
17050
  var node_2 = sibling(li, 2);
16808
17051
  each(node_2, 17, () => get$2(cart).items, (cartItem) => cartItem.uuid, ($$anchor3, cartItem) => {
16809
17052
  var li_6 = root_3$7();
16810
- var article = child(li_6);
16811
- var ul_1 = child(article);
16812
- var node_3 = child(ul_1);
16813
- {
16814
- var consequent_1 = ($$anchor4) => {
16815
- Ticket($$anchor4, {
16816
- get cartItem() {
16817
- return get$2(cartItem);
16818
- }
16819
- });
16820
- };
16821
- var alternate = ($$anchor4) => {
16822
- var fragment_2 = comment();
16823
- var node_4 = first_child(fragment_2);
16824
- {
16825
- var consequent_2 = ($$anchor5) => {
16826
- Event$2($$anchor5, {
16827
- get cartItem() {
16828
- return get$2(cartItem);
16829
- }
16830
- });
16831
- };
16832
- if_block(
16833
- node_4,
16834
- ($$render) => {
16835
- if (get$2(cartItem).product.product_type === "Event") $$render(consequent_2);
16836
- },
16837
- true
16838
- );
16839
- }
16840
- append($$anchor4, fragment_2);
16841
- };
16842
- if_block(node_3, ($$render) => {
16843
- if (get$2(cartItem).product.product_type === "Ticket") $$render(consequent_1);
16844
- else $$render(alternate, false);
16845
- });
16846
- }
16847
- var li_7 = sibling(node_3, 2);
16848
- var text_4 = child(li_7, true);
16849
- reset(li_7);
16850
- var li_8 = sibling(li_7, 2);
16851
- var text_5 = child(li_8, true);
16852
- reset(li_8);
16853
- var node_5 = sibling(li_8, 2);
16854
- {
16855
- var consequent_3 = ($$anchor4) => {
16856
- var li_9 = root_7$3();
16857
- var button = child(li_9);
16858
- button.__click = () => get$2(cart).deleteItem(get$2(cartItem));
16859
- reset(li_9);
16860
- append($$anchor4, li_9);
16861
- };
16862
- if_block(node_5, ($$render) => {
16863
- if (!preview()) $$render(consequent_3);
16864
- });
16865
- }
16866
- var li_10 = sibling(node_5, 2);
16867
- var text_6 = child(li_10, true);
16868
- reset(li_10);
16869
- reset(ul_1);
16870
- reset(article);
16871
- reset(li_6);
16872
- template_effect(() => {
16873
- set_attribute(article, "data-testid", get$2(cartItem).uuid);
16874
- set_text(text_4, get$2(cartItem).final_price_formatted);
16875
- set_text(text_5, get$2(cartItem).quantity);
16876
- set_text(text_6, get$2(cartItem).total_price_formatted);
17053
+ var node_3 = child(li_6);
17054
+ Item$1(node_3, {
17055
+ get cartItem() {
17056
+ return get$2(cartItem);
17057
+ },
17058
+ get cart() {
17059
+ return get$2(cart);
17060
+ },
17061
+ get preview() {
17062
+ return preview();
17063
+ }
16877
17064
  });
17065
+ reset(li_6);
16878
17066
  append($$anchor3, li_6);
16879
17067
  });
16880
- var li_11 = sibling(node_2, 2);
16881
- var ul_2 = child(li_11);
16882
- var node_6 = sibling(child(ul_2), 6);
17068
+ var li_7 = sibling(node_2, 2);
17069
+ var ul_1 = child(li_7);
17070
+ var node_4 = sibling(child(ul_1), 6);
16883
17071
  {
16884
- var consequent_4 = ($$anchor3) => {
16885
- var li_12 = root_8$2();
16886
- append($$anchor3, li_12);
17072
+ var consequent_1 = ($$anchor3) => {
17073
+ var li_8 = root_4$6();
17074
+ append($$anchor3, li_8);
16887
17075
  };
16888
- if_block(node_6, ($$render) => {
16889
- if (!preview()) $$render(consequent_4);
17076
+ if_block(node_4, ($$render) => {
17077
+ if (!preview()) $$render(consequent_1);
16890
17078
  });
16891
17079
  }
16892
- var li_13 = sibling(node_6, 2);
16893
- var text_7 = child(li_13, true);
16894
- reset(li_13);
16895
- reset(ul_2);
16896
- reset(li_11);
17080
+ var li_9 = sibling(node_4, 2);
17081
+ var text_4 = child(li_9, true);
17082
+ reset(li_9);
17083
+ reset(ul_1);
17084
+ reset(li_7);
16897
17085
  reset(ol);
16898
17086
  template_effect(
16899
17087
  ($0, $1, $2, $3) => {
@@ -16901,7 +17089,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16901
17089
  set_text(text_1, $1);
16902
17090
  set_text(text_2, $2);
16903
17091
  set_text(text_3, $3);
16904
- set_text(text_7, get$2(cart).totalFormatted);
17092
+ set_text(text_4, get$2(cart).totalFormatted);
16905
17093
  },
16906
17094
  [
16907
17095
  () => shop.t("cart.content.table.desc"),
@@ -16913,13 +17101,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16913
17101
  append($$anchor2, ol);
16914
17102
  };
16915
17103
  if_block(node, ($$render) => {
16916
- if (get$2(cart) && get$2(cart).items.length) $$render(consequent_5);
17104
+ if (get$2(cart) && get$2(cart).items.length) $$render(consequent_2);
16917
17105
  });
16918
17106
  }
16919
17107
  append($$anchor, fragment);
16920
17108
  return pop($$exports);
16921
17109
  }
16922
- delegate(["click"]);
16923
17110
  customElements.define("go-cart", create_custom_element(Cart, { preview: {} }, [], []));
16924
17111
  function CartEmpty($$anchor, $$props) {
16925
17112
  push($$props, true);
@@ -30359,6 +30546,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
30359
30546
  push($$props, true);
30360
30547
  let dateString = prop($$props, "dateString", 15), labelClass = prop($$props, "labelClass", 7), inputClass = prop($$props, "inputClass", 7), labelText = prop($$props, "labelText", 7);
30361
30548
  let date2 = /* @__PURE__ */ state(proxy($14e0f24ef4ac5c92$export$d0bdf45af03a6ea3($14e0f24ef4ac5c92$export$aa8b41735afcabd2())));
30549
+ const uniqueId = "go-" + Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
30362
30550
  user_effect(() => {
30363
30551
  dateString(get$2(date2).toString());
30364
30552
  });
@@ -30414,6 +30602,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
30414
30602
  var node_1 = first_child(fragment_1);
30415
30603
  component(node_1, () => Date_field_label, ($$anchor4, DatePicker_Label) => {
30416
30604
  DatePicker_Label($$anchor4, {
30605
+ get id() {
30606
+ return uniqueId;
30607
+ },
30417
30608
  get class() {
30418
30609
  return `go-datepicker-label ${labelClass() ?? ""}`;
30419
30610
  },
@@ -30465,7 +30656,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
30465
30656
  });
30466
30657
  var node_7 = sibling(node_5, 2);
30467
30658
  component(node_7, () => Date_picker_trigger, ($$anchor5, DatePicker_Trigger) => {
30468
- DatePicker_Trigger($$anchor5, { class: "go-calendar-button" });
30659
+ DatePicker_Trigger($$anchor5, {
30660
+ get "aria-labelledby"() {
30661
+ return uniqueId;
30662
+ },
30663
+ class: "go-calendar-button"
30664
+ });
30469
30665
  });
30470
30666
  append($$anchor4, fragment_4);
30471
30667
  };
@@ -31373,6 +31569,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
31373
31569
  set preCarts(value) {
31374
31570
  set(this.#preCarts, value);
31375
31571
  }
31572
+ #timeslotDetails = /* @__PURE__ */ state();
31573
+ get timeslotDetails() {
31574
+ return get$2(this.#timeslotDetails);
31575
+ }
31576
+ set timeslotDetails(value) {
31577
+ set(this.#timeslotDetails, value, true);
31578
+ }
31376
31579
  addTicketSegment(ticketGroup) {
31377
31580
  this.ticketSegments.push(ticketGroup);
31378
31581
  }
@@ -32714,24 +32917,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
32714
32917
  const d = /* @__PURE__ */ new Date();
32715
32918
  return d.toISOString();
32716
32919
  }
32717
- function generateQuantityOptions(min2, max2) {
32718
- let options = [{ value: 0, label: "0" }];
32719
- if (max2 === 0) {
32720
- return options;
32721
- }
32722
- if (max2 < min2) {
32723
- max2 = min2;
32724
- options = [];
32725
- }
32726
- for (let quantity = min2; quantity <= max2; quantity++) {
32727
- if (quantity == 0) continue;
32728
- options.push({
32729
- value: quantity,
32730
- label: quantity.toString()
32731
- });
32732
- }
32733
- return options;
32734
- }
32735
32920
  var root_1$4 = /* @__PURE__ */ from_html(`<span class="go-tickets-item-title-event-title"> </span> <span class="go-tickets-item-title-product-title"> </span>`, 1);
32736
32921
  var root_4 = /* @__PURE__ */ from_html(`<option> </option>`);
32737
32922
  var root_3$1 = /* @__PURE__ */ from_html(`<li><article><ul><li class="go-tickets-item-title"><!></li> <li class="go-tickets-item-description" data-go-tickets-description=""><!></li> <li class="go-tickets-item-price" data-go-tickets-price=""> </li> <li class="go-tickets-item-quality" data-go-tickets-quality=""><select></select></li></ul></article></li>`);
@@ -32812,7 +32997,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
32812
32997
  var li_4 = sibling(li_3, 2);
32813
32998
  var select = child(li_4);
32814
32999
  select.__change = (e) => update(item(), e.target, details()?.ticketSelectionDetails);
32815
- each(select, 21, () => generateQuantityOptions(get$2(capacity).min, get$2(capacity).max), index$1, ($$anchor3, q) => {
33000
+ each(select, 21, () => generateQuantityOptions(get$2(capacity).min, get$2(capacity).max), (q) => q.value, ($$anchor3, q) => {
32816
33001
  var option = root_4();
32817
33002
  var text_4 = child(option, true);
32818
33003
  reset(option);
@@ -32935,6 +33120,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
32935
33120
  constructor(tsdWrapper) {
32936
33121
  if (!tsdWrapper) return;
32937
33122
  this.#tsd = /* @__PURE__ */ user_derived(() => tsdWrapper.value);
33123
+ if (this.tsd) this.tsd.timeslotDetails = this;
33124
+ }
33125
+ get boockedOutCount() {
33126
+ return this.timeslots.filter((t) => t.capacity == 0).length;
32938
33127
  }
32939
33128
  get timeslots() {
32940
33129
  const tsd = this.tsd;