@gomusdev/web-components 1.56.1 → 1.57.1

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.
@@ -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;
@@ -12635,6 +12654,14 @@ class Shop {
12635
12654
  finalizePersonalizations(token, params) {
12636
12655
  return this.apiPost("/api/v4/annual/personalization/finalize", { body: params, params: { query: { token } } });
12637
12656
  }
12657
+ uploadPersonalizationPhoto(token, personalizationId, file) {
12658
+ const fd = new FormData();
12659
+ fd.append("file", file);
12660
+ return this.apiUpload("/api/v4/annual/personalizations/{id}/upload", {
12661
+ body: fd,
12662
+ params: { path: { id: personalizationId }, query: { token } }
12663
+ });
12664
+ }
12638
12665
  /**
12639
12666
  * Returns a reactive value that will contain the fetched data, no need to await.
12640
12667
  *
@@ -12742,6 +12769,16 @@ class Shop {
12742
12769
  async apiDELETE(path, options) {
12743
12770
  return this.apiCall(path, { method: "DELETE", ...options });
12744
12771
  }
12772
+ async apiUpload(path, options) {
12773
+ this.#ensureApi();
12774
+ const { body, params = {} } = options;
12775
+ const ret = await this.client.POST(path, {
12776
+ body,
12777
+ params: assign(this.#defaultApiParams, { params }).params,
12778
+ bodySerializer: (b) => b
12779
+ });
12780
+ return ret;
12781
+ }
12745
12782
  async apiCall(path, options) {
12746
12783
  this.#ensureApi();
12747
12784
  const { body, params = {}, requiredFields } = options;
@@ -16023,6 +16060,28 @@ function refine(fn, _params = {}) {
16023
16060
  function superRefine(fn) {
16024
16061
  return /* @__PURE__ */ _superRefine(fn);
16025
16062
  }
