@gomusdev/web-components 0.0.3 → 0.0.5

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.
@@ -11,7 +11,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
11
11
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
12
12
  (function() {
13
13
  "use strict";
14
- var _a, _previous, _callbacks, _pending, _deferred, _neutered, _async_effects, _boundary_async_effects, _render_effects, _effects, _block_effects, _dirty_effects, _maybe_dirty_effects, _Batch_instances, traverse_effect_tree_fn, defer_effects_fn, commit_fn, _events, _instance, _data, _fetchStatus, _Shop_instances, defaultApiParams_get, _canFetch, _ensureFetch, _id, _currentPage, _mode, _filters, _eventId, _museumIds, _selectedDate, _selectedTimeslot, _selectedTickets, _document, _subscribe, _name, _key, _root, _variant, _prefix, _visibleMonths, _months, _weekdays, _initialPlaceholderYear, _defaultYears, _CalendarRootState_instances, setupInitialFocusEffect_fn, setupAccessibleHeadingEffect_fn, setupFormatterEffect_fn, _isNextButtonDisabled, _isPrevButtonDisabled, _isInvalid, _headingValue, _fullCalendarLabel, isMultipleSelectionValid_fn, _snippetProps, _props, _props2, _cellDate, _isUnavailable, _isDateToday, _isOutsideMonth, _isOutsideVisibleMonths, _isDisabled, _isFocusedDate, _isSelectedDate, _labelText, _snippetProps2, _ariaDisabled, _sharedDataAttrs, _props3, _tabindex, _snippetProps3, _props4, _isDisabled2, _props5, _isDisabled3, _props6, _props7, _props8, _props9, _props10, _props11, _props12, _startAt, _selected, _b, _params, _ticketSelectionDetails;
14
+ var _a, _previous, _callbacks, _pending, _deferred, _neutered, _async_effects, _boundary_async_effects, _render_effects, _effects, _block_effects, _dirty_effects, _maybe_dirty_effects, _Batch_instances, traverse_effect_tree_fn, defer_effects_fn, commit_fn, _events, _instance, _data, _fetchStatus, _Shop_instances, defaultApiParams_get, _canFetch, _ensureFetch, _mode, _filters, _eventId, _museumIds, _exhibitionIds, _selectedDate, _selectedTimeslot, _selectedTickets, _ticketList, _document, _subscribe, _name, _key, _root, _variant, _prefix, _visibleMonths, _months, _weekdays, _initialPlaceholderYear, _defaultYears, _CalendarRootState_instances, setupInitialFocusEffect_fn, setupAccessibleHeadingEffect_fn, setupFormatterEffect_fn, _isNextButtonDisabled, _isPrevButtonDisabled, _isInvalid, _headingValue, _fullCalendarLabel, isMultipleSelectionValid_fn, _snippetProps, _props, _props2, _cellDate, _isUnavailable, _isDateToday, _isOutsideMonth, _isOutsideVisibleMonths, _isDisabled, _isFocusedDate, _isSelectedDate, _labelText, _snippetProps2, _ariaDisabled, _sharedDataAttrs, _props3, _tabindex, _snippetProps3, _props4, _isDisabled2, _props5, _isDisabled3, _props6, _props7, _props8, _props9, _props10, _props11, _props12, _startAt, _selected, _b, _params, _ticketSelectionDetails, _c, _ticketSelectionDetails2;
15
15
  const PUBLIC_VERSION = "5";
16
16
  if (typeof window !== "undefined") {
17
17
  ((_a = window.__svelte ?? (window.__svelte = {})).v ?? (_a.v = /* @__PURE__ */ new Set())).add(PUBLIC_VERSION);
@@ -22,7 +22,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
22
22
  const EACH_IS_ANIMATED = 1 << 3;
23
23
  const EACH_ITEM_IMMUTABLE = 1 << 4;
24
24
  const PROPS_IS_IMMUTABLE = 1;
25
- const PROPS_IS_RUNES = 1 << 1;
26
25
  const PROPS_IS_UPDATED = 1 << 2;
27
26
  const PROPS_IS_BINDABLE = 1 << 3;
28
27
  const PROPS_IS_LAZY_INITIAL = 1 << 4;
@@ -251,11 +250,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
251
250
  function safe_equals(value) {
252
251
  return !safe_not_equal(value, this.v);
253
252
  }
254
- let legacy_mode_flag = false;
255
253
  let tracing_mode_flag = false;
256
- function enable_legacy_mode_flag() {
257
- legacy_mode_flag = true;
258
- }
259
254
  const empty = [];
260
255
  function snapshot(value, skip_warning = false) {
261
256
  return clone(value, /* @__PURE__ */ new Map(), "", empty);
@@ -365,7 +360,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
365
360
  e: null,
366
361
  s: props,
367
362
  x: null,
368
- l: legacy_mode_flag && !runes ? { s: null, u: null, $: [] } : null
363
+ l: null
369
364
  };
370
365
  }
371
366
  function pop(component2) {
@@ -388,7 +383,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
388
383
  {};
389
384
  }
390
385
  function is_runes() {
391
- return !legacy_mode_flag || component_context !== null && component_context.l === null;
386
+ return true;
392
387
  }
393
388
  function get_or_init_context_map(name) {
394
389
  if (component_context === null) {
@@ -708,7 +703,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
708
703
  }
709
704
  }
710
705
  function flatten(sync, async, fn) {
711
- const d = is_runes() ? derived : derived_safe_equal;
706
+ const d = derived;
712
707
  if (async.length === 0) {
713
708
  fn(sync.map(d));
714
709
  return;
@@ -1204,14 +1199,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
1204
1199
  }
1205
1200
  // @__NO_SIDE_EFFECTS__
1206
1201
  function mutable_source(initial_value, immutable = false, trackable = true) {
1207
- var _a2;
1208
1202
  const s = source(initial_value);
1209
1203
  if (!immutable) {
1210
1204
  s.equals = safe_equals;
1211
1205
  }
1212
- if (legacy_mode_flag && trackable && component_context !== null && component_context.l !== null) {
1213
- ((_a2 = component_context.l).s ?? (_a2.s = [])).push(s);
1214
- }
1215
1206
  return s;
1216
1207
  }
1217
1208
  function set(source2, value, should_proxy = false) {
@@ -1245,7 +1236,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
1245
1236
  }
1246
1237
  source2.wv = increment_write_version();
1247
1238
  mark_reactions(source2, DIRTY$1);
1248
- if (is_runes() && active_effect !== null && (active_effect.f & CLEAN) !== 0 && (active_effect.f & (BRANCH_EFFECT | ROOT_EFFECT)) === 0) {
1239
+ if (active_effect !== null && (active_effect.f & CLEAN) !== 0 && (active_effect.f & (BRANCH_EFFECT | ROOT_EFFECT)) === 0) {
1249
1240
  if (untracked_writes === null) {
1250
1241
  set_untracked_writes([source2]);
1251
1242
  } else {
@@ -1261,12 +1252,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
1261
1252
  function mark_reactions(signal, status) {
1262
1253
  var reactions = signal.reactions;
1263
1254
  if (reactions === null) return;
1264
- var runes = is_runes();
1265
1255
  var length = reactions.length;
1266
1256
  for (var i = 0; i < length; i++) {
1267
1257
  var reaction = reactions[i];
1268
1258
  var flags = reaction.f;
1269
- if (!runes && reaction === active_effect) continue;
1270
1259
  var not_dirty = (flags & DIRTY$1) === 0;
1271
1260
  if (not_dirty) {
1272
1261
  set_signal_status(reaction, status);
@@ -2804,9 +2793,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2804
2793
  if (component_context === null) {
2805
2794
  lifecycle_outside_component();
2806
2795
  }
2807
- if (legacy_mode_flag && component_context.l !== null) {
2808
- init_update_callbacks(component_context).m.push(fn);
2809
- } else {
2796
+ {
2810
2797
  user_effect(() => {
2811
2798
  const cleanup = untrack(fn);
2812
2799
  if (typeof cleanup === "function") return (
@@ -2816,13 +2803,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2816
2803
  });
2817
2804
  }
2818
2805
  }
2819
- function init_update_callbacks(context) {
2820
- var l = (
2821
- /** @type {ComponentContextLegacy} */
2822
- context.l
2823
- );
2824
- return l.u ?? (l.u = { a: [], b: [], m: [] });
2825
- }
2826
2806
  function createAttachmentKey() {
2827
2807
  return Symbol(ATTACHMENT_KEY);
2828
2808
  }
@@ -3111,7 +3091,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
3111
3091
  }
3112
3092
  }
3113
3093
  function reconcile(each_effect, array, state2, offscreen_items, anchor, render_fn, flags, get_key, get_collection) {
3114
- var _a2, _b2, _c, _d;
3094
+ var _a2, _b2, _c2, _d;
3115
3095
  var is_animated = (flags & EACH_IS_ANIMATED) !== 0;
3116
3096
  var should_update = (flags & (EACH_ITEM_REACTIVE | EACH_INDEX_REACTIVE)) !== 0;
3117
3097
  var length = array.length;
@@ -3249,7 +3229,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
3249
3229
  var controlled_anchor = (flags & EACH_IS_CONTROLLED) !== 0 && length === 0 ? anchor : null;
3250
3230
  if (is_animated) {
3251
3231
  for (i = 0; i < destroy_length; i += 1) {
3252
- (_c = to_destroy[i].a) == null ? void 0 : _c.measure();
3232
+ (_c2 = to_destroy[i].a) == null ? void 0 : _c2.measure();
3253
3233
  }
3254
3234
  for (i = 0; i < destroy_length; i += 1) {
3255
3235
  (_d = to_destroy[i].a) == null ? void 0 : _d.fix();
@@ -3432,22 +3412,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
3432
3412
  }
3433
3413
  });
3434
3414
  }
3435
- function slot(anchor, $$props, name, slot_props, fallback_fn) {
3436
- var _a2;
3437
- if (hydrating) {
3438
- hydrate_next();
3439
- }
3440
- var slot_fn = (_a2 = $$props.$$slots) == null ? void 0 : _a2[name];
3441
- var is_interop = false;
3442
- if (slot_fn === true) {
3443
- slot_fn = $$props["children"];
3444
- is_interop = true;
3445
- }
3446
- if (slot_fn === void 0) ;
3447
- else {
3448
- slot_fn(anchor, is_interop ? () => slot_props : slot_props);
3449
- }
3450
- }
3451
3415
  function component(node, get_component, render_fn) {
3452
3416
  if (hydrating) {
3453
3417
  hydrate_next();
@@ -3494,39 +3458,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
3494
3458
  anchor = hydrate_node;
3495
3459
  }
3496
3460
  }
3497
- function append_styles$1(anchor, css) {
3498
- effect(() => {
3499
- var root2 = anchor.getRootNode();
3500
- var target = (
3501
- /** @type {ShadowRoot} */
3502
- root2.host ? (
3503
- /** @type {ShadowRoot} */
3504
- root2
3505
- ) : (
3506
- /** @type {Document} */
3507
- root2.head ?? /** @type {Document} */
3508
- root2.ownerDocument.head
3509
- )
3510
- );
3511
- if (!target.querySelector("#" + css.hash)) {
3512
- const style = document.createElement("style");
3513
- style.id = css.hash;
3514
- style.textContent = css.code;
3515
- target.appendChild(style);
3516
- }
3517
- });
3518
- }
3519
- function action(dom, action2, get_value) {
3520
- effect(() => {
3521
- var payload = untrack(() => action2(dom, get_value == null ? void 0 : get_value()) || {});
3522
- if (payload == null ? void 0 : payload.destroy) {
3523
- return () => (
3524
- /** @type {Function} */
3525
- payload.destroy()
3526
- );
3527
- }
3528
- });
3529
- }
3530
3461
  function attach(node, get_fn) {
3531
3462
  var fn = void 0;
3532
3463
  var e;
@@ -4270,7 +4201,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
4270
4201
  }
4271
4202
  function prop(props, key, flags, fallback) {
4272
4203
  var _a2;
4273
- var runes = !legacy_mode_flag || (flags & PROPS_IS_RUNES) !== 0;
4274
4204
  var bindable = (flags & PROPS_IS_BINDABLE) !== 0;
4275
4205
  var lazy = (flags & PROPS_IS_LAZY_INITIAL) !== 0;
4276
4206
  var fallback_value = (
@@ -4310,12 +4240,12 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
4310
4240
  if (initial_value === void 0 && fallback !== void 0) {
4311
4241
  initial_value = get_fallback();
4312
4242
  if (setter) {
4313
- if (runes) props_invalid_value();
4243
+ props_invalid_value();
4314
4244
  setter(initial_value);
4315
4245
  }
4316
4246
  }
4317
4247
  var getter;
4318
- if (runes) {
4248
+ {
4319
4249
  getter = () => {
4320
4250
  var value = (
4321
4251
  /** @type {V} */
@@ -4325,20 +4255,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
4325
4255
  fallback_dirty = true;
4326
4256
  return value;
4327
4257
  };
4328
- } else {
4329
- getter = () => {
4330
- var value = (
4331
- /** @type {V} */
4332
- props[key]
4333
- );
4334
- if (value !== void 0) {
4335
- fallback_value = /** @type {V} */
4336
- void 0;
4337
- }
4338
- return value === void 0 ? fallback_value : value;
4339
- };
4340
4258
  }
4341
- if (runes && (flags & PROPS_IS_UPDATED) === 0) {
4259
+ if ((flags & PROPS_IS_UPDATED) === 0) {
4342
4260
  return getter;
4343
4261
  }
4344
4262
  if (setter) {
@@ -4347,7 +4265,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
4347
4265
  /** @type {() => V} */
4348
4266
  function(value, mutation) {
4349
4267
  if (arguments.length > 0) {
4350
- if (!runes || !mutation || legacy_parent || is_store_sub) {
4268
+ if (!mutation || legacy_parent || is_store_sub) {
4351
4269
  setter(mutation ? getter() : value);
4352
4270
  }
4353
4271
  return value;
@@ -4370,7 +4288,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
4370
4288
  /** @type {() => V} */
4371
4289
  function(value, mutation) {
4372
4290
  if (arguments.length > 0) {
4373
- const new_value = mutation ? get(d) : runes && bindable ? proxy(value) : value;
4291
+ const new_value = mutation ? get(d) : bindable ? proxy(value) : value;
4374
4292
  set(d, new_value);
4375
4293
  overridden = true;
4376
4294
  if (fallback_value !== void 0) {
@@ -4552,9 +4470,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
4552
4470
  if (!this.$$c) {
4553
4471
  let create_slot = function(name) {
4554
4472
  return (anchor) => {
4555
- const slot2 = document.createElement("slot");
4556
- if (name !== "default") slot2.name = name;
4557
- append(anchor, slot2);
4473
+ const slot = document.createElement("slot");
4474
+ if (name !== "default") slot.name = name;
4475
+ append(anchor, slot);
4558
4476
  };
4559
4477
  };
4560
4478
  await Promise.resolve();
@@ -4774,7 +4692,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
4774
4692
  ticketGroup: (slug) => "/#/tickets/filters?group=" + slug,
4775
4693
  tour: (id) => "/#/product/tour/" + id,
4776
4694
  tours: () => "/#/products/tours",
4777
- toursGroup: toursGroupUrl
4695
+ toursGroup: toursGroupUrl,
4696
+ cart: () => "/#/cart"
4778
4697
  };
4779
4698
  const JMB_Urls = {
4780
4699
  ...ANGULAR_URLS,
@@ -4866,9 +4785,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
4866
4785
  const defaultErrorConfig = {
4867
4786
  withStackTrace: false
4868
4787
  };
4869
- const createNeverThrowError = (message, result, config2 = defaultErrorConfig) => {
4788
+ const createNeverThrowError = (message, result, config = defaultErrorConfig) => {
4870
4789
  const data = result.isOk() ? { type: "Ok", value: result.value } : { type: "Err", value: result.error };
4871
- const maybeStack = config2.withStackTrace ? new Error().stack : void 0;
4790
+ const maybeStack = config.withStackTrace ? new Error().stack : void 0;
4872
4791
  return {
4873
4792
  data,
4874
4793
  message,
@@ -5206,8 +5125,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
5206
5125
  _unsafeUnwrap(_) {
5207
5126
  return this.value;
5208
5127
  }
5209
- _unsafeUnwrapErr(config2) {
5210
- throw createNeverThrowError("Called `_unsafeUnwrapErr` on an Ok", this, config2);
5128
+ _unsafeUnwrapErr(config) {
5129
+ throw createNeverThrowError("Called `_unsafeUnwrapErr` on an Ok", this, config);
5211
5130
  }
5212
5131
  }
5213
5132
  class Err {
@@ -5265,8 +5184,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
5265
5184
  throw new Error("Do not use this generator out of `safeTry`");
5266
5185
  }();
5267
5186
  }
5268
- _unsafeUnwrap(config2) {
5269
- throw createNeverThrowError("Called `_unsafeUnwrap` on an Err", this, config2);
5187
+ _unsafeUnwrap(config) {
5188
+ throw createNeverThrowError("Called `_unsafeUnwrap` on an Err", this, config);
5270
5189
  }
5271
5190
  _unsafeUnwrapErr(_) {
5272
5191
  return this.error;
@@ -7897,8 +7816,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
7897
7816
  unknownKeys: "strict",
7898
7817
  ...message !== void 0 ? {
7899
7818
  errorMap: (issue, ctx) => {
7900
- var _a2, _b2, _c, _d;
7901
- const defaultError = (_c = (_b2 = (_a2 = this._def).errorMap) === null || _b2 === void 0 ? void 0 : _b2.call(_a2, issue, ctx).message) !== null && _c !== void 0 ? _c : ctx.defaultError;
7819
+ var _a2, _b2, _c2, _d;
7820
+ const defaultError = (_c2 = (_b2 = (_a2 = this._def).errorMap) === null || _b2 === void 0 ? void 0 : _b2.call(_a2, issue, ctx).message) !== null && _c2 !== void 0 ? _c2 : ctx.defaultError;
7902
7821
  if (issue.code === "unrecognized_keys")
7903
7822
  return {
7904
7823
  message: (_d = errorUtil.errToObj(message).message) !== null && _d !== void 0 ? _d : defaultError
@@ -9602,6 +9521,13 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
9602
9521
  const isObject$1 = (value) => {
9603
9522
  return !!value && value.constructor === Object;
9604
9523
  };
9524
+ const sort = (array, getter, desc = false) => {
9525
+ if (!array)
9526
+ return [];
9527
+ const asc = (a, b) => getter(a) - getter(b);
9528
+ const dsc = (a, b) => getter(b) - getter(a);
9529
+ return array.slice().sort(desc === true ? dsc : asc);
9530
+ };
9605
9531
  const alphabetical = (array, getter, dir = "asc") => {
9606
9532
  if (!array)
9607
9533
  return [];
@@ -9626,2394 +9552,1678 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
9626
9552
  {}
9627
9553
  );
9628
9554
  };
9629
- class Shop {
9630
- constructor(apiUrl, shopDomain, locale, type = "angular") {
9631
- __privateAdd(this, _Shop_instances);
9632
- __privateAdd(this, _data, /* @__PURE__ */ state(proxy({})));
9633
- // Holds the fetch status and timestamp for data requests, tracking whether the request is ongoing or completed and when it was completed.
9634
- __privateAdd(this, _fetchStatus, {});
9635
- __privateAdd(this, _canFetch, () => {
9636
- return this.apiUrl !== void 0 && this.shopDomain !== void 0 && this.locale !== void 0 && this.client !== void 0;
9637
- });
9638
- __privateAdd(this, _ensureFetch, () => {
9639
- if (this.apiUrl === void 0) {
9640
- throw new Error("Public API URL is not set");
9641
- }
9642
- if (this.shopDomain === void 0) {
9643
- throw new Error("Shop Domain (X-Shop-Url) is not set");
9644
- }
9645
- if (this.locale === void 0) {
9646
- throw new Error("Locale is not set");
9647
- }
9648
- if (this.client === void 0) {
9649
- throw new Error("client is not set");
9650
- }
9651
- if (!__privateGet(this, _canFetch).call(this)) {
9652
- throw new Error("Fetch is not possible.");
9653
- }
9654
- });
9655
- this.type = type;
9656
- if (apiUrl && shopDomain && locale) {
9657
- this.load(apiUrl, shopDomain, locale, type);
9658
- }
9659
- }
9660
- async load(apiUrl, shopDomain, locale, type = "angular") {
9661
- if (apiUrl.includes("jmb-staging.gomus.de") || apiUrl.includes("jmb.gomus.de")) {
9662
- this.type = "jmb";
9663
- }
9664
- get(__privateGet(this, _data)).urls = shopUrlProvider(this.type);
9665
- get(__privateGet(this, _data)).currentUser = getUserProvider(this.type);
9666
- get(__privateGet(this, _data)).apiUrl = apiUrl;
9667
- get(__privateGet(this, _data)).shopDomain = shopDomain;
9668
- get(__privateGet(this, _data)).locale = locale || "de";
9669
- __privateSet(this, _fetchStatus, {});
9670
- get(__privateGet(this, _data)).client = client(apiUrl, shopDomain);
9671
- await this.waitForAllFetches(this.shop);
9672
- }
9673
- get currentUser() {
9674
- return get(__privateGet(this, _data)).currentUser;
9675
- }
9676
- get slug() {
9677
- var _a2, _b2;
9678
- return (_b2 = (_a2 = this.shopDomain) == null ? void 0 : _a2.match(/^(?:https?:\/\/)?([^.-]+)/)) == null ? void 0 : _b2[1];
9555
+ function $2b4dce13dd5a17fa$export$842a2cf37af977e1(amount, numerator) {
9556
+ return amount - numerator * Math.floor(amount / numerator);
9557
+ }
9558
+ const $3b62074eb05584b2$var$EPOCH = 1721426;
9559
+ function $3b62074eb05584b2$export$f297eb839006d339(era, year, month, day) {
9560
+ year = $3b62074eb05584b2$export$c36e0ecb2d4fa69d(era, year);
9561
+ let y1 = year - 1;
9562
+ let monthOffset = -2;
9563
+ if (month <= 2) monthOffset = 0;
9564
+ else if ($3b62074eb05584b2$export$553d7fa8e3805fc0(year)) monthOffset = -1;
9565
+ return $3b62074eb05584b2$var$EPOCH - 1 + 365 * y1 + Math.floor(y1 / 4) - Math.floor(y1 / 100) + Math.floor(y1 / 400) + Math.floor((367 * month - 362) / 12 + monthOffset + day);
9566
+ }
9567
+ function $3b62074eb05584b2$export$553d7fa8e3805fc0(year) {
9568
+ return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
9569
+ }
9570
+ function $3b62074eb05584b2$export$c36e0ecb2d4fa69d(era, year) {
9571
+ return era === "BC" ? 1 - year : year;
9572
+ }
9573
+ function $3b62074eb05584b2$export$4475b7e617eb123c(year) {
9574
+ let era = "AD";
9575
+ if (year <= 0) {
9576
+ era = "BC";
9577
+ year = 1 - year;
9679
9578
  }
9680
- get client() {
9681
- return get(__privateGet(this, _data)).client;
9579
+ return [
9580
+ era,
9581
+ year
9582
+ ];
9583
+ }
9584
+ const $3b62074eb05584b2$var$daysInMonth = {
9585
+ standard: [
9586
+ 31,
9587
+ 28,
9588
+ 31,
9589
+ 30,
9590
+ 31,
9591
+ 30,
9592
+ 31,
9593
+ 31,
9594
+ 30,
9595
+ 31,
9596
+ 30,
9597
+ 31
9598
+ ],
9599
+ leapyear: [
9600
+ 31,
9601
+ 29,
9602
+ 31,
9603
+ 30,
9604
+ 31,
9605
+ 30,
9606
+ 31,
9607
+ 31,
9608
+ 30,
9609
+ 31,
9610
+ 30,
9611
+ 31
9612
+ ]
9613
+ };
9614
+ class $3b62074eb05584b2$export$80ee6245ec4f29ec {
9615
+ fromJulianDay(jd) {
9616
+ let jd0 = jd;
9617
+ let depoch = jd0 - $3b62074eb05584b2$var$EPOCH;
9618
+ let quadricent = Math.floor(depoch / 146097);
9619
+ let dqc = $2b4dce13dd5a17fa$export$842a2cf37af977e1(depoch, 146097);
9620
+ let cent = Math.floor(dqc / 36524);
9621
+ let dcent = $2b4dce13dd5a17fa$export$842a2cf37af977e1(dqc, 36524);
9622
+ let quad = Math.floor(dcent / 1461);
9623
+ let dquad = $2b4dce13dd5a17fa$export$842a2cf37af977e1(dcent, 1461);
9624
+ let yindex = Math.floor(dquad / 365);
9625
+ let extendedYear = quadricent * 400 + cent * 100 + quad * 4 + yindex + (cent !== 4 && yindex !== 4 ? 1 : 0);
9626
+ let [era, year] = $3b62074eb05584b2$export$4475b7e617eb123c(extendedYear);
9627
+ let yearDay = jd0 - $3b62074eb05584b2$export$f297eb839006d339(era, year, 1, 1);
9628
+ let leapAdj = 2;
9629
+ if (jd0 < $3b62074eb05584b2$export$f297eb839006d339(era, year, 3, 1)) leapAdj = 0;
9630
+ else if ($3b62074eb05584b2$export$553d7fa8e3805fc0(year)) leapAdj = 1;
9631
+ let month = Math.floor(((yearDay + leapAdj) * 12 + 373) / 367);
9632
+ let day = jd0 - $3b62074eb05584b2$export$f297eb839006d339(era, year, month, 1) + 1;
9633
+ return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(era, year, month, day);
9682
9634
  }
9683
- get name() {
9684
- var _a2;
9685
- return (_a2 = this.shop) == null ? void 0 : _a2.name;
9635
+ toJulianDay(date) {
9636
+ return $3b62074eb05584b2$export$f297eb839006d339(date.era, date.year, date.month, date.day);
9686
9637
  }
9687
- get config() {
9688
- var _a2;
9689
- return (_a2 = this.shop) == null ? void 0 : _a2.config;
9638
+ getDaysInMonth(date) {
9639
+ return $3b62074eb05584b2$var$daysInMonth[$3b62074eb05584b2$export$553d7fa8e3805fc0(date.year) ? "leapyear" : "standard"][date.month - 1];
9690
9640
  }
9691
- get payment_modes() {
9692
- var _a2;
9693
- return (_a2 = this.shop) == null ? void 0 : _a2.payment_modes;
9641
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
9642
+ getMonthsInYear(date) {
9643
+ return 12;
9694
9644
  }
9695
- get content() {
9696
- var _a2;
9697
- return (_a2 = this.shop) == null ? void 0 : _a2.content;
9645
+ getDaysInYear(date) {
9646
+ return $3b62074eb05584b2$export$553d7fa8e3805fc0(date.year) ? 366 : 365;
9698
9647
  }
9699
- get settings() {
9700
- var _a2;
9701
- return (_a2 = this.shop) == null ? void 0 : _a2.settings;
9648
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
9649
+ getYearsInEra(date) {
9650
+ return 9999;
9702
9651
  }
9703
- get translations() {
9704
- var _a2;
9705
- return (_a2 = this.shop) == null ? void 0 : _a2.translations;
9652
+ getEras() {
9653
+ return [
9654
+ "BC",
9655
+ "AD"
9656
+ ];
9706
9657
  }
9707
- t(key, values) {
9708
- return this.translate(key, values);
9658
+ isInverseEra(date) {
9659
+ return date.era === "BC";
9709
9660
  }
9710
- translate(key, values) {
9711
- var _a2;
9712
- if (!((_a2 = this.translations) == null ? void 0 : _a2[key])) return "";
9713
- let translatedString = this.translations[key];
9714
- if (values && translatedString) {
9715
- for (const [key2, value] of Object.entries(values)) {
9716
- translatedString = translatedString.replace(`{{${key2}}}`, value);
9717
- }
9661
+ balanceDate(date) {
9662
+ if (date.year <= 0) {
9663
+ date.era = date.era === "BC" ? "AD" : "BC";
9664
+ date.year = 1 - date.year;
9718
9665
  }
9719
- return translatedString || "";
9720
- }
9721
- get apiUrl() {
9722
- return get(__privateGet(this, _data)).apiUrl;
9723
- }
9724
- get shopDomain() {
9725
- return get(__privateGet(this, _data)).shopDomain;
9726
- }
9727
- get baseUrl() {
9728
- return "https://" + this.shopDomain;
9729
- }
9730
- get locale() {
9731
- return get(__privateGet(this, _data)).locale;
9732
- }
9733
- get shop() {
9734
- return this.fetchAndCache("/api/v4/shop", "shop", "shop");
9735
- }
9736
- get _data() {
9737
- return get(__privateGet(this, _data));
9738
9666
  }
9739
- ticketsCalendar(params) {
9740
- return this.fetchAndCache(TICKETS_CALENDAR_ENDPOINT, `ticketsCalendar-${JSON.stringify(params)}`, "data", { cache: 60, query: params });
9741
- }
9742
- ticketsAndQuotas(params) {
9743
- return this.fetchAndCache(TICKET_AND_QUOTAS_ENDPOINT, `ticketsAndQuotas-${JSON.stringify(params)}`, "", { cache: 60, query: params });
9667
+ constructor() {
9668
+ this.identifier = "gregory";
9744
9669
  }
9745
- /**
9746
- * Returns a reactive value that will contain the fetched data, no need to await.
9747
- *
9748
- * @param {`/api${string}`} endpoint - The API endpoint to fetch data from. Must start with `/api`.
9749
- * @param {string} dataKey - The key where the fetched data will be stored in `shop.#data`.
9750
- * @param {string} responseKey - The key in the API response that contains the desired data.
9751
- * @param [options]
9752
- * - query: A record of query parameters to include in the API request.
9753
- * - cache: The cache duration (in seconds) before data is considered expired. Defaults to 1000 seconds if not provided.
9754
- * @return {T} The data fetched from the API or the cached data if it is still valid.
9755
- */
9756
- fetchAndCache(endpoint, dataKey, responseKey, options) {
9757
- var _a2;
9758
- options ?? (options = {});
9759
- options.query ?? (options.query = {});
9760
- options.cache ?? (options.cache = 1e3);
9761
- const query = assign(options.query, { per_page: 1e3 });
9762
- if (!__privateGet(this, _canFetch).call(this)) return get(__privateGet(this, _data))[dataKey];
9763
- const fetchId = endpoint + JSON.stringify(query);
9764
- const isNotFetchedYet = !__privateGet(this, _fetchStatus)[fetchId];
9765
- const isCacheExpired = ((_a2 = __privateGet(this, _fetchStatus)[fetchId]) == null ? void 0 : _a2.fetchedAt) < Date.now() - options.cache * 1e3;
9766
- if (isNotFetchedYet || isCacheExpired) {
9767
- this.apiGet(endpoint, query).then((ret) => {
9768
- get(__privateGet(this, _data))[dataKey] = responseKey === "" ? ret : ret[responseKey];
9769
- });
9770
- }
9771
- return get(__privateGet(this, _data))[dataKey];
9772
- }
9773
- get museums() {
9774
- return this.fetchAndCache("/api/v4/museums", "museums", "museums");
9775
- }
9776
- get exhibitions() {
9777
- return this.fetchAndCache("/api/v4/exhibitions", "exhibitions", "exhibitions");
9778
- }
9779
- getEvent(id) {
9780
- return this.fetchAndCache(`/api/v4/events/${id}`, `single_event_${id}`, "event");
9781
- }
9782
- get events() {
9783
- return this.fetchAndCache("/api/v4/events", "events", "events");
9784
- }
9785
- get upcomingEvents() {
9786
- return this.fetchAndCache("/api/v4/events", "events", "events", { query: { by_bookable: true, with_bookings_in_future: 1 } });
9787
- }
9788
- get tours() {
9789
- return this.fetchAndCache("/api/v4/tours", "tours", "tours");
9790
- }
9791
- get merchandises() {
9792
- return this.fetchAndCache("/api/v4/merchandises", "merchandises", "merchandises");
9793
- }
9794
- get urls() {
9795
- return get(__privateGet(this, _data)).urls;
9796
- }
9797
- async apiPost(path, { body }) {
9798
- const ret = await this.client.POST(path, { body, params: __privateGet(this, _Shop_instances, defaultApiParams_get) });
9799
- console.log("data", ret.data);
9800
- return ret;
9801
- }
9802
- async waitForAllFetches(...variables) {
9803
- while (Object.values(__privateGet(this, _fetchStatus)).filter((f) => f.status === "fetching").length) {
9804
- await wait(10);
9805
- }
9806
- }
9807
- async apiGet(path, query = {}) {
9808
- __privateGet(this, _ensureFetch).call(this);
9809
- const fetchId = path + JSON.stringify(query);
9810
- __privateGet(this, _fetchStatus)[fetchId] = { status: "fetching", fetchedAt: Date.now() };
9811
- let params = __privateGet(this, _Shop_instances, defaultApiParams_get);
9812
- if (query) {
9813
- params = assign(params, { params: { query } });
9814
- }
9815
- const ret = await this.client.GET(path, params);
9816
- __privateGet(this, _fetchStatus)[fetchId] = { status: "completed", fetchedAt: Date.now() };
9817
- return ret.data;
9818
- }
9819
- }
9820
- _data = new WeakMap();
9821
- _fetchStatus = new WeakMap();
9822
- _Shop_instances = new WeakSet();
9823
- defaultApiParams_get = function() {
9824
- return {
9825
- params: {
9826
- query: { locale: this.locale },
9827
- header: { "X-Shop-Url": this.shopDomain }
9828
- }
9829
- };
9830
- };
9831
- _canFetch = new WeakMap();
9832
- _ensureFetch = new WeakMap();
9833
- const shop = new Shop();
9834
- function GomusInit($$anchor, $$props) {
9835
- push($$props, true);
9836
- let apiUrl = prop($$props, "apiUrl", 7), shopDomain = prop($$props, "shopDomain", 7), locale = prop($$props, "locale", 7);
9837
- locale(locale() || localStorage.getItem("lang") || "en");
9838
- user_effect(() => {
9839
- if (shopDomain() !== shop.shopDomain || apiUrl() !== shop.apiUrl || locale() !== shop.locale) {
9840
- shop.load(apiUrl(), shopDomain(), locale());
9841
- console.log("shop loaded due to prop change");
9842
- }
9843
- });
9844
- return pop({
9845
- get apiUrl() {
9846
- return apiUrl();
9847
- },
9848
- set apiUrl($$value) {
9849
- apiUrl($$value);
9850
- flushSync();
9851
- },
9852
- get shopDomain() {
9853
- return shopDomain();
9854
- },
9855
- set shopDomain($$value) {
9856
- shopDomain($$value);
9857
- flushSync();
9858
- },
9859
- get locale() {
9860
- return locale();
9861
- },
9862
- set locale($$value) {
9863
- locale($$value);
9864
- flushSync();
9865
- }
9866
- });
9867
- }
9868
- customElements.define("gomus-init", create_custom_element(
9869
- GomusInit,
9870
- {
9871
- apiUrl: { attribute: "api-url", type: "String" },
9872
- shopDomain: { attribute: "shop-domain", type: "String" },
9873
- locale: { attribute: "locale", type: "String" }
9874
- },
9875
- [],
9876
- [],
9877
- false
9878
- ));
9879
- const labelGenerators = {
9880
- "label:museum": museumLabel
9881
- };
9882
- function museumLabel(id) {
9883
- var _a2, _b2;
9884
- return ((_b2 = (_a2 = shop.museums) == null ? void 0 : _a2.find((m) => m.id == id)) == null ? void 0 : _b2.title) || `Museum not found: ${id}`;
9885
- }
9886
- function createSubNavGenerator(options) {
9887
- return (count) => {
9888
- if (!options.items) return [];
9889
- count ?? (count = options.items.length);
9890
- const selected = options.items.slice(0, count).map((e) => ({ label: e.title, url: options.urlItemFn(e.id) }));
9891
- if (count >= options.items.length) return selected;
9892
- return [
9893
- ...selected,
9894
- "divider",
9895
- {
9896
- label: shop.t("header.dropdown.links.viewAll", {
9897
- count: options.items.length,
9898
- title: shop.t(`header.dropdown.titles.${options.titleKey}`)
9899
- }),
9900
- url: options.urlAllFn()
9901
- }
9902
- ];
9903
- };
9904
- }
9905
- const museumsSubnavGenerator = (count) => createSubNavGenerator({
9906
- items: shop.museums,
9907
- urlItemFn: shop.urls.museum,
9908
- urlAllFn: shop.urls.museums,
9909
- titleKey: "museums"
9910
- })(count);
9911
- const exhibitionsSubnavGenerator = (count) => createSubNavGenerator({
9912
- items: shop.exhibitions,
9913
- urlItemFn: shop.urls.exhibition,
9914
- urlAllFn: shop.urls.exhibitions,
9915
- titleKey: "exhibitions"
9916
- })(count);
9917
- const eventsSubnavGenerator = (count) => createSubNavGenerator({
9918
- items: shop.upcomingEvents,
9919
- urlItemFn: shop.urls.event,
9920
- urlAllFn: shop.urls.events,
9921
- titleKey: "events"
9922
- })(count);
9923
- const toursSubnavGenerator = (count) => {
9924
- var _a2;
9925
- return createSubNavGenerator({
9926
- items: (_a2 = shop.tours) == null ? void 0 : _a2.filter((t) => t.bookable),
9927
- urlItemFn: shop.urls.tour,
9928
- urlAllFn: shop.urls.tours,
9929
- titleKey: "tours"
9930
- })(count);
9931
- };
9932
- const merchandisesSubnavGenerator = (count) => createSubNavGenerator({
9933
- // @ts-ignore
9934
- items: shop.merchandises,
9935
- urlItemFn: shop.urls.merchandise,
9936
- urlAllFn: shop.urls.merchandises,
9937
- titleKey: "merchandises"
9938
- })(count);
9939
- const subNavGenerators = {
9940
- "subnav:museums": museumsSubnavGenerator,
9941
- "subnav:exhibitions": exhibitionsSubnavGenerator
9942
- };
9943
- const navGenerators = {
9944
- annual_tickets: () => {
9945
- return {
9946
- label: "annualTickets",
9947
- url: "url:annual_tickets",
9948
- navId: "annualTickets"
9949
- };
9950
- },
9951
- combi_tickets: (group) => group ? {
9952
- label: "combi." + group,
9953
- url: `url:combi_ticket_group(${group})`,
9954
- navId: "combiTickets"
9955
- } : {
9956
- label: "combi",
9957
- url: "url:combi_tickets",
9958
- navId: "combiTickets"
9959
- },
9960
- coupons: () => ({
9961
- label: "coupons",
9962
- url: "url:coupons",
9963
- navId: "coupons"
9964
- }),
9965
- events: singleOrSubnav("events", "url:events", eventsSubnavGenerator),
9966
- exhibitions: singleOrSubnav("exhibitions", "url:exhibitions", exhibitionsSubnavGenerator),
9967
- event_group: (id) => ({
9968
- label: "events_group" + id,
9969
- url: `url:event_group(${id})`,
9970
- navId: "eventsGroup"
9971
- }),
9972
- home: (url) => url ? {
9973
- label: "icon:home",
9974
- url,
9975
- navId: "home"
9976
- } : {
9977
- label: "icon:home",
9978
- url: "url:home",
9979
- navId: "home"
9980
- },
9981
- museums: singleOrSubnav("museums", "url:museums", museumsSubnavGenerator),
9982
- tour_group: (id) => ({
9983
- label: "tours_group" + id,
9984
- url: `url:tours_group(${id})`,
9985
- navId: "toursGroup"
9986
- }),
9987
- tours: singleOrSubnav("tours", "url:tours", toursSubnavGenerator),
9988
- merchandises: singleOrSubnav("merchandise", "url:merchandises", merchandisesSubnavGenerator),
9989
- tickets: (group) => group ? {
9990
- label: "tickets",
9991
- url: `url:ticket_group(${group})`,
9992
- navId: "tickets"
9993
- } : {
9994
- label: "tickets",
9995
- url: "url:tickets",
9996
- navId: "tickets"
9997
- }
9998
- };
9999
- function singleOrSubnav(label, singleUrl, subnavGenerator) {
10000
- return (count) => count === 0 ? { label, url: singleUrl, navId: label } : { label, parentUrl: singleUrl, items: subnavGenerator(count), navId: label };
10001
- }
10002
- Object.entries(
10003
- shop.urls || {}
10004
- ).reduce(
10005
- (acc, [key, value]) => ({
10006
- ...acc,
10007
- // converts camelCase to under_line
10008
- [`url:${key.replace(/([a-z])([A-Z])/g, "$1_$2").toLowerCase()}`]: (...args) => value(args)
10009
- }),
10010
- {}
10011
- );
10012
- function generateUrl(key, ...args) {
10013
- var _a2, _b2;
10014
- const camelCaseKey = key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase());
10015
- return ((_b2 = (_a2 = shop.urls) == null ? void 0 : _a2[camelCaseKey]) == null ? void 0 : _b2.call(_a2, ...args)) || key;
10016
- }
10017
- function generate(type, expression) {
10018
- const args = extractArgs(expression);
10019
- const command = extractCommand(expression);
10020
- if (type === "url") {
10021
- return generateUrl(command.replace("url:", ""), ...args);
10022
- }
10023
- const generators = {
10024
- subnav: subNavGenerators,
10025
- label: labelGenerators,
10026
- nav: navGenerators
10027
- }[type];
10028
- const funcName = Object.keys(generators).find((k) => extractCommand(k) === command);
10029
- if (!funcName) {
10030
- return type === "label" ? mainNavTranslate(expression) : expression;
10031
- }
10032
- const func = generators[funcName];
10033
- return func(...args);
10034
- }
10035
- function extractArgs(expression) {
10036
- const match = expression.match(/\w+\(([^)]*)\)/);
10037
- if (!match) return [];
10038
- const argsString = match[1];
10039
- return argsString.split(",").map((arg) => arg.trim()).filter((arg) => arg.length > 0).map((arg) => {
10040
- const num = parseInt(arg);
10041
- return !isNaN(num) ? num : arg;
10042
- });
10043
- }
10044
- function extractCommand(expression) {
10045
- return expression.split("(")[0];
10046
- }
10047
- function mainNavTranslate(key) {
10048
- return shop.t("header.dropdown.titles." + key) || shop.t(key) || key;
10049
- }
10050
- function isNavItem(entry) {
10051
- return typeof entry === "object" && "label" in entry && "url" in entry && typeof entry.label === "string" && typeof entry.url === "string";
10052
- }
10053
- function isGenericNavItem(entry) {
10054
- return typeof entry === "object" && "url" in entry && typeof entry.url === "string" && !("items" in entry);
10055
- }
10056
- function isNavDivider(entry) {
10057
- return entry === "divider";
10058
- }
10059
- function isSingleNavEntry(entry) {
10060
- return isGenericNavItem(entry) || isNavDivider(entry);
10061
- }
10062
- function isGenerator(value) {
10063
- return ["url", "label", "subnav"].includes(value.toString().split(":")[0]);
10064
- }
10065
- function generateNavEntry(item) {
10066
- if (isNavDivider(item)) return item;
10067
- if (typeof item === "string") {
10068
- const generated = generate("nav", item);
10069
- return generated !== item ? generateNavEntry(generated) : generated;
10070
- }
10071
- if (isGenericNavItem(item)) {
10072
- return {
10073
- label: generate("label", item.label),
10074
- url: generate("url", item.url),
10075
- navId: item.navId || "unknown"
10076
- };
10077
- }
10078
- return {
10079
- label: generate("label", item.label),
10080
- parentUrl: generate("url", item.parentUrl),
10081
- // @ts-ignore
10082
- items: isGenerator(item.items) ? generate("subnav", item.items) : item.items.map((i) => generateNavEntry(i))
10083
- };
10084
- }
10085
- function generateNavigation(settings) {
10086
- const ret = (settings || []).map((s) => generateNavEntry(s));
10087
- return ret;
10088
- }
10089
- enable_legacy_mode_flag();
10090
- var root$7 = /* @__PURE__ */ from_html(`<li class="divider"></li>`);
10091
- function Devider($$anchor) {
10092
- var li = root$7();
10093
- append($$anchor, li);
10094
- }
10095
- create_custom_element(Devider, {}, [], [], true);
10096
- class OpenedDropdown {
10097
- constructor() {
10098
- __privateAdd(this, _id, /* @__PURE__ */ state(-1));
10099
- }
10100
- get id() {
10101
- return get(__privateGet(this, _id));
10102
- }
10103
- set id(value) {
10104
- set(__privateGet(this, _id), value, true);
10105
- }
10106
- isOpen(id) {
10107
- return this.id === id;
10108
- }
10109
- toggle(id) {
10110
- if (this.id === id) {
10111
- this.id = void 0;
10112
- } else {
10113
- this.id = id;
10114
- }
10115
- }
10116
- close() {
10117
- this.id = void 0;
10118
- }
10119
- }
10120
- _id = new WeakMap();
10121
- function outsideClicksHandler() {
10122
- const openedDropdown = getOpenedDropdown();
10123
- return (element) => handleOutsideClicks(element, openedDropdown);
10124
- }
10125
- function handleOutsideClicks(element, openedDropdown) {
10126
- function handleClick(event) {
10127
- const path = event.composedPath();
10128
- if (!path.includes(element)) {
10129
- openedDropdown.id = void 0;
10130
- }
10131
- }
10132
- document.addEventListener("click", handleClick);
10133
- return {
10134
- destroy() {
10135
- document.removeEventListener("click", handleClick);
10136
- }
10137
- };
10138
- }
10139
- const KEY$2 = Symbol("Opened Dropdown");
10140
- function setOpenedDropdown() {
10141
- return setContext(KEY$2, new OpenedDropdown());
10142
- }
10143
- function getOpenedDropdown() {
10144
- return getContext(KEY$2);
10145
- }
10146
- class PageState {
10147
- constructor() {
10148
- __privateAdd(this, _currentPage, /* @__PURE__ */ state(""));
10149
- }
10150
- get currentPage() {
10151
- return get(__privateGet(this, _currentPage));
10152
- }
10153
- set currentPage(value) {
10154
- set(__privateGet(this, _currentPage), value, true);
10155
- }
10156
- isActivePage(currentUrl, entry) {
10157
- var _a2;
10158
- if (entry === "divider") return false;
10159
- const hasNavId = (navId) => () => !!entry.navId && entry.navId === navId;
10160
- const routes = {
10161
- // tickets
10162
- "shop.tickets.filters": hasNavId("tickets"),
10163
- "shop.tickets.annual": hasNavId("annualTickets"),
10164
- "shop.tickets.combi": hasNavId("combiTickets"),
10165
- // listings
10166
- "shop.museums": hasNavId("museums"),
10167
- "shop.products.events": hasNavId("events"),
10168
- "shop.tours": hasNavId("tours"),
10169
- "shop.exhibitions": hasNavId("exhibitions"),
10170
- "shop.merchandise.list": hasNavId("merchandise"),
10171
- "shop.coupons": hasNavId("coupons"),
10172
- // single items
10173
- "shop.products.publicTours": () => entry.label === mainNavTranslate("publicTours"),
10174
- // 'shop.museum': () => !('items' in entry) && currentUrl.includes(entry.url),
10175
- // 'shop.product.event': () => !('items' in entry) && currentUrl.includes(entry.url),
10176
- // 'shop.tour': () => !('items' in entry) && currentUrl.includes(entry.url),
10177
- // 'shop.exhibition': () => !('items' in entry) && currentUrl.includes(entry.url),
10178
- // 'shop.merchandise.detail': () => !('items' in entry) && currentUrl.includes(entry.url),
10179
- // 'shop.products.publicTours': () => entry.label === mainNavTranslate('publicTours'),
10180
- "shop.start": hasNavId("home"),
10181
- "": () => false
10182
- };
10183
- return ((_a2 = routes[this.currentPage || ""]) == null ? void 0 : _a2.call(routes)) ?? false;
10184
- }
10185
- }
10186
- _currentPage = new WeakMap();
10187
- const KEY$1 = Symbol("pageState");
10188
- function setPageState() {
10189
- return setContext(KEY$1, new PageState());
10190
- }
10191
- function getPageState() {
10192
- return getContext(KEY$1);
10193
- }
10194
- var root$6 = /* @__PURE__ */ from_html(`<a><!></a>`);
10195
- function Link($$anchor, $$props) {
10196
- push($$props, true);
10197
- let entry = prop($$props, "entry", 7), restProps = /* @__PURE__ */ rest_props($$props, ["$$slots", "$$events", "$$legacy", "$$host", "entry"]);
10198
- let openedDropdown = getOpenedDropdown();
10199
- let isActive = /* @__PURE__ */ user_derived(() => getPageState().isActivePage(window.location.href, entry()));
10200
- var a = root$6();
10201
- attribute_effect(
10202
- a,
10203
- ($0) => ({
10204
- href: entry().url,
10205
- onclick: openedDropdown.close,
10206
- "ui-sref-opts": "{inherit: false, reload: true}",
10207
- ...restProps,
10208
- [CLASS]: $0
10209
- }),
10210
- [() => ({ active: get(isActive) })]
10211
- );
10212
- var node = child(a);
10213
- slot(node, $$props, "default", {});
10214
- reset(a);
10215
- append($$anchor, a);
10216
- return pop({
10217
- get entry() {
10218
- return entry();
10219
- },
10220
- set entry($$value) {
10221
- entry($$value);
10222
- flushSync();
10223
- }
10224
- });
10225
- }
10226
- create_custom_element(Link, { entry: {} }, ["default"], [], true);
10227
- var root_1$4 = /* @__PURE__ */ from_html(`<span aria-hidden="true" class="fa fa-home"></span>`);
10228
- var root$5 = /* @__PURE__ */ from_html(`<li><!></li>`);
10229
- function Home($$anchor, $$props) {
10230
- push($$props, true);
10231
- let entry = prop($$props, "entry", 7);
10232
- var li = root$5();
10233
- var node = child(li);
10234
- Link(node, {
10235
- get entry() {
10236
- return entry();
10237
- },
10238
- "aria-label": "Home",
10239
- children: ($$anchor2, $$slotProps) => {
10240
- var span = root_1$4();
10241
- append($$anchor2, span);
10242
- },
10243
- $$slots: { default: true }
10244
- });
10245
- reset(li);
10246
- append($$anchor, li);
10247
- return pop({
10248
- get entry() {
10249
- return entry();
10250
- },
10251
- set entry($$value) {
10252
- entry($$value);
10253
- flushSync();
10254
- }
10255
- });
10256
- }
10257
- create_custom_element(Home, { entry: {} }, [], [], true);
10258
- var root$4 = /* @__PURE__ */ from_html(`<li><!></li>`);
10259
- function NavLink($$anchor, $$props) {
10260
- push($$props, true);
10261
- let entry = prop($$props, "entry", 7);
10262
- var li = root$4();
10263
- var node = child(li);
10264
- Link(node, {
10265
- get entry() {
10266
- return entry();
10267
- },
10268
- children: ($$anchor2, $$slotProps) => {
10269
- next();
10270
- var text$1 = text();
10271
- template_effect(() => set_text(text$1, entry().label));
10272
- append($$anchor2, text$1);
10273
- },
10274
- $$slots: { default: true }
10275
- });
10276
- reset(li);
10277
- append($$anchor, li);
10278
- return pop({
10279
- get entry() {
10280
- return entry();
10281
- },
10282
- set entry($$value) {
10283
- entry($$value);
10284
- flushSync();
10285
- }
10286
- });
10287
- }
10288
- create_custom_element(NavLink, { entry: {} }, [], [], true);
10289
- function SingleNavEntry($$anchor, $$props) {
10290
- push($$props, true);
10291
- let entry = prop($$props, "entry", 7);
10292
- var fragment = comment();
10293
- var node = first_child(fragment);
10294
- {
10295
- var consequent = ($$anchor2) => {
10296
- Devider($$anchor2);
10297
- };
10298
- var alternate_1 = ($$anchor2) => {
10299
- var fragment_2 = comment();
10300
- var node_1 = first_child(fragment_2);
10301
- {
10302
- var consequent_2 = ($$anchor3) => {
10303
- var fragment_3 = comment();
10304
- var node_2 = first_child(fragment_3);
10305
- {
10306
- var consequent_1 = ($$anchor4) => {
10307
- Home($$anchor4, {
10308
- get entry() {
10309
- return entry();
10310
- }
10311
- });
10312
- };
10313
- var alternate = ($$anchor4) => {
10314
- NavLink($$anchor4, {
10315
- get entry() {
10316
- return entry();
10317
- }
10318
- });
10319
- };
10320
- if_block(node_2, ($$render) => {
10321
- if (entry().label === "icon:home") $$render(consequent_1);
10322
- else $$render(alternate, false);
10323
- });
10324
- }
10325
- append($$anchor3, fragment_3);
10326
- };
10327
- if_block(
10328
- node_1,
10329
- ($$render) => {
10330
- if (isGenericNavItem(entry())) $$render(consequent_2);
10331
- },
10332
- true
10333
- );
10334
- }
10335
- append($$anchor2, fragment_2);
10336
- };
10337
- if_block(node, ($$render) => {
10338
- if (isNavDivider(entry())) $$render(consequent);
10339
- else $$render(alternate_1, false);
10340
- });
10341
- }
10342
- append($$anchor, fragment);
10343
- return pop({
10344
- get entry() {
10345
- return entry();
10346
- },
10347
- set entry($$value) {
10348
- entry($$value);
10349
- flushSync();
10350
- }
10351
- });
10352
9670
  }
10353
- create_custom_element(SingleNavEntry, { entry: {} }, [], [], true);
10354
- var on_click = (_, openedDropdown, id) => openedDropdown.toggle(id());
10355
- var root$3 = /* @__PURE__ */ from_html(`<li><a href="javascript:void(0);" uib-dropdown-toggle=""><span> </span> <span aria-hidden="true" class="fa fa-caret-down svelte-n0q1j9"></span></a> <ul class="dropdown-menu"></ul></li>`);
10356
- const $$css$1 = {
10357
- hash: "svelte-n0q1j9",
10358
- code: ".fa.svelte-n0q1j9 {transition:transform 0.2s ease-in-out;}.open.svelte-n0q1j9 .fa:where(.svelte-n0q1j9) {transform:rotate(180deg);}"
9671
+ const $2fe286d2fb449abb$export$7a5acbd77d414bd9 = {
9672
+ "001": 1,
9673
+ AD: 1,
9674
+ AE: 6,
9675
+ AF: 6,
9676
+ AI: 1,
9677
+ AL: 1,
9678
+ AM: 1,
9679
+ AN: 1,
9680
+ AR: 1,
9681
+ AT: 1,
9682
+ AU: 1,
9683
+ AX: 1,
9684
+ AZ: 1,
9685
+ BA: 1,
9686
+ BE: 1,
9687
+ BG: 1,
9688
+ BH: 6,
9689
+ BM: 1,
9690
+ BN: 1,
9691
+ BY: 1,
9692
+ CH: 1,
9693
+ CL: 1,
9694
+ CM: 1,
9695
+ CN: 1,
9696
+ CR: 1,
9697
+ CY: 1,
9698
+ CZ: 1,
9699
+ DE: 1,
9700
+ DJ: 6,
9701
+ DK: 1,
9702
+ DZ: 6,
9703
+ EC: 1,
9704
+ EE: 1,
9705
+ EG: 6,
9706
+ ES: 1,
9707
+ FI: 1,
9708
+ FJ: 1,
9709
+ FO: 1,
9710
+ FR: 1,
9711
+ GB: 1,
9712
+ GE: 1,
9713
+ GF: 1,
9714
+ GP: 1,
9715
+ GR: 1,
9716
+ HR: 1,
9717
+ HU: 1,
9718
+ IE: 1,
9719
+ IQ: 6,
9720
+ IR: 6,
9721
+ IS: 1,
9722
+ IT: 1,
9723
+ JO: 6,
9724
+ KG: 1,
9725
+ KW: 6,
9726
+ KZ: 1,
9727
+ LB: 1,
9728
+ LI: 1,
9729
+ LK: 1,
9730
+ LT: 1,
9731
+ LU: 1,
9732
+ LV: 1,
9733
+ LY: 6,
9734
+ MC: 1,
9735
+ MD: 1,
9736
+ ME: 1,
9737
+ MK: 1,
9738
+ MN: 1,
9739
+ MQ: 1,
9740
+ MV: 5,
9741
+ MY: 1,
9742
+ NL: 1,
9743
+ NO: 1,
9744
+ NZ: 1,
9745
+ OM: 6,
9746
+ PL: 1,
9747
+ QA: 6,
9748
+ RE: 1,
9749
+ RO: 1,
9750
+ RS: 1,
9751
+ RU: 1,
9752
+ SD: 6,
9753
+ SE: 1,
9754
+ SI: 1,
9755
+ SK: 1,
9756
+ SM: 1,
9757
+ SY: 6,
9758
+ TJ: 1,
9759
+ TM: 1,
9760
+ TR: 1,
9761
+ UA: 1,
9762
+ UY: 1,
9763
+ UZ: 1,
9764
+ VA: 1,
9765
+ VN: 1,
9766
+ XK: 1
10359
9767
  };
10360
- function DropDown($$anchor, $$props) {
10361
- push($$props, true);
10362
- append_styles$1($$anchor, $$css$1);
10363
- let entry = prop($$props, "entry", 7), id = prop($$props, "id", 7);
10364
- let openedDropdown = getOpenedDropdown();
10365
- let isOpen = /* @__PURE__ */ user_derived(() => openedDropdown.isOpen(id()));
10366
- let isActive = /* @__PURE__ */ user_derived(() => getPageState().isActivePage(window.location.href, entry()));
10367
- var li = root$3();
10368
- let classes;
10369
- var a = child(li);
10370
- a.__click = [on_click, openedDropdown, id];
10371
- let classes_1;
10372
- var span = child(a);
10373
- var text2 = child(span, true);
10374
- reset(span);
10375
- next(2);
10376
- reset(a);
10377
- var ul = sibling(a, 2);
10378
- each(ul, 21, () => entry().items, index, ($$anchor2, subEntry) => {
10379
- SingleNavEntry($$anchor2, {
10380
- get entry() {
10381
- return get(subEntry);
10382
- }
10383
- });
10384
- });
10385
- reset(ul);
10386
- reset(li);
10387
- template_effect(
10388
- ($0, $1) => {
10389
- classes = set_class(li, 1, "dropdown svelte-n0q1j9", null, classes, $0);
10390
- classes_1 = set_class(a, 1, "dropdown-toggle", null, classes_1, $1);
10391
- set_attribute(a, "aria-expanded", get(isOpen));
10392
- set_text(text2, entry().label);
10393
- },
10394
- [
10395
- () => ({ open: get(isOpen) }),
10396
- () => ({ active: get(isActive) })
10397
- ]
10398
- );
10399
- append($$anchor, li);
10400
- return pop({
10401
- get entry() {
10402
- return entry();
10403
- },
10404
- set entry($$value) {
10405
- entry($$value);
10406
- flushSync();
10407
- },
10408
- get id() {
10409
- return id();
10410
- },
10411
- set id($$value) {
10412
- id($$value);
10413
- flushSync();
10414
- }
10415
- });
9768
+ function $14e0f24ef4ac5c92$export$ea39ec197993aef0(a, b) {
9769
+ b = $11d87f3f76e88657$export$b4a036af3fc0b032(b, a.calendar);
9770
+ return a.era === b.era && a.year === b.year && a.month === b.month && a.day === b.day;
10416
9771
  }
10417
- delegate(["click"]);
10418
- create_custom_element(DropDown, { entry: {}, id: {} }, [], [], true);
10419
- var root_1$3 = /* @__PURE__ */ from_html(`<ul class="nav navbar-nav hidden-xs"></ul>`);
10420
- var root_7$1 = /* @__PURE__ */ from_html(`<ul class="nav navbar-nav"></ul>`);
10421
- function MainNav($$anchor, $$props) {
10422
- push($$props, true);
10423
- let nav = prop($$props, "nav", 7), mobile = prop($$props, "mobile", 7), expandMobileSubnavs = prop($$props, "expandMobileSubnavs", 7), currentPage = prop($$props, "currentPage", 7);
10424
- mobile(mobile() ?? false);
10425
- expandMobileSubnavs(expandMobileSubnavs() ?? false);
10426
- const mobileNav = /* @__PURE__ */ user_derived(() => [
10427
- ...nav().filter((e) => !(isNavItem(e) && e.label === "icon:home")),
10428
- "divider"
10429
- ]);
10430
- setOpenedDropdown();
10431
- setPageState();
10432
- const clickHandler = outsideClicksHandler();
10433
- user_effect(() => {
10434
- getPageState().currentPage = currentPage();
10435
- });
10436
- var fragment = comment();
10437
- var node = first_child(fragment);
10438
- {
10439
- var consequent_2 = ($$anchor2) => {
10440
- var ul = root_1$3();
10441
- each(ul, 21, nav, index, ($$anchor3, entry, index2) => {
10442
- var fragment_1 = comment();
10443
- var node_1 = first_child(fragment_1);
10444
- {
10445
- var consequent = ($$anchor4) => {
10446
- SingleNavEntry($$anchor4, {
10447
- get entry() {
10448
- return get(entry);
10449
- }
10450
- });
10451
- };
10452
- var alternate_1 = ($$anchor4) => {
10453
- var fragment_3 = comment();
10454
- var node_2 = first_child(fragment_3);
10455
- {
10456
- var consequent_1 = ($$anchor5) => {
10457
- DropDown($$anchor5, {
10458
- get entry() {
10459
- return get(entry);
10460
- },
10461
- id: index2
10462
- });
10463
- };
10464
- var alternate = ($$anchor5) => {
10465
- {
10466
- let $0 = /* @__PURE__ */ user_derived(() => ({ label: get(entry).label, url: get(entry).parentUrl }));
10467
- NavLink($$anchor5, {
10468
- get entry() {
10469
- return get($0);
10470
- }
10471
- });
10472
- }
10473
- };
10474
- if_block(
10475
- node_2,
10476
- ($$render) => {
10477
- var _a2;
10478
- if (((_a2 = get(entry).items) == null ? void 0 : _a2.length) > 0) $$render(consequent_1);
10479
- else $$render(alternate, false);
10480
- },
10481
- true
10482
- );
10483
- }
10484
- append($$anchor4, fragment_3);
10485
- };
10486
- if_block(node_1, ($$render) => {
10487
- if (isSingleNavEntry(get(entry))) $$render(consequent);
10488
- else $$render(alternate_1, false);
10489
- });
10490
- }
10491
- append($$anchor3, fragment_1);
10492
- });
10493
- reset(ul);
10494
- action(ul, ($$node) => clickHandler == null ? void 0 : clickHandler($$node));
10495
- append($$anchor2, ul);
10496
- };
10497
- var alternate_4 = ($$anchor2) => {
10498
- var ul_1 = root_7$1();
10499
- each(ul_1, 21, () => get(mobileNav), index, ($$anchor3, entry, index2) => {
10500
- var fragment_6 = comment();
10501
- var node_3 = first_child(fragment_6);
10502
- {
10503
- var consequent_3 = ($$anchor4) => {
10504
- SingleNavEntry($$anchor4, {
10505
- get entry() {
10506
- return get(entry);
10507
- }
10508
- });
10509
- };
10510
- var alternate_3 = ($$anchor4) => {
10511
- var fragment_8 = comment();
10512
- var node_4 = first_child(fragment_8);
10513
- {
10514
- var consequent_4 = ($$anchor5) => {
10515
- DropDown($$anchor5, {
10516
- get entry() {
10517
- return get(entry);
10518
- },
10519
- id: index2
10520
- });
10521
- };
10522
- var alternate_2 = ($$anchor5) => {
10523
- {
10524
- let $0 = /* @__PURE__ */ user_derived(() => ({ label: get(entry).label, url: get(entry).parentUrl }));
10525
- NavLink($$anchor5, {
10526
- get entry() {
10527
- return get($0);
10528
- }
10529
- });
10530
- }
10531
- };
10532
- if_block(
10533
- node_4,
10534
- ($$render) => {
10535
- var _a2;
10536
- if (expandMobileSubnavs() && ((_a2 = get(entry).items) == null ? void 0 : _a2.length) > 0) $$render(consequent_4);
10537
- else $$render(alternate_2, false);
10538
- },
10539
- true
10540
- );
10541
- }
10542
- append($$anchor4, fragment_8);
10543
- };
10544
- if_block(node_3, ($$render) => {
10545
- if (isSingleNavEntry(get(entry))) $$render(consequent_3);
10546
- else $$render(alternate_3, false);
10547
- });
10548
- }
10549
- append($$anchor3, fragment_6);
10550
- });
10551
- reset(ul_1);
10552
- append($$anchor2, ul_1);
10553
- };
10554
- if_block(node, ($$render) => {
10555
- if (!mobile()) $$render(consequent_2);
10556
- else $$render(alternate_4, false);
10557
- });
10558
- }
10559
- append($$anchor, fragment);
10560
- return pop({
10561
- get nav() {
10562
- return nav();
10563
- },
10564
- set nav($$value) {
10565
- nav($$value);
10566
- flushSync();
10567
- },
10568
- get mobile() {
10569
- return mobile();
10570
- },
10571
- set mobile($$value) {
10572
- mobile($$value);
10573
- flushSync();
10574
- },
10575
- get expandMobileSubnavs() {
10576
- return expandMobileSubnavs();
10577
- },
10578
- set expandMobileSubnavs($$value) {
10579
- expandMobileSubnavs($$value);
10580
- flushSync();
10581
- },
10582
- get currentPage() {
10583
- return currentPage();
10584
- },
10585
- set currentPage($$value) {
10586
- currentPage($$value);
10587
- flushSync();
10588
- }
10589
- });
9772
+ function $14e0f24ef4ac5c92$export$a18c89cbd24170ff(a, b) {
9773
+ b = $11d87f3f76e88657$export$b4a036af3fc0b032(b, a.calendar);
9774
+ a = $14e0f24ef4ac5c92$export$a5a3b454ada2268e(a);
9775
+ b = $14e0f24ef4ac5c92$export$a5a3b454ada2268e(b);
9776
+ return a.era === b.era && a.year === b.year && a.month === b.month;
10590
9777
  }
10591
- create_custom_element(
10592
- MainNav,
10593
- {
10594
- nav: {},
10595
- mobile: {},
10596
- expandMobileSubnavs: {},
10597
- currentPage: {}
10598
- },
10599
- [],
10600
- [],
10601
- true
10602
- );
10603
- var root_1$2 = /* @__PURE__ */ from_html(`<label class="svelte-sbq87r"> </label>`);
10604
- var root$2 = /* @__PURE__ */ from_html(`<div class="svelte-sbq87r"><!> <pre><!>
10605
- </pre></div>`);
10606
- const $$css = {
10607
- hash: "svelte-sbq87r",
10608
- code: "div.svelte-sbq87r {display:grid;}label.svelte-sbq87r {font-weight:bold;display:inline-block;}pre.svelte-sbq87r {margin-top:0.5rlh;padding:0;white-space:pre-wrap; /* CSS3: Wrap long lines */word-wrap:break-word; /* For legacy support */}"
10609
- };
10610
- function Log($$anchor, $$props) {
10611
- push($$props, true);
10612
- append_styles$1($$anchor, $$css);
10613
- let data = prop($$props, "data", 7), format = prop($$props, "format", 7, true), label = prop($$props, "label", 7, "");
10614
- var div = root$2();
10615
- var node = child(div);
10616
- {
10617
- var consequent = ($$anchor2) => {
10618
- var label_1 = root_1$2();
10619
- var text2 = child(label_1);
10620
- reset(label_1);
10621
- template_effect(() => set_text(text2, `${label() ?? ""}:`));
10622
- append($$anchor2, label_1);
10623
- };
10624
- if_block(node, ($$render) => {
10625
- if (label()) $$render(consequent);
10626
- });
10627
- }
10628
- var pre = sibling(node, 2);
10629
- let classes;
10630
- var node_1 = child(pre);
10631
- html(node_1, () => format() ? JSON.stringify(data(), null, 2) : JSON.stringify(data()));
10632
- next();
10633
- reset(pre);
10634
- reset(div);
10635
- template_effect(($0) => classes = set_class(pre, 1, "svelte-sbq87r", null, classes, $0), [() => ({ format: format() })]);
10636
- append($$anchor, div);
10637
- return pop({
10638
- get data() {
10639
- return data();
10640
- },
10641
- set data($$value) {
10642
- data($$value);
10643
- flushSync();
10644
- },
10645
- get format() {
10646
- return format();
10647
- },
10648
- set format($$value = true) {
10649
- format($$value);
10650
- flushSync();
10651
- },
10652
- get label() {
10653
- return label();
10654
- },
10655
- set label($$value = "") {
10656
- label($$value);
10657
- flushSync();
10658
- }
10659
- });
9778
+ function $14e0f24ef4ac5c92$export$dbc69fd56b53d5e(a, b) {
9779
+ var _a_isEqual, _b_isEqual;
9780
+ var _a_isEqual1, _ref;
9781
+ return (_ref = (_a_isEqual1 = (_a_isEqual = a.isEqual) === null || _a_isEqual === void 0 ? void 0 : _a_isEqual.call(a, b)) !== null && _a_isEqual1 !== void 0 ? _a_isEqual1 : (_b_isEqual = b.isEqual) === null || _b_isEqual === void 0 ? void 0 : _b_isEqual.call(b, a)) !== null && _ref !== void 0 ? _ref : a.identifier === b.identifier;
10660
9782
  }
10661
- create_custom_element(Log, { data: {}, format: {}, label: {} }, [], [], true);
10662
- function ConnectedMainNav($$anchor, $$props) {
10663
- push($$props, true);
10664
- let mobile = prop($$props, "mobile", 7), nav = prop($$props, "nav", 7), expandMobileSubnavs = prop($$props, "expandMobileSubnavs", 7), currentPage = prop($$props, "currentPage", 7);
10665
- currentPage(currentPage() || "shop.start");
10666
- let loadedNav = /* @__PURE__ */ state(proxy([]));
10667
- user_effect(() => {
10668
- nav();
10669
- (async () => {
10670
- await loadNav();
10671
- })();
10672
- });
10673
- async function loadNav() {
10674
- var _a2;
10675
- await shop.waitForAllFetches();
10676
- nav(nav() ?? []);
10677
- const navSettings = nav().length ? nav() : (_a2 = shop.settings) == null ? void 0 : _a2.mainNav;
10678
- generateNavigation(navSettings);
10679
- await shop.waitForAllFetches();
10680
- set(loadedNav, generateNavigation(navSettings), true);
10681
- }
10682
- MainNav($$anchor, {
10683
- get nav() {
10684
- return get(loadedNav);
10685
- },
10686
- get mobile() {
10687
- return mobile();
10688
- },
10689
- get expandMobileSubnavs() {
10690
- return expandMobileSubnavs();
10691
- },
10692
- get currentPage() {
10693
- return currentPage();
10694
- }
10695
- });
10696
- return pop({
10697
- get mobile() {
10698
- return mobile();
10699
- },
10700
- set mobile($$value) {
10701
- mobile($$value);
10702
- flushSync();
10703
- },
10704
- get nav() {
10705
- return nav();
10706
- },
10707
- set nav($$value) {
10708
- nav($$value);
10709
- flushSync();
10710
- },
10711
- get expandMobileSubnavs() {
10712
- return expandMobileSubnavs();
10713
- },
10714
- set expandMobileSubnavs($$value) {
10715
- expandMobileSubnavs($$value);
10716
- flushSync();
10717
- },
10718
- get currentPage() {
10719
- return currentPage();
10720
- },
10721
- set currentPage($$value) {
10722
- currentPage($$value);
10723
- flushSync();
10724
- }
10725
- });
9783
+ function $14e0f24ef4ac5c92$export$629b0a497aa65267(date, timeZone) {
9784
+ return $14e0f24ef4ac5c92$export$ea39ec197993aef0(date, $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3(timeZone));
10726
9785
  }
10727
- customElements.define("go-mainnav", create_custom_element(
10728
- ConnectedMainNav,
10729
- {
10730
- mobile: { attribute: "mobile", type: "Boolean" },
10731
- nav: { attribute: "nav", type: "Object" },
10732
- expandMobileSubnavs: { attribute: "expand-mobile-subnavs", type: "Boolean" },
10733
- currentPage: { attribute: "current-page", type: "String" }
10734
- },
10735
- [],
10736
- [],
10737
- false
10738
- ));
10739
- class config {
10740
- // init(apiUrl: string, etc...) {}
10741
- // config(options) {}
9786
+ function $14e0f24ef4ac5c92$export$2061056d06d7cdf7(date, locale, firstDayOfWeek) {
9787
+ let julian = date.calendar.toJulianDay(date);
9788
+ let weekStart = $14e0f24ef4ac5c92$var$getWeekStart(locale);
9789
+ let dayOfWeek = Math.ceil(julian + 1 - weekStart) % 7;
9790
+ if (dayOfWeek < 0) dayOfWeek += 7;
9791
+ return dayOfWeek;
10742
9792
  }
10743
- window.go = new config();
10744
- function createSetDetails(KEY2) {
10745
- return function(host, details) {
10746
- if (host) {
10747
- host.addEventListener(KEY2, (e) => {
10748
- e.detail.data = details;
10749
- });
10750
- }
10751
- setContext(KEY2, details);
10752
- };
9793
+ function $14e0f24ef4ac5c92$export$461939dd4422153(timeZone) {
9794
+ return $11d87f3f76e88657$export$1b96692a1ba042ac(Date.now(), timeZone);
10753
9795
  }
10754
- function createGetDetails(KEY2) {
10755
- return function(host) {
10756
- if (host) {
10757
- const container = proxy({ data: void 0 });
10758
- host.dispatchEvent(new CustomEvent(KEY2, { detail: container, bubbles: true }));
10759
- return container.data;
10760
- } else {
10761
- return getContext(KEY2);
10762
- }
10763
- };
9796
+ function $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3(timeZone) {
9797
+ return $11d87f3f76e88657$export$93522d1a439f3617($14e0f24ef4ac5c92$export$461939dd4422153(timeZone));
10764
9798
  }
10765
- class TicketSelectionDetails {
10766
- constructor() {
10767
- __privateAdd(this, _mode, /* @__PURE__ */ state());
10768
- __privateAdd(this, _filters, /* @__PURE__ */ state());
10769
- __privateAdd(this, _eventId, /* @__PURE__ */ state());
10770
- __privateAdd(this, _museumIds, /* @__PURE__ */ state());
10771
- __privateAdd(this, _selectedDate, /* @__PURE__ */ state());
10772
- __privateAdd(this, _selectedTimeslot, /* @__PURE__ */ state());
10773
- __privateAdd(this, _selectedTickets, /* @__PURE__ */ state(proxy([])));
10774
- }
10775
- get mode() {
10776
- return get(__privateGet(this, _mode));
10777
- }
10778
- set mode(value) {
10779
- set(__privateGet(this, _mode), value, true);
10780
- }
10781
- get filters() {
10782
- return get(__privateGet(this, _filters));
10783
- }
10784
- set filters(value) {
10785
- set(__privateGet(this, _filters), value, true);
10786
- }
10787
- get eventId() {
10788
- return get(__privateGet(this, _eventId));
10789
- }
10790
- set eventId(value) {
10791
- set(__privateGet(this, _eventId), value, true);
10792
- }
10793
- get museumIds() {
10794
- return get(__privateGet(this, _museumIds));
10795
- }
10796
- set museumIds(value) {
10797
- set(__privateGet(this, _museumIds), value, true);
10798
- }
10799
- get selectedDate() {
10800
- return get(__privateGet(this, _selectedDate));
10801
- }
10802
- set selectedDate(value) {
10803
- set(__privateGet(this, _selectedDate), value, true);
10804
- }
10805
- get selectedTimeslot() {
10806
- return get(__privateGet(this, _selectedTimeslot));
10807
- }
10808
- set selectedTimeslot(value) {
10809
- set(__privateGet(this, _selectedTimeslot), value, true);
10810
- }
10811
- get selectedTickets() {
10812
- return get(__privateGet(this, _selectedTickets));
10813
- }
10814
- set selectedTickets(value) {
10815
- set(__privateGet(this, _selectedTickets), value, true);
10816
- }
10817
- get selectedClasses() {
10818
- return [
10819
- this.selectedDate && "is-date-selected",
10820
- this.selectedTimeslot && "is-timeslot-selected",
10821
- this.selectedTickets.length && "is-tickets-selected"
10822
- ].filter(Boolean).join(" ");
9799
+ function $14e0f24ef4ac5c92$export$68781ddf31c0090f(a, b) {
9800
+ return a.calendar.toJulianDay(a) - b.calendar.toJulianDay(b);
9801
+ }
9802
+ function $14e0f24ef4ac5c92$export$c19a80a9721b80f6(a, b) {
9803
+ return $14e0f24ef4ac5c92$var$timeToMs(a) - $14e0f24ef4ac5c92$var$timeToMs(b);
9804
+ }
9805
+ function $14e0f24ef4ac5c92$var$timeToMs(a) {
9806
+ return a.hour * 36e5 + a.minute * 6e4 + a.second * 1e3 + a.millisecond;
9807
+ }
9808
+ let $14e0f24ef4ac5c92$var$localTimeZone = null;
9809
+ function $14e0f24ef4ac5c92$export$aa8b41735afcabd2() {
9810
+ if ($14e0f24ef4ac5c92$var$localTimeZone == null) $14e0f24ef4ac5c92$var$localTimeZone = new Intl.DateTimeFormat().resolvedOptions().timeZone;
9811
+ return $14e0f24ef4ac5c92$var$localTimeZone;
9812
+ }
9813
+ function $14e0f24ef4ac5c92$export$a5a3b454ada2268e(date) {
9814
+ return date.subtract({
9815
+ days: date.day - 1
9816
+ });
9817
+ }
9818
+ function $14e0f24ef4ac5c92$export$a2258d9c4118825c(date) {
9819
+ return date.add({
9820
+ days: date.calendar.getDaysInMonth(date) - date.day
9821
+ });
9822
+ }
9823
+ const $14e0f24ef4ac5c92$var$cachedRegions = /* @__PURE__ */ new Map();
9824
+ function $14e0f24ef4ac5c92$var$getRegion(locale) {
9825
+ if (Intl.Locale) {
9826
+ let region = $14e0f24ef4ac5c92$var$cachedRegions.get(locale);
9827
+ if (!region) {
9828
+ region = new Intl.Locale(locale).maximize().region;
9829
+ if (region) $14e0f24ef4ac5c92$var$cachedRegions.set(locale, region);
9830
+ }
9831
+ return region;
10823
9832
  }
9833
+ let part = locale.split("-")[1];
9834
+ return part === "u" ? void 0 : part;
10824
9835
  }
10825
- _mode = new WeakMap();
10826
- _filters = new WeakMap();
10827
- _eventId = new WeakMap();
10828
- _museumIds = new WeakMap();
10829
- _selectedDate = new WeakMap();
10830
- _selectedTimeslot = new WeakMap();
10831
- _selectedTickets = new WeakMap();
10832
- const KEY = "go-ticket-selection";
10833
- const setTicketSelectionDetails = createSetDetails(KEY);
10834
- const getTicketSelectionDetails = createGetDetails(KEY);
10835
- function $2b4dce13dd5a17fa$export$842a2cf37af977e1(amount, numerator) {
10836
- return amount - numerator * Math.floor(amount / numerator);
9836
+ function $14e0f24ef4ac5c92$var$getWeekStart(locale) {
9837
+ let region = $14e0f24ef4ac5c92$var$getRegion(locale);
9838
+ return region ? $2fe286d2fb449abb$export$7a5acbd77d414bd9[region] || 0 : 0;
10837
9839
  }
10838
- const $3b62074eb05584b2$var$EPOCH = 1721426;
10839
- function $3b62074eb05584b2$export$f297eb839006d339(era, year, month, day) {
10840
- year = $3b62074eb05584b2$export$c36e0ecb2d4fa69d(era, year);
10841
- let y1 = year - 1;
10842
- let monthOffset = -2;
10843
- if (month <= 2) monthOffset = 0;
10844
- else if ($3b62074eb05584b2$export$553d7fa8e3805fc0(year)) monthOffset = -1;
10845
- return $3b62074eb05584b2$var$EPOCH - 1 + 365 * y1 + Math.floor(y1 / 4) - Math.floor(y1 / 100) + Math.floor(y1 / 400) + Math.floor((367 * month - 362) / 12 + monthOffset + day);
9840
+ function $11d87f3f76e88657$export$bd4fb2bc8bb06fb(date) {
9841
+ date = $11d87f3f76e88657$export$b4a036af3fc0b032(date, new $3b62074eb05584b2$export$80ee6245ec4f29ec());
9842
+ let year = $3b62074eb05584b2$export$c36e0ecb2d4fa69d(date.era, date.year);
9843
+ return $11d87f3f76e88657$var$epochFromParts(year, date.month, date.day, date.hour, date.minute, date.second, date.millisecond);
10846
9844
  }
10847
- function $3b62074eb05584b2$export$553d7fa8e3805fc0(year) {
10848
- return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
9845
+ function $11d87f3f76e88657$var$epochFromParts(year, month, day, hour, minute, second, millisecond) {
9846
+ let date = /* @__PURE__ */ new Date();
9847
+ date.setUTCHours(hour, minute, second, millisecond);
9848
+ date.setUTCFullYear(year, month - 1, day);
9849
+ return date.getTime();
10849
9850
  }
10850
- function $3b62074eb05584b2$export$c36e0ecb2d4fa69d(era, year) {
10851
- return era === "BC" ? 1 - year : year;
9851
+ function $11d87f3f76e88657$export$59c99f3515d3493f(ms, timeZone) {
9852
+ if (timeZone === "UTC") return 0;
9853
+ if (ms > 0 && timeZone === $14e0f24ef4ac5c92$export$aa8b41735afcabd2()) return new Date(ms).getTimezoneOffset() * -6e4;
9854
+ let { year, month, day, hour, minute, second } = $11d87f3f76e88657$var$getTimeZoneParts(ms, timeZone);
9855
+ let utc = $11d87f3f76e88657$var$epochFromParts(year, month, day, hour, minute, second, 0);
9856
+ return utc - Math.floor(ms / 1e3) * 1e3;
10852
9857
  }
10853
- function $3b62074eb05584b2$export$4475b7e617eb123c(year) {
10854
- let era = "AD";
10855
- if (year <= 0) {
10856
- era = "BC";
10857
- year = 1 - year;
9858
+ const $11d87f3f76e88657$var$formattersByTimeZone = /* @__PURE__ */ new Map();
9859
+ function $11d87f3f76e88657$var$getTimeZoneParts(ms, timeZone) {
9860
+ let formatter = $11d87f3f76e88657$var$formattersByTimeZone.get(timeZone);
9861
+ if (!formatter) {
9862
+ formatter = new Intl.DateTimeFormat("en-US", {
9863
+ timeZone,
9864
+ hour12: false,
9865
+ era: "short",
9866
+ year: "numeric",
9867
+ month: "numeric",
9868
+ day: "numeric",
9869
+ hour: "numeric",
9870
+ minute: "numeric",
9871
+ second: "numeric"
9872
+ });
9873
+ $11d87f3f76e88657$var$formattersByTimeZone.set(timeZone, formatter);
10858
9874
  }
10859
- return [
10860
- era,
10861
- year
9875
+ let parts = formatter.formatToParts(new Date(ms));
9876
+ let namedParts = {};
9877
+ for (let part of parts) if (part.type !== "literal") namedParts[part.type] = part.value;
9878
+ return {
9879
+ // Firefox returns B instead of BC... https://bugzilla.mozilla.org/show_bug.cgi?id=1752253
9880
+ year: namedParts.era === "BC" || namedParts.era === "B" ? -namedParts.year + 1 : +namedParts.year,
9881
+ month: +namedParts.month,
9882
+ day: +namedParts.day,
9883
+ hour: namedParts.hour === "24" ? 0 : +namedParts.hour,
9884
+ minute: +namedParts.minute,
9885
+ second: +namedParts.second
9886
+ };
9887
+ }
9888
+ const $11d87f3f76e88657$var$DAYMILLIS = 864e5;
9889
+ function $11d87f3f76e88657$export$136f38efe7caf549(date, timeZone) {
9890
+ let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(date);
9891
+ let earlier = ms - $11d87f3f76e88657$export$59c99f3515d3493f(ms - $11d87f3f76e88657$var$DAYMILLIS, timeZone);
9892
+ let later = ms - $11d87f3f76e88657$export$59c99f3515d3493f(ms + $11d87f3f76e88657$var$DAYMILLIS, timeZone);
9893
+ return $11d87f3f76e88657$var$getValidWallTimes(date, timeZone, earlier, later);
9894
+ }
9895
+ function $11d87f3f76e88657$var$getValidWallTimes(date, timeZone, earlier, later) {
9896
+ let found = earlier === later ? [
9897
+ earlier
9898
+ ] : [
9899
+ earlier,
9900
+ later
10862
9901
  ];
9902
+ return found.filter((absolute) => $11d87f3f76e88657$var$isValidWallTime(date, timeZone, absolute));
10863
9903
  }
10864
- const $3b62074eb05584b2$var$daysInMonth = {
10865
- standard: [
10866
- 31,
10867
- 28,
10868
- 31,
10869
- 30,
10870
- 31,
10871
- 30,
10872
- 31,
10873
- 31,
10874
- 30,
10875
- 31,
10876
- 30,
10877
- 31
10878
- ],
10879
- leapyear: [
10880
- 31,
10881
- 29,
10882
- 31,
10883
- 30,
10884
- 31,
10885
- 30,
10886
- 31,
10887
- 31,
10888
- 30,
10889
- 31,
10890
- 30,
10891
- 31
10892
- ]
10893
- };
10894
- class $3b62074eb05584b2$export$80ee6245ec4f29ec {
10895
- fromJulianDay(jd) {
10896
- let jd0 = jd;
10897
- let depoch = jd0 - $3b62074eb05584b2$var$EPOCH;
10898
- let quadricent = Math.floor(depoch / 146097);
10899
- let dqc = $2b4dce13dd5a17fa$export$842a2cf37af977e1(depoch, 146097);
10900
- let cent = Math.floor(dqc / 36524);
10901
- let dcent = $2b4dce13dd5a17fa$export$842a2cf37af977e1(dqc, 36524);
10902
- let quad = Math.floor(dcent / 1461);
10903
- let dquad = $2b4dce13dd5a17fa$export$842a2cf37af977e1(dcent, 1461);
10904
- let yindex = Math.floor(dquad / 365);
10905
- let extendedYear = quadricent * 400 + cent * 100 + quad * 4 + yindex + (cent !== 4 && yindex !== 4 ? 1 : 0);
10906
- let [era, year] = $3b62074eb05584b2$export$4475b7e617eb123c(extendedYear);
10907
- let yearDay = jd0 - $3b62074eb05584b2$export$f297eb839006d339(era, year, 1, 1);
10908
- let leapAdj = 2;
10909
- if (jd0 < $3b62074eb05584b2$export$f297eb839006d339(era, year, 3, 1)) leapAdj = 0;
10910
- else if ($3b62074eb05584b2$export$553d7fa8e3805fc0(year)) leapAdj = 1;
10911
- let month = Math.floor(((yearDay + leapAdj) * 12 + 373) / 367);
10912
- let day = jd0 - $3b62074eb05584b2$export$f297eb839006d339(era, year, month, 1) + 1;
10913
- return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(era, year, month, day);
9904
+ function $11d87f3f76e88657$var$isValidWallTime(date, timeZone, absolute) {
9905
+ let parts = $11d87f3f76e88657$var$getTimeZoneParts(absolute, timeZone);
9906
+ return date.year === parts.year && date.month === parts.month && date.day === parts.day && date.hour === parts.hour && date.minute === parts.minute && date.second === parts.second;
9907
+ }
9908
+ function $11d87f3f76e88657$export$5107c82f94518f5c(date, timeZone, disambiguation = "compatible") {
9909
+ let dateTime = $11d87f3f76e88657$export$b21e0b124e224484(date);
9910
+ if (timeZone === "UTC") return $11d87f3f76e88657$export$bd4fb2bc8bb06fb(dateTime);
9911
+ if (timeZone === $14e0f24ef4ac5c92$export$aa8b41735afcabd2() && disambiguation === "compatible") {
9912
+ dateTime = $11d87f3f76e88657$export$b4a036af3fc0b032(dateTime, new $3b62074eb05584b2$export$80ee6245ec4f29ec());
9913
+ let date2 = /* @__PURE__ */ new Date();
9914
+ let year = $3b62074eb05584b2$export$c36e0ecb2d4fa69d(dateTime.era, dateTime.year);
9915
+ date2.setFullYear(year, dateTime.month - 1, dateTime.day);
9916
+ date2.setHours(dateTime.hour, dateTime.minute, dateTime.second, dateTime.millisecond);
9917
+ return date2.getTime();
10914
9918
  }
10915
- toJulianDay(date) {
10916
- return $3b62074eb05584b2$export$f297eb839006d339(date.era, date.year, date.month, date.day);
9919
+ let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(dateTime);
9920
+ let offsetBefore = $11d87f3f76e88657$export$59c99f3515d3493f(ms - $11d87f3f76e88657$var$DAYMILLIS, timeZone);
9921
+ let offsetAfter = $11d87f3f76e88657$export$59c99f3515d3493f(ms + $11d87f3f76e88657$var$DAYMILLIS, timeZone);
9922
+ let valid = $11d87f3f76e88657$var$getValidWallTimes(dateTime, timeZone, ms - offsetBefore, ms - offsetAfter);
9923
+ if (valid.length === 1) return valid[0];
9924
+ if (valid.length > 1) switch (disambiguation) {
9925
+ // 'compatible' means 'earlier' for "fall back" transitions
9926
+ case "compatible":
9927
+ case "earlier":
9928
+ return valid[0];
9929
+ case "later":
9930
+ return valid[valid.length - 1];
9931
+ case "reject":
9932
+ throw new RangeError("Multiple possible absolute times found");
10917
9933
  }
10918
- getDaysInMonth(date) {
10919
- return $3b62074eb05584b2$var$daysInMonth[$3b62074eb05584b2$export$553d7fa8e3805fc0(date.year) ? "leapyear" : "standard"][date.month - 1];
9934
+ switch (disambiguation) {
9935
+ case "earlier":
9936
+ return Math.min(ms - offsetBefore, ms - offsetAfter);
9937
+ // 'compatible' means 'later' for "spring forward" transitions
9938
+ case "compatible":
9939
+ case "later":
9940
+ return Math.max(ms - offsetBefore, ms - offsetAfter);
9941
+ case "reject":
9942
+ throw new RangeError("No such absolute time found");
10920
9943
  }
10921
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
10922
- getMonthsInYear(date) {
10923
- return 12;
9944
+ }
9945
+ function $11d87f3f76e88657$export$e67a095c620b86fe(dateTime, timeZone, disambiguation = "compatible") {
9946
+ return new Date($11d87f3f76e88657$export$5107c82f94518f5c(dateTime, timeZone, disambiguation));
9947
+ }
9948
+ function $11d87f3f76e88657$export$1b96692a1ba042ac(ms, timeZone) {
9949
+ let offset = $11d87f3f76e88657$export$59c99f3515d3493f(ms, timeZone);
9950
+ let date = new Date(ms + offset);
9951
+ let year = date.getUTCFullYear();
9952
+ let month = date.getUTCMonth() + 1;
9953
+ let day = date.getUTCDate();
9954
+ let hour = date.getUTCHours();
9955
+ let minute = date.getUTCMinutes();
9956
+ let second = date.getUTCSeconds();
9957
+ let millisecond = date.getUTCMilliseconds();
9958
+ return new $35ea8db9cb2ccb90$export$d3b7288e7994edea(year < 1 ? "BC" : "AD", year < 1 ? -year + 1 : year, month, day, timeZone, offset, hour, minute, second, millisecond);
9959
+ }
9960
+ function $11d87f3f76e88657$export$93522d1a439f3617(dateTime) {
9961
+ return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(dateTime.calendar, dateTime.era, dateTime.year, dateTime.month, dateTime.day);
9962
+ }
9963
+ function $11d87f3f76e88657$export$b21e0b124e224484(date, time) {
9964
+ let hour = 0, minute = 0, second = 0, millisecond = 0;
9965
+ if ("timeZone" in date) ({ hour, minute, second, millisecond } = date);
9966
+ else if ("hour" in date && !time) return date;
9967
+ if (time) ({ hour, minute, second, millisecond } = time);
9968
+ return new $35ea8db9cb2ccb90$export$ca871e8dbb80966f(date.calendar, date.era, date.year, date.month, date.day, hour, minute, second, millisecond);
9969
+ }
9970
+ function $11d87f3f76e88657$export$d33f79e3ffc3dc83(dateTime) {
9971
+ return new $35ea8db9cb2ccb90$export$680ea196effce5f(dateTime.hour, dateTime.minute, dateTime.second, dateTime.millisecond);
9972
+ }
9973
+ function $11d87f3f76e88657$export$b4a036af3fc0b032(date, calendar) {
9974
+ if ($14e0f24ef4ac5c92$export$dbc69fd56b53d5e(date.calendar, calendar)) return date;
9975
+ let calendarDate = calendar.fromJulianDay(date.calendar.toJulianDay(date));
9976
+ let copy = date.copy();
9977
+ copy.calendar = calendar;
9978
+ copy.era = calendarDate.era;
9979
+ copy.year = calendarDate.year;
9980
+ copy.month = calendarDate.month;
9981
+ copy.day = calendarDate.day;
9982
+ $735220c2d4774dd3$export$c4e2ecac49351ef2(copy);
9983
+ return copy;
9984
+ }
9985
+ function $11d87f3f76e88657$export$84c95a83c799e074(date, timeZone, disambiguation) {
9986
+ if (date instanceof $35ea8db9cb2ccb90$export$d3b7288e7994edea) {
9987
+ if (date.timeZone === timeZone) return date;
9988
+ return $11d87f3f76e88657$export$538b00033cc11c75(date, timeZone);
10924
9989
  }
10925
- getDaysInYear(date) {
10926
- return $3b62074eb05584b2$export$553d7fa8e3805fc0(date.year) ? 366 : 365;
9990
+ let ms = $11d87f3f76e88657$export$5107c82f94518f5c(date, timeZone, disambiguation);
9991
+ return $11d87f3f76e88657$export$1b96692a1ba042ac(ms, timeZone);
9992
+ }
9993
+ function $11d87f3f76e88657$export$83aac07b4c37b25(date) {
9994
+ let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(date) - date.offset;
9995
+ return new Date(ms);
9996
+ }
9997
+ function $11d87f3f76e88657$export$538b00033cc11c75(date, timeZone) {
9998
+ let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(date) - date.offset;
9999
+ return $11d87f3f76e88657$export$b4a036af3fc0b032($11d87f3f76e88657$export$1b96692a1ba042ac(ms, timeZone), date.calendar);
10000
+ }
10001
+ const $735220c2d4774dd3$var$ONE_HOUR = 36e5;
10002
+ function $735220c2d4774dd3$export$e16d8520af44a096(date, duration) {
10003
+ let mutableDate = date.copy();
10004
+ let days = "hour" in mutableDate ? $735220c2d4774dd3$var$addTimeFields(mutableDate, duration) : 0;
10005
+ $735220c2d4774dd3$var$addYears(mutableDate, duration.years || 0);
10006
+ if (mutableDate.calendar.balanceYearMonth) mutableDate.calendar.balanceYearMonth(mutableDate, date);
10007
+ mutableDate.month += duration.months || 0;
10008
+ $735220c2d4774dd3$var$balanceYearMonth(mutableDate);
10009
+ $735220c2d4774dd3$var$constrainMonthDay(mutableDate);
10010
+ mutableDate.day += (duration.weeks || 0) * 7;
10011
+ mutableDate.day += duration.days || 0;
10012
+ mutableDate.day += days;
10013
+ $735220c2d4774dd3$var$balanceDay(mutableDate);
10014
+ if (mutableDate.calendar.balanceDate) mutableDate.calendar.balanceDate(mutableDate);
10015
+ if (mutableDate.year < 1) {
10016
+ mutableDate.year = 1;
10017
+ mutableDate.month = 1;
10018
+ mutableDate.day = 1;
10927
10019
  }
10928
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
10929
- getYearsInEra(date) {
10930
- return 9999;
10020
+ let maxYear = mutableDate.calendar.getYearsInEra(mutableDate);
10021
+ if (mutableDate.year > maxYear) {
10022
+ var _mutableDate_calendar_isInverseEra, _mutableDate_calendar;
10023
+ let isInverseEra = (_mutableDate_calendar_isInverseEra = (_mutableDate_calendar = mutableDate.calendar).isInverseEra) === null || _mutableDate_calendar_isInverseEra === void 0 ? void 0 : _mutableDate_calendar_isInverseEra.call(_mutableDate_calendar, mutableDate);
10024
+ mutableDate.year = maxYear;
10025
+ mutableDate.month = isInverseEra ? 1 : mutableDate.calendar.getMonthsInYear(mutableDate);
10026
+ mutableDate.day = isInverseEra ? 1 : mutableDate.calendar.getDaysInMonth(mutableDate);
10931
10027
  }
10932
- getEras() {
10933
- return [
10934
- "BC",
10935
- "AD"
10936
- ];
10028
+ if (mutableDate.month < 1) {
10029
+ mutableDate.month = 1;
10030
+ mutableDate.day = 1;
10937
10031
  }
10938
- isInverseEra(date) {
10939
- return date.era === "BC";
10032
+ let maxMonth = mutableDate.calendar.getMonthsInYear(mutableDate);
10033
+ if (mutableDate.month > maxMonth) {
10034
+ mutableDate.month = maxMonth;
10035
+ mutableDate.day = mutableDate.calendar.getDaysInMonth(mutableDate);
10940
10036
  }
10941
- balanceDate(date) {
10942
- if (date.year <= 0) {
10943
- date.era = date.era === "BC" ? "AD" : "BC";
10944
- date.year = 1 - date.year;
10945
- }
10037
+ mutableDate.day = Math.max(1, Math.min(mutableDate.calendar.getDaysInMonth(mutableDate), mutableDate.day));
10038
+ return mutableDate;
10039
+ }
10040
+ function $735220c2d4774dd3$var$addYears(date, years) {
10041
+ var _date_calendar_isInverseEra, _date_calendar;
10042
+ if ((_date_calendar_isInverseEra = (_date_calendar = date.calendar).isInverseEra) === null || _date_calendar_isInverseEra === void 0 ? void 0 : _date_calendar_isInverseEra.call(_date_calendar, date)) years = -years;
10043
+ date.year += years;
10044
+ }
10045
+ function $735220c2d4774dd3$var$balanceYearMonth(date) {
10046
+ while (date.month < 1) {
10047
+ $735220c2d4774dd3$var$addYears(date, -1);
10048
+ date.month += date.calendar.getMonthsInYear(date);
10946
10049
  }
10947
- constructor() {
10948
- this.identifier = "gregory";
10050
+ let monthsInYear = 0;
10051
+ while (date.month > (monthsInYear = date.calendar.getMonthsInYear(date))) {
10052
+ date.month -= monthsInYear;
10053
+ $735220c2d4774dd3$var$addYears(date, 1);
10949
10054
  }
10950
10055
  }
10951
- const $2fe286d2fb449abb$export$7a5acbd77d414bd9 = {
10952
- "001": 1,
10953
- AD: 1,
10954
- AE: 6,
10955
- AF: 6,
10956
- AI: 1,
10957
- AL: 1,
10958
- AM: 1,
10959
- AN: 1,
10960
- AR: 1,
10961
- AT: 1,
10962
- AU: 1,
10963
- AX: 1,
10964
- AZ: 1,
10965
- BA: 1,
10966
- BE: 1,
10967
- BG: 1,
10968
- BH: 6,
10969
- BM: 1,
10970
- BN: 1,
10971
- BY: 1,
10972
- CH: 1,
10973
- CL: 1,
10974
- CM: 1,
10975
- CN: 1,
10976
- CR: 1,
10977
- CY: 1,
10978
- CZ: 1,
10979
- DE: 1,
10980
- DJ: 6,
10981
- DK: 1,
10982
- DZ: 6,
10983
- EC: 1,
10984
- EE: 1,
10985
- EG: 6,
10986
- ES: 1,
10987
- FI: 1,
10988
- FJ: 1,
10989
- FO: 1,
10990
- FR: 1,
10991
- GB: 1,
10992
- GE: 1,
10993
- GF: 1,
10994
- GP: 1,
10995
- GR: 1,
10996
- HR: 1,
10997
- HU: 1,
10998
- IE: 1,
10999
- IQ: 6,
11000
- IR: 6,
11001
- IS: 1,
11002
- IT: 1,
11003
- JO: 6,
11004
- KG: 1,
11005
- KW: 6,
11006
- KZ: 1,
11007
- LB: 1,
11008
- LI: 1,
11009
- LK: 1,
11010
- LT: 1,
11011
- LU: 1,
11012
- LV: 1,
11013
- LY: 6,
11014
- MC: 1,
11015
- MD: 1,
11016
- ME: 1,
11017
- MK: 1,
11018
- MN: 1,
11019
- MQ: 1,
11020
- MV: 5,
11021
- MY: 1,
11022
- NL: 1,
11023
- NO: 1,
11024
- NZ: 1,
11025
- OM: 6,
11026
- PL: 1,
11027
- QA: 6,
11028
- RE: 1,
11029
- RO: 1,
11030
- RS: 1,
11031
- RU: 1,
11032
- SD: 6,
11033
- SE: 1,
11034
- SI: 1,
11035
- SK: 1,
11036
- SM: 1,
11037
- SY: 6,
11038
- TJ: 1,
11039
- TM: 1,
11040
- TR: 1,
11041
- UA: 1,
11042
- UY: 1,
11043
- UZ: 1,
11044
- VA: 1,
11045
- VN: 1,
11046
- XK: 1
11047
- };
11048
- function $14e0f24ef4ac5c92$export$ea39ec197993aef0(a, b) {
11049
- b = $11d87f3f76e88657$export$b4a036af3fc0b032(b, a.calendar);
11050
- return a.era === b.era && a.year === b.year && a.month === b.month && a.day === b.day;
10056
+ function $735220c2d4774dd3$var$balanceDay(date) {
10057
+ while (date.day < 1) {
10058
+ date.month--;
10059
+ $735220c2d4774dd3$var$balanceYearMonth(date);
10060
+ date.day += date.calendar.getDaysInMonth(date);
10061
+ }
10062
+ while (date.day > date.calendar.getDaysInMonth(date)) {
10063
+ date.day -= date.calendar.getDaysInMonth(date);
10064
+ date.month++;
10065
+ $735220c2d4774dd3$var$balanceYearMonth(date);
10066
+ }
11051
10067
  }
11052
- function $14e0f24ef4ac5c92$export$a18c89cbd24170ff(a, b) {
11053
- b = $11d87f3f76e88657$export$b4a036af3fc0b032(b, a.calendar);
11054
- a = $14e0f24ef4ac5c92$export$a5a3b454ada2268e(a);
11055
- b = $14e0f24ef4ac5c92$export$a5a3b454ada2268e(b);
11056
- return a.era === b.era && a.year === b.year && a.month === b.month;
10068
+ function $735220c2d4774dd3$var$constrainMonthDay(date) {
10069
+ date.month = Math.max(1, Math.min(date.calendar.getMonthsInYear(date), date.month));
10070
+ date.day = Math.max(1, Math.min(date.calendar.getDaysInMonth(date), date.day));
11057
10071
  }
11058
- function $14e0f24ef4ac5c92$export$dbc69fd56b53d5e(a, b) {
11059
- var _a_isEqual, _b_isEqual;
11060
- var _a_isEqual1, _ref;
11061
- return (_ref = (_a_isEqual1 = (_a_isEqual = a.isEqual) === null || _a_isEqual === void 0 ? void 0 : _a_isEqual.call(a, b)) !== null && _a_isEqual1 !== void 0 ? _a_isEqual1 : (_b_isEqual = b.isEqual) === null || _b_isEqual === void 0 ? void 0 : _b_isEqual.call(b, a)) !== null && _ref !== void 0 ? _ref : a.identifier === b.identifier;
10072
+ function $735220c2d4774dd3$export$c4e2ecac49351ef2(date) {
10073
+ if (date.calendar.constrainDate) date.calendar.constrainDate(date);
10074
+ date.year = Math.max(1, Math.min(date.calendar.getYearsInEra(date), date.year));
10075
+ $735220c2d4774dd3$var$constrainMonthDay(date);
11062
10076
  }
11063
- function $14e0f24ef4ac5c92$export$629b0a497aa65267(date, timeZone) {
11064
- return $14e0f24ef4ac5c92$export$ea39ec197993aef0(date, $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3(timeZone));
10077
+ function $735220c2d4774dd3$export$3e2544e88a25bff8(duration) {
10078
+ let inverseDuration = {};
10079
+ for (let key in duration) if (typeof duration[key] === "number") inverseDuration[key] = -duration[key];
10080
+ return inverseDuration;
11065
10081
  }
11066
- function $14e0f24ef4ac5c92$export$2061056d06d7cdf7(date, locale, firstDayOfWeek) {
11067
- let julian = date.calendar.toJulianDay(date);
11068
- let weekStart = $14e0f24ef4ac5c92$var$getWeekStart(locale);
11069
- let dayOfWeek = Math.ceil(julian + 1 - weekStart) % 7;
11070
- if (dayOfWeek < 0) dayOfWeek += 7;
11071
- return dayOfWeek;
10082
+ function $735220c2d4774dd3$export$4e2d2ead65e5f7e3(date, duration) {
10083
+ return $735220c2d4774dd3$export$e16d8520af44a096(date, $735220c2d4774dd3$export$3e2544e88a25bff8(duration));
11072
10084
  }
11073
- function $14e0f24ef4ac5c92$export$461939dd4422153(timeZone) {
11074
- return $11d87f3f76e88657$export$1b96692a1ba042ac(Date.now(), timeZone);
10085
+ function $735220c2d4774dd3$export$adaa4cf7ef1b65be(date, fields) {
10086
+ let mutableDate = date.copy();
10087
+ if (fields.era != null) mutableDate.era = fields.era;
10088
+ if (fields.year != null) mutableDate.year = fields.year;
10089
+ if (fields.month != null) mutableDate.month = fields.month;
10090
+ if (fields.day != null) mutableDate.day = fields.day;
10091
+ $735220c2d4774dd3$export$c4e2ecac49351ef2(mutableDate);
10092
+ return mutableDate;
11075
10093
  }
11076
- function $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3(timeZone) {
11077
- return $11d87f3f76e88657$export$93522d1a439f3617($14e0f24ef4ac5c92$export$461939dd4422153(timeZone));
10094
+ function $735220c2d4774dd3$export$e5d5e1c1822b6e56(value, fields) {
10095
+ let mutableValue = value.copy();
10096
+ if (fields.hour != null) mutableValue.hour = fields.hour;
10097
+ if (fields.minute != null) mutableValue.minute = fields.minute;
10098
+ if (fields.second != null) mutableValue.second = fields.second;
10099
+ if (fields.millisecond != null) mutableValue.millisecond = fields.millisecond;
10100
+ $735220c2d4774dd3$export$7555de1e070510cb(mutableValue);
10101
+ return mutableValue;
11078
10102
  }
11079
- function $14e0f24ef4ac5c92$export$68781ddf31c0090f(a, b) {
11080
- return a.calendar.toJulianDay(a) - b.calendar.toJulianDay(b);
10103
+ function $735220c2d4774dd3$var$balanceTime(time) {
10104
+ time.second += Math.floor(time.millisecond / 1e3);
10105
+ time.millisecond = $735220c2d4774dd3$var$nonNegativeMod(time.millisecond, 1e3);
10106
+ time.minute += Math.floor(time.second / 60);
10107
+ time.second = $735220c2d4774dd3$var$nonNegativeMod(time.second, 60);
10108
+ time.hour += Math.floor(time.minute / 60);
10109
+ time.minute = $735220c2d4774dd3$var$nonNegativeMod(time.minute, 60);
10110
+ let days = Math.floor(time.hour / 24);
10111
+ time.hour = $735220c2d4774dd3$var$nonNegativeMod(time.hour, 24);
10112
+ return days;
11081
10113
  }
11082
- function $14e0f24ef4ac5c92$export$c19a80a9721b80f6(a, b) {
11083
- return $14e0f24ef4ac5c92$var$timeToMs(a) - $14e0f24ef4ac5c92$var$timeToMs(b);
10114
+ function $735220c2d4774dd3$export$7555de1e070510cb(time) {
10115
+ time.millisecond = Math.max(0, Math.min(time.millisecond, 1e3));
10116
+ time.second = Math.max(0, Math.min(time.second, 59));
10117
+ time.minute = Math.max(0, Math.min(time.minute, 59));
10118
+ time.hour = Math.max(0, Math.min(time.hour, 23));
11084
10119
  }
11085
- function $14e0f24ef4ac5c92$var$timeToMs(a) {
11086
- return a.hour * 36e5 + a.minute * 6e4 + a.second * 1e3 + a.millisecond;
10120
+ function $735220c2d4774dd3$var$nonNegativeMod(a, b) {
10121
+ let result = a % b;
10122
+ if (result < 0) result += b;
10123
+ return result;
11087
10124
  }
11088
- let $14e0f24ef4ac5c92$var$localTimeZone = null;
11089
- function $14e0f24ef4ac5c92$export$aa8b41735afcabd2() {
11090
- if ($14e0f24ef4ac5c92$var$localTimeZone == null) $14e0f24ef4ac5c92$var$localTimeZone = new Intl.DateTimeFormat().resolvedOptions().timeZone;
11091
- return $14e0f24ef4ac5c92$var$localTimeZone;
10125
+ function $735220c2d4774dd3$var$addTimeFields(time, duration) {
10126
+ time.hour += duration.hours || 0;
10127
+ time.minute += duration.minutes || 0;
10128
+ time.second += duration.seconds || 0;
10129
+ time.millisecond += duration.milliseconds || 0;
10130
+ return $735220c2d4774dd3$var$balanceTime(time);
11092
10131
  }
11093
- function $14e0f24ef4ac5c92$export$a5a3b454ada2268e(date) {
11094
- return date.subtract({
11095
- days: date.day - 1
11096
- });
10132
+ function $735220c2d4774dd3$export$7ed87b6bc2506470(time, duration) {
10133
+ let res = time.copy();
10134
+ $735220c2d4774dd3$var$addTimeFields(res, duration);
10135
+ return res;
11097
10136
  }
11098
- function $14e0f24ef4ac5c92$export$a2258d9c4118825c(date) {
11099
- return date.add({
11100
- days: date.calendar.getDaysInMonth(date) - date.day
11101
- });
10137
+ function $735220c2d4774dd3$export$fe34d3a381cd7501(time, duration) {
10138
+ return $735220c2d4774dd3$export$7ed87b6bc2506470(time, $735220c2d4774dd3$export$3e2544e88a25bff8(duration));
11102
10139
  }
11103
- const $14e0f24ef4ac5c92$var$cachedRegions = /* @__PURE__ */ new Map();
11104
- function $14e0f24ef4ac5c92$var$getRegion(locale) {
11105
- if (Intl.Locale) {
11106
- let region = $14e0f24ef4ac5c92$var$cachedRegions.get(locale);
11107
- if (!region) {
11108
- region = new Intl.Locale(locale).maximize().region;
11109
- if (region) $14e0f24ef4ac5c92$var$cachedRegions.set(locale, region);
10140
+ function $735220c2d4774dd3$export$d52ced6badfb9a4c(value, field, amount, options) {
10141
+ let mutable = value.copy();
10142
+ switch (field) {
10143
+ case "era": {
10144
+ let eras = value.calendar.getEras();
10145
+ let eraIndex = eras.indexOf(value.era);
10146
+ if (eraIndex < 0) throw new Error("Invalid era: " + value.era);
10147
+ eraIndex = $735220c2d4774dd3$var$cycleValue(eraIndex, amount, 0, eras.length - 1, options === null || options === void 0 ? void 0 : options.round);
10148
+ mutable.era = eras[eraIndex];
10149
+ $735220c2d4774dd3$export$c4e2ecac49351ef2(mutable);
10150
+ break;
11110
10151
  }
11111
- return region;
10152
+ case "year":
10153
+ var _mutable_calendar_isInverseEra, _mutable_calendar;
10154
+ if ((_mutable_calendar_isInverseEra = (_mutable_calendar = mutable.calendar).isInverseEra) === null || _mutable_calendar_isInverseEra === void 0 ? void 0 : _mutable_calendar_isInverseEra.call(_mutable_calendar, mutable)) amount = -amount;
10155
+ mutable.year = $735220c2d4774dd3$var$cycleValue(value.year, amount, -Infinity, 9999, options === null || options === void 0 ? void 0 : options.round);
10156
+ if (mutable.year === -Infinity) mutable.year = 1;
10157
+ if (mutable.calendar.balanceYearMonth) mutable.calendar.balanceYearMonth(mutable, value);
10158
+ break;
10159
+ case "month":
10160
+ mutable.month = $735220c2d4774dd3$var$cycleValue(value.month, amount, 1, value.calendar.getMonthsInYear(value), options === null || options === void 0 ? void 0 : options.round);
10161
+ break;
10162
+ case "day":
10163
+ mutable.day = $735220c2d4774dd3$var$cycleValue(value.day, amount, 1, value.calendar.getDaysInMonth(value), options === null || options === void 0 ? void 0 : options.round);
10164
+ break;
10165
+ default:
10166
+ throw new Error("Unsupported field " + field);
11112
10167
  }
11113
- let part = locale.split("-")[1];
11114
- return part === "u" ? void 0 : part;
10168
+ if (value.calendar.balanceDate) value.calendar.balanceDate(mutable);
10169
+ $735220c2d4774dd3$export$c4e2ecac49351ef2(mutable);
10170
+ return mutable;
11115
10171
  }
11116
- function $14e0f24ef4ac5c92$var$getWeekStart(locale) {
11117
- let region = $14e0f24ef4ac5c92$var$getRegion(locale);
11118
- return region ? $2fe286d2fb449abb$export$7a5acbd77d414bd9[region] || 0 : 0;
10172
+ function $735220c2d4774dd3$export$dd02b3e0007dfe28(value, field, amount, options) {
10173
+ let mutable = value.copy();
10174
+ switch (field) {
10175
+ case "hour": {
10176
+ let hours = value.hour;
10177
+ let min = 0;
10178
+ let max = 23;
10179
+ if ((options === null || options === void 0 ? void 0 : options.hourCycle) === 12) {
10180
+ let isPM = hours >= 12;
10181
+ min = isPM ? 12 : 0;
10182
+ max = isPM ? 23 : 11;
10183
+ }
10184
+ mutable.hour = $735220c2d4774dd3$var$cycleValue(hours, amount, min, max, options === null || options === void 0 ? void 0 : options.round);
10185
+ break;
10186
+ }
10187
+ case "minute":
10188
+ mutable.minute = $735220c2d4774dd3$var$cycleValue(value.minute, amount, 0, 59, options === null || options === void 0 ? void 0 : options.round);
10189
+ break;
10190
+ case "second":
10191
+ mutable.second = $735220c2d4774dd3$var$cycleValue(value.second, amount, 0, 59, options === null || options === void 0 ? void 0 : options.round);
10192
+ break;
10193
+ case "millisecond":
10194
+ mutable.millisecond = $735220c2d4774dd3$var$cycleValue(value.millisecond, amount, 0, 999, options === null || options === void 0 ? void 0 : options.round);
10195
+ break;
10196
+ default:
10197
+ throw new Error("Unsupported field " + field);
10198
+ }
10199
+ return mutable;
11119
10200
  }
11120
- function $11d87f3f76e88657$export$bd4fb2bc8bb06fb(date) {
11121
- date = $11d87f3f76e88657$export$b4a036af3fc0b032(date, new $3b62074eb05584b2$export$80ee6245ec4f29ec());
11122
- let year = $3b62074eb05584b2$export$c36e0ecb2d4fa69d(date.era, date.year);
11123
- return $11d87f3f76e88657$var$epochFromParts(year, date.month, date.day, date.hour, date.minute, date.second, date.millisecond);
10201
+ function $735220c2d4774dd3$var$cycleValue(value, amount, min, max, round = false) {
10202
+ if (round) {
10203
+ value += Math.sign(amount);
10204
+ if (value < min) value = max;
10205
+ let div = Math.abs(amount);
10206
+ if (amount > 0) value = Math.ceil(value / div) * div;
10207
+ else value = Math.floor(value / div) * div;
10208
+ if (value > max) value = min;
10209
+ } else {
10210
+ value += amount;
10211
+ if (value < min) value = max - (min - value - 1);
10212
+ else if (value > max) value = min + (value - max - 1);
10213
+ }
10214
+ return value;
11124
10215
  }
11125
- function $11d87f3f76e88657$var$epochFromParts(year, month, day, hour, minute, second, millisecond) {
11126
- let date = /* @__PURE__ */ new Date();
11127
- date.setUTCHours(hour, minute, second, millisecond);
11128
- date.setUTCFullYear(year, month - 1, day);
11129
- return date.getTime();
10216
+ function $735220c2d4774dd3$export$96b1d28349274637(dateTime, duration) {
10217
+ let ms;
10218
+ if (duration.years != null && duration.years !== 0 || duration.months != null && duration.months !== 0 || duration.weeks != null && duration.weeks !== 0 || duration.days != null && duration.days !== 0) {
10219
+ let res2 = $735220c2d4774dd3$export$e16d8520af44a096($11d87f3f76e88657$export$b21e0b124e224484(dateTime), {
10220
+ years: duration.years,
10221
+ months: duration.months,
10222
+ weeks: duration.weeks,
10223
+ days: duration.days
10224
+ });
10225
+ ms = $11d87f3f76e88657$export$5107c82f94518f5c(res2, dateTime.timeZone);
10226
+ } else
10227
+ ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(dateTime) - dateTime.offset;
10228
+ ms += duration.milliseconds || 0;
10229
+ ms += (duration.seconds || 0) * 1e3;
10230
+ ms += (duration.minutes || 0) * 6e4;
10231
+ ms += (duration.hours || 0) * 36e5;
10232
+ let res = $11d87f3f76e88657$export$1b96692a1ba042ac(ms, dateTime.timeZone);
10233
+ return $11d87f3f76e88657$export$b4a036af3fc0b032(res, dateTime.calendar);
11130
10234
  }
11131
- function $11d87f3f76e88657$export$59c99f3515d3493f(ms, timeZone) {
11132
- if (timeZone === "UTC") return 0;
11133
- if (ms > 0 && timeZone === $14e0f24ef4ac5c92$export$aa8b41735afcabd2()) return new Date(ms).getTimezoneOffset() * -6e4;
11134
- let { year, month, day, hour, minute, second } = $11d87f3f76e88657$var$getTimeZoneParts(ms, timeZone);
11135
- let utc = $11d87f3f76e88657$var$epochFromParts(year, month, day, hour, minute, second, 0);
11136
- return utc - Math.floor(ms / 1e3) * 1e3;
10235
+ function $735220c2d4774dd3$export$6814caac34ca03c7(dateTime, duration) {
10236
+ return $735220c2d4774dd3$export$96b1d28349274637(dateTime, $735220c2d4774dd3$export$3e2544e88a25bff8(duration));
11137
10237
  }
11138
- const $11d87f3f76e88657$var$formattersByTimeZone = /* @__PURE__ */ new Map();
11139
- function $11d87f3f76e88657$var$getTimeZoneParts(ms, timeZone) {
11140
- let formatter = $11d87f3f76e88657$var$formattersByTimeZone.get(timeZone);
11141
- if (!formatter) {
11142
- formatter = new Intl.DateTimeFormat("en-US", {
11143
- timeZone,
11144
- hour12: false,
11145
- era: "short",
11146
- year: "numeric",
11147
- month: "numeric",
11148
- day: "numeric",
11149
- hour: "numeric",
11150
- minute: "numeric",
11151
- second: "numeric"
11152
- });
11153
- $11d87f3f76e88657$var$formattersByTimeZone.set(timeZone, formatter);
10238
+ function $735220c2d4774dd3$export$9a297d111fc86b79(dateTime, field, amount, options) {
10239
+ switch (field) {
10240
+ case "hour": {
10241
+ let min = 0;
10242
+ let max = 23;
10243
+ if ((options === null || options === void 0 ? void 0 : options.hourCycle) === 12) {
10244
+ let isPM = dateTime.hour >= 12;
10245
+ min = isPM ? 12 : 0;
10246
+ max = isPM ? 23 : 11;
10247
+ }
10248
+ let plainDateTime = $11d87f3f76e88657$export$b21e0b124e224484(dateTime);
10249
+ let minDate = $11d87f3f76e88657$export$b4a036af3fc0b032($735220c2d4774dd3$export$e5d5e1c1822b6e56(plainDateTime, {
10250
+ hour: min
10251
+ }), new $3b62074eb05584b2$export$80ee6245ec4f29ec());
10252
+ let minAbsolute = [
10253
+ $11d87f3f76e88657$export$5107c82f94518f5c(minDate, dateTime.timeZone, "earlier"),
10254
+ $11d87f3f76e88657$export$5107c82f94518f5c(minDate, dateTime.timeZone, "later")
10255
+ ].filter((ms2) => $11d87f3f76e88657$export$1b96692a1ba042ac(ms2, dateTime.timeZone).day === minDate.day)[0];
10256
+ let maxDate = $11d87f3f76e88657$export$b4a036af3fc0b032($735220c2d4774dd3$export$e5d5e1c1822b6e56(plainDateTime, {
10257
+ hour: max
10258
+ }), new $3b62074eb05584b2$export$80ee6245ec4f29ec());
10259
+ let maxAbsolute = [
10260
+ $11d87f3f76e88657$export$5107c82f94518f5c(maxDate, dateTime.timeZone, "earlier"),
10261
+ $11d87f3f76e88657$export$5107c82f94518f5c(maxDate, dateTime.timeZone, "later")
10262
+ ].filter((ms2) => $11d87f3f76e88657$export$1b96692a1ba042ac(ms2, dateTime.timeZone).day === maxDate.day).pop();
10263
+ let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(dateTime) - dateTime.offset;
10264
+ let hours = Math.floor(ms / $735220c2d4774dd3$var$ONE_HOUR);
10265
+ let remainder = ms % $735220c2d4774dd3$var$ONE_HOUR;
10266
+ ms = $735220c2d4774dd3$var$cycleValue(hours, amount, Math.floor(minAbsolute / $735220c2d4774dd3$var$ONE_HOUR), Math.floor(maxAbsolute / $735220c2d4774dd3$var$ONE_HOUR), options === null || options === void 0 ? void 0 : options.round) * $735220c2d4774dd3$var$ONE_HOUR + remainder;
10267
+ return $11d87f3f76e88657$export$b4a036af3fc0b032($11d87f3f76e88657$export$1b96692a1ba042ac(ms, dateTime.timeZone), dateTime.calendar);
10268
+ }
10269
+ case "minute":
10270
+ case "second":
10271
+ case "millisecond":
10272
+ return $735220c2d4774dd3$export$dd02b3e0007dfe28(dateTime, field, amount, options);
10273
+ case "era":
10274
+ case "year":
10275
+ case "month":
10276
+ case "day": {
10277
+ let res = $735220c2d4774dd3$export$d52ced6badfb9a4c($11d87f3f76e88657$export$b21e0b124e224484(dateTime), field, amount, options);
10278
+ let ms = $11d87f3f76e88657$export$5107c82f94518f5c(res, dateTime.timeZone);
10279
+ return $11d87f3f76e88657$export$b4a036af3fc0b032($11d87f3f76e88657$export$1b96692a1ba042ac(ms, dateTime.timeZone), dateTime.calendar);
10280
+ }
10281
+ default:
10282
+ throw new Error("Unsupported field " + field);
11154
10283
  }
11155
- let parts = formatter.formatToParts(new Date(ms));
11156
- let namedParts = {};
11157
- for (let part of parts) if (part.type !== "literal") namedParts[part.type] = part.value;
11158
- return {
11159
- // Firefox returns B instead of BC... https://bugzilla.mozilla.org/show_bug.cgi?id=1752253
11160
- year: namedParts.era === "BC" || namedParts.era === "B" ? -namedParts.year + 1 : +namedParts.year,
11161
- month: +namedParts.month,
11162
- day: +namedParts.day,
11163
- hour: namedParts.hour === "24" ? 0 : +namedParts.hour,
11164
- minute: +namedParts.minute,
11165
- second: +namedParts.second
11166
- };
11167
10284
  }
11168
- const $11d87f3f76e88657$var$DAYMILLIS = 864e5;
11169
- function $11d87f3f76e88657$export$136f38efe7caf549(date, timeZone) {
11170
- let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(date);
11171
- let earlier = ms - $11d87f3f76e88657$export$59c99f3515d3493f(ms - $11d87f3f76e88657$var$DAYMILLIS, timeZone);
11172
- let later = ms - $11d87f3f76e88657$export$59c99f3515d3493f(ms + $11d87f3f76e88657$var$DAYMILLIS, timeZone);
11173
- return $11d87f3f76e88657$var$getValidWallTimes(date, timeZone, earlier, later);
10285
+ function $735220c2d4774dd3$export$31b5430eb18be4f8(dateTime, fields, disambiguation) {
10286
+ let plainDateTime = $11d87f3f76e88657$export$b21e0b124e224484(dateTime);
10287
+ let res = $735220c2d4774dd3$export$e5d5e1c1822b6e56($735220c2d4774dd3$export$adaa4cf7ef1b65be(plainDateTime, fields), fields);
10288
+ if (res.compare(plainDateTime) === 0) return dateTime;
10289
+ let ms = $11d87f3f76e88657$export$5107c82f94518f5c(res, dateTime.timeZone, disambiguation);
10290
+ return $11d87f3f76e88657$export$b4a036af3fc0b032($11d87f3f76e88657$export$1b96692a1ba042ac(ms, dateTime.timeZone), dateTime.calendar);
11174
10291
  }
11175
- function $11d87f3f76e88657$var$getValidWallTimes(date, timeZone, earlier, later) {
11176
- let found = earlier === later ? [
11177
- earlier
11178
- ] : [
11179
- earlier,
11180
- later
11181
- ];
11182
- return found.filter((absolute) => $11d87f3f76e88657$var$isValidWallTime(date, timeZone, absolute));
10292
+ const $fae977aafc393c5c$var$DATE_RE = /^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/;
10293
+ const $fae977aafc393c5c$var$DATE_TIME_RE = /^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?$/;
10294
+ const $fae977aafc393c5c$var$ZONED_DATE_TIME_RE = /^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:([+-]\d{2})(?::?(\d{2}))?)?\[(.*?)\]$/;
10295
+ const $fae977aafc393c5c$var$ABSOLUTE_RE = /^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;
10296
+ function $fae977aafc393c5c$export$6b862160d295c8e(value) {
10297
+ let m = value.match($fae977aafc393c5c$var$DATE_RE);
10298
+ if (!m) throw new Error("Invalid ISO 8601 date string: " + value);
10299
+ let date = new $35ea8db9cb2ccb90$export$99faa760c7908e4f($fae977aafc393c5c$var$parseNumber(m[1], 0, 9999), $fae977aafc393c5c$var$parseNumber(m[2], 1, 12), 1);
10300
+ date.day = $fae977aafc393c5c$var$parseNumber(m[3], 1, date.calendar.getDaysInMonth(date));
10301
+ return date;
10302
+ }
10303
+ function $fae977aafc393c5c$export$588937bcd60ade55(value) {
10304
+ let m = value.match($fae977aafc393c5c$var$DATE_TIME_RE);
10305
+ if (!m) throw new Error("Invalid ISO 8601 date time string: " + value);
10306
+ let year = $fae977aafc393c5c$var$parseNumber(m[1], -9999, 9999);
10307
+ let era = year < 1 ? "BC" : "AD";
10308
+ let date = new $35ea8db9cb2ccb90$export$ca871e8dbb80966f(era, year < 1 ? -year + 1 : year, $fae977aafc393c5c$var$parseNumber(m[2], 1, 12), 1, m[4] ? $fae977aafc393c5c$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $fae977aafc393c5c$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $fae977aafc393c5c$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $fae977aafc393c5c$var$parseNumber(m[7], 0, Infinity) * 1e3 : 0);
10309
+ date.day = $fae977aafc393c5c$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));
10310
+ return date;
11183
10311
  }
11184
- function $11d87f3f76e88657$var$isValidWallTime(date, timeZone, absolute) {
11185
- let parts = $11d87f3f76e88657$var$getTimeZoneParts(absolute, timeZone);
11186
- return date.year === parts.year && date.month === parts.month && date.day === parts.day && date.hour === parts.hour && date.minute === parts.minute && date.second === parts.second;
10312
+ function $fae977aafc393c5c$export$fd7893f06e92a6a4(value, disambiguation) {
10313
+ let m = value.match($fae977aafc393c5c$var$ZONED_DATE_TIME_RE);
10314
+ if (!m) throw new Error("Invalid ISO 8601 date time string: " + value);
10315
+ let year = $fae977aafc393c5c$var$parseNumber(m[1], -9999, 9999);
10316
+ let era = year < 1 ? "BC" : "AD";
10317
+ let date = new $35ea8db9cb2ccb90$export$d3b7288e7994edea(era, year < 1 ? -year + 1 : year, $fae977aafc393c5c$var$parseNumber(m[2], 1, 12), 1, m[10], 0, m[4] ? $fae977aafc393c5c$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $fae977aafc393c5c$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $fae977aafc393c5c$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $fae977aafc393c5c$var$parseNumber(m[7], 0, Infinity) * 1e3 : 0);
10318
+ date.day = $fae977aafc393c5c$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));
10319
+ let plainDateTime = $11d87f3f76e88657$export$b21e0b124e224484(date);
10320
+ let ms;
10321
+ if (m[8]) {
10322
+ var _m_;
10323
+ date.offset = $fae977aafc393c5c$var$parseNumber(m[8], -23, 23) * 36e5 + $fae977aafc393c5c$var$parseNumber((_m_ = m[9]) !== null && _m_ !== void 0 ? _m_ : "0", 0, 59) * 6e4;
10324
+ ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(date) - date.offset;
10325
+ let absolutes = $11d87f3f76e88657$export$136f38efe7caf549(plainDateTime, date.timeZone);
10326
+ if (!absolutes.includes(ms)) throw new Error(`Offset ${$fae977aafc393c5c$var$offsetToString(date.offset)} is invalid for ${$fae977aafc393c5c$export$4223de14708adc63(date)} in ${date.timeZone}`);
10327
+ } else
10328
+ ms = $11d87f3f76e88657$export$5107c82f94518f5c($11d87f3f76e88657$export$b21e0b124e224484(plainDateTime), date.timeZone, disambiguation);
10329
+ return $11d87f3f76e88657$export$1b96692a1ba042ac(ms, date.timeZone);
11187
10330
  }
11188
- function $11d87f3f76e88657$export$5107c82f94518f5c(date, timeZone, disambiguation = "compatible") {
11189
- let dateTime = $11d87f3f76e88657$export$b21e0b124e224484(date);
11190
- if (timeZone === "UTC") return $11d87f3f76e88657$export$bd4fb2bc8bb06fb(dateTime);
11191
- if (timeZone === $14e0f24ef4ac5c92$export$aa8b41735afcabd2() && disambiguation === "compatible") {
11192
- dateTime = $11d87f3f76e88657$export$b4a036af3fc0b032(dateTime, new $3b62074eb05584b2$export$80ee6245ec4f29ec());
11193
- let date2 = /* @__PURE__ */ new Date();
11194
- let year = $3b62074eb05584b2$export$c36e0ecb2d4fa69d(dateTime.era, dateTime.year);
11195
- date2.setFullYear(year, dateTime.month - 1, dateTime.day);
11196
- date2.setHours(dateTime.hour, dateTime.minute, dateTime.second, dateTime.millisecond);
11197
- return date2.getTime();
11198
- }
11199
- let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(dateTime);
11200
- let offsetBefore = $11d87f3f76e88657$export$59c99f3515d3493f(ms - $11d87f3f76e88657$var$DAYMILLIS, timeZone);
11201
- let offsetAfter = $11d87f3f76e88657$export$59c99f3515d3493f(ms + $11d87f3f76e88657$var$DAYMILLIS, timeZone);
11202
- let valid = $11d87f3f76e88657$var$getValidWallTimes(dateTime, timeZone, ms - offsetBefore, ms - offsetAfter);
11203
- if (valid.length === 1) return valid[0];
11204
- if (valid.length > 1) switch (disambiguation) {
11205
- // 'compatible' means 'earlier' for "fall back" transitions
11206
- case "compatible":
11207
- case "earlier":
11208
- return valid[0];
11209
- case "later":
11210
- return valid[valid.length - 1];
11211
- case "reject":
11212
- throw new RangeError("Multiple possible absolute times found");
11213
- }
11214
- switch (disambiguation) {
11215
- case "earlier":
11216
- return Math.min(ms - offsetBefore, ms - offsetAfter);
11217
- // 'compatible' means 'later' for "spring forward" transitions
11218
- case "compatible":
11219
- case "later":
11220
- return Math.max(ms - offsetBefore, ms - offsetAfter);
11221
- case "reject":
11222
- throw new RangeError("No such absolute time found");
11223
- }
10331
+ function $fae977aafc393c5c$export$5adfdab05168c219(value, timeZone) {
10332
+ let m = value.match($fae977aafc393c5c$var$ABSOLUTE_RE);
10333
+ if (!m) throw new Error("Invalid ISO 8601 date time string: " + value);
10334
+ let year = $fae977aafc393c5c$var$parseNumber(m[1], -9999, 9999);
10335
+ let era = year < 1 ? "BC" : "AD";
10336
+ let date = new $35ea8db9cb2ccb90$export$d3b7288e7994edea(era, year < 1 ? -year + 1 : year, $fae977aafc393c5c$var$parseNumber(m[2], 1, 12), 1, timeZone, 0, m[4] ? $fae977aafc393c5c$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $fae977aafc393c5c$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $fae977aafc393c5c$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $fae977aafc393c5c$var$parseNumber(m[7], 0, Infinity) * 1e3 : 0);
10337
+ date.day = $fae977aafc393c5c$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));
10338
+ var _m_;
10339
+ if (m[8]) date.offset = $fae977aafc393c5c$var$parseNumber(m[8], -23, 23) * 36e5 + $fae977aafc393c5c$var$parseNumber((_m_ = m[9]) !== null && _m_ !== void 0 ? _m_ : "0", 0, 59) * 6e4;
10340
+ return $11d87f3f76e88657$export$538b00033cc11c75(date, timeZone);
11224
10341
  }
11225
- function $11d87f3f76e88657$export$e67a095c620b86fe(dateTime, timeZone, disambiguation = "compatible") {
11226
- return new Date($11d87f3f76e88657$export$5107c82f94518f5c(dateTime, timeZone, disambiguation));
10342
+ function $fae977aafc393c5c$var$parseNumber(value, min, max) {
10343
+ let val = Number(value);
10344
+ if (val < min || val > max) throw new RangeError(`Value out of range: ${min} <= ${val} <= ${max}`);
10345
+ return val;
11227
10346
  }
11228
- function $11d87f3f76e88657$export$1b96692a1ba042ac(ms, timeZone) {
11229
- let offset = $11d87f3f76e88657$export$59c99f3515d3493f(ms, timeZone);
11230
- let date = new Date(ms + offset);
11231
- let year = date.getUTCFullYear();
11232
- let month = date.getUTCMonth() + 1;
11233
- let day = date.getUTCDate();
11234
- let hour = date.getUTCHours();
11235
- let minute = date.getUTCMinutes();
11236
- let second = date.getUTCSeconds();
11237
- let millisecond = date.getUTCMilliseconds();
11238
- return new $35ea8db9cb2ccb90$export$d3b7288e7994edea(year < 1 ? "BC" : "AD", year < 1 ? -year + 1 : year, month, day, timeZone, offset, hour, minute, second, millisecond);
10347
+ function $fae977aafc393c5c$export$f59dee82248f5ad4(time) {
10348
+ return `${String(time.hour).padStart(2, "0")}:${String(time.minute).padStart(2, "0")}:${String(time.second).padStart(2, "0")}${time.millisecond ? String(time.millisecond / 1e3).slice(1) : ""}`;
11239
10349
  }
11240
- function $11d87f3f76e88657$export$93522d1a439f3617(dateTime) {
11241
- return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(dateTime.calendar, dateTime.era, dateTime.year, dateTime.month, dateTime.day);
10350
+ function $fae977aafc393c5c$export$60dfd74aa96791bd(date) {
10351
+ let gregorianDate = $11d87f3f76e88657$export$b4a036af3fc0b032(date, new $3b62074eb05584b2$export$80ee6245ec4f29ec());
10352
+ let year;
10353
+ if (gregorianDate.era === "BC") year = gregorianDate.year === 1 ? "0000" : "-" + String(Math.abs(1 - gregorianDate.year)).padStart(6, "00");
10354
+ else year = String(gregorianDate.year).padStart(4, "0");
10355
+ return `${year}-${String(gregorianDate.month).padStart(2, "0")}-${String(gregorianDate.day).padStart(2, "0")}`;
11242
10356
  }
11243
- function $11d87f3f76e88657$export$b21e0b124e224484(date, time) {
11244
- let hour = 0, minute = 0, second = 0, millisecond = 0;
11245
- if ("timeZone" in date) ({ hour, minute, second, millisecond } = date);
11246
- else if ("hour" in date && !time) return date;
11247
- if (time) ({ hour, minute, second, millisecond } = time);
11248
- return new $35ea8db9cb2ccb90$export$ca871e8dbb80966f(date.calendar, date.era, date.year, date.month, date.day, hour, minute, second, millisecond);
10357
+ function $fae977aafc393c5c$export$4223de14708adc63(date) {
10358
+ return `${$fae977aafc393c5c$export$60dfd74aa96791bd(date)}T${$fae977aafc393c5c$export$f59dee82248f5ad4(date)}`;
11249
10359
  }
11250
- function $11d87f3f76e88657$export$d33f79e3ffc3dc83(dateTime) {
11251
- return new $35ea8db9cb2ccb90$export$680ea196effce5f(dateTime.hour, dateTime.minute, dateTime.second, dateTime.millisecond);
10360
+ function $fae977aafc393c5c$var$offsetToString(offset) {
10361
+ let sign = Math.sign(offset) < 0 ? "-" : "+";
10362
+ offset = Math.abs(offset);
10363
+ let offsetHours = Math.floor(offset / 36e5);
10364
+ let offsetMinutes = offset % 36e5 / 6e4;
10365
+ return `${sign}${String(offsetHours).padStart(2, "0")}:${String(offsetMinutes).padStart(2, "0")}`;
11252
10366
  }
11253
- function $11d87f3f76e88657$export$b4a036af3fc0b032(date, calendar) {
11254
- if ($14e0f24ef4ac5c92$export$dbc69fd56b53d5e(date.calendar, calendar)) return date;
11255
- let calendarDate = calendar.fromJulianDay(date.calendar.toJulianDay(date));
11256
- let copy = date.copy();
11257
- copy.calendar = calendar;
11258
- copy.era = calendarDate.era;
11259
- copy.year = calendarDate.year;
11260
- copy.month = calendarDate.month;
11261
- copy.day = calendarDate.day;
11262
- $735220c2d4774dd3$export$c4e2ecac49351ef2(copy);
11263
- return copy;
10367
+ function $fae977aafc393c5c$export$bf79f1ebf4b18792(date) {
10368
+ return `${$fae977aafc393c5c$export$4223de14708adc63(date)}${$fae977aafc393c5c$var$offsetToString(date.offset)}[${date.timeZone}]`;
11264
10369
  }
11265
- function $11d87f3f76e88657$export$84c95a83c799e074(date, timeZone, disambiguation) {
11266
- if (date instanceof $35ea8db9cb2ccb90$export$d3b7288e7994edea) {
11267
- if (date.timeZone === timeZone) return date;
11268
- return $11d87f3f76e88657$export$538b00033cc11c75(date, timeZone);
10370
+ function _check_private_redeclaration(obj, privateCollection) {
10371
+ if (privateCollection.has(obj)) {
10372
+ throw new TypeError("Cannot initialize the same private elements twice on an object");
11269
10373
  }
11270
- let ms = $11d87f3f76e88657$export$5107c82f94518f5c(date, timeZone, disambiguation);
11271
- return $11d87f3f76e88657$export$1b96692a1ba042ac(ms, timeZone);
11272
10374
  }
11273
- function $11d87f3f76e88657$export$83aac07b4c37b25(date) {
11274
- let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(date) - date.offset;
11275
- return new Date(ms);
10375
+ function _class_private_field_init(obj, privateMap, value) {
10376
+ _check_private_redeclaration(obj, privateMap);
10377
+ privateMap.set(obj, value);
11276
10378
  }
11277
- function $11d87f3f76e88657$export$538b00033cc11c75(date, timeZone) {
11278
- let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(date) - date.offset;
11279
- return $11d87f3f76e88657$export$b4a036af3fc0b032($11d87f3f76e88657$export$1b96692a1ba042ac(ms, timeZone), date.calendar);
10379
+ function $35ea8db9cb2ccb90$var$shiftArgs(args) {
10380
+ let calendar = typeof args[0] === "object" ? args.shift() : new $3b62074eb05584b2$export$80ee6245ec4f29ec();
10381
+ let era;
10382
+ if (typeof args[0] === "string") era = args.shift();
10383
+ else {
10384
+ let eras = calendar.getEras();
10385
+ era = eras[eras.length - 1];
10386
+ }
10387
+ let year = args.shift();
10388
+ let month = args.shift();
10389
+ let day = args.shift();
10390
+ return [
10391
+ calendar,
10392
+ era,
10393
+ year,
10394
+ month,
10395
+ day
10396
+ ];
11280
10397
  }
11281
- const $735220c2d4774dd3$var$ONE_HOUR = 36e5;
11282
- function $735220c2d4774dd3$export$e16d8520af44a096(date, duration) {
11283
- let mutableDate = date.copy();
11284
- let days = "hour" in mutableDate ? $735220c2d4774dd3$var$addTimeFields(mutableDate, duration) : 0;
11285
- $735220c2d4774dd3$var$addYears(mutableDate, duration.years || 0);
11286
- if (mutableDate.calendar.balanceYearMonth) mutableDate.calendar.balanceYearMonth(mutableDate, date);
11287
- mutableDate.month += duration.months || 0;
11288
- $735220c2d4774dd3$var$balanceYearMonth(mutableDate);
11289
- $735220c2d4774dd3$var$constrainMonthDay(mutableDate);
11290
- mutableDate.day += (duration.weeks || 0) * 7;
11291
- mutableDate.day += duration.days || 0;
11292
- mutableDate.day += days;
11293
- $735220c2d4774dd3$var$balanceDay(mutableDate);
11294
- if (mutableDate.calendar.balanceDate) mutableDate.calendar.balanceDate(mutableDate);
11295
- if (mutableDate.year < 1) {
11296
- mutableDate.year = 1;
11297
- mutableDate.month = 1;
11298
- mutableDate.day = 1;
10398
+ var $35ea8db9cb2ccb90$var$_type = /* @__PURE__ */ new WeakMap();
10399
+ class $35ea8db9cb2ccb90$export$99faa760c7908e4f {
10400
+ /** Returns a copy of this date. */
10401
+ copy() {
10402
+ if (this.era) return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this.calendar, this.era, this.year, this.month, this.day);
10403
+ else return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this.calendar, this.year, this.month, this.day);
10404
+ }
10405
+ /** Returns a new `CalendarDate` with the given duration added to it. */
10406
+ add(duration) {
10407
+ return $735220c2d4774dd3$export$e16d8520af44a096(this, duration);
10408
+ }
10409
+ /** Returns a new `CalendarDate` with the given duration subtracted from it. */
10410
+ subtract(duration) {
10411
+ return $735220c2d4774dd3$export$4e2d2ead65e5f7e3(this, duration);
10412
+ }
10413
+ /** Returns a new `CalendarDate` with the given fields set to the provided values. Other fields will be constrained accordingly. */
10414
+ set(fields) {
10415
+ return $735220c2d4774dd3$export$adaa4cf7ef1b65be(this, fields);
10416
+ }
10417
+ /**
10418
+ * Returns a new `CalendarDate` with the given field adjusted by a specified amount.
10419
+ * When the resulting value reaches the limits of the field, it wraps around.
10420
+ */
10421
+ cycle(field, amount, options) {
10422
+ return $735220c2d4774dd3$export$d52ced6badfb9a4c(this, field, amount, options);
10423
+ }
10424
+ /** Converts the date to a native JavaScript Date object, with the time set to midnight in the given time zone. */
10425
+ toDate(timeZone) {
10426
+ return $11d87f3f76e88657$export$e67a095c620b86fe(this, timeZone);
10427
+ }
10428
+ /** Converts the date to an ISO 8601 formatted string. */
10429
+ toString() {
10430
+ return $fae977aafc393c5c$export$60dfd74aa96791bd(this);
10431
+ }
10432
+ /** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */
10433
+ compare(b) {
10434
+ return $14e0f24ef4ac5c92$export$68781ddf31c0090f(this, b);
10435
+ }
10436
+ constructor(...args) {
10437
+ _class_private_field_init(this, $35ea8db9cb2ccb90$var$_type, {
10438
+ writable: true,
10439
+ value: void 0
10440
+ });
10441
+ let [calendar, era, year, month, day] = $35ea8db9cb2ccb90$var$shiftArgs(args);
10442
+ this.calendar = calendar;
10443
+ this.era = era;
10444
+ this.year = year;
10445
+ this.month = month;
10446
+ this.day = day;
10447
+ $735220c2d4774dd3$export$c4e2ecac49351ef2(this);
10448
+ }
10449
+ }
10450
+ var $35ea8db9cb2ccb90$var$_type1 = /* @__PURE__ */ new WeakMap();
10451
+ class $35ea8db9cb2ccb90$export$680ea196effce5f {
10452
+ /** Returns a copy of this time. */
10453
+ copy() {
10454
+ return new $35ea8db9cb2ccb90$export$680ea196effce5f(this.hour, this.minute, this.second, this.millisecond);
10455
+ }
10456
+ /** Returns a new `Time` with the given duration added to it. */
10457
+ add(duration) {
10458
+ return $735220c2d4774dd3$export$7ed87b6bc2506470(this, duration);
10459
+ }
10460
+ /** Returns a new `Time` with the given duration subtracted from it. */
10461
+ subtract(duration) {
10462
+ return $735220c2d4774dd3$export$fe34d3a381cd7501(this, duration);
10463
+ }
10464
+ /** Returns a new `Time` with the given fields set to the provided values. Other fields will be constrained accordingly. */
10465
+ set(fields) {
10466
+ return $735220c2d4774dd3$export$e5d5e1c1822b6e56(this, fields);
10467
+ }
10468
+ /**
10469
+ * Returns a new `Time` with the given field adjusted by a specified amount.
10470
+ * When the resulting value reaches the limits of the field, it wraps around.
10471
+ */
10472
+ cycle(field, amount, options) {
10473
+ return $735220c2d4774dd3$export$dd02b3e0007dfe28(this, field, amount, options);
11299
10474
  }
11300
- let maxYear = mutableDate.calendar.getYearsInEra(mutableDate);
11301
- if (mutableDate.year > maxYear) {
11302
- var _mutableDate_calendar_isInverseEra, _mutableDate_calendar;
11303
- let isInverseEra = (_mutableDate_calendar_isInverseEra = (_mutableDate_calendar = mutableDate.calendar).isInverseEra) === null || _mutableDate_calendar_isInverseEra === void 0 ? void 0 : _mutableDate_calendar_isInverseEra.call(_mutableDate_calendar, mutableDate);
11304
- mutableDate.year = maxYear;
11305
- mutableDate.month = isInverseEra ? 1 : mutableDate.calendar.getMonthsInYear(mutableDate);
11306
- mutableDate.day = isInverseEra ? 1 : mutableDate.calendar.getDaysInMonth(mutableDate);
10475
+ /** Converts the time to an ISO 8601 formatted string. */
10476
+ toString() {
10477
+ return $fae977aafc393c5c$export$f59dee82248f5ad4(this);
11307
10478
  }
11308
- if (mutableDate.month < 1) {
11309
- mutableDate.month = 1;
11310
- mutableDate.day = 1;
10479
+ /** Compares this time with another. A negative result indicates that this time is before the given one, and a positive time indicates that it is after. */
10480
+ compare(b) {
10481
+ return $14e0f24ef4ac5c92$export$c19a80a9721b80f6(this, b);
11311
10482
  }
11312
- let maxMonth = mutableDate.calendar.getMonthsInYear(mutableDate);
11313
- if (mutableDate.month > maxMonth) {
11314
- mutableDate.month = maxMonth;
11315
- mutableDate.day = mutableDate.calendar.getDaysInMonth(mutableDate);
10483
+ constructor(hour = 0, minute = 0, second = 0, millisecond = 0) {
10484
+ _class_private_field_init(this, $35ea8db9cb2ccb90$var$_type1, {
10485
+ writable: true,
10486
+ value: void 0
10487
+ });
10488
+ this.hour = hour;
10489
+ this.minute = minute;
10490
+ this.second = second;
10491
+ this.millisecond = millisecond;
10492
+ $735220c2d4774dd3$export$7555de1e070510cb(this);
11316
10493
  }
11317
- mutableDate.day = Math.max(1, Math.min(mutableDate.calendar.getDaysInMonth(mutableDate), mutableDate.day));
11318
- return mutableDate;
11319
- }
11320
- function $735220c2d4774dd3$var$addYears(date, years) {
11321
- var _date_calendar_isInverseEra, _date_calendar;
11322
- if ((_date_calendar_isInverseEra = (_date_calendar = date.calendar).isInverseEra) === null || _date_calendar_isInverseEra === void 0 ? void 0 : _date_calendar_isInverseEra.call(_date_calendar, date)) years = -years;
11323
- date.year += years;
11324
10494
  }
11325
- function $735220c2d4774dd3$var$balanceYearMonth(date) {
11326
- while (date.month < 1) {
11327
- $735220c2d4774dd3$var$addYears(date, -1);
11328
- date.month += date.calendar.getMonthsInYear(date);
10495
+ var $35ea8db9cb2ccb90$var$_type2 = /* @__PURE__ */ new WeakMap();
10496
+ class $35ea8db9cb2ccb90$export$ca871e8dbb80966f {
10497
+ /** Returns a copy of this date. */
10498
+ copy() {
10499
+ if (this.era) return new $35ea8db9cb2ccb90$export$ca871e8dbb80966f(this.calendar, this.era, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);
10500
+ else return new $35ea8db9cb2ccb90$export$ca871e8dbb80966f(this.calendar, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);
11329
10501
  }
11330
- let monthsInYear = 0;
11331
- while (date.month > (monthsInYear = date.calendar.getMonthsInYear(date))) {
11332
- date.month -= monthsInYear;
11333
- $735220c2d4774dd3$var$addYears(date, 1);
10502
+ /** Returns a new `CalendarDateTime` with the given duration added to it. */
10503
+ add(duration) {
10504
+ return $735220c2d4774dd3$export$e16d8520af44a096(this, duration);
11334
10505
  }
11335
- }
11336
- function $735220c2d4774dd3$var$balanceDay(date) {
11337
- while (date.day < 1) {
11338
- date.month--;
11339
- $735220c2d4774dd3$var$balanceYearMonth(date);
11340
- date.day += date.calendar.getDaysInMonth(date);
10506
+ /** Returns a new `CalendarDateTime` with the given duration subtracted from it. */
10507
+ subtract(duration) {
10508
+ return $735220c2d4774dd3$export$4e2d2ead65e5f7e3(this, duration);
11341
10509
  }
11342
- while (date.day > date.calendar.getDaysInMonth(date)) {
11343
- date.day -= date.calendar.getDaysInMonth(date);
11344
- date.month++;
11345
- $735220c2d4774dd3$var$balanceYearMonth(date);
10510
+ /** Returns a new `CalendarDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */
10511
+ set(fields) {
10512
+ return $735220c2d4774dd3$export$adaa4cf7ef1b65be($735220c2d4774dd3$export$e5d5e1c1822b6e56(this, fields), fields);
11346
10513
  }
11347
- }
11348
- function $735220c2d4774dd3$var$constrainMonthDay(date) {
11349
- date.month = Math.max(1, Math.min(date.calendar.getMonthsInYear(date), date.month));
11350
- date.day = Math.max(1, Math.min(date.calendar.getDaysInMonth(date), date.day));
11351
- }
11352
- function $735220c2d4774dd3$export$c4e2ecac49351ef2(date) {
11353
- if (date.calendar.constrainDate) date.calendar.constrainDate(date);
11354
- date.year = Math.max(1, Math.min(date.calendar.getYearsInEra(date), date.year));
11355
- $735220c2d4774dd3$var$constrainMonthDay(date);
11356
- }
11357
- function $735220c2d4774dd3$export$3e2544e88a25bff8(duration) {
11358
- let inverseDuration = {};
11359
- for (let key in duration) if (typeof duration[key] === "number") inverseDuration[key] = -duration[key];
11360
- return inverseDuration;
11361
- }
11362
- function $735220c2d4774dd3$export$4e2d2ead65e5f7e3(date, duration) {
11363
- return $735220c2d4774dd3$export$e16d8520af44a096(date, $735220c2d4774dd3$export$3e2544e88a25bff8(duration));
11364
- }
11365
- function $735220c2d4774dd3$export$adaa4cf7ef1b65be(date, fields) {
11366
- let mutableDate = date.copy();
11367
- if (fields.era != null) mutableDate.era = fields.era;
11368
- if (fields.year != null) mutableDate.year = fields.year;
11369
- if (fields.month != null) mutableDate.month = fields.month;
11370
- if (fields.day != null) mutableDate.day = fields.day;
11371
- $735220c2d4774dd3$export$c4e2ecac49351ef2(mutableDate);
11372
- return mutableDate;
11373
- }
11374
- function $735220c2d4774dd3$export$e5d5e1c1822b6e56(value, fields) {
11375
- let mutableValue = value.copy();
11376
- if (fields.hour != null) mutableValue.hour = fields.hour;
11377
- if (fields.minute != null) mutableValue.minute = fields.minute;
11378
- if (fields.second != null) mutableValue.second = fields.second;
11379
- if (fields.millisecond != null) mutableValue.millisecond = fields.millisecond;
11380
- $735220c2d4774dd3$export$7555de1e070510cb(mutableValue);
11381
- return mutableValue;
11382
- }
11383
- function $735220c2d4774dd3$var$balanceTime(time) {
11384
- time.second += Math.floor(time.millisecond / 1e3);
11385
- time.millisecond = $735220c2d4774dd3$var$nonNegativeMod(time.millisecond, 1e3);
11386
- time.minute += Math.floor(time.second / 60);
11387
- time.second = $735220c2d4774dd3$var$nonNegativeMod(time.second, 60);
11388
- time.hour += Math.floor(time.minute / 60);
11389
- time.minute = $735220c2d4774dd3$var$nonNegativeMod(time.minute, 60);
11390
- let days = Math.floor(time.hour / 24);
11391
- time.hour = $735220c2d4774dd3$var$nonNegativeMod(time.hour, 24);
11392
- return days;
11393
- }
11394
- function $735220c2d4774dd3$export$7555de1e070510cb(time) {
11395
- time.millisecond = Math.max(0, Math.min(time.millisecond, 1e3));
11396
- time.second = Math.max(0, Math.min(time.second, 59));
11397
- time.minute = Math.max(0, Math.min(time.minute, 59));
11398
- time.hour = Math.max(0, Math.min(time.hour, 23));
11399
- }
11400
- function $735220c2d4774dd3$var$nonNegativeMod(a, b) {
11401
- let result = a % b;
11402
- if (result < 0) result += b;
11403
- return result;
11404
- }
11405
- function $735220c2d4774dd3$var$addTimeFields(time, duration) {
11406
- time.hour += duration.hours || 0;
11407
- time.minute += duration.minutes || 0;
11408
- time.second += duration.seconds || 0;
11409
- time.millisecond += duration.milliseconds || 0;
11410
- return $735220c2d4774dd3$var$balanceTime(time);
11411
- }
11412
- function $735220c2d4774dd3$export$7ed87b6bc2506470(time, duration) {
11413
- let res = time.copy();
11414
- $735220c2d4774dd3$var$addTimeFields(res, duration);
11415
- return res;
11416
- }
11417
- function $735220c2d4774dd3$export$fe34d3a381cd7501(time, duration) {
11418
- return $735220c2d4774dd3$export$7ed87b6bc2506470(time, $735220c2d4774dd3$export$3e2544e88a25bff8(duration));
11419
- }
11420
- function $735220c2d4774dd3$export$d52ced6badfb9a4c(value, field, amount, options) {
11421
- let mutable = value.copy();
11422
- switch (field) {
11423
- case "era": {
11424
- let eras = value.calendar.getEras();
11425
- let eraIndex = eras.indexOf(value.era);
11426
- if (eraIndex < 0) throw new Error("Invalid era: " + value.era);
11427
- eraIndex = $735220c2d4774dd3$var$cycleValue(eraIndex, amount, 0, eras.length - 1, options === null || options === void 0 ? void 0 : options.round);
11428
- mutable.era = eras[eraIndex];
11429
- $735220c2d4774dd3$export$c4e2ecac49351ef2(mutable);
11430
- break;
10514
+ /**
10515
+ * Returns a new `CalendarDateTime` with the given field adjusted by a specified amount.
10516
+ * When the resulting value reaches the limits of the field, it wraps around.
10517
+ */
10518
+ cycle(field, amount, options) {
10519
+ switch (field) {
10520
+ case "era":
10521
+ case "year":
10522
+ case "month":
10523
+ case "day":
10524
+ return $735220c2d4774dd3$export$d52ced6badfb9a4c(this, field, amount, options);
10525
+ default:
10526
+ return $735220c2d4774dd3$export$dd02b3e0007dfe28(this, field, amount, options);
11431
10527
  }
11432
- case "year":
11433
- var _mutable_calendar_isInverseEra, _mutable_calendar;
11434
- if ((_mutable_calendar_isInverseEra = (_mutable_calendar = mutable.calendar).isInverseEra) === null || _mutable_calendar_isInverseEra === void 0 ? void 0 : _mutable_calendar_isInverseEra.call(_mutable_calendar, mutable)) amount = -amount;
11435
- mutable.year = $735220c2d4774dd3$var$cycleValue(value.year, amount, -Infinity, 9999, options === null || options === void 0 ? void 0 : options.round);
11436
- if (mutable.year === -Infinity) mutable.year = 1;
11437
- if (mutable.calendar.balanceYearMonth) mutable.calendar.balanceYearMonth(mutable, value);
11438
- break;
11439
- case "month":
11440
- mutable.month = $735220c2d4774dd3$var$cycleValue(value.month, amount, 1, value.calendar.getMonthsInYear(value), options === null || options === void 0 ? void 0 : options.round);
11441
- break;
11442
- case "day":
11443
- mutable.day = $735220c2d4774dd3$var$cycleValue(value.day, amount, 1, value.calendar.getDaysInMonth(value), options === null || options === void 0 ? void 0 : options.round);
11444
- break;
11445
- default:
11446
- throw new Error("Unsupported field " + field);
11447
10528
  }
11448
- if (value.calendar.balanceDate) value.calendar.balanceDate(mutable);
11449
- $735220c2d4774dd3$export$c4e2ecac49351ef2(mutable);
11450
- return mutable;
11451
- }
11452
- function $735220c2d4774dd3$export$dd02b3e0007dfe28(value, field, amount, options) {
11453
- let mutable = value.copy();
11454
- switch (field) {
11455
- case "hour": {
11456
- let hours = value.hour;
11457
- let min = 0;
11458
- let max = 23;
11459
- if ((options === null || options === void 0 ? void 0 : options.hourCycle) === 12) {
11460
- let isPM = hours >= 12;
11461
- min = isPM ? 12 : 0;
11462
- max = isPM ? 23 : 11;
11463
- }
11464
- mutable.hour = $735220c2d4774dd3$var$cycleValue(hours, amount, min, max, options === null || options === void 0 ? void 0 : options.round);
11465
- break;
11466
- }
11467
- case "minute":
11468
- mutable.minute = $735220c2d4774dd3$var$cycleValue(value.minute, amount, 0, 59, options === null || options === void 0 ? void 0 : options.round);
11469
- break;
11470
- case "second":
11471
- mutable.second = $735220c2d4774dd3$var$cycleValue(value.second, amount, 0, 59, options === null || options === void 0 ? void 0 : options.round);
11472
- break;
11473
- case "millisecond":
11474
- mutable.millisecond = $735220c2d4774dd3$var$cycleValue(value.millisecond, amount, 0, 999, options === null || options === void 0 ? void 0 : options.round);
11475
- break;
11476
- default:
11477
- throw new Error("Unsupported field " + field);
10529
+ /** Converts the date to a native JavaScript Date object in the given time zone. */
10530
+ toDate(timeZone, disambiguation) {
10531
+ return $11d87f3f76e88657$export$e67a095c620b86fe(this, timeZone, disambiguation);
11478
10532
  }
11479
- return mutable;
11480
- }
11481
- function $735220c2d4774dd3$var$cycleValue(value, amount, min, max, round = false) {
11482
- if (round) {
11483
- value += Math.sign(amount);
11484
- if (value < min) value = max;
11485
- let div = Math.abs(amount);
11486
- if (amount > 0) value = Math.ceil(value / div) * div;
11487
- else value = Math.floor(value / div) * div;
11488
- if (value > max) value = min;
11489
- } else {
11490
- value += amount;
11491
- if (value < min) value = max - (min - value - 1);
11492
- else if (value > max) value = min + (value - max - 1);
10533
+ /** Converts the date to an ISO 8601 formatted string. */
10534
+ toString() {
10535
+ return $fae977aafc393c5c$export$4223de14708adc63(this);
10536
+ }
10537
+ /** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */
10538
+ compare(b) {
10539
+ let res = $14e0f24ef4ac5c92$export$68781ddf31c0090f(this, b);
10540
+ if (res === 0) return $14e0f24ef4ac5c92$export$c19a80a9721b80f6(this, $11d87f3f76e88657$export$b21e0b124e224484(b));
10541
+ return res;
10542
+ }
10543
+ constructor(...args) {
10544
+ _class_private_field_init(this, $35ea8db9cb2ccb90$var$_type2, {
10545
+ writable: true,
10546
+ value: void 0
10547
+ });
10548
+ let [calendar, era, year, month, day] = $35ea8db9cb2ccb90$var$shiftArgs(args);
10549
+ this.calendar = calendar;
10550
+ this.era = era;
10551
+ this.year = year;
10552
+ this.month = month;
10553
+ this.day = day;
10554
+ this.hour = args.shift() || 0;
10555
+ this.minute = args.shift() || 0;
10556
+ this.second = args.shift() || 0;
10557
+ this.millisecond = args.shift() || 0;
10558
+ $735220c2d4774dd3$export$c4e2ecac49351ef2(this);
11493
10559
  }
11494
- return value;
11495
10560
  }
11496
- function $735220c2d4774dd3$export$96b1d28349274637(dateTime, duration) {
11497
- let ms;
11498
- if (duration.years != null && duration.years !== 0 || duration.months != null && duration.months !== 0 || duration.weeks != null && duration.weeks !== 0 || duration.days != null && duration.days !== 0) {
11499
- let res2 = $735220c2d4774dd3$export$e16d8520af44a096($11d87f3f76e88657$export$b21e0b124e224484(dateTime), {
11500
- years: duration.years,
11501
- months: duration.months,
11502
- weeks: duration.weeks,
11503
- days: duration.days
10561
+ var $35ea8db9cb2ccb90$var$_type3 = /* @__PURE__ */ new WeakMap();
10562
+ class $35ea8db9cb2ccb90$export$d3b7288e7994edea {
10563
+ /** Returns a copy of this date. */
10564
+ copy() {
10565
+ if (this.era) return new $35ea8db9cb2ccb90$export$d3b7288e7994edea(this.calendar, this.era, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond);
10566
+ else return new $35ea8db9cb2ccb90$export$d3b7288e7994edea(this.calendar, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond);
10567
+ }
10568
+ /** Returns a new `ZonedDateTime` with the given duration added to it. */
10569
+ add(duration) {
10570
+ return $735220c2d4774dd3$export$96b1d28349274637(this, duration);
10571
+ }
10572
+ /** Returns a new `ZonedDateTime` with the given duration subtracted from it. */
10573
+ subtract(duration) {
10574
+ return $735220c2d4774dd3$export$6814caac34ca03c7(this, duration);
10575
+ }
10576
+ /** Returns a new `ZonedDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */
10577
+ set(fields, disambiguation) {
10578
+ return $735220c2d4774dd3$export$31b5430eb18be4f8(this, fields, disambiguation);
10579
+ }
10580
+ /**
10581
+ * Returns a new `ZonedDateTime` with the given field adjusted by a specified amount.
10582
+ * When the resulting value reaches the limits of the field, it wraps around.
10583
+ */
10584
+ cycle(field, amount, options) {
10585
+ return $735220c2d4774dd3$export$9a297d111fc86b79(this, field, amount, options);
10586
+ }
10587
+ /** Converts the date to a native JavaScript Date object. */
10588
+ toDate() {
10589
+ return $11d87f3f76e88657$export$83aac07b4c37b25(this);
10590
+ }
10591
+ /** Converts the date to an ISO 8601 formatted string, including the UTC offset and time zone identifier. */
10592
+ toString() {
10593
+ return $fae977aafc393c5c$export$bf79f1ebf4b18792(this);
10594
+ }
10595
+ /** Converts the date to an ISO 8601 formatted string in UTC. */
10596
+ toAbsoluteString() {
10597
+ return this.toDate().toISOString();
10598
+ }
10599
+ /** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */
10600
+ compare(b) {
10601
+ return this.toDate().getTime() - $11d87f3f76e88657$export$84c95a83c799e074(b, this.timeZone).toDate().getTime();
10602
+ }
10603
+ constructor(...args) {
10604
+ _class_private_field_init(this, $35ea8db9cb2ccb90$var$_type3, {
10605
+ writable: true,
10606
+ value: void 0
11504
10607
  });
11505
- ms = $11d87f3f76e88657$export$5107c82f94518f5c(res2, dateTime.timeZone);
11506
- } else
11507
- ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(dateTime) - dateTime.offset;
11508
- ms += duration.milliseconds || 0;
11509
- ms += (duration.seconds || 0) * 1e3;
11510
- ms += (duration.minutes || 0) * 6e4;
11511
- ms += (duration.hours || 0) * 36e5;
11512
- let res = $11d87f3f76e88657$export$1b96692a1ba042ac(ms, dateTime.timeZone);
11513
- return $11d87f3f76e88657$export$b4a036af3fc0b032(res, dateTime.calendar);
11514
- }
11515
- function $735220c2d4774dd3$export$6814caac34ca03c7(dateTime, duration) {
11516
- return $735220c2d4774dd3$export$96b1d28349274637(dateTime, $735220c2d4774dd3$export$3e2544e88a25bff8(duration));
10608
+ let [calendar, era, year, month, day] = $35ea8db9cb2ccb90$var$shiftArgs(args);
10609
+ let timeZone = args.shift();
10610
+ let offset = args.shift();
10611
+ this.calendar = calendar;
10612
+ this.era = era;
10613
+ this.year = year;
10614
+ this.month = month;
10615
+ this.day = day;
10616
+ this.timeZone = timeZone;
10617
+ this.offset = offset;
10618
+ this.hour = args.shift() || 0;
10619
+ this.minute = args.shift() || 0;
10620
+ this.second = args.shift() || 0;
10621
+ this.millisecond = args.shift() || 0;
10622
+ $735220c2d4774dd3$export$c4e2ecac49351ef2(this);
10623
+ }
11517
10624
  }
11518
- function $735220c2d4774dd3$export$9a297d111fc86b79(dateTime, field, amount, options) {
11519
- switch (field) {
11520
- case "hour": {
11521
- let min = 0;
11522
- let max = 23;
11523
- if ((options === null || options === void 0 ? void 0 : options.hourCycle) === 12) {
11524
- let isPM = dateTime.hour >= 12;
11525
- min = isPM ? 12 : 0;
11526
- max = isPM ? 23 : 11;
11527
- }
11528
- let plainDateTime = $11d87f3f76e88657$export$b21e0b124e224484(dateTime);
11529
- let minDate = $11d87f3f76e88657$export$b4a036af3fc0b032($735220c2d4774dd3$export$e5d5e1c1822b6e56(plainDateTime, {
11530
- hour: min
11531
- }), new $3b62074eb05584b2$export$80ee6245ec4f29ec());
11532
- let minAbsolute = [
11533
- $11d87f3f76e88657$export$5107c82f94518f5c(minDate, dateTime.timeZone, "earlier"),
11534
- $11d87f3f76e88657$export$5107c82f94518f5c(minDate, dateTime.timeZone, "later")
11535
- ].filter((ms2) => $11d87f3f76e88657$export$1b96692a1ba042ac(ms2, dateTime.timeZone).day === minDate.day)[0];
11536
- let maxDate = $11d87f3f76e88657$export$b4a036af3fc0b032($735220c2d4774dd3$export$e5d5e1c1822b6e56(plainDateTime, {
11537
- hour: max
11538
- }), new $3b62074eb05584b2$export$80ee6245ec4f29ec());
11539
- let maxAbsolute = [
11540
- $11d87f3f76e88657$export$5107c82f94518f5c(maxDate, dateTime.timeZone, "earlier"),
11541
- $11d87f3f76e88657$export$5107c82f94518f5c(maxDate, dateTime.timeZone, "later")
11542
- ].filter((ms2) => $11d87f3f76e88657$export$1b96692a1ba042ac(ms2, dateTime.timeZone).day === maxDate.day).pop();
11543
- let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(dateTime) - dateTime.offset;
11544
- let hours = Math.floor(ms / $735220c2d4774dd3$var$ONE_HOUR);
11545
- let remainder = ms % $735220c2d4774dd3$var$ONE_HOUR;
11546
- ms = $735220c2d4774dd3$var$cycleValue(hours, amount, Math.floor(minAbsolute / $735220c2d4774dd3$var$ONE_HOUR), Math.floor(maxAbsolute / $735220c2d4774dd3$var$ONE_HOUR), options === null || options === void 0 ? void 0 : options.round) * $735220c2d4774dd3$var$ONE_HOUR + remainder;
11547
- return $11d87f3f76e88657$export$b4a036af3fc0b032($11d87f3f76e88657$export$1b96692a1ba042ac(ms, dateTime.timeZone), dateTime.calendar);
11548
- }
11549
- case "minute":
11550
- case "second":
11551
- case "millisecond":
11552
- return $735220c2d4774dd3$export$dd02b3e0007dfe28(dateTime, field, amount, options);
11553
- case "era":
11554
- case "year":
11555
- case "month":
11556
- case "day": {
11557
- let res = $735220c2d4774dd3$export$d52ced6badfb9a4c($11d87f3f76e88657$export$b21e0b124e224484(dateTime), field, amount, options);
11558
- let ms = $11d87f3f76e88657$export$5107c82f94518f5c(res, dateTime.timeZone);
11559
- return $11d87f3f76e88657$export$b4a036af3fc0b032($11d87f3f76e88657$export$1b96692a1ba042ac(ms, dateTime.timeZone), dateTime.calendar);
10625
+ let $fb18d541ea1ad717$var$formatterCache = /* @__PURE__ */ new Map();
10626
+ class $fb18d541ea1ad717$export$ad991b66133851cf {
10627
+ /** Formats a date as a string according to the locale and format options passed to the constructor. */
10628
+ format(value) {
10629
+ return this.formatter.format(value);
10630
+ }
10631
+ /** Formats a date to an array of parts such as separators, numbers, punctuation, and more. */
10632
+ formatToParts(value) {
10633
+ return this.formatter.formatToParts(value);
10634
+ }
10635
+ /** Formats a date range as a string. */
10636
+ formatRange(start, end) {
10637
+ if (typeof this.formatter.formatRange === "function")
10638
+ return this.formatter.formatRange(start, end);
10639
+ if (end < start) throw new RangeError("End date must be >= start date");
10640
+ return `${this.formatter.format(start)} – ${this.formatter.format(end)}`;
10641
+ }
10642
+ /** Formats a date range as an array of parts. */
10643
+ formatRangeToParts(start, end) {
10644
+ if (typeof this.formatter.formatRangeToParts === "function")
10645
+ return this.formatter.formatRangeToParts(start, end);
10646
+ if (end < start) throw new RangeError("End date must be >= start date");
10647
+ let startParts = this.formatter.formatToParts(start);
10648
+ let endParts = this.formatter.formatToParts(end);
10649
+ return [
10650
+ ...startParts.map((p) => ({
10651
+ ...p,
10652
+ source: "startRange"
10653
+ })),
10654
+ {
10655
+ type: "literal",
10656
+ value: "",
10657
+ source: "shared"
10658
+ },
10659
+ ...endParts.map((p) => ({
10660
+ ...p,
10661
+ source: "endRange"
10662
+ }))
10663
+ ];
10664
+ }
10665
+ /** Returns the resolved formatting options based on the values passed to the constructor. */
10666
+ resolvedOptions() {
10667
+ let resolvedOptions = this.formatter.resolvedOptions();
10668
+ if ($fb18d541ea1ad717$var$hasBuggyResolvedHourCycle()) {
10669
+ if (!this.resolvedHourCycle) this.resolvedHourCycle = $fb18d541ea1ad717$var$getResolvedHourCycle(resolvedOptions.locale, this.options);
10670
+ resolvedOptions.hourCycle = this.resolvedHourCycle;
10671
+ resolvedOptions.hour12 = this.resolvedHourCycle === "h11" || this.resolvedHourCycle === "h12";
11560
10672
  }
11561
- default:
11562
- throw new Error("Unsupported field " + field);
10673
+ if (resolvedOptions.calendar === "ethiopic-amete-alem") resolvedOptions.calendar = "ethioaa";
10674
+ return resolvedOptions;
10675
+ }
10676
+ constructor(locale, options = {}) {
10677
+ this.formatter = $fb18d541ea1ad717$var$getCachedDateFormatter(locale, options);
10678
+ this.options = options;
11563
10679
  }
11564
10680
  }
11565
- function $735220c2d4774dd3$export$31b5430eb18be4f8(dateTime, fields, disambiguation) {
11566
- let plainDateTime = $11d87f3f76e88657$export$b21e0b124e224484(dateTime);
11567
- let res = $735220c2d4774dd3$export$e5d5e1c1822b6e56($735220c2d4774dd3$export$adaa4cf7ef1b65be(plainDateTime, fields), fields);
11568
- if (res.compare(plainDateTime) === 0) return dateTime;
11569
- let ms = $11d87f3f76e88657$export$5107c82f94518f5c(res, dateTime.timeZone, disambiguation);
11570
- return $11d87f3f76e88657$export$b4a036af3fc0b032($11d87f3f76e88657$export$1b96692a1ba042ac(ms, dateTime.timeZone), dateTime.calendar);
11571
- }
11572
- const $fae977aafc393c5c$var$DATE_RE = /^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/;
11573
- const $fae977aafc393c5c$var$DATE_TIME_RE = /^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?$/;
11574
- const $fae977aafc393c5c$var$ZONED_DATE_TIME_RE = /^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:([+-]\d{2})(?::?(\d{2}))?)?\[(.*?)\]$/;
11575
- const $fae977aafc393c5c$var$ABSOLUTE_RE = /^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;
11576
- function $fae977aafc393c5c$export$6b862160d295c8e(value) {
11577
- let m = value.match($fae977aafc393c5c$var$DATE_RE);
11578
- if (!m) throw new Error("Invalid ISO 8601 date string: " + value);
11579
- let date = new $35ea8db9cb2ccb90$export$99faa760c7908e4f($fae977aafc393c5c$var$parseNumber(m[1], 0, 9999), $fae977aafc393c5c$var$parseNumber(m[2], 1, 12), 1);
11580
- date.day = $fae977aafc393c5c$var$parseNumber(m[3], 1, date.calendar.getDaysInMonth(date));
11581
- return date;
11582
- }
11583
- function $fae977aafc393c5c$export$588937bcd60ade55(value) {
11584
- let m = value.match($fae977aafc393c5c$var$DATE_TIME_RE);
11585
- if (!m) throw new Error("Invalid ISO 8601 date time string: " + value);
11586
- let year = $fae977aafc393c5c$var$parseNumber(m[1], -9999, 9999);
11587
- let era = year < 1 ? "BC" : "AD";
11588
- let date = new $35ea8db9cb2ccb90$export$ca871e8dbb80966f(era, year < 1 ? -year + 1 : year, $fae977aafc393c5c$var$parseNumber(m[2], 1, 12), 1, m[4] ? $fae977aafc393c5c$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $fae977aafc393c5c$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $fae977aafc393c5c$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $fae977aafc393c5c$var$parseNumber(m[7], 0, Infinity) * 1e3 : 0);
11589
- date.day = $fae977aafc393c5c$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));
11590
- return date;
11591
- }
11592
- function $fae977aafc393c5c$export$fd7893f06e92a6a4(value, disambiguation) {
11593
- let m = value.match($fae977aafc393c5c$var$ZONED_DATE_TIME_RE);
11594
- if (!m) throw new Error("Invalid ISO 8601 date time string: " + value);
11595
- let year = $fae977aafc393c5c$var$parseNumber(m[1], -9999, 9999);
11596
- let era = year < 1 ? "BC" : "AD";
11597
- let date = new $35ea8db9cb2ccb90$export$d3b7288e7994edea(era, year < 1 ? -year + 1 : year, $fae977aafc393c5c$var$parseNumber(m[2], 1, 12), 1, m[10], 0, m[4] ? $fae977aafc393c5c$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $fae977aafc393c5c$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $fae977aafc393c5c$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $fae977aafc393c5c$var$parseNumber(m[7], 0, Infinity) * 1e3 : 0);
11598
- date.day = $fae977aafc393c5c$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));
11599
- let plainDateTime = $11d87f3f76e88657$export$b21e0b124e224484(date);
11600
- let ms;
11601
- if (m[8]) {
11602
- var _m_;
11603
- date.offset = $fae977aafc393c5c$var$parseNumber(m[8], -23, 23) * 36e5 + $fae977aafc393c5c$var$parseNumber((_m_ = m[9]) !== null && _m_ !== void 0 ? _m_ : "0", 0, 59) * 6e4;
11604
- ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(date) - date.offset;
11605
- let absolutes = $11d87f3f76e88657$export$136f38efe7caf549(plainDateTime, date.timeZone);
11606
- if (!absolutes.includes(ms)) throw new Error(`Offset ${$fae977aafc393c5c$var$offsetToString(date.offset)} is invalid for ${$fae977aafc393c5c$export$4223de14708adc63(date)} in ${date.timeZone}`);
11607
- } else
11608
- ms = $11d87f3f76e88657$export$5107c82f94518f5c($11d87f3f76e88657$export$b21e0b124e224484(plainDateTime), date.timeZone, disambiguation);
11609
- return $11d87f3f76e88657$export$1b96692a1ba042ac(ms, date.timeZone);
11610
- }
11611
- function $fae977aafc393c5c$export$5adfdab05168c219(value, timeZone) {
11612
- let m = value.match($fae977aafc393c5c$var$ABSOLUTE_RE);
11613
- if (!m) throw new Error("Invalid ISO 8601 date time string: " + value);
11614
- let year = $fae977aafc393c5c$var$parseNumber(m[1], -9999, 9999);
11615
- let era = year < 1 ? "BC" : "AD";
11616
- let date = new $35ea8db9cb2ccb90$export$d3b7288e7994edea(era, year < 1 ? -year + 1 : year, $fae977aafc393c5c$var$parseNumber(m[2], 1, 12), 1, timeZone, 0, m[4] ? $fae977aafc393c5c$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $fae977aafc393c5c$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $fae977aafc393c5c$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $fae977aafc393c5c$var$parseNumber(m[7], 0, Infinity) * 1e3 : 0);
11617
- date.day = $fae977aafc393c5c$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));
11618
- var _m_;
11619
- if (m[8]) date.offset = $fae977aafc393c5c$var$parseNumber(m[8], -23, 23) * 36e5 + $fae977aafc393c5c$var$parseNumber((_m_ = m[9]) !== null && _m_ !== void 0 ? _m_ : "0", 0, 59) * 6e4;
11620
- return $11d87f3f76e88657$export$538b00033cc11c75(date, timeZone);
10681
+ const $fb18d541ea1ad717$var$hour12Preferences = {
10682
+ true: {
10683
+ // Only Japanese uses the h11 style for 12 hour time. All others use h12.
10684
+ ja: "h11"
10685
+ },
10686
+ false: {}
10687
+ };
10688
+ function $fb18d541ea1ad717$var$getCachedDateFormatter(locale, options = {}) {
10689
+ if (typeof options.hour12 === "boolean" && $fb18d541ea1ad717$var$hasBuggyHour12Behavior()) {
10690
+ options = {
10691
+ ...options
10692
+ };
10693
+ let pref = $fb18d541ea1ad717$var$hour12Preferences[String(options.hour12)][locale.split("-")[0]];
10694
+ let defaultHourCycle = options.hour12 ? "h12" : "h23";
10695
+ options.hourCycle = pref !== null && pref !== void 0 ? pref : defaultHourCycle;
10696
+ delete options.hour12;
10697
+ }
10698
+ let cacheKey = locale + (options ? Object.entries(options).sort((a, b) => a[0] < b[0] ? -1 : 1).join() : "");
10699
+ if ($fb18d541ea1ad717$var$formatterCache.has(cacheKey)) return $fb18d541ea1ad717$var$formatterCache.get(cacheKey);
10700
+ let numberFormatter = new Intl.DateTimeFormat(locale, options);
10701
+ $fb18d541ea1ad717$var$formatterCache.set(cacheKey, numberFormatter);
10702
+ return numberFormatter;
11621
10703
  }
11622
- function $fae977aafc393c5c$var$parseNumber(value, min, max) {
11623
- let val = Number(value);
11624
- if (val < min || val > max) throw new RangeError(`Value out of range: ${min} <= ${val} <= ${max}`);
11625
- return val;
10704
+ let $fb18d541ea1ad717$var$_hasBuggyHour12Behavior = null;
10705
+ function $fb18d541ea1ad717$var$hasBuggyHour12Behavior() {
10706
+ if ($fb18d541ea1ad717$var$_hasBuggyHour12Behavior == null) $fb18d541ea1ad717$var$_hasBuggyHour12Behavior = new Intl.DateTimeFormat("en-US", {
10707
+ hour: "numeric",
10708
+ hour12: false
10709
+ }).format(new Date(2020, 2, 3, 0)) === "24";
10710
+ return $fb18d541ea1ad717$var$_hasBuggyHour12Behavior;
11626
10711
  }
11627
- function $fae977aafc393c5c$export$f59dee82248f5ad4(time) {
11628
- return `${String(time.hour).padStart(2, "0")}:${String(time.minute).padStart(2, "0")}:${String(time.second).padStart(2, "0")}${time.millisecond ? String(time.millisecond / 1e3).slice(1) : ""}`;
10712
+ let $fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle = null;
10713
+ function $fb18d541ea1ad717$var$hasBuggyResolvedHourCycle() {
10714
+ if ($fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle == null) $fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle = new Intl.DateTimeFormat("fr", {
10715
+ hour: "numeric",
10716
+ hour12: false
10717
+ }).resolvedOptions().hourCycle === "h12";
10718
+ return $fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle;
11629
10719
  }
11630
- function $fae977aafc393c5c$export$60dfd74aa96791bd(date) {
11631
- let gregorianDate = $11d87f3f76e88657$export$b4a036af3fc0b032(date, new $3b62074eb05584b2$export$80ee6245ec4f29ec());
11632
- let year;
11633
- if (gregorianDate.era === "BC") year = gregorianDate.year === 1 ? "0000" : "-" + String(Math.abs(1 - gregorianDate.year)).padStart(6, "00");
11634
- else year = String(gregorianDate.year).padStart(4, "0");
11635
- return `${year}-${String(gregorianDate.month).padStart(2, "0")}-${String(gregorianDate.day).padStart(2, "0")}`;
10720
+ function $fb18d541ea1ad717$var$getResolvedHourCycle(locale, options) {
10721
+ if (!options.timeStyle && !options.hour) return void 0;
10722
+ locale = locale.replace(/(-u-)?-nu-[a-zA-Z0-9]+/, "");
10723
+ locale += (locale.includes("-u-") ? "" : "-u") + "-nu-latn";
10724
+ let formatter = $fb18d541ea1ad717$var$getCachedDateFormatter(locale, {
10725
+ ...options,
10726
+ timeZone: void 0
10727
+ // use local timezone
10728
+ });
10729
+ let min = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 0)).find((p) => p.type === "hour").value, 10);
10730
+ let max = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 23)).find((p) => p.type === "hour").value, 10);
10731
+ if (min === 0 && max === 23) return "h23";
10732
+ if (min === 24 && max === 23) return "h24";
10733
+ if (min === 0 && max === 11) return "h11";
10734
+ if (min === 12 && max === 11) return "h12";
10735
+ throw new Error("Unexpected hour cycle result");
11636
10736
  }
11637
- function $fae977aafc393c5c$export$4223de14708adc63(date) {
11638
- return `${$fae977aafc393c5c$export$60dfd74aa96791bd(date)}T${$fae977aafc393c5c$export$f59dee82248f5ad4(date)}`;
10737
+ function formatTime(value) {
10738
+ return $11d87f3f76e88657$export$d33f79e3ffc3dc83($fae977aafc393c5c$export$5adfdab05168c219(value, "Europe/Berlin")).toString().slice(0, -3);
11639
10739
  }
11640
- function $fae977aafc393c5c$var$offsetToString(offset) {
11641
- let sign = Math.sign(offset) < 0 ? "-" : "+";
11642
- offset = Math.abs(offset);
11643
- let offsetHours = Math.floor(offset / 36e5);
11644
- let offsetMinutes = offset % 36e5 / 6e4;
11645
- return `${sign}${String(offsetHours).padStart(2, "0")}:${String(offsetMinutes).padStart(2, "0")}`;
10740
+ function formatCurrency(priceCents) {
10741
+ if (priceCents === void 0) {
10742
+ throw Error("priceCents is required");
10743
+ }
10744
+ return new Intl.NumberFormat("de-DE", {
10745
+ style: "currency",
10746
+ currency: "EUR"
10747
+ }).format(priceCents / 100);
11646
10748
  }
11647
- function $fae977aafc393c5c$export$bf79f1ebf4b18792(date) {
11648
- return `${$fae977aafc393c5c$export$4223de14708adc63(date)}${$fae977aafc393c5c$var$offsetToString(date.offset)}[${date.timeZone}]`;
10749
+ function generateQuantityOptions(min, max) {
10750
+ if (min === 0) min = 1;
10751
+ if (max < min) return [{ value: 0, label: "0" }];
10752
+ return [
10753
+ { value: 0, label: "0" },
10754
+ ...new Array(max - min + 1).fill({}).map((_value, index2) => {
10755
+ return { value: min + index2, label: (min + index2).toString() };
10756
+ })
10757
+ ];
11649
10758
  }
11650
- function _check_private_redeclaration(obj, privateCollection) {
11651
- if (privateCollection.has(obj)) {
11652
- throw new TypeError("Cannot initialize the same private elements twice on an object");
10759
+ class GomusTicket {
10760
+ constructor(ticketObject, minAvailableCapacity = 0, selectedTime = "", quantity) {
10761
+ __publicField(this, "id");
10762
+ __publicField(this, "title");
10763
+ __publicField(this, "description");
10764
+ __publicField(this, "type");
10765
+ __publicField(this, "selectedTime");
10766
+ __publicField(this, "_quantity", 0);
10767
+ __publicField(this, "quantityOptions");
10768
+ __publicField(this, "vatPct");
10769
+ __publicField(this, "priceCents");
10770
+ __publicField(this, "priceFormatted");
10771
+ __publicField(this, "totalPriceCents");
10772
+ __publicField(this, "totalPriceFormatted");
10773
+ __publicField(this, "minQuantity");
10774
+ __publicField(this, "maxQuantity");
10775
+ __publicField(this, "maxPersons");
10776
+ __publicField(this, "startTimes");
10777
+ __publicField(this, "capacities");
10778
+ __publicField(this, "totalCapacities");
10779
+ __publicField(this, "maxCapacity");
10780
+ __publicField(this, "maxTotalCapacity");
10781
+ __publicField(this, "quotaIds");
10782
+ __publicField(this, "shopOrder");
10783
+ __publicField(this, "minAvailableCapacity");
10784
+ __publicField(this, "reductionReason");
10785
+ __publicField(this, "ticketObject");
10786
+ this.ticketObject = ticketObject;
10787
+ this.minAvailableCapacity = minAvailableCapacity;
10788
+ this.id = ticketObject.id;
10789
+ this.title = ticketObject.title;
10790
+ this.description = ticketObject.description;
10791
+ this.type = ticketObject.ticket_type;
10792
+ this.selectedTime = selectedTime;
10793
+ this.vatPct = ticketObject.vat_pct;
10794
+ if (ticketObject.tax_included) {
10795
+ this.priceCents = ticketObject.price_cents;
10796
+ } else {
10797
+ this.priceCents = ticketObject.price_cents * (1 + this.vatPct / 100);
10798
+ }
10799
+ this.priceFormatted = formatCurrency(this.priceCents);
10800
+ this.quantity = quantity || 0;
10801
+ this.minQuantity = ticketObject.min_persons;
10802
+ this.maxPersons = ticketObject.max_persons;
10803
+ this.maxTotalCapacity = ticketObject.max_total_capacity;
10804
+ this.capacities = { ...ticketObject.capacities };
10805
+ this.totalCapacities = { ...ticketObject.total_capacities };
10806
+ this.startTimes = Object.keys(this.capacities).map((key) => {
10807
+ return {
10808
+ startAt: key,
10809
+ timeFormatted: formatTime(key),
10810
+ capacity: this.capacities[key],
10811
+ totalCapacity: this.totalCapacities[key],
10812
+ available: this.capacities[key] >= minAvailableCapacity,
10813
+ selected: this.selectedTime === key,
10814
+ quotaIds: ticketObject.quota_ids
10815
+ };
10816
+ });
10817
+ this.startTimes = this.startTimes.filter((st) => this.totalCapacities[st.startAt]).sort((a, b) => a.startAt > b.startAt ? 1 : -1);
10818
+ this.quotaIds = ticketObject.quota_ids;
10819
+ this.updateMaxCapacity(selectedTime ?? null);
10820
+ this.shopOrder = ticketObject.shop_order ? ticketObject.shop_order : 0;
10821
+ }
10822
+ set quantity(value) {
10823
+ this._quantity = value;
10824
+ this.updateTotalPrices();
10825
+ }
10826
+ get quantity() {
10827
+ return this._quantity;
10828
+ }
10829
+ updateMaxCapacity(isoTime) {
10830
+ if (isoTime) {
10831
+ this.maxCapacity = Math.max(0, this.capacities[isoTime] ?? 0);
10832
+ } else {
10833
+ this.maxCapacity = Math.max(0, ...Object.keys(this.capacities).map((key) => this.capacities[key])) + this.quantity;
10834
+ }
10835
+ this.updateMaxQuantity();
10836
+ }
10837
+ updateMaxQuantity() {
10838
+ this.maxQuantity = Math.min(this.maxPersons, this.maxCapacity);
10839
+ this.quantityOptions = generateQuantityOptions(this.minQuantity, this.maxQuantity);
10840
+ this.updateStartTimes();
10841
+ }
10842
+ updateStartTimes() {
10843
+ this.startTimes.forEach((startTime) => {
10844
+ startTime.capacity = Math.max(this.capacities[startTime.startAt], 0);
10845
+ const selectedQuantity = startTime.startAt === this.selectedTime ? this.quantity : 0;
10846
+ startTime.available = this.capacities[startTime.startAt] + selectedQuantity >= this.quantity && this.capacities[startTime.startAt] + selectedQuantity >= this.minAvailableCapacity;
10847
+ startTime.selected = this.selectedTime === startTime.startAt;
10848
+ });
10849
+ }
10850
+ updateTotalPrices() {
10851
+ this.totalPriceCents = this.quantity * this.priceCents;
10852
+ this.totalPriceFormatted = formatCurrency(this.totalPriceCents);
11653
10853
  }
11654
10854
  }
11655
- function _class_private_field_init(obj, privateMap, value) {
11656
- _check_private_redeclaration(obj, privateMap);
11657
- privateMap.set(obj, value);
10855
+ function initGomusTickets(tickets) {
10856
+ const tmpTickets = {};
10857
+ Object.keys(tickets).forEach((ticketId) => {
10858
+ if (tickets[ticketId]) tmpTickets[ticketId] = new GomusTicket(tickets[ticketId]);
10859
+ });
10860
+ return sort(Object.values(tmpTickets), (f) => f.shopOrder);
11658
10861
  }
11659
- function $35ea8db9cb2ccb90$var$shiftArgs(args) {
11660
- let calendar = typeof args[0] === "object" ? args.shift() : new $3b62074eb05584b2$export$80ee6245ec4f29ec();
11661
- let era;
11662
- if (typeof args[0] === "string") era = args.shift();
11663
- else {
11664
- let eras = calendar.getEras();
11665
- era = eras[eras.length - 1];
10862
+ class Shop {
10863
+ constructor(apiUrl, shopDomain, locale, type = "angular") {
10864
+ __privateAdd(this, _Shop_instances);
10865
+ __privateAdd(this, _data, /* @__PURE__ */ state(proxy({})));
10866
+ // Holds the fetch status and timestamp for data requests, tracking whether the request is ongoing or completed and when it was completed.
10867
+ __privateAdd(this, _fetchStatus, {});
10868
+ __privateAdd(this, _canFetch, () => {
10869
+ return this.apiUrl !== void 0 && this.shopDomain !== void 0 && this.locale !== void 0 && this.client !== void 0;
10870
+ });
10871
+ __privateAdd(this, _ensureFetch, () => {
10872
+ if (this.apiUrl === void 0) {
10873
+ throw new Error("Public API URL is not set");
10874
+ }
10875
+ if (this.shopDomain === void 0) {
10876
+ throw new Error("Shop Domain (X-Shop-Url) is not set");
10877
+ }
10878
+ if (this.locale === void 0) {
10879
+ throw new Error("Locale is not set");
10880
+ }
10881
+ if (this.client === void 0) {
10882
+ throw new Error("client is not set");
10883
+ }
10884
+ if (!__privateGet(this, _canFetch).call(this)) {
10885
+ throw new Error("Fetch is not possible.");
10886
+ }
10887
+ });
10888
+ this.type = type;
10889
+ if (apiUrl && shopDomain && locale) {
10890
+ this.load(apiUrl, shopDomain, locale, type);
10891
+ }
11666
10892
  }
11667
- let year = args.shift();
11668
- let month = args.shift();
11669
- let day = args.shift();
11670
- return [
11671
- calendar,
11672
- era,
11673
- year,
11674
- month,
11675
- day
11676
- ];
11677
- }
11678
- var $35ea8db9cb2ccb90$var$_type = /* @__PURE__ */ new WeakMap();
11679
- class $35ea8db9cb2ccb90$export$99faa760c7908e4f {
11680
- /** Returns a copy of this date. */
11681
- copy() {
11682
- if (this.era) return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this.calendar, this.era, this.year, this.month, this.day);
11683
- else return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this.calendar, this.year, this.month, this.day);
10893
+ async load(apiUrl, shopDomain, locale, type = "angular") {
10894
+ if (apiUrl.includes("jmb-staging.gomus.de") || apiUrl.includes("jmb.gomus.de")) {
10895
+ this.type = "jmb";
10896
+ }
10897
+ get(__privateGet(this, _data)).urls = shopUrlProvider(this.type);
10898
+ get(__privateGet(this, _data)).currentUser = getUserProvider(this.type);
10899
+ get(__privateGet(this, _data)).apiUrl = apiUrl;
10900
+ get(__privateGet(this, _data)).shopDomain = shopDomain;
10901
+ get(__privateGet(this, _data)).locale = locale || "de";
10902
+ __privateSet(this, _fetchStatus, {});
10903
+ get(__privateGet(this, _data)).client = client(apiUrl, shopDomain);
10904
+ await this.waitForAllFetches(this.shop);
11684
10905
  }
11685
- /** Returns a new `CalendarDate` with the given duration added to it. */
11686
- add(duration) {
11687
- return $735220c2d4774dd3$export$e16d8520af44a096(this, duration);
10906
+ get currentUser() {
10907
+ return get(__privateGet(this, _data)).currentUser;
11688
10908
  }
11689
- /** Returns a new `CalendarDate` with the given duration subtracted from it. */
11690
- subtract(duration) {
11691
- return $735220c2d4774dd3$export$4e2d2ead65e5f7e3(this, duration);
10909
+ get slug() {
10910
+ var _a2, _b2;
10911
+ return (_b2 = (_a2 = this.shopDomain) == null ? void 0 : _a2.match(/^(?:https?:\/\/)?([^.-]+)/)) == null ? void 0 : _b2[1];
11692
10912
  }
11693
- /** Returns a new `CalendarDate` with the given fields set to the provided values. Other fields will be constrained accordingly. */
11694
- set(fields) {
11695
- return $735220c2d4774dd3$export$adaa4cf7ef1b65be(this, fields);
10913
+ get client() {
10914
+ return get(__privateGet(this, _data)).client;
11696
10915
  }
11697
- /**
11698
- * Returns a new `CalendarDate` with the given field adjusted by a specified amount.
11699
- * When the resulting value reaches the limits of the field, it wraps around.
11700
- */
11701
- cycle(field, amount, options) {
11702
- return $735220c2d4774dd3$export$d52ced6badfb9a4c(this, field, amount, options);
10916
+ get name() {
10917
+ var _a2;
10918
+ return (_a2 = this.shop) == null ? void 0 : _a2.name;
11703
10919
  }
11704
- /** Converts the date to a native JavaScript Date object, with the time set to midnight in the given time zone. */
11705
- toDate(timeZone) {
11706
- return $11d87f3f76e88657$export$e67a095c620b86fe(this, timeZone);
10920
+ get config() {
10921
+ var _a2;
10922
+ return (_a2 = this.shop) == null ? void 0 : _a2.config;
11707
10923
  }
11708
- /** Converts the date to an ISO 8601 formatted string. */
11709
- toString() {
11710
- return $fae977aafc393c5c$export$60dfd74aa96791bd(this);
10924
+ get payment_modes() {
10925
+ var _a2;
10926
+ return (_a2 = this.shop) == null ? void 0 : _a2.payment_modes;
11711
10927
  }
11712
- /** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */
11713
- compare(b) {
11714
- return $14e0f24ef4ac5c92$export$68781ddf31c0090f(this, b);
10928
+ get content() {
10929
+ var _a2;
10930
+ return (_a2 = this.shop) == null ? void 0 : _a2.content;
11715
10931
  }
11716
- constructor(...args) {
11717
- _class_private_field_init(this, $35ea8db9cb2ccb90$var$_type, {
11718
- writable: true,
11719
- value: void 0
11720
- });
11721
- let [calendar, era, year, month, day] = $35ea8db9cb2ccb90$var$shiftArgs(args);
11722
- this.calendar = calendar;
11723
- this.era = era;
11724
- this.year = year;
11725
- this.month = month;
11726
- this.day = day;
11727
- $735220c2d4774dd3$export$c4e2ecac49351ef2(this);
10932
+ get settings() {
10933
+ var _a2;
10934
+ return (_a2 = this.shop) == null ? void 0 : _a2.settings;
11728
10935
  }
11729
- }
11730
- var $35ea8db9cb2ccb90$var$_type1 = /* @__PURE__ */ new WeakMap();
11731
- class $35ea8db9cb2ccb90$export$680ea196effce5f {
11732
- /** Returns a copy of this time. */
11733
- copy() {
11734
- return new $35ea8db9cb2ccb90$export$680ea196effce5f(this.hour, this.minute, this.second, this.millisecond);
10936
+ get donations() {
10937
+ var _a2;
10938
+ return (_a2 = this.shop) == null ? void 0 : _a2.config.donations;
11735
10939
  }
11736
- /** Returns a new `Time` with the given duration added to it. */
11737
- add(duration) {
11738
- return $735220c2d4774dd3$export$7ed87b6bc2506470(this, duration);
10940
+ get translations() {
10941
+ var _a2;
10942
+ return (_a2 = this.shop) == null ? void 0 : _a2.translations;
11739
10943
  }
11740
- /** Returns a new `Time` with the given duration subtracted from it. */
11741
- subtract(duration) {
11742
- return $735220c2d4774dd3$export$fe34d3a381cd7501(this, duration);
10944
+ get currency() {
10945
+ var _a2;
10946
+ return (_a2 = this.shop) == null ? void 0 : _a2.config.currency;
10947
+ }
10948
+ t(key, values) {
10949
+ return this.translate(key, values);
10950
+ }
10951
+ translate(key, values) {
10952
+ var _a2;
10953
+ if (!((_a2 = this.translations) == null ? void 0 : _a2[key])) return "";
10954
+ let translatedString = this.translations[key];
10955
+ if (values && translatedString) {
10956
+ for (const [key2, value] of Object.entries(values)) {
10957
+ translatedString = translatedString.replace(`{{${key2}}}`, value);
10958
+ }
10959
+ }
10960
+ return translatedString || "";
10961
+ }
10962
+ get apiUrl() {
10963
+ return get(__privateGet(this, _data)).apiUrl;
10964
+ }
10965
+ get shopDomain() {
10966
+ return get(__privateGet(this, _data)).shopDomain;
10967
+ }
10968
+ get baseUrl() {
10969
+ return "https://" + this.shopDomain;
10970
+ }
10971
+ get locale() {
10972
+ return get(__privateGet(this, _data)).locale;
10973
+ }
10974
+ get shop() {
10975
+ return this.fetchAndCache("/api/v4/shop", "shop", "shop");
10976
+ }
10977
+ get _data() {
10978
+ return get(__privateGet(this, _data));
10979
+ }
10980
+ ticketsCalendar(params) {
10981
+ return this.fetchAndCache(TICKETS_CALENDAR_ENDPOINT, `ticketsCalendar-${JSON.stringify(params)}`, "data", { cache: 60, query: params });
11743
10982
  }
11744
- /** Returns a new `Time` with the given fields set to the provided values. Other fields will be constrained accordingly. */
11745
- set(fields) {
11746
- return $735220c2d4774dd3$export$e5d5e1c1822b6e56(this, fields);
10983
+ ticketsAndQuotas(params) {
10984
+ return this.fetchAndCache(TICKET_AND_QUOTAS_ENDPOINT, `ticketsAndQuotas-${JSON.stringify(params)}`, "", { cache: 60, query: params });
11747
10985
  }
11748
10986
  /**
11749
- * Returns a new `Time` with the given field adjusted by a specified amount.
11750
- * When the resulting value reaches the limits of the field, it wraps around.
11751
- */
11752
- cycle(field, amount, options) {
11753
- return $735220c2d4774dd3$export$dd02b3e0007dfe28(this, field, amount, options);
10987
+ * Returns a reactive value that will contain the fetched data, no need to await.
10988
+ *
10989
+ * @param {`/api${string}`} endpoint - The API endpoint to fetch data from. Must start with `/api`.
10990
+ * @param {string} dataKey - The key where the fetched data will be stored in `shop.#data`.
10991
+ * @param {string} responseKey - The key in the API response that contains the desired data.
10992
+ * @param [options]
10993
+ * - query: A record of query parameters to include in the API request.
10994
+ * - cache: The cache duration (in seconds) before data is considered expired. Defaults to 1000 seconds if not provided.
10995
+ * @return {T} The data fetched from the API or the cached data if it is still valid.
10996
+ */
10997
+ fetchAndCache(endpoint, dataKey, responseKey, options) {
10998
+ var _a2;
10999
+ options ?? (options = {});
11000
+ options.query ?? (options.query = {});
11001
+ options.cache ?? (options.cache = 1e3);
11002
+ const query = assign(options.query, { per_page: 1e3 });
11003
+ if (!__privateGet(this, _canFetch).call(this)) return get(__privateGet(this, _data))[dataKey];
11004
+ const fetchId = endpoint + JSON.stringify(query);
11005
+ const isNotFetchedYet = !__privateGet(this, _fetchStatus)[fetchId];
11006
+ const isCacheExpired = ((_a2 = __privateGet(this, _fetchStatus)[fetchId]) == null ? void 0 : _a2.fetchedAt) < Date.now() - options.cache * 1e3;
11007
+ if (isNotFetchedYet || isCacheExpired) {
11008
+ this.apiGet(endpoint, query).then((ret) => {
11009
+ get(__privateGet(this, _data))[dataKey] = responseKey === "" ? ret : ret[responseKey];
11010
+ });
11011
+ }
11012
+ return get(__privateGet(this, _data))[dataKey];
11754
11013
  }
11755
- /** Converts the time to an ISO 8601 formatted string. */
11756
- toString() {
11757
- return $fae977aafc393c5c$export$f59dee82248f5ad4(this);
11014
+ get museums() {
11015
+ return this.fetchAndCache("/api/v4/museums", "museums", "museums");
11758
11016
  }
11759
- /** Compares this time with another. A negative result indicates that this time is before the given one, and a positive time indicates that it is after. */
11760
- compare(b) {
11761
- return $14e0f24ef4ac5c92$export$c19a80a9721b80f6(this, b);
11017
+ get exhibitions() {
11018
+ return this.fetchAndCache("/api/v4/exhibitions", "exhibitions", "exhibitions");
11762
11019
  }
11763
- constructor(hour = 0, minute = 0, second = 0, millisecond = 0) {
11764
- _class_private_field_init(this, $35ea8db9cb2ccb90$var$_type1, {
11765
- writable: true,
11766
- value: void 0
11767
- });
11768
- this.hour = hour;
11769
- this.minute = minute;
11770
- this.second = second;
11771
- this.millisecond = millisecond;
11772
- $735220c2d4774dd3$export$7555de1e070510cb(this);
11020
+ getEvent(id) {
11021
+ return this.fetchAndCache(`/api/v4/events/${id}`, `single_event_${id}`, "event");
11773
11022
  }
11774
- }
11775
- var $35ea8db9cb2ccb90$var$_type2 = /* @__PURE__ */ new WeakMap();
11776
- class $35ea8db9cb2ccb90$export$ca871e8dbb80966f {
11777
- /** Returns a copy of this date. */
11778
- copy() {
11779
- if (this.era) return new $35ea8db9cb2ccb90$export$ca871e8dbb80966f(this.calendar, this.era, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);
11780
- else return new $35ea8db9cb2ccb90$export$ca871e8dbb80966f(this.calendar, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);
11023
+ get events() {
11024
+ return this.fetchAndCache("/api/v4/events", "events", "events");
11781
11025
  }
11782
- /** Returns a new `CalendarDateTime` with the given duration added to it. */
11783
- add(duration) {
11784
- return $735220c2d4774dd3$export$e16d8520af44a096(this, duration);
11026
+ get upcomingEvents() {
11027
+ return this.fetchAndCache("/api/v4/events", "events", "events", { query: { by_bookable: true, with_bookings_in_future: 1 } });
11785
11028
  }
11786
- /** Returns a new `CalendarDateTime` with the given duration subtracted from it. */
11787
- subtract(duration) {
11788
- return $735220c2d4774dd3$export$4e2d2ead65e5f7e3(this, duration);
11029
+ get tours() {
11030
+ return this.fetchAndCache("/api/v4/tours", "tours", "tours");
11789
11031
  }
11790
- /** Returns a new `CalendarDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */
11791
- set(fields) {
11792
- return $735220c2d4774dd3$export$adaa4cf7ef1b65be($735220c2d4774dd3$export$e5d5e1c1822b6e56(this, fields), fields);
11032
+ get merchandises() {
11033
+ return this.fetchAndCache("/api/v4/merchandises", "merchandises", "merchandises");
11793
11034
  }
11794
- /**
11795
- * Returns a new `CalendarDateTime` with the given field adjusted by a specified amount.
11796
- * When the resulting value reaches the limits of the field, it wraps around.
11797
- */
11798
- cycle(field, amount, options) {
11799
- switch (field) {
11800
- case "era":
11801
- case "year":
11802
- case "month":
11803
- case "day":
11804
- return $735220c2d4774dd3$export$d52ced6badfb9a4c(this, field, amount, options);
11805
- default:
11806
- return $735220c2d4774dd3$export$dd02b3e0007dfe28(this, field, amount, options);
11035
+ get urls() {
11036
+ return get(__privateGet(this, _data)).urls;
11037
+ }
11038
+ async apiPost(path, { body }) {
11039
+ const ret = await this.client.POST(path, { body, params: __privateGet(this, _Shop_instances, defaultApiParams_get) });
11040
+ console.log("data", ret.data);
11041
+ return ret;
11042
+ }
11043
+ async waitForAllFetches(...variables) {
11044
+ while (Object.values(__privateGet(this, _fetchStatus)).filter((f) => f.status === "fetching").length) {
11045
+ await wait(10);
11807
11046
  }
11808
11047
  }
11809
- /** Converts the date to a native JavaScript Date object in the given time zone. */
11810
- toDate(timeZone, disambiguation) {
11811
- return $11d87f3f76e88657$export$e67a095c620b86fe(this, timeZone, disambiguation);
11048
+ async apiGet(path, query = {}) {
11049
+ __privateGet(this, _ensureFetch).call(this);
11050
+ const fetchId = path + JSON.stringify(query);
11051
+ __privateGet(this, _fetchStatus)[fetchId] = { status: "fetching", fetchedAt: Date.now() };
11052
+ let params = __privateGet(this, _Shop_instances, defaultApiParams_get);
11053
+ if (query) {
11054
+ params = assign(params, { params: { query } });
11055
+ }
11056
+ const ret = await this.client.GET(path, params);
11057
+ __privateGet(this, _fetchStatus)[fetchId] = { status: "completed", fetchedAt: Date.now() };
11058
+ return ret.data;
11812
11059
  }
11813
- /** Converts the date to an ISO 8601 formatted string. */
11814
- toString() {
11815
- return $fae977aafc393c5c$export$4223de14708adc63(this);
11060
+ }
11061
+ _data = new WeakMap();
11062
+ _fetchStatus = new WeakMap();
11063
+ _Shop_instances = new WeakSet();
11064
+ defaultApiParams_get = function() {
11065
+ return {
11066
+ params: {
11067
+ query: { locale: this.locale },
11068
+ header: { "X-Shop-Url": this.shopDomain }
11069
+ }
11070
+ };
11071
+ };
11072
+ _canFetch = new WeakMap();
11073
+ _ensureFetch = new WeakMap();
11074
+ const shop = new Shop();
11075
+ function GomusInit($$anchor, $$props) {
11076
+ push($$props, true);
11077
+ let apiUrl = prop($$props, "apiUrl", 7), shopDomain = prop($$props, "shopDomain", 7), locale = prop($$props, "locale", 7);
11078
+ locale(locale() || localStorage.getItem("lang") || "en");
11079
+ user_effect(() => {
11080
+ if (shopDomain() !== shop.shopDomain || apiUrl() !== shop.apiUrl || locale() !== shop.locale) {
11081
+ shop.load(apiUrl(), shopDomain(), locale());
11082
+ console.log("shop loaded due to prop change");
11083
+ }
11084
+ });
11085
+ return pop({
11086
+ get apiUrl() {
11087
+ return apiUrl();
11088
+ },
11089
+ set apiUrl($$value) {
11090
+ apiUrl($$value);
11091
+ flushSync();
11092
+ },
11093
+ get shopDomain() {
11094
+ return shopDomain();
11095
+ },
11096
+ set shopDomain($$value) {
11097
+ shopDomain($$value);
11098
+ flushSync();
11099
+ },
11100
+ get locale() {
11101
+ return locale();
11102
+ },
11103
+ set locale($$value) {
11104
+ locale($$value);
11105
+ flushSync();
11106
+ }
11107
+ });
11108
+ }
11109
+ customElements.define("gomus-init", create_custom_element(
11110
+ GomusInit,
11111
+ {
11112
+ apiUrl: { attribute: "api-url", type: "String" },
11113
+ shopDomain: { attribute: "shop-domain", type: "String" },
11114
+ locale: { attribute: "locale", type: "String" }
11115
+ },
11116
+ [],
11117
+ [],
11118
+ false
11119
+ ));
11120
+ function createSetDetails(KEY2) {
11121
+ return function(host, details) {
11122
+ if (host) {
11123
+ host.addEventListener(KEY2, (e) => {
11124
+ e.detail.data = details;
11125
+ });
11126
+ }
11127
+ setContext(KEY2, details);
11128
+ };
11129
+ }
11130
+ function createGetDetails(KEY2) {
11131
+ return function(host) {
11132
+ if (host) {
11133
+ const container = proxy({ data: void 0 });
11134
+ host.dispatchEvent(new CustomEvent(KEY2, { detail: container, bubbles: true }));
11135
+ return container.data;
11136
+ } else {
11137
+ return getContext(KEY2);
11138
+ }
11139
+ };
11140
+ }
11141
+ class TicketSelectionDetails {
11142
+ constructor() {
11143
+ __privateAdd(this, _mode, /* @__PURE__ */ state());
11144
+ __privateAdd(this, _filters, /* @__PURE__ */ state());
11145
+ __privateAdd(this, _eventId, /* @__PURE__ */ state());
11146
+ __privateAdd(this, _museumIds, /* @__PURE__ */ state());
11147
+ __privateAdd(this, _exhibitionIds, /* @__PURE__ */ state());
11148
+ __privateAdd(this, _selectedDate, /* @__PURE__ */ state());
11149
+ __privateAdd(this, _selectedTimeslot, /* @__PURE__ */ state());
11150
+ __privateAdd(this, _selectedTickets, /* @__PURE__ */ state(proxy([])));
11151
+ __privateAdd(this, _ticketList, /* @__PURE__ */ state(proxy([])));
11816
11152
  }
11817
- /** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */
11818
- compare(b) {
11819
- let res = $14e0f24ef4ac5c92$export$68781ddf31c0090f(this, b);
11820
- if (res === 0) return $14e0f24ef4ac5c92$export$c19a80a9721b80f6(this, $11d87f3f76e88657$export$b21e0b124e224484(b));
11821
- return res;
11153
+ get mode() {
11154
+ return get(__privateGet(this, _mode));
11822
11155
  }
11823
- constructor(...args) {
11824
- _class_private_field_init(this, $35ea8db9cb2ccb90$var$_type2, {
11825
- writable: true,
11826
- value: void 0
11827
- });
11828
- let [calendar, era, year, month, day] = $35ea8db9cb2ccb90$var$shiftArgs(args);
11829
- this.calendar = calendar;
11830
- this.era = era;
11831
- this.year = year;
11832
- this.month = month;
11833
- this.day = day;
11834
- this.hour = args.shift() || 0;
11835
- this.minute = args.shift() || 0;
11836
- this.second = args.shift() || 0;
11837
- this.millisecond = args.shift() || 0;
11838
- $735220c2d4774dd3$export$c4e2ecac49351ef2(this);
11156
+ set mode(value) {
11157
+ set(__privateGet(this, _mode), value, true);
11839
11158
  }
11840
- }
11841
- var $35ea8db9cb2ccb90$var$_type3 = /* @__PURE__ */ new WeakMap();
11842
- class $35ea8db9cb2ccb90$export$d3b7288e7994edea {
11843
- /** Returns a copy of this date. */
11844
- copy() {
11845
- if (this.era) return new $35ea8db9cb2ccb90$export$d3b7288e7994edea(this.calendar, this.era, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond);
11846
- else return new $35ea8db9cb2ccb90$export$d3b7288e7994edea(this.calendar, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond);
11159
+ get filters() {
11160
+ return get(__privateGet(this, _filters));
11847
11161
  }
11848
- /** Returns a new `ZonedDateTime` with the given duration added to it. */
11849
- add(duration) {
11850
- return $735220c2d4774dd3$export$96b1d28349274637(this, duration);
11162
+ set filters(value) {
11163
+ set(__privateGet(this, _filters), value, true);
11851
11164
  }
11852
- /** Returns a new `ZonedDateTime` with the given duration subtracted from it. */
11853
- subtract(duration) {
11854
- return $735220c2d4774dd3$export$6814caac34ca03c7(this, duration);
11165
+ get eventId() {
11166
+ return get(__privateGet(this, _eventId));
11855
11167
  }
11856
- /** Returns a new `ZonedDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */
11857
- set(fields, disambiguation) {
11858
- return $735220c2d4774dd3$export$31b5430eb18be4f8(this, fields, disambiguation);
11168
+ set eventId(value) {
11169
+ set(__privateGet(this, _eventId), value, true);
11859
11170
  }
11860
- /**
11861
- * Returns a new `ZonedDateTime` with the given field adjusted by a specified amount.
11862
- * When the resulting value reaches the limits of the field, it wraps around.
11863
- */
11864
- cycle(field, amount, options) {
11865
- return $735220c2d4774dd3$export$9a297d111fc86b79(this, field, amount, options);
11171
+ get museumIds() {
11172
+ return get(__privateGet(this, _museumIds));
11866
11173
  }
11867
- /** Converts the date to a native JavaScript Date object. */
11868
- toDate() {
11869
- return $11d87f3f76e88657$export$83aac07b4c37b25(this);
11174
+ set museumIds(value) {
11175
+ set(__privateGet(this, _museumIds), value, true);
11870
11176
  }
11871
- /** Converts the date to an ISO 8601 formatted string, including the UTC offset and time zone identifier. */
11872
- toString() {
11873
- return $fae977aafc393c5c$export$bf79f1ebf4b18792(this);
11177
+ get exhibitionIds() {
11178
+ return get(__privateGet(this, _exhibitionIds));
11874
11179
  }
11875
- /** Converts the date to an ISO 8601 formatted string in UTC. */
11876
- toAbsoluteString() {
11877
- return this.toDate().toISOString();
11180
+ set exhibitionIds(value) {
11181
+ set(__privateGet(this, _exhibitionIds), value, true);
11878
11182
  }
11879
- /** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */
11880
- compare(b) {
11881
- return this.toDate().getTime() - $11d87f3f76e88657$export$84c95a83c799e074(b, this.timeZone).toDate().getTime();
11183
+ get selectedDate() {
11184
+ return get(__privateGet(this, _selectedDate));
11882
11185
  }
11883
- constructor(...args) {
11884
- _class_private_field_init(this, $35ea8db9cb2ccb90$var$_type3, {
11885
- writable: true,
11886
- value: void 0
11887
- });
11888
- let [calendar, era, year, month, day] = $35ea8db9cb2ccb90$var$shiftArgs(args);
11889
- let timeZone = args.shift();
11890
- let offset = args.shift();
11891
- this.calendar = calendar;
11892
- this.era = era;
11893
- this.year = year;
11894
- this.month = month;
11895
- this.day = day;
11896
- this.timeZone = timeZone;
11897
- this.offset = offset;
11898
- this.hour = args.shift() || 0;
11899
- this.minute = args.shift() || 0;
11900
- this.second = args.shift() || 0;
11901
- this.millisecond = args.shift() || 0;
11902
- $735220c2d4774dd3$export$c4e2ecac49351ef2(this);
11186
+ set selectedDate(value) {
11187
+ set(__privateGet(this, _selectedDate), value, true);
11903
11188
  }
11904
- }
11905
- let $fb18d541ea1ad717$var$formatterCache = /* @__PURE__ */ new Map();
11906
- class $fb18d541ea1ad717$export$ad991b66133851cf {
11907
- /** Formats a date as a string according to the locale and format options passed to the constructor. */
11908
- format(value) {
11909
- return this.formatter.format(value);
11189
+ get selectedTimeslot() {
11190
+ return get(__privateGet(this, _selectedTimeslot));
11910
11191
  }
11911
- /** Formats a date to an array of parts such as separators, numbers, punctuation, and more. */
11912
- formatToParts(value) {
11913
- return this.formatter.formatToParts(value);
11192
+ set selectedTimeslot(value) {
11193
+ set(__privateGet(this, _selectedTimeslot), value, true);
11914
11194
  }
11915
- /** Formats a date range as a string. */
11916
- formatRange(start, end) {
11917
- if (typeof this.formatter.formatRange === "function")
11918
- return this.formatter.formatRange(start, end);
11919
- if (end < start) throw new RangeError("End date must be >= start date");
11920
- return `${this.formatter.format(start)} – ${this.formatter.format(end)}`;
11195
+ get selectedTickets() {
11196
+ return get(__privateGet(this, _selectedTickets));
11921
11197
  }
11922
- /** Formats a date range as an array of parts. */
11923
- formatRangeToParts(start, end) {
11924
- if (typeof this.formatter.formatRangeToParts === "function")
11925
- return this.formatter.formatRangeToParts(start, end);
11926
- if (end < start) throw new RangeError("End date must be >= start date");
11927
- let startParts = this.formatter.formatToParts(start);
11928
- let endParts = this.formatter.formatToParts(end);
11929
- return [
11930
- ...startParts.map((p) => ({
11931
- ...p,
11932
- source: "startRange"
11933
- })),
11934
- {
11935
- type: "literal",
11936
- value: " – ",
11937
- source: "shared"
11938
- },
11939
- ...endParts.map((p) => ({
11940
- ...p,
11941
- source: "endRange"
11942
- }))
11943
- ];
11198
+ set selectedTickets(value) {
11199
+ set(__privateGet(this, _selectedTickets), value, true);
11944
11200
  }
11945
- /** Returns the resolved formatting options based on the values passed to the constructor. */
11946
- resolvedOptions() {
11947
- let resolvedOptions = this.formatter.resolvedOptions();
11948
- if ($fb18d541ea1ad717$var$hasBuggyResolvedHourCycle()) {
11949
- if (!this.resolvedHourCycle) this.resolvedHourCycle = $fb18d541ea1ad717$var$getResolvedHourCycle(resolvedOptions.locale, this.options);
11950
- resolvedOptions.hourCycle = this.resolvedHourCycle;
11951
- resolvedOptions.hour12 = this.resolvedHourCycle === "h11" || this.resolvedHourCycle === "h12";
11952
- }
11953
- if (resolvedOptions.calendar === "ethiopic-amete-alem") resolvedOptions.calendar = "ethioaa";
11954
- return resolvedOptions;
11201
+ get ticketList() {
11202
+ return get(__privateGet(this, _ticketList));
11955
11203
  }
11956
- constructor(locale, options = {}) {
11957
- this.formatter = $fb18d541ea1ad717$var$getCachedDateFormatter(locale, options);
11958
- this.options = options;
11204
+ set ticketList(value) {
11205
+ set(__privateGet(this, _ticketList), value, true);
11959
11206
  }
11960
- }
11961
- const $fb18d541ea1ad717$var$hour12Preferences = {
11962
- true: {
11963
- // Only Japanese uses the h11 style for 12 hour time. All others use h12.
11964
- ja: "h11"
11965
- },
11966
- false: {}
11967
- };
11968
- function $fb18d541ea1ad717$var$getCachedDateFormatter(locale, options = {}) {
11969
- if (typeof options.hour12 === "boolean" && $fb18d541ea1ad717$var$hasBuggyHour12Behavior()) {
11970
- options = {
11971
- ...options
11972
- };
11973
- let pref = $fb18d541ea1ad717$var$hour12Preferences[String(options.hour12)][locale.split("-")[0]];
11974
- let defaultHourCycle = options.hour12 ? "h12" : "h23";
11975
- options.hourCycle = pref !== null && pref !== void 0 ? pref : defaultHourCycle;
11976
- delete options.hour12;
11207
+ get selectedClasses() {
11208
+ return [
11209
+ this.selectedDate && "is-date-selected",
11210
+ this.selectedTimeslot && "is-timeslot-selected",
11211
+ this.selectedTickets.length && "is-tickets-selected"
11212
+ ].filter(Boolean).join(" ");
11977
11213
  }
11978
- let cacheKey = locale + (options ? Object.entries(options).sort((a, b) => a[0] < b[0] ? -1 : 1).join() : "");
11979
- if ($fb18d541ea1ad717$var$formatterCache.has(cacheKey)) return $fb18d541ea1ad717$var$formatterCache.get(cacheKey);
11980
- let numberFormatter = new Intl.DateTimeFormat(locale, options);
11981
- $fb18d541ea1ad717$var$formatterCache.set(cacheKey, numberFormatter);
11982
- return numberFormatter;
11983
- }
11984
- let $fb18d541ea1ad717$var$_hasBuggyHour12Behavior = null;
11985
- function $fb18d541ea1ad717$var$hasBuggyHour12Behavior() {
11986
- if ($fb18d541ea1ad717$var$_hasBuggyHour12Behavior == null) $fb18d541ea1ad717$var$_hasBuggyHour12Behavior = new Intl.DateTimeFormat("en-US", {
11987
- hour: "numeric",
11988
- hour12: false
11989
- }).format(new Date(2020, 2, 3, 0)) === "24";
11990
- return $fb18d541ea1ad717$var$_hasBuggyHour12Behavior;
11991
- }
11992
- let $fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle = null;
11993
- function $fb18d541ea1ad717$var$hasBuggyResolvedHourCycle() {
11994
- if ($fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle == null) $fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle = new Intl.DateTimeFormat("fr", {
11995
- hour: "numeric",
11996
- hour12: false
11997
- }).resolvedOptions().hourCycle === "h12";
11998
- return $fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle;
11999
- }
12000
- function $fb18d541ea1ad717$var$getResolvedHourCycle(locale, options) {
12001
- if (!options.timeStyle && !options.hour) return void 0;
12002
- locale = locale.replace(/(-u-)?-nu-[a-zA-Z0-9]+/, "");
12003
- locale += (locale.includes("-u-") ? "" : "-u") + "-nu-latn";
12004
- let formatter = $fb18d541ea1ad717$var$getCachedDateFormatter(locale, {
12005
- ...options,
12006
- timeZone: void 0
12007
- // use local timezone
12008
- });
12009
- let min = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 0)).find((p) => p.type === "hour").value, 10);
12010
- let max = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 23)).find((p) => p.type === "hour").value, 10);
12011
- if (min === 0 && max === 23) return "h23";
12012
- if (min === 24 && max === 23) return "h24";
12013
- if (min === 0 && max === 11) return "h11";
12014
- if (min === 12 && max === 11) return "h12";
12015
- throw new Error("Unexpected hour cycle result");
12016
11214
  }
11215
+ _mode = new WeakMap();
11216
+ _filters = new WeakMap();
11217
+ _eventId = new WeakMap();
11218
+ _museumIds = new WeakMap();
11219
+ _exhibitionIds = new WeakMap();
11220
+ _selectedDate = new WeakMap();
11221
+ _selectedTimeslot = new WeakMap();
11222
+ _selectedTickets = new WeakMap();
11223
+ _ticketList = new WeakMap();
11224
+ const KEY = "go-ticket-selection";
11225
+ const setTicketSelectionDetails = createSetDetails(KEY);
11226
+ const getTicketSelectionDetails = createGetDetails(KEY);
12017
11227
  function isFunction(value) {
12018
11228
  return typeof value === "function";
12019
11229
  }
@@ -12889,15 +12099,15 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
12889
12099
  return condition ? "" : void 0;
12890
12100
  }
12891
12101
  class BitsAttrs {
12892
- constructor(config2) {
12102
+ constructor(config) {
12893
12103
  __privateAdd(this, _variant);
12894
12104
  __privateAdd(this, _prefix);
12895
12105
  __publicField(this, "attrs");
12896
- __privateSet(this, _variant, config2.getVariant ? config2.getVariant() : null);
12897
- __privateSet(this, _prefix, __privateGet(this, _variant) ? `data-${__privateGet(this, _variant)}-` : `data-${config2.component}-`);
12106
+ __privateSet(this, _variant, config.getVariant ? config.getVariant() : null);
12107
+ __privateSet(this, _prefix, __privateGet(this, _variant) ? `data-${__privateGet(this, _variant)}-` : `data-${config.component}-`);
12898
12108
  this.getAttr = this.getAttr.bind(this);
12899
12109
  this.selector = this.selector.bind(this);
12900
- this.attrs = Object.fromEntries(config2.parts.map((part) => [part, this.getAttr(part)]));
12110
+ this.attrs = Object.fromEntries(config.parts.map((part) => [part, this.getAttr(part)]));
12901
12111
  }
12902
12112
  getAttr(part, variantOverride) {
12903
12113
  if (variantOverride)
@@ -12910,8 +12120,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
12910
12120
  }
12911
12121
  _variant = new WeakMap();
12912
12122
  _prefix = new WeakMap();
12913
- function createBitsAttrs(config2) {
12914
- const bitsAttrs = new BitsAttrs(config2);
12123
+ function createBitsAttrs(config) {
12124
+ const bitsAttrs = new BitsAttrs(config);
12915
12125
  return {
12916
12126
  ...bitsAttrs.attrs,
12917
12127
  selector: bitsAttrs.selector,
@@ -12943,8 +12153,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
12943
12153
  __publicField(this, "opts");
12944
12154
  const resolveConfigOption = createConfigResolver(parent, opts);
12945
12155
  this.opts = {
12946
- defaultPortalTo: resolveConfigOption((config2) => config2.defaultPortalTo),
12947
- defaultLocale: resolveConfigOption((config2) => config2.defaultLocale)
12156
+ defaultPortalTo: resolveConfigOption((config) => config.defaultPortalTo),
12157
+ defaultLocale: resolveConfigOption((config) => config.defaultLocale)
12948
12158
  };
12949
12159
  }
12950
12160
  }
@@ -12964,19 +12174,19 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
12964
12174
  }
12965
12175
  function createPropResolver(configOption, fallback) {
12966
12176
  return (getProp) => {
12967
- const config2 = getBitsConfig();
12177
+ const config = getBitsConfig();
12968
12178
  return box.with(() => {
12969
12179
  const propValue = getProp();
12970
12180
  if (propValue !== void 0)
12971
12181
  return propValue;
12972
- const option = configOption(config2).current;
12182
+ const option = configOption(config).current;
12973
12183
  if (option !== void 0)
12974
12184
  return option;
12975
12185
  return fallback;
12976
12186
  });
12977
12187
  };
12978
12188
  }
12979
- const resolveLocaleProp = createPropResolver((config2) => config2.defaultLocale, "en");
12189
+ const resolveLocaleProp = createPropResolver((config) => config.defaultLocale, "en");
12980
12190
  globalThis.bitsIdCounter ?? (globalThis.bitsIdCounter = { current: 0 });
12981
12191
  function useId(prefix = "bits") {
12982
12192
  globalThis.bitsIdCounter.current++;
@@ -13986,8 +13196,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
13986
13196
  });
13987
13197
  }
13988
13198
  handleCellClick(_, date) {
13989
- var _a2, _b2, _c, _d, _e, _f;
13990
- if (this.opts.readonly.current || ((_b2 = (_a2 = this.opts.isDateDisabled).current) == null ? void 0 : _b2.call(_a2, date)) || ((_d = (_c = this.opts.isDateUnavailable).current) == null ? void 0 : _d.call(_c, date))) {
13199
+ var _a2, _b2, _c2, _d, _e, _f;
13200
+ if (this.opts.readonly.current || ((_b2 = (_a2 = this.opts.isDateDisabled).current) == null ? void 0 : _b2.call(_a2, date)) || ((_d = (_c2 = this.opts.isDateUnavailable).current) == null ? void 0 : _d.call(_c2, date))) {
13991
13201
  return;
13992
13202
  }
13993
13203
  const prev = this.opts.value.current;
@@ -15919,12 +15129,12 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15919
15129
  }
15920
15130
  _params = new WeakMap();
15921
15131
  const ticketsCalendar = new TicketsCalendar();
15922
- var root_3 = /* @__PURE__ */ from_html(`<!> <!> <!>`, 1);
15132
+ var root_3$1 = /* @__PURE__ */ from_html(`<!> <!> <!>`, 1);
15923
15133
  var root_11 = /* @__PURE__ */ from_html(`<div> </div>`);
15924
15134
  var root_17 = /* @__PURE__ */ from_html(`<div></div> `, 1);
15925
15135
  var root_7 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
15926
15136
  var root_2$2 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
15927
- var root_1$1 = /* @__PURE__ */ from_html(`<div data-calendar-wrapper=""><!></div>`);
15137
+ var root_1$2 = /* @__PURE__ */ from_html(`<div data-calendar-wrapper=""><!></div>`);
15928
15138
  function CalendarUI($$anchor, $$props) {
15929
15139
  push($$props, true);
15930
15140
  let calendarClass = prop($$props, "calendarClass", 7);
@@ -15936,7 +15146,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15936
15146
  bubbles: true
15937
15147
  }));
15938
15148
  });
15939
- var div = root_1$1();
15149
+ var div = root_1$2();
15940
15150
  var node = child(div);
15941
15151
  {
15942
15152
  const children = ($$anchor2, $$arg0) => {
@@ -15947,7 +15157,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15947
15157
  component(node_1, () => Calendar_header, ($$anchor3, Calendar_Header) => {
15948
15158
  Calendar_Header($$anchor3, {
15949
15159
  children: ($$anchor4, $$slotProps) => {
15950
- var fragment_1 = root_3();
15160
+ var fragment_1 = root_3$1();
15951
15161
  var node_2 = first_child(fragment_1);
15952
15162
  component(node_2, () => Calendar_prev_button, ($$anchor5, Calendar_PrevButton) => {
15953
15163
  Calendar_PrevButton($$anchor5, {
@@ -16186,10 +15396,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
16186
15396
  });
16187
15397
  }
16188
15398
  function flattenTicketsIntoSlots(tickets) {
16189
- return alphabetical(Object.values(tickets).flatMap(createTimeSlotEntriesFromTicket), (slot2) => slot2.startAt);
15399
+ return alphabetical(Object.values(tickets).flatMap(createTimeSlotEntriesFromTicket), (slot) => slot.startAt);
16190
15400
  }
16191
15401
  function filterSlotsByQuota(allTimeSlots, quotaId) {
16192
- const slotsForThisQuota = allTimeSlots.filter((slot2) => slot2.quotaIds.includes(quotaId));
15402
+ const slotsForThisQuota = allTimeSlots.filter((slot) => slot.quotaIds.includes(quotaId));
16193
15403
  return slotsForThisQuota;
16194
15404
  }
16195
15405
  function filterSlots(allTimeSlots, quotas) {
@@ -16202,26 +15412,26 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
16202
15412
  }
16203
15413
  function combineSlots(timeSlots) {
16204
15414
  const slotMap = {};
16205
- for (const slot2 of timeSlots) {
16206
- const existing = slotMap[slot2.startAt];
15415
+ for (const slot of timeSlots) {
15416
+ const existing = slotMap[slot.startAt];
16207
15417
  if (existing) {
16208
- existing.capacity += slot2.capacity;
16209
- existing.totalCapacity += slot2.totalCapacity;
16210
- const newQuotaIds = slot2.quotaIds.filter((id) => !existing.quotaIds.includes(id));
15418
+ existing.capacity += slot.capacity;
15419
+ existing.totalCapacity += slot.totalCapacity;
15420
+ const newQuotaIds = slot.quotaIds.filter((id) => !existing.quotaIds.includes(id));
16211
15421
  existing.quotaIds.push(...newQuotaIds);
16212
15422
  existing.available = existing.capacity > 0;
16213
15423
  } else {
16214
- slotMap[slot2.startAt] = { ...slot2 };
15424
+ slotMap[slot.startAt] = { ...slot };
16215
15425
  }
16216
15426
  }
16217
- return alphabetical(Object.values(slotMap), (slot2) => slot2.startAt);
15427
+ return alphabetical(Object.values(slotMap), (slot) => slot.startAt);
16218
15428
  }
16219
15429
  function generateAvailableTimeSlots(tickets, quotas) {
16220
15430
  const ticketSlots = flattenTicketsIntoSlots(tickets);
16221
15431
  const quotaSlots = filterSlots(ticketSlots, quotas);
16222
15432
  return combineSlots(quotaSlots);
16223
15433
  }
16224
- class Details {
15434
+ let Details$1 = (_c = class {
16225
15435
  constructor() {
16226
15436
  __privateAdd(this, _ticketSelectionDetails, /* @__PURE__ */ state());
16227
15437
  }
@@ -16232,21 +15442,30 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
16232
15442
  set(__privateGet(this, _ticketSelectionDetails), value, true);
16233
15443
  }
16234
15444
  get timeslots() {
16235
- var _a2;
15445
+ var _a2, _b2, _c2, _d;
16236
15446
  const date = (_a2 = this.ticketSelectionDetails) == null ? void 0 : _a2.selectedDate;
15447
+ const ticketTypes = (_b2 = this.ticketSelectionDetails) == null ? void 0 : _b2.filters;
15448
+ const museumIds = (_c2 = this.ticketSelectionDetails) == null ? void 0 : _c2.museumIds;
15449
+ const exhibitionIds = (_d = this.ticketSelectionDetails) == null ? void 0 : _d.exhibitionIds;
16237
15450
  if (!date) return [];
16238
- const result = snapshot(shop.ticketsAndQuotas({ valid_at: date.toString() }));
15451
+ const result = snapshot(shop.ticketsAndQuotas({
15452
+ by_bookable: true,
15453
+ valid_at: date.toString(),
15454
+ // @ts-ignore
15455
+ "by_ticket_types[]": ticketTypes,
15456
+ "by_museum_ids[]": [museumIds],
15457
+ "by_exhibition_ids[]": exhibitionIds
15458
+ }));
16239
15459
  if (!result) return [];
16240
15460
  return generateAvailableTimeSlots(result.tickets, result.quotas);
16241
15461
  }
16242
- }
16243
- _ticketSelectionDetails = new WeakMap();
15462
+ }, _ticketSelectionDetails = new WeakMap(), _c);
16244
15463
  var root_2$1 = /* @__PURE__ */ from_html(`<li><label> <input type="radio" name="timeslot"/></label></li>`);
16245
- var root_1 = /* @__PURE__ */ from_html(`<ul data-testid="timeslots" data-go-timeslots=""></ul>`);
15464
+ var root_1$1 = /* @__PURE__ */ from_html(`<ul data-testid="timeslots" data-go-timeslots=""></ul>`);
16246
15465
  function Timeslots($$anchor, $$props) {
16247
15466
  push($$props, true);
16248
15467
  const binding_group = [];
16249
- const details = new Details();
15468
+ const details = new Details$1();
16250
15469
  onMount(() => {
16251
15470
  details.ticketSelectionDetails = getTicketSelectionDetails($$props.$$host);
16252
15471
  });
@@ -16261,7 +15480,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
16261
15480
  var node = first_child(fragment);
16262
15481
  {
16263
15482
  var consequent = ($$anchor2) => {
16264
- var ul = root_1();
15483
+ var ul = root_1$1();
16265
15484
  each(ul, 20, () => details.timeslots, (timeslot) => timeslot, ($$anchor3, timeslot) => {
16266
15485
  var li = root_2$1();
16267
15486
  var label = child(li);
@@ -16368,7 +15587,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
16368
15587
  create_custom_element(Wrapper, { host: {}, children: {} }, [], [], true);
16369
15588
  function TicketSelection($$anchor, $$props) {
16370
15589
  push($$props, true);
16371
- let mode = prop($$props, "mode", 7), filter = prop($$props, "filter", 7), eventId = prop($$props, "eventId", 7), children = prop($$props, "children", 7), restProps = /* @__PURE__ */ rest_props($$props, [
15590
+ let mode = prop($$props, "mode", 7), filter = prop($$props, "filter", 7), eventId = prop($$props, "eventId", 7), children = prop($$props, "children", 7), museumId = prop($$props, "museumId", 7), exhibitionId = prop($$props, "exhibitionId", 7), restProps = /* @__PURE__ */ rest_props($$props, [
16372
15591
  "$$slots",
16373
15592
  "$$events",
16374
15593
  "$$legacy",
@@ -16376,12 +15595,16 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
16376
15595
  "mode",
16377
15596
  "filter",
16378
15597
  "eventId",
16379
- "children"
15598
+ "children",
15599
+ "museumId",
15600
+ "exhibitionId"
16380
15601
  ]);
16381
15602
  const details = new TicketSelectionDetails();
16382
15603
  details.mode = mode();
16383
15604
  details.filters = [filter()];
16384
15605
  details.eventId = eventId();
15606
+ details.museumIds = [museumId()];
15607
+ details.exhibitionIds = [exhibitionId()];
16385
15608
  setTicketSelectionDetails($$props.$$host, details);
16386
15609
  let cls = /* @__PURE__ */ user_derived(() => [
16387
15610
  "go-ticket-selection",
@@ -16429,6 +15652,20 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
16429
15652
  set children($$value) {
16430
15653
  children($$value);
16431
15654
  flushSync();
15655
+ },
15656
+ get museumId() {
15657
+ return museumId();
15658
+ },
15659
+ set museumId($$value) {
15660
+ museumId($$value);
15661
+ flushSync();
15662
+ },
15663
+ get exhibitionId() {
15664
+ return exhibitionId();
15665
+ },
15666
+ set exhibitionId($$value) {
15667
+ exhibitionId($$value);
15668
+ flushSync();
16432
15669
  }
16433
15670
  });
16434
15671
  }
@@ -16438,10 +15675,151 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
16438
15675
  mode: { attribute: "mode", reflect: true, type: "String" },
16439
15676
  eventId: { attribute: "event-id", reflect: true, type: "Number" },
16440
15677
  filter: {},
16441
- children: {}
15678
+ children: {},
15679
+ museumId: {},
15680
+ exhibitionId: {}
16442
15681
  },
16443
15682
  [],
16444
15683
  ["details"],
16445
15684
  false
16446
15685
  ));
15686
+ class Details {
15687
+ constructor() {
15688
+ __privateAdd(this, _ticketSelectionDetails2, /* @__PURE__ */ state());
15689
+ }
15690
+ get ticketSelectionDetails() {
15691
+ return get(__privateGet(this, _ticketSelectionDetails2));
15692
+ }
15693
+ set ticketSelectionDetails(value) {
15694
+ set(__privateGet(this, _ticketSelectionDetails2), value, true);
15695
+ }
15696
+ get tickets() {
15697
+ var _a2, _b2, _c2, _d, _e;
15698
+ const date = (_a2 = this.ticketSelectionDetails) == null ? void 0 : _a2.selectedDate;
15699
+ const ticketTypes = (_b2 = this.ticketSelectionDetails) == null ? void 0 : _b2.filters;
15700
+ const museumIds = (_c2 = this.ticketSelectionDetails) == null ? void 0 : _c2.museumIds;
15701
+ const exhibitionIds = (_d = this.ticketSelectionDetails) == null ? void 0 : _d.exhibitionIds;
15702
+ if (!date && !((_e = this.ticketSelectionDetails) == null ? void 0 : _e.selectedTimeslot)) return [];
15703
+ const result = snapshot(shop.ticketsAndQuotas({
15704
+ by_bookable: true,
15705
+ valid_at: date == null ? void 0 : date.toString(),
15706
+ // @ts-ignore
15707
+ "by_ticket_types[]": ticketTypes,
15708
+ "by_museum_ids[]": [museumIds],
15709
+ "by_exhibition_ids[]": exhibitionIds
15710
+ }));
15711
+ if (!result) return [];
15712
+ return initGomusTickets(result.tickets);
15713
+ }
15714
+ }
15715
+ _ticketSelectionDetails2 = new WeakMap();
15716
+ var root_4 = /* @__PURE__ */ from_html(`<option> </option>`);
15717
+ var root_3 = /* @__PURE__ */ from_html(`<tr><td><select></select></td><td><p> </p> <!></td><td> </td><td> </td></tr>`);
15718
+ var root_1 = /* @__PURE__ */ from_html(`<table><thead><tr><th>Quantity</th><th>Ticket</th><th>Price</th><th>Total</th></tr></thead><tbody></tbody></table>`);
15719
+ function Tickets($$anchor, $$props) {
15720
+ push($$props, true);
15721
+ const details = new Details();
15722
+ onMount(() => {
15723
+ details.ticketSelectionDetails = getTicketSelectionDetails($$props.$$host);
15724
+ });
15725
+ let selection = prop($$props, "selection", 7), timeslot = prop($$props, "timeslot", 7);
15726
+ function hasTimeSlotInCapacities(ticket) {
15727
+ var _a2;
15728
+ if ((_a2 = details.ticketSelectionDetails) == null ? void 0 : _a2.selectedTimeslot) {
15729
+ return Object.keys(ticket.capacities).includes(details.ticketSelectionDetails.selectedTimeslot);
15730
+ } else {
15731
+ return false;
15732
+ }
15733
+ }
15734
+ var fragment = comment();
15735
+ var node = first_child(fragment);
15736
+ {
15737
+ var consequent_1 = ($$anchor2) => {
15738
+ var table = root_1();
15739
+ var tbody = sibling(child(table));
15740
+ each(tbody, 20, () => Object.values(details.tickets), (ticket) => ticket, ($$anchor3, ticket) => {
15741
+ var fragment_1 = comment();
15742
+ var node_1 = first_child(fragment_1);
15743
+ {
15744
+ var consequent = ($$anchor4) => {
15745
+ var tr = root_3();
15746
+ let classes;
15747
+ var td = child(tr);
15748
+ var select = child(td);
15749
+ each(select, 21, () => ticket.quantityOptions, index, ($$anchor5, quantity) => {
15750
+ var option = root_4();
15751
+ var text2 = child(option, true);
15752
+ reset(option);
15753
+ var option_value = {};
15754
+ template_effect(() => {
15755
+ set_selected(option, get(quantity).selected);
15756
+ set_text(text2, get(quantity).label);
15757
+ if (option_value !== (option_value = get(quantity).value)) {
15758
+ option.value = (option.__value = get(quantity).value) ?? "";
15759
+ }
15760
+ });
15761
+ append($$anchor5, option);
15762
+ });
15763
+ reset(select);
15764
+ reset(td);
15765
+ var td_1 = sibling(td);
15766
+ var p = child(td_1);
15767
+ var text_1 = child(p, true);
15768
+ reset(p);
15769
+ var node_2 = sibling(p, 2);
15770
+ html(node_2, () => ticket.description);
15771
+ reset(td_1);
15772
+ var td_2 = sibling(td_1);
15773
+ var text_2 = child(td_2, true);
15774
+ reset(td_2);
15775
+ var td_3 = sibling(td_2);
15776
+ var text_3 = child(td_3, true);
15777
+ reset(td_3);
15778
+ reset(tr);
15779
+ template_effect(
15780
+ ($0) => {
15781
+ classes = set_class(tr, 1, "", null, classes, $0);
15782
+ set_attribute(select, "name", ticket.id);
15783
+ set_text(text_1, ticket.title);
15784
+ set_text(text_2, ticket.priceFormatted);
15785
+ set_text(text_3, ticket.totalPriceFormatted);
15786
+ },
15787
+ [() => ({ hidden: hasTimeSlotInCapacities(ticket) })]
15788
+ );
15789
+ append($$anchor4, tr);
15790
+ };
15791
+ if_block(node_1, ($$render) => {
15792
+ if (hasTimeSlotInCapacities(ticket)) $$render(consequent);
15793
+ });
15794
+ }
15795
+ append($$anchor3, fragment_1);
15796
+ });
15797
+ reset(tbody);
15798
+ reset(table);
15799
+ append($$anchor2, table);
15800
+ };
15801
+ if_block(node, ($$render) => {
15802
+ if (details.ticketSelectionDetails && details.ticketSelectionDetails.selectedTimeslot) $$render(consequent_1);
15803
+ });
15804
+ }
15805
+ append($$anchor, fragment);
15806
+ return pop({
15807
+ details,
15808
+ get selection() {
15809
+ return selection();
15810
+ },
15811
+ set selection($$value) {
15812
+ selection($$value);
15813
+ flushSync();
15814
+ },
15815
+ get timeslot() {
15816
+ return timeslot();
15817
+ },
15818
+ set timeslot($$value) {
15819
+ timeslot($$value);
15820
+ flushSync();
15821
+ }
15822
+ });
15823
+ }
15824
+ customElements.define("go-tickets", create_custom_element(Tickets, { selection: {}, timeslot: {} }, [], ["details"], false));
16447
15825
  })();