slim-select 4.0.0 → 4.0.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.
package/dist/vue/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { createElementBlock as e, defineComponent as t, openBlock as n, toRaw as r } from "vue";
1
+ import { createElementBlock as e, defineComponent as t, isReactive as n, isRef as r, openBlock as i, toRaw as a, unref as o } from "vue";
2
2
  //#region src/slim-select/classes.ts
3
- var i = class {
3
+ var s = class {
4
4
  main;
5
5
  placeholder;
6
6
  values;
@@ -57,8 +57,8 @@ var i = class {
57
57
  getFirst(e) {
58
58
  return this[e].split(" ")[0];
59
59
  }
60
- }, a = 200, o = ["transform", "opacity"];
61
- function s(e, t = a) {
60
+ }, c = 200, l = ["transform", "opacity"];
61
+ function u(e, t = c) {
62
62
  let n = e.trim();
63
63
  if (!n) return t;
64
64
  if (n.endsWith("ms")) {
@@ -72,22 +72,22 @@ function s(e, t = a) {
72
72
  let r = parseFloat(n);
73
73
  return Number.isNaN(r) ? t : r;
74
74
  }
75
- function c(e, t = a) {
76
- return s(getComputedStyle(e).getPropertyValue("--ss-animation-timing").trim(), t);
75
+ function d(e, t = c) {
76
+ return u(getComputedStyle(e).getPropertyValue("--ss-animation-timing").trim(), t);
77
77
  }
78
- function l(e, t, n = a) {
79
- let r = c(e, n) + 50;
78
+ function f(e, t, n = c) {
79
+ let r = d(e, n) + 50;
80
80
  return t === void 0 ? r : Math.max(r, t);
81
81
  }
82
- function u() {
82
+ function p() {
83
83
  return typeof window > "u" || typeof window.matchMedia != "function" ? !1 : window.matchMedia("(prefers-reduced-motion: reduce)").matches;
84
84
  }
85
- function d(e) {
85
+ function m(e) {
86
86
  return e === void 0 ? null : new Set(Array.isArray(e) ? e : [e]);
87
87
  }
88
- function f(e, t, n = a, r) {
89
- if (u() || r?.aborted) return Promise.resolve();
90
- let i = d(t);
88
+ function h(e, t, n = c, r) {
89
+ if (p() || r?.aborted) return Promise.resolve();
90
+ let i = m(t);
91
91
  return new Promise((t) => {
92
92
  let a = null, o = !1, s = () => {
93
93
  o || (o = !0, e.removeEventListener("transitionend", l), r?.removeEventListener("abort", c), a && clearTimeout(a), t());
@@ -97,8 +97,8 @@ function f(e, t, n = a, r) {
97
97
  r?.addEventListener("abort", c, { once: !0 }), e.addEventListener("transitionend", l), a = setTimeout(s, n);
98
98
  });
99
99
  }
100
- function p(e, t, n = a, r) {
101
- return u() || r?.aborted ? Promise.resolve() : new Promise((i) => {
100
+ function g(e, t, n = c, r) {
101
+ return p() || r?.aborted ? Promise.resolve() : new Promise((i) => {
102
102
  let a = null, o = !1, s = () => {
103
103
  o || (o = !0, e.removeEventListener("animationend", l), r?.removeEventListener("abort", c), a && clearTimeout(a), i());
104
104
  }, c = () => s(), l = (n) => {
@@ -109,7 +109,7 @@ function p(e, t, n = a, r) {
109
109
  }
110
110
  //#endregion
111
111
  //#region src/slim-select/settings.ts
112
- var m = class {
112
+ var _ = class {
113
113
  id = "";
114
114
  style = "";
115
115
  class = [];
@@ -149,12 +149,12 @@ var m = class {
149
149
  modal;
150
150
  modalTitle;
151
151
  constructor(e) {
152
- e ||= {}, this.id = "ss-" + v(), this.style = e.style || "", this.class = e.class || [], this.disabled = e.disabled === void 0 ? !1 : e.disabled, this.alwaysOpen = e.alwaysOpen === void 0 ? !1 : e.alwaysOpen, this.showSearch = e.showSearch === void 0 ? !0 : e.showSearch, this.focusSearch = e.focusSearch === void 0 ? !0 : e.focusSearch, this.keepSearch = e.keepSearch === void 0 ? !1 : e.keepSearch, this.ariaLabel = e.ariaLabel || "Combobox", this.searchPlaceholder = e.searchPlaceholder || "Search...", this.searchText = e.searchText || "No Results", this.searchingText = e.searchingText || "Searching...", this.resultsText = e.resultsText || "{count} results available", this.deselectText = e.deselectText || "Clear", this.removeText = e.removeText || "Remove", this.searchHighlight = e.searchHighlight === void 0 ? !1 : e.searchHighlight, this.closeOnSelect = e.closeOnSelect === void 0 ? !0 : e.closeOnSelect, this.contentLocation = e.contentLocation || document.body, this.contentPosition = e.contentPosition || "absolute", this.contentWidth = e.contentWidth || "", this.openPosition = e.openPosition || "auto", this.placeholderText = e.placeholderText === void 0 ? "Select Value" : e.placeholderText, this.allowDeselect = e.allowDeselect === void 0 ? !1 : e.allowDeselect, this.hideSelected = e.hideSelected === void 0 ? !1 : e.hideSelected, this.multiString = e.multiString === void 0 ? !1 : e.multiString, this.keepOrder = e.keepOrder === void 0 ? !1 : e.keepOrder, this.showOptionTooltips = e.showOptionTooltips === void 0 ? !1 : e.showOptionTooltips, this.minSelected = e.minSelected || 0, this.maxSelected = e.maxSelected || 1e3, this.timeoutDelay = e.timeoutDelay || 200, this.maxValuesShown = e.maxValuesShown || 20, this.maxValuesMessage = e.maxValuesMessage || "{number} selected", this.addableText = e.addableText || "Press \"Enter\" to add {value}", this.modal = e.modal || "mobile", this.modalTitle = e.modalTitle || "";
152
+ e ||= {}, this.id = "ss-" + x(), this.style = e.style || "", this.class = e.class || [], this.disabled = e.disabled === void 0 ? !1 : e.disabled, this.alwaysOpen = e.alwaysOpen === void 0 ? !1 : e.alwaysOpen, this.showSearch = e.showSearch === void 0 ? !0 : e.showSearch, this.focusSearch = e.focusSearch === void 0 ? !0 : e.focusSearch, this.keepSearch = e.keepSearch === void 0 ? !1 : e.keepSearch, this.ariaLabel = e.ariaLabel || "Combobox", this.searchPlaceholder = e.searchPlaceholder || "Search...", this.searchText = e.searchText || "No Results", this.searchingText = e.searchingText || "Searching...", this.resultsText = e.resultsText || "{count} results available", this.deselectText = e.deselectText || "Clear", this.removeText = e.removeText || "Remove", this.searchHighlight = e.searchHighlight === void 0 ? !1 : e.searchHighlight, this.closeOnSelect = e.closeOnSelect === void 0 ? !0 : e.closeOnSelect, this.contentLocation = e.contentLocation || document.body, this.contentPosition = e.contentPosition || "absolute", this.contentWidth = e.contentWidth || "", this.openPosition = e.openPosition || "auto", this.placeholderText = e.placeholderText === void 0 ? "Select Value" : e.placeholderText, this.allowDeselect = e.allowDeselect === void 0 ? !1 : e.allowDeselect, this.hideSelected = e.hideSelected === void 0 ? !1 : e.hideSelected, this.multiString = e.multiString === void 0 ? !1 : e.multiString, this.keepOrder = e.keepOrder === void 0 ? !1 : e.keepOrder, this.showOptionTooltips = e.showOptionTooltips === void 0 ? !1 : e.showOptionTooltips, this.minSelected = e.minSelected || 0, this.maxSelected = e.maxSelected || 1e3, this.timeoutDelay = e.timeoutDelay || 200, this.maxValuesShown = e.maxValuesShown || 20, this.maxValuesMessage = e.maxValuesMessage || "{number} selected", this.addableText = e.addableText || "Press \"Enter\" to add {value}", this.modal = e.modal || "mobile", this.modalTitle = e.modalTitle || "";
153
153
  }
154
154
  };
155
155
  //#endregion
156
156
  //#region src/slim-select/helpers.ts
157
- function h(e) {
157
+ function v(e) {
158
158
  if (!e) return {};
159
159
  let t = {};
160
160
  for (let n of Object.keys(e)) {
@@ -163,21 +163,21 @@ function h(e) {
163
163
  }
164
164
  return t;
165
165
  }
166
- function g(e) {
166
+ function y(e) {
167
167
  let t = e.cloneNode(!0);
168
168
  return t.querySelectorAll("select, option, optgroup, textarea, input, button").forEach((e) => e.remove()), t.textContent?.replace(/\s+/g, " ").trim() || "";
169
169
  }
170
- function _(e) {
170
+ function b(e) {
171
171
  if (e.labels && e.labels.length > 0) {
172
- let t = Array.from(e.labels).map(g).filter(Boolean);
172
+ let t = Array.from(e.labels).map(y).filter(Boolean);
173
173
  if (t.length > 0) return [...new Set(t)].join(" ");
174
174
  }
175
175
  return e.getAttribute("aria-label")?.trim() || "";
176
176
  }
177
- function v() {
177
+ function x() {
178
178
  return Math.random().toString(36).substring(2, 10);
179
179
  }
180
- function y(e, t) {
180
+ function S(e, t) {
181
181
  function n(e, n) {
182
182
  return n && e && e.classList && e.classList.contains(n) || n && e && e.dataset && e.dataset.id && e.dataset.id === t ? e : null;
183
183
  }
@@ -186,7 +186,7 @@ function y(e, t) {
186
186
  }
187
187
  return n(e, t) || r(e, t);
188
188
  }
189
- function b(e, t = 50, n = !1) {
189
+ function C(e, t = 50, n = !1) {
190
190
  let r;
191
191
  return function(...i) {
192
192
  let a = self, o = () => {
@@ -195,12 +195,12 @@ function b(e, t = 50, n = !1) {
195
195
  clearTimeout(r), r = setTimeout(o, t), s && e.apply(a, i);
196
196
  };
197
197
  }
198
- function x(e, t) {
198
+ function w(e, t) {
199
199
  if (e.length !== t.length) return !1;
200
200
  let n = [...e].sort(), r = [...t].sort();
201
201
  return n.every((e, t) => e === r[t]);
202
202
  }
203
- var S = [
203
+ var T = [
204
204
  "id",
205
205
  "value",
206
206
  "text",
@@ -214,13 +214,13 @@ var S = [
214
214
  "style",
215
215
  "mandatory"
216
216
  ];
217
- function C(e, t) {
217
+ function E(e, t) {
218
218
  let n = Object.keys(e), r = Object.keys(t);
219
219
  if (n.length !== r.length) return !1;
220
220
  for (let r of n) if (e[r] !== t[r]) return !1;
221
221
  return !0;
222
222
  }
223
- function w(e, t) {
223
+ function D(e, t) {
224
224
  switch (t) {
225
225
  case "id": return e.id || "";
226
226
  case "value": return e.value === void 0 ? e.text || "" : e.value || "";
@@ -237,14 +237,14 @@ function w(e, t) {
237
237
  default: return e.data || {};
238
238
  }
239
239
  }
240
- function T(e) {
240
+ function O(e) {
241
241
  return !!e && typeof e == "object" && "label" in e && "options" in e;
242
242
  }
243
- function E(e, t) {
244
- for (let n of S) if (w(e, n) !== w(t, n)) return !1;
245
- return C(e.data || {}, t.data || {});
243
+ function k(e, t) {
244
+ for (let n of T) if (D(e, n) !== D(t, n)) return !1;
245
+ return E(e.data || {}, t.data || {});
246
246
  }
247
- function D(e, t) {
247
+ function A(e, t) {
248
248
  let n = (e) => ({
249
249
  id: e.id || "",
250
250
  label: e.label || "",
@@ -254,33 +254,33 @@ function D(e, t) {
254
254
  if (r.id !== i.id || r.label !== i.label || r.selectAll !== i.selectAll || r.closable !== i.closable) return !1;
255
255
  let a = e.options || [], o = t.options || [];
256
256
  if (a.length !== o.length) return !1;
257
- for (let e = 0; e < a.length; e++) if (!E(a[e], o[e])) return !1;
257
+ for (let e = 0; e < a.length; e++) if (!k(a[e], o[e])) return !1;
258
258
  return !0;
259
259
  }
260
- function O(e, t) {
260
+ function j(e, t) {
261
261
  if (e === t) return !0;
262
262
  if (e.length !== t.length) return !1;
263
263
  for (let n = 0; n < e.length; n++) {
264
- let r = e[n], i = t[n], a = T(r);
265
- if (a !== T(i)) return !1;
264
+ let r = e[n], i = t[n], a = O(r);
265
+ if (a !== O(i)) return !1;
266
266
  if (a) {
267
- if (!D(r, i)) return !1;
267
+ if (!A(r, i)) return !1;
268
268
  continue;
269
269
  }
270
- if (!E(r, i)) return !1;
270
+ if (!k(r, i)) return !1;
271
271
  }
272
272
  return !0;
273
273
  }
274
- function k(e) {
274
+ function M(e) {
275
275
  let t = e.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g, (e) => "-" + e.toLowerCase());
276
276
  return e[0] === e[0].toUpperCase() ? t.substring(1) : t;
277
277
  }
278
- function A(e, t = typeof window < "u" ? window.innerWidth : 768) {
278
+ function N(e, t = typeof window < "u" ? window.innerWidth : 768) {
279
279
  return e === "on" ? !0 : e === "mobile" ? t < 768 : !1;
280
280
  }
281
281
  //#endregion
282
282
  //#region src/slim-select/events.ts
283
- var j = class {
283
+ var P = class {
284
284
  handlers;
285
285
  attached = !1;
286
286
  constructor(e) {
@@ -298,16 +298,16 @@ var j = class {
298
298
  detach(e) {
299
299
  this.attached && (this.attached = !1, this.detachDocumentClick(), window.removeEventListener("resize", this.resizeHandler, !1), e.listenScroll && window.removeEventListener("scroll", this.scrollHandler, !1), document.removeEventListener("visibilitychange", this.visibilityHandler));
300
300
  }
301
- resizeHandler = b(() => {
301
+ resizeHandler = C(() => {
302
302
  this.handlers.onWindowResize();
303
303
  });
304
- scrollHandler = b(() => {
304
+ scrollHandler = C(() => {
305
305
  this.handlers.onWindowScroll();
306
306
  });
307
307
  visibilityHandler = () => {
308
308
  this.handlers.onVisibilityChange();
309
309
  };
310
- }, M = class {
310
+ }, F = class {
311
311
  handlers;
312
312
  options;
313
313
  state = "closed";
@@ -368,7 +368,7 @@ var j = class {
368
368
  this.generation;
369
369
  });
370
370
  }
371
- }, N = class {
371
+ }, I = class {
372
372
  id;
373
373
  value;
374
374
  text;
@@ -383,18 +383,18 @@ var j = class {
383
383
  data;
384
384
  mandatory;
385
385
  constructor(e) {
386
- this.id = !e.id || e.id === "" ? v() : e.id, this.value = e.value === void 0 ? e.text || "" : e.value || "", this.text = e.text || "", this.html = e.html || "", this.defaultSelected = e.defaultSelected === void 0 ? !1 : e.defaultSelected, this.selected = e.selected === void 0 ? !1 : e.selected, this.display = e.display === void 0 ? !0 : e.display, this.disabled = e.disabled === void 0 ? !1 : e.disabled, this.mandatory = e.mandatory === void 0 ? !1 : e.mandatory, this.placeholder = e.placeholder === void 0 ? !1 : e.placeholder, this.class = e.class || "", this.style = e.style || "", this.data = h(e.data);
386
+ this.id = !e.id || e.id === "" ? x() : e.id, this.value = e.value === void 0 ? e.text || "" : e.value || "", this.text = e.text || "", this.html = e.html || "", this.defaultSelected = e.defaultSelected === void 0 ? !1 : e.defaultSelected, this.selected = e.selected === void 0 ? !1 : e.selected, this.display = e.display === void 0 ? !0 : e.display, this.disabled = e.disabled === void 0 ? !1 : e.disabled, this.mandatory = e.mandatory === void 0 ? !1 : e.mandatory, this.placeholder = e.placeholder === void 0 ? !1 : e.placeholder, this.class = e.class || "", this.style = e.style || "", this.data = v(e.data);
387
387
  }
388
- }, P = class {
388
+ }, L = class {
389
389
  id;
390
390
  label;
391
391
  selectAll;
392
392
  closable;
393
393
  options;
394
394
  constructor(e) {
395
- if (this.id = !e.id || e.id === "" ? v() : e.id, this.label = e.label || "", this.selectAll = e.selectAll === void 0 ? !1 : e.selectAll, this.closable = e.closable || "off", this.options = [], e.options) for (let t of e.options) this.options.push(new N(t));
395
+ if (this.id = !e.id || e.id === "" ? x() : e.id, this.label = e.label || "", this.selectAll = e.selectAll === void 0 ? !1 : e.selectAll, this.closable = e.closable || "off", this.options = [], e.options) for (let t of e.options) this.options.push(new I(t));
396
396
  }
397
- }, F = class {
397
+ }, R = class {
398
398
  selectType = "single";
399
399
  data = [];
400
400
  selectedOrder = [];
@@ -404,13 +404,13 @@ var j = class {
404
404
  }
405
405
  validateDataArray(e) {
406
406
  if (!Array.isArray(e)) return /* @__PURE__ */ Error("Data must be an array");
407
- for (let t of e) if (t) if (t instanceof P || "label" in t) {
407
+ for (let t of e) if (t) if (t instanceof L || "label" in t) {
408
408
  if (!("label" in t)) return /* @__PURE__ */ Error("Optgroup must have a label");
409
409
  if ("options" in t && t.options) for (let e of t.options) {
410
410
  let t = this.validateOption(e);
411
411
  if (t) return t;
412
412
  }
413
- } else if (t instanceof N || "text" in t) {
413
+ } else if (t instanceof I || "text" in t) {
414
414
  let e = this.validateOption(t);
415
415
  if (e) return e;
416
416
  } else return /* @__PURE__ */ Error("Data object must be a valid optgroup or option");
@@ -423,13 +423,13 @@ var j = class {
423
423
  let t = [];
424
424
  return e.forEach((e) => {
425
425
  if (e) {
426
- if (e instanceof P || "label" in e) {
426
+ if (e instanceof L || "label" in e) {
427
427
  let n = [];
428
428
  "options" in e && e.options && e.options.forEach((e) => {
429
- n.push(new N(e));
430
- }), n.length > 0 && t.push(new P(e));
429
+ n.push(new I(e));
430
+ }), n.length > 0 && t.push(new L(e));
431
431
  }
432
- (e instanceof N || "text" in e) && t.push(new N(e));
432
+ (e instanceof I || "text" in e) && t.push(new I(e));
433
433
  }
434
434
  }), t;
435
435
  }
@@ -440,20 +440,20 @@ var j = class {
440
440
  return this.cloneData(this.catalog ?? this.data);
441
441
  }
442
442
  cloneData(e) {
443
- return e.map((e) => e instanceof P ? new P({
443
+ return e.map((e) => e instanceof L ? new L({
444
444
  id: e.id,
445
445
  label: e.label,
446
446
  selectAll: e.selectAll,
447
447
  closable: e.closable,
448
- options: e.options.map((e) => new N(e instanceof N ? { ...e } : e))
449
- }) : new N({ ...e }));
448
+ options: e.options.map((e) => new I(e instanceof I ? { ...e } : e))
449
+ }) : new I({ ...e }));
450
450
  }
451
451
  optionMatchesSelected(e, t) {
452
452
  return e.id === t.id ? !0 : t.value !== "" && e.value !== "" && e.value === t.value;
453
453
  }
454
454
  findOptionInData(e, t) {
455
455
  for (let n of e) {
456
- if (n instanceof N) {
456
+ if (n instanceof I) {
457
457
  if (this.optionMatchesSelected(n, t)) return n;
458
458
  continue;
459
459
  }
@@ -485,19 +485,19 @@ var j = class {
485
485
  }
486
486
  addOption(e, t = !1) {
487
487
  if (t) {
488
- let t = [new N(e)];
488
+ let t = [new I(e)];
489
489
  this.setData(t.concat(this.getData()));
490
- } else this.setData(this.getData().concat(new N(e)));
490
+ } else this.setData(this.getData().concat(new I(e)));
491
491
  }
492
492
  setSelectedBy(e, t, n = !1) {
493
493
  let r = null, i = !1, a = [];
494
494
  for (let n of this.data) {
495
- if (n instanceof P) for (let o of n.options) {
495
+ if (n instanceof L) for (let o of n.options) {
496
496
  r ||= o;
497
497
  let n = o[e] || "";
498
498
  o.selected = i ? !1 : t.includes(n), o.selected && (a.push(o), this.selectType === "single" && (i = !0));
499
499
  }
500
- n instanceof N && (r ||= n, n.selected = i ? !1 : t.includes(n[e]), n.selected && (a.push(n), this.selectType === "single" && (i = !0)));
500
+ n instanceof I && (r ||= n, n.selected = i ? !1 : t.includes(n[e]), n.selected && (a.push(n), this.selectType === "single" && (i = !0)));
501
501
  }
502
502
  this.selectType === "single" && r && !i && !n && (r.selected = !0, a.push(r));
503
503
  let o = t.map((t) => a.find((n) => n[e] === t)?.id || "");
@@ -511,16 +511,16 @@ var j = class {
511
511
  }
512
512
  getSelectedOptions() {
513
513
  let e = [];
514
- for (let t of this.data) if (t instanceof P) for (let n of t.options) n.selected && e.push(n);
514
+ for (let t of this.data) if (t instanceof L) for (let n of t.options) n.selected && e.push(n);
515
515
  else t.selected && e.push(t);
516
516
  return e;
517
517
  }
518
518
  getOptgroupByID(e) {
519
- for (let t of this.data) if (t instanceof P && t.id === e) return t;
519
+ for (let t of this.data) if (t instanceof L && t.id === e) return t;
520
520
  return null;
521
521
  }
522
522
  getOptionByID(e) {
523
- for (let t of this.data) if (t instanceof P) {
523
+ for (let t of this.data) if (t instanceof L) {
524
524
  for (let n of t.options) if (n.id === e) return n;
525
525
  } else if (t.id === e) return t;
526
526
  return null;
@@ -530,14 +530,14 @@ var j = class {
530
530
  }
531
531
  getFirstOption() {
532
532
  let e = null;
533
- for (let t of this.data) if (t instanceof P ? e = t.options[0] : t instanceof N && (e = t), e) break;
533
+ for (let t of this.data) if (t instanceof L ? e = t.options[0] : t instanceof I && (e = t), e) break;
534
534
  return e;
535
535
  }
536
536
  search(e, t) {
537
537
  return e = e.trim(), e === "" ? this.getData(!1) : this.filter((n) => t(n, e), !0, !1);
538
538
  }
539
539
  createOptgroupView(e, t) {
540
- let n = new P({
540
+ let n = new L({
541
541
  id: e.id,
542
542
  label: e.label,
543
543
  selectAll: e.selectAll,
@@ -549,16 +549,16 @@ var j = class {
549
549
  filter(e, t, n = !0) {
550
550
  let r = [];
551
551
  return this.data.forEach((i) => {
552
- if (i instanceof P) {
552
+ if (i instanceof L) {
553
553
  let a = [];
554
554
  if (i.options.forEach((i) => {
555
- (!e || e(i)) && (t ? a.push(n ? new N(i) : i) : r.push(n ? new N(i) : i));
555
+ (!e || e(i)) && (t ? a.push(n ? new I(i) : i) : r.push(n ? new I(i) : i));
556
556
  }), a.length > 0) if (n) {
557
- let e = new P(i);
557
+ let e = new L(i);
558
558
  e.options = a, r.push(e);
559
559
  } else r.push(this.createOptgroupView(i, a));
560
560
  }
561
- i instanceof N && (!e || e(i)) && r.push(n ? new N(i) : i);
561
+ i instanceof I && (!e || e(i)) && r.push(n ? new I(i) : i);
562
562
  }), r;
563
563
  }
564
564
  selectedOrderOptions(e) {
@@ -576,7 +576,7 @@ var j = class {
576
576
  }), n || t.push(e);
577
577
  }), t;
578
578
  }
579
- }, I = class {
579
+ }, z = class {
580
580
  settings;
581
581
  store;
582
582
  callbacks;
@@ -589,6 +589,7 @@ var j = class {
589
589
  classes;
590
590
  positionObserver = null;
591
591
  positionObserverRaf = 0;
592
+ overflowShiftRaf = 0;
592
593
  modalElements = null;
593
594
  modalSessionActive = null;
594
595
  bodyScrollLocked = !1;
@@ -630,7 +631,7 @@ var j = class {
630
631
  return this.modalSessionActive === !0;
631
632
  }
632
633
  resolveModalView() {
633
- return this.settings.alwaysOpen || this.settings.modal === "off" || !this.modalElements ? !1 : (this.modalSessionActive === null && (this.modalSessionActive = A(this.settings.modal)), this.modalSessionActive);
634
+ return this.settings.alwaysOpen || this.settings.modal === "off" || !this.modalElements ? !1 : (this.modalSessionActive === null && (this.modalSessionActive = N(this.settings.modal)), this.modalSessionActive);
634
635
  }
635
636
  createModalElements() {
636
637
  let e = document.createElement("div");
@@ -673,8 +674,8 @@ var j = class {
673
674
  this.modalElements && this.content.main.parentElement === this.modalElements.dialog && (this.addClasses(this.modalElements.overlay, this.classes.hide), this.removeClasses(this.modalElements.overlay, this.classes.contentOpen), this.removeClasses(this.content.main, this.classes.modalContent), this.restoreContentOffscreen(), this.unlockBodyScroll());
674
675
  }
675
676
  waitForAnimation(e, t) {
676
- let n = l(this.content.main, this.settings.timeoutDelay);
677
- return f(this.content.main, o, n, t);
677
+ let n = f(this.content.main, this.settings.timeoutDelay);
678
+ return h(this.content.main, l, n, t);
678
679
  }
679
680
  close() {
680
681
  this.main.main.setAttribute("aria-expanded", "false"), this.main.arrow.path.setAttribute("d", this.classes.arrowClose);
@@ -685,7 +686,7 @@ var j = class {
685
686
  this.removeClasses(this.main.main, this.classes.dirAbove), this.removeClasses(this.main.main, this.classes.dirBelow), this.removeClasses(this.content.main, this.classes.dirAbove), this.removeClasses(this.content.main, this.classes.dirBelow);
686
687
  }
687
688
  updateClassStyles() {
688
- if (this.main.main.className = "", this.main.main.removeAttribute("style"), this.content.main.className = "", this.content.main.removeAttribute("style"), this.addClasses(this.main.main, this.classes.main), this.addClasses(this.content.main, this.classes.content), this.settings.style !== "" && (this.main.main.style.cssText = this.settings.style, this.content.main.style.cssText = this.settings.style), this.settings.class.length) for (let e of this.settings.class) e.trim() !== "" && (this.main.main.classList.add(e.trim()), this.content.main.classList.add(e.trim()));
689
+ if (this.main.main.className = "", this.main.main.removeAttribute("style"), this.content.main.className = "", this.content.main.removeAttribute("style"), this.addClasses(this.main.main, this.classes.main), this.addClasses(this.content.main, this.classes.content), this.settings.style !== "" && (this.main.main.style.cssText = this.settings.style, this.content.main.style.cssText = this.settings.style), this.settings.class.length) for (let e of this.settings.class) e.trim() !== "" && this.main.main.classList.add(e.trim());
689
690
  (this.settings.contentPosition === "relative" || this.settings.contentPosition === "fixed") && this.content.main.classList.add("ss-" + this.settings.contentPosition);
690
691
  }
691
692
  updateAriaAttributes() {
@@ -811,8 +812,8 @@ var j = class {
811
812
  let i = e[r], a = i.getAttribute("data-id");
812
813
  a && (t.filter((e) => e.id === a, !1).length || n.push(i));
813
814
  }
814
- let r = l(this.content.main, this.settings.timeoutDelay);
815
- for (let e of n) this.addClasses(e, this.classes.valueOut), p(e, "ss-valueOut", r).then(() => {
815
+ let r = f(this.content.main, this.settings.timeoutDelay);
816
+ for (let e of n) this.addClasses(e, this.classes.valueOut), g(e, "ss-valueOut", r).then(() => {
816
817
  this.main.values.hasChildNodes() && this.main.values.contains(e) && this.main.values.removeChild(e);
817
818
  });
818
819
  e = this.main.values.childNodes;
@@ -847,8 +848,8 @@ var j = class {
847
848
  if (!(this.settings.minSelected && i.length < this.settings.minSelected) && (this.callbacks.beforeChange && (n = this.callbacks.beforeChange(i, r) === !0), n)) {
848
849
  let e = [];
849
850
  for (let t of i) {
850
- if (t instanceof P) for (let n of t.options) n.id && e.push(n.id);
851
- t instanceof N && e.push(t.id);
851
+ if (t instanceof L) for (let n of t.options) n.id && e.push(n.id);
852
+ t instanceof I && e.push(t.id);
852
853
  }
853
854
  this.callbacks.setSelected(e, !1), this.settings.closeOnSelect && this.callbacks.close(), this.callbacks.afterChange && this.callbacks.afterChange(i), this.updateDeselectAll(), this.updateMultipleValueDeleteVisibility();
854
855
  }
@@ -904,14 +905,14 @@ var j = class {
904
905
  }), this.observePositionTargets()));
905
906
  }
906
907
  stopPositionTracking() {
907
- cancelAnimationFrame(this.positionObserverRaf), this.positionObserver?.disconnect(), this.positionObserver = null;
908
+ cancelAnimationFrame(this.positionObserverRaf), this.positionObserver?.disconnect(), this.positionObserver = null, this.cancelOverflowShift();
908
909
  }
909
910
  observePositionTargets() {
910
911
  if (!this.positionObserver) return;
911
912
  let e = /* @__PURE__ */ new Set(), t = (t) => {
912
913
  !t || e.has(t) || (e.add(t), this.positionObserver.observe(t));
913
914
  };
914
- t(this.main.main), t(this.content.main);
915
+ t(this.main.main);
915
916
  let n = this.main.main.parentElement, r = this.settings.contentLocation;
916
917
  for (let e = 0; n && e < 8 && (t(n), n !== r); e++) n = n.parentElement;
917
918
  }
@@ -922,7 +923,7 @@ var j = class {
922
923
  main: e,
923
924
  input: t
924
925
  };
925
- if (this.settings.showSearch || (this.addClasses(e, this.classes.hide), t.readOnly = !0), t.type = "search", t.placeholder = this.settings.searchPlaceholder, t.tabIndex = -1, t.setAttribute("aria-label", this.settings.searchPlaceholder), t.setAttribute("aria-autocomplete", "list"), t.setAttribute("autocapitalize", "off"), t.setAttribute("autocomplete", "off"), t.setAttribute("autocorrect", "off"), t.setAttribute("aria-hidden", "true"), t.oninput = b((e) => {
926
+ if (this.settings.showSearch || (this.addClasses(e, this.classes.hide), t.readOnly = !0), t.type = "search", t.placeholder = this.settings.searchPlaceholder, t.tabIndex = -1, t.setAttribute("aria-label", this.settings.searchPlaceholder), t.setAttribute("aria-autocomplete", "list"), t.setAttribute("autocapitalize", "off"), t.setAttribute("autocomplete", "off"), t.setAttribute("autocorrect", "off"), t.setAttribute("aria-hidden", "true"), t.oninput = C((e) => {
926
927
  this.callbacks.search(e.target.value);
927
928
  }, 100), t.onkeydown = (e) => {
928
929
  switch (e.key) {
@@ -930,12 +931,9 @@ var j = class {
930
931
  case "ArrowDown": return e.key === "ArrowDown" ? this.highlight("down") : this.highlight("up"), !1;
931
932
  case "Tab": return this.callbacks.close(), !0;
932
933
  case "Escape": return this.callbacks.close(), !1;
933
- case " ":
934
- let t = this.content.list.querySelector("." + this.classes.getFirst("highlighted"));
935
- return t ? (t.click(), !1) : !0;
936
934
  case "Enter":
937
- let r = this.content.list.querySelector("." + this.classes.getFirst("highlighted"));
938
- return r ? (r.click(), !1) : this.callbacks.addable ? (n.click(), !1) : !0;
935
+ let t = this.content.list.querySelector("." + this.classes.getFirst("highlighted"));
936
+ return t ? (t.click(), !1) : this.callbacks.addable ? (n.click(), !1) : !0;
939
937
  }
940
938
  return !0;
941
939
  }, e.appendChild(t), this.callbacks.addable) {
@@ -951,13 +949,13 @@ var j = class {
951
949
  return;
952
950
  }
953
951
  let n = (e) => {
954
- let t = new N(e);
952
+ let t = new I(e);
955
953
  if (this.callbacks.addOption(t), this.settings.isMultiple) {
956
954
  let e = this.store.getSelected();
957
955
  e.push(t.id), this.callbacks.setSelected(e, !0);
958
956
  } else this.callbacks.setSelected([t.id], !0);
959
957
  if (this.callbacks.search(""), this.settings.closeOnSelect) {
960
- let e = c(this.content.main);
958
+ let e = d(this.content.main);
961
959
  setTimeout(() => {
962
960
  this.callbacks.close();
963
961
  }, e);
@@ -1039,7 +1037,7 @@ var j = class {
1039
1037
  this.addClasses(e, this.classes.searching), e.textContent = this.settings.searchingText, this.content.list.appendChild(e), this.announce(this.settings.searchingText);
1040
1038
  }
1041
1039
  renderOptions(e) {
1042
- if (this.lastSearchFilterTerm = "", this.lastRenderedOptions = e.map((e) => e instanceof N ? [e] : e.options.map((e) => new N(e))).flat(), this.content.list.innerHTML = "", e.length === 0) {
1040
+ if (this.lastSearchFilterTerm = "", this.lastRenderedOptions = e.map((e) => e instanceof I ? [e] : e.options.map((e) => new I(e))).flat(), this.content.list.innerHTML = "", e.length === 0) {
1043
1041
  this.optionsListIsFullData = !1;
1044
1042
  let e = document.createElement("div");
1045
1043
  if (this.addClasses(e, this.classes.search), this.callbacks.addable) {
@@ -1049,7 +1047,7 @@ var j = class {
1049
1047
  this.content.list.appendChild(e);
1050
1048
  return;
1051
1049
  }
1052
- this.settings.allowDeselect && !this.settings.isMultiple && (this.store.filter((e) => e.placeholder, !1, !1).length || this.store.addOption(new N({
1050
+ this.settings.allowDeselect && !this.settings.isMultiple && (this.store.filter((e) => e.placeholder, !1, !1).length || this.store.addOption(new I({
1053
1051
  text: "",
1054
1052
  value: "",
1055
1053
  selected: !1,
@@ -1057,7 +1055,7 @@ var j = class {
1057
1055
  }), !0));
1058
1056
  let t = document.createDocumentFragment();
1059
1057
  for (let n of e) {
1060
- if (n instanceof P) {
1058
+ if (n instanceof L) {
1061
1059
  let e = document.createElement("div");
1062
1060
  this.addClasses(e, this.classes.optgroup);
1063
1061
  let r = document.createElement("div");
@@ -1089,7 +1087,7 @@ var j = class {
1089
1087
  return;
1090
1088
  } else {
1091
1089
  let e = n.options.map((e) => e.id).filter((e) => e !== void 0), r = t.concat(e);
1092
- for (let e of n.options) e.id && !this.store.getOptionByID(e.id) && this.callbacks.addOption(new N(e));
1090
+ for (let e of n.options) e.id && !this.store.getOptionByID(e.id) && this.callbacks.addOption(new I(e));
1093
1091
  this.callbacks.setSelected(r, !0);
1094
1092
  return;
1095
1093
  }
@@ -1106,9 +1104,9 @@ var j = class {
1106
1104
  }), a.appendChild(t);
1107
1105
  }
1108
1106
  e.appendChild(r);
1109
- for (let r of n.options) e.appendChild(this.option(new N(r))), t.appendChild(e);
1107
+ for (let r of n.options) e.appendChild(this.option(new I(r))), t.appendChild(e);
1110
1108
  }
1111
- n instanceof N && t.appendChild(this.option(n));
1109
+ n instanceof I && t.appendChild(this.option(n));
1112
1110
  }
1113
1111
  this.content.list.appendChild(t), this.setOptionsListFullData(e), this.announce(this.settings.resultsText.replace("{count}", String(this.lastRenderedOptions.length)));
1114
1112
  }
@@ -1134,7 +1132,7 @@ var j = class {
1134
1132
  this.lastRenderedOptions = r, this.updateOptgroupVisibilityAfterSearch(n), r.length === 0 ? this.updateSearchResultsMessage(0, n) : (this.removeListSearchMessage(), this.announce(this.settings.resultsText.replace("{count}", String(r.length)))), this.updateOptgroupSelectAllStates();
1135
1133
  }
1136
1134
  setOptionsListFullData(e) {
1137
- let t = this.store.getDataOptions(!1), n = e.map((e) => e instanceof N ? [e] : e.options.map((e) => new N(e))).flat();
1135
+ let t = this.store.getDataOptions(!1), n = e.map((e) => e instanceof I ? [e] : e.options.map((e) => new I(e))).flat();
1138
1136
  if (n.length !== t.length) {
1139
1137
  this.optionsListIsFullData = !1;
1140
1138
  return;
@@ -1263,7 +1261,13 @@ var j = class {
1263
1261
  }), t;
1264
1262
  }
1265
1263
  destroy() {
1266
- this.stopPositionTracking(), this.modalElements &&= (this.unlockBodyScroll(), this.content.main.parentElement === this.modalElements.dialog && this.restoreContentOffscreen(), this.modalElements.overlay.remove(), null), this.main.main.remove(), this.content.main.remove();
1264
+ this.stopPositionTracking(), this.modalElements ? (this.unlockBodyScroll(), this.content.main.parentElement === this.modalElements.dialog && this.restoreContentOffscreen(), this.modalElements.overlay.remove(), this.modalElements = null) : this.bodyScrollLocked && this.unlockBodyScroll(), this.main.main.remove(), this.content.main.remove(), this.removeDetachedInstanceDom();
1265
+ }
1266
+ removeDetachedInstanceDom() {
1267
+ let e = this.settings.id, t = this.classes.getFirst("main"), n = this.classes.getFirst("content"), r = this.classes.getFirst("modalOverlay");
1268
+ document.querySelectorAll(`[data-id="${e}"]`).forEach((e) => {
1269
+ (e.classList.contains(t) || e.classList.contains(n) || e.classList.contains(r)) && e.remove();
1270
+ });
1267
1271
  }
1268
1272
  highlightText(e, t, n) {
1269
1273
  let r = t.trim();
@@ -1294,27 +1298,53 @@ var j = class {
1294
1298
  } else this.content.main.style.margin = "-1px 0px 0px 0px";
1295
1299
  }
1296
1300
  setContentPosition() {
1297
- if (this.settings.contentPosition === "relative") return;
1298
- let e = this.main.main.getBoundingClientRect(), t, n;
1299
- this.settings.contentPosition === "fixed" ? (t = e.top + e.height, n = e.left) : (t = e.top + window.scrollY + e.height, n = e.left + window.scrollX), this.content.main.style.top = t + "px", this.content.main.style.left = n + "px";
1300
- let r = this.settings.contentWidth;
1301
- this.content.main.style.width = "", this.content.main.style.minWidth = "", this.content.main.style.maxWidth = "", r ? r.startsWith(">") ? this.content.main.style.minWidth = r.slice(1) : r.startsWith("<") ? this.content.main.style.maxWidth = r.slice(1) : this.content.main.style.width = r : this.content.main.style.width = e.width + "px";
1302
- let i = window.innerWidth - 20, a = () => {
1303
- let e = this.content.main.getBoundingClientRect().right;
1304
- if (e <= i) return;
1305
- let t = e - i, n = parseFloat(this.content.main.style.left) || 0;
1306
- if (this.settings.contentPosition === "fixed") {
1307
- let e = Math.max(20, n - t);
1308
- this.content.main.style.left = e + "px";
1309
- } else {
1310
- let e = Math.max(window.scrollX + 20, n - t);
1311
- this.content.main.style.left = e + "px";
1312
- }
1313
- };
1314
- requestAnimationFrame(() => {
1315
- a(), requestAnimationFrame(a);
1301
+ let e = this.main.main.getBoundingClientRect();
1302
+ if (this.settings.contentPosition === "relative") {
1303
+ this.applyContentWidth(e);
1304
+ return;
1305
+ }
1306
+ this.cancelOverflowShift();
1307
+ let t, n;
1308
+ this.settings.contentPosition === "fixed" ? (t = e.top + e.height, n = e.left) : (t = e.top + window.scrollY + e.height, n = e.left + window.scrollX), this.content.main.style.top = t + "px", this.content.main.style.left = n + "px", this.applyContentWidth(e);
1309
+ let r = this.getKnownContentWidth(e);
1310
+ if (r !== null) {
1311
+ this.content.main.style.left = this.adjustLeftForOverflow(n, e.left, r) + "px";
1312
+ return;
1313
+ }
1314
+ this.overflowShiftRaf = requestAnimationFrame(() => {
1315
+ this.overflowShiftRaf = 0, this.applyOverflowShiftFromMeasure();
1316
1316
  });
1317
1317
  }
1318
+ applyContentWidth(e) {
1319
+ let t = this.settings.contentWidth;
1320
+ if (this.content.main.style.width = "", this.content.main.style.minWidth = "", this.content.main.style.maxWidth = "", !t) {
1321
+ this.settings.contentPosition !== "relative" && (this.content.main.style.width = e.width + "px");
1322
+ return;
1323
+ }
1324
+ t.startsWith(">") ? this.content.main.style.minWidth = t.slice(1) : t.startsWith("<") ? this.content.main.style.maxWidth = t.slice(1) : this.content.main.style.width = t;
1325
+ }
1326
+ cancelOverflowShift() {
1327
+ this.overflowShiftRaf &&= (cancelAnimationFrame(this.overflowShiftRaf), 0);
1328
+ }
1329
+ getKnownContentWidth(e) {
1330
+ let t = this.settings.contentWidth;
1331
+ if (!t) return e.width;
1332
+ if (t.startsWith(">") || t.startsWith("<") || t.includes("%")) return null;
1333
+ let n = parseFloat(t);
1334
+ return Number.isNaN(n) ? null : n;
1335
+ }
1336
+ adjustLeftForOverflow(e, t, n) {
1337
+ let r = t + n;
1338
+ if (r <= window.innerWidth) return e;
1339
+ let i = e - (r - (window.innerWidth - 20));
1340
+ return this.settings.contentPosition === "fixed" ? Math.max(0, i) : Math.max(window.scrollX, i);
1341
+ }
1342
+ applyOverflowShiftFromMeasure() {
1343
+ let e = this.content.main.getBoundingClientRect().right;
1344
+ if (e <= window.innerWidth) return;
1345
+ let t = e - (window.innerWidth - 20), n = (parseFloat(this.content.main.style.left) || 0) - t;
1346
+ this.settings.contentPosition === "fixed" ? this.content.main.style.left = Math.max(0, n) + "px" : this.content.main.style.left = Math.max(window.scrollX, n) + "px";
1347
+ }
1318
1348
  moveContentAbove() {
1319
1349
  this.setContentDirection("above"), this.setContentPosition();
1320
1350
  }
@@ -1337,7 +1367,7 @@ var j = class {
1337
1367
  };
1338
1368
  //#endregion
1339
1369
  //#region src/slim-select/mutations.ts
1340
- function L(e, t) {
1370
+ function B(e, t) {
1341
1371
  let n = {
1342
1372
  classChanged: !1,
1343
1373
  disabledChanged: !1,
@@ -1358,7 +1388,7 @@ function L(e, t) {
1358
1388
  }
1359
1389
  //#endregion
1360
1390
  //#region src/slim-select/select.ts
1361
- var R = class {
1391
+ var V = class {
1362
1392
  select;
1363
1393
  onValueChange;
1364
1394
  onClassChange;
@@ -1420,7 +1450,7 @@ var R = class {
1420
1450
  }
1421
1451
  observeCall(e) {
1422
1452
  if (!this.listen) return;
1423
- let { classChanged: t, disabledChanged: n, optgroupOptionChanged: r, selectionChanged: i } = L(e, this.select), a = i;
1453
+ let { classChanged: t, disabledChanged: n, optgroupOptionChanged: r, selectionChanged: i } = B(e, this.select), a = i;
1424
1454
  if (t && this.onClassChange && this.onClassChange(this.select.className.split(" ")), n && this.onDisabledChange && (this.changeListen(!1), this.onDisabledChange(this.select.disabled), this.changeListen(!0)), r && this.onOptionsChange) {
1425
1455
  if (this.isUpdating) {
1426
1456
  if (this.select.options.length > 0) {
@@ -1464,7 +1494,7 @@ var R = class {
1464
1494
  placeholder: e.dataset.placeholder === "true",
1465
1495
  class: e.className,
1466
1496
  style: e.style.cssText,
1467
- data: h(e.dataset)
1497
+ data: v(e.dataset)
1468
1498
  };
1469
1499
  }
1470
1500
  getSelectedOptions() {
@@ -1504,7 +1534,7 @@ var R = class {
1504
1534
  }
1505
1535
  }
1506
1536
  let n = this.getSelectedOptions();
1507
- this.select.multiple || (this.select.value = n.length === 1 ? n[0].value : ""), this.changeListen(!0);
1537
+ this.select.multiple || (this.select.value = n.length === 1 ? n[0].value : ""), this.select.dispatchEvent(new Event("change", { bubbles: !0 })), this.changeListen(!0);
1508
1538
  }
1509
1539
  setSelectedByValue(e) {
1510
1540
  this.changeListen(!1);
@@ -1523,7 +1553,7 @@ var R = class {
1523
1553
  }
1524
1554
  }
1525
1555
  let n = this.getSelectedOptions();
1526
- this.select.multiple || (this.select.value = n.length === 1 ? n[0].value : ""), this.changeListen(!0);
1556
+ this.select.multiple || (this.select.value = n.length === 1 ? n[0].value : ""), this.select.dispatchEvent(new Event("change", { bubbles: !0 })), this.changeListen(!0);
1527
1557
  }
1528
1558
  updateSelect(e, t, n) {
1529
1559
  this.changeListen(!1), e && (this.select.dataset.id = e), t && (this.select.style.cssText = t), n && (this.select.className = "", n.forEach((e) => {
@@ -1533,7 +1563,7 @@ var R = class {
1533
1563
  updateOptions(e) {
1534
1564
  if (!(!e || e.length === 0)) {
1535
1565
  this.isUpdating = !0, this.pendingOptionsChange = null, this.changeListen(!1), this.select.innerHTML = "";
1536
- for (let t of e) t instanceof P && this.select.appendChild(this.createOptgroup(t)), t instanceof N && this.select.appendChild(this.createOption(t));
1566
+ for (let t of e) t instanceof L && this.select.appendChild(this.createOptgroup(t)), t instanceof I && this.select.appendChild(this.createOption(t));
1537
1567
  if (this.select.dispatchEvent(new Event("change", { bubbles: !0 })), this.changeListen(!0), this.isUpdating = !1, this.pendingOptionsChange !== null) {
1538
1568
  let e = this.pendingOptionsChange;
1539
1569
  e.length > 0 && this.onOptionsChange ? (this.pendingOptionsChange = null, this.changeListen(!1), this.onOptionsChange(e), this.changeListen(!0)) : this.pendingOptionsChange = null;
@@ -1550,7 +1580,7 @@ var R = class {
1550
1580
  return t.id = e.id, t.value = e.value, t.textContent = e.text, e.html !== "" && t.setAttribute("data-html", e.html), t.defaultSelected = e.defaultSelected, t.selected = e.selected, e.disabled && (t.disabled = !0), e.display || (t.style.display = "none"), e.placeholder && t.setAttribute("data-placeholder", "true"), e.mandatory && t.setAttribute("data-mandatory", "true"), e.class && e.class.split(" ").forEach((e) => {
1551
1581
  t.classList.add(e);
1552
1582
  }), e.data && typeof e.data == "object" && Object.keys(e.data).forEach((n) => {
1553
- t.setAttribute("data-" + k(n), e.data[n]);
1583
+ t.setAttribute("data-" + M(n), e.data[n]);
1554
1584
  }), t;
1555
1585
  }
1556
1586
  setupLabelHandlers() {
@@ -1567,7 +1597,7 @@ var R = class {
1567
1597
  Array.from(new Set(e)).forEach((e) => {
1568
1598
  if (e.__slimSelectLabelHandler) return;
1569
1599
  let t = (e) => {
1570
- let t = e.target, n = y(t, this.select.dataset.id);
1600
+ let t = e.target, n = S(t, this.select.dataset.id);
1571
1601
  e.preventDefault(), !n && this.onLabelClick && this.onLabelClick();
1572
1602
  };
1573
1603
  e.__slimSelectLabelHandler = t, e.addEventListener("click", t, {
@@ -1598,10 +1628,10 @@ var R = class {
1598
1628
  };
1599
1629
  //#endregion
1600
1630
  //#region src/slim-select/sync.ts
1601
- function z(e, t) {
1602
- return O(e.getData(!1), t);
1631
+ function H(e, t) {
1632
+ return j(e.getData(!1), t);
1603
1633
  }
1604
- function B(e, t) {
1634
+ function U(e, t) {
1605
1635
  let n = Array.isArray(t) ? t : [t], r = e.getDataOptions(!1), i = [];
1606
1636
  for (let e of n) {
1607
1637
  if (r.find((t) => t.id == e)) {
@@ -1612,7 +1642,7 @@ function B(e, t) {
1612
1642
  }
1613
1643
  return i;
1614
1644
  }
1615
- var V = class {
1645
+ var W = class {
1616
1646
  deps;
1617
1647
  queue = [];
1618
1648
  flushScheduled = !1;
@@ -1661,7 +1691,7 @@ var V = class {
1661
1691
  }
1662
1692
  applyStructure(e, t, n = !1, r = !1) {
1663
1693
  let { store: i, select: a, render: o, events: s } = this.deps;
1664
- if (z(i, e)) return;
1694
+ if (H(i, e)) return;
1665
1695
  let c = i.getSelected(), l = i.validateDataArray(e);
1666
1696
  if (l) {
1667
1697
  s.error ? s.error(l) : this.deps.onError && this.deps.onError(l);
@@ -1669,19 +1699,19 @@ var V = class {
1669
1699
  }
1670
1700
  i.setData(e, n);
1671
1701
  let u = i.getData(!1);
1672
- r || i.snapshotCatalog(), a.updateOptions(u), o.renderValues(), o.renderOptions(u), s.afterChange && !x(c, i.getSelected()) && s.afterChange(i.getSelectedOptions());
1702
+ r || i.snapshotCatalog(), a.updateOptions(u), o.renderValues(), o.renderOptions(u), s.afterChange && !w(c, i.getSelected()) && s.afterChange(i.getSelectedOptions());
1673
1703
  }
1674
1704
  applySelection(e, t, n) {
1675
- let { store: r, select: i, render: a, events: o } = this.deps, s = r.getSelected(), c = B(r, e);
1676
- if (x(s, c)) return;
1705
+ let { store: r, select: i, render: a, events: o } = this.deps, s = r.getSelected(), c = U(r, e);
1706
+ if (w(s, c)) return;
1677
1707
  r.setSelectedBy("id", c), i.setSelectedByValue(r.getSelectedValues()), a.renderValues();
1678
1708
  let l = a.content.search.input.value.trim();
1679
- l === "" ? a.canUpdateOptionSelectionInPlace() ? a.updateOptionSelection() : a.renderOptions(r.getData(!1)) : a.hasRenderedOptions() ? a.updateOptionSelection() : this.deps.search && this.deps.search(l), n && o.afterChange && !x(s, r.getSelected()) && o.afterChange(r.getSelectedOptions());
1709
+ l === "" ? a.canUpdateOptionSelectionInPlace() ? a.updateOptionSelection() : a.renderOptions(r.getData(!1)) : a.hasRenderedOptions() ? a.updateOptionSelection() : this.deps.search && this.deps.search(l), n && o.afterChange && !w(s, r.getSelected()) && o.afterChange(r.getSelectedOptions());
1680
1710
  }
1681
1711
  applyAddOption(e) {
1682
1712
  let { store: t, select: n, render: r, events: i } = this.deps, a = t.getSelected(), o = r.content.search.input.value.trim() !== "" && !!this.deps.search, s = e.value ?? e.text ?? "", c = (e) => {
1683
1713
  for (let t of e) {
1684
- if (t instanceof P) {
1714
+ if (t instanceof L) {
1685
1715
  if (t.options.some((e) => (e.value ?? e.text) === s)) return !0;
1686
1716
  continue;
1687
1717
  }
@@ -1691,12 +1721,12 @@ var V = class {
1691
1721
  };
1692
1722
  if (!c(t.getData(!1))) if (o) {
1693
1723
  let n = t.getCatalogData();
1694
- c(n) || t.setData([...n, new N(e)], !0), t.snapshotCatalog();
1724
+ c(n) || t.setData([...n, new I(e)], !0), t.snapshotCatalog();
1695
1725
  } else t.addOption(e), t.snapshotCatalog();
1696
1726
  let l = t.getData(!1);
1697
- n.updateOptions(l), r.renderValues(), r.renderOptions(l), i.afterChange && !x(a, t.getSelected()) && i.afterChange(t.getSelectedOptions());
1727
+ n.updateOptions(l), r.renderValues(), r.renderOptions(l), i.afterChange && !w(a, t.getSelected()) && i.afterChange(t.getSelectedOptions());
1698
1728
  }
1699
- }, H = class {
1729
+ }, G = class {
1700
1730
  selectEl;
1701
1731
  settings;
1702
1732
  cssClasses;
@@ -1727,15 +1757,15 @@ var V = class {
1727
1757
  e.events && e.events.error && e.events.error(/* @__PURE__ */ Error("Element isnt of type select"));
1728
1758
  return;
1729
1759
  }
1730
- this.selectEl.dataset.ssid && this.destroy(), this.settings = new m(e.settings), this.cssClasses = new i(e.cssClasses);
1760
+ this.selectEl.dataset.ssid && this.destroy(), this.settings = new _(e.settings), this.cssClasses = new s(e.cssClasses);
1731
1761
  let t = [
1732
1762
  "beforeOpen",
1733
1763
  "afterOpen",
1734
1764
  "beforeClose",
1735
1765
  "afterClose"
1736
1766
  ];
1737
- for (let n in e.events) e.events.hasOwnProperty(n) && (t.indexOf(n) === -1 ? this.events[n] = e.events[n] : this.events[n] = b(e.events[n], 100));
1738
- this.settings.disabled = e.settings?.disabled ? e.settings.disabled : this.selectEl.disabled, this.settings.isMultiple = this.selectEl.multiple, this.settings.style = this.selectEl.style.cssText, this.settings.class = this.selectEl.className.split(" "), this.select = new R(this.selectEl), this.selectEl.id || (this.selectEl.id = this.settings.id), this.select.updateSelect(this.settings.id, this.settings.style, this.settings.class), this.select.hideUI(), this.select.onClassChange = (e) => {
1767
+ for (let n in e.events) e.events.hasOwnProperty(n) && (t.indexOf(n) === -1 ? this.events[n] = e.events[n] : this.events[n] = C(e.events[n], 100));
1768
+ this.settings.disabled = e.settings?.disabled ? e.settings.disabled : this.selectEl.disabled, this.settings.isMultiple = this.selectEl.multiple, this.settings.style = this.selectEl.style.cssText, this.settings.class = this.selectEl.className.split(" "), this.select = new V(this.selectEl), this.selectEl.id || (this.selectEl.id = this.settings.id), this.select.updateSelect(this.settings.id, this.settings.style, this.settings.class), this.select.hideUI(), this.select.onClassChange = (e) => {
1739
1769
  this.settings.class = e, this.render.updateClassStyles();
1740
1770
  }, this.select.onDisabledChange = (e) => {
1741
1771
  e ? this.disable() : this.enable();
@@ -1743,7 +1773,7 @@ var V = class {
1743
1773
  this.settings.disabled || (this.settings.isOpen ? this.close() : this.open());
1744
1774
  };
1745
1775
  let n = e.data ? e.data : this.select.getData();
1746
- this.store = new F(this.settings.isMultiple ? "multiple" : "single", n), e.data && this.select.updateOptions(this.store.getData());
1776
+ this.store = new R(this.settings.isMultiple ? "multiple" : "single", n), e.data && this.select.updateOptions(this.store.getData());
1747
1777
  let r = {
1748
1778
  open: this.open.bind(this),
1749
1779
  close: this.close.bind(this),
@@ -1767,7 +1797,7 @@ var V = class {
1767
1797
  beforeChange: this.events.beforeChange,
1768
1798
  afterChange: this.events.afterChange
1769
1799
  };
1770
- this.settings.modalTitle = e.settings?.modalTitle ?? _(this.selectEl), this.render = new I(this.settings, this.cssClasses, this.store, r), this.settings.timeoutDelay = l(this.render.content.main, e.settings?.timeoutDelay), this.sync = new V({
1800
+ this.settings.modalTitle = e.settings?.modalTitle ?? b(this.selectEl), this.render = new z(this.settings, this.cssClasses, this.store, r), this.settings.timeoutDelay = f(this.render.content.main, e.settings?.timeoutDelay), this.sync = new W({
1771
1801
  select: this.select,
1772
1802
  store: this.store,
1773
1803
  render: this.render,
@@ -1785,7 +1815,7 @@ var V = class {
1785
1815
  data: e || [],
1786
1816
  source: "native"
1787
1817
  });
1788
- }, this.lifecycle = new M({
1818
+ }, this.lifecycle = new F({
1789
1819
  beforeOpen: this.events.beforeOpen,
1790
1820
  afterOpen: this.events.afterOpen,
1791
1821
  beforeClose: this.events.beforeClose,
@@ -1797,7 +1827,7 @@ var V = class {
1797
1827
  }, {
1798
1828
  timeoutDelay: this.settings.timeoutDelay,
1799
1829
  waitForAnimation: (e, t) => this.render.waitForAnimation(e, t)
1800
- }), this.globalEvents = new j({
1830
+ }), this.globalEvents = new P({
1801
1831
  onDocumentClick: this.documentClick.bind(this),
1802
1832
  onWindowResize: () => {
1803
1833
  !this.settings.isOpen && !this.settings.isFullOpen || this.render.moveContent();
@@ -1809,9 +1839,9 @@ var V = class {
1809
1839
  document.hidden && this.close();
1810
1840
  }
1811
1841
  }), this.render.renderValues(), this.render.renderOptions(this.store.getData(!1));
1812
- let a = this.selectEl.getAttribute("aria-label"), o = this.selectEl.getAttribute("aria-labelledby");
1813
- if (a) this.render.main.main.setAttribute("aria-label", a);
1814
- else if (o) this.render.main.main.removeAttribute("aria-label"), this.render.main.main.setAttribute("aria-labelledby", o);
1842
+ let i = this.selectEl.getAttribute("aria-label"), a = this.selectEl.getAttribute("aria-labelledby");
1843
+ if (i) this.render.main.main.setAttribute("aria-label", i);
1844
+ else if (a) this.render.main.main.removeAttribute("aria-label"), this.render.main.main.setAttribute("aria-labelledby", a);
1815
1845
  else if (this.selectEl.labels && this.selectEl.labels.length > 0) {
1816
1846
  let e = Array.from(this.selectEl.labels).map((e, t) => (e.id ||= `${this.settings.id}-label-${t}`, e.id));
1817
1847
  this.render.main.main.removeAttribute("aria-label"), this.render.main.main.setAttribute("aria-labelledby", e.join(" "));
@@ -1868,11 +1898,11 @@ var V = class {
1868
1898
  }
1869
1899
  search(e) {
1870
1900
  let t = e.trim();
1871
- if (this.render.content.search.input.value !== t && (this.render.content.search.input.value = t), t === "") {
1872
- this.clearSearch();
1901
+ if (t === "") {
1902
+ this.render.content.search.input.value = "", this.clearSearch();
1873
1903
  return;
1874
1904
  }
1875
- if (this.events.search) {
1905
+ if (this.render.content.search.input.value !== e && (this.render.content.search.input.value = e), this.events.search) {
1876
1906
  this.runApiSearch(t);
1877
1907
  return;
1878
1908
  }
@@ -1923,12 +1953,34 @@ var V = class {
1923
1953
  this.render.renderError("Search event must return a promise or an array of data");
1924
1954
  }
1925
1955
  destroy() {
1926
- this.lifecycle.destroy(), this.render.stopPositionTracking(), this.globalEvents.detach({ listenScroll: this.settings.openPosition === "auto" }), this.store.setData([]), this.render.destroy(), this.select.destroy();
1956
+ this.lifecycle.destroy(), this.render.stopPositionTracking(), this.globalEvents.detach({ listenScroll: this.settings.openPosition === "auto" }), this.store.setData([]), this.render.destroy(), this.select.destroy(), delete this.selectEl.slim;
1927
1957
  }
1928
1958
  documentClick(e) {
1929
- this.settings.isOpen && e.target && !y(e.target, this.settings.id) && this.close(e.type);
1959
+ this.settings.isOpen && e.target && !S(e.target, this.settings.id) && this.close(e.type);
1930
1960
  }
1931
- }, U = t({
1961
+ };
1962
+ //#endregion
1963
+ //#region src/slim-select/vue/helpers.ts
1964
+ function K(e) {
1965
+ let t = /* @__PURE__ */ new WeakMap(), i = (e) => {
1966
+ if (r(e) && (e = o(e)), n(e) && (e = a(e)), typeof e != "object" || !e) return e;
1967
+ if (t.has(e)) return t.get(e);
1968
+ if (Array.isArray(e)) {
1969
+ let n = [];
1970
+ t.set(e, n);
1971
+ for (let t of e) n.push(i(t));
1972
+ return n;
1973
+ }
1974
+ let s = {};
1975
+ t.set(e, s);
1976
+ for (let t of Object.keys(e)) s[t] = i(e[t]);
1977
+ return s;
1978
+ };
1979
+ return i(e);
1980
+ }
1981
+ //#endregion
1982
+ //#region src/slim-select/vue/vue.vue?vue&type=script&lang.ts
1983
+ var q = t({
1932
1984
  name: "SlimSelect",
1933
1985
  props: {
1934
1986
  modelValue: { type: [
@@ -1969,7 +2021,7 @@ var V = class {
1969
2021
  afterChange: (e) => {
1970
2022
  this.handleAfterChange(e, t);
1971
2023
  }
1972
- }, this.slim = new H(e), this.lastAppliedData = structuredClone(r(this.data)), this.syncModelValueToSlimSelect(!1);
2024
+ }, this.slim = new G(e), this.lastAppliedData = structuredClone(K(this.data)), this.syncModelValueToSlimSelect(!1);
1973
2025
  },
1974
2026
  beforeUnmount() {
1975
2027
  this.slim && this.slim.destroy();
@@ -1980,7 +2032,7 @@ var V = class {
1980
2032
  } },
1981
2033
  data: {
1982
2034
  handler: function(e) {
1983
- this.slim && (this.lastAppliedData !== null && O(this.lastAppliedData, r(e)) || (this.slim.setData(e), this.lastAppliedData = structuredClone(r(e)), this.syncModelValueToSlimSelect(!1)));
2035
+ this.slim && (this.lastAppliedData !== null && j(this.lastAppliedData, a(e)) || (this.slim.setData(e), this.lastAppliedData = structuredClone(K(e)), this.syncModelValueToSlimSelect(!1)));
1984
2036
  },
1985
2037
  deep: !0
1986
2038
  }
@@ -2020,19 +2072,19 @@ var V = class {
2020
2072
  this.slim.setSelected(t, e);
2021
2073
  }
2022
2074
  }
2023
- }), W = (e, t) => {
2075
+ }), J = (e, t) => {
2024
2076
  let n = e.__vccOpts || e;
2025
2077
  for (let [e, r] of t) n[e] = r;
2026
2078
  return n;
2027
- }, G = ["multiple"];
2028
- function K(t, r, i, a, o, s) {
2029
- return n(), e("select", {
2079
+ }, Y = ["multiple"];
2080
+ function X(t, n, r, a, o, s) {
2081
+ return i(), e("select", {
2030
2082
  multiple: t.multiple,
2031
2083
  ref: "slim"
2032
- }, null, 8, G);
2084
+ }, null, 8, Y);
2033
2085
  }
2034
2086
  //#endregion
2035
2087
  //#region src/slim-select/vue/index.ts
2036
- var q = /* @__PURE__ */ W(U, [["render", K]]);
2088
+ var Z = /* @__PURE__ */ J(q, [["render", X]]);
2037
2089
  //#endregion
2038
- export { P as Optgroup, N as Option, m as Settings, q as default };
2090
+ export { L as Optgroup, I as Option, _ as Settings, Z as default };