16063
+ function _instanceof(cls, params = {}) {
16064
+ const inst = new ZodCustom({
16065
+ type: "custom",
16066
+ check: "custom",
16067
+ fn: (data) => data instanceof cls,
16068
+ abort: true,
16069
+ ...normalizeParams(params)
16070
+ });
16071
+ inst._zod.bag.Class = cls;
16072
+ inst._zod.check = (payload) => {
16073
+ if (!(payload.value instanceof cls)) {
16074
+ payload.issues.push({
16075
+ code: "invalid_type",
16076
+ expected: cls.name,
16077
+ input: payload.value,
16078
+ inst,
16079
+ path: [...inst._zod.def.path ?? []]
16080
+ });
16081
+ }
16082
+ };
16083
+ return inst;
16084
+ }
16026
16085
  var allFields = {
16027
16086
  salutation: {
16028
16087
  key: "salutation",
@@ -16209,6 +16268,16 @@ var allFields = {
16209
16268
  description: "",
16210
16269
  autocomplete: "off"
16211
16270
  },
16271
+ photo: {
16272
+ key: "photo",
16273
+ apiKey: "file",
16274
+ type: "file",
16275
+ label: "ticket.annual.personalization.form.photo",
16276
+ placeholder: "",
16277
+ description: "",
16278
+ autocomplete: "off",
16279
+ validator: _instanceof(File)
16280
+ },
16212
16281
  paymentMode: {
16213
16282
  key: "paymentMode",
16214
16283
  apiKey: "payment_mode_id",
@@ -16244,6 +16313,8 @@ function createField(data, required) {
16244
16313
  function defaultValue(fieldType) {
16245
16314
  if (fieldType === "checkbox") {
16246
16315
  return false;
16316
+ } else if (fieldType === "file") {
16317
+ return null;
16247
16318
  } else {
16248
16319
  return "";
16249
16320
  }
@@ -16252,7 +16323,8 @@ function validateField(field) {
16252
16323
  field.errors = [];
16253
16324
  if (!field.validator) {
16254
16325
  if (field.required) {
16255
- if (field.value === false || field.value === "") field.errors = field.value ? [] : [`common.fieldErrors.required`];
16326
+ const empty2 = field.value === false || field.value === "" || field.value === null || field.value === void 0;
16327
+ if (empty2) field.errors = [`common.fieldErrors.required`];
16256
16328
  }
16257
16329
  return;
16258
16330
  }
@@ -16359,6 +16431,33 @@ function AnnualTicketPersonalizationForm($$anchor, $$props) {
16359
16431
  if (!isValid2) {
16360
16432
  return;
16361
16433
  }
16434
+ if (details.ticketSale?.photo_mandatory === "mandatory") {
16435
+ const uploads = personalizationForms.map(async (detail, index2) => {
16436
+ const personalizationId = details.ticketSale.personalizations[index2].id;
16437
+ const photoField = detail.fields.find((f) => f.key === "photo");
16438
+ const file = photoField?.value;
16439
+ if (!(file instanceof File)) {
16440
+ return {
16441
+ ok: false,
16442
+ error: "ticket.annual.personalization.photo.missing"
16443
+ };
16444
+ }
16445
+ const result2 = await shop.uploadPersonalizationPhoto(token(), personalizationId, file);
16446
+ if (result2.error) {
16447
+ return {
16448
+ ok: false,
16449
+ error: result2.error.error ?? "ticket.annual.personalization.photo.upload_failed"
16450
+ };
16451
+ }
16452
+ return { ok: true, error: "" };
16453
+ });
16454
+ const results = await Promise.all(uploads);
16455
+ const firstFailure = results.find((r2) => !r2.ok);
16456
+ if (firstFailure) {
16457
+ form.details.apiErrors = [firstFailure.error];
16458
+ return;
16459
+ }
16460
+ }
16362
16461
  const body = {
16363
16462
  personalization: {
16364
16463
  ticket_sale_id: details.ticketSaleId,
@@ -16495,7 +16594,7 @@ class FormDetails {
16495
16594
  if (!Number.isNaN(+x) && x.trim() !== "") return +x;
16496
16595
  return x;
16497
16596
  }
16498
- const validFields = this.fields.filter((f) => f !== void 0).filter((f) => f.value !== "");
16597
+ const validFields = this.fields.filter((f) => f !== void 0).filter((f) => f.type !== "file").filter((f) => f.value !== "");
16499
16598
  const ret = Object.fromEntries(validFields.map((f) => [f.apiKey, coerce2(f.value)]));
16500
16599
  return ret;
16501
16600
  }
@@ -16955,8 +17054,8 @@ var root_5$2 = /* @__PURE__ */ from_html(`<s class="go-cart-item-price-original"
16955
17054
  var root_6$3 = /* @__PURE__ */ from_html(`<span class="go-cart-item-price-discounted"> </span>`);
16956
17055
  var root_7$4 = /* @__PURE__ */ from_html(`<span> </span>`);
16957
17056
  var root_9$4 = /* @__PURE__ */ from_html(`<option> </option>`);
16958
- var root_8$2 = /* @__PURE__ */ from_html(`<select class="go-cart-item-select"></select>`);
16959
- var root_10$2 = /* @__PURE__ */ from_html(`<li class="go-cart-item-remove"><button>⨉</button></li>`);
17057
+ var root_8$3 = /* @__PURE__ */ from_html(`<select class="go-cart-item-select"></select>`);
17058
+ var root_10$1 = /* @__PURE__ */ from_html(`<li class="go-cart-item-remove"><button>⨉</button></li>`);
16960
17059
  var root_1$i = /* @__PURE__ */ from_html(`<article class="go-cart-item-content"><ul><li class="go-cart-item-title-container"><!></li> <li class="go-cart-item-price"><!></li> <li class="go-cart-item-count"><!></li> <!> <li class="go-cart-item-sum"> </li></ul></article>`);
16961
17060
  function Item$1($$anchor, $$props) {
16962
17061
  push($$props, true);
@@ -17111,7 +17210,7 @@ function Item$1($$anchor, $$props) {
17111
17210
  append($$anchor3, span_2);
17112
17211
  };
17113
17212
  var alternate_2 = ($$anchor3) => {
17114
- var select = root_8$2();
17213
+ var select = root_8$3();
17115
17214
  select.__change = (e) => update(e.target);
17116
17215
  each(select, 21, () => generateQuantityOptions(get$2(capacity).min, get$2(capacity).max, { floor: 1 }), (q) => q.value, ($$anchor4, q) => {
17117
17216
  var option2 = root_9$4();
@@ -17140,7 +17239,7 @@ function Item$1($$anchor, $$props) {
17140
17239
  var node_5 = sibling(li_2, 2);
17141
17240
  {
17142
17241
  var consequent_4 = ($$anchor3) => {
17143
- var li_3 = root_10$2();
17242
+ var li_3 = root_10$1();
17144
17243
  var button = child(li_3);
17145
17244
  button.__click = del;
17146
17245
  reset(li_3);
@@ -31150,7 +31249,7 @@ create_custom_element(Date_picker_trigger, { ref: {}, onkeydown: {} }, [], [], {
31150
31249
  var root_4$4 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
31151
31250
  var root_9$2 = /* @__PURE__ */ from_html(`<!> <!> <!>`, 1);
31152
31251
  var root_11$3 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
31153
- var root_8$1 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
31252
+ var root_8$2 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
31154
31253
  var root_1$b = /* @__PURE__ */ from_html(`<!> <!> <!>`, 1);
31155
31254
  function DatePicker_1($$anchor, $$props) {
31156
31255
  push($$props, true);
@@ -31295,7 +31394,7 @@ function DatePicker_1($$anchor, $$props) {
31295
31394
  const children = ($$anchor6, $$arg0) => {
31296
31395
  let months = () => $$arg0?.().months;
31297
31396
  let weekdays = () => $$arg0?.().weekdays;
31298
- var fragment_8 = root_8$1();
31397
+ var fragment_8 = root_8$2();
31299
31398
  var node_10 = first_child(fragment_8);
31300
31399
  component(node_10, () => Calendar_header, ($$anchor7, DatePicker_Header) => {
31301
31400
  DatePicker_Header($$anchor7, {
@@ -31455,17 +31554,19 @@ create_custom_element(
31455
31554
  var root_2$6 = /* @__PURE__ */ from_html(`<span class="go-field-star" aria-hidden="true">*</span>`);
31456
31555
  var root_1$a = /* @__PURE__ */ from_html(` <!>`, 1);
31457
31556
  var root_3$6 = /* @__PURE__ */ from_html(`<label><!></label> <input/>`, 1);
31458
- var root_4$3 = /* @__PURE__ */ from_html(`<label><input/> <span class="go-checkbox-label"><!></span></label>`);
31459
- var root_7$2 = /* @__PURE__ */ from_html(`<img src="" alt=""/> <option> </option>`, 1);
31460
- var root_6$1 = /* @__PURE__ */ from_html(`<option disabled hidden="" selected> </option> <!>`, 1);
31557
+ var root_5 = /* @__PURE__ */ from_html(`<figure role="status" aria-live="polite"><img class="go-file-preview"/> <figcaption class="go-file-preview-caption"> </figcaption></figure>`);
31558
+ var root_4$3 = /* @__PURE__ */ from_html(`<label><!></label> <input/> <!>`, 1);
31559
+ var root_6$1 = /* @__PURE__ */ from_html(`<label><input/> <span class="go-checkbox-label"><!></span></label>`);
31560
+ var root_9$1 = /* @__PURE__ */ from_html(`<img src="" alt=""/> <option> </option>`, 1);
31561
+ var root_8$1 = /* @__PURE__ */ from_html(`<option disabled hidden="" selected> </option> <!>`, 1);
31461
31562
  var select_content = /* @__PURE__ */ from_html(`<!>`, 1);
31462
- var root_5 = /* @__PURE__ */ from_html(`<label><!></label> <select><!></select>`, 1);
31463
- var root_12$1 = /* @__PURE__ */ from_html(`<img style="width: 60px" aria-hidden="true"/>`);
31464
- var root_11$2 = /* @__PURE__ */ from_html(`<span class="go-payment-mode-icons"></span>`);
31465
- var root_10$1 = /* @__PURE__ */ from_html(`<label><input type="radio"/> <!></label>`);
31466
- var root_9$1 = /* @__PURE__ */ from_html(`<fieldset role="radiogroup"><legend><!></legend> <!></fieldset>`);
31467
- var root_15 = /* @__PURE__ */ from_html(`<label> <input/></label>`);
31468
- var root_13 = /* @__PURE__ */ from_html(`<fieldset><legend><!></legend> <!></fieldset>`);
31563
+ var root_7$2 = /* @__PURE__ */ from_html(`<label><!></label> <select><!></select>`, 1);
31564
+ var root_14 = /* @__PURE__ */ from_html(`<img style="width: 60px" aria-hidden="true"/>`);
31565
+ var root_13 = /* @__PURE__ */ from_html(`<span class="go-payment-mode-icons"></span>`);
31566
+ var root_12$1 = /* @__PURE__ */ from_html(`<label><input type="radio"/> <!></label>`);
31567
+ var root_11$2 = /* @__PURE__ */ from_html(`<fieldset role="radiogroup"><legend><!></legend> <!></fieldset>`);
31568
+ var root_17 = /* @__PURE__ */ from_html(`<label> <input/></label>`);
31569
+ var root_15 = /* @__PURE__ */ from_html(`<fieldset><legend><!></legend> <!></fieldset>`);
31469
31570
  function InputAndLabel($$anchor, $$props) {
31470
31571
  push($$props, true);
31471
31572
  const labelText = ($$anchor2) => {
@@ -31515,11 +31616,73 @@ function InputAndLabel($$anchor, $$props) {
31515
31616
  bind_value(input_1, () => field().value, ($$value) => field(field().value = $$value, true));
31516
31617
  append($$anchor2, fragment_1);
31517
31618
  };
31518
- const checkbox = ($$anchor2) => {
31519
- var label_2 = root_4$3();
31520
- var input_2 = child(label_2);
31619
+ const file = ($$anchor2) => {
31620
+ var fragment_2 = root_4$3();
31621
+ var label_2 = first_child(fragment_2);
31622
+ var node_2 = child(label_2);
31623
+ labelText(node_2);
31624
+ reset(label_2);
31625
+ var input_2 = sibling(label_2, 2);
31626
+ var event_handler = (e) => {
31627
+ const files = e.currentTarget.files;
31628
+ field(field().value = files && files[0] ? files[0] : null, true);
31629
+ if (get$2(details)) get$2(details).validateField(field());
31630
+ else field().validate();
31631
+ };
31521
31632
  attribute_effect(
31522
31633
  input_2,
31634
+ () => ({
31635
+ ...get$2(fieldAttributes),
31636
+ ...restProps,
31637
+ class: inputClass(),
31638
+ type: "file",
31639
+ accept: "image/*",
31640
+ name: field().key,
31641
+ onchange: event_handler
31642
+ }),
31643
+ void 0,
31644
+ void 0,
31645
+ void 0,
31646
+ void 0,
31647
+ true
31648
+ );
31649
+ var node_3 = sibling(input_2, 2);
31650
+ {
31651
+ var consequent_1 = ($$anchor3) => {
31652
+ var figure = root_5();
31653
+ var img = child(figure);
31654
+ var figcaption = sibling(img, 2);
31655
+ var text_1 = child(figcaption, true);
31656
+ reset(figcaption);
31657
+ reset(figure);
31658
+ template_effect(
31659
+ ($0) => {
31660
+ set_attribute(figure, "data-field-preview", field().key);
31661
+ set_attribute(img, "src", get$2(filePreviewUrl));
31662
+ set_attribute(img, "alt", $0);
31663
+ set_text(text_1, field().value.name);
31664
+ },
31665
+ [
31666
+ () => shop.t("forms.file.preview_alt") || "User uploaded photo"
31667
+ ]
31668
+ );
31669
+ append($$anchor3, figure);
31670
+ };
31671
+ if_block(node_3, ($$render) => {
31672
+ if (get$2(filePreviewUrl) && field().value instanceof File) $$render(consequent_1);
31673
+ });
31674
+ }
31675
+ template_effect(() => {
31676
+ set_class(label_2, 1, clsx(labelClass()));
31677
+ set_attribute(label_2, "for", get$2(inputId));
31678
+ });
31679
+ append($$anchor2, fragment_2);
31680
+ };
31681
+ const checkbox = ($$anchor2) => {
31682
+ var label_3 = root_6$1();
31683
+ var input_3 = child(label_3);
31684
+ attribute_effect(
31685
+ input_3,
31523
31686
  () => ({
31524
31687
  ...get$2(fieldAttributes),
31525
31688
  ...restProps,
@@ -31533,17 +31696,17 @@ function InputAndLabel($$anchor, $$props) {
31533
31696
  void 0,
31534
31697
  true
31535
31698
  );
31536
- var span_1 = sibling(input_2, 2);
31537
- var node_2 = child(span_1);
31538
- labelText(node_2);
31699
+ var span_1 = sibling(input_3, 2);
31700
+ var node_4 = child(span_1);
31701
+ labelText(node_4);
31539
31702
  reset(span_1);
31540
- reset(label_2);
31703
+ reset(label_3);
31541
31704
  template_effect(() => {
31542
- set_class(label_2, 1, clsx(labelClass()));
31543
- set_attribute(label_2, "for", get$2(inputId));
31705
+ set_class(label_3, 1, clsx(labelClass()));
31706
+ set_attribute(label_3, "for", get$2(inputId));
31544
31707
  });
31545
31708
  bind_checked(
31546
- input_2,
31709
+ input_3,
31547
31710
  () => {
31548
31711
  return field().value === true;
31549
31712
  },
@@ -31551,15 +31714,15 @@ function InputAndLabel($$anchor, $$props) {
31551
31714
  field(field().value = value, true);
31552
31715
  }
31553
31716
  );
31554
- append($$anchor2, label_2);
31717
+ append($$anchor2, label_3);
31555
31718
  };
31556
31719
  const select = ($$anchor2) => {
31557
- var fragment_2 = root_5();
31558
- var label_3 = first_child(fragment_2);
31559
- var node_3 = child(label_3);
31560
- labelText(node_3);
31561
- reset(label_3);
31562
- var select_1 = sibling(label_3, 2);
31720
+ var fragment_3 = root_7$2();
31721
+ var label_4 = first_child(fragment_3);
31722
+ var node_5 = child(label_4);
31723
+ labelText(node_5);
31724
+ reset(label_4);
31725
+ var select_1 = sibling(label_4, 2);
31563
31726
  attribute_effect(select_1, () => ({
31564
31727
  ...get$2(fieldAttributes),
31565
31728
  ...restProps,
@@ -31568,45 +31731,45 @@ function InputAndLabel($$anchor, $$props) {
31568
31731
  }));
31569
31732
  customizable_select(select_1, () => {
31570
31733
  var anchor = child(select_1);
31571
- var fragment_3 = select_content();
31572
- var node_4 = first_child(fragment_3);
31734
+ var fragment_4 = select_content();
31735
+ var node_6 = first_child(fragment_4);
31573
31736
  {
31574
- var consequent_1 = ($$anchor3) => {
31575
- var fragment_4 = root_6$1();
31576
- var option_1 = first_child(fragment_4);
31577
- var text_1 = child(option_1, true);
31737
+ var consequent_2 = ($$anchor3) => {
31738
+ var fragment_5 = root_8$1();
31739
+ var option_1 = first_child(fragment_5);
31740
+ var text_2 = child(option_1, true);
31578
31741
  reset(option_1);
31579
31742
  option_1.value = option_1.__value = "";
31580
- var node_5 = sibling(option_1, 2);
31581
- each(node_5, 17, () => field().options(), (option2) => option2.value, ($$anchor4, option2) => {
31582
- var fragment_5 = root_7$2();
31583
- var option_2 = sibling(first_child(fragment_5), 2);
31584
- var text_2 = child(option_2, true);
31743
+ var node_7 = sibling(option_1, 2);
31744
+ each(node_7, 17, () => field().options(), (option2) => option2.value, ($$anchor4, option2) => {
31745
+ var fragment_6 = root_9$1();
31746
+ var option_2 = sibling(first_child(fragment_6), 2);
31747
+ var text_3 = child(option_2, true);
31585
31748
  reset(option_2);
31586
31749
  var option_2_value = {};
31587
31750
  template_effect(() => {
31588
- set_text(text_2, get$2(option2).label);
31751
+ set_text(text_3, get$2(option2).label);
31589
31752
  if (option_2_value !== (option_2_value = get$2(option2).value)) {
31590
31753
  option_2.value = (option_2.__value = get$2(option2).value) ?? "";
31591
31754
  }
31592
31755
  });
31593
- append($$anchor4, fragment_5);
31756
+ append($$anchor4, fragment_6);
31594
31757
  });
31595
- template_effect(($0) => set_text(text_1, $0), [() => shop.t("common.choose")]);
31596
- append($$anchor3, fragment_4);
31758
+ template_effect(($0) => set_text(text_2, $0), [() => shop.t("common.choose")]);
31759
+ append($$anchor3, fragment_5);
31597
31760
  };
31598
- if_block(node_4, ($$render) => {
31599
- if (field().options) $$render(consequent_1);
31761
+ if_block(node_6, ($$render) => {
31762
+ if (field().options) $$render(consequent_2);
31600
31763
  });
31601
31764
  }
31602
- append(anchor, fragment_3);
31765
+ append(anchor, fragment_4);
31603
31766
  });
31604
31767
  template_effect(() => {
31605
- set_class(label_3, 1, clsx(labelClass()));
31606
- set_attribute(label_3, "for", get$2(inputId));
31768
+ set_class(label_4, 1, clsx(labelClass()));
31769
+ set_attribute(label_4, "for", get$2(inputId));
31607
31770
  });
31608
31771
  bind_select_value(select_1, () => field().value, ($$value) => field(field().value = $$value, true));
31609
- append($$anchor2, fragment_2);
31772
+ append($$anchor2, fragment_3);
31610
31773
  };
31611
31774
  const date2 = ($$anchor2) => {
31612
31775
  DatePicker_1($$anchor2, {
@@ -31629,48 +31792,48 @@ function InputAndLabel($$anchor, $$props) {
31629
31792
  };
31630
31793
  const paymentMode = ($$anchor2) => {
31631
31794
  const modes = /* @__PURE__ */ user_derived(() => shop.payment_modes ? Object.values(shop.payment_modes) : []);
31632
- var fieldset = root_9$1();
31795
+ var fieldset = root_11$2();
31633
31796
  var legend = child(fieldset);
31634
- var node_6 = child(legend);
31635
- labelText(node_6);
31797
+ var node_8 = child(legend);
31798
+ labelText(node_8);
31636
31799
  reset(legend);
31637
- var node_7 = sibling(legend, 2);
31638
- each(node_7, 17, () => get$2(modes), (mode) => mode.id, ($$anchor3, mode) => {
31639
- var label_4 = root_10$1();
31640
- var input_3 = child(label_4);
31641
- remove_input_defaults(input_3);
31642
- input_3.__change = () => {
31800
+ var node_9 = sibling(legend, 2);
31801
+ each(node_9, 17, () => get$2(modes), (mode) => mode.id, ($$anchor3, mode) => {
31802
+ var label_5 = root_12$1();
31803
+ var input_4 = child(label_5);
31804
+ remove_input_defaults(input_4);
31805
+ input_4.__change = () => {
31643
31806
  field(field().value = String(get$2(mode).id), true);
31644
31807
  };
31645
- var node_8 = sibling(input_3, 2);
31808
+ var node_10 = sibling(input_4, 2);
31646
31809
  {
31647
- var consequent_2 = ($$anchor4) => {
31648
- var span_2 = root_11$2();
31810
+ var consequent_3 = ($$anchor4) => {
31811
+ var span_2 = root_13();
31649
31812
  each(span_2, 20, () => get$2(mode).icons, (icon) => icon, ($$anchor5, icon) => {
31650
31813
  const url = /* @__PURE__ */ user_derived(() => CDN_PATH + icon + ".svg");
31651
- var img = root_12$1();
31814
+ var img_1 = root_14();
31652
31815
  template_effect(() => {
31653
- set_class(img, 1, clsx(icon));
31654
- set_attribute(img, "src", get$2(url));
31655
- set_attribute(img, "alt", icon + " icon");
31816
+ set_class(img_1, 1, clsx(icon));
31817
+ set_attribute(img_1, "src", get$2(url));
31818
+ set_attribute(img_1, "alt", icon + " icon");
31656
31819
  });
31657
- append($$anchor5, img);
31820
+ append($$anchor5, img_1);
31658
31821
  });
31659
31822
  reset(span_2);
31660
31823
  append($$anchor4, span_2);
31661
31824
  };
31662
- if_block(node_8, ($$render) => {
31663
- if (get$2(mode).icons.length > 0) $$render(consequent_2);
31825
+ if_block(node_10, ($$render) => {
31826
+ if (get$2(mode).icons.length > 0) $$render(consequent_3);
31664
31827
  });
31665
31828
  }
31666
- reset(label_4);
31829
+ reset(label_5);
31667
31830
  template_effect(
31668
31831
  ($0, $1, $2) => {
31669
- set_attribute(input_3, "name", field().key);
31670
- set_value(input_3, $0);
31671
- set_checked(input_3, $1);
31672
- set_attribute(input_3, "hidden", get$2(modes).length === 1);
31673
- set_attribute(input_3, "aria-label", $2);
31832
+ set_attribute(input_4, "name", field().key);
31833
+ set_value(input_4, $0);
31834
+ set_checked(input_4, $1);
31835
+ set_attribute(input_4, "hidden", get$2(modes).length === 1);
31836
+ set_attribute(input_4, "aria-label", $2);
31674
31837
  },
31675
31838
  [
31676
31839
  () => String(get$2(mode).id),
@@ -31678,7 +31841,7 @@ function InputAndLabel($$anchor, $$props) {
31678
31841
  () => shop.t(`cart.paymentMode.ariaLabel.${get$2(mode).name.toLowerCase()}`)
31679
31842
  ]
31680
31843
  );
31681
- append($$anchor3, label_4);
31844
+ append($$anchor3, label_5);
31682
31845
  });
31683
31846
  reset(fieldset);
31684
31847
  template_effect(() => {
@@ -31688,22 +31851,22 @@ function InputAndLabel($$anchor, $$props) {
31688
31851
  append($$anchor2, fieldset);
31689
31852
  };
31690
31853
  const radio = ($$anchor2) => {
31691
- var fieldset_1 = root_13();
31854
+ var fieldset_1 = root_15();
31692
31855
  var legend_1 = child(fieldset_1);
31693
- var node_9 = child(legend_1);
31694
- labelText(node_9);
31856
+ var node_11 = child(legend_1);
31857
+ labelText(node_11);
31695
31858
  reset(legend_1);
31696
- var node_10 = sibling(legend_1, 2);
31859
+ var node_12 = sibling(legend_1, 2);
31697
31860
  {
31698
- var consequent_3 = ($$anchor3) => {
31699
- var fragment_7 = comment();
31700
- var node_11 = first_child(fragment_7);
31701
- each(node_11, 17, () => field().options, index$1, ($$anchor4, option2) => {
31702
- var label_5 = root_15();
31703
- var text_3 = child(label_5);
31704
- var input_4 = sibling(text_3);
31861
+ var consequent_4 = ($$anchor3) => {
31862
+ var fragment_8 = comment();
31863
+ var node_13 = first_child(fragment_8);
31864
+ each(node_13, 17, () => field().options, index$1, ($$anchor4, option2) => {
31865
+ var label_6 = root_17();
31866
+ var text_4 = child(label_6);
31867
+ var input_5 = sibling(text_4);
31705
31868
  attribute_effect(
31706
- input_4,
31869
+ input_5,
31707
31870
  () => ({
31708
31871
  ...get$2(fieldAttributes),
31709
31872
  ...restProps,
@@ -31716,19 +31879,19 @@ function InputAndLabel($$anchor, $$props) {
31716
31879
  void 0,
31717
31880
  true
31718
31881
  );
31719
- reset(label_5);
31882
+ reset(label_6);
31720
31883
  template_effect(() => {
31721
- set_class(label_5, 1, clsx(labelClass()));
31722
- set_attribute(label_5, "for", get$2(inputId) + get$2(option2));
31723
- set_text(text_3, `${get$2(option2) ?? ""} `);
31884
+ set_class(label_6, 1, clsx(labelClass()));
31885
+ set_attribute(label_6, "for", get$2(inputId) + get$2(option2));
31886
+ set_text(text_4, `${get$2(option2) ?? ""} `);
31724
31887
  });
31725
- bind_value(input_4, () => field().value, ($$value) => field(field().value = $$value, true));
31726
- append($$anchor4, label_5);
31888
+ bind_value(input_5, () => field().value, ($$value) => field(field().value = $$value, true));
31889
+ append($$anchor4, label_6);
31727
31890
  });
31728
- append($$anchor3, fragment_7);
31891
+ append($$anchor3, fragment_8);
31729
31892
  };
31730
- if_block(node_10, ($$render) => {
31731
- if (field().options) $$render(consequent_3);
31893
+ if_block(node_12, ($$render) => {
31894
+ if (field().options) $$render(consequent_4);
31732
31895
  });
31733
31896
  }
31734
31897
  reset(fieldset_1);
@@ -31760,6 +31923,7 @@ function InputAndLabel($$anchor, $$props) {
31760
31923
  select,
31761
31924
  radio,
31762
31925
  date: date2,
31926
+ file,
31763
31927
  textarea: null,
31764
31928
  paymentMode
31765
31929
  };
@@ -31781,6 +31945,19 @@ function InputAndLabel($$anchor, $$props) {
31781
31945
  }));
31782
31946
  let label = /* @__PURE__ */ user_derived(() => shop.t(field().label) || field().label);
31783
31947
  const CDN_PATH = `https://cdn.shop.platform.gomus.de/`;
31948
+ let filePreviewUrl = /* @__PURE__ */ state(null);
31949
+ user_effect(() => {
31950
+ const value = field().value;
31951
+ if (value instanceof File && value.type.startsWith("image/")) {
31952
+ const url = URL.createObjectURL(value);
31953
+ set(filePreviewUrl, url, true);
31954
+ return () => {
31955
+ URL.revokeObjectURL(url);
31956
+ set(filePreviewUrl, null);
31957
+ };
31958
+ }
31959
+ set(filePreviewUrl, null);
31960
+ });
31784
31961
  var $$exports = {
31785
31962
  get field() {
31786
31963
  return field();
@@ -31818,20 +31995,20 @@ function InputAndLabel($$anchor, $$props) {
31818
31995
  flushSync();
31819
31996
  }
31820
31997
  };
31821
- var fragment_8 = comment();
31822
- var node_12 = first_child(fragment_8);
31998
+ var fragment_9 = comment();
31999
+ var node_14 = first_child(fragment_9);
31823
32000
  {
31824
- var consequent_4 = ($$anchor2) => {
31825
- var fragment_9 = comment();
31826
- var node_13 = first_child(fragment_9);
31827
- snippet(node_13, () => get$2(snippet$1));
31828
- append($$anchor2, fragment_9);
32001
+ var consequent_5 = ($$anchor2) => {
32002
+ var fragment_10 = comment();
32003
+ var node_15 = first_child(fragment_10);
32004
+ snippet(node_15, () => get$2(snippet$1));
32005
+ append($$anchor2, fragment_10);
31829
32006
  };
31830
- if_block(node_12, ($$render) => {
31831
- if (get$2(snippet$1)) $$render(consequent_4);
32007
+ if_block(node_14, ($$render) => {
32008
+ if (get$2(snippet$1)) $$render(consequent_5);
31832
32009
  });
31833
32010
  }
31834
- append($$anchor, fragment_8);
32011
+ append($$anchor, fragment_9);
31835
32012
  return pop($$exports);
31836
32013
  }
31837
32014
  delegate(["change"]);