@ozdao/prometheus-framework 0.1.11 → 0.1.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-cf9f6aed.js +1 -0
  2. package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-ec801e39.mjs +1945 -0
  3. package/dist/ButtonFollow-d4552677.mjs +131 -0
  4. package/dist/ButtonFollow-daa0e9e4.js +1 -0
  5. package/dist/CardOrganization-79eb2b6f.js +1 -0
  6. package/dist/CardOrganization-d3a9d898.mjs +230 -0
  7. package/dist/Feed-2c92ceed.js +1 -0
  8. package/dist/Feed-536c8a92.mjs +439 -0
  9. package/dist/Feed-a5229528.js +1 -0
  10. package/dist/Feed-bbe44c17.mjs +368 -0
  11. package/dist/Image-89b2a540.js +9 -0
  12. package/dist/Image-d42a89db.mjs +477 -0
  13. package/dist/Popup-f5cdd3c1.js +1 -0
  14. package/dist/Popup-fca78130.mjs +76 -0
  15. package/dist/Product-9170a446.mjs +838 -0
  16. package/dist/Product-dc5024f6.js +7 -0
  17. package/dist/ProductEdit-d74fddb1.mjs +350 -0
  18. package/dist/ProductEdit-e22cc4ef.js +1 -0
  19. package/dist/ProfileBlogposts-bf3cd8e5.mjs +64 -0
  20. package/dist/ProfileBlogposts-d1d3326e.js +1 -0
  21. package/dist/ProfileComments-1e0d72cc.mjs +44 -0
  22. package/dist/ProfileComments-c3290211.js +1 -0
  23. package/dist/ProfileEvents-314eadc3.js +1 -0
  24. package/dist/ProfileEvents-ba769f57.mjs +56 -0
  25. package/dist/ProfileLikes-36373ac1.mjs +44 -0
  26. package/dist/ProfileLikes-a2c1b585.js +1 -0
  27. package/dist/ProfileOrganizations-1f9f1841.js +1 -0
  28. package/dist/ProfileOrganizations-974a50ca.mjs +212 -0
  29. package/dist/Publics-5ae33b91.mjs +123 -0
  30. package/dist/Publics-8bc74cc3.js +1 -0
  31. package/dist/UploadImage-39483aee.mjs +83 -0
  32. package/dist/UploadImage-802b81db.js +1 -0
  33. package/dist/auth-3dedf391.js +8 -0
  34. package/dist/auth-c3234662.mjs +1836 -0
  35. package/dist/auth.client.cjs +1 -1
  36. package/dist/auth.client.js +3 -3
  37. package/dist/auth.validation-892bea9b.js +1 -0
  38. package/dist/auth.validation-c8d5adf5.mjs +20 -0
  39. package/dist/community.client.cjs +1 -1
  40. package/dist/community.client.js +10 -10
  41. package/dist/components/Field/Field.vue.d.ts.map +1 -1
  42. package/dist/events.client.cjs +1 -1
  43. package/dist/events.client.js +8 -8
  44. package/dist/main.css +1 -1
  45. package/dist/organizations-e1bfd3a8.mjs +121 -0
  46. package/dist/organizations-e74f4f84.js +1 -0
  47. package/dist/organizations.client-37ec4817.js +3 -0
  48. package/dist/organizations.client-52d2951c.mjs +3017 -0
  49. package/dist/organizations.client.cjs +1 -1
  50. package/dist/organizations.client.js +10 -10
  51. package/dist/prometheus-framework.cjs.js +1 -1
  52. package/dist/prometheus-framework.es.js +1 -1
  53. package/dist/style.css +1 -1
  54. package/dist/users.client.cjs +1 -1
  55. package/dist/users.client.js +9 -9
  56. package/package.json +1 -1
  57. package/src/components/Field/Field.svlt +73 -0
  58. package/src/components/Field/Field.vue +18 -19
  59. package/src/modules/community/components/sections/Feed.vue +3 -3
