@gomusdev/web-components 1.33.0 → 1.34.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.
Files changed (35) hide show
  1. package/dist-js/components/forms/ui/generic/FormDetails.svelte.d.ts +14 -1
  2. package/dist-js/components/profile/details/Details.spec.d.ts +1 -0
  3. package/dist-js/components/profile/details/Details.svelte.d.ts +1 -0
  4. package/dist-js/components/profile/entry.d.ts +0 -0
  5. package/dist-js/components/profile/overview/Overview.spec.d.ts +1 -0
  6. package/dist-js/components/profile/overview/Overview.svelte.d.ts +1 -0
  7. package/dist-js/components/profile/password/Password.spec.d.ts +1 -0
  8. package/dist-js/components/profile/password/Password.svelte.d.ts +1 -0
  9. package/dist-js/components/ticketSelection/TicketSelectionDetails.svelte.d.ts +4 -4
  10. package/dist-js/components/ticketSelection/subcomponents/tickets/subcomponents/segment/{TicketSegmentDetails.svelte.d.ts → SegmentDetails.svelte.d.ts} +10 -5
  11. package/dist-js/components/ticketSelection/subcomponents/tickets/subcomponents/segment/TicketSegmentEmpty.svelte.d.ts +1 -0
  12. package/dist-js/components/ticketSelection/subcomponents/tickets/subcomponents/segment/lib/annualTickets.svelte.d.ts +2 -2
  13. package/dist-js/components/ticketSelection/subcomponents/tickets/subcomponents/segment/lib/dayTickets.svelte.d.ts +2 -2
  14. package/dist-js/components/ticketSelection/subcomponents/tickets/subcomponents/segment/lib/event/event_ScaledPriceTickets.spec.d.ts +1 -0
  15. package/dist-js/components/ticketSelection/subcomponents/tickets/subcomponents/segment/lib/event/event_ScaledPriceTickets.svelte.d.ts +2 -0
  16. package/dist-js/components/ticketSelection/subcomponents/tickets/subcomponents/segment/lib/event/event_Tickets.svelte.d.ts +2 -0
  17. package/dist-js/components/ticketSelection/subcomponents/tickets/subcomponents/segment/lib/event/event_Tickets.svelte.spec.d.ts +1 -0
  18. package/dist-js/components/ticketSelection/subcomponents/tickets/subcomponents/segment/lib/events/events_ScaledPriceTickets.spec.d.ts +1 -0
  19. package/dist-js/components/ticketSelection/subcomponents/tickets/subcomponents/segment/lib/events/events_ScaledPriceTickets.svelte.d.ts +2 -0
  20. package/dist-js/components/ticketSelection/subcomponents/tickets/subcomponents/segment/lib/timeslotTickets.svelte.d.ts +2 -2
  21. package/dist-js/factories/DateFactories.d.ts +161 -0
  22. package/dist-js/factories/ScalingPriceFactories.d.ts +11 -0
  23. package/dist-js/gomus-webcomponents.css +25 -36
  24. package/dist-js/gomus-webcomponents.iife.js +563 -199
  25. package/dist-js/gomus-webcomponents.js +563 -199
  26. package/dist-js/lib/helpers/shopCart.d.ts +2 -2
  27. package/dist-js/lib/models/scalePrice/UIScaledPrice.svelte.d.ts +5 -5
  28. package/dist-js/lib/stores/auth.svelte.d.ts +1 -1
  29. package/dist-js/lib/stores/shop.svelte.d.ts +76 -2
  30. package/dist-js/mocks/MSWMocks.d.ts +1 -0
  31. package/package.json +1 -1
  32. package/dist-js/components/ticketSelection/subcomponents/tickets/subcomponents/segment/lib/event/eventScaledPriceTickets.svelte.d.ts +0 -2
  33. package/dist-js/components/ticketSelection/subcomponents/tickets/subcomponents/segment/lib/event/eventTickets.svelte.d.ts +0 -2
  34. /package/dist-js/components/{ticketSelection/subcomponents/tickets/subcomponents/segment/lib/event/eventScaledPriceTickets.spec.d.ts → forms/ui/specs/fill.spec.d.ts} +0 -0
  35. /package/dist-js/components/{ticketSelection/subcomponents/tickets/subcomponents/segment/lib/event/eventTickets.svelte.spec.d.ts → forms/ui/specs/onsubmit.spec.d.ts} +0 -0
@@ -2043,8 +2043,8 @@ function without_reactive_context(fn) {
2043
2043
  set_active_effect(previous_effect);
2044
2044
  }
2045
2045
  }
