@web-utils/component 2.9.2 → 2.9.3

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.
@@ -0,0 +1,2883 @@
1
+ var ke = Object.defineProperty, He = Object.defineProperties;
2
+ var Pe = Object.getOwnPropertyDescriptors;
3
+ var G = Object.getOwnPropertySymbols;
4
+ var We = Object.prototype.hasOwnProperty, je = Object.prototype.propertyIsEnumerable;
5
+ var J = (e, t, s) => t in e ? ke(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, _ = (e, t) => {
6
+ for (var s in t || (t = {}))
7
+ We.call(t, s) && J(e, s, t[s]);
8
+ if (G)
9
+ for (var s of G(t))
10
+ je.call(t, s) && J(e, s, t[s]);
11
+ return e;
12
+ }, b = (e, t) => He(e, Pe(t));
13
+ import Qe from "lodash/noop";
14
+ import Ke from "lodash/debounce";
15
+ import { isPromise as ye } from "@web-utils/core";
16
+ import qe from "lodash/once";
17
+ import Ue from "lodash/identity";
18
+ import Z from "lodash/constant";
19
+ import ee from "lodash/last";
20
+ import { n as f } from "../chunks/vueComponentNormalizer.446f5dc4.mjs";
21
+ import Ye from "vue";
22
+ const S = process.env.NODE_ENV === "production" ? (
23
+ /* istanbul ignore next */
24
+ Qe
25
+ ) : function(t, s) {
26
+ if (!t()) {
27
+ const n = ["[Vue-TreeSelect Warning]"].concat(s());
28
+ console.error(...n);
29
+ }
30
+ };
31
+ function N(e) {
32
+ return function(s, ...n) {
33
+ s.type === "mousedown" && s.button === 0 && e.call(this, s, ...n);
34
+ };
35
+ }
36
+ function Xe(e, t) {
37
+ const s = e.getBoundingClientRect(), n = t.getBoundingClientRect(), i = t.offsetHeight / 3;
38
+ n.bottom + i > s.bottom ? e.scrollTop = Math.min(
39
+ t.offsetTop + t.clientHeight - e.offsetHeight + i,
40
+ e.scrollHeight
41
+ ) : n.top - i < s.top && (e.scrollTop = Math.max(t.offsetTop - i, 0));
42
+ }
43
+ function Ee(e, t) {
44
+ const s = e.indexOf(t);
45
+ s !== -1 && e.splice(s, 1);
46
+ }
47
+ let K;
48
+ const T = [], Ge = 100;
49
+ function Je() {
50
+ K = setInterval(() => {
51
+ T.forEach(Ne);
52
+ }, Ge);
53
+ }
54
+ function Ze() {
55
+ clearInterval(K), K = null;
56
+ }
57
+ function Ne(e) {
58
+ const { $el: t, listener: s, lastWidth: n, lastHeight: i } = e, o = t.offsetWidth, r = t.offsetHeight;
59
+ (n !== o || i !== r) && (e.lastWidth = o, e.lastHeight = r, s({ width: o, height: r }));
60
+ }
61
+ function et(e, t) {
62
+ const s = {
63
+ $el: e,
64
+ listener: t,
65
+ lastWidth: null,
66
+ lastHeight: null
67
+ }, n = () => {
68
+ Ee(T, s), T.length || Ze();
69
+ };
70
+ return T.push(s), Ne(s), Je(), n;
71
+ }
72
+ function tt(e, t) {
73
+ const s = document.createElement("_"), n = s.appendChild(document.createElement("_")), i = s.appendChild(document.createElement("_")), o = n.appendChild(document.createElement("_"));
74
+ let r, c;
75
+ return n.style.cssText = s.style.cssText = "height:100%;left:0;opacity:0;overflow:hidden;pointer-events:none;position:absolute;top:0;transition:0s;width:100%;z-index:-1", o.style.cssText = i.style.cssText = "display:block;height:100%;transition:0s;width:100%", o.style.width = o.style.height = "200%", e.appendChild(s), d(), m;
76
+ function d() {
77
+ a();
78
+ const p = e.offsetWidth, y = e.offsetHeight;
79
+ (p !== r || y !== c) && (r = p, c = y, i.style.width = p * 2 + "px", i.style.height = y * 2 + "px", s.scrollLeft = s.scrollWidth, s.scrollTop = s.scrollHeight, n.scrollLeft = n.scrollWidth, n.scrollTop = n.scrollHeight, t({ width: p, height: y })), n.addEventListener("scroll", d), s.addEventListener("scroll", d);
80
+ }
81
+ function a() {
82
+ n.removeEventListener("scroll", d), s.removeEventListener("scroll", d);
83
+ }
84
+ function m() {
85
+ a(), e.removeChild(s);
86
+ }
87
+ }
88
+ function be(e, t) {
89
+ const s = document.documentMode === 9;
90
+ let n = !0;
91
+ const r = (s ? et : tt)(e, (...c) => n || t(...c));
92
+ return n = !1, r;
93
+ }
94
+ function st(e) {
95
+ const t = [];
96
+ let s = e.parentNode;
97
+ for (; s && s.nodeName !== "BODY" && s.nodeType === document.ELEMENT_NODE; )
98
+ nt(s) && t.push(s), s = s.parentNode;
99
+ return t.push(window), t;
100
+ }
101
+ function nt(e) {
102
+ const { overflow: t, overflowX: s, overflowY: n } = getComputedStyle(e);
103
+ return /(auto|scroll|overlay)/.test(t + n + s);
104
+ }
105
+ function $e(e, t) {
106
+ const s = st(e);
107
+ return window.addEventListener("resize", t, { passive: !0 }), s.forEach((n) => {
108
+ n.addEventListener("scroll", t, { passive: !0 });
109
+ }), function() {
110
+ window.removeEventListener("resize", t, { passive: !0 }), s.forEach((i) => {
111
+ i.removeEventListener("scroll", t, { passive: !0 });
112
+ });
113
+ };
114
+ }
115
+ function we(e) {
116
+ return e !== e;
117
+ }
118
+ const g = () => /* @__PURE__ */ Object.create(null);
119
+ function Ce(e) {
120
+ return e == null || typeof e != "object" ? !1 : Object.getPrototypeOf(e) === Object.prototype;
121
+ }
122
+ function it(e, t, s) {
123
+ Ce(s) ? (e[t] || (e[t] = {}), q(e[t], s)) : e[t] = s;
124
+ }
125
+ function q(e, t) {
126
+ if (Ce(t)) {
127
+ const s = Object.keys(t);
128
+ for (let n = 0, i = s.length; n < i; n++)
129
+ it(e, s[n], t[s[n]]);
130
+ }
131
+ return e;
132
+ }
133
+ function O(e, t) {
134
+ return e.indexOf(t) !== -1;
135
+ }
136
+ function Le(e, t, s) {
137
+ for (let n = 0, i = e.length; n < i; n++)
138
+ if (t.call(s, e[n], n, e))
139
+ return e[n];
140
+ }
141
+ function V(e, t) {
142
+ if (e.length !== t.length)
143
+ return !0;
144
+ for (let s = 0; s < e.length; s++)
145
+ if (e[s] !== t[s])
146
+ return !0;
147
+ return !1;
148
+ }
149
+ function rt(e, t) {
150
+ const s = t.length, n = e.length;
151
+ if (n > s)
152
+ return !1;
153
+ if (n === s)
154
+ return e === t;
155
+ e:
156
+ for (let i = 0, o = 0; i < n; i++) {
157
+ const r = e.charCodeAt(i);
158
+ for (; o < s; )
159
+ if (t.charCodeAt(o++) === r)
160
+ continue e;
161
+ return !1;
162
+ }
163
+ return !0;
164
+ }
165
+ const E = null, U = 0, Me = 1, xe = 2, $ = "ALL_CHILDREN", w = "ALL_DESCENDANTS", C = "LEAF_CHILDREN", L = "LEAF_DESCENDANTS", ot = "LOAD_ROOT_OPTIONS", lt = "LOAD_CHILDREN_OPTIONS", at = "ASYNC_SEARCH", B = "ALL", x = "BRANCH_PRIORITY", z = "LEAF_PRIORITY", F = "ALL_WITH_INDETERMINATE", te = "ORDER_SELECTED", se = "LEVEL", ne = "INDEX", h = {
166
+ BACKSPACE: 8,
167
+ ENTER: 13,
168
+ ESCAPE: 27,
169
+ END: 35,
170
+ HOME: 36,
171
+ ARROW_LEFT: 37,
172
+ ARROW_UP: 38,
173
+ ARROW_RIGHT: 39,
174
+ ARROW_DOWN: 40,
175
+ DELETE: 46
176
+ }, ct = process.env.NODE_ENV === "testing" ? (
177
+ /* to speed up unit testing */
178
+ 10
179
+ ) : (
180
+ /* istanbul ignore next */
181
+ 200
182
+ ), ie = 5, re = 40;
183
+ function Te(e, t) {
184
+ let s = 0;
185
+ do {
186
+ if (e.level < s)
187
+ return -1;
188
+ if (t.level < s)
189
+ return 1;
190
+ if (e.index[s] !== t.index[s])
191
+ return e.index[s] - t.index[s];
192
+ s++;
193
+ } while (!0);
194
+ }
195
+ function ut(e, t) {
196
+ return e.level === t.level ? Te(e, t) : e.level - t.level;
197
+ }
198
+ function k() {
199
+ return {
200
+ isLoaded: !1,
201
+ isLoading: !1,
202
+ loadingError: ""
203
+ };
204
+ }
205
+ function ht(e) {
206
+ return typeof e == "string" ? e : typeof e == "number" && !we(e) ? `${e}` : "";
207
+ }
208
+ function oe(e, t, s) {
209
+ return e ? rt(t, s) : O(s, t);
210
+ }
211
+ function H(e) {
212
+ return e.message || /* istanbul ignore next */
213
+ String(e);
214
+ }
215
+ let dt = 0;
216
+ const pt = {
217
+ provide() {
218
+ return {
219
+ // Enable access to the instance of root component of vue-treeselect
220
+ // across hierarchy.
221
+ instance: this
222
+ };
223
+ },
224
+ props: {
225
+ /**
226
+ * Whether to allow resetting value even if there are disabled selected nodes.
227
+ */
228
+ allowClearingDisabled: {
229
+ type: Boolean,
230
+ default: !1
231
+ },
232
+ /**
233
+ * When an ancestor node is selected/deselected, whether its disabled descendants should be selected/deselected.
234
+ * You may want to use this in conjunction with `allowClearingDisabled` prop.
235
+ */
236
+ allowSelectingDisabledDescendants: {
237
+ type: Boolean,
238
+ default: !1
239
+ },
240
+ /**
241
+ * Whether the menu should be always open.
242
+ */
243
+ alwaysOpen: {
244
+ type: Boolean,
245
+ default: !1
246
+ },
247
+ /**
248
+ * Append the menu to <body />?
249
+ */
250
+ appendToBody: {
251
+ type: Boolean,
252
+ default: !1
253
+ },
254
+ /**
255
+ * Whether to enable async search mode.
256
+ */
257
+ async: {
258
+ type: Boolean,
259
+ default: !1
260
+ },
261
+ /**
262
+ * Automatically focus the component on mount?
263
+ */
264
+ autoFocus: {
265
+ type: Boolean,
266
+ default: !1
267
+ },
268
+ /**
269
+ * Automatically load root options on mount. When set to `false`, root options will be loaded when the menu is opened.
270
+ */
271
+ autoLoadRootOptions: {
272
+ type: Boolean,
273
+ default: !0
274
+ },
275
+ /**
276
+ * When user deselects a node, automatically deselect its ancestors. Applies to flat mode only.
277
+ */
278
+ autoDeselectAncestors: {
279
+ type: Boolean,
280
+ default: !1
281
+ },
282
+ /**
283
+ * When user deselects a node, automatically deselect its descendants. Applies to flat mode only.
284
+ */
285
+ autoDeselectDescendants: {
286
+ type: Boolean,
287
+ default: !1
288
+ },
289
+ /**
290
+ * When user selects a node, automatically select its ancestors. Applies to flat mode only.
291
+ */
292
+ autoSelectAncestors: {
293
+ type: Boolean,
294
+ default: !1
295
+ },
296
+ /**
297
+ * When user selects a node, automatically select its descendants. Applies to flat mode only.
298
+ */
299
+ autoSelectDescendants: {
300
+ type: Boolean,
301
+ default: !1
302
+ },
303
+ /**
304
+ * Whether pressing backspace key removes the last item if there is no text input.
305
+ */
306
+ backspaceRemoves: {
307
+ type: Boolean,
308
+ default: !0
309
+ },
310
+ /**
311
+ * Function that processes before clearing all input fields.
312
+ * Return `false` to prevent value from being cleared.
313
+ * @type {function(): (boolean|Promise<boolean>)}
314
+ */
315
+ beforeClearAll: {
316
+ type: Function,
317
+ default: Z(!0)
318
+ },
319
+ /**
320
+ * Show branch nodes before leaf nodes?
321
+ */
322
+ branchNodesFirst: {
323
+ type: Boolean,
324
+ default: !1
325
+ },
326
+ /**
327
+ * Should cache results of every search request?
328
+ */
329
+ cacheOptions: {
330
+ type: Boolean,
331
+ default: !0
332
+ },
333
+ /**
334
+ * Show an "×" button that resets value?
335
+ */
336
+ clearable: {
337
+ type: Boolean,
338
+ default: !0
339
+ },
340
+ /**
341
+ * Title for the "×" button when `multiple: true`.
342
+ */
343
+ clearAllText: {
344
+ type: String,
345
+ default: "Clear all"
346
+ },
347
+ /**
348
+ * Whether to clear the search input after selecting.
349
+ * Use only when `multiple` is `true`.
350
+ * For single-select mode, it **always** clears the input after selecting an option regardless of the prop value.
351
+ */
352
+ clearOnSelect: {
353
+ type: Boolean,
354
+ default: !1
355
+ },
356
+ /**
357
+ * Title for the "×" button.
358
+ */
359
+ clearValueText: {
360
+ type: String,
361
+ default: "Clear value"
362
+ },
363
+ /**
364
+ * Whether to close the menu after selecting an option?
365
+ * Use only when `multiple` is `true`.
366
+ */
367
+ closeOnSelect: {
368
+ type: Boolean,
369
+ default: !0
370
+ },
371
+ /**
372
+ * How many levels of branch nodes should be automatically expanded when loaded.
373
+ * Set `Infinity` to make all branch nodes expanded by default.
374
+ */
375
+ defaultExpandLevel: {
376
+ type: Number,
377
+ default: 0
378
+ },
379
+ /**
380
+ * The default set of options to show before the user starts searching. Used for async search mode.
381
+ * When set to `true`, the results for search query as a empty string will be autoloaded.
382
+ * @type {boolean|node[]}
383
+ */
384
+ defaultOptions: {
385
+ default: !1
386
+ },
387
+ /**
388
+ * Whether pressing delete key removes the last item if there is no text input.
389
+ */
390
+ deleteRemoves: {
391
+ type: Boolean,
392
+ default: !0
393
+ },
394
+ /**
395
+ * Delimiter to use to join multiple values for the hidden field value.
396
+ */
397
+ delimiter: {
398
+ type: String,
399
+ default: ","
400
+ },
401
+ /**
402
+ * Only show the nodes that match the search value directly, excluding its ancestors.
403
+ *
404
+ * @type {Object}
405
+ */
406
+ flattenSearchResults: {
407
+ type: Boolean,
408
+ default: !1
409
+ },
410
+ /**
411
+ * Prevent branch nodes from being selected?
412
+ */
413
+ disableBranchNodes: {
414
+ type: Boolean,
415
+ default: !1
416
+ },
417
+ /**
418
+ * Disable the control?
419
+ */
420
+ disabled: {
421
+ type: Boolean,
422
+ default: !1
423
+ },
424
+ /**
425
+ * Disable the fuzzy matching functionality?
426
+ */
427
+ disableFuzzyMatching: {
428
+ type: Boolean,
429
+ default: !1
430
+ },
431
+ /**
432
+ * Whether to enable flat mode or not. Non-flat mode (default) means:
433
+ * - Whenever a branch node gets checked, all its children will be checked too
434
+ * - Whenever a branch node has all children checked, the branch node itself will be checked too
435
+ * Set `true` to disable this mechanism
436
+ */
437
+ flat: {
438
+ type: Boolean,
439
+ default: !1
440
+ },
441
+ /**
442
+ * Will be passed with all events as the last param.
443
+ * Useful for identifying events origin.
444
+ */
445
+ instanceId: {
446
+ // Add two trailing "$" to distinguish from explictly specified ids.
447
+ default: () => `${dt++}$$`,
448
+ type: [String, Number]
449
+ },
450
+ /**
451
+ * Joins multiple values into a single form field with the `delimiter` (legacy mode).
452
+ */
453
+ joinValues: {
454
+ type: Boolean,
455
+ default: !1
456
+ },
457
+ /**
458
+ * Limit the display of selected options.
459
+ * The rest will be hidden within the limitText string.
460
+ */
461
+ limit: {
462
+ type: Number,
463
+ default: 1 / 0
464
+ },
465
+ /**
466
+ * Function that processes the message shown when selected elements pass the defined limit.
467
+ * @type {function(number): string}
468
+ */
469
+ limitText: {
470
+ type: Function,
471
+ default: function(t) {
472
+ return `and ${t} more`;
473
+ }
474
+ },
475
+ /**
476
+ * Text displayed when loading options.
477
+ */
478
+ loadingText: {
479
+ type: String,
480
+ default: "Loading..."
481
+ },
482
+ /**
483
+ * Used for dynamically loading options.
484
+ * @type {function({action: string, callback: (function((Error|string)=): void), parentNode: node=, instanceId}): void}
485
+ */
486
+ loadOptions: {
487
+ type: Function
488
+ },
489
+ /**
490
+ * Which node properties to filter on.
491
+ */
492
+ matchKeys: {
493
+ type: Array,
494
+ default: Z(["label"])
495
+ },
496
+ /**
497
+ * Sets `maxHeight` style value of the menu.
498
+ */
499
+ maxHeight: {
500
+ type: Number,
501
+ default: 300
502
+ },
503
+ /**
504
+ * Set `true` to allow selecting multiple options (a.k.a., multi-select mode).
505
+ */
506
+ multiple: {
507
+ type: Boolean,
508
+ default: !1
509
+ },
510
+ /**
511
+ * Generates a hidden <input /> tag with this field name for html forms.
512
+ */
513
+ name: {
514
+ type: String
515
+ },
516
+ /**
517
+ * Text displayed when a branch node has no children.
518
+ */
519
+ noChildrenText: {
520
+ type: String,
521
+ default: "No sub-options."
522
+ },
523
+ /**
524
+ * Text displayed when there are no available options.
525
+ */
526
+ noOptionsText: {
527
+ type: String,
528
+ default: "No options available."
529
+ },
530
+ /**
531
+ * Text displayed when there are no matching search results.
532
+ */
533
+ noResultsText: {
534
+ type: String,
535
+ default: "No results found..."
536
+ },
537
+ /**
538
+ * Used for normalizing source data.
539
+ * @type {function(node, instanceId): node}
540
+ */
541
+ normalizer: {
542
+ type: Function,
543
+ default: Ue
544
+ },
545
+ /**
546
+ * By default (`auto`), the menu will open below the control. If there is not
547
+ * enough space, vue-treeselect will automatically flip the menu.
548
+ * You can use one of other four options to force the menu to be always opened
549
+ * to specified direction.
550
+ * Acceptable values:
551
+ * - `"auto"`
552
+ * - `"below"`
553
+ * - `"bottom"`
554
+ * - `"above"`
555
+ * - `"top"`
556
+ */
557
+ openDirection: {
558
+ type: String,
559
+ default: "auto",
560
+ validator(e) {
561
+ return O(["auto", "top", "bottom", "above", "below"], e);
562
+ }
563
+ },
564
+ /**
565
+ * Whether to automatically open the menu when the control is clicked.
566
+ */
567
+ openOnClick: {
568
+ type: Boolean,
569
+ default: !0
570
+ },
571
+ /**
572
+ * Whether to automatically open the menu when the control is focused.
573
+ */
574
+ openOnFocus: {
575
+ type: Boolean,
576
+ default: !1
577
+ },
578
+ /**
579
+ * Array of available options.
580
+ * @type {node[]}
581
+ */
582
+ options: {
583
+ type: Array
584
+ },
585
+ /**
586
+ * Field placeholder, displayed when there's no value.
587
+ */
588
+ placeholder: {
589
+ type: String,
590
+ default: "Select..."
591
+ },
592
+ /**
593
+ * Applies HTML5 required attribute when needed.
594
+ */
595
+ required: {
596
+ type: Boolean,
597
+ default: !1
598
+ },
599
+ /**
600
+ * Text displayed asking user whether to retry loading children options.
601
+ */
602
+ retryText: {
603
+ type: String,
604
+ default: "Retry?"
605
+ },
606
+ /**
607
+ * Title for the retry button.
608
+ */
609
+ retryTitle: {
610
+ type: String,
611
+ default: "Click to retry"
612
+ },
613
+ /**
614
+ * Enable searching feature?
615
+ */
616
+ searchable: {
617
+ type: Boolean,
618
+ default: !0
619
+ },
620
+ /**
621
+ * Search in ancestor nodes too.
622
+ */
623
+ searchNested: {
624
+ type: Boolean,
625
+ default: !1
626
+ },
627
+ /**
628
+ * Text tip to prompt for async search.
629
+ */
630
+ searchPromptText: {
631
+ type: String,
632
+ default: "Type to search..."
633
+ },
634
+ /**
635
+ * Whether to show a children count next to the label of each branch node.
636
+ */
637
+ showCount: {
638
+ type: Boolean,
639
+ default: !1
640
+ },
641
+ /**
642
+ * Used in conjunction with `showCount` to specify which type of count number should be displayed.
643
+ * Acceptable values:
644
+ * - "ALL_CHILDREN"
645
+ * - "ALL_DESCENDANTS"
646
+ * - "LEAF_CHILDREN"
647
+ * - "LEAF_DESCENDANTS"
648
+ */
649
+ showCountOf: {
650
+ type: String,
651
+ default: $,
652
+ validator(e) {
653
+ return O([$, w, C, L], e);
654
+ }
655
+ },
656
+ /**
657
+ * Whether to show children count when searching.
658
+ * Fallbacks to the value of `showCount` when not specified.
659
+ * @type {boolean}
660
+ */
661
+ showCountOnSearch: null,
662
+ /**
663
+ * In which order the selected options should be displayed in trigger & sorted in `value` array.
664
+ * Used for multi-select mode only.
665
+ * Acceptable values:
666
+ * - "ORDER_SELECTED"
667
+ * - "LEVEL"
668
+ * - "INDEX"
669
+ */
670
+ sortValueBy: {
671
+ type: String,
672
+ default: te,
673
+ validator(e) {
674
+ return O([te, se, ne], e);
675
+ }
676
+ },
677
+ /**
678
+ * Tab index of the control.
679
+ */
680
+ tabIndex: {
681
+ type: Number,
682
+ default: 0
683
+ },
684
+ /**
685
+ * The value of the control.
686
+ * Should be `id` or `node` object for single-select mode, or an array of `id` or `node` object for multi-select mode.
687
+ * Its format depends on the `valueFormat` prop.
688
+ * For most cases, just use `v-model` instead.
689
+ * @type {?Array}
690
+ */
691
+ value: null,
692
+ /**
693
+ * Which kind of nodes should be included in the `value` array in multi-select mode.
694
+ * Acceptable values:
695
+ * - "ALL" - Any node that is checked will be included in the `value` array
696
+ * - "BRANCH_PRIORITY" (default) - If a branch node is checked, all its descendants will be excluded in the `value` array
697
+ * - "LEAF_PRIORITY" - If a branch node is checked, this node itself and its branch descendants will be excluded from the `value` array but its leaf descendants will be included
698
+ * - "ALL_WITH_INDETERMINATE" - Any node that is checked will be included in the `value` array, plus indeterminate nodes
699
+ */
700
+ valueConsistsOf: {
701
+ type: String,
702
+ default: x,
703
+ validator(e) {
704
+ return O([B, x, z, F], e);
705
+ }
706
+ },
707
+ /**
708
+ * Format of `value` prop.
709
+ * Note that, when set to `"object"`, only `id` & `label` properties are required in each `node` object in `value` prop.
710
+ * Acceptable values:
711
+ * - "id"
712
+ * - "object"
713
+ */
714
+ valueFormat: {
715
+ type: String,
716
+ default: "id"
717
+ },
718
+ /**
719
+ * z-index of the menu.
720
+ */
721
+ zIndex: {
722
+ type: [Number, String],
723
+ default: 999
724
+ }
725
+ },
726
+ data() {
727
+ return {
728
+ trigger: {
729
+ // Is the control focused?
730
+ isFocused: !1,
731
+ // User entered search query - value of the input.
732
+ searchQuery: ""
733
+ },
734
+ menu: {
735
+ // Is the menu opened?
736
+ isOpen: !1,
737
+ // Id of current highlighted option.
738
+ current: null,
739
+ // The scroll position before last menu closing.
740
+ lastScrollPosition: 0,
741
+ // Which direction to open the menu.
742
+ placement: "bottom"
743
+ },
744
+ forest: {
745
+ // Normalized options.
746
+ normalizedOptions: [],
747
+ // <id, node> map for quick look-up.
748
+ nodeMap: g(),
749
+ // <id, checkedState> map, used for multi-select mode.
750
+ checkedStateMap: g(),
751
+ // Id list of all selected options.
752
+ selectedNodeIds: this.extractCheckedNodeIdsFromValue(),
753
+ // <id, true> map for fast checking:
754
+ // if (forest.selectedNodeIds.indexOf(id) !== -1) forest.selectedNodeMap[id] === true
755
+ selectedNodeMap: g()
756
+ },
757
+ // States of root options.
758
+ rootOptionsStates: k(),
759
+ localSearch: {
760
+ // Has user entered any query to search local options?
761
+ active: !1,
762
+ // Has any options matched the search query?
763
+ noResults: !0,
764
+ // <id, countObject> map for counting matched children/descendants.
765
+ countMap: g()
766
+ },
767
+ // <searchQuery, remoteSearchEntry> map.
768
+ remoteSearch: g()
769
+ };
770
+ },
771
+ computed: {
772
+ /* eslint-disable valid-jsdoc */
773
+ /**
774
+ * Normalized nodes that have been selected.
775
+ * @type {node[]}
776
+ */
777
+ selectedNodes() {
778
+ return this.forest.selectedNodeIds.map(this.getNode);
779
+ },
780
+ /**
781
+ * Id list of selected nodes with `sortValueBy` prop applied.
782
+ * @type {nodeId[]}
783
+ */
784
+ internalValue() {
785
+ let e;
786
+ if (this.single || this.flat || this.disableBranchNodes || this.valueConsistsOf === B)
787
+ e = this.forest.selectedNodeIds.slice();
788
+ else if (this.valueConsistsOf === x)
789
+ e = this.forest.selectedNodeIds.filter((t) => {
790
+ const s = this.getNode(t);
791
+ return s.isRootNode ? !0 : !this.isSelected(s.parentNode);
792
+ });
793
+ else if (this.valueConsistsOf === z)
794
+ e = this.forest.selectedNodeIds.filter((t) => {
795
+ const s = this.getNode(t);
796
+ return s.isLeaf ? !0 : s.children.length === 0;
797
+ });
798
+ else if (this.valueConsistsOf === F) {
799
+ const t = [];
800
+ e = this.forest.selectedNodeIds.slice(), this.selectedNodes.forEach((s) => {
801
+ s.ancestors.forEach((n) => {
802
+ O(t, n.id) || O(e, n.id) || t.push(n.id);
803
+ });
804
+ }), e.push(...t);
805
+ }
806
+ return this.sortValueBy === se ? e.sort((t, s) => ut(this.getNode(t), this.getNode(s))) : this.sortValueBy === ne && e.sort((t, s) => Te(this.getNode(t), this.getNode(s))), e;
807
+ },
808
+ /**
809
+ * Has any option been selected?
810
+ * @type {boolean}
811
+ */
812
+ hasValue() {
813
+ return this.internalValue.length > 0;
814
+ },
815
+ /**
816
+ * Single-select mode?
817
+ * @type {boolean}
818
+ */
819
+ single() {
820
+ return !this.multiple;
821
+ },
822
+ /**
823
+ * Id list of nodes displayed in the menu. Nodes that are considered NOT visible:
824
+ * - descendants of a collapsed branch node
825
+ * - in local search mode, nodes that are not matched, unless
826
+ * - it's a branch node and has matched descendants
827
+ * - it's a leaf node and its parent node is explicitly set to show all children
828
+ * @type {id[]}
829
+ */
830
+ visibleOptionIds() {
831
+ const e = [];
832
+ return this.traverseAllNodesByIndex((t) => {
833
+ if ((!this.localSearch.active || this.shouldOptionBeIncludedInSearchResult(t)) && e.push(t.id), t.isBranch && !this.shouldExpand(t))
834
+ return !1;
835
+ }), e;
836
+ },
837
+ /**
838
+ * Has any option should be displayed in the menu?
839
+ * @type {boolean}
840
+ */
841
+ hasVisibleOptions() {
842
+ return this.visibleOptionIds.length !== 0;
843
+ },
844
+ /**
845
+ * Should show children count when searching?
846
+ * @type {boolean}
847
+ */
848
+ showCountOnSearchComputed() {
849
+ return typeof this.showCountOnSearch == "boolean" ? this.showCountOnSearch : this.showCount;
850
+ },
851
+ /**
852
+ * Is there any branch node?
853
+ * @type {boolean}
854
+ */
855
+ hasBranchNodes() {
856
+ return this.forest.normalizedOptions.some((e) => e.isBranch);
857
+ },
858
+ shouldFlattenOptions() {
859
+ return this.localSearch.active && this.flattenSearchResults;
860
+ }
861
+ /* eslint-enable valid-jsdoc */
862
+ },
863
+ watch: {
864
+ alwaysOpen(e) {
865
+ e ? this.openMenu() : this.closeMenu();
866
+ },
867
+ branchNodesFirst() {
868
+ this.initialize();
869
+ },
870
+ disabled(e) {
871
+ e && this.menu.isOpen ? this.closeMenu() : !e && !this.menu.isOpen && this.alwaysOpen && this.openMenu();
872
+ },
873
+ flat() {
874
+ this.initialize();
875
+ },
876
+ internalValue(e, t) {
877
+ V(e, t) && this.$emit("input", this.getValue(), this.getInstanceId());
878
+ },
879
+ matchKeys() {
880
+ this.initialize();
881
+ },
882
+ multiple(e) {
883
+ e && this.buildForestState();
884
+ },
885
+ options: {
886
+ handler() {
887
+ this.async || (this.initialize(), this.rootOptionsStates.isLoaded = Array.isArray(this.options));
888
+ },
889
+ deep: !0,
890
+ immediate: !0
891
+ },
892
+ "trigger.searchQuery"() {
893
+ this.async ? this.handleRemoteSearch() : this.handleLocalSearch(), this.$emit("search-change", this.trigger.searchQuery, this.getInstanceId());
894
+ },
895
+ value() {
896
+ const e = this.extractCheckedNodeIdsFromValue();
897
+ V(e, this.internalValue) && this.fixSelectedNodeIds(e);
898
+ }
899
+ },
900
+ methods: {
901
+ verifyProps() {
902
+ S(
903
+ () => this.async ? this.searchable : !0,
904
+ () => 'For async search mode, the value of "searchable" prop must be true.'
905
+ ), this.options == null && !this.loadOptions && S(
906
+ () => !1,
907
+ () => 'Are you meant to dynamically load options? You need to use "loadOptions" prop.'
908
+ ), this.flat && S(
909
+ () => this.multiple,
910
+ () => 'You are using flat mode. But you forgot to add "multiple=true"?'
911
+ ), this.flat || [
912
+ "autoSelectAncestors",
913
+ "autoSelectDescendants",
914
+ "autoDeselectAncestors",
915
+ "autoDeselectDescendants"
916
+ ].forEach((t) => {
917
+ S(
918
+ () => !this[t],
919
+ () => `"${t}" only applies to flat mode.`
920
+ );
921
+ });
922
+ },
923
+ resetFlags() {
924
+ this._blurOnSelect = !1;
925
+ },
926
+ initialize() {
927
+ const e = this.async ? this.getRemoteSearchEntry().options : this.options;
928
+ if (Array.isArray(e)) {
929
+ const t = this.forest.nodeMap;
930
+ this.forest.nodeMap = g(), this.keepDataOfSelectedNodes(t), this.forest.normalizedOptions = this.normalize(E, e, t), this.fixSelectedNodeIds(this.internalValue);
931
+ } else
932
+ this.forest.normalizedOptions = [];
933
+ },
934
+ getInstanceId() {
935
+ return this.instanceId == null ? this.id : this.instanceId;
936
+ },
937
+ getValue() {
938
+ if (this.valueFormat === "id")
939
+ return this.multiple ? this.internalValue.slice() : this.internalValue[0];
940
+ const e = this.internalValue.map((t) => this.getNode(t).raw);
941
+ return this.multiple ? e : e[0];
942
+ },
943
+ getNode(e) {
944
+ return S(
945
+ () => e != null,
946
+ () => `Invalid node id: ${e}`
947
+ ), e == null ? null : e in this.forest.nodeMap ? this.forest.nodeMap[e] : this.createFallbackNode(e);
948
+ },
949
+ createFallbackNode(e) {
950
+ const t = this.extractNodeFromValue(e), s = this.enhancedNormalizer(t).label || `${e} (unknown)`, n = {
951
+ id: e,
952
+ label: s,
953
+ ancestors: [],
954
+ parentNode: E,
955
+ isFallbackNode: !0,
956
+ isRootNode: !0,
957
+ isLeaf: !0,
958
+ isBranch: !1,
959
+ isDisabled: !1,
960
+ isNew: !1,
961
+ index: [-1],
962
+ level: 0,
963
+ raw: t
964
+ };
965
+ return this.$set(this.forest.nodeMap, e, n);
966
+ },
967
+ extractCheckedNodeIdsFromValue() {
968
+ return this.value == null ? [] : this.valueFormat === "id" ? this.multiple ? this.value.slice() : [this.value] : (this.multiple ? this.value : [this.value]).map((e) => this.enhancedNormalizer(e)).map((e) => e.id);
969
+ },
970
+ extractNodeFromValue(e) {
971
+ const t = { id: e };
972
+ if (this.valueFormat === "id")
973
+ return t;
974
+ const s = this.multiple ? Array.isArray(this.value) ? this.value : [] : this.value ? [this.value] : [];
975
+ return Le(
976
+ s,
977
+ (i) => i && this.enhancedNormalizer(i).id === e
978
+ ) || t;
979
+ },
980
+ fixSelectedNodeIds(e) {
981
+ let t = [];
982
+ if (this.single || this.flat || this.disableBranchNodes || this.valueConsistsOf === B)
983
+ t = e;
984
+ else if (this.valueConsistsOf === x)
985
+ e.forEach((n) => {
986
+ t.push(n);
987
+ const i = this.getNode(n);
988
+ i.isBranch && this.traverseDescendantsBFS(i, (o) => {
989
+ t.push(o.id);
990
+ });
991
+ });
992
+ else if (this.valueConsistsOf === z) {
993
+ const n = g(), i = e.slice();
994
+ for (; i.length; ) {
995
+ const o = i.shift(), r = this.getNode(o);
996
+ t.push(o), !r.isRootNode && (r.parentNode.id in n || (n[r.parentNode.id] = r.parentNode.children.length), --n[r.parentNode.id] === 0 && i.push(r.parentNode.id));
997
+ }
998
+ } else if (this.valueConsistsOf === F) {
999
+ const n = g(), i = e.filter((o) => {
1000
+ const r = this.getNode(o);
1001
+ return r.isLeaf || r.children.length === 0;
1002
+ });
1003
+ for (; i.length; ) {
1004
+ const o = i.shift(), r = this.getNode(o);
1005
+ t.push(o), !r.isRootNode && (r.parentNode.id in n || (n[r.parentNode.id] = r.parentNode.children.length), --n[r.parentNode.id] === 0 && i.push(r.parentNode.id));
1006
+ }
1007
+ }
1008
+ V(this.forest.selectedNodeIds, t) && (this.forest.selectedNodeIds = t), this.buildForestState();
1009
+ },
1010
+ keepDataOfSelectedNodes(e) {
1011
+ this.forest.selectedNodeIds.forEach((t) => {
1012
+ if (!e[t])
1013
+ return;
1014
+ const s = b(_({}, e[t]), {
1015
+ isFallbackNode: !0
1016
+ });
1017
+ this.$set(this.forest.nodeMap, t, s);
1018
+ });
1019
+ },
1020
+ isSelected(e) {
1021
+ return this.forest.selectedNodeMap[e.id] === !0;
1022
+ },
1023
+ traverseDescendantsBFS(e, t) {
1024
+ if (!e.isBranch)
1025
+ return;
1026
+ const s = e.children.slice();
1027
+ for (; s.length; ) {
1028
+ const n = s[0];
1029
+ n.isBranch && s.push(...n.children), t(n), s.shift();
1030
+ }
1031
+ },
1032
+ traverseDescendantsDFS(e, t) {
1033
+ e.isBranch && e.children.forEach((s) => {
1034
+ this.traverseDescendantsDFS(s, t), t(s);
1035
+ });
1036
+ },
1037
+ traverseAllNodesDFS(e) {
1038
+ this.forest.normalizedOptions.forEach((t) => {
1039
+ this.traverseDescendantsDFS(t, e), e(t);
1040
+ });
1041
+ },
1042
+ traverseAllNodesByIndex(e) {
1043
+ const t = (s) => {
1044
+ s.children.forEach((n) => {
1045
+ e(n) !== !1 && n.isBranch && t(n);
1046
+ });
1047
+ };
1048
+ t({ children: this.forest.normalizedOptions });
1049
+ },
1050
+ toggleClickOutsideEvent(e) {
1051
+ e ? document.addEventListener("mousedown", this.handleClickOutside, !1) : document.removeEventListener("mousedown", this.handleClickOutside, !1);
1052
+ },
1053
+ getValueContainer() {
1054
+ return this.$refs.control.$refs["value-container"];
1055
+ },
1056
+ getInput() {
1057
+ return this.getValueContainer().$refs.input;
1058
+ },
1059
+ focusInput() {
1060
+ this.getInput().focus();
1061
+ },
1062
+ blurInput() {
1063
+ this.getInput().blur();
1064
+ },
1065
+ handleMouseDown: N(function(t) {
1066
+ if (t.preventDefault(), t.stopPropagation(), this.disabled)
1067
+ return;
1068
+ this.getValueContainer().$el.contains(t.target) && !this.menu.isOpen && (this.openOnClick || this.trigger.isFocused) && this.openMenu(), this._blurOnSelect ? this.blurInput() : this.focusInput(), this.resetFlags();
1069
+ }),
1070
+ handleClickOutside(e) {
1071
+ this.$refs.wrapper && !this.$refs.wrapper.contains(e.target) && (this.blurInput(), this.closeMenu());
1072
+ },
1073
+ handleLocalSearch() {
1074
+ const { searchQuery: e } = this.trigger, t = () => this.resetHighlightedOptionWhenNecessary(!0);
1075
+ if (!e)
1076
+ return this.localSearch.active = !1, t();
1077
+ this.localSearch.active = !0, this.localSearch.noResults = !0, this.traverseAllNodesDFS((i) => {
1078
+ i.isBranch && (i.isExpandedOnSearch = !1, i.showAllChildrenOnSearch = !1, i.isMatched = !1, i.hasMatchedDescendants = !1, this.$set(this.localSearch.countMap, i.id, {
1079
+ [$]: 0,
1080
+ [w]: 0,
1081
+ [C]: 0,
1082
+ [L]: 0
1083
+ }));
1084
+ });
1085
+ const s = e.trim().toLocaleLowerCase(), n = s.replace(/\s+/g, " ").split(" ");
1086
+ this.traverseAllNodesDFS((i) => {
1087
+ this.searchNested && n.length > 1 ? i.isMatched = n.every(
1088
+ (o) => oe(!1, o, i.nestedSearchLabel)
1089
+ ) : i.isMatched = this.matchKeys.some(
1090
+ (o) => oe(!this.disableFuzzyMatching, s, i.lowerCased[o])
1091
+ ), i.isMatched && (this.localSearch.noResults = !1, i.ancestors.forEach((o) => this.localSearch.countMap[o.id][w]++), i.isLeaf && i.ancestors.forEach((o) => this.localSearch.countMap[o.id][L]++), i.parentNode !== E && (this.localSearch.countMap[i.parentNode.id][$] += 1, i.isLeaf && (this.localSearch.countMap[i.parentNode.id][C] += 1))), (i.isMatched || i.isBranch && i.isExpandedOnSearch) && i.parentNode !== E && (i.parentNode.isExpandedOnSearch = !0, i.parentNode.hasMatchedDescendants = !0);
1092
+ }), t();
1093
+ },
1094
+ handleRemoteSearch() {
1095
+ const { searchQuery: e } = this.trigger, t = this.getRemoteSearchEntry(), s = () => {
1096
+ this.initialize(), this.resetHighlightedOptionWhenNecessary(!0);
1097
+ };
1098
+ if ((e === "" || this.cacheOptions) && t.isLoaded)
1099
+ return s();
1100
+ this.callLoadOptionsProp({
1101
+ action: at,
1102
+ args: { searchQuery: e },
1103
+ isPending() {
1104
+ return t.isLoading;
1105
+ },
1106
+ start: () => {
1107
+ t.isLoading = !0, t.isLoaded = !1, t.loadingError = "";
1108
+ },
1109
+ succeed: (n) => {
1110
+ t.isLoaded = !0, t.options = n, this.trigger.searchQuery === e && s();
1111
+ },
1112
+ fail: (n) => {
1113
+ t.loadingError = H(n);
1114
+ },
1115
+ end: () => {
1116
+ t.isLoading = !1;
1117
+ }
1118
+ });
1119
+ },
1120
+ getRemoteSearchEntry() {
1121
+ const { searchQuery: e } = this.trigger, t = this.remoteSearch[e] || b(_({}, k()), {
1122
+ options: []
1123
+ });
1124
+ if (this.$watch(
1125
+ () => t.options,
1126
+ () => {
1127
+ this.trigger.searchQuery === e && this.initialize();
1128
+ },
1129
+ { deep: !0 }
1130
+ ), e === "") {
1131
+ if (Array.isArray(this.defaultOptions))
1132
+ return t.options = this.defaultOptions, t.isLoaded = !0, t;
1133
+ if (this.defaultOptions !== !0)
1134
+ return t.isLoaded = !0, t;
1135
+ }
1136
+ return this.remoteSearch[e] || this.$set(this.remoteSearch, e, t), t;
1137
+ },
1138
+ shouldExpand(e) {
1139
+ return this.localSearch.active ? e.isExpandedOnSearch : e.isExpanded;
1140
+ },
1141
+ shouldOptionBeIncludedInSearchResult(e) {
1142
+ return !!(e.isMatched || e.isBranch && e.hasMatchedDescendants && !this.flattenSearchResults || !e.isRootNode && e.parentNode.showAllChildrenOnSearch);
1143
+ },
1144
+ shouldShowOptionInMenu(e) {
1145
+ return !(this.localSearch.active && !this.shouldOptionBeIncludedInSearchResult(e));
1146
+ },
1147
+ getControl() {
1148
+ return this.$refs.control.$el;
1149
+ },
1150
+ getMenu() {
1151
+ const t = (this.appendToBody ? this.$refs.portal.portalTarget : this).$refs.menu.$refs.menu;
1152
+ return t && t.nodeName !== "#comment" ? t : null;
1153
+ },
1154
+ setCurrentHighlightedOption(e, t = !0) {
1155
+ const s = this.menu.current;
1156
+ if (s != null && s in this.forest.nodeMap && (this.forest.nodeMap[s].isHighlighted = !1), this.menu.current = e.id, e.isHighlighted = !0, this.menu.isOpen && t) {
1157
+ const n = () => {
1158
+ const i = this.getMenu(), o = i.querySelector(`.vue-treeselect__option[data-id="${e.id}"]`);
1159
+ o && Xe(i, o);
1160
+ };
1161
+ this.getMenu() ? n() : this.$nextTick(n);
1162
+ }
1163
+ },
1164
+ resetHighlightedOptionWhenNecessary(e = !1) {
1165
+ const { current: t } = this.menu;
1166
+ (e || t == null || !(t in this.forest.nodeMap) || !this.shouldShowOptionInMenu(this.getNode(t))) && this.highlightFirstOption();
1167
+ },
1168
+ highlightFirstOption() {
1169
+ if (!this.hasVisibleOptions)
1170
+ return;
1171
+ const e = this.visibleOptionIds[0];
1172
+ this.setCurrentHighlightedOption(this.getNode(e));
1173
+ },
1174
+ highlightPrevOption() {
1175
+ if (!this.hasVisibleOptions)
1176
+ return;
1177
+ const e = this.visibleOptionIds.indexOf(this.menu.current) - 1;
1178
+ if (e === -1)
1179
+ return this.highlightLastOption();
1180
+ this.setCurrentHighlightedOption(this.getNode(this.visibleOptionIds[e]));
1181
+ },
1182
+ highlightNextOption() {
1183
+ if (!this.hasVisibleOptions)
1184
+ return;
1185
+ const e = this.visibleOptionIds.indexOf(this.menu.current) + 1;
1186
+ if (e === this.visibleOptionIds.length)
1187
+ return this.highlightFirstOption();
1188
+ this.setCurrentHighlightedOption(this.getNode(this.visibleOptionIds[e]));
1189
+ },
1190
+ highlightLastOption() {
1191
+ if (!this.hasVisibleOptions)
1192
+ return;
1193
+ const e = ee(this.visibleOptionIds);
1194
+ this.setCurrentHighlightedOption(this.getNode(e));
1195
+ },
1196
+ resetSearchQuery() {
1197
+ this.trigger.searchQuery = "";
1198
+ },
1199
+ closeMenu() {
1200
+ !this.menu.isOpen || !this.disabled && this.alwaysOpen || (this.saveMenuScrollPosition(), this.menu.isOpen = !1, this.toggleClickOutsideEvent(!1), this.resetSearchQuery(), this.$emit("close", this.getValue(), this.getInstanceId()));
1201
+ },
1202
+ openMenu() {
1203
+ this.disabled || this.menu.isOpen || (this.menu.isOpen = !0, this.$nextTick(this.resetHighlightedOptionWhenNecessary), this.$nextTick(this.restoreMenuScrollPosition), !this.options && !this.async && this.loadRootOptions(), this.toggleClickOutsideEvent(!0), this.$emit("open", this.getInstanceId()));
1204
+ },
1205
+ toggleMenu() {
1206
+ this.menu.isOpen ? this.closeMenu() : this.openMenu();
1207
+ },
1208
+ toggleExpanded(e) {
1209
+ let t;
1210
+ this.localSearch.active ? (t = e.isExpandedOnSearch = !e.isExpandedOnSearch, t && (e.showAllChildrenOnSearch = !0)) : t = e.isExpanded = !e.isExpanded, t && !e.childrenStates.isLoaded && this.loadChildrenOptions(e);
1211
+ },
1212
+ buildForestState() {
1213
+ const e = g();
1214
+ this.forest.selectedNodeIds.forEach((s) => {
1215
+ e[s] = !0;
1216
+ }), this.forest.selectedNodeMap = e;
1217
+ const t = g();
1218
+ this.multiple && (this.traverseAllNodesByIndex((s) => {
1219
+ t[s.id] = U;
1220
+ }), this.selectedNodes.forEach((s) => {
1221
+ t[s.id] = xe, !this.flat && !this.disableBranchNodes && s.ancestors.forEach((n) => {
1222
+ this.isSelected(n) || (t[n.id] = Me);
1223
+ });
1224
+ })), this.forest.checkedStateMap = t;
1225
+ },
1226
+ enhancedNormalizer(e) {
1227
+ return _(_({}, e), this.normalizer(e, this.getInstanceId()));
1228
+ },
1229
+ normalize(e, t, s) {
1230
+ let n = t.map((i) => [this.enhancedNormalizer(i), i]).map(([i, o], r) => {
1231
+ this.checkDuplication(i), this.verifyNodeShape(i);
1232
+ const { id: c, label: d, children: a, isDefaultExpanded: m } = i, p = e === E, y = p ? 0 : e.level + 1, R = Array.isArray(a) || a === null, I = !R, X = !!i.isDisabled || !this.flat && !p && e.isDisabled, ze = !!i.isNew, A = this.matchKeys.reduce((u, M) => b(_({}, u), {
1233
+ [M]: ht(i[M]).toLocaleLowerCase()
1234
+ }), {}), Fe = p ? A.label : `${e.nestedSearchLabel} ${A.label}`, l = this.$set(this.forest.nodeMap, c, g());
1235
+ if (this.$set(l, "id", c), this.$set(l, "label", d), this.$set(l, "level", y), this.$set(l, "ancestors", p ? [] : [e].concat(e.ancestors)), this.$set(l, "index", (p ? [] : e.index).concat(r)), this.$set(l, "parentNode", e), this.$set(l, "lowerCased", A), this.$set(l, "nestedSearchLabel", Fe), this.$set(l, "isDisabled", X), this.$set(l, "isNew", ze), this.$set(l, "isMatched", !1), this.$set(l, "isHighlighted", !1), this.$set(l, "isBranch", R), this.$set(l, "isLeaf", I), this.$set(l, "isRootNode", p), this.$set(l, "raw", o), R) {
1236
+ const u = Array.isArray(a);
1237
+ this.$set(l, "childrenStates", b(_({}, k()), {
1238
+ isLoaded: u
1239
+ })), this.$set(l, "isExpanded", typeof m == "boolean" ? m : y < this.defaultExpandLevel), this.$set(l, "hasMatchedDescendants", !1), this.$set(l, "hasDisabledDescendants", !1), this.$set(l, "isExpandedOnSearch", !1), this.$set(l, "showAllChildrenOnSearch", !1), this.$set(l, "count", {
1240
+ [$]: 0,
1241
+ [w]: 0,
1242
+ [C]: 0,
1243
+ [L]: 0
1244
+ }), this.$set(l, "children", u ? this.normalize(l, a, s) : []), m === !0 && l.ancestors.forEach((M) => {
1245
+ M.isExpanded = !0;
1246
+ }), !u && typeof this.loadOptions != "function" ? S(
1247
+ () => !1,
1248
+ () => 'Unloaded branch node detected. "loadOptions" prop is required to load its children.'
1249
+ ) : !u && l.isExpanded && this.loadChildrenOptions(l);
1250
+ }
1251
+ if (l.ancestors.forEach((u) => u.count[w]++), I && l.ancestors.forEach((u) => u.count[L]++), p || (e.count[$] += 1, I && (e.count[C] += 1), X && (e.hasDisabledDescendants = !0)), s && s[c]) {
1252
+ const u = s[c];
1253
+ l.isMatched = u.isMatched, l.showAllChildrenOnSearch = u.showAllChildrenOnSearch, l.isHighlighted = u.isHighlighted, u.isBranch && l.isBranch && (l.isExpanded = u.isExpanded, l.isExpandedOnSearch = u.isExpandedOnSearch, u.childrenStates.isLoaded && !l.childrenStates.isLoaded ? l.isExpanded = !1 : l.childrenStates = _({}, u.childrenStates));
1254
+ }
1255
+ return l;
1256
+ });
1257
+ if (this.branchNodesFirst) {
1258
+ const i = n.filter((r) => r.isBranch), o = n.filter((r) => r.isLeaf);
1259
+ n = i.concat(o);
1260
+ }
1261
+ return n;
1262
+ },
1263
+ loadRootOptions() {
1264
+ this.callLoadOptionsProp({
1265
+ action: ot,
1266
+ isPending: () => this.rootOptionsStates.isLoading,
1267
+ start: () => {
1268
+ this.rootOptionsStates.isLoading = !0, this.rootOptionsStates.loadingError = "";
1269
+ },
1270
+ succeed: () => {
1271
+ this.rootOptionsStates.isLoaded = !0, this.$nextTick(() => {
1272
+ this.resetHighlightedOptionWhenNecessary(!0);
1273
+ });
1274
+ },
1275
+ fail: (e) => {
1276
+ this.rootOptionsStates.loadingError = H(e);
1277
+ },
1278
+ end: () => {
1279
+ this.rootOptionsStates.isLoading = !1;
1280
+ }
1281
+ });
1282
+ },
1283
+ loadChildrenOptions(e) {
1284
+ const { id: t, raw: s } = e;
1285
+ this.callLoadOptionsProp({
1286
+ action: lt,
1287
+ args: {
1288
+ // We always pass the raw node instead of the normalized node to any
1289
+ // callback provided by the user of this component.
1290
+ // Because the shape of the raw node is more likely to be closing to
1291
+ // what the back-end API service of the application needs.
1292
+ parentNode: s
1293
+ },
1294
+ isPending: () => this.getNode(t).childrenStates.isLoading,
1295
+ start: () => {
1296
+ this.getNode(t).childrenStates.isLoading = !0, this.getNode(t).childrenStates.loadingError = "";
1297
+ },
1298
+ succeed: () => {
1299
+ this.getNode(t).childrenStates.isLoaded = !0;
1300
+ },
1301
+ fail: (n) => {
1302
+ this.getNode(t).childrenStates.loadingError = H(n);
1303
+ },
1304
+ end: () => {
1305
+ this.getNode(t).childrenStates.isLoading = !1;
1306
+ }
1307
+ });
1308
+ },
1309
+ callLoadOptionsProp({ action: e, args: t, isPending: s, start: n, succeed: i, fail: o, end: r }) {
1310
+ if (!this.loadOptions || s())
1311
+ return;
1312
+ n();
1313
+ const c = qe((a, m) => {
1314
+ a ? o(a) : i(m), r();
1315
+ }), d = this.loadOptions(b(_({
1316
+ id: this.getInstanceId(),
1317
+ instanceId: this.getInstanceId(),
1318
+ action: e
1319
+ }, t), {
1320
+ callback: c
1321
+ }));
1322
+ ye(d) && d.then(() => {
1323
+ c();
1324
+ }, (a) => {
1325
+ c(a);
1326
+ }).catch((a) => {
1327
+ console.error(a);
1328
+ });
1329
+ },
1330
+ checkDuplication(e) {
1331
+ S(
1332
+ () => !(e.id in this.forest.nodeMap && !this.forest.nodeMap[e.id].isFallbackNode),
1333
+ () => `Detected duplicate presence of node id ${JSON.stringify(e.id)}. Their labels are "${this.forest.nodeMap[e.id].label}" and "${e.label}" respectively.`
1334
+ );
1335
+ },
1336
+ verifyNodeShape(e) {
1337
+ S(
1338
+ () => !(e.children === void 0 && e.isBranch === !0),
1339
+ () => "Are you meant to declare an unloaded branch node? `isBranch: true` is no longer supported, please use `children: null` instead."
1340
+ );
1341
+ },
1342
+ select(e) {
1343
+ if (this.disabled || e.isDisabled)
1344
+ return;
1345
+ this.single && this.clear();
1346
+ const t = this.multiple && !this.flat ? this.forest.checkedStateMap[e.id] === U : !this.isSelected(e);
1347
+ t ? this._selectNode(e) : this._deselectNode(e), this.buildForestState(), t ? this.$emit("select", e.raw, this.getInstanceId()) : this.$emit("deselect", e.raw, this.getInstanceId()), this.localSearch.active && t && (this.single || this.clearOnSelect) && this.resetSearchQuery(), this.single && this.closeOnSelect && (this.closeMenu(), this.searchable && (this._blurOnSelect = !0));
1348
+ },
1349
+ clear() {
1350
+ this.hasValue && (this.single || this.allowClearingDisabled ? this.forest.selectedNodeIds = [] : this.forest.selectedNodeIds = this.forest.selectedNodeIds.filter(
1351
+ (e) => this.getNode(e).isDisabled
1352
+ ), this.buildForestState());
1353
+ },
1354
+ // This is meant to be called only by `select()`.
1355
+ _selectNode(e) {
1356
+ if (this.single || this.disableBranchNodes)
1357
+ return this.addValue(e);
1358
+ if (this.flat) {
1359
+ this.addValue(e), this.autoSelectAncestors ? e.ancestors.forEach((s) => {
1360
+ !this.isSelected(s) && !s.isDisabled && this.addValue(s);
1361
+ }) : this.autoSelectDescendants && this.traverseDescendantsBFS(e, (s) => {
1362
+ !this.isSelected(s) && !s.isDisabled && this.addValue(s);
1363
+ });
1364
+ return;
1365
+ }
1366
+ const t = e.isLeaf || /* node.isBranch && */
1367
+ !e.hasDisabledDescendants || /* node.isBranch && */
1368
+ this.allowSelectingDisabledDescendants;
1369
+ if (t && this.addValue(e), e.isBranch && this.traverseDescendantsBFS(e, (s) => {
1370
+ (!s.isDisabled || this.allowSelectingDisabledDescendants) && this.addValue(s);
1371
+ }), t) {
1372
+ let s = e;
1373
+ for (; (s = s.parentNode) !== E && s.children.every(this.isSelected); )
1374
+ this.addValue(s);
1375
+ }
1376
+ },
1377
+ // This is meant to be called only by `select()`.
1378
+ _deselectNode(e) {
1379
+ if (this.disableBranchNodes)
1380
+ return this.removeValue(e);
1381
+ if (this.flat) {
1382
+ this.removeValue(e), this.autoDeselectAncestors ? e.ancestors.forEach((s) => {
1383
+ this.isSelected(s) && !s.isDisabled && this.removeValue(s);
1384
+ }) : this.autoDeselectDescendants && this.traverseDescendantsBFS(e, (s) => {
1385
+ this.isSelected(s) && !s.isDisabled && this.removeValue(s);
1386
+ });
1387
+ return;
1388
+ }
1389
+ let t = !1;
1390
+ if (e.isBranch && this.traverseDescendantsDFS(e, (s) => {
1391
+ (!s.isDisabled || this.allowSelectingDisabledDescendants) && (this.removeValue(s), t = !0);
1392
+ }), e.isLeaf || /* node.isBranch && */
1393
+ t || /* node.isBranch && */
1394
+ e.children.length === 0) {
1395
+ this.removeValue(e);
1396
+ let s = e;
1397
+ for (; (s = s.parentNode) !== E && this.isSelected(s); )
1398
+ this.removeValue(s);
1399
+ }
1400
+ },
1401
+ addValue(e) {
1402
+ this.forest.selectedNodeIds.push(e.id), this.forest.selectedNodeMap[e.id] = !0;
1403
+ },
1404
+ removeValue(e) {
1405
+ Ee(this.forest.selectedNodeIds, e.id), delete this.forest.selectedNodeMap[e.id];
1406
+ },
1407
+ removeLastValue() {
1408
+ if (!this.hasValue)
1409
+ return;
1410
+ if (this.single)
1411
+ return this.clear();
1412
+ const e = ee(this.internalValue), t = this.getNode(e);
1413
+ this.select(t);
1414
+ },
1415
+ saveMenuScrollPosition() {
1416
+ const e = this.getMenu();
1417
+ e && (this.menu.lastScrollPosition = e.scrollTop);
1418
+ },
1419
+ restoreMenuScrollPosition() {
1420
+ const e = this.getMenu();
1421
+ e && (e.scrollTop = this.menu.lastScrollPosition);
1422
+ }
1423
+ },
1424
+ created() {
1425
+ this.verifyProps(), this.resetFlags();
1426
+ },
1427
+ mounted() {
1428
+ this.autoFocus && this.focusInput(), !this.options && !this.async && this.autoLoadRootOptions && this.loadRootOptions(), this.alwaysOpen && this.openMenu(), this.async && this.defaultOptions && this.handleRemoteSearch();
1429
+ },
1430
+ destroyed() {
1431
+ this.toggleClickOutsideEvent(!1);
1432
+ }
1433
+ };
1434
+ function ft(e) {
1435
+ return typeof e == "string" ? e : e != null && !we(e) ? JSON.stringify(e) : "";
1436
+ }
1437
+ const mt = {
1438
+ name: "VueTreeSelectHiddenFields",
1439
+ functional: !0,
1440
+ inject: ["instance"],
1441
+ render(e, t) {
1442
+ const s = arguments[0], {
1443
+ instance: n
1444
+ } = t.injections;
1445
+ if (!n.name || n.disabled || !n.hasValue)
1446
+ return null;
1447
+ let i = n.internalValue.map(ft);
1448
+ return n.multiple && n.joinValues && (i = [i.join(n.delimiter)]), i.map((o, r) => s("input", {
1449
+ attrs: {
1450
+ type: "hidden",
1451
+ name: n.name
1452
+ },
1453
+ domProps: {
1454
+ value: o
1455
+ },
1456
+ key: `hidden-field-${r}`
1457
+ }));
1458
+ }
1459
+ };
1460
+ let gt, _t;
1461
+ const le = {};
1462
+ var vt = /* @__PURE__ */ f(
1463
+ mt,
1464
+ gt,
1465
+ _t,
1466
+ !1,
1467
+ St,
1468
+ null,
1469
+ null,
1470
+ null
1471
+ );
1472
+ function St(e) {
1473
+ for (let t in le)
1474
+ this[t] = le[t];
1475
+ }
1476
+ const Ot = /* @__PURE__ */ function() {
1477
+ return vt.exports;
1478
+ }();
1479
+ function Y() {
1480
+ return Y = Object.assign ? Object.assign.bind() : function(e) {
1481
+ for (var t, s = 1; s < arguments.length; s++)
1482
+ for (var n in t = arguments[s], t)
1483
+ Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
1484
+ return e;
1485
+ }, Y.apply(this, arguments);
1486
+ }
1487
+ var yt = ["attrs", "props", "domProps"], Et = ["class", "style", "directives"], Nt = ["on", "nativeOn"], bt = function(e) {
1488
+ return e.reduce(function(t, s) {
1489
+ for (var n in s)
1490
+ if (!t[n])
1491
+ t[n] = s[n];
1492
+ else if (yt.indexOf(n) !== -1)
1493
+ t[n] = Y({}, t[n], s[n]);
1494
+ else if (Et.indexOf(n) !== -1) {
1495
+ var i = t[n] instanceof Array ? t[n] : [t[n]], o = s[n] instanceof Array ? s[n] : [s[n]];
1496
+ t[n] = [].concat(i, o);
1497
+ } else if (Nt.indexOf(n) !== -1)
1498
+ for (var r in s[n])
1499
+ if (t[n][r]) {
1500
+ var c = t[n][r] instanceof Array ? t[n][r] : [t[n][r]], d = s[n][r] instanceof Array ? s[n][r] : [s[n][r]];
1501
+ t[n][r] = [].concat(c, d);
1502
+ } else
1503
+ t[n][r] = s[n][r];
1504
+ else if (n === "hook")
1505
+ for (var a in s[n])
1506
+ t[n][a] = t[n][a] ? $t(t[n][a], s[n][a]) : s[n][a];
1507
+ else
1508
+ t[n] = s[n];
1509
+ return t;
1510
+ }, {});
1511
+ }, $t = function(e, t) {
1512
+ return function() {
1513
+ e && e.apply(this, arguments), t && t.apply(this, arguments);
1514
+ };
1515
+ }, D = bt;
1516
+ const wt = [h.ENTER, h.END, h.HOME, h.ARROW_LEFT, h.ARROW_UP, h.ARROW_RIGHT, h.ARROW_DOWN], Ct = {
1517
+ name: "VueTreeSelectInput",
1518
+ inject: ["instance"],
1519
+ data: () => ({
1520
+ inputWidth: ie,
1521
+ value: ""
1522
+ }),
1523
+ computed: {
1524
+ needAutoSize() {
1525
+ const {
1526
+ instance: e
1527
+ } = this;
1528
+ return e.searchable && !e.disabled && e.multiple;
1529
+ },
1530
+ inputStyle() {
1531
+ return {
1532
+ width: this.needAutoSize ? `${this.inputWidth}px` : null
1533
+ };
1534
+ }
1535
+ },
1536
+ watch: {
1537
+ "instance.trigger.searchQuery"(e) {
1538
+ this.value = e;
1539
+ },
1540
+ value() {
1541
+ this.needAutoSize && this.$nextTick(this.updateInputWidth);
1542
+ }
1543
+ },
1544
+ created() {
1545
+ this.debouncedCallback = Ke(this.updateSearchQuery, ct, {
1546
+ leading: !0,
1547
+ trailing: !0
1548
+ });
1549
+ },
1550
+ methods: {
1551
+ clear() {
1552
+ this.onInput({
1553
+ target: {
1554
+ value: ""
1555
+ }
1556
+ });
1557
+ },
1558
+ focus() {
1559
+ const {
1560
+ instance: e
1561
+ } = this;
1562
+ e.disabled || this.$refs.input && this.$refs.input.focus();
1563
+ },
1564
+ blur() {
1565
+ this.$refs.input && this.$refs.input.blur();
1566
+ },
1567
+ onFocus() {
1568
+ const {
1569
+ instance: e
1570
+ } = this;
1571
+ e.trigger.isFocused = !0, e.openOnFocus && e.openMenu();
1572
+ },
1573
+ onBlur() {
1574
+ const {
1575
+ instance: e
1576
+ } = this, t = e.getMenu();
1577
+ if (t && document.activeElement === t)
1578
+ return this.focus();
1579
+ e.trigger.isFocused = !1, e.closeMenu();
1580
+ },
1581
+ onInput(e) {
1582
+ const {
1583
+ value: t
1584
+ } = e.target;
1585
+ this.value = t, t ? this.debouncedCallback() : (this.debouncedCallback.cancel(), this.updateSearchQuery());
1586
+ },
1587
+ // 用 keyUp 事件存在一个问题,删除输入框最后一个字符也会导致取消选中最后一项
1588
+ onKeyDown(e) {
1589
+ const {
1590
+ instance: t
1591
+ } = this, s = "which" in e ? e.which : (
1592
+ /* istanbul ignore next */
1593
+ e.keyCode
1594
+ );
1595
+ if (!(e.ctrlKey || e.shiftKey || e.altKey || e.metaKey)) {
1596
+ if (!t.menu.isOpen && O(wt, s))
1597
+ return e.preventDefault(), t.openMenu();
1598
+ switch (s) {
1599
+ case h.BACKSPACE: {
1600
+ t.backspaceRemoves && !this.value.length && t.removeLastValue();
1601
+ break;
1602
+ }
1603
+ case h.ENTER: {
1604
+ if (e.preventDefault(), t.menu.current === null)
1605
+ return;
1606
+ const n = t.getNode(t.menu.current);
1607
+ if (n.isBranch && t.disableBranchNodes)
1608
+ return;
1609
+ t.select(n);
1610
+ break;
1611
+ }
1612
+ case h.ESCAPE: {
1613
+ this.value.length ? this.clear() : t.menu.isOpen && t.closeMenu();
1614
+ break;
1615
+ }
1616
+ case h.END: {
1617
+ e.preventDefault(), t.highlightLastOption();
1618
+ break;
1619
+ }
1620
+ case h.HOME: {
1621
+ e.preventDefault(), t.highlightFirstOption();
1622
+ break;
1623
+ }
1624
+ case h.ARROW_LEFT: {
1625
+ const n = t.getNode(t.menu.current);
1626
+ n.isBranch && t.shouldExpand(n) ? (e.preventDefault(), t.toggleExpanded(n)) : !n.isRootNode && (n.isLeaf || n.isBranch && !t.shouldExpand(n)) && (e.preventDefault(), t.setCurrentHighlightedOption(n.parentNode));
1627
+ break;
1628
+ }
1629
+ case h.ARROW_UP: {
1630
+ e.preventDefault(), t.highlightPrevOption();
1631
+ break;
1632
+ }
1633
+ case h.ARROW_RIGHT: {
1634
+ const n = t.getNode(t.menu.current);
1635
+ n.isBranch && !t.shouldExpand(n) && (e.preventDefault(), t.toggleExpanded(n));
1636
+ break;
1637
+ }
1638
+ case h.ARROW_DOWN: {
1639
+ e.preventDefault(), t.highlightNextOption();
1640
+ break;
1641
+ }
1642
+ case h.DELETE: {
1643
+ t.deleteRemoves && !this.value.length && t.removeLastValue();
1644
+ break;
1645
+ }
1646
+ default:
1647
+ t.openMenu();
1648
+ }
1649
+ }
1650
+ },
1651
+ onMouseDown(e) {
1652
+ this.value.length && e.stopPropagation();
1653
+ },
1654
+ renderInputContainer() {
1655
+ const e = this.$createElement, {
1656
+ instance: t
1657
+ } = this, s = {}, n = [];
1658
+ return t.searchable && !t.disabled && (n.push(this.renderInput()), this.needAutoSize && n.push(this.renderSizer())), t.searchable || q(s, {
1659
+ on: {
1660
+ focus: this.onFocus,
1661
+ blur: this.onBlur,
1662
+ keydown: this.onKeyDown
1663
+ },
1664
+ ref: "input"
1665
+ }), !t.searchable && !t.disabled && q(s, {
1666
+ attrs: {
1667
+ tabIndex: t.tabIndex
1668
+ }
1669
+ }), e("div", D([{
1670
+ class: "vue-treeselect__input-container"
1671
+ }, s]), [n]);
1672
+ },
1673
+ renderInput() {
1674
+ const e = this.$createElement, {
1675
+ instance: t
1676
+ } = this;
1677
+ return e("input", {
1678
+ ref: "input",
1679
+ class: "vue-treeselect__input",
1680
+ attrs: {
1681
+ type: "text",
1682
+ autocomplete: "off",
1683
+ tabIndex: t.tabIndex,
1684
+ required: t.required && !t.hasValue
1685
+ },
1686
+ domProps: {
1687
+ value: this.value
1688
+ },
1689
+ style: this.inputStyle,
1690
+ on: {
1691
+ focus: this.onFocus,
1692
+ input: this.onInput,
1693
+ blur: this.onBlur,
1694
+ keydown: this.onKeyDown,
1695
+ mousedown: this.onMouseDown
1696
+ }
1697
+ });
1698
+ },
1699
+ renderSizer() {
1700
+ const e = this.$createElement;
1701
+ return e("div", {
1702
+ ref: "sizer",
1703
+ class: "vue-treeselect__sizer"
1704
+ }, [this.value]);
1705
+ },
1706
+ updateInputWidth() {
1707
+ this.inputWidth = Math.max(ie, this.$refs.sizer.scrollWidth + 15);
1708
+ },
1709
+ updateSearchQuery() {
1710
+ const {
1711
+ instance: e
1712
+ } = this;
1713
+ e.trigger.searchQuery = this.value;
1714
+ }
1715
+ },
1716
+ render() {
1717
+ return this.renderInputContainer();
1718
+ }
1719
+ };
1720
+ let Lt, Mt;
1721
+ const ae = {};
1722
+ var xt = /* @__PURE__ */ f(
1723
+ Ct,
1724
+ Lt,
1725
+ Mt,
1726
+ !1,
1727
+ Tt,
1728
+ null,
1729
+ null,
1730
+ null
1731
+ );
1732
+ function Tt(e) {
1733
+ for (let t in ae)
1734
+ this[t] = ae[t];
1735
+ }
1736
+ const De = /* @__PURE__ */ function() {
1737
+ return xt.exports;
1738
+ }(), Dt = {
1739
+ name: "VueTreeSelectPlaceholder",
1740
+ inject: ["instance"],
1741
+ render() {
1742
+ const e = arguments[0], {
1743
+ instance: t
1744
+ } = this, s = {
1745
+ "vue-treeselect__placeholder": !0,
1746
+ "vue-treeselect-helper-zoom-effect-off": !0,
1747
+ "vue-treeselect-helper-hide": t.hasValue || t.trigger.searchQuery
1748
+ };
1749
+ return e("div", {
1750
+ class: s
1751
+ }, [t.placeholder]);
1752
+ }
1753
+ };
1754
+ let Rt, It;
1755
+ const ce = {};
1756
+ var At = /* @__PURE__ */ f(
1757
+ Dt,
1758
+ Rt,
1759
+ It,
1760
+ !1,
1761
+ Vt,
1762
+ null,
1763
+ null,
1764
+ null
1765
+ );
1766
+ function Vt(e) {
1767
+ for (let t in ce)
1768
+ this[t] = ce[t];
1769
+ }
1770
+ const Re = /* @__PURE__ */ function() {
1771
+ return At.exports;
1772
+ }(), Bt = {
1773
+ name: "VueTreeSelectSingleValue",
1774
+ inject: ["instance"],
1775
+ methods: {
1776
+ renderSingleValueLabel() {
1777
+ const {
1778
+ instance: e
1779
+ } = this, t = e.selectedNodes[0], s = e.$scopedSlots["value-label"];
1780
+ return s ? s({
1781
+ node: t
1782
+ }) : t.label;
1783
+ }
1784
+ },
1785
+ render() {
1786
+ const e = arguments[0], {
1787
+ instance: t,
1788
+ $parent: {
1789
+ renderValueContainer: s
1790
+ }
1791
+ } = this, n = t.hasValue && !t.trigger.searchQuery;
1792
+ return s([n && e("div", {
1793
+ class: "vue-treeselect__single-value"
1794
+ }, [this.renderSingleValueLabel()]), e(Re), e(De, {
1795
+ ref: "input"
1796
+ })]);
1797
+ }
1798
+ };
1799
+ let zt, Ft;
1800
+ const ue = {};
1801
+ var kt = /* @__PURE__ */ f(
1802
+ Bt,
1803
+ zt,
1804
+ Ft,
1805
+ !1,
1806
+ Ht,
1807
+ null,
1808
+ null,
1809
+ null
1810
+ );
1811
+ function Ht(e) {
1812
+ for (let t in ue)
1813
+ this[t] = ue[t];
1814
+ }
1815
+ const Pt = /* @__PURE__ */ function() {
1816
+ return kt.exports;
1817
+ }();
1818
+ var Wt = function() {
1819
+ var e = this, t = e.$createElement, s = e._self._c || t;
1820
+ return s("svg", {
1821
+ attrs: {
1822
+ xmlns: "http://www.w3.org/2000/svg",
1823
+ viewBox: "0 0 348.333 348.333"
1824
+ }
1825
+ }, [s("path", {
1826
+ attrs: {
1827
+ d: "M336.559 68.611L231.016 174.165l105.543 105.549c15.699 15.705 15.699 41.145 0 56.85-7.844 7.844-18.128 11.769-28.407 11.769-10.296 0-20.581-3.919-28.419-11.769L174.167 231.003 68.609 336.563c-7.843 7.844-18.128 11.769-28.416 11.769-10.285 0-20.563-3.919-28.413-11.769-15.699-15.698-15.699-41.139 0-56.85l105.54-105.549L11.774 68.611c-15.699-15.699-15.699-41.145 0-56.844 15.696-15.687 41.127-15.687 56.829 0l105.563 105.554L279.721 11.767c15.705-15.687 41.139-15.687 56.832 0 15.705 15.699 15.705 41.145.006 56.844z"
1828
+ }
1829
+ })]);
1830
+ }, jt = [];
1831
+ const Qt = {
1832
+ name: "VueTreeSelectDelete"
1833
+ }, he = {};
1834
+ var Kt = /* @__PURE__ */ f(
1835
+ Qt,
1836
+ Wt,
1837
+ jt,
1838
+ !1,
1839
+ qt,
1840
+ null,
1841
+ null,
1842
+ null
1843
+ );
1844
+ function qt(e) {
1845
+ for (let t in he)
1846
+ this[t] = he[t];
1847
+ }
1848
+ const Ie = /* @__PURE__ */ function() {
1849
+ return Kt.exports;
1850
+ }(), Ut = {
1851
+ name: "VueTreeSelectMultiValueItem",
1852
+ inject: ["instance"],
1853
+ props: {
1854
+ node: {
1855
+ type: Object,
1856
+ required: !0
1857
+ }
1858
+ },
1859
+ methods: {
1860
+ handleMouseDown: N(function() {
1861
+ const {
1862
+ instance: t,
1863
+ node: s
1864
+ } = this;
1865
+ t.select(s);
1866
+ })
1867
+ },
1868
+ render() {
1869
+ const e = arguments[0], {
1870
+ instance: t,
1871
+ node: s
1872
+ } = this, n = {
1873
+ "vue-treeselect__multi-value-item": !0,
1874
+ "vue-treeselect__multi-value-item-disabled": s.isDisabled,
1875
+ "vue-treeselect__multi-value-item-new": s.isNew
1876
+ }, i = t.$scopedSlots["value-label"], o = i ? i({
1877
+ node: s
1878
+ }) : s.label;
1879
+ return e("div", {
1880
+ class: "vue-treeselect__multi-value-item-container"
1881
+ }, [e("div", {
1882
+ class: n,
1883
+ on: {
1884
+ mousedown: this.handleMouseDown
1885
+ }
1886
+ }, [e("span", {
1887
+ class: "vue-treeselect__multi-value-label"
1888
+ }, [o]), e("span", {
1889
+ class: "vue-treeselect__icon vue-treeselect__value-remove"
1890
+ }, [e(Ie)])])]);
1891
+ }
1892
+ };
1893
+ let Yt, Xt;
1894
+ const de = {};
1895
+ var Gt = /* @__PURE__ */ f(
1896
+ Ut,
1897
+ Yt,
1898
+ Xt,
1899
+ !1,
1900
+ Jt,
1901
+ null,
1902
+ null,
1903
+ null
1904
+ );
1905
+ function Jt(e) {
1906
+ for (let t in de)
1907
+ this[t] = de[t];
1908
+ }
1909
+ const Zt = /* @__PURE__ */ function() {
1910
+ return Gt.exports;
1911
+ }(), es = {
1912
+ name: "VueTreeSelectMultiValue",
1913
+ inject: ["instance"],
1914
+ methods: {
1915
+ renderMultiValueItems() {
1916
+ const e = this.$createElement, {
1917
+ instance: t
1918
+ } = this;
1919
+ return t.internalValue.slice(0, t.limit).map(t.getNode).map((s) => e(Zt, {
1920
+ key: `multi-value-item-${s.id}`,
1921
+ attrs: {
1922
+ node: s
1923
+ }
1924
+ }));
1925
+ },
1926
+ renderExceedLimitTip() {
1927
+ const e = this.$createElement, {
1928
+ instance: t
1929
+ } = this, s = t.internalValue.length - t.limit;
1930
+ return s <= 0 ? null : e("div", {
1931
+ class: "vue-treeselect__limit-tip vue-treeselect-helper-zoom-effect-off",
1932
+ key: "exceed-limit-tip"
1933
+ }, [e("span", {
1934
+ class: "vue-treeselect__limit-tip-text"
1935
+ }, [t.limitText(s)])]);
1936
+ }
1937
+ },
1938
+ render() {
1939
+ const e = arguments[0], {
1940
+ renderValueContainer: t
1941
+ } = this.$parent;
1942
+ return t(e("transition-group", D([{
1943
+ class: "vue-treeselect__multi-value"
1944
+ }, {
1945
+ props: {
1946
+ tag: "div",
1947
+ name: "vue-treeselect__multi-value-item--transition",
1948
+ appear: !0
1949
+ }
1950
+ }]), [this.renderMultiValueItems(), this.renderExceedLimitTip(), e(Re, {
1951
+ key: "placeholder"
1952
+ }), e(De, {
1953
+ ref: "input",
1954
+ key: "input"
1955
+ })]));
1956
+ }
1957
+ };
1958
+ let ts, ss;
1959
+ const pe = {};
1960
+ var ns = /* @__PURE__ */ f(
1961
+ es,
1962
+ ts,
1963
+ ss,
1964
+ !1,
1965
+ is,
1966
+ null,
1967
+ null,
1968
+ null
1969
+ );
1970
+ function is(e) {
1971
+ for (let t in pe)
1972
+ this[t] = pe[t];
1973
+ }
1974
+ const rs = /* @__PURE__ */ function() {
1975
+ return ns.exports;
1976
+ }();
1977
+ var os = function() {
1978
+ var e = this, t = e.$createElement, s = e._self._c || t;
1979
+ return s("svg", {
1980
+ attrs: {
1981
+ xmlns: "http://www.w3.org/2000/svg",
1982
+ viewBox: "0 0 292.362 292.362"
1983
+ }
1984
+ }, [s("path", {
1985
+ attrs: {
1986
+ d: "M286.935 69.377c-3.614-3.617-7.898-5.424-12.848-5.424H18.274c-4.952 0-9.233 1.807-12.85 5.424C1.807 72.998 0 77.279 0 82.228c0 4.948 1.807 9.229 5.424 12.847l127.907 127.907c3.621 3.617 7.902 5.428 12.85 5.428s9.233-1.811 12.847-5.428L286.935 95.074c3.613-3.617 5.427-7.898 5.427-12.847 0-4.948-1.814-9.229-5.427-12.85z"
1987
+ }
1988
+ })]);
1989
+ }, ls = [];
1990
+ const as = {
1991
+ name: "VueTreeSelectArrow"
1992
+ }, fe = {};
1993
+ var cs = /* @__PURE__ */ f(
1994
+ as,
1995
+ os,
1996
+ ls,
1997
+ !1,
1998
+ us,
1999
+ null,
2000
+ null,
2001
+ null
2002
+ );
2003
+ function us(e) {
2004
+ for (let t in fe)
2005
+ this[t] = fe[t];
2006
+ }
2007
+ const Ae = /* @__PURE__ */ function() {
2008
+ return cs.exports;
2009
+ }(), hs = {
2010
+ name: "VueTreeSelectControl",
2011
+ inject: ["instance"],
2012
+ computed: {
2013
+ /* eslint-disable valid-jsdoc */
2014
+ /**
2015
+ * Should show the "×" button that resets value?
2016
+ * @return {boolean}
2017
+ */
2018
+ shouldShowX() {
2019
+ const {
2020
+ instance: e
2021
+ } = this;
2022
+ return e.clearable && !e.disabled && e.hasValue && (this.hasUndisabledValue || e.allowClearingDisabled);
2023
+ },
2024
+ /**
2025
+ * Should show the arrow button that toggles menu?
2026
+ * @return {boolean}
2027
+ */
2028
+ shouldShowArrow() {
2029
+ const {
2030
+ instance: e
2031
+ } = this;
2032
+ return e.alwaysOpen ? !e.menu.isOpen : !0;
2033
+ },
2034
+ /**
2035
+ * Has any undisabled option been selected?
2036
+ * @type {boolean}
2037
+ */
2038
+ hasUndisabledValue() {
2039
+ const {
2040
+ instance: e
2041
+ } = this;
2042
+ return e.hasValue && e.internalValue.some((t) => !e.getNode(t).isDisabled);
2043
+ }
2044
+ /* eslint-enable valid-jsdoc */
2045
+ },
2046
+ methods: {
2047
+ renderX() {
2048
+ const e = this.$createElement, {
2049
+ instance: t
2050
+ } = this, s = t.multiple ? t.clearAllText : t.clearValueText;
2051
+ return this.shouldShowX ? e("div", {
2052
+ class: "vue-treeselect__x-container",
2053
+ attrs: {
2054
+ title: s
2055
+ },
2056
+ on: {
2057
+ mousedown: this.handleMouseDownOnX
2058
+ }
2059
+ }, [e(Ie, {
2060
+ class: "vue-treeselect__x"
2061
+ })]) : null;
2062
+ },
2063
+ renderArrow() {
2064
+ const e = this.$createElement, {
2065
+ instance: t
2066
+ } = this, s = {
2067
+ "vue-treeselect__control-arrow": !0,
2068
+ "vue-treeselect__control-arrow--rotated": t.menu.isOpen
2069
+ };
2070
+ return this.shouldShowArrow ? e("div", {
2071
+ class: "vue-treeselect__control-arrow-container",
2072
+ on: {
2073
+ mousedown: this.handleMouseDownOnArrow
2074
+ }
2075
+ }, [e(Ae, {
2076
+ class: s
2077
+ })]) : null;
2078
+ },
2079
+ handleMouseDownOnX: N(function(t) {
2080
+ t.stopPropagation(), t.preventDefault();
2081
+ const {
2082
+ instance: s
2083
+ } = this, n = s.beforeClearAll(), i = (o) => {
2084
+ o && s.clear();
2085
+ };
2086
+ ye(n) ? n.then(i) : setTimeout(() => i(n), 0);
2087
+ }),
2088
+ handleMouseDownOnArrow: N(function(t) {
2089
+ t.preventDefault(), t.stopPropagation();
2090
+ const {
2091
+ instance: s
2092
+ } = this;
2093
+ s.focusInput(), s.toggleMenu();
2094
+ }),
2095
+ // This is meant to be called by child `<Value />` component.
2096
+ renderValueContainer(e) {
2097
+ const t = this.$createElement;
2098
+ return t("div", {
2099
+ class: "vue-treeselect__value-container"
2100
+ }, [e]);
2101
+ }
2102
+ },
2103
+ render() {
2104
+ const e = arguments[0], {
2105
+ instance: t
2106
+ } = this, s = t.single ? Pt : rs;
2107
+ return e("div", {
2108
+ class: "vue-treeselect__control",
2109
+ on: {
2110
+ mousedown: t.handleMouseDown
2111
+ }
2112
+ }, [e(s, {
2113
+ ref: "value-container"
2114
+ }), this.renderX(), this.renderArrow()]);
2115
+ }
2116
+ };
2117
+ let ds, ps;
2118
+ const me = {};
2119
+ var fs = /* @__PURE__ */ f(
2120
+ hs,
2121
+ ds,
2122
+ ps,
2123
+ !1,
2124
+ ms,
2125
+ null,
2126
+ null,
2127
+ null
2128
+ );
2129
+ function ms(e) {
2130
+ for (let t in me)
2131
+ this[t] = me[t];
2132
+ }
2133
+ const gs = /* @__PURE__ */ function() {
2134
+ return fs.exports;
2135
+ }(), _s = {
2136
+ name: "VueTreeSelectTip",
2137
+ functional: !0,
2138
+ props: {
2139
+ type: {
2140
+ type: String,
2141
+ required: !0
2142
+ },
2143
+ icon: {
2144
+ type: String,
2145
+ required: !0
2146
+ }
2147
+ },
2148
+ render(e, t) {
2149
+ const s = arguments[0], {
2150
+ props: n,
2151
+ children: i
2152
+ } = t;
2153
+ return s("div", {
2154
+ class: `vue-treeselect__tip vue-treeselect__${n.type}-tip`
2155
+ }, [s("div", {
2156
+ class: "vue-treeselect__icon-container"
2157
+ }, [s("span", {
2158
+ class: `vue-treeselect__icon-${n.icon}`
2159
+ })]), s("span", {
2160
+ class: `vue-treeselect__tip-text vue-treeselect__${n.type}-tip-text`
2161
+ }, [i])]);
2162
+ }
2163
+ };
2164
+ let vs, Ss;
2165
+ const ge = {};
2166
+ var Os = /* @__PURE__ */ f(
2167
+ _s,
2168
+ vs,
2169
+ Ss,
2170
+ !1,
2171
+ ys,
2172
+ null,
2173
+ null,
2174
+ null
2175
+ );
2176
+ function ys(e) {
2177
+ for (let t in ge)
2178
+ this[t] = ge[t];
2179
+ }
2180
+ const v = /* @__PURE__ */ function() {
2181
+ return Os.exports;
2182
+ }();
2183
+ let P, W, j;
2184
+ const Ve = {
2185
+ name: "VueTreeSelectOption",
2186
+ inject: ["instance"],
2187
+ props: {
2188
+ node: {
2189
+ type: Object,
2190
+ required: !0
2191
+ }
2192
+ },
2193
+ computed: {
2194
+ shouldExpand() {
2195
+ const {
2196
+ instance: e,
2197
+ node: t
2198
+ } = this;
2199
+ return t.isBranch && e.shouldExpand(t);
2200
+ },
2201
+ shouldShow() {
2202
+ const {
2203
+ instance: e,
2204
+ node: t
2205
+ } = this;
2206
+ return e.shouldShowOptionInMenu(t);
2207
+ }
2208
+ },
2209
+ methods: {
2210
+ renderOption() {
2211
+ const e = this.$createElement, {
2212
+ instance: t,
2213
+ node: s
2214
+ } = this, n = {
2215
+ "vue-treeselect__option": !0,
2216
+ "vue-treeselect__option--disabled": s.isDisabled,
2217
+ "vue-treeselect__option--selected": t.isSelected(s),
2218
+ "vue-treeselect__option--highlight": s.isHighlighted,
2219
+ "vue-treeselect__option--matched": t.localSearch.active && s.isMatched,
2220
+ "vue-treeselect__option--hide": !this.shouldShow
2221
+ };
2222
+ return e("div", {
2223
+ class: n,
2224
+ on: {
2225
+ mouseenter: this.handleMouseEnterOption
2226
+ },
2227
+ attrs: {
2228
+ "data-id": s.id
2229
+ }
2230
+ }, [this.renderArrow(), this.renderLabelContainer([this.renderCheckboxContainer([this.renderCheckbox()]), this.renderLabel()])]);
2231
+ },
2232
+ renderSubOptionsList() {
2233
+ const e = this.$createElement;
2234
+ return this.shouldExpand ? e("div", {
2235
+ class: "vue-treeselect__list"
2236
+ }, [this.renderSubOptions(), this.renderNoChildrenTip(), this.renderLoadingChildrenTip(), this.renderLoadingChildrenErrorTip()]) : null;
2237
+ },
2238
+ renderArrow() {
2239
+ const e = this.$createElement, {
2240
+ instance: t,
2241
+ node: s
2242
+ } = this;
2243
+ if (t.shouldFlattenOptions && this.shouldShow)
2244
+ return null;
2245
+ if (s.isBranch) {
2246
+ const n = {
2247
+ props: {
2248
+ name: "vue-treeselect__option-arrow--prepare",
2249
+ appear: !0
2250
+ }
2251
+ }, i = {
2252
+ "vue-treeselect__option-arrow": !0,
2253
+ "vue-treeselect__option-arrow--rotated": this.shouldExpand
2254
+ };
2255
+ return e("div", {
2256
+ class: "vue-treeselect__option-arrow-container",
2257
+ on: {
2258
+ mousedown: this.handleMouseDownOnArrow
2259
+ }
2260
+ }, [e("transition", D([{}, n]), [e(Ae, {
2261
+ class: i
2262
+ })])]);
2263
+ }
2264
+ return (
2265
+ /* node.isLeaf && */
2266
+ t.hasBranchNodes ? (P || (P = e("div", {
2267
+ class: "vue-treeselect__option-arrow-placeholder"
2268
+ }, [" "])), P) : null
2269
+ );
2270
+ },
2271
+ renderLabelContainer(e) {
2272
+ const t = this.$createElement;
2273
+ return t("div", {
2274
+ class: "vue-treeselect__label-container",
2275
+ on: {
2276
+ mousedown: this.handleMouseDownOnLabelContainer
2277
+ }
2278
+ }, [e]);
2279
+ },
2280
+ renderCheckboxContainer(e) {
2281
+ const t = this.$createElement, {
2282
+ instance: s,
2283
+ node: n
2284
+ } = this;
2285
+ return s.single || s.disableBranchNodes && n.isBranch ? null : t("div", {
2286
+ class: "vue-treeselect__checkbox-container"
2287
+ }, [e]);
2288
+ },
2289
+ renderCheckbox() {
2290
+ const e = this.$createElement, {
2291
+ instance: t,
2292
+ node: s
2293
+ } = this, n = t.forest.checkedStateMap[s.id], i = {
2294
+ "vue-treeselect__checkbox": !0,
2295
+ "vue-treeselect__checkbox--checked": n === xe,
2296
+ "vue-treeselect__checkbox--indeterminate": n === Me,
2297
+ "vue-treeselect__checkbox--unchecked": n === U,
2298
+ "vue-treeselect__checkbox--disabled": s.isDisabled
2299
+ };
2300
+ return W || (W = e("span", {
2301
+ class: "vue-treeselect__check-mark"
2302
+ })), j || (j = e("span", {
2303
+ class: "vue-treeselect__minus-mark"
2304
+ })), e("span", {
2305
+ class: i
2306
+ }, [W, j]);
2307
+ },
2308
+ renderLabel() {
2309
+ const e = this.$createElement, {
2310
+ instance: t,
2311
+ node: s
2312
+ } = this, n = s.isBranch && (t.localSearch.active ? t.showCountOnSearchComputed : t.showCount), i = n ? t.localSearch.active ? t.localSearch.countMap[s.id][t.showCountOf] : s.count[t.showCountOf] : NaN, o = "vue-treeselect__label", r = "vue-treeselect__count", c = t.$scopedSlots["option-label"];
2313
+ return c ? c({
2314
+ node: s,
2315
+ shouldShowCount: n,
2316
+ count: i,
2317
+ labelClassName: o,
2318
+ countClassName: r
2319
+ }) : e("label", {
2320
+ class: o
2321
+ }, [s.label, n && e("span", {
2322
+ class: r
2323
+ }, ["(", i, ")"])]);
2324
+ },
2325
+ renderSubOptions() {
2326
+ const e = this.$createElement, {
2327
+ node: t
2328
+ } = this;
2329
+ return t.childrenStates.isLoaded ? t.children.map((s) => e(Ve, {
2330
+ attrs: {
2331
+ node: s
2332
+ },
2333
+ key: s.id
2334
+ })) : null;
2335
+ },
2336
+ renderNoChildrenTip() {
2337
+ const e = this.$createElement, {
2338
+ instance: t,
2339
+ node: s
2340
+ } = this;
2341
+ return !s.childrenStates.isLoaded || s.children.length ? null : e(v, {
2342
+ attrs: {
2343
+ type: "no-children",
2344
+ icon: "warning"
2345
+ }
2346
+ }, [t.noChildrenText]);
2347
+ },
2348
+ renderLoadingChildrenTip() {
2349
+ const e = this.$createElement, {
2350
+ instance: t,
2351
+ node: s
2352
+ } = this;
2353
+ return s.childrenStates.isLoading ? e(v, {
2354
+ attrs: {
2355
+ type: "loading",
2356
+ icon: "loader"
2357
+ }
2358
+ }, [t.loadingText]) : null;
2359
+ },
2360
+ renderLoadingChildrenErrorTip() {
2361
+ const e = this.$createElement, {
2362
+ instance: t,
2363
+ node: s
2364
+ } = this;
2365
+ return s.childrenStates.loadingError ? e(v, {
2366
+ attrs: {
2367
+ type: "error",
2368
+ icon: "error"
2369
+ }
2370
+ }, [s.childrenStates.loadingError, e("a", {
2371
+ class: "vue-treeselect__retry",
2372
+ attrs: {
2373
+ title: t.retryTitle
2374
+ },
2375
+ on: {
2376
+ mousedown: this.handleMouseDownOnRetry
2377
+ }
2378
+ }, [t.retryText])]) : null;
2379
+ },
2380
+ handleMouseEnterOption(e) {
2381
+ const {
2382
+ instance: t,
2383
+ node: s
2384
+ } = this;
2385
+ e.target === e.currentTarget && t.setCurrentHighlightedOption(s, !1);
2386
+ },
2387
+ handleMouseDownOnArrow: N(function() {
2388
+ const {
2389
+ instance: t,
2390
+ node: s
2391
+ } = this;
2392
+ t.toggleExpanded(s);
2393
+ }),
2394
+ handleMouseDownOnLabelContainer: N(function() {
2395
+ const {
2396
+ instance: t,
2397
+ node: s
2398
+ } = this;
2399
+ s.isBranch && t.disableBranchNodes ? t.toggleExpanded(s) : t.select(s);
2400
+ }),
2401
+ handleMouseDownOnRetry: N(function() {
2402
+ const {
2403
+ instance: t,
2404
+ node: s
2405
+ } = this;
2406
+ t.loadChildrenOptions(s);
2407
+ })
2408
+ },
2409
+ render() {
2410
+ const e = arguments[0], {
2411
+ node: t
2412
+ } = this, n = {
2413
+ "vue-treeselect__list-item": !0,
2414
+ [`vue-treeselect__indent-level-${this.instance.shouldFlattenOptions ? 0 : t.level}`]: !0
2415
+ }, i = {
2416
+ props: {
2417
+ name: "vue-treeselect__list--transition"
2418
+ }
2419
+ };
2420
+ return e("div", {
2421
+ class: n
2422
+ }, [this.renderOption(), t.isBranch && e("transition", D([{}, i]), [this.renderSubOptionsList()])]);
2423
+ }
2424
+ };
2425
+ let Es, Ns;
2426
+ const _e = {};
2427
+ var bs = /* @__PURE__ */ f(
2428
+ Ve,
2429
+ Es,
2430
+ Ns,
2431
+ !1,
2432
+ $s,
2433
+ null,
2434
+ null,
2435
+ null
2436
+ );
2437
+ function $s(e) {
2438
+ for (let t in _e)
2439
+ this[t] = _e[t];
2440
+ }
2441
+ const ws = /* @__PURE__ */ function() {
2442
+ return bs.exports;
2443
+ }(), Cs = {
2444
+ top: "top",
2445
+ bottom: "bottom",
2446
+ above: "top",
2447
+ below: "bottom"
2448
+ }, Ls = {
2449
+ name: "VueTreeSelectMenu",
2450
+ inject: ["instance"],
2451
+ computed: {
2452
+ menuStyle() {
2453
+ const {
2454
+ instance: e
2455
+ } = this;
2456
+ return {
2457
+ maxHeight: `${e.maxHeight}px`
2458
+ };
2459
+ },
2460
+ menuContainerStyle() {
2461
+ const {
2462
+ instance: e
2463
+ } = this;
2464
+ return {
2465
+ zIndex: e.appendToBody ? null : e.zIndex
2466
+ };
2467
+ }
2468
+ },
2469
+ watch: {
2470
+ "instance.menu.isOpen"(e) {
2471
+ e ? this.$nextTick(this.onMenuOpen) : this.onMenuClose();
2472
+ }
2473
+ },
2474
+ created() {
2475
+ this.menuSizeWatcher = null, this.menuResizeAndScrollEventListeners = null;
2476
+ },
2477
+ mounted() {
2478
+ const {
2479
+ instance: e
2480
+ } = this;
2481
+ e.menu.isOpen && this.$nextTick(this.onMenuOpen);
2482
+ },
2483
+ destroyed() {
2484
+ this.onMenuClose();
2485
+ },
2486
+ methods: {
2487
+ renderMenu() {
2488
+ const e = this.$createElement, {
2489
+ instance: t
2490
+ } = this;
2491
+ return t.menu.isOpen ? e("div", {
2492
+ ref: "menu",
2493
+ class: "vue-treeselect__menu",
2494
+ on: {
2495
+ mousedown: t.handleMouseDown
2496
+ },
2497
+ style: this.menuStyle
2498
+ }, [this.renderBeforeList(), t.async ? this.renderAsyncSearchMenuInner() : t.localSearch.active ? this.renderLocalSearchMenuInner() : this.renderNormalMenuInner(), this.renderAfterList()]) : null;
2499
+ },
2500
+ renderBeforeList() {
2501
+ const {
2502
+ instance: e
2503
+ } = this, t = e.$scopedSlots["before-list"];
2504
+ return t ? t() : null;
2505
+ },
2506
+ renderAfterList() {
2507
+ const {
2508
+ instance: e
2509
+ } = this, t = e.$scopedSlots["after-list"];
2510
+ return t ? t() : null;
2511
+ },
2512
+ renderNormalMenuInner() {
2513
+ const {
2514
+ instance: e
2515
+ } = this;
2516
+ return e.rootOptionsStates.isLoading ? this.renderLoadingOptionsTip() : e.rootOptionsStates.loadingError ? this.renderLoadingRootOptionsErrorTip() : e.rootOptionsStates.isLoaded && e.forest.normalizedOptions.length === 0 ? this.renderNoAvailableOptionsTip() : this.renderOptionList();
2517
+ },
2518
+ renderLocalSearchMenuInner() {
2519
+ const {
2520
+ instance: e
2521
+ } = this;
2522
+ return e.rootOptionsStates.isLoading ? this.renderLoadingOptionsTip() : e.rootOptionsStates.loadingError ? this.renderLoadingRootOptionsErrorTip() : e.rootOptionsStates.isLoaded && e.forest.normalizedOptions.length === 0 ? this.renderNoAvailableOptionsTip() : e.localSearch.noResults ? this.renderNoResultsTip() : this.renderOptionList();
2523
+ },
2524
+ renderAsyncSearchMenuInner() {
2525
+ const {
2526
+ instance: e
2527
+ } = this, t = e.getRemoteSearchEntry(), s = e.trigger.searchQuery === "" && !e.defaultOptions, n = s ? !1 : t.isLoaded && t.options.length === 0;
2528
+ return s ? this.renderSearchPromptTip() : t.isLoading ? this.renderLoadingOptionsTip() : t.loadingError ? this.renderAsyncSearchLoadingErrorTip() : n ? this.renderNoResultsTip() : this.renderOptionList();
2529
+ },
2530
+ renderOptionList() {
2531
+ const e = this.$createElement, {
2532
+ instance: t
2533
+ } = this;
2534
+ return e("div", {
2535
+ class: "vue-treeselect__list"
2536
+ }, [t.forest.normalizedOptions.map((s) => e(ws, {
2537
+ attrs: {
2538
+ node: s
2539
+ },
2540
+ key: s.id
2541
+ }))]);
2542
+ },
2543
+ renderSearchPromptTip() {
2544
+ const e = this.$createElement, {
2545
+ instance: t
2546
+ } = this;
2547
+ return e(v, {
2548
+ attrs: {
2549
+ type: "search-prompt",
2550
+ icon: "warning"
2551
+ }
2552
+ }, [t.searchPromptText]);
2553
+ },
2554
+ renderLoadingOptionsTip() {
2555
+ const e = this.$createElement, {
2556
+ instance: t
2557
+ } = this;
2558
+ return e(v, {
2559
+ attrs: {
2560
+ type: "loading",
2561
+ icon: "loader"
2562
+ }
2563
+ }, [t.loadingText]);
2564
+ },
2565
+ renderLoadingRootOptionsErrorTip() {
2566
+ const e = this.$createElement, {
2567
+ instance: t
2568
+ } = this;
2569
+ return e(v, {
2570
+ attrs: {
2571
+ type: "error",
2572
+ icon: "error"
2573
+ }
2574
+ }, [t.rootOptionsStates.loadingError, e("a", {
2575
+ class: "vue-treeselect__retry",
2576
+ on: {
2577
+ click: t.loadRootOptions
2578
+ },
2579
+ attrs: {
2580
+ title: t.retryTitle
2581
+ }
2582
+ }, [t.retryText])]);
2583
+ },
2584
+ renderAsyncSearchLoadingErrorTip() {
2585
+ const e = this.$createElement, {
2586
+ instance: t
2587
+ } = this, s = t.getRemoteSearchEntry();
2588
+ return e(v, {
2589
+ attrs: {
2590
+ type: "error",
2591
+ icon: "error"
2592
+ }
2593
+ }, [s.loadingError, e("a", {
2594
+ class: "vue-treeselect__retry",
2595
+ on: {
2596
+ click: t.handleRemoteSearch
2597
+ },
2598
+ attrs: {
2599
+ title: t.retryTitle
2600
+ }
2601
+ }, [t.retryText])]);
2602
+ },
2603
+ renderNoAvailableOptionsTip() {
2604
+ const e = this.$createElement, {
2605
+ instance: t
2606
+ } = this;
2607
+ return e(v, {
2608
+ attrs: {
2609
+ type: "no-options",
2610
+ icon: "warning"
2611
+ }
2612
+ }, [t.noOptionsText]);
2613
+ },
2614
+ renderNoResultsTip() {
2615
+ const e = this.$createElement, {
2616
+ instance: t
2617
+ } = this;
2618
+ return e(v, {
2619
+ attrs: {
2620
+ type: "no-results",
2621
+ icon: "warning"
2622
+ }
2623
+ }, [t.noResultsText]);
2624
+ },
2625
+ onMenuOpen() {
2626
+ this.adjustMenuOpenDirection(), this.setupMenuSizeWatcher(), this.setupMenuResizeAndScrollEventListeners();
2627
+ },
2628
+ onMenuClose() {
2629
+ this.removeMenuSizeWatcher(), this.removeMenuResizeAndScrollEventListeners();
2630
+ },
2631
+ adjustMenuOpenDirection() {
2632
+ const {
2633
+ instance: e
2634
+ } = this;
2635
+ if (!e.menu.isOpen)
2636
+ return;
2637
+ const t = e.getMenu(), s = e.getControl(), n = t.getBoundingClientRect(), i = s.getBoundingClientRect(), o = n.height, r = window.innerHeight, c = i.top, d = window.innerHeight - i.bottom, a = i.top >= 0 && i.top <= r || i.top < 0 && i.bottom > 0, m = d > o + re, p = c > o + re;
2638
+ a ? e.openDirection !== "auto" ? e.menu.placement = Cs[e.openDirection] : m || !p ? e.menu.placement = "bottom" : e.menu.placement = "top" : e.closeMenu();
2639
+ },
2640
+ setupMenuSizeWatcher() {
2641
+ const {
2642
+ instance: e
2643
+ } = this, t = e.getMenu();
2644
+ this.menuSizeWatcher || (this.menuSizeWatcher = {
2645
+ remove: be(t, this.adjustMenuOpenDirection)
2646
+ });
2647
+ },
2648
+ setupMenuResizeAndScrollEventListeners() {
2649
+ const {
2650
+ instance: e
2651
+ } = this, t = e.getControl();
2652
+ this.menuResizeAndScrollEventListeners || (this.menuResizeAndScrollEventListeners = {
2653
+ remove: $e(t, this.adjustMenuOpenDirection)
2654
+ });
2655
+ },
2656
+ removeMenuSizeWatcher() {
2657
+ this.menuSizeWatcher && (this.menuSizeWatcher.remove(), this.menuSizeWatcher = null);
2658
+ },
2659
+ removeMenuResizeAndScrollEventListeners() {
2660
+ this.menuResizeAndScrollEventListeners && (this.menuResizeAndScrollEventListeners.remove(), this.menuResizeAndScrollEventListeners = null);
2661
+ }
2662
+ },
2663
+ render() {
2664
+ const e = arguments[0];
2665
+ return e("div", {
2666
+ ref: "menu-container",
2667
+ class: "vue-treeselect__menu-container",
2668
+ style: this.menuContainerStyle
2669
+ }, [e("transition", {
2670
+ attrs: {
2671
+ name: "vue-treeselect__menu--transition"
2672
+ }
2673
+ }, [this.renderMenu()])]);
2674
+ }
2675
+ };
2676
+ let Ms, xs;
2677
+ const ve = {};
2678
+ var Ts = /* @__PURE__ */ f(
2679
+ Ls,
2680
+ Ms,
2681
+ xs,
2682
+ !1,
2683
+ Ds,
2684
+ null,
2685
+ null,
2686
+ null
2687
+ );
2688
+ function Ds(e) {
2689
+ for (let t in ve)
2690
+ this[t] = ve[t];
2691
+ }
2692
+ const Be = /* @__PURE__ */ function() {
2693
+ return Ts.exports;
2694
+ }(), Rs = {
2695
+ name: "VueTreeSelectPortalTarget",
2696
+ inject: ["instance"],
2697
+ watch: {
2698
+ "instance.menu.isOpen"(e) {
2699
+ e ? this.setupHandlers() : this.removeHandlers();
2700
+ },
2701
+ "instance.menu.placement"() {
2702
+ this.updateMenuContainerOffset();
2703
+ }
2704
+ },
2705
+ created() {
2706
+ this.controlResizeAndScrollEventListeners = null, this.controlSizeWatcher = null;
2707
+ },
2708
+ mounted() {
2709
+ const {
2710
+ instance: e
2711
+ } = this;
2712
+ e.menu.isOpen && this.setupHandlers();
2713
+ },
2714
+ methods: {
2715
+ setupHandlers() {
2716
+ this.updateWidth(), this.updateMenuContainerOffset(), this.setupControlResizeAndScrollEventListeners(), this.setupControlSizeWatcher();
2717
+ },
2718
+ removeHandlers() {
2719
+ this.removeControlResizeAndScrollEventListeners(), this.removeControlSizeWatcher();
2720
+ },
2721
+ setupControlResizeAndScrollEventListeners() {
2722
+ const {
2723
+ instance: e
2724
+ } = this, t = e.getControl();
2725
+ this.controlResizeAndScrollEventListeners || (this.controlResizeAndScrollEventListeners = {
2726
+ remove: $e(t, this.updateMenuContainerOffset)
2727
+ });
2728
+ },
2729
+ setupControlSizeWatcher() {
2730
+ const {
2731
+ instance: e
2732
+ } = this, t = e.getControl();
2733
+ this.controlSizeWatcher || (this.controlSizeWatcher = {
2734
+ remove: be(t, () => {
2735
+ this.updateWidth(), this.updateMenuContainerOffset();
2736
+ })
2737
+ });
2738
+ },
2739
+ removeControlResizeAndScrollEventListeners() {
2740
+ this.controlResizeAndScrollEventListeners && (this.controlResizeAndScrollEventListeners.remove(), this.controlResizeAndScrollEventListeners = null);
2741
+ },
2742
+ removeControlSizeWatcher() {
2743
+ this.controlSizeWatcher && (this.controlSizeWatcher.remove(), this.controlSizeWatcher = null);
2744
+ },
2745
+ updateWidth() {
2746
+ const {
2747
+ instance: e
2748
+ } = this, t = this.$el, n = e.getControl().getBoundingClientRect();
2749
+ t.style.width = `${n.width}px`;
2750
+ },
2751
+ updateMenuContainerOffset() {
2752
+ const {
2753
+ instance: e
2754
+ } = this, t = e.getControl(), s = this.$el, n = t.getBoundingClientRect(), i = s.getBoundingClientRect(), o = e.menu.placement === "bottom" ? n.height : 0, r = `${Math.round(n.left - i.left)}px`, c = `${Math.round(n.top - i.top + o)}px`, d = this.$refs.menu.$refs["menu-container"].style, m = Le(["transform", "webkitTransform", "MozTransform", "msTransform"], (p) => p in document.body.style);
2755
+ d[m] = `translate(${r}, ${c})`;
2756
+ }
2757
+ },
2758
+ render() {
2759
+ const e = arguments[0], {
2760
+ instance: t
2761
+ } = this, s = ["vue-treeselect__portal-target", t.wrapperClass], n = {
2762
+ zIndex: t.zIndex
2763
+ };
2764
+ return e("div", {
2765
+ class: s,
2766
+ style: n,
2767
+ attrs: {
2768
+ "data-instance-id": t.getInstanceId()
2769
+ }
2770
+ }, [e(Be, {
2771
+ ref: "menu"
2772
+ })]);
2773
+ },
2774
+ destroyed() {
2775
+ this.removeHandlers();
2776
+ }
2777
+ };
2778
+ let Q;
2779
+ const Is = {
2780
+ name: "VueTreeSelectMenuPortal",
2781
+ created() {
2782
+ this.portalTarget = null;
2783
+ },
2784
+ mounted() {
2785
+ this.setup();
2786
+ },
2787
+ destroyed() {
2788
+ this.teardown();
2789
+ },
2790
+ methods: {
2791
+ setup() {
2792
+ const e = document.createElement("div");
2793
+ document.body.appendChild(e), this.portalTarget = new Ye(_({
2794
+ el: e,
2795
+ parent: this
2796
+ }, Rs));
2797
+ },
2798
+ teardown() {
2799
+ document.body.removeChild(this.portalTarget.$el), this.portalTarget.$el.innerHTML = "", this.portalTarget.$destroy(), this.portalTarget = null;
2800
+ }
2801
+ },
2802
+ render() {
2803
+ const e = arguments[0];
2804
+ return Q || (Q = e("div", {
2805
+ class: "vue-treeselect__menu-placeholder"
2806
+ })), Q;
2807
+ }
2808
+ };
2809
+ let As, Vs;
2810
+ const Se = {};
2811
+ var Bs = /* @__PURE__ */ f(
2812
+ Is,
2813
+ As,
2814
+ Vs,
2815
+ !1,
2816
+ zs,
2817
+ null,
2818
+ null,
2819
+ null
2820
+ );
2821
+ function zs(e) {
2822
+ for (let t in Se)
2823
+ this[t] = Se[t];
2824
+ }
2825
+ const Fs = /* @__PURE__ */ function() {
2826
+ return Bs.exports;
2827
+ }(), ks = {
2828
+ name: "VueTreeSelect",
2829
+ mixins: [pt],
2830
+ computed: {
2831
+ wrapperClass() {
2832
+ return {
2833
+ "vue-treeselect": !0,
2834
+ "vue-treeselect--single": this.single,
2835
+ "vue-treeselect--multi": this.multiple,
2836
+ "vue-treeselect--searchable": this.searchable,
2837
+ "vue-treeselect--disabled": this.disabled,
2838
+ "vue-treeselect--focused": this.trigger.isFocused,
2839
+ "vue-treeselect--has-value": this.hasValue,
2840
+ "vue-treeselect--open": this.menu.isOpen,
2841
+ "vue-treeselect--open-above": this.menu.placement === "top",
2842
+ "vue-treeselect--open-below": this.menu.placement === "bottom",
2843
+ "vue-treeselect--branch-nodes-disabled": this.disableBranchNodes,
2844
+ "vue-treeselect--append-to-body": this.appendToBody
2845
+ };
2846
+ }
2847
+ },
2848
+ render() {
2849
+ const e = arguments[0];
2850
+ return e("div", {
2851
+ ref: "wrapper",
2852
+ class: this.wrapperClass
2853
+ }, [e(Ot), e(gs, {
2854
+ ref: "control"
2855
+ }), this.appendToBody ? e(Fs, {
2856
+ ref: "portal"
2857
+ }) : e(Be, {
2858
+ ref: "menu"
2859
+ })]);
2860
+ }
2861
+ };
2862
+ let Hs, Ps;
2863
+ const Oe = {};
2864
+ var Ws = /* @__PURE__ */ f(
2865
+ ks,
2866
+ Hs,
2867
+ Ps,
2868
+ !1,
2869
+ js,
2870
+ null,
2871
+ null,
2872
+ null
2873
+ );
2874
+ function js(e) {
2875
+ for (let t in Oe)
2876
+ this[t] = Oe[t];
2877
+ }
2878
+ const tn = /* @__PURE__ */ function() {
2879
+ return Ws.exports;
2880
+ }();
2881
+ export {
2882
+ tn as default
2883
+ };