treeselectjs 0.8.0 → 0.8.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.
@@ -1,974 +1,974 @@
1
- var Ks = Object.defineProperty;
2
- var Xs = (l, e, t) => e in l ? Ks(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t;
3
- var c = (l, e, t) => (Xs(l, typeof e != "symbol" ? e + "" : e, t), t), ft = (l, e, t) => {
4
- if (!e.has(l))
5
- throw TypeError("Cannot " + t);
6
- };
7
- var n = (l, e, t) => (ft(l, e, "read from private field"), t ? t.call(l) : e.get(l)), r = (l, e, t) => {
8
- if (e.has(l))
9
- throw TypeError("Cannot add the same private member more than once");
10
- e instanceof WeakSet ? e.add(l) : e.set(l, t);
11
- }, m = (l, e, t, s) => (ft(l, e, "write to private field"), s ? s.call(l, t) : e.set(l, t), t);
12
- var a = (l, e, t) => (ft(l, e, "access private method"), t);
13
- const At = {
14
- arrowUp: '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 15l-6-6-6 6"/></svg>',
15
- arrowDown: '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 9l6 6 6-6"/></svg>',
16
- arrowRight: '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 18l6-6-6-6"/></svg>',
17
- attention: '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path><line x1="12" y1="9" x2="12" y2="13"></line><line x1="12" y1="17" x2="12.01" y2="17"></line></svg>',
18
- clear: '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="15" y1="9" x2="9" y2="15"></line><line x1="9" y1="9" x2="15" y2="15"></line></svg>',
19
- cross: '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>',
20
- check: '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>',
21
- partialCheck: '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="5" y1="12" x2="19" y2="12"></line></svg>'
22
- }, N = (l, e) => {
23
- if (e.innerHTML = "", typeof l == "string")
24
- e.innerHTML = l;
25
- else {
26
- const t = l.cloneNode(!0);
27
- e.appendChild(t);
28
- }
29
- }, Js = (l) => {
30
- const e = l ? { ...l } : {};
31
- return Object.keys(At).forEach((t) => {
32
- e[t] || (e[t] = At[t]);
33
- }), e;
34
- }, Zs = (l) => l.reduce((e, { name: t }, s) => (e += t, s < l.length - 1 && (e += ", "), e), "");
35
- var A, E, I, v, he, Nt, H, U, ue, Ot, pe, Pt, G, z, T, D, me, Bt, fe, Vt, Ce, Dt, be, It, ge, Ht, we, Gt, ke, Mt, Ee, Ft, ve, qt, Le, jt, ye, $t, xe, Wt, Se, Rt, _e, Ut, Ae, zt, Te, Yt, Y, bt;
36
- class Qs {
37
- constructor({
38
- value: e,
39
- showTags: t,
40
- tagsCountText: s,
41
- clearable: i,
42
- isAlwaysOpened: o,
43
- searchable: d,
44
- placeholder: u,
45
- disabled: f,
46
- isSingleSelect: C,
47
- id: b,
48
- iconElements: g,
49
- inputCallback: w,
50
- searchCallback: k,
51
- openCallback: O,
52
- closeCallback: P,
53
- keydownCallback: R,
54
- focusCallback: ne,
55
- blurCallback: mt,
56
- nameChangeCallback: oe
57
- }) {
58
- // Private methods
59
- r(this, he);
60
- r(this, H);
61
- r(this, ue);
62
- r(this, pe);
63
- r(this, G);
64
- r(this, T);
65
- r(this, me);
66
- r(this, fe);
67
- r(this, Ce);
68
- r(this, be);
69
- r(this, ge);
70
- r(this, we);
71
- r(this, ke);
72
- r(this, Ee);
73
- r(this, ve);
74
- r(this, Le);
75
- r(this, ye);
76
- r(this, xe);
77
- r(this, Se);
78
- r(this, _e);
79
- r(this, Ae);
80
- r(this, Te);
81
- // Emits
82
- r(this, Y);
83
- // Props
84
- c(this, "value");
85
- c(this, "showTags");
86
- c(this, "tagsCountText");
87
- c(this, "clearable");
88
- c(this, "isAlwaysOpened");
89
- c(this, "searchable");
90
- c(this, "placeholder");
91
- c(this, "disabled");
92
- c(this, "isSingleSelect");
93
- c(this, "id");
94
- c(this, "iconElements");
95
- // InnerState
96
- c(this, "isOpened");
97
- c(this, "searchText");
98
- c(this, "srcElement");
99
- // PrivateInnerState
100
- r(this, A, void 0);
101
- r(this, E, void 0);
102
- r(this, I, void 0);
103
- r(this, v, void 0);
104
- // Callbacks
105
- c(this, "inputCallback");
106
- c(this, "searchCallback");
107
- c(this, "openCallback");
108
- c(this, "closeCallback");
109
- c(this, "keydownCallback");
110
- c(this, "focusCallback");
111
- c(this, "blurCallback");
112
- c(this, "nameChangeCallback");
113
- this.value = e, this.showTags = t, this.tagsCountText = s, this.searchable = d, this.placeholder = u, this.clearable = i, this.isAlwaysOpened = o, this.disabled = f, this.isSingleSelect = C, this.id = b, this.iconElements = g, this.isOpened = !1, this.searchText = "", m(this, A, a(this, Ce, Dt).call(this)), m(this, E, a(this, ve, qt).call(this)), m(this, I, a(this, xe, Wt).call(this)), m(this, v, null), this.inputCallback = w, this.searchCallback = k, this.openCallback = O, this.closeCallback = P, this.keydownCallback = R, this.focusCallback = ne, this.blurCallback = mt, this.nameChangeCallback = oe, this.srcElement = a(this, me, Bt).call(this, n(this, A), n(this, E), n(this, I)), a(this, he, Nt).call(this);
114
- }
115
- // Public methods
116
- focus() {
117
- setTimeout(() => n(this, E).focus(), 0);
118
- }
119
- blur() {
120
- this.isOpened && a(this, T, D).call(this), this.clearSearch(), n(this, E).blur();
121
- }
122
- updateValue(e) {
123
- this.value = e, a(this, H, U).call(this), a(this, G, z).call(this);
124
- }
125
- removeItem(e) {
126
- this.value = this.value.filter((t) => t.id !== e), a(this, Y, bt).call(this), a(this, H, U).call(this), a(this, G, z).call(this);
127
- }
128
- clear() {
129
- this.value = [], a(this, Y, bt).call(this), a(this, H, U).call(this), this.clearSearch();
130
- }
131
- openClose() {
132
- a(this, T, D).call(this);
133
- }
134
- clearSearch() {
135
- this.searchText = "", this.searchCallback(""), a(this, G, z).call(this);
136
- }
137
- }
138
- A = new WeakMap(), E = new WeakMap(), I = new WeakMap(), v = new WeakMap(), he = new WeakSet(), Nt = function() {
139
- a(this, H, U).call(this), a(this, G, z).call(this), a(this, ue, Ot).call(this);
140
- }, H = new WeakSet(), U = function() {
141
- if (n(this, A).innerHTML = "", this.showTags) {
142
- n(this, A).append(...a(this, be, It).call(this));
143
- const e = Zs(this.value);
144
- this.nameChangeCallback(e);
145
- } else {
146
- const e = a(this, Ee, Ft).call(this);
147
- n(this, A).appendChild(e), this.nameChangeCallback(e.innerText);
148
- }
149
- n(this, A).appendChild(n(this, E));
150
- }, ue = new WeakSet(), Ot = function() {
151
- const e = [];
152
- n(this, I).innerHTML = "", this.clearable && e.push(a(this, Se, Rt).call(this)), this.isAlwaysOpened || e.push(a(this, Ae, zt).call(this, this.isOpened)), e.length && n(this, I).append(...e);
153
- }, pe = new WeakSet(), Pt = function() {
154
- if (!this.isAlwaysOpened && n(this, v)) {
155
- const e = this.isOpened ? this.iconElements.arrowUp : this.iconElements.arrowDown;
156
- N(e, n(this, v));
157
- }
158
- }, G = new WeakSet(), z = function() {
159
- var e;
160
- (e = this.value) != null && e.length ? (n(this, E).removeAttribute("placeholder"), this.srcElement.classList.remove("treeselect-input--value-not-selected")) : (n(this, E).setAttribute("placeholder", this.placeholder), this.srcElement.classList.add("treeselect-input--value-not-selected")), this.searchable ? this.srcElement.classList.remove("treeselect-input--unsearchable") : this.srcElement.classList.add("treeselect-input--unsearchable"), this.isSingleSelect ? this.srcElement.classList.add("treeselect-input--is-single-select") : this.srcElement.classList.remove("treeselect-input--is-single-select"), n(this, E).value = this.searchText;
161
- }, T = new WeakSet(), D = function() {
162
- this.isOpened = !this.isOpened, a(this, pe, Pt).call(this), this.isOpened ? this.openCallback() : this.closeCallback();
163
- }, me = new WeakSet(), Bt = function(e, t, s) {
164
- const i = document.createElement("div");
165
- return i.classList.add("treeselect-input"), i.setAttribute("tabindex", "-1"), i.addEventListener("mousedown", (o) => a(this, fe, Vt).call(this, o)), i.addEventListener("focus", () => this.focusCallback(), !0), i.addEventListener("blur", () => this.blurCallback(), !0), e.appendChild(t), i.append(e, s), i;
166
- }, fe = new WeakSet(), Vt = function(e) {
167
- e.stopPropagation(), this.isOpened || a(this, T, D).call(this), this.focus();
168
- }, Ce = new WeakSet(), Dt = function() {
169
- const e = document.createElement("div");
170
- return e.classList.add("treeselect-input__tags"), e;
171
- }, be = new WeakSet(), It = function() {
172
- return this.value.map((e) => {
173
- const t = document.createElement("div");
174
- t.classList.add("treeselect-input__tags-element"), t.setAttribute("tabindex", "-1"), t.setAttribute("tag-id", e.id.toString()), t.setAttribute("title", e.name);
175
- const s = a(this, we, Gt).call(this, e.name), i = a(this, ke, Mt).call(this);
176
- return t.addEventListener("mousedown", (o) => a(this, ge, Ht).call(this, o, e.id)), t.append(s, i), t;
177
- });
178
- }, ge = new WeakSet(), Ht = function(e, t) {
179
- e.preventDefault(), e.stopPropagation(), this.removeItem(t), this.focus();
180
- }, we = new WeakSet(), Gt = function(e) {
181
- const t = document.createElement("span");
182
- return t.classList.add("treeselect-input__tags-name"), t.textContent = e, t;
183
- }, ke = new WeakSet(), Mt = function() {
184
- const e = document.createElement("span");
185
- return e.classList.add("treeselect-input__tags-cross"), N(this.iconElements.cross, e), e;
186
- }, Ee = new WeakSet(), Ft = function() {
187
- const e = document.createElement("span");
188
- if (e.classList.add("treeselect-input__tags-count"), !this.value.length)
189
- return e.textContent = "", e.setAttribute("title", ""), e;
190
- const t = this.value.length === 1 ? this.value[0].name : `${this.value.length} ${this.tagsCountText}`;
191
- return e.textContent = t, e.setAttribute("title", t), e;
192
- }, ve = new WeakSet(), qt = function() {
193
- const e = document.createElement("input");
194
- return e.classList.add("treeselect-input__edit"), this.id && e.setAttribute("id", this.id), (!this.searchable || this.disabled) && e.setAttribute("readonly", "readonly"), this.disabled && e.setAttribute("tabindex", "-1"), e.addEventListener("keydown", (t) => a(this, Le, jt).call(this, t)), e.addEventListener("input", (t) => a(this, ye, $t).call(this, t, e)), e;
195
- }, Le = new WeakSet(), jt = function(e) {
196
- e.stopPropagation();
197
- const t = e.key;
198
- t === "Backspace" && !this.searchText.length && this.value.length && !this.showTags && this.clear(), t === "Backspace" && !this.searchText.length && this.value.length && this.removeItem(this.value[this.value.length - 1].id), e.code === "Space" && (!this.searchText || !this.searchable) && a(this, T, D).call(this), (t === "Enter" || t === "ArrowDown" || t === "ArrowUp") && e.preventDefault(), this.keydownCallback(e), t !== "Tab" && this.focus();
199
- }, ye = new WeakSet(), $t = function(e, t) {
200
- e.stopPropagation();
201
- const s = this.searchText, i = t.value.trim();
202
- if (s.length === 0 && i.length === 0) {
203
- t.value = "";
204
- return;
205
- }
206
- if (this.searchable) {
207
- const o = e.target.value;
208
- this.searchCallback(o), this.isOpened || a(this, T, D).call(this);
209
- } else
210
- t.value = "";
211
- this.searchText = t.value;
212
- }, xe = new WeakSet(), Wt = function() {
213
- const e = document.createElement("div");
214
- return e.classList.add("treeselect-input__operators"), e;
215
- }, Se = new WeakSet(), Rt = function() {
216
- const e = document.createElement("span");
217
- return e.classList.add("treeselect-input__clear"), e.setAttribute("tabindex", "-1"), N(this.iconElements.clear, e), e.addEventListener("mousedown", (t) => a(this, _e, Ut).call(this, t)), e;
218
- }, _e = new WeakSet(), Ut = function(e) {
219
- e.preventDefault(), e.stopPropagation(), (this.searchText.length || this.value.length) && this.clear(), this.focus();
220
- }, Ae = new WeakSet(), zt = function(e) {
221
- m(this, v, document.createElement("span")), n(this, v).classList.add("treeselect-input__arrow");
222
- const t = e ? this.iconElements.arrowUp : this.iconElements.arrowDown;
223
- return N(t, n(this, v)), n(this, v).addEventListener("mousedown", (s) => a(this, Te, Yt).call(this, s)), n(this, v);
224
- }, Te = new WeakSet(), Yt = function(e) {
225
- e.stopPropagation(), e.preventDefault(), this.focus(), a(this, T, D).call(this);
226
- }, Y = new WeakSet(), bt = function() {
227
- this.inputCallback(this.value);
228
- };
229
- const Kt = (l, e, t) => {
230
- ii(e);
231
- const s = e.filter((i) => !i.disabled && l.some((o) => o === i.id));
232
- if (t && s.length) {
233
- s[0].checked = !0;
234
- return;
235
- }
236
- s.forEach((i) => {
237
- i.checked = !0;
238
- const o = _t(i, e);
239
- i.checked = o;
240
- });
241
- }, _t = ({ id: l, checked: e }, t) => {
242
- const s = t.find((o) => o.id === l);
243
- if (!s)
244
- return !1;
245
- const i = Xt(!!e, s, t);
246
- return Jt(s, t), i;
247
- }, Xt = (l, e, t) => {
248
- if (!e.isGroup)
249
- return e.checked = e.disabled ? !1 : !!l, e.isPartialChecked = !1, e.checked;
250
- const s = t.filter((u) => u.childOf === e.id);
251
- return !l || e.disabled || e.isPartialChecked ? (e.checked = !1, e.isPartialChecked = !1, gt(e, s, t), e.checked) : Zt(s, t) ? Qt(s) ? (e.checked = !1, e.isPartialChecked = !1, e.disabled = !0, e.checked) : (e.checked = !1, e.isPartialChecked = !0, s.forEach((u) => {
252
- Xt(l, u, t);
253
- }), e.checked) : (e.checked = !0, e.isPartialChecked = !1, gt(e, s, t), e.checked);
254
- }, Jt = (l, e) => {
255
- const t = e.find((s) => s.id === l.childOf);
256
- t && (ei(t, e), Jt(t, e));
257
- }, ei = (l, e) => {
258
- const t = ut(l, e);
259
- if (Qt(t)) {
260
- l.checked = !1, l.isPartialChecked = !1, l.disabled = !0;
261
- return;
262
- }
263
- if (ti(t)) {
264
- l.checked = !0, l.isPartialChecked = !1;
265
- return;
266
- }
267
- if (si(t)) {
268
- l.checked = !1, l.isPartialChecked = !0;
269
- return;
270
- }
271
- l.checked = !1, l.isPartialChecked = !1;
272
- }, gt = ({ checked: l, disabled: e }, t, s) => {
273
- t.forEach((i) => {
274
- i.disabled = !!e, i.checked = !!l && !i.disabled, i.isPartialChecked = !1;
275
- const o = ut(i, s);
276
- gt({ checked: l, disabled: e }, o, s);
277
- });
278
- }, Zt = (l, e) => l.some((i) => i.disabled) ? !0 : l.some((i) => {
279
- if (i.isGroup) {
280
- const o = ut(i, e);
281
- return Zt(o, e);
282
- }
283
- return !1;
284
- }), Qt = (l) => l.every((e) => !!e.disabled), ti = (l) => l.every((e) => !!e.checked), si = (l) => l.some((e) => !!e.checked || !!e.isPartialChecked), ii = (l) => {
285
- l.forEach((e) => {
286
- e.checked = !1, e.isPartialChecked = !1;
287
- });
288
- }, li = (l, e, t = "", s = 0) => {
289
- const i = es(l, e, t, s);
290
- return oi(i);
291
- }, es = (l, e, t, s) => l.reduce((i, o) => {
292
- var C;
293
- const d = !!((C = o.children) != null && C.length), u = s >= e && d, f = s > e;
294
- if (i.push({
295
- id: o.value,
296
- name: o.name,
297
- childOf: t,
298
- isGroup: d,
299
- checked: !1,
300
- isPartialChecked: !1,
301
- level: s,
302
- isClosed: u,
303
- hidden: f,
304
- disabled: o.disabled ?? !1
305
- }), d) {
306
- const b = es(o.children, e, o.value, s + 1);
307
- i.push(...b);
308
- }
309
- return i;
310
- }, []), ut = ({ id: l }, e) => e.filter((t) => t.childOf === l), ni = (l) => {
311
- const { ungroupedNodes: e, allGroupedNodes: t, allNodes: s } = l.reduce(
312
- (o, d) => (d.checked && (o.allNodes.push(d), d.isGroup ? o.allGroupedNodes.push(d) : o.ungroupedNodes.push(d)), o),
313
- {
314
- ungroupedNodes: [],
315
- allGroupedNodes: [],
316
- allNodes: []
317
- }
318
- ), i = s.filter((o) => !t.some(({ id: d }) => d === o.childOf));
319
- return { ungroupedNodes: e, groupedNodes: i, allNodes: s };
320
- }, oi = (l) => (l.filter((t) => !!t.disabled).forEach(({ id: t }) => _t({ id: t, checked: !1 }, l)), l), pt = (l, { id: e, isClosed: t }) => {
321
- ut({ id: e }, l).forEach((i) => {
322
- i.hidden = t ?? !1, i.isGroup && !i.isClosed && pt(l, { id: i.id, isClosed: t });
323
- });
324
- }, ai = (l) => {
325
- l.filter((e) => e.isGroup && !e.disabled && (e.checked || e.isPartialChecked)).forEach((e) => {
326
- e.isClosed = !1, pt(l, e);
327
- });
328
- }, ri = (l, e) => {
329
- const t = ci(l, e);
330
- l.forEach((s) => {
331
- t.some(({ id: o }) => o === s.id) ? (s.isGroup && (s.isClosed = !1, pt(l, s)), s.hidden = !1) : s.hidden = !0;
332
- });
333
- }, ci = (l, e) => l.reduce((t, s) => {
334
- if (s.name.toLowerCase().includes(e.toLowerCase())) {
335
- if (t.push(s), s.isGroup) {
336
- const o = ts(s.id, l);
337
- t.push(...o);
338
- }
339
- if (s.childOf) {
340
- const o = ss(s.childOf, l);
341
- t.push(...o);
342
- }
343
- }
344
- return t;
345
- }, []), ts = (l, e) => e.reduce((t, s) => (s.childOf === l && (t.push(s), s.isGroup && t.push(...ts(s.id, e))), t), []), ss = (l, e) => e.reduce((t, s) => (s.id === l && (t.push(s), s.childOf && t.push(...ss(s.childOf, e))), t), []), di = (l) => {
346
- const { duplications: e } = l.reduce(
347
- (t, s) => (t.allItems.some((i) => i.toString() === s.id.toString()) && t.duplications.push(s.id), t.allItems.push(s.id), t),
348
- {
349
- duplications: [],
350
- allItems: []
351
- }
352
- );
353
- e.length && console.error(`Validation: You have duplicated values: ${e.join(", ")}! You should use unique values.`);
354
- }, hi = (l, e, t, s, i, o, d, u) => {
355
- Kt(l, e, i), u && d && ai(e), ae(e, t, s, o);
356
- }, ae = (l, e, t, s) => {
357
- l.forEach((i) => {
358
- const o = e.querySelector(`[input-id="${i.id}"]`), d = _(o);
359
- o.checked = i.checked, ui(i, d, s), pi(i, d), mi(i, d), fi(i, d, t), Ci(i, d), gi(i, d, l), bi(i, o, t);
360
- }), wi(l, e);
361
- }, ui = (l, e, t) => {
362
- l.checked ? e.classList.add("treeselect-list__item--checked") : e.classList.remove("treeselect-list__item--checked"), Array.isArray(t) && t[0] === l.id && !l.disabled ? e.classList.add("treeselect-list__item--single-selected") : e.classList.remove("treeselect-list__item--single-selected");
363
- }, pi = (l, e) => {
364
- l.isPartialChecked ? e.classList.add("treeselect-list__item--partial-checked") : e.classList.remove("treeselect-list__item--partial-checked");
365
- }, mi = (l, e) => {
366
- l.disabled ? e.classList.add("treeselect-list__item--disabled") : e.classList.remove("treeselect-list__item--disabled");
367
- }, fi = (l, e, t) => {
368
- if (l.isGroup) {
369
- const s = e.querySelector(".treeselect-list__item-icon"), i = l.isClosed ? t.arrowRight : t.arrowDown;
370
- N(i, s), l.isClosed ? e.classList.add("treeselect-list__item--closed") : e.classList.remove("treeselect-list__item--closed");
371
- }
372
- }, Ci = (l, e) => {
373
- l.hidden ? e.classList.add("treeselect-list__item--hidden") : e.classList.remove("treeselect-list__item--hidden");
374
- }, bi = (l, e, t) => {
375
- const i = e.parentNode.querySelector(".treeselect-list__item-checkbox-icon");
376
- l.checked ? N(t.check, i) : l.isPartialChecked ? N(t.partialCheck, i) : i.innerHTML = "";
377
- }, gi = (l, e, t) => {
378
- const s = l.level === 0, i = 20, o = 5;
379
- if (s) {
380
- const d = t.some((f) => f.isGroup && f.level === l.level), u = !l.isGroup && d ? `${i}px` : `${o}px`;
381
- e.style.paddingLeft = l.isGroup ? "0" : u;
382
- } else
383
- e.style.paddingLeft = l.isGroup ? `${l.level * i}px` : `${l.level * i + i}px`;
384
- e.setAttribute("level", l.level.toString()), e.setAttribute("group", l.isGroup.toString());
385
- }, wi = (l, e) => {
386
- const t = l.some((i) => !i.hidden), s = e.querySelector(".treeselect-list__empty");
387
- t ? s.classList.add("treeselect-list__empty--hidden") : s.classList.remove("treeselect-list__empty--hidden");
388
- }, _ = (l) => l.parentNode.parentNode, Tt = (l, e) => e.find((t) => t.id.toString() === l), ki = (l) => _(l).querySelector(".treeselect-list__item-icon"), Ei = (l, e) => {
389
- e && Object.keys(e).forEach((t) => {
390
- const s = e[t];
391
- typeof s == "string" && l.setAttribute(t, s);
392
- });
393
- };
394
- var M, B, y, K, Ne, is, Oe, ls, Pe, ns, Be, os, Ve, as, De, rs, X, wt, Ie, cs, He, ds, Ge, hs, J, kt, Me, us, Fe, ps, qe, ms, je, fs, $e, Cs, We, bs, Re, gs, Ue, ws, ze, ks, Ye, Es, Ke, vs, Z, Et, Q, vt, Xe, Ls;
395
- class vi {
396
- constructor({
397
- options: e,
398
- value: t,
399
- openLevel: s,
400
- listSlotHtmlComponent: i,
401
- emptyText: o,
402
- isSingleSelect: d,
403
- iconElements: u,
404
- showCount: f,
405
- disabledBranchNode: C,
406
- expandSelected: b,
407
- inputCallback: g,
408
- arrowClickCallback: w,
409
- mouseupCallback: k
410
- }) {
411
- // Private methods
412
- r(this, Ne);
413
- r(this, Oe);
414
- r(this, Pe);
415
- r(this, Be);
416
- r(this, Ve);
417
- r(this, De);
418
- r(this, X);
419
- r(this, Ie);
420
- r(this, He);
421
- r(this, Ge);
422
- r(this, J);
423
- r(this, Me);
424
- r(this, Fe);
425
- r(this, qe);
426
- r(this, je);
427
- r(this, $e);
428
- r(this, We);
429
- r(this, Re);
430
- r(this, Ue);
431
- r(this, ze);
432
- // Actions
433
- r(this, Ye);
434
- r(this, Ke);
435
- r(this, Z);
436
- r(this, Q);
437
- // Emits
438
- r(this, Xe);
439
- // Props
440
- c(this, "options");
441
- c(this, "value");
442
- c(this, "openLevel");
443
- c(this, "listSlotHtmlComponent");
444
- c(this, "emptyText");
445
- c(this, "isSingleSelect");
446
- c(this, "showCount");
447
- c(this, "disabledBranchNode");
448
- c(this, "expandSelected");
449
- c(this, "iconElements");
450
- // InnerState
451
- c(this, "searchText");
452
- c(this, "flattedOptions");
453
- c(this, "flattedOptionsBeforeSearch");
454
- c(this, "selectedNodes");
455
- c(this, "srcElement");
456
- // Callbacks
457
- c(this, "inputCallback");
458
- c(this, "arrowClickCallback");
459
- c(this, "mouseupCallback");
460
- // PrivateInnerState
461
- r(this, M, null);
462
- r(this, B, !0);
463
- r(this, y, []);
464
- r(this, K, !0);
465
- this.options = e, this.value = t, this.openLevel = s ?? 0, this.listSlotHtmlComponent = i ?? null, this.emptyText = o ?? "No results found...", this.isSingleSelect = d ?? !1, this.showCount = f ?? !1, this.disabledBranchNode = C ?? !1, this.expandSelected = b ?? !1, this.iconElements = u, this.searchText = "", this.flattedOptions = li(this.options, this.openLevel), this.flattedOptionsBeforeSearch = this.flattedOptions, this.selectedNodes = { nodes: [], groupedNodes: [] }, this.srcElement = a(this, Pe, ns).call(this), this.inputCallback = g, this.arrowClickCallback = w, this.mouseupCallback = k, di(this.flattedOptions);
466
- }
467
- // Public methods
468
- updateValue(e) {
469
- this.value = e, m(this, y, this.isSingleSelect ? this.value : []), hi(
470
- e,
471
- this.flattedOptions,
472
- this.srcElement,
473
- this.iconElements,
474
- this.isSingleSelect,
475
- n(this, y),
476
- this.expandSelected,
477
- n(this, K)
478
- ), m(this, K, !1), a(this, Q, vt).call(this);
479
- }
480
- updateSearchValue(e) {
481
- if (e === this.searchText)
482
- return;
483
- const t = this.searchText === "" && e !== "";
484
- this.searchText = e, t && (this.flattedOptionsBeforeSearch = JSON.parse(JSON.stringify(this.flattedOptions))), this.searchText === "" && (this.flattedOptions = this.flattedOptionsBeforeSearch.map((s) => {
485
- const i = this.flattedOptions.find((o) => o.id === s.id);
486
- return i.isClosed = s.isClosed, i.hidden = s.hidden, i;
487
- }), this.flattedOptionsBeforeSearch = []), this.searchText && ri(this.flattedOptions, e), ae(this.flattedOptions, this.srcElement, this.iconElements, n(this, y)), this.focusFirstListElement();
488
- }
489
- callKeyAction(e) {
490
- m(this, B, !1);
491
- const t = this.srcElement.querySelector(".treeselect-list__item--focused");
492
- if (t == null ? void 0 : t.classList.contains("treeselect-list__item--hidden"))
493
- return;
494
- const i = e.key;
495
- i === "Enter" && t && t.dispatchEvent(new Event("mousedown")), (i === "ArrowLeft" || i === "ArrowRight") && a(this, Ne, is).call(this, t, e), (i === "ArrowDown" || i === "ArrowUp") && a(this, Oe, ls).call(this, t, i);
496
- }
497
- focusFirstListElement() {
498
- const e = "treeselect-list__item--focused", t = this.srcElement.querySelector(`.${e}`), s = Array.from(this.srcElement.querySelectorAll(".treeselect-list__item-checkbox")).filter(
499
- (o) => window.getComputedStyle(_(o)).display !== "none"
500
- );
501
- if (!s.length)
502
- return;
503
- t && t.classList.remove(e), _(s[0]).classList.add(e);
504
- }
505
- isLastFocusedElementExist() {
506
- return !!n(this, M);
507
- }
508
- }
509
- M = new WeakMap(), B = new WeakMap(), y = new WeakMap(), K = new WeakMap(), Ne = new WeakSet(), is = function(e, t) {
510
- if (!e)
511
- return;
512
- const s = t.key, o = e.querySelector(".treeselect-list__item-checkbox").getAttribute("input-id"), d = Tt(o, this.flattedOptions), u = e.querySelector(".treeselect-list__item-icon");
513
- s === "ArrowLeft" && !d.isClosed && d.isGroup && (u.dispatchEvent(new Event("mousedown")), t.preventDefault()), s === "ArrowRight" && d.isClosed && d.isGroup && (u.dispatchEvent(new Event("mousedown")), t.preventDefault());
514
- }, Oe = new WeakSet(), ls = function(e, t) {
515
- var i;
516
- const s = Array.from(this.srcElement.querySelectorAll(".treeselect-list__item-checkbox")).filter(
517
- (o) => window.getComputedStyle(_(o)).display !== "none"
518
- );
519
- if (s.length)
520
- if (!e)
521
- _(s[0]).classList.add("treeselect-list__item--focused");
522
- else {
523
- const o = s.findIndex(
524
- (P) => _(P).classList.contains("treeselect-list__item--focused")
525
- );
526
- _(s[o]).classList.remove("treeselect-list__item--focused");
527
- const u = t === "ArrowDown" ? o + 1 : o - 1, f = t === "ArrowDown" ? 0 : s.length - 1, C = s[u] ?? s[f], b = !s[u], g = _(C);
528
- g.classList.add("treeselect-list__item--focused");
529
- const w = this.srcElement.getBoundingClientRect(), k = g.getBoundingClientRect();
530
- if (b && t === "ArrowDown") {
531
- this.srcElement.scroll(0, 0);
532
- return;
533
- }
534
- if (b && t === "ArrowUp") {
535
- this.srcElement.scroll(0, this.srcElement.scrollHeight);
536
- return;
537
- }
538
- const O = ((i = this.listSlotHtmlComponent) == null ? void 0 : i.clientHeight) ?? 0;
539
- if (w.y + w.height < k.y + k.height + O) {
540
- this.srcElement.scroll(0, this.srcElement.scrollTop + k.height);
541
- return;
542
- }
543
- if (w.y > k.y) {
544
- this.srcElement.scroll(0, this.srcElement.scrollTop - k.height);
545
- return;
546
- }
547
- }
548
- }, Pe = new WeakSet(), ns = function() {
549
- const e = a(this, Be, os).call(this), t = a(this, X, wt).call(this, this.options);
550
- e.append(...t);
551
- const s = a(this, He, ds).call(this);
552
- e.append(s);
553
- const i = a(this, Ie, cs).call(this);
554
- return i && e.append(i), e;
555
- }, Be = new WeakSet(), os = function() {
556
- const e = document.createElement("div");
557
- return e.classList.add("treeselect-list"), this.isSingleSelect && e.classList.add("treeselect-list--single-select"), this.disabledBranchNode && e.classList.add("treeselect-list--disabled-branch-node"), e.addEventListener("mouseout", (t) => a(this, Ve, as).call(this, t)), e.addEventListener("mousemove", () => a(this, De, rs).call(this)), e.addEventListener("mouseup", () => this.mouseupCallback(), !0), e;
558
- }, Ve = new WeakSet(), as = function(e) {
559
- e.stopPropagation(), n(this, M) && n(this, B) && n(this, M).classList.add("treeselect-list__item--focused");
560
- }, De = new WeakSet(), rs = function() {
561
- m(this, B, !0);
562
- }, X = new WeakSet(), wt = function(e) {
563
- return e.reduce((t, s) => {
564
- var o;
565
- if ((o = s.children) != null && o.length) {
566
- const d = a(this, Ge, hs).call(this, s), u = a(this, X, wt).call(this, s.children);
567
- return d.append(...u), t.push(d), t;
568
- }
569
- const i = a(this, J, kt).call(this, s, !1);
570
- return t.push(i), t;
571
- }, []);
572
- }, Ie = new WeakSet(), cs = function() {
573
- if (!this.listSlotHtmlComponent)
574
- return null;
575
- const e = document.createElement("div");
576
- return e.classList.add("treeselect-list__slot"), e.appendChild(this.listSlotHtmlComponent), e;
577
- }, He = new WeakSet(), ds = function() {
578
- const e = document.createElement("div");
579
- e.classList.add("treeselect-list__empty"), e.setAttribute("title", this.emptyText);
580
- const t = document.createElement("span");
581
- t.classList.add("treeselect-list__empty-icon"), N(this.iconElements.attention, t);
582
- const s = document.createElement("span");
583
- return s.classList.add("treeselect-list__empty-text"), s.textContent = this.emptyText, e.append(t, s), e;
584
- }, Ge = new WeakSet(), hs = function(e) {
585
- const t = document.createElement("div");
586
- t.setAttribute("group-container-id", e.value.toString()), t.classList.add("treeselect-list__group-container");
587
- const s = a(this, J, kt).call(this, e, !0);
588
- return t.appendChild(s), t;
589
- }, J = new WeakSet(), kt = function(e, t) {
590
- const s = a(this, Me, us).call(this, e);
591
- if (t) {
592
- const d = a(this, $e, Cs).call(this);
593
- s.appendChild(d), s.classList.add("treeselect-list__item--group");
594
- }
595
- const i = a(this, Re, gs).call(this, e), o = a(this, Ue, ws).call(this, e, t);
596
- return s.append(i, o), s;
597
- }, Me = new WeakSet(), us = function(e) {
598
- const t = document.createElement("div");
599
- return Ei(t, e.htmlAttr), t.setAttribute("tabindex", "-1"), t.setAttribute("title", e.name), t.classList.add("treeselect-list__item"), t.addEventListener("mouseover", () => a(this, Fe, ps).call(this, t), !0), t.addEventListener("mouseout", () => a(this, qe, ms).call(this, t), !0), t.addEventListener("mousedown", (s) => a(this, je, fs).call(this, s, e)), t;
600
- }, Fe = new WeakSet(), ps = function(e) {
601
- n(this, B) && a(this, Z, Et).call(this, !0, e);
602
- }, qe = new WeakSet(), ms = function(e) {
603
- n(this, B) && (a(this, Z, Et).call(this, !1, e), m(this, M, e));
604
- }, je = new WeakSet(), fs = function(e, t) {
605
- var o;
606
- if (e.preventDefault(), e.stopPropagation(), (o = this.flattedOptions.find((d) => d.id === t.value)) == null ? void 0 : o.disabled)
607
- return;
608
- const i = e.target.querySelector(".treeselect-list__item-checkbox");
609
- i.checked = !i.checked, a(this, Ye, Es).call(this, i, t);
610
- }, $e = new WeakSet(), Cs = function() {
611
- const e = document.createElement("span");
612
- return e.setAttribute("tabindex", "-1"), e.classList.add("treeselect-list__item-icon"), N(this.iconElements.arrowDown, e), e.addEventListener("mousedown", (t) => a(this, We, bs).call(this, t)), e;
613
- }, We = new WeakSet(), bs = function(e) {
614
- e.preventDefault(), e.stopPropagation(), a(this, Ke, vs).call(this, e);
615
- }, Re = new WeakSet(), gs = function(e) {
616
- const t = document.createElement("div");
617
- t.classList.add("treeselect-list__item-checkbox-container");
618
- const s = document.createElement("span");
619
- s.classList.add("treeselect-list__item-checkbox-icon"), s.innerHTML = "";
620
- const i = document.createElement("input");
621
- return i.setAttribute("tabindex", "-1"), i.setAttribute("type", "checkbox"), i.setAttribute("input-id", e.value.toString()), i.classList.add("treeselect-list__item-checkbox"), t.append(s, i), t;
622
- }, Ue = new WeakSet(), ws = function(e, t) {
623
- const s = document.createElement("label");
624
- if (s.textContent = e.name, s.classList.add("treeselect-list__item-label"), t && this.showCount) {
625
- const i = a(this, ze, ks).call(this, e);
626
- s.appendChild(i);
627
- }
628
- return s;
629
- }, ze = new WeakSet(), ks = function(e) {
630
- const t = document.createElement("span"), s = this.flattedOptions.filter((i) => i.childOf === e.value);
631
- return t.textContent = `(${s.length})`, t.classList.add("treeselect-list__item-label-counter"), t;
632
- }, Ye = new WeakSet(), Es = function(e, t) {
633
- const s = this.flattedOptions.find((i) => i.id === t.value);
634
- if (s) {
635
- if (s != null && s.isGroup && this.disabledBranchNode) {
636
- const i = ki(e);
637
- i == null || i.dispatchEvent(new Event("mousedown"));
638
- return;
639
- }
640
- if (this.isSingleSelect) {
641
- const [i] = n(this, y);
642
- if (s.id === i)
643
- return;
644
- m(this, y, [s.id]), Kt([s.id], this.flattedOptions, this.isSingleSelect);
645
- } else {
646
- s.checked = e.checked;
647
- const i = _t(s, this.flattedOptions);
648
- e.checked = i;
649
- }
650
- ae(this.flattedOptions, this.srcElement, this.iconElements, n(this, y)), a(this, Xe, Ls).call(this);
651
- }
652
- }, Ke = new WeakSet(), vs = function(e) {
653
- var o, d;
654
- const t = (d = (o = e.target) == null ? void 0 : o.parentNode) == null ? void 0 : d.querySelector("[input-id]"), s = (t == null ? void 0 : t.getAttribute("input-id")) ?? null, i = Tt(s, this.flattedOptions);
655
- i && (i.isClosed = !i.isClosed, pt(this.flattedOptions, i), ae(this.flattedOptions, this.srcElement, this.iconElements, n(this, y)), this.arrowClickCallback());
656
- }, Z = new WeakSet(), Et = function(e, t) {
657
- const s = "treeselect-list__item--focused";
658
- if (e) {
659
- const i = Array.from(this.srcElement.querySelectorAll(`.${s}`));
660
- i.length && i.forEach((o) => o.classList.remove(s)), t.classList.add(s);
661
- } else
662
- t.classList.remove(s);
663
- }, Q = new WeakSet(), vt = function() {
664
- const { ungroupedNodes: e, groupedNodes: t } = ni(this.flattedOptions);
665
- this.selectedNodes = { nodes: e, groupedNodes: t };
666
- }, Xe = new WeakSet(), Ls = function() {
667
- a(this, Q, vt).call(this), this.inputCallback(this.selectedNodes), this.value = this.selectedNodes.nodes.map((e) => e.id);
668
- };
669
- const Li = ({
670
- parentHtmlContainer: l,
671
- staticList: e,
672
- appendToBody: t,
673
- isSingleSelect: s,
674
- value: i,
675
- direction: o
676
- }) => {
677
- l || console.error("Validation: parentHtmlContainer prop is required!"), e && t && console.error("Validation: You should set staticList to false if you use appendToBody!"), s && Array.isArray(i) && console.error("Validation: if you use isSingleSelect prop, you should pass a single value!"), !s && !Array.isArray(i) && console.error("Validation: you should pass an array as a value!"), o && o !== "auto" && o !== "bottom" && o !== "top" && console.error("Validation: you should pass (auto | top | bottom | undefined) as a value for the direction prop!");
678
- }, Ct = (l) => l.map((e) => e.id), yi = (l) => l ? Array.isArray(l) ? l : [l] : [], xi = (l, e) => {
679
- if (e) {
680
- const [t] = l;
681
- return t;
682
- }
683
- return l;
684
- };
685
- var h, p, F, ee, q, x, S, L, V, te, Lt, j, re, Je, ys, Ze, xs, Qe, Ss, et, _s, tt, As, st, Ts, it, Ns, lt, Os, nt, Ps, ot, Bs, se, yt, at, Vs, $, ce, ie, xt, W, de, rt, Ds, le, St, ct, Is, dt, Hs, ht, Gs;
686
- class _i {
687
- constructor({
688
- parentHtmlContainer: e,
689
- value: t,
690
- options: s,
691
- openLevel: i,
692
- appendToBody: o,
693
- alwaysOpen: d,
694
- showTags: u,
695
- tagsCountText: f,
696
- clearable: C,
697
- searchable: b,
698
- placeholder: g,
699
- grouped: w,
700
- isGroupedValue: k,
701
- listSlotHtmlComponent: O,
702
- disabled: P,
703
- emptyText: R,
704
- staticList: ne,
705
- id: mt,
706
- isSingleSelect: oe,
707
- showCount: Ms,
708
- disabledBranchNode: Fs,
709
- direction: qs,
710
- expandSelected: js,
711
- saveScrollPosition: $s,
712
- iconElements: Ws,
713
- inputCallback: Rs,
714
- openCallback: Us,
715
- closeCallback: zs,
716
- nameChangeCallback: Ys
717
- }) {
718
- r(this, te);
719
- r(this, j);
720
- r(this, Je);
721
- r(this, Ze);
722
- r(this, Qe);
723
- r(this, et);
724
- r(this, tt);
725
- r(this, st);
726
- r(this, it);
727
- r(this, lt);
728
- r(this, nt);
729
- r(this, ot);
730
- r(this, se);
731
- r(this, at);
732
- r(this, $);
733
- r(this, ie);
734
- r(this, W);
735
- r(this, rt);
736
- // Emits
737
- r(this, le);
738
- r(this, ct);
739
- r(this, dt);
740
- r(this, ht);
741
- // Props
742
- c(this, "parentHtmlContainer");
743
- c(this, "value");
744
- c(this, "options");
745
- c(this, "openLevel");
746
- c(this, "appendToBody");
747
- c(this, "alwaysOpen");
748
- c(this, "showTags");
749
- c(this, "tagsCountText");
750
- c(this, "clearable");
751
- c(this, "searchable");
752
- c(this, "placeholder");
753
- c(this, "grouped");
754
- c(this, "isGroupedValue");
755
- c(this, "listSlotHtmlComponent");
756
- c(this, "disabled");
757
- c(this, "emptyText");
758
- c(this, "staticList");
759
- c(this, "id");
760
- c(this, "isSingleSelect");
761
- c(this, "showCount");
762
- c(this, "disabledBranchNode");
763
- c(this, "direction");
764
- c(this, "expandSelected");
765
- c(this, "saveScrollPosition");
766
- c(this, "iconElements");
767
- c(this, "inputCallback");
768
- c(this, "openCallback");
769
- c(this, "closeCallback");
770
- c(this, "nameChangeCallback");
771
- // InnerState
772
- c(this, "ungroupedValue");
773
- c(this, "groupedValue");
774
- c(this, "isListOpened");
775
- c(this, "selectedName");
776
- c(this, "srcElement");
777
- // Components
778
- r(this, h, null);
779
- r(this, p, null);
780
- // Resize props
781
- r(this, F, null);
782
- // List position scroll
783
- r(this, ee, 0);
784
- // Timer for search text
785
- r(this, q, 0);
786
- // Outside listeners
787
- r(this, x, null);
788
- r(this, S, null);
789
- r(this, L, null);
790
- r(this, V, null);
791
- Li({
792
- parentHtmlContainer: e,
793
- value: t,
794
- staticList: ne,
795
- appendToBody: o,
796
- isSingleSelect: oe
797
- }), this.parentHtmlContainer = e, this.value = [], this.options = s ?? [], this.openLevel = i ?? 0, this.appendToBody = o ?? !1, this.alwaysOpen = !!(d && !P), this.showTags = u ?? !0, this.tagsCountText = f ?? "elements selected", this.clearable = C ?? !0, this.searchable = b ?? !0, this.placeholder = g ?? "Search...", this.grouped = w ?? !0, this.isGroupedValue = k ?? !1, this.listSlotHtmlComponent = O ?? null, this.disabled = P ?? !1, this.emptyText = R ?? "No results found...", this.staticList = !!(ne && !this.appendToBody), this.id = mt ?? "", this.isSingleSelect = oe ?? !1, this.showCount = Ms ?? !1, this.disabledBranchNode = Fs ?? !1, this.direction = qs ?? "auto", this.expandSelected = js ?? !1, this.saveScrollPosition = $s ?? !0, this.iconElements = Js(Ws), this.inputCallback = Rs, this.openCallback = Us, this.closeCallback = zs, this.nameChangeCallback = Ys, this.ungroupedValue = [], this.groupedValue = [], this.isListOpened = !1, this.selectedName = "", this.srcElement = null, a(this, te, Lt).call(this, t);
798
- }
799
- mount() {
800
- a(this, te, Lt).call(this, this.value);
801
- }
802
- updateValue(e) {
803
- var s;
804
- const t = n(this, h);
805
- if (t) {
806
- const i = yi(e);
807
- t.updateValue(i);
808
- const { groupedNodes: o, nodes: d } = t.selectedNodes, u = this.grouped || this.isSingleSelect ? o : d;
809
- (s = n(this, p)) == null || s.updateValue(u), a(this, j, re).call(this, { groupedNodes: o, nodes: d });
810
- }
811
- }
812
- destroy() {
813
- this.srcElement && (a(this, se, yt).call(this), this.srcElement.innerHTML = "", this.srcElement = null, a(this, W, de).call(this, !0));
814
- }
815
- focus() {
816
- n(this, p) && n(this, p).focus();
817
- }
818
- toggleOpenClose() {
819
- n(this, p) && (n(this, p).openClose(), n(this, p).focus());
820
- }
821
- // Outside Listeners
822
- scrollWindowHandler() {
823
- this.updateListPosition();
824
- }
825
- focusWindowHandler(e) {
826
- var s, i, o;
827
- ((s = this.srcElement) == null ? void 0 : s.contains(e.target)) || ((i = n(this, h)) == null ? void 0 : i.srcElement.contains(e.target)) || ((o = n(this, p)) == null || o.blur(), a(this, W, de).call(this, !1), a(this, $, ce).call(this, !1));
828
- }
829
- blurWindowHandler() {
830
- var e;
831
- (e = n(this, p)) == null || e.blur(), a(this, W, de).call(this, !1), a(this, $, ce).call(this, !1);
832
- }
833
- // Update direction of the list. Support appendToBody and standard mode with absolute
834
- updateListPosition() {
835
- var O;
836
- const e = this.srcElement, t = (O = n(this, h)) == null ? void 0 : O.srcElement;
837
- if (!e || !t)
838
- return;
839
- const { height: s } = t.getBoundingClientRect(), {
840
- x: i,
841
- y: o,
842
- height: d,
843
- width: u
844
- } = e.getBoundingClientRect(), f = window.innerHeight, C = o, b = f - o - d;
845
- let g = C > b && C >= s && b < s;
846
- if (this.direction !== "auto" && (g = this.direction === "top"), this.appendToBody) {
847
- (t.style.top !== "0px" || t.style.left !== "0px") && (t.style.top = "0px", t.style.left = "0px");
848
- const P = i + window.scrollX, R = g ? o + window.scrollY - s : o + window.scrollY + d;
849
- t.style.transform = `translate(${P}px,${R}px)`, t.style.width = `${u}px`;
850
- }
851
- const w = g ? "top" : "bottom";
852
- t.getAttribute("direction") !== w && (t.setAttribute("direction", w), a(this, at, Vs).call(this, g, this.appendToBody));
853
- }
854
- }
855
- h = new WeakMap(), p = new WeakMap(), F = new WeakMap(), ee = new WeakMap(), q = new WeakMap(), x = new WeakMap(), S = new WeakMap(), L = new WeakMap(), V = new WeakMap(), te = new WeakSet(), Lt = function(e) {
856
- var o;
857
- this.destroy();
858
- const { container: t, list: s, input: i } = a(this, Je, ys).call(this);
859
- this.srcElement = t, m(this, h, s), m(this, p, i), m(this, x, this.scrollWindowHandler.bind(this)), m(this, S, this.scrollWindowHandler.bind(this)), m(this, L, this.focusWindowHandler.bind(this)), m(this, V, this.blurWindowHandler.bind(this)), this.alwaysOpen && ((o = n(this, p)) == null || o.openClose()), this.disabled ? this.srcElement.classList.add("treeselect--disabled") : this.srcElement.classList.remove("treeselect--disabled"), this.updateValue(e ?? this.value);
860
- }, j = new WeakSet(), re = function({ groupedNodes: e, nodes: t }) {
861
- this.ungroupedValue = t ? Ct(t) : [], this.groupedValue = e ? Ct(e) : [];
862
- const s = this.isGroupedValue || this.isSingleSelect ? this.groupedValue : this.ungroupedValue;
863
- this.value = xi(s, this.isSingleSelect);
864
- }, Je = new WeakSet(), ys = function() {
865
- const e = this.parentHtmlContainer;
866
- e.classList.add("treeselect");
867
- const t = new vi({
868
- options: this.options,
869
- value: this.ungroupedValue,
870
- openLevel: this.openLevel,
871
- listSlotHtmlComponent: this.listSlotHtmlComponent,
872
- emptyText: this.emptyText,
873
- isSingleSelect: this.isSingleSelect,
874
- showCount: this.showCount,
875
- disabledBranchNode: this.disabledBranchNode,
876
- expandSelected: this.expandSelected,
877
- iconElements: this.iconElements,
878
- inputCallback: (d) => a(this, it, Ns).call(this, d),
879
- arrowClickCallback: () => a(this, lt, Os).call(this),
880
- mouseupCallback: () => {
881
- var d;
882
- return (d = n(this, p)) == null ? void 0 : d.focus();
883
- }
884
- }), { groupedNodes: s, nodes: i } = t.selectedNodes, o = new Qs({
885
- value: this.grouped || this.isSingleSelect ? s : i,
886
- showTags: this.showTags,
887
- tagsCountText: this.tagsCountText,
888
- clearable: this.clearable,
889
- isAlwaysOpened: this.alwaysOpen,
890
- searchable: this.searchable,
891
- placeholder: this.placeholder,
892
- disabled: this.disabled,
893
- isSingleSelect: this.isSingleSelect,
894
- id: this.id,
895
- iconElements: this.iconElements,
896
- inputCallback: (d) => a(this, Ze, xs).call(this, d),
897
- searchCallback: (d) => a(this, et, _s).call(this, d),
898
- openCallback: () => a(this, ot, Bs).call(this),
899
- closeCallback: () => a(this, se, yt).call(this),
900
- keydownCallback: (d) => a(this, Qe, Ss).call(this, d),
901
- focusCallback: () => a(this, tt, As).call(this),
902
- blurCallback: () => a(this, st, Ts).call(this),
903
- nameChangeCallback: (d) => a(this, nt, Ps).call(this, d)
904
- });
905
- return this.appendToBody && m(this, F, new ResizeObserver(() => this.updateListPosition())), e.append(o.srcElement), { container: e, list: t, input: o };
906
- }, Ze = new WeakSet(), xs = function(e) {
907
- var o, d, u, f, C;
908
- const t = Ct(e);
909
- (o = n(this, h)) == null || o.updateValue(t);
910
- const s = (u = (d = n(this, h)) == null ? void 0 : d.selectedNodes) == null ? void 0 : u.nodes, i = (C = (f = n(this, h)) == null ? void 0 : f.selectedNodes) == null ? void 0 : C.groupedNodes;
911
- a(this, j, re).call(this, { groupedNodes: i, nodes: s }), a(this, le, St).call(this);
912
- }, Qe = new WeakSet(), Ss = function(e) {
913
- var t;
914
- this.isListOpened && ((t = n(this, h)) == null || t.callKeyAction(e));
915
- }, et = new WeakSet(), _s = function(e) {
916
- n(this, q) && clearTimeout(n(this, q)), m(this, q, setTimeout(() => {
917
- var t;
918
- (t = n(this, h)) == null || t.updateSearchValue(e), this.updateListPosition();
919
- }, 350));
920
- }, tt = new WeakSet(), As = function() {
921
- a(this, $, ce).call(this, !0), n(this, L) && n(this, L) && n(this, V) && (document.addEventListener("mousedown", n(this, L), !0), document.addEventListener("focus", n(this, L), !0), window.addEventListener("blur", n(this, V)));
922
- }, st = new WeakSet(), Ts = function() {
923
- setTimeout(() => {
924
- var s, i;
925
- const e = (s = n(this, p)) == null ? void 0 : s.srcElement.contains(document.activeElement), t = (i = n(this, h)) == null ? void 0 : i.srcElement.contains(document.activeElement);
926
- !e && !t && this.blurWindowHandler();
927
- }, 1);
928
- }, it = new WeakSet(), Ns = function(e) {
929
- var o, d, u, f;
930
- const { groupedNodes: t, nodes: s } = e, i = this.grouped || this.isSingleSelect ? t : s;
931
- (o = n(this, p)) == null || o.updateValue(i), a(this, j, re).call(this, { groupedNodes: t, nodes: s }), this.isSingleSelect && !this.alwaysOpen && ((d = n(this, p)) == null || d.openClose(), (u = n(this, p)) == null || u.clearSearch()), (f = n(this, p)) == null || f.focus(), a(this, le, St).call(this);
932
- }, lt = new WeakSet(), Os = function() {
933
- var e;
934
- (e = n(this, p)) == null || e.focus(), this.updateListPosition();
935
- }, nt = new WeakSet(), Ps = function(e) {
936
- this.selectedName !== e && (this.selectedName = e, a(this, ct, Is).call(this));
937
- }, ot = new WeakSet(), Bs = function() {
938
- var e;
939
- this.isListOpened = !0, n(this, x) && n(this, S) && (window.addEventListener("scroll", n(this, x), !0), window.addEventListener("resize", n(this, S))), !(!n(this, h) || !this.srcElement) && (this.appendToBody ? (document.body.appendChild(n(this, h).srcElement), (e = n(this, F)) == null || e.observe(this.srcElement)) : this.srcElement.appendChild(n(this, h).srcElement), this.updateListPosition(), a(this, ie, xt).call(this, !0), a(this, rt, Ds).call(this), a(this, dt, Hs).call(this));
940
- }, se = new WeakSet(), yt = function() {
941
- var t;
942
- this.alwaysOpen || (this.isListOpened = !1, n(this, x) && n(this, S) && (window.removeEventListener("scroll", n(this, x), !0), window.removeEventListener("resize", n(this, S))), !n(this, h) || !this.srcElement) || !(this.appendToBody ? document.body.contains(n(this, h).srcElement) : this.srcElement.contains(n(this, h).srcElement)) || (m(this, ee, n(this, h).srcElement.scrollTop), this.appendToBody ? (document.body.removeChild(n(this, h).srcElement), (t = n(this, F)) == null || t.disconnect()) : this.srcElement.removeChild(n(this, h).srcElement), a(this, ie, xt).call(this, !1), a(this, ht, Gs).call(this));
943
- }, at = new WeakSet(), Vs = function(e, t) {
944
- if (!n(this, h) || !n(this, p))
945
- return;
946
- const s = t ? "treeselect-list--top-to-body" : "treeselect-list--top", i = t ? "treeselect-list--bottom-to-body" : "treeselect-list--bottom";
947
- e ? (n(this, h).srcElement.classList.add(s), n(this, h).srcElement.classList.remove(i), n(this, p).srcElement.classList.add("treeselect-input--top"), n(this, p).srcElement.classList.remove("treeselect-input--bottom")) : (n(this, h).srcElement.classList.remove(s), n(this, h).srcElement.classList.add(i), n(this, p).srcElement.classList.remove("treeselect-input--top"), n(this, p).srcElement.classList.add("treeselect-input--bottom"));
948
- }, $ = new WeakSet(), ce = function(e) {
949
- !n(this, p) || !n(this, h) || (e ? (n(this, p).srcElement.classList.add("treeselect-input--focused"), n(this, h).srcElement.classList.add("treeselect-list--focused")) : (n(this, p).srcElement.classList.remove("treeselect-input--focused"), n(this, h).srcElement.classList.remove("treeselect-list--focused")));
950
- }, ie = new WeakSet(), xt = function(e) {
951
- var t, s, i, o;
952
- e ? (t = n(this, p)) == null || t.srcElement.classList.add("treeselect-input--opened") : (s = n(this, p)) == null || s.srcElement.classList.remove("treeselect-input--opened"), this.staticList ? (i = n(this, h)) == null || i.srcElement.classList.add("treeselect-list--static") : (o = n(this, h)) == null || o.srcElement.classList.remove("treeselect-list--static");
953
- }, W = new WeakSet(), de = function(e) {
954
- !n(this, x) || !n(this, S) || !n(this, L) || !n(this, V) || ((!this.alwaysOpen || e) && (window.removeEventListener("scroll", n(this, x), !0), window.removeEventListener("resize", n(this, S))), document.removeEventListener("mousedown", n(this, L), !0), document.removeEventListener("focus", n(this, L), !0), window.removeEventListener("blur", n(this, V)));
955
- }, rt = new WeakSet(), Ds = function() {
956
- var t, s, i;
957
- const e = (t = n(this, h)) == null ? void 0 : t.isLastFocusedElementExist();
958
- this.saveScrollPosition && e ? (s = n(this, h)) == null || s.srcElement.scroll(0, n(this, ee)) : (i = n(this, h)) == null || i.focusFirstListElement();
959
- }, le = new WeakSet(), St = function() {
960
- var e;
961
- (e = this.srcElement) == null || e.dispatchEvent(new CustomEvent("input", { detail: this.value })), this.inputCallback && this.inputCallback(this.value);
962
- }, ct = new WeakSet(), Is = function() {
963
- var e;
964
- (e = this.srcElement) == null || e.dispatchEvent(new CustomEvent("name-change", { detail: this.selectedName })), this.nameChangeCallback && this.nameChangeCallback(this.selectedName);
965
- }, dt = new WeakSet(), Hs = function() {
966
- var e;
967
- this.alwaysOpen || ((e = this.srcElement) == null || e.dispatchEvent(new CustomEvent("open", { detail: this.value })), this.openCallback && this.openCallback(this.value));
968
- }, ht = new WeakSet(), Gs = function() {
969
- var e;
970
- this.alwaysOpen || ((e = this.srcElement) == null || e.dispatchEvent(new CustomEvent("close", { detail: this.value })), this.closeCallback && this.closeCallback(this.value));
971
- };
972
- export {
973
- _i as default
974
- };
1
+ var Ks = Object.defineProperty;
2
+ var Xs = (l, e, t) => e in l ? Ks(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t;
3
+ var c = (l, e, t) => (Xs(l, typeof e != "symbol" ? e + "" : e, t), t), ft = (l, e, t) => {
4
+ if (!e.has(l))
5
+ throw TypeError("Cannot " + t);
6
+ };
7
+ var n = (l, e, t) => (ft(l, e, "read from private field"), t ? t.call(l) : e.get(l)), r = (l, e, t) => {
8
+ if (e.has(l))
9
+ throw TypeError("Cannot add the same private member more than once");
10
+ e instanceof WeakSet ? e.add(l) : e.set(l, t);
11
+ }, m = (l, e, t, s) => (ft(l, e, "write to private field"), s ? s.call(l, t) : e.set(l, t), t);
12
+ var a = (l, e, t) => (ft(l, e, "access private method"), t);
13
+ const At = {
14
+ arrowUp: '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 15l-6-6-6 6"/></svg>',
15
+ arrowDown: '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 9l6 6 6-6"/></svg>',
16
+ arrowRight: '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 18l6-6-6-6"/></svg>',
17
+ attention: '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path><line x1="12" y1="9" x2="12" y2="13"></line><line x1="12" y1="17" x2="12.01" y2="17"></line></svg>',
18
+ clear: '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="15" y1="9" x2="9" y2="15"></line><line x1="9" y1="9" x2="15" y2="15"></line></svg>',
19
+ cross: '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>',
20
+ check: '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>',
21
+ partialCheck: '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 25 25" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="5" y1="12" x2="19" y2="12"></line></svg>'
22
+ }, N = (l, e) => {
23
+ if (e.innerHTML = "", typeof l == "string")
24
+ e.innerHTML = l;
25
+ else {
26
+ const t = l.cloneNode(!0);
27
+ e.appendChild(t);
28
+ }
29
+ }, Js = (l) => {
30
+ const e = l ? { ...l } : {};
31
+ return Object.keys(At).forEach((t) => {
32
+ e[t] || (e[t] = At[t]);
33
+ }), e;
34
+ }, Zs = (l) => l.reduce((e, { name: t }, s) => (e += t, s < l.length - 1 && (e += ", "), e), "");
35
+ var A, E, I, v, he, Nt, H, U, ue, Ot, pe, Pt, G, z, T, D, me, Bt, fe, Vt, Ce, Dt, be, It, ge, Ht, we, Gt, ke, Mt, Ee, Ft, ve, qt, Le, jt, ye, $t, xe, Wt, Se, Rt, _e, Ut, Ae, zt, Te, Yt, Y, bt;
36
+ class Qs {
37
+ constructor({
38
+ value: e,
39
+ showTags: t,
40
+ tagsCountText: s,
41
+ clearable: i,
42
+ isAlwaysOpened: o,
43
+ searchable: d,
44
+ placeholder: u,
45
+ disabled: f,
46
+ isSingleSelect: C,
47
+ id: b,
48
+ iconElements: g,
49
+ inputCallback: w,
50
+ searchCallback: k,
51
+ openCallback: O,
52
+ closeCallback: P,
53
+ keydownCallback: R,
54
+ focusCallback: ne,
55
+ blurCallback: mt,
56
+ nameChangeCallback: oe
57
+ }) {
58
+ // Private methods
59
+ r(this, he);
60
+ r(this, H);
61
+ r(this, ue);
62
+ r(this, pe);
63
+ r(this, G);
64
+ r(this, T);
65
+ r(this, me);
66
+ r(this, fe);
67
+ r(this, Ce);
68
+ r(this, be);
69
+ r(this, ge);
70
+ r(this, we);
71
+ r(this, ke);
72
+ r(this, Ee);
73
+ r(this, ve);
74
+ r(this, Le);
75
+ r(this, ye);
76
+ r(this, xe);
77
+ r(this, Se);
78
+ r(this, _e);
79
+ r(this, Ae);
80
+ r(this, Te);
81
+ // Emits
82
+ r(this, Y);
83
+ // Props
84
+ c(this, "value");
85
+ c(this, "showTags");
86
+ c(this, "tagsCountText");
87
+ c(this, "clearable");
88
+ c(this, "isAlwaysOpened");
89
+ c(this, "searchable");
90
+ c(this, "placeholder");
91
+ c(this, "disabled");
92
+ c(this, "isSingleSelect");
93
+ c(this, "id");
94
+ c(this, "iconElements");
95
+ // InnerState
96
+ c(this, "isOpened");
97
+ c(this, "searchText");
98
+ c(this, "srcElement");
99
+ // PrivateInnerState
100
+ r(this, A, void 0);
101
+ r(this, E, void 0);
102
+ r(this, I, void 0);
103
+ r(this, v, void 0);
104
+ // Callbacks
105
+ c(this, "inputCallback");
106
+ c(this, "searchCallback");
107
+ c(this, "openCallback");
108
+ c(this, "closeCallback");
109
+ c(this, "keydownCallback");
110
+ c(this, "focusCallback");
111
+ c(this, "blurCallback");
112
+ c(this, "nameChangeCallback");
113
+ this.value = e, this.showTags = t, this.tagsCountText = s, this.searchable = d, this.placeholder = u, this.clearable = i, this.isAlwaysOpened = o, this.disabled = f, this.isSingleSelect = C, this.id = b, this.iconElements = g, this.isOpened = !1, this.searchText = "", m(this, A, a(this, Ce, Dt).call(this)), m(this, E, a(this, ve, qt).call(this)), m(this, I, a(this, xe, Wt).call(this)), m(this, v, null), this.inputCallback = w, this.searchCallback = k, this.openCallback = O, this.closeCallback = P, this.keydownCallback = R, this.focusCallback = ne, this.blurCallback = mt, this.nameChangeCallback = oe, this.srcElement = a(this, me, Bt).call(this, n(this, A), n(this, E), n(this, I)), a(this, he, Nt).call(this);
114
+ }
115
+ // Public methods
116
+ focus() {
117
+ setTimeout(() => n(this, E).focus(), 0);
118
+ }
119
+ blur() {
120
+ this.isOpened && a(this, T, D).call(this), this.clearSearch(), n(this, E).blur();
121
+ }
122
+ updateValue(e) {
123
+ this.value = e, a(this, H, U).call(this), a(this, G, z).call(this);
124
+ }
125
+ removeItem(e) {
126
+ this.value = this.value.filter((t) => t.id !== e), a(this, Y, bt).call(this), a(this, H, U).call(this), a(this, G, z).call(this);
127
+ }
128
+ clear() {
129
+ this.value = [], a(this, Y, bt).call(this), a(this, H, U).call(this), this.clearSearch();
130
+ }
131
+ openClose() {
132
+ a(this, T, D).call(this);
133
+ }
134
+ clearSearch() {
135
+ this.searchText = "", this.searchCallback(""), a(this, G, z).call(this);
136
+ }
137
+ }
138
+ A = new WeakMap(), E = new WeakMap(), I = new WeakMap(), v = new WeakMap(), he = new WeakSet(), Nt = function() {
139
+ a(this, H, U).call(this), a(this, G, z).call(this), a(this, ue, Ot).call(this);
140
+ }, H = new WeakSet(), U = function() {
141
+ if (n(this, A).innerHTML = "", this.showTags) {
142
+ n(this, A).append(...a(this, be, It).call(this));
143
+ const e = Zs(this.value);
144
+ this.nameChangeCallback(e);
145
+ } else {
146
+ const e = a(this, Ee, Ft).call(this);
147
+ n(this, A).appendChild(e), this.nameChangeCallback(e.innerText);
148
+ }
149
+ n(this, A).appendChild(n(this, E));
150
+ }, ue = new WeakSet(), Ot = function() {
151
+ const e = [];
152
+ n(this, I).innerHTML = "", this.clearable && e.push(a(this, Se, Rt).call(this)), this.isAlwaysOpened || e.push(a(this, Ae, zt).call(this, this.isOpened)), e.length && n(this, I).append(...e);
153
+ }, pe = new WeakSet(), Pt = function() {
154
+ if (!this.isAlwaysOpened && n(this, v)) {
155
+ const e = this.isOpened ? this.iconElements.arrowUp : this.iconElements.arrowDown;
156
+ N(e, n(this, v));
157
+ }
158
+ }, G = new WeakSet(), z = function() {
159
+ var e;
160
+ (e = this.value) != null && e.length ? (n(this, E).removeAttribute("placeholder"), this.srcElement.classList.remove("treeselect-input--value-not-selected")) : (n(this, E).setAttribute("placeholder", this.placeholder), this.srcElement.classList.add("treeselect-input--value-not-selected")), this.searchable ? this.srcElement.classList.remove("treeselect-input--unsearchable") : this.srcElement.classList.add("treeselect-input--unsearchable"), this.isSingleSelect ? this.srcElement.classList.add("treeselect-input--is-single-select") : this.srcElement.classList.remove("treeselect-input--is-single-select"), n(this, E).value = this.searchText;
161
+ }, T = new WeakSet(), D = function() {
162
+ this.isOpened = !this.isOpened, a(this, pe, Pt).call(this), this.isOpened ? this.openCallback() : this.closeCallback();
163
+ }, me = new WeakSet(), Bt = function(e, t, s) {
164
+ const i = document.createElement("div");
165
+ return i.classList.add("treeselect-input"), i.setAttribute("tabindex", "-1"), i.addEventListener("mousedown", (o) => a(this, fe, Vt).call(this, o)), i.addEventListener("focus", () => this.focusCallback(), !0), i.addEventListener("blur", () => this.blurCallback(), !0), e.appendChild(t), i.append(e, s), i;
166
+ }, fe = new WeakSet(), Vt = function(e) {
167
+ e.stopPropagation(), this.isOpened || a(this, T, D).call(this), this.focus();
168
+ }, Ce = new WeakSet(), Dt = function() {
169
+ const e = document.createElement("div");
170
+ return e.classList.add("treeselect-input__tags"), e;
171
+ }, be = new WeakSet(), It = function() {
172
+ return this.value.map((e) => {
173
+ const t = document.createElement("div");
174
+ t.classList.add("treeselect-input__tags-element"), t.setAttribute("tabindex", "-1"), t.setAttribute("tag-id", e.id.toString()), t.setAttribute("title", e.name);
175
+ const s = a(this, we, Gt).call(this, e.name), i = a(this, ke, Mt).call(this);
176
+ return t.addEventListener("mousedown", (o) => a(this, ge, Ht).call(this, o, e.id)), t.append(s, i), t;
177
+ });
178
+ }, ge = new WeakSet(), Ht = function(e, t) {
179
+ e.preventDefault(), e.stopPropagation(), this.removeItem(t), this.focus();
180
+ }, we = new WeakSet(), Gt = function(e) {
181
+ const t = document.createElement("span");
182
+ return t.classList.add("treeselect-input__tags-name"), t.textContent = e, t;
183
+ }, ke = new WeakSet(), Mt = function() {
184
+ const e = document.createElement("span");
185
+ return e.classList.add("treeselect-input__tags-cross"), N(this.iconElements.cross, e), e;
186
+ }, Ee = new WeakSet(), Ft = function() {
187
+ const e = document.createElement("span");
188
+ if (e.classList.add("treeselect-input__tags-count"), !this.value.length)
189
+ return e.textContent = "", e.setAttribute("title", ""), e;
190
+ const t = this.value.length === 1 ? this.value[0].name : `${this.value.length} ${this.tagsCountText}`;
191
+ return e.textContent = t, e.setAttribute("title", t), e;
192
+ }, ve = new WeakSet(), qt = function() {
193
+ const e = document.createElement("input");
194
+ return e.classList.add("treeselect-input__edit"), this.id && e.setAttribute("id", this.id), (!this.searchable || this.disabled) && e.setAttribute("readonly", "readonly"), this.disabled && e.setAttribute("tabindex", "-1"), e.addEventListener("keydown", (t) => a(this, Le, jt).call(this, t)), e.addEventListener("input", (t) => a(this, ye, $t).call(this, t, e)), e;
195
+ }, Le = new WeakSet(), jt = function(e) {
196
+ e.stopPropagation();
197
+ const t = e.key;
198
+ t === "Backspace" && !this.searchText.length && this.value.length && !this.showTags && this.clear(), t === "Backspace" && !this.searchText.length && this.value.length && this.removeItem(this.value[this.value.length - 1].id), e.code === "Space" && (!this.searchText || !this.searchable) && a(this, T, D).call(this), (t === "Enter" || t === "ArrowDown" || t === "ArrowUp") && e.preventDefault(), this.keydownCallback(e), t !== "Tab" && this.focus();
199
+ }, ye = new WeakSet(), $t = function(e, t) {
200
+ e.stopPropagation();
201
+ const s = this.searchText, i = t.value.trim();
202
+ if (s.length === 0 && i.length === 0) {
203
+ t.value = "";
204
+ return;
205
+ }
206
+ if (this.searchable) {
207
+ const o = e.target.value;
208
+ this.searchCallback(o), this.isOpened || a(this, T, D).call(this);
209
+ } else
210
+ t.value = "";
211
+ this.searchText = t.value;
212
+ }, xe = new WeakSet(), Wt = function() {
213
+ const e = document.createElement("div");
214
+ return e.classList.add("treeselect-input__operators"), e;
215
+ }, Se = new WeakSet(), Rt = function() {
216
+ const e = document.createElement("span");
217
+ return e.classList.add("treeselect-input__clear"), e.setAttribute("tabindex", "-1"), N(this.iconElements.clear, e), e.addEventListener("mousedown", (t) => a(this, _e, Ut).call(this, t)), e;
218
+ }, _e = new WeakSet(), Ut = function(e) {
219
+ e.preventDefault(), e.stopPropagation(), (this.searchText.length || this.value.length) && this.clear(), this.focus();
220
+ }, Ae = new WeakSet(), zt = function(e) {
221
+ m(this, v, document.createElement("span")), n(this, v).classList.add("treeselect-input__arrow");
222
+ const t = e ? this.iconElements.arrowUp : this.iconElements.arrowDown;
223
+ return N(t, n(this, v)), n(this, v).addEventListener("mousedown", (s) => a(this, Te, Yt).call(this, s)), n(this, v);
224
+ }, Te = new WeakSet(), Yt = function(e) {
225
+ e.stopPropagation(), e.preventDefault(), this.focus(), a(this, T, D).call(this);
226
+ }, Y = new WeakSet(), bt = function() {
227
+ this.inputCallback(this.value);
228
+ };
229
+ const Kt = (l, e, t) => {
230
+ ii(e);
231
+ const s = e.filter((i) => !i.disabled && l.some((o) => o === i.id));
232
+ if (t && s.length) {
233
+ s[0].checked = !0;
234
+ return;
235
+ }
236
+ s.forEach((i) => {
237
+ i.checked = !0;
238
+ const o = _t(i, e);
239
+ i.checked = o;
240
+ });
241
+ }, _t = ({ id: l, checked: e }, t) => {
242
+ const s = t.find((o) => o.id === l);
243
+ if (!s)
244
+ return !1;
245
+ const i = Xt(!!e, s, t);
246
+ return Jt(s, t), i;
247
+ }, Xt = (l, e, t) => {
248
+ if (!e.isGroup)
249
+ return e.checked = e.disabled ? !1 : !!l, e.isPartialChecked = !1, e.checked;
250
+ const s = t.filter((u) => u.childOf === e.id);
251
+ return !l || e.disabled || e.isPartialChecked ? (e.checked = !1, e.isPartialChecked = !1, gt(e, s, t), e.checked) : Zt(s, t) ? Qt(s) ? (e.checked = !1, e.isPartialChecked = !1, e.disabled = !0, e.checked) : (e.checked = !1, e.isPartialChecked = !0, s.forEach((u) => {
252
+ Xt(l, u, t);
253
+ }), e.checked) : (e.checked = !0, e.isPartialChecked = !1, gt(e, s, t), e.checked);
254
+ }, Jt = (l, e) => {
255
+ const t = e.find((s) => s.id === l.childOf);
256
+ t && (ei(t, e), Jt(t, e));
257
+ }, ei = (l, e) => {
258
+ const t = ut(l, e);
259
+ if (Qt(t)) {
260
+ l.checked = !1, l.isPartialChecked = !1, l.disabled = !0;
261
+ return;
262
+ }
263
+ if (ti(t)) {
264
+ l.checked = !0, l.isPartialChecked = !1;
265
+ return;
266
+ }
267
+ if (si(t)) {
268
+ l.checked = !1, l.isPartialChecked = !0;
269
+ return;
270
+ }
271
+ l.checked = !1, l.isPartialChecked = !1;
272
+ }, gt = ({ checked: l, disabled: e }, t, s) => {
273
+ t.forEach((i) => {
274
+ i.disabled = !!e, i.checked = !!l && !i.disabled, i.isPartialChecked = !1;
275
+ const o = ut(i, s);
276
+ gt({ checked: l, disabled: e }, o, s);
277
+ });
278
+ }, Zt = (l, e) => l.some((i) => i.disabled) ? !0 : l.some((i) => {
279
+ if (i.isGroup) {
280
+ const o = ut(i, e);
281
+ return Zt(o, e);
282
+ }
283
+ return !1;
284
+ }), Qt = (l) => l.every((e) => !!e.disabled), ti = (l) => l.every((e) => !!e.checked), si = (l) => l.some((e) => !!e.checked || !!e.isPartialChecked), ii = (l) => {
285
+ l.forEach((e) => {
286
+ e.checked = !1, e.isPartialChecked = !1;
287
+ });
288
+ }, li = (l, e, t = "", s = 0) => {
289
+ const i = es(l, e, t, s);
290
+ return oi(i);
291
+ }, es = (l, e, t, s) => l.reduce((i, o) => {
292
+ var C;
293
+ const d = !!((C = o.children) != null && C.length), u = s >= e && d, f = s > e;
294
+ if (i.push({
295
+ id: o.value,
296
+ name: o.name,
297
+ childOf: t,
298
+ isGroup: d,
299
+ checked: !1,
300
+ isPartialChecked: !1,
301
+ level: s,
302
+ isClosed: u,
303
+ hidden: f,
304
+ disabled: o.disabled ?? !1
305
+ }), d) {
306
+ const b = es(o.children, e, o.value, s + 1);
307
+ i.push(...b);
308
+ }
309
+ return i;
310
+ }, []), ut = ({ id: l }, e) => e.filter((t) => t.childOf === l), ni = (l) => {
311
+ const { ungroupedNodes: e, allGroupedNodes: t, allNodes: s } = l.reduce(
312
+ (o, d) => (d.checked && (o.allNodes.push(d), d.isGroup ? o.allGroupedNodes.push(d) : o.ungroupedNodes.push(d)), o),
313
+ {
314
+ ungroupedNodes: [],
315
+ allGroupedNodes: [],
316
+ allNodes: []
317
+ }
318
+ ), i = s.filter((o) => !t.some(({ id: d }) => d === o.childOf));
319
+ return { ungroupedNodes: e, groupedNodes: i, allNodes: s };
320
+ }, oi = (l) => (l.filter((t) => !!t.disabled).forEach(({ id: t }) => _t({ id: t, checked: !1 }, l)), l), pt = (l, { id: e, isClosed: t }) => {
321
+ ut({ id: e }, l).forEach((i) => {
322
+ i.hidden = t ?? !1, i.isGroup && !i.isClosed && pt(l, { id: i.id, isClosed: t });
323
+ });
324
+ }, ai = (l) => {
325
+ l.filter((e) => e.isGroup && !e.disabled && (e.checked || e.isPartialChecked)).forEach((e) => {
326
+ e.isClosed = !1, pt(l, e);
327
+ });
328
+ }, ri = (l, e) => {
329
+ const t = ci(l, e);
330
+ l.forEach((s) => {
331
+ t.some(({ id: o }) => o === s.id) ? (s.isGroup && (s.isClosed = !1, pt(l, s)), s.hidden = !1) : s.hidden = !0;
332
+ });
333
+ }, ci = (l, e) => l.reduce((t, s) => {
334
+ if (s.name.toLowerCase().includes(e.toLowerCase())) {
335
+ if (t.push(s), s.isGroup) {
336
+ const o = ts(s.id, l);
337
+ t.push(...o);
338
+ }
339
+ if (s.childOf) {
340
+ const o = ss(s.childOf, l);
341
+ t.push(...o);
342
+ }
343
+ }
344
+ return t;
345
+ }, []), ts = (l, e) => e.reduce((t, s) => (s.childOf === l && (t.push(s), s.isGroup && t.push(...ts(s.id, e))), t), []), ss = (l, e) => e.reduce((t, s) => (s.id === l && (t.push(s), s.childOf && t.push(...ss(s.childOf, e))), t), []), di = (l) => {
346
+ const { duplications: e } = l.reduce(
347
+ (t, s) => (t.allItems.some((i) => i.toString() === s.id.toString()) && t.duplications.push(s.id), t.allItems.push(s.id), t),
348
+ {
349
+ duplications: [],
350
+ allItems: []
351
+ }
352
+ );
353
+ e.length && console.error(`Validation: You have duplicated values: ${e.join(", ")}! You should use unique values.`);
354
+ }, hi = (l, e, t, s, i, o, d, u) => {
355
+ Kt(l, e, i), u && d && ai(e), ae(e, t, s, o);
356
+ }, ae = (l, e, t, s) => {
357
+ l.forEach((i) => {
358
+ const o = e.querySelector(`[input-id="${i.id}"]`), d = _(o);
359
+ o.checked = i.checked, ui(i, d, s), pi(i, d), mi(i, d), fi(i, d, t), Ci(i, d), gi(i, d, l), bi(i, o, t);
360
+ }), wi(l, e);
361
+ }, ui = (l, e, t) => {
362
+ l.checked ? e.classList.add("treeselect-list__item--checked") : e.classList.remove("treeselect-list__item--checked"), Array.isArray(t) && t[0] === l.id && !l.disabled ? e.classList.add("treeselect-list__item--single-selected") : e.classList.remove("treeselect-list__item--single-selected");
363
+ }, pi = (l, e) => {
364
+ l.isPartialChecked ? e.classList.add("treeselect-list__item--partial-checked") : e.classList.remove("treeselect-list__item--partial-checked");
365
+ }, mi = (l, e) => {
366
+ l.disabled ? e.classList.add("treeselect-list__item--disabled") : e.classList.remove("treeselect-list__item--disabled");
367
+ }, fi = (l, e, t) => {
368
+ if (l.isGroup) {
369
+ const s = e.querySelector(".treeselect-list__item-icon"), i = l.isClosed ? t.arrowRight : t.arrowDown;
370
+ N(i, s), l.isClosed ? e.classList.add("treeselect-list__item--closed") : e.classList.remove("treeselect-list__item--closed");
371
+ }
372
+ }, Ci = (l, e) => {
373
+ l.hidden ? e.classList.add("treeselect-list__item--hidden") : e.classList.remove("treeselect-list__item--hidden");
374
+ }, bi = (l, e, t) => {
375
+ const i = e.parentNode.querySelector(".treeselect-list__item-checkbox-icon");
376
+ l.checked ? N(t.check, i) : l.isPartialChecked ? N(t.partialCheck, i) : i.innerHTML = "";
377
+ }, gi = (l, e, t) => {
378
+ const s = l.level === 0, i = 20, o = 5;
379
+ if (s) {
380
+ const d = t.some((f) => f.isGroup && f.level === l.level), u = !l.isGroup && d ? `${i}px` : `${o}px`;
381
+ e.style.paddingLeft = l.isGroup ? "0" : u;
382
+ } else
383
+ e.style.paddingLeft = l.isGroup ? `${l.level * i}px` : `${l.level * i + i}px`;
384
+ e.setAttribute("level", l.level.toString()), e.setAttribute("group", l.isGroup.toString());
385
+ }, wi = (l, e) => {
386
+ const t = l.some((i) => !i.hidden), s = e.querySelector(".treeselect-list__empty");
387
+ t ? s.classList.add("treeselect-list__empty--hidden") : s.classList.remove("treeselect-list__empty--hidden");
388
+ }, _ = (l) => l.parentNode.parentNode, Tt = (l, e) => e.find((t) => t.id.toString() === l), ki = (l) => _(l).querySelector(".treeselect-list__item-icon"), Ei = (l, e) => {
389
+ e && Object.keys(e).forEach((t) => {
390
+ const s = e[t];
391
+ typeof s == "string" && l.setAttribute(t, s);
392
+ });
393
+ };
394
+ var M, B, y, K, Ne, is, Oe, ls, Pe, ns, Be, os, Ve, as, De, rs, X, wt, Ie, cs, He, ds, Ge, hs, J, kt, Me, us, Fe, ps, qe, ms, je, fs, $e, Cs, We, bs, Re, gs, Ue, ws, ze, ks, Ye, Es, Ke, vs, Z, Et, Q, vt, Xe, Ls;
395
+ class vi {
396
+ constructor({
397
+ options: e,
398
+ value: t,
399
+ openLevel: s,
400
+ listSlotHtmlComponent: i,
401
+ emptyText: o,
402
+ isSingleSelect: d,
403
+ iconElements: u,
404
+ showCount: f,
405
+ disabledBranchNode: C,
406
+ expandSelected: b,
407
+ inputCallback: g,
408
+ arrowClickCallback: w,
409
+ mouseupCallback: k
410
+ }) {
411
+ // Private methods
412
+ r(this, Ne);
413
+ r(this, Oe);
414
+ r(this, Pe);
415
+ r(this, Be);
416
+ r(this, Ve);
417
+ r(this, De);
418
+ r(this, X);
419
+ r(this, Ie);
420
+ r(this, He);
421
+ r(this, Ge);
422
+ r(this, J);
423
+ r(this, Me);
424
+ r(this, Fe);
425
+ r(this, qe);
426
+ r(this, je);
427
+ r(this, $e);
428
+ r(this, We);
429
+ r(this, Re);
430
+ r(this, Ue);
431
+ r(this, ze);
432
+ // Actions
433
+ r(this, Ye);
434
+ r(this, Ke);
435
+ r(this, Z);
436
+ r(this, Q);
437
+ // Emits
438
+ r(this, Xe);
439
+ // Props
440
+ c(this, "options");
441
+ c(this, "value");
442
+ c(this, "openLevel");
443
+ c(this, "listSlotHtmlComponent");
444
+ c(this, "emptyText");
445
+ c(this, "isSingleSelect");
446
+ c(this, "showCount");
447
+ c(this, "disabledBranchNode");
448
+ c(this, "expandSelected");
449
+ c(this, "iconElements");
450
+ // InnerState
451
+ c(this, "searchText");
452
+ c(this, "flattedOptions");
453
+ c(this, "flattedOptionsBeforeSearch");
454
+ c(this, "selectedNodes");
455
+ c(this, "srcElement");
456
+ // Callbacks
457
+ c(this, "inputCallback");
458
+ c(this, "arrowClickCallback");
459
+ c(this, "mouseupCallback");
460
+ // PrivateInnerState
461
+ r(this, M, null);
462
+ r(this, B, !0);
463
+ r(this, y, []);
464
+ r(this, K, !0);
465
+ this.options = e, this.value = t, this.openLevel = s ?? 0, this.listSlotHtmlComponent = i ?? null, this.emptyText = o ?? "No results found...", this.isSingleSelect = d ?? !1, this.showCount = f ?? !1, this.disabledBranchNode = C ?? !1, this.expandSelected = b ?? !1, this.iconElements = u, this.searchText = "", this.flattedOptions = li(this.options, this.openLevel), this.flattedOptionsBeforeSearch = this.flattedOptions, this.selectedNodes = { nodes: [], groupedNodes: [] }, this.srcElement = a(this, Pe, ns).call(this), this.inputCallback = g, this.arrowClickCallback = w, this.mouseupCallback = k, di(this.flattedOptions);
466
+ }
467
+ // Public methods
468
+ updateValue(e) {
469
+ this.value = e, m(this, y, this.isSingleSelect ? this.value : []), hi(
470
+ e,
471
+ this.flattedOptions,
472
+ this.srcElement,
473
+ this.iconElements,
474
+ this.isSingleSelect,
475
+ n(this, y),
476
+ this.expandSelected,
477
+ n(this, K)
478
+ ), m(this, K, !1), a(this, Q, vt).call(this);
479
+ }
480
+ updateSearchValue(e) {
481
+ if (e === this.searchText)
482
+ return;
483
+ const t = this.searchText === "" && e !== "";
484
+ this.searchText = e, t && (this.flattedOptionsBeforeSearch = JSON.parse(JSON.stringify(this.flattedOptions))), this.searchText === "" && (this.flattedOptions = this.flattedOptionsBeforeSearch.map((s) => {
485
+ const i = this.flattedOptions.find((o) => o.id === s.id);
486
+ return i.isClosed = s.isClosed, i.hidden = s.hidden, i;
487
+ }), this.flattedOptionsBeforeSearch = []), this.searchText && ri(this.flattedOptions, e), ae(this.flattedOptions, this.srcElement, this.iconElements, n(this, y)), this.focusFirstListElement();
488
+ }
489
+ callKeyAction(e) {
490
+ m(this, B, !1);
491
+ const t = this.srcElement.querySelector(".treeselect-list__item--focused");
492
+ if (t == null ? void 0 : t.classList.contains("treeselect-list__item--hidden"))
493
+ return;
494
+ const i = e.key;
495
+ i === "Enter" && t && t.dispatchEvent(new Event("mousedown")), (i === "ArrowLeft" || i === "ArrowRight") && a(this, Ne, is).call(this, t, e), (i === "ArrowDown" || i === "ArrowUp") && a(this, Oe, ls).call(this, t, i);
496
+ }
497
+ focusFirstListElement() {
498
+ const e = "treeselect-list__item--focused", t = this.srcElement.querySelector(`.${e}`), s = Array.from(this.srcElement.querySelectorAll(".treeselect-list__item-checkbox")).filter(
499
+ (o) => window.getComputedStyle(_(o)).display !== "none"
500
+ );
501
+ if (!s.length)
502
+ return;
503
+ t && t.classList.remove(e), _(s[0]).classList.add(e);
504
+ }
505
+ isLastFocusedElementExist() {
506
+ return !!n(this, M);
507
+ }
508
+ }
509
+ M = new WeakMap(), B = new WeakMap(), y = new WeakMap(), K = new WeakMap(), Ne = new WeakSet(), is = function(e, t) {
510
+ if (!e)
511
+ return;
512
+ const s = t.key, o = e.querySelector(".treeselect-list__item-checkbox").getAttribute("input-id"), d = Tt(o, this.flattedOptions), u = e.querySelector(".treeselect-list__item-icon");
513
+ s === "ArrowLeft" && !d.isClosed && d.isGroup && (u.dispatchEvent(new Event("mousedown")), t.preventDefault()), s === "ArrowRight" && d.isClosed && d.isGroup && (u.dispatchEvent(new Event("mousedown")), t.preventDefault());
514
+ }, Oe = new WeakSet(), ls = function(e, t) {
515
+ var i;
516
+ const s = Array.from(this.srcElement.querySelectorAll(".treeselect-list__item-checkbox")).filter(
517
+ (o) => window.getComputedStyle(_(o)).display !== "none"
518
+ );
519
+ if (s.length)
520
+ if (!e)
521
+ _(s[0]).classList.add("treeselect-list__item--focused");
522
+ else {
523
+ const o = s.findIndex(
524
+ (P) => _(P).classList.contains("treeselect-list__item--focused")
525
+ );
526
+ _(s[o]).classList.remove("treeselect-list__item--focused");
527
+ const u = t === "ArrowDown" ? o + 1 : o - 1, f = t === "ArrowDown" ? 0 : s.length - 1, C = s[u] ?? s[f], b = !s[u], g = _(C);
528
+ g.classList.add("treeselect-list__item--focused");
529
+ const w = this.srcElement.getBoundingClientRect(), k = g.getBoundingClientRect();
530
+ if (b && t === "ArrowDown") {
531
+ this.srcElement.scroll(0, 0);
532
+ return;
533
+ }
534
+ if (b && t === "ArrowUp") {
535
+ this.srcElement.scroll(0, this.srcElement.scrollHeight);
536
+ return;
537
+ }
538
+ const O = ((i = this.listSlotHtmlComponent) == null ? void 0 : i.clientHeight) ?? 0;
539
+ if (w.y + w.height < k.y + k.height + O) {
540
+ this.srcElement.scroll(0, this.srcElement.scrollTop + k.height);
541
+ return;
542
+ }
543
+ if (w.y > k.y) {
544
+ this.srcElement.scroll(0, this.srcElement.scrollTop - k.height);
545
+ return;
546
+ }
547
+ }
548
+ }, Pe = new WeakSet(), ns = function() {
549
+ const e = a(this, Be, os).call(this), t = a(this, X, wt).call(this, this.options);
550
+ e.append(...t);
551
+ const s = a(this, He, ds).call(this);
552
+ e.append(s);
553
+ const i = a(this, Ie, cs).call(this);
554
+ return i && e.append(i), e;
555
+ }, Be = new WeakSet(), os = function() {
556
+ const e = document.createElement("div");
557
+ return e.classList.add("treeselect-list"), this.isSingleSelect && e.classList.add("treeselect-list--single-select"), this.disabledBranchNode && e.classList.add("treeselect-list--disabled-branch-node"), e.addEventListener("mouseout", (t) => a(this, Ve, as).call(this, t)), e.addEventListener("mousemove", () => a(this, De, rs).call(this)), e.addEventListener("mouseup", () => this.mouseupCallback(), !0), e;
558
+ }, Ve = new WeakSet(), as = function(e) {
559
+ e.stopPropagation(), n(this, M) && n(this, B) && n(this, M).classList.add("treeselect-list__item--focused");
560
+ }, De = new WeakSet(), rs = function() {
561
+ m(this, B, !0);
562
+ }, X = new WeakSet(), wt = function(e) {
563
+ return e.reduce((t, s) => {
564
+ var o;
565
+ if ((o = s.children) != null && o.length) {
566
+ const d = a(this, Ge, hs).call(this, s), u = a(this, X, wt).call(this, s.children);
567
+ return d.append(...u), t.push(d), t;
568
+ }
569
+ const i = a(this, J, kt).call(this, s, !1);
570
+ return t.push(i), t;
571
+ }, []);
572
+ }, Ie = new WeakSet(), cs = function() {
573
+ if (!this.listSlotHtmlComponent)
574
+ return null;
575
+ const e = document.createElement("div");
576
+ return e.classList.add("treeselect-list__slot"), e.appendChild(this.listSlotHtmlComponent), e;
577
+ }, He = new WeakSet(), ds = function() {
578
+ const e = document.createElement("div");
579
+ e.classList.add("treeselect-list__empty"), e.setAttribute("title", this.emptyText);
580
+ const t = document.createElement("span");
581
+ t.classList.add("treeselect-list__empty-icon"), N(this.iconElements.attention, t);
582
+ const s = document.createElement("span");
583
+ return s.classList.add("treeselect-list__empty-text"), s.textContent = this.emptyText, e.append(t, s), e;
584
+ }, Ge = new WeakSet(), hs = function(e) {
585
+ const t = document.createElement("div");
586
+ t.setAttribute("group-container-id", e.value.toString()), t.classList.add("treeselect-list__group-container");
587
+ const s = a(this, J, kt).call(this, e, !0);
588
+ return t.appendChild(s), t;
589
+ }, J = new WeakSet(), kt = function(e, t) {
590
+ const s = a(this, Me, us).call(this, e);
591
+ if (t) {
592
+ const d = a(this, $e, Cs).call(this);
593
+ s.appendChild(d), s.classList.add("treeselect-list__item--group");
594
+ }
595
+ const i = a(this, Re, gs).call(this, e), o = a(this, Ue, ws).call(this, e, t);
596
+ return s.append(i, o), s;
597
+ }, Me = new WeakSet(), us = function(e) {
598
+ const t = document.createElement("div");
599
+ return Ei(t, e.htmlAttr), t.setAttribute("tabindex", "-1"), t.setAttribute("title", e.name), t.classList.add("treeselect-list__item"), t.addEventListener("mouseover", () => a(this, Fe, ps).call(this, t), !0), t.addEventListener("mouseout", () => a(this, qe, ms).call(this, t), !0), t.addEventListener("mousedown", (s) => a(this, je, fs).call(this, s, e)), t;
600
+ }, Fe = new WeakSet(), ps = function(e) {
601
+ n(this, B) && a(this, Z, Et).call(this, !0, e);
602
+ }, qe = new WeakSet(), ms = function(e) {
603
+ n(this, B) && (a(this, Z, Et).call(this, !1, e), m(this, M, e));
604
+ }, je = new WeakSet(), fs = function(e, t) {
605
+ var o;
606
+ if (e.preventDefault(), e.stopPropagation(), (o = this.flattedOptions.find((d) => d.id === t.value)) == null ? void 0 : o.disabled)
607
+ return;
608
+ const i = e.target.querySelector(".treeselect-list__item-checkbox");
609
+ i.checked = !i.checked, a(this, Ye, Es).call(this, i, t);
610
+ }, $e = new WeakSet(), Cs = function() {
611
+ const e = document.createElement("span");
612
+ return e.setAttribute("tabindex", "-1"), e.classList.add("treeselect-list__item-icon"), N(this.iconElements.arrowDown, e), e.addEventListener("mousedown", (t) => a(this, We, bs).call(this, t)), e;
613
+ }, We = new WeakSet(), bs = function(e) {
614
+ e.preventDefault(), e.stopPropagation(), a(this, Ke, vs).call(this, e);
615
+ }, Re = new WeakSet(), gs = function(e) {
616
+ const t = document.createElement("div");
617
+ t.classList.add("treeselect-list__item-checkbox-container");
618
+ const s = document.createElement("span");
619
+ s.classList.add("treeselect-list__item-checkbox-icon"), s.innerHTML = "";
620
+ const i = document.createElement("input");
621
+ return i.setAttribute("tabindex", "-1"), i.setAttribute("type", "checkbox"), i.setAttribute("input-id", e.value.toString()), i.classList.add("treeselect-list__item-checkbox"), t.append(s, i), t;
622
+ }, Ue = new WeakSet(), ws = function(e, t) {
623
+ const s = document.createElement("label");
624
+ if (s.textContent = e.name, s.classList.add("treeselect-list__item-label"), t && this.showCount) {
625
+ const i = a(this, ze, ks).call(this, e);
626
+ s.appendChild(i);
627
+ }
628
+ return s;
629
+ }, ze = new WeakSet(), ks = function(e) {
630
+ const t = document.createElement("span"), s = this.flattedOptions.filter((i) => i.childOf === e.value);
631
+ return t.textContent = `(${s.length})`, t.classList.add("treeselect-list__item-label-counter"), t;
632
+ }, Ye = new WeakSet(), Es = function(e, t) {
633
+ const s = this.flattedOptions.find((i) => i.id === t.value);
634
+ if (s) {
635
+ if (s != null && s.isGroup && this.disabledBranchNode) {
636
+ const i = ki(e);
637
+ i == null || i.dispatchEvent(new Event("mousedown"));
638
+ return;
639
+ }
640
+ if (this.isSingleSelect) {
641
+ const [i] = n(this, y);
642
+ if (s.id === i)
643
+ return;
644
+ m(this, y, [s.id]), Kt([s.id], this.flattedOptions, this.isSingleSelect);
645
+ } else {
646
+ s.checked = e.checked;
647
+ const i = _t(s, this.flattedOptions);
648
+ e.checked = i;
649
+ }
650
+ ae(this.flattedOptions, this.srcElement, this.iconElements, n(this, y)), a(this, Xe, Ls).call(this);
651
+ }
652
+ }, Ke = new WeakSet(), vs = function(e) {
653
+ var o, d;
654
+ const t = (d = (o = e.target) == null ? void 0 : o.parentNode) == null ? void 0 : d.querySelector("[input-id]"), s = (t == null ? void 0 : t.getAttribute("input-id")) ?? null, i = Tt(s, this.flattedOptions);
655
+ i && (i.isClosed = !i.isClosed, pt(this.flattedOptions, i), ae(this.flattedOptions, this.srcElement, this.iconElements, n(this, y)), this.arrowClickCallback());
656
+ }, Z = new WeakSet(), Et = function(e, t) {
657
+ const s = "treeselect-list__item--focused";
658
+ if (e) {
659
+ const i = Array.from(this.srcElement.querySelectorAll(`.${s}`));
660
+ i.length && i.forEach((o) => o.classList.remove(s)), t.classList.add(s);
661
+ } else
662
+ t.classList.remove(s);
663
+ }, Q = new WeakSet(), vt = function() {
664
+ const { ungroupedNodes: e, groupedNodes: t } = ni(this.flattedOptions);
665
+ this.selectedNodes = { nodes: e, groupedNodes: t };
666
+ }, Xe = new WeakSet(), Ls = function() {
667
+ a(this, Q, vt).call(this), this.inputCallback(this.selectedNodes), this.value = this.selectedNodes.nodes.map((e) => e.id);
668
+ };
669
+ const Li = ({
670
+ parentHtmlContainer: l,
671
+ staticList: e,
672
+ appendToBody: t,
673
+ isSingleSelect: s,
674
+ value: i,
675
+ direction: o
676
+ }) => {
677
+ l || console.error("Validation: parentHtmlContainer prop is required!"), e && t && console.error("Validation: You should set staticList to false if you use appendToBody!"), s && Array.isArray(i) && console.error("Validation: if you use isSingleSelect prop, you should pass a single value!"), !s && !Array.isArray(i) && console.error("Validation: you should pass an array as a value!"), o && o !== "auto" && o !== "bottom" && o !== "top" && console.error("Validation: you should pass (auto | top | bottom | undefined) as a value for the direction prop!");
678
+ }, Ct = (l) => l.map((e) => e.id), yi = (l) => l ? Array.isArray(l) ? l : [l] : [], xi = (l, e) => {
679
+ if (e) {
680
+ const [t] = l;
681
+ return t;
682
+ }
683
+ return l;
684
+ };
685
+ var h, p, F, ee, q, x, S, L, V, te, Lt, j, re, Je, ys, Ze, xs, Qe, Ss, et, _s, tt, As, st, Ts, it, Ns, lt, Os, nt, Ps, ot, Bs, se, yt, at, Vs, $, ce, ie, xt, W, de, rt, Ds, le, St, ct, Is, dt, Hs, ht, Gs;
686
+ class _i {
687
+ constructor({
688
+ parentHtmlContainer: e,
689
+ value: t,
690
+ options: s,
691
+ openLevel: i,
692
+ appendToBody: o,
693
+ alwaysOpen: d,
694
+ showTags: u,
695
+ tagsCountText: f,
696
+ clearable: C,
697
+ searchable: b,
698
+ placeholder: g,
699
+ grouped: w,
700
+ isGroupedValue: k,
701
+ listSlotHtmlComponent: O,
702
+ disabled: P,
703
+ emptyText: R,
704
+ staticList: ne,
705
+ id: mt,
706
+ isSingleSelect: oe,
707
+ showCount: Ms,
708
+ disabledBranchNode: Fs,
709
+ direction: qs,
710
+ expandSelected: js,
711
+ saveScrollPosition: $s,
712
+ iconElements: Ws,
713
+ inputCallback: Rs,
714
+ openCallback: Us,
715
+ closeCallback: zs,
716
+ nameChangeCallback: Ys
717
+ }) {
718
+ r(this, te);
719
+ r(this, j);
720
+ r(this, Je);
721
+ r(this, Ze);
722
+ r(this, Qe);
723
+ r(this, et);
724
+ r(this, tt);
725
+ r(this, st);
726
+ r(this, it);
727
+ r(this, lt);
728
+ r(this, nt);
729
+ r(this, ot);
730
+ r(this, se);
731
+ r(this, at);
732
+ r(this, $);
733
+ r(this, ie);
734
+ r(this, W);
735
+ r(this, rt);
736
+ // Emits
737
+ r(this, le);
738
+ r(this, ct);
739
+ r(this, dt);
740
+ r(this, ht);
741
+ // Props
742
+ c(this, "parentHtmlContainer");
743
+ c(this, "value");
744
+ c(this, "options");
745
+ c(this, "openLevel");
746
+ c(this, "appendToBody");
747
+ c(this, "alwaysOpen");
748
+ c(this, "showTags");
749
+ c(this, "tagsCountText");
750
+ c(this, "clearable");
751
+ c(this, "searchable");
752
+ c(this, "placeholder");
753
+ c(this, "grouped");
754
+ c(this, "isGroupedValue");
755
+ c(this, "listSlotHtmlComponent");
756
+ c(this, "disabled");
757
+ c(this, "emptyText");
758
+ c(this, "staticList");
759
+ c(this, "id");
760
+ c(this, "isSingleSelect");
761
+ c(this, "showCount");
762
+ c(this, "disabledBranchNode");
763
+ c(this, "direction");
764
+ c(this, "expandSelected");
765
+ c(this, "saveScrollPosition");
766
+ c(this, "iconElements");
767
+ c(this, "inputCallback");
768
+ c(this, "openCallback");
769
+ c(this, "closeCallback");
770
+ c(this, "nameChangeCallback");
771
+ // InnerState
772
+ c(this, "ungroupedValue");
773
+ c(this, "groupedValue");
774
+ c(this, "isListOpened");
775
+ c(this, "selectedName");
776
+ c(this, "srcElement");
777
+ // Components
778
+ r(this, h, null);
779
+ r(this, p, null);
780
+ // Resize props
781
+ r(this, F, null);
782
+ // List position scroll
783
+ r(this, ee, 0);
784
+ // Timer for search text
785
+ r(this, q, 0);
786
+ // Outside listeners
787
+ r(this, x, null);
788
+ r(this, S, null);
789
+ r(this, L, null);
790
+ r(this, V, null);
791
+ Li({
792
+ parentHtmlContainer: e,
793
+ value: t,
794
+ staticList: ne,
795
+ appendToBody: o,
796
+ isSingleSelect: oe
797
+ }), this.parentHtmlContainer = e, this.value = [], this.options = s ?? [], this.openLevel = i ?? 0, this.appendToBody = o ?? !1, this.alwaysOpen = !!(d && !P), this.showTags = u ?? !0, this.tagsCountText = f ?? "elements selected", this.clearable = C ?? !0, this.searchable = b ?? !0, this.placeholder = g ?? "Search...", this.grouped = w ?? !0, this.isGroupedValue = k ?? !1, this.listSlotHtmlComponent = O ?? null, this.disabled = P ?? !1, this.emptyText = R ?? "No results found...", this.staticList = !!(ne && !this.appendToBody), this.id = mt ?? "", this.isSingleSelect = oe ?? !1, this.showCount = Ms ?? !1, this.disabledBranchNode = Fs ?? !1, this.direction = qs ?? "auto", this.expandSelected = js ?? !1, this.saveScrollPosition = $s ?? !0, this.iconElements = Js(Ws), this.inputCallback = Rs, this.openCallback = Us, this.closeCallback = zs, this.nameChangeCallback = Ys, this.ungroupedValue = [], this.groupedValue = [], this.isListOpened = !1, this.selectedName = "", this.srcElement = null, a(this, te, Lt).call(this, t);
798
+ }
799
+ mount() {
800
+ a(this, te, Lt).call(this, this.value);
801
+ }
802
+ updateValue(e) {
803
+ var s;
804
+ const t = n(this, h);
805
+ if (t) {
806
+ const i = yi(e);
807
+ t.updateValue(i);
808
+ const { groupedNodes: o, nodes: d } = t.selectedNodes, u = this.grouped || this.isSingleSelect ? o : d;
809
+ (s = n(this, p)) == null || s.updateValue(u), a(this, j, re).call(this, { groupedNodes: o, nodes: d });
810
+ }
811
+ }
812
+ destroy() {
813
+ this.srcElement && (a(this, se, yt).call(this), this.srcElement.innerHTML = "", this.srcElement = null, a(this, W, de).call(this, !0));
814
+ }
815
+ focus() {
816
+ n(this, p) && n(this, p).focus();
817
+ }
818
+ toggleOpenClose() {
819
+ n(this, p) && (n(this, p).openClose(), n(this, p).focus());
820
+ }
821
+ // Outside Listeners
822
+ scrollWindowHandler() {
823
+ this.updateListPosition();
824
+ }
825
+ focusWindowHandler(e) {
826
+ var s, i, o;
827
+ ((s = this.srcElement) == null ? void 0 : s.contains(e.target)) || ((i = n(this, h)) == null ? void 0 : i.srcElement.contains(e.target)) || ((o = n(this, p)) == null || o.blur(), a(this, W, de).call(this, !1), a(this, $, ce).call(this, !1));
828
+ }
829
+ blurWindowHandler() {
830
+ var e;
831
+ (e = n(this, p)) == null || e.blur(), a(this, W, de).call(this, !1), a(this, $, ce).call(this, !1);
832
+ }
833
+ // Update direction of the list. Support appendToBody and standard mode with absolute
834
+ updateListPosition() {
835
+ var O;
836
+ const e = this.srcElement, t = (O = n(this, h)) == null ? void 0 : O.srcElement;
837
+ if (!e || !t)
838
+ return;
839
+ const { height: s } = t.getBoundingClientRect(), {
840
+ x: i,
841
+ y: o,
842
+ height: d,
843
+ width: u
844
+ } = e.getBoundingClientRect(), f = window.innerHeight, C = o, b = f - o - d;
845
+ let g = C > b && C >= s && b < s;
846
+ if (this.direction !== "auto" && (g = this.direction === "top"), this.appendToBody) {
847
+ (t.style.top !== "0px" || t.style.left !== "0px") && (t.style.top = "0px", t.style.left = "0px");
848
+ const P = i + window.scrollX, R = g ? o + window.scrollY - s : o + window.scrollY + d;
849
+ t.style.transform = `translate(${P}px,${R}px)`, t.style.width = `${u}px`;
850
+ }
851
+ const w = g ? "top" : "bottom";
852
+ t.getAttribute("direction") !== w && (t.setAttribute("direction", w), a(this, at, Vs).call(this, g, this.appendToBody));
853
+ }
854
+ }
855
+ h = new WeakMap(), p = new WeakMap(), F = new WeakMap(), ee = new WeakMap(), q = new WeakMap(), x = new WeakMap(), S = new WeakMap(), L = new WeakMap(), V = new WeakMap(), te = new WeakSet(), Lt = function(e) {
856
+ var o;
857
+ this.destroy();
858
+ const { container: t, list: s, input: i } = a(this, Je, ys).call(this);
859
+ this.srcElement = t, m(this, h, s), m(this, p, i), m(this, x, this.scrollWindowHandler.bind(this)), m(this, S, this.scrollWindowHandler.bind(this)), m(this, L, this.focusWindowHandler.bind(this)), m(this, V, this.blurWindowHandler.bind(this)), this.alwaysOpen && ((o = n(this, p)) == null || o.openClose()), this.disabled ? this.srcElement.classList.add("treeselect--disabled") : this.srcElement.classList.remove("treeselect--disabled"), this.updateValue(e ?? this.value);
860
+ }, j = new WeakSet(), re = function({ groupedNodes: e, nodes: t }) {
861
+ this.ungroupedValue = t ? Ct(t) : [], this.groupedValue = e ? Ct(e) : [];
862
+ const s = this.isGroupedValue || this.isSingleSelect ? this.groupedValue : this.ungroupedValue;
863
+ this.value = xi(s, this.isSingleSelect);
864
+ }, Je = new WeakSet(), ys = function() {
865
+ const e = this.parentHtmlContainer;
866
+ e.classList.add("treeselect");
867
+ const t = new vi({
868
+ options: this.options,
869
+ value: this.ungroupedValue,
870
+ openLevel: this.openLevel,
871
+ listSlotHtmlComponent: this.listSlotHtmlComponent,
872
+ emptyText: this.emptyText,
873
+ isSingleSelect: this.isSingleSelect,
874
+ showCount: this.showCount,
875
+ disabledBranchNode: this.disabledBranchNode,
876
+ expandSelected: this.expandSelected,
877
+ iconElements: this.iconElements,
878
+ inputCallback: (d) => a(this, it, Ns).call(this, d),
879
+ arrowClickCallback: () => a(this, lt, Os).call(this),
880
+ mouseupCallback: () => {
881
+ var d;
882
+ return (d = n(this, p)) == null ? void 0 : d.focus();
883
+ }
884
+ }), { groupedNodes: s, nodes: i } = t.selectedNodes, o = new Qs({
885
+ value: this.grouped || this.isSingleSelect ? s : i,
886
+ showTags: this.showTags,
887
+ tagsCountText: this.tagsCountText,
888
+ clearable: this.clearable,
889
+ isAlwaysOpened: this.alwaysOpen,
890
+ searchable: this.searchable,
891
+ placeholder: this.placeholder,
892
+ disabled: this.disabled,
893
+ isSingleSelect: this.isSingleSelect,
894
+ id: this.id,
895
+ iconElements: this.iconElements,
896
+ inputCallback: (d) => a(this, Ze, xs).call(this, d),
897
+ searchCallback: (d) => a(this, et, _s).call(this, d),
898
+ openCallback: () => a(this, ot, Bs).call(this),
899
+ closeCallback: () => a(this, se, yt).call(this),
900
+ keydownCallback: (d) => a(this, Qe, Ss).call(this, d),
901
+ focusCallback: () => a(this, tt, As).call(this),
902
+ blurCallback: () => a(this, st, Ts).call(this),
903
+ nameChangeCallback: (d) => a(this, nt, Ps).call(this, d)
904
+ });
905
+ return this.appendToBody && m(this, F, new ResizeObserver(() => this.updateListPosition())), e.append(o.srcElement), { container: e, list: t, input: o };
906
+ }, Ze = new WeakSet(), xs = function(e) {
907
+ var o, d, u, f, C;
908
+ const t = Ct(e);
909
+ (o = n(this, h)) == null || o.updateValue(t);
910
+ const s = (u = (d = n(this, h)) == null ? void 0 : d.selectedNodes) == null ? void 0 : u.nodes, i = (C = (f = n(this, h)) == null ? void 0 : f.selectedNodes) == null ? void 0 : C.groupedNodes;
911
+ a(this, j, re).call(this, { groupedNodes: i, nodes: s }), a(this, le, St).call(this);
912
+ }, Qe = new WeakSet(), Ss = function(e) {
913
+ var t;
914
+ this.isListOpened && ((t = n(this, h)) == null || t.callKeyAction(e));
915
+ }, et = new WeakSet(), _s = function(e) {
916
+ n(this, q) && clearTimeout(n(this, q)), m(this, q, setTimeout(() => {
917
+ var t;
918
+ (t = n(this, h)) == null || t.updateSearchValue(e), this.updateListPosition();
919
+ }, 350));
920
+ }, tt = new WeakSet(), As = function() {
921
+ a(this, $, ce).call(this, !0), n(this, L) && n(this, L) && n(this, V) && (document.addEventListener("mousedown", n(this, L), !0), document.addEventListener("focus", n(this, L), !0), window.addEventListener("blur", n(this, V)));
922
+ }, st = new WeakSet(), Ts = function() {
923
+ setTimeout(() => {
924
+ var s, i;
925
+ const e = (s = n(this, p)) == null ? void 0 : s.srcElement.contains(document.activeElement), t = (i = n(this, h)) == null ? void 0 : i.srcElement.contains(document.activeElement);
926
+ !e && !t && this.blurWindowHandler();
927
+ }, 1);
928
+ }, it = new WeakSet(), Ns = function(e) {
929
+ var o, d, u, f;
930
+ const { groupedNodes: t, nodes: s } = e, i = this.grouped || this.isSingleSelect ? t : s;
931
+ (o = n(this, p)) == null || o.updateValue(i), a(this, j, re).call(this, { groupedNodes: t, nodes: s }), this.isSingleSelect && !this.alwaysOpen && ((d = n(this, p)) == null || d.openClose(), (u = n(this, p)) == null || u.clearSearch()), (f = n(this, p)) == null || f.focus(), a(this, le, St).call(this);
932
+ }, lt = new WeakSet(), Os = function() {
933
+ var e;
934
+ (e = n(this, p)) == null || e.focus(), this.updateListPosition();
935
+ }, nt = new WeakSet(), Ps = function(e) {
936
+ this.selectedName !== e && (this.selectedName = e, a(this, ct, Is).call(this));
937
+ }, ot = new WeakSet(), Bs = function() {
938
+ var e;
939
+ this.isListOpened = !0, n(this, x) && n(this, S) && (window.addEventListener("scroll", n(this, x), !0), window.addEventListener("resize", n(this, S))), !(!n(this, h) || !this.srcElement) && (this.appendToBody ? (document.body.appendChild(n(this, h).srcElement), (e = n(this, F)) == null || e.observe(this.srcElement)) : this.srcElement.appendChild(n(this, h).srcElement), this.updateListPosition(), a(this, ie, xt).call(this, !0), a(this, rt, Ds).call(this), a(this, dt, Hs).call(this));
940
+ }, se = new WeakSet(), yt = function() {
941
+ var t;
942
+ this.alwaysOpen || (this.isListOpened = !1, n(this, x) && n(this, S) && (window.removeEventListener("scroll", n(this, x), !0), window.removeEventListener("resize", n(this, S))), !n(this, h) || !this.srcElement) || !(this.appendToBody ? document.body.contains(n(this, h).srcElement) : this.srcElement.contains(n(this, h).srcElement)) || (m(this, ee, n(this, h).srcElement.scrollTop), this.appendToBody ? (document.body.removeChild(n(this, h).srcElement), (t = n(this, F)) == null || t.disconnect()) : this.srcElement.removeChild(n(this, h).srcElement), a(this, ie, xt).call(this, !1), a(this, ht, Gs).call(this));
943
+ }, at = new WeakSet(), Vs = function(e, t) {
944
+ if (!n(this, h) || !n(this, p))
945
+ return;
946
+ const s = t ? "treeselect-list--top-to-body" : "treeselect-list--top", i = t ? "treeselect-list--bottom-to-body" : "treeselect-list--bottom";
947
+ e ? (n(this, h).srcElement.classList.add(s), n(this, h).srcElement.classList.remove(i), n(this, p).srcElement.classList.add("treeselect-input--top"), n(this, p).srcElement.classList.remove("treeselect-input--bottom")) : (n(this, h).srcElement.classList.remove(s), n(this, h).srcElement.classList.add(i), n(this, p).srcElement.classList.remove("treeselect-input--top"), n(this, p).srcElement.classList.add("treeselect-input--bottom"));
948
+ }, $ = new WeakSet(), ce = function(e) {
949
+ !n(this, p) || !n(this, h) || (e ? (n(this, p).srcElement.classList.add("treeselect-input--focused"), n(this, h).srcElement.classList.add("treeselect-list--focused")) : (n(this, p).srcElement.classList.remove("treeselect-input--focused"), n(this, h).srcElement.classList.remove("treeselect-list--focused")));
950
+ }, ie = new WeakSet(), xt = function(e) {
951
+ var t, s, i, o;
952
+ e ? (t = n(this, p)) == null || t.srcElement.classList.add("treeselect-input--opened") : (s = n(this, p)) == null || s.srcElement.classList.remove("treeselect-input--opened"), this.staticList ? (i = n(this, h)) == null || i.srcElement.classList.add("treeselect-list--static") : (o = n(this, h)) == null || o.srcElement.classList.remove("treeselect-list--static");
953
+ }, W = new WeakSet(), de = function(e) {
954
+ !n(this, x) || !n(this, S) || !n(this, L) || !n(this, V) || ((!this.alwaysOpen || e) && (window.removeEventListener("scroll", n(this, x), !0), window.removeEventListener("resize", n(this, S))), document.removeEventListener("mousedown", n(this, L), !0), document.removeEventListener("focus", n(this, L), !0), window.removeEventListener("blur", n(this, V)));
955
+ }, rt = new WeakSet(), Ds = function() {
956
+ var t, s, i;
957
+ const e = (t = n(this, h)) == null ? void 0 : t.isLastFocusedElementExist();
958
+ this.saveScrollPosition && e ? (s = n(this, h)) == null || s.srcElement.scroll(0, n(this, ee)) : (i = n(this, h)) == null || i.focusFirstListElement();
959
+ }, le = new WeakSet(), St = function() {
960
+ var e;
961
+ (e = this.srcElement) == null || e.dispatchEvent(new CustomEvent("input", { detail: this.value })), this.inputCallback && this.inputCallback(this.value);
962
+ }, ct = new WeakSet(), Is = function() {
963
+ var e;
964
+ (e = this.srcElement) == null || e.dispatchEvent(new CustomEvent("name-change", { detail: this.selectedName })), this.nameChangeCallback && this.nameChangeCallback(this.selectedName);
965
+ }, dt = new WeakSet(), Hs = function() {
966
+ var e;
967
+ this.alwaysOpen || ((e = this.srcElement) == null || e.dispatchEvent(new CustomEvent("open", { detail: this.value })), this.openCallback && this.openCallback(this.value));
968
+ }, ht = new WeakSet(), Gs = function() {
969
+ var e;
970
+ this.alwaysOpen || ((e = this.srcElement) == null || e.dispatchEvent(new CustomEvent("close", { detail: this.value })), this.closeCallback && this.closeCallback(this.value));
971
+ };
972
+ export {
973
+ _i as default
974
+ };