2046
- function listen_to_event_and_reset_event(element, event, handler, on_reset = handler) {
2047
- element.addEventListener(event, () => without_reactive_context(handler));
2046
+ function listen_to_event_and_reset_event(element, event2, handler, on_reset = handler) {
2047
+ element.addEventListener(event2, () => without_reactive_context(handler));
2048
2048
  const prev = element.__on_r;
2049
2049
  if (prev) {
2050
2050
  element.__on_r = () => {
@@ -2826,13 +2826,13 @@ function deep_read(value, visited = /* @__PURE__ */ new Set()) {
2826
2826
  const all_registered_events = /* @__PURE__ */ new Set();
2827
2827
  const root_event_handles = /* @__PURE__ */ new Set();
2828
2828
  function create_event(event_name, dom, handler, options = {}) {
2829
- function target_handler(event) {
2829
+ function target_handler(event2) {
2830
2830
  if (!options.capture) {
2831
- handle_event_propagation.call(dom, event);
2831
+ handle_event_propagation.call(dom, event2);
2832
2832
  }
2833
- if (!event.cancelBubble) {
2833
+ if (!event2.cancelBubble) {
2834
2834
  return without_reactive_context(() => {
2835
- return handler?.call(this, event);
2835
+ return handler?.call(this, event2);
2836
2836
  });
2837
2837
  }
2838
2838
  }
@@ -2851,6 +2851,18 @@ function on(element, type, handler, options = {}) {
2851
2851
  element.removeEventListener(type, target_handler, options);
2852
2852
  };
2853
2853
  }
2854
+ function event(event_name, dom, handler, capture2, passive) {
2855
+ var options = { capture: capture2, passive };
2856
+ var target_handler = create_event(event_name, dom, handler, options);
2857
+ if (dom === document.body || // @ts-ignore
2858
+ dom === window || // @ts-ignore
2859
+ dom === document || // Firefox has quirky behavior, it can happen that we still get "canplay" events when the element is already removed
2860
+ dom instanceof HTMLMediaElement) {
2861
+ teardown(() => {
2862
+ dom.removeEventListener(event_name, target_handler, options);
2863
+ });
2864
+ }
2865
+ }
2854
2866
  function delegate(events) {
2855
2867
  for (var i = 0; i < events.length; i++) {
2856
2868
  all_registered_events.add(events[i]);
@@ -2860,26 +2872,26 @@ function delegate(events) {
2860
2872
  }
2861
2873
  }
2862
2874
  let last_propagated_event = null;
2863
- function handle_event_propagation(event) {
2875
+ function handle_event_propagation(event2) {
2864
2876
  var handler_element = this;
2865
2877
  var owner_document = (
2866
2878
  /** @type {Node} */
2867
2879
  handler_element.ownerDocument
2868
2880
  );
2869
- var event_name = event.type;
2870
- var path = event.composedPath?.() || [];
2881
+ var event_name = event2.type;
2882
+ var path = event2.composedPath?.() || [];
2871
2883
  var current_target = (
2872
2884
  /** @type {null | Element} */
2873
- path[0] || event.target
2885
+ path[0] || event2.target
2874
2886
  );
2875
- last_propagated_event = event;
2887
+ last_propagated_event = event2;
2876
2888
  var path_idx = 0;
2877
- var handled_at = last_propagated_event === event && event.__root;
2889
+ var handled_at = last_propagated_event === event2 && event2.__root;
2878
2890
  if (handled_at) {
2879
2891
  var at_idx = path.indexOf(handled_at);
2880
2892
  if (at_idx !== -1 && (handler_element === document || handler_element === /** @type {any} */
2881
2893
  window)) {
2882
- event.__root = handler_element;
2894
+ event2.__root = handler_element;
2883
2895
  return;
2884
2896
  }
2885
2897
  var handler_idx = path.indexOf(handler_element);
@@ -2891,9 +2903,9 @@ function handle_event_propagation(event) {
2891
2903
  }
2892
2904
  }
2893
2905
  current_target = /** @type {Element} */
2894
- path[path_idx] || event.target;
2906
+ path[path_idx] || event2.target;
2895
2907
  if (current_target === handler_element) return;
2896
- define_property(event, "currentTarget", {
2908
+ define_property(event2, "currentTarget", {
2897
2909
  configurable: true,
2898
2910
  get() {
2899
2911
  return current_target || owner_document;
@@ -2914,8 +2926,8 @@ function handle_event_propagation(event) {
2914
2926
  if (delegated != null && (!/** @type {any} */
2915
2927
  current_target.disabled || // DOM could've been updated already by the time this is reached, so we check this as well
2916
2928
  // -> the target could not have been disabled because it emits the event in the first place
2917
- event.target === current_target)) {
2918
- delegated.call(current_target, event);
2929
+ event2.target === current_target)) {
2930
+ delegated.call(current_target, event2);
2919
2931
  }
2920
2932
  } catch (error) {
2921
2933
  if (throw_error) {
@@ -2924,7 +2936,7 @@ function handle_event_propagation(event) {
2924
2936
  throw_error = error;
2925
2937
  }
2926
2938
  }
2927
- if (event.cancelBubble || parent_element === handler_element || parent_element === null) {
2939
+ if (event2.cancelBubble || parent_element === handler_element || parent_element === null) {
2928
2940
  break;
2929
2941
  }
2930
2942
  current_target = parent_element;
@@ -2938,8 +2950,8 @@ function handle_event_propagation(event) {
2938
2950
  throw throw_error;
2939
2951
  }
2940
2952
  } finally {
2941
- event.__root = handler_element;
2942
- delete event.currentTarget;
2953
+ event2.__root = handler_element;
2954
+ delete event2.currentTarget;
2943
2955
  set_active_reaction(previous_reaction);
2944
2956
  set_active_effect(previous_effect);
2945
2957
  }
@@ -4751,6 +4763,24 @@ function bind_group(inputs, group_index, input, get2, set2 = get2) {
4751
4763
  }
4752
4764
  });
4753
4765
  }
4766
+ function bind_checked(input, get2, set2 = get2) {
4767
+ listen_to_event_and_reset_event(input, "change", (is_reset) => {
4768
+ var value = is_reset ? input.defaultChecked : input.checked;
4769
+ set2(value);
4770
+ });
4771
+ if (
4772
+ // If we are hydrating and the value has since changed,
4773
+ // then use the update value from the input instead.
4774
+ hydrating && input.defaultChecked !== input.checked || // If defaultChecked is set, then checked == defaultChecked
4775
+ untrack(get2) == null
4776
+ ) {
4777
+ set2(input.checked);
4778
+ }
4779
+ render_effect(() => {
4780
+ var value = get2();
4781
+ input.checked = Boolean(value);
4782
+ });
4783
+ }
4754
4784
  function get_binding_group_value(group, __value, checked) {
4755
4785
  var value = /* @__PURE__ */ new Set();
4756
4786
  for (var i = 0; i < group.length; i += 1) {
@@ -5156,12 +5186,12 @@ class Svelte4Component {
5156
5186
  * @param {(...args: any[]) => any} callback
5157
5187
  * @returns {any}
5158
5188
  */
5159
- $on(event, callback) {
5160
- this.#events[event] = this.#events[event] || [];
5189
+ $on(event2, callback) {
5190
+ this.#events[event2] = this.#events[event2] || [];
5161
5191
  const cb = (...args) => callback.call(this, ...args);
5162
- this.#events[event].push(cb);
5192
+ this.#events[event2].push(cb);
5163
5193
  return () => {
5164
- this.#events[event] = this.#events[event].filter(
5194
+ this.#events[event2] = this.#events[event2].filter(
5165
5195
  /** @param {any} fn */
5166
5196
  (fn) => fn !== cb
5167
5197
  );
@@ -5660,6 +5690,7 @@ class Auth {
5660
5690
  // Unix time (seconds)
5661
5691
  };
5662
5692
  constructor() {
5693
+ this.load();
5663
5694
  setInterval(() => this.load(), 1e3);
5664
5695
  }
5665
5696
  customerLevel() {
@@ -10970,8 +11001,6 @@ const maxQuantity_Quotas = function(manager, cart, item, preCart) {
10970
11001
  quotaManager.setPrecartItemQuantity(product.id, i.quantity);
10971
11002
  }
10972
11003
  }
10973
- console.log("checking quotas for", p2.id, "on", p2.selectedTime);
10974
- console.log("available timeslots", quotaManager.timeslots());
10975
11004
  const cap = quotaManager.ticketCapacity(p2.id, p2.selectedTime);
10976
11005
  const total = quotaManager.totalCapacity(p2.id, p2.selectedTime);
10977
11006
  return {
@@ -10981,11 +11010,11 @@ const maxQuantity_Quotas = function(manager, cart, item, preCart) {
10981
11010
  unavailable: total === 0
10982
11011
  };
10983
11012
  };
10984
- function isUIEventTicket(x) {
11013
+ function isUIScaledPricesTicket(x) {
10985
11014
  return x.product_type === "Event";
10986
11015
  }
10987
11016
  let uuid$1 = 1;
10988
- function createUIEventTicket(apiTicket, dateId, options) {
11017
+ function createUIScaledPricesTicket(apiTicket, dateId, options) {
10989
11018
  const finalOptions = {
10990
11019
  minAvailableCapacity: 0,
10991
11020
  selectedTime: "",
@@ -11012,7 +11041,7 @@ function createUIEventTicket(apiTicket, dateId, options) {
11012
11041
  }
11013
11042
  const maxQuantity_Seats = function(manager, cart, item, preCart) {
11014
11043
  if (manager.capacityPolicy(item) !== "seats") throw new Error("(getMaxQuantitySeats) impossible");
11015
- if (!isUIEventTicket(item.product)) {
11044
+ if (!isUIScaledPricesTicket(item.product)) {
11016
11045
  throw new Error("(getMaxQuantitySeats) impossible");
11017
11046
  }
11018
11047
  const p2 = item.product;
@@ -11140,9 +11169,9 @@ function dispatchCartEvents(cart) {
11140
11169
  if (cart.items.length === lastLength) {
11141
11170
  return;
11142
11171
  }
11143
- const event = cart.items.length > lastLength ? "go-cart-item-added" : "go-cart-item-removed";
11172
+ const event2 = cart.items.length > lastLength ? "go-cart-item-added" : "go-cart-item-removed";
11144
11173
  lastLength = cart.items.length;
11145
- document.dispatchEvent(new CustomEvent(event, { detail: cart.items.length }));
11174
+ document.dispatchEvent(new CustomEvent(event2, { detail: cart.items.length }));
11146
11175
  });
11147
11176
  });
11148
11177
  }
@@ -11173,7 +11202,7 @@ function createCartItem(product, options) {
11173
11202
  ...base
11174
11203
  };
11175
11204
  case "Event":
11176
- if (!isUIEventTicket(this.product)) {
11205
+ if (!isUIScaledPricesTicket(this.product)) {
11177
11206
  throw new Error("Event ticket is not a scale ticket");
11178
11207
  }
11179
11208
  const scaleTicket = this.product;
@@ -11191,7 +11220,7 @@ function createCartItem(product, options) {
11191
11220
  return this.type + "-" + this.product.id + this.subUId;
11192
11221
  },
11193
11222
  get subUId() {
11194
- if (isUIEventTicket(this.product)) {
11223
+ if (isUIScaledPricesTicket(this.product)) {
11195
11224
  return ` (scale_price: ${this.product.scale_price_id})`;
11196
11225
  }
11197
11226
  return "";
@@ -11233,8 +11262,8 @@ function generateCartItem(cartItem) {
11233
11262
  const ticket = createUITicket(cartItem.product);
11234
11263
  return createCartItem(ticket, { time: cartItem.time, quantity: cartItem.quantity });
11235
11264
  case "Event":
11236
- const event = createUIEventTicket(cartItem.product, cartItem.id);
11237
- return createCartItem(event, { time: cartItem.time, quantity: cartItem.quantity });
11265
+ const event2 = createUIScaledPricesTicket(cartItem.product, cartItem.id);
11266
+ return createCartItem(event2, { time: cartItem.time, quantity: cartItem.quantity });
11238
11267
  default:
11239
11268
  const _exhaustiveCheck = type;
11240
11269
  throw new Error(`Unhandled case: ${_exhaustiveCheck}`);
@@ -12305,6 +12334,7 @@ function client(publicApiUrl, shopUrl) {
12305
12334
  }
12306
12335
  const CALENDAR_ENDPOINT = "/api/v4/calendar";
12307
12336
  const TICKETS_CALENDAR_ENDPOINT = "/api/v4/tickets/calendar";
12337
+ const VALIDATE_TOKEN_ENDPOINT = "/api/v4/auth/validate_token";
12308
12338
  const TICKET_AND_QUOTAS_ENDPOINT = "/api/v4/tickets/list_and_quotas";
12309
12339
  const TICKETS_ENDPOINT = "/api/v4/tickets";
12310
12340
  const SIGN_IN_ENDPOINT = "/api/v4/auth/sign_in";
@@ -12422,6 +12452,9 @@ class Shop {
12422
12452
  get _data() {
12423
12453
  return get$2(this.#data);
12424
12454
  }
12455
+ validateToken() {
12456
+ return this.fetchAndCache(VALIDATE_TOKEN_ENDPOINT, `validateToken`, "", { cache: 5 });
12457
+ }
12425
12458
  ticketsCalendar(params) {
12426
12459
  return this.fetchAndCache(TICKETS_CALENDAR_ENDPOINT, `ticketsCalendar-${JSON.stringify(params)}`, "data", { cache: 60, query: params });
12427
12460
  }
@@ -12457,6 +12490,15 @@ class Shop {
12457
12490
  if (!asGuest) requiredFields.push("password", "password_confirmation");
12458
12491
  return this.apiPost(SIGN_UP_ENDPOINT, { body: params, requiredFields });
12459
12492
  }
12493
+ getDates(query) {
12494
+ return this.fetchAndCache("/api/v4/dates", `dates-${JSON.stringify(query)}`, "dates", { query, cache: 60 });
12495
+ }
12496
+ updatePassword(params) {
12497
+ return this.apiPut("/api/v4/auth/password", {
12498
+ body: params,
12499
+ requiredFields: ["current_password", "password", "password_confirmation"]
12500
+ });
12501
+ }
12460
12502
  passwordReset(params) {
12461
12503
  return this.apiPost("/api/v4/auth/password", { body: params, requiredFields: ["email"] });
12462
12504
  }
@@ -12492,7 +12534,7 @@ class Shop {
12492
12534
  console.warn("(fetchAndCache) Couldn't fetch, Shop not loaded!");
12493
12535
  return get$2(this.#data)[dataKey];
12494
12536
  }
12495
- const query = assign(options.query, { per_page: 1e3 });
12537
+ const query = assign({ per_page: 1e3 }, options.query);
12496
12538
  const fetchId = endpoint + JSON.stringify(query);
12497
12539
  const isNotFetchedYet = !this.#fetchStatus[fetchId];
12498
12540
  const isCacheExpired = this.#fetchStatus[fetchId]?.fetchedAt < Date.now() - options.cache * 1e3;
@@ -12568,13 +12610,23 @@ class Shop {
12568
12610
  * @return {Promise<T>} A promise that resolves with the typed response of the POST request.
12569
12611
  */
12570
12612
  async apiPost(path, options) {
12613
+ return this.apiCall(path, { method: "POST", ...options });
12614
+ }
12615
+ async apiPut(path, options) {
12616
+ return this.apiCall(path, { method: "PUT", ...options });
12617
+ }
12618
+ async apiDELETE(path, options) {
12619
+ return this.apiCall(path, { method: "DELETE", ...options });
12620
+ }
12621
+ async apiCall(path, options) {
12571
12622
  this.#ensureApi();
12572
12623
  const { body, params = {}, requiredFields } = options;
12573
12624
  const validationErrors = validateApiPostBody(body, requiredFields);
12574
12625
  if (Object.keys(validationErrors).length > 0) {
12575
12626
  return { error: { errors: validationErrors } };
12576
12627
  }
12577
- const ret = await this.client.POST(path, { body, params: assign(this.#defaultApiParams, params) });
12628
+ const httpMethod = this.client[options.method];
12629
+ const ret = await httpMethod(path, { body, params: assign(this.#defaultApiParams, params) });
12578
12630
  return ret;
12579
12631
  }
12580
12632
  /**
@@ -12603,7 +12655,7 @@ class Shop {
12603
12655
  }
12604
12656
  const ret = await this.client.GET(path, params);
12605
12657
  this.#fetchStatus[fetchId] = { status: "completed", fetchedAt: Date.now() };
12606
- return ret.data;
12658
+ return ret.data || ret;
12607
12659
  }
12608
12660
  #canFetch = () => {
12609
12661
  return this.apiUrl !== void 0 && this.shopDomain !== void 0 && this.locale !== void 0 && this.client !== void 0;
@@ -15169,6 +15221,15 @@ var allFields = {
15169
15221
  description: "",
15170
15222
  autocomplete: "current-password"
15171
15223
  },
15224
+ currentPassword: {
15225
+ key: "current_password",
15226
+ apiKey: "current_password",
15227
+ type: "password",
15228
+ label: "user.registration.form.password",
15229
+ placeholder: "",
15230
+ description: "",
15231
+ autocomplete: "current-password"
15232
+ },
15172
15233
  newPassword: {
15173
15234
  key: "password",
15174
15235
  apiKey: "password",
@@ -15524,7 +15585,6 @@ class FormDetails {
15524
15585
  this.formId = formId;
15525
15586
  this.form = form;
15526
15587
  }
15527
- #fields = /* @__PURE__ */ state(proxy([]));
15528
15588
  #apiErrors = /* @__PURE__ */ state(proxy([]));
15529
15589
  #isValid = /* @__PURE__ */ user_derived(() => errors(this.fields) == 0);
15530
15590
  get isValid() {
@@ -15557,6 +15617,8 @@ class FormDetails {
15557
15617
  /**
15558
15618
  * Sets API errors for the current instance.
15559
15619
  *
15620
+ * The API returns errors in very different shapes, this method should consume all those shapes
15621
+ *
15560
15622
  * @param {string[] | Record<string, string[]>} errors - Errors passed as an array or an object where keys are API field keys and values are arrays of error messages. If an array is provided, it assigns the errors directly. If an object is provided, it maps the errors to the respective fields based on their API keys.
15561
15623
  */
15562
15624
  set apiErrors(errors2) {
@@ -15565,12 +15627,17 @@ class FormDetails {
15565
15627
  set(this.#apiErrors, errors2, true);
15566
15628
  return;
15567
15629
  }
15630
+ if (errors2.errors && isArray(errors2.errors)) {
15631
+ set(this.#apiErrors, errors2.errors, true);
15632
+ }
15568
15633
  if (isString(errors2.error)) {
15569
15634
  set(this.#apiErrors, [errors2.error], true);
15570
15635
  return;
15571
15636
  }
15572
15637
  for (const [key, value] of Object.entries(errors2)) {
15573
15638
  if (key === "full_messages ") continue;
15639
+ if (key === "success") continue;
15640
+ if (key === "errors") continue;
15574
15641
  const field = this.fields.find((f) => f.apiKey === key);
15575
15642
  if (!field) {
15576
15643
  console.error(`(set apiErrors) Field with API key ${key} not found`);
@@ -15603,6 +15670,36 @@ class FormDetails {
15603
15670
  const parent = this.form.closest("go-form");
15604
15671
  return Array.from(this.form.querySelectorAll("go-field")).filter((fe) => fe.closest("go-form") === parent).map((fe) => fe.getField?.()).filter((f) => f);
15605
15672
  }
15673
+ toString() {
15674
+ return `Form: ${this.formId}, Fields: [${this.fields.map((f) => f.key).join(", ")}], Data: ${JSON.stringify(this.formData)}`;
15675
+ }
15676
+ /**
15677
+ * Populates the fields of the current instance with the corresponding values from the provided data object.
15678
+ * Filters the fields by matching their `apiKey` to keys in the data object and updates their `value`.
15679
+ *
15680
+ * @param {Record<string, any>} data - An object containing key-value pairs where keys represent the `apiKey` of fields and values represent the data to be filled into each field.
15681
+ */
15682
+ fill(data) {
15683
+ const fs = this.fields;
15684
+ Object.entries(data).forEach(([key, val]) => {
15685
+ console.log(key, val);
15686
+ const f = fs.find((f2) => f2.apiKey === key);
15687
+ if (!f) {
15688
+ console.warn(`(FormDetails.fill) Field with API key ${key} not found.`);
15689
+ return;
15690
+ }
15691
+ if (f.type === "select") {
15692
+ console.log(f.options());
15693
+ if (!f.options?.().find((o) => o.value === val)) {
15694
+ throw new Error(`(FormDetails.fill) Field ${key} has invalid value: ${val}`);
15695
+ }
15696
+ }
15697
+ if (f.type === "checkbox") {
15698
+ if (![true, false].includes(val)) throw new Error(`(FormDetails.fill) Field ${key} has invalid value: ${val}`);
15699
+ }
15700
+ f.value = val;
15701
+ });
15702
+ }
15606
15703
  }
15607
15704
  const KEY$3 = "go-form-details";
15608
15705
  const setDetails$1 = createSetDetails(KEY$3);
@@ -15630,19 +15727,21 @@ function wrapInElement(host, tag, props) {
15630
15727
  host.replaceChildren(element);
15631
15728
  return element;
15632
15729
  }
15633
- var root_1$h = /* @__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>Submit</go-submit>`, 3);
15730
+ 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>Submit</go-submit>`, 3);
15634
15731
  function Form($$anchor, $$props) {
15635
15732
  push($$props, true);
15636
15733
  let formId = prop($$props, "formId", 7), custom2 = prop($$props, "custom", 7);
15637
15734
  const details = new FormDetails(formId(), $$props.$$host);
15638
15735
  setDetails$1($$props.$$host, details);
15639
- async function handleSubmit(event) {
15640
- event.preventDefault();
15736
+ async function handleSubmit(event2) {
15737
+ event2.preventDefault();
15738
+ event2.stopPropagation();
15641
15739
  details.validateForm();
15642
- details?.form?.dispatchEvent(new Event("go-after-validation", event));
15740
+ details?.form?.dispatchEvent(new Event("go-after-validation", event2));
15643
15741
  if (details.isValid) {
15644
15742
  details.apiErrors = {};
15645
- details?.form?.dispatchEvent(new Event("go-submit", event));
15743
+ details?.form?.dispatchEvent(new Event("go-submit", event2));
15744
+ $$props.$$host.dispatchEvent(new Event("submit", { bubbles: true, composed: true }));
15646
15745
  }
15647
15746
  }
15648
15747
  onMount(() => {
@@ -15671,7 +15770,7 @@ function Form($$anchor, $$props) {
15671
15770
  var node = first_child(fragment);
15672
15771
  {
15673
15772
  var consequent = ($$anchor2) => {
15674
- var fragment_1 = root_1$h();
15773
+ var fragment_1 = root_1$i();
15675
15774
  var go_all_fields = first_child(fragment_1);
15676
15775
  var go_form_feedback = sibling(go_all_fields, 2);
15677
15776
  sibling(go_form_feedback, 2);
@@ -15694,31 +15793,26 @@ customElements.define("go-form", create_custom_element(
15694
15793
  ["details"],
15695
15794
  false
15696
15795
  ));
15697
- var root$9 = /* @__PURE__ */ from_html(`<go-form></go-form>`, 2);
15796
+ var root$b = /* @__PURE__ */ from_html(`<go-form></go-form>`, 2);
15698
15797
  function PasswordReset($$anchor, $$props) {
15699
15798
  push($$props, true);
15700
- let form;
15701
15799
  let custom2 = prop($$props, "custom", 7, false);
15702
15800
  Forms.defineForm({
15703
15801
  id: "passwordReset",
15704
15802
  fields: [{ key: "email", required: true }]
15705
15803
  });
15706
- async function passwordReset() {
15707
- if (!form) {
15708
- throw new Error("(go-password-reset: form not found");
15709
- }
15710
- const result = await shop.passwordReset(form.details.formData);
15804
+ async function passwordReset(event2) {
15805
+ const form = event2.target;
15806
+ const details = form.details;
15807
+ const result = await shop.passwordReset(details.formData);
15711
15808
  if (result.data) {
15712
15809
  $$props.$$host.dispatchEvent(new Event("go-success", { bubbles: true, composed: true }));
15713
- form.details.successMessage = result.data.message;
15714
- form.details.apiErrors = [];
15810
+ details.successMessage = result.data.message;
15811
+ details.apiErrors = [];
15715
15812
  } else {
15716
- form.details.apiErrors = result.error.errors;
15813
+ details.apiErrors = result.error.errors;
15717
15814
  }
15718
15815
  }
15719
- onMount(() => {
15720
- $$props.$$host.addEventListener("go-submit", passwordReset);
15721
- });
15722
15816
  var $$exports = {
15723
15817
  get custom() {
15724
15818
  return custom2();
@@ -15728,18 +15822,17 @@ function PasswordReset($$anchor, $$props) {
15728
15822
  flushSync();
15729
15823
  }
15730
15824
  };
15731
- var go_form = root$9();
15825
+ var go_form = root$b();
15732
15826
  set_custom_element_data(go_form, "formId", "passwordReset");
15733
15827
  template_effect(() => set_custom_element_data(go_form, "custom", custom2()));
15734
- bind_this(go_form, ($$value) => form = $$value, () => form);
15828
+ event("submit", go_form, passwordReset);
15735
15829
  append($$anchor, go_form);
15736
15830
  return pop($$exports);
15737
15831
  }
15738
15832
  customElements.define("go-password-reset", create_custom_element(PasswordReset, { custom: {} }, [], [], false));
15739
- var root$8 = /* @__PURE__ */ from_html(`<go-form></go-form>`, 2);
15833
+ var root$a = /* @__PURE__ */ from_html(`<go-form></go-form>`, 2);
15740
15834
  function SignIn($$anchor, $$props) {
15741
15835
  push($$props, true);
15742
- let form;
15743
15836
  Forms.defineForm({
15744
15837
  id: "signIn",
15745
15838
  fields: [
@@ -15747,23 +15840,19 @@ function SignIn($$anchor, $$props) {
15747
15840
  { key: "password", required: true }
15748
15841
  ]
15749
15842
  });
15750
- async function signIn() {
15751
- if (!form) {
15752
- throw new Error("(go-sign-in: form not found");
15753
- }
15754
- const result = await shop.signIn(form.details.formData);
15843
+ async function signIn(event2) {
15844
+ const form = event2.target;
15845
+ const details = form.details;
15846
+ const result = await shop.signIn(details.formData);
15755
15847
  if (result.data) {
15756
15848
  $$props.$$host.dispatchEvent(new Event("go-success", { bubbles: true, composed: true }));
15757
15849
  } else {
15758
- form.details.apiErrors = result.error.errors;
15850
+ details.apiErrors = result.error.errors;
15759
15851
  }
15760
15852
  }
15761
- onMount(() => {
15762
- $$props.$$host.addEventListener("go-submit", signIn);
15763
- });
15764
- var go_form = root$8();
15853
+ var go_form = root$a();
15765
15854
  set_custom_element_data(go_form, "formId", "signIn");
15766
- bind_this(go_form, ($$value) => form = $$value, () => form);
15855
+ event("submit", go_form, signIn);
15767
15856
  append($$anchor, go_form);
15768
15857
  pop();
15769
15858
  }
@@ -15776,7 +15865,7 @@ customElements.define("go-sign-in", create_custom_element(
15776
15865
  [],
15777
15866
  false
15778
15867
  ));
15779
- var root$7 = /* @__PURE__ */ from_html(`<go-form></go-form>`, 2);
15868
+ var root$9 = /* @__PURE__ */ from_html(`<go-form></go-form>`, 2);
15780
15869
  function SignUp($$anchor, $$props) {
15781
15870
  push($$props, true);
15782
15871
  Forms.defineForm({
@@ -15798,24 +15887,19 @@ function SignUp($$anchor, $$props) {
15798
15887
  { key: "acceptTerms", required: true }
15799
15888
  ]
15800
15889
  });
15801
- let form;
15802
- async function signUp() {
15803
- if (!form) {
15804
- return;
15805
- }
15806
- const result = await shop.signUp(form.details.formData, false);
15890
+ async function signUp(event2) {
15891
+ const form = event2.target;
15892
+ const details = form.details;
15893
+ const result = await shop.signUp(details.formData, false);
15807
15894
  if (result.data) {
15808
15895
  $$props.$$host.dispatchEvent(new Event("go-success", { bubbles: true, composed: true }));
15809
15896
  } else {
15810
- form.details.apiErrors = result.error.errors;
15897
+ details.apiErrors = result.error.errors;
15811
15898
  }
15812
15899
  }
15813
- onMount(() => {
15814
- $$props.$$host.addEventListener("go-submit", signUp);
15815
- });
15816
- var go_form = root$7();
15900
+ var go_form = root$9();
15817
15901
  set_custom_element_data(go_form, "formId", "signUp");
15818
- bind_this(go_form, ($$value) => form = $$value, () => form);
15902
+ event("submit", go_form, signUp);
15819
15903
  append($$anchor, go_form);
15820
15904
  pop();
15821
15905
  }
@@ -15828,12 +15912,12 @@ customElements.define("go-sign-up", create_custom_element(
15828
15912
  [],
15829
15913
  false
15830
15914
  ));
15831
- var root_1$g = /* @__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);
15832
- var root$6 = /* @__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>`);
15915
+ 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);
15916
+ var root$8 = /* @__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>`);
15833
15917
  function Event$2($$anchor, $$props) {
15834
15918
  push($$props, true);
15835
15919
  let cartItem = prop($$props, "cartItem", 7);
15836
- if (!isUIEventTicket(cartItem().product)) throw new Error("Product is not an event ticket");
15920
+ if (!isUIScaledPricesTicket(cartItem().product)) throw new Error("Product is not an event ticket");
15837
15921
  const product = cartItem().product;
15838
15922
  var $$exports = {
15839
15923
  get cartItem() {
@@ -15844,7 +15928,7 @@ function Event$2($$anchor, $$props) {
15844
15928
  flushSync();
15845
15929
  }
15846
15930
  };
15847
- var li = root$6();
15931
+ var li = root$8();
15848
15932
  var span = child(li);
15849
15933
  var span_1 = child(span);
15850
15934
  var text2 = child(span_1, true);
@@ -15856,7 +15940,7 @@ function Event$2($$anchor, $$props) {
15856
15940
  var node = sibling(span);
15857
15941
  {
15858
15942
  var consequent = ($$anchor2) => {
15859
- var fragment = root_1$g();
15943
+ var fragment = root_1$h();
15860
15944
  var span_3 = first_child(fragment);
15861
15945
  var text_2 = child(span_3, true);
15862
15946
  reset(span_3);
@@ -15889,8 +15973,8 @@ function Event$2($$anchor, $$props) {
15889
15973
  }
15890
15974
  create_custom_element(Event$2, { cartItem: {} }, [], [], true);
15891
15975
  var root_2$q = /* @__PURE__ */ from_html(`<span class="go-cart-item-time" data-testid="cart-item-time"> </span>`);
15892
- var root_1$f = /* @__PURE__ */ from_html(`<span class="go-cart-item-date" data-testid="cart-item-date"> </span> <!>`, 1);
15893
- var root$5 = /* @__PURE__ */ from_html(`<li data-go-cart-item-title=""><span class="go-cart-item-title" data-testid="cart-item-title"> </span> <!></li>`);
15976
+ var root_1$g = /* @__PURE__ */ from_html(`<span class="go-cart-item-date" data-testid="cart-item-date"> </span> <!>`, 1);
15977
+ var root$7 = /* @__PURE__ */ from_html(`<li data-go-cart-item-title=""><span class="go-cart-item-title" data-testid="cart-item-title"> </span> <!></li>`);
15894
15978
  function Ticket($$anchor, $$props) {
15895
15979
  push($$props, true);
15896
15980
  let cartItem = prop($$props, "cartItem", 7);
@@ -15903,14 +15987,14 @@ function Ticket($$anchor, $$props) {
15903
15987
  flushSync();
15904
15988
  }
15905
15989
  };
15906
- var li = root$5();
15990
+ var li = root$7();
15907
15991
  var span = child(li);
15908
15992
  var text2 = child(span, true);
15909
15993
  reset(span);
15910
15994
  var node = sibling(span, 2);
15911
15995
  {
15912
15996
  var consequent_1 = ($$anchor2) => {
15913
- var fragment = root_1$f();
15997
+ var fragment = root_1$g();
15914
15998
  var span_1 = first_child(fragment);
15915
15999
  var text_1 = child(span_1, true);
15916
16000
  reset(span_1);
@@ -15946,7 +16030,7 @@ var root_2$p = /* @__PURE__ */ from_html(`<li class="go-cart-header-remove" data
15946
16030
  var root_7$4 = /* @__PURE__ */ from_html(`<li class="go-cart-item-remove" data-go-cart-item-remove=""><button>⨉</button></li>`);
15947
16031
  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>`);
15948
16032
  var root_8$1 = /* @__PURE__ */ from_html(`<li class="go-cart-footer-remove" data-go-cart-footer-remove=""></li>`);
15949
- var root_1$e = /* @__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>`);
16033
+ 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>`);
15950
16034
  function Cart($$anchor, $$props) {
15951
16035
  push($$props, true);
15952
16036
  const preview = prop($$props, "preview", 7, false);
@@ -15964,7 +16048,7 @@ function Cart($$anchor, $$props) {
15964
16048
  var node = first_child(fragment);
15965
16049
  {
15966
16050
  var consequent_5 = ($$anchor2) => {
15967
- var ol = root_1$e();
16051
+ var ol = root_1$f();
15968
16052
  var li = child(ol);
15969
16053
  var ul = child(li);
15970
16054
  var li_1 = child(ul);
@@ -17464,8 +17548,8 @@ function isOrContainsTarget(node, target) {
17464
17548
  function getOwnerDocument(el) {
17465
17549
  return el?.ownerDocument ?? document;
17466
17550
  }
17467
- function isClickTrulyOutside(event, contentNode) {
17468
- const { clientX, clientY } = event;
17551
+ function isClickTrulyOutside(event2, contentNode) {
17552
+ const { clientX, clientY } = event2;
17469
17553
  const rect = contentNode.getBoundingClientRect();
17470
17554
  return clientX < rect.left || clientX > rect.right || clientY < rect.top || clientY > rect.bottom;
17471
17555
  }
@@ -17889,13 +17973,13 @@ class DismissibleLayerState {
17889
17973
  unsubEvents();
17890
17974
  });
17891
17975
  }
17892
- #handleFocus = (event) => {
17893
- if (event.defaultPrevented) return;
17976
+ #handleFocus = (event2) => {
17977
+ if (event2.defaultPrevented) return;
17894
17978
  if (!this.opts.ref.current) return;
17895
17979
  afterTick(() => {
17896
- if (!this.opts.ref.current || this.#isTargetWithinLayer(event.target)) return;
17897
- if (event.target && !this.#isFocusInsideDOMTree) {
17898
- this.#onFocusOutside.current?.(event);
17980
+ if (!this.opts.ref.current || this.#isTargetWithinLayer(event2.target)) return;
17981
+ if (event2.target && !this.#isFocusInsideDOMTree) {
17982
+ this.#onFocusOutside.current?.(event2);
17899
17983
  }
17900
17984
  });
17901
17985
  };
@@ -17922,9 +18006,9 @@ class DismissibleLayerState {
17922
18006
  );
17923
18007
  }
17924
18008
  #handleDismiss = (e) => {
17925
- let event = e;
17926
- if (event.defaultPrevented) {
17927
- event = createWrappedEvent(e);
18009
+ let event2 = e;
18010
+ if (event2.defaultPrevented) {
18011
+ event2 = createWrappedEvent(e);
17928
18012
  }
17929
18013
  this.#interactOutsideProp.current(e);
17930
18014
  };
@@ -17939,9 +18023,9 @@ class DismissibleLayerState {
17939
18023
  this.#unsubClickListener();
17940
18024
  return;
17941
18025
  }
17942
- let event = e;
17943
- if (event.defaultPrevented) {
17944
- event = createWrappedEvent(event);
18026
+ let event2 = e;
18027
+ if (event2.defaultPrevented) {
18028
+ event2 = createWrappedEvent(event2);
17945
18029
  }
17946
18030
  if (this.#behaviorType.current !== "close" && this.#behaviorType.current !== "defer-otherwise-close") {
17947
18031
  this.#unsubClickListener();
@@ -17951,7 +18035,7 @@ class DismissibleLayerState {
17951
18035
  this.#unsubClickListener();
17952
18036
  this.#unsubClickListener = on(this.#documentObj, "click", this.#handleDismiss, { once: true });
17953
18037
  } else {
17954
- this.#interactOutsideProp.current(event);
18038
+ this.#interactOutsideProp.current(event2);
17955
18039
  }
17956
18040
  },
17957
18041
  10
@@ -18346,9 +18430,9 @@ class FocusScope {
18346
18430
  }
18347
18431
  #handleOpenAutoFocus() {
18348
18432
  if (!this.#container) return;
18349
- const event = new CustomEvent("focusScope.onOpenAutoFocus", { bubbles: false, cancelable: true });
18350
- this.#opts.onOpenAutoFocus.current(event);
18351
- if (!event.defaultPrevented) {
18433
+ const event2 = new CustomEvent("focusScope.onOpenAutoFocus", { bubbles: false, cancelable: true });
18434
+ this.#opts.onOpenAutoFocus.current(event2);
18435
+ if (!event2.defaultPrevented) {
18352
18436
  requestAnimationFrame(() => {
18353
18437
  if (!this.#container) return;
18354
18438
  const firstTabbable = this.#getFirstTabbable();
@@ -18362,9 +18446,9 @@ class FocusScope {
18362
18446
  }
18363
18447
  }
18364
18448
  #handleCloseAutoFocus() {
18365
- const event = new CustomEvent("focusScope.onCloseAutoFocus", { bubbles: false, cancelable: true });
18366
- this.#opts.onCloseAutoFocus.current?.(event);
18367
- if (!event.defaultPrevented) {
18449
+ const event2 = new CustomEvent("focusScope.onCloseAutoFocus", { bubbles: false, cancelable: true });
18450
+ this.#opts.onCloseAutoFocus.current?.(event2);
18451
+ if (!event2.defaultPrevented) {
18368
18452
  const preFocusedElement = this.#manager.getPreFocusMemory(this);
18369
18453
  if (preFocusedElement && document.contains(preFocusedElement)) {
18370
18454
  try {
@@ -19857,27 +19941,27 @@ const ARROW_KEYS = [
19857
19941
  ARROW_RIGHT
19858
19942
  ];
19859
19943
  const SELECT_KEYS = [ENTER, SPACE];
19860
- function handleCalendarKeydown({ event, handleCellClick, shiftFocus, placeholderValue }) {
19861
- const currentCell = event.target;
19944
+ function handleCalendarKeydown({ event: event2, handleCellClick, shiftFocus, placeholderValue }) {
19945
+ const currentCell = event2.target;
19862
19946
  if (!isCalendarDayNode(currentCell)) return;
19863
- if (!ARROW_KEYS.includes(event.key) && !SELECT_KEYS.includes(event.key)) return;
19864
- event.preventDefault();
19947
+ if (!ARROW_KEYS.includes(event2.key) && !SELECT_KEYS.includes(event2.key)) return;
19948
+ event2.preventDefault();
19865
19949
  const kbdFocusMap = {
19866
19950
  [ARROW_DOWN]: 7,
19867
19951
  [ARROW_UP]: -7,
19868
19952
  [ARROW_LEFT]: -1,
19869
19953
  [ARROW_RIGHT]: 1
19870
19954
  };
19871
- if (ARROW_KEYS.includes(event.key)) {
19872
- const add = kbdFocusMap[event.key];
19955
+ if (ARROW_KEYS.includes(event2.key)) {
19956
+ const add = kbdFocusMap[event2.key];
19873
19957
  if (add !== void 0) {
19874
19958
  shiftFocus(currentCell, add);
19875
19959
  }
19876
19960
  }
19877
- if (SELECT_KEYS.includes(event.key)) {
19961
+ if (SELECT_KEYS.includes(event2.key)) {
19878
19962
  const cellValue = currentCell.getAttribute("data-value");
19879
19963
  if (!cellValue) return;
19880
- handleCellClick(event, parseStringToDateValue(cellValue, placeholderValue));
19964
+ handleCellClick(event2, parseStringToDateValue(cellValue, placeholderValue));
19881
19965
  }
19882
19966
  }
19883
19967
  function handleCalendarNextPage({
@@ -20538,9 +20622,9 @@ class CalendarRootState {
20538
20622
  }
20539
20623
  return date2;
20540
20624
  }
20541
- onkeydown(event) {
20625
+ onkeydown(event2) {
20542
20626
  handleCalendarKeydown({
20543
- event,
20627
+ event: event2,
20544
20628
  handleCellClick: this.handleCellClick,
20545
20629
  shiftFocus: this.shiftFocus,
20546
20630
  placeholderValue: this.opts.placeholder.current
@@ -22299,7 +22383,7 @@ function Calendar_prev_button($$anchor, $$props) {
22299
22383
  }
22300
22384
  create_custom_element(Calendar_prev_button, { children: {}, child: {}, id: {}, ref: {}, tabindex: {} }, [], [], true);
22301
22385
  enable_legacy_mode_flag();
22302
- var root_1$d = /* @__PURE__ */ from_html(`<input/>`);
22386
+ var root_1$e = /* @__PURE__ */ from_html(`<input/>`);
22303
22387
  var root_2$c = /* @__PURE__ */ from_html(`<input/>`);
22304
22388
  function Hidden_input($$anchor, $$props) {
22305
22389
  push($$props, true);
@@ -22322,7 +22406,7 @@ function Hidden_input($$anchor, $$props) {
22322
22406
  var node = first_child(fragment);
22323
22407
  {
22324
22408
  var consequent = ($$anchor2) => {
22325
- var input = root_1$d();
22409
+ var input = root_1$e();
22326
22410
  attribute_effect(input, () => ({ ...get$2(mergedProps), value: value() }), void 0, void 0, void 0, void 0, true);
22327
22411
  append($$anchor2, input);
22328
22412
  };
@@ -24770,7 +24854,7 @@ function Popper_content($$anchor, $$props) {
24770
24854
  return pop($$exports);
24771
24855
  }
24772
24856
  create_custom_element(Popper_content, { content: {}, isStatic: {}, onPlaced: {} }, [], [], true);
24773
- var root_1$c = /* @__PURE__ */ from_html(`<!> <!>`, 1);
24857
+ var root_1$d = /* @__PURE__ */ from_html(`<!> <!>`, 1);
24774
24858
  function Popper_layer_inner($$anchor, $$props) {
24775
24859
  push($$props, true);
24776
24860
  let popper = prop($$props, "popper", 7), onEscapeKeydown = prop($$props, "onEscapeKeydown", 7), escapeKeydownBehavior = prop($$props, "escapeKeydownBehavior", 7), preventOverflowTextSelection = prop($$props, "preventOverflowTextSelection", 7), id = prop($$props, "id", 7), onPointerDown = prop($$props, "onPointerDown", 7), onPointerUp = prop($$props, "onPointerUp", 7), side = prop($$props, "side", 7), sideOffset = prop($$props, "sideOffset", 7), align = prop($$props, "align", 7), alignOffset = prop($$props, "alignOffset", 7), arrowPadding = prop($$props, "arrowPadding", 7), avoidCollisions = prop($$props, "avoidCollisions", 7), collisionBoundary = prop($$props, "collisionBoundary", 7), collisionPadding = prop($$props, "collisionPadding", 7), sticky = prop($$props, "sticky", 7), hideWhenDetached = prop($$props, "hideWhenDetached", 7), updatePositionStrategy = prop($$props, "updatePositionStrategy", 7), strategy = prop($$props, "strategy", 7), dir = prop($$props, "dir", 7), preventScroll = prop($$props, "preventScroll", 7), wrapperId = prop($$props, "wrapperId", 7), style = prop($$props, "style", 7), onPlaced = prop($$props, "onPlaced", 7), onInteractOutside = prop($$props, "onInteractOutside", 7), onCloseAutoFocus = prop($$props, "onCloseAutoFocus", 7), onOpenAutoFocus = prop($$props, "onOpenAutoFocus", 7), onFocusOutside = prop($$props, "onFocusOutside", 7), interactOutsideBehavior = prop($$props, "interactOutsideBehavior", 7, "close"), loop = prop($$props, "loop", 7), trapFocus = prop($$props, "trapFocus", 7, true), isValidEvent2 = prop($$props, "isValidEvent", 7, () => false), customAnchor = prop($$props, "customAnchor", 7, null), isStatic = prop($$props, "isStatic", 7, false), enabled = prop($$props, "enabled", 7), ref = prop($$props, "ref", 7), tooltip = prop($$props, "tooltip", 7, false), restProps = /* @__PURE__ */ rest_props($$props, [
@@ -25081,7 +25165,7 @@ function Popper_layer_inner($$anchor, $$props) {
25081
25165
  const content = ($$anchor2, $$arg0) => {
25082
25166
  let floatingProps = () => $$arg0?.().props;
25083
25167
  let wrapperProps = () => $$arg0?.().wrapperProps;
25084
- var fragment_1 = root_1$c();
25168
+ var fragment_1 = root_1$d();
25085
25169
  var node = first_child(fragment_1);
25086
25170
  {
25087
25171
  var consequent = ($$anchor3) => {
@@ -27536,7 +27620,7 @@ function Date_field_hidden_input($$anchor, $$props) {
27536
27620
  }
27537
27621
  create_custom_element(Date_field_hidden_input, {}, [], [], true);
27538
27622
  var root_2$b = /* @__PURE__ */ from_html(`<div><!></div>`);
27539
- var root$4 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
27623
+ var root$6 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
27540
27624
  function Date_field_input($$anchor, $$props) {
27541
27625
  const uid = props_id();
27542
27626
  push($$props, true);
@@ -27594,7 +27678,7 @@ function Date_field_input($$anchor, $$props) {
27594
27678
  flushSync();
27595
27679
  }
27596
27680
  };
27597
- var fragment = root$4();
27681
+ var fragment = root$6();
27598
27682
  var node = first_child(fragment);
27599
27683
  {
27600
27684
  var consequent = ($$anchor2) => {
@@ -28946,7 +29030,7 @@ var root_2$7 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
28946
29030
  var root_7$3 = /* @__PURE__ */ from_html(`<!> <!> <!>`, 1);
28947
29031
  var root_9$2 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
28948
29032
  var root_6$2 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
28949
- var root_1$b = /* @__PURE__ */ from_html(`<!> <!> <!>`, 1);
29033
+ var root_1$c = /* @__PURE__ */ from_html(`<!> <!> <!>`, 1);
28950
29034
  function DatePicker_1($$anchor, $$props) {
28951
29035
  push($$props, true);
28952
29036
  let dateString = prop($$props, "dateString", 15), labelClass = prop($$props, "labelClass", 7), inputClass = prop($$props, "inputClass", 7);
@@ -28988,7 +29072,7 @@ function DatePicker_1($$anchor, $$props) {
28988
29072
  set(date2, $$value, true);
28989
29073
  },
28990
29074
  children: ($$anchor3, $$slotProps) => {
28991
- var fragment_1 = root_1$b();
29075
+ var fragment_1 = root_1$c();
28992
29076
  var node_1 = first_child(fragment_1);
28993
29077
  component(node_1, () => Date_field_label, ($$anchor4, DatePicker_Label) => {
28994
29078
  DatePicker_Label($$anchor4, {
@@ -29196,7 +29280,7 @@ function DatePicker_1($$anchor, $$props) {
29196
29280
  }
29197
29281
  create_custom_element(DatePicker_1, { dateString: {}, labelClass: {}, inputClass: {} }, [], [], true);
29198
29282
  var root_2$6 = /* @__PURE__ */ from_html(`<span class="go-field-star" aria-hidden="true">*</span>`);
29199
- var root_1$a = /* @__PURE__ */ from_html(` <!>`, 1);
29283
+ var root_1$b = /* @__PURE__ */ from_html(` <!>`, 1);
29200
29284
  var root_3$5 = /* @__PURE__ */ from_html(`<label><!></label> <input/>`, 1);
29201
29285
  var root_4$3 = /* @__PURE__ */ from_html(`<label><input/> <span class="go-checkbox-label"><!></span></label>`);
29202
29286
  var root_7$2 = /* @__PURE__ */ from_html(`<option> </option>`);
@@ -29208,7 +29292,7 @@ function InputAndLabel($$anchor, $$props) {
29208
29292
  push($$props, true);
29209
29293
  const labelText = ($$anchor2) => {
29210
29294
  next();
29211
- var fragment = root_1$a();
29295
+ var fragment = root_1$b();
29212
29296
  var text2 = first_child(fragment);
29213
29297
  var node = sibling(text2);
29214
29298
  {
@@ -29256,7 +29340,6 @@ function InputAndLabel($$anchor, $$props) {
29256
29340
  const checkbox = ($$anchor2) => {
29257
29341
  var label_2 = root_4$3();
29258
29342
  var input_2 = child(label_2);
29259
- var event_handler = (e) => field(field().value = e.target.checked, true);
29260
29343
  attribute_effect(
29261
29344
  input_2,
29262
29345
  () => ({
@@ -29264,7 +29347,7 @@ function InputAndLabel($$anchor, $$props) {
29264
29347
  ...restProps,
29265
29348
  name: field().key,
29266
29349
  type: "checkbox",
29267
- onchange: event_handler
29350
+ value: "true"
29268
29351
  }),
29269
29352
  void 0,
29270
29353
  void 0,
@@ -29281,6 +29364,15 @@ function InputAndLabel($$anchor, $$props) {
29281
29364
  set_class(label_2, 1, clsx(labelClass()));
29282
29365
  set_attribute(label_2, "for", get$2(inputId));
29283
29366
  });
29367
+ bind_checked(
29368
+ input_2,
29369
+ () => {
29370
+ return field().value === true;
29371
+ },
29372
+ (value) => {
29373
+ field(field().value = value, true);
29374
+ }
29375
+ );
29284
29376
  append($$anchor2, label_2);
29285
29377
  };
29286
29378
  const select = ($$anchor2) => {
@@ -29427,7 +29519,7 @@ function InputAndLabel($$anchor, $$props) {
29427
29519
  const snippet$1 = /* @__PURE__ */ user_derived(() => map[field().type]);
29428
29520
  let inputId = /* @__PURE__ */ user_derived(() => $$props.id || `go-field-${Math.random().toString(36).substring(2, 9)}`);
29429
29521
  function onblur() {
29430
- if (field().type == "checkbox") return;
29522
+ if (field().type === "checkbox") return;
29431
29523
  if (field().value) if (get$2(details))
29432
29524
  get$2(details).validateField(field());
29433
29525
  else field().validate();
@@ -29507,10 +29599,10 @@ create_custom_element(
29507
29599
  [],
29508
29600
  true
29509
29601
  );
29510
- var root_1$9 = /* @__PURE__ */ from_html(`<span> </span>`);
29602
+ var root_1$a = /* @__PURE__ */ from_html(`<span> </span>`);
29511
29603
  var root_3$4 = /* @__PURE__ */ from_html(`<li> </li>`);
29512
29604
  var root_2$5 = /* @__PURE__ */ from_html(`<ul class="go-field-errors" role="alert"></ul>`);
29513
- var root$3 = /* @__PURE__ */ from_html(`<!> <!> <!>`, 1);
29605
+ var root$5 = /* @__PURE__ */ from_html(`<!> <!> <!>`, 1);
29514
29606
  function Field($$anchor, $$props) {
29515
29607
  push($$props, true);
29516
29608
  let key = prop($$props, "key", 7), required = prop($$props, "required", 7, false), labelClass = prop($$props, "labelClass", 7), inputClass = prop($$props, "inputClass", 7);
@@ -29569,7 +29661,7 @@ function Field($$anchor, $$props) {
29569
29661
  flushSync();
29570
29662
  }
29571
29663
  };
29572
- var fragment = root$3();
29664
+ var fragment = root$5();
29573
29665
  var node = first_child(fragment);
29574
29666
  InputAndLabel(node, {
29575
29667
  get describedById() {
@@ -29592,7 +29684,7 @@ function Field($$anchor, $$props) {
29592
29684
  var node_1 = sibling(node, 2);
29593
29685
  {
29594
29686
  var consequent = ($$anchor2) => {
29595
- var span = root_1$9();
29687
+ var span = root_1$a();
29596
29688
  var text2 = child(span, true);
29597
29689
  reset(span);
29598
29690
  template_effect(() => {
@@ -29639,7 +29731,7 @@ customElements.define("go-field", create_custom_element(
29639
29731
  ["getField"],
29640
29732
  false
29641
29733
  ));
29642
- var root_1$8 = /* @__PURE__ */ from_html(`<go-field></go-field>`, 2);
29734
+ var root_1$9 = /* @__PURE__ */ from_html(`<go-field></go-field>`, 2);
29643
29735
  function AllFields($$anchor, $$props) {
29644
29736
  push($$props, true);
29645
29737
  let _details = getDetails$1($$props.$$host);
@@ -29648,7 +29740,7 @@ function AllFields($$anchor, $$props) {
29648
29740
  var fragment = comment();
29649
29741
  var node = first_child(fragment);
29650
29742
  each(node, 17, () => get$2(allFields2), index$1, ($$anchor2, field) => {
29651
- var go_field = root_1$8();
29743
+ var go_field = root_1$9();
29652
29744
  template_effect(() => set_custom_element_data(go_field, "key", get$2(field).key));
29653
29745
  template_effect(() => set_custom_element_data(go_field, "required", get$2(field).required));
29654
29746
  append($$anchor2, go_field);
@@ -29661,7 +29753,7 @@ var root_2$4 = /* @__PURE__ */ from_html(`<p aria-live="assertive" class="sr-onl
29661
29753
  var root_4$2 = /* @__PURE__ */ from_html(`<li> </li>`);
29662
29754
  var root_3$3 = /* @__PURE__ */ from_html(`<ul class="go-error-feedback-api-errors"></ul>`);
29663
29755
  var root_5 = /* @__PURE__ */ from_html(`<p aria-hidden="true"> </p>`);
29664
- var root_1$7 = /* @__PURE__ */ from_html(`<div><!> <!> <!></div>`);
29756
+ var root_1$8 = /* @__PURE__ */ from_html(`<div><!> <!> <!></div>`);
29665
29757
  function ErrorsFeedback($$anchor, $$props) {
29666
29758
  push($$props, true);
29667
29759
  const _details = getDetails$1($$props.$$host);
@@ -29684,7 +29776,7 @@ function ErrorsFeedback($$anchor, $$props) {
29684
29776
  var node = first_child(fragment);
29685
29777
  {
29686
29778
  var consequent_3 = ($$anchor2) => {
29687
- var div = root_1$7();
29779
+ var div = root_1$8();
29688
29780
  let classes;
29689
29781
  var node_1 = child(div);
29690
29782
  {
@@ -29748,9 +29840,9 @@ function ErrorsFeedback($$anchor, $$props) {
29748
29840
  pop();
29749
29841
  }
29750
29842
  customElements.define("go-errors-feedback", create_custom_element(ErrorsFeedback, {}, [], [], false));
29751
- var root$2 = /* @__PURE__ */ from_html(`<div class="go-form-feedback"><!></div>`);
29843
+ var root$4 = /* @__PURE__ */ from_html(`<div class="go-form-feedback"><!></div>`);
29752
29844
  function FormFeedback($$anchor, $$props) {
29753
- var div = root$2();
29845
+ var div = root$4();
29754
29846
  var node = child(div);
29755
29847
  slot(node, $$props, "default", {});
29756
29848
  reset(div);
@@ -29783,7 +29875,7 @@ customElements.define("go-submit", create_custom_element(
29783
29875
  [],
29784
29876
  false
29785
29877
  ));
29786
- var root_1$6 = /* @__PURE__ */ from_html(`<div aria-live="assertive"> </div>`);
29878
+ var root_1$7 = /* @__PURE__ */ from_html(`<div aria-live="assertive"> </div>`);
29787
29879
  function SuccessFeedback($$anchor, $$props) {
29788
29880
  push($$props, true);
29789
29881
  const _details = getDetails$1($$props.$$host);
@@ -29792,7 +29884,7 @@ function SuccessFeedback($$anchor, $$props) {
29792
29884
  var node = first_child(fragment);
29793
29885
  {
29794
29886
  var consequent = ($$anchor2) => {
29795
- var div = root_1$6();
29887
+ var div = root_1$7();
29796
29888
  let classes;
29797
29889
  var text2 = child(div, true);
29798
29890
  reset(div);
@@ -29823,7 +29915,8 @@ const validTicketSelectionFilters = [
29823
29915
  "day",
29824
29916
  "annual",
29825
29917
  "event:scaled-price",
29826
- "event:ticket"
29918
+ "event:ticket",
29919
+ "events:scaled-price"
29827
29920
  ];
29828
29921
  let lastUId = 0;
29829
29922
  class TicketSelectionDetails {
@@ -29916,6 +30009,7 @@ class TicketSelectionDetails {
29916
30009
  this.ticketSegments.push(ticketGroup);
29917
30010
  }
29918
30011
  get isTimeslotsVisible() {
30012
+ if (this.filters?.includes("events:scaled-price")) return true;
29919
30013
  if (this.mode === "event") return false;
29920
30014
  return Boolean(this.filters?.includes("timeslot") && this.selectedDate);
29921
30015
  }
@@ -29928,6 +30022,8 @@ class TicketSelectionDetails {
29928
30022
  return true;
29929
30023
  case "event:scaled-price":
29930
30024
  return Boolean(this.selectedDate);
30025
+ case "events:scaled-price":
30026
+ return true;
29931
30027
  case "event:ticket":
29932
30028
  return Boolean(this.selectedDate);
29933
30029
  case "timeslot":
@@ -29952,6 +30048,7 @@ class TicketSelectionDetails {
29952
30048
  return this.filters?.some(byFilter);
29953
30049
  }
29954
30050
  get isCalendarVisible() {
30051
+ if (this.filters?.includes("events:scaled-price")) return true;
29955
30052
  return Boolean(this.filters?.includes("timeslot") || this.filters?.includes("day"));
29956
30053
  }
29957
30054
  }
@@ -30181,9 +30278,9 @@ function Order($$anchor, $$props) {
30181
30278
  return pop($$exports);
30182
30279
  }
30183
30280
  customElements.define("go-order", create_custom_element(Order, { token: { attribute: "token", reflect: true, type: "String" } }, [], ["orderDetails"], false));
30184
- var root_1$5 = /* @__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);
30281
+ var root_1$6 = /* @__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);
30185
30282
  var root_2$3 = /* @__PURE__ */ from_html(`<br/> <span class="go-order-item-quantities"> </span>`, 1);
30186
- var root$1 = /* @__PURE__ */ from_html(`<li><article><ul><li class="go-order-breakdown-count">1</li> <li class="go-order-breakdown-product"><span class="go-order-item-title"> </span> <!> <!> <a class="go-ticket-download" target="_blank">Download</a></li> <li class="go-order-breakdown-item-price"> </li> <li class="go-order-breakdown-passbook"></li></ul></article></li>`);
30283
+ var root$3 = /* @__PURE__ */ from_html(`<li><article><ul><li class="go-order-breakdown-count">1</li> <li class="go-order-breakdown-product"><span class="go-order-item-title"> </span> <!> <!> <a class="go-ticket-download" target="_blank">Download</a></li> <li class="go-order-breakdown-item-price"> </li> <li class="go-order-breakdown-passbook"></li></ul></article></li>`);
30187
30284
  function Event$1($$anchor, $$props) {
30188
30285
  push($$props, true);
30189
30286
  let item = prop($$props, "item", 7), orderDetails = prop($$props, "orderDetails", 7);
@@ -30203,7 +30300,7 @@ function Event$1($$anchor, $$props) {
30203
30300
  flushSync();
30204
30301
  }
30205
30302
  };
30206
- var li = root$1();
30303
+ var li = root$3();
30207
30304
  var article = child(li);
30208
30305
  var ul = child(article);
30209
30306
  var li_1 = sibling(child(ul), 2);
@@ -30213,7 +30310,7 @@ function Event$1($$anchor, $$props) {
30213
30310
  var node = sibling(span, 2);
30214
30311
  {
30215
30312
  var consequent = ($$anchor2) => {
30216
- var fragment = root_1$5();
30313
+ var fragment = root_1$6();
30217
30314
  var span_1 = first_child(fragment);
30218
30315
  var text_1 = child(span_1, true);
30219
30316
  reset(span_1);
@@ -30475,7 +30572,7 @@ function TicketSale($$anchor, $$props) {
30475
30572
  return pop($$exports);
30476
30573
  }
30477
30574
  create_custom_element(TicketSale, { item: {}, orderDetails: {} }, [], [], true);
30478
- var root_1$4 = /* @__PURE__ */ from_html(`<ol><li class="data-go-order-breakdown-header"><ul><li class="go-order-breakdown-header-count">Count</li> <li class="go-order-breakdown-header-product">Product</li> <li class="go-order-breakdown-header-price">Price</li> <li class="go-order-breakdown-header-passbook"></li></ul></li> <!> <li class="go-order-breakdown-footer"><ul><li class="go-cart-footer-title"></li> <li class="go-cart-footer-count"></li> <li class="go-cart-footer-price"> </li> <li class="go-cart-footer-passbook"></li></ul></li></ol>`);
30575
+ var root_1$5 = /* @__PURE__ */ from_html(`<ol><li class="data-go-order-breakdown-header"><ul><li class="go-order-breakdown-header-count">Count</li> <li class="go-order-breakdown-header-product">Product</li> <li class="go-order-breakdown-header-price">Price</li> <li class="go-order-breakdown-header-passbook"></li></ul></li> <!> <li class="go-order-breakdown-footer"><ul><li class="go-cart-footer-title"></li> <li class="go-cart-footer-count"></li> <li class="go-cart-footer-price"> </li> <li class="go-cart-footer-passbook"></li></ul></li></ol>`);
30479
30576
  function Breakdown($$anchor, $$props) {
30480
30577
  push($$props, true);
30481
30578
  const _orderDetails = getDetails($$props.$$host);
@@ -30485,7 +30582,7 @@ function Breakdown($$anchor, $$props) {
30485
30582
  var node = first_child(fragment);
30486
30583
  {
30487
30584
  var consequent_2 = ($$anchor2) => {
30488
- var ol = root_1$4();
30585
+ var ol = root_1$5();
30489
30586
  var node_1 = sibling(child(ol), 2);
30490
30587
  each(node_1, 17, () => get$2(order).items, (item) => item.id, ($$anchor3, item) => {
30491
30588
  var fragment_1 = comment();
@@ -30744,14 +30841,15 @@ async function loadAnnualTickets(segment) {
30744
30841
  // @ts-ignore
30745
30842
  "by_ticket_types[]": ["annual"],
30746
30843
  "by_ticket_ids[]": tsd.ticketIds,
30747
- "by_ticket_group_ids[]": tsd.ticketGroupIds
30844
+ "by_ticket_group_ids[]": segment.ticketGroupIds ?? tsd.ticketGroupIds
30748
30845
  }));
30749
30846
  const uiTickets = Object.values(tickets).map((t) => createUITicket(t));
30750
30847
  segment.preCart = createCart(uiTickets);
30751
30848
  }
30752
30849
  async function loadDayTickets(segment) {
30753
30850
  const tsd = segment.ticketSelectionDetails;
30754
- if (!tsd || !tsd.filters?.includes("day")) {
30851
+ if (!tsd) {
30852
+ console.warn("(loadDayTickets) tsd is undefined");
30755
30853
  segment.clear();
30756
30854
  return;
30757
30855
  }
@@ -30768,7 +30866,7 @@ async function loadDayTickets(segment) {
30768
30866
  "by_museum_ids[]": tsd.museumIds,
30769
30867
  "by_exhibition_ids[]": tsd.exhibitionIds,
30770
30868
  "by_ticket_ids[]": tsd.ticketIds,
30771
- "by_ticket_group_ids[]": tsd.ticketGroupIds
30869
+ "by_ticket_group_ids[]": segment.ticketGroupIds ?? tsd.ticketGroupIds
30772
30870
  }));
30773
30871
  let timeslot;
30774
30872
  if (quotas && Object.values(quotas).length > 0 && Object.keys(Object.values(quotas)[0].capacities).length > 0) {
@@ -30779,7 +30877,7 @@ async function loadDayTickets(segment) {
30779
30877
  const uiTickets = initUITimeslotTickets(available, timeslot);
30780
30878
  segment.preCart = createCart(uiTickets);
30781
30879
  }
30782
- async function loadEventScaledPricesTickets(segment) {
30880
+ async function load_Event_ScaledPricesTickets(segment) {
30783
30881
  const tsd = segment.ticketSelectionDetails;
30784
30882
  if (!tsd) {
30785
30883
  console.warn("(loadEventScaledPricesTickets) tsd is undefined");
@@ -30805,7 +30903,7 @@ async function loadEventScaledPricesTickets(segment) {
30805
30903
  const eid = tsd.eventIds[0];
30806
30904
  const eventDate = await shop.asyncFetch(() => shop.getEventDetailsOnDate(eid, segment.dateId));
30807
30905
  if (eventDate.prices) {
30808
- const UITickets = eventDate.prices.map((t) => createUIEventTicket(t, segment.dateId, {
30906
+ const UITickets = eventDate.prices.map((t) => createUIScaledPricesTicket(t, segment.dateId, {
30809
30907
  selectedTime: eventDate.start_time,
30810
30908
  event_title: eventDate.event_title
30811
30909
  })) || [];
@@ -30838,8 +30936,8 @@ async function loadEventTickets(segment) {
30838
30936
  }
30839
30937
  if (tsd.eventIds.length > 1) throw new Error("(loadEventTickets) currently we support only one eventId in go-ticket-selection");
30840
30938
  const eid = tsd.eventIds[0];
30841
- const event = await shop.asyncFetch(() => shop.getEvent(eid));
30842
- const ticketIds = event.tickets;
30939
+ const event2 = await shop.asyncFetch(() => shop.getEvent(eid));
30940
+ const ticketIds = event2.tickets;
30843
30941
  if (ticketIds.length === 0) {
30844
30942
  segment.clear();
30845
30943
  return;
@@ -30854,9 +30952,77 @@ async function loadEventTickets(segment) {
30854
30952
  const uiTickets = initUITimeslotTickets(available, tsd.selectedTime);
30855
30953
  segment.preCart = createCart(uiTickets);
30856
30954
  }
30955
+ async function load_Events_ScaledPricesTickets(segment) {
30956
+ const tsd = segment.ticketSelectionDetails;
30957
+ if (!tsd) {
30958
+ console.warn("(load_Events_ScaledPricesTickets) tsd is undefined");
30959
+ segment.clear();
30960
+ return;
30961
+ }
30962
+ if (!segment.filters?.includes("events:scaled-price")) {
30963
+ console.warn("(load_Events_ScaledPricesTickets) filters should include events:scaled-price");
30964
+ segment.clear();
30965
+ return;
30966
+ }
30967
+ if (!tsd.selectedDate) {
30968
+ console.warn("(load_Events_ScaledPricesTickets) go-ticket-selection does not have a selected date");
30969
+ segment.clear();
30970
+ return;
30971
+ }
30972
+ if (!tsd.selectedTime) {
30973
+ console.warn("(load_Events_ScaledPricesTickets) go-ticket-selection does not have a selected time");
30974
+ segment.clear();
30975
+ return;
30976
+ }
30977
+ let dates = await shop.asyncFetch(() => shop.getDates({
30978
+ // q?: string
30979
+ by_bookable: true,
30980
+ "by_museum_ids[]": tsd.museumIds,
30981
+ "by_exhibition_ids[]": tsd.exhibitionIds,
30982
+ "by_event_ids[]": tsd.eventIds,
30983
+ "by_language_ids[]": segment.languageIds,
30984
+ "by_catch_word_ids[]": segment.catchWordIds,
30985
+ // by_category_ids?: number[]
30986
+ start_at: tsd.selectedDate?.toString(),
30987
+ //YYYY-MM-DD format
30988
+ // end_at?: string // YYYY-MM-DD format
30989
+ per_page: segment.limit || 30
30990
+ // page?: number
30991
+ }));
30992
+ segment.preCart = createCart();
30993
+ dates = dates.filter((d) => {
30994
+ const datePart = d.start_time.slice(0, 10);
30995
+ const sameDay = tsd.selectedDate?.toString() == datePart;
30996
+ const after = Date.parse(d.start_time) >= Date.parse(tsd.selectedTime);
30997
+ return sameDay && after;
30998
+ });
30999
+ for (const date2 of dates) {
31000
+ if (date2.prices) {
31001
+ let prices = date2.prices;
31002
+ if (segment.query) prices = prices.filter((p2) => p2.title.includes(segment.query));
31003
+ const tickets = prices.map((t) => createUIScaledPricesTicket(t, date2.id, { selectedTime: date2.start_time, event_title: date2.event_title }));
31004
+ const cartItems = tickets.map((t) => createCartItem(t));
31005
+ segment.preCart.addItems(cartItems);
31006
+ } else console.warn("(load_Events_ScaledPricesTickets) event.prices is undefined");
31007
+ if (date2.seats) {
31008
+ shop.capacityManager.addSeats(date2.id, date2.seats);
31009
+ } else console.warn("(load_Events_ScaledPricesTickets) event.seats is undefined");
31010
+ }
31011
+ }
30857
31012
  async function loadTimeslotTickets(segment) {
30858
31013
  const tsd = segment.ticketSelectionDetails;
30859
- if (!tsd || !(tsd.selectedDate && tsd.selectedTimeslot && tsd.filters?.includes("timeslot"))) {
31014
+ if (!tsd) {
31015
+ console.warn("(loadTimeslotTickets) tsd is undefined");
31016
+ segment.clear();
31017
+ return;
31018
+ }
31019
+ if (!tsd.selectedDate) {
31020
+ console.warn("(loadTimeslotTickets) selectedDate is not given to the go-ticket-selection");
31021
+ segment.clear();
31022
+ return;
31023
+ }
31024
+ if (!tsd.selectedTimeslot) {
31025
+ console.warn("(loadTimeslotTickets) selectedTimeslot is not given to the go-ticket-selection");
30860
31026
  segment.clear();
30861
31027
  return;
30862
31028
  }
@@ -30868,14 +31034,14 @@ async function loadTimeslotTickets(segment) {
30868
31034
  "by_museum_ids[]": tsd.museumIds,
30869
31035
  "by_exhibition_ids[]": tsd.exhibitionIds,
30870
31036
  "by_ticket_ids[]": tsd.ticketIds,
30871
- "by_ticket_group_ids[]": tsd.ticketGroupIds
31037
+ "by_ticket_group_ids[]": segment.ticketGroupIds ?? tsd.ticketGroupIds
30872
31038
  }));
30873
31039
  shop.capacityManager.addQuotas(quotas);
30874
31040
  const available = filterAvailabletickets(tickets, tsd.selectedTime);
30875
31041
  const uiTickets = initUITimeslotTickets(available, tsd.selectedTime);
30876
31042
  segment.preCart = createCart(uiTickets);
30877
31043
  }
30878
- class TicketSegmentDetails {
31044
+ class SegmentDetails {
30879
31045
  #ticketSelectionDetails;
30880
31046
  get ticketSelectionDetails() {
30881
31047
  return get$2(this.#ticketSelectionDetails);
@@ -30904,6 +31070,41 @@ class TicketSegmentDetails {
30904
31070
  set dateId(value) {
30905
31071
  set(this.#dateId, value, true);
30906
31072
  }
31073
+ #limit = /* @__PURE__ */ state();
31074
+ get limit() {
31075
+ return get$2(this.#limit);
31076
+ }
31077
+ set limit(value) {
31078
+ set(this.#limit, value, true);
31079
+ }
31080
+ #query = /* @__PURE__ */ state();
31081
+ get query() {
31082
+ return get$2(this.#query);
31083
+ }
31084
+ set query(value) {
31085
+ set(this.#query, value, true);
31086
+ }
31087
+ #ticketGroupIds = /* @__PURE__ */ state(proxy([]));
31088
+ get ticketGroupIds() {
31089
+ return get$2(this.#ticketGroupIds);
31090
+ }
31091
+ set ticketGroupIds(value) {
31092
+ set(this.#ticketGroupIds, value, true);
31093
+ }
31094
+ #languageIds = /* @__PURE__ */ state(proxy([]));
31095
+ get languageIds() {
31096
+ return get$2(this.#languageIds);
31097
+ }
31098
+ set languageIds(value) {
31099
+ set(this.#languageIds, value, true);
31100
+ }
31101
+ #catchWordIds = /* @__PURE__ */ state(proxy([]));
31102
+ get catchWordIds() {
31103
+ return get$2(this.#catchWordIds);
31104
+ }
31105
+ set catchWordIds(value) {
31106
+ set(this.#catchWordIds, value, true);
31107
+ }
30907
31108
  constructor(type, tsdWrapper) {
30908
31109
  this.filters = type;
30909
31110
  this.#ticketSelectionDetails = /* @__PURE__ */ user_derived(() => tsdWrapper.value);
@@ -30912,7 +31113,7 @@ class TicketSegmentDetails {
30912
31113
  this.preCart = createCart([]);
30913
31114
  }
30914
31115
  toString() {
30915
- return JSON.stringify({ filters: this.filters, preCart: this.preCart.pretty() });
31116
+ return JSON.stringify({ filters: this.filters, preCart: this.preCart.toString() });
30916
31117
  }
30917
31118
  loadTickets() {
30918
31119
  const method = {
@@ -30921,34 +31122,40 @@ class TicketSegmentDetails {
30921
31122
  day: loadDayTickets,
30922
31123
  custom: () => {
30923
31124
  },
30924
- "event:scaled-price": loadEventScaledPricesTickets,
31125
+ "event:scaled-price": load_Event_ScaledPricesTickets,
31126
+ "events:scaled-price": load_Events_ScaledPricesTickets,
30925
31127
  "event:ticket": loadEventTickets
30926
31128
  }[this.filters];
30927
31129
  method(this);
30928
31130
  }
30929
31131
  }
30930
31132
  const KEY = "go-ticket-segment";
30931
- const setTicketSegmentDetails = createSetDetails(KEY);
30932
- const getTicketSegmentDetails = createGetDetails(KEY);
31133
+ const setSegmentDetails = createSetDetails(KEY);
31134
+ const getSegmentDetails = createGetDetails(KEY);
30933
31135
  function TicketSegment($$anchor, $$props) {
30934
31136
  push($$props, true);
30935
- const filters = prop($$props, "filters", 7), dateId = prop($$props, "dateId", 7);
31137
+ const filters = prop($$props, "filters", 7), dateId = prop($$props, "dateId", 7), query = prop($$props, "query", 7), limit = prop($$props, "limit", 7), ticketGroupIds = prop($$props, "ticketGroupIds", 7), languageIds = prop($$props, "languageIds", 7), catchWordIds = prop($$props, "catchWordIds", 7);
30936
31138
  if (!filters()) throw new Error("filters is required");
30937
31139
  const tsdWrapper = getTicketSelectionDetails($$props.$$host);
30938
31140
  const tsd = tsdWrapper.value;
30939
- const details = new TicketSegmentDetails(filters(), tsdWrapper);
30940
- setTicketSegmentDetails($$props.$$host, details);
30941
- details.filters = filters();
30942
- details.dateId = dateId();
31141
+ const details = new SegmentDetails(filters(), tsdWrapper);
31142
+ setSegmentDetails($$props.$$host, details);
30943
31143
  user_effect(() => {
30944
31144
  details.filters = filters();
30945
31145
  details.dateId = dateId();
31146
+ details.query = query();
31147
+ details.limit = limit();
31148
+ details.ticketGroupIds = parseIds(ticketGroupIds());
31149
+ details.languageIds = parseIds(languageIds());
31150
+ details.catchWordIds = parseIds(catchWordIds());
30946
31151
  });
30947
31152
  user_effect(() => {
30948
31153
  details.dateId;
30949
31154
  details.filters;
30950
31155
  details.dateId;
31156
+ details.ticketGroupIds;
30951
31157
  tsd?.selectedTimeslot;
31158
+ tsd?.selectedTime;
30952
31159
  tsd?.selectedDate;
30953
31160
  untrack(() => {
30954
31161
  details.loadTickets();
@@ -30977,6 +31184,41 @@ function TicketSegment($$anchor, $$props) {
30977
31184
  set dateId($$value) {
30978
31185
  dateId($$value);
30979
31186
  flushSync();
31187
+ },
31188
+ get query() {
31189
+ return query();
31190
+ },
31191
+ set query($$value) {
31192
+ query($$value);
31193
+ flushSync();
31194
+ },
31195
+ get limit() {
31196
+ return limit();
31197
+ },
31198
+ set limit($$value) {
31199
+ limit($$value);
31200
+ flushSync();
31201
+ },
31202
+ get ticketGroupIds() {
31203
+ return ticketGroupIds();
31204
+ },
31205
+ set ticketGroupIds($$value) {
31206
+ ticketGroupIds($$value);
31207
+ flushSync();
31208
+ },
31209
+ get languageIds() {
31210
+ return languageIds();
31211
+ },
31212
+ set languageIds($$value) {
31213
+ languageIds($$value);
31214
+ flushSync();
31215
+ },
31216
+ get catchWordIds() {
31217
+ return catchWordIds();
31218
+ },
31219
+ set catchWordIds($$value) {
31220
+ catchWordIds($$value);
31221
+ flushSync();
30980
31222
  }
30981
31223
  };
30982
31224
  return pop($$exports);
@@ -30984,13 +31226,34 @@ function TicketSegment($$anchor, $$props) {
30984
31226
  customElements.define("go-ticket-segment", create_custom_element(
30985
31227
  TicketSegment,
30986
31228
  {
31229
+ catchWordIds: { attribute: "catch-word-ids", reflect: true, type: "String" },
30987
31230
  dateId: { attribute: "date-id", reflect: true, type: "Number" },
30988
- filters: { attribute: "filters", reflect: true, type: "String" }
31231
+ filters: { attribute: "filters", reflect: true, type: "String" },
31232
+ languageIds: { attribute: "language-ids", reflect: true, type: "String" },
31233
+ limit: { attribute: "limit", reflect: true, type: "Number" },
31234
+ query: { attribute: "query", reflect: true, type: "String" },
31235
+ ticketGroupIds: { attribute: "ticket-group-ids", reflect: true, type: "String" }
30989
31236
  },
30990
31237
  [],
30991
31238
  ["details"],
30992
31239
  false
30993
31240
  ));
31241
+ function TicketSegmentEmpty($$anchor, $$props) {
31242
+ push($$props, true);
31243
+ const tsdWrapper = getTicketSelectionDetails($$props.$$host);
31244
+ const tsd = tsdWrapper.value;
31245
+ const _details = getSegmentDetails($$props.$$host);
31246
+ const details = _details.value;
31247
+ const numTickets = /* @__PURE__ */ user_derived(() => details?.preCart.items.length);
31248
+ const isVisible = /* @__PURE__ */ user_derived(() => !tsd?.isTicketsVisible || tsd?.isTicketsVisible && get$2(numTickets) === 0);
31249
+ user_effect(() => {
31250
+ $$props.$$host.style.display = get$2(isVisible) ? "block" : "none";
31251
+ $$props.$$host.classList.toggle("is-hidden", !get$2(isVisible));
31252
+ $$props.$$host.classList.toggle("is-visible", get$2(isVisible));
31253
+ });
31254
+ pop();
31255
+ }
31256
+ customElements.define("go-ticket-segment-empty", create_custom_element(TicketSegmentEmpty, {}, [], [], false));
30994
31257
  function selectedTime(product, tsd) {
30995
31258
  switch (product.product_type) {
30996
31259
  case "Ticket":
@@ -31015,7 +31278,7 @@ function selectedTime(product, tsd) {
31015
31278
  throw new Error(`(selectedTime) Unhandled Ticket Type: ${exhaustedChecking2}`);
31016
31279
  }
31017
31280
  case "Event":
31018
- if (!isUIEventTicket(product)) {
31281
+ if (!isUIScaledPricesTicket(product)) {
31019
31282
  throw new Error("(selectedTime) this should not happen");
31020
31283
  }
31021
31284
  return product.selectedTime || "";
@@ -31046,13 +31309,13 @@ function generateQuantityOptions(min2, max2) {
31046
31309
  }
31047
31310
  return options;
31048
31311
  }
31049
- var root_1$3 = /* @__PURE__ */ from_html(`<span class="go-tickets-item-title-event-title"> </span> <span class="go-tickets-item-title-product-title"> </span>`, 1);
31312
+ 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);
31050
31313
  var root_4 = /* @__PURE__ */ from_html(`<option> </option>`);
31051
31314
  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>`);
31052
31315
  function Item($$anchor, $$props) {
31053
31316
  push($$props, true);
31054
31317
  const scaled_title = ($$anchor2) => {
31055
- var fragment = root_1$3();
31318
+ var fragment = root_1$4();
31056
31319
  var span = first_child(fragment);
31057
31320
  var text2 = child(span, true);
31058
31321
  reset(span);
@@ -31085,7 +31348,7 @@ function Item($$anchor, $$props) {
31085
31348
  ci.time = selectedTime(ci.product, tsd);
31086
31349
  }
31087
31350
  let titleSnippet = default_title;
31088
- if (isUIEventTicket(item().product)) titleSnippet = scaled_title;
31351
+ if (isUIScaledPricesTicket(item().product)) titleSnippet = scaled_title;
31089
31352
  var $$exports = {
31090
31353
  get item() {
31091
31354
  return item();
@@ -31161,17 +31424,17 @@ function Item($$anchor, $$props) {
31161
31424
  }
31162
31425
  delegate(["change"]);
31163
31426
  create_custom_element(Item, { item: {}, details: {} }, [], [], true);
31164
- var root_1$2 = /* @__PURE__ */ from_html(`<ol class="go-tickets" data-testid="tickets"><li class="go-tickets-header" data-go-tickets-header="" data-testid="tickets-header"><ul><li class="go-tickets-header-title" data-go-tickets-title=""> </li> <li class="go-tickets-header-description" data-go-tickets-description=""> </li> <li class="go-tickets-header-price" data-go-tickets-price=""> </li> <li class="go-tickets-header-quality" data-go-tickets-quality=""> </li></ul></li> <!></ol>`);
31427
+ var root_1$3 = /* @__PURE__ */ from_html(`<ol class="go-tickets" data-testid="tickets"><li class="go-tickets-header" data-go-tickets-header="" data-testid="tickets-header"><ul><li class="go-tickets-header-title" data-go-tickets-title=""> </li> <li class="go-tickets-header-description" data-go-tickets-description=""> </li> <li class="go-tickets-header-price" data-go-tickets-price=""> </li> <li class="go-tickets-header-quality" data-go-tickets-quality=""> </li></ul></li> <!></ol>`);
31165
31428
  function Body($$anchor, $$props) {
31166
31429
  push($$props, true);
31167
- const _details = getTicketSegmentDetails($$props.$$host);
31430
+ const _details = getSegmentDetails($$props.$$host);
31168
31431
  const details = /* @__PURE__ */ user_derived(() => _details.value);
31169
31432
  const anyItems = /* @__PURE__ */ user_derived(() => get$2(details)?.preCart?.items.length && get$2(details)?.preCart?.items.length > 0);
31170
31433
  var fragment = comment();
31171
31434
  var node = first_child(fragment);
31172
31435
  {
31173
31436
  var consequent = ($$anchor2) => {
31174
- var ol = root_1$2();
31437
+ var ol = root_1$3();
31175
31438
  var li = child(ol);
31176
31439
  var ul = child(li);
31177
31440
  var li_1 = child(ul);
@@ -31226,7 +31489,7 @@ function Body($$anchor, $$props) {
31226
31489
  customElements.define("go-ticket-segment-body", create_custom_element(Body, {}, [], [], false));
31227
31490
  function Sum($$anchor, $$props) {
31228
31491
  push($$props, true);
31229
- const _details = getTicketSegmentDetails($$props.$$host);
31492
+ const _details = getSegmentDetails($$props.$$host);
31230
31493
  const details = /* @__PURE__ */ user_derived(() => _details.value);
31231
31494
  next();
31232
31495
  var text$1 = text();
@@ -31235,7 +31498,7 @@ function Sum($$anchor, $$props) {
31235
31498
  pop();
31236
31499
  }
31237
31500
  customElements.define("go-ticket-segment-sum", create_custom_element(Sum, {}, [], [], false));
31238
- let Details$1 = class Details {
31501
+ let Details$2 = class Details {
31239
31502
  #tsd;
31240
31503
  get tsd() {
31241
31504
  return get$2(this.#tsd);
@@ -31282,12 +31545,12 @@ let Details$1 = class Details {
31282
31545
  }
31283
31546
  };
31284
31547
  var root_2$1 = /* @__PURE__ */ from_html(`<li><label> <input type="radio" name="timeslot"/></label></li>`);
31285
- var root_1$1 = /* @__PURE__ */ from_html(`<ul data-testid="timeslots"></ul>`);
31548
+ var root_1$2 = /* @__PURE__ */ from_html(`<ul data-testid="timeslots"></ul>`);
31286
31549
  function Timeslots($$anchor, $$props) {
31287
31550
  push($$props, true);
31288
31551
  const binding_group = [];
31289
31552
  const _tsd = getTicketSelectionDetails($$props.$$host);
31290
- const details = new Details$1(_tsd);
31553
+ const details = new Details$2(_tsd);
31291
31554
  const change = (e) => {
31292
31555
  e.target.dispatchEvent(new CustomEvent("go-timeslot-select", {
31293
31556
  detail: { selected: details.tsd.selectedTimeslot },
@@ -31300,7 +31563,7 @@ function Timeslots($$anchor, $$props) {
31300
31563
  var node = first_child(fragment);
31301
31564
  {
31302
31565
  var consequent = ($$anchor2) => {
31303
- var ul = root_1$1();
31566
+ var ul = root_1$2();
31304
31567
  each(ul, 20, () => details.timeslots, (timeslot) => timeslot, ($$anchor3, timeslot) => {
31305
31568
  const selected = /* @__PURE__ */ user_derived(() => details.tsd?.selectedTimeslot === timeslot.startAt);
31306
31569
  var li = root_2$1();
@@ -31374,7 +31637,6 @@ class Calendar {
31374
31637
  }
31375
31638
  get dates() {
31376
31639
  if (!this.details) {
31377
- console.warn("(Calendar) details is undefined");
31378
31640
  return void 0;
31379
31641
  }
31380
31642
  switch (this.details.mode) {
@@ -31412,6 +31674,7 @@ class Calendar {
31412
31674
  timeslot: "time_slot",
31413
31675
  annual: "annual",
31414
31676
  "event:scaled-price": "scaled_price",
31677
+ "events:scaled-price": "not implemented",
31415
31678
  "event:ticket": "not implemented"
31416
31679
  })[f]);
31417
31680
  }
@@ -31459,7 +31722,7 @@ var root_3 = /* @__PURE__ */ from_html(`<!> <!> <!>`, 1);
31459
31722
  var root_11 = /* @__PURE__ */ from_html(`<div> </div>`);
31460
31723
  var root_7 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
31461
31724
  var root_2 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
31462
- var root_1 = /* @__PURE__ */ from_html(`<div data-calendar-wrapper=""><!></div>`);
31725
+ var root_1$1 = /* @__PURE__ */ from_html(`<div data-calendar-wrapper=""><!></div>`);
31463
31726
  function CalendarUI($$anchor, $$props) {
31464
31727
  push($$props, true);
31465
31728
  let calendarClass = prop($$props, "calendarClass", 7);
@@ -31481,7 +31744,7 @@ function CalendarUI($$anchor, $$props) {
31481
31744
  flushSync();
31482
31745
  }
31483
31746
  };
31484
- var div = root_1();
31747
+ var div = root_1$1();
31485
31748
  var node = child(div);
31486
31749
  {
31487
31750
  const children = ($$anchor2, $$arg0) => {
@@ -31731,7 +31994,7 @@ function Calendar_1($$anchor, $$props) {
31731
31994
  return pop($$exports);
31732
31995
  }
31733
31996
  customElements.define("go-calendar", create_custom_element(Calendar_1, {}, [], ["details"], false));
31734
- class Details2 {
31997
+ let Details$1 = class Details2 {
31735
31998
  #ticketSelectionDetails;
31736
31999
  get ticketSelectionDetails() {
31737
32000
  return get$2(this.#ticketSelectionDetails);
@@ -31767,14 +32030,14 @@ class Details2 {
31767
32030
  const ret = this.ticketSelectionDetails.preCarts.some((cart) => cart.items.some((item) => item.quantity > 0));
31768
32031
  return ret;
31769
32032
  }
31770
- }
31771
- var root = /* @__PURE__ */ from_html(`<button data-add-to-cart-button="" data-testid="go-add-to-cart-button__button"> </button>`);
32033
+ };
32034
+ var root$2 = /* @__PURE__ */ from_html(`<button data-add-to-cart-button="" data-testid="go-add-to-cart-button__button"> </button>`);
31772
32035
  function AddToCartButton($$anchor, $$props) {
31773
32036
  push($$props, true);
31774
32037
  const _tsd = getTicketSelectionDetails($$props.$$host);
31775
- const details = new Details2(_tsd);
32038
+ const details = new Details$1(_tsd);
31776
32039
  var $$exports = { details };
31777
- var button = root();
32040
+ var button = root$2();
31778
32041
  button.__click = () => details.addToCart();
31779
32042
  var text2 = child(button, true);
31780
32043
  reset(button);
@@ -31828,3 +32091,104 @@ function Link($$anchor, $$props) {
31828
32091
  return pop($$exports);
31829
32092
  }
31830
32093
  customElements.define("go-link", create_custom_element(Link, { to: { attribute: "to", reflect: true, type: "String" } }, [], [], false));
32094
+ var root$1 = /* @__PURE__ */ from_html(`<go-form></go-form>`, 2);
32095
+ function Password($$anchor, $$props) {
32096
+ push($$props, false);
32097
+ Forms.defineForm({
32098
+ id: "passwordResetForm",
32099
+ fields: [
32100
+ { key: "currentPassword", required: true },
32101
+ { key: "password", required: true },
32102
+ { key: "confirmPassword", required: true }
32103
+ ]
32104
+ });
32105
+ async function submit(event2) {
32106
+ const form = event2.target;
32107
+ const details = form.details;
32108
+ const result = await shop.updatePassword(details.formData);
32109
+ if (result.data) {
32110
+ details.successMessage = shop.t("user.passwordSuccess.desc.title");
32111
+ details.apiErrors = [];
32112
+ } else {
32113
+ details.apiErrors = result.error?.errors || result.error || result.errors;
32114
+ }
32115
+ }
32116
+ init();
32117
+ var go_form = root$1();
32118
+ set_custom_element_data(go_form, "formId", "passwordResetForm");
32119
+ event("submit", go_form, submit);
32120
+ append($$anchor, go_form);
32121
+ pop();
32122
+ }
32123
+ customElements.define("go-profile-password", create_custom_element(Password, {}, [], [], false));
32124
+ var root = /* @__PURE__ */ from_html(`<go-form></go-form>`, 2);
32125
+ function Details3($$anchor, $$props) {
32126
+ push($$props, true);
32127
+ Forms.defineForm({
32128
+ id: "accountDetailsForm",
32129
+ fields: [
32130
+ { key: "salutation", required: false },
32131
+ { key: "firstName", required: true },
32132
+ { key: "lastName", required: true },
32133
+ { key: "email", required: true },
32134
+ { key: "confirmEmail", required: true },
32135
+ // { key: 'addressee', required: true },
32136
+ // { key: 'street', required: true },
32137
+ // { key: 'postcode', required: true },
32138
+ // { key: 'city', required: true },
32139
+ // { key: 'country', required: true },
32140
+ { key: "language", required: true }
32141
+ ]
32142
+ });
32143
+ let form = /* @__PURE__ */ state(void 0);
32144
+ const user = /* @__PURE__ */ user_derived(() => shop.validateToken());
32145
+ onMount(async () => {
32146
+ await shop.waitForAllFetches();
32147
+ await pollUntilTruthy(() => get$2(form).details);
32148
+ await pollUntilTruthy(() => get$2(user).data);
32149
+ get$2(form).details.fill(get$2(user).data);
32150
+ });
32151
+ var go_form = root();
32152
+ set_custom_element_data(go_form, "formId", "accountDetailsForm");
32153
+ bind_this(go_form, ($$value) => set(form, $$value), () => get$2(form));
32154
+ append($$anchor, go_form);
32155
+ pop();
32156
+ }
32157
+ customElements.define("go-profile-details", create_custom_element(Details3, {}, [], [], false));
32158
+ var root_1 = /* @__PURE__ */ from_html(`<div class="go-profile-fullname"> </div> <div class="go-profile-email"> </div>`, 1);
32159
+ function Overview($$anchor, $$props) {
32160
+ push($$props, true);
32161
+ const user = /* @__PURE__ */ user_derived(() => shop.validateToken());
32162
+ const data = /* @__PURE__ */ user_derived(() => get$2(user)?.data);
32163
+ var fragment = comment();
32164
+ var node = first_child(fragment);
32165
+ {
32166
+ var consequent = ($$anchor2) => {
32167
+ var fragment_1 = root_1();
32168
+ var div = first_child(fragment_1);
32169
+ var text2 = child(div);
32170
+ reset(div);
32171
+ var div_1 = sibling(div, 2);
32172
+ var text_1 = child(div_1, true);
32173
+ reset(div_1);
32174
+ template_effect(() => {
32175
+ set_text(text2, `${get$2(data).name ?? ""}
32176
+ ${get$2(data).surname ?? ""}`);
32177
+ set_text(text_1, get$2(data).email);
32178
+ });
32179
+ append($$anchor2, fragment_1);
32180
+ };
32181
+ var alternate = ($$anchor2) => {
32182
+ var text_2 = text();
32183
+ template_effect(($0) => set_text(text_2, $0), [() => shop.t("user.login.desc.text")]);
32184
+ append($$anchor2, text_2);
32185
+ };
32186
+ if_block(node, ($$render) => {
32187
+ if (get$2(data)) $$render(consequent);
32188
+ else $$render(alternate, false);
32189
+ });
32190
+ }
32191
+ append($$anchor, fragment);
32192
+ pop();
32193
+ }
32194
+ customElements.define("go-profile-overview", create_custom_element(Overview, {}, [], [], false));