@@ -0,0 +1,1945 @@
1
+ import { withDirectives as $, openBlock as u, createElementBlock as d, vModelText as U, createCommentVNode as f, resolveComponent as J, normalizeClass as y, normalizeStyle as w, createElementVNode as h, Fragment as V, renderList as E, renderSlot as p, toDisplayString as b, createBlock as W, vShow as S, mergeProps as Y, withKeys as c, ref as B, computed as P, createVNode as I, unref as L, withModifiers as g, Transition as K, withCtx as N, createTextVNode as k } from "vue";
2
+ import { g as Q } from "./auth-c3234662.mjs";
3
+ import { _ as D } from "./_plugin-vue_export-helper-dad06003.mjs";
4
+ var X = function e(t, s) {
5
+ if (t === s)
6
+ return !0;
7
+ if (t && s && typeof t == "object" && typeof s == "object") {
8
+ if (t.constructor !== s.constructor)
9
+ return !1;
10
+ var l, a, r;
11
+ if (Array.isArray(t)) {
12
+ if (l = t.length, l != s.length)
13
+ return !1;
14
+ for (a = l; a-- !== 0; )
15
+ if (!e(t[a], s[a]))
16
+ return !1;
17
+ return !0;
18
+ }
19
+ if (t.constructor === RegExp)
20
+ return t.source === s.source && t.flags === s.flags;
21
+ if (t.valueOf !== Object.prototype.valueOf)
22
+ return t.valueOf() === s.valueOf();
23
+ if (t.toString !== Object.prototype.toString)
24
+ return t.toString() === s.toString();
25
+ if (r = Object.keys(t), l = r.length, l !== Object.keys(s).length)
26
+ return !1;
27
+ for (a = l; a-- !== 0; )
28
+ if (!Object.prototype.hasOwnProperty.call(s, r[a]))
29
+ return !1;
30
+ for (a = l; a-- !== 0; ) {
31
+ var i = r[a];
32
+ if (!e(t[i], s[i]))
33
+ return !1;
34
+ }
35
+ return !0;
36
+ }
37
+ return t !== t && s !== s;
38
+ };
39
+ const Z = /* @__PURE__ */ Q(X), x = (e, t) => t.filter((s) => {
40
+ const { text: l } = e;
41
+ if (typeof s.rule == "string")
42
+ return !new RegExp(s.rule).test(l);
43
+ if (s.rule instanceof RegExp)
44
+ return !s.rule.test(l);
45
+ if ({}.toString.call(s.rule) === "[object Function]")
46
+ return s.rule(e);
47
+ }).map((s) => s.classes), O = (e) => JSON.parse(JSON.stringify(e)), _ = (e, t) => {
48
+ let s = 0;
49
+ for (; s < e.length; ) {
50
+ if (t(e[s], s, e))
51
+ return s;
52
+ s++;
53
+ }
54
+ return -1;
55
+ }, j = (e, t, s = [], l) => {
56
+ e.text === void 0 && (e = { text: e });
57
+ const a = x(e, s), r = _(t, (m) => m === e), i = O(t), n = r !== -1 ? i.splice(r, 1)[0] : O(e);
58
+ return (l ? l(i, n) : i.map((m) => m.text).indexOf(n.text) !== -1) && a.push("ti-duplicate"), a.length === 0 ? a.push("ti-valid") : a.push("ti-invalid"), a;
59
+ }, C = (e, ...t) => {
60
+ e.text === void 0 && (e = { text: e });
61
+ const s = O(e);
62
+ return s.tiClasses = j(e, ...t), s;
63
+ }, ee = (e, ...t) => e.map((s) => C(s, e, ...t));
64
+ const te = {
65
+ name: "TagInput",
66
+ props: {
67
+ scope: {
68
+ type: Object
69
+ }
70
+ }
71
+ }, se = ["maxlength"];
72
+ function ie(e, t, s, l, a, r) {
73
+ return s.scope.edit ? $((u(), d("input", {
74
+ key: 0,
75
+ "onUpdate:modelValue": t[0] || (t[0] = (i) => s.scope.tag.text = i),
76
+ maxlength: s.scope.maxlength,
77
+ type: "text",
78
+ class: "ti-tag-input",
79
+ size: "1",
80
+ onInput: t[1] || (t[1] = (i) => s.scope.validateTag(s.scope.index, i)),
81
+ onBlur: t[2] || (t[2] = (i) => s.scope.performCancelEdit(s.scope.index)),
82
+ onKeydown: t[3] || (t[3] = (i) => s.scope.performSaveEdit(s.scope.index, i))
83
+ }, null, 40, se)), [
84
+ [U, s.scope.tag.text]
85
+ ]) : f("", !0);
86
+ }
87
+ const le = /* @__PURE__ */ D(te, [["render", ie], ["__scopeId", "data-v-a1f1c345"]]), R = (e) => !e.some((t) => {
88
+ const s = !t.text;
89
+ s && console.warn('Missing property "text"', t);
90
+ let l = !1;
91
+ return t.classes && (l = typeof t.classes != "string"), l && console.warn('Property "classes" must be type of string', t), s || l;
92
+ }), H = (e) => !e.some((t) => {
93
+ if (typeof t == "number") {
94
+ const s = isFinite(t) && Math.floor(t) === t;
95
+ return s || console.warn("Only numerics are allowed for this prop. Found:", t), !s;
96
+ } else if (typeof t == "string") {
97
+ const s = /\W|[a-z]|!\d/i.test(t);
98
+ return s || console.warn("Only alpha strings are allowed for this prop. Found:", t), !s;
99
+ } else
100
+ return console.warn("Only numeric and string values are allowed. Found:", t), !1;
101
+ }), ae = {
102
+ /**
103
+ * @description Property to bind a model to the input.
104
+ If the user changes the input value, the model updates, too.
105
+ If the user presses enter with an valid input,
106
+ a new tag is created with the value of this model.
107
+ After creating the new tag, the model is cleared.
108
+ * @property {props}
109
+ * @required
110
+ * @type {String}
111
+ * @model
112
+ * @default ''
113
+ */
114
+ modelValue: {
115
+ type: String,
116
+ default: "",
117
+ required: !0
118
+ },
119
+ /**
120
+ * @description Pass an array containing objects like in the example below.
121
+ The properties 'style' and 'class' are optional. Of course it is possible to add custom
122
+ properties to a tag object. vue-tags-input won't change the key and value.
123
+ * @property {props}
124
+ * @type {Array}
125
+ * @sync
126
+ * @default []
127
+ * @example
128
+ {
129
+ &emsp;text: 'My tag value', &#47;* The visible text on display *&#47;
130
+ &emsp;style: 'background-color: #ccc', &#47;* Adding inline styles is possible *&#47;
131
+ &emsp;classes: 'custom-class another', &#47;* The value will be added as css classes *&#47;
132
+ }
133
+ */
134
+ tags: {
135
+ type: Array,
136
+ default: () => [],
137
+ validator: R
138
+ },
139
+ /**
140
+ * @description Expects an array containing objects inside. The objects
141
+ can have the same properties as a tag object.
142
+ * @property {props}
143
+ * @type {Array}
144
+ * @default []
145
+ */
146
+ autocompleteItems: {
147
+ type: Array,
148
+ default: () => [],
149
+ validator: R
150
+ },
151
+ /**
152
+ * @description Defines whether a tag is editable after creation or not.
153
+ * @property {props}
154
+ * @type {Boolean}
155
+ * @default false
156
+ */
157
+ allowEditTags: {
158
+ type: Boolean,
159
+ default: !1
160
+ },
161
+ /**
162
+ * @description Defines if duplicate autocomplete items are filtered out from the view or not.
163
+ * @property {props}
164
+ * @type {Boolean}
165
+ * @default true
166
+ */
167
+ autocompleteFilterDuplicates: {
168
+ default: !0,
169
+ type: Boolean
170
+ },
171
+ /**
172
+ * @description If it's true, the user can add tags only via the autocomplete layer.
173
+ * @property {props}
174
+ * @type {Boolean}
175
+ * @default false
176
+ */
177
+ addOnlyFromAutocomplete: {
178
+ type: Boolean,
179
+ default: !1
180
+ },
181
+ /**
182
+ * @description The minimum character length which is required
183
+ until the autocomplete layer is shown. If set to 0,
184
+ then it'll be shown on focus.
185
+ * @property {props}
186
+ * @type {Number}
187
+ * @default 1
188
+ */
189
+ autocompleteMinLength: {
190
+ type: Number,
191
+ default: 1
192
+ },
193
+ /**
194
+ * @description If it's true, the autocomplete layer is always shown, regardless if
195
+ an input or an autocomplete items exists.
196
+ * @property {props}
197
+ * @type {Boolean}
198
+ * @default false
199
+ */
200
+ autocompleteAlwaysOpen: {
201
+ type: Boolean,
202
+ default: !1
203
+ },
204
+ /**
205
+ * @description Property to disable vue-tags-input.
206
+ * @property {props}
207
+ * @type {Boolean}
208
+ * @default false
209
+ */
210
+ disabled: {
211
+ type: Boolean,
212
+ default: !1
213
+ },
214
+ /**
215
+ * @description The placeholder text which is shown in the input, when it's empty.
216
+ * @property {props}
217
+ * @type {String}
218
+ * @default Add Tag
219
+ */
220
+ placeholder: {
221
+ type: String,
222
+ default: "Add Tag"
223
+ },
224
+ /**
225
+ * @description Custom trigger key codes can be registrated. If the user presses one of these,
226
+ a tag will be generated out of the input value. Can be either a numeric keyCode or the key
227
+ as a string.
228
+ * @property {props}
229
+ * @type {Array}
230
+ * @default [13]
231
+ * @example add-on-key="[13, ':', ';']"
232
+ */
233
+ addOnKey: {
234
+ type: Array,
235
+ default: () => [13],
236
+ validator: H
237
+ },
238
+ /**
239
+ * @description Custom trigger key codes can be registrated. If the user edits a tag
240
+ and presses one of these, the edited tag will be saved.
241
+ Can be either a numeric keyCode or the key as a string.
242
+ * @property {props}
243
+ * @type {Array}
244
+ * @default [13]
245
+ * @example save-on-key="[13, ':', ';']"
246
+ */
247
+ saveOnKey: {
248
+ type: Array,
249
+ default: () => [13],
250
+ validator: H
251
+ },
252
+ /**
253
+ * @description The maximum amount the tags array is allowed to hold.
254
+ * @property {props}
255
+ * @type {Number}
256
+ */
257
+ maxTags: {
258
+ type: Number
259
+ },
260
+ /**
261
+ * @description The maximum amount of characters the input is allowed to hold.
262
+ * @property {props}
263
+ * @type {Number}
264
+ */
265
+ maxlength: {
266
+ type: Number
267
+ },
268
+ /**
269
+ * @description Pass an array containing objects like in the example below.
270
+ The property 'classes' will be added as css classes, if the property 'rule' matches the text
271
+ of a tag, an autocomplete item or the input. The property 'rule' can be type of
272
+ RegExp or function. If the property 'disableAdd' is 'true', the item can't be added
273
+ to the tags array, if the appropriated rule matches.
274
+ * @property {props}
275
+ * @type {Array}
276
+ * @default []
277
+ * @example
278
+ {
279
+ &ensp;classes: 'class', &#47;* css class *&#47;
280
+ &ensp;rule: /^([^0-9]*)$/, &#47;* RegExp *&#47;
281
+ }, {
282
+ &ensp;classes: 'no-braces', &#47;* css class *&#47;
283
+ &ensp;rule(text) { &#47;* function with text as param *&#47;
284
+ &ensp;&ensp;return text.indexOf('{') !== -1 || text.indexOf('}') !== -1;
285
+ &ensp;},
286
+ &ensp;disableAdd: true, &#47;* if the rule matches, the item cannot be added *&#47;,
287
+ },
288
+ */
289
+ validation: {
290
+ type: Array,
291
+ default: () => [],
292
+ validator(e) {
293
+ return !e.some((t) => {
294
+ const s = !t.rule;
295
+ s && console.warn('Property "rule" is missing', t);
296
+ const l = t.rule && (typeof t.rule == "string" || t.rule instanceof RegExp || {}.toString.call(t.rule) === "[object Function]");
297
+ l || console.warn(
298
+ "A rule must be type of string, RegExp or function. Found:",
299
+ JSON.stringify(t.rule)
300
+ );
301
+ const a = !t.classes;
302
+ a && console.warn('Property "classes" is missing', t);
303
+ const r = t.type && typeof t.type != "string";
304
+ return r && console.warn('Property "type" must be type of string. Found:', t), !l || s || a || r;
305
+ });
306
+ }
307
+ },
308
+ /**
309
+ * @description Defines the characters which splits a text into different pieces,
310
+ to generate tags out of this pieces.
311
+ * @property {props}
312
+ * @type {Array}
313
+ * @default [';']
314
+ * @example
315
+ separators: [';', ',']
316
+ input: some; user input, has random; commas, an,d semicolons
317
+ will split into: some - user input - has random - commas - an - d semicolons
318
+ */
319
+ separators: {
320
+ type: Array,
321
+ default: () => [";"],
322
+ validator(e) {
323
+ return !e.some((t) => {
324
+ const s = typeof t != "string";
325
+ return s && console.warn("Separators must be type of string. Found:", t), s;
326
+ });
327
+ }
328
+ },
329
+ /**
330
+ * @description If it's true, the user can't add or save a tag,
331
+ if another exists, with the same text value.
332
+ * @property {props}
333
+ * @type {Boolean}
334
+ * @default true
335
+ */
336
+ avoidAddingDuplicates: {
337
+ type: Boolean,
338
+ default: !0
339
+ },
340
+ /**
341
+ * @description If the input holds a value and loses the focus,
342
+ a tag will be generated out of this value, if possible.
343
+ * @property {props}
344
+ * @type {Boolean}
345
+ * @default true
346
+ */
347
+ addOnBlur: {
348
+ type: Boolean,
349
+ default: !0
350
+ },
351
+ /**
352
+ * @description Custom function to detect duplicates. If the function returns 'true',
353
+ the tag will be marked as duplicate.
354
+ * @property {props}
355
+ * @type {Function}
356
+ * @param {Array} tagsarray The Array of tags minus the one which is edited/created.
357
+ * @param {Object} tag The tag which is edited or should be added to the tags array.
358
+ * @example
359
+ // The duplicate function to recreate the default behaviour, would look like this:
360
+ isDuplicate(tags, tag) {
361
+ &ensp;return tags.map(t => t.text).indexOf(tag.text) !== -1;
362
+ }
363
+ */
364
+ isDuplicate: {
365
+ type: Function,
366
+ default: null
367
+ },
368
+ /**
369
+ * @description If it's true, the user can paste into the input element and
370
+ vue-tags-input will create tags out of the incoming text.
371
+ * @property {props}
372
+ * @type {Boolean}
373
+ * @default true
374
+ */
375
+ addFromPaste: {
376
+ type: Boolean,
377
+ default: !0
378
+ },
379
+ /**
380
+ * @description Defines if it's possible to delete tags by pressing backspace.
381
+ If so and the user wants to delete a tag,
382
+ the tag gets the css class 'deletion-mark' for 1 second.
383
+ If the user presses backspace again in that time period,
384
+ the tag is removed from the tags array and the view.
385
+ * @property {props}
386
+ * @type {Boolean}
387
+ * @default true
388
+ */
389
+ deleteOnBackspace: {
390
+ default: !0,
391
+ type: Boolean
392
+ },
393
+ // event handlers
394
+ onBeforeAddingTag: Function,
395
+ onBeforeDeletingTag: Function,
396
+ onBeforeEditingTag: Function,
397
+ onBeforeSavingTag: Function
398
+ }, ne = {
399
+ name: "VueTagsInput",
400
+ components: { TagInput: le },
401
+ props: ae,
402
+ emits: [
403
+ "adding-duplicate",
404
+ "before-adding-tag",
405
+ "before-deleting-tag",
406
+ "before-editing-tag",
407
+ "before-saving-tag",
408
+ "max-tags-reached",
409
+ "saving-duplicate",
410
+ "tags-changed",
411
+ "tag-clicked",
412
+ "update:modelValue",
413
+ "update:tags"
414
+ ],
415
+ inheritAttrs: !1,
416
+ data() {
417
+ return {
418
+ tagCenter: [],
419
+ newTag: null,
420
+ tagsCopy: [],
421
+ tagsEditStatus: null,
422
+ deletionMark: null,
423
+ deletionMarkTime: null,
424
+ selectedItem: null,
425
+ focused: null
426
+ };
427
+ },
428
+ computed: {
429
+ // Property which calculates if the autocomplete should be opened or not
430
+ autocompleteOpen() {
431
+ return this.autocompleteAlwaysOpen ? !0 : this.newTag !== null && this.newTag.length >= this.autocompleteMinLength && this.filteredAutocompleteItems.length > 0 && this.focused;
432
+ },
433
+ // Returns validated autocomplete items. Maybe duplicates are filtered out
434
+ filteredAutocompleteItems() {
435
+ const e = this.autocompleteItems.map((t) => C(t, this.tags, this.validation, this.isDuplicate));
436
+ return this.autocompleteFilterDuplicates ? e.filter(this.duplicateFilter) : e;
437
+ }
438
+ },
439
+ methods: {
440
+ createClasses: j,
441
+ // Returns the index which item should be selected, based on the parameter 'method'
442
+ getSelectedIndex(e) {
443
+ const t = this.filteredAutocompleteItems, s = this.selectedItem, l = t.length - 1;
444
+ if (t.length !== 0)
445
+ return s === null ? 0 : e === "before" && s === 0 ? l : e === "after" && s === l ? 0 : e === "after" ? s + 1 : s - 1;
446
+ },
447
+ selectDefaultItem() {
448
+ this.addOnlyFromAutocomplete && this.filteredAutocompleteItems.length > 0 ? this.selectedItem = 0 : this.selectedItem = null;
449
+ },
450
+ selectItem(e, t) {
451
+ e.preventDefault(), this.selectedItem = this.getSelectedIndex(t);
452
+ },
453
+ isSelected(e) {
454
+ return this.selectedItem === e;
455
+ },
456
+ isMarked(e) {
457
+ return this.deletionMark === e;
458
+ },
459
+ // Save ref for tag
460
+ setTagCenter(e) {
461
+ e && this.tagCenter.push(e);
462
+ },
463
+ // Method which is called when the user presses backspace → remove the last tag
464
+ invokeDelete() {
465
+ if (!this.deleteOnBackspace || this.newTag.length > 0)
466
+ return;
467
+ const e = this.tagsCopy.length - 1;
468
+ this.deletionMark === null ? (this.deletionMarkTime = setTimeout(() => this.deletionMark = null, 1e3), this.deletionMark = e) : this.performDeleteTag(e);
469
+ },
470
+ addTagsFromPaste() {
471
+ this.addFromPaste && setTimeout(() => this.performAddTags(this.newTag), 10);
472
+ },
473
+ // Method to call if a tag should switch to it's edit mode
474
+ performEditTag(e) {
475
+ this.allowEditTags && (this.onBeforeAddingTag || this.editTag(e), this.$emit("before-editing-tag", {
476
+ index: e,
477
+ tag: this.tagsCopy[e],
478
+ editTag: () => this.editTag(e)
479
+ }));
480
+ },
481
+ // Opens the edit mode for a tag and focuses it
482
+ editTag(e) {
483
+ this.allowEditTags && (this.toggleEditMode(e), this.focus(e));
484
+ },
485
+ // Toggles the edit mode for a tag
486
+ toggleEditMode(e) {
487
+ !this.allowEditTags || this.disabled || (this.tagsEditStatus[e] = !this.tagsEditStatus[e]);
488
+ },
489
+ // only called by the @input event from TagInput.
490
+ // Creates a new tag model and applys it to this.tagsCopy[index]
491
+ createChangedTag(e, t) {
492
+ const s = this.tagsCopy[e];
493
+ s.text = t ? t.target.value : this.tagsCopy[e].text, this.tagsCopy[e] = C(s, this.tagsCopy, this.validation, this.isDuplicate);
494
+ },
495
+ // Focuses the input of a tag
496
+ focus(e) {
497
+ this.$nextTick(() => {
498
+ const t = this.tagCenter[e].querySelector("input.ti-tag-input");
499
+ t && t.focus();
500
+ });
501
+ },
502
+ quote(e) {
503
+ return e.replace(/([()[{*+.$^\\|?])/g, "\\$1");
504
+ },
505
+ // Cancels the edit mode for a tag → resets the tag to it's original model!
506
+ cancelEdit(e) {
507
+ this.tags[e] && (this.tagsCopy[e] = O(
508
+ C(this.tags[e], this.tags, this.validation, this.isDuplicate)
509
+ ), this.tagsEditStatus[e] = !1);
510
+ },
511
+ hasForbiddingAddRule(e) {
512
+ return e.some((t) => {
513
+ const s = this.validation.find((l) => t === l.classes);
514
+ return s ? s.disableAdd : !1;
515
+ });
516
+ },
517
+ // Creates multiple tags out of a string, based on the prop separators
518
+ createTagTexts(e) {
519
+ const t = new RegExp(this.separators.map((s) => this.quote(s)).join("|"));
520
+ return e.split(t).map((s) => ({ text: s }));
521
+ },
522
+ // Method to call to delete a tag
523
+ performDeleteTag(e) {
524
+ this.onBeforeDeletingTag || this.deleteTag(e), this.$emit("before-deleting-tag", {
525
+ index: e,
526
+ tag: this.tagsCopy[e],
527
+ deleteTag: () => this.deleteTag(e)
528
+ });
529
+ },
530
+ deleteTag(e) {
531
+ this.disabled || (this.deletionMark = null, clearTimeout(this.deletionMarkTime), this.tagsCopy.splice(e, 1), this.$emit("update:tags", this.tagsCopy), this.$emit("tags-changed", this.tagsCopy));
532
+ },
533
+ // Decides wether the input keyCode is one, which is allowed to modify/add tags
534
+ noTriggerKey(e, t) {
535
+ const s = this[t].indexOf(e.keyCode) !== -1 || this[t].indexOf(e.key) !== -1;
536
+ return s && e.preventDefault(), !s;
537
+ },
538
+ // Method to call to add a tag
539
+ performAddTags(e, t, s) {
540
+ if (this.disabled || t && this.noTriggerKey(t, "addOnKey"))
541
+ return;
542
+ let l = [];
543
+ typeof e == "object" && (l = [e]), typeof e == "string" && (l = this.createTagTexts(e)), l = l.filter((a) => a.text.trim().length > 0), l.forEach((a) => {
544
+ a = C(a, this.tags, this.validation, this.isDuplicate), this.onBeforeAddingTag || this.addTag(a, s), this.$emit("before-adding-tag", {
545
+ tag: a,
546
+ addTag: () => this.addTag(a, s)
547
+ });
548
+ });
549
+ },
550
+ duplicateFilter(e) {
551
+ return this.isDuplicate ? !this.isDuplicate(this.tagsCopy, e) : !this.tagsCopy.find((t) => t.text === e.text);
552
+ },
553
+ addTag(e, t = "new-tag-input") {
554
+ const s = this.filteredAutocompleteItems.map((l) => l.text);
555
+ this.addOnlyFromAutocomplete && s.indexOf(e.text) === -1 || this.$nextTick(() => {
556
+ if (this.maxTags && this.maxTags <= this.tagsCopy.length)
557
+ return this.$emit("max-tags-reached", e);
558
+ if (this.avoidAddingDuplicates && !this.duplicateFilter(e))
559
+ return this.$emit("adding-duplicate", e);
560
+ this.hasForbiddingAddRule(e.tiClasses) || (this.newTag = "", this.tagsCopy.push(e), this.$emit("update:tags", this.tagsCopy), t === "autocomplete" && this.$refs.newTagInput.focus(), this.$emit("tags-changed", this.tagsCopy));
561
+ });
562
+ },
563
+ // Method to call to save a tag
564
+ performSaveTag(e, t) {
565
+ const s = this.tagsCopy[e];
566
+ this.disabled || t && this.noTriggerKey(t, "addOnKey") || s.text.trim().length !== 0 && (this["on-before-saving-tag"] || this.saveTag(e, s), this.$emit("before-saving-tag", {
567
+ index: e,
568
+ tag: s,
569
+ saveTag: () => this.saveTag(e, s)
570
+ }));
571
+ },
572
+ saveTag(e, t) {
573
+ if (this.avoidAddingDuplicates) {
574
+ const s = O(this.tagsCopy), l = s.splice(e, 1)[0];
575
+ if (this.isDuplicate ? this.isDuplicate(s, l) : s.map((r) => r.text).indexOf(l.text) !== -1)
576
+ return this.$emit("saving-duplicate", t);
577
+ }
578
+ this.hasForbiddingAddRule(t.tiClasses) || (this.tagsCopy[e] = t, this.toggleEditMode(e), this.$emit("update:tags", this.tagsCopy), this.$emit("tags-changed", this.tagsCopy));
579
+ },
580
+ tagsEqual() {
581
+ return !this.tagsCopy.some((e, t) => !Z(e, this.tags[t]));
582
+ },
583
+ updateNewTag(e) {
584
+ const t = e.target.value;
585
+ this.newTag = t, this.$emit("update:modelValue", t);
586
+ },
587
+ initTags() {
588
+ this.tagsCopy = ee(this.tags, this.validation, this.isDuplicate), this.tagsEditStatus = O(this.tags).map(() => !1), this.tagsEqual() || this.$emit("update:tags", this.tagsCopy);
589
+ },
590
+ blurredOnClick(e) {
591
+ this.$el.contains(e.target) || this.$el.contains(document.activeElement) || this.performBlur(e);
592
+ },
593
+ performBlur() {
594
+ this.addOnBlur && this.focused && this.performAddTags(this.newTag), this.focused = !1;
595
+ }
596
+ },
597
+ watch: {
598
+ modelValue(e) {
599
+ this.addOnlyFromAutocomplete || (this.selectedItem = null), this.newTag = e;
600
+ },
601
+ tags: {
602
+ handler() {
603
+ this.initTags();
604
+ },
605
+ deep: !0
606
+ },
607
+ autocompleteOpen: "selectDefaultItem"
608
+ },
609
+ created() {
610
+ this.newTag = this.modelValue, this.initTags();
611
+ },
612
+ mounted() {
613
+ this.selectDefaultItem(), document.addEventListener("click", this.blurredOnClick);
614
+ },
615
+ beforeUpdate() {
616
+ this.tagCenter = [];
617
+ },
618
+ unmounted() {
619
+ document.removeEventListener("click", this.blurredOnClick);
620
+ }
621
+ };
622
+ const re = { class: "ti-input" }, oe = {
623
+ key: 0,
624
+ class: "ti-tags"
625
+ }, ue = ["onClick"], de = { class: "ti-content" }, he = {
626
+ key: 0,
627
+ class: "ti-tag-left"
628
+ }, pe = ["onClick"], ge = {
629
+ key: 1,
630
+ class: "ti-tag-right"
631
+ }, fe = { class: "ti-actions" }, ce = ["onClick"], me = ["onClick"], ye = { class: "ti-new-tag-input-wrapper" }, be = ["placeholder", "value", "maxlength", "disabled"], ve = ["onMouseover"], Te = ["onClick"];
632
+ function $e(e, t, s, l, a, r) {
633
+ const i = J("tag-input");
634
+ return u(), d("div", {
635
+ class: y(["vue-tags-input", [{ "ti-disabled": e.disabled }, { "ti-focus": e.focused }, e.$attrs.class]]),
636
+ style: w(e.$attrs.style)
637
+ }, [
638
+ h("div", re, [
639
+ e.tagsCopy ? (u(), d("ul", oe, [
640
+ (u(!0), d(V, null, E(e.tagsCopy, (n, o) => (u(), d("li", {
641
+ key: o,
642
+ style: w(n.style),
643
+ class: y([[
644
+ { "ti-editing": e.tagsEditStatus[o] },
645
+ n.tiClasses,
646
+ n.classes,
647
+ { "ti-deletion-mark": e.isMarked(o) }
648
+ ], "ti-tag"]),
649
+ tabindex: "0",
650
+ onClick: (m) => e.$emit("tag-clicked", { tag: n, index: o })
651
+ }, [
652
+ h("div", de, [
653
+ e.$slots["tag-left"] ? (u(), d("div", he, [
654
+ p(e.$slots, "tag-left", {
655
+ tag: n,
656
+ index: o,
657
+ edit: e.tagsEditStatus[o],
658
+ performSaveEdit: e.performSaveTag,
659
+ performDelete: e.performDeleteTag,
660
+ performCancelEdit: e.cancelEdit,
661
+ performOpenEdit: e.performEditTag,
662
+ deletionMark: e.isMarked(o)
663
+ }, void 0, !0)
664
+ ])) : f("", !0),
665
+ h("div", {
666
+ ref_for: !0,
667
+ ref: e.setTagCenter,
668
+ class: "ti-tag-center"
669
+ }, [
670
+ e.$slots["tag-center"] ? f("", !0) : (u(), d("span", {
671
+ key: 0,
672
+ class: y({ "ti-hidden": e.tagsEditStatus[o] }),
673
+ onClick: (m) => e.performEditTag(o)
674
+ }, b(n.text), 11, pe)),
675
+ e.$slots["tag-center"] ? f("", !0) : (u(), W(i, {
676
+ key: 1,
677
+ scope: {
678
+ edit: e.tagsEditStatus[o],
679
+ maxlength: e.maxlength,
680
+ tag: n,
681
+ index: o,
682
+ validateTag: e.createChangedTag,
683
+ performCancelEdit: e.cancelEdit,
684
+ performSaveEdit: e.performSaveTag
685
+ }
686
+ }, null, 8, ["scope"])),
687
+ p(e.$slots, "tag-center", {
688
+ tag: n,
689
+ index: o,
690
+ maxlength: e.maxlength,
691
+ edit: e.tagsEditStatus[o],
692
+ performSaveEdit: e.performSaveTag,
693
+ performDelete: e.performDeleteTag,
694
+ performCancelEdit: e.cancelEdit,
695
+ validateTag: e.createChangedTag,
696
+ performOpenEdit: e.performEditTag,
697
+ deletionMark: e.isMarked(o)
698
+ }, void 0, !0)
699
+ ], 512),
700
+ e.$slots["tag-right"] ? (u(), d("div", ge, [
701
+ p(e.$slots, "tag-right", {
702
+ tag: n,
703
+ index: o,
704
+ edit: e.tagsEditStatus[o],
705
+ performSaveEdit: e.performSaveTag,
706
+ performDelete: e.performDeleteTag,
707
+ performCancelEdit: e.cancelEdit,
708
+ performOpenEdit: e.performEditTag,
709
+ deletionMark: e.isMarked(o)
710
+ }, void 0, !0)
711
+ ])) : f("", !0)
712
+ ]),
713
+ h("div", fe, [
714
+ e.$slots["tag-actions"] ? f("", !0) : $((u(), d("i", {
715
+ key: 0,
716
+ class: "ti-icon-undo",
717
+ onClick: (m) => e.cancelEdit(o)
718
+ }, null, 8, ce)), [
719
+ [S, e.tagsEditStatus[o]]
720
+ ]),
721
+ e.$slots["tag-actions"] ? f("", !0) : $((u(), d("i", {
722
+ key: 1,
723
+ class: "ti-icon-close",
724
+ onClick: (m) => e.performDeleteTag(o)
725
+ }, null, 8, me)), [
726
+ [S, !e.tagsEditStatus[o]]
727
+ ]),
728
+ e.$slots["tag-actions"] ? p(e.$slots, "tag-actions", {
729
+ key: 2,
730
+ tag: n,
731
+ index: o,
732
+ edit: e.tagsEditStatus[o],
733
+ performSaveEdit: e.performSaveTag,
734
+ performDelete: e.performDeleteTag,
735
+ performCancelEdit: e.cancelEdit,
736
+ performOpenEdit: e.performEditTag,
737
+ deletionMark: e.isMarked(o)
738
+ }, void 0, !0) : f("", !0)
739
+ ])
740
+ ], 14, ue))), 128)),
741
+ h("li", ye, [
742
+ h("input", Y({ ref: "newTagInput" }, e.$attrs, {
743
+ class: [[e.createClasses(e.newTag, e.tags, e.validation, e.isDuplicate)], "ti-new-tag-input"],
744
+ placeholder: e.placeholder,
745
+ value: e.newTag,
746
+ maxlength: e.maxlength,
747
+ disabled: e.disabled,
748
+ type: "text",
749
+ size: "1",
750
+ onKeydown: [
751
+ t[0] || (t[0] = (n) => e.performAddTags(
752
+ e.filteredAutocompleteItems[e.selectedItem] || e.newTag,
753
+ n
754
+ )),
755
+ t[2] || (t[2] = c((...n) => e.invokeDelete && e.invokeDelete(...n), ["delete"])),
756
+ t[3] || (t[3] = c((...n) => e.performBlur && e.performBlur(...n), ["tab"])),
757
+ t[4] || (t[4] = c((n) => e.selectItem(n, "before"), ["up"])),
758
+ t[5] || (t[5] = c((n) => e.selectItem(n, "after"), ["down"]))
759
+ ],
760
+ onPaste: t[1] || (t[1] = (...n) => e.addTagsFromPaste && e.addTagsFromPaste(...n)),
761
+ onInput: t[6] || (t[6] = (...n) => e.updateNewTag && e.updateNewTag(...n)),
762
+ onFocus: t[7] || (t[7] = (n) => e.focused = !0),
763
+ onClick: t[8] || (t[8] = (n) => e.addOnlyFromAutocomplete ? !1 : e.selectedItem = null)
764
+ }), null, 16, be)
765
+ ])
766
+ ])) : f("", !0)
767
+ ]),
768
+ p(e.$slots, "between-elements", {}, void 0, !0),
769
+ e.autocompleteOpen ? (u(), d("div", {
770
+ key: 0,
771
+ class: y(["ti-autocomplete", e.$attrs.class]),
772
+ onMouseout: t[9] || (t[9] = (n) => e.selectedItem = null)
773
+ }, [
774
+ p(e.$slots, "autocomplete-header", {}, void 0, !0),
775
+ h("ul", null, [
776
+ (u(!0), d(V, null, E(e.filteredAutocompleteItems, (n, o) => (u(), d("li", {
777
+ key: o,
778
+ style: w(n.style),
779
+ class: y([[
780
+ n.tiClasses,
781
+ n.classes,
782
+ { "ti-selected-item": e.isSelected(o) }
783
+ ], "ti-item"]),
784
+ onMouseover: (m) => e.disabled ? !1 : e.selectedItem = o
785
+ }, [
786
+ e.$slots["autocomplete-item"] ? p(e.$slots, "autocomplete-item", {
787
+ key: 1,
788
+ item: n,
789
+ index: o,
790
+ performAdd: (m) => e.performAddTags(m, void 0, "autocomplete"),
791
+ selected: e.isSelected(o)
792
+ }, void 0, !0) : (u(), d("div", {
793
+ key: 0,
794
+ onClick: (m) => e.performAddTags(n, void 0, "autocomplete")
795
+ }, b(n.text), 9, Te))
796
+ ], 46, ve))), 128))
797
+ ]),
798
+ p(e.$slots, "autocomplete-footer", {}, void 0, !0)
799
+ ], 34)) : f("", !0)
800
+ ], 6);
801
+ }
802
+ const Se = /* @__PURE__ */ D(ne, [["render", $e], ["__scopeId", "data-v-d14eec25"]]);
803
+ const we = /* @__PURE__ */ h("h5", { class: "mn-thin" }, "Tags (maximum 20):", -1), Oe = { class: "mn-medium" }, ke = /* @__PURE__ */ h("p", { class: "p-small mn-thin" }, "Suggested:", -1), Ce = ["onClick"], Ve = { key: 1 }, nt = {
804
+ __name: "BlockTags",
805
+ props: ["tags"],
806
+ emits: ["tags-changed"],
807
+ setup(e, { emit: t }) {
808
+ const s = e, l = B(""), a = B([]), r = B([
809
+ { text: "story" },
810
+ { text: "news" },
811
+ { text: "guide" },
812
+ { text: "discussion" },
813
+ { text: "photos" }
814
+ ]);
815
+ s.tags && (a.value = s.tags.map((v) => ({ text: v })));
816
+ const i = P(() => r.value.filter((v) => v.text.toLowerCase().includes(l.value.toLowerCase()))), n = P(() => r.value.filter((v) => !a.value.some((T) => T.text === v.text)));
817
+ function o(v) {
818
+ a.value.push(v), t("tags-changed", a.value.map((T) => T.text));
819
+ }
820
+ function m(v) {
821
+ a.value = v, t("tags-changed", a.value.map((T) => T.text));
822
+ }
823
+ return (v, T) => (u(), d("div", null, [
824
+ we,
825
+ I(Se, {
826
+ modelValue: l.value,
827
+ "onUpdate:modelValue": T[0] || (T[0] = (A) => l.value = A),
828
+ tags: a.value,
829
+ "autocomplete-items": L(i),
830
+ "add-on-key": [13, ":", ";", ","],
831
+ "save-on-key": [13, ":", ";", ","],
832
+ separators: [";", ","],
833
+ "max-tags": 20,
834
+ maxlength: 20,
835
+ placeholder: "Please add tags",
836
+ "add-from-paste": !0,
837
+ "allow-edit-tags": !0,
838
+ onTagsChanged: m,
839
+ class: "mn-thin bg-grey radius-medium pd-small"
840
+ }, null, 8, ["modelValue", "tags", "autocomplete-items"]),
841
+ h("p", Oe, [
842
+ ke,
843
+ L(n).length > 0 ? (u(!0), d(V, { key: 0 }, E(L(n), (A, z) => (u(), d("span", {
844
+ onClick: (st) => o(A),
845
+ class: y(["cursor-pointer ti-tag-toDefactor", { "mn-r-micro": z !== L(n).length - 1 }])
846
+ }, b(A.text), 11, Ce))), 256)) : (u(), d("span", Ve, "You added all suggested tags"))
847
+ ])
848
+ ]));
849
+ }
850
+ };
851
+ const Ee = { class: "flex-v-center flex-nowrap flex" }, Ae = {
852
+ key: 0,
853
+ class: "mn-r-auto t-transp mn-r-small"
854
+ }, Le = ["name", "value", "checked"], De = {
855
+ __name: "Checkbox",
856
+ props: {
857
+ label: String,
858
+ name: String,
859
+ value: String,
860
+ radio: {
861
+ type: [Array, Boolean, Object],
862
+ default: () => []
863
+ }
864
+ },
865
+ emits: ["update:radio"],
866
+ setup(e, { emit: t }) {
867
+ const s = e, l = (a) => {
868
+ if (Array.isArray(s.radio)) {
869
+ let r = [...s.radio];
870
+ if (a.target.checked)
871
+ r.push(s.value);
872
+ else {
873
+ const i = r.indexOf(s.value);
874
+ i !== -1 && r.splice(i, 1);
875
+ }
876
+ t("update:radio", r);
877
+ } else
878
+ typeof s.radio == "boolean" && t("update:radio", a.target.checked);
879
+ };
880
+ return (a, r) => (u(), d("label", Ee, [
881
+ e.label ? (u(), d("div", Ae, [
882
+ h("span", null, b(e.label), 1)
883
+ ])) : f("", !0),
884
+ h("input", {
885
+ onChange: l,
886
+ class: "round radiobutton",
887
+ type: "checkbox",
888
+ name: e.name,
889
+ value: e.value,
890
+ checked: Array.isArray(e.radio) ? e.radio.includes(e.value) : e.radio
891
+ }, null, 40, Le),
892
+ h("div", {
893
+ class: y(["transition-elastic pd-thin h-2r w-4r radius-extra", {
894
+ "bg-grey": !(Array.isArray(e.radio) ? e.radio.includes(e.value) : e.radio),
895
+ "bg-main": Array.isArray(e.radio) ? e.radio.includes(e.value) : e.radio
896
+ }])
897
+ }, [
898
+ h("div", {
899
+ class: y(["transition-linear w-1r h-1r radius-extra h-100 bg-white", {
900
+ "mn-r-auto": !(Array.isArray(e.radio) ? e.radio.includes(e.value) : e.radio),
901
+ "mn-l-auto": Array.isArray(e.radio) ? e.radio.includes(e.value) : e.radio
902
+ }])
903
+ }, null, 2)
904
+ ], 2)
905
+ ]));
906
+ }
907
+ }, rt = /* @__PURE__ */ D(De, [["__scopeId", "data-v-f641f618"]]);
908
+ function M(e) {
909
+ return e === 0 ? !1 : Array.isArray(e) && e.length === 0 ? !0 : !e;
910
+ }
911
+ function Be(e) {
912
+ return (...t) => !e(...t);
913
+ }
914
+ function Me(e, t) {
915
+ return e === void 0 && (e = "undefined"), e === null && (e = "null"), e === !1 && (e = "false"), e.toString().toLowerCase().indexOf(t.trim()) !== -1;
916
+ }
917
+ function q(e, t, s, l) {
918
+ return t ? e.filter((a) => Me(l(a, s), t)).sort((a, r) => l(a, s).length - l(r, s).length) : e;
919
+ }
920
+ function Fe(e) {
921
+ return e.filter((t) => !t.$isLabel);
922
+ }
923
+ function F(e, t) {
924
+ return (s) => s.reduce((l, a) => a[e] && a[e].length ? (l.push({
925
+ $groupLabel: a[t],
926
+ $isLabel: !0
927
+ }), l.concat(a[e])) : l, []);
928
+ }
929
+ function Ie(e, t, s, l, a) {
930
+ return (r) => r.map((i) => {
931
+ if (!i[s])
932
+ return console.warn("Options passed to vue-multiselect do not contain groups, despite the config."), [];
933
+ const n = q(i[s], e, t, a);
934
+ return n.length ? {
935
+ [l]: i[l],
936
+ [s]: n
937
+ } : [];
938
+ });
939
+ }
940
+ const G = (...e) => (t) => e.reduce((s, l) => l(s), t), Pe = {
941
+ data() {
942
+ return {
943
+ search: "",
944
+ isOpen: !1,
945
+ preferredOpenDirection: "below",
946
+ optimizedHeight: this.maxHeight
947
+ };
948
+ },
949
+ props: {
950
+ /**
951
+ * Decide whether to filter the results based on search query.
952
+ * Useful for async filtering, where we search through more complex data.
953
+ * @type {Boolean}
954
+ */
955
+ internalSearch: {
956
+ type: Boolean,
957
+ default: !0
958
+ },
959
+ /**
960
+ * Array of available options: Objects, Strings or Integers.
961
+ * If array of objects, visible label will default to option.label.
962
+ * If `labal` prop is passed, label will equal option['label']
963
+ * @type {Array}
964
+ */
965
+ options: {
966
+ type: Array,
967
+ required: !0
968
+ },
969
+ /**
970
+ * Equivalent to the `multiple` attribute on a `<select>` input.
971
+ * @default false
972
+ * @type {Boolean}
973
+ */
974
+ multiple: {
975
+ type: Boolean,
976
+ default: !1
977
+ },
978
+ /**
979
+ * Key to compare objects
980
+ * @default 'id'
981
+ * @type {String}
982
+ */
983
+ trackBy: {
984
+ type: String
985
+ },
986
+ /**
987
+ * Label to look for in option Object
988
+ * @default 'label'
989
+ * @type {String}
990
+ */
991
+ label: {
992
+ type: String
993
+ },
994
+ /**
995
+ * Enable/disable search in options
996
+ * @default true
997
+ * @type {Boolean}
998
+ */
999
+ searchable: {
1000
+ type: Boolean,
1001
+ default: !0
1002
+ },
1003
+ /**
1004
+ * Clear the search input after `)
1005
+ * @default true
1006
+ * @type {Boolean}
1007
+ */
1008
+ clearOnSelect: {
1009
+ type: Boolean,
1010
+ default: !0
1011
+ },
1012
+ /**
1013
+ * Hide already selected options
1014
+ * @default false
1015
+ * @type {Boolean}
1016
+ */
1017
+ hideSelected: {
1018
+ type: Boolean,
1019
+ default: !1
1020
+ },
1021
+ /**
1022
+ * Equivalent to the `placeholder` attribute on a `<select>` input.
1023
+ * @default 'Select option'
1024
+ * @type {String}
1025
+ */
1026
+ placeholder: {
1027
+ type: String,
1028
+ default: "Select option"
1029
+ },
1030
+ /**
1031
+ * Allow to remove all selected values
1032
+ * @default true
1033
+ * @type {Boolean}
1034
+ */
1035
+ allowEmpty: {
1036
+ type: Boolean,
1037
+ default: !0
1038
+ },
1039
+ /**
1040
+ * Reset this.internalValue, this.search after this.internalValue changes.
1041
+ * Useful if want to create a stateless dropdown.
1042
+ * @default false
1043
+ * @type {Boolean}
1044
+ */
1045
+ resetAfter: {
1046
+ type: Boolean,
1047
+ default: !1
1048
+ },
1049
+ /**
1050
+ * Enable/disable closing after selecting an option
1051
+ * @default true
1052
+ * @type {Boolean}
1053
+ */
1054
+ closeOnSelect: {
1055
+ type: Boolean,
1056
+ default: !0
1057
+ },
1058
+ /**
1059
+ * Function to interpolate the custom label
1060
+ * @default false
1061
+ * @type {Function}
1062
+ */
1063
+ customLabel: {
1064
+ type: Function,
1065
+ default(e, t) {
1066
+ return M(e) ? "" : t ? e[t] : e;
1067
+ }
1068
+ },
1069
+ /**
1070
+ * Disable / Enable tagging
1071
+ * @default false
1072
+ * @type {Boolean}
1073
+ */
1074
+ taggable: {
1075
+ type: Boolean,
1076
+ default: !1
1077
+ },
1078
+ /**
1079
+ * String to show when highlighting a potential tag
1080
+ * @default 'Press enter to create a tag'
1081
+ * @type {String}
1082
+ */
1083
+ tagPlaceholder: {
1084
+ type: String,
1085
+ default: "Press enter to create a tag"
1086
+ },
1087
+ /**
1088
+ * By default new tags will appear above the search results.
1089
+ * Changing to 'bottom' will revert this behaviour
1090
+ * and will proritize the search results
1091
+ * @default 'top'
1092
+ * @type {String}
1093
+ */
1094
+ tagPosition: {
1095
+ type: String,
1096
+ default: "top"
1097
+ },
1098
+ /**
1099
+ * Number of allowed selected options. No limit if 0.
1100
+ * @default 0
1101
+ * @type {Number}
1102
+ */
1103
+ max: {
1104
+ type: [Number, Boolean],
1105
+ default: !1
1106
+ },
1107
+ /**
1108
+ * Will be passed with all events as second param.
1109
+ * Useful for identifying events origin.
1110
+ * @default null
1111
+ * @type {String|Integer}
1112
+ */
1113
+ id: {
1114
+ default: null
1115
+ },
1116
+ /**
1117
+ * Limits the options displayed in the dropdown
1118
+ * to the first X options.
1119
+ * @default 1000
1120
+ * @type {Integer}
1121
+ */
1122
+ optionsLimit: {
1123
+ type: Number,
1124
+ default: 1e3
1125
+ },
1126
+ /**
1127
+ * Name of the property containing
1128
+ * the group values
1129
+ * @default 1000
1130
+ * @type {String}
1131
+ */
1132
+ groupValues: {
1133
+ type: String
1134
+ },
1135
+ /**
1136
+ * Name of the property containing
1137
+ * the group label
1138
+ * @default 1000
1139
+ * @type {String}
1140
+ */
1141
+ groupLabel: {
1142
+ type: String
1143
+ },
1144
+ /**
1145
+ * Allow to select all group values
1146
+ * by selecting the group label
1147
+ * @default false
1148
+ * @type {Boolean}
1149
+ */
1150
+ groupSelect: {
1151
+ type: Boolean,
1152
+ default: !1
1153
+ },
1154
+ /**
1155
+ * Array of keyboard keys to block
1156
+ * when selecting
1157
+ * @default 1000
1158
+ * @type {String}
1159
+ */
1160
+ blockKeys: {
1161
+ type: Array,
1162
+ default() {
1163
+ return [];
1164
+ }
1165
+ },
1166
+ /**
1167
+ * Prevent from wiping up the search value
1168
+ * @default false
1169
+ * @type {Boolean}
1170
+ */
1171
+ preserveSearch: {
1172
+ type: Boolean,
1173
+ default: !1
1174
+ },
1175
+ /**
1176
+ * Select 1st options if value is empty
1177
+ * @default false
1178
+ * @type {Boolean}
1179
+ */
1180
+ preselectFirst: {
1181
+ type: Boolean,
1182
+ default: !1
1183
+ },
1184
+ /**
1185
+ * Prevent autofocus
1186
+ * @default false
1187
+ * @type {Boolean}
1188
+ */
1189
+ preventAutofocus: {
1190
+ type: Boolean,
1191
+ default: !1
1192
+ }
1193
+ },
1194
+ mounted() {
1195
+ !this.multiple && this.max && console.warn("[Vue-Multiselect warn]: Max prop should not be used when prop Multiple equals false."), this.preselectFirst && !this.internalValue.length && this.options.length && this.select(this.filteredOptions[0]);
1196
+ },
1197
+ computed: {
1198
+ internalValue() {
1199
+ return this.modelValue || this.modelValue === 0 ? Array.isArray(this.modelValue) ? this.modelValue : [this.modelValue] : [];
1200
+ },
1201
+ filteredOptions() {
1202
+ const e = this.search || "", t = e.toLowerCase().trim();
1203
+ let s = this.options.concat();
1204
+ return this.internalSearch ? s = this.groupValues ? this.filterAndFlat(s, t, this.label) : q(s, t, this.label, this.customLabel) : s = this.groupValues ? F(this.groupValues, this.groupLabel)(s) : s, s = this.hideSelected ? s.filter(Be(this.isSelected)) : s, this.taggable && t.length && !this.isExistingOption(t) && (this.tagPosition === "bottom" ? s.push({ isTag: !0, label: e }) : s.unshift({ isTag: !0, label: e })), s.slice(0, this.optionsLimit);
1205
+ },
1206
+ valueKeys() {
1207
+ return this.trackBy ? this.internalValue.map((e) => e[this.trackBy]) : this.internalValue;
1208
+ },
1209
+ optionKeys() {
1210
+ return (this.groupValues ? this.flatAndStrip(this.options) : this.options).map((t) => this.customLabel(t, this.label).toString().toLowerCase());
1211
+ },
1212
+ currentOptionLabel() {
1213
+ return this.multiple ? this.searchable ? "" : this.placeholder : this.internalValue.length ? this.getOptionLabel(this.internalValue[0]) : this.searchable ? "" : this.placeholder;
1214
+ }
1215
+ },
1216
+ watch: {
1217
+ internalValue: {
1218
+ handler() {
1219
+ this.resetAfter && this.internalValue.length && (this.search = "", this.$emit("update:modelValue", this.multiple ? [] : null));
1220
+ },
1221
+ deep: !0
1222
+ },
1223
+ search() {
1224
+ this.$emit("search-change", this.search);
1225
+ }
1226
+ },
1227
+ emits: ["open", "search-change", "close", "select", "update:modelValue", "remove", "tag"],
1228
+ methods: {
1229
+ /**
1230
+ * Returns the internalValue in a way it can be emited to the parent
1231
+ * @returns {Object||Array||String||Integer}
1232
+ */
1233
+ getValue() {
1234
+ return this.multiple ? this.internalValue : this.internalValue.length === 0 ? null : this.internalValue[0];
1235
+ },
1236
+ /**
1237
+ * Filters and then flattens the options list
1238
+ * @param {Array}
1239
+ * @return {Array} returns a filtered and flat options list
1240
+ */
1241
+ filterAndFlat(e, t, s) {
1242
+ return G(
1243
+ Ie(t, s, this.groupValues, this.groupLabel, this.customLabel),
1244
+ F(this.groupValues, this.groupLabel)
1245
+ )(e);
1246
+ },
1247
+ /**
1248
+ * Flattens and then strips the group labels from the options list
1249
+ * @param {Array}
1250
+ * @return {Array} returns a flat options list without group labels
1251
+ */
1252
+ flatAndStrip(e) {
1253
+ return G(
1254
+ F(this.groupValues, this.groupLabel),
1255
+ Fe
1256
+ )(e);
1257
+ },
1258
+ /**
1259
+ * Updates the search value
1260
+ * @param {String}
1261
+ */
1262
+ updateSearch(e) {
1263
+ this.search = e;
1264
+ },
1265
+ /**
1266
+ * Finds out if the given query is already present
1267
+ * in the available options
1268
+ * @param {String}
1269
+ * @return {Boolean} returns true if element is available
1270
+ */
1271
+ isExistingOption(e) {
1272
+ return this.options ? this.optionKeys.indexOf(e) > -1 : !1;
1273
+ },
1274
+ /**
1275
+ * Finds out if the given element is already present
1276
+ * in the result value
1277
+ * @param {Object||String||Integer} option passed element to check
1278
+ * @returns {Boolean} returns true if element is selected
1279
+ */
1280
+ isSelected(e) {
1281
+ const t = this.trackBy ? e[this.trackBy] : e;
1282
+ return this.valueKeys.indexOf(t) > -1;
1283
+ },
1284
+ /**
1285
+ * Finds out if the given option is disabled
1286
+ * @param {Object||String||Integer} option passed element to check
1287
+ * @returns {Boolean} returns true if element is disabled
1288
+ */
1289
+ isOptionDisabled(e) {
1290
+ return !!e.$isDisabled;
1291
+ },
1292
+ /**
1293
+ * Returns empty string when options is null/undefined
1294
+ * Returns tag query if option is tag.
1295
+ * Returns the customLabel() results and casts it to string.
1296
+ *
1297
+ * @param {Object||String||Integer} Passed option
1298
+ * @returns {Object||String}
1299
+ */
1300
+ getOptionLabel(e) {
1301
+ if (M(e))
1302
+ return "";
1303
+ if (e.isTag)
1304
+ return e.label;
1305
+ if (e.$isLabel)
1306
+ return e.$groupLabel;
1307
+ const t = this.customLabel(e, this.label);
1308
+ return M(t) ? "" : t;
1309
+ },
1310
+ /**
1311
+ * Add the given option to the list of selected options
1312
+ * or sets the option as the selected option.
1313
+ * If option is already selected -> remove it from the results.
1314
+ *
1315
+ * @param {Object||String||Integer} option to select/deselect
1316
+ * @param {Boolean} block removing
1317
+ */
1318
+ select(e, t) {
1319
+ if (e.$isLabel && this.groupSelect) {
1320
+ this.selectGroup(e);
1321
+ return;
1322
+ }
1323
+ if (!(this.blockKeys.indexOf(t) !== -1 || this.disabled || e.$isDisabled || e.$isLabel) && !(this.max && this.multiple && this.internalValue.length === this.max) && !(t === "Tab" && !this.pointerDirty)) {
1324
+ if (e.isTag)
1325
+ this.$emit("tag", e.label, this.id), this.search = "", this.closeOnSelect && !this.multiple && this.deactivate();
1326
+ else {
1327
+ if (this.isSelected(e)) {
1328
+ t !== "Tab" && this.removeElement(e);
1329
+ return;
1330
+ }
1331
+ this.multiple ? this.$emit("update:modelValue", this.internalValue.concat([e])) : this.$emit("update:modelValue", e), this.$emit("select", e, this.id), this.clearOnSelect && (this.search = "");
1332
+ }
1333
+ this.closeOnSelect && this.deactivate();
1334
+ }
1335
+ },
1336
+ /**
1337
+ * Add the given group options to the list of selected options
1338
+ * If all group optiona are already selected -> remove it from the results.
1339
+ *
1340
+ * @param {Object||String||Integer} group to select/deselect
1341
+ */
1342
+ selectGroup(e) {
1343
+ const t = this.options.find((s) => s[this.groupLabel] === e.$groupLabel);
1344
+ if (t) {
1345
+ if (this.wholeGroupSelected(t)) {
1346
+ this.$emit("remove", t[this.groupValues], this.id);
1347
+ const s = this.internalValue.filter(
1348
+ (l) => t[this.groupValues].indexOf(l) === -1
1349
+ );
1350
+ this.$emit("update:modelValue", s);
1351
+ } else {
1352
+ let s = t[this.groupValues].filter(
1353
+ (l) => !(this.isOptionDisabled(l) || this.isSelected(l))
1354
+ );
1355
+ this.max && s.splice(this.max - this.internalValue.length), this.$emit("select", s, this.id), this.$emit(
1356
+ "update:modelValue",
1357
+ this.internalValue.concat(s)
1358
+ );
1359
+ }
1360
+ this.closeOnSelect && this.deactivate();
1361
+ }
1362
+ },
1363
+ /**
1364
+ * Helper to identify if all values in a group are selected
1365
+ *
1366
+ * @param {Object} group to validated selected values against
1367
+ */
1368
+ wholeGroupSelected(e) {
1369
+ return e[this.groupValues].every(
1370
+ (t) => this.isSelected(t) || this.isOptionDisabled(t)
1371
+ );
1372
+ },
1373
+ /**
1374
+ * Helper to identify if all values in a group are disabled
1375
+ *
1376
+ * @param {Object} group to check for disabled values
1377
+ */
1378
+ wholeGroupDisabled(e) {
1379
+ return e[this.groupValues].every(this.isOptionDisabled);
1380
+ },
1381
+ /**
1382
+ * Removes the given option from the selected options.
1383
+ * Additionally checks this.allowEmpty prop if option can be removed when
1384
+ * it is the last selected option.
1385
+ *
1386
+ * @param {type} option description
1387
+ * @return {type} description
1388
+ */
1389
+ removeElement(e, t = !0) {
1390
+ if (this.disabled || e.$isDisabled)
1391
+ return;
1392
+ if (!this.allowEmpty && this.internalValue.length <= 1) {
1393
+ this.deactivate();
1394
+ return;
1395
+ }
1396
+ const s = typeof e == "object" ? this.valueKeys.indexOf(e[this.trackBy]) : this.valueKeys.indexOf(e);
1397
+ if (this.multiple) {
1398
+ const l = this.internalValue.slice(0, s).concat(this.internalValue.slice(s + 1));
1399
+ this.$emit("update:modelValue", l);
1400
+ } else
1401
+ this.$emit("update:modelValue", null);
1402
+ this.$emit("remove", e, this.id), this.closeOnSelect && t && this.deactivate();
1403
+ },
1404
+ /**
1405
+ * Calls this.removeElement() with the last element
1406
+ * from this.internalValue (selected element Array)
1407
+ *
1408
+ * @fires this#removeElement
1409
+ */
1410
+ removeLastElement() {
1411
+ this.blockKeys.indexOf("Delete") === -1 && this.search.length === 0 && Array.isArray(this.internalValue) && this.internalValue.length && this.removeElement(this.internalValue[this.internalValue.length - 1], !1);
1412
+ },
1413
+ /**
1414
+ * Opens the multiselect’s dropdown.
1415
+ * Sets this.isOpen to TRUE
1416
+ */
1417
+ activate() {
1418
+ this.isOpen || this.disabled || (this.adjustPosition(), this.groupValues && this.pointer === 0 && this.filteredOptions.length && (this.pointer = 1), this.isOpen = !0, this.searchable ? (this.preserveSearch || (this.search = ""), this.preventAutofocus || this.$nextTick(() => this.$refs.search && this.$refs.search.focus())) : this.preventAutofocus || typeof this.$el < "u" && this.$el.focus(), this.$emit("open", this.id));
1419
+ },
1420
+ /**
1421
+ * Closes the multiselect’s dropdown.
1422
+ * Sets this.isOpen to FALSE
1423
+ */
1424
+ deactivate() {
1425
+ this.isOpen && (this.isOpen = !1, this.searchable ? typeof this.$refs.search < "u" && this.$refs.search.blur() : typeof this.$el < "u" && this.$el.blur(), this.preserveSearch || (this.search = ""), this.$emit("close", this.getValue(), this.id));
1426
+ },
1427
+ /**
1428
+ * Call this.activate() or this.deactivate()
1429
+ * depending on this.isOpen value.
1430
+ *
1431
+ * @fires this#activate || this#deactivate
1432
+ * @property {Boolean} isOpen indicates if dropdown is open
1433
+ */
1434
+ toggle() {
1435
+ this.isOpen ? this.deactivate() : this.activate();
1436
+ },
1437
+ /**
1438
+ * Updates the hasEnoughSpace variable used for
1439
+ * detecting where to expand the dropdown
1440
+ */
1441
+ adjustPosition() {
1442
+ if (typeof window > "u")
1443
+ return;
1444
+ const e = this.$el.getBoundingClientRect().top, t = window.innerHeight - this.$el.getBoundingClientRect().bottom;
1445
+ t > this.maxHeight || t > e || this.openDirection === "below" || this.openDirection === "bottom" ? (this.preferredOpenDirection = "below", this.optimizedHeight = Math.min(t - 40, this.maxHeight)) : (this.preferredOpenDirection = "above", this.optimizedHeight = Math.min(e - 40, this.maxHeight));
1446
+ }
1447
+ }
1448
+ }, Ke = {
1449
+ data() {
1450
+ return {
1451
+ pointer: 0,
1452
+ pointerDirty: !1
1453
+ };
1454
+ },
1455
+ props: {
1456
+ /**
1457
+ * Enable/disable highlighting of the pointed value.
1458
+ * @type {Boolean}
1459
+ * @default true
1460
+ */
1461
+ showPointer: {
1462
+ type: Boolean,
1463
+ default: !0
1464
+ },
1465
+ optionHeight: {
1466
+ type: Number,
1467
+ default: 40
1468
+ }
1469
+ },
1470
+ computed: {
1471
+ pointerPosition() {
1472
+ return this.pointer * this.optionHeight;
1473
+ },
1474
+ visibleElements() {
1475
+ return this.optimizedHeight / this.optionHeight;
1476
+ }
1477
+ },
1478
+ watch: {
1479
+ filteredOptions() {
1480
+ this.pointerAdjust();
1481
+ },
1482
+ isOpen() {
1483
+ this.pointerDirty = !1;
1484
+ },
1485
+ pointer() {
1486
+ this.$refs.search && this.$refs.search.setAttribute("aria-activedescendant", this.id + "-" + this.pointer.toString());
1487
+ }
1488
+ },
1489
+ methods: {
1490
+ optionHighlight(e, t) {
1491
+ return {
1492
+ "multiselect__option--highlight": e === this.pointer && this.showPointer,
1493
+ "multiselect__option--selected": this.isSelected(t)
1494
+ };
1495
+ },
1496
+ groupHighlight(e, t) {
1497
+ if (!this.groupSelect)
1498
+ return [
1499
+ "multiselect__option--disabled",
1500
+ { "multiselect__option--group": t.$isLabel }
1501
+ ];
1502
+ const s = this.options.find((l) => l[this.groupLabel] === t.$groupLabel);
1503
+ return s && !this.wholeGroupDisabled(s) ? [
1504
+ "multiselect__option--group",
1505
+ { "multiselect__option--highlight": e === this.pointer && this.showPointer },
1506
+ { "multiselect__option--group-selected": this.wholeGroupSelected(s) }
1507
+ ] : "multiselect__option--disabled";
1508
+ },
1509
+ addPointerElement({ key: e } = "Enter") {
1510
+ this.filteredOptions.length > 0 && this.select(this.filteredOptions[this.pointer], e), this.pointerReset();
1511
+ },
1512
+ pointerForward() {
1513
+ this.pointer < this.filteredOptions.length - 1 && (this.pointer++, this.$refs.list.scrollTop <= this.pointerPosition - (this.visibleElements - 1) * this.optionHeight && (this.$refs.list.scrollTop = this.pointerPosition - (this.visibleElements - 1) * this.optionHeight), this.filteredOptions[this.pointer] && this.filteredOptions[this.pointer].$isLabel && !this.groupSelect && this.pointerForward()), this.pointerDirty = !0;
1514
+ },
1515
+ pointerBackward() {
1516
+ this.pointer > 0 ? (this.pointer--, this.$refs.list.scrollTop >= this.pointerPosition && (this.$refs.list.scrollTop = this.pointerPosition), this.filteredOptions[this.pointer] && this.filteredOptions[this.pointer].$isLabel && !this.groupSelect && this.pointerBackward()) : this.filteredOptions[this.pointer] && this.filteredOptions[0].$isLabel && !this.groupSelect && this.pointerForward(), this.pointerDirty = !0;
1517
+ },
1518
+ pointerReset() {
1519
+ this.closeOnSelect && (this.pointer = 0, this.$refs.list && (this.$refs.list.scrollTop = 0));
1520
+ },
1521
+ pointerAdjust() {
1522
+ this.pointer >= this.filteredOptions.length - 1 && (this.pointer = this.filteredOptions.length ? this.filteredOptions.length - 1 : 0), this.filteredOptions.length > 0 && this.filteredOptions[this.pointer].$isLabel && !this.groupSelect && this.pointerForward();
1523
+ },
1524
+ pointerSet(e) {
1525
+ this.pointer = e, this.pointerDirty = !0;
1526
+ }
1527
+ }
1528
+ };
1529
+ const Ne = {
1530
+ name: "vue-multiselect",
1531
+ mixins: [Pe, Ke],
1532
+ compatConfig: {
1533
+ MODE: 3,
1534
+ ATTR_ENUMERATED_COERCION: !1
1535
+ },
1536
+ props: {
1537
+ /**
1538
+ * name attribute to match optional label element
1539
+ * @default ''
1540
+ * @type {String}
1541
+ */
1542
+ name: {
1543
+ type: String,
1544
+ default: ""
1545
+ },
1546
+ /**
1547
+ * Presets the selected options value.
1548
+ * @type {Object||Array||String||Integer}
1549
+ */
1550
+ modelValue: {
1551
+ type: null,
1552
+ default() {
1553
+ return [];
1554
+ }
1555
+ },
1556
+ /**
1557
+ * String to show when pointing to an option
1558
+ * @default 'Press enter to select'
1559
+ * @type {String}
1560
+ */
1561
+ selectLabel: {
1562
+ type: String,
1563
+ default: "Press enter to select"
1564
+ },
1565
+ /**
1566
+ * String to show when pointing to an option
1567
+ * @default 'Press enter to select'
1568
+ * @type {String}
1569
+ */
1570
+ selectGroupLabel: {
1571
+ type: String,
1572
+ default: "Press enter to select group"
1573
+ },
1574
+ /**
1575
+ * String to show next to selected option
1576
+ * @default 'Selected'
1577
+ * @type {String}
1578
+ */
1579
+ selectedLabel: {
1580
+ type: String,
1581
+ default: "Selected"
1582
+ },
1583
+ /**
1584
+ * String to show when pointing to an already selected option
1585
+ * @default 'Press enter to remove'
1586
+ * @type {String}
1587
+ */
1588
+ deselectLabel: {
1589
+ type: String,
1590
+ default: "Press enter to remove"
1591
+ },
1592
+ /**
1593
+ * String to show when pointing to an already selected option
1594
+ * @default 'Press enter to remove'
1595
+ * @type {String}
1596
+ */
1597
+ deselectGroupLabel: {
1598
+ type: String,
1599
+ default: "Press enter to deselect group"
1600
+ },
1601
+ /**
1602
+ * Decide whether to show pointer labels
1603
+ * @default true
1604
+ * @type {Boolean}
1605
+ */
1606
+ showLabels: {
1607
+ type: Boolean,
1608
+ default: !0
1609
+ },
1610
+ /**
1611
+ * Limit the display of selected options. The rest will be hidden within the limitText string.
1612
+ * @default 99999
1613
+ * @type {Integer}
1614
+ */
1615
+ limit: {
1616
+ type: Number,
1617
+ default: 99999
1618
+ },
1619
+ /**
1620
+ * Sets maxHeight style value of the dropdown
1621
+ * @default 300
1622
+ * @type {Integer}
1623
+ */
1624
+ maxHeight: {
1625
+ type: Number,
1626
+ default: 300
1627
+ },
1628
+ /**
1629
+ * Function that process the message shown when selected
1630
+ * elements pass the defined limit.
1631
+ * @default 'and * more'
1632
+ * @param {Int} count Number of elements more than limit
1633
+ * @type {Function}
1634
+ */
1635
+ limitText: {
1636
+ type: Function,
1637
+ default: (e) => `and ${e} more`
1638
+ },
1639
+ /**
1640
+ * Set true to trigger the loading spinner.
1641
+ * @default False
1642
+ * @type {Boolean}
1643
+ */
1644
+ loading: {
1645
+ type: Boolean,
1646
+ default: !1
1647
+ },
1648
+ /**
1649
+ * Disables the multiselect if true.
1650
+ * @default false
1651
+ * @type {Boolean}
1652
+ */
1653
+ disabled: {
1654
+ type: Boolean,
1655
+ default: !1
1656
+ },
1657
+ /**
1658
+ * Fixed opening direction
1659
+ * @default ''
1660
+ * @type {String}
1661
+ */
1662
+ openDirection: {
1663
+ type: String,
1664
+ default: ""
1665
+ },
1666
+ /**
1667
+ * Shows slot with message about empty options
1668
+ * @default true
1669
+ * @type {Boolean}
1670
+ */
1671
+ showNoOptions: {
1672
+ type: Boolean,
1673
+ default: !0
1674
+ },
1675
+ showNoResults: {
1676
+ type: Boolean,
1677
+ default: !0
1678
+ },
1679
+ tabindex: {
1680
+ type: Number,
1681
+ default: 0
1682
+ }
1683
+ },
1684
+ computed: {
1685
+ hasOptionGroup() {
1686
+ return this.groupValues && this.groupLabel && this.groupSelect;
1687
+ },
1688
+ isSingleLabelVisible() {
1689
+ return (this.singleValue || this.singleValue === 0) && (!this.isOpen || !this.searchable) && !this.visibleValues.length;
1690
+ },
1691
+ isPlaceholderVisible() {
1692
+ return !this.internalValue.length && (!this.searchable || !this.isOpen);
1693
+ },
1694
+ visibleValues() {
1695
+ return this.multiple ? this.internalValue.slice(0, this.limit) : [];
1696
+ },
1697
+ singleValue() {
1698
+ return this.internalValue[0];
1699
+ },
1700
+ deselectLabelText() {
1701
+ return this.showLabels ? this.deselectLabel : "";
1702
+ },
1703
+ deselectGroupLabelText() {
1704
+ return this.showLabels ? this.deselectGroupLabel : "";
1705
+ },
1706
+ selectLabelText() {
1707
+ return this.showLabels ? this.selectLabel : "";
1708
+ },
1709
+ selectGroupLabelText() {
1710
+ return this.showLabels ? this.selectGroupLabel : "";
1711
+ },
1712
+ selectedLabelText() {
1713
+ return this.showLabels ? this.selectedLabel : "";
1714
+ },
1715
+ inputStyle() {
1716
+ return this.searchable || this.multiple && this.modelValue && this.modelValue.length ? this.isOpen ? { width: "100%" } : { width: "0", position: "absolute", padding: "0" } : "";
1717
+ },
1718
+ contentStyle() {
1719
+ return this.options.length ? { display: "inline-block" } : { display: "block" };
1720
+ },
1721
+ isAbove() {
1722
+ return this.openDirection === "above" || this.openDirection === "top" ? !0 : this.openDirection === "below" || this.openDirection === "bottom" ? !1 : this.preferredOpenDirection === "above";
1723
+ },
1724
+ showSearchInput() {
1725
+ return this.searchable && (this.hasSingleSelectedSlot && (this.visibleSingleValue || this.visibleSingleValue === 0) ? this.isOpen : !0);
1726
+ }
1727
+ }
1728
+ }, Re = ["tabindex", "aria-owns"], He = {
1729
+ ref: "tags",
1730
+ class: "multiselect__tags"
1731
+ }, Ge = { class: "multiselect__tags-wrap" }, je = ["textContent"], qe = ["onKeypress", "onMousedown"], ze = ["textContent"], Ue = { class: "multiselect__spinner" }, Je = ["name", "id", "placeholder", "value", "disabled", "tabindex", "aria-controls"], We = ["id"], Ye = { key: 0 }, Qe = { class: "multiselect__option" }, Xe = ["id", "role"], Ze = ["onClick", "onMouseenter", "data-select", "data-selected", "data-deselect"], xe = ["data-select", "data-deselect", "onMouseenter", "onMousedown"], _e = { class: "multiselect__option" }, et = { class: "multiselect__option" };
1732
+ function tt(e, t, s, l, a, r) {
1733
+ return u(), d("div", {
1734
+ tabindex: e.searchable ? -1 : s.tabindex,
1735
+ class: y([{ "multiselect--active": e.isOpen, "multiselect--disabled": s.disabled, "multiselect--above": r.isAbove, "multiselect--has-options-group": r.hasOptionGroup }, "multiselect"]),
1736
+ onFocus: t[13] || (t[13] = (i) => e.activate()),
1737
+ onBlur: t[14] || (t[14] = (i) => e.searchable ? !1 : e.deactivate()),
1738
+ onKeydown: [
1739
+ t[15] || (t[15] = c(g((i) => e.pointerForward(), ["self", "prevent"]), ["down"])),
1740
+ t[16] || (t[16] = c(g((i) => e.pointerBackward(), ["self", "prevent"]), ["up"]))
1741
+ ],
1742
+ onKeypress: t[17] || (t[17] = c(g((i) => e.addPointerElement(i), ["stop", "self"]), ["enter", "tab"])),
1743
+ onKeyup: t[18] || (t[18] = c((i) => e.deactivate(), ["esc"])),
1744
+ role: "combobox",
1745
+ "aria-owns": "listbox-" + e.id
1746
+ }, [
1747
+ p(e.$slots, "caret", { toggle: e.toggle }, () => [
1748
+ h("div", {
1749
+ onMousedown: t[0] || (t[0] = g((i) => e.toggle(), ["prevent", "stop"])),
1750
+ class: "multiselect__select"
1751
+ }, null, 32)
1752
+ ]),
1753
+ p(e.$slots, "clear", { search: e.search }),
1754
+ h("div", He, [
1755
+ p(e.$slots, "selection", {
1756
+ search: e.search,
1757
+ remove: e.removeElement,
1758
+ values: r.visibleValues,
1759
+ isOpen: e.isOpen
1760
+ }, () => [
1761
+ $(h("div", Ge, [
1762
+ (u(!0), d(V, null, E(r.visibleValues, (i, n) => p(e.$slots, "tag", {
1763
+ option: i,
1764
+ search: e.search,
1765
+ remove: e.removeElement
1766
+ }, () => [
1767
+ (u(), d("span", {
1768
+ class: "multiselect__tag",
1769
+ key: n
1770
+ }, [
1771
+ h("span", {
1772
+ textContent: b(e.getOptionLabel(i))
1773
+ }, null, 8, je),
1774
+ h("i", {
1775
+ tabindex: "1",
1776
+ onKeypress: c(g((o) => e.removeElement(i), ["prevent"]), ["enter"]),
1777
+ onMousedown: g((o) => e.removeElement(i), ["prevent"]),
1778
+ class: "multiselect__tag-icon"
1779
+ }, null, 40, qe)
1780
+ ]))
1781
+ ])), 256))
1782
+ ], 512), [
1783
+ [S, r.visibleValues.length > 0]
1784
+ ]),
1785
+ e.internalValue && e.internalValue.length > s.limit ? p(e.$slots, "limit", { key: 0 }, () => [
1786
+ h("strong", {
1787
+ class: "multiselect__strong",
1788
+ textContent: b(s.limitText(e.internalValue.length - s.limit))
1789
+ }, null, 8, ze)
1790
+ ]) : f("", !0)
1791
+ ]),
1792
+ I(K, { name: "multiselect__loading" }, {
1793
+ default: N(() => [
1794
+ p(e.$slots, "loading", {}, () => [
1795
+ $(h("div", Ue, null, 512), [
1796
+ [S, s.loading]
1797
+ ])
1798
+ ])
1799
+ ]),
1800
+ _: 3
1801
+ }),
1802
+ e.searchable ? (u(), d("input", {
1803
+ key: 0,
1804
+ ref: "search",
1805
+ name: s.name,
1806
+ id: e.id,
1807
+ type: "text",
1808
+ autocomplete: "off",
1809
+ spellcheck: "false",
1810
+ placeholder: e.placeholder,
1811
+ style: w(r.inputStyle),
1812
+ value: e.search,
1813
+ disabled: s.disabled,
1814
+ tabindex: s.tabindex,
1815
+ onInput: t[1] || (t[1] = (i) => e.updateSearch(i.target.value)),
1816
+ onFocus: t[2] || (t[2] = g((i) => e.activate(), ["prevent"])),
1817
+ onBlur: t[3] || (t[3] = g((i) => e.deactivate(), ["prevent"])),
1818
+ onKeyup: t[4] || (t[4] = c((i) => e.deactivate(), ["esc"])),
1819
+ onKeydown: [
1820
+ t[5] || (t[5] = c(g((i) => e.pointerForward(), ["prevent"]), ["down"])),
1821
+ t[6] || (t[6] = c(g((i) => e.pointerBackward(), ["prevent"]), ["up"])),
1822
+ t[8] || (t[8] = c(g((i) => e.removeLastElement(), ["stop"]), ["delete"]))
1823
+ ],
1824
+ onKeypress: t[7] || (t[7] = c(g((i) => e.addPointerElement(i), ["prevent", "stop", "self"]), ["enter"])),
1825
+ class: "multiselect__input",
1826
+ "aria-controls": "listbox-" + e.id
1827
+ }, null, 44, Je)) : f("", !0),
1828
+ r.isSingleLabelVisible ? (u(), d("span", {
1829
+ key: 1,
1830
+ class: "multiselect__single",
1831
+ onMousedown: t[9] || (t[9] = g((...i) => e.toggle && e.toggle(...i), ["prevent"]))
1832
+ }, [
1833
+ p(e.$slots, "singleLabel", { option: r.singleValue }, () => [
1834
+ k(b(e.currentOptionLabel), 1)
1835
+ ])
1836
+ ], 32)) : f("", !0),
1837
+ r.isPlaceholderVisible ? (u(), d("span", {
1838
+ key: 2,
1839
+ class: "multiselect__placeholder",
1840
+ onMousedown: t[10] || (t[10] = g((...i) => e.toggle && e.toggle(...i), ["prevent"]))
1841
+ }, [
1842
+ p(e.$slots, "placeholder", {}, () => [
1843
+ k(b(e.placeholder), 1)
1844
+ ])
1845
+ ], 32)) : f("", !0)
1846
+ ], 512),
1847
+ I(K, { name: "multiselect" }, {
1848
+ default: N(() => [
1849
+ $(h("div", {
1850
+ class: y(["multiselect__content-wrapper", e.$attrs.class]),
1851
+ onFocus: t[11] || (t[11] = (...i) => e.activate && e.activate(...i)),
1852
+ tabindex: "-1",
1853
+ onMousedown: t[12] || (t[12] = g(() => {
1854
+ }, ["prevent"])),
1855
+ style: w({ maxHeight: e.optimizedHeight + "px" }),
1856
+ ref: "list"
1857
+ }, [
1858
+ h("ul", {
1859
+ class: "multiselect__content",
1860
+ style: w(r.contentStyle),
1861
+ role: "listbox",
1862
+ id: "listbox-" + e.id
1863
+ }, [
1864
+ p(e.$slots, "beforeList"),
1865
+ e.multiple && e.max === e.internalValue.length ? (u(), d("li", Ye, [
1866
+ h("span", Qe, [
1867
+ p(e.$slots, "maxElements", {}, () => [
1868
+ k("Maximum of " + b(e.max) + " options selected. First remove a selected option to select another.", 1)
1869
+ ])
1870
+ ])
1871
+ ])) : f("", !0),
1872
+ !e.max || e.internalValue.length < e.max ? (u(!0), d(V, { key: 1 }, E(e.filteredOptions, (i, n) => (u(), d("li", {
1873
+ class: "multiselect__element",
1874
+ key: n,
1875
+ id: e.id + "-" + n,
1876
+ role: i && (i.$isLabel || i.$isDisabled) ? null : "option"
1877
+ }, [
1878
+ i && (i.$isLabel || i.$isDisabled) ? f("", !0) : (u(), d("span", {
1879
+ key: 0,
1880
+ class: y([e.optionHighlight(n, i), "multiselect__option"]),
1881
+ onClick: g((o) => e.select(i), ["stop"]),
1882
+ onMouseenter: g((o) => e.pointerSet(n), ["self"]),
1883
+ "data-select": i && i.isTag ? e.tagPlaceholder : r.selectLabelText,
1884
+ "data-selected": r.selectedLabelText,
1885
+ "data-deselect": r.deselectLabelText
1886
+ }, [
1887
+ p(e.$slots, "option", {
1888
+ option: i,
1889
+ search: e.search,
1890
+ index: n
1891
+ }, () => [
1892
+ h("span", null, b(e.getOptionLabel(i)), 1)
1893
+ ])
1894
+ ], 42, Ze)),
1895
+ i && (i.$isLabel || i.$isDisabled) ? (u(), d("span", {
1896
+ key: 1,
1897
+ "data-select": e.groupSelect && r.selectGroupLabelText,
1898
+ "data-deselect": e.groupSelect && r.deselectGroupLabelText,
1899
+ class: y([e.groupHighlight(n, i), "multiselect__option"]),
1900
+ onMouseenter: g((o) => e.groupSelect && e.pointerSet(n), ["self"]),
1901
+ onMousedown: g((o) => e.selectGroup(i), ["prevent"])
1902
+ }, [
1903
+ p(e.$slots, "option", {
1904
+ option: i,
1905
+ search: e.search,
1906
+ index: n
1907
+ }, () => [
1908
+ h("span", null, b(e.getOptionLabel(i)), 1)
1909
+ ])
1910
+ ], 42, xe)) : f("", !0)
1911
+ ], 8, Xe))), 128)) : f("", !0),
1912
+ $(h("li", null, [
1913
+ h("span", _e, [
1914
+ p(e.$slots, "noResult", { search: e.search }, () => [
1915
+ k("No elements found. Consider changing the search query.")
1916
+ ])
1917
+ ])
1918
+ ], 512), [
1919
+ [S, s.showNoResults && e.filteredOptions.length === 0 && e.search && !s.loading]
1920
+ ]),
1921
+ $(h("li", null, [
1922
+ h("span", et, [
1923
+ p(e.$slots, "noOptions", {}, () => [
1924
+ k("List is empty.")
1925
+ ])
1926
+ ])
1927
+ ], 512), [
1928
+ [S, s.showNoOptions && (e.options.length === 0 || r.hasOptionGroup === !0 && e.filteredOptions.length === 0) && !e.search && !s.loading]
1929
+ ]),
1930
+ p(e.$slots, "afterList")
1931
+ ], 12, We)
1932
+ ], 38), [
1933
+ [S, e.isOpen]
1934
+ ])
1935
+ ]),
1936
+ _: 3
1937
+ })
1938
+ ], 42, Re);
1939
+ }
1940
+ const ot = /* @__PURE__ */ D(Ne, [["render", tt]]);
1941
+ export {
1942
+ rt as C,
1943
+ ot as S,
1944
+ nt as _
1945
+ };