@gomusdev/web-components 1.57.0 → 1.57.2

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.
@@ -3536,23 +3536,23 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
3536
3536
  function pause_effects(state2, to_destroy, controlled_anchor) {
3537
3537
  var transitions = [];
3538
3538
  var length = to_destroy.length;
3539
- var group;
3539
+ var group2;
3540
3540
  var remaining = to_destroy.length;
3541
3541
  for (var i = 0; i < length; i++) {
3542
3542
  let effect2 = to_destroy[i];
3543
3543
  pause_effect(
3544
3544
  effect2,
3545
3545
  () => {
3546
- if (group) {
3547
- group.pending.delete(effect2);
3548
- group.done.add(effect2);
3549
- if (group.pending.size === 0) {
3546
+ if (group2) {
3547
+ group2.pending.delete(effect2);
3548
+ group2.done.add(effect2);
3549
+ if (group2.pending.size === 0) {
3550
3550
  var groups = (
3551
3551
  /** @type {Set<EachOutroGroup>} */
3552
3552
  state2.outrogroups
3553
3553
  );
3554
- destroy_effects(array_from(group.done));
3555
- groups.delete(group);
3554
+ destroy_effects(array_from(group2.done));
3555
+ groups.delete(group2);
3556
3556
  if (groups.size === 0) {
3557
3557
  state2.outrogroups = null;
3558
3558
  }
@@ -3581,11 +3581,11 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
3581
3581
  }
3582
3582
  destroy_effects(to_destroy, !fast_path);
3583
3583
  } else {
3584
- group = {
3584
+ group2 = {
3585
3585
  pending: new Set(to_destroy),
3586
3586
  done: /* @__PURE__ */ new Set()
3587
3587
  };
3588
- (state2.outrogroups ??= /* @__PURE__ */ new Set()).add(group);
3588
+ (state2.outrogroups ??= /* @__PURE__ */ new Set()).add(group2);
3589
3589
  }
3590
3590
  }
3591
3591
  function destroy_effects(to_destroy, remove_dom = true) {
@@ -3762,9 +3762,9 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
3762
3762
  effect2 = /** @type {EachItem} */
3763
3763
  items.get(key).e;
3764
3764
  if (state2.outrogroups !== null) {
3765
- for (const group of state2.outrogroups) {
3766
- group.pending.delete(effect2);
3767
- group.done.delete(effect2);
3765
+ for (const group2 of state2.outrogroups) {
3766
+ group2.pending.delete(effect2);
3767
+ group2.done.delete(effect2);
3768
3768
  }
3769
3769
  }
3770
3770
  if ((effect2.f & EFFECT_OFFSCREEN) !== 0) {
@@ -3845,10 +3845,10 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
3845
3845
  current = skip_to_branch(effect2.next);
3846
3846
  }
3847
3847
  if (state2.outrogroups !== null) {
3848
- for (const group of state2.outrogroups) {
3849
- if (group.pending.size === 0) {
3850
- destroy_effects(array_from(group.done));
3851
- state2.outrogroups?.delete(group);
3848
+ for (const group2 of state2.outrogroups) {
3849
+ if (group2.pending.size === 0) {
3850
+ destroy_effects(array_from(group2.done));
3851
+ state2.outrogroups?.delete(group2);
3852
3852
  }
3853
3853
  }
3854
3854
  if (state2.outrogroups.size === 0) {
@@ -4840,11 +4840,11 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
4840
4840
  input.checked = Boolean(value);
4841
4841
  });
4842
4842
  }
4843
- function get_binding_group_value(group, __value, checked) {
4843
+ function get_binding_group_value(group2, __value, checked) {
4844
4844
  var value = /* @__PURE__ */ new Set();
4845
- for (var i = 0; i < group.length; i += 1) {
4846
- if (group[i].checked) {
4847
- value.add(group[i].__value);
4845
+ for (var i = 0; i < group2.length; i += 1) {
4846
+ if (group2[i].checked) {
4847
+ value.add(group2[i].__value);
4848
4848
  }
4849
4849
  }
4850
4850
  if (!checked) {
@@ -5618,6 +5618,15 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
5618
5618
  return false;
5619
5619
  }
5620
5620
  };
5621
+ const group = (array2, getGroupId) => {
5622
+ return array2.reduce((acc, item) => {
5623
+ const groupId = getGroupId(item);
5624
+ if (!acc[groupId])
5625
+ acc[groupId] = [];
5626
+ acc[groupId].push(item);
5627
+ return acc;
5628
+ }, {});
5629
+ };
5621
5630
  const boil = (array2, compareFunc) => {
5622
5631
  if (!array2 || (array2.length ?? 0) === 0)
5623
5632
  return null;
@@ -5633,10 +5642,24 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
5633
5642
  const dsc = (a2, b) => getter(b) - getter(a2);
5634
5643
  return array2.slice().sort(desc === true ? dsc : asc);
5635
5644
  };
5645
+ function max$2(array2, getter) {
5646
+ const get2 = getter ?? ((v) => v);
5647
+ return boil(array2, (a2, b) => get2(a2) > get2(b) ? a2 : b);
5648
+ }
5636
5649
  function min$2(array2, getter) {
5637
- const get2 = ((v) => v);
5650
+ const get2 = getter ?? ((v) => v);
5638
5651
  return boil(array2, (a2, b) => get2(a2) < get2(b) ? a2 : b);
5639
5652
  }
5653
+ const unique = (array2, toKey) => {
5654
+ const valueMap = array2.reduce((acc, item) => {
5655
+ const key = item;
5656
+ if (acc[key])
5657
+ return acc;
5658
+ acc[key] = item;
5659
+ return acc;
5660
+ }, {});
5661
+ return Object.values(valueMap);
5662
+ };
5640
5663
  const iterate = (count, func, initValue) => {
5641
5664
  let value = initValue;
5642
5665
  for (let i = 1; i <= count; i++) {
@@ -11154,18 +11177,14 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
11154
11177
  return totalCap;
11155
11178
  },
11156
11179
  timeslotsOn(date2) {
11157
- const filtered = Object.values(
11158
- this.timeslots().filter((x) => x.timeSlot.startsWith(date2.toString())).reduce(
11159
- (acc, item) => {
11160
- if (!acc[item.timeSlot] || item.capacity < acc[item.timeSlot].capacity) {
11161
- acc[item.timeSlot] = item;
11162
- }
11163
- return acc;
11164
- },
11165
- {}
11166
- )
11167
- );
11168
- return filtered.sort((a2, b) => a2.timeSlot.localeCompare(b.timeSlot));
11180
+ const rows = this.timeslots().filter((x) => x.timeSlot.startsWith(date2.toString()));
11181
+ const bySlot = group(rows, (r2) => r2.timeSlot);
11182
+ const result = Object.values(bySlot).map((slotRows) => {
11183
+ const tickets = unique(slotRows.flatMap((r2) => r2.tickets));
11184
+ const bindingPerTicket = tickets.map((t) => min$2(slotRows.filter((r2) => r2.tickets.includes(t)), (r2) => r2.capacity)).filter((r2) => r2 !== null);
11185
+ return max$2(bindingPerTicket, (r2) => r2.capacity) ?? slotRows[0];
11186
+ });
11187
+ return result.sort((a2, b) => a2.timeSlot.localeCompare(b.timeSlot));
11169
11188
  }
11170
11189
  };
11171
11190
  return ret;
@@ -35876,8 +35895,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
35876
35895
  var consequent = ($$anchor2) => {
35877
35896
  var ul = root_1$1();
35878
35897
  each(ul, 20, () => details.timeslots, (timeslot) => timeslot, ($$anchor3, timeslot) => {
35879
- const soldOut = /* @__PURE__ */ user_derived(() => timeslot.capacity === 0);
35880
- const disabled = /* @__PURE__ */ user_derived(() => get$2(soldOut) || !timeslot.available);
35898
+ const unavailable = /* @__PURE__ */ user_derived(() => timeslot.totalCapacity === 0);
35899
+ const soldOut = /* @__PURE__ */ user_derived(() => !get$2(unavailable) && timeslot.capacity === 0);
35900
+ const disabled = /* @__PURE__ */ user_derived(() => get$2(unavailable) || get$2(soldOut) || !timeslot.available);
35881
35901
  const selected = /* @__PURE__ */ user_derived(() => details.tsd?.selectedTimeslot === timeslot.startAt);
35882
35902
  var li = root_2$1();
35883
35903
  var label = child(li);
@@ -35891,6 +35911,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
35891
35911
  template_effect(() => {
35892
35912
  set_class(li, 1, clsx({
35893
35913
  "go-timeslot": true,
35914
+ "is-unavailable": get$2(unavailable),
35894
35915
  "is-sold-out": get$2(soldOut),
35895
35916
  "is-disabled": get$2(disabled),
35896
35917
  "is-selected": get$2(selected)
@@ -3534,23 +3534,23 @@ function index$1(_, i) {
3534
3534
  function pause_effects(state2, to_destroy, controlled_anchor) {
3535
3535
  var transitions = [];
3536
3536
  var length = to_destroy.length;
3537
- var group;
3537
+ var group2;
3538
3538
  var remaining = to_destroy.length;
3539
3539
  for (var i = 0; i < length; i++) {
3540
3540
  let effect2 = to_destroy[i];
3541
3541
  pause_effect(
3542
3542
  effect2,
3543
3543
  () => {
3544
- if (group) {
3545
- group.pending.delete(effect2);
3546
- group.done.add(effect2);
3547
- if (group.pending.size === 0) {
3544
+ if (group2) {
3545
+ group2.pending.delete(effect2);
3546
+ group2.done.add(effect2);
3547
+ if (group2.pending.size === 0) {
3548
3548
  var groups = (
3549
3549
  /** @type {Set<EachOutroGroup>} */
3550
3550
  state2.outrogroups
3551
3551
  );
3552
- destroy_effects(array_from(group.done));
3553
- groups.delete(group);
3552
+ destroy_effects(array_from(group2.done));
3553
+ groups.delete(group2);
3554
3554
  if (groups.size === 0) {
3555
3555
  state2.outrogroups = null;
3556
3556
  }
@@ -3579,11 +3579,11 @@ function pause_effects(state2, to_destroy, controlled_anchor) {
3579
3579
  }
3580
3580
  destroy_effects(to_destroy, !fast_path);
3581
3581
  } else {
3582
- group = {
3582
+ group2 = {
3583
3583
  pending: new Set(to_destroy),
3584
3584
  done: /* @__PURE__ */ new Set()
3585
3585
  };
3586
- (state2.outrogroups ??= /* @__PURE__ */ new Set()).add(group);
3586
+ (state2.outrogroups ??= /* @__PURE__ */ new Set()).add(group2);
3587
3587
  }
3588
3588
  }
3589
3589
  function destroy_effects(to_destroy, remove_dom = true) {
@@ -3760,9 +3760,9 @@ function reconcile(state2, array2, anchor, flags2, get_key) {
3760
3760
  effect2 = /** @type {EachItem} */
3761
3761
  items.get(key).e;
3762
3762
  if (state2.outrogroups !== null) {
3763
- for (const group of state2.outrogroups) {
3764
- group.pending.delete(effect2);
3765
- group.done.delete(effect2);
3763
+ for (const group2 of state2.outrogroups) {
3764
+ group2.pending.delete(effect2);
3765
+ group2.done.delete(effect2);
3766
3766
  }
3767
3767
  }
3768
3768
  if ((effect2.f & EFFECT_OFFSCREEN) !== 0) {
@@ -3843,10 +3843,10 @@ function reconcile(state2, array2, anchor, flags2, get_key) {
3843
3843
  current = skip_to_branch(effect2.next);
3844
3844
  }
3845
3845
  if (state2.outrogroups !== null) {
3846
- for (const group of state2.outrogroups) {
3847
- if (group.pending.size === 0) {
3848
- destroy_effects(array_from(group.done));
3849
- state2.outrogroups?.delete(group);
3846
+ for (const group2 of state2.outrogroups) {
3847
+ if (group2.pending.size === 0) {
3848
+ destroy_effects(array_from(group2.done));
3849
+ state2.outrogroups?.delete(group2);
3850
3850
  }
3851
3851
  }
3852
3852
  if (state2.outrogroups.size === 0) {
@@ -4839,11 +4839,11 @@ function bind_checked(input, get2, set2 = get2) {
4839
4839
  input.checked = Boolean(value);
4840
4840
  });
4841
4841
  }
4842
- function get_binding_group_value(group, __value, checked) {
4842
+ function get_binding_group_value(group2, __value, checked) {
4843
4843
  var value = /* @__PURE__ */ new Set();
4844
- for (var i = 0; i < group.length; i += 1) {
4845
- if (group[i].checked) {
4846
- value.add(group[i].__value);
4844
+ for (var i = 0; i < group2.length; i += 1) {
4845
+ if (group2[i].checked) {
4846
+ value.add(group2[i].__value);
4847
4847
  }
4848
4848
  }
4849
4849
  if (!checked) {
@@ -5618,6 +5618,15 @@ const isNumber = (value) => {
5618
5618
  return false;
5619
5619
  }
5620
5620
  };
5621
+ const group = (array2, getGroupId) => {
5622
+ return array2.reduce((acc, item) => {
5623
+ const groupId = getGroupId(item);
5624
+ if (!acc[groupId])
5625
+ acc[groupId] = [];
5626
+ acc[groupId].push(item);
5627
+ return acc;
5628
+ }, {});
5629
+ };
5621
5630
  const boil = (array2, compareFunc) => {
5622
5631
  if (!array2 || (array2.length ?? 0) === 0)
5623
5632
  return null;
@@ -5633,10 +5642,24 @@ const sort = (array2, getter, desc = false) => {
5633
5642
  const dsc = (a2, b) => getter(b) - getter(a2);
5634
5643
  return array2.slice().sort(desc === true ? dsc : asc);
5635
5644
  };
5645
+ function max$2(array2, getter) {
5646
+ const get2 = getter ?? ((v) => v);
5647
+ return boil(array2, (a2, b) => get2(a2) > get2(b) ? a2 : b);
5648
+ }
5636
5649
  function min$2(array2, getter) {
5637
- const get2 = ((v) => v);
5650
+ const get2 = getter ?? ((v) => v);
5638
5651
  return boil(array2, (a2, b) => get2(a2) < get2(b) ? a2 : b);
5639
5652
  }
5653
+ const unique = (array2, toKey) => {
5654
+ const valueMap = array2.reduce((acc, item) => {
5655
+ const key = item;
5656
+ if (acc[key])
5657
+ return acc;
5658
+ acc[key] = item;
5659
+ return acc;
5660
+ }, {});
5661
+ return Object.values(valueMap);
5662
+ };
5640
5663
  const iterate = (count, func, initValue) => {
5641
5664
  let value = initValue;
5642
5665
  for (let i = 1; i <= count; i++) {
@@ -11154,18 +11177,14 @@ function createQuotaManager(quotas) {
11154
11177
  return totalCap;
11155
11178
  },
11156
11179
  timeslotsOn(date2) {
11157
- const filtered = Object.values(
11158
- this.timeslots().filter((x) => x.timeSlot.startsWith(date2.toString())).reduce(
11159
- (acc, item) => {
11160
- if (!acc[item.timeSlot] || item.capacity < acc[item.timeSlot].capacity) {
11161
- acc[item.timeSlot] = item;
11162
- }
11163
- return acc;
11164
- },
11165
- {}
11166
- )
11167
- );
11168
- return filtered.sort((a2, b) => a2.timeSlot.localeCompare(b.timeSlot));
11180
+ const rows = this.timeslots().filter((x) => x.timeSlot.startsWith(date2.toString()));
11181
+ const bySlot = group(rows, (r2) => r2.timeSlot);
11182
+ const result = Object.values(bySlot).map((slotRows) => {
11183
+ const tickets = unique(slotRows.flatMap((r2) => r2.tickets));
11184
+ const bindingPerTicket = tickets.map((t) => min$2(slotRows.filter((r2) => r2.tickets.includes(t)), (r2) => r2.capacity)).filter((r2) => r2 !== null);
11185
+ return max$2(bindingPerTicket, (r2) => r2.capacity) ?? slotRows[0];
11186
+ });
11187
+ return result.sort((a2, b) => a2.timeSlot.localeCompare(b.timeSlot));
11169
11188
  }
11170
11189
  };
11171
11190
  return ret;
@@ -35876,8 +35895,9 @@ function Timeslots($$anchor, $$props) {
35876
35895
  var consequent = ($$anchor2) => {
35877
35896
  var ul = root_1$1();
35878
35897
  each(ul, 20, () => details.timeslots, (timeslot) => timeslot, ($$anchor3, timeslot) => {
35879
- const soldOut = /* @__PURE__ */ user_derived(() => timeslot.capacity === 0);
35880
- const disabled = /* @__PURE__ */ user_derived(() => get$2(soldOut) || !timeslot.available);
35898
+ const unavailable = /* @__PURE__ */ user_derived(() => timeslot.totalCapacity === 0);
35899
+ const soldOut = /* @__PURE__ */ user_derived(() => !get$2(unavailable) && timeslot.capacity === 0);
35900
+ const disabled = /* @__PURE__ */ user_derived(() => get$2(unavailable) || get$2(soldOut) || !timeslot.available);
35881
35901
  const selected = /* @__PURE__ */ user_derived(() => details.tsd?.selectedTimeslot === timeslot.startAt);
35882
35902
  var li = root_2$1();
35883
35903
  var label = child(li);
@@ -35891,6 +35911,7 @@ function Timeslots($$anchor, $$props) {
35891
35911
  template_effect(() => {
35892
35912
  set_class(li, 1, clsx({
35893
35913
  "go-timeslot": true,
35914
+ "is-unavailable": get$2(unavailable),
35894
35915
  "is-sold-out": get$2(soldOut),
35895
35916
  "is-disabled": get$2(disabled),
35896
35917
  "is-selected": get$2(selected)
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "Giantmonkey GmbH"
5
5
  },
6
6
  "license": "MIT",
7
- "version": "1.57.0",
7
+ "version": "1.57.2",
8
8
  "type": "module",
9
9
  "main": "./dist-js/gomus-webcomponents.iife.js",
10
10
  "module": "./dist-js/gomus-webcomponents.iife.js",