From 13ce168058b9af0260dcc3ffe956391e1f4ccafc Mon Sep 17 00:00:00 2001 From: Ruben Fileti Date: Wed, 26 Jun 2024 12:41:23 +0200 Subject: [PATCH 1/3] Options are now selected by id instead of values --- dist/index.d.ts | 2 +- dist/select.d.ts | 5 +- dist/slimselect.cjs.js | 76 ++++++++++++---------------- dist/slimselect.es.js | 76 ++++++++++++---------------- dist/slimselect.global.js | 76 ++++++++++++---------------- dist/slimselect.js | 76 ++++++++++++---------------- dist/slimselect.min.js | 2 +- dist/slimselect.umd.js | 76 ++++++++++++---------------- dist/slimselect.umd.min.js | 2 +- dist/store.d.ts | 1 - docs/assets/index.js | 32 ++++++------ src/slim-select/index.ts | 8 +-- src/slim-select/render.ts | 28 +++++----- src/slim-select/select.ts | 28 +++++----- src/slim-select/store.ts | 23 +-------- src/vue/dist/slim-select/index.d.ts | 2 +- src/vue/dist/slim-select/select.d.ts | 5 +- src/vue/dist/slim-select/store.d.ts | 1 - src/vue/dist/slimselectvue.es.js | 76 ++++++++++++---------------- src/vue/dist/slimselectvue.global.js | 76 ++++++++++++---------------- src/vue/dist/slimselectvue.ssr.js | 76 ++++++++++++---------------- src/vue/dist/vue/slimselect.vue.d.ts | 9 ++-- 22 files changed, 330 insertions(+), 426 deletions(-) diff --git a/dist/index.d.ts b/dist/index.d.ts index e90aa361..4296bbe5 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -33,7 +33,7 @@ export default class SlimSelect { getData(): DataArray; setData(data: DataArrayPartial): void; getSelected(): string[]; - setSelected(value: string | string[], runAfterChange?: boolean): void; + setSelected(id: string | string[], runAfterChange?: boolean): void; addOption(option: OptionOptional): void; open(): void; close(eventType?: string | null): void; diff --git a/dist/select.d.ts b/dist/select.d.ts index 3b9dd83e..62b6f779 100644 --- a/dist/select.d.ts +++ b/dist/select.d.ts @@ -1,7 +1,7 @@ import { DataArray, DataArrayPartial, Optgroup, OptgroupOptional, Option } from './store'; export default class Select { select: HTMLSelectElement; - onValueChange?: (value: string[]) => void; + onValueChange?: (value: Option[]) => void; onClassChange?: (classes: string[]) => void; onDisabledChange?: (disabled: boolean) => void; onOptionsChange?: (data: DataArrayPartial) => void; @@ -18,8 +18,9 @@ export default class Select { getData(): DataArrayPartial; getDataFromOptgroup(optgroup: HTMLOptGroupElement): OptgroupOptional; getDataFromOption(option: HTMLOptionElement): Option; + getSelectedOptions(): Option[]; getSelectedValues(): string[]; - setSelected(value: string[]): void; + setSelected(ids: string[]): void; updateSelect(id?: string, style?: string, classes?: string[]): void; updateOptions(data: DataArray): void; createOptgroup(optgroup: Optgroup): HTMLOptGroupElement; diff --git a/dist/slimselect.cjs.js b/dist/slimselect.cjs.js index 3bc5dde8..67ac8a6c 100644 --- a/dist/slimselect.cjs.js +++ b/dist/slimselect.cjs.js @@ -143,7 +143,7 @@ class Store { setData(data) { this.data = this.partialToFullData(data); if (this.selectType === 'single') { - this.setSelectedBy('value', this.getSelected()); + this.setSelectedBy('id', this.getSelected()); } } getData() { @@ -185,26 +185,13 @@ class Store { } } getSelected() { - let selectedOptions = this.getSelectedOptions(); - let selectedValues = []; - selectedOptions.forEach((option) => { - selectedValues.push(option.value); - }); - return selectedValues; + return this.getSelectedOptions().map(option => option.id); } getSelectedOptions() { return this.filter((opt) => { return opt.selected; }, false); } - getSelectedIDs() { - let selectedOptions = this.getSelectedOptions(); - let selectedIDs = []; - selectedOptions.forEach((op) => { - selectedIDs.push(op.id); - }); - return selectedIDs; - } getOptgroupByID(id) { for (let dataObj of this.data) { if (dataObj instanceof Optgroup && dataObj.id === id) { @@ -456,8 +443,8 @@ class Render { } else { const firstOption = this.store.getFirstOption(); - const value = firstOption ? firstOption.value : ''; - this.callbacks.setSelected(value, false); + const id = firstOption ? firstOption.id : ''; + this.callbacks.setSelected(id, false); } if (this.settings.closeOnSelect) { this.callbacks.close(); @@ -657,18 +644,18 @@ class Render { shouldDelete = this.callbacks.beforeChange(after, before) === true; } if (shouldDelete) { - let selectedValues = []; + let selectedIds = []; for (const o of after) { if (o instanceof Optgroup) { for (const c of o.options) { - selectedValues.push(c.value); + selectedIds.push(c.id); } } if (o instanceof Option) { - selectedValues.push(o.value); + selectedIds.push(o.id); } } - this.callbacks.setSelected(selectedValues, false); + this.callbacks.setSelected(selectedIds, false); if (this.settings.closeOnSelect) { this.callbacks.close(); } @@ -797,12 +784,12 @@ class Render { let newOption = new Option(oo); this.callbacks.addOption(newOption); if (this.settings.isMultiple) { - let values = this.store.getSelected(); - values.push(newOption.value); - this.callbacks.setSelected(values, true); + let ids = this.store.getSelected(); + ids.push(newOption.id); + this.callbacks.setSelected(ids, true); } else { - this.callbacks.setSelected([newOption.value], true); + this.callbacks.setSelected([newOption.id], true); } this.callbacks.search(''); if (this.settings.closeOnSelect) { @@ -990,7 +977,7 @@ class Render { if (allSelected) { const newSelected = currentSelected.filter((s) => { for (const o of d.options) { - if (s === o.value) { + if (s === o.id) { return false; } } @@ -1000,7 +987,7 @@ class Render { return; } else { - const newSelected = currentSelected.concat(d.options.map((o) => o.value)); + const newSelected = currentSelected.concat(d.options.map((o) => o.id)); for (const o of d.options) { if (!this.store.getOptionByID(o.id)) { this.callbacks.addOption(o); @@ -1157,7 +1144,7 @@ class Render { if (!this.store.getOptionByID(elementID)) { this.callbacks.addOption(option); } - this.callbacks.setSelected(after.map((o) => o.value), false); + this.callbacks.setSelected(after.map((o) => o.id), false); if (this.settings.closeOnSelect) { this.callbacks.close(); } @@ -1303,7 +1290,7 @@ class Select { } valueChange(ev) { if (this.listen && this.onValueChange) { - this.onValueChange(this.getSelectedValues()); + this.onValueChange(this.getSelectedOptions()); } return true; } @@ -1387,17 +1374,17 @@ class Select { data: option.dataset, }; } - getSelectedValues() { - let values = []; - const options = this.select.childNodes; - for (const o of options) { + getSelectedOptions() { + let options = []; + const opts = this.select.childNodes; + for (const o of opts) { if (o.nodeName === 'OPTGROUP') { const optgroupOptions = o.childNodes; for (const oo of optgroupOptions) { if (oo.nodeName === 'OPTION') { const option = oo; if (option.selected) { - values.push(option.value); + options.push(this.getDataFromOption(option)); } } } @@ -1405,13 +1392,16 @@ class Select { if (o.nodeName === 'OPTION') { const option = o; if (option.selected) { - values.push(option.value); + options.push(this.getDataFromOption(option)); } } } - return values; + return options; + } + getSelectedValues() { + return this.getSelectedOptions().map(option => option.value); } - setSelected(value) { + setSelected(ids) { this.changeListen(false); const options = this.select.childNodes; for (const o of options) { @@ -1421,13 +1411,13 @@ class Select { for (const oo of optgroupOptions) { if (oo.nodeName === 'OPTION') { const option = oo; - option.selected = value.includes(option.value); + option.selected = ids.includes(option.id); } } } if (o.nodeName === 'OPTION') { const option = o; - option.selected = value.includes(option.value); + option.selected = ids.includes(option.id); } } this.changeListen(true); @@ -1645,8 +1635,8 @@ class SlimSelect { this.select = new Select(this.selectEl); this.select.updateSelect(this.settings.id, this.settings.style, this.settings.class); this.select.hideUI(); - this.select.onValueChange = (values) => { - this.setSelected(values); + this.select.onValueChange = (options) => { + this.setSelected(options.map(option => option.id)); }; this.select.onClassChange = (classes) => { this.settings.class = classes; @@ -1738,9 +1728,9 @@ class SlimSelect { getSelected() { return this.store.getSelected(); } - setSelected(value, runAfterChange = true) { + setSelected(id, runAfterChange = true) { const selected = this.store.getSelected(); - this.store.setSelectedBy('value', Array.isArray(value) ? value : [value]); + this.store.setSelectedBy('id', Array.isArray(id) ? id : [id]); const data = this.store.getData(); this.select.updateOptions(data); this.render.renderValues(); diff --git a/dist/slimselect.es.js b/dist/slimselect.es.js index 4e52a192..8ad9e3eb 100644 --- a/dist/slimselect.es.js +++ b/dist/slimselect.es.js @@ -141,7 +141,7 @@ class Store { setData(data) { this.data = this.partialToFullData(data); if (this.selectType === 'single') { - this.setSelectedBy('value', this.getSelected()); + this.setSelectedBy('id', this.getSelected()); } } getData() { @@ -183,26 +183,13 @@ class Store { } } getSelected() { - let selectedOptions = this.getSelectedOptions(); - let selectedValues = []; - selectedOptions.forEach((option) => { - selectedValues.push(option.value); - }); - return selectedValues; + return this.getSelectedOptions().map(option => option.id); } getSelectedOptions() { return this.filter((opt) => { return opt.selected; }, false); } - getSelectedIDs() { - let selectedOptions = this.getSelectedOptions(); - let selectedIDs = []; - selectedOptions.forEach((op) => { - selectedIDs.push(op.id); - }); - return selectedIDs; - } getOptgroupByID(id) { for (let dataObj of this.data) { if (dataObj instanceof Optgroup && dataObj.id === id) { @@ -454,8 +441,8 @@ class Render { } else { const firstOption = this.store.getFirstOption(); - const value = firstOption ? firstOption.value : ''; - this.callbacks.setSelected(value, false); + const id = firstOption ? firstOption.id : ''; + this.callbacks.setSelected(id, false); } if (this.settings.closeOnSelect) { this.callbacks.close(); @@ -655,18 +642,18 @@ class Render { shouldDelete = this.callbacks.beforeChange(after, before) === true; } if (shouldDelete) { - let selectedValues = []; + let selectedIds = []; for (const o of after) { if (o instanceof Optgroup) { for (const c of o.options) { - selectedValues.push(c.value); + selectedIds.push(c.id); } } if (o instanceof Option) { - selectedValues.push(o.value); + selectedIds.push(o.id); } } - this.callbacks.setSelected(selectedValues, false); + this.callbacks.setSelected(selectedIds, false); if (this.settings.closeOnSelect) { this.callbacks.close(); } @@ -795,12 +782,12 @@ class Render { let newOption = new Option(oo); this.callbacks.addOption(newOption); if (this.settings.isMultiple) { - let values = this.store.getSelected(); - values.push(newOption.value); - this.callbacks.setSelected(values, true); + let ids = this.store.getSelected(); + ids.push(newOption.id); + this.callbacks.setSelected(ids, true); } else { - this.callbacks.setSelected([newOption.value], true); + this.callbacks.setSelected([newOption.id], true); } this.callbacks.search(''); if (this.settings.closeOnSelect) { @@ -988,7 +975,7 @@ class Render { if (allSelected) { const newSelected = currentSelected.filter((s) => { for (const o of d.options) { - if (s === o.value) { + if (s === o.id) { return false; } } @@ -998,7 +985,7 @@ class Render { return; } else { - const newSelected = currentSelected.concat(d.options.map((o) => o.value)); + const newSelected = currentSelected.concat(d.options.map((o) => o.id)); for (const o of d.options) { if (!this.store.getOptionByID(o.id)) { this.callbacks.addOption(o); @@ -1155,7 +1142,7 @@ class Render { if (!this.store.getOptionByID(elementID)) { this.callbacks.addOption(option); } - this.callbacks.setSelected(after.map((o) => o.value), false); + this.callbacks.setSelected(after.map((o) => o.id), false); if (this.settings.closeOnSelect) { this.callbacks.close(); } @@ -1301,7 +1288,7 @@ class Select { } valueChange(ev) { if (this.listen && this.onValueChange) { - this.onValueChange(this.getSelectedValues()); + this.onValueChange(this.getSelectedOptions()); } return true; } @@ -1385,17 +1372,17 @@ class Select { data: option.dataset, }; } - getSelectedValues() { - let values = []; - const options = this.select.childNodes; - for (const o of options) { + getSelectedOptions() { + let options = []; + const opts = this.select.childNodes; + for (const o of opts) { if (o.nodeName === 'OPTGROUP') { const optgroupOptions = o.childNodes; for (const oo of optgroupOptions) { if (oo.nodeName === 'OPTION') { const option = oo; if (option.selected) { - values.push(option.value); + options.push(this.getDataFromOption(option)); } } } @@ -1403,13 +1390,16 @@ class Select { if (o.nodeName === 'OPTION') { const option = o; if (option.selected) { - values.push(option.value); + options.push(this.getDataFromOption(option)); } } } - return values; + return options; + } + getSelectedValues() { + return this.getSelectedOptions().map(option => option.value); } - setSelected(value) { + setSelected(ids) { this.changeListen(false); const options = this.select.childNodes; for (const o of options) { @@ -1419,13 +1409,13 @@ class Select { for (const oo of optgroupOptions) { if (oo.nodeName === 'OPTION') { const option = oo; - option.selected = value.includes(option.value); + option.selected = ids.includes(option.id); } } } if (o.nodeName === 'OPTION') { const option = o; - option.selected = value.includes(option.value); + option.selected = ids.includes(option.id); } } this.changeListen(true); @@ -1643,8 +1633,8 @@ class SlimSelect { this.select = new Select(this.selectEl); this.select.updateSelect(this.settings.id, this.settings.style, this.settings.class); this.select.hideUI(); - this.select.onValueChange = (values) => { - this.setSelected(values); + this.select.onValueChange = (options) => { + this.setSelected(options.map(option => option.id)); }; this.select.onClassChange = (classes) => { this.settings.class = classes; @@ -1736,9 +1726,9 @@ class SlimSelect { getSelected() { return this.store.getSelected(); } - setSelected(value, runAfterChange = true) { + setSelected(id, runAfterChange = true) { const selected = this.store.getSelected(); - this.store.setSelectedBy('value', Array.isArray(value) ? value : [value]); + this.store.setSelectedBy('id', Array.isArray(id) ? id : [id]); const data = this.store.getData(); this.select.updateOptions(data); this.render.renderValues(); diff --git a/dist/slimselect.global.js b/dist/slimselect.global.js index 8bb1d92f..a2bc1a77 100644 --- a/dist/slimselect.global.js +++ b/dist/slimselect.global.js @@ -144,7 +144,7 @@ var SlimSelect = (function () { setData(data) { this.data = this.partialToFullData(data); if (this.selectType === 'single') { - this.setSelectedBy('value', this.getSelected()); + this.setSelectedBy('id', this.getSelected()); } } getData() { @@ -186,26 +186,13 @@ var SlimSelect = (function () { } } getSelected() { - let selectedOptions = this.getSelectedOptions(); - let selectedValues = []; - selectedOptions.forEach((option) => { - selectedValues.push(option.value); - }); - return selectedValues; + return this.getSelectedOptions().map(option => option.id); } getSelectedOptions() { return this.filter((opt) => { return opt.selected; }, false); } - getSelectedIDs() { - let selectedOptions = this.getSelectedOptions(); - let selectedIDs = []; - selectedOptions.forEach((op) => { - selectedIDs.push(op.id); - }); - return selectedIDs; - } getOptgroupByID(id) { for (let dataObj of this.data) { if (dataObj instanceof Optgroup && dataObj.id === id) { @@ -457,8 +444,8 @@ var SlimSelect = (function () { } else { const firstOption = this.store.getFirstOption(); - const value = firstOption ? firstOption.value : ''; - this.callbacks.setSelected(value, false); + const id = firstOption ? firstOption.id : ''; + this.callbacks.setSelected(id, false); } if (this.settings.closeOnSelect) { this.callbacks.close(); @@ -658,18 +645,18 @@ var SlimSelect = (function () { shouldDelete = this.callbacks.beforeChange(after, before) === true; } if (shouldDelete) { - let selectedValues = []; + let selectedIds = []; for (const o of after) { if (o instanceof Optgroup) { for (const c of o.options) { - selectedValues.push(c.value); + selectedIds.push(c.id); } } if (o instanceof Option) { - selectedValues.push(o.value); + selectedIds.push(o.id); } } - this.callbacks.setSelected(selectedValues, false); + this.callbacks.setSelected(selectedIds, false); if (this.settings.closeOnSelect) { this.callbacks.close(); } @@ -798,12 +785,12 @@ var SlimSelect = (function () { let newOption = new Option(oo); this.callbacks.addOption(newOption); if (this.settings.isMultiple) { - let values = this.store.getSelected(); - values.push(newOption.value); - this.callbacks.setSelected(values, true); + let ids = this.store.getSelected(); + ids.push(newOption.id); + this.callbacks.setSelected(ids, true); } else { - this.callbacks.setSelected([newOption.value], true); + this.callbacks.setSelected([newOption.id], true); } this.callbacks.search(''); if (this.settings.closeOnSelect) { @@ -991,7 +978,7 @@ var SlimSelect = (function () { if (allSelected) { const newSelected = currentSelected.filter((s) => { for (const o of d.options) { - if (s === o.value) { + if (s === o.id) { return false; } } @@ -1001,7 +988,7 @@ var SlimSelect = (function () { return; } else { - const newSelected = currentSelected.concat(d.options.map((o) => o.value)); + const newSelected = currentSelected.concat(d.options.map((o) => o.id)); for (const o of d.options) { if (!this.store.getOptionByID(o.id)) { this.callbacks.addOption(o); @@ -1158,7 +1145,7 @@ var SlimSelect = (function () { if (!this.store.getOptionByID(elementID)) { this.callbacks.addOption(option); } - this.callbacks.setSelected(after.map((o) => o.value), false); + this.callbacks.setSelected(after.map((o) => o.id), false); if (this.settings.closeOnSelect) { this.callbacks.close(); } @@ -1304,7 +1291,7 @@ var SlimSelect = (function () { } valueChange(ev) { if (this.listen && this.onValueChange) { - this.onValueChange(this.getSelectedValues()); + this.onValueChange(this.getSelectedOptions()); } return true; } @@ -1388,17 +1375,17 @@ var SlimSelect = (function () { data: option.dataset, }; } - getSelectedValues() { - let values = []; - const options = this.select.childNodes; - for (const o of options) { + getSelectedOptions() { + let options = []; + const opts = this.select.childNodes; + for (const o of opts) { if (o.nodeName === 'OPTGROUP') { const optgroupOptions = o.childNodes; for (const oo of optgroupOptions) { if (oo.nodeName === 'OPTION') { const option = oo; if (option.selected) { - values.push(option.value); + options.push(this.getDataFromOption(option)); } } } @@ -1406,13 +1393,16 @@ var SlimSelect = (function () { if (o.nodeName === 'OPTION') { const option = o; if (option.selected) { - values.push(option.value); + options.push(this.getDataFromOption(option)); } } } - return values; + return options; + } + getSelectedValues() { + return this.getSelectedOptions().map(option => option.value); } - setSelected(value) { + setSelected(ids) { this.changeListen(false); const options = this.select.childNodes; for (const o of options) { @@ -1422,13 +1412,13 @@ var SlimSelect = (function () { for (const oo of optgroupOptions) { if (oo.nodeName === 'OPTION') { const option = oo; - option.selected = value.includes(option.value); + option.selected = ids.includes(option.id); } } } if (o.nodeName === 'OPTION') { const option = o; - option.selected = value.includes(option.value); + option.selected = ids.includes(option.id); } } this.changeListen(true); @@ -1646,8 +1636,8 @@ var SlimSelect = (function () { this.select = new Select(this.selectEl); this.select.updateSelect(this.settings.id, this.settings.style, this.settings.class); this.select.hideUI(); - this.select.onValueChange = (values) => { - this.setSelected(values); + this.select.onValueChange = (options) => { + this.setSelected(options.map(option => option.id)); }; this.select.onClassChange = (classes) => { this.settings.class = classes; @@ -1739,9 +1729,9 @@ var SlimSelect = (function () { getSelected() { return this.store.getSelected(); } - setSelected(value, runAfterChange = true) { + setSelected(id, runAfterChange = true) { const selected = this.store.getSelected(); - this.store.setSelectedBy('value', Array.isArray(value) ? value : [value]); + this.store.setSelectedBy('id', Array.isArray(id) ? id : [id]); const data = this.store.getData(); this.select.updateOptions(data); this.render.renderValues(); diff --git a/dist/slimselect.js b/dist/slimselect.js index 76114c8b..0e8ad964 100644 --- a/dist/slimselect.js +++ b/dist/slimselect.js @@ -147,7 +147,7 @@ setData(data) { this.data = this.partialToFullData(data); if (this.selectType === 'single') { - this.setSelectedBy('value', this.getSelected()); + this.setSelectedBy('id', this.getSelected()); } } getData() { @@ -189,26 +189,13 @@ } } getSelected() { - let selectedOptions = this.getSelectedOptions(); - let selectedValues = []; - selectedOptions.forEach((option) => { - selectedValues.push(option.value); - }); - return selectedValues; + return this.getSelectedOptions().map(option => option.id); } getSelectedOptions() { return this.filter((opt) => { return opt.selected; }, false); } - getSelectedIDs() { - let selectedOptions = this.getSelectedOptions(); - let selectedIDs = []; - selectedOptions.forEach((op) => { - selectedIDs.push(op.id); - }); - return selectedIDs; - } getOptgroupByID(id) { for (let dataObj of this.data) { if (dataObj instanceof Optgroup && dataObj.id === id) { @@ -460,8 +447,8 @@ } else { const firstOption = this.store.getFirstOption(); - const value = firstOption ? firstOption.value : ''; - this.callbacks.setSelected(value, false); + const id = firstOption ? firstOption.id : ''; + this.callbacks.setSelected(id, false); } if (this.settings.closeOnSelect) { this.callbacks.close(); @@ -661,18 +648,18 @@ shouldDelete = this.callbacks.beforeChange(after, before) === true; } if (shouldDelete) { - let selectedValues = []; + let selectedIds = []; for (const o of after) { if (o instanceof Optgroup) { for (const c of o.options) { - selectedValues.push(c.value); + selectedIds.push(c.id); } } if (o instanceof Option) { - selectedValues.push(o.value); + selectedIds.push(o.id); } } - this.callbacks.setSelected(selectedValues, false); + this.callbacks.setSelected(selectedIds, false); if (this.settings.closeOnSelect) { this.callbacks.close(); } @@ -801,12 +788,12 @@ let newOption = new Option(oo); this.callbacks.addOption(newOption); if (this.settings.isMultiple) { - let values = this.store.getSelected(); - values.push(newOption.value); - this.callbacks.setSelected(values, true); + let ids = this.store.getSelected(); + ids.push(newOption.id); + this.callbacks.setSelected(ids, true); } else { - this.callbacks.setSelected([newOption.value], true); + this.callbacks.setSelected([newOption.id], true); } this.callbacks.search(''); if (this.settings.closeOnSelect) { @@ -994,7 +981,7 @@ if (allSelected) { const newSelected = currentSelected.filter((s) => { for (const o of d.options) { - if (s === o.value) { + if (s === o.id) { return false; } } @@ -1004,7 +991,7 @@ return; } else { - const newSelected = currentSelected.concat(d.options.map((o) => o.value)); + const newSelected = currentSelected.concat(d.options.map((o) => o.id)); for (const o of d.options) { if (!this.store.getOptionByID(o.id)) { this.callbacks.addOption(o); @@ -1161,7 +1148,7 @@ if (!this.store.getOptionByID(elementID)) { this.callbacks.addOption(option); } - this.callbacks.setSelected(after.map((o) => o.value), false); + this.callbacks.setSelected(after.map((o) => o.id), false); if (this.settings.closeOnSelect) { this.callbacks.close(); } @@ -1307,7 +1294,7 @@ } valueChange(ev) { if (this.listen && this.onValueChange) { - this.onValueChange(this.getSelectedValues()); + this.onValueChange(this.getSelectedOptions()); } return true; } @@ -1391,17 +1378,17 @@ data: option.dataset, }; } - getSelectedValues() { - let values = []; - const options = this.select.childNodes; - for (const o of options) { + getSelectedOptions() { + let options = []; + const opts = this.select.childNodes; + for (const o of opts) { if (o.nodeName === 'OPTGROUP') { const optgroupOptions = o.childNodes; for (const oo of optgroupOptions) { if (oo.nodeName === 'OPTION') { const option = oo; if (option.selected) { - values.push(option.value); + options.push(this.getDataFromOption(option)); } } } @@ -1409,13 +1396,16 @@ if (o.nodeName === 'OPTION') { const option = o; if (option.selected) { - values.push(option.value); + options.push(this.getDataFromOption(option)); } } } - return values; + return options; + } + getSelectedValues() { + return this.getSelectedOptions().map(option => option.value); } - setSelected(value) { + setSelected(ids) { this.changeListen(false); const options = this.select.childNodes; for (const o of options) { @@ -1425,13 +1415,13 @@ for (const oo of optgroupOptions) { if (oo.nodeName === 'OPTION') { const option = oo; - option.selected = value.includes(option.value); + option.selected = ids.includes(option.id); } } } if (o.nodeName === 'OPTION') { const option = o; - option.selected = value.includes(option.value); + option.selected = ids.includes(option.id); } } this.changeListen(true); @@ -1649,8 +1639,8 @@ this.select = new Select(this.selectEl); this.select.updateSelect(this.settings.id, this.settings.style, this.settings.class); this.select.hideUI(); - this.select.onValueChange = (values) => { - this.setSelected(values); + this.select.onValueChange = (options) => { + this.setSelected(options.map(option => option.id)); }; this.select.onClassChange = (classes) => { this.settings.class = classes; @@ -1742,9 +1732,9 @@ getSelected() { return this.store.getSelected(); } - setSelected(value, runAfterChange = true) { + setSelected(id, runAfterChange = true) { const selected = this.store.getSelected(); - this.store.setSelectedBy('value', Array.isArray(value) ? value : [value]); + this.store.setSelectedBy('id', Array.isArray(id) ? id : [id]); const data = this.store.getData(); this.select.updateOptions(data); this.render.renderValues(); diff --git a/dist/slimselect.min.js b/dist/slimselect.min.js index d68c273f..8fde4b4e 100644 --- a/dist/slimselect.min.js +++ b/dist/slimselect.min.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).SlimSelect=t()}(this,(function(){"use strict";function e(){return Math.random().toString(36).substring(2,10)}function t(e,t=50,s=!1){let i;return function(...n){const a=self,l=s&&!i;clearTimeout(i),i=setTimeout((()=>{i=null,s||e.apply(a,n)}),t),l&&e.apply(a,n)}}function s(e,t){return JSON.stringify(e)===JSON.stringify(t)}class i{constructor(t){if(this.id=t.id&&""!==t.id?t.id:e(),this.label=t.label||"",this.selectAll=void 0!==t.selectAll&&t.selectAll,this.selectAllText=t.selectAllText||"Select All",this.closable=t.closable||"off",this.options=[],t.options)for(const e of t.options)this.options.push(new n(e))}}class n{constructor(t){this.id=t.id&&""!==t.id?t.id:e(),this.value=void 0===t.value?t.text:t.value,this.text=t.text||"",this.html=t.html||"",this.selected=void 0!==t.selected&&t.selected,this.display=void 0===t.display||t.display,this.disabled=void 0!==t.disabled&&t.disabled,this.mandatory=void 0!==t.mandatory&&t.mandatory,this.placeholder=void 0!==t.placeholder&&t.placeholder,this.class=t.class||"",this.style=t.style||"",this.data=t.data||{}}}class a{constructor(e,t){this.selectType="single",this.data=[],this.selectType=e,this.setData(t)}validateDataArray(e){if(!Array.isArray(e))return new Error("Data must be an array");for(let t of e){if(!(t instanceof i||"label"in t))return t instanceof n||"text"in t?this.validateOption(t):new Error("Data object must be a valid optgroup or option");if(!("label"in t))return new Error("Optgroup must have a label");if("options"in t&&t.options)for(let e of t.options)return this.validateOption(e)}return null}validateOption(e){return"text"in e?null:new Error("Option must have a text")}partialToFullData(e){let t=[];return e.forEach((e=>{if(e instanceof i||"label"in e){let s=[];"options"in e&&e.options&&e.options.forEach((e=>{s.push(new n(e))})),s.length>0&&t.push(new i(e))}(e instanceof n||"text"in e)&&t.push(new n(e))})),t}setData(e){this.data=this.partialToFullData(e),"single"===this.selectType&&this.setSelectedBy("value",this.getSelected())}getData(){return this.filter(null,!0)}getDataOptions(){return this.filter(null,!1)}addOption(e){this.setData(this.getData().concat(new n(e)))}setSelectedBy(e,t){let s=null,a=!1;for(let l of this.data){if(l instanceof i)for(let i of l.options)s||(s=i),i.selected=!a&&t.includes(i[e]),i.selected&&"single"===this.selectType&&(a=!0);l instanceof n&&(s||(s=l),l.selected=!a&&t.includes(l[e]),l.selected&&"single"===this.selectType&&(a=!0))}"single"===this.selectType&&s&&!a&&(s.selected=!0)}getSelected(){let e=this.getSelectedOptions(),t=[];return e.forEach((e=>{t.push(e.value)})),t}getSelectedOptions(){return this.filter((e=>e.selected),!1)}getSelectedIDs(){let e=this.getSelectedOptions(),t=[];return e.forEach((e=>{t.push(e.id)})),t}getOptgroupByID(e){for(let t of this.data)if(t instanceof i&&t.id===e)return t;return null}getOptionByID(e){let t=this.filter((t=>t.id===e),!1);return t.length?t[0]:null}getSelectType(){return this.selectType}getFirstOption(){let e=null;for(let t of this.data)if(t instanceof i?e=t.options[0]:t instanceof n&&(e=t),e)break;return e}search(e,t){return""===(e=e.trim())?this.getData():this.filter((s=>t(s,e)),!0)}filter(e,t){const s=[];return this.data.forEach((a=>{if(a instanceof i){let l=[];if(a.options.forEach((i=>{e&&!e(i)||(t?l.push(new n(i)):s.push(new n(i)))})),l.length>0){let e=new i(a);e.options=l,s.push(e)}}a instanceof n&&(e&&!e(a)||s.push(new n(a)))})),s}}class l{constructor(e,t,s){this.classes={main:"ss-main",placeholder:"ss-placeholder",values:"ss-values",single:"ss-single",max:"ss-max",value:"ss-value",valueText:"ss-value-text",valueDelete:"ss-value-delete",valueOut:"ss-value-out",deselect:"ss-deselect",deselectPath:"M10,10 L90,90 M10,90 L90,10",arrow:"ss-arrow",arrowClose:"M10,30 L50,70 L90,30",arrowOpen:"M10,70 L50,30 L90,70",content:"ss-content",openAbove:"ss-open-above",openBelow:"ss-open-below",search:"ss-search",searchHighlighter:"ss-search-highlight",searching:"ss-searching",addable:"ss-addable",addablePath:"M50,10 L50,90 M10,50 L90,50",list:"ss-list",optgroup:"ss-optgroup",optgroupLabel:"ss-optgroup-label",optgroupLabelText:"ss-optgroup-label-text",optgroupActions:"ss-optgroup-actions",optgroupSelectAll:"ss-selectall",optgroupSelectAllBox:"M60,10 L10,10 L10,90 L90,90 L90,50",optgroupSelectAllCheck:"M30,45 L50,70 L90,10",optgroupClosable:"ss-closable",option:"ss-option",optionDelete:"M10,10 L90,90 M10,90 L90,10",highlighted:"ss-highlighted",open:"ss-open",close:"ss-close",selected:"ss-selected",error:"ss-error",disabled:"ss-disabled",hide:"ss-hide"},this.store=t,this.settings=e,this.callbacks=s,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes(),this.settings.contentLocation.appendChild(this.content.main)}enable(){this.main.main.classList.remove(this.classes.disabled),this.content.search.input.disabled=!1}disable(){this.main.main.classList.add(this.classes.disabled),this.content.search.input.disabled=!0}open(){this.main.arrow.path.setAttribute("d",this.classes.arrowOpen),this.main.main.classList.add("up"===this.settings.openPosition?this.classes.openAbove:this.classes.openBelow),this.main.main.setAttribute("aria-expanded","true"),this.moveContent();const e=this.store.getSelectedOptions();if(e.length){const t=e[e.length-1].id,s=this.content.list.querySelector('[data-id="'+t+'"]');s&&this.ensureElementInView(this.content.list,s)}}close(){this.main.main.classList.remove(this.classes.openAbove),this.main.main.classList.remove(this.classes.openBelow),this.main.main.setAttribute("aria-expanded","false"),this.content.main.classList.remove(this.classes.openAbove),this.content.main.classList.remove(this.classes.openBelow),this.main.arrow.path.setAttribute("d",this.classes.arrowClose)}updateClassStyles(){if(this.main.main.className="",this.main.main.removeAttribute("style"),this.content.main.className="",this.content.main.removeAttribute("style"),this.main.main.classList.add(this.classes.main),this.content.main.classList.add(this.classes.content),""!==this.settings.style&&(this.main.main.style.cssText=this.settings.style,this.content.main.style.cssText=this.settings.style),this.settings.class.length)for(const e of this.settings.class)""!==e.trim()&&(this.main.main.classList.add(e.trim()),this.content.main.classList.add(e.trim()));"relative"===this.settings.contentPosition&&this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){this.main.main.role="combobox",this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.main.id),this.main.main.setAttribute("aria-expanded","false"),this.content.main.setAttribute("role","listbox")}mainDiv(){var e;const t=document.createElement("div");t.dataset.id=this.settings.id,t.setAttribute("aria-label",this.settings.ariaLabel),t.tabIndex=0,t.onkeydown=e=>{switch(e.key){case"ArrowUp":case"ArrowDown":return this.callbacks.open(),"ArrowDown"===e.key?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Enter":case" ":this.callbacks.open();const t=this.content.list.querySelector("."+this.classes.highlighted);return t&&t.click(),!1;case"Escape":return this.callbacks.close(),!1}return!1},t.onclick=e=>{this.settings.disabled||(this.settings.isOpen?this.callbacks.close():this.callbacks.open())};const s=document.createElement("div");s.classList.add(this.classes.values),t.appendChild(s);const i=document.createElement("div");i.classList.add(this.classes.deselect);const n=null===(e=this.store)||void 0===e?void 0:e.getSelectedOptions();!this.settings.allowDeselect||this.settings.isMultiple&&n&&n.length<=0?i.classList.add(this.classes.hide):i.classList.remove(this.classes.hide),i.onclick=e=>{if(e.stopPropagation(),this.settings.disabled)return;let t=!0;const s=this.store.getSelectedOptions(),i=[];if(this.callbacks.beforeChange&&(t=!0===this.callbacks.beforeChange(i,s)),t){if(this.settings.isMultiple)this.callbacks.setSelected([],!1),this.updateDeselectAll();else{const e=this.store.getFirstOption(),t=e?e.value:"";this.callbacks.setSelected(t,!1)}this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(this.store.getSelectedOptions())}};const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100");const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.deselectPath),a.appendChild(l),i.appendChild(a),t.appendChild(i);const o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.classList.add(this.classes.arrow),o.setAttribute("viewBox","0 0 100 100");const c=document.createElementNS("http://www.w3.org/2000/svg","path");return c.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&o.classList.add(this.classes.hide),o.appendChild(c),t.appendChild(o),{main:t,values:s,deselect:{main:i,svg:a,path:l},arrow:{main:o,path:c}}}mainFocus(e){"click"!==e&&this.main.main.focus({preventScroll:!0})}placeholder(){const e=this.store.filter((e=>e.placeholder),!1);let t=this.settings.placeholderText;e.length&&(""!==e[0].html?t=e[0].html:""!==e[0].text&&(t=e[0].text));const s=document.createElement("div");return s.classList.add(this.classes.placeholder),s.innerHTML=t,s}renderValues(){this.settings.isMultiple?(this.renderMultipleValues(),this.updateDeselectAll()):this.renderSingleValue()}renderSingleValue(){const e=this.store.filter((e=>e.selected&&!e.placeholder),!1),t=e.length>0?e[0]:null;if(t){const e=document.createElement("div");e.classList.add(this.classes.single),t.html?e.innerHTML=t.html:e.innerText=t.text,this.main.values.innerHTML=e.outerHTML}else this.main.values.innerHTML=this.placeholder().outerHTML;this.settings.allowDeselect&&e.length?this.main.deselect.main.classList.remove(this.classes.hide):this.main.deselect.main.classList.add(this.classes.hide)}renderMultipleValues(){let e=this.main.values.childNodes,t=this.store.filter((e=>e.selected&&e.display),!1);if(0===t.length)return void(this.main.values.innerHTML=this.placeholder().outerHTML);{const e=this.main.values.querySelector("."+this.classes.placeholder);e&&e.remove()}if(t.length>this.settings.maxValuesShown){const e=document.createElement("div");return e.classList.add(this.classes.max),e.textContent=this.settings.maxValuesMessage.replace("{number}",t.length.toString()),void(this.main.values.innerHTML=e.outerHTML)}{const e=this.main.values.querySelector("."+this.classes.max);e&&e.remove()}let s=[];for(let i=0;ie.id===a),!1).length||s.push(n)}}for(const e of s)e.classList.add(this.classes.valueOut),setTimeout((()=>{this.main.values.hasChildNodes()&&this.main.values.contains(e)&&this.main.values.removeChild(e)}),100);e=this.main.values.childNodes;for(let s=0;s{if(t.preventDefault(),t.stopPropagation(),this.settings.disabled)return;let s=!0;const a=this.store.getSelectedOptions(),l=a.filter((t=>t.selected&&t.id!==e.id),!0);if(!(this.settings.minSelected&&l.length{this.callbacks.search(e.target.value)}),100),s.onkeydown=e=>{switch(e.key){case"ArrowUp":case"ArrowDown":return"ArrowDown"===e.key?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Escape":return this.callbacks.close(),!1;case"Enter":case" ":if(this.callbacks.addable&&e.ctrlKey)return i.click(),!1;{const e=this.content.list.querySelector("."+this.classes.highlighted);if(e)return e.click(),!1}return!0}return!0},e.appendChild(s),this.callbacks.addable){i.classList.add(this.classes.addable);const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("viewBox","0 0 100 100");const s=document.createElementNS("http://www.w3.org/2000/svg","path");s.setAttribute("d",this.classes.addablePath),t.appendChild(s),i.appendChild(t),i.onclick=e=>{if(e.preventDefault(),e.stopPropagation(),!this.callbacks.addable)return;const t=this.content.search.input.value.trim();if(""===t)return void this.content.search.input.focus();const s=e=>{let t=new n(e);if(this.callbacks.addOption(t),this.settings.isMultiple){let e=this.store.getSelected();e.push(t.value),this.callbacks.setSelected(e,!0)}else this.callbacks.setSelected([t.value],!0);this.callbacks.search(""),this.settings.closeOnSelect&&setTimeout((()=>{this.callbacks.close()}),100)},i=this.callbacks.addable(t);!1!==i&&null!=i&&(i instanceof Promise?i.then((e=>{s("string"==typeof e?{text:e,value:e}:e)})):s("string"==typeof i?{text:i,value:i}:i))},e.appendChild(i),a.addable={main:i,svg:t,path:s}}return a}searchFocus(){this.content.search.input.focus()}getOptions(e=!1,t=!1,s=!1){let i="."+this.classes.option;return e&&(i+=":not(."+this.classes.placeholder+")"),t&&(i+=":not(."+this.classes.disabled+")"),s&&(i+=":not(."+this.classes.hide+")"),Array.from(this.content.list.querySelectorAll(i))}highlight(e){const t=this.getOptions(!0,!0,!0);if(0===t.length)return;if(1===t.length&&!t[0].classList.contains(this.classes.highlighted))return void t[0].classList.add(this.classes.highlighted);let s=!1;for(const e of t)e.classList.contains(this.classes.highlighted)&&(s=!0);if(!s)for(const e of t)if(e.classList.contains(this.classes.selected)){e.classList.add(this.classes.highlighted);break}for(let s=0;s=0?s-1:t.length-1];a.classList.add(this.classes.highlighted),this.ensureElementInView(this.content.list,a);const l=a.parentElement;if(l&&l.classList.contains(this.classes.close)){const e=l.querySelector("."+this.classes.optgroupLabel);e&&e.click()}return}t["down"===e?0:t.length-1].classList.add(this.classes.highlighted),this.ensureElementInView(this.content.list,t["down"===e?0:t.length-1])}listDiv(){const e=document.createElement("div");return e.classList.add(this.classes.list),e}renderError(e){this.content.list.innerHTML="";const t=document.createElement("div");t.classList.add(this.classes.error),t.textContent=e,this.content.list.appendChild(t)}renderSearching(){this.content.list.innerHTML="";const e=document.createElement("div");e.classList.add(this.classes.searching),e.textContent=this.settings.searchingText,this.content.list.appendChild(e)}renderOptions(e){if(this.content.list.innerHTML="",0===e.length){const e=document.createElement("div");return e.classList.add(this.classes.search),e.innerHTML=this.settings.searchText,void this.content.list.appendChild(e)}for(const t of e){if(t instanceof i){const e=document.createElement("div");e.classList.add(this.classes.optgroup);const s=document.createElement("div");s.classList.add(this.classes.optgroupLabel),e.appendChild(s);const i=document.createElement("div");i.classList.add(this.classes.optgroupLabelText),i.textContent=t.label,s.appendChild(i);const n=document.createElement("div");if(n.classList.add(this.classes.optgroupActions),s.appendChild(n),this.settings.isMultiple&&t.selectAll){const e=document.createElement("div");e.classList.add(this.classes.optgroupSelectAll);let s=!0;for(const e of t.options)if(!e.selected){s=!1;break}s&&e.classList.add(this.classes.selected);const i=document.createElement("span");i.textContent=t.selectAllText,e.appendChild(i);const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100"),e.appendChild(a);const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.optgroupSelectAllBox),a.appendChild(l);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.optgroupSelectAllCheck),a.appendChild(o),e.addEventListener("click",(e=>{e.preventDefault(),e.stopPropagation();const i=this.store.getSelected();if(s){const e=i.filter((e=>{for(const s of t.options)if(e===s.value)return!1;return!0}));this.callbacks.setSelected(e,!0)}else{const e=i.concat(t.options.map((e=>e.value)));for(const e of t.options)this.store.getOptionByID(e.id)||this.callbacks.addOption(e);this.callbacks.setSelected(e,!0)}})),n.appendChild(e)}if("off"!==t.closable){const i=document.createElement("div");i.classList.add(this.classes.optgroupClosable);const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100"),a.classList.add(this.classes.arrow),i.appendChild(a);const l=document.createElementNS("http://www.w3.org/2000/svg","path");a.appendChild(l),t.options.some((e=>e.selected))||""!==this.content.search.input.value.trim()?(i.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"open"===t.closable?(e.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"close"===t.closable&&(e.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose)),s.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation(),e.classList.contains(this.classes.close)?(e.classList.remove(this.classes.close),e.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):(e.classList.remove(this.classes.open),e.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose))})),n.appendChild(i)}e.appendChild(s);for(const s of t.options)e.appendChild(this.option(s));this.content.list.appendChild(e)}t instanceof n&&this.content.list.appendChild(this.option(t))}}option(e){if(e.placeholder){const e=document.createElement("div");return e.classList.add(this.classes.option),e.classList.add(this.classes.hide),e}const t=document.createElement("div");return t.dataset.id=e.id,t.id=e.id,t.classList.add(this.classes.option),t.setAttribute("role","option"),e.class&&e.class.split(" ").forEach((e=>{t.classList.add(e)})),e.style&&(t.style.cssText=e.style),this.settings.searchHighlight&&""!==this.content.search.input.value.trim()?t.innerHTML=this.highlightText(""!==e.html?e.html:e.text,this.content.search.input.value,this.classes.searchHighlighter):""!==e.html?t.innerHTML=e.html:t.textContent=e.text,this.settings.showOptionTooltips&&t.textContent&&t.setAttribute("title",t.textContent),e.display||t.classList.add(this.classes.hide),e.disabled&&t.classList.add(this.classes.disabled),e.selected&&this.settings.hideSelected&&t.classList.add(this.classes.hide),e.selected?(t.classList.add(this.classes.selected),t.setAttribute("aria-selected","true"),this.main.main.setAttribute("aria-activedescendant",t.id)):(t.classList.remove(this.classes.selected),t.setAttribute("aria-selected","false")),t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const s=this.store.getSelected(),i=t.currentTarget,n=String(i.dataset.id);if(e.disabled||e.selected&&!this.settings.allowDeselect)return;if(this.settings.isMultiple&&this.settings.maxSelected<=s.length&&!e.selected||this.settings.isMultiple&&this.settings.minSelected>=s.length&&e.selected)return;let a=!1;const l=this.store.getSelectedOptions();let o=[];this.settings.isMultiple&&(o=e.selected?l.filter((e=>e.id!==n)):l.concat(e)),this.settings.isMultiple||(o=e.selected?[]:[e]),this.callbacks.beforeChange||(a=!0),this.callbacks.beforeChange&&(a=!1!==this.callbacks.beforeChange(o,l)),a&&(this.store.getOptionByID(n)||this.callbacks.addOption(e),this.callbacks.setSelected(o.map((e=>e.value)),!1),this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(o))})),t}destroy(){this.main.main.remove(),this.content.main.remove()}highlightText(e,t,s){let i=e;const n=new RegExp("("+t.trim()+")(?![^<]*>[^<>]*${o}`),i}moveContentAbove(){const e=this.main.main.offsetHeight,t=this.content.main.offsetHeight;this.main.main.classList.remove(this.classes.openBelow),this.main.main.classList.add(this.classes.openAbove),this.content.main.classList.remove(this.classes.openBelow),this.content.main.classList.add(this.classes.openAbove);const s=this.main.main.getBoundingClientRect();this.content.main.style.margin="-"+(e+t-1)+"px 0px 0px 0px",this.content.main.style.top=s.top+s.height+window.scrollY+"px",this.content.main.style.left=s.left+window.scrollX+"px",this.content.main.style.width=s.width+"px"}moveContentBelow(){this.main.main.classList.remove(this.classes.openAbove),this.main.main.classList.add(this.classes.openBelow),this.content.main.classList.remove(this.classes.openAbove),this.content.main.classList.add(this.classes.openBelow);const e=this.main.main.getBoundingClientRect();this.content.main.style.margin="-1px 0px 0px 0px","relative"!==this.settings.contentPosition&&(this.content.main.style.top=e.top+e.height+window.scrollY+"px",this.content.main.style.left=e.left+window.scrollX+"px",this.content.main.style.width=e.width+"px")}ensureElementInView(e,t){const s=e.scrollTop+e.offsetTop,i=s+e.clientHeight,n=t.offsetTop,a=n+t.clientHeight;ni&&(e.scrollTop+=a-i)}putContent(){const e=this.main.main.offsetHeight,t=this.main.main.getBoundingClientRect(),s=this.content.main.offsetHeight;return window.innerHeight-(t.top+e)<=s&&t.top>s?"up":"down"}updateDeselectAll(){if(!this.store||!this.settings)return;const e=this.store.getSelectedOptions(),t=e&&e.length>0,s=this.settings.isMultiple,i=this.settings.allowDeselect,n=this.main.deselect.main,a=this.classes.hide;!i||s&&!t?n.classList.add(a):n.classList.remove(a)}}class o{constructor(e){this.listen=!1,this.observer=null,this.select=e,this.valueChange=this.valueChange.bind(this),this.select.addEventListener("change",this.valueChange,{passive:!0}),this.observer=new MutationObserver(this.observeCall.bind(this)),this.changeListen(!0)}enable(){this.select.disabled=!1}disable(){this.select.disabled=!0}hideUI(){this.select.tabIndex=-1,this.select.style.display="none",this.select.setAttribute("aria-hidden","true")}showUI(){this.select.removeAttribute("tabindex"),this.select.style.display="",this.select.removeAttribute("aria-hidden")}changeListen(e){this.listen=e,e&&this.observer&&this.observer.observe(this.select,{subtree:!0,childList:!0,attributes:!0}),e||this.observer&&this.observer.disconnect()}valueChange(e){return this.listen&&this.onValueChange&&this.onValueChange(this.getSelectedValues()),!0}observeCall(e){if(!this.listen)return;let t=!1,s=!1,i=!1;for(const n of e)n.target===this.select&&("disabled"===n.attributeName&&(s=!0),"class"===n.attributeName&&(t=!0)),"OPTGROUP"!==n.target.nodeName&&"OPTION"!==n.target.nodeName||(i=!0);t&&this.onClassChange&&this.onClassChange(this.select.className.split(" ")),s&&this.onDisabledChange&&(this.changeListen(!1),this.onDisabledChange(this.select.disabled),this.changeListen(!0)),i&&this.onOptionsChange&&(this.changeListen(!1),this.onOptionsChange(this.getData()),this.changeListen(!0))}getData(){let e=[];const t=this.select.childNodes;for(const s of t)"OPTGROUP"===s.nodeName&&e.push(this.getDataFromOptgroup(s)),"OPTION"===s.nodeName&&e.push(this.getDataFromOption(s));return e}getDataFromOptgroup(e){let t={id:e.id,label:e.label,selectAll:!!e.dataset&&"true"===e.dataset.selectall,selectAllText:e.dataset?e.dataset.selectalltext:"Select all",closable:e.dataset?e.dataset.closable:"off",options:[]};const s=e.childNodes;for(const e of s)"OPTION"===e.nodeName&&t.options.push(this.getDataFromOption(e));return t}getDataFromOption(e){return{id:e.id,value:e.value,text:e.text,html:e.dataset&&e.dataset.html?e.dataset.html:"",selected:e.selected,display:"none"!==e.style.display,disabled:e.disabled,mandatory:!!e.dataset&&"true"===e.dataset.mandatory,placeholder:"true"===e.dataset.placeholder,class:e.className,style:e.style.cssText,data:e.dataset}}getSelectedValues(){let e=[];const t=this.select.childNodes;for(const s of t){if("OPTGROUP"===s.nodeName){const t=s.childNodes;for(const s of t)if("OPTION"===s.nodeName){const t=s;t.selected&&e.push(t.value)}}if("OPTION"===s.nodeName){const t=s;t.selected&&e.push(t.value)}}return e}setSelected(e){this.changeListen(!1);const t=this.select.childNodes;for(const s of t){if("OPTGROUP"===s.nodeName){const t=s.childNodes;for(const s of t)if("OPTION"===s.nodeName){const t=s;t.selected=e.includes(t.value)}}if("OPTION"===s.nodeName){const t=s;t.selected=e.includes(t.value)}}this.changeListen(!0)}updateSelect(e,t,s){this.changeListen(!1),e&&(this.select.dataset.id=e),t&&(this.select.style.cssText=t),s&&(this.select.className="",s.forEach((e=>{""!==e.trim()&&this.select.classList.add(e.trim())}))),this.changeListen(!0)}updateOptions(e){this.changeListen(!1),this.select.innerHTML="";for(const t of e)t instanceof i&&this.select.appendChild(this.createOptgroup(t)),t instanceof n&&this.select.appendChild(this.createOption(t));this.select.dispatchEvent(new Event("change")),this.changeListen(!0)}createOptgroup(e){const t=document.createElement("optgroup");if(t.id=e.id,t.label=e.label,e.selectAll&&(t.dataset.selectAll="true"),"off"!==e.closable&&(t.dataset.closable=e.closable),e.options)for(const s of e.options)t.appendChild(this.createOption(s));return t}createOption(e){const t=document.createElement("option");return t.id=e.id,t.value=e.value,t.innerHTML=e.text,""!==e.html&&t.setAttribute("data-html",e.html),e.selected&&(t.selected=e.selected),e.disabled&&(t.disabled=!0),!1===e.display&&(t.style.display="none"),e.placeholder&&t.setAttribute("data-placeholder","true"),e.mandatory&&t.setAttribute("data-mandatory","true"),e.class&&e.class.split(" ").forEach((e=>{t.classList.add(e)})),e.data&&"object"==typeof e.data&&Object.keys(e.data).forEach((s=>{t.setAttribute("data-"+function(e){const t=e.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,(e=>"-"+e.toLowerCase()));return e[0]===e[0].toUpperCase()?t.substring(1):t}(s),e.data[s])})),t}destroy(){this.changeListen(!1),this.select.removeEventListener("change",this.valueChange),this.observer&&(this.observer.disconnect(),this.observer=null),delete this.select.dataset.id,this.showUI()}}class c{constructor(t){this.id="",this.style="",this.class=[],this.isMultiple=!1,this.isOpen=!1,this.isFullOpen=!1,this.intervalMove=null,t||(t={}),this.id="ss-"+e(),this.style=t.style||"",this.class=t.class||[],this.disabled=void 0!==t.disabled&&t.disabled,this.alwaysOpen=void 0!==t.alwaysOpen&&t.alwaysOpen,this.showSearch=void 0===t.showSearch||t.showSearch,this.ariaLabel=t.ariaLabel||"Combobox",this.searchPlaceholder=t.searchPlaceholder||"Search",this.searchText=t.searchText||"No Results",this.searchingText=t.searchingText||"Searching...",this.searchHighlight=void 0!==t.searchHighlight&&t.searchHighlight,this.closeOnSelect=void 0===t.closeOnSelect||t.closeOnSelect,this.contentLocation=t.contentLocation||document.body,this.contentPosition=t.contentPosition||"absolute",this.openPosition=t.openPosition||"auto",this.placeholderText=void 0!==t.placeholderText?t.placeholderText:"Select Value",this.allowDeselect=void 0!==t.allowDeselect&&t.allowDeselect,this.hideSelected=void 0!==t.hideSelected&&t.hideSelected,this.keepOrder=void 0!==t.keepOrder&&t.keepOrder,this.showOptionTooltips=void 0!==t.showOptionTooltips&&t.showOptionTooltips,this.minSelected=t.minSelected||0,this.maxSelected=t.maxSelected||1e3,this.timeoutDelay=t.timeoutDelay||200,this.maxValuesShown=t.maxValuesShown||20,this.maxValuesMessage=t.maxValuesMessage||"{number} selected"}}return class{constructor(e){var s;if(this.events={search:void 0,searchFilter:(e,t)=>-1!==e.text.toLowerCase().indexOf(t.toLowerCase()),addable:void 0,beforeChange:void 0,afterChange:void 0,beforeOpen:void 0,afterOpen:void 0,beforeClose:void 0,afterClose:void 0},this.windowResize=t((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.windowScroll=t((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.documentClick=e=>{this.settings.isOpen&&e.target&&!function(e,t){function s(e,s){return s&&e&&e.classList&&e.classList.contains(s)||s&&e&&e.dataset&&e.dataset.id&&e.dataset.id===t?e:null}return s(e,t)||function e(t,i){return t&&t!==document?s(t,i)?t:e(t.parentNode,i):null}(e,t)}(e.target,this.settings.id)&&this.close(e.type)},this.windowVisibilityChange=()=>{document.hidden&&this.close()},this.selectEl="string"==typeof e.select?document.querySelector(e.select):e.select,!this.selectEl)return void(e.events&&e.events.error&&e.events.error(new Error("Could not find select element")));if("SELECT"!==this.selectEl.tagName)return void(e.events&&e.events.error&&e.events.error(new Error("Element isnt of type select")));this.selectEl.dataset.ssid&&this.destroy(),this.settings=new c(e.settings);const i=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const s in e.events)e.events.hasOwnProperty(s)&&(-1!==i.indexOf(s)?this.events[s]=t(e.events[s],100):this.events[s]=e.events[s]);this.settings.disabled=(null===(s=e.settings)||void 0===s?void 0:s.disabled)?e.settings.disabled:this.selectEl.disabled,this.settings.isMultiple=this.selectEl.multiple,this.settings.style=this.selectEl.style.cssText,this.settings.class=this.selectEl.className.split(" "),this.select=new o(this.selectEl),this.select.updateSelect(this.settings.id,this.settings.style,this.settings.class),this.select.hideUI(),this.select.onValueChange=e=>{this.setSelected(e)},this.select.onClassChange=e=>{this.settings.class=e,this.render.updateClassStyles()},this.select.onDisabledChange=e=>{e?this.disable():this.enable()},this.select.onOptionsChange=e=>{this.setData(e)},this.store=new a(this.settings.isMultiple?"multiple":"single",e.data?e.data:this.select.getData()),e.data&&this.select.updateOptions(this.store.getData());const n={open:this.open.bind(this),close:this.close.bind(this),addable:this.events.addable?this.events.addable:void 0,setSelected:this.setSelected.bind(this),addOption:this.addOption.bind(this),search:this.search.bind(this),beforeChange:this.events.beforeChange,afterChange:this.events.afterChange};this.render=new l(this.settings,this.store,n),this.render.renderValues(),this.render.renderOptions(this.store.getData());const h=this.selectEl.getAttribute("aria-label"),r=this.selectEl.getAttribute("aria-labelledby");h?this.render.main.main.setAttribute("aria-label",h):r&&this.render.main.main.setAttribute("aria-labelledby",r),this.selectEl.parentNode&&this.selectEl.parentNode.insertBefore(this.render.main.main,this.selectEl.nextSibling),window.addEventListener("resize",this.windowResize,!1),"auto"===this.settings.openPosition&&window.addEventListener("scroll",this.windowScroll,!1),document.addEventListener("visibilitychange",this.windowVisibilityChange),this.settings.disabled&&this.disable(),this.settings.alwaysOpen&&this.open(),this.selectEl.slim=this}enable(){this.settings.disabled=!1,this.select.enable(),this.render.enable()}disable(){this.settings.disabled=!0,this.select.disable(),this.render.disable()}getData(){return this.store.getData()}setData(e){const t=this.store.getSelected(),i=this.store.validateDataArray(e);if(i)return void(this.events.error&&this.events.error(i));this.store.setData(e);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!s(t,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){return this.store.getSelected()}setSelected(e,t=!0){const i=this.store.getSelected();this.store.setSelectedBy("value",Array.isArray(e)?e:[e]);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),""!==this.render.content.search.input.value?this.search(this.render.content.search.input.value):this.render.renderOptions(n),t&&this.events.afterChange&&!s(i,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}addOption(e){const t=this.store.getSelected();this.store.getDataOptions().some((t=>{var s;return t.value===(null!==(s=e.value)&&void 0!==s?s:e.text)}))||this.store.addOption(e);const i=this.store.getData();this.select.updateOptions(i),this.render.renderValues(),this.render.renderOptions(i),this.events.afterChange&&!s(t,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}open(){this.settings.disabled||this.settings.isOpen||(this.events.beforeOpen&&this.events.beforeOpen(),this.render.open(),this.settings.showSearch&&this.render.searchFocus(),this.settings.isOpen=!0,setTimeout((()=>{this.events.afterOpen&&this.events.afterOpen(),this.settings.isOpen&&(this.settings.isFullOpen=!0),document.addEventListener("click",this.documentClick)}),this.settings.timeoutDelay),"absolute"===this.settings.contentPosition&&(this.settings.intervalMove&&clearInterval(this.settings.intervalMove),this.settings.intervalMove=setInterval(this.render.moveContent.bind(this.render),500)))}close(e=null){this.settings.isOpen&&!this.settings.alwaysOpen&&(this.events.beforeClose&&this.events.beforeClose(),this.render.close(),""!==this.render.content.search.input.value&&this.search(""),this.render.mainFocus(e),this.settings.isOpen=!1,this.settings.isFullOpen=!1,setTimeout((()=>{this.events.afterClose&&this.events.afterClose(),document.removeEventListener("click",this.documentClick)}),this.settings.timeoutDelay),this.settings.intervalMove&&clearInterval(this.settings.intervalMove))}search(e){if(this.render.content.search.input.value!==e&&(this.render.content.search.input.value=e),!this.events.search)return void this.render.renderOptions(""===e?this.store.getData():this.store.search(e,this.events.searchFilter));this.render.renderSearching();const t=this.events.search(e,this.store.getSelectedOptions());t instanceof Promise?t.then((e=>{this.render.renderOptions(this.store.partialToFullData(e))})).catch((e=>{this.render.renderError("string"==typeof e?e:e.message)})):Array.isArray(t)?this.render.renderOptions(this.store.partialToFullData(t)):this.render.renderError("Search event must return a promise or an array of data")}destroy(){document.removeEventListener("click",this.documentClick),window.removeEventListener("resize",this.windowResize,!1),"auto"===this.settings.openPosition&&window.removeEventListener("scroll",this.windowScroll,!1),document.removeEventListener("visibilitychange",this.windowVisibilityChange),this.store.setData([]),this.render.destroy(),this.select.destroy()}}})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).SlimSelect=e()}(this,(function(){"use strict";function t(){return Math.random().toString(36).substring(2,10)}function e(t,e=50,s=!1){let i;return function(...n){const a=self,l=s&&!i;clearTimeout(i),i=setTimeout((()=>{i=null,s||t.apply(a,n)}),e),l&&t.apply(a,n)}}function s(t,e){return JSON.stringify(t)===JSON.stringify(e)}class i{constructor(e){if(this.id=e.id&&""!==e.id?e.id:t(),this.label=e.label||"",this.selectAll=void 0!==e.selectAll&&e.selectAll,this.selectAllText=e.selectAllText||"Select All",this.closable=e.closable||"off",this.options=[],e.options)for(const t of e.options)this.options.push(new n(t))}}class n{constructor(e){this.id=e.id&&""!==e.id?e.id:t(),this.value=void 0===e.value?e.text:e.value,this.text=e.text||"",this.html=e.html||"",this.selected=void 0!==e.selected&&e.selected,this.display=void 0===e.display||e.display,this.disabled=void 0!==e.disabled&&e.disabled,this.mandatory=void 0!==e.mandatory&&e.mandatory,this.placeholder=void 0!==e.placeholder&&e.placeholder,this.class=e.class||"",this.style=e.style||"",this.data=e.data||{}}}class a{constructor(t,e){this.selectType="single",this.data=[],this.selectType=t,this.setData(e)}validateDataArray(t){if(!Array.isArray(t))return new Error("Data must be an array");for(let e of t){if(!(e instanceof i||"label"in e))return e instanceof n||"text"in e?this.validateOption(e):new Error("Data object must be a valid optgroup or option");if(!("label"in e))return new Error("Optgroup must have a label");if("options"in e&&e.options)for(let t of e.options)return this.validateOption(t)}return null}validateOption(t){return"text"in t?null:new Error("Option must have a text")}partialToFullData(t){let e=[];return t.forEach((t=>{if(t instanceof i||"label"in t){let s=[];"options"in t&&t.options&&t.options.forEach((t=>{s.push(new n(t))})),s.length>0&&e.push(new i(t))}(t instanceof n||"text"in t)&&e.push(new n(t))})),e}setData(t){this.data=this.partialToFullData(t),"single"===this.selectType&&this.setSelectedBy("id",this.getSelected())}getData(){return this.filter(null,!0)}getDataOptions(){return this.filter(null,!1)}addOption(t){this.setData(this.getData().concat(new n(t)))}setSelectedBy(t,e){let s=null,a=!1;for(let l of this.data){if(l instanceof i)for(let i of l.options)s||(s=i),i.selected=!a&&e.includes(i[t]),i.selected&&"single"===this.selectType&&(a=!0);l instanceof n&&(s||(s=l),l.selected=!a&&e.includes(l[t]),l.selected&&"single"===this.selectType&&(a=!0))}"single"===this.selectType&&s&&!a&&(s.selected=!0)}getSelected(){return this.getSelectedOptions().map((t=>t.id))}getSelectedOptions(){return this.filter((t=>t.selected),!1)}getOptgroupByID(t){for(let e of this.data)if(e instanceof i&&e.id===t)return e;return null}getOptionByID(t){let e=this.filter((e=>e.id===t),!1);return e.length?e[0]:null}getSelectType(){return this.selectType}getFirstOption(){let t=null;for(let e of this.data)if(e instanceof i?t=e.options[0]:e instanceof n&&(t=e),t)break;return t}search(t,e){return""===(t=t.trim())?this.getData():this.filter((s=>e(s,t)),!0)}filter(t,e){const s=[];return this.data.forEach((a=>{if(a instanceof i){let l=[];if(a.options.forEach((i=>{t&&!t(i)||(e?l.push(new n(i)):s.push(new n(i)))})),l.length>0){let t=new i(a);t.options=l,s.push(t)}}a instanceof n&&(t&&!t(a)||s.push(new n(a)))})),s}}class l{constructor(t,e,s){this.classes={main:"ss-main",placeholder:"ss-placeholder",values:"ss-values",single:"ss-single",max:"ss-max",value:"ss-value",valueText:"ss-value-text",valueDelete:"ss-value-delete",valueOut:"ss-value-out",deselect:"ss-deselect",deselectPath:"M10,10 L90,90 M10,90 L90,10",arrow:"ss-arrow",arrowClose:"M10,30 L50,70 L90,30",arrowOpen:"M10,70 L50,30 L90,70",content:"ss-content",openAbove:"ss-open-above",openBelow:"ss-open-below",search:"ss-search",searchHighlighter:"ss-search-highlight",searching:"ss-searching",addable:"ss-addable",addablePath:"M50,10 L50,90 M10,50 L90,50",list:"ss-list",optgroup:"ss-optgroup",optgroupLabel:"ss-optgroup-label",optgroupLabelText:"ss-optgroup-label-text",optgroupActions:"ss-optgroup-actions",optgroupSelectAll:"ss-selectall",optgroupSelectAllBox:"M60,10 L10,10 L10,90 L90,90 L90,50",optgroupSelectAllCheck:"M30,45 L50,70 L90,10",optgroupClosable:"ss-closable",option:"ss-option",optionDelete:"M10,10 L90,90 M10,90 L90,10",highlighted:"ss-highlighted",open:"ss-open",close:"ss-close",selected:"ss-selected",error:"ss-error",disabled:"ss-disabled",hide:"ss-hide"},this.store=e,this.settings=t,this.callbacks=s,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes(),this.settings.contentLocation.appendChild(this.content.main)}enable(){this.main.main.classList.remove(this.classes.disabled),this.content.search.input.disabled=!1}disable(){this.main.main.classList.add(this.classes.disabled),this.content.search.input.disabled=!0}open(){this.main.arrow.path.setAttribute("d",this.classes.arrowOpen),this.main.main.classList.add("up"===this.settings.openPosition?this.classes.openAbove:this.classes.openBelow),this.main.main.setAttribute("aria-expanded","true"),this.moveContent();const t=this.store.getSelectedOptions();if(t.length){const e=t[t.length-1].id,s=this.content.list.querySelector('[data-id="'+e+'"]');s&&this.ensureElementInView(this.content.list,s)}}close(){this.main.main.classList.remove(this.classes.openAbove),this.main.main.classList.remove(this.classes.openBelow),this.main.main.setAttribute("aria-expanded","false"),this.content.main.classList.remove(this.classes.openAbove),this.content.main.classList.remove(this.classes.openBelow),this.main.arrow.path.setAttribute("d",this.classes.arrowClose)}updateClassStyles(){if(this.main.main.className="",this.main.main.removeAttribute("style"),this.content.main.className="",this.content.main.removeAttribute("style"),this.main.main.classList.add(this.classes.main),this.content.main.classList.add(this.classes.content),""!==this.settings.style&&(this.main.main.style.cssText=this.settings.style,this.content.main.style.cssText=this.settings.style),this.settings.class.length)for(const t of this.settings.class)""!==t.trim()&&(this.main.main.classList.add(t.trim()),this.content.main.classList.add(t.trim()));"relative"===this.settings.contentPosition&&this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){this.main.main.role="combobox",this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.main.id),this.main.main.setAttribute("aria-expanded","false"),this.content.main.setAttribute("role","listbox")}mainDiv(){var t;const e=document.createElement("div");e.dataset.id=this.settings.id,e.setAttribute("aria-label",this.settings.ariaLabel),e.tabIndex=0,e.onkeydown=t=>{switch(t.key){case"ArrowUp":case"ArrowDown":return this.callbacks.open(),"ArrowDown"===t.key?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Enter":case" ":this.callbacks.open();const e=this.content.list.querySelector("."+this.classes.highlighted);return e&&e.click(),!1;case"Escape":return this.callbacks.close(),!1}return!1},e.onclick=t=>{this.settings.disabled||(this.settings.isOpen?this.callbacks.close():this.callbacks.open())};const s=document.createElement("div");s.classList.add(this.classes.values),e.appendChild(s);const i=document.createElement("div");i.classList.add(this.classes.deselect);const n=null===(t=this.store)||void 0===t?void 0:t.getSelectedOptions();!this.settings.allowDeselect||this.settings.isMultiple&&n&&n.length<=0?i.classList.add(this.classes.hide):i.classList.remove(this.classes.hide),i.onclick=t=>{if(t.stopPropagation(),this.settings.disabled)return;let e=!0;const s=this.store.getSelectedOptions(),i=[];if(this.callbacks.beforeChange&&(e=!0===this.callbacks.beforeChange(i,s)),e){if(this.settings.isMultiple)this.callbacks.setSelected([],!1),this.updateDeselectAll();else{const t=this.store.getFirstOption(),e=t?t.id:"";this.callbacks.setSelected(e,!1)}this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(this.store.getSelectedOptions())}};const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100");const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.deselectPath),a.appendChild(l),i.appendChild(a),e.appendChild(i);const o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.classList.add(this.classes.arrow),o.setAttribute("viewBox","0 0 100 100");const c=document.createElementNS("http://www.w3.org/2000/svg","path");return c.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&o.classList.add(this.classes.hide),o.appendChild(c),e.appendChild(o),{main:e,values:s,deselect:{main:i,svg:a,path:l},arrow:{main:o,path:c}}}mainFocus(t){"click"!==t&&this.main.main.focus({preventScroll:!0})}placeholder(){const t=this.store.filter((t=>t.placeholder),!1);let e=this.settings.placeholderText;t.length&&(""!==t[0].html?e=t[0].html:""!==t[0].text&&(e=t[0].text));const s=document.createElement("div");return s.classList.add(this.classes.placeholder),s.innerHTML=e,s}renderValues(){this.settings.isMultiple?(this.renderMultipleValues(),this.updateDeselectAll()):this.renderSingleValue()}renderSingleValue(){const t=this.store.filter((t=>t.selected&&!t.placeholder),!1),e=t.length>0?t[0]:null;if(e){const t=document.createElement("div");t.classList.add(this.classes.single),e.html?t.innerHTML=e.html:t.innerText=e.text,this.main.values.innerHTML=t.outerHTML}else this.main.values.innerHTML=this.placeholder().outerHTML;this.settings.allowDeselect&&t.length?this.main.deselect.main.classList.remove(this.classes.hide):this.main.deselect.main.classList.add(this.classes.hide)}renderMultipleValues(){let t=this.main.values.childNodes,e=this.store.filter((t=>t.selected&&t.display),!1);if(0===e.length)return void(this.main.values.innerHTML=this.placeholder().outerHTML);{const t=this.main.values.querySelector("."+this.classes.placeholder);t&&t.remove()}if(e.length>this.settings.maxValuesShown){const t=document.createElement("div");return t.classList.add(this.classes.max),t.textContent=this.settings.maxValuesMessage.replace("{number}",e.length.toString()),void(this.main.values.innerHTML=t.outerHTML)}{const t=this.main.values.querySelector("."+this.classes.max);t&&t.remove()}let s=[];for(let i=0;it.id===a),!1).length||s.push(n)}}for(const t of s)t.classList.add(this.classes.valueOut),setTimeout((()=>{this.main.values.hasChildNodes()&&this.main.values.contains(t)&&this.main.values.removeChild(t)}),100);t=this.main.values.childNodes;for(let s=0;s{if(e.preventDefault(),e.stopPropagation(),this.settings.disabled)return;let s=!0;const a=this.store.getSelectedOptions(),l=a.filter((e=>e.selected&&e.id!==t.id),!0);if(!(this.settings.minSelected&&l.length{this.callbacks.search(t.target.value)}),100),s.onkeydown=t=>{switch(t.key){case"ArrowUp":case"ArrowDown":return"ArrowDown"===t.key?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Escape":return this.callbacks.close(),!1;case"Enter":case" ":if(this.callbacks.addable&&t.ctrlKey)return i.click(),!1;{const t=this.content.list.querySelector("."+this.classes.highlighted);if(t)return t.click(),!1}return!0}return!0},t.appendChild(s),this.callbacks.addable){i.classList.add(this.classes.addable);const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 100 100");const s=document.createElementNS("http://www.w3.org/2000/svg","path");s.setAttribute("d",this.classes.addablePath),e.appendChild(s),i.appendChild(e),i.onclick=t=>{if(t.preventDefault(),t.stopPropagation(),!this.callbacks.addable)return;const e=this.content.search.input.value.trim();if(""===e)return void this.content.search.input.focus();const s=t=>{let e=new n(t);if(this.callbacks.addOption(e),this.settings.isMultiple){let t=this.store.getSelected();t.push(e.id),this.callbacks.setSelected(t,!0)}else this.callbacks.setSelected([e.id],!0);this.callbacks.search(""),this.settings.closeOnSelect&&setTimeout((()=>{this.callbacks.close()}),100)},i=this.callbacks.addable(e);!1!==i&&null!=i&&(i instanceof Promise?i.then((t=>{s("string"==typeof t?{text:t,value:t}:t)})):s("string"==typeof i?{text:i,value:i}:i))},t.appendChild(i),a.addable={main:i,svg:e,path:s}}return a}searchFocus(){this.content.search.input.focus()}getOptions(t=!1,e=!1,s=!1){let i="."+this.classes.option;return t&&(i+=":not(."+this.classes.placeholder+")"),e&&(i+=":not(."+this.classes.disabled+")"),s&&(i+=":not(."+this.classes.hide+")"),Array.from(this.content.list.querySelectorAll(i))}highlight(t){const e=this.getOptions(!0,!0,!0);if(0===e.length)return;if(1===e.length&&!e[0].classList.contains(this.classes.highlighted))return void e[0].classList.add(this.classes.highlighted);let s=!1;for(const t of e)t.classList.contains(this.classes.highlighted)&&(s=!0);if(!s)for(const t of e)if(t.classList.contains(this.classes.selected)){t.classList.add(this.classes.highlighted);break}for(let s=0;s=0?s-1:e.length-1];a.classList.add(this.classes.highlighted),this.ensureElementInView(this.content.list,a);const l=a.parentElement;if(l&&l.classList.contains(this.classes.close)){const t=l.querySelector("."+this.classes.optgroupLabel);t&&t.click()}return}e["down"===t?0:e.length-1].classList.add(this.classes.highlighted),this.ensureElementInView(this.content.list,e["down"===t?0:e.length-1])}listDiv(){const t=document.createElement("div");return t.classList.add(this.classes.list),t}renderError(t){this.content.list.innerHTML="";const e=document.createElement("div");e.classList.add(this.classes.error),e.textContent=t,this.content.list.appendChild(e)}renderSearching(){this.content.list.innerHTML="";const t=document.createElement("div");t.classList.add(this.classes.searching),t.textContent=this.settings.searchingText,this.content.list.appendChild(t)}renderOptions(t){if(this.content.list.innerHTML="",0===t.length){const t=document.createElement("div");return t.classList.add(this.classes.search),t.innerHTML=this.settings.searchText,void this.content.list.appendChild(t)}for(const e of t){if(e instanceof i){const t=document.createElement("div");t.classList.add(this.classes.optgroup);const s=document.createElement("div");s.classList.add(this.classes.optgroupLabel),t.appendChild(s);const i=document.createElement("div");i.classList.add(this.classes.optgroupLabelText),i.textContent=e.label,s.appendChild(i);const n=document.createElement("div");if(n.classList.add(this.classes.optgroupActions),s.appendChild(n),this.settings.isMultiple&&e.selectAll){const t=document.createElement("div");t.classList.add(this.classes.optgroupSelectAll);let s=!0;for(const t of e.options)if(!t.selected){s=!1;break}s&&t.classList.add(this.classes.selected);const i=document.createElement("span");i.textContent=e.selectAllText,t.appendChild(i);const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100"),t.appendChild(a);const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.optgroupSelectAllBox),a.appendChild(l);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.optgroupSelectAllCheck),a.appendChild(o),t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const i=this.store.getSelected();if(s){const t=i.filter((t=>{for(const s of e.options)if(t===s.id)return!1;return!0}));this.callbacks.setSelected(t,!0)}else{const t=i.concat(e.options.map((t=>t.id)));for(const t of e.options)this.store.getOptionByID(t.id)||this.callbacks.addOption(t);this.callbacks.setSelected(t,!0)}})),n.appendChild(t)}if("off"!==e.closable){const i=document.createElement("div");i.classList.add(this.classes.optgroupClosable);const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100"),a.classList.add(this.classes.arrow),i.appendChild(a);const l=document.createElementNS("http://www.w3.org/2000/svg","path");a.appendChild(l),e.options.some((t=>t.selected))||""!==this.content.search.input.value.trim()?(i.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"open"===e.closable?(t.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"close"===e.closable&&(t.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose)),s.addEventListener("click",(e=>{e.preventDefault(),e.stopPropagation(),t.classList.contains(this.classes.close)?(t.classList.remove(this.classes.close),t.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):(t.classList.remove(this.classes.open),t.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose))})),n.appendChild(i)}t.appendChild(s);for(const s of e.options)t.appendChild(this.option(s));this.content.list.appendChild(t)}e instanceof n&&this.content.list.appendChild(this.option(e))}}option(t){if(t.placeholder){const t=document.createElement("div");return t.classList.add(this.classes.option),t.classList.add(this.classes.hide),t}const e=document.createElement("div");return e.dataset.id=t.id,e.id=t.id,e.classList.add(this.classes.option),e.setAttribute("role","option"),t.class&&t.class.split(" ").forEach((t=>{e.classList.add(t)})),t.style&&(e.style.cssText=t.style),this.settings.searchHighlight&&""!==this.content.search.input.value.trim()?e.innerHTML=this.highlightText(""!==t.html?t.html:t.text,this.content.search.input.value,this.classes.searchHighlighter):""!==t.html?e.innerHTML=t.html:e.textContent=t.text,this.settings.showOptionTooltips&&e.textContent&&e.setAttribute("title",e.textContent),t.display||e.classList.add(this.classes.hide),t.disabled&&e.classList.add(this.classes.disabled),t.selected&&this.settings.hideSelected&&e.classList.add(this.classes.hide),t.selected?(e.classList.add(this.classes.selected),e.setAttribute("aria-selected","true"),this.main.main.setAttribute("aria-activedescendant",e.id)):(e.classList.remove(this.classes.selected),e.setAttribute("aria-selected","false")),e.addEventListener("click",(e=>{e.preventDefault(),e.stopPropagation();const s=this.store.getSelected(),i=e.currentTarget,n=String(i.dataset.id);if(t.disabled||t.selected&&!this.settings.allowDeselect)return;if(this.settings.isMultiple&&this.settings.maxSelected<=s.length&&!t.selected||this.settings.isMultiple&&this.settings.minSelected>=s.length&&t.selected)return;let a=!1;const l=this.store.getSelectedOptions();let o=[];this.settings.isMultiple&&(o=t.selected?l.filter((t=>t.id!==n)):l.concat(t)),this.settings.isMultiple||(o=t.selected?[]:[t]),this.callbacks.beforeChange||(a=!0),this.callbacks.beforeChange&&(a=!1!==this.callbacks.beforeChange(o,l)),a&&(this.store.getOptionByID(n)||this.callbacks.addOption(t),this.callbacks.setSelected(o.map((t=>t.id)),!1),this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(o))})),e}destroy(){this.main.main.remove(),this.content.main.remove()}highlightText(t,e,s){let i=t;const n=new RegExp("("+e.trim()+")(?![^<]*>[^<>]*${o}`),i}moveContentAbove(){const t=this.main.main.offsetHeight,e=this.content.main.offsetHeight;this.main.main.classList.remove(this.classes.openBelow),this.main.main.classList.add(this.classes.openAbove),this.content.main.classList.remove(this.classes.openBelow),this.content.main.classList.add(this.classes.openAbove);const s=this.main.main.getBoundingClientRect();this.content.main.style.margin="-"+(t+e-1)+"px 0px 0px 0px",this.content.main.style.top=s.top+s.height+window.scrollY+"px",this.content.main.style.left=s.left+window.scrollX+"px",this.content.main.style.width=s.width+"px"}moveContentBelow(){this.main.main.classList.remove(this.classes.openAbove),this.main.main.classList.add(this.classes.openBelow),this.content.main.classList.remove(this.classes.openAbove),this.content.main.classList.add(this.classes.openBelow);const t=this.main.main.getBoundingClientRect();this.content.main.style.margin="-1px 0px 0px 0px","relative"!==this.settings.contentPosition&&(this.content.main.style.top=t.top+t.height+window.scrollY+"px",this.content.main.style.left=t.left+window.scrollX+"px",this.content.main.style.width=t.width+"px")}ensureElementInView(t,e){const s=t.scrollTop+t.offsetTop,i=s+t.clientHeight,n=e.offsetTop,a=n+e.clientHeight;ni&&(t.scrollTop+=a-i)}putContent(){const t=this.main.main.offsetHeight,e=this.main.main.getBoundingClientRect(),s=this.content.main.offsetHeight;return window.innerHeight-(e.top+t)<=s&&e.top>s?"up":"down"}updateDeselectAll(){if(!this.store||!this.settings)return;const t=this.store.getSelectedOptions(),e=t&&t.length>0,s=this.settings.isMultiple,i=this.settings.allowDeselect,n=this.main.deselect.main,a=this.classes.hide;!i||s&&!e?n.classList.add(a):n.classList.remove(a)}}class o{constructor(t){this.listen=!1,this.observer=null,this.select=t,this.valueChange=this.valueChange.bind(this),this.select.addEventListener("change",this.valueChange,{passive:!0}),this.observer=new MutationObserver(this.observeCall.bind(this)),this.changeListen(!0)}enable(){this.select.disabled=!1}disable(){this.select.disabled=!0}hideUI(){this.select.tabIndex=-1,this.select.style.display="none",this.select.setAttribute("aria-hidden","true")}showUI(){this.select.removeAttribute("tabindex"),this.select.style.display="",this.select.removeAttribute("aria-hidden")}changeListen(t){this.listen=t,t&&this.observer&&this.observer.observe(this.select,{subtree:!0,childList:!0,attributes:!0}),t||this.observer&&this.observer.disconnect()}valueChange(t){return this.listen&&this.onValueChange&&this.onValueChange(this.getSelectedOptions()),!0}observeCall(t){if(!this.listen)return;let e=!1,s=!1,i=!1;for(const n of t)n.target===this.select&&("disabled"===n.attributeName&&(s=!0),"class"===n.attributeName&&(e=!0)),"OPTGROUP"!==n.target.nodeName&&"OPTION"!==n.target.nodeName||(i=!0);e&&this.onClassChange&&this.onClassChange(this.select.className.split(" ")),s&&this.onDisabledChange&&(this.changeListen(!1),this.onDisabledChange(this.select.disabled),this.changeListen(!0)),i&&this.onOptionsChange&&(this.changeListen(!1),this.onOptionsChange(this.getData()),this.changeListen(!0))}getData(){let t=[];const e=this.select.childNodes;for(const s of e)"OPTGROUP"===s.nodeName&&t.push(this.getDataFromOptgroup(s)),"OPTION"===s.nodeName&&t.push(this.getDataFromOption(s));return t}getDataFromOptgroup(t){let e={id:t.id,label:t.label,selectAll:!!t.dataset&&"true"===t.dataset.selectall,selectAllText:t.dataset?t.dataset.selectalltext:"Select all",closable:t.dataset?t.dataset.closable:"off",options:[]};const s=t.childNodes;for(const t of s)"OPTION"===t.nodeName&&e.options.push(this.getDataFromOption(t));return e}getDataFromOption(t){return{id:t.id,value:t.value,text:t.text,html:t.dataset&&t.dataset.html?t.dataset.html:"",selected:t.selected,display:"none"!==t.style.display,disabled:t.disabled,mandatory:!!t.dataset&&"true"===t.dataset.mandatory,placeholder:"true"===t.dataset.placeholder,class:t.className,style:t.style.cssText,data:t.dataset}}getSelectedOptions(){let t=[];const e=this.select.childNodes;for(const s of e){if("OPTGROUP"===s.nodeName){const e=s.childNodes;for(const s of e)if("OPTION"===s.nodeName){const e=s;e.selected&&t.push(this.getDataFromOption(e))}}if("OPTION"===s.nodeName){const e=s;e.selected&&t.push(this.getDataFromOption(e))}}return t}getSelectedValues(){return this.getSelectedOptions().map((t=>t.value))}setSelected(t){this.changeListen(!1);const e=this.select.childNodes;for(const s of e){if("OPTGROUP"===s.nodeName){const e=s.childNodes;for(const s of e)if("OPTION"===s.nodeName){const e=s;e.selected=t.includes(e.id)}}if("OPTION"===s.nodeName){const e=s;e.selected=t.includes(e.id)}}this.changeListen(!0)}updateSelect(t,e,s){this.changeListen(!1),t&&(this.select.dataset.id=t),e&&(this.select.style.cssText=e),s&&(this.select.className="",s.forEach((t=>{""!==t.trim()&&this.select.classList.add(t.trim())}))),this.changeListen(!0)}updateOptions(t){this.changeListen(!1),this.select.innerHTML="";for(const e of t)e instanceof i&&this.select.appendChild(this.createOptgroup(e)),e instanceof n&&this.select.appendChild(this.createOption(e));this.select.dispatchEvent(new Event("change")),this.changeListen(!0)}createOptgroup(t){const e=document.createElement("optgroup");if(e.id=t.id,e.label=t.label,t.selectAll&&(e.dataset.selectAll="true"),"off"!==t.closable&&(e.dataset.closable=t.closable),t.options)for(const s of t.options)e.appendChild(this.createOption(s));return e}createOption(t){const e=document.createElement("option");return e.id=t.id,e.value=t.value,e.innerHTML=t.text,""!==t.html&&e.setAttribute("data-html",t.html),t.selected&&(e.selected=t.selected),t.disabled&&(e.disabled=!0),!1===t.display&&(e.style.display="none"),t.placeholder&&e.setAttribute("data-placeholder","true"),t.mandatory&&e.setAttribute("data-mandatory","true"),t.class&&t.class.split(" ").forEach((t=>{e.classList.add(t)})),t.data&&"object"==typeof t.data&&Object.keys(t.data).forEach((s=>{e.setAttribute("data-"+function(t){const e=t.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,(t=>"-"+t.toLowerCase()));return t[0]===t[0].toUpperCase()?e.substring(1):e}(s),t.data[s])})),e}destroy(){this.changeListen(!1),this.select.removeEventListener("change",this.valueChange),this.observer&&(this.observer.disconnect(),this.observer=null),delete this.select.dataset.id,this.showUI()}}class c{constructor(e){this.id="",this.style="",this.class=[],this.isMultiple=!1,this.isOpen=!1,this.isFullOpen=!1,this.intervalMove=null,e||(e={}),this.id="ss-"+t(),this.style=e.style||"",this.class=e.class||[],this.disabled=void 0!==e.disabled&&e.disabled,this.alwaysOpen=void 0!==e.alwaysOpen&&e.alwaysOpen,this.showSearch=void 0===e.showSearch||e.showSearch,this.ariaLabel=e.ariaLabel||"Combobox",this.searchPlaceholder=e.searchPlaceholder||"Search",this.searchText=e.searchText||"No Results",this.searchingText=e.searchingText||"Searching...",this.searchHighlight=void 0!==e.searchHighlight&&e.searchHighlight,this.closeOnSelect=void 0===e.closeOnSelect||e.closeOnSelect,this.contentLocation=e.contentLocation||document.body,this.contentPosition=e.contentPosition||"absolute",this.openPosition=e.openPosition||"auto",this.placeholderText=void 0!==e.placeholderText?e.placeholderText:"Select Value",this.allowDeselect=void 0!==e.allowDeselect&&e.allowDeselect,this.hideSelected=void 0!==e.hideSelected&&e.hideSelected,this.keepOrder=void 0!==e.keepOrder&&e.keepOrder,this.showOptionTooltips=void 0!==e.showOptionTooltips&&e.showOptionTooltips,this.minSelected=e.minSelected||0,this.maxSelected=e.maxSelected||1e3,this.timeoutDelay=e.timeoutDelay||200,this.maxValuesShown=e.maxValuesShown||20,this.maxValuesMessage=e.maxValuesMessage||"{number} selected"}}return class{constructor(t){var s;if(this.events={search:void 0,searchFilter:(t,e)=>-1!==t.text.toLowerCase().indexOf(e.toLowerCase()),addable:void 0,beforeChange:void 0,afterChange:void 0,beforeOpen:void 0,afterOpen:void 0,beforeClose:void 0,afterClose:void 0},this.windowResize=e((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.windowScroll=e((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.documentClick=t=>{this.settings.isOpen&&t.target&&!function(t,e){function s(t,s){return s&&t&&t.classList&&t.classList.contains(s)||s&&t&&t.dataset&&t.dataset.id&&t.dataset.id===e?t:null}return s(t,e)||function t(e,i){return e&&e!==document?s(e,i)?e:t(e.parentNode,i):null}(t,e)}(t.target,this.settings.id)&&this.close(t.type)},this.windowVisibilityChange=()=>{document.hidden&&this.close()},this.selectEl="string"==typeof t.select?document.querySelector(t.select):t.select,!this.selectEl)return void(t.events&&t.events.error&&t.events.error(new Error("Could not find select element")));if("SELECT"!==this.selectEl.tagName)return void(t.events&&t.events.error&&t.events.error(new Error("Element isnt of type select")));this.selectEl.dataset.ssid&&this.destroy(),this.settings=new c(t.settings);const i=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const s in t.events)t.events.hasOwnProperty(s)&&(-1!==i.indexOf(s)?this.events[s]=e(t.events[s],100):this.events[s]=t.events[s]);this.settings.disabled=(null===(s=t.settings)||void 0===s?void 0:s.disabled)?t.settings.disabled:this.selectEl.disabled,this.settings.isMultiple=this.selectEl.multiple,this.settings.style=this.selectEl.style.cssText,this.settings.class=this.selectEl.className.split(" "),this.select=new o(this.selectEl),this.select.updateSelect(this.settings.id,this.settings.style,this.settings.class),this.select.hideUI(),this.select.onValueChange=t=>{this.setSelected(t.map((t=>t.id)))},this.select.onClassChange=t=>{this.settings.class=t,this.render.updateClassStyles()},this.select.onDisabledChange=t=>{t?this.disable():this.enable()},this.select.onOptionsChange=t=>{this.setData(t)},this.store=new a(this.settings.isMultiple?"multiple":"single",t.data?t.data:this.select.getData()),t.data&&this.select.updateOptions(this.store.getData());const n={open:this.open.bind(this),close:this.close.bind(this),addable:this.events.addable?this.events.addable:void 0,setSelected:this.setSelected.bind(this),addOption:this.addOption.bind(this),search:this.search.bind(this),beforeChange:this.events.beforeChange,afterChange:this.events.afterChange};this.render=new l(this.settings,this.store,n),this.render.renderValues(),this.render.renderOptions(this.store.getData());const h=this.selectEl.getAttribute("aria-label"),r=this.selectEl.getAttribute("aria-labelledby");h?this.render.main.main.setAttribute("aria-label",h):r&&this.render.main.main.setAttribute("aria-labelledby",r),this.selectEl.parentNode&&this.selectEl.parentNode.insertBefore(this.render.main.main,this.selectEl.nextSibling),window.addEventListener("resize",this.windowResize,!1),"auto"===this.settings.openPosition&&window.addEventListener("scroll",this.windowScroll,!1),document.addEventListener("visibilitychange",this.windowVisibilityChange),this.settings.disabled&&this.disable(),this.settings.alwaysOpen&&this.open(),this.selectEl.slim=this}enable(){this.settings.disabled=!1,this.select.enable(),this.render.enable()}disable(){this.settings.disabled=!0,this.select.disable(),this.render.disable()}getData(){return this.store.getData()}setData(t){const e=this.store.getSelected(),i=this.store.validateDataArray(t);if(i)return void(this.events.error&&this.events.error(i));this.store.setData(t);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!s(e,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){return this.store.getSelected()}setSelected(t,e=!0){const i=this.store.getSelected();this.store.setSelectedBy("id",Array.isArray(t)?t:[t]);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),""!==this.render.content.search.input.value?this.search(this.render.content.search.input.value):this.render.renderOptions(n),e&&this.events.afterChange&&!s(i,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}addOption(t){const e=this.store.getSelected();this.store.getDataOptions().some((e=>{var s;return e.value===(null!==(s=t.value)&&void 0!==s?s:t.text)}))||this.store.addOption(t);const i=this.store.getData();this.select.updateOptions(i),this.render.renderValues(),this.render.renderOptions(i),this.events.afterChange&&!s(e,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}open(){this.settings.disabled||this.settings.isOpen||(this.events.beforeOpen&&this.events.beforeOpen(),this.render.open(),this.settings.showSearch&&this.render.searchFocus(),this.settings.isOpen=!0,setTimeout((()=>{this.events.afterOpen&&this.events.afterOpen(),this.settings.isOpen&&(this.settings.isFullOpen=!0),document.addEventListener("click",this.documentClick)}),this.settings.timeoutDelay),"absolute"===this.settings.contentPosition&&(this.settings.intervalMove&&clearInterval(this.settings.intervalMove),this.settings.intervalMove=setInterval(this.render.moveContent.bind(this.render),500)))}close(t=null){this.settings.isOpen&&!this.settings.alwaysOpen&&(this.events.beforeClose&&this.events.beforeClose(),this.render.close(),""!==this.render.content.search.input.value&&this.search(""),this.render.mainFocus(t),this.settings.isOpen=!1,this.settings.isFullOpen=!1,setTimeout((()=>{this.events.afterClose&&this.events.afterClose(),document.removeEventListener("click",this.documentClick)}),this.settings.timeoutDelay),this.settings.intervalMove&&clearInterval(this.settings.intervalMove))}search(t){if(this.render.content.search.input.value!==t&&(this.render.content.search.input.value=t),!this.events.search)return void this.render.renderOptions(""===t?this.store.getData():this.store.search(t,this.events.searchFilter));this.render.renderSearching();const e=this.events.search(t,this.store.getSelectedOptions());e instanceof Promise?e.then((t=>{this.render.renderOptions(this.store.partialToFullData(t))})).catch((t=>{this.render.renderError("string"==typeof t?t:t.message)})):Array.isArray(e)?this.render.renderOptions(this.store.partialToFullData(e)):this.render.renderError("Search event must return a promise or an array of data")}destroy(){document.removeEventListener("click",this.documentClick),window.removeEventListener("resize",this.windowResize,!1),"auto"===this.settings.openPosition&&window.removeEventListener("scroll",this.windowScroll,!1),document.removeEventListener("visibilitychange",this.windowVisibilityChange),this.store.setData([]),this.render.destroy(),this.select.destroy()}}})); diff --git a/dist/slimselect.umd.js b/dist/slimselect.umd.js index 76114c8b..0e8ad964 100644 --- a/dist/slimselect.umd.js +++ b/dist/slimselect.umd.js @@ -147,7 +147,7 @@ setData(data) { this.data = this.partialToFullData(data); if (this.selectType === 'single') { - this.setSelectedBy('value', this.getSelected()); + this.setSelectedBy('id', this.getSelected()); } } getData() { @@ -189,26 +189,13 @@ } } getSelected() { - let selectedOptions = this.getSelectedOptions(); - let selectedValues = []; - selectedOptions.forEach((option) => { - selectedValues.push(option.value); - }); - return selectedValues; + return this.getSelectedOptions().map(option => option.id); } getSelectedOptions() { return this.filter((opt) => { return opt.selected; }, false); } - getSelectedIDs() { - let selectedOptions = this.getSelectedOptions(); - let selectedIDs = []; - selectedOptions.forEach((op) => { - selectedIDs.push(op.id); - }); - return selectedIDs; - } getOptgroupByID(id) { for (let dataObj of this.data) { if (dataObj instanceof Optgroup && dataObj.id === id) { @@ -460,8 +447,8 @@ } else { const firstOption = this.store.getFirstOption(); - const value = firstOption ? firstOption.value : ''; - this.callbacks.setSelected(value, false); + const id = firstOption ? firstOption.id : ''; + this.callbacks.setSelected(id, false); } if (this.settings.closeOnSelect) { this.callbacks.close(); @@ -661,18 +648,18 @@ shouldDelete = this.callbacks.beforeChange(after, before) === true; } if (shouldDelete) { - let selectedValues = []; + let selectedIds = []; for (const o of after) { if (o instanceof Optgroup) { for (const c of o.options) { - selectedValues.push(c.value); + selectedIds.push(c.id); } } if (o instanceof Option) { - selectedValues.push(o.value); + selectedIds.push(o.id); } } - this.callbacks.setSelected(selectedValues, false); + this.callbacks.setSelected(selectedIds, false); if (this.settings.closeOnSelect) { this.callbacks.close(); } @@ -801,12 +788,12 @@ let newOption = new Option(oo); this.callbacks.addOption(newOption); if (this.settings.isMultiple) { - let values = this.store.getSelected(); - values.push(newOption.value); - this.callbacks.setSelected(values, true); + let ids = this.store.getSelected(); + ids.push(newOption.id); + this.callbacks.setSelected(ids, true); } else { - this.callbacks.setSelected([newOption.value], true); + this.callbacks.setSelected([newOption.id], true); } this.callbacks.search(''); if (this.settings.closeOnSelect) { @@ -994,7 +981,7 @@ if (allSelected) { const newSelected = currentSelected.filter((s) => { for (const o of d.options) { - if (s === o.value) { + if (s === o.id) { return false; } } @@ -1004,7 +991,7 @@ return; } else { - const newSelected = currentSelected.concat(d.options.map((o) => o.value)); + const newSelected = currentSelected.concat(d.options.map((o) => o.id)); for (const o of d.options) { if (!this.store.getOptionByID(o.id)) { this.callbacks.addOption(o); @@ -1161,7 +1148,7 @@ if (!this.store.getOptionByID(elementID)) { this.callbacks.addOption(option); } - this.callbacks.setSelected(after.map((o) => o.value), false); + this.callbacks.setSelected(after.map((o) => o.id), false); if (this.settings.closeOnSelect) { this.callbacks.close(); } @@ -1307,7 +1294,7 @@ } valueChange(ev) { if (this.listen && this.onValueChange) { - this.onValueChange(this.getSelectedValues()); + this.onValueChange(this.getSelectedOptions()); } return true; } @@ -1391,17 +1378,17 @@ data: option.dataset, }; } - getSelectedValues() { - let values = []; - const options = this.select.childNodes; - for (const o of options) { + getSelectedOptions() { + let options = []; + const opts = this.select.childNodes; + for (const o of opts) { if (o.nodeName === 'OPTGROUP') { const optgroupOptions = o.childNodes; for (const oo of optgroupOptions) { if (oo.nodeName === 'OPTION') { const option = oo; if (option.selected) { - values.push(option.value); + options.push(this.getDataFromOption(option)); } } } @@ -1409,13 +1396,16 @@ if (o.nodeName === 'OPTION') { const option = o; if (option.selected) { - values.push(option.value); + options.push(this.getDataFromOption(option)); } } } - return values; + return options; + } + getSelectedValues() { + return this.getSelectedOptions().map(option => option.value); } - setSelected(value) { + setSelected(ids) { this.changeListen(false); const options = this.select.childNodes; for (const o of options) { @@ -1425,13 +1415,13 @@ for (const oo of optgroupOptions) { if (oo.nodeName === 'OPTION') { const option = oo; - option.selected = value.includes(option.value); + option.selected = ids.includes(option.id); } } } if (o.nodeName === 'OPTION') { const option = o; - option.selected = value.includes(option.value); + option.selected = ids.includes(option.id); } } this.changeListen(true); @@ -1649,8 +1639,8 @@ this.select = new Select(this.selectEl); this.select.updateSelect(this.settings.id, this.settings.style, this.settings.class); this.select.hideUI(); - this.select.onValueChange = (values) => { - this.setSelected(values); + this.select.onValueChange = (options) => { + this.setSelected(options.map(option => option.id)); }; this.select.onClassChange = (classes) => { this.settings.class = classes; @@ -1742,9 +1732,9 @@ getSelected() { return this.store.getSelected(); } - setSelected(value, runAfterChange = true) { + setSelected(id, runAfterChange = true) { const selected = this.store.getSelected(); - this.store.setSelectedBy('value', Array.isArray(value) ? value : [value]); + this.store.setSelectedBy('id', Array.isArray(id) ? id : [id]); const data = this.store.getData(); this.select.updateOptions(data); this.render.renderValues(); diff --git a/dist/slimselect.umd.min.js b/dist/slimselect.umd.min.js index d68c273f..8fde4b4e 100644 --- a/dist/slimselect.umd.min.js +++ b/dist/slimselect.umd.min.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).SlimSelect=t()}(this,(function(){"use strict";function e(){return Math.random().toString(36).substring(2,10)}function t(e,t=50,s=!1){let i;return function(...n){const a=self,l=s&&!i;clearTimeout(i),i=setTimeout((()=>{i=null,s||e.apply(a,n)}),t),l&&e.apply(a,n)}}function s(e,t){return JSON.stringify(e)===JSON.stringify(t)}class i{constructor(t){if(this.id=t.id&&""!==t.id?t.id:e(),this.label=t.label||"",this.selectAll=void 0!==t.selectAll&&t.selectAll,this.selectAllText=t.selectAllText||"Select All",this.closable=t.closable||"off",this.options=[],t.options)for(const e of t.options)this.options.push(new n(e))}}class n{constructor(t){this.id=t.id&&""!==t.id?t.id:e(),this.value=void 0===t.value?t.text:t.value,this.text=t.text||"",this.html=t.html||"",this.selected=void 0!==t.selected&&t.selected,this.display=void 0===t.display||t.display,this.disabled=void 0!==t.disabled&&t.disabled,this.mandatory=void 0!==t.mandatory&&t.mandatory,this.placeholder=void 0!==t.placeholder&&t.placeholder,this.class=t.class||"",this.style=t.style||"",this.data=t.data||{}}}class a{constructor(e,t){this.selectType="single",this.data=[],this.selectType=e,this.setData(t)}validateDataArray(e){if(!Array.isArray(e))return new Error("Data must be an array");for(let t of e){if(!(t instanceof i||"label"in t))return t instanceof n||"text"in t?this.validateOption(t):new Error("Data object must be a valid optgroup or option");if(!("label"in t))return new Error("Optgroup must have a label");if("options"in t&&t.options)for(let e of t.options)return this.validateOption(e)}return null}validateOption(e){return"text"in e?null:new Error("Option must have a text")}partialToFullData(e){let t=[];return e.forEach((e=>{if(e instanceof i||"label"in e){let s=[];"options"in e&&e.options&&e.options.forEach((e=>{s.push(new n(e))})),s.length>0&&t.push(new i(e))}(e instanceof n||"text"in e)&&t.push(new n(e))})),t}setData(e){this.data=this.partialToFullData(e),"single"===this.selectType&&this.setSelectedBy("value",this.getSelected())}getData(){return this.filter(null,!0)}getDataOptions(){return this.filter(null,!1)}addOption(e){this.setData(this.getData().concat(new n(e)))}setSelectedBy(e,t){let s=null,a=!1;for(let l of this.data){if(l instanceof i)for(let i of l.options)s||(s=i),i.selected=!a&&t.includes(i[e]),i.selected&&"single"===this.selectType&&(a=!0);l instanceof n&&(s||(s=l),l.selected=!a&&t.includes(l[e]),l.selected&&"single"===this.selectType&&(a=!0))}"single"===this.selectType&&s&&!a&&(s.selected=!0)}getSelected(){let e=this.getSelectedOptions(),t=[];return e.forEach((e=>{t.push(e.value)})),t}getSelectedOptions(){return this.filter((e=>e.selected),!1)}getSelectedIDs(){let e=this.getSelectedOptions(),t=[];return e.forEach((e=>{t.push(e.id)})),t}getOptgroupByID(e){for(let t of this.data)if(t instanceof i&&t.id===e)return t;return null}getOptionByID(e){let t=this.filter((t=>t.id===e),!1);return t.length?t[0]:null}getSelectType(){return this.selectType}getFirstOption(){let e=null;for(let t of this.data)if(t instanceof i?e=t.options[0]:t instanceof n&&(e=t),e)break;return e}search(e,t){return""===(e=e.trim())?this.getData():this.filter((s=>t(s,e)),!0)}filter(e,t){const s=[];return this.data.forEach((a=>{if(a instanceof i){let l=[];if(a.options.forEach((i=>{e&&!e(i)||(t?l.push(new n(i)):s.push(new n(i)))})),l.length>0){let e=new i(a);e.options=l,s.push(e)}}a instanceof n&&(e&&!e(a)||s.push(new n(a)))})),s}}class l{constructor(e,t,s){this.classes={main:"ss-main",placeholder:"ss-placeholder",values:"ss-values",single:"ss-single",max:"ss-max",value:"ss-value",valueText:"ss-value-text",valueDelete:"ss-value-delete",valueOut:"ss-value-out",deselect:"ss-deselect",deselectPath:"M10,10 L90,90 M10,90 L90,10",arrow:"ss-arrow",arrowClose:"M10,30 L50,70 L90,30",arrowOpen:"M10,70 L50,30 L90,70",content:"ss-content",openAbove:"ss-open-above",openBelow:"ss-open-below",search:"ss-search",searchHighlighter:"ss-search-highlight",searching:"ss-searching",addable:"ss-addable",addablePath:"M50,10 L50,90 M10,50 L90,50",list:"ss-list",optgroup:"ss-optgroup",optgroupLabel:"ss-optgroup-label",optgroupLabelText:"ss-optgroup-label-text",optgroupActions:"ss-optgroup-actions",optgroupSelectAll:"ss-selectall",optgroupSelectAllBox:"M60,10 L10,10 L10,90 L90,90 L90,50",optgroupSelectAllCheck:"M30,45 L50,70 L90,10",optgroupClosable:"ss-closable",option:"ss-option",optionDelete:"M10,10 L90,90 M10,90 L90,10",highlighted:"ss-highlighted",open:"ss-open",close:"ss-close",selected:"ss-selected",error:"ss-error",disabled:"ss-disabled",hide:"ss-hide"},this.store=t,this.settings=e,this.callbacks=s,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes(),this.settings.contentLocation.appendChild(this.content.main)}enable(){this.main.main.classList.remove(this.classes.disabled),this.content.search.input.disabled=!1}disable(){this.main.main.classList.add(this.classes.disabled),this.content.search.input.disabled=!0}open(){this.main.arrow.path.setAttribute("d",this.classes.arrowOpen),this.main.main.classList.add("up"===this.settings.openPosition?this.classes.openAbove:this.classes.openBelow),this.main.main.setAttribute("aria-expanded","true"),this.moveContent();const e=this.store.getSelectedOptions();if(e.length){const t=e[e.length-1].id,s=this.content.list.querySelector('[data-id="'+t+'"]');s&&this.ensureElementInView(this.content.list,s)}}close(){this.main.main.classList.remove(this.classes.openAbove),this.main.main.classList.remove(this.classes.openBelow),this.main.main.setAttribute("aria-expanded","false"),this.content.main.classList.remove(this.classes.openAbove),this.content.main.classList.remove(this.classes.openBelow),this.main.arrow.path.setAttribute("d",this.classes.arrowClose)}updateClassStyles(){if(this.main.main.className="",this.main.main.removeAttribute("style"),this.content.main.className="",this.content.main.removeAttribute("style"),this.main.main.classList.add(this.classes.main),this.content.main.classList.add(this.classes.content),""!==this.settings.style&&(this.main.main.style.cssText=this.settings.style,this.content.main.style.cssText=this.settings.style),this.settings.class.length)for(const e of this.settings.class)""!==e.trim()&&(this.main.main.classList.add(e.trim()),this.content.main.classList.add(e.trim()));"relative"===this.settings.contentPosition&&this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){this.main.main.role="combobox",this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.main.id),this.main.main.setAttribute("aria-expanded","false"),this.content.main.setAttribute("role","listbox")}mainDiv(){var e;const t=document.createElement("div");t.dataset.id=this.settings.id,t.setAttribute("aria-label",this.settings.ariaLabel),t.tabIndex=0,t.onkeydown=e=>{switch(e.key){case"ArrowUp":case"ArrowDown":return this.callbacks.open(),"ArrowDown"===e.key?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Enter":case" ":this.callbacks.open();const t=this.content.list.querySelector("."+this.classes.highlighted);return t&&t.click(),!1;case"Escape":return this.callbacks.close(),!1}return!1},t.onclick=e=>{this.settings.disabled||(this.settings.isOpen?this.callbacks.close():this.callbacks.open())};const s=document.createElement("div");s.classList.add(this.classes.values),t.appendChild(s);const i=document.createElement("div");i.classList.add(this.classes.deselect);const n=null===(e=this.store)||void 0===e?void 0:e.getSelectedOptions();!this.settings.allowDeselect||this.settings.isMultiple&&n&&n.length<=0?i.classList.add(this.classes.hide):i.classList.remove(this.classes.hide),i.onclick=e=>{if(e.stopPropagation(),this.settings.disabled)return;let t=!0;const s=this.store.getSelectedOptions(),i=[];if(this.callbacks.beforeChange&&(t=!0===this.callbacks.beforeChange(i,s)),t){if(this.settings.isMultiple)this.callbacks.setSelected([],!1),this.updateDeselectAll();else{const e=this.store.getFirstOption(),t=e?e.value:"";this.callbacks.setSelected(t,!1)}this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(this.store.getSelectedOptions())}};const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100");const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.deselectPath),a.appendChild(l),i.appendChild(a),t.appendChild(i);const o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.classList.add(this.classes.arrow),o.setAttribute("viewBox","0 0 100 100");const c=document.createElementNS("http://www.w3.org/2000/svg","path");return c.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&o.classList.add(this.classes.hide),o.appendChild(c),t.appendChild(o),{main:t,values:s,deselect:{main:i,svg:a,path:l},arrow:{main:o,path:c}}}mainFocus(e){"click"!==e&&this.main.main.focus({preventScroll:!0})}placeholder(){const e=this.store.filter((e=>e.placeholder),!1);let t=this.settings.placeholderText;e.length&&(""!==e[0].html?t=e[0].html:""!==e[0].text&&(t=e[0].text));const s=document.createElement("div");return s.classList.add(this.classes.placeholder),s.innerHTML=t,s}renderValues(){this.settings.isMultiple?(this.renderMultipleValues(),this.updateDeselectAll()):this.renderSingleValue()}renderSingleValue(){const e=this.store.filter((e=>e.selected&&!e.placeholder),!1),t=e.length>0?e[0]:null;if(t){const e=document.createElement("div");e.classList.add(this.classes.single),t.html?e.innerHTML=t.html:e.innerText=t.text,this.main.values.innerHTML=e.outerHTML}else this.main.values.innerHTML=this.placeholder().outerHTML;this.settings.allowDeselect&&e.length?this.main.deselect.main.classList.remove(this.classes.hide):this.main.deselect.main.classList.add(this.classes.hide)}renderMultipleValues(){let e=this.main.values.childNodes,t=this.store.filter((e=>e.selected&&e.display),!1);if(0===t.length)return void(this.main.values.innerHTML=this.placeholder().outerHTML);{const e=this.main.values.querySelector("."+this.classes.placeholder);e&&e.remove()}if(t.length>this.settings.maxValuesShown){const e=document.createElement("div");return e.classList.add(this.classes.max),e.textContent=this.settings.maxValuesMessage.replace("{number}",t.length.toString()),void(this.main.values.innerHTML=e.outerHTML)}{const e=this.main.values.querySelector("."+this.classes.max);e&&e.remove()}let s=[];for(let i=0;ie.id===a),!1).length||s.push(n)}}for(const e of s)e.classList.add(this.classes.valueOut),setTimeout((()=>{this.main.values.hasChildNodes()&&this.main.values.contains(e)&&this.main.values.removeChild(e)}),100);e=this.main.values.childNodes;for(let s=0;s{if(t.preventDefault(),t.stopPropagation(),this.settings.disabled)return;let s=!0;const a=this.store.getSelectedOptions(),l=a.filter((t=>t.selected&&t.id!==e.id),!0);if(!(this.settings.minSelected&&l.length{this.callbacks.search(e.target.value)}),100),s.onkeydown=e=>{switch(e.key){case"ArrowUp":case"ArrowDown":return"ArrowDown"===e.key?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Escape":return this.callbacks.close(),!1;case"Enter":case" ":if(this.callbacks.addable&&e.ctrlKey)return i.click(),!1;{const e=this.content.list.querySelector("."+this.classes.highlighted);if(e)return e.click(),!1}return!0}return!0},e.appendChild(s),this.callbacks.addable){i.classList.add(this.classes.addable);const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("viewBox","0 0 100 100");const s=document.createElementNS("http://www.w3.org/2000/svg","path");s.setAttribute("d",this.classes.addablePath),t.appendChild(s),i.appendChild(t),i.onclick=e=>{if(e.preventDefault(),e.stopPropagation(),!this.callbacks.addable)return;const t=this.content.search.input.value.trim();if(""===t)return void this.content.search.input.focus();const s=e=>{let t=new n(e);if(this.callbacks.addOption(t),this.settings.isMultiple){let e=this.store.getSelected();e.push(t.value),this.callbacks.setSelected(e,!0)}else this.callbacks.setSelected([t.value],!0);this.callbacks.search(""),this.settings.closeOnSelect&&setTimeout((()=>{this.callbacks.close()}),100)},i=this.callbacks.addable(t);!1!==i&&null!=i&&(i instanceof Promise?i.then((e=>{s("string"==typeof e?{text:e,value:e}:e)})):s("string"==typeof i?{text:i,value:i}:i))},e.appendChild(i),a.addable={main:i,svg:t,path:s}}return a}searchFocus(){this.content.search.input.focus()}getOptions(e=!1,t=!1,s=!1){let i="."+this.classes.option;return e&&(i+=":not(."+this.classes.placeholder+")"),t&&(i+=":not(."+this.classes.disabled+")"),s&&(i+=":not(."+this.classes.hide+")"),Array.from(this.content.list.querySelectorAll(i))}highlight(e){const t=this.getOptions(!0,!0,!0);if(0===t.length)return;if(1===t.length&&!t[0].classList.contains(this.classes.highlighted))return void t[0].classList.add(this.classes.highlighted);let s=!1;for(const e of t)e.classList.contains(this.classes.highlighted)&&(s=!0);if(!s)for(const e of t)if(e.classList.contains(this.classes.selected)){e.classList.add(this.classes.highlighted);break}for(let s=0;s=0?s-1:t.length-1];a.classList.add(this.classes.highlighted),this.ensureElementInView(this.content.list,a);const l=a.parentElement;if(l&&l.classList.contains(this.classes.close)){const e=l.querySelector("."+this.classes.optgroupLabel);e&&e.click()}return}t["down"===e?0:t.length-1].classList.add(this.classes.highlighted),this.ensureElementInView(this.content.list,t["down"===e?0:t.length-1])}listDiv(){const e=document.createElement("div");return e.classList.add(this.classes.list),e}renderError(e){this.content.list.innerHTML="";const t=document.createElement("div");t.classList.add(this.classes.error),t.textContent=e,this.content.list.appendChild(t)}renderSearching(){this.content.list.innerHTML="";const e=document.createElement("div");e.classList.add(this.classes.searching),e.textContent=this.settings.searchingText,this.content.list.appendChild(e)}renderOptions(e){if(this.content.list.innerHTML="",0===e.length){const e=document.createElement("div");return e.classList.add(this.classes.search),e.innerHTML=this.settings.searchText,void this.content.list.appendChild(e)}for(const t of e){if(t instanceof i){const e=document.createElement("div");e.classList.add(this.classes.optgroup);const s=document.createElement("div");s.classList.add(this.classes.optgroupLabel),e.appendChild(s);const i=document.createElement("div");i.classList.add(this.classes.optgroupLabelText),i.textContent=t.label,s.appendChild(i);const n=document.createElement("div");if(n.classList.add(this.classes.optgroupActions),s.appendChild(n),this.settings.isMultiple&&t.selectAll){const e=document.createElement("div");e.classList.add(this.classes.optgroupSelectAll);let s=!0;for(const e of t.options)if(!e.selected){s=!1;break}s&&e.classList.add(this.classes.selected);const i=document.createElement("span");i.textContent=t.selectAllText,e.appendChild(i);const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100"),e.appendChild(a);const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.optgroupSelectAllBox),a.appendChild(l);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.optgroupSelectAllCheck),a.appendChild(o),e.addEventListener("click",(e=>{e.preventDefault(),e.stopPropagation();const i=this.store.getSelected();if(s){const e=i.filter((e=>{for(const s of t.options)if(e===s.value)return!1;return!0}));this.callbacks.setSelected(e,!0)}else{const e=i.concat(t.options.map((e=>e.value)));for(const e of t.options)this.store.getOptionByID(e.id)||this.callbacks.addOption(e);this.callbacks.setSelected(e,!0)}})),n.appendChild(e)}if("off"!==t.closable){const i=document.createElement("div");i.classList.add(this.classes.optgroupClosable);const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100"),a.classList.add(this.classes.arrow),i.appendChild(a);const l=document.createElementNS("http://www.w3.org/2000/svg","path");a.appendChild(l),t.options.some((e=>e.selected))||""!==this.content.search.input.value.trim()?(i.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"open"===t.closable?(e.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"close"===t.closable&&(e.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose)),s.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation(),e.classList.contains(this.classes.close)?(e.classList.remove(this.classes.close),e.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):(e.classList.remove(this.classes.open),e.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose))})),n.appendChild(i)}e.appendChild(s);for(const s of t.options)e.appendChild(this.option(s));this.content.list.appendChild(e)}t instanceof n&&this.content.list.appendChild(this.option(t))}}option(e){if(e.placeholder){const e=document.createElement("div");return e.classList.add(this.classes.option),e.classList.add(this.classes.hide),e}const t=document.createElement("div");return t.dataset.id=e.id,t.id=e.id,t.classList.add(this.classes.option),t.setAttribute("role","option"),e.class&&e.class.split(" ").forEach((e=>{t.classList.add(e)})),e.style&&(t.style.cssText=e.style),this.settings.searchHighlight&&""!==this.content.search.input.value.trim()?t.innerHTML=this.highlightText(""!==e.html?e.html:e.text,this.content.search.input.value,this.classes.searchHighlighter):""!==e.html?t.innerHTML=e.html:t.textContent=e.text,this.settings.showOptionTooltips&&t.textContent&&t.setAttribute("title",t.textContent),e.display||t.classList.add(this.classes.hide),e.disabled&&t.classList.add(this.classes.disabled),e.selected&&this.settings.hideSelected&&t.classList.add(this.classes.hide),e.selected?(t.classList.add(this.classes.selected),t.setAttribute("aria-selected","true"),this.main.main.setAttribute("aria-activedescendant",t.id)):(t.classList.remove(this.classes.selected),t.setAttribute("aria-selected","false")),t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const s=this.store.getSelected(),i=t.currentTarget,n=String(i.dataset.id);if(e.disabled||e.selected&&!this.settings.allowDeselect)return;if(this.settings.isMultiple&&this.settings.maxSelected<=s.length&&!e.selected||this.settings.isMultiple&&this.settings.minSelected>=s.length&&e.selected)return;let a=!1;const l=this.store.getSelectedOptions();let o=[];this.settings.isMultiple&&(o=e.selected?l.filter((e=>e.id!==n)):l.concat(e)),this.settings.isMultiple||(o=e.selected?[]:[e]),this.callbacks.beforeChange||(a=!0),this.callbacks.beforeChange&&(a=!1!==this.callbacks.beforeChange(o,l)),a&&(this.store.getOptionByID(n)||this.callbacks.addOption(e),this.callbacks.setSelected(o.map((e=>e.value)),!1),this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(o))})),t}destroy(){this.main.main.remove(),this.content.main.remove()}highlightText(e,t,s){let i=e;const n=new RegExp("("+t.trim()+")(?![^<]*>[^<>]*${o}`),i}moveContentAbove(){const e=this.main.main.offsetHeight,t=this.content.main.offsetHeight;this.main.main.classList.remove(this.classes.openBelow),this.main.main.classList.add(this.classes.openAbove),this.content.main.classList.remove(this.classes.openBelow),this.content.main.classList.add(this.classes.openAbove);const s=this.main.main.getBoundingClientRect();this.content.main.style.margin="-"+(e+t-1)+"px 0px 0px 0px",this.content.main.style.top=s.top+s.height+window.scrollY+"px",this.content.main.style.left=s.left+window.scrollX+"px",this.content.main.style.width=s.width+"px"}moveContentBelow(){this.main.main.classList.remove(this.classes.openAbove),this.main.main.classList.add(this.classes.openBelow),this.content.main.classList.remove(this.classes.openAbove),this.content.main.classList.add(this.classes.openBelow);const e=this.main.main.getBoundingClientRect();this.content.main.style.margin="-1px 0px 0px 0px","relative"!==this.settings.contentPosition&&(this.content.main.style.top=e.top+e.height+window.scrollY+"px",this.content.main.style.left=e.left+window.scrollX+"px",this.content.main.style.width=e.width+"px")}ensureElementInView(e,t){const s=e.scrollTop+e.offsetTop,i=s+e.clientHeight,n=t.offsetTop,a=n+t.clientHeight;ni&&(e.scrollTop+=a-i)}putContent(){const e=this.main.main.offsetHeight,t=this.main.main.getBoundingClientRect(),s=this.content.main.offsetHeight;return window.innerHeight-(t.top+e)<=s&&t.top>s?"up":"down"}updateDeselectAll(){if(!this.store||!this.settings)return;const e=this.store.getSelectedOptions(),t=e&&e.length>0,s=this.settings.isMultiple,i=this.settings.allowDeselect,n=this.main.deselect.main,a=this.classes.hide;!i||s&&!t?n.classList.add(a):n.classList.remove(a)}}class o{constructor(e){this.listen=!1,this.observer=null,this.select=e,this.valueChange=this.valueChange.bind(this),this.select.addEventListener("change",this.valueChange,{passive:!0}),this.observer=new MutationObserver(this.observeCall.bind(this)),this.changeListen(!0)}enable(){this.select.disabled=!1}disable(){this.select.disabled=!0}hideUI(){this.select.tabIndex=-1,this.select.style.display="none",this.select.setAttribute("aria-hidden","true")}showUI(){this.select.removeAttribute("tabindex"),this.select.style.display="",this.select.removeAttribute("aria-hidden")}changeListen(e){this.listen=e,e&&this.observer&&this.observer.observe(this.select,{subtree:!0,childList:!0,attributes:!0}),e||this.observer&&this.observer.disconnect()}valueChange(e){return this.listen&&this.onValueChange&&this.onValueChange(this.getSelectedValues()),!0}observeCall(e){if(!this.listen)return;let t=!1,s=!1,i=!1;for(const n of e)n.target===this.select&&("disabled"===n.attributeName&&(s=!0),"class"===n.attributeName&&(t=!0)),"OPTGROUP"!==n.target.nodeName&&"OPTION"!==n.target.nodeName||(i=!0);t&&this.onClassChange&&this.onClassChange(this.select.className.split(" ")),s&&this.onDisabledChange&&(this.changeListen(!1),this.onDisabledChange(this.select.disabled),this.changeListen(!0)),i&&this.onOptionsChange&&(this.changeListen(!1),this.onOptionsChange(this.getData()),this.changeListen(!0))}getData(){let e=[];const t=this.select.childNodes;for(const s of t)"OPTGROUP"===s.nodeName&&e.push(this.getDataFromOptgroup(s)),"OPTION"===s.nodeName&&e.push(this.getDataFromOption(s));return e}getDataFromOptgroup(e){let t={id:e.id,label:e.label,selectAll:!!e.dataset&&"true"===e.dataset.selectall,selectAllText:e.dataset?e.dataset.selectalltext:"Select all",closable:e.dataset?e.dataset.closable:"off",options:[]};const s=e.childNodes;for(const e of s)"OPTION"===e.nodeName&&t.options.push(this.getDataFromOption(e));return t}getDataFromOption(e){return{id:e.id,value:e.value,text:e.text,html:e.dataset&&e.dataset.html?e.dataset.html:"",selected:e.selected,display:"none"!==e.style.display,disabled:e.disabled,mandatory:!!e.dataset&&"true"===e.dataset.mandatory,placeholder:"true"===e.dataset.placeholder,class:e.className,style:e.style.cssText,data:e.dataset}}getSelectedValues(){let e=[];const t=this.select.childNodes;for(const s of t){if("OPTGROUP"===s.nodeName){const t=s.childNodes;for(const s of t)if("OPTION"===s.nodeName){const t=s;t.selected&&e.push(t.value)}}if("OPTION"===s.nodeName){const t=s;t.selected&&e.push(t.value)}}return e}setSelected(e){this.changeListen(!1);const t=this.select.childNodes;for(const s of t){if("OPTGROUP"===s.nodeName){const t=s.childNodes;for(const s of t)if("OPTION"===s.nodeName){const t=s;t.selected=e.includes(t.value)}}if("OPTION"===s.nodeName){const t=s;t.selected=e.includes(t.value)}}this.changeListen(!0)}updateSelect(e,t,s){this.changeListen(!1),e&&(this.select.dataset.id=e),t&&(this.select.style.cssText=t),s&&(this.select.className="",s.forEach((e=>{""!==e.trim()&&this.select.classList.add(e.trim())}))),this.changeListen(!0)}updateOptions(e){this.changeListen(!1),this.select.innerHTML="";for(const t of e)t instanceof i&&this.select.appendChild(this.createOptgroup(t)),t instanceof n&&this.select.appendChild(this.createOption(t));this.select.dispatchEvent(new Event("change")),this.changeListen(!0)}createOptgroup(e){const t=document.createElement("optgroup");if(t.id=e.id,t.label=e.label,e.selectAll&&(t.dataset.selectAll="true"),"off"!==e.closable&&(t.dataset.closable=e.closable),e.options)for(const s of e.options)t.appendChild(this.createOption(s));return t}createOption(e){const t=document.createElement("option");return t.id=e.id,t.value=e.value,t.innerHTML=e.text,""!==e.html&&t.setAttribute("data-html",e.html),e.selected&&(t.selected=e.selected),e.disabled&&(t.disabled=!0),!1===e.display&&(t.style.display="none"),e.placeholder&&t.setAttribute("data-placeholder","true"),e.mandatory&&t.setAttribute("data-mandatory","true"),e.class&&e.class.split(" ").forEach((e=>{t.classList.add(e)})),e.data&&"object"==typeof e.data&&Object.keys(e.data).forEach((s=>{t.setAttribute("data-"+function(e){const t=e.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,(e=>"-"+e.toLowerCase()));return e[0]===e[0].toUpperCase()?t.substring(1):t}(s),e.data[s])})),t}destroy(){this.changeListen(!1),this.select.removeEventListener("change",this.valueChange),this.observer&&(this.observer.disconnect(),this.observer=null),delete this.select.dataset.id,this.showUI()}}class c{constructor(t){this.id="",this.style="",this.class=[],this.isMultiple=!1,this.isOpen=!1,this.isFullOpen=!1,this.intervalMove=null,t||(t={}),this.id="ss-"+e(),this.style=t.style||"",this.class=t.class||[],this.disabled=void 0!==t.disabled&&t.disabled,this.alwaysOpen=void 0!==t.alwaysOpen&&t.alwaysOpen,this.showSearch=void 0===t.showSearch||t.showSearch,this.ariaLabel=t.ariaLabel||"Combobox",this.searchPlaceholder=t.searchPlaceholder||"Search",this.searchText=t.searchText||"No Results",this.searchingText=t.searchingText||"Searching...",this.searchHighlight=void 0!==t.searchHighlight&&t.searchHighlight,this.closeOnSelect=void 0===t.closeOnSelect||t.closeOnSelect,this.contentLocation=t.contentLocation||document.body,this.contentPosition=t.contentPosition||"absolute",this.openPosition=t.openPosition||"auto",this.placeholderText=void 0!==t.placeholderText?t.placeholderText:"Select Value",this.allowDeselect=void 0!==t.allowDeselect&&t.allowDeselect,this.hideSelected=void 0!==t.hideSelected&&t.hideSelected,this.keepOrder=void 0!==t.keepOrder&&t.keepOrder,this.showOptionTooltips=void 0!==t.showOptionTooltips&&t.showOptionTooltips,this.minSelected=t.minSelected||0,this.maxSelected=t.maxSelected||1e3,this.timeoutDelay=t.timeoutDelay||200,this.maxValuesShown=t.maxValuesShown||20,this.maxValuesMessage=t.maxValuesMessage||"{number} selected"}}return class{constructor(e){var s;if(this.events={search:void 0,searchFilter:(e,t)=>-1!==e.text.toLowerCase().indexOf(t.toLowerCase()),addable:void 0,beforeChange:void 0,afterChange:void 0,beforeOpen:void 0,afterOpen:void 0,beforeClose:void 0,afterClose:void 0},this.windowResize=t((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.windowScroll=t((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.documentClick=e=>{this.settings.isOpen&&e.target&&!function(e,t){function s(e,s){return s&&e&&e.classList&&e.classList.contains(s)||s&&e&&e.dataset&&e.dataset.id&&e.dataset.id===t?e:null}return s(e,t)||function e(t,i){return t&&t!==document?s(t,i)?t:e(t.parentNode,i):null}(e,t)}(e.target,this.settings.id)&&this.close(e.type)},this.windowVisibilityChange=()=>{document.hidden&&this.close()},this.selectEl="string"==typeof e.select?document.querySelector(e.select):e.select,!this.selectEl)return void(e.events&&e.events.error&&e.events.error(new Error("Could not find select element")));if("SELECT"!==this.selectEl.tagName)return void(e.events&&e.events.error&&e.events.error(new Error("Element isnt of type select")));this.selectEl.dataset.ssid&&this.destroy(),this.settings=new c(e.settings);const i=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const s in e.events)e.events.hasOwnProperty(s)&&(-1!==i.indexOf(s)?this.events[s]=t(e.events[s],100):this.events[s]=e.events[s]);this.settings.disabled=(null===(s=e.settings)||void 0===s?void 0:s.disabled)?e.settings.disabled:this.selectEl.disabled,this.settings.isMultiple=this.selectEl.multiple,this.settings.style=this.selectEl.style.cssText,this.settings.class=this.selectEl.className.split(" "),this.select=new o(this.selectEl),this.select.updateSelect(this.settings.id,this.settings.style,this.settings.class),this.select.hideUI(),this.select.onValueChange=e=>{this.setSelected(e)},this.select.onClassChange=e=>{this.settings.class=e,this.render.updateClassStyles()},this.select.onDisabledChange=e=>{e?this.disable():this.enable()},this.select.onOptionsChange=e=>{this.setData(e)},this.store=new a(this.settings.isMultiple?"multiple":"single",e.data?e.data:this.select.getData()),e.data&&this.select.updateOptions(this.store.getData());const n={open:this.open.bind(this),close:this.close.bind(this),addable:this.events.addable?this.events.addable:void 0,setSelected:this.setSelected.bind(this),addOption:this.addOption.bind(this),search:this.search.bind(this),beforeChange:this.events.beforeChange,afterChange:this.events.afterChange};this.render=new l(this.settings,this.store,n),this.render.renderValues(),this.render.renderOptions(this.store.getData());const h=this.selectEl.getAttribute("aria-label"),r=this.selectEl.getAttribute("aria-labelledby");h?this.render.main.main.setAttribute("aria-label",h):r&&this.render.main.main.setAttribute("aria-labelledby",r),this.selectEl.parentNode&&this.selectEl.parentNode.insertBefore(this.render.main.main,this.selectEl.nextSibling),window.addEventListener("resize",this.windowResize,!1),"auto"===this.settings.openPosition&&window.addEventListener("scroll",this.windowScroll,!1),document.addEventListener("visibilitychange",this.windowVisibilityChange),this.settings.disabled&&this.disable(),this.settings.alwaysOpen&&this.open(),this.selectEl.slim=this}enable(){this.settings.disabled=!1,this.select.enable(),this.render.enable()}disable(){this.settings.disabled=!0,this.select.disable(),this.render.disable()}getData(){return this.store.getData()}setData(e){const t=this.store.getSelected(),i=this.store.validateDataArray(e);if(i)return void(this.events.error&&this.events.error(i));this.store.setData(e);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!s(t,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){return this.store.getSelected()}setSelected(e,t=!0){const i=this.store.getSelected();this.store.setSelectedBy("value",Array.isArray(e)?e:[e]);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),""!==this.render.content.search.input.value?this.search(this.render.content.search.input.value):this.render.renderOptions(n),t&&this.events.afterChange&&!s(i,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}addOption(e){const t=this.store.getSelected();this.store.getDataOptions().some((t=>{var s;return t.value===(null!==(s=e.value)&&void 0!==s?s:e.text)}))||this.store.addOption(e);const i=this.store.getData();this.select.updateOptions(i),this.render.renderValues(),this.render.renderOptions(i),this.events.afterChange&&!s(t,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}open(){this.settings.disabled||this.settings.isOpen||(this.events.beforeOpen&&this.events.beforeOpen(),this.render.open(),this.settings.showSearch&&this.render.searchFocus(),this.settings.isOpen=!0,setTimeout((()=>{this.events.afterOpen&&this.events.afterOpen(),this.settings.isOpen&&(this.settings.isFullOpen=!0),document.addEventListener("click",this.documentClick)}),this.settings.timeoutDelay),"absolute"===this.settings.contentPosition&&(this.settings.intervalMove&&clearInterval(this.settings.intervalMove),this.settings.intervalMove=setInterval(this.render.moveContent.bind(this.render),500)))}close(e=null){this.settings.isOpen&&!this.settings.alwaysOpen&&(this.events.beforeClose&&this.events.beforeClose(),this.render.close(),""!==this.render.content.search.input.value&&this.search(""),this.render.mainFocus(e),this.settings.isOpen=!1,this.settings.isFullOpen=!1,setTimeout((()=>{this.events.afterClose&&this.events.afterClose(),document.removeEventListener("click",this.documentClick)}),this.settings.timeoutDelay),this.settings.intervalMove&&clearInterval(this.settings.intervalMove))}search(e){if(this.render.content.search.input.value!==e&&(this.render.content.search.input.value=e),!this.events.search)return void this.render.renderOptions(""===e?this.store.getData():this.store.search(e,this.events.searchFilter));this.render.renderSearching();const t=this.events.search(e,this.store.getSelectedOptions());t instanceof Promise?t.then((e=>{this.render.renderOptions(this.store.partialToFullData(e))})).catch((e=>{this.render.renderError("string"==typeof e?e:e.message)})):Array.isArray(t)?this.render.renderOptions(this.store.partialToFullData(t)):this.render.renderError("Search event must return a promise or an array of data")}destroy(){document.removeEventListener("click",this.documentClick),window.removeEventListener("resize",this.windowResize,!1),"auto"===this.settings.openPosition&&window.removeEventListener("scroll",this.windowScroll,!1),document.removeEventListener("visibilitychange",this.windowVisibilityChange),this.store.setData([]),this.render.destroy(),this.select.destroy()}}})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).SlimSelect=e()}(this,(function(){"use strict";function t(){return Math.random().toString(36).substring(2,10)}function e(t,e=50,s=!1){let i;return function(...n){const a=self,l=s&&!i;clearTimeout(i),i=setTimeout((()=>{i=null,s||t.apply(a,n)}),e),l&&t.apply(a,n)}}function s(t,e){return JSON.stringify(t)===JSON.stringify(e)}class i{constructor(e){if(this.id=e.id&&""!==e.id?e.id:t(),this.label=e.label||"",this.selectAll=void 0!==e.selectAll&&e.selectAll,this.selectAllText=e.selectAllText||"Select All",this.closable=e.closable||"off",this.options=[],e.options)for(const t of e.options)this.options.push(new n(t))}}class n{constructor(e){this.id=e.id&&""!==e.id?e.id:t(),this.value=void 0===e.value?e.text:e.value,this.text=e.text||"",this.html=e.html||"",this.selected=void 0!==e.selected&&e.selected,this.display=void 0===e.display||e.display,this.disabled=void 0!==e.disabled&&e.disabled,this.mandatory=void 0!==e.mandatory&&e.mandatory,this.placeholder=void 0!==e.placeholder&&e.placeholder,this.class=e.class||"",this.style=e.style||"",this.data=e.data||{}}}class a{constructor(t,e){this.selectType="single",this.data=[],this.selectType=t,this.setData(e)}validateDataArray(t){if(!Array.isArray(t))return new Error("Data must be an array");for(let e of t){if(!(e instanceof i||"label"in e))return e instanceof n||"text"in e?this.validateOption(e):new Error("Data object must be a valid optgroup or option");if(!("label"in e))return new Error("Optgroup must have a label");if("options"in e&&e.options)for(let t of e.options)return this.validateOption(t)}return null}validateOption(t){return"text"in t?null:new Error("Option must have a text")}partialToFullData(t){let e=[];return t.forEach((t=>{if(t instanceof i||"label"in t){let s=[];"options"in t&&t.options&&t.options.forEach((t=>{s.push(new n(t))})),s.length>0&&e.push(new i(t))}(t instanceof n||"text"in t)&&e.push(new n(t))})),e}setData(t){this.data=this.partialToFullData(t),"single"===this.selectType&&this.setSelectedBy("id",this.getSelected())}getData(){return this.filter(null,!0)}getDataOptions(){return this.filter(null,!1)}addOption(t){this.setData(this.getData().concat(new n(t)))}setSelectedBy(t,e){let s=null,a=!1;for(let l of this.data){if(l instanceof i)for(let i of l.options)s||(s=i),i.selected=!a&&e.includes(i[t]),i.selected&&"single"===this.selectType&&(a=!0);l instanceof n&&(s||(s=l),l.selected=!a&&e.includes(l[t]),l.selected&&"single"===this.selectType&&(a=!0))}"single"===this.selectType&&s&&!a&&(s.selected=!0)}getSelected(){return this.getSelectedOptions().map((t=>t.id))}getSelectedOptions(){return this.filter((t=>t.selected),!1)}getOptgroupByID(t){for(let e of this.data)if(e instanceof i&&e.id===t)return e;return null}getOptionByID(t){let e=this.filter((e=>e.id===t),!1);return e.length?e[0]:null}getSelectType(){return this.selectType}getFirstOption(){let t=null;for(let e of this.data)if(e instanceof i?t=e.options[0]:e instanceof n&&(t=e),t)break;return t}search(t,e){return""===(t=t.trim())?this.getData():this.filter((s=>e(s,t)),!0)}filter(t,e){const s=[];return this.data.forEach((a=>{if(a instanceof i){let l=[];if(a.options.forEach((i=>{t&&!t(i)||(e?l.push(new n(i)):s.push(new n(i)))})),l.length>0){let t=new i(a);t.options=l,s.push(t)}}a instanceof n&&(t&&!t(a)||s.push(new n(a)))})),s}}class l{constructor(t,e,s){this.classes={main:"ss-main",placeholder:"ss-placeholder",values:"ss-values",single:"ss-single",max:"ss-max",value:"ss-value",valueText:"ss-value-text",valueDelete:"ss-value-delete",valueOut:"ss-value-out",deselect:"ss-deselect",deselectPath:"M10,10 L90,90 M10,90 L90,10",arrow:"ss-arrow",arrowClose:"M10,30 L50,70 L90,30",arrowOpen:"M10,70 L50,30 L90,70",content:"ss-content",openAbove:"ss-open-above",openBelow:"ss-open-below",search:"ss-search",searchHighlighter:"ss-search-highlight",searching:"ss-searching",addable:"ss-addable",addablePath:"M50,10 L50,90 M10,50 L90,50",list:"ss-list",optgroup:"ss-optgroup",optgroupLabel:"ss-optgroup-label",optgroupLabelText:"ss-optgroup-label-text",optgroupActions:"ss-optgroup-actions",optgroupSelectAll:"ss-selectall",optgroupSelectAllBox:"M60,10 L10,10 L10,90 L90,90 L90,50",optgroupSelectAllCheck:"M30,45 L50,70 L90,10",optgroupClosable:"ss-closable",option:"ss-option",optionDelete:"M10,10 L90,90 M10,90 L90,10",highlighted:"ss-highlighted",open:"ss-open",close:"ss-close",selected:"ss-selected",error:"ss-error",disabled:"ss-disabled",hide:"ss-hide"},this.store=e,this.settings=t,this.callbacks=s,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes(),this.settings.contentLocation.appendChild(this.content.main)}enable(){this.main.main.classList.remove(this.classes.disabled),this.content.search.input.disabled=!1}disable(){this.main.main.classList.add(this.classes.disabled),this.content.search.input.disabled=!0}open(){this.main.arrow.path.setAttribute("d",this.classes.arrowOpen),this.main.main.classList.add("up"===this.settings.openPosition?this.classes.openAbove:this.classes.openBelow),this.main.main.setAttribute("aria-expanded","true"),this.moveContent();const t=this.store.getSelectedOptions();if(t.length){const e=t[t.length-1].id,s=this.content.list.querySelector('[data-id="'+e+'"]');s&&this.ensureElementInView(this.content.list,s)}}close(){this.main.main.classList.remove(this.classes.openAbove),this.main.main.classList.remove(this.classes.openBelow),this.main.main.setAttribute("aria-expanded","false"),this.content.main.classList.remove(this.classes.openAbove),this.content.main.classList.remove(this.classes.openBelow),this.main.arrow.path.setAttribute("d",this.classes.arrowClose)}updateClassStyles(){if(this.main.main.className="",this.main.main.removeAttribute("style"),this.content.main.className="",this.content.main.removeAttribute("style"),this.main.main.classList.add(this.classes.main),this.content.main.classList.add(this.classes.content),""!==this.settings.style&&(this.main.main.style.cssText=this.settings.style,this.content.main.style.cssText=this.settings.style),this.settings.class.length)for(const t of this.settings.class)""!==t.trim()&&(this.main.main.classList.add(t.trim()),this.content.main.classList.add(t.trim()));"relative"===this.settings.contentPosition&&this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){this.main.main.role="combobox",this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.main.id),this.main.main.setAttribute("aria-expanded","false"),this.content.main.setAttribute("role","listbox")}mainDiv(){var t;const e=document.createElement("div");e.dataset.id=this.settings.id,e.setAttribute("aria-label",this.settings.ariaLabel),e.tabIndex=0,e.onkeydown=t=>{switch(t.key){case"ArrowUp":case"ArrowDown":return this.callbacks.open(),"ArrowDown"===t.key?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Enter":case" ":this.callbacks.open();const e=this.content.list.querySelector("."+this.classes.highlighted);return e&&e.click(),!1;case"Escape":return this.callbacks.close(),!1}return!1},e.onclick=t=>{this.settings.disabled||(this.settings.isOpen?this.callbacks.close():this.callbacks.open())};const s=document.createElement("div");s.classList.add(this.classes.values),e.appendChild(s);const i=document.createElement("div");i.classList.add(this.classes.deselect);const n=null===(t=this.store)||void 0===t?void 0:t.getSelectedOptions();!this.settings.allowDeselect||this.settings.isMultiple&&n&&n.length<=0?i.classList.add(this.classes.hide):i.classList.remove(this.classes.hide),i.onclick=t=>{if(t.stopPropagation(),this.settings.disabled)return;let e=!0;const s=this.store.getSelectedOptions(),i=[];if(this.callbacks.beforeChange&&(e=!0===this.callbacks.beforeChange(i,s)),e){if(this.settings.isMultiple)this.callbacks.setSelected([],!1),this.updateDeselectAll();else{const t=this.store.getFirstOption(),e=t?t.id:"";this.callbacks.setSelected(e,!1)}this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(this.store.getSelectedOptions())}};const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100");const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.deselectPath),a.appendChild(l),i.appendChild(a),e.appendChild(i);const o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.classList.add(this.classes.arrow),o.setAttribute("viewBox","0 0 100 100");const c=document.createElementNS("http://www.w3.org/2000/svg","path");return c.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&o.classList.add(this.classes.hide),o.appendChild(c),e.appendChild(o),{main:e,values:s,deselect:{main:i,svg:a,path:l},arrow:{main:o,path:c}}}mainFocus(t){"click"!==t&&this.main.main.focus({preventScroll:!0})}placeholder(){const t=this.store.filter((t=>t.placeholder),!1);let e=this.settings.placeholderText;t.length&&(""!==t[0].html?e=t[0].html:""!==t[0].text&&(e=t[0].text));const s=document.createElement("div");return s.classList.add(this.classes.placeholder),s.innerHTML=e,s}renderValues(){this.settings.isMultiple?(this.renderMultipleValues(),this.updateDeselectAll()):this.renderSingleValue()}renderSingleValue(){const t=this.store.filter((t=>t.selected&&!t.placeholder),!1),e=t.length>0?t[0]:null;if(e){const t=document.createElement("div");t.classList.add(this.classes.single),e.html?t.innerHTML=e.html:t.innerText=e.text,this.main.values.innerHTML=t.outerHTML}else this.main.values.innerHTML=this.placeholder().outerHTML;this.settings.allowDeselect&&t.length?this.main.deselect.main.classList.remove(this.classes.hide):this.main.deselect.main.classList.add(this.classes.hide)}renderMultipleValues(){let t=this.main.values.childNodes,e=this.store.filter((t=>t.selected&&t.display),!1);if(0===e.length)return void(this.main.values.innerHTML=this.placeholder().outerHTML);{const t=this.main.values.querySelector("."+this.classes.placeholder);t&&t.remove()}if(e.length>this.settings.maxValuesShown){const t=document.createElement("div");return t.classList.add(this.classes.max),t.textContent=this.settings.maxValuesMessage.replace("{number}",e.length.toString()),void(this.main.values.innerHTML=t.outerHTML)}{const t=this.main.values.querySelector("."+this.classes.max);t&&t.remove()}let s=[];for(let i=0;it.id===a),!1).length||s.push(n)}}for(const t of s)t.classList.add(this.classes.valueOut),setTimeout((()=>{this.main.values.hasChildNodes()&&this.main.values.contains(t)&&this.main.values.removeChild(t)}),100);t=this.main.values.childNodes;for(let s=0;s{if(e.preventDefault(),e.stopPropagation(),this.settings.disabled)return;let s=!0;const a=this.store.getSelectedOptions(),l=a.filter((e=>e.selected&&e.id!==t.id),!0);if(!(this.settings.minSelected&&l.length{this.callbacks.search(t.target.value)}),100),s.onkeydown=t=>{switch(t.key){case"ArrowUp":case"ArrowDown":return"ArrowDown"===t.key?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Escape":return this.callbacks.close(),!1;case"Enter":case" ":if(this.callbacks.addable&&t.ctrlKey)return i.click(),!1;{const t=this.content.list.querySelector("."+this.classes.highlighted);if(t)return t.click(),!1}return!0}return!0},t.appendChild(s),this.callbacks.addable){i.classList.add(this.classes.addable);const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 100 100");const s=document.createElementNS("http://www.w3.org/2000/svg","path");s.setAttribute("d",this.classes.addablePath),e.appendChild(s),i.appendChild(e),i.onclick=t=>{if(t.preventDefault(),t.stopPropagation(),!this.callbacks.addable)return;const e=this.content.search.input.value.trim();if(""===e)return void this.content.search.input.focus();const s=t=>{let e=new n(t);if(this.callbacks.addOption(e),this.settings.isMultiple){let t=this.store.getSelected();t.push(e.id),this.callbacks.setSelected(t,!0)}else this.callbacks.setSelected([e.id],!0);this.callbacks.search(""),this.settings.closeOnSelect&&setTimeout((()=>{this.callbacks.close()}),100)},i=this.callbacks.addable(e);!1!==i&&null!=i&&(i instanceof Promise?i.then((t=>{s("string"==typeof t?{text:t,value:t}:t)})):s("string"==typeof i?{text:i,value:i}:i))},t.appendChild(i),a.addable={main:i,svg:e,path:s}}return a}searchFocus(){this.content.search.input.focus()}getOptions(t=!1,e=!1,s=!1){let i="."+this.classes.option;return t&&(i+=":not(."+this.classes.placeholder+")"),e&&(i+=":not(."+this.classes.disabled+")"),s&&(i+=":not(."+this.classes.hide+")"),Array.from(this.content.list.querySelectorAll(i))}highlight(t){const e=this.getOptions(!0,!0,!0);if(0===e.length)return;if(1===e.length&&!e[0].classList.contains(this.classes.highlighted))return void e[0].classList.add(this.classes.highlighted);let s=!1;for(const t of e)t.classList.contains(this.classes.highlighted)&&(s=!0);if(!s)for(const t of e)if(t.classList.contains(this.classes.selected)){t.classList.add(this.classes.highlighted);break}for(let s=0;s=0?s-1:e.length-1];a.classList.add(this.classes.highlighted),this.ensureElementInView(this.content.list,a);const l=a.parentElement;if(l&&l.classList.contains(this.classes.close)){const t=l.querySelector("."+this.classes.optgroupLabel);t&&t.click()}return}e["down"===t?0:e.length-1].classList.add(this.classes.highlighted),this.ensureElementInView(this.content.list,e["down"===t?0:e.length-1])}listDiv(){const t=document.createElement("div");return t.classList.add(this.classes.list),t}renderError(t){this.content.list.innerHTML="";const e=document.createElement("div");e.classList.add(this.classes.error),e.textContent=t,this.content.list.appendChild(e)}renderSearching(){this.content.list.innerHTML="";const t=document.createElement("div");t.classList.add(this.classes.searching),t.textContent=this.settings.searchingText,this.content.list.appendChild(t)}renderOptions(t){if(this.content.list.innerHTML="",0===t.length){const t=document.createElement("div");return t.classList.add(this.classes.search),t.innerHTML=this.settings.searchText,void this.content.list.appendChild(t)}for(const e of t){if(e instanceof i){const t=document.createElement("div");t.classList.add(this.classes.optgroup);const s=document.createElement("div");s.classList.add(this.classes.optgroupLabel),t.appendChild(s);const i=document.createElement("div");i.classList.add(this.classes.optgroupLabelText),i.textContent=e.label,s.appendChild(i);const n=document.createElement("div");if(n.classList.add(this.classes.optgroupActions),s.appendChild(n),this.settings.isMultiple&&e.selectAll){const t=document.createElement("div");t.classList.add(this.classes.optgroupSelectAll);let s=!0;for(const t of e.options)if(!t.selected){s=!1;break}s&&t.classList.add(this.classes.selected);const i=document.createElement("span");i.textContent=e.selectAllText,t.appendChild(i);const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100"),t.appendChild(a);const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.optgroupSelectAllBox),a.appendChild(l);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.optgroupSelectAllCheck),a.appendChild(o),t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const i=this.store.getSelected();if(s){const t=i.filter((t=>{for(const s of e.options)if(t===s.id)return!1;return!0}));this.callbacks.setSelected(t,!0)}else{const t=i.concat(e.options.map((t=>t.id)));for(const t of e.options)this.store.getOptionByID(t.id)||this.callbacks.addOption(t);this.callbacks.setSelected(t,!0)}})),n.appendChild(t)}if("off"!==e.closable){const i=document.createElement("div");i.classList.add(this.classes.optgroupClosable);const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100"),a.classList.add(this.classes.arrow),i.appendChild(a);const l=document.createElementNS("http://www.w3.org/2000/svg","path");a.appendChild(l),e.options.some((t=>t.selected))||""!==this.content.search.input.value.trim()?(i.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"open"===e.closable?(t.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"close"===e.closable&&(t.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose)),s.addEventListener("click",(e=>{e.preventDefault(),e.stopPropagation(),t.classList.contains(this.classes.close)?(t.classList.remove(this.classes.close),t.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):(t.classList.remove(this.classes.open),t.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose))})),n.appendChild(i)}t.appendChild(s);for(const s of e.options)t.appendChild(this.option(s));this.content.list.appendChild(t)}e instanceof n&&this.content.list.appendChild(this.option(e))}}option(t){if(t.placeholder){const t=document.createElement("div");return t.classList.add(this.classes.option),t.classList.add(this.classes.hide),t}const e=document.createElement("div");return e.dataset.id=t.id,e.id=t.id,e.classList.add(this.classes.option),e.setAttribute("role","option"),t.class&&t.class.split(" ").forEach((t=>{e.classList.add(t)})),t.style&&(e.style.cssText=t.style),this.settings.searchHighlight&&""!==this.content.search.input.value.trim()?e.innerHTML=this.highlightText(""!==t.html?t.html:t.text,this.content.search.input.value,this.classes.searchHighlighter):""!==t.html?e.innerHTML=t.html:e.textContent=t.text,this.settings.showOptionTooltips&&e.textContent&&e.setAttribute("title",e.textContent),t.display||e.classList.add(this.classes.hide),t.disabled&&e.classList.add(this.classes.disabled),t.selected&&this.settings.hideSelected&&e.classList.add(this.classes.hide),t.selected?(e.classList.add(this.classes.selected),e.setAttribute("aria-selected","true"),this.main.main.setAttribute("aria-activedescendant",e.id)):(e.classList.remove(this.classes.selected),e.setAttribute("aria-selected","false")),e.addEventListener("click",(e=>{e.preventDefault(),e.stopPropagation();const s=this.store.getSelected(),i=e.currentTarget,n=String(i.dataset.id);if(t.disabled||t.selected&&!this.settings.allowDeselect)return;if(this.settings.isMultiple&&this.settings.maxSelected<=s.length&&!t.selected||this.settings.isMultiple&&this.settings.minSelected>=s.length&&t.selected)return;let a=!1;const l=this.store.getSelectedOptions();let o=[];this.settings.isMultiple&&(o=t.selected?l.filter((t=>t.id!==n)):l.concat(t)),this.settings.isMultiple||(o=t.selected?[]:[t]),this.callbacks.beforeChange||(a=!0),this.callbacks.beforeChange&&(a=!1!==this.callbacks.beforeChange(o,l)),a&&(this.store.getOptionByID(n)||this.callbacks.addOption(t),this.callbacks.setSelected(o.map((t=>t.id)),!1),this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(o))})),e}destroy(){this.main.main.remove(),this.content.main.remove()}highlightText(t,e,s){let i=t;const n=new RegExp("("+e.trim()+")(?![^<]*>[^<>]*${o}`),i}moveContentAbove(){const t=this.main.main.offsetHeight,e=this.content.main.offsetHeight;this.main.main.classList.remove(this.classes.openBelow),this.main.main.classList.add(this.classes.openAbove),this.content.main.classList.remove(this.classes.openBelow),this.content.main.classList.add(this.classes.openAbove);const s=this.main.main.getBoundingClientRect();this.content.main.style.margin="-"+(t+e-1)+"px 0px 0px 0px",this.content.main.style.top=s.top+s.height+window.scrollY+"px",this.content.main.style.left=s.left+window.scrollX+"px",this.content.main.style.width=s.width+"px"}moveContentBelow(){this.main.main.classList.remove(this.classes.openAbove),this.main.main.classList.add(this.classes.openBelow),this.content.main.classList.remove(this.classes.openAbove),this.content.main.classList.add(this.classes.openBelow);const t=this.main.main.getBoundingClientRect();this.content.main.style.margin="-1px 0px 0px 0px","relative"!==this.settings.contentPosition&&(this.content.main.style.top=t.top+t.height+window.scrollY+"px",this.content.main.style.left=t.left+window.scrollX+"px",this.content.main.style.width=t.width+"px")}ensureElementInView(t,e){const s=t.scrollTop+t.offsetTop,i=s+t.clientHeight,n=e.offsetTop,a=n+e.clientHeight;ni&&(t.scrollTop+=a-i)}putContent(){const t=this.main.main.offsetHeight,e=this.main.main.getBoundingClientRect(),s=this.content.main.offsetHeight;return window.innerHeight-(e.top+t)<=s&&e.top>s?"up":"down"}updateDeselectAll(){if(!this.store||!this.settings)return;const t=this.store.getSelectedOptions(),e=t&&t.length>0,s=this.settings.isMultiple,i=this.settings.allowDeselect,n=this.main.deselect.main,a=this.classes.hide;!i||s&&!e?n.classList.add(a):n.classList.remove(a)}}class o{constructor(t){this.listen=!1,this.observer=null,this.select=t,this.valueChange=this.valueChange.bind(this),this.select.addEventListener("change",this.valueChange,{passive:!0}),this.observer=new MutationObserver(this.observeCall.bind(this)),this.changeListen(!0)}enable(){this.select.disabled=!1}disable(){this.select.disabled=!0}hideUI(){this.select.tabIndex=-1,this.select.style.display="none",this.select.setAttribute("aria-hidden","true")}showUI(){this.select.removeAttribute("tabindex"),this.select.style.display="",this.select.removeAttribute("aria-hidden")}changeListen(t){this.listen=t,t&&this.observer&&this.observer.observe(this.select,{subtree:!0,childList:!0,attributes:!0}),t||this.observer&&this.observer.disconnect()}valueChange(t){return this.listen&&this.onValueChange&&this.onValueChange(this.getSelectedOptions()),!0}observeCall(t){if(!this.listen)return;let e=!1,s=!1,i=!1;for(const n of t)n.target===this.select&&("disabled"===n.attributeName&&(s=!0),"class"===n.attributeName&&(e=!0)),"OPTGROUP"!==n.target.nodeName&&"OPTION"!==n.target.nodeName||(i=!0);e&&this.onClassChange&&this.onClassChange(this.select.className.split(" ")),s&&this.onDisabledChange&&(this.changeListen(!1),this.onDisabledChange(this.select.disabled),this.changeListen(!0)),i&&this.onOptionsChange&&(this.changeListen(!1),this.onOptionsChange(this.getData()),this.changeListen(!0))}getData(){let t=[];const e=this.select.childNodes;for(const s of e)"OPTGROUP"===s.nodeName&&t.push(this.getDataFromOptgroup(s)),"OPTION"===s.nodeName&&t.push(this.getDataFromOption(s));return t}getDataFromOptgroup(t){let e={id:t.id,label:t.label,selectAll:!!t.dataset&&"true"===t.dataset.selectall,selectAllText:t.dataset?t.dataset.selectalltext:"Select all",closable:t.dataset?t.dataset.closable:"off",options:[]};const s=t.childNodes;for(const t of s)"OPTION"===t.nodeName&&e.options.push(this.getDataFromOption(t));return e}getDataFromOption(t){return{id:t.id,value:t.value,text:t.text,html:t.dataset&&t.dataset.html?t.dataset.html:"",selected:t.selected,display:"none"!==t.style.display,disabled:t.disabled,mandatory:!!t.dataset&&"true"===t.dataset.mandatory,placeholder:"true"===t.dataset.placeholder,class:t.className,style:t.style.cssText,data:t.dataset}}getSelectedOptions(){let t=[];const e=this.select.childNodes;for(const s of e){if("OPTGROUP"===s.nodeName){const e=s.childNodes;for(const s of e)if("OPTION"===s.nodeName){const e=s;e.selected&&t.push(this.getDataFromOption(e))}}if("OPTION"===s.nodeName){const e=s;e.selected&&t.push(this.getDataFromOption(e))}}return t}getSelectedValues(){return this.getSelectedOptions().map((t=>t.value))}setSelected(t){this.changeListen(!1);const e=this.select.childNodes;for(const s of e){if("OPTGROUP"===s.nodeName){const e=s.childNodes;for(const s of e)if("OPTION"===s.nodeName){const e=s;e.selected=t.includes(e.id)}}if("OPTION"===s.nodeName){const e=s;e.selected=t.includes(e.id)}}this.changeListen(!0)}updateSelect(t,e,s){this.changeListen(!1),t&&(this.select.dataset.id=t),e&&(this.select.style.cssText=e),s&&(this.select.className="",s.forEach((t=>{""!==t.trim()&&this.select.classList.add(t.trim())}))),this.changeListen(!0)}updateOptions(t){this.changeListen(!1),this.select.innerHTML="";for(const e of t)e instanceof i&&this.select.appendChild(this.createOptgroup(e)),e instanceof n&&this.select.appendChild(this.createOption(e));this.select.dispatchEvent(new Event("change")),this.changeListen(!0)}createOptgroup(t){const e=document.createElement("optgroup");if(e.id=t.id,e.label=t.label,t.selectAll&&(e.dataset.selectAll="true"),"off"!==t.closable&&(e.dataset.closable=t.closable),t.options)for(const s of t.options)e.appendChild(this.createOption(s));return e}createOption(t){const e=document.createElement("option");return e.id=t.id,e.value=t.value,e.innerHTML=t.text,""!==t.html&&e.setAttribute("data-html",t.html),t.selected&&(e.selected=t.selected),t.disabled&&(e.disabled=!0),!1===t.display&&(e.style.display="none"),t.placeholder&&e.setAttribute("data-placeholder","true"),t.mandatory&&e.setAttribute("data-mandatory","true"),t.class&&t.class.split(" ").forEach((t=>{e.classList.add(t)})),t.data&&"object"==typeof t.data&&Object.keys(t.data).forEach((s=>{e.setAttribute("data-"+function(t){const e=t.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,(t=>"-"+t.toLowerCase()));return t[0]===t[0].toUpperCase()?e.substring(1):e}(s),t.data[s])})),e}destroy(){this.changeListen(!1),this.select.removeEventListener("change",this.valueChange),this.observer&&(this.observer.disconnect(),this.observer=null),delete this.select.dataset.id,this.showUI()}}class c{constructor(e){this.id="",this.style="",this.class=[],this.isMultiple=!1,this.isOpen=!1,this.isFullOpen=!1,this.intervalMove=null,e||(e={}),this.id="ss-"+t(),this.style=e.style||"",this.class=e.class||[],this.disabled=void 0!==e.disabled&&e.disabled,this.alwaysOpen=void 0!==e.alwaysOpen&&e.alwaysOpen,this.showSearch=void 0===e.showSearch||e.showSearch,this.ariaLabel=e.ariaLabel||"Combobox",this.searchPlaceholder=e.searchPlaceholder||"Search",this.searchText=e.searchText||"No Results",this.searchingText=e.searchingText||"Searching...",this.searchHighlight=void 0!==e.searchHighlight&&e.searchHighlight,this.closeOnSelect=void 0===e.closeOnSelect||e.closeOnSelect,this.contentLocation=e.contentLocation||document.body,this.contentPosition=e.contentPosition||"absolute",this.openPosition=e.openPosition||"auto",this.placeholderText=void 0!==e.placeholderText?e.placeholderText:"Select Value",this.allowDeselect=void 0!==e.allowDeselect&&e.allowDeselect,this.hideSelected=void 0!==e.hideSelected&&e.hideSelected,this.keepOrder=void 0!==e.keepOrder&&e.keepOrder,this.showOptionTooltips=void 0!==e.showOptionTooltips&&e.showOptionTooltips,this.minSelected=e.minSelected||0,this.maxSelected=e.maxSelected||1e3,this.timeoutDelay=e.timeoutDelay||200,this.maxValuesShown=e.maxValuesShown||20,this.maxValuesMessage=e.maxValuesMessage||"{number} selected"}}return class{constructor(t){var s;if(this.events={search:void 0,searchFilter:(t,e)=>-1!==t.text.toLowerCase().indexOf(e.toLowerCase()),addable:void 0,beforeChange:void 0,afterChange:void 0,beforeOpen:void 0,afterOpen:void 0,beforeClose:void 0,afterClose:void 0},this.windowResize=e((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.windowScroll=e((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.documentClick=t=>{this.settings.isOpen&&t.target&&!function(t,e){function s(t,s){return s&&t&&t.classList&&t.classList.contains(s)||s&&t&&t.dataset&&t.dataset.id&&t.dataset.id===e?t:null}return s(t,e)||function t(e,i){return e&&e!==document?s(e,i)?e:t(e.parentNode,i):null}(t,e)}(t.target,this.settings.id)&&this.close(t.type)},this.windowVisibilityChange=()=>{document.hidden&&this.close()},this.selectEl="string"==typeof t.select?document.querySelector(t.select):t.select,!this.selectEl)return void(t.events&&t.events.error&&t.events.error(new Error("Could not find select element")));if("SELECT"!==this.selectEl.tagName)return void(t.events&&t.events.error&&t.events.error(new Error("Element isnt of type select")));this.selectEl.dataset.ssid&&this.destroy(),this.settings=new c(t.settings);const i=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const s in t.events)t.events.hasOwnProperty(s)&&(-1!==i.indexOf(s)?this.events[s]=e(t.events[s],100):this.events[s]=t.events[s]);this.settings.disabled=(null===(s=t.settings)||void 0===s?void 0:s.disabled)?t.settings.disabled:this.selectEl.disabled,this.settings.isMultiple=this.selectEl.multiple,this.settings.style=this.selectEl.style.cssText,this.settings.class=this.selectEl.className.split(" "),this.select=new o(this.selectEl),this.select.updateSelect(this.settings.id,this.settings.style,this.settings.class),this.select.hideUI(),this.select.onValueChange=t=>{this.setSelected(t.map((t=>t.id)))},this.select.onClassChange=t=>{this.settings.class=t,this.render.updateClassStyles()},this.select.onDisabledChange=t=>{t?this.disable():this.enable()},this.select.onOptionsChange=t=>{this.setData(t)},this.store=new a(this.settings.isMultiple?"multiple":"single",t.data?t.data:this.select.getData()),t.data&&this.select.updateOptions(this.store.getData());const n={open:this.open.bind(this),close:this.close.bind(this),addable:this.events.addable?this.events.addable:void 0,setSelected:this.setSelected.bind(this),addOption:this.addOption.bind(this),search:this.search.bind(this),beforeChange:this.events.beforeChange,afterChange:this.events.afterChange};this.render=new l(this.settings,this.store,n),this.render.renderValues(),this.render.renderOptions(this.store.getData());const h=this.selectEl.getAttribute("aria-label"),r=this.selectEl.getAttribute("aria-labelledby");h?this.render.main.main.setAttribute("aria-label",h):r&&this.render.main.main.setAttribute("aria-labelledby",r),this.selectEl.parentNode&&this.selectEl.parentNode.insertBefore(this.render.main.main,this.selectEl.nextSibling),window.addEventListener("resize",this.windowResize,!1),"auto"===this.settings.openPosition&&window.addEventListener("scroll",this.windowScroll,!1),document.addEventListener("visibilitychange",this.windowVisibilityChange),this.settings.disabled&&this.disable(),this.settings.alwaysOpen&&this.open(),this.selectEl.slim=this}enable(){this.settings.disabled=!1,this.select.enable(),this.render.enable()}disable(){this.settings.disabled=!0,this.select.disable(),this.render.disable()}getData(){return this.store.getData()}setData(t){const e=this.store.getSelected(),i=this.store.validateDataArray(t);if(i)return void(this.events.error&&this.events.error(i));this.store.setData(t);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!s(e,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){return this.store.getSelected()}setSelected(t,e=!0){const i=this.store.getSelected();this.store.setSelectedBy("id",Array.isArray(t)?t:[t]);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),""!==this.render.content.search.input.value?this.search(this.render.content.search.input.value):this.render.renderOptions(n),e&&this.events.afterChange&&!s(i,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}addOption(t){const e=this.store.getSelected();this.store.getDataOptions().some((e=>{var s;return e.value===(null!==(s=t.value)&&void 0!==s?s:t.text)}))||this.store.addOption(t);const i=this.store.getData();this.select.updateOptions(i),this.render.renderValues(),this.render.renderOptions(i),this.events.afterChange&&!s(e,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}open(){this.settings.disabled||this.settings.isOpen||(this.events.beforeOpen&&this.events.beforeOpen(),this.render.open(),this.settings.showSearch&&this.render.searchFocus(),this.settings.isOpen=!0,setTimeout((()=>{this.events.afterOpen&&this.events.afterOpen(),this.settings.isOpen&&(this.settings.isFullOpen=!0),document.addEventListener("click",this.documentClick)}),this.settings.timeoutDelay),"absolute"===this.settings.contentPosition&&(this.settings.intervalMove&&clearInterval(this.settings.intervalMove),this.settings.intervalMove=setInterval(this.render.moveContent.bind(this.render),500)))}close(t=null){this.settings.isOpen&&!this.settings.alwaysOpen&&(this.events.beforeClose&&this.events.beforeClose(),this.render.close(),""!==this.render.content.search.input.value&&this.search(""),this.render.mainFocus(t),this.settings.isOpen=!1,this.settings.isFullOpen=!1,setTimeout((()=>{this.events.afterClose&&this.events.afterClose(),document.removeEventListener("click",this.documentClick)}),this.settings.timeoutDelay),this.settings.intervalMove&&clearInterval(this.settings.intervalMove))}search(t){if(this.render.content.search.input.value!==t&&(this.render.content.search.input.value=t),!this.events.search)return void this.render.renderOptions(""===t?this.store.getData():this.store.search(t,this.events.searchFilter));this.render.renderSearching();const e=this.events.search(t,this.store.getSelectedOptions());e instanceof Promise?e.then((t=>{this.render.renderOptions(this.store.partialToFullData(t))})).catch((t=>{this.render.renderError("string"==typeof t?t:t.message)})):Array.isArray(e)?this.render.renderOptions(this.store.partialToFullData(e)):this.render.renderError("Search event must return a promise or an array of data")}destroy(){document.removeEventListener("click",this.documentClick),window.removeEventListener("resize",this.windowResize,!1),"auto"===this.settings.openPosition&&window.removeEventListener("scroll",this.windowScroll,!1),document.removeEventListener("visibilitychange",this.windowVisibilityChange),this.store.setData([]),this.render.destroy(),this.select.destroy()}}})); diff --git a/dist/store.d.ts b/dist/store.d.ts index ad71bb55..e00d0d80 100644 --- a/dist/store.d.ts +++ b/dist/store.d.ts @@ -67,7 +67,6 @@ export default class Store { setSelectedBy(selectedType: 'id' | 'value', selectedValues: string[]): void; getSelected(): string[]; getSelectedOptions(): Option[]; - getSelectedIDs(): string[]; getOptgroupByID(id: string): Optgroup | null; getOptionByID(id: string): Option | null; getSelectType(): string; diff --git a/docs/assets/index.js b/docs/assets/index.js index 27947be4..bb13c721 100644 --- a/docs/assets/index.js +++ b/docs/assets/index.js @@ -1,19 +1,19 @@ -(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const l of s)if(l.type==="childList")for(const i of l.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const l={};return s.integrity&&(l.integrity=s.integrity),s.referrerPolicy&&(l.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?l.credentials="include":s.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(s){if(s.ep)return;s.ep=!0;const l=n(s);fetch(s.href,l)}})();function Ju(e,t){const n=new Set(e.split(","));return t?r=>n.has(r.toLowerCase()):r=>n.has(r)}const ye={},Lr=[],xt=()=>{},tg=()=>!1,ki=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Xu=e=>e.startsWith("onUpdate:"),ze=Object.assign,qu=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},ng=Object.prototype.hasOwnProperty,ie=(e,t)=>ng.call(e,t),X=Array.isArray,Tr=e=>Ai(e)==="[object Map]",Cd=e=>Ai(e)==="[object Set]",q=e=>typeof e=="function",Ne=e=>typeof e=="string",Xr=e=>typeof e=="symbol",Se=e=>e!==null&&typeof e=="object",kd=e=>(Se(e)||q(e))&&q(e.then)&&q(e.catch),Ad=Object.prototype.toString,Ai=e=>Ad.call(e),rg=e=>Ai(e).slice(8,-1),Od=e=>Ai(e)==="[object Object]",ea=e=>Ne(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Tl=Ju(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Oi=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},sg=/-(\w)/g,Jt=Oi(e=>e.replace(sg,(t,n)=>n?n.toUpperCase():"")),lg=/\B([A-Z])/g,qr=Oi(e=>e.replace(lg,"-$1").toLowerCase()),Pi=Oi(e=>e.charAt(0).toUpperCase()+e.slice(1)),no=Oi(e=>e?`on${Pi(e)}`:""),jn=(e,t)=>!Object.is(e,t),ro=(e,t)=>{for(let n=0;n{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value:n})},ig=e=>{const t=parseFloat(e);return isNaN(t)?e:t};let wc;const Pd=()=>wc||(wc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function ta(e){if(X(e)){const t={};for(let n=0;n{if(n){const r=n.split(ug);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function na(e){let t="";if(Ne(e))t=e;else if(X(e))for(let n=0;nNe(e)?e:e==null?"":X(e)||Se(e)&&(e.toString===Ad||!q(e.toString))?JSON.stringify(e,Td,2):String(e),Td=(e,t)=>t&&t.__v_isRef?Td(e,t.value):Tr(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,s],l)=>(n[so(r,l)+" =>"]=s,n),{})}:Cd(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>so(n))}:Xr(t)?so(t):Se(t)&&!X(t)&&!Od(t)?String(t):t,so=(e,t="")=>{var n;return Xr(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};let $t;class pg{constructor(t=!1){this.detached=t,this._active=!0,this.effects=[],this.cleanups=[],this.parent=$t,!t&&$t&&(this.index=($t.scopes||($t.scopes=[])).push(this)-1)}get active(){return this._active}run(t){if(this._active){const n=$t;try{return $t=this,t()}finally{$t=n}}}on(){$t=this}off(){$t=this.parent}stop(t){if(this._active){let n,r;for(n=0,r=this.effects.length;n=2))break;cr(),this._queryings--}return this._dirtyLevel>=2}set dirty(t){this._dirtyLevel=t?3:0}run(){if(this._dirtyLevel=0,!this.active)return this.fn();let t=Pn,n=qn;try{return Pn=!0,qn=this,this._runnings++,Sc(this),this.fn()}finally{xc(this),this._runnings--,qn=n,Pn=t}}stop(){var t;this.active&&(Sc(this),xc(this),(t=this.onStop)==null||t.call(this),this.active=!1)}}function gg(e){return e.value}function Sc(e){e._trackId++,e._depsLength=0}function xc(e){if(e.deps&&e.deps.length>e._depsLength){for(let t=e._depsLength;t{const n=new Map;return n.cleanup=e,n.computed=t,n},$o=new WeakMap,er=Symbol(""),Wo=Symbol("");function ut(e,t,n){if(Pn&&qn){let r=$o.get(e);r||$o.set(e,r=new Map);let s=r.get(n);s||r.set(n,s=Fd(()=>r.delete(n))),Md(qn,s)}}function on(e,t,n,r,s,l){const i=$o.get(e);if(!i)return;let o=[];if(t==="clear")o=[...i.values()];else if(n==="length"&&X(e)){const u=Number(r);i.forEach((a,c)=>{(c==="length"||!Xr(c)&&c>=u)&&o.push(a)})}else switch(n!==void 0&&o.push(i.get(n)),t){case"add":X(e)?ea(n)&&o.push(i.get("length")):(o.push(i.get(er)),Tr(e)&&o.push(i.get(Wo)));break;case"delete":X(e)||(o.push(i.get(er)),Tr(e)&&o.push(i.get(Wo)));break;case"set":Tr(e)&&o.push(i.get(er));break}sa();for(const u of o)u&&Id(u,3);la()}const vg=Ju("__proto__,__v_isRef,__isVue"),Dd=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(Xr)),Ec=yg();function yg(){const e={};return["includes","indexOf","lastIndexOf"].forEach(t=>{e[t]=function(...n){const r=ue(this);for(let l=0,i=this.length;l{e[t]=function(...n){ar(),sa();const r=ue(this)[t].apply(this,n);return la(),cr(),r}}),e}function wg(e){const t=ue(this);return ut(t,"has",e),t.hasOwnProperty(e)}class bd{constructor(t=!1,n=!1){this._isReadonly=t,this._shallow=n}get(t,n,r){const s=this._isReadonly,l=this._shallow;if(n==="__v_isReactive")return!s;if(n==="__v_isReadonly")return s;if(n==="__v_isShallow")return l;if(n==="__v_raw")return r===(s?l?Ng:Ud:l?Bd:zd).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(r)?t:void 0;const i=X(t);if(!s){if(i&&ie(Ec,n))return Reflect.get(Ec,n,r);if(n==="hasOwnProperty")return wg}const o=Reflect.get(t,n,r);return(Xr(n)?Dd.has(n):vg(n))||(s||ut(t,"get",n),l)?o:at(o)?i&&ea(n)?o:o.value:Se(o)?s?Hd(o):Ti(o):o}}class jd extends bd{constructor(t=!1){super(!1,t)}set(t,n,r,s){let l=t[n];if(!this._shallow){const u=Br(l);if(!Yl(r)&&!Br(r)&&(l=ue(l),r=ue(r)),!X(t)&&at(l)&&!at(r))return u?!1:(l.value=r,!0)}const i=X(t)&&ea(n)?Number(n)e,Li=e=>Reflect.getPrototypeOf(e);function ol(e,t,n=!1,r=!1){e=e.__v_raw;const s=ue(e),l=ue(t);n||(jn(t,l)&&ut(s,"get",t),ut(s,"get",l));const{has:i}=Li(s),o=r?ia:n?aa:Is;if(i.call(s,t))return o(e.get(t));if(i.call(s,l))return o(e.get(l));e!==s&&e.get(t)}function ul(e,t=!1){const n=this.__v_raw,r=ue(n),s=ue(e);return t||(jn(e,s)&&ut(r,"has",e),ut(r,"has",s)),e===s?n.has(e):n.has(e)||n.has(s)}function al(e,t=!1){return e=e.__v_raw,!t&&ut(ue(e),"iterate",er),Reflect.get(e,"size",e)}function _c(e){e=ue(e);const t=ue(this);return Li(t).has.call(t,e)||(t.add(e),on(t,"add",e,e)),this}function Cc(e,t){t=ue(t);const n=ue(this),{has:r,get:s}=Li(n);let l=r.call(n,e);l||(e=ue(e),l=r.call(n,e));const i=s.call(n,e);return n.set(e,t),l?jn(t,i)&&on(n,"set",e,t):on(n,"add",e,t),this}function kc(e){const t=ue(this),{has:n,get:r}=Li(t);let s=n.call(t,e);s||(e=ue(e),s=n.call(t,e)),r&&r.call(t,e);const l=t.delete(e);return s&&on(t,"delete",e,void 0),l}function Ac(){const e=ue(this),t=e.size!==0,n=e.clear();return t&&on(e,"clear",void 0,void 0),n}function cl(e,t){return function(r,s){const l=this,i=l.__v_raw,o=ue(i),u=t?ia:e?aa:Is;return!e&&ut(o,"iterate",er),i.forEach((a,c)=>r.call(s,u(a),u(c),l))}}function fl(e,t,n){return function(...r){const s=this.__v_raw,l=ue(s),i=Tr(l),o=e==="entries"||e===Symbol.iterator&&i,u=e==="keys"&&i,a=s[e](...r),c=n?ia:t?aa:Is;return!t&&ut(l,"iterate",u?Wo:er),{next(){const{value:d,done:p}=a.next();return p?{value:d,done:p}:{value:o?[c(d[0]),c(d[1])]:c(d),done:p}},[Symbol.iterator](){return this}}}}function gn(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function Cg(){const e={get(l){return ol(this,l)},get size(){return al(this)},has:ul,add:_c,set:Cc,delete:kc,clear:Ac,forEach:cl(!1,!1)},t={get(l){return ol(this,l,!1,!0)},get size(){return al(this)},has:ul,add:_c,set:Cc,delete:kc,clear:Ac,forEach:cl(!1,!0)},n={get(l){return ol(this,l,!0)},get size(){return al(this,!0)},has(l){return ul.call(this,l,!0)},add:gn("add"),set:gn("set"),delete:gn("delete"),clear:gn("clear"),forEach:cl(!0,!1)},r={get(l){return ol(this,l,!0,!0)},get size(){return al(this,!0)},has(l){return ul.call(this,l,!0)},add:gn("add"),set:gn("set"),delete:gn("delete"),clear:gn("clear"),forEach:cl(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(l=>{e[l]=fl(l,!1,!1),n[l]=fl(l,!0,!1),t[l]=fl(l,!1,!0),r[l]=fl(l,!0,!0)}),[e,n,t,r]}const[kg,Ag,Og,Pg]=Cg();function oa(e,t){const n=t?e?Pg:Og:e?Ag:kg;return(r,s,l)=>s==="__v_isReactive"?!e:s==="__v_isReadonly"?e:s==="__v_raw"?r:Reflect.get(ie(n,s)&&s in r?n:r,s,l)}const Lg={get:oa(!1,!1)},Tg={get:oa(!1,!0)},Rg={get:oa(!0,!1)},zd=new WeakMap,Bd=new WeakMap,Ud=new WeakMap,Ng=new WeakMap;function Mg(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Ig(e){return e.__v_skip||!Object.isExtensible(e)?0:Mg(rg(e))}function Ti(e){return Br(e)?e:ua(e,!1,xg,Lg,zd)}function Vd(e){return ua(e,!1,_g,Tg,Bd)}function Hd(e){return ua(e,!0,Eg,Rg,Ud)}function ua(e,t,n,r,s){if(!Se(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const l=s.get(e);if(l)return l;const i=Ig(e);if(i===0)return e;const o=new Proxy(e,i===2?r:n);return s.set(e,o),o}function Rr(e){return Br(e)?Rr(e.__v_raw):!!(e&&e.__v_isReactive)}function Br(e){return!!(e&&e.__v_isReadonly)}function Yl(e){return!!(e&&e.__v_isShallow)}function $d(e){return Rr(e)||Br(e)}function ue(e){const t=e&&e.__v_raw;return t?ue(t):e}function Wd(e){return Gl(e,"__v_skip",!0),e}const Is=e=>Se(e)?Ti(e):e,aa=e=>Se(e)?Hd(e):e;class Qd{constructor(t,n,r,s){this._setter=n,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this.effect=new ra(()=>t(this._value),()=>Qo(this,1)),this.effect.computed=this,this.effect.active=this._cacheable=!s,this.__v_isReadonly=r}get value(){const t=ue(this);return Kd(t),(!t._cacheable||t.effect.dirty)&&jn(t._value,t._value=t.effect.run())&&Qo(t,2),t._value}set value(t){this._setter(t)}get _dirty(){return this.effect.dirty}set _dirty(t){this.effect.dirty=t}}function Fg(e,t,n=!1){let r,s;const l=q(e);return l?(r=e,s=xt):(r=e.get,s=e.set),new Qd(r,s,l||!s,n)}function Kd(e){Pn&&qn&&(e=ue(e),Md(qn,e.dep||(e.dep=Fd(()=>e.dep=void 0,e instanceof Qd?e:void 0))))}function Qo(e,t=3,n){e=ue(e);const r=e.dep;r&&Id(r,t)}function at(e){return!!(e&&e.__v_isRef===!0)}function Gd(e){return Yd(e,!1)}function Dg(e){return Yd(e,!0)}function Yd(e,t){return at(e)?e:new bg(e,t)}class bg{constructor(t,n){this.__v_isShallow=n,this.dep=void 0,this.__v_isRef=!0,this._rawValue=n?t:ue(t),this._value=n?t:Is(t)}get value(){return Kd(this),this._value}set value(t){const n=this.__v_isShallow||Yl(t)||Br(t);t=n?t:ue(t),jn(t,this._rawValue)&&(this._rawValue=t,this._value=n?t:Is(t),Qo(this,3))}}function Nr(e){return at(e)?e.value:e}const jg={get:(e,t,n)=>Nr(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const s=e[t];return at(s)&&!at(n)?(s.value=n,!0):Reflect.set(e,t,n,r)}};function Zd(e){return Rr(e)?e:new Proxy(e,jg)}function Ln(e,t,n,r){let s;try{s=r?e(...r):e()}catch(l){Ri(l,t,n)}return s}function Ft(e,t,n,r){if(q(e)){const l=Ln(e,t,n,r);return l&&kd(l)&&l.catch(i=>{Ri(i,t,n)}),l}const s=[];for(let l=0;l>>1,s=We[r],l=Ds(s);lKt&&We.splice(t,1)}function Vg(e){X(e)?Mr.push(...e):(!en||!en.includes(e,e.allowRecurse?Yn+1:Yn))&&Mr.push(e),qd()}function Oc(e,t,n=Fs?Kt+1:0){for(;nDs(n)-Ds(r)),Yn=0;Yne.id==null?1/0:e.id,Hg=(e,t)=>{const n=Ds(e)-Ds(t);if(n===0){if(e.pre&&!t.pre)return-1;if(t.pre&&!e.pre)return 1}return n};function th(e){Ko=!1,Fs=!0,We.sort(Hg);try{for(Kt=0;KtNe(w)?w.trim():w)),d&&(s=n.map(ig))}let o,u=r[o=no(t)]||r[o=no(Jt(t))];!u&&l&&(u=r[o=no(qr(t))]),u&&Ft(u,e,6,s);const a=r[o+"Once"];if(a){if(!e.emitted)e.emitted={};else if(e.emitted[o])return;e.emitted[o]=!0,Ft(a,e,6,s)}}function nh(e,t,n=!1){const r=t.emitsCache,s=r.get(e);if(s!==void 0)return s;const l=e.emits;let i={},o=!1;if(!q(e)){const u=a=>{const c=nh(a,t,!0);c&&(o=!0,ze(i,c))};!n&&t.mixins.length&&t.mixins.forEach(u),e.extends&&u(e.extends),e.mixins&&e.mixins.forEach(u)}return!l&&!o?(Se(e)&&r.set(e,null),null):(X(l)?l.forEach(u=>i[u]=null):ze(i,l),Se(e)&&r.set(e,i),i)}function Ni(e,t){return!e||!ki(t)?!1:(t=t.slice(2).replace(/Once$/,""),ie(e,t[0].toLowerCase()+t.slice(1))||ie(e,qr(t))||ie(e,t))}let Ze=null,rh=null;function Zl(e){const t=Ze;return Ze=e,rh=e&&e.type.__scopeId||null,t}function Wg(e,t=Ze,n){if(!t||e._n)return e;const r=(...s)=>{r._d&&zc(-1);const l=Zl(t);let i;try{i=e(...s)}finally{Zl(l),r._d&&zc(1)}return i};return r._n=!0,r._c=!0,r._d=!0,r}function lo(e){const{type:t,vnode:n,proxy:r,withProxy:s,props:l,propsOptions:[i],slots:o,attrs:u,emit:a,render:c,renderCache:d,data:p,setupState:w,ctx:x,inheritAttrs:_}=e;let L,m;const f=Zl(e);try{if(n.shapeFlag&4){const y=s||r,S=y;L=Qt(c.call(S,y,d,l,w,p,x)),m=u}else{const y=t;L=Qt(y.length>1?y(l,{attrs:u,slots:o,emit:a}):y(l,null)),m=t.props?u:Qg(u)}}catch(y){xs.length=0,Ri(y,e,1),L=be(zn)}let h=L;if(m&&_!==!1){const y=Object.keys(m),{shapeFlag:S}=h;y.length&&S&7&&(i&&y.some(Xu)&&(m=Kg(m,i)),h=Ur(h,m))}return n.dirs&&(h=Ur(h),h.dirs=h.dirs?h.dirs.concat(n.dirs):n.dirs),n.transition&&(h.transition=n.transition),L=h,Zl(f),L}const Qg=e=>{let t;for(const n in e)(n==="class"||n==="style"||ki(n))&&((t||(t={}))[n]=e[n]);return t},Kg=(e,t)=>{const n={};for(const r in e)(!Xu(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function Gg(e,t,n){const{props:r,children:s,component:l}=e,{props:i,children:o,patchFlag:u}=t,a=l.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&u>=0){if(u&1024)return!0;if(u&16)return r?Pc(r,i,a):!!i;if(u&8){const c=t.dynamicProps;for(let d=0;de.__isSuspense;function qg(e,t){t&&t.pendingBranch?X(e)?t.effects.push(...e):t.effects.push(e):Vg(e)}const ev=Symbol.for("v-scx"),tv=()=>un(ev),dl={};function Rl(e,t,n){return lh(e,t,n)}function lh(e,t,{immediate:n,deep:r,flush:s,once:l,onTrack:i,onTrigger:o}=ye){if(t&&l){const S=t;t=(...C)=>{S(...C),y()}}const u=Qe,a=S=>r===!0?S:gr(S,r===!1?1:void 0);let c,d=!1,p=!1;if(at(e)?(c=()=>e.value,d=Yl(e)):Rr(e)?(c=()=>a(e),d=!0):X(e)?(p=!0,d=e.some(S=>Rr(S)||Yl(S)),c=()=>e.map(S=>{if(at(S))return S.value;if(Rr(S))return a(S);if(q(S))return Ln(S,u,2)})):q(e)?t?c=()=>Ln(e,u,2):c=()=>(w&&w(),Ft(e,u,3,[x])):c=xt,t&&r){const S=c;c=()=>gr(S())}let w,x=S=>{w=h.onStop=()=>{Ln(S,u,4),w=h.onStop=void 0}},_;if(ji)if(x=xt,t?n&&Ft(t,u,3,[c(),p?[]:void 0,x]):c(),s==="sync"){const S=tv();_=S.__watcherHandles||(S.__watcherHandles=[])}else return xt;let L=p?new Array(e.length).fill(dl):dl;const m=()=>{if(!(!h.active||!h.dirty))if(t){const S=h.run();(r||d||(p?S.some((C,k)=>jn(C,L[k])):jn(S,L)))&&(w&&w(),Ft(t,u,3,[S,L===dl?void 0:p&&L[0]===dl?[]:L,x]),L=S)}else h.run()};m.allowRecurse=!!t;let f;s==="sync"?f=m:s==="post"?f=()=>tt(m,u&&u.suspense):(m.pre=!0,u&&(m.id=u.uid),f=()=>fa(m));const h=new ra(c,xt,f),y=()=>{h.stop(),u&&u.scope&&qu(u.scope.effects,h)};return t?n?m():L=h.run():s==="post"?tt(h.run.bind(h),u&&u.suspense):h.run(),_&&_.push(y),y}function nv(e,t,n){const r=this.proxy,s=Ne(e)?e.includes(".")?ih(r,e):()=>r[e]:e.bind(r,r);let l;q(t)?l=t:(l=t.handler,n=t);const i=Qe;Vr(this);const o=lh(s,l.bind(r),n);return i?Vr(i):tr(),o}function ih(e,t){const n=t.split(".");return()=>{let r=e;for(let s=0;s0){if(n>=t)return e;n++}if(r=r||new Set,r.has(e))return e;if(r.add(e),at(e))gr(e.value,t,n,r);else if(X(e))for(let s=0;s{gr(s,t,n,r)});else if(Od(e))for(const s in e)gr(e[s],t,n,r);return e}function Wn(e,t,n,r){const s=e.dirs,l=t&&t.dirs;for(let i=0;i!!e.type.__asyncLoader,oh=e=>e.type.__isKeepAlive;function rv(e,t){uh(e,"a",t)}function sv(e,t){uh(e,"da",t)}function uh(e,t,n=Qe){const r=e.__wdc||(e.__wdc=()=>{let s=n;for(;s;){if(s.isDeactivated)return;s=s.parent}return e()});if(Ii(t,r,n),n){let s=n.parent;for(;s&&s.parent;)oh(s.parent.vnode)&&lv(r,t,n,s),s=s.parent}}function lv(e,t,n,r){const s=Ii(t,e,r,!0);ch(()=>{qu(r[t],s)},n)}function Ii(e,t,n=Qe,r=!1){if(n){const s=n[e]||(n[e]=[]),l=t.__weh||(t.__weh=(...i)=>{if(n.isUnmounted)return;ar(),Vr(n);const o=Ft(t,n,e,i);return tr(),cr(),o});return r?s.unshift(l):s.push(l),l}}const pn=e=>(t,n=Qe)=>(!ji||e==="sp")&&Ii(e,(...r)=>t(...r),n),iv=pn("bm"),ah=pn("m"),ov=pn("bu"),uv=pn("u"),av=pn("bum"),ch=pn("um"),cv=pn("sp"),fv=pn("rtg"),dv=pn("rtc");function hv(e,t=Qe){Ii("ec",e,t)}function CS(e,t,n,r){let s;const l=n&&n[r];if(X(e)||Ne(e)){s=new Array(e.length);for(let i=0,o=e.length;it(i,o,void 0,l&&l[o]));else{const i=Object.keys(e);s=new Array(i.length);for(let o=0,u=i.length;oql(t)?!(t.type===zn||t.type===yt&&!fh(t.children)):!0)?e:null}const Go=e=>e?kh(e)?ga(e)||e.proxy:Go(e.parent):null,Ss=ze(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>Go(e.parent),$root:e=>Go(e.root),$emit:e=>e.emit,$options:e=>da(e),$forceUpdate:e=>e.f||(e.f=()=>{e.effect.dirty=!0,fa(e.update)}),$nextTick:e=>e.n||(e.n=Xd.bind(e.proxy)),$watch:e=>nv.bind(e)}),io=(e,t)=>e!==ye&&!e.__isScriptSetup&&ie(e,t),pv={get({_:e},t){const{ctx:n,setupState:r,data:s,props:l,accessCache:i,type:o,appContext:u}=e;let a;if(t[0]!=="$"){const w=i[t];if(w!==void 0)switch(w){case 1:return r[t];case 2:return s[t];case 4:return n[t];case 3:return l[t]}else{if(io(r,t))return i[t]=1,r[t];if(s!==ye&&ie(s,t))return i[t]=2,s[t];if((a=e.propsOptions[0])&&ie(a,t))return i[t]=3,l[t];if(n!==ye&&ie(n,t))return i[t]=4,n[t];Yo&&(i[t]=0)}}const c=Ss[t];let d,p;if(c)return t==="$attrs"&&ut(e,"get",t),c(e);if((d=o.__cssModules)&&(d=d[t]))return d;if(n!==ye&&ie(n,t))return i[t]=4,n[t];if(p=u.config.globalProperties,ie(p,t))return p[t]},set({_:e},t,n){const{data:r,setupState:s,ctx:l}=e;return io(s,t)?(s[t]=n,!0):r!==ye&&ie(r,t)?(r[t]=n,!0):ie(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(l[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:s,propsOptions:l}},i){let o;return!!n[i]||e!==ye&&ie(e,i)||io(t,i)||(o=l[0])&&ie(o,i)||ie(r,i)||ie(Ss,i)||ie(s.config.globalProperties,i)},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:ie(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function Rc(e){return X(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let Yo=!0;function mv(e){const t=da(e),n=e.proxy,r=e.ctx;Yo=!1,t.beforeCreate&&Nc(t.beforeCreate,e,"bc");const{data:s,computed:l,methods:i,watch:o,provide:u,inject:a,created:c,beforeMount:d,mounted:p,beforeUpdate:w,updated:x,activated:_,deactivated:L,beforeDestroy:m,beforeUnmount:f,destroyed:h,unmounted:y,render:S,renderTracked:C,renderTriggered:k,errorCaptured:R,serverPrefetch:D,expose:U,inheritAttrs:ee,components:ke,directives:Le,filters:At}=t;if(a&&gv(a,r,null),i)for(const se in i){const P=i[se];q(P)&&(r[se]=P.bind(n))}if(s){const se=s.call(n,n);Se(se)&&(e.data=Ti(se))}if(Yo=!0,l)for(const se in l){const P=l[se],W=q(P)?P.bind(n,n):q(P.get)?P.get.bind(n,n):xt,K=!q(P)&&q(P.set)?P.set.bind(n):xt,te=Mt({get:W,set:K});Object.defineProperty(r,se,{enumerable:!0,configurable:!0,get:()=>te.value,set:Z=>te.value=Z})}if(o)for(const se in o)dh(o[se],r,n,se);if(u){const se=q(u)?u.call(n):u;Reflect.ownKeys(se).forEach(P=>{Nl(P,se[P])})}c&&Nc(c,e,"c");function ge(se,P){X(P)?P.forEach(W=>se(W.bind(n))):P&&se(P.bind(n))}if(ge(iv,d),ge(ah,p),ge(ov,w),ge(uv,x),ge(rv,_),ge(sv,L),ge(hv,R),ge(dv,C),ge(fv,k),ge(av,f),ge(ch,y),ge(cv,D),X(U))if(U.length){const se=e.exposed||(e.exposed={});U.forEach(P=>{Object.defineProperty(se,P,{get:()=>n[P],set:W=>n[P]=W})})}else e.exposed||(e.exposed={});S&&e.render===xt&&(e.render=S),ee!=null&&(e.inheritAttrs=ee),ke&&(e.components=ke),Le&&(e.directives=Le)}function gv(e,t,n=xt){X(e)&&(e=Zo(e));for(const r in e){const s=e[r];let l;Se(s)?"default"in s?l=un(s.from||r,s.default,!0):l=un(s.from||r):l=un(s),at(l)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>l.value,set:i=>l.value=i}):t[r]=l}}function Nc(e,t,n){Ft(X(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function dh(e,t,n,r){const s=r.includes(".")?ih(n,r):()=>n[r];if(Ne(e)){const l=t[e];q(l)&&Rl(s,l)}else if(q(e))Rl(s,e.bind(n));else if(Se(e))if(X(e))e.forEach(l=>dh(l,t,n,r));else{const l=q(e.handler)?e.handler.bind(n):t[e.handler];q(l)&&Rl(s,l,e)}}function da(e){const t=e.type,{mixins:n,extends:r}=t,{mixins:s,optionsCache:l,config:{optionMergeStrategies:i}}=e.appContext,o=l.get(t);let u;return o?u=o:!s.length&&!n&&!r?u=t:(u={},s.length&&s.forEach(a=>Jl(u,a,i,!0)),Jl(u,t,i)),Se(t)&&l.set(t,u),u}function Jl(e,t,n,r=!1){const{mixins:s,extends:l}=t;l&&Jl(e,l,n,!0),s&&s.forEach(i=>Jl(e,i,n,!0));for(const i in t)if(!(r&&i==="expose")){const o=vv[i]||n&&n[i];e[i]=o?o(e[i],t[i]):t[i]}return e}const vv={data:Mc,props:Ic,emits:Ic,methods:ps,computed:ps,beforeCreate:Ge,created:Ge,beforeMount:Ge,mounted:Ge,beforeUpdate:Ge,updated:Ge,beforeDestroy:Ge,beforeUnmount:Ge,destroyed:Ge,unmounted:Ge,activated:Ge,deactivated:Ge,errorCaptured:Ge,serverPrefetch:Ge,components:ps,directives:ps,watch:wv,provide:Mc,inject:yv};function Mc(e,t){return t?e?function(){return ze(q(e)?e.call(this,this):e,q(t)?t.call(this,this):t)}:t:e}function yv(e,t){return ps(Zo(e),Zo(t))}function Zo(e){if(X(e)){const t={};for(let n=0;n1)return n&&q(t)?t.call(r&&r.proxy):t}}function Ev(e,t,n,r=!1){const s={},l={};Gl(l,bi,1),e.propsDefaults=Object.create(null),ph(e,t,s,l);for(const i in e.propsOptions[0])i in s||(s[i]=void 0);n?e.props=r?s:Vd(s):e.type.props?e.props=s:e.props=l,e.attrs=l}function _v(e,t,n,r){const{props:s,attrs:l,vnode:{patchFlag:i}}=e,o=ue(s),[u]=e.propsOptions;let a=!1;if((r||i>0)&&!(i&16)){if(i&8){const c=e.vnode.dynamicProps;for(let d=0;d{u=!0;const[p,w]=mh(d,t,!0);ze(i,p),w&&o.push(...w)};!n&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}if(!l&&!u)return Se(e)&&r.set(e,Lr),Lr;if(X(l))for(let c=0;c-1,w[1]=_<0||x<_,(x>-1||ie(w,"default"))&&o.push(d)}}}const a=[i,o];return Se(e)&&r.set(e,a),a}function Fc(e){return e[0]!=="$"}function Dc(e){const t=e&&e.toString().match(/^\s*(function|class) (\w+)/);return t?t[2]:e===null?"null":""}function bc(e,t){return Dc(e)===Dc(t)}function jc(e,t){return X(t)?t.findIndex(n=>bc(n,e)):q(t)&&bc(t,e)?0:-1}const gh=e=>e[0]==="_"||e==="$stable",ha=e=>X(e)?e.map(Qt):[Qt(e)],Cv=(e,t,n)=>{if(t._n)return t;const r=Wg((...s)=>ha(t(...s)),n);return r._c=!1,r},vh=(e,t,n)=>{const r=e._ctx;for(const s in e){if(gh(s))continue;const l=e[s];if(q(l))t[s]=Cv(s,l,r);else if(l!=null){const i=ha(l);t[s]=()=>i}}},yh=(e,t)=>{const n=ha(t);e.slots.default=()=>n},kv=(e,t)=>{if(e.vnode.shapeFlag&32){const n=t._;n?(e.slots=ue(t),Gl(t,"_",n)):vh(t,e.slots={})}else e.slots={},t&&yh(e,t);Gl(e.slots,bi,1)},Av=(e,t,n)=>{const{vnode:r,slots:s}=e;let l=!0,i=ye;if(r.shapeFlag&32){const o=t._;o?n&&o===1?l=!1:(ze(s,t),!n&&o===1&&delete s._):(l=!t.$stable,vh(t,s)),i=t}else t&&(yh(e,t),i={default:1});if(l)for(const o in s)!gh(o)&&i[o]==null&&delete s[o]};function Xo(e,t,n,r,s=!1){if(X(e)){e.forEach((p,w)=>Xo(p,t&&(X(t)?t[w]:t),n,r,s));return}if(ws(r)&&!s)return;const l=r.shapeFlag&4?ga(r.component)||r.component.proxy:r.el,i=s?null:l,{i:o,r:u}=e,a=t&&t.r,c=o.refs===ye?o.refs={}:o.refs,d=o.setupState;if(a!=null&&a!==u&&(Ne(a)?(c[a]=null,ie(d,a)&&(d[a]=null)):at(a)&&(a.value=null)),q(u))Ln(u,o,12,[i,c]);else{const p=Ne(u),w=at(u);if(p||w){const x=()=>{if(e.f){const _=p?ie(d,u)?d[u]:c[u]:u.value;s?X(_)&&qu(_,l):X(_)?_.includes(l)||_.push(l):p?(c[u]=[l],ie(d,u)&&(d[u]=c[u])):(u.value=[l],e.k&&(c[e.k]=u.value))}else p?(c[u]=i,ie(d,u)&&(d[u]=i)):w&&(u.value=i,e.k&&(c[e.k]=i))};i?(x.id=-1,tt(x,n)):x()}}}const tt=qg;function Ov(e){return Pv(e)}function Pv(e,t){const n=Pd();n.__VUE__=!0;const{insert:r,remove:s,patchProp:l,createElement:i,createText:o,createComment:u,setText:a,setElementText:c,parentNode:d,nextSibling:p,setScopeId:w=xt,insertStaticContent:x}=e,_=(g,v,E,O=null,T=null,N=null,B=void 0,F=null,j=!!v.dynamicChildren)=>{if(g===v)return;g&&!ss(g,v)&&(O=A(g),Z(g,T,N,!0),g=null),v.patchFlag===-2&&(j=!1,v.dynamicChildren=null);const{type:M,ref:H,shapeFlag:Y}=v;switch(M){case Fi:L(g,v,E,O);break;case zn:m(g,v,E,O);break;case Ml:g==null&&f(v,E,O,B);break;case yt:ke(g,v,E,O,T,N,B,F,j);break;default:Y&1?S(g,v,E,O,T,N,B,F,j):Y&6?Le(g,v,E,O,T,N,B,F,j):(Y&64||Y&128)&&M.process(g,v,E,O,T,N,B,F,j,b)}H!=null&&T&&Xo(H,g&&g.ref,N,v||g,!v)},L=(g,v,E,O)=>{if(g==null)r(v.el=o(v.children),E,O);else{const T=v.el=g.el;v.children!==g.children&&a(T,v.children)}},m=(g,v,E,O)=>{g==null?r(v.el=u(v.children||""),E,O):v.el=g.el},f=(g,v,E,O)=>{[g.el,g.anchor]=x(g.children,v,E,O,g.el,g.anchor)},h=({el:g,anchor:v},E,O)=>{let T;for(;g&&g!==v;)T=p(g),r(g,E,O),g=T;r(v,E,O)},y=({el:g,anchor:v})=>{let E;for(;g&&g!==v;)E=p(g),s(g),g=E;s(v)},S=(g,v,E,O,T,N,B,F,j)=>{v.type==="svg"?B="svg":v.type==="math"&&(B="mathml"),g==null?C(v,E,O,T,N,B,F,j):D(g,v,T,N,B,F,j)},C=(g,v,E,O,T,N,B,F)=>{let j,M;const{props:H,shapeFlag:Y,transition:G,dirs:J}=g;if(j=g.el=i(g.type,N,H&&H.is,H),Y&8?c(j,g.children):Y&16&&R(g.children,j,null,O,T,oo(g,N),B,F),J&&Wn(g,null,O,"created"),k(j,g,g.scopeId,B,O),H){for(const de in H)de!=="value"&&!Tl(de)&&l(j,de,null,H[de],N,g.children,O,T,ae);"value"in H&&l(j,"value",null,H.value,N),(M=H.onVnodeBeforeMount)&&Vt(M,O,g)}J&&Wn(g,null,O,"beforeMount");const ne=Lv(T,G);ne&&G.beforeEnter(j),r(j,v,E),((M=H&&H.onVnodeMounted)||ne||J)&&tt(()=>{M&&Vt(M,O,g),ne&&G.enter(j),J&&Wn(g,null,O,"mounted")},T)},k=(g,v,E,O,T)=>{if(E&&w(g,E),O)for(let N=0;N{for(let M=j;M{const F=v.el=g.el;let{patchFlag:j,dynamicChildren:M,dirs:H}=v;j|=g.patchFlag&16;const Y=g.props||ye,G=v.props||ye;let J;if(E&&Qn(E,!1),(J=G.onVnodeBeforeUpdate)&&Vt(J,E,v,g),H&&Wn(v,g,E,"beforeUpdate"),E&&Qn(E,!0),M?U(g.dynamicChildren,M,F,E,O,oo(v,T),N):B||P(g,v,F,null,E,O,oo(v,T),N,!1),j>0){if(j&16)ee(F,v,Y,G,E,O,T);else if(j&2&&Y.class!==G.class&&l(F,"class",null,G.class,T),j&4&&l(F,"style",Y.style,G.style,T),j&8){const ne=v.dynamicProps;for(let de=0;de{J&&Vt(J,E,v,g),H&&Wn(v,g,E,"updated")},O)},U=(g,v,E,O,T,N,B)=>{for(let F=0;F{if(E!==O){if(E!==ye)for(const F in E)!Tl(F)&&!(F in O)&&l(g,F,E[F],null,B,v.children,T,N,ae);for(const F in O){if(Tl(F))continue;const j=O[F],M=E[F];j!==M&&F!=="value"&&l(g,F,M,j,B,v.children,T,N,ae)}"value"in O&&l(g,"value",E.value,O.value,B)}},ke=(g,v,E,O,T,N,B,F,j)=>{const M=v.el=g?g.el:o(""),H=v.anchor=g?g.anchor:o("");let{patchFlag:Y,dynamicChildren:G,slotScopeIds:J}=v;J&&(F=F?F.concat(J):J),g==null?(r(M,E,O),r(H,E,O),R(v.children,E,H,T,N,B,F,j)):Y>0&&Y&64&&G&&g.dynamicChildren?(U(g.dynamicChildren,G,E,T,N,B,F),(v.key!=null||T&&v===T.subTree)&&wh(g,v,!0)):P(g,v,E,H,T,N,B,F,j)},Le=(g,v,E,O,T,N,B,F,j)=>{v.slotScopeIds=F,g==null?v.shapeFlag&512?T.ctx.activate(v,E,O,B,j):At(v,E,O,T,N,B,j):Bt(g,v,j)},At=(g,v,E,O,T,N,B)=>{const F=g.component=zv(g,O,T);if(oh(g)&&(F.ctx.renderer=b),Bv(F),F.asyncDep){if(T&&T.registerDep(F,ge),!g.el){const j=F.subTree=be(zn);m(null,j,v,E)}}else ge(F,g,v,E,T,N,B)},Bt=(g,v,E)=>{const O=v.component=g.component;if(Gg(g,v,E))if(O.asyncDep&&!O.asyncResolved){se(O,v,E);return}else O.next=v,Ug(O.update),O.effect.dirty=!0,O.update();else v.el=g.el,O.vnode=v},ge=(g,v,E,O,T,N,B)=>{const F=()=>{if(g.isMounted){let{next:H,bu:Y,u:G,parent:J,vnode:ne}=g;{const hr=Sh(g);if(hr){H&&(H.el=ne.el,se(g,H,B)),hr.asyncDep.then(()=>{g.isUnmounted||F()});return}}let de=H,ve;Qn(g,!1),H?(H.el=ne.el,se(g,H,B)):H=ne,Y&&ro(Y),(ve=H.props&&H.props.onVnodeBeforeUpdate)&&Vt(ve,J,H,ne),Qn(g,!0);const Me=lo(g),Ot=g.subTree;g.subTree=Me,_(Ot,Me,d(Ot.el),A(Ot),g,T,N),H.el=Me.el,de===null&&Yg(g,Me.el),G&&tt(G,T),(ve=H.props&&H.props.onVnodeUpdated)&&tt(()=>Vt(ve,J,H,ne),T)}else{let H;const{el:Y,props:G}=v,{bm:J,m:ne,parent:de}=g,ve=ws(v);if(Qn(g,!1),J&&ro(J),!ve&&(H=G&&G.onVnodeBeforeMount)&&Vt(H,de,v),Qn(g,!0),Y&&le){const Me=()=>{g.subTree=lo(g),le(Y,g.subTree,g,T,null)};ve?v.type.__asyncLoader().then(()=>!g.isUnmounted&&Me()):Me()}else{const Me=g.subTree=lo(g);_(null,Me,E,O,g,T,N),v.el=Me.el}if(ne&&tt(ne,T),!ve&&(H=G&&G.onVnodeMounted)){const Me=v;tt(()=>Vt(H,de,Me),T)}(v.shapeFlag&256||de&&ws(de.vnode)&&de.vnode.shapeFlag&256)&&g.a&&tt(g.a,T),g.isMounted=!0,v=E=O=null}},j=g.effect=new ra(F,xt,()=>fa(M),g.scope),M=g.update=()=>{j.dirty&&j.run()};M.id=g.uid,Qn(g,!0),M()},se=(g,v,E)=>{v.component=g;const O=g.vnode.props;g.vnode=v,g.next=null,_v(g,v.props,O,E),Av(g,v.children,E),ar(),Oc(g),cr()},P=(g,v,E,O,T,N,B,F,j=!1)=>{const M=g&&g.children,H=g?g.shapeFlag:0,Y=v.children,{patchFlag:G,shapeFlag:J}=v;if(G>0){if(G&128){K(M,Y,E,O,T,N,B,F,j);return}else if(G&256){W(M,Y,E,O,T,N,B,F,j);return}}J&8?(H&16&&ae(M,T,N),Y!==M&&c(E,Y)):H&16?J&16?K(M,Y,E,O,T,N,B,F,j):ae(M,T,N,!0):(H&8&&c(E,""),J&16&&R(Y,E,O,T,N,B,F,j))},W=(g,v,E,O,T,N,B,F,j)=>{g=g||Lr,v=v||Lr;const M=g.length,H=v.length,Y=Math.min(M,H);let G;for(G=0;GH?ae(g,T,N,!0,!1,Y):R(v,E,O,T,N,B,F,j,Y)},K=(g,v,E,O,T,N,B,F,j)=>{let M=0;const H=v.length;let Y=g.length-1,G=H-1;for(;M<=Y&&M<=G;){const J=g[M],ne=v[M]=j?wn(v[M]):Qt(v[M]);if(ss(J,ne))_(J,ne,E,null,T,N,B,F,j);else break;M++}for(;M<=Y&&M<=G;){const J=g[Y],ne=v[G]=j?wn(v[G]):Qt(v[G]);if(ss(J,ne))_(J,ne,E,null,T,N,B,F,j);else break;Y--,G--}if(M>Y){if(M<=G){const J=G+1,ne=JG)for(;M<=Y;)Z(g[M],T,N,!0),M++;else{const J=M,ne=M,de=new Map;for(M=ne;M<=G;M++){const ft=v[M]=j?wn(v[M]):Qt(v[M]);ft.key!=null&&de.set(ft.key,M)}let ve,Me=0;const Ot=G-ne+1;let hr=!1,gc=0;const rs=new Array(Ot);for(M=0;M=Ot){Z(ft,T,N,!0);continue}let Ut;if(ft.key!=null)Ut=de.get(ft.key);else for(ve=ne;ve<=G;ve++)if(rs[ve-ne]===0&&ss(ft,v[ve])){Ut=ve;break}Ut===void 0?Z(ft,T,N,!0):(rs[Ut-ne]=M+1,Ut>=gc?gc=Ut:hr=!0,_(ft,v[Ut],E,null,T,N,B,F,j),Me++)}const vc=hr?Tv(rs):Lr;for(ve=vc.length-1,M=Ot-1;M>=0;M--){const ft=ne+M,Ut=v[ft],yc=ft+1{const{el:N,type:B,transition:F,children:j,shapeFlag:M}=g;if(M&6){te(g.component.subTree,v,E,O);return}if(M&128){g.suspense.move(v,E,O);return}if(M&64){B.move(g,v,E,b);return}if(B===yt){r(N,v,E);for(let Y=0;YF.enter(N),T);else{const{leave:Y,delayLeave:G,afterLeave:J}=F,ne=()=>r(N,v,E),de=()=>{Y(N,()=>{ne(),J&&J()})};G?G(N,ne,de):de()}else r(N,v,E)},Z=(g,v,E,O=!1,T=!1)=>{const{type:N,props:B,ref:F,children:j,dynamicChildren:M,shapeFlag:H,patchFlag:Y,dirs:G}=g;if(F!=null&&Xo(F,null,E,g,!0),H&256){v.ctx.deactivate(g);return}const J=H&1&&G,ne=!ws(g);let de;if(ne&&(de=B&&B.onVnodeBeforeUnmount)&&Vt(de,v,g),H&6)et(g.component,E,O);else{if(H&128){g.suspense.unmount(E,O);return}J&&Wn(g,null,v,"beforeUnmount"),H&64?g.type.remove(g,v,E,T,b,O):M&&(N!==yt||Y>0&&Y&64)?ae(M,v,E,!1,!0):(N===yt&&Y&384||!T&&H&16)&&ae(j,v,E),O&&ct(g)}(ne&&(de=B&&B.onVnodeUnmounted)||J)&&tt(()=>{de&&Vt(de,v,g),J&&Wn(g,null,v,"unmounted")},E)},ct=g=>{const{type:v,el:E,anchor:O,transition:T}=g;if(v===yt){xe(E,O);return}if(v===Ml){y(g);return}const N=()=>{s(E),T&&!T.persisted&&T.afterLeave&&T.afterLeave()};if(g.shapeFlag&1&&T&&!T.persisted){const{leave:B,delayLeave:F}=T,j=()=>B(E,N);F?F(g.el,N,j):j()}else N()},xe=(g,v)=>{let E;for(;g!==v;)E=p(g),s(g),g=E;s(v)},et=(g,v,E)=>{const{bum:O,scope:T,update:N,subTree:B,um:F}=g;O&&ro(O),T.stop(),N&&(N.active=!1,Z(B,g,v,E)),F&&tt(F,v),tt(()=>{g.isUnmounted=!0},v),v&&v.pendingBranch&&!v.isUnmounted&&g.asyncDep&&!g.asyncResolved&&g.suspenseId===v.pendingId&&(v.deps--,v.deps===0&&v.resolve())},ae=(g,v,E,O=!1,T=!1,N=0)=>{for(let B=N;Bg.shapeFlag&6?A(g.component.subTree):g.shapeFlag&128?g.suspense.next():p(g.anchor||g.el),V=(g,v,E)=>{g==null?v._vnode&&Z(v._vnode,null,null,!0):_(v._vnode||null,g,v,null,null,null,E),Oc(),eh(),v._vnode=g},b={p:_,um:Z,m:te,r:ct,mt:At,mc:R,pc:P,pbc:U,n:A,o:e};let Q,le;return t&&([Q,le]=t(b)),{render:V,hydrate:Q,createApp:xv(V,Q)}}function oo({type:e,props:t},n){return n==="svg"&&e==="foreignObject"||n==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function Qn({effect:e,update:t},n){e.allowRecurse=t.allowRecurse=n}function Lv(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function wh(e,t,n=!1){const r=e.children,s=t.children;if(X(r)&&X(s))for(let l=0;l>1,e[n[o]]0&&(t[r]=n[l-1]),n[l]=r)}}for(l=n.length,i=n[l-1];l-- >0;)n[l]=i,i=t[i];return n}function Sh(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Sh(t)}const Rv=e=>e.__isTeleport,yt=Symbol.for("v-fgt"),Fi=Symbol.for("v-txt"),zn=Symbol.for("v-cmt"),Ml=Symbol.for("v-stc"),xs=[];let It=null;function Di(e=!1){xs.push(It=e?null:[])}function Nv(){xs.pop(),It=xs[xs.length-1]||null}let bs=1;function zc(e){bs+=e}function xh(e){return e.dynamicChildren=bs>0?It||Lr:null,Nv(),bs>0&&It&&It.push(e),e}function Eh(e,t,n,r,s,l){return xh(rn(e,t,n,r,s,l,!0))}function _h(e,t,n,r,s){return xh(be(e,t,n,r,s,!0))}function ql(e){return e?e.__v_isVNode===!0:!1}function ss(e,t){return e.type===t.type&&e.key===t.key}const bi="__vInternal",Ch=({key:e})=>e??null,Il=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Ne(e)||at(e)||q(e)?{i:Ze,r:e,k:t,f:!!n}:e:null);function rn(e,t=null,n=null,r=0,s=null,l=e===yt?0:1,i=!1,o=!1){const u={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Ch(t),ref:t&&Il(t),scopeId:rh,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:l,patchFlag:r,dynamicProps:s,dynamicChildren:null,appContext:null,ctx:Ze};return o?(pa(u,n),l&128&&e.normalize(u)):n&&(u.shapeFlag|=Ne(n)?8:16),bs>0&&!i&&It&&(u.patchFlag>0||l&6)&&u.patchFlag!==32&&It.push(u),u}const be=Mv;function Mv(e,t=null,n=null,r=0,s=null,l=!1){if((!e||e===Zg)&&(e=zn),ql(e)){const o=Ur(e,t,!0);return n&&pa(o,n),bs>0&&!l&&It&&(o.shapeFlag&6?It[It.indexOf(e)]=o:It.push(o)),o.patchFlag|=-2,o}if(Wv(e)&&(e=e.__vccOpts),t){t=Iv(t);let{class:o,style:u}=t;o&&!Ne(o)&&(t.class=na(o)),Se(u)&&($d(u)&&!X(u)&&(u=ze({},u)),t.style=ta(u))}const i=Ne(e)?1:Xg(e)?128:Rv(e)?64:Se(e)?4:q(e)?2:0;return rn(e,t,n,r,s,i,l,!0)}function Iv(e){return e?$d(e)||bi in e?ze({},e):e:null}function Ur(e,t,n=!1){const{props:r,ref:s,patchFlag:l,children:i}=e,o=t?Dv(r||{},t):r;return{__v_isVNode:!0,__v_skip:!0,type:e.type,props:o,key:o&&Ch(o),ref:t&&t.ref?n&&s?X(s)?s.concat(Il(t)):[s,Il(t)]:Il(t):s,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:i,target:e.target,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==yt?l===-1?16:l|16:l,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:e.transition,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&Ur(e.ssContent),ssFallback:e.ssFallback&&Ur(e.ssFallback),el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce}}function Fl(e=" ",t=0){return be(Fi,null,e,t)}function Fv(e,t){const n=be(Ml,null,e);return n.staticCount=t,n}function AS(e="",t=!1){return t?(Di(),_h(zn,null,e)):be(zn,null,e)}function Qt(e){return e==null||typeof e=="boolean"?be(zn):X(e)?be(yt,null,e.slice()):typeof e=="object"?wn(e):be(Fi,null,String(e))}function wn(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Ur(e)}function pa(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(X(t))n=16;else if(typeof t=="object")if(r&65){const s=t.default;s&&(s._c&&(s._d=!1),pa(e,s()),s._c&&(s._d=!0));return}else{n=32;const s=t._;!s&&!(bi in t)?t._ctx=Ze:s===3&&Ze&&(Ze.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else q(t)?(t={default:t,_ctx:Ze},n=32):(t=String(t),r&64?(n=16,t=[Fl(t)]):n=8);e.children=t,e.shapeFlag|=n}function Dv(...e){const t={};for(let n=0;n{let s;return(s=e[n])||(s=e[n]=[]),s.push(r),l=>{s.length>1?s.forEach(i=>i(l)):s[0](l)}};ma=t("__VUE_INSTANCE_SETTERS__",n=>Qe=n),qo=t("__VUE_SSR_SETTERS__",n=>ji=n)}const Vr=e=>{ma(e),e.scope.on()},tr=()=>{Qe&&Qe.scope.off(),ma(null)};function kh(e){return e.vnode.shapeFlag&4}let ji=!1;function Bv(e,t=!1){t&&qo(t);const{props:n,children:r}=e.vnode,s=kh(e);Ev(e,n,s,t),kv(e,r);const l=s?Uv(e,t):void 0;return t&&qo(!1),l}function Uv(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=Wd(new Proxy(e.ctx,pv));const{setup:r}=n;if(r){const s=e.setupContext=r.length>1?Hv(e):null;Vr(e),ar();const l=Ln(r,e,0,[e.props,s]);if(cr(),tr(),kd(l)){if(l.then(tr,tr),t)return l.then(i=>{Bc(e,i,t)}).catch(i=>{Ri(i,e,0)});e.asyncDep=l}else Bc(e,l,t)}else Ah(e,t)}function Bc(e,t,n){q(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Se(t)&&(e.setupState=Zd(t)),Ah(e,n)}let Uc;function Ah(e,t,n){const r=e.type;if(!e.render){if(!t&&Uc&&!r.render){const s=r.template||da(e).template;if(s){const{isCustomElement:l,compilerOptions:i}=e.appContext.config,{delimiters:o,compilerOptions:u}=r,a=ze(ze({isCustomElement:l,delimiters:o},i),u);r.render=Uc(s,a)}}e.render=r.render||xt}{Vr(e),ar();try{mv(e)}finally{cr(),tr()}}}function Vv(e){return e.attrsProxy||(e.attrsProxy=new Proxy(e.attrs,{get(t,n){return ut(e,"get","$attrs"),t[n]}}))}function Hv(e){const t=n=>{e.exposed=n||{}};return{get attrs(){return Vv(e)},slots:e.slots,emit:e.emit,expose:t}}function ga(e){if(e.exposed)return e.exposeProxy||(e.exposeProxy=new Proxy(Zd(Wd(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Ss)return Ss[n](e)},has(t,n){return n in t||n in Ss}}))}function $v(e,t=!0){return q(e)?e.displayName||e.name:e.name||t&&e.__name}function Wv(e){return q(e)&&"__vccOpts"in e}const Mt=(e,t)=>Fg(e,t,ji);function Oh(e,t,n){const r=arguments.length;return r===2?Se(t)&&!X(t)?ql(t)?be(e,null,[t]):be(e,t):be(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&ql(n)&&(n=[n]),be(e,t,n))}const Qv="3.4.4",Kv="http://www.w3.org/2000/svg",Gv="http://www.w3.org/1998/Math/MathML",Sn=typeof document<"u"?document:null,Vc=Sn&&Sn.createElement("template"),Yv={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{const s=t==="svg"?Sn.createElementNS(Kv,e):t==="mathml"?Sn.createElementNS(Gv,e):Sn.createElement(e,n?{is:n}:void 0);return e==="select"&&r&&r.multiple!=null&&s.setAttribute("multiple",r.multiple),s},createText:e=>Sn.createTextNode(e),createComment:e=>Sn.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Sn.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,r,s,l){const i=n?n.previousSibling:t.lastChild;if(s&&(s===l||s.nextSibling))for(;t.insertBefore(s.cloneNode(!0),n),!(s===l||!(s=s.nextSibling)););else{Vc.innerHTML=r==="svg"?`${e}`:r==="mathml"?`${e}`:e;const o=Vc.content;if(r==="svg"||r==="mathml"){const u=o.firstChild;for(;u.firstChild;)o.appendChild(u.firstChild);o.removeChild(u)}t.insertBefore(o,n)}return[i?i.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Zv=Symbol("_vtc");function Jv(e,t,n){const r=e[Zv];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const Xv=Symbol("_vod"),qv=Symbol("");function e0(e,t,n){const r=e.style,s=Ne(n);if(n&&!s){if(t&&!Ne(t))for(const l in t)n[l]==null&&eu(r,l,"");for(const l in n)eu(r,l,n[l])}else{const l=r.display;if(s){if(t!==n){const i=r[qv];i&&(n+=";"+i),r.cssText=n}}else t&&e.removeAttribute("style");Xv in e&&(r.display=l)}}const Hc=/\s*!important$/;function eu(e,t,n){if(X(n))n.forEach(r=>eu(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=t0(e,t);Hc.test(n)?e.setProperty(qr(r),n.replace(Hc,""),"important"):e[r]=n}}const $c=["Webkit","Moz","ms"],uo={};function t0(e,t){const n=uo[t];if(n)return n;let r=Jt(t);if(r!=="filter"&&r in e)return uo[t]=r;r=Pi(r);for(let s=0;s<$c.length;s++){const l=$c[s]+r;if(l in e)return uo[t]=l}return t}const Wc="http://www.w3.org/1999/xlink";function n0(e,t,n,r,s){if(r&&t.startsWith("xlink:"))n==null?e.removeAttributeNS(Wc,t.slice(6,t.length)):e.setAttributeNS(Wc,t,n);else{const l=dg(t);n==null||l&&!Ld(n)?e.removeAttribute(t):e.setAttribute(t,l?"":n)}}function r0(e,t,n,r,s,l,i){if(t==="innerHTML"||t==="textContent"){r&&i(r,s,l),e[t]=n??"";return}const o=e.tagName;if(t==="value"&&o!=="PROGRESS"&&!o.includes("-")){e._value=n;const a=o==="OPTION"?e.getAttribute("value"):e.value,c=n??"";a!==c&&(e.value=c),n==null&&e.removeAttribute(t);return}let u=!1;if(n===""||n==null){const a=typeof e[t];a==="boolean"?n=Ld(n):n==null&&a==="string"?(n="",u=!0):a==="number"&&(n=0,u=!0)}try{e[t]=n}catch{}u&&e.removeAttribute(t)}function s0(e,t,n,r){e.addEventListener(t,n,r)}function l0(e,t,n,r){e.removeEventListener(t,n,r)}const Qc=Symbol("_vei");function i0(e,t,n,r,s=null){const l=e[Qc]||(e[Qc]={}),i=l[t];if(r&&i)i.value=r;else{const[o,u]=o0(t);if(r){const a=l[t]=c0(r,s);s0(e,o,a,u)}else i&&(l0(e,o,i,u),l[t]=void 0)}}const Kc=/(?:Once|Passive|Capture)$/;function o0(e){let t;if(Kc.test(e)){t={};let r;for(;r=e.match(Kc);)e=e.slice(0,e.length-r[0].length),t[r[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):qr(e.slice(2)),t]}let ao=0;const u0=Promise.resolve(),a0=()=>ao||(u0.then(()=>ao=0),ao=Date.now());function c0(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;Ft(f0(r,n.value),t,5,[r])};return n.value=e,n.attached=a0(),n}function f0(e,t){if(X(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(r=>s=>!s._stopped&&r&&r(s))}else return t}const Gc=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,d0=(e,t,n,r,s,l,i,o,u)=>{const a=s==="svg";t==="class"?Jv(e,r,a):t==="style"?e0(e,n,r):ki(t)?Xu(t)||i0(e,t,n,r,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):h0(e,t,r,a))?r0(e,t,r,l,i,o,u):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),n0(e,t,r,a))};function h0(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&Gc(t)&&q(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const s=e.tagName;if(s==="IMG"||s==="VIDEO"||s==="CANVAS"||s==="SOURCE")return!1}return Gc(t)&&Ne(n)?!1:t in e}const p0=ze({patchProp:d0},Yv);let Yc;function m0(){return Yc||(Yc=Ov(p0))}const g0=(...e)=>{const t=m0().createApp(...e),{mount:n}=t;return t.mount=r=>{const s=y0(r);if(!s)return;const l=t._component;!q(l)&&!l.render&&!l.template&&(l.template=s.innerHTML),s.innerHTML="";const i=n(s,!1,v0(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),i},t};function v0(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function y0(e){return Ne(e)?document.querySelector(e):e}const w0="modulepreload",S0=function(e){return"/"+e},Zc={},Xt=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){const l=document.getElementsByTagName("link");s=Promise.all(n.map(i=>{if(i=S0(i),i in Zc)return;Zc[i]=!0;const o=i.endsWith(".css"),u=o?'[rel="stylesheet"]':"";if(!!r)for(let d=l.length-1;d>=0;d--){const p=l[d];if(p.href===i&&(!o||p.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${i}"]${u}`))return;const c=document.createElement("link");if(c.rel=o?"stylesheet":w0,o||(c.as="script",c.crossOrigin=""),c.href=i,document.head.appendChild(c),o)return new Promise((d,p)=>{c.addEventListener("load",d),c.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${i}`)))})}))}return s.then(()=>t()).catch(l=>{const i=new Event("vite:preloadError",{cancelable:!0});if(i.payload=l,window.dispatchEvent(i),!i.defaultPrevented)throw l})};/*! +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const l of s)if(l.type==="childList")for(const i of l.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const l={};return s.integrity&&(l.integrity=s.integrity),s.referrerPolicy&&(l.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?l.credentials="include":s.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(s){if(s.ep)return;s.ep=!0;const l=n(s);fetch(s.href,l)}})();function Ja(e,t){const n=new Set(e.split(","));return t?r=>n.has(r.toLowerCase()):r=>n.has(r)}const ye={},Lr=[],xt=()=>{},tg=()=>!1,ki=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Xa=e=>e.startsWith("onUpdate:"),ze=Object.assign,qa=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},ng=Object.prototype.hasOwnProperty,ie=(e,t)=>ng.call(e,t),X=Array.isArray,Tr=e=>Ai(e)==="[object Map]",Cd=e=>Ai(e)==="[object Set]",q=e=>typeof e=="function",Ne=e=>typeof e=="string",Xr=e=>typeof e=="symbol",Se=e=>e!==null&&typeof e=="object",kd=e=>(Se(e)||q(e))&&q(e.then)&&q(e.catch),Ad=Object.prototype.toString,Ai=e=>Ad.call(e),rg=e=>Ai(e).slice(8,-1),Od=e=>Ai(e)==="[object Object]",eu=e=>Ne(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Tl=Ja(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Oi=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},sg=/-(\w)/g,Jt=Oi(e=>e.replace(sg,(t,n)=>n?n.toUpperCase():"")),lg=/\B([A-Z])/g,qr=Oi(e=>e.replace(lg,"-$1").toLowerCase()),Pi=Oi(e=>e.charAt(0).toUpperCase()+e.slice(1)),no=Oi(e=>e?`on${Pi(e)}`:""),jn=(e,t)=>!Object.is(e,t),ro=(e,t)=>{for(let n=0;n{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value:n})},ig=e=>{const t=parseFloat(e);return isNaN(t)?e:t};let wc;const Pd=()=>wc||(wc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function tu(e){if(X(e)){const t={};for(let n=0;n{if(n){const r=n.split(ag);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function nu(e){let t="";if(Ne(e))t=e;else if(X(e))for(let n=0;nNe(e)?e:e==null?"":X(e)||Se(e)&&(e.toString===Ad||!q(e.toString))?JSON.stringify(e,Td,2):String(e),Td=(e,t)=>t&&t.__v_isRef?Td(e,t.value):Tr(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,s],l)=>(n[so(r,l)+" =>"]=s,n),{})}:Cd(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>so(n))}:Xr(t)?so(t):Se(t)&&!X(t)&&!Od(t)?String(t):t,so=(e,t="")=>{var n;return Xr(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};let $t;class pg{constructor(t=!1){this.detached=t,this._active=!0,this.effects=[],this.cleanups=[],this.parent=$t,!t&&$t&&(this.index=($t.scopes||($t.scopes=[])).push(this)-1)}get active(){return this._active}run(t){if(this._active){const n=$t;try{return $t=this,t()}finally{$t=n}}}on(){$t=this}off(){$t=this.parent}stop(t){if(this._active){let n,r;for(n=0,r=this.effects.length;n=2))break;cr(),this._queryings--}return this._dirtyLevel>=2}set dirty(t){this._dirtyLevel=t?3:0}run(){if(this._dirtyLevel=0,!this.active)return this.fn();let t=Pn,n=qn;try{return Pn=!0,qn=this,this._runnings++,Sc(this),this.fn()}finally{xc(this),this._runnings--,qn=n,Pn=t}}stop(){var t;this.active&&(Sc(this),xc(this),(t=this.onStop)==null||t.call(this),this.active=!1)}}function gg(e){return e.value}function Sc(e){e._trackId++,e._depsLength=0}function xc(e){if(e.deps&&e.deps.length>e._depsLength){for(let t=e._depsLength;t{const n=new Map;return n.cleanup=e,n.computed=t,n},$o=new WeakMap,er=Symbol(""),Wo=Symbol("");function at(e,t,n){if(Pn&&qn){let r=$o.get(e);r||$o.set(e,r=new Map);let s=r.get(n);s||r.set(n,s=Id(()=>r.delete(n))),Md(qn,s)}}function on(e,t,n,r,s,l){const i=$o.get(e);if(!i)return;let o=[];if(t==="clear")o=[...i.values()];else if(n==="length"&&X(e)){const a=Number(r);i.forEach((u,c)=>{(c==="length"||!Xr(c)&&c>=a)&&o.push(u)})}else switch(n!==void 0&&o.push(i.get(n)),t){case"add":X(e)?eu(n)&&o.push(i.get("length")):(o.push(i.get(er)),Tr(e)&&o.push(i.get(Wo)));break;case"delete":X(e)||(o.push(i.get(er)),Tr(e)&&o.push(i.get(Wo)));break;case"set":Tr(e)&&o.push(i.get(er));break}su();for(const a of o)a&&Fd(a,3);lu()}const vg=Ja("__proto__,__v_isRef,__isVue"),Dd=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(Xr)),Ec=yg();function yg(){const e={};return["includes","indexOf","lastIndexOf"].forEach(t=>{e[t]=function(...n){const r=ae(this);for(let l=0,i=this.length;l{e[t]=function(...n){ur(),su();const r=ae(this)[t].apply(this,n);return lu(),cr(),r}}),e}function wg(e){const t=ae(this);return at(t,"has",e),t.hasOwnProperty(e)}class bd{constructor(t=!1,n=!1){this._isReadonly=t,this._shallow=n}get(t,n,r){const s=this._isReadonly,l=this._shallow;if(n==="__v_isReactive")return!s;if(n==="__v_isReadonly")return s;if(n==="__v_isShallow")return l;if(n==="__v_raw")return r===(s?l?Ng:Ud:l?Bd:zd).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(r)?t:void 0;const i=X(t);if(!s){if(i&&ie(Ec,n))return Reflect.get(Ec,n,r);if(n==="hasOwnProperty")return wg}const o=Reflect.get(t,n,r);return(Xr(n)?Dd.has(n):vg(n))||(s||at(t,"get",n),l)?o:ut(o)?i&&eu(n)?o:o.value:Se(o)?s?Hd(o):Ti(o):o}}class jd extends bd{constructor(t=!1){super(!1,t)}set(t,n,r,s){let l=t[n];if(!this._shallow){const a=Br(l);if(!Yl(r)&&!Br(r)&&(l=ae(l),r=ae(r)),!X(t)&&ut(l)&&!ut(r))return a?!1:(l.value=r,!0)}const i=X(t)&&eu(n)?Number(n)e,Li=e=>Reflect.getPrototypeOf(e);function ol(e,t,n=!1,r=!1){e=e.__v_raw;const s=ae(e),l=ae(t);n||(jn(t,l)&&at(s,"get",t),at(s,"get",l));const{has:i}=Li(s),o=r?iu:n?uu:Fs;if(i.call(s,t))return o(e.get(t));if(i.call(s,l))return o(e.get(l));e!==s&&e.get(t)}function al(e,t=!1){const n=this.__v_raw,r=ae(n),s=ae(e);return t||(jn(e,s)&&at(r,"has",e),at(r,"has",s)),e===s?n.has(e):n.has(e)||n.has(s)}function ul(e,t=!1){return e=e.__v_raw,!t&&at(ae(e),"iterate",er),Reflect.get(e,"size",e)}function _c(e){e=ae(e);const t=ae(this);return Li(t).has.call(t,e)||(t.add(e),on(t,"add",e,e)),this}function Cc(e,t){t=ae(t);const n=ae(this),{has:r,get:s}=Li(n);let l=r.call(n,e);l||(e=ae(e),l=r.call(n,e));const i=s.call(n,e);return n.set(e,t),l?jn(t,i)&&on(n,"set",e,t):on(n,"add",e,t),this}function kc(e){const t=ae(this),{has:n,get:r}=Li(t);let s=n.call(t,e);s||(e=ae(e),s=n.call(t,e)),r&&r.call(t,e);const l=t.delete(e);return s&&on(t,"delete",e,void 0),l}function Ac(){const e=ae(this),t=e.size!==0,n=e.clear();return t&&on(e,"clear",void 0,void 0),n}function cl(e,t){return function(r,s){const l=this,i=l.__v_raw,o=ae(i),a=t?iu:e?uu:Fs;return!e&&at(o,"iterate",er),i.forEach((u,c)=>r.call(s,a(u),a(c),l))}}function fl(e,t,n){return function(...r){const s=this.__v_raw,l=ae(s),i=Tr(l),o=e==="entries"||e===Symbol.iterator&&i,a=e==="keys"&&i,u=s[e](...r),c=n?iu:t?uu:Fs;return!t&&at(l,"iterate",a?Wo:er),{next(){const{value:d,done:p}=u.next();return p?{value:d,done:p}:{value:o?[c(d[0]),c(d[1])]:c(d),done:p}},[Symbol.iterator](){return this}}}}function gn(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function Cg(){const e={get(l){return ol(this,l)},get size(){return ul(this)},has:al,add:_c,set:Cc,delete:kc,clear:Ac,forEach:cl(!1,!1)},t={get(l){return ol(this,l,!1,!0)},get size(){return ul(this)},has:al,add:_c,set:Cc,delete:kc,clear:Ac,forEach:cl(!1,!0)},n={get(l){return ol(this,l,!0)},get size(){return ul(this,!0)},has(l){return al.call(this,l,!0)},add:gn("add"),set:gn("set"),delete:gn("delete"),clear:gn("clear"),forEach:cl(!0,!1)},r={get(l){return ol(this,l,!0,!0)},get size(){return ul(this,!0)},has(l){return al.call(this,l,!0)},add:gn("add"),set:gn("set"),delete:gn("delete"),clear:gn("clear"),forEach:cl(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(l=>{e[l]=fl(l,!1,!1),n[l]=fl(l,!0,!1),t[l]=fl(l,!1,!0),r[l]=fl(l,!0,!0)}),[e,n,t,r]}const[kg,Ag,Og,Pg]=Cg();function ou(e,t){const n=t?e?Pg:Og:e?Ag:kg;return(r,s,l)=>s==="__v_isReactive"?!e:s==="__v_isReadonly"?e:s==="__v_raw"?r:Reflect.get(ie(n,s)&&s in r?n:r,s,l)}const Lg={get:ou(!1,!1)},Tg={get:ou(!1,!0)},Rg={get:ou(!0,!1)},zd=new WeakMap,Bd=new WeakMap,Ud=new WeakMap,Ng=new WeakMap;function Mg(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Fg(e){return e.__v_skip||!Object.isExtensible(e)?0:Mg(rg(e))}function Ti(e){return Br(e)?e:au(e,!1,xg,Lg,zd)}function Vd(e){return au(e,!1,_g,Tg,Bd)}function Hd(e){return au(e,!0,Eg,Rg,Ud)}function au(e,t,n,r,s){if(!Se(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const l=s.get(e);if(l)return l;const i=Fg(e);if(i===0)return e;const o=new Proxy(e,i===2?r:n);return s.set(e,o),o}function Rr(e){return Br(e)?Rr(e.__v_raw):!!(e&&e.__v_isReactive)}function Br(e){return!!(e&&e.__v_isReadonly)}function Yl(e){return!!(e&&e.__v_isShallow)}function $d(e){return Rr(e)||Br(e)}function ae(e){const t=e&&e.__v_raw;return t?ae(t):e}function Wd(e){return Gl(e,"__v_skip",!0),e}const Fs=e=>Se(e)?Ti(e):e,uu=e=>Se(e)?Hd(e):e;class Qd{constructor(t,n,r,s){this._setter=n,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this.effect=new ru(()=>t(this._value),()=>Qo(this,1)),this.effect.computed=this,this.effect.active=this._cacheable=!s,this.__v_isReadonly=r}get value(){const t=ae(this);return Kd(t),(!t._cacheable||t.effect.dirty)&&jn(t._value,t._value=t.effect.run())&&Qo(t,2),t._value}set value(t){this._setter(t)}get _dirty(){return this.effect.dirty}set _dirty(t){this.effect.dirty=t}}function Ig(e,t,n=!1){let r,s;const l=q(e);return l?(r=e,s=xt):(r=e.get,s=e.set),new Qd(r,s,l||!s,n)}function Kd(e){Pn&&qn&&(e=ae(e),Md(qn,e.dep||(e.dep=Id(()=>e.dep=void 0,e instanceof Qd?e:void 0))))}function Qo(e,t=3,n){e=ae(e);const r=e.dep;r&&Fd(r,t)}function ut(e){return!!(e&&e.__v_isRef===!0)}function Gd(e){return Yd(e,!1)}function Dg(e){return Yd(e,!0)}function Yd(e,t){return ut(e)?e:new bg(e,t)}class bg{constructor(t,n){this.__v_isShallow=n,this.dep=void 0,this.__v_isRef=!0,this._rawValue=n?t:ae(t),this._value=n?t:Fs(t)}get value(){return Kd(this),this._value}set value(t){const n=this.__v_isShallow||Yl(t)||Br(t);t=n?t:ae(t),jn(t,this._rawValue)&&(this._rawValue=t,this._value=n?t:Fs(t),Qo(this,3))}}function Nr(e){return ut(e)?e.value:e}const jg={get:(e,t,n)=>Nr(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const s=e[t];return ut(s)&&!ut(n)?(s.value=n,!0):Reflect.set(e,t,n,r)}};function Zd(e){return Rr(e)?e:new Proxy(e,jg)}function Ln(e,t,n,r){let s;try{s=r?e(...r):e()}catch(l){Ri(l,t,n)}return s}function It(e,t,n,r){if(q(e)){const l=Ln(e,t,n,r);return l&&kd(l)&&l.catch(i=>{Ri(i,t,n)}),l}const s=[];for(let l=0;l>>1,s=We[r],l=Ds(s);lKt&&We.splice(t,1)}function Vg(e){X(e)?Mr.push(...e):(!en||!en.includes(e,e.allowRecurse?Yn+1:Yn))&&Mr.push(e),qd()}function Oc(e,t,n=Is?Kt+1:0){for(;nDs(n)-Ds(r)),Yn=0;Yne.id==null?1/0:e.id,Hg=(e,t)=>{const n=Ds(e)-Ds(t);if(n===0){if(e.pre&&!t.pre)return-1;if(t.pre&&!e.pre)return 1}return n};function th(e){Ko=!1,Is=!0,We.sort(Hg);try{for(Kt=0;KtNe(w)?w.trim():w)),d&&(s=n.map(ig))}let o,a=r[o=no(t)]||r[o=no(Jt(t))];!a&&l&&(a=r[o=no(qr(t))]),a&&It(a,e,6,s);const u=r[o+"Once"];if(u){if(!e.emitted)e.emitted={};else if(e.emitted[o])return;e.emitted[o]=!0,It(u,e,6,s)}}function nh(e,t,n=!1){const r=t.emitsCache,s=r.get(e);if(s!==void 0)return s;const l=e.emits;let i={},o=!1;if(!q(e)){const a=u=>{const c=nh(u,t,!0);c&&(o=!0,ze(i,c))};!n&&t.mixins.length&&t.mixins.forEach(a),e.extends&&a(e.extends),e.mixins&&e.mixins.forEach(a)}return!l&&!o?(Se(e)&&r.set(e,null),null):(X(l)?l.forEach(a=>i[a]=null):ze(i,l),Se(e)&&r.set(e,i),i)}function Ni(e,t){return!e||!ki(t)?!1:(t=t.slice(2).replace(/Once$/,""),ie(e,t[0].toLowerCase()+t.slice(1))||ie(e,qr(t))||ie(e,t))}let Ze=null,rh=null;function Zl(e){const t=Ze;return Ze=e,rh=e&&e.type.__scopeId||null,t}function Wg(e,t=Ze,n){if(!t||e._n)return e;const r=(...s)=>{r._d&&zc(-1);const l=Zl(t);let i;try{i=e(...s)}finally{Zl(l),r._d&&zc(1)}return i};return r._n=!0,r._c=!0,r._d=!0,r}function lo(e){const{type:t,vnode:n,proxy:r,withProxy:s,props:l,propsOptions:[i],slots:o,attrs:a,emit:u,render:c,renderCache:d,data:p,setupState:w,ctx:x,inheritAttrs:_}=e;let L,m;const f=Zl(e);try{if(n.shapeFlag&4){const y=s||r,S=y;L=Qt(c.call(S,y,d,l,w,p,x)),m=a}else{const y=t;L=Qt(y.length>1?y(l,{attrs:a,slots:o,emit:u}):y(l,null)),m=t.props?a:Qg(a)}}catch(y){xs.length=0,Ri(y,e,1),L=be(zn)}let h=L;if(m&&_!==!1){const y=Object.keys(m),{shapeFlag:S}=h;y.length&&S&7&&(i&&y.some(Xa)&&(m=Kg(m,i)),h=Ur(h,m))}return n.dirs&&(h=Ur(h),h.dirs=h.dirs?h.dirs.concat(n.dirs):n.dirs),n.transition&&(h.transition=n.transition),L=h,Zl(f),L}const Qg=e=>{let t;for(const n in e)(n==="class"||n==="style"||ki(n))&&((t||(t={}))[n]=e[n]);return t},Kg=(e,t)=>{const n={};for(const r in e)(!Xa(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function Gg(e,t,n){const{props:r,children:s,component:l}=e,{props:i,children:o,patchFlag:a}=t,u=l.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&a>=0){if(a&1024)return!0;if(a&16)return r?Pc(r,i,u):!!i;if(a&8){const c=t.dynamicProps;for(let d=0;de.__isSuspense;function qg(e,t){t&&t.pendingBranch?X(e)?t.effects.push(...e):t.effects.push(e):Vg(e)}const ev=Symbol.for("v-scx"),tv=()=>an(ev),dl={};function Rl(e,t,n){return lh(e,t,n)}function lh(e,t,{immediate:n,deep:r,flush:s,once:l,onTrack:i,onTrigger:o}=ye){if(t&&l){const S=t;t=(...C)=>{S(...C),y()}}const a=Qe,u=S=>r===!0?S:gr(S,r===!1?1:void 0);let c,d=!1,p=!1;if(ut(e)?(c=()=>e.value,d=Yl(e)):Rr(e)?(c=()=>u(e),d=!0):X(e)?(p=!0,d=e.some(S=>Rr(S)||Yl(S)),c=()=>e.map(S=>{if(ut(S))return S.value;if(Rr(S))return u(S);if(q(S))return Ln(S,a,2)})):q(e)?t?c=()=>Ln(e,a,2):c=()=>(w&&w(),It(e,a,3,[x])):c=xt,t&&r){const S=c;c=()=>gr(S())}let w,x=S=>{w=h.onStop=()=>{Ln(S,a,4),w=h.onStop=void 0}},_;if(ji)if(x=xt,t?n&&It(t,a,3,[c(),p?[]:void 0,x]):c(),s==="sync"){const S=tv();_=S.__watcherHandles||(S.__watcherHandles=[])}else return xt;let L=p?new Array(e.length).fill(dl):dl;const m=()=>{if(!(!h.active||!h.dirty))if(t){const S=h.run();(r||d||(p?S.some((C,k)=>jn(C,L[k])):jn(S,L)))&&(w&&w(),It(t,a,3,[S,L===dl?void 0:p&&L[0]===dl?[]:L,x]),L=S)}else h.run()};m.allowRecurse=!!t;let f;s==="sync"?f=m:s==="post"?f=()=>tt(m,a&&a.suspense):(m.pre=!0,a&&(m.id=a.uid),f=()=>fu(m));const h=new ru(c,xt,f),y=()=>{h.stop(),a&&a.scope&&qa(a.scope.effects,h)};return t?n?m():L=h.run():s==="post"?tt(h.run.bind(h),a&&a.suspense):h.run(),_&&_.push(y),y}function nv(e,t,n){const r=this.proxy,s=Ne(e)?e.includes(".")?ih(r,e):()=>r[e]:e.bind(r,r);let l;q(t)?l=t:(l=t.handler,n=t);const i=Qe;Vr(this);const o=lh(s,l.bind(r),n);return i?Vr(i):tr(),o}function ih(e,t){const n=t.split(".");return()=>{let r=e;for(let s=0;s0){if(n>=t)return e;n++}if(r=r||new Set,r.has(e))return e;if(r.add(e),ut(e))gr(e.value,t,n,r);else if(X(e))for(let s=0;s{gr(s,t,n,r)});else if(Od(e))for(const s in e)gr(e[s],t,n,r);return e}function Wn(e,t,n,r){const s=e.dirs,l=t&&t.dirs;for(let i=0;i!!e.type.__asyncLoader,oh=e=>e.type.__isKeepAlive;function rv(e,t){ah(e,"a",t)}function sv(e,t){ah(e,"da",t)}function ah(e,t,n=Qe){const r=e.__wdc||(e.__wdc=()=>{let s=n;for(;s;){if(s.isDeactivated)return;s=s.parent}return e()});if(Fi(t,r,n),n){let s=n.parent;for(;s&&s.parent;)oh(s.parent.vnode)&&lv(r,t,n,s),s=s.parent}}function lv(e,t,n,r){const s=Fi(t,e,r,!0);ch(()=>{qa(r[t],s)},n)}function Fi(e,t,n=Qe,r=!1){if(n){const s=n[e]||(n[e]=[]),l=t.__weh||(t.__weh=(...i)=>{if(n.isUnmounted)return;ur(),Vr(n);const o=It(t,n,e,i);return tr(),cr(),o});return r?s.unshift(l):s.push(l),l}}const pn=e=>(t,n=Qe)=>(!ji||e==="sp")&&Fi(e,(...r)=>t(...r),n),iv=pn("bm"),uh=pn("m"),ov=pn("bu"),av=pn("u"),uv=pn("bum"),ch=pn("um"),cv=pn("sp"),fv=pn("rtg"),dv=pn("rtc");function hv(e,t=Qe){Fi("ec",e,t)}function CS(e,t,n,r){let s;const l=n&&n[r];if(X(e)||Ne(e)){s=new Array(e.length);for(let i=0,o=e.length;it(i,o,void 0,l&&l[o]));else{const i=Object.keys(e);s=new Array(i.length);for(let o=0,a=i.length;oql(t)?!(t.type===zn||t.type===yt&&!fh(t.children)):!0)?e:null}const Go=e=>e?kh(e)?gu(e)||e.proxy:Go(e.parent):null,Ss=ze(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>Go(e.parent),$root:e=>Go(e.root),$emit:e=>e.emit,$options:e=>du(e),$forceUpdate:e=>e.f||(e.f=()=>{e.effect.dirty=!0,fu(e.update)}),$nextTick:e=>e.n||(e.n=Xd.bind(e.proxy)),$watch:e=>nv.bind(e)}),io=(e,t)=>e!==ye&&!e.__isScriptSetup&&ie(e,t),pv={get({_:e},t){const{ctx:n,setupState:r,data:s,props:l,accessCache:i,type:o,appContext:a}=e;let u;if(t[0]!=="$"){const w=i[t];if(w!==void 0)switch(w){case 1:return r[t];case 2:return s[t];case 4:return n[t];case 3:return l[t]}else{if(io(r,t))return i[t]=1,r[t];if(s!==ye&&ie(s,t))return i[t]=2,s[t];if((u=e.propsOptions[0])&&ie(u,t))return i[t]=3,l[t];if(n!==ye&&ie(n,t))return i[t]=4,n[t];Yo&&(i[t]=0)}}const c=Ss[t];let d,p;if(c)return t==="$attrs"&&at(e,"get",t),c(e);if((d=o.__cssModules)&&(d=d[t]))return d;if(n!==ye&&ie(n,t))return i[t]=4,n[t];if(p=a.config.globalProperties,ie(p,t))return p[t]},set({_:e},t,n){const{data:r,setupState:s,ctx:l}=e;return io(s,t)?(s[t]=n,!0):r!==ye&&ie(r,t)?(r[t]=n,!0):ie(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(l[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:s,propsOptions:l}},i){let o;return!!n[i]||e!==ye&&ie(e,i)||io(t,i)||(o=l[0])&&ie(o,i)||ie(r,i)||ie(Ss,i)||ie(s.config.globalProperties,i)},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:ie(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function Rc(e){return X(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let Yo=!0;function mv(e){const t=du(e),n=e.proxy,r=e.ctx;Yo=!1,t.beforeCreate&&Nc(t.beforeCreate,e,"bc");const{data:s,computed:l,methods:i,watch:o,provide:a,inject:u,created:c,beforeMount:d,mounted:p,beforeUpdate:w,updated:x,activated:_,deactivated:L,beforeDestroy:m,beforeUnmount:f,destroyed:h,unmounted:y,render:S,renderTracked:C,renderTriggered:k,errorCaptured:R,serverPrefetch:D,expose:U,inheritAttrs:ee,components:ke,directives:Le,filters:At}=t;if(u&&gv(u,r,null),i)for(const se in i){const P=i[se];q(P)&&(r[se]=P.bind(n))}if(s){const se=s.call(n,n);Se(se)&&(e.data=Ti(se))}if(Yo=!0,l)for(const se in l){const P=l[se],W=q(P)?P.bind(n,n):q(P.get)?P.get.bind(n,n):xt,K=!q(P)&&q(P.set)?P.set.bind(n):xt,te=Mt({get:W,set:K});Object.defineProperty(r,se,{enumerable:!0,configurable:!0,get:()=>te.value,set:Z=>te.value=Z})}if(o)for(const se in o)dh(o[se],r,n,se);if(a){const se=q(a)?a.call(n):a;Reflect.ownKeys(se).forEach(P=>{Nl(P,se[P])})}c&&Nc(c,e,"c");function ge(se,P){X(P)?P.forEach(W=>se(W.bind(n))):P&&se(P.bind(n))}if(ge(iv,d),ge(uh,p),ge(ov,w),ge(av,x),ge(rv,_),ge(sv,L),ge(hv,R),ge(dv,C),ge(fv,k),ge(uv,f),ge(ch,y),ge(cv,D),X(U))if(U.length){const se=e.exposed||(e.exposed={});U.forEach(P=>{Object.defineProperty(se,P,{get:()=>n[P],set:W=>n[P]=W})})}else e.exposed||(e.exposed={});S&&e.render===xt&&(e.render=S),ee!=null&&(e.inheritAttrs=ee),ke&&(e.components=ke),Le&&(e.directives=Le)}function gv(e,t,n=xt){X(e)&&(e=Zo(e));for(const r in e){const s=e[r];let l;Se(s)?"default"in s?l=an(s.from||r,s.default,!0):l=an(s.from||r):l=an(s),ut(l)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>l.value,set:i=>l.value=i}):t[r]=l}}function Nc(e,t,n){It(X(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function dh(e,t,n,r){const s=r.includes(".")?ih(n,r):()=>n[r];if(Ne(e)){const l=t[e];q(l)&&Rl(s,l)}else if(q(e))Rl(s,e.bind(n));else if(Se(e))if(X(e))e.forEach(l=>dh(l,t,n,r));else{const l=q(e.handler)?e.handler.bind(n):t[e.handler];q(l)&&Rl(s,l,e)}}function du(e){const t=e.type,{mixins:n,extends:r}=t,{mixins:s,optionsCache:l,config:{optionMergeStrategies:i}}=e.appContext,o=l.get(t);let a;return o?a=o:!s.length&&!n&&!r?a=t:(a={},s.length&&s.forEach(u=>Jl(a,u,i,!0)),Jl(a,t,i)),Se(t)&&l.set(t,a),a}function Jl(e,t,n,r=!1){const{mixins:s,extends:l}=t;l&&Jl(e,l,n,!0),s&&s.forEach(i=>Jl(e,i,n,!0));for(const i in t)if(!(r&&i==="expose")){const o=vv[i]||n&&n[i];e[i]=o?o(e[i],t[i]):t[i]}return e}const vv={data:Mc,props:Fc,emits:Fc,methods:ps,computed:ps,beforeCreate:Ge,created:Ge,beforeMount:Ge,mounted:Ge,beforeUpdate:Ge,updated:Ge,beforeDestroy:Ge,beforeUnmount:Ge,destroyed:Ge,unmounted:Ge,activated:Ge,deactivated:Ge,errorCaptured:Ge,serverPrefetch:Ge,components:ps,directives:ps,watch:wv,provide:Mc,inject:yv};function Mc(e,t){return t?e?function(){return ze(q(e)?e.call(this,this):e,q(t)?t.call(this,this):t)}:t:e}function yv(e,t){return ps(Zo(e),Zo(t))}function Zo(e){if(X(e)){const t={};for(let n=0;n1)return n&&q(t)?t.call(r&&r.proxy):t}}function Ev(e,t,n,r=!1){const s={},l={};Gl(l,bi,1),e.propsDefaults=Object.create(null),ph(e,t,s,l);for(const i in e.propsOptions[0])i in s||(s[i]=void 0);n?e.props=r?s:Vd(s):e.type.props?e.props=s:e.props=l,e.attrs=l}function _v(e,t,n,r){const{props:s,attrs:l,vnode:{patchFlag:i}}=e,o=ae(s),[a]=e.propsOptions;let u=!1;if((r||i>0)&&!(i&16)){if(i&8){const c=e.vnode.dynamicProps;for(let d=0;d{a=!0;const[p,w]=mh(d,t,!0);ze(i,p),w&&o.push(...w)};!n&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}if(!l&&!a)return Se(e)&&r.set(e,Lr),Lr;if(X(l))for(let c=0;c-1,w[1]=_<0||x<_,(x>-1||ie(w,"default"))&&o.push(d)}}}const u=[i,o];return Se(e)&&r.set(e,u),u}function Ic(e){return e[0]!=="$"}function Dc(e){const t=e&&e.toString().match(/^\s*(function|class) (\w+)/);return t?t[2]:e===null?"null":""}function bc(e,t){return Dc(e)===Dc(t)}function jc(e,t){return X(t)?t.findIndex(n=>bc(n,e)):q(t)&&bc(t,e)?0:-1}const gh=e=>e[0]==="_"||e==="$stable",hu=e=>X(e)?e.map(Qt):[Qt(e)],Cv=(e,t,n)=>{if(t._n)return t;const r=Wg((...s)=>hu(t(...s)),n);return r._c=!1,r},vh=(e,t,n)=>{const r=e._ctx;for(const s in e){if(gh(s))continue;const l=e[s];if(q(l))t[s]=Cv(s,l,r);else if(l!=null){const i=hu(l);t[s]=()=>i}}},yh=(e,t)=>{const n=hu(t);e.slots.default=()=>n},kv=(e,t)=>{if(e.vnode.shapeFlag&32){const n=t._;n?(e.slots=ae(t),Gl(t,"_",n)):vh(t,e.slots={})}else e.slots={},t&&yh(e,t);Gl(e.slots,bi,1)},Av=(e,t,n)=>{const{vnode:r,slots:s}=e;let l=!0,i=ye;if(r.shapeFlag&32){const o=t._;o?n&&o===1?l=!1:(ze(s,t),!n&&o===1&&delete s._):(l=!t.$stable,vh(t,s)),i=t}else t&&(yh(e,t),i={default:1});if(l)for(const o in s)!gh(o)&&i[o]==null&&delete s[o]};function Xo(e,t,n,r,s=!1){if(X(e)){e.forEach((p,w)=>Xo(p,t&&(X(t)?t[w]:t),n,r,s));return}if(ws(r)&&!s)return;const l=r.shapeFlag&4?gu(r.component)||r.component.proxy:r.el,i=s?null:l,{i:o,r:a}=e,u=t&&t.r,c=o.refs===ye?o.refs={}:o.refs,d=o.setupState;if(u!=null&&u!==a&&(Ne(u)?(c[u]=null,ie(d,u)&&(d[u]=null)):ut(u)&&(u.value=null)),q(a))Ln(a,o,12,[i,c]);else{const p=Ne(a),w=ut(a);if(p||w){const x=()=>{if(e.f){const _=p?ie(d,a)?d[a]:c[a]:a.value;s?X(_)&&qa(_,l):X(_)?_.includes(l)||_.push(l):p?(c[a]=[l],ie(d,a)&&(d[a]=c[a])):(a.value=[l],e.k&&(c[e.k]=a.value))}else p?(c[a]=i,ie(d,a)&&(d[a]=i)):w&&(a.value=i,e.k&&(c[e.k]=i))};i?(x.id=-1,tt(x,n)):x()}}}const tt=qg;function Ov(e){return Pv(e)}function Pv(e,t){const n=Pd();n.__VUE__=!0;const{insert:r,remove:s,patchProp:l,createElement:i,createText:o,createComment:a,setText:u,setElementText:c,parentNode:d,nextSibling:p,setScopeId:w=xt,insertStaticContent:x}=e,_=(g,v,E,O=null,T=null,N=null,B=void 0,I=null,j=!!v.dynamicChildren)=>{if(g===v)return;g&&!ss(g,v)&&(O=A(g),Z(g,T,N,!0),g=null),v.patchFlag===-2&&(j=!1,v.dynamicChildren=null);const{type:M,ref:H,shapeFlag:Y}=v;switch(M){case Ii:L(g,v,E,O);break;case zn:m(g,v,E,O);break;case Ml:g==null&&f(v,E,O,B);break;case yt:ke(g,v,E,O,T,N,B,I,j);break;default:Y&1?S(g,v,E,O,T,N,B,I,j):Y&6?Le(g,v,E,O,T,N,B,I,j):(Y&64||Y&128)&&M.process(g,v,E,O,T,N,B,I,j,b)}H!=null&&T&&Xo(H,g&&g.ref,N,v||g,!v)},L=(g,v,E,O)=>{if(g==null)r(v.el=o(v.children),E,O);else{const T=v.el=g.el;v.children!==g.children&&u(T,v.children)}},m=(g,v,E,O)=>{g==null?r(v.el=a(v.children||""),E,O):v.el=g.el},f=(g,v,E,O)=>{[g.el,g.anchor]=x(g.children,v,E,O,g.el,g.anchor)},h=({el:g,anchor:v},E,O)=>{let T;for(;g&&g!==v;)T=p(g),r(g,E,O),g=T;r(v,E,O)},y=({el:g,anchor:v})=>{let E;for(;g&&g!==v;)E=p(g),s(g),g=E;s(v)},S=(g,v,E,O,T,N,B,I,j)=>{v.type==="svg"?B="svg":v.type==="math"&&(B="mathml"),g==null?C(v,E,O,T,N,B,I,j):D(g,v,T,N,B,I,j)},C=(g,v,E,O,T,N,B,I)=>{let j,M;const{props:H,shapeFlag:Y,transition:G,dirs:J}=g;if(j=g.el=i(g.type,N,H&&H.is,H),Y&8?c(j,g.children):Y&16&&R(g.children,j,null,O,T,oo(g,N),B,I),J&&Wn(g,null,O,"created"),k(j,g,g.scopeId,B,O),H){for(const de in H)de!=="value"&&!Tl(de)&&l(j,de,null,H[de],N,g.children,O,T,ue);"value"in H&&l(j,"value",null,H.value,N),(M=H.onVnodeBeforeMount)&&Vt(M,O,g)}J&&Wn(g,null,O,"beforeMount");const ne=Lv(T,G);ne&&G.beforeEnter(j),r(j,v,E),((M=H&&H.onVnodeMounted)||ne||J)&&tt(()=>{M&&Vt(M,O,g),ne&&G.enter(j),J&&Wn(g,null,O,"mounted")},T)},k=(g,v,E,O,T)=>{if(E&&w(g,E),O)for(let N=0;N{for(let M=j;M{const I=v.el=g.el;let{patchFlag:j,dynamicChildren:M,dirs:H}=v;j|=g.patchFlag&16;const Y=g.props||ye,G=v.props||ye;let J;if(E&&Qn(E,!1),(J=G.onVnodeBeforeUpdate)&&Vt(J,E,v,g),H&&Wn(v,g,E,"beforeUpdate"),E&&Qn(E,!0),M?U(g.dynamicChildren,M,I,E,O,oo(v,T),N):B||P(g,v,I,null,E,O,oo(v,T),N,!1),j>0){if(j&16)ee(I,v,Y,G,E,O,T);else if(j&2&&Y.class!==G.class&&l(I,"class",null,G.class,T),j&4&&l(I,"style",Y.style,G.style,T),j&8){const ne=v.dynamicProps;for(let de=0;de{J&&Vt(J,E,v,g),H&&Wn(v,g,E,"updated")},O)},U=(g,v,E,O,T,N,B)=>{for(let I=0;I{if(E!==O){if(E!==ye)for(const I in E)!Tl(I)&&!(I in O)&&l(g,I,E[I],null,B,v.children,T,N,ue);for(const I in O){if(Tl(I))continue;const j=O[I],M=E[I];j!==M&&I!=="value"&&l(g,I,M,j,B,v.children,T,N,ue)}"value"in O&&l(g,"value",E.value,O.value,B)}},ke=(g,v,E,O,T,N,B,I,j)=>{const M=v.el=g?g.el:o(""),H=v.anchor=g?g.anchor:o("");let{patchFlag:Y,dynamicChildren:G,slotScopeIds:J}=v;J&&(I=I?I.concat(J):J),g==null?(r(M,E,O),r(H,E,O),R(v.children,E,H,T,N,B,I,j)):Y>0&&Y&64&&G&&g.dynamicChildren?(U(g.dynamicChildren,G,E,T,N,B,I),(v.key!=null||T&&v===T.subTree)&&wh(g,v,!0)):P(g,v,E,H,T,N,B,I,j)},Le=(g,v,E,O,T,N,B,I,j)=>{v.slotScopeIds=I,g==null?v.shapeFlag&512?T.ctx.activate(v,E,O,B,j):At(v,E,O,T,N,B,j):Bt(g,v,j)},At=(g,v,E,O,T,N,B)=>{const I=g.component=zv(g,O,T);if(oh(g)&&(I.ctx.renderer=b),Bv(I),I.asyncDep){if(T&&T.registerDep(I,ge),!g.el){const j=I.subTree=be(zn);m(null,j,v,E)}}else ge(I,g,v,E,T,N,B)},Bt=(g,v,E)=>{const O=v.component=g.component;if(Gg(g,v,E))if(O.asyncDep&&!O.asyncResolved){se(O,v,E);return}else O.next=v,Ug(O.update),O.effect.dirty=!0,O.update();else v.el=g.el,O.vnode=v},ge=(g,v,E,O,T,N,B)=>{const I=()=>{if(g.isMounted){let{next:H,bu:Y,u:G,parent:J,vnode:ne}=g;{const hr=Sh(g);if(hr){H&&(H.el=ne.el,se(g,H,B)),hr.asyncDep.then(()=>{g.isUnmounted||I()});return}}let de=H,ve;Qn(g,!1),H?(H.el=ne.el,se(g,H,B)):H=ne,Y&&ro(Y),(ve=H.props&&H.props.onVnodeBeforeUpdate)&&Vt(ve,J,H,ne),Qn(g,!0);const Me=lo(g),Ot=g.subTree;g.subTree=Me,_(Ot,Me,d(Ot.el),A(Ot),g,T,N),H.el=Me.el,de===null&&Yg(g,Me.el),G&&tt(G,T),(ve=H.props&&H.props.onVnodeUpdated)&&tt(()=>Vt(ve,J,H,ne),T)}else{let H;const{el:Y,props:G}=v,{bm:J,m:ne,parent:de}=g,ve=ws(v);if(Qn(g,!1),J&&ro(J),!ve&&(H=G&&G.onVnodeBeforeMount)&&Vt(H,de,v),Qn(g,!0),Y&&le){const Me=()=>{g.subTree=lo(g),le(Y,g.subTree,g,T,null)};ve?v.type.__asyncLoader().then(()=>!g.isUnmounted&&Me()):Me()}else{const Me=g.subTree=lo(g);_(null,Me,E,O,g,T,N),v.el=Me.el}if(ne&&tt(ne,T),!ve&&(H=G&&G.onVnodeMounted)){const Me=v;tt(()=>Vt(H,de,Me),T)}(v.shapeFlag&256||de&&ws(de.vnode)&&de.vnode.shapeFlag&256)&&g.a&&tt(g.a,T),g.isMounted=!0,v=E=O=null}},j=g.effect=new ru(I,xt,()=>fu(M),g.scope),M=g.update=()=>{j.dirty&&j.run()};M.id=g.uid,Qn(g,!0),M()},se=(g,v,E)=>{v.component=g;const O=g.vnode.props;g.vnode=v,g.next=null,_v(g,v.props,O,E),Av(g,v.children,E),ur(),Oc(g),cr()},P=(g,v,E,O,T,N,B,I,j=!1)=>{const M=g&&g.children,H=g?g.shapeFlag:0,Y=v.children,{patchFlag:G,shapeFlag:J}=v;if(G>0){if(G&128){K(M,Y,E,O,T,N,B,I,j);return}else if(G&256){W(M,Y,E,O,T,N,B,I,j);return}}J&8?(H&16&&ue(M,T,N),Y!==M&&c(E,Y)):H&16?J&16?K(M,Y,E,O,T,N,B,I,j):ue(M,T,N,!0):(H&8&&c(E,""),J&16&&R(Y,E,O,T,N,B,I,j))},W=(g,v,E,O,T,N,B,I,j)=>{g=g||Lr,v=v||Lr;const M=g.length,H=v.length,Y=Math.min(M,H);let G;for(G=0;GH?ue(g,T,N,!0,!1,Y):R(v,E,O,T,N,B,I,j,Y)},K=(g,v,E,O,T,N,B,I,j)=>{let M=0;const H=v.length;let Y=g.length-1,G=H-1;for(;M<=Y&&M<=G;){const J=g[M],ne=v[M]=j?wn(v[M]):Qt(v[M]);if(ss(J,ne))_(J,ne,E,null,T,N,B,I,j);else break;M++}for(;M<=Y&&M<=G;){const J=g[Y],ne=v[G]=j?wn(v[G]):Qt(v[G]);if(ss(J,ne))_(J,ne,E,null,T,N,B,I,j);else break;Y--,G--}if(M>Y){if(M<=G){const J=G+1,ne=JG)for(;M<=Y;)Z(g[M],T,N,!0),M++;else{const J=M,ne=M,de=new Map;for(M=ne;M<=G;M++){const ft=v[M]=j?wn(v[M]):Qt(v[M]);ft.key!=null&&de.set(ft.key,M)}let ve,Me=0;const Ot=G-ne+1;let hr=!1,gc=0;const rs=new Array(Ot);for(M=0;M=Ot){Z(ft,T,N,!0);continue}let Ut;if(ft.key!=null)Ut=de.get(ft.key);else for(ve=ne;ve<=G;ve++)if(rs[ve-ne]===0&&ss(ft,v[ve])){Ut=ve;break}Ut===void 0?Z(ft,T,N,!0):(rs[Ut-ne]=M+1,Ut>=gc?gc=Ut:hr=!0,_(ft,v[Ut],E,null,T,N,B,I,j),Me++)}const vc=hr?Tv(rs):Lr;for(ve=vc.length-1,M=Ot-1;M>=0;M--){const ft=ne+M,Ut=v[ft],yc=ft+1{const{el:N,type:B,transition:I,children:j,shapeFlag:M}=g;if(M&6){te(g.component.subTree,v,E,O);return}if(M&128){g.suspense.move(v,E,O);return}if(M&64){B.move(g,v,E,b);return}if(B===yt){r(N,v,E);for(let Y=0;YI.enter(N),T);else{const{leave:Y,delayLeave:G,afterLeave:J}=I,ne=()=>r(N,v,E),de=()=>{Y(N,()=>{ne(),J&&J()})};G?G(N,ne,de):de()}else r(N,v,E)},Z=(g,v,E,O=!1,T=!1)=>{const{type:N,props:B,ref:I,children:j,dynamicChildren:M,shapeFlag:H,patchFlag:Y,dirs:G}=g;if(I!=null&&Xo(I,null,E,g,!0),H&256){v.ctx.deactivate(g);return}const J=H&1&&G,ne=!ws(g);let de;if(ne&&(de=B&&B.onVnodeBeforeUnmount)&&Vt(de,v,g),H&6)et(g.component,E,O);else{if(H&128){g.suspense.unmount(E,O);return}J&&Wn(g,null,v,"beforeUnmount"),H&64?g.type.remove(g,v,E,T,b,O):M&&(N!==yt||Y>0&&Y&64)?ue(M,v,E,!1,!0):(N===yt&&Y&384||!T&&H&16)&&ue(j,v,E),O&&ct(g)}(ne&&(de=B&&B.onVnodeUnmounted)||J)&&tt(()=>{de&&Vt(de,v,g),J&&Wn(g,null,v,"unmounted")},E)},ct=g=>{const{type:v,el:E,anchor:O,transition:T}=g;if(v===yt){xe(E,O);return}if(v===Ml){y(g);return}const N=()=>{s(E),T&&!T.persisted&&T.afterLeave&&T.afterLeave()};if(g.shapeFlag&1&&T&&!T.persisted){const{leave:B,delayLeave:I}=T,j=()=>B(E,N);I?I(g.el,N,j):j()}else N()},xe=(g,v)=>{let E;for(;g!==v;)E=p(g),s(g),g=E;s(v)},et=(g,v,E)=>{const{bum:O,scope:T,update:N,subTree:B,um:I}=g;O&&ro(O),T.stop(),N&&(N.active=!1,Z(B,g,v,E)),I&&tt(I,v),tt(()=>{g.isUnmounted=!0},v),v&&v.pendingBranch&&!v.isUnmounted&&g.asyncDep&&!g.asyncResolved&&g.suspenseId===v.pendingId&&(v.deps--,v.deps===0&&v.resolve())},ue=(g,v,E,O=!1,T=!1,N=0)=>{for(let B=N;Bg.shapeFlag&6?A(g.component.subTree):g.shapeFlag&128?g.suspense.next():p(g.anchor||g.el),V=(g,v,E)=>{g==null?v._vnode&&Z(v._vnode,null,null,!0):_(v._vnode||null,g,v,null,null,null,E),Oc(),eh(),v._vnode=g},b={p:_,um:Z,m:te,r:ct,mt:At,mc:R,pc:P,pbc:U,n:A,o:e};let Q,le;return t&&([Q,le]=t(b)),{render:V,hydrate:Q,createApp:xv(V,Q)}}function oo({type:e,props:t},n){return n==="svg"&&e==="foreignObject"||n==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function Qn({effect:e,update:t},n){e.allowRecurse=t.allowRecurse=n}function Lv(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function wh(e,t,n=!1){const r=e.children,s=t.children;if(X(r)&&X(s))for(let l=0;l>1,e[n[o]]0&&(t[r]=n[l-1]),n[l]=r)}}for(l=n.length,i=n[l-1];l-- >0;)n[l]=i,i=t[i];return n}function Sh(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Sh(t)}const Rv=e=>e.__isTeleport,yt=Symbol.for("v-fgt"),Ii=Symbol.for("v-txt"),zn=Symbol.for("v-cmt"),Ml=Symbol.for("v-stc"),xs=[];let Ft=null;function Di(e=!1){xs.push(Ft=e?null:[])}function Nv(){xs.pop(),Ft=xs[xs.length-1]||null}let bs=1;function zc(e){bs+=e}function xh(e){return e.dynamicChildren=bs>0?Ft||Lr:null,Nv(),bs>0&&Ft&&Ft.push(e),e}function Eh(e,t,n,r,s,l){return xh(rn(e,t,n,r,s,l,!0))}function _h(e,t,n,r,s){return xh(be(e,t,n,r,s,!0))}function ql(e){return e?e.__v_isVNode===!0:!1}function ss(e,t){return e.type===t.type&&e.key===t.key}const bi="__vInternal",Ch=({key:e})=>e??null,Fl=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Ne(e)||ut(e)||q(e)?{i:Ze,r:e,k:t,f:!!n}:e:null);function rn(e,t=null,n=null,r=0,s=null,l=e===yt?0:1,i=!1,o=!1){const a={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Ch(t),ref:t&&Fl(t),scopeId:rh,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:l,patchFlag:r,dynamicProps:s,dynamicChildren:null,appContext:null,ctx:Ze};return o?(pu(a,n),l&128&&e.normalize(a)):n&&(a.shapeFlag|=Ne(n)?8:16),bs>0&&!i&&Ft&&(a.patchFlag>0||l&6)&&a.patchFlag!==32&&Ft.push(a),a}const be=Mv;function Mv(e,t=null,n=null,r=0,s=null,l=!1){if((!e||e===Zg)&&(e=zn),ql(e)){const o=Ur(e,t,!0);return n&&pu(o,n),bs>0&&!l&&Ft&&(o.shapeFlag&6?Ft[Ft.indexOf(e)]=o:Ft.push(o)),o.patchFlag|=-2,o}if(Wv(e)&&(e=e.__vccOpts),t){t=Fv(t);let{class:o,style:a}=t;o&&!Ne(o)&&(t.class=nu(o)),Se(a)&&($d(a)&&!X(a)&&(a=ze({},a)),t.style=tu(a))}const i=Ne(e)?1:Xg(e)?128:Rv(e)?64:Se(e)?4:q(e)?2:0;return rn(e,t,n,r,s,i,l,!0)}function Fv(e){return e?$d(e)||bi in e?ze({},e):e:null}function Ur(e,t,n=!1){const{props:r,ref:s,patchFlag:l,children:i}=e,o=t?Dv(r||{},t):r;return{__v_isVNode:!0,__v_skip:!0,type:e.type,props:o,key:o&&Ch(o),ref:t&&t.ref?n&&s?X(s)?s.concat(Fl(t)):[s,Fl(t)]:Fl(t):s,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:i,target:e.target,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==yt?l===-1?16:l|16:l,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:e.transition,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&Ur(e.ssContent),ssFallback:e.ssFallback&&Ur(e.ssFallback),el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce}}function Il(e=" ",t=0){return be(Ii,null,e,t)}function Iv(e,t){const n=be(Ml,null,e);return n.staticCount=t,n}function AS(e="",t=!1){return t?(Di(),_h(zn,null,e)):be(zn,null,e)}function Qt(e){return e==null||typeof e=="boolean"?be(zn):X(e)?be(yt,null,e.slice()):typeof e=="object"?wn(e):be(Ii,null,String(e))}function wn(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Ur(e)}function pu(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(X(t))n=16;else if(typeof t=="object")if(r&65){const s=t.default;s&&(s._c&&(s._d=!1),pu(e,s()),s._c&&(s._d=!0));return}else{n=32;const s=t._;!s&&!(bi in t)?t._ctx=Ze:s===3&&Ze&&(Ze.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else q(t)?(t={default:t,_ctx:Ze},n=32):(t=String(t),r&64?(n=16,t=[Il(t)]):n=8);e.children=t,e.shapeFlag|=n}function Dv(...e){const t={};for(let n=0;n{let s;return(s=e[n])||(s=e[n]=[]),s.push(r),l=>{s.length>1?s.forEach(i=>i(l)):s[0](l)}};mu=t("__VUE_INSTANCE_SETTERS__",n=>Qe=n),qo=t("__VUE_SSR_SETTERS__",n=>ji=n)}const Vr=e=>{mu(e),e.scope.on()},tr=()=>{Qe&&Qe.scope.off(),mu(null)};function kh(e){return e.vnode.shapeFlag&4}let ji=!1;function Bv(e,t=!1){t&&qo(t);const{props:n,children:r}=e.vnode,s=kh(e);Ev(e,n,s,t),kv(e,r);const l=s?Uv(e,t):void 0;return t&&qo(!1),l}function Uv(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=Wd(new Proxy(e.ctx,pv));const{setup:r}=n;if(r){const s=e.setupContext=r.length>1?Hv(e):null;Vr(e),ur();const l=Ln(r,e,0,[e.props,s]);if(cr(),tr(),kd(l)){if(l.then(tr,tr),t)return l.then(i=>{Bc(e,i,t)}).catch(i=>{Ri(i,e,0)});e.asyncDep=l}else Bc(e,l,t)}else Ah(e,t)}function Bc(e,t,n){q(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Se(t)&&(e.setupState=Zd(t)),Ah(e,n)}let Uc;function Ah(e,t,n){const r=e.type;if(!e.render){if(!t&&Uc&&!r.render){const s=r.template||du(e).template;if(s){const{isCustomElement:l,compilerOptions:i}=e.appContext.config,{delimiters:o,compilerOptions:a}=r,u=ze(ze({isCustomElement:l,delimiters:o},i),a);r.render=Uc(s,u)}}e.render=r.render||xt}{Vr(e),ur();try{mv(e)}finally{cr(),tr()}}}function Vv(e){return e.attrsProxy||(e.attrsProxy=new Proxy(e.attrs,{get(t,n){return at(e,"get","$attrs"),t[n]}}))}function Hv(e){const t=n=>{e.exposed=n||{}};return{get attrs(){return Vv(e)},slots:e.slots,emit:e.emit,expose:t}}function gu(e){if(e.exposed)return e.exposeProxy||(e.exposeProxy=new Proxy(Zd(Wd(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Ss)return Ss[n](e)},has(t,n){return n in t||n in Ss}}))}function $v(e,t=!0){return q(e)?e.displayName||e.name:e.name||t&&e.__name}function Wv(e){return q(e)&&"__vccOpts"in e}const Mt=(e,t)=>Ig(e,t,ji);function Oh(e,t,n){const r=arguments.length;return r===2?Se(t)&&!X(t)?ql(t)?be(e,null,[t]):be(e,t):be(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&ql(n)&&(n=[n]),be(e,t,n))}const Qv="3.4.4",Kv="http://www.w3.org/2000/svg",Gv="http://www.w3.org/1998/Math/MathML",Sn=typeof document<"u"?document:null,Vc=Sn&&Sn.createElement("template"),Yv={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{const s=t==="svg"?Sn.createElementNS(Kv,e):t==="mathml"?Sn.createElementNS(Gv,e):Sn.createElement(e,n?{is:n}:void 0);return e==="select"&&r&&r.multiple!=null&&s.setAttribute("multiple",r.multiple),s},createText:e=>Sn.createTextNode(e),createComment:e=>Sn.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Sn.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,r,s,l){const i=n?n.previousSibling:t.lastChild;if(s&&(s===l||s.nextSibling))for(;t.insertBefore(s.cloneNode(!0),n),!(s===l||!(s=s.nextSibling)););else{Vc.innerHTML=r==="svg"?`${e}`:r==="mathml"?`${e}`:e;const o=Vc.content;if(r==="svg"||r==="mathml"){const a=o.firstChild;for(;a.firstChild;)o.appendChild(a.firstChild);o.removeChild(a)}t.insertBefore(o,n)}return[i?i.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Zv=Symbol("_vtc");function Jv(e,t,n){const r=e[Zv];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const Xv=Symbol("_vod"),qv=Symbol("");function e0(e,t,n){const r=e.style,s=Ne(n);if(n&&!s){if(t&&!Ne(t))for(const l in t)n[l]==null&&ea(r,l,"");for(const l in n)ea(r,l,n[l])}else{const l=r.display;if(s){if(t!==n){const i=r[qv];i&&(n+=";"+i),r.cssText=n}}else t&&e.removeAttribute("style");Xv in e&&(r.display=l)}}const Hc=/\s*!important$/;function ea(e,t,n){if(X(n))n.forEach(r=>ea(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=t0(e,t);Hc.test(n)?e.setProperty(qr(r),n.replace(Hc,""),"important"):e[r]=n}}const $c=["Webkit","Moz","ms"],ao={};function t0(e,t){const n=ao[t];if(n)return n;let r=Jt(t);if(r!=="filter"&&r in e)return ao[t]=r;r=Pi(r);for(let s=0;s<$c.length;s++){const l=$c[s]+r;if(l in e)return ao[t]=l}return t}const Wc="http://www.w3.org/1999/xlink";function n0(e,t,n,r,s){if(r&&t.startsWith("xlink:"))n==null?e.removeAttributeNS(Wc,t.slice(6,t.length)):e.setAttributeNS(Wc,t,n);else{const l=dg(t);n==null||l&&!Ld(n)?e.removeAttribute(t):e.setAttribute(t,l?"":n)}}function r0(e,t,n,r,s,l,i){if(t==="innerHTML"||t==="textContent"){r&&i(r,s,l),e[t]=n??"";return}const o=e.tagName;if(t==="value"&&o!=="PROGRESS"&&!o.includes("-")){e._value=n;const u=o==="OPTION"?e.getAttribute("value"):e.value,c=n??"";u!==c&&(e.value=c),n==null&&e.removeAttribute(t);return}let a=!1;if(n===""||n==null){const u=typeof e[t];u==="boolean"?n=Ld(n):n==null&&u==="string"?(n="",a=!0):u==="number"&&(n=0,a=!0)}try{e[t]=n}catch{}a&&e.removeAttribute(t)}function s0(e,t,n,r){e.addEventListener(t,n,r)}function l0(e,t,n,r){e.removeEventListener(t,n,r)}const Qc=Symbol("_vei");function i0(e,t,n,r,s=null){const l=e[Qc]||(e[Qc]={}),i=l[t];if(r&&i)i.value=r;else{const[o,a]=o0(t);if(r){const u=l[t]=c0(r,s);s0(e,o,u,a)}else i&&(l0(e,o,i,a),l[t]=void 0)}}const Kc=/(?:Once|Passive|Capture)$/;function o0(e){let t;if(Kc.test(e)){t={};let r;for(;r=e.match(Kc);)e=e.slice(0,e.length-r[0].length),t[r[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):qr(e.slice(2)),t]}let uo=0;const a0=Promise.resolve(),u0=()=>uo||(a0.then(()=>uo=0),uo=Date.now());function c0(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;It(f0(r,n.value),t,5,[r])};return n.value=e,n.attached=u0(),n}function f0(e,t){if(X(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(r=>s=>!s._stopped&&r&&r(s))}else return t}const Gc=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,d0=(e,t,n,r,s,l,i,o,a)=>{const u=s==="svg";t==="class"?Jv(e,r,u):t==="style"?e0(e,n,r):ki(t)?Xa(t)||i0(e,t,n,r,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):h0(e,t,r,u))?r0(e,t,r,l,i,o,a):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),n0(e,t,r,u))};function h0(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&Gc(t)&&q(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const s=e.tagName;if(s==="IMG"||s==="VIDEO"||s==="CANVAS"||s==="SOURCE")return!1}return Gc(t)&&Ne(n)?!1:t in e}const p0=ze({patchProp:d0},Yv);let Yc;function m0(){return Yc||(Yc=Ov(p0))}const g0=(...e)=>{const t=m0().createApp(...e),{mount:n}=t;return t.mount=r=>{const s=y0(r);if(!s)return;const l=t._component;!q(l)&&!l.render&&!l.template&&(l.template=s.innerHTML),s.innerHTML="";const i=n(s,!1,v0(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),i},t};function v0(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function y0(e){return Ne(e)?document.querySelector(e):e}const w0="modulepreload",S0=function(e){return"/"+e},Zc={},Xt=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){const l=document.getElementsByTagName("link");s=Promise.all(n.map(i=>{if(i=S0(i),i in Zc)return;Zc[i]=!0;const o=i.endsWith(".css"),a=o?'[rel="stylesheet"]':"";if(!!r)for(let d=l.length-1;d>=0;d--){const p=l[d];if(p.href===i&&(!o||p.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${i}"]${a}`))return;const c=document.createElement("link");if(c.rel=o?"stylesheet":w0,o||(c.as="script",c.crossOrigin=""),c.href=i,document.head.appendChild(c),o)return new Promise((d,p)=>{c.addEventListener("load",d),c.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${i}`)))})}))}return s.then(()=>t()).catch(l=>{const i=new Event("vite:preloadError",{cancelable:!0});if(i.payload=l,window.dispatchEvent(i),!i.defaultPrevented)throw l})};/*! * vue-router v4.2.5 * (c) 2023 Eduardo San Martin Morote * @license MIT - */const mr=typeof window<"u";function x0(e){return e.__esModule||e[Symbol.toStringTag]==="Module"}const ce=Object.assign;function co(e,t){const n={};for(const r in t){const s=t[r];n[r]=jt(s)?s.map(e):e(s)}return n}const Es=()=>{},jt=Array.isArray,E0=/\/$/,_0=e=>e.replace(E0,"");function fo(e,t,n="/"){let r,s={},l="",i="";const o=t.indexOf("#");let u=t.indexOf("?");return o=0&&(u=-1),u>-1&&(r=t.slice(0,u),l=t.slice(u+1,o>-1?o:t.length),s=e(l)),o>-1&&(r=r||t.slice(0,o),i=t.slice(o,t.length)),r=O0(r??t,n),{fullPath:r+(l&&"?")+l+i,path:r,query:s,hash:i}}function C0(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function Jc(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function k0(e,t,n){const r=t.matched.length-1,s=n.matched.length-1;return r>-1&&r===s&&Hr(t.matched[r],n.matched[s])&&Ph(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function Hr(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function Ph(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(!A0(e[n],t[n]))return!1;return!0}function A0(e,t){return jt(e)?Xc(e,t):jt(t)?Xc(t,e):e===t}function Xc(e,t){return jt(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function O0(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),r=e.split("/"),s=r[r.length-1];(s===".."||s===".")&&r.push("");let l=n.length-1,i,o;for(i=0;i1&&l--;else break;return n.slice(0,l).join("/")+"/"+r.slice(i-(i===r.length?1:0)).join("/")}var js;(function(e){e.pop="pop",e.push="push"})(js||(js={}));var _s;(function(e){e.back="back",e.forward="forward",e.unknown=""})(_s||(_s={}));function P0(e){if(!e)if(mr){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),_0(e)}const L0=/^[^#]+#/;function T0(e,t){return e.replace(L0,"#")+t}function R0(e,t){const n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect();return{behavior:t.behavior,left:r.left-n.left-(t.left||0),top:r.top-n.top-(t.top||0)}}const zi=()=>({left:window.pageXOffset,top:window.pageYOffset});function N0(e){let t;if("el"in e){const n=e.el,r=typeof n=="string"&&n.startsWith("#"),s=typeof n=="string"?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!s)return;t=R0(s,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.pageXOffset,t.top!=null?t.top:window.pageYOffset)}function qc(e,t){return(history.state?history.state.position-t:-1)+e}const tu=new Map;function M0(e,t){tu.set(e,t)}function I0(e){const t=tu.get(e);return tu.delete(e),t}let F0=()=>location.protocol+"//"+location.host;function Lh(e,t){const{pathname:n,search:r,hash:s}=t,l=e.indexOf("#");if(l>-1){let o=s.includes(e.slice(l))?e.slice(l).length:1,u=s.slice(o);return u[0]!=="/"&&(u="/"+u),Jc(u,"")}return Jc(n,e)+r+s}function D0(e,t,n,r){let s=[],l=[],i=null;const o=({state:p})=>{const w=Lh(e,location),x=n.value,_=t.value;let L=0;if(p){if(n.value=w,t.value=p,i&&i===x){i=null;return}L=_?p.position-_.position:0}else r(w);s.forEach(m=>{m(n.value,x,{delta:L,type:js.pop,direction:L?L>0?_s.forward:_s.back:_s.unknown})})};function u(){i=n.value}function a(p){s.push(p);const w=()=>{const x=s.indexOf(p);x>-1&&s.splice(x,1)};return l.push(w),w}function c(){const{history:p}=window;p.state&&p.replaceState(ce({},p.state,{scroll:zi()}),"")}function d(){for(const p of l)p();l=[],window.removeEventListener("popstate",o),window.removeEventListener("beforeunload",c)}return window.addEventListener("popstate",o),window.addEventListener("beforeunload",c,{passive:!0}),{pauseListeners:u,listen:a,destroy:d}}function ef(e,t,n,r=!1,s=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:s?zi():null}}function b0(e){const{history:t,location:n}=window,r={value:Lh(e,n)},s={value:t.state};s.value||l(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function l(u,a,c){const d=e.indexOf("#"),p=d>-1?(n.host&&document.querySelector("base")?e:e.slice(d))+u:F0()+e+u;try{t[c?"replaceState":"pushState"](a,"",p),s.value=a}catch(w){console.error(w),n[c?"replace":"assign"](p)}}function i(u,a){const c=ce({},t.state,ef(s.value.back,u,s.value.forward,!0),a,{position:s.value.position});l(u,c,!0),r.value=u}function o(u,a){const c=ce({},s.value,t.state,{forward:u,scroll:zi()});l(c.current,c,!0);const d=ce({},ef(r.value,u,null),{position:c.position+1},a);l(u,d,!1),r.value=u}return{location:r,state:s,push:o,replace:i}}function j0(e){e=P0(e);const t=b0(e),n=D0(e,t.state,t.location,t.replace);function r(l,i=!0){i||n.pauseListeners(),history.go(l)}const s=ce({location:"",base:e,go:r,createHref:T0.bind(null,e)},t,n);return Object.defineProperty(s,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(s,"state",{enumerable:!0,get:()=>t.state.value}),s}function z0(e){return typeof e=="string"||e&&typeof e=="object"}function Th(e){return typeof e=="string"||typeof e=="symbol"}const vn={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0},Rh=Symbol("");var tf;(function(e){e[e.aborted=4]="aborted",e[e.cancelled=8]="cancelled",e[e.duplicated=16]="duplicated"})(tf||(tf={}));function $r(e,t){return ce(new Error,{type:e,[Rh]:!0},t)}function qt(e,t){return e instanceof Error&&Rh in e&&(t==null||!!(e.type&t))}const nf="[^/]+?",B0={sensitive:!1,strict:!1,start:!0,end:!0},U0=/[.+*?^${}()[\]/\\]/g;function V0(e,t){const n=ce({},B0,t),r=[];let s=n.start?"^":"";const l=[];for(const a of e){const c=a.length?[]:[90];n.strict&&!a.length&&(s+="/");for(let d=0;dt.length?t.length===1&&t[0]===80?1:-1:0}function $0(e,t){let n=0;const r=e.score,s=t.score;for(;n0&&t[t.length-1]<0}const W0={type:0,value:""},Q0=/[a-zA-Z0-9_]/;function K0(e){if(!e)return[[]];if(e==="/")return[[W0]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(w){throw new Error(`ERR (${n})/"${a}": ${w}`)}let n=0,r=n;const s=[];let l;function i(){l&&s.push(l),l=[]}let o=0,u,a="",c="";function d(){a&&(n===0?l.push({type:0,value:a}):n===1||n===2||n===3?(l.length>1&&(u==="*"||u==="+")&&t(`A repeatable param (${a}) must be alone in its segment. eg: '/:ids+.`),l.push({type:1,value:a,regexp:c,repeatable:u==="*"||u==="+",optional:u==="*"||u==="?"})):t("Invalid state to consume buffer"),a="")}function p(){a+=u}for(;o{i(f)}:Es}function i(c){if(Th(c)){const d=r.get(c);d&&(r.delete(c),n.splice(n.indexOf(d),1),d.children.forEach(i),d.alias.forEach(i))}else{const d=n.indexOf(c);d>-1&&(n.splice(d,1),c.record.name&&r.delete(c.record.name),c.children.forEach(i),c.alias.forEach(i))}}function o(){return n}function u(c){let d=0;for(;d=0&&(c.record.path!==n[d].record.path||!Nh(c,n[d]));)d++;n.splice(d,0,c),c.record.name&&!lf(c)&&r.set(c.record.name,c)}function a(c,d){let p,w={},x,_;if("name"in c&&c.name){if(p=r.get(c.name),!p)throw $r(1,{location:c});_=p.record.name,w=ce(sf(d.params,p.keys.filter(f=>!f.optional).map(f=>f.name)),c.params&&sf(c.params,p.keys.map(f=>f.name))),x=p.stringify(w)}else if("path"in c)x=c.path,p=n.find(f=>f.re.test(x)),p&&(w=p.parse(x),_=p.record.name);else{if(p=d.name?r.get(d.name):n.find(f=>f.re.test(d.path)),!p)throw $r(1,{location:c,currentLocation:d});_=p.record.name,w=ce({},d.params,c.params),x=p.stringify(w)}const L=[];let m=p;for(;m;)L.unshift(m.record),m=m.parent;return{name:_,path:x,params:w,matched:L,meta:X0(L)}}return e.forEach(c=>l(c)),{addRoute:l,resolve:a,removeRoute:i,getRoutes:o,getRecordMatcher:s}}function sf(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function Z0(e){return{path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:void 0,beforeEnter:e.beforeEnter,props:J0(e),children:e.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in e?e.components||null:e.component&&{default:e.component}}}function J0(e){const t={},n=e.props||!1;if("component"in e)t.default=n;else for(const r in e.components)t[r]=typeof n=="object"?n[r]:n;return t}function lf(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function X0(e){return e.reduce((t,n)=>ce(t,n.meta),{})}function of(e,t){const n={};for(const r in e)n[r]=r in t?t[r]:e[r];return n}function Nh(e,t){return t.children.some(n=>n===e||Nh(e,n))}const Mh=/#/g,q0=/&/g,ey=/\//g,ty=/=/g,ny=/\?/g,Ih=/\+/g,ry=/%5B/g,sy=/%5D/g,Fh=/%5E/g,ly=/%60/g,Dh=/%7B/g,iy=/%7C/g,bh=/%7D/g,oy=/%20/g;function va(e){return encodeURI(""+e).replace(iy,"|").replace(ry,"[").replace(sy,"]")}function uy(e){return va(e).replace(Dh,"{").replace(bh,"}").replace(Fh,"^")}function nu(e){return va(e).replace(Ih,"%2B").replace(oy,"+").replace(Mh,"%23").replace(q0,"%26").replace(ly,"`").replace(Dh,"{").replace(bh,"}").replace(Fh,"^")}function ay(e){return nu(e).replace(ty,"%3D")}function cy(e){return va(e).replace(Mh,"%23").replace(ny,"%3F")}function fy(e){return e==null?"":cy(e).replace(ey,"%2F")}function ei(e){try{return decodeURIComponent(""+e)}catch{}return""+e}function dy(e){const t={};if(e===""||e==="?")return t;const r=(e[0]==="?"?e.slice(1):e).split("&");for(let s=0;sl&&nu(l)):[r&&nu(r)]).forEach(l=>{l!==void 0&&(t+=(t.length?"&":"")+n,l!=null&&(t+="="+l))})}return t}function hy(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=jt(r)?r.map(s=>s==null?null:""+s):r==null?r:""+r)}return t}const py=Symbol(""),af=Symbol(""),ya=Symbol(""),jh=Symbol(""),ru=Symbol("");function ls(){let e=[];function t(r){return e.push(r),()=>{const s=e.indexOf(r);s>-1&&e.splice(s,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function xn(e,t,n,r,s){const l=r&&(r.enterCallbacks[s]=r.enterCallbacks[s]||[]);return()=>new Promise((i,o)=>{const u=d=>{d===!1?o($r(4,{from:n,to:t})):d instanceof Error?o(d):z0(d)?o($r(2,{from:t,to:d})):(l&&r.enterCallbacks[s]===l&&typeof d=="function"&&l.push(d),i())},a=e.call(r&&r.instances[s],t,n,u);let c=Promise.resolve(a);e.length<3&&(c=c.then(u)),c.catch(d=>o(d))})}function ho(e,t,n,r){const s=[];for(const l of e)for(const i in l.components){let o=l.components[i];if(!(t!=="beforeRouteEnter"&&!l.instances[i]))if(my(o)){const a=(o.__vccOpts||o)[t];a&&s.push(xn(a,n,r,l,i))}else{let u=o();s.push(()=>u.then(a=>{if(!a)return Promise.reject(new Error(`Couldn't resolve component "${i}" at "${l.path}"`));const c=x0(a)?a.default:a;l.components[i]=c;const p=(c.__vccOpts||c)[t];return p&&xn(p,n,r,l,i)()}))}}return s}function my(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function cf(e){const t=un(ya),n=un(jh),r=Mt(()=>t.resolve(Nr(e.to))),s=Mt(()=>{const{matched:u}=r.value,{length:a}=u,c=u[a-1],d=n.matched;if(!c||!d.length)return-1;const p=d.findIndex(Hr.bind(null,c));if(p>-1)return p;const w=ff(u[a-2]);return a>1&&ff(c)===w&&d[d.length-1].path!==w?d.findIndex(Hr.bind(null,u[a-2])):p}),l=Mt(()=>s.value>-1&&wy(n.params,r.value.params)),i=Mt(()=>s.value>-1&&s.value===n.matched.length-1&&Ph(n.params,r.value.params));function o(u={}){return yy(u)?t[Nr(e.replace)?"replace":"push"](Nr(e.to)).catch(Es):Promise.resolve()}return{route:r,href:Mt(()=>r.value.href),isActive:l,isExactActive:i,navigate:o}}const gy=Mi({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"}},useLink:cf,setup(e,{slots:t}){const n=Ti(cf(e)),{options:r}=un(ya),s=Mt(()=>({[df(e.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[df(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const l=t.default&&t.default(n);return e.custom?l:Oh("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:s.value},l)}}}),vy=gy;function yy(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){const t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function wy(e,t){for(const n in t){const r=t[n],s=e[n];if(typeof r=="string"){if(r!==s)return!1}else if(!jt(s)||s.length!==r.length||r.some((l,i)=>l!==s[i]))return!1}return!0}function ff(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const df=(e,t,n)=>e??t??n,Sy=Mi({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const r=un(ru),s=Mt(()=>e.route||r.value),l=un(af,0),i=Mt(()=>{let a=Nr(l);const{matched:c}=s.value;let d;for(;(d=c[a])&&!d.components;)a++;return a}),o=Mt(()=>s.value.matched[i.value]);Nl(af,Mt(()=>i.value+1)),Nl(py,o),Nl(ru,s);const u=Gd();return Rl(()=>[u.value,o.value,e.name],([a,c,d],[p,w,x])=>{c&&(c.instances[d]=a,w&&w!==c&&a&&a===p&&(c.leaveGuards.size||(c.leaveGuards=w.leaveGuards),c.updateGuards.size||(c.updateGuards=w.updateGuards))),a&&c&&(!w||!Hr(c,w)||!p)&&(c.enterCallbacks[d]||[]).forEach(_=>_(a))},{flush:"post"}),()=>{const a=s.value,c=e.name,d=o.value,p=d&&d.components[c];if(!p)return hf(n.default,{Component:p,route:a});const w=d.props[c],x=w?w===!0?a.params:typeof w=="function"?w(a):w:null,L=Oh(p,ce({},x,t,{onVnodeUnmounted:m=>{m.component.isUnmounted&&(d.instances[c]=null)},ref:u}));return hf(n.default,{Component:L,route:a})||L}}});function hf(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const xy=Sy;function Ey(e){const t=Y0(e.routes,e),n=e.parseQuery||dy,r=e.stringifyQuery||uf,s=e.history,l=ls(),i=ls(),o=ls(),u=Dg(vn);let a=vn;mr&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=co.bind(null,A=>""+A),d=co.bind(null,fy),p=co.bind(null,ei);function w(A,V){let b,Q;return Th(A)?(b=t.getRecordMatcher(A),Q=V):Q=A,t.addRoute(Q,b)}function x(A){const V=t.getRecordMatcher(A);V&&t.removeRoute(V)}function _(){return t.getRoutes().map(A=>A.record)}function L(A){return!!t.getRecordMatcher(A)}function m(A,V){if(V=ce({},V||u.value),typeof A=="string"){const E=fo(n,A,V.path),O=t.resolve({path:E.path},V),T=s.createHref(E.fullPath);return ce(E,O,{params:p(O.params),hash:ei(E.hash),redirectedFrom:void 0,href:T})}let b;if("path"in A)b=ce({},A,{path:fo(n,A.path,V.path).path});else{const E=ce({},A.params);for(const O in E)E[O]==null&&delete E[O];b=ce({},A,{params:d(E)}),V.params=d(V.params)}const Q=t.resolve(b,V),le=A.hash||"";Q.params=c(p(Q.params));const g=C0(r,ce({},A,{hash:uy(le),path:Q.path})),v=s.createHref(g);return ce({fullPath:g,hash:le,query:r===uf?hy(A.query):A.query||{}},Q,{redirectedFrom:void 0,href:v})}function f(A){return typeof A=="string"?fo(n,A,u.value.path):ce({},A)}function h(A,V){if(a!==A)return $r(8,{from:V,to:A})}function y(A){return k(A)}function S(A){return y(ce(f(A),{replace:!0}))}function C(A){const V=A.matched[A.matched.length-1];if(V&&V.redirect){const{redirect:b}=V;let Q=typeof b=="function"?b(A):b;return typeof Q=="string"&&(Q=Q.includes("?")||Q.includes("#")?Q=f(Q):{path:Q},Q.params={}),ce({query:A.query,hash:A.hash,params:"path"in Q?{}:A.params},Q)}}function k(A,V){const b=a=m(A),Q=u.value,le=A.state,g=A.force,v=A.replace===!0,E=C(b);if(E)return k(ce(f(E),{state:typeof E=="object"?ce({},le,E.state):le,force:g,replace:v}),V||b);const O=b;O.redirectedFrom=V;let T;return!g&&k0(r,Q,b)&&(T=$r(16,{to:O,from:Q}),te(Q,Q,!0,!1)),(T?Promise.resolve(T):U(O,Q)).catch(N=>qt(N)?qt(N,2)?N:K(N):P(N,O,Q)).then(N=>{if(N){if(qt(N,2))return k(ce({replace:v},f(N.to),{state:typeof N.to=="object"?ce({},le,N.to.state):le,force:g}),V||O)}else N=ke(O,Q,!0,v,le);return ee(O,Q,N),N})}function R(A,V){const b=h(A,V);return b?Promise.reject(b):Promise.resolve()}function D(A){const V=xe.values().next().value;return V&&typeof V.runWithContext=="function"?V.runWithContext(A):A()}function U(A,V){let b;const[Q,le,g]=_y(A,V);b=ho(Q.reverse(),"beforeRouteLeave",A,V);for(const E of Q)E.leaveGuards.forEach(O=>{b.push(xn(O,A,V))});const v=R.bind(null,A,V);return b.push(v),ae(b).then(()=>{b=[];for(const E of l.list())b.push(xn(E,A,V));return b.push(v),ae(b)}).then(()=>{b=ho(le,"beforeRouteUpdate",A,V);for(const E of le)E.updateGuards.forEach(O=>{b.push(xn(O,A,V))});return b.push(v),ae(b)}).then(()=>{b=[];for(const E of g)if(E.beforeEnter)if(jt(E.beforeEnter))for(const O of E.beforeEnter)b.push(xn(O,A,V));else b.push(xn(E.beforeEnter,A,V));return b.push(v),ae(b)}).then(()=>(A.matched.forEach(E=>E.enterCallbacks={}),b=ho(g,"beforeRouteEnter",A,V),b.push(v),ae(b))).then(()=>{b=[];for(const E of i.list())b.push(xn(E,A,V));return b.push(v),ae(b)}).catch(E=>qt(E,8)?E:Promise.reject(E))}function ee(A,V,b){o.list().forEach(Q=>D(()=>Q(A,V,b)))}function ke(A,V,b,Q,le){const g=h(A,V);if(g)return g;const v=V===vn,E=mr?history.state:{};b&&(Q||v?s.replace(A.fullPath,ce({scroll:v&&E&&E.scroll},le)):s.push(A.fullPath,le)),u.value=A,te(A,V,b,v),K()}let Le;function At(){Le||(Le=s.listen((A,V,b)=>{if(!et.listening)return;const Q=m(A),le=C(Q);if(le){k(ce(le,{replace:!0}),Q).catch(Es);return}a=Q;const g=u.value;mr&&M0(qc(g.fullPath,b.delta),zi()),U(Q,g).catch(v=>qt(v,12)?v:qt(v,2)?(k(v.to,Q).then(E=>{qt(E,20)&&!b.delta&&b.type===js.pop&&s.go(-1,!1)}).catch(Es),Promise.reject()):(b.delta&&s.go(-b.delta,!1),P(v,Q,g))).then(v=>{v=v||ke(Q,g,!1),v&&(b.delta&&!qt(v,8)?s.go(-b.delta,!1):b.type===js.pop&&qt(v,20)&&s.go(-1,!1)),ee(Q,g,v)}).catch(Es)}))}let Bt=ls(),ge=ls(),se;function P(A,V,b){K(A);const Q=ge.list();return Q.length?Q.forEach(le=>le(A,V,b)):console.error(A),Promise.reject(A)}function W(){return se&&u.value!==vn?Promise.resolve():new Promise((A,V)=>{Bt.add([A,V])})}function K(A){return se||(se=!A,At(),Bt.list().forEach(([V,b])=>A?b(A):V()),Bt.reset()),A}function te(A,V,b,Q){const{scrollBehavior:le}=e;if(!mr||!le)return Promise.resolve();const g=!b&&I0(qc(A.fullPath,0))||(Q||!b)&&history.state&&history.state.scroll||null;return Xd().then(()=>le(A,V,g)).then(v=>v&&N0(v)).catch(v=>P(v,A,V))}const Z=A=>s.go(A);let ct;const xe=new Set,et={currentRoute:u,listening:!0,addRoute:w,removeRoute:x,hasRoute:L,getRoutes:_,resolve:m,options:e,push:y,replace:S,go:Z,back:()=>Z(-1),forward:()=>Z(1),beforeEach:l.add,beforeResolve:i.add,afterEach:o.add,onError:ge.add,isReady:W,install(A){const V=this;A.component("RouterLink",vy),A.component("RouterView",xy),A.config.globalProperties.$router=V,Object.defineProperty(A.config.globalProperties,"$route",{enumerable:!0,get:()=>Nr(u)}),mr&&!ct&&u.value===vn&&(ct=!0,y(s.location).catch(le=>{}));const b={};for(const le in vn)Object.defineProperty(b,le,{get:()=>u.value[le],enumerable:!0});A.provide(ya,V),A.provide(jh,Vd(b)),A.provide(ru,u);const Q=A.unmount;xe.add(A),A.unmount=function(){xe.delete(A),xe.size<1&&(a=vn,Le&&Le(),Le=null,u.value=vn,ct=!1,se=!1),Q()}}};function ae(A){return A.reduce((V,b)=>V.then(()=>D(b)),Promise.resolve())}return et}function _y(e,t){const n=[],r=[],s=[],l=Math.max(t.matched.length,e.matched.length);for(let i=0;iHr(a,o))?r.push(o):n.push(o));const u=e.matched[i];u&&(t.matched.find(a=>Hr(a,u))||s.push(u))}return[n,r,s]}const Cy=Ey({history:j0(),linkActiveClass:"active",routes:[{path:"/",name:"Home",component:()=>Xt(()=>import("./home.js"),__vite__mapDeps([0,1]))},{path:"/install",name:"Install",component:()=>Xt(()=>import("./install.js"),__vite__mapDeps([]))},{path:"/selects",name:"Selects",component:()=>Xt(()=>import("./selects.js"),__vite__mapDeps([]))},{path:"/data",name:"Data",component:()=>Xt(()=>import("./data.js"),__vite__mapDeps([]))},{path:"/settings",name:"Settings",component:()=>Xt(()=>import("./index2.js"),__vite__mapDeps([2,3]))},{path:"/events",name:"Events",component:()=>Xt(()=>import("./index3.js"),__vite__mapDeps([]))},{path:"/methods",name:"Methods",component:()=>Xt(()=>import("./index4.js"),__vite__mapDeps([]))},{path:"/vue",name:"Vue",component:()=>Xt(()=>import("./vue.js"),__vite__mapDeps([]))},{path:"/react",name:"React",component:()=>Xt(()=>import("./react.js"),__vite__mapDeps([]))}]});function wa(){return Math.random().toString(36).substring(2,10)}function ky(e,t){function n(s,l){return l&&s&&s.classList&&s.classList.contains(l)||l&&s&&s.dataset&&s.dataset.id&&s.dataset.id===t?s:null}function r(s,l){return!s||s===document?null:n(s,l)?s:r(s.parentNode,l)}return n(e,t)||r(e,t)}function Cs(e,t=50,n=!1){let r;return function(...s){const l=self,i=()=>{r=null,n||e.apply(l,s)},o=n&&!r;clearTimeout(r),r=setTimeout(i,t),o&&e.apply(l,s)}}function po(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Ay(e){const t=e.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,n=>"-"+n.toLowerCase());return e[0]===e[0].toUpperCase()?t.substring(1):t}class Lt{constructor(t){if(this.id=!t.id||t.id===""?wa():t.id,this.label=t.label||"",this.selectAll=t.selectAll===void 0?!1:t.selectAll,this.selectAllText=t.selectAllText||"Select All",this.closable=t.closable||"off",this.options=[],t.options)for(const n of t.options)this.options.push(new He(n))}}class He{constructor(t){this.id=!t.id||t.id===""?wa():t.id,this.value=t.value===void 0?t.text:t.value,this.text=t.text||"",this.html=t.html||"",this.selected=t.selected!==void 0?t.selected:!1,this.display=t.display!==void 0?t.display:!0,this.disabled=t.disabled!==void 0?t.disabled:!1,this.mandatory=t.mandatory!==void 0?t.mandatory:!1,this.placeholder=t.placeholder!==void 0?t.placeholder:!1,this.class=t.class||"",this.style=t.style||"",this.data=t.data||{}}}class Oy{constructor(t,n){this.selectType="single",this.data=[],this.selectType=t,this.setData(n)}validateDataArray(t){if(!Array.isArray(t))return new Error("Data must be an array");for(let n of t)if(n instanceof Lt||"label"in n){if(!("label"in n))return new Error("Optgroup must have a label");if("options"in n&&n.options)for(let r of n.options)return this.validateOption(r)}else return n instanceof He||"text"in n?this.validateOption(n):new Error("Data object must be a valid optgroup or option");return null}validateOption(t){return"text"in t?null:new Error("Option must have a text")}partialToFullData(t){let n=[];return t.forEach(r=>{if(r instanceof Lt||"label"in r){let s=[];"options"in r&&r.options&&r.options.forEach(l=>{s.push(new He(l))}),s.length>0&&n.push(new Lt(r))}(r instanceof He||"text"in r)&&n.push(new He(r))}),n}setData(t){this.data=this.partialToFullData(t),this.selectType==="single"&&this.setSelectedBy("value",this.getSelected())}getData(){return this.filter(null,!0)}getDataOptions(){return this.filter(null,!1)}addOption(t){this.setData(this.getData().concat(new He(t)))}setSelectedBy(t,n){let r=null,s=!1;for(let l of this.data){if(l instanceof Lt)for(let i of l.options)r||(r=i),i.selected=s?!1:n.includes(i[t]),i.selected&&this.selectType==="single"&&(s=!0);l instanceof He&&(r||(r=l),l.selected=s?!1:n.includes(l[t]),l.selected&&this.selectType==="single"&&(s=!0))}this.selectType==="single"&&r&&!s&&(r.selected=!0)}getSelected(){let t=this.getSelectedOptions(),n=[];return t.forEach(r=>{n.push(r.value)}),n}getSelectedOptions(){return this.filter(t=>t.selected,!1)}getSelectedIDs(){let t=this.getSelectedOptions(),n=[];return t.forEach(r=>{n.push(r.id)}),n}getOptgroupByID(t){for(let n of this.data)if(n instanceof Lt&&n.id===t)return n;return null}getOptionByID(t){let n=this.filter(r=>r.id===t,!1);return n.length?n[0]:null}getSelectType(){return this.selectType}getFirstOption(){let t=null;for(let n of this.data)if(n instanceof Lt?t=n.options[0]:n instanceof He&&(t=n),t)break;return t}search(t,n){return t=t.trim(),t===""?this.getData():this.filter(r=>n(r,t),!0)}filter(t,n){const r=[];return this.data.forEach(s=>{if(s instanceof Lt){let l=[];if(s.options.forEach(i=>{(!t||t(i))&&(n?l.push(new He(i)):r.push(new He(i)))}),l.length>0){let i=new Lt(s);i.options=l,r.push(i)}}s instanceof He&&(!t||t(s))&&r.push(new He(s))}),r}}class Py{constructor(t,n,r){this.classes={main:"ss-main",placeholder:"ss-placeholder",values:"ss-values",single:"ss-single",max:"ss-max",value:"ss-value",valueText:"ss-value-text",valueDelete:"ss-value-delete",valueOut:"ss-value-out",deselect:"ss-deselect",deselectPath:"M10,10 L90,90 M10,90 L90,10",arrow:"ss-arrow",arrowClose:"M10,30 L50,70 L90,30",arrowOpen:"M10,70 L50,30 L90,70",content:"ss-content",openAbove:"ss-open-above",openBelow:"ss-open-below",search:"ss-search",searchHighlighter:"ss-search-highlight",searching:"ss-searching",addable:"ss-addable",addablePath:"M50,10 L50,90 M10,50 L90,50",list:"ss-list",optgroup:"ss-optgroup",optgroupLabel:"ss-optgroup-label",optgroupLabelText:"ss-optgroup-label-text",optgroupActions:"ss-optgroup-actions",optgroupSelectAll:"ss-selectall",optgroupSelectAllBox:"M60,10 L10,10 L10,90 L90,90 L90,50",optgroupSelectAllCheck:"M30,45 L50,70 L90,10",optgroupClosable:"ss-closable",option:"ss-option",optionDelete:"M10,10 L90,90 M10,90 L90,10",highlighted:"ss-highlighted",open:"ss-open",close:"ss-close",selected:"ss-selected",error:"ss-error",disabled:"ss-disabled",hide:"ss-hide"},this.store=n,this.settings=t,this.callbacks=r,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes(),this.settings.contentLocation.appendChild(this.content.main)}enable(){this.main.main.classList.remove(this.classes.disabled),this.content.search.input.disabled=!1}disable(){this.main.main.classList.add(this.classes.disabled),this.content.search.input.disabled=!0}open(){this.main.arrow.path.setAttribute("d",this.classes.arrowOpen),this.main.main.classList.add(this.settings.openPosition==="up"?this.classes.openAbove:this.classes.openBelow),this.main.main.setAttribute("aria-expanded","true"),this.moveContent();const t=this.store.getSelectedOptions();if(t.length){const n=t[t.length-1].id,r=this.content.list.querySelector('[data-id="'+n+'"]');r&&this.ensureElementInView(this.content.list,r)}}close(){this.main.main.classList.remove(this.classes.openAbove),this.main.main.classList.remove(this.classes.openBelow),this.main.main.setAttribute("aria-expanded","false"),this.content.main.classList.remove(this.classes.openAbove),this.content.main.classList.remove(this.classes.openBelow),this.main.arrow.path.setAttribute("d",this.classes.arrowClose)}updateClassStyles(){if(this.main.main.className="",this.main.main.removeAttribute("style"),this.content.main.className="",this.content.main.removeAttribute("style"),this.main.main.classList.add(this.classes.main),this.content.main.classList.add(this.classes.content),this.settings.style!==""&&(this.main.main.style.cssText=this.settings.style,this.content.main.style.cssText=this.settings.style),this.settings.class.length)for(const t of this.settings.class)t.trim()!==""&&(this.main.main.classList.add(t.trim()),this.content.main.classList.add(t.trim()));this.settings.contentPosition==="relative"&&this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){this.main.main.role="combobox",this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.main.id),this.main.main.setAttribute("aria-expanded","false"),this.content.main.setAttribute("role","listbox")}mainDiv(){var a;const t=document.createElement("div");t.dataset.id=this.settings.id,t.setAttribute("aria-label",this.settings.ariaLabel),t.tabIndex=0,t.onkeydown=c=>{switch(c.key){case"ArrowUp":case"ArrowDown":return this.callbacks.open(),c.key==="ArrowDown"?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Enter":case" ":this.callbacks.open();const d=this.content.list.querySelector("."+this.classes.highlighted);return d&&d.click(),!1;case"Escape":return this.callbacks.close(),!1}return!1},t.onclick=c=>{this.settings.disabled||(this.settings.isOpen?this.callbacks.close():this.callbacks.open())};const n=document.createElement("div");n.classList.add(this.classes.values),t.appendChild(n);const r=document.createElement("div");r.classList.add(this.classes.deselect);const s=(a=this.store)==null?void 0:a.getSelectedOptions();!this.settings.allowDeselect||this.settings.isMultiple&&s&&s.length<=0?r.classList.add(this.classes.hide):r.classList.remove(this.classes.hide),r.onclick=c=>{if(c.stopPropagation(),this.settings.disabled)return;let d=!0;const p=this.store.getSelectedOptions(),w=[];if(this.callbacks.beforeChange&&(d=this.callbacks.beforeChange(w,p)===!0),d){if(this.settings.isMultiple)this.callbacks.setSelected([],!1),this.updateDeselectAll();else{const x=this.store.getFirstOption(),_=x?x.value:"";this.callbacks.setSelected(_,!1)}this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(this.store.getSelectedOptions())}};const l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.setAttribute("viewBox","0 0 100 100");const i=document.createElementNS("http://www.w3.org/2000/svg","path");i.setAttribute("d",this.classes.deselectPath),l.appendChild(i),r.appendChild(l),t.appendChild(r);const o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.classList.add(this.classes.arrow),o.setAttribute("viewBox","0 0 100 100");const u=document.createElementNS("http://www.w3.org/2000/svg","path");return u.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&o.classList.add(this.classes.hide),o.appendChild(u),t.appendChild(o),{main:t,values:n,deselect:{main:r,svg:l,path:i},arrow:{main:o,path:u}}}mainFocus(t){t!=="click"&&this.main.main.focus({preventScroll:!0})}placeholder(){const t=this.store.filter(s=>s.placeholder,!1);let n=this.settings.placeholderText;t.length&&(t[0].html!==""?n=t[0].html:t[0].text!==""&&(n=t[0].text));const r=document.createElement("div");return r.classList.add(this.classes.placeholder),r.innerHTML=n,r}renderValues(){if(!this.settings.isMultiple){this.renderSingleValue();return}this.renderMultipleValues(),this.updateDeselectAll()}renderSingleValue(){const t=this.store.filter(r=>r.selected&&!r.placeholder,!1),n=t.length>0?t[0]:null;if(!n)this.main.values.innerHTML=this.placeholder().outerHTML;else{const r=document.createElement("div");r.classList.add(this.classes.single),n.html?r.innerHTML=n.html:r.innerText=n.text,this.main.values.innerHTML=r.outerHTML}!this.settings.allowDeselect||!t.length?this.main.deselect.main.classList.add(this.classes.hide):this.main.deselect.main.classList.remove(this.classes.hide)}renderMultipleValues(){let t=this.main.values.childNodes,n=this.store.filter(s=>s.selected&&s.display,!1);if(n.length===0){this.main.values.innerHTML=this.placeholder().outerHTML;return}else{const s=this.main.values.querySelector("."+this.classes.placeholder);s&&s.remove()}if(n.length>this.settings.maxValuesShown){const s=document.createElement("div");s.classList.add(this.classes.max),s.textContent=this.settings.maxValuesMessage.replace("{number}",n.length.toString()),this.main.values.innerHTML=s.outerHTML;return}else{const s=this.main.values.querySelector("."+this.classes.max);s&&s.remove()}let r=[];for(let s=0;su.id===i,!1).length||r.push(l))}for(const s of r)s.classList.add(this.classes.valueOut),setTimeout(()=>{this.main.values.hasChildNodes()&&this.main.values.contains(s)&&this.main.values.removeChild(s)},100);t=this.main.values.childNodes;for(let s=0;s{if(o.preventDefault(),o.stopPropagation(),this.settings.disabled)return;let u=!0;const a=this.store.getSelectedOptions(),c=a.filter(d=>d.selected&&d.id!==t.id,!0);if(!(this.settings.minSelected&&c.length{this.callbacks.search(l.target.value)},100),n.onkeydown=l=>{switch(l.key){case"ArrowUp":case"ArrowDown":return l.key==="ArrowDown"?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Escape":return this.callbacks.close(),!1;case"Enter":case" ":if(this.callbacks.addable&&l.ctrlKey)return r.click(),!1;{const i=this.content.list.querySelector("."+this.classes.highlighted);if(i)return i.click(),!1}return!0}return!0},t.appendChild(n),this.callbacks.addable){r.classList.add(this.classes.addable);const l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.setAttribute("viewBox","0 0 100 100");const i=document.createElementNS("http://www.w3.org/2000/svg","path");i.setAttribute("d",this.classes.addablePath),l.appendChild(i),r.appendChild(l),r.onclick=o=>{if(o.preventDefault(),o.stopPropagation(),!this.callbacks.addable)return;const u=this.content.search.input.value.trim();if(u===""){this.content.search.input.focus();return}const a=d=>{let p=new He(d);if(this.callbacks.addOption(p),this.settings.isMultiple){let w=this.store.getSelected();w.push(p.value),this.callbacks.setSelected(w,!0)}else this.callbacks.setSelected([p.value],!0);this.callbacks.search(""),this.settings.closeOnSelect&&setTimeout(()=>{this.callbacks.close()},100)},c=this.callbacks.addable(u);c===!1||c===void 0||c===null||(c instanceof Promise?c.then(d=>{a(typeof d=="string"?{text:d,value:d}:d)}):a(typeof c=="string"?{text:c,value:c}:c))},t.appendChild(r),s.addable={main:r,svg:l,path:i}}return s}searchFocus(){this.content.search.input.focus()}getOptions(t=!1,n=!1,r=!1){let s="."+this.classes.option;return t&&(s+=":not(."+this.classes.placeholder+")"),n&&(s+=":not(."+this.classes.disabled+")"),r&&(s+=":not(."+this.classes.hide+")"),Array.from(this.content.list.querySelectorAll(s))}highlight(t){const n=this.getOptions(!0,!0,!0);if(n.length===0)return;if(n.length===1&&!n[0].classList.contains(this.classes.highlighted)){n[0].classList.add(this.classes.highlighted);return}let r=!1;for(const s of n)s.classList.contains(this.classes.highlighted)&&(r=!0);if(!r){for(const s of n)if(s.classList.contains(this.classes.selected)){s.classList.add(this.classes.highlighted);break}}for(let s=0;s=0?s-1:n.length-1];o.classList.add(this.classes.highlighted),this.ensureElementInView(this.content.list,o);const u=o.parentElement;if(u&&u.classList.contains(this.classes.close)){const a=u.querySelector("."+this.classes.optgroupLabel);a&&a.click()}return}n[t==="down"?0:n.length-1].classList.add(this.classes.highlighted),this.ensureElementInView(this.content.list,n[t==="down"?0:n.length-1])}listDiv(){const t=document.createElement("div");return t.classList.add(this.classes.list),t}renderError(t){this.content.list.innerHTML="";const n=document.createElement("div");n.classList.add(this.classes.error),n.textContent=t,this.content.list.appendChild(n)}renderSearching(){this.content.list.innerHTML="";const t=document.createElement("div");t.classList.add(this.classes.searching),t.textContent=this.settings.searchingText,this.content.list.appendChild(t)}renderOptions(t){if(this.content.list.innerHTML="",t.length===0){const n=document.createElement("div");n.classList.add(this.classes.search),n.innerHTML=this.settings.searchText,this.content.list.appendChild(n);return}for(const n of t){if(n instanceof Lt){const r=document.createElement("div");r.classList.add(this.classes.optgroup);const s=document.createElement("div");s.classList.add(this.classes.optgroupLabel),r.appendChild(s);const l=document.createElement("div");l.classList.add(this.classes.optgroupLabelText),l.textContent=n.label,s.appendChild(l);const i=document.createElement("div");if(i.classList.add(this.classes.optgroupActions),s.appendChild(i),this.settings.isMultiple&&n.selectAll){const o=document.createElement("div");o.classList.add(this.classes.optgroupSelectAll);let u=!0;for(const w of n.options)if(!w.selected){u=!1;break}u&&o.classList.add(this.classes.selected);const a=document.createElement("span");a.textContent=n.selectAllText,o.appendChild(a);const c=document.createElementNS("http://www.w3.org/2000/svg","svg");c.setAttribute("viewBox","0 0 100 100"),o.appendChild(c);const d=document.createElementNS("http://www.w3.org/2000/svg","path");d.setAttribute("d",this.classes.optgroupSelectAllBox),c.appendChild(d);const p=document.createElementNS("http://www.w3.org/2000/svg","path");p.setAttribute("d",this.classes.optgroupSelectAllCheck),c.appendChild(p),o.addEventListener("click",w=>{w.preventDefault(),w.stopPropagation();const x=this.store.getSelected();if(u){const _=x.filter(L=>{for(const m of n.options)if(L===m.value)return!1;return!0});this.callbacks.setSelected(_,!0);return}else{const _=x.concat(n.options.map(L=>L.value));for(const L of n.options)this.store.getOptionByID(L.id)||this.callbacks.addOption(L);this.callbacks.setSelected(_,!0);return}}),i.appendChild(o)}if(n.closable!=="off"){const o=document.createElement("div");o.classList.add(this.classes.optgroupClosable);const u=document.createElementNS("http://www.w3.org/2000/svg","svg");u.setAttribute("viewBox","0 0 100 100"),u.classList.add(this.classes.arrow),o.appendChild(u);const a=document.createElementNS("http://www.w3.org/2000/svg","path");u.appendChild(a),n.options.some(c=>c.selected)||this.content.search.input.value.trim()!==""?(o.classList.add(this.classes.open),a.setAttribute("d",this.classes.arrowOpen)):n.closable==="open"?(r.classList.add(this.classes.open),a.setAttribute("d",this.classes.arrowOpen)):n.closable==="close"&&(r.classList.add(this.classes.close),a.setAttribute("d",this.classes.arrowClose)),s.addEventListener("click",c=>{c.preventDefault(),c.stopPropagation(),r.classList.contains(this.classes.close)?(r.classList.remove(this.classes.close),r.classList.add(this.classes.open),a.setAttribute("d",this.classes.arrowOpen)):(r.classList.remove(this.classes.open),r.classList.add(this.classes.close),a.setAttribute("d",this.classes.arrowClose))}),i.appendChild(o)}r.appendChild(s);for(const o of n.options)r.appendChild(this.option(o));this.content.list.appendChild(r)}n instanceof He&&this.content.list.appendChild(this.option(n))}}option(t){if(t.placeholder){const r=document.createElement("div");return r.classList.add(this.classes.option),r.classList.add(this.classes.hide),r}const n=document.createElement("div");return n.dataset.id=t.id,n.id=t.id,n.classList.add(this.classes.option),n.setAttribute("role","option"),t.class&&t.class.split(" ").forEach(r=>{n.classList.add(r)}),t.style&&(n.style.cssText=t.style),this.settings.searchHighlight&&this.content.search.input.value.trim()!==""?n.innerHTML=this.highlightText(t.html!==""?t.html:t.text,this.content.search.input.value,this.classes.searchHighlighter):t.html!==""?n.innerHTML=t.html:n.textContent=t.text,this.settings.showOptionTooltips&&n.textContent&&n.setAttribute("title",n.textContent),t.display||n.classList.add(this.classes.hide),t.disabled&&n.classList.add(this.classes.disabled),t.selected&&this.settings.hideSelected&&n.classList.add(this.classes.hide),t.selected?(n.classList.add(this.classes.selected),n.setAttribute("aria-selected","true"),this.main.main.setAttribute("aria-activedescendant",n.id)):(n.classList.remove(this.classes.selected),n.setAttribute("aria-selected","false")),n.addEventListener("click",r=>{r.preventDefault(),r.stopPropagation();const s=this.store.getSelected(),l=r.currentTarget,i=String(l.dataset.id);if(t.disabled||t.selected&&!this.settings.allowDeselect||this.settings.isMultiple&&this.settings.maxSelected<=s.length&&!t.selected||this.settings.isMultiple&&this.settings.minSelected>=s.length&&t.selected)return;let o=!1;const u=this.store.getSelectedOptions();let a=[];this.settings.isMultiple&&(t.selected?a=u.filter(c=>c.id!==i):a=u.concat(t)),this.settings.isMultiple||(t.selected?a=[]:a=[t]),this.callbacks.beforeChange||(o=!0),this.callbacks.beforeChange&&(this.callbacks.beforeChange(a,u)===!1?o=!1:o=!0),o&&(this.store.getOptionByID(i)||this.callbacks.addOption(t),this.callbacks.setSelected(a.map(c=>c.value),!1),this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(a))}),n}destroy(){this.main.main.remove(),this.content.main.remove()}highlightText(t,n,r){let s=t;const l=new RegExp("("+n.trim()+")(?![^<]*>[^<>]*${u}`),s}moveContentAbove(){const t=this.main.main.offsetHeight,n=this.content.main.offsetHeight;this.main.main.classList.remove(this.classes.openBelow),this.main.main.classList.add(this.classes.openAbove),this.content.main.classList.remove(this.classes.openBelow),this.content.main.classList.add(this.classes.openAbove);const r=this.main.main.getBoundingClientRect();this.content.main.style.margin="-"+(t+n-1)+"px 0px 0px 0px",this.content.main.style.top=r.top+r.height+window.scrollY+"px",this.content.main.style.left=r.left+window.scrollX+"px",this.content.main.style.width=r.width+"px"}moveContentBelow(){this.main.main.classList.remove(this.classes.openAbove),this.main.main.classList.add(this.classes.openBelow),this.content.main.classList.remove(this.classes.openAbove),this.content.main.classList.add(this.classes.openBelow);const t=this.main.main.getBoundingClientRect();this.content.main.style.margin="-1px 0px 0px 0px",this.settings.contentPosition!=="relative"&&(this.content.main.style.top=t.top+t.height+window.scrollY+"px",this.content.main.style.left=t.left+window.scrollX+"px",this.content.main.style.width=t.width+"px")}ensureElementInView(t,n){const r=t.scrollTop+t.offsetTop,s=r+t.clientHeight,l=n.offsetTop,i=l+n.clientHeight;ls&&(t.scrollTop+=i-s)}putContent(){const t=this.main.main.offsetHeight,n=this.main.main.getBoundingClientRect(),r=this.content.main.offsetHeight;return window.innerHeight-(n.top+t)<=r&&n.top>r?"up":"down"}updateDeselectAll(){if(!this.store||!this.settings)return;const t=this.store.getSelectedOptions(),n=t&&t.length>0,r=this.settings.isMultiple,s=this.settings.allowDeselect,l=this.main.deselect.main,i=this.classes.hide;s&&!(r&&!n)?l.classList.remove(i):l.classList.add(i)}}class Ly{constructor(t){this.listen=!1,this.observer=null,this.select=t,this.valueChange=this.valueChange.bind(this),this.select.addEventListener("change",this.valueChange,{passive:!0}),this.observer=new MutationObserver(this.observeCall.bind(this)),this.changeListen(!0)}enable(){this.select.disabled=!1}disable(){this.select.disabled=!0}hideUI(){this.select.tabIndex=-1,this.select.style.display="none",this.select.setAttribute("aria-hidden","true")}showUI(){this.select.removeAttribute("tabindex"),this.select.style.display="",this.select.removeAttribute("aria-hidden")}changeListen(t){this.listen=t,t&&this.observer&&this.observer.observe(this.select,{subtree:!0,childList:!0,attributes:!0}),t||this.observer&&this.observer.disconnect()}valueChange(t){return this.listen&&this.onValueChange&&this.onValueChange(this.getSelectedValues()),!0}observeCall(t){if(!this.listen)return;let n=!1,r=!1,s=!1;for(const l of t)l.target===this.select&&(l.attributeName==="disabled"&&(r=!0),l.attributeName==="class"&&(n=!0)),(l.target.nodeName==="OPTGROUP"||l.target.nodeName==="OPTION")&&(s=!0);n&&this.onClassChange&&this.onClassChange(this.select.className.split(" ")),r&&this.onDisabledChange&&(this.changeListen(!1),this.onDisabledChange(this.select.disabled),this.changeListen(!0)),s&&this.onOptionsChange&&(this.changeListen(!1),this.onOptionsChange(this.getData()),this.changeListen(!0))}getData(){let t=[];const n=this.select.childNodes;for(const r of n)r.nodeName==="OPTGROUP"&&t.push(this.getDataFromOptgroup(r)),r.nodeName==="OPTION"&&t.push(this.getDataFromOption(r));return t}getDataFromOptgroup(t){let n={id:t.id,label:t.label,selectAll:t.dataset?t.dataset.selectall==="true":!1,selectAllText:t.dataset?t.dataset.selectalltext:"Select all",closable:t.dataset?t.dataset.closable:"off",options:[]};const r=t.childNodes;for(const s of r)s.nodeName==="OPTION"&&n.options.push(this.getDataFromOption(s));return n}getDataFromOption(t){return{id:t.id,value:t.value,text:t.text,html:t.dataset&&t.dataset.html?t.dataset.html:"",selected:t.selected,display:t.style.display!=="none",disabled:t.disabled,mandatory:t.dataset?t.dataset.mandatory==="true":!1,placeholder:t.dataset.placeholder==="true",class:t.className,style:t.style.cssText,data:t.dataset}}getSelectedValues(){let t=[];const n=this.select.childNodes;for(const r of n){if(r.nodeName==="OPTGROUP"){const s=r.childNodes;for(const l of s)if(l.nodeName==="OPTION"){const i=l;i.selected&&t.push(i.value)}}if(r.nodeName==="OPTION"){const s=r;s.selected&&t.push(s.value)}}return t}setSelected(t){this.changeListen(!1);const n=this.select.childNodes;for(const r of n){if(r.nodeName==="OPTGROUP"){const l=r.childNodes;for(const i of l)if(i.nodeName==="OPTION"){const o=i;o.selected=t.includes(o.value)}}if(r.nodeName==="OPTION"){const s=r;s.selected=t.includes(s.value)}}this.changeListen(!0)}updateSelect(t,n,r){this.changeListen(!1),t&&(this.select.dataset.id=t),n&&(this.select.style.cssText=n),r&&(this.select.className="",r.forEach(s=>{s.trim()!==""&&this.select.classList.add(s.trim())})),this.changeListen(!0)}updateOptions(t){this.changeListen(!1),this.select.innerHTML="";for(const n of t)n instanceof Lt&&this.select.appendChild(this.createOptgroup(n)),n instanceof He&&this.select.appendChild(this.createOption(n));this.select.dispatchEvent(new Event("change")),this.changeListen(!0)}createOptgroup(t){const n=document.createElement("optgroup");if(n.id=t.id,n.label=t.label,t.selectAll&&(n.dataset.selectAll="true"),t.closable!=="off"&&(n.dataset.closable=t.closable),t.options)for(const r of t.options)n.appendChild(this.createOption(r));return n}createOption(t){const n=document.createElement("option");return n.id=t.id,n.value=t.value,n.innerHTML=t.text,t.html!==""&&n.setAttribute("data-html",t.html),t.selected&&(n.selected=t.selected),t.disabled&&(n.disabled=!0),t.display===!1&&(n.style.display="none"),t.placeholder&&n.setAttribute("data-placeholder","true"),t.mandatory&&n.setAttribute("data-mandatory","true"),t.class&&t.class.split(" ").forEach(r=>{n.classList.add(r)}),t.data&&typeof t.data=="object"&&Object.keys(t.data).forEach(r=>{n.setAttribute("data-"+Ay(r),t.data[r])}),n}destroy(){this.changeListen(!1),this.select.removeEventListener("change",this.valueChange),this.observer&&(this.observer.disconnect(),this.observer=null),delete this.select.dataset.id,this.showUI()}}class Ty{constructor(t){this.id="",this.style="",this.class=[],this.isMultiple=!1,this.isOpen=!1,this.isFullOpen=!1,this.intervalMove=null,t||(t={}),this.id="ss-"+wa(),this.style=t.style||"",this.class=t.class||[],this.disabled=t.disabled!==void 0?t.disabled:!1,this.alwaysOpen=t.alwaysOpen!==void 0?t.alwaysOpen:!1,this.showSearch=t.showSearch!==void 0?t.showSearch:!0,this.ariaLabel=t.ariaLabel||"Combobox",this.searchPlaceholder=t.searchPlaceholder||"Search",this.searchText=t.searchText||"No Results",this.searchingText=t.searchingText||"Searching...",this.searchHighlight=t.searchHighlight!==void 0?t.searchHighlight:!1,this.closeOnSelect=t.closeOnSelect!==void 0?t.closeOnSelect:!0,this.contentLocation=t.contentLocation||document.body,this.contentPosition=t.contentPosition||"absolute",this.openPosition=t.openPosition||"auto",this.placeholderText=t.placeholderText!==void 0?t.placeholderText:"Select Value",this.allowDeselect=t.allowDeselect!==void 0?t.allowDeselect:!1,this.hideSelected=t.hideSelected!==void 0?t.hideSelected:!1,this.keepOrder=t.keepOrder!==void 0?t.keepOrder:!1,this.showOptionTooltips=t.showOptionTooltips!==void 0?t.showOptionTooltips:!1,this.minSelected=t.minSelected||0,this.maxSelected=t.maxSelected||1e3,this.timeoutDelay=t.timeoutDelay||200,this.maxValuesShown=t.maxValuesShown||20,this.maxValuesMessage=t.maxValuesMessage||"{number} selected"}}let zh=class{constructor(t){var i;if(this.events={search:void 0,searchFilter:(o,u)=>o.text.toLowerCase().indexOf(u.toLowerCase())!==-1,addable:void 0,beforeChange:void 0,afterChange:void 0,beforeOpen:void 0,afterOpen:void 0,beforeClose:void 0,afterClose:void 0},this.windowResize=Cs(()=>{!this.settings.isOpen&&!this.settings.isFullOpen||this.render.moveContent()}),this.windowScroll=Cs(()=>{!this.settings.isOpen&&!this.settings.isFullOpen||this.render.moveContent()}),this.documentClick=o=>{this.settings.isOpen&&o.target&&!ky(o.target,this.settings.id)&&this.close(o.type)},this.windowVisibilityChange=()=>{document.hidden&&this.close()},this.selectEl=typeof t.select=="string"?document.querySelector(t.select):t.select,!this.selectEl){t.events&&t.events.error&&t.events.error(new Error("Could not find select element"));return}if(this.selectEl.tagName!=="SELECT"){t.events&&t.events.error&&t.events.error(new Error("Element isnt of type select"));return}this.selectEl.dataset.ssid&&this.destroy(),this.settings=new Ty(t.settings);const n=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const o in t.events)t.events.hasOwnProperty(o)&&(n.indexOf(o)!==-1?this.events[o]=Cs(t.events[o],100):this.events[o]=t.events[o]);this.settings.disabled=(i=t.settings)!=null&&i.disabled?t.settings.disabled:this.selectEl.disabled,this.settings.isMultiple=this.selectEl.multiple,this.settings.style=this.selectEl.style.cssText,this.settings.class=this.selectEl.className.split(" "),this.select=new Ly(this.selectEl),this.select.updateSelect(this.settings.id,this.settings.style,this.settings.class),this.select.hideUI(),this.select.onValueChange=o=>{this.setSelected(o)},this.select.onClassChange=o=>{this.settings.class=o,this.render.updateClassStyles()},this.select.onDisabledChange=o=>{o?this.disable():this.enable()},this.select.onOptionsChange=o=>{this.setData(o)},this.store=new Oy(this.settings.isMultiple?"multiple":"single",t.data?t.data:this.select.getData()),t.data&&this.select.updateOptions(this.store.getData());const r={open:this.open.bind(this),close:this.close.bind(this),addable:this.events.addable?this.events.addable:void 0,setSelected:this.setSelected.bind(this),addOption:this.addOption.bind(this),search:this.search.bind(this),beforeChange:this.events.beforeChange,afterChange:this.events.afterChange};this.render=new Py(this.settings,this.store,r),this.render.renderValues(),this.render.renderOptions(this.store.getData());const s=this.selectEl.getAttribute("aria-label"),l=this.selectEl.getAttribute("aria-labelledby");s?this.render.main.main.setAttribute("aria-label",s):l&&this.render.main.main.setAttribute("aria-labelledby",l),this.selectEl.parentNode&&this.selectEl.parentNode.insertBefore(this.render.main.main,this.selectEl.nextSibling),window.addEventListener("resize",this.windowResize,!1),this.settings.openPosition==="auto"&&window.addEventListener("scroll",this.windowScroll,!1),document.addEventListener("visibilitychange",this.windowVisibilityChange),this.settings.disabled&&this.disable(),this.settings.alwaysOpen&&this.open(),this.selectEl.slim=this}enable(){this.settings.disabled=!1,this.select.enable(),this.render.enable()}disable(){this.settings.disabled=!0,this.select.disable(),this.render.disable()}getData(){return this.store.getData()}setData(t){const n=this.store.getSelected(),r=this.store.validateDataArray(t);if(r){this.events.error&&this.events.error(r);return}this.store.setData(t);const s=this.store.getData();this.select.updateOptions(s),this.render.renderValues(),this.render.renderOptions(s),this.events.afterChange&&!po(n,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){return this.store.getSelected()}setSelected(t,n=!0){const r=this.store.getSelected();this.store.setSelectedBy("value",Array.isArray(t)?t:[t]);const s=this.store.getData();this.select.updateOptions(s),this.render.renderValues(),this.render.content.search.input.value!==""?this.search(this.render.content.search.input.value):this.render.renderOptions(s),n&&this.events.afterChange&&!po(r,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}addOption(t){const n=this.store.getSelected();this.store.getDataOptions().some(s=>s.value===(t.value??t.text))||this.store.addOption(t);const r=this.store.getData();this.select.updateOptions(r),this.render.renderValues(),this.render.renderOptions(r),this.events.afterChange&&!po(n,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}open(){this.settings.disabled||this.settings.isOpen||(this.events.beforeOpen&&this.events.beforeOpen(),this.render.open(),this.settings.showSearch&&this.render.searchFocus(),this.settings.isOpen=!0,setTimeout(()=>{this.events.afterOpen&&this.events.afterOpen(),this.settings.isOpen&&(this.settings.isFullOpen=!0),document.addEventListener("click",this.documentClick)},this.settings.timeoutDelay),this.settings.contentPosition==="absolute"&&(this.settings.intervalMove&&clearInterval(this.settings.intervalMove),this.settings.intervalMove=setInterval(this.render.moveContent.bind(this.render),500)))}close(t=null){!this.settings.isOpen||this.settings.alwaysOpen||(this.events.beforeClose&&this.events.beforeClose(),this.render.close(),this.render.content.search.input.value!==""&&this.search(""),this.render.mainFocus(t),this.settings.isOpen=!1,this.settings.isFullOpen=!1,setTimeout(()=>{this.events.afterClose&&this.events.afterClose(),document.removeEventListener("click",this.documentClick)},this.settings.timeoutDelay),this.settings.intervalMove&&clearInterval(this.settings.intervalMove))}search(t){if(this.render.content.search.input.value!==t&&(this.render.content.search.input.value=t),!this.events.search){this.render.renderOptions(t===""?this.store.getData():this.store.search(t,this.events.searchFilter));return}this.render.renderSearching();const n=this.events.search(t,this.store.getSelectedOptions());if(n instanceof Promise){n.then(r=>{this.render.renderOptions(this.store.partialToFullData(r))}).catch(r=>{this.render.renderError(typeof r=="string"?r:r.message)});return}else Array.isArray(n)?this.render.renderOptions(this.store.partialToFullData(n)):this.render.renderError("Search event must return a promise or an array of data")}destroy(){document.removeEventListener("click",this.documentClick),window.removeEventListener("resize",this.windowResize,!1),this.settings.openPosition==="auto"&&window.removeEventListener("scroll",this.windowScroll,!1),document.removeEventListener("visibilitychange",this.windowVisibilityChange),this.store.setData([]),this.render.destroy(),this.select.destroy()}};const Ry="CWYDT23U",Ny="slimselectjscom",My=Mi({__name:"carbonad",setup(e){const t=Gd(null);let n=!1;return ah(()=>{if(!n){n=!0;const r=document.createElement("script");r.id="_carbonads_js",r.src=`//cdn.carbonads.com/carbon.js?serve=${Ry}&placement=${Ny}`,r.async=!0,t.value&&t.value.appendChild(r)}}),(r,s)=>(Di(),Eh("div",{class:"carbon-container",ref_key:"container",ref:t},null,512))}}),Iy=Mi({name:"App",components:{CarbonAd:My},data(){return{nav:null,navDebounce:Cs(()=>{this.setDemensions()},100),year:new Date().getFullYear(),width:0,height:0,navData:[{text:"Home",value:"/",class:"label"},{label:"Install",closable:"close",options:[{text:"npm",value:"install#npm"},{text:"cdn",value:"install#cdn"},{text:"download",value:"install#download"}]},{label:"Selects",closable:"close",options:[{text:"single",value:"selects#single"},{text:"multiple",value:"selects#multiple"}]},{label:"Data",closable:"close",options:[{text:"types",value:"data#types"},{text:"field",value:"data#field"}]},{label:"Settings",closable:"close",options:[{text:"select",value:"settings#select"},{text:"alwaysOpen",value:"settings#alwaysOpen"},{text:"contentLocation",value:"settings#contentLocation"},{text:"contentPosition",value:"settings#contentPosition"},{text:"openPosition",value:"settings#openPosition"},{text:"placeholder",value:"settings#placeholder"},{text:"selectAll",value:"settings#selectAll"},{text:"allowDeselect",value:"settings#allowDeselect"},{text:"display",value:"settings#display"},{text:"disabled",value:"settings#disabled"},{text:"mandatory",value:"settings#mandatory"},{text:"minmax",value:"settings#minmax"},{text:"dataAttributes",value:"settings#dataAttributes"},{text:"cssClass",value:"settings#cssClass"},{text:"inlineStyles",value:"settings#inlineStyles"},{text:"html",value:"settings#html"},{text:"keepOrder",value:"settings#keepOrder"},{text:"search",value:"settings#search"},{text:"closeOnSelect",value:"settings#closeOnSelect"},{text:"showOptionTooltips",value:"settings#showOptionTooltips"},{text:"closable",value:"settings#closable"},{text:"hideSelected",value:"settings#hideSelected"},{text:"maxValuesShown",value:"settings#maxValuesShown"}]},{label:"Events",closable:"close",options:[{text:"error",value:"events#error"},{text:"beforeChange",value:"events#beforeChange"},{text:"afterChange",value:"events#afterChange"},{text:"open",value:"events#open"},{text:"search",value:"events#search"},{text:"searchFilter",value:"events#searchFilter"},{text:"addable",value:"events#addable"}]},{label:"Methods",closable:"close",options:[{text:"getSelected",value:"methods#getSelected"},{text:"setSelected",value:"methods#setSelected"},{text:"getData",value:"methods#getData"},{text:"setData",value:"methods#setData"},{text:"enableDisable",value:"methods#enableDisable"},{text:"openClose",value:"methods#openClose"},{text:"search",value:"methods#search"},{text:"destroy",value:"methods#destroy"}]},{label:"Frameworks",closable:"close",options:[{text:"vue",value:"vue"},{text:"react",value:"react"}]}]}},mounted(){this.runNav(),this.$router.isReady().then(()=>{this.nav&&this.nav.setSelected(this.$router.currentRoute.value.fullPath.replace("/",""))}),this.$router.afterEach(()=>{if(this.$route.query.p){setTimeout(()=>{this.$route.query.p&&this.$router.push({path:this.$route.query.p.toString(),hash:this.$route.hash})},200);return}setTimeout(()=>{const e=this.$route.hash;if(e===""&&window.scroll({top:0,behavior:"smooth"}),e){const t=document.querySelector(e);if(t){const n=document.querySelector("header"),r=document.querySelector("nav"),s=n?n.clientHeight+(window.innerWidth<700?r.clientHeight:0)+8:0;window.scroll({top:t.offsetTop-s,behavior:"smooth"})}}},200)}),this.setDemensions(),window.addEventListener("resize",this.navDebounce)},unmounted(){var e;window.removeEventListener("resize",this.navDebounce),(e=this.nav)==null||e.destroy()},watch:{width(){this.runNav()}},methods:{setDemensions(){this.width=document.documentElement.clientWidth,this.height=document.documentElement.clientHeight},runNav(){this.nav&&(this.nav.destroy(),this.nav=null);let e={searchHighlight:!0,openContent:"below"};this.width>700&&(e.alwaysOpen=!0,e.contentPosition="relative",e.contentLocation=this.$refs.navContent),this.nav=new zh({select:this.$refs.nav,data:this.navData,settings:e,events:{afterChange:t=>{const r=t[0].value.split("#"),s=r[0],l=r[1]?"#"+r[1]:void 0;this.$router.push({path:s,hash:l})}}})}}}),Fy="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpFNTE3OEEyRTk5QTAxMUUyOUExNUJDMTA0NkE4OTA0RCIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpFNTE3OEEyRjk5QTAxMUUyOUExNUJDMTA0NkE4OTA0RCI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkU1MTc4QTJDOTlBMDExRTI5QTE1QkMxMDQ2QTg5MDREIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkU1MTc4QTJEOTlBMDExRTI5QTE1QkMxMDQ2QTg5MDREIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+FYrpWAAABrNJREFUeNrkW2lsVFUUvjMWirYUkS5BXApUa2vd6gL+wAWjoP5RiW2EUBajAiqSuPADQ0w1UUQTrcFAUUSJEKriEuMWFKuJIElFSS24YNpQK6WoBbuAktbva880M8O8vnfevJm+CSf5cme599xzvnfffffce17AJFjycnLzUVwDXAgUAucBY4BMIEOqdQIdwJ/Az4J64OvWtoONibQvkACHgyiuBe4CbgLOjVNlE/AZsAmoBSE9viQAjueieBCYC5yVoAvWDKwHqkBEmy8IgON09lHgXmCESY4cBaqBlSCieUgIgOPDUCwBngBOM0MjXdL/CyDiv6QRAOcvR7EBKDL+kD3AbJBQl1AC4DjrLwaeBYYbf8m/ciu+BCJ6PScAzp+K4nXgTuNveQuYAxK6PSMAzo9C8TFwtUkN2Q7cDBIOx02AOP8FUGpSSzgf3GBHQsDGec7unwOTTWrKDiGhS02ATHjvALeb1JZ3gRlWE+MpVq0yMzIekRk/1YWP6o7Ors5vHI8AXH1Odl8BaTbKrwd4j10MTAduS8JqkKvA94BPgN0A56htNm2OMyDDKNhuSwCcT5dIrMBG6S4oLI1qezqKBcBjwGiPHW8HVgCr0W97VL/fobjMpv2vQAnaHgv/MdYVXurAeSNPhggRw56BQatRVgL3A0H5+xDwI8Dw9g/5Hlq+clmdDYwF8iV0zpb/GP2tApZHOx4m2xwQUCC+VVqOABg+AUUDkO6AgHkwaL2DJXORxPVNylUnw+gpXObaLXFRlxHoaw7U8uoXQ99vViNgqUPnKQfsKojhdW7GuxDW5JUtIuni432hH4JhLJ7Dq6qwcZiPZnpNXDJPfI0kQEJbjVM5PiIgW3nhlkQQILH9LGWnV/iIAK0ts8TngREwDchVKrnKRwRobckVnwcIKFcq4ONrkY8IWBT2SHUq5eEE3Khs/CRm6Z1+8V5sqVQ26/M5gHuhSJ79TqUFmIhOj/ppwQ8/Rshqb5yiWXFQFhsaWeU352UU0KaXlc2mBI1+Y3OzjyO/Gm2kSAIKFQ2awfQ+v3oP23gL/K5oUhh0GPiEZG8KxP97FHULgsqwtTUFCDioqHsGCRipaHA8BQjQrAcyg4roj5KVAgSMUtRNDyqVj0wBAlQ2koBuRf3xKUBAvqJuN1eCrYpAiHNAltNjpyFYDfL47oix38wdmDA5AvYr+kjzWRgcLVcqnKfsJwGNyk5u9TEBtyjrNwaVgRClTPKA/Db8aVOZslkDG2nD2vEuOkqGlLmYpHcGJLlJu8LjtvJFgx06Jvnq8xC33gUBeUE4waWjduua5wdVPrr6VS6cr6PvoXv5Ixed3g3mH/fB1V9OW1w07fM5IEouUEZR4bIWWJzsTRJ55r8I3ONSRRFs3hsIU8hkgkkulf0CPAx8qElQcuk4beYp9Epgoks138LOvqSPgfyAzIwMZlnFSobgIegc4H3gH6AkxmKDub9Mjb0DeoYDrZ1dne0eO14AvfPx8RXgAYaycahbBvt+GLgFpIM0md3PjqrMTMxpYKxB6p1v+s/n7bbSuMCqldmZyc+fRh9ND+IsAxrmG3C3qtj0J1uP84hLrnwnwJbjEQRIxzw0XB2jER93C9Bog9TjsRgzLpzuJr0BzHV6e8gwf9XoziqdCv1YE/oSTQBHwfem/3w+5syPxuukLtfdO0zk+WIs+YuPKLQ7ohzyWTIix3joPPMTLg1d/Yg5gIL7ogf32U/4WGGhYDr+34J6bUALPpPA62w6XYMOP9BaCv3HoD/PeJubODN6U/eEq4cKTIurttpBAZ4L+87TmKdtOt0ah8FbPXS+WnyLEKskqUy5FaweM5dA2e6w+pNkZuajhfMD3/zYBfDKb3Y6+cWwgytOL7bh98nQ73BEgHReIvd4Roy/a6Cs3CRYJOnq7zjV8HWcybC33mpLLKZIA84FPRYhcSokUNL2Civnjd0MjoZbUCy0+PtNkDDD5wQsFB8sxWm2+GJZd8eSt4HnZXnZ66Nb4CHYYxuxat4XmI1inbHeczskq77DMrK4z8AgK3+Q/L5EEMBn/PzQos0zAsQgvg5XY3TpNKOTSAD3NsrQX63TBqq9PVHM9NgvfXi/06ZSjfNqAoQEHj9Pled+pw8cpw2co6aKbSoJxDlJnYniKdP/sqSVrrEw7IBL/TnG+rSXEy7fYVoG/S1uffDkzVEYypB1qewJRCdb5rp9yxN6mQDZFmOS2wisCIXo8Yin7w7LiKiQEcFYfhOMnBmnzo1CLIO09Qyt47niJxDQ29trTmY56Qn4X4ABAFR7IoDmVT5NAAAAAElFTkSuQmCC",Dy="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACAAQMAAAD58POIAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZQTFRFyzg3////IltC9QAAAAFiS0dEAf8CLd4AAAAJcEhZcwAACxMAAAsTAQCanBgAAAAkSURBVEjHY2AYBYMV/IeDUQG4AJgeFRgVGBUYFSBNYBQMPgAARjtdvxo6xaMAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTEtMDUtMzBUMjM6MTA6NDQtMDc6MDCm4GvfAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDEwLTEyLTA2VDEyOjIwOjEyLTA4OjAwpIGEmQAAADJ0RVh0UE5HOmNIUk0AY2h1bmsgd2FzIGZvdW5kIChzZWUgQ2hyb21hdGljaXR5LCBhYm92ZSkH0UjaAAAAKXRFWHRQTkc6Z0FNQQBnYW1tYT0wLjQ1NDU1IChTZWUgR2FtbWEsIGFib3ZlKRISLKcAAAAUdEVYdFBORzpJSERSLmJpdF9kZXB0aAA4KYV+UAAAABV0RVh0UE5HOklIRFIuY29sb3JfdHlwZQA2BkqnKwAAABt0RVh0UE5HOklIRFIuaW50ZXJsYWNlX21ldGhvZAAw+zsHjAAAABx0RVh0UE5HOklIRFIud2lkdGgsaGVpZ2h0ADE2LCAxNjjVBg0AAAAodEVYdFBORzpwSFlzAHhfcmVzPTI4MzUsIHlfcmVzPTI4MzUsIHVuaXRzPTGCKXI+AAAAKHRFWHRQTkc6c1JHQgBpbnRlbnQ9MCAoU2VlIFJlbmRlcmluZyBpbnRlbnQp8hEU9QAAAABJRU5ErkJggg==",by=(e,t)=>{const n=e.__vccOpts||e;for(const[r,s]of t)n[r]=s;return n},jy=Fv('

Slim Select 2.0

Advanced select dropdown
',1),zy={ref:"nav"},By={class:"nav-content",ref:"navContent"},Uy=rn("a",{href:"http://webiswhatido.com",style:{color:"#ffffff"},target:"_blank"},"Brian Voelker",-1),Vy=rn("br",null,null,-1);function Hy(e,t,n,r,s,l){const i=Lc("CarbonAd"),o=Lc("router-view");return Di(),Eh(yt,null,[jy,rn("nav",null,[rn("select",zy,null,512),rn("div",By,null,512),be(i)]),rn("main",null,[be(o),rn("footer",null,[Fl(" © "+hg(e.year)+" ",1),Uy,Fl(". "),Vy,Fl(" Slim Select is under the MIT license. ")])])],64)}const $y=by(Iy,[["render",Hy]]);var pf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Sa(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Bh={exports:{}};(function(e){var t=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};/** + */const mr=typeof window<"u";function x0(e){return e.__esModule||e[Symbol.toStringTag]==="Module"}const ce=Object.assign;function co(e,t){const n={};for(const r in t){const s=t[r];n[r]=jt(s)?s.map(e):e(s)}return n}const Es=()=>{},jt=Array.isArray,E0=/\/$/,_0=e=>e.replace(E0,"");function fo(e,t,n="/"){let r,s={},l="",i="";const o=t.indexOf("#");let a=t.indexOf("?");return o=0&&(a=-1),a>-1&&(r=t.slice(0,a),l=t.slice(a+1,o>-1?o:t.length),s=e(l)),o>-1&&(r=r||t.slice(0,o),i=t.slice(o,t.length)),r=O0(r??t,n),{fullPath:r+(l&&"?")+l+i,path:r,query:s,hash:i}}function C0(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function Jc(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function k0(e,t,n){const r=t.matched.length-1,s=n.matched.length-1;return r>-1&&r===s&&Hr(t.matched[r],n.matched[s])&&Ph(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function Hr(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function Ph(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(!A0(e[n],t[n]))return!1;return!0}function A0(e,t){return jt(e)?Xc(e,t):jt(t)?Xc(t,e):e===t}function Xc(e,t){return jt(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function O0(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),r=e.split("/"),s=r[r.length-1];(s===".."||s===".")&&r.push("");let l=n.length-1,i,o;for(i=0;i1&&l--;else break;return n.slice(0,l).join("/")+"/"+r.slice(i-(i===r.length?1:0)).join("/")}var js;(function(e){e.pop="pop",e.push="push"})(js||(js={}));var _s;(function(e){e.back="back",e.forward="forward",e.unknown=""})(_s||(_s={}));function P0(e){if(!e)if(mr){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),_0(e)}const L0=/^[^#]+#/;function T0(e,t){return e.replace(L0,"#")+t}function R0(e,t){const n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect();return{behavior:t.behavior,left:r.left-n.left-(t.left||0),top:r.top-n.top-(t.top||0)}}const zi=()=>({left:window.pageXOffset,top:window.pageYOffset});function N0(e){let t;if("el"in e){const n=e.el,r=typeof n=="string"&&n.startsWith("#"),s=typeof n=="string"?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!s)return;t=R0(s,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.pageXOffset,t.top!=null?t.top:window.pageYOffset)}function qc(e,t){return(history.state?history.state.position-t:-1)+e}const ta=new Map;function M0(e,t){ta.set(e,t)}function F0(e){const t=ta.get(e);return ta.delete(e),t}let I0=()=>location.protocol+"//"+location.host;function Lh(e,t){const{pathname:n,search:r,hash:s}=t,l=e.indexOf("#");if(l>-1){let o=s.includes(e.slice(l))?e.slice(l).length:1,a=s.slice(o);return a[0]!=="/"&&(a="/"+a),Jc(a,"")}return Jc(n,e)+r+s}function D0(e,t,n,r){let s=[],l=[],i=null;const o=({state:p})=>{const w=Lh(e,location),x=n.value,_=t.value;let L=0;if(p){if(n.value=w,t.value=p,i&&i===x){i=null;return}L=_?p.position-_.position:0}else r(w);s.forEach(m=>{m(n.value,x,{delta:L,type:js.pop,direction:L?L>0?_s.forward:_s.back:_s.unknown})})};function a(){i=n.value}function u(p){s.push(p);const w=()=>{const x=s.indexOf(p);x>-1&&s.splice(x,1)};return l.push(w),w}function c(){const{history:p}=window;p.state&&p.replaceState(ce({},p.state,{scroll:zi()}),"")}function d(){for(const p of l)p();l=[],window.removeEventListener("popstate",o),window.removeEventListener("beforeunload",c)}return window.addEventListener("popstate",o),window.addEventListener("beforeunload",c,{passive:!0}),{pauseListeners:a,listen:u,destroy:d}}function ef(e,t,n,r=!1,s=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:s?zi():null}}function b0(e){const{history:t,location:n}=window,r={value:Lh(e,n)},s={value:t.state};s.value||l(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function l(a,u,c){const d=e.indexOf("#"),p=d>-1?(n.host&&document.querySelector("base")?e:e.slice(d))+a:I0()+e+a;try{t[c?"replaceState":"pushState"](u,"",p),s.value=u}catch(w){console.error(w),n[c?"replace":"assign"](p)}}function i(a,u){const c=ce({},t.state,ef(s.value.back,a,s.value.forward,!0),u,{position:s.value.position});l(a,c,!0),r.value=a}function o(a,u){const c=ce({},s.value,t.state,{forward:a,scroll:zi()});l(c.current,c,!0);const d=ce({},ef(r.value,a,null),{position:c.position+1},u);l(a,d,!1),r.value=a}return{location:r,state:s,push:o,replace:i}}function j0(e){e=P0(e);const t=b0(e),n=D0(e,t.state,t.location,t.replace);function r(l,i=!0){i||n.pauseListeners(),history.go(l)}const s=ce({location:"",base:e,go:r,createHref:T0.bind(null,e)},t,n);return Object.defineProperty(s,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(s,"state",{enumerable:!0,get:()=>t.state.value}),s}function z0(e){return typeof e=="string"||e&&typeof e=="object"}function Th(e){return typeof e=="string"||typeof e=="symbol"}const vn={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0},Rh=Symbol("");var tf;(function(e){e[e.aborted=4]="aborted",e[e.cancelled=8]="cancelled",e[e.duplicated=16]="duplicated"})(tf||(tf={}));function $r(e,t){return ce(new Error,{type:e,[Rh]:!0},t)}function qt(e,t){return e instanceof Error&&Rh in e&&(t==null||!!(e.type&t))}const nf="[^/]+?",B0={sensitive:!1,strict:!1,start:!0,end:!0},U0=/[.+*?^${}()[\]/\\]/g;function V0(e,t){const n=ce({},B0,t),r=[];let s=n.start?"^":"";const l=[];for(const u of e){const c=u.length?[]:[90];n.strict&&!u.length&&(s+="/");for(let d=0;dt.length?t.length===1&&t[0]===80?1:-1:0}function $0(e,t){let n=0;const r=e.score,s=t.score;for(;n0&&t[t.length-1]<0}const W0={type:0,value:""},Q0=/[a-zA-Z0-9_]/;function K0(e){if(!e)return[[]];if(e==="/")return[[W0]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(w){throw new Error(`ERR (${n})/"${u}": ${w}`)}let n=0,r=n;const s=[];let l;function i(){l&&s.push(l),l=[]}let o=0,a,u="",c="";function d(){u&&(n===0?l.push({type:0,value:u}):n===1||n===2||n===3?(l.length>1&&(a==="*"||a==="+")&&t(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),l.push({type:1,value:u,regexp:c,repeatable:a==="*"||a==="+",optional:a==="*"||a==="?"})):t("Invalid state to consume buffer"),u="")}function p(){u+=a}for(;o{i(f)}:Es}function i(c){if(Th(c)){const d=r.get(c);d&&(r.delete(c),n.splice(n.indexOf(d),1),d.children.forEach(i),d.alias.forEach(i))}else{const d=n.indexOf(c);d>-1&&(n.splice(d,1),c.record.name&&r.delete(c.record.name),c.children.forEach(i),c.alias.forEach(i))}}function o(){return n}function a(c){let d=0;for(;d=0&&(c.record.path!==n[d].record.path||!Nh(c,n[d]));)d++;n.splice(d,0,c),c.record.name&&!lf(c)&&r.set(c.record.name,c)}function u(c,d){let p,w={},x,_;if("name"in c&&c.name){if(p=r.get(c.name),!p)throw $r(1,{location:c});_=p.record.name,w=ce(sf(d.params,p.keys.filter(f=>!f.optional).map(f=>f.name)),c.params&&sf(c.params,p.keys.map(f=>f.name))),x=p.stringify(w)}else if("path"in c)x=c.path,p=n.find(f=>f.re.test(x)),p&&(w=p.parse(x),_=p.record.name);else{if(p=d.name?r.get(d.name):n.find(f=>f.re.test(d.path)),!p)throw $r(1,{location:c,currentLocation:d});_=p.record.name,w=ce({},d.params,c.params),x=p.stringify(w)}const L=[];let m=p;for(;m;)L.unshift(m.record),m=m.parent;return{name:_,path:x,params:w,matched:L,meta:X0(L)}}return e.forEach(c=>l(c)),{addRoute:l,resolve:u,removeRoute:i,getRoutes:o,getRecordMatcher:s}}function sf(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function Z0(e){return{path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:void 0,beforeEnter:e.beforeEnter,props:J0(e),children:e.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in e?e.components||null:e.component&&{default:e.component}}}function J0(e){const t={},n=e.props||!1;if("component"in e)t.default=n;else for(const r in e.components)t[r]=typeof n=="object"?n[r]:n;return t}function lf(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function X0(e){return e.reduce((t,n)=>ce(t,n.meta),{})}function of(e,t){const n={};for(const r in e)n[r]=r in t?t[r]:e[r];return n}function Nh(e,t){return t.children.some(n=>n===e||Nh(e,n))}const Mh=/#/g,q0=/&/g,ey=/\//g,ty=/=/g,ny=/\?/g,Fh=/\+/g,ry=/%5B/g,sy=/%5D/g,Ih=/%5E/g,ly=/%60/g,Dh=/%7B/g,iy=/%7C/g,bh=/%7D/g,oy=/%20/g;function vu(e){return encodeURI(""+e).replace(iy,"|").replace(ry,"[").replace(sy,"]")}function ay(e){return vu(e).replace(Dh,"{").replace(bh,"}").replace(Ih,"^")}function na(e){return vu(e).replace(Fh,"%2B").replace(oy,"+").replace(Mh,"%23").replace(q0,"%26").replace(ly,"`").replace(Dh,"{").replace(bh,"}").replace(Ih,"^")}function uy(e){return na(e).replace(ty,"%3D")}function cy(e){return vu(e).replace(Mh,"%23").replace(ny,"%3F")}function fy(e){return e==null?"":cy(e).replace(ey,"%2F")}function ei(e){try{return decodeURIComponent(""+e)}catch{}return""+e}function dy(e){const t={};if(e===""||e==="?")return t;const r=(e[0]==="?"?e.slice(1):e).split("&");for(let s=0;sl&&na(l)):[r&&na(r)]).forEach(l=>{l!==void 0&&(t+=(t.length?"&":"")+n,l!=null&&(t+="="+l))})}return t}function hy(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=jt(r)?r.map(s=>s==null?null:""+s):r==null?r:""+r)}return t}const py=Symbol(""),uf=Symbol(""),yu=Symbol(""),jh=Symbol(""),ra=Symbol("");function ls(){let e=[];function t(r){return e.push(r),()=>{const s=e.indexOf(r);s>-1&&e.splice(s,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function xn(e,t,n,r,s){const l=r&&(r.enterCallbacks[s]=r.enterCallbacks[s]||[]);return()=>new Promise((i,o)=>{const a=d=>{d===!1?o($r(4,{from:n,to:t})):d instanceof Error?o(d):z0(d)?o($r(2,{from:t,to:d})):(l&&r.enterCallbacks[s]===l&&typeof d=="function"&&l.push(d),i())},u=e.call(r&&r.instances[s],t,n,a);let c=Promise.resolve(u);e.length<3&&(c=c.then(a)),c.catch(d=>o(d))})}function ho(e,t,n,r){const s=[];for(const l of e)for(const i in l.components){let o=l.components[i];if(!(t!=="beforeRouteEnter"&&!l.instances[i]))if(my(o)){const u=(o.__vccOpts||o)[t];u&&s.push(xn(u,n,r,l,i))}else{let a=o();s.push(()=>a.then(u=>{if(!u)return Promise.reject(new Error(`Couldn't resolve component "${i}" at "${l.path}"`));const c=x0(u)?u.default:u;l.components[i]=c;const p=(c.__vccOpts||c)[t];return p&&xn(p,n,r,l,i)()}))}}return s}function my(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function cf(e){const t=an(yu),n=an(jh),r=Mt(()=>t.resolve(Nr(e.to))),s=Mt(()=>{const{matched:a}=r.value,{length:u}=a,c=a[u-1],d=n.matched;if(!c||!d.length)return-1;const p=d.findIndex(Hr.bind(null,c));if(p>-1)return p;const w=ff(a[u-2]);return u>1&&ff(c)===w&&d[d.length-1].path!==w?d.findIndex(Hr.bind(null,a[u-2])):p}),l=Mt(()=>s.value>-1&&wy(n.params,r.value.params)),i=Mt(()=>s.value>-1&&s.value===n.matched.length-1&&Ph(n.params,r.value.params));function o(a={}){return yy(a)?t[Nr(e.replace)?"replace":"push"](Nr(e.to)).catch(Es):Promise.resolve()}return{route:r,href:Mt(()=>r.value.href),isActive:l,isExactActive:i,navigate:o}}const gy=Mi({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"}},useLink:cf,setup(e,{slots:t}){const n=Ti(cf(e)),{options:r}=an(yu),s=Mt(()=>({[df(e.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[df(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const l=t.default&&t.default(n);return e.custom?l:Oh("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:s.value},l)}}}),vy=gy;function yy(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){const t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function wy(e,t){for(const n in t){const r=t[n],s=e[n];if(typeof r=="string"){if(r!==s)return!1}else if(!jt(s)||s.length!==r.length||r.some((l,i)=>l!==s[i]))return!1}return!0}function ff(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const df=(e,t,n)=>e??t??n,Sy=Mi({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const r=an(ra),s=Mt(()=>e.route||r.value),l=an(uf,0),i=Mt(()=>{let u=Nr(l);const{matched:c}=s.value;let d;for(;(d=c[u])&&!d.components;)u++;return u}),o=Mt(()=>s.value.matched[i.value]);Nl(uf,Mt(()=>i.value+1)),Nl(py,o),Nl(ra,s);const a=Gd();return Rl(()=>[a.value,o.value,e.name],([u,c,d],[p,w,x])=>{c&&(c.instances[d]=u,w&&w!==c&&u&&u===p&&(c.leaveGuards.size||(c.leaveGuards=w.leaveGuards),c.updateGuards.size||(c.updateGuards=w.updateGuards))),u&&c&&(!w||!Hr(c,w)||!p)&&(c.enterCallbacks[d]||[]).forEach(_=>_(u))},{flush:"post"}),()=>{const u=s.value,c=e.name,d=o.value,p=d&&d.components[c];if(!p)return hf(n.default,{Component:p,route:u});const w=d.props[c],x=w?w===!0?u.params:typeof w=="function"?w(u):w:null,L=Oh(p,ce({},x,t,{onVnodeUnmounted:m=>{m.component.isUnmounted&&(d.instances[c]=null)},ref:a}));return hf(n.default,{Component:L,route:u})||L}}});function hf(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const xy=Sy;function Ey(e){const t=Y0(e.routes,e),n=e.parseQuery||dy,r=e.stringifyQuery||af,s=e.history,l=ls(),i=ls(),o=ls(),a=Dg(vn);let u=vn;mr&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=co.bind(null,A=>""+A),d=co.bind(null,fy),p=co.bind(null,ei);function w(A,V){let b,Q;return Th(A)?(b=t.getRecordMatcher(A),Q=V):Q=A,t.addRoute(Q,b)}function x(A){const V=t.getRecordMatcher(A);V&&t.removeRoute(V)}function _(){return t.getRoutes().map(A=>A.record)}function L(A){return!!t.getRecordMatcher(A)}function m(A,V){if(V=ce({},V||a.value),typeof A=="string"){const E=fo(n,A,V.path),O=t.resolve({path:E.path},V),T=s.createHref(E.fullPath);return ce(E,O,{params:p(O.params),hash:ei(E.hash),redirectedFrom:void 0,href:T})}let b;if("path"in A)b=ce({},A,{path:fo(n,A.path,V.path).path});else{const E=ce({},A.params);for(const O in E)E[O]==null&&delete E[O];b=ce({},A,{params:d(E)}),V.params=d(V.params)}const Q=t.resolve(b,V),le=A.hash||"";Q.params=c(p(Q.params));const g=C0(r,ce({},A,{hash:ay(le),path:Q.path})),v=s.createHref(g);return ce({fullPath:g,hash:le,query:r===af?hy(A.query):A.query||{}},Q,{redirectedFrom:void 0,href:v})}function f(A){return typeof A=="string"?fo(n,A,a.value.path):ce({},A)}function h(A,V){if(u!==A)return $r(8,{from:V,to:A})}function y(A){return k(A)}function S(A){return y(ce(f(A),{replace:!0}))}function C(A){const V=A.matched[A.matched.length-1];if(V&&V.redirect){const{redirect:b}=V;let Q=typeof b=="function"?b(A):b;return typeof Q=="string"&&(Q=Q.includes("?")||Q.includes("#")?Q=f(Q):{path:Q},Q.params={}),ce({query:A.query,hash:A.hash,params:"path"in Q?{}:A.params},Q)}}function k(A,V){const b=u=m(A),Q=a.value,le=A.state,g=A.force,v=A.replace===!0,E=C(b);if(E)return k(ce(f(E),{state:typeof E=="object"?ce({},le,E.state):le,force:g,replace:v}),V||b);const O=b;O.redirectedFrom=V;let T;return!g&&k0(r,Q,b)&&(T=$r(16,{to:O,from:Q}),te(Q,Q,!0,!1)),(T?Promise.resolve(T):U(O,Q)).catch(N=>qt(N)?qt(N,2)?N:K(N):P(N,O,Q)).then(N=>{if(N){if(qt(N,2))return k(ce({replace:v},f(N.to),{state:typeof N.to=="object"?ce({},le,N.to.state):le,force:g}),V||O)}else N=ke(O,Q,!0,v,le);return ee(O,Q,N),N})}function R(A,V){const b=h(A,V);return b?Promise.reject(b):Promise.resolve()}function D(A){const V=xe.values().next().value;return V&&typeof V.runWithContext=="function"?V.runWithContext(A):A()}function U(A,V){let b;const[Q,le,g]=_y(A,V);b=ho(Q.reverse(),"beforeRouteLeave",A,V);for(const E of Q)E.leaveGuards.forEach(O=>{b.push(xn(O,A,V))});const v=R.bind(null,A,V);return b.push(v),ue(b).then(()=>{b=[];for(const E of l.list())b.push(xn(E,A,V));return b.push(v),ue(b)}).then(()=>{b=ho(le,"beforeRouteUpdate",A,V);for(const E of le)E.updateGuards.forEach(O=>{b.push(xn(O,A,V))});return b.push(v),ue(b)}).then(()=>{b=[];for(const E of g)if(E.beforeEnter)if(jt(E.beforeEnter))for(const O of E.beforeEnter)b.push(xn(O,A,V));else b.push(xn(E.beforeEnter,A,V));return b.push(v),ue(b)}).then(()=>(A.matched.forEach(E=>E.enterCallbacks={}),b=ho(g,"beforeRouteEnter",A,V),b.push(v),ue(b))).then(()=>{b=[];for(const E of i.list())b.push(xn(E,A,V));return b.push(v),ue(b)}).catch(E=>qt(E,8)?E:Promise.reject(E))}function ee(A,V,b){o.list().forEach(Q=>D(()=>Q(A,V,b)))}function ke(A,V,b,Q,le){const g=h(A,V);if(g)return g;const v=V===vn,E=mr?history.state:{};b&&(Q||v?s.replace(A.fullPath,ce({scroll:v&&E&&E.scroll},le)):s.push(A.fullPath,le)),a.value=A,te(A,V,b,v),K()}let Le;function At(){Le||(Le=s.listen((A,V,b)=>{if(!et.listening)return;const Q=m(A),le=C(Q);if(le){k(ce(le,{replace:!0}),Q).catch(Es);return}u=Q;const g=a.value;mr&&M0(qc(g.fullPath,b.delta),zi()),U(Q,g).catch(v=>qt(v,12)?v:qt(v,2)?(k(v.to,Q).then(E=>{qt(E,20)&&!b.delta&&b.type===js.pop&&s.go(-1,!1)}).catch(Es),Promise.reject()):(b.delta&&s.go(-b.delta,!1),P(v,Q,g))).then(v=>{v=v||ke(Q,g,!1),v&&(b.delta&&!qt(v,8)?s.go(-b.delta,!1):b.type===js.pop&&qt(v,20)&&s.go(-1,!1)),ee(Q,g,v)}).catch(Es)}))}let Bt=ls(),ge=ls(),se;function P(A,V,b){K(A);const Q=ge.list();return Q.length?Q.forEach(le=>le(A,V,b)):console.error(A),Promise.reject(A)}function W(){return se&&a.value!==vn?Promise.resolve():new Promise((A,V)=>{Bt.add([A,V])})}function K(A){return se||(se=!A,At(),Bt.list().forEach(([V,b])=>A?b(A):V()),Bt.reset()),A}function te(A,V,b,Q){const{scrollBehavior:le}=e;if(!mr||!le)return Promise.resolve();const g=!b&&F0(qc(A.fullPath,0))||(Q||!b)&&history.state&&history.state.scroll||null;return Xd().then(()=>le(A,V,g)).then(v=>v&&N0(v)).catch(v=>P(v,A,V))}const Z=A=>s.go(A);let ct;const xe=new Set,et={currentRoute:a,listening:!0,addRoute:w,removeRoute:x,hasRoute:L,getRoutes:_,resolve:m,options:e,push:y,replace:S,go:Z,back:()=>Z(-1),forward:()=>Z(1),beforeEach:l.add,beforeResolve:i.add,afterEach:o.add,onError:ge.add,isReady:W,install(A){const V=this;A.component("RouterLink",vy),A.component("RouterView",xy),A.config.globalProperties.$router=V,Object.defineProperty(A.config.globalProperties,"$route",{enumerable:!0,get:()=>Nr(a)}),mr&&!ct&&a.value===vn&&(ct=!0,y(s.location).catch(le=>{}));const b={};for(const le in vn)Object.defineProperty(b,le,{get:()=>a.value[le],enumerable:!0});A.provide(yu,V),A.provide(jh,Vd(b)),A.provide(ra,a);const Q=A.unmount;xe.add(A),A.unmount=function(){xe.delete(A),xe.size<1&&(u=vn,Le&&Le(),Le=null,a.value=vn,ct=!1,se=!1),Q()}}};function ue(A){return A.reduce((V,b)=>V.then(()=>D(b)),Promise.resolve())}return et}function _y(e,t){const n=[],r=[],s=[],l=Math.max(t.matched.length,e.matched.length);for(let i=0;iHr(u,o))?r.push(o):n.push(o));const a=e.matched[i];a&&(t.matched.find(u=>Hr(u,a))||s.push(a))}return[n,r,s]}const Cy=Ey({history:j0(),linkActiveClass:"active",routes:[{path:"/",name:"Home",component:()=>Xt(()=>import("./home.js"),__vite__mapDeps([0,1]))},{path:"/install",name:"Install",component:()=>Xt(()=>import("./install.js"),__vite__mapDeps([]))},{path:"/selects",name:"Selects",component:()=>Xt(()=>import("./selects.js"),__vite__mapDeps([]))},{path:"/data",name:"Data",component:()=>Xt(()=>import("./data.js"),__vite__mapDeps([]))},{path:"/settings",name:"Settings",component:()=>Xt(()=>import("./index2.js"),__vite__mapDeps([2,3]))},{path:"/events",name:"Events",component:()=>Xt(()=>import("./index3.js"),__vite__mapDeps([]))},{path:"/methods",name:"Methods",component:()=>Xt(()=>import("./index4.js"),__vite__mapDeps([]))},{path:"/vue",name:"Vue",component:()=>Xt(()=>import("./vue.js"),__vite__mapDeps([]))},{path:"/react",name:"React",component:()=>Xt(()=>import("./react.js"),__vite__mapDeps([]))}]});function wu(){return Math.random().toString(36).substring(2,10)}function ky(e,t){function n(s,l){return l&&s&&s.classList&&s.classList.contains(l)||l&&s&&s.dataset&&s.dataset.id&&s.dataset.id===t?s:null}function r(s,l){return!s||s===document?null:n(s,l)?s:r(s.parentNode,l)}return n(e,t)||r(e,t)}function Cs(e,t=50,n=!1){let r;return function(...s){const l=self,i=()=>{r=null,n||e.apply(l,s)},o=n&&!r;clearTimeout(r),r=setTimeout(i,t),o&&e.apply(l,s)}}function po(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Ay(e){const t=e.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,n=>"-"+n.toLowerCase());return e[0]===e[0].toUpperCase()?t.substring(1):t}class Lt{constructor(t){if(this.id=!t.id||t.id===""?wu():t.id,this.label=t.label||"",this.selectAll=t.selectAll===void 0?!1:t.selectAll,this.selectAllText=t.selectAllText||"Select All",this.closable=t.closable||"off",this.options=[],t.options)for(const n of t.options)this.options.push(new He(n))}}class He{constructor(t){this.id=!t.id||t.id===""?wu():t.id,this.value=t.value===void 0?t.text:t.value,this.text=t.text||"",this.html=t.html||"",this.selected=t.selected!==void 0?t.selected:!1,this.display=t.display!==void 0?t.display:!0,this.disabled=t.disabled!==void 0?t.disabled:!1,this.mandatory=t.mandatory!==void 0?t.mandatory:!1,this.placeholder=t.placeholder!==void 0?t.placeholder:!1,this.class=t.class||"",this.style=t.style||"",this.data=t.data||{}}}class Oy{constructor(t,n){this.selectType="single",this.data=[],this.selectType=t,this.setData(n)}validateDataArray(t){if(!Array.isArray(t))return new Error("Data must be an array");for(let n of t)if(n instanceof Lt||"label"in n){if(!("label"in n))return new Error("Optgroup must have a label");if("options"in n&&n.options)for(let r of n.options)return this.validateOption(r)}else return n instanceof He||"text"in n?this.validateOption(n):new Error("Data object must be a valid optgroup or option");return null}validateOption(t){return"text"in t?null:new Error("Option must have a text")}partialToFullData(t){let n=[];return t.forEach(r=>{if(r instanceof Lt||"label"in r){let s=[];"options"in r&&r.options&&r.options.forEach(l=>{s.push(new He(l))}),s.length>0&&n.push(new Lt(r))}(r instanceof He||"text"in r)&&n.push(new He(r))}),n}setData(t){this.data=this.partialToFullData(t),this.selectType==="single"&&this.setSelectedBy("id",this.getSelected())}getData(){return this.filter(null,!0)}getDataOptions(){return this.filter(null,!1)}addOption(t){this.setData(this.getData().concat(new He(t)))}setSelectedBy(t,n){let r=null,s=!1;for(let l of this.data){if(l instanceof Lt)for(let i of l.options)r||(r=i),i.selected=s?!1:n.includes(i[t]),i.selected&&this.selectType==="single"&&(s=!0);l instanceof He&&(r||(r=l),l.selected=s?!1:n.includes(l[t]),l.selected&&this.selectType==="single"&&(s=!0))}this.selectType==="single"&&r&&!s&&(r.selected=!0)}getSelected(){return this.getSelectedOptions().map(t=>t.id)}getSelectedOptions(){return this.filter(t=>t.selected,!1)}getOptgroupByID(t){for(let n of this.data)if(n instanceof Lt&&n.id===t)return n;return null}getOptionByID(t){let n=this.filter(r=>r.id===t,!1);return n.length?n[0]:null}getSelectType(){return this.selectType}getFirstOption(){let t=null;for(let n of this.data)if(n instanceof Lt?t=n.options[0]:n instanceof He&&(t=n),t)break;return t}search(t,n){return t=t.trim(),t===""?this.getData():this.filter(r=>n(r,t),!0)}filter(t,n){const r=[];return this.data.forEach(s=>{if(s instanceof Lt){let l=[];if(s.options.forEach(i=>{(!t||t(i))&&(n?l.push(new He(i)):r.push(new He(i)))}),l.length>0){let i=new Lt(s);i.options=l,r.push(i)}}s instanceof He&&(!t||t(s))&&r.push(new He(s))}),r}}class Py{constructor(t,n,r){this.classes={main:"ss-main",placeholder:"ss-placeholder",values:"ss-values",single:"ss-single",max:"ss-max",value:"ss-value",valueText:"ss-value-text",valueDelete:"ss-value-delete",valueOut:"ss-value-out",deselect:"ss-deselect",deselectPath:"M10,10 L90,90 M10,90 L90,10",arrow:"ss-arrow",arrowClose:"M10,30 L50,70 L90,30",arrowOpen:"M10,70 L50,30 L90,70",content:"ss-content",openAbove:"ss-open-above",openBelow:"ss-open-below",search:"ss-search",searchHighlighter:"ss-search-highlight",searching:"ss-searching",addable:"ss-addable",addablePath:"M50,10 L50,90 M10,50 L90,50",list:"ss-list",optgroup:"ss-optgroup",optgroupLabel:"ss-optgroup-label",optgroupLabelText:"ss-optgroup-label-text",optgroupActions:"ss-optgroup-actions",optgroupSelectAll:"ss-selectall",optgroupSelectAllBox:"M60,10 L10,10 L10,90 L90,90 L90,50",optgroupSelectAllCheck:"M30,45 L50,70 L90,10",optgroupClosable:"ss-closable",option:"ss-option",optionDelete:"M10,10 L90,90 M10,90 L90,10",highlighted:"ss-highlighted",open:"ss-open",close:"ss-close",selected:"ss-selected",error:"ss-error",disabled:"ss-disabled",hide:"ss-hide"},this.store=n,this.settings=t,this.callbacks=r,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes(),this.settings.contentLocation.appendChild(this.content.main)}enable(){this.main.main.classList.remove(this.classes.disabled),this.content.search.input.disabled=!1}disable(){this.main.main.classList.add(this.classes.disabled),this.content.search.input.disabled=!0}open(){this.main.arrow.path.setAttribute("d",this.classes.arrowOpen),this.main.main.classList.add(this.settings.openPosition==="up"?this.classes.openAbove:this.classes.openBelow),this.main.main.setAttribute("aria-expanded","true"),this.moveContent();const t=this.store.getSelectedOptions();if(t.length){const n=t[t.length-1].id,r=this.content.list.querySelector('[data-id="'+n+'"]');r&&this.ensureElementInView(this.content.list,r)}}close(){this.main.main.classList.remove(this.classes.openAbove),this.main.main.classList.remove(this.classes.openBelow),this.main.main.setAttribute("aria-expanded","false"),this.content.main.classList.remove(this.classes.openAbove),this.content.main.classList.remove(this.classes.openBelow),this.main.arrow.path.setAttribute("d",this.classes.arrowClose)}updateClassStyles(){if(this.main.main.className="",this.main.main.removeAttribute("style"),this.content.main.className="",this.content.main.removeAttribute("style"),this.main.main.classList.add(this.classes.main),this.content.main.classList.add(this.classes.content),this.settings.style!==""&&(this.main.main.style.cssText=this.settings.style,this.content.main.style.cssText=this.settings.style),this.settings.class.length)for(const t of this.settings.class)t.trim()!==""&&(this.main.main.classList.add(t.trim()),this.content.main.classList.add(t.trim()));this.settings.contentPosition==="relative"&&this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){this.main.main.role="combobox",this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.main.id),this.main.main.setAttribute("aria-expanded","false"),this.content.main.setAttribute("role","listbox")}mainDiv(){var u;const t=document.createElement("div");t.dataset.id=this.settings.id,t.setAttribute("aria-label",this.settings.ariaLabel),t.tabIndex=0,t.onkeydown=c=>{switch(c.key){case"ArrowUp":case"ArrowDown":return this.callbacks.open(),c.key==="ArrowDown"?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Enter":case" ":this.callbacks.open();const d=this.content.list.querySelector("."+this.classes.highlighted);return d&&d.click(),!1;case"Escape":return this.callbacks.close(),!1}return!1},t.onclick=c=>{this.settings.disabled||(this.settings.isOpen?this.callbacks.close():this.callbacks.open())};const n=document.createElement("div");n.classList.add(this.classes.values),t.appendChild(n);const r=document.createElement("div");r.classList.add(this.classes.deselect);const s=(u=this.store)==null?void 0:u.getSelectedOptions();!this.settings.allowDeselect||this.settings.isMultiple&&s&&s.length<=0?r.classList.add(this.classes.hide):r.classList.remove(this.classes.hide),r.onclick=c=>{if(c.stopPropagation(),this.settings.disabled)return;let d=!0;const p=this.store.getSelectedOptions(),w=[];if(this.callbacks.beforeChange&&(d=this.callbacks.beforeChange(w,p)===!0),d){if(this.settings.isMultiple)this.callbacks.setSelected([],!1),this.updateDeselectAll();else{const x=this.store.getFirstOption(),_=x?x.id:"";this.callbacks.setSelected(_,!1)}this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(this.store.getSelectedOptions())}};const l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.setAttribute("viewBox","0 0 100 100");const i=document.createElementNS("http://www.w3.org/2000/svg","path");i.setAttribute("d",this.classes.deselectPath),l.appendChild(i),r.appendChild(l),t.appendChild(r);const o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.classList.add(this.classes.arrow),o.setAttribute("viewBox","0 0 100 100");const a=document.createElementNS("http://www.w3.org/2000/svg","path");return a.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&o.classList.add(this.classes.hide),o.appendChild(a),t.appendChild(o),{main:t,values:n,deselect:{main:r,svg:l,path:i},arrow:{main:o,path:a}}}mainFocus(t){t!=="click"&&this.main.main.focus({preventScroll:!0})}placeholder(){const t=this.store.filter(s=>s.placeholder,!1);let n=this.settings.placeholderText;t.length&&(t[0].html!==""?n=t[0].html:t[0].text!==""&&(n=t[0].text));const r=document.createElement("div");return r.classList.add(this.classes.placeholder),r.innerHTML=n,r}renderValues(){if(!this.settings.isMultiple){this.renderSingleValue();return}this.renderMultipleValues(),this.updateDeselectAll()}renderSingleValue(){const t=this.store.filter(r=>r.selected&&!r.placeholder,!1),n=t.length>0?t[0]:null;if(!n)this.main.values.innerHTML=this.placeholder().outerHTML;else{const r=document.createElement("div");r.classList.add(this.classes.single),n.html?r.innerHTML=n.html:r.innerText=n.text,this.main.values.innerHTML=r.outerHTML}!this.settings.allowDeselect||!t.length?this.main.deselect.main.classList.add(this.classes.hide):this.main.deselect.main.classList.remove(this.classes.hide)}renderMultipleValues(){let t=this.main.values.childNodes,n=this.store.filter(s=>s.selected&&s.display,!1);if(n.length===0){this.main.values.innerHTML=this.placeholder().outerHTML;return}else{const s=this.main.values.querySelector("."+this.classes.placeholder);s&&s.remove()}if(n.length>this.settings.maxValuesShown){const s=document.createElement("div");s.classList.add(this.classes.max),s.textContent=this.settings.maxValuesMessage.replace("{number}",n.length.toString()),this.main.values.innerHTML=s.outerHTML;return}else{const s=this.main.values.querySelector("."+this.classes.max);s&&s.remove()}let r=[];for(let s=0;sa.id===i,!1).length||r.push(l))}for(const s of r)s.classList.add(this.classes.valueOut),setTimeout(()=>{this.main.values.hasChildNodes()&&this.main.values.contains(s)&&this.main.values.removeChild(s)},100);t=this.main.values.childNodes;for(let s=0;s{if(o.preventDefault(),o.stopPropagation(),this.settings.disabled)return;let a=!0;const u=this.store.getSelectedOptions(),c=u.filter(d=>d.selected&&d.id!==t.id,!0);if(!(this.settings.minSelected&&c.length{this.callbacks.search(l.target.value)},100),n.onkeydown=l=>{switch(l.key){case"ArrowUp":case"ArrowDown":return l.key==="ArrowDown"?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Escape":return this.callbacks.close(),!1;case"Enter":case" ":if(this.callbacks.addable&&l.ctrlKey)return r.click(),!1;{const i=this.content.list.querySelector("."+this.classes.highlighted);if(i)return i.click(),!1}return!0}return!0},t.appendChild(n),this.callbacks.addable){r.classList.add(this.classes.addable);const l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.setAttribute("viewBox","0 0 100 100");const i=document.createElementNS("http://www.w3.org/2000/svg","path");i.setAttribute("d",this.classes.addablePath),l.appendChild(i),r.appendChild(l),r.onclick=o=>{if(o.preventDefault(),o.stopPropagation(),!this.callbacks.addable)return;const a=this.content.search.input.value.trim();if(a===""){this.content.search.input.focus();return}const u=d=>{let p=new He(d);if(this.callbacks.addOption(p),this.settings.isMultiple){let w=this.store.getSelected();w.push(p.id),this.callbacks.setSelected(w,!0)}else this.callbacks.setSelected([p.id],!0);this.callbacks.search(""),this.settings.closeOnSelect&&setTimeout(()=>{this.callbacks.close()},100)},c=this.callbacks.addable(a);c===!1||c===void 0||c===null||(c instanceof Promise?c.then(d=>{u(typeof d=="string"?{text:d,value:d}:d)}):u(typeof c=="string"?{text:c,value:c}:c))},t.appendChild(r),s.addable={main:r,svg:l,path:i}}return s}searchFocus(){this.content.search.input.focus()}getOptions(t=!1,n=!1,r=!1){let s="."+this.classes.option;return t&&(s+=":not(."+this.classes.placeholder+")"),n&&(s+=":not(."+this.classes.disabled+")"),r&&(s+=":not(."+this.classes.hide+")"),Array.from(this.content.list.querySelectorAll(s))}highlight(t){const n=this.getOptions(!0,!0,!0);if(n.length===0)return;if(n.length===1&&!n[0].classList.contains(this.classes.highlighted)){n[0].classList.add(this.classes.highlighted);return}let r=!1;for(const s of n)s.classList.contains(this.classes.highlighted)&&(r=!0);if(!r){for(const s of n)if(s.classList.contains(this.classes.selected)){s.classList.add(this.classes.highlighted);break}}for(let s=0;s=0?s-1:n.length-1];o.classList.add(this.classes.highlighted),this.ensureElementInView(this.content.list,o);const a=o.parentElement;if(a&&a.classList.contains(this.classes.close)){const u=a.querySelector("."+this.classes.optgroupLabel);u&&u.click()}return}n[t==="down"?0:n.length-1].classList.add(this.classes.highlighted),this.ensureElementInView(this.content.list,n[t==="down"?0:n.length-1])}listDiv(){const t=document.createElement("div");return t.classList.add(this.classes.list),t}renderError(t){this.content.list.innerHTML="";const n=document.createElement("div");n.classList.add(this.classes.error),n.textContent=t,this.content.list.appendChild(n)}renderSearching(){this.content.list.innerHTML="";const t=document.createElement("div");t.classList.add(this.classes.searching),t.textContent=this.settings.searchingText,this.content.list.appendChild(t)}renderOptions(t){if(this.content.list.innerHTML="",t.length===0){const n=document.createElement("div");n.classList.add(this.classes.search),n.innerHTML=this.settings.searchText,this.content.list.appendChild(n);return}for(const n of t){if(n instanceof Lt){const r=document.createElement("div");r.classList.add(this.classes.optgroup);const s=document.createElement("div");s.classList.add(this.classes.optgroupLabel),r.appendChild(s);const l=document.createElement("div");l.classList.add(this.classes.optgroupLabelText),l.textContent=n.label,s.appendChild(l);const i=document.createElement("div");if(i.classList.add(this.classes.optgroupActions),s.appendChild(i),this.settings.isMultiple&&n.selectAll){const o=document.createElement("div");o.classList.add(this.classes.optgroupSelectAll);let a=!0;for(const w of n.options)if(!w.selected){a=!1;break}a&&o.classList.add(this.classes.selected);const u=document.createElement("span");u.textContent=n.selectAllText,o.appendChild(u);const c=document.createElementNS("http://www.w3.org/2000/svg","svg");c.setAttribute("viewBox","0 0 100 100"),o.appendChild(c);const d=document.createElementNS("http://www.w3.org/2000/svg","path");d.setAttribute("d",this.classes.optgroupSelectAllBox),c.appendChild(d);const p=document.createElementNS("http://www.w3.org/2000/svg","path");p.setAttribute("d",this.classes.optgroupSelectAllCheck),c.appendChild(p),o.addEventListener("click",w=>{w.preventDefault(),w.stopPropagation();const x=this.store.getSelected();if(a){const _=x.filter(L=>{for(const m of n.options)if(L===m.id)return!1;return!0});this.callbacks.setSelected(_,!0);return}else{const _=x.concat(n.options.map(L=>L.id));for(const L of n.options)this.store.getOptionByID(L.id)||this.callbacks.addOption(L);this.callbacks.setSelected(_,!0);return}}),i.appendChild(o)}if(n.closable!=="off"){const o=document.createElement("div");o.classList.add(this.classes.optgroupClosable);const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100"),a.classList.add(this.classes.arrow),o.appendChild(a);const u=document.createElementNS("http://www.w3.org/2000/svg","path");a.appendChild(u),n.options.some(c=>c.selected)||this.content.search.input.value.trim()!==""?(o.classList.add(this.classes.open),u.setAttribute("d",this.classes.arrowOpen)):n.closable==="open"?(r.classList.add(this.classes.open),u.setAttribute("d",this.classes.arrowOpen)):n.closable==="close"&&(r.classList.add(this.classes.close),u.setAttribute("d",this.classes.arrowClose)),s.addEventListener("click",c=>{c.preventDefault(),c.stopPropagation(),r.classList.contains(this.classes.close)?(r.classList.remove(this.classes.close),r.classList.add(this.classes.open),u.setAttribute("d",this.classes.arrowOpen)):(r.classList.remove(this.classes.open),r.classList.add(this.classes.close),u.setAttribute("d",this.classes.arrowClose))}),i.appendChild(o)}r.appendChild(s);for(const o of n.options)r.appendChild(this.option(o));this.content.list.appendChild(r)}n instanceof He&&this.content.list.appendChild(this.option(n))}}option(t){if(t.placeholder){const r=document.createElement("div");return r.classList.add(this.classes.option),r.classList.add(this.classes.hide),r}const n=document.createElement("div");return n.dataset.id=t.id,n.id=t.id,n.classList.add(this.classes.option),n.setAttribute("role","option"),t.class&&t.class.split(" ").forEach(r=>{n.classList.add(r)}),t.style&&(n.style.cssText=t.style),this.settings.searchHighlight&&this.content.search.input.value.trim()!==""?n.innerHTML=this.highlightText(t.html!==""?t.html:t.text,this.content.search.input.value,this.classes.searchHighlighter):t.html!==""?n.innerHTML=t.html:n.textContent=t.text,this.settings.showOptionTooltips&&n.textContent&&n.setAttribute("title",n.textContent),t.display||n.classList.add(this.classes.hide),t.disabled&&n.classList.add(this.classes.disabled),t.selected&&this.settings.hideSelected&&n.classList.add(this.classes.hide),t.selected?(n.classList.add(this.classes.selected),n.setAttribute("aria-selected","true"),this.main.main.setAttribute("aria-activedescendant",n.id)):(n.classList.remove(this.classes.selected),n.setAttribute("aria-selected","false")),n.addEventListener("click",r=>{r.preventDefault(),r.stopPropagation();const s=this.store.getSelected(),l=r.currentTarget,i=String(l.dataset.id);if(t.disabled||t.selected&&!this.settings.allowDeselect||this.settings.isMultiple&&this.settings.maxSelected<=s.length&&!t.selected||this.settings.isMultiple&&this.settings.minSelected>=s.length&&t.selected)return;let o=!1;const a=this.store.getSelectedOptions();let u=[];this.settings.isMultiple&&(t.selected?u=a.filter(c=>c.id!==i):u=a.concat(t)),this.settings.isMultiple||(t.selected?u=[]:u=[t]),this.callbacks.beforeChange||(o=!0),this.callbacks.beforeChange&&(this.callbacks.beforeChange(u,a)===!1?o=!1:o=!0),o&&(this.store.getOptionByID(i)||this.callbacks.addOption(t),this.callbacks.setSelected(u.map(c=>c.id),!1),this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(u))}),n}destroy(){this.main.main.remove(),this.content.main.remove()}highlightText(t,n,r){let s=t;const l=new RegExp("("+n.trim()+")(?![^<]*>[^<>]*${a}`),s}moveContentAbove(){const t=this.main.main.offsetHeight,n=this.content.main.offsetHeight;this.main.main.classList.remove(this.classes.openBelow),this.main.main.classList.add(this.classes.openAbove),this.content.main.classList.remove(this.classes.openBelow),this.content.main.classList.add(this.classes.openAbove);const r=this.main.main.getBoundingClientRect();this.content.main.style.margin="-"+(t+n-1)+"px 0px 0px 0px",this.content.main.style.top=r.top+r.height+window.scrollY+"px",this.content.main.style.left=r.left+window.scrollX+"px",this.content.main.style.width=r.width+"px"}moveContentBelow(){this.main.main.classList.remove(this.classes.openAbove),this.main.main.classList.add(this.classes.openBelow),this.content.main.classList.remove(this.classes.openAbove),this.content.main.classList.add(this.classes.openBelow);const t=this.main.main.getBoundingClientRect();this.content.main.style.margin="-1px 0px 0px 0px",this.settings.contentPosition!=="relative"&&(this.content.main.style.top=t.top+t.height+window.scrollY+"px",this.content.main.style.left=t.left+window.scrollX+"px",this.content.main.style.width=t.width+"px")}ensureElementInView(t,n){const r=t.scrollTop+t.offsetTop,s=r+t.clientHeight,l=n.offsetTop,i=l+n.clientHeight;ls&&(t.scrollTop+=i-s)}putContent(){const t=this.main.main.offsetHeight,n=this.main.main.getBoundingClientRect(),r=this.content.main.offsetHeight;return window.innerHeight-(n.top+t)<=r&&n.top>r?"up":"down"}updateDeselectAll(){if(!this.store||!this.settings)return;const t=this.store.getSelectedOptions(),n=t&&t.length>0,r=this.settings.isMultiple,s=this.settings.allowDeselect,l=this.main.deselect.main,i=this.classes.hide;s&&!(r&&!n)?l.classList.remove(i):l.classList.add(i)}}class Ly{constructor(t){this.listen=!1,this.observer=null,this.select=t,this.valueChange=this.valueChange.bind(this),this.select.addEventListener("change",this.valueChange,{passive:!0}),this.observer=new MutationObserver(this.observeCall.bind(this)),this.changeListen(!0)}enable(){this.select.disabled=!1}disable(){this.select.disabled=!0}hideUI(){this.select.tabIndex=-1,this.select.style.display="none",this.select.setAttribute("aria-hidden","true")}showUI(){this.select.removeAttribute("tabindex"),this.select.style.display="",this.select.removeAttribute("aria-hidden")}changeListen(t){this.listen=t,t&&this.observer&&this.observer.observe(this.select,{subtree:!0,childList:!0,attributes:!0}),t||this.observer&&this.observer.disconnect()}valueChange(t){return this.listen&&this.onValueChange&&this.onValueChange(this.getSelectedOptions()),!0}observeCall(t){if(!this.listen)return;let n=!1,r=!1,s=!1;for(const l of t)l.target===this.select&&(l.attributeName==="disabled"&&(r=!0),l.attributeName==="class"&&(n=!0)),(l.target.nodeName==="OPTGROUP"||l.target.nodeName==="OPTION")&&(s=!0);n&&this.onClassChange&&this.onClassChange(this.select.className.split(" ")),r&&this.onDisabledChange&&(this.changeListen(!1),this.onDisabledChange(this.select.disabled),this.changeListen(!0)),s&&this.onOptionsChange&&(this.changeListen(!1),this.onOptionsChange(this.getData()),this.changeListen(!0))}getData(){let t=[];const n=this.select.childNodes;for(const r of n)r.nodeName==="OPTGROUP"&&t.push(this.getDataFromOptgroup(r)),r.nodeName==="OPTION"&&t.push(this.getDataFromOption(r));return t}getDataFromOptgroup(t){let n={id:t.id,label:t.label,selectAll:t.dataset?t.dataset.selectall==="true":!1,selectAllText:t.dataset?t.dataset.selectalltext:"Select all",closable:t.dataset?t.dataset.closable:"off",options:[]};const r=t.childNodes;for(const s of r)s.nodeName==="OPTION"&&n.options.push(this.getDataFromOption(s));return n}getDataFromOption(t){return{id:t.id,value:t.value,text:t.text,html:t.dataset&&t.dataset.html?t.dataset.html:"",selected:t.selected,display:t.style.display!=="none",disabled:t.disabled,mandatory:t.dataset?t.dataset.mandatory==="true":!1,placeholder:t.dataset.placeholder==="true",class:t.className,style:t.style.cssText,data:t.dataset}}getSelectedOptions(){let t=[];const n=this.select.childNodes;for(const r of n){if(r.nodeName==="OPTGROUP"){const s=r.childNodes;for(const l of s)if(l.nodeName==="OPTION"){const i=l;i.selected&&t.push(this.getDataFromOption(i))}}if(r.nodeName==="OPTION"){const s=r;s.selected&&t.push(this.getDataFromOption(s))}}return t}getSelectedValues(){return this.getSelectedOptions().map(t=>t.value)}setSelected(t){this.changeListen(!1);const n=this.select.childNodes;for(const r of n){if(r.nodeName==="OPTGROUP"){const l=r.childNodes;for(const i of l)if(i.nodeName==="OPTION"){const o=i;o.selected=t.includes(o.id)}}if(r.nodeName==="OPTION"){const s=r;s.selected=t.includes(s.id)}}this.changeListen(!0)}updateSelect(t,n,r){this.changeListen(!1),t&&(this.select.dataset.id=t),n&&(this.select.style.cssText=n),r&&(this.select.className="",r.forEach(s=>{s.trim()!==""&&this.select.classList.add(s.trim())})),this.changeListen(!0)}updateOptions(t){this.changeListen(!1),this.select.innerHTML="";for(const n of t)n instanceof Lt&&this.select.appendChild(this.createOptgroup(n)),n instanceof He&&this.select.appendChild(this.createOption(n));this.select.dispatchEvent(new Event("change")),this.changeListen(!0)}createOptgroup(t){const n=document.createElement("optgroup");if(n.id=t.id,n.label=t.label,t.selectAll&&(n.dataset.selectAll="true"),t.closable!=="off"&&(n.dataset.closable=t.closable),t.options)for(const r of t.options)n.appendChild(this.createOption(r));return n}createOption(t){const n=document.createElement("option");return n.id=t.id,n.value=t.value,n.innerHTML=t.text,t.html!==""&&n.setAttribute("data-html",t.html),t.selected&&(n.selected=t.selected),t.disabled&&(n.disabled=!0),t.display===!1&&(n.style.display="none"),t.placeholder&&n.setAttribute("data-placeholder","true"),t.mandatory&&n.setAttribute("data-mandatory","true"),t.class&&t.class.split(" ").forEach(r=>{n.classList.add(r)}),t.data&&typeof t.data=="object"&&Object.keys(t.data).forEach(r=>{n.setAttribute("data-"+Ay(r),t.data[r])}),n}destroy(){this.changeListen(!1),this.select.removeEventListener("change",this.valueChange),this.observer&&(this.observer.disconnect(),this.observer=null),delete this.select.dataset.id,this.showUI()}}class Ty{constructor(t){this.id="",this.style="",this.class=[],this.isMultiple=!1,this.isOpen=!1,this.isFullOpen=!1,this.intervalMove=null,t||(t={}),this.id="ss-"+wu(),this.style=t.style||"",this.class=t.class||[],this.disabled=t.disabled!==void 0?t.disabled:!1,this.alwaysOpen=t.alwaysOpen!==void 0?t.alwaysOpen:!1,this.showSearch=t.showSearch!==void 0?t.showSearch:!0,this.ariaLabel=t.ariaLabel||"Combobox",this.searchPlaceholder=t.searchPlaceholder||"Search",this.searchText=t.searchText||"No Results",this.searchingText=t.searchingText||"Searching...",this.searchHighlight=t.searchHighlight!==void 0?t.searchHighlight:!1,this.closeOnSelect=t.closeOnSelect!==void 0?t.closeOnSelect:!0,this.contentLocation=t.contentLocation||document.body,this.contentPosition=t.contentPosition||"absolute",this.openPosition=t.openPosition||"auto",this.placeholderText=t.placeholderText!==void 0?t.placeholderText:"Select Value",this.allowDeselect=t.allowDeselect!==void 0?t.allowDeselect:!1,this.hideSelected=t.hideSelected!==void 0?t.hideSelected:!1,this.keepOrder=t.keepOrder!==void 0?t.keepOrder:!1,this.showOptionTooltips=t.showOptionTooltips!==void 0?t.showOptionTooltips:!1,this.minSelected=t.minSelected||0,this.maxSelected=t.maxSelected||1e3,this.timeoutDelay=t.timeoutDelay||200,this.maxValuesShown=t.maxValuesShown||20,this.maxValuesMessage=t.maxValuesMessage||"{number} selected"}}let zh=class{constructor(t){var i;if(this.events={search:void 0,searchFilter:(o,a)=>o.text.toLowerCase().indexOf(a.toLowerCase())!==-1,addable:void 0,beforeChange:void 0,afterChange:void 0,beforeOpen:void 0,afterOpen:void 0,beforeClose:void 0,afterClose:void 0},this.windowResize=Cs(()=>{!this.settings.isOpen&&!this.settings.isFullOpen||this.render.moveContent()}),this.windowScroll=Cs(()=>{!this.settings.isOpen&&!this.settings.isFullOpen||this.render.moveContent()}),this.documentClick=o=>{this.settings.isOpen&&o.target&&!ky(o.target,this.settings.id)&&this.close(o.type)},this.windowVisibilityChange=()=>{document.hidden&&this.close()},this.selectEl=typeof t.select=="string"?document.querySelector(t.select):t.select,!this.selectEl){t.events&&t.events.error&&t.events.error(new Error("Could not find select element"));return}if(this.selectEl.tagName!=="SELECT"){t.events&&t.events.error&&t.events.error(new Error("Element isnt of type select"));return}this.selectEl.dataset.ssid&&this.destroy(),this.settings=new Ty(t.settings);const n=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const o in t.events)t.events.hasOwnProperty(o)&&(n.indexOf(o)!==-1?this.events[o]=Cs(t.events[o],100):this.events[o]=t.events[o]);this.settings.disabled=(i=t.settings)!=null&&i.disabled?t.settings.disabled:this.selectEl.disabled,this.settings.isMultiple=this.selectEl.multiple,this.settings.style=this.selectEl.style.cssText,this.settings.class=this.selectEl.className.split(" "),this.select=new Ly(this.selectEl),this.select.updateSelect(this.settings.id,this.settings.style,this.settings.class),this.select.hideUI(),this.select.onValueChange=o=>{this.setSelected(o.map(a=>a.id))},this.select.onClassChange=o=>{this.settings.class=o,this.render.updateClassStyles()},this.select.onDisabledChange=o=>{o?this.disable():this.enable()},this.select.onOptionsChange=o=>{this.setData(o)},this.store=new Oy(this.settings.isMultiple?"multiple":"single",t.data?t.data:this.select.getData()),t.data&&this.select.updateOptions(this.store.getData());const r={open:this.open.bind(this),close:this.close.bind(this),addable:this.events.addable?this.events.addable:void 0,setSelected:this.setSelected.bind(this),addOption:this.addOption.bind(this),search:this.search.bind(this),beforeChange:this.events.beforeChange,afterChange:this.events.afterChange};this.render=new Py(this.settings,this.store,r),this.render.renderValues(),this.render.renderOptions(this.store.getData());const s=this.selectEl.getAttribute("aria-label"),l=this.selectEl.getAttribute("aria-labelledby");s?this.render.main.main.setAttribute("aria-label",s):l&&this.render.main.main.setAttribute("aria-labelledby",l),this.selectEl.parentNode&&this.selectEl.parentNode.insertBefore(this.render.main.main,this.selectEl.nextSibling),window.addEventListener("resize",this.windowResize,!1),this.settings.openPosition==="auto"&&window.addEventListener("scroll",this.windowScroll,!1),document.addEventListener("visibilitychange",this.windowVisibilityChange),this.settings.disabled&&this.disable(),this.settings.alwaysOpen&&this.open(),this.selectEl.slim=this}enable(){this.settings.disabled=!1,this.select.enable(),this.render.enable()}disable(){this.settings.disabled=!0,this.select.disable(),this.render.disable()}getData(){return this.store.getData()}setData(t){const n=this.store.getSelected(),r=this.store.validateDataArray(t);if(r){this.events.error&&this.events.error(r);return}this.store.setData(t);const s=this.store.getData();this.select.updateOptions(s),this.render.renderValues(),this.render.renderOptions(s),this.events.afterChange&&!po(n,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){return this.store.getSelected()}setSelected(t,n=!0){const r=this.store.getSelected();this.store.setSelectedBy("id",Array.isArray(t)?t:[t]);const s=this.store.getData();this.select.updateOptions(s),this.render.renderValues(),this.render.content.search.input.value!==""?this.search(this.render.content.search.input.value):this.render.renderOptions(s),n&&this.events.afterChange&&!po(r,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}addOption(t){const n=this.store.getSelected();this.store.getDataOptions().some(s=>s.value===(t.value??t.text))||this.store.addOption(t);const r=this.store.getData();this.select.updateOptions(r),this.render.renderValues(),this.render.renderOptions(r),this.events.afterChange&&!po(n,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}open(){this.settings.disabled||this.settings.isOpen||(this.events.beforeOpen&&this.events.beforeOpen(),this.render.open(),this.settings.showSearch&&this.render.searchFocus(),this.settings.isOpen=!0,setTimeout(()=>{this.events.afterOpen&&this.events.afterOpen(),this.settings.isOpen&&(this.settings.isFullOpen=!0),document.addEventListener("click",this.documentClick)},this.settings.timeoutDelay),this.settings.contentPosition==="absolute"&&(this.settings.intervalMove&&clearInterval(this.settings.intervalMove),this.settings.intervalMove=setInterval(this.render.moveContent.bind(this.render),500)))}close(t=null){!this.settings.isOpen||this.settings.alwaysOpen||(this.events.beforeClose&&this.events.beforeClose(),this.render.close(),this.render.content.search.input.value!==""&&this.search(""),this.render.mainFocus(t),this.settings.isOpen=!1,this.settings.isFullOpen=!1,setTimeout(()=>{this.events.afterClose&&this.events.afterClose(),document.removeEventListener("click",this.documentClick)},this.settings.timeoutDelay),this.settings.intervalMove&&clearInterval(this.settings.intervalMove))}search(t){if(this.render.content.search.input.value!==t&&(this.render.content.search.input.value=t),!this.events.search){this.render.renderOptions(t===""?this.store.getData():this.store.search(t,this.events.searchFilter));return}this.render.renderSearching();const n=this.events.search(t,this.store.getSelectedOptions());if(n instanceof Promise){n.then(r=>{this.render.renderOptions(this.store.partialToFullData(r))}).catch(r=>{this.render.renderError(typeof r=="string"?r:r.message)});return}else Array.isArray(n)?this.render.renderOptions(this.store.partialToFullData(n)):this.render.renderError("Search event must return a promise or an array of data")}destroy(){document.removeEventListener("click",this.documentClick),window.removeEventListener("resize",this.windowResize,!1),this.settings.openPosition==="auto"&&window.removeEventListener("scroll",this.windowScroll,!1),document.removeEventListener("visibilitychange",this.windowVisibilityChange),this.store.setData([]),this.render.destroy(),this.select.destroy()}};const Ry="CWYDT23U",Ny="slimselectjscom",My=Mi({__name:"carbonad",setup(e){const t=Gd(null);let n=!1;return uh(()=>{if(!n){n=!0;const r=document.createElement("script");r.id="_carbonads_js",r.src=`//cdn.carbonads.com/carbon.js?serve=${Ry}&placement=${Ny}`,r.async=!0,t.value&&t.value.appendChild(r)}}),(r,s)=>(Di(),Eh("div",{class:"carbon-container",ref_key:"container",ref:t},null,512))}}),Fy=Mi({name:"App",components:{CarbonAd:My},data(){return{nav:null,navDebounce:Cs(()=>{this.setDemensions()},100),year:new Date().getFullYear(),width:0,height:0,navData:[{text:"Home",value:"/",class:"label"},{label:"Install",closable:"close",options:[{text:"npm",value:"install#npm"},{text:"cdn",value:"install#cdn"},{text:"download",value:"install#download"}]},{label:"Selects",closable:"close",options:[{text:"single",value:"selects#single"},{text:"multiple",value:"selects#multiple"}]},{label:"Data",closable:"close",options:[{text:"types",value:"data#types"},{text:"field",value:"data#field"}]},{label:"Settings",closable:"close",options:[{text:"select",value:"settings#select"},{text:"alwaysOpen",value:"settings#alwaysOpen"},{text:"contentLocation",value:"settings#contentLocation"},{text:"contentPosition",value:"settings#contentPosition"},{text:"openPosition",value:"settings#openPosition"},{text:"placeholder",value:"settings#placeholder"},{text:"selectAll",value:"settings#selectAll"},{text:"allowDeselect",value:"settings#allowDeselect"},{text:"display",value:"settings#display"},{text:"disabled",value:"settings#disabled"},{text:"mandatory",value:"settings#mandatory"},{text:"minmax",value:"settings#minmax"},{text:"dataAttributes",value:"settings#dataAttributes"},{text:"cssClass",value:"settings#cssClass"},{text:"inlineStyles",value:"settings#inlineStyles"},{text:"html",value:"settings#html"},{text:"keepOrder",value:"settings#keepOrder"},{text:"search",value:"settings#search"},{text:"closeOnSelect",value:"settings#closeOnSelect"},{text:"showOptionTooltips",value:"settings#showOptionTooltips"},{text:"closable",value:"settings#closable"},{text:"hideSelected",value:"settings#hideSelected"},{text:"maxValuesShown",value:"settings#maxValuesShown"}]},{label:"Events",closable:"close",options:[{text:"error",value:"events#error"},{text:"beforeChange",value:"events#beforeChange"},{text:"afterChange",value:"events#afterChange"},{text:"open",value:"events#open"},{text:"search",value:"events#search"},{text:"searchFilter",value:"events#searchFilter"},{text:"addable",value:"events#addable"}]},{label:"Methods",closable:"close",options:[{text:"getSelected",value:"methods#getSelected"},{text:"setSelected",value:"methods#setSelected"},{text:"getData",value:"methods#getData"},{text:"setData",value:"methods#setData"},{text:"enableDisable",value:"methods#enableDisable"},{text:"openClose",value:"methods#openClose"},{text:"search",value:"methods#search"},{text:"destroy",value:"methods#destroy"}]},{label:"Frameworks",closable:"close",options:[{text:"vue",value:"vue"},{text:"react",value:"react"}]}]}},mounted(){this.runNav(),this.$router.isReady().then(()=>{this.nav&&this.nav.setSelected(this.$router.currentRoute.value.fullPath.replace("/",""))}),this.$router.afterEach(()=>{if(this.$route.query.p){setTimeout(()=>{this.$route.query.p&&this.$router.push({path:this.$route.query.p.toString(),hash:this.$route.hash})},200);return}setTimeout(()=>{const e=this.$route.hash;if(e===""&&window.scroll({top:0,behavior:"smooth"}),e){const t=document.querySelector(e);if(t){const n=document.querySelector("header"),r=document.querySelector("nav"),s=n?n.clientHeight+(window.innerWidth<700?r.clientHeight:0)+8:0;window.scroll({top:t.offsetTop-s,behavior:"smooth"})}}},200)}),this.setDemensions(),window.addEventListener("resize",this.navDebounce)},unmounted(){var e;window.removeEventListener("resize",this.navDebounce),(e=this.nav)==null||e.destroy()},watch:{width(){this.runNav()}},methods:{setDemensions(){this.width=document.documentElement.clientWidth,this.height=document.documentElement.clientHeight},runNav(){this.nav&&(this.nav.destroy(),this.nav=null);let e={searchHighlight:!0,openContent:"below"};this.width>700&&(e.alwaysOpen=!0,e.contentPosition="relative",e.contentLocation=this.$refs.navContent),this.nav=new zh({select:this.$refs.nav,data:this.navData,settings:e,events:{afterChange:t=>{const r=t[0].value.split("#"),s=r[0],l=r[1]?"#"+r[1]:void 0;this.$router.push({path:s,hash:l})}}})}}}),Iy="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpFNTE3OEEyRTk5QTAxMUUyOUExNUJDMTA0NkE4OTA0RCIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpFNTE3OEEyRjk5QTAxMUUyOUExNUJDMTA0NkE4OTA0RCI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkU1MTc4QTJDOTlBMDExRTI5QTE1QkMxMDQ2QTg5MDREIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkU1MTc4QTJEOTlBMDExRTI5QTE1QkMxMDQ2QTg5MDREIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+FYrpWAAABrNJREFUeNrkW2lsVFUUvjMWirYUkS5BXApUa2vd6gL+wAWjoP5RiW2EUBajAiqSuPADQ0w1UUQTrcFAUUSJEKriEuMWFKuJIElFSS24YNpQK6WoBbuAktbva880M8O8vnfevJm+CSf5cme599xzvnfffffce17AJFjycnLzUVwDXAgUAucBY4BMIEOqdQIdwJ/Az4J64OvWtoONibQvkACHgyiuBe4CbgLOjVNlE/AZsAmoBSE9viQAjueieBCYC5yVoAvWDKwHqkBEmy8IgON09lHgXmCESY4cBaqBlSCieUgIgOPDUCwBngBOM0MjXdL/CyDiv6QRAOcvR7EBKDL+kD3AbJBQl1AC4DjrLwaeBYYbf8m/ciu+BCJ6PScAzp+K4nXgTuNveQuYAxK6PSMAzo9C8TFwtUkN2Q7cDBIOx02AOP8FUGpSSzgf3GBHQsDGec7unwOTTWrKDiGhS02ATHjvALeb1JZ3gRlWE+MpVq0yMzIekRk/1YWP6o7Ors5vHI8AXH1Odl8BaTbKrwd4j10MTAduS8JqkKvA94BPgN0A56htNm2OMyDDKNhuSwCcT5dIrMBG6S4oLI1qezqKBcBjwGiPHW8HVgCr0W97VL/fobjMpv2vQAnaHgv/MdYVXurAeSNPhggRw56BQatRVgL3A0H5+xDwI8Dw9g/5Hlq+clmdDYwF8iV0zpb/GP2tApZHOx4m2xwQUCC+VVqOABg+AUUDkO6AgHkwaL2DJXORxPVNylUnw+gpXObaLXFRlxHoaw7U8uoXQ99vViNgqUPnKQfsKojhdW7GuxDW5JUtIuni432hH4JhLJ7Dq6qwcZiPZnpNXDJPfI0kQEJbjVM5PiIgW3nhlkQQILH9LGWnV/iIAK0ts8TngREwDchVKrnKRwRobckVnwcIKFcq4ONrkY8IWBT2SHUq5eEE3Khs/CRm6Z1+8V5sqVQ26/M5gHuhSJ79TqUFmIhOj/ppwQ8/Rshqb5yiWXFQFhsaWeU352UU0KaXlc2mBI1+Y3OzjyO/Gm2kSAIKFQ2awfQ+v3oP23gL/K5oUhh0GPiEZG8KxP97FHULgsqwtTUFCDioqHsGCRipaHA8BQjQrAcyg4roj5KVAgSMUtRNDyqVj0wBAlQ2koBuRf3xKUBAvqJuN1eCrYpAiHNAltNjpyFYDfL47oix38wdmDA5AvYr+kjzWRgcLVcqnKfsJwGNyk5u9TEBtyjrNwaVgRClTPKA/Db8aVOZslkDG2nD2vEuOkqGlLmYpHcGJLlJu8LjtvJFgx06Jvnq8xC33gUBeUE4waWjduua5wdVPrr6VS6cr6PvoXv5Ixed3g3mH/fB1V9OW1w07fM5IEouUEZR4bIWWJzsTRJ55r8I3ONSRRFs3hsIU8hkgkkulf0CPAx8qElQcuk4beYp9Epgoks138LOvqSPgfyAzIwMZlnFSobgIegc4H3gH6AkxmKDub9Mjb0DeoYDrZ1dne0eO14AvfPx8RXgAYaycahbBvt+GLgFpIM0md3PjqrMTMxpYKxB6p1v+s/n7bbSuMCqldmZyc+fRh9ND+IsAxrmG3C3qtj0J1uP84hLrnwnwJbjEQRIxzw0XB2jER93C9Bog9TjsRgzLpzuJr0BzHV6e8gwf9XoziqdCv1YE/oSTQBHwfem/3w+5syPxuukLtfdO0zk+WIs+YuPKLQ7ohzyWTIix3joPPMTLg1d/Yg5gIL7ogf32U/4WGGhYDr+34J6bUALPpPA62w6XYMOP9BaCv3HoD/PeJubODN6U/eEq4cKTIurttpBAZ4L+87TmKdtOt0ah8FbPXS+WnyLEKskqUy5FaweM5dA2e6w+pNkZuajhfMD3/zYBfDKb3Y6+cWwgytOL7bh98nQ73BEgHReIvd4Roy/a6Cs3CRYJOnq7zjV8HWcybC33mpLLKZIA84FPRYhcSokUNL2Civnjd0MjoZbUCy0+PtNkDDD5wQsFB8sxWm2+GJZd8eSt4HnZXnZ66Nb4CHYYxuxat4XmI1inbHeczskq77DMrK4z8AgK3+Q/L5EEMBn/PzQos0zAsQgvg5XY3TpNKOTSAD3NsrQX63TBqq9PVHM9NgvfXi/06ZSjfNqAoQEHj9Pled+pw8cpw2co6aKbSoJxDlJnYniKdP/sqSVrrEw7IBL/TnG+rSXEy7fYVoG/S1uffDkzVEYypB1qewJRCdb5rp9yxN6mQDZFmOS2wisCIXo8Yin7w7LiKiQEcFYfhOMnBmnzo1CLIO09Qyt47niJxDQ29trTmY56Qn4X4ABAFR7IoDmVT5NAAAAAElFTkSuQmCC",Dy="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACAAQMAAAD58POIAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZQTFRFyzg3////IltC9QAAAAFiS0dEAf8CLd4AAAAJcEhZcwAACxMAAAsTAQCanBgAAAAkSURBVEjHY2AYBYMV/IeDUQG4AJgeFRgVGBUYFSBNYBQMPgAARjtdvxo6xaMAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTEtMDUtMzBUMjM6MTA6NDQtMDc6MDCm4GvfAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDEwLTEyLTA2VDEyOjIwOjEyLTA4OjAwpIGEmQAAADJ0RVh0UE5HOmNIUk0AY2h1bmsgd2FzIGZvdW5kIChzZWUgQ2hyb21hdGljaXR5LCBhYm92ZSkH0UjaAAAAKXRFWHRQTkc6Z0FNQQBnYW1tYT0wLjQ1NDU1IChTZWUgR2FtbWEsIGFib3ZlKRISLKcAAAAUdEVYdFBORzpJSERSLmJpdF9kZXB0aAA4KYV+UAAAABV0RVh0UE5HOklIRFIuY29sb3JfdHlwZQA2BkqnKwAAABt0RVh0UE5HOklIRFIuaW50ZXJsYWNlX21ldGhvZAAw+zsHjAAAABx0RVh0UE5HOklIRFIud2lkdGgsaGVpZ2h0ADE2LCAxNjjVBg0AAAAodEVYdFBORzpwSFlzAHhfcmVzPTI4MzUsIHlfcmVzPTI4MzUsIHVuaXRzPTGCKXI+AAAAKHRFWHRQTkc6c1JHQgBpbnRlbnQ9MCAoU2VlIFJlbmRlcmluZyBpbnRlbnQp8hEU9QAAAABJRU5ErkJggg==",by=(e,t)=>{const n=e.__vccOpts||e;for(const[r,s]of t)n[r]=s;return n},jy=Iv('

Slim Select 2.0

Advanced select dropdown
',1),zy={ref:"nav"},By={class:"nav-content",ref:"navContent"},Uy=rn("a",{href:"http://webiswhatido.com",style:{color:"#ffffff"},target:"_blank"},"Brian Voelker",-1),Vy=rn("br",null,null,-1);function Hy(e,t,n,r,s,l){const i=Lc("CarbonAd"),o=Lc("router-view");return Di(),Eh(yt,null,[jy,rn("nav",null,[rn("select",zy,null,512),rn("div",By,null,512),be(i)]),rn("main",null,[be(o),rn("footer",null,[Il(" © "+hg(e.year)+" ",1),Uy,Il(". "),Vy,Il(" Slim Select is under the MIT license. ")])])],64)}const $y=by(Fy,[["render",Hy]]);var pf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Su(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Bh={exports:{}};(function(e){var t=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};/** * Prism: Lightweight, robust, elegant syntax highlighting * * @license MIT * @author Lea Verou * @namespace * @public - */var n=function(r){var s=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,l=0,i={},o={manual:r.Prism&&r.Prism.manual,disableWorkerMessageHandler:r.Prism&&r.Prism.disableWorkerMessageHandler,util:{encode:function f(h){return h instanceof u?new u(h.type,f(h.content),h.alias):Array.isArray(h)?h.map(f):h.replace(/&/g,"&").replace(/"u")return null;if("currentScript"in document&&1<2)return document.currentScript;try{throw new Error}catch(S){var f=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(S.stack)||[])[1];if(f){var h=document.getElementsByTagName("script");for(var y in h)if(h[y].src==f)return h[y]}return null}},isActive:function(f,h,y){for(var S="no-"+h;f;){var C=f.classList;if(C.contains(h))return!0;if(C.contains(S))return!1;f=f.parentElement}return!!y}},languages:{plain:i,plaintext:i,text:i,txt:i,extend:function(f,h){var y=o.util.clone(o.languages[f]);for(var S in h)y[S]=h[S];return y},insertBefore:function(f,h,y,S){S=S||o.languages;var C=S[f],k={};for(var R in C)if(C.hasOwnProperty(R)){if(R==h)for(var D in y)y.hasOwnProperty(D)&&(k[D]=y[D]);y.hasOwnProperty(R)||(k[R]=C[R])}var U=S[f];return S[f]=k,o.languages.DFS(o.languages,function(ee,ke){ke===U&&ee!=f&&(this[ee]=k)}),k},DFS:function f(h,y,S,C){C=C||{};var k=o.util.objId;for(var R in h)if(h.hasOwnProperty(R)){y.call(h,R,h[R],S||R);var D=h[R],U=o.util.type(D);U==="Object"&&!C[k(D)]?(C[k(D)]=!0,f(D,y,null,C)):U==="Array"&&!C[k(D)]&&(C[k(D)]=!0,f(D,y,R,C))}}},plugins:{},highlightAll:function(f,h){o.highlightAllUnder(document,f,h)},highlightAllUnder:function(f,h,y){var S={callback:y,container:f,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};o.hooks.run("before-highlightall",S),S.elements=Array.prototype.slice.apply(S.container.querySelectorAll(S.selector)),o.hooks.run("before-all-elements-highlight",S);for(var C=0,k;k=S.elements[C++];)o.highlightElement(k,h===!0,S.callback)},highlightElement:function(f,h,y){var S=o.util.getLanguage(f),C=o.languages[S];o.util.setLanguage(f,S);var k=f.parentElement;k&&k.nodeName.toLowerCase()==="pre"&&o.util.setLanguage(k,S);var R=f.textContent,D={element:f,language:S,grammar:C,code:R};function U(ke){D.highlightedCode=ke,o.hooks.run("before-insert",D),D.element.innerHTML=D.highlightedCode,o.hooks.run("after-highlight",D),o.hooks.run("complete",D),y&&y.call(D.element)}if(o.hooks.run("before-sanity-check",D),k=D.element.parentElement,k&&k.nodeName.toLowerCase()==="pre"&&!k.hasAttribute("tabindex")&&k.setAttribute("tabindex","0"),!D.code){o.hooks.run("complete",D),y&&y.call(D.element);return}if(o.hooks.run("before-highlight",D),!D.grammar){U(o.util.encode(D.code));return}if(h&&r.Worker){var ee=new Worker(o.filename);ee.onmessage=function(ke){U(ke.data)},ee.postMessage(JSON.stringify({language:D.language,code:D.code,immediateClose:!0}))}else U(o.highlight(D.code,D.grammar,D.language))},highlight:function(f,h,y){var S={code:f,grammar:h,language:y};if(o.hooks.run("before-tokenize",S),!S.grammar)throw new Error('The language "'+S.language+'" has no grammar.');return S.tokens=o.tokenize(S.code,S.grammar),o.hooks.run("after-tokenize",S),u.stringify(o.util.encode(S.tokens),S.language)},tokenize:function(f,h){var y=h.rest;if(y){for(var S in y)h[S]=y[S];delete h.rest}var C=new d;return p(C,C.head,f),c(f,C,h,C.head,0),x(C)},hooks:{all:{},add:function(f,h){var y=o.hooks.all;y[f]=y[f]||[],y[f].push(h)},run:function(f,h){var y=o.hooks.all[f];if(!(!y||!y.length))for(var S=0,C;C=y[S++];)C(h)}},Token:u};r.Prism=o;function u(f,h,y,S){this.type=f,this.content=h,this.alias=y,this.length=(S||"").length|0}u.stringify=function f(h,y){if(typeof h=="string")return h;if(Array.isArray(h)){var S="";return h.forEach(function(U){S+=f(U,y)}),S}var C={type:h.type,content:f(h.content,y),tag:"span",classes:["token",h.type],attributes:{},language:y},k=h.alias;k&&(Array.isArray(k)?Array.prototype.push.apply(C.classes,k):C.classes.push(k)),o.hooks.run("wrap",C);var R="";for(var D in C.attributes)R+=" "+D+'="'+(C.attributes[D]||"").replace(/"/g,""")+'"';return"<"+C.tag+' class="'+C.classes.join(" ")+'"'+R+">"+C.content+""};function a(f,h,y,S){f.lastIndex=h;var C=f.exec(y);if(C&&S&&C[1]){var k=C[1].length;C.index+=k,C[0]=C[0].slice(k)}return C}function c(f,h,y,S,C,k){for(var R in y)if(!(!y.hasOwnProperty(R)||!y[R])){var D=y[R];D=Array.isArray(D)?D:[D];for(var U=0;U=k.reach);W+=P.value.length,P=P.next){var K=P.value;if(h.length>f.length)return;if(!(K instanceof u)){var te=1,Z;if(At){if(Z=a(se,W,f,Le),!Z||Z.index>=f.length)break;var ae=Z.index,ct=Z.index+Z[0].length,xe=W;for(xe+=P.value.length;ae>=xe;)P=P.next,xe+=P.value.length;if(xe-=P.value.length,W=xe,P.value instanceof u)continue;for(var et=P;et!==h.tail&&(xek.reach&&(k.reach=Q);var le=P.prev;V&&(le=p(h,le,V),W+=V.length),w(h,le,te);var g=new u(R,ke?o.tokenize(A,ke):A,Bt,A);if(P=p(h,le,g),b&&p(h,P,b),te>1){var v={cause:R+","+U,reach:Q};c(f,h,y,P.prev,W,v),k&&v.reach>k.reach&&(k.reach=v.reach)}}}}}}function d(){var f={value:null,prev:null,next:null},h={value:null,prev:f,next:null};f.next=h,this.head=f,this.tail=h,this.length=0}function p(f,h,y){var S=h.next,C={value:y,prev:h,next:S};return h.next=C,S.prev=C,f.length++,C}function w(f,h,y){for(var S=h.next,C=0;C/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},n.languages.markup.tag.inside["attr-value"].inside.entity=n.languages.markup.entity,n.languages.markup.doctype.inside["internal-subset"].inside=n.languages.markup,n.hooks.add("wrap",function(r){r.type==="entity"&&(r.attributes.title=r.content.replace(/&/,"&"))}),Object.defineProperty(n.languages.markup.tag,"addInlined",{value:function(s,l){var i={};i["language-"+l]={pattern:/(^$)/i,lookbehind:!0,inside:n.languages[l]},i.cdata=/^$/i;var o={"included-cdata":{pattern://i,inside:i}};o["language-"+l]={pattern:/[\s\S]+/,inside:n.languages[l]};var u={};u[s]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return s}),"i"),lookbehind:!0,greedy:!0,inside:o},n.languages.insertBefore("markup","cdata",u)}}),Object.defineProperty(n.languages.markup.tag,"addAttribute",{value:function(r,s){n.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+r+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[s,"language-"+s],inside:n.languages[s]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),n.languages.html=n.languages.markup,n.languages.mathml=n.languages.markup,n.languages.svg=n.languages.markup,n.languages.xml=n.languages.extend("markup",{}),n.languages.ssml=n.languages.xml,n.languages.atom=n.languages.xml,n.languages.rss=n.languages.xml,function(r){var s=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;r.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+s.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+s.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+s.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+s.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:s,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},r.languages.css.atrule.inside.rest=r.languages.css;var l=r.languages.markup;l&&(l.tag.addInlined("style","css"),l.tag.addAttribute("style","css"))}(n),n.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},n.languages.javascript=n.languages.extend("clike",{"class-name":[n.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),n.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,n.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:n.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:n.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:n.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:n.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:n.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),n.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:n.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),n.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),n.languages.markup&&(n.languages.markup.tag.addInlined("script","javascript"),n.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),n.languages.js=n.languages.javascript,function(){if(typeof n>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var r="Loading…",s=function(_,L){return"✖ Error "+_+" while fetching file: "+L},l="✖ Error: File does not exist or is empty",i={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},o="data-src-status",u="loading",a="loaded",c="failed",d="pre[data-src]:not(["+o+'="'+a+'"]):not(['+o+'="'+u+'"])';function p(_,L,m){var f=new XMLHttpRequest;f.open("GET",_,!0),f.onreadystatechange=function(){f.readyState==4&&(f.status<400&&f.responseText?L(f.responseText):f.status>=400?m(s(f.status,f.statusText)):m(l))},f.send(null)}function w(_){var L=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(_||"");if(L){var m=Number(L[1]),f=L[2],h=L[3];return f?h?[m,Number(h)]:[m,void 0]:[m,m]}}n.hooks.add("before-highlightall",function(_){_.selector+=", "+d}),n.hooks.add("before-sanity-check",function(_){var L=_.element;if(L.matches(d)){_.code="",L.setAttribute(o,u);var m=L.appendChild(document.createElement("CODE"));m.textContent=r;var f=L.getAttribute("data-src"),h=_.language;if(h==="none"){var y=(/\.(\w+)$/.exec(f)||[,"none"])[1];h=i[y]||y}n.util.setLanguage(m,h),n.util.setLanguage(L,h);var S=n.plugins.autoloader;S&&S.loadLanguages(h),p(f,function(C){L.setAttribute(o,a);var k=w(L.getAttribute("data-range"));if(k){var R=C.split(/\r\n?|\n/g),D=k[0],U=k[1]==null?R.length:k[1];D<0&&(D+=R.length),D=Math.max(0,Math.min(D-1,R.length)),U<0&&(U+=R.length),U=Math.max(0,Math.min(U,R.length)),C=R.slice(D,U).join(` -`),L.hasAttribute("data-start")||L.setAttribute("data-start",String(D+1))}m.textContent=C,n.highlightElement(m)},function(C){L.setAttribute(o,c),m.textContent=C})}}),n.plugins.fileHighlight={highlight:function(L){for(var m=(L||document).querySelectorAll(d),f=0,h;h=m[f++];)n.highlightElement(h)}};var x=!1;n.fileHighlight=function(){x||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),x=!0),n.plugins.fileHighlight.highlight.apply(this,arguments)}}()})(Bh);var Wy=Bh.exports;const Qy=Sa(Wy);var Uh={exports:{}};(function(e){(function(){if(typeof Prism>"u")return;var t=Object.assign||function(i,o){for(var u in o)o.hasOwnProperty(u)&&(i[u]=o[u]);return i};function n(i){this.defaults=t({},i)}function r(i){return i.replace(/-(\w)/g,function(o,u){return u.toUpperCase()})}function s(i){for(var o=0,u=0;uo&&(c[p]=` -`+c[p],d=w)}u[a]=c.join("")}return u.join(` -`)}},e.exports&&(e.exports=n),Prism.plugins.NormalizeWhitespace=new n({"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0}),Prism.hooks.add("before-sanity-check",function(i){var o=Prism.plugins.NormalizeWhitespace;if(!(i.settings&&i.settings["whitespace-normalization"]===!1)&&Prism.util.isActive(i.element,"whitespace-normalization",!0)){if((!i.element||!i.element.parentNode)&&i.code){i.code=o.normalize(i.code,i.settings);return}var u=i.element.parentNode;if(!(!i.code||!u||u.nodeName.toLowerCase()!=="pre")){i.settings==null&&(i.settings={});for(var a in l)if(Object.hasOwnProperty.call(l,a)){var c=l[a];if(u.hasAttribute("data-"+a))try{var d=JSON.parse(u.getAttribute("data-"+a)||"true");typeof d===c&&(i.settings[a]=d)}catch{}}for(var p=u.childNodes,w="",x="",_=!1,L=0;L"u"||typeof document>"u")return;var e=[],t={},n=function(){};Prism.plugins.toolbar={};var r=Prism.plugins.toolbar.registerButton=function(i,o){var u;if(typeof o=="function"?u=o:u=function(a){var c;return typeof o.onClick=="function"?(c=document.createElement("button"),c.type="button",c.addEventListener("click",function(){o.onClick.call(this,a)})):typeof o.url=="string"?(c=document.createElement("a"),c.href=o.url):c=document.createElement("span"),o.className&&c.classList.add(o.className),c.textContent=o.text,c},i in t){console.warn('There is a button with the key "'+i+'" registered already.');return}e.push(t[i]=u)};function s(i){for(;i;){var o=i.getAttribute("data-toolbar-order");if(o!=null)return o=o.trim(),o.length?o.split(/\s*,\s*/g):[];i=i.parentElement}}var l=Prism.plugins.toolbar.hook=function(i){var o=i.element.parentNode;if(!(!o||!/pre/i.test(o.nodeName))&&!o.parentNode.classList.contains("code-toolbar")){var u=document.createElement("div");u.classList.add("code-toolbar"),o.parentNode.insertBefore(u,o),u.appendChild(o);var a=document.createElement("div");a.classList.add("toolbar");var c=e,d=s(i.element);d&&(c=d.map(function(p){return t[p]||n})),c.forEach(function(p){var w=p(i);if(w){var x=document.createElement("div");x.classList.add("toolbar-item"),x.appendChild(w),a.appendChild(x)}}),u.appendChild(a)}};r("label",function(i){var o=i.element.parentNode;if(!(!o||!/pre/i.test(o.nodeName))&&o.hasAttribute("data-label")){var u,a,c=o.getAttribute("data-label");try{a=document.querySelector("template#"+c)}catch{}return a?u=a.content:(o.hasAttribute("data-url")?(u=document.createElement("a"),u.href=o.getAttribute("data-url")):u=document.createElement("span"),u.textContent=c),u}}),Prism.hooks.add("complete",l)})();new Gy({"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0});const xa=g0($y);xa.use(Cy);xa.mixin({updated(){Qy.highlightAll()}});xa.mount("#app");var Vh={exports:{}},Bi={},Hh={exports:{}},re={};/** + */var n=function(r){var s=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,l=0,i={},o={manual:r.Prism&&r.Prism.manual,disableWorkerMessageHandler:r.Prism&&r.Prism.disableWorkerMessageHandler,util:{encode:function f(h){return h instanceof a?new a(h.type,f(h.content),h.alias):Array.isArray(h)?h.map(f):h.replace(/&/g,"&").replace(/"u")return null;if("currentScript"in document&&1<2)return document.currentScript;try{throw new Error}catch(S){var f=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(S.stack)||[])[1];if(f){var h=document.getElementsByTagName("script");for(var y in h)if(h[y].src==f)return h[y]}return null}},isActive:function(f,h,y){for(var S="no-"+h;f;){var C=f.classList;if(C.contains(h))return!0;if(C.contains(S))return!1;f=f.parentElement}return!!y}},languages:{plain:i,plaintext:i,text:i,txt:i,extend:function(f,h){var y=o.util.clone(o.languages[f]);for(var S in h)y[S]=h[S];return y},insertBefore:function(f,h,y,S){S=S||o.languages;var C=S[f],k={};for(var R in C)if(C.hasOwnProperty(R)){if(R==h)for(var D in y)y.hasOwnProperty(D)&&(k[D]=y[D]);y.hasOwnProperty(R)||(k[R]=C[R])}var U=S[f];return S[f]=k,o.languages.DFS(o.languages,function(ee,ke){ke===U&&ee!=f&&(this[ee]=k)}),k},DFS:function f(h,y,S,C){C=C||{};var k=o.util.objId;for(var R in h)if(h.hasOwnProperty(R)){y.call(h,R,h[R],S||R);var D=h[R],U=o.util.type(D);U==="Object"&&!C[k(D)]?(C[k(D)]=!0,f(D,y,null,C)):U==="Array"&&!C[k(D)]&&(C[k(D)]=!0,f(D,y,R,C))}}},plugins:{},highlightAll:function(f,h){o.highlightAllUnder(document,f,h)},highlightAllUnder:function(f,h,y){var S={callback:y,container:f,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};o.hooks.run("before-highlightall",S),S.elements=Array.prototype.slice.apply(S.container.querySelectorAll(S.selector)),o.hooks.run("before-all-elements-highlight",S);for(var C=0,k;k=S.elements[C++];)o.highlightElement(k,h===!0,S.callback)},highlightElement:function(f,h,y){var S=o.util.getLanguage(f),C=o.languages[S];o.util.setLanguage(f,S);var k=f.parentElement;k&&k.nodeName.toLowerCase()==="pre"&&o.util.setLanguage(k,S);var R=f.textContent,D={element:f,language:S,grammar:C,code:R};function U(ke){D.highlightedCode=ke,o.hooks.run("before-insert",D),D.element.innerHTML=D.highlightedCode,o.hooks.run("after-highlight",D),o.hooks.run("complete",D),y&&y.call(D.element)}if(o.hooks.run("before-sanity-check",D),k=D.element.parentElement,k&&k.nodeName.toLowerCase()==="pre"&&!k.hasAttribute("tabindex")&&k.setAttribute("tabindex","0"),!D.code){o.hooks.run("complete",D),y&&y.call(D.element);return}if(o.hooks.run("before-highlight",D),!D.grammar){U(o.util.encode(D.code));return}if(h&&r.Worker){var ee=new Worker(o.filename);ee.onmessage=function(ke){U(ke.data)},ee.postMessage(JSON.stringify({language:D.language,code:D.code,immediateClose:!0}))}else U(o.highlight(D.code,D.grammar,D.language))},highlight:function(f,h,y){var S={code:f,grammar:h,language:y};if(o.hooks.run("before-tokenize",S),!S.grammar)throw new Error('The language "'+S.language+'" has no grammar.');return S.tokens=o.tokenize(S.code,S.grammar),o.hooks.run("after-tokenize",S),a.stringify(o.util.encode(S.tokens),S.language)},tokenize:function(f,h){var y=h.rest;if(y){for(var S in y)h[S]=y[S];delete h.rest}var C=new d;return p(C,C.head,f),c(f,C,h,C.head,0),x(C)},hooks:{all:{},add:function(f,h){var y=o.hooks.all;y[f]=y[f]||[],y[f].push(h)},run:function(f,h){var y=o.hooks.all[f];if(!(!y||!y.length))for(var S=0,C;C=y[S++];)C(h)}},Token:a};r.Prism=o;function a(f,h,y,S){this.type=f,this.content=h,this.alias=y,this.length=(S||"").length|0}a.stringify=function f(h,y){if(typeof h=="string")return h;if(Array.isArray(h)){var S="";return h.forEach(function(U){S+=f(U,y)}),S}var C={type:h.type,content:f(h.content,y),tag:"span",classes:["token",h.type],attributes:{},language:y},k=h.alias;k&&(Array.isArray(k)?Array.prototype.push.apply(C.classes,k):C.classes.push(k)),o.hooks.run("wrap",C);var R="";for(var D in C.attributes)R+=" "+D+'="'+(C.attributes[D]||"").replace(/"/g,""")+'"';return"<"+C.tag+' class="'+C.classes.join(" ")+'"'+R+">"+C.content+""};function u(f,h,y,S){f.lastIndex=h;var C=f.exec(y);if(C&&S&&C[1]){var k=C[1].length;C.index+=k,C[0]=C[0].slice(k)}return C}function c(f,h,y,S,C,k){for(var R in y)if(!(!y.hasOwnProperty(R)||!y[R])){var D=y[R];D=Array.isArray(D)?D:[D];for(var U=0;U=k.reach);W+=P.value.length,P=P.next){var K=P.value;if(h.length>f.length)return;if(!(K instanceof a)){var te=1,Z;if(At){if(Z=u(se,W,f,Le),!Z||Z.index>=f.length)break;var ue=Z.index,ct=Z.index+Z[0].length,xe=W;for(xe+=P.value.length;ue>=xe;)P=P.next,xe+=P.value.length;if(xe-=P.value.length,W=xe,P.value instanceof a)continue;for(var et=P;et!==h.tail&&(xek.reach&&(k.reach=Q);var le=P.prev;V&&(le=p(h,le,V),W+=V.length),w(h,le,te);var g=new a(R,ke?o.tokenize(A,ke):A,Bt,A);if(P=p(h,le,g),b&&p(h,P,b),te>1){var v={cause:R+","+U,reach:Q};c(f,h,y,P.prev,W,v),k&&v.reach>k.reach&&(k.reach=v.reach)}}}}}}function d(){var f={value:null,prev:null,next:null},h={value:null,prev:f,next:null};f.next=h,this.head=f,this.tail=h,this.length=0}function p(f,h,y){var S=h.next,C={value:y,prev:h,next:S};return h.next=C,S.prev=C,f.length++,C}function w(f,h,y){for(var S=h.next,C=0;C/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},n.languages.markup.tag.inside["attr-value"].inside.entity=n.languages.markup.entity,n.languages.markup.doctype.inside["internal-subset"].inside=n.languages.markup,n.hooks.add("wrap",function(r){r.type==="entity"&&(r.attributes.title=r.content.replace(/&/,"&"))}),Object.defineProperty(n.languages.markup.tag,"addInlined",{value:function(s,l){var i={};i["language-"+l]={pattern:/(^$)/i,lookbehind:!0,inside:n.languages[l]},i.cdata=/^$/i;var o={"included-cdata":{pattern://i,inside:i}};o["language-"+l]={pattern:/[\s\S]+/,inside:n.languages[l]};var a={};a[s]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return s}),"i"),lookbehind:!0,greedy:!0,inside:o},n.languages.insertBefore("markup","cdata",a)}}),Object.defineProperty(n.languages.markup.tag,"addAttribute",{value:function(r,s){n.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+r+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[s,"language-"+s],inside:n.languages[s]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),n.languages.html=n.languages.markup,n.languages.mathml=n.languages.markup,n.languages.svg=n.languages.markup,n.languages.xml=n.languages.extend("markup",{}),n.languages.ssml=n.languages.xml,n.languages.atom=n.languages.xml,n.languages.rss=n.languages.xml,function(r){var s=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;r.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+s.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+s.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+s.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+s.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:s,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},r.languages.css.atrule.inside.rest=r.languages.css;var l=r.languages.markup;l&&(l.tag.addInlined("style","css"),l.tag.addAttribute("style","css"))}(n),n.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},n.languages.javascript=n.languages.extend("clike",{"class-name":[n.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),n.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,n.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:n.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:n.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:n.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:n.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:n.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),n.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:n.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),n.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),n.languages.markup&&(n.languages.markup.tag.addInlined("script","javascript"),n.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),n.languages.js=n.languages.javascript,function(){if(typeof n>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var r="Loading…",s=function(_,L){return"✖ Error "+_+" while fetching file: "+L},l="✖ Error: File does not exist or is empty",i={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},o="data-src-status",a="loading",u="loaded",c="failed",d="pre[data-src]:not(["+o+'="'+u+'"]):not(['+o+'="'+a+'"])';function p(_,L,m){var f=new XMLHttpRequest;f.open("GET",_,!0),f.onreadystatechange=function(){f.readyState==4&&(f.status<400&&f.responseText?L(f.responseText):f.status>=400?m(s(f.status,f.statusText)):m(l))},f.send(null)}function w(_){var L=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(_||"");if(L){var m=Number(L[1]),f=L[2],h=L[3];return f?h?[m,Number(h)]:[m,void 0]:[m,m]}}n.hooks.add("before-highlightall",function(_){_.selector+=", "+d}),n.hooks.add("before-sanity-check",function(_){var L=_.element;if(L.matches(d)){_.code="",L.setAttribute(o,a);var m=L.appendChild(document.createElement("CODE"));m.textContent=r;var f=L.getAttribute("data-src"),h=_.language;if(h==="none"){var y=(/\.(\w+)$/.exec(f)||[,"none"])[1];h=i[y]||y}n.util.setLanguage(m,h),n.util.setLanguage(L,h);var S=n.plugins.autoloader;S&&S.loadLanguages(h),p(f,function(C){L.setAttribute(o,u);var k=w(L.getAttribute("data-range"));if(k){var R=C.split(/\r\n?|\n/g),D=k[0],U=k[1]==null?R.length:k[1];D<0&&(D+=R.length),D=Math.max(0,Math.min(D-1,R.length)),U<0&&(U+=R.length),U=Math.max(0,Math.min(U,R.length)),C=R.slice(D,U).join(` +`),L.hasAttribute("data-start")||L.setAttribute("data-start",String(D+1))}m.textContent=C,n.highlightElement(m)},function(C){L.setAttribute(o,c),m.textContent=C})}}),n.plugins.fileHighlight={highlight:function(L){for(var m=(L||document).querySelectorAll(d),f=0,h;h=m[f++];)n.highlightElement(h)}};var x=!1;n.fileHighlight=function(){x||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),x=!0),n.plugins.fileHighlight.highlight.apply(this,arguments)}}()})(Bh);var Wy=Bh.exports;const Qy=Su(Wy);var Uh={exports:{}};(function(e){(function(){if(typeof Prism>"u")return;var t=Object.assign||function(i,o){for(var a in o)o.hasOwnProperty(a)&&(i[a]=o[a]);return i};function n(i){this.defaults=t({},i)}function r(i){return i.replace(/-(\w)/g,function(o,a){return a.toUpperCase()})}function s(i){for(var o=0,a=0;ao&&(c[p]=` +`+c[p],d=w)}a[u]=c.join("")}return a.join(` +`)}},e.exports&&(e.exports=n),Prism.plugins.NormalizeWhitespace=new n({"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0}),Prism.hooks.add("before-sanity-check",function(i){var o=Prism.plugins.NormalizeWhitespace;if(!(i.settings&&i.settings["whitespace-normalization"]===!1)&&Prism.util.isActive(i.element,"whitespace-normalization",!0)){if((!i.element||!i.element.parentNode)&&i.code){i.code=o.normalize(i.code,i.settings);return}var a=i.element.parentNode;if(!(!i.code||!a||a.nodeName.toLowerCase()!=="pre")){i.settings==null&&(i.settings={});for(var u in l)if(Object.hasOwnProperty.call(l,u)){var c=l[u];if(a.hasAttribute("data-"+u))try{var d=JSON.parse(a.getAttribute("data-"+u)||"true");typeof d===c&&(i.settings[u]=d)}catch{}}for(var p=a.childNodes,w="",x="",_=!1,L=0;L"u"||typeof document>"u")return;var e=[],t={},n=function(){};Prism.plugins.toolbar={};var r=Prism.plugins.toolbar.registerButton=function(i,o){var a;if(typeof o=="function"?a=o:a=function(u){var c;return typeof o.onClick=="function"?(c=document.createElement("button"),c.type="button",c.addEventListener("click",function(){o.onClick.call(this,u)})):typeof o.url=="string"?(c=document.createElement("a"),c.href=o.url):c=document.createElement("span"),o.className&&c.classList.add(o.className),c.textContent=o.text,c},i in t){console.warn('There is a button with the key "'+i+'" registered already.');return}e.push(t[i]=a)};function s(i){for(;i;){var o=i.getAttribute("data-toolbar-order");if(o!=null)return o=o.trim(),o.length?o.split(/\s*,\s*/g):[];i=i.parentElement}}var l=Prism.plugins.toolbar.hook=function(i){var o=i.element.parentNode;if(!(!o||!/pre/i.test(o.nodeName))&&!o.parentNode.classList.contains("code-toolbar")){var a=document.createElement("div");a.classList.add("code-toolbar"),o.parentNode.insertBefore(a,o),a.appendChild(o);var u=document.createElement("div");u.classList.add("toolbar");var c=e,d=s(i.element);d&&(c=d.map(function(p){return t[p]||n})),c.forEach(function(p){var w=p(i);if(w){var x=document.createElement("div");x.classList.add("toolbar-item"),x.appendChild(w),u.appendChild(x)}}),a.appendChild(u)}};r("label",function(i){var o=i.element.parentNode;if(!(!o||!/pre/i.test(o.nodeName))&&o.hasAttribute("data-label")){var a,u,c=o.getAttribute("data-label");try{u=document.querySelector("template#"+c)}catch{}return u?a=u.content:(o.hasAttribute("data-url")?(a=document.createElement("a"),a.href=o.getAttribute("data-url")):a=document.createElement("span"),a.textContent=c),a}}),Prism.hooks.add("complete",l)})();new Gy({"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0});const xu=g0($y);xu.use(Cy);xu.mixin({updated(){Qy.highlightAll()}});xu.mount("#app");var Vh={exports:{}},Bi={},Hh={exports:{}},re={};/** * @license React * react.production.min.js * @@ -21,7 +21,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var nl=Symbol.for("react.element"),Yy=Symbol.for("react.portal"),Zy=Symbol.for("react.fragment"),Jy=Symbol.for("react.strict_mode"),Xy=Symbol.for("react.profiler"),qy=Symbol.for("react.provider"),e1=Symbol.for("react.context"),t1=Symbol.for("react.forward_ref"),n1=Symbol.for("react.suspense"),r1=Symbol.for("react.memo"),s1=Symbol.for("react.lazy"),mf=Symbol.iterator;function l1(e){return e===null||typeof e!="object"?null:(e=mf&&e[mf]||e["@@iterator"],typeof e=="function"?e:null)}var $h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Wh=Object.assign,Qh={};function es(e,t,n){this.props=e,this.context=t,this.refs=Qh,this.updater=n||$h}es.prototype.isReactComponent={};es.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};es.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Kh(){}Kh.prototype=es.prototype;function Ea(e,t,n){this.props=e,this.context=t,this.refs=Qh,this.updater=n||$h}var _a=Ea.prototype=new Kh;_a.constructor=Ea;Wh(_a,es.prototype);_a.isPureReactComponent=!0;var gf=Array.isArray,Gh=Object.prototype.hasOwnProperty,Ca={current:null},Yh={key:!0,ref:!0,__self:!0,__source:!0};function Zh(e,t,n){var r,s={},l=null,i=null;if(t!=null)for(r in t.ref!==void 0&&(i=t.ref),t.key!==void 0&&(l=""+t.key),t)Gh.call(t,r)&&!Yh.hasOwnProperty(r)&&(s[r]=t[r]);var o=arguments.length-2;if(o===1)s.children=n;else if(1>>1,Z=P[te];if(0>>1;tes(et,K))aes(A,et)?(P[te]=A,P[ae]=K,te=ae):(P[te]=et,P[xe]=K,te=xe);else if(aes(A,K))P[te]=A,P[ae]=K,te=ae;else break e}}return W}function s(P,W){var K=P.sortIndex-W.sortIndex;return K!==0?K:P.id-W.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var i=Date,o=i.now();e.unstable_now=function(){return i.now()-o}}var u=[],a=[],c=1,d=null,p=3,w=!1,x=!1,_=!1,L=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,f=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function h(P){for(var W=n(a);W!==null;){if(W.callback===null)r(a);else if(W.startTime<=P)r(a),W.sortIndex=W.expirationTime,t(u,W);else break;W=n(a)}}function y(P){if(_=!1,h(P),!x)if(n(u)!==null)x=!0,ge(S);else{var W=n(a);W!==null&&se(y,W.startTime-P)}}function S(P,W){x=!1,_&&(_=!1,m(R),R=-1),w=!0;var K=p;try{for(h(W),d=n(u);d!==null&&(!(d.expirationTime>W)||P&&!ee());){var te=d.callback;if(typeof te=="function"){d.callback=null,p=d.priorityLevel;var Z=te(d.expirationTime<=W);W=e.unstable_now(),typeof Z=="function"?d.callback=Z:d===n(u)&&r(u),h(W)}else r(u);d=n(u)}if(d!==null)var ct=!0;else{var xe=n(a);xe!==null&&se(y,xe.startTime-W),ct=!1}return ct}finally{d=null,p=K,w=!1}}var C=!1,k=null,R=-1,D=5,U=-1;function ee(){return!(e.unstable_now()-UP||125te?(P.sortIndex=K,t(a,P),n(u)===null&&P===n(a)&&(_?(m(R),R=-1):_=!0,se(y,K-te))):(P.sortIndex=Z,t(u,P),x||w||(x=!0,ge(S))),P},e.unstable_shouldYield=ee,e.unstable_wrapCallback=function(P){var W=p;return function(){var K=p;p=W;try{return P.apply(this,arguments)}finally{p=K}}}})(ep);qh.exports=ep;var v1=qh.exports;/** + */(function(e){function t(P,W){var K=P.length;P.push(W);e:for(;0>>1,Z=P[te];if(0>>1;tes(et,K))ues(A,et)?(P[te]=A,P[ue]=K,te=ue):(P[te]=et,P[xe]=K,te=xe);else if(ues(A,K))P[te]=A,P[ue]=K,te=ue;else break e}}return W}function s(P,W){var K=P.sortIndex-W.sortIndex;return K!==0?K:P.id-W.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var i=Date,o=i.now();e.unstable_now=function(){return i.now()-o}}var a=[],u=[],c=1,d=null,p=3,w=!1,x=!1,_=!1,L=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,f=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function h(P){for(var W=n(u);W!==null;){if(W.callback===null)r(u);else if(W.startTime<=P)r(u),W.sortIndex=W.expirationTime,t(a,W);else break;W=n(u)}}function y(P){if(_=!1,h(P),!x)if(n(a)!==null)x=!0,ge(S);else{var W=n(u);W!==null&&se(y,W.startTime-P)}}function S(P,W){x=!1,_&&(_=!1,m(R),R=-1),w=!0;var K=p;try{for(h(W),d=n(a);d!==null&&(!(d.expirationTime>W)||P&&!ee());){var te=d.callback;if(typeof te=="function"){d.callback=null,p=d.priorityLevel;var Z=te(d.expirationTime<=W);W=e.unstable_now(),typeof Z=="function"?d.callback=Z:d===n(a)&&r(a),h(W)}else r(a);d=n(a)}if(d!==null)var ct=!0;else{var xe=n(u);xe!==null&&se(y,xe.startTime-W),ct=!1}return ct}finally{d=null,p=K,w=!1}}var C=!1,k=null,R=-1,D=5,U=-1;function ee(){return!(e.unstable_now()-UP||125te?(P.sortIndex=K,t(u,P),n(a)===null&&P===n(u)&&(_?(m(R),R=-1):_=!0,se(y,K-te))):(P.sortIndex=Z,t(a,P),x||w||(x=!0,ge(S))),P},e.unstable_shouldYield=ee,e.unstable_wrapCallback=function(P){var W=p;return function(){var K=p;p=W;try{return P.apply(this,arguments)}finally{p=K}}}})(ep);qh.exports=ep;var v1=qh.exports;/** * @license React * react-dom.production.min.js * @@ -45,14 +45,14 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var tp=nt,mt=v1;function I(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),lu=Object.prototype.hasOwnProperty,y1=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,yf={},wf={};function w1(e){return lu.call(wf,e)?!0:lu.call(yf,e)?!1:y1.test(e)?wf[e]=!0:(yf[e]=!0,!1)}function S1(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function x1(e,t,n,r){if(t===null||typeof t>"u"||S1(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function qe(e,t,n,r,s,l,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=l,this.removeEmptyString=i}var Be={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Be[e]=new qe(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Be[t]=new qe(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Be[e]=new qe(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Be[e]=new qe(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Be[e]=new qe(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Be[e]=new qe(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Be[e]=new qe(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Be[e]=new qe(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Be[e]=new qe(e,5,!1,e.toLowerCase(),null,!1,!1)});var Aa=/[\-:]([a-z])/g;function Oa(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Aa,Oa);Be[t]=new qe(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Aa,Oa);Be[t]=new qe(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Aa,Oa);Be[t]=new qe(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Be[e]=new qe(e,1,!1,e.toLowerCase(),null,!1,!1)});Be.xlinkHref=new qe("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Be[e]=new qe(e,1,!1,e.toLowerCase(),null,!0,!0)});function Pa(e,t,n,r){var s=Be.hasOwnProperty(t)?Be[t]:null;(s!==null?s.type!==0:r||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),la=Object.prototype.hasOwnProperty,y1=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,yf={},wf={};function w1(e){return la.call(wf,e)?!0:la.call(yf,e)?!1:y1.test(e)?wf[e]=!0:(yf[e]=!0,!1)}function S1(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function x1(e,t,n,r){if(t===null||typeof t>"u"||S1(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function qe(e,t,n,r,s,l,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=l,this.removeEmptyString=i}var Be={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Be[e]=new qe(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Be[t]=new qe(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Be[e]=new qe(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Be[e]=new qe(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Be[e]=new qe(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Be[e]=new qe(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Be[e]=new qe(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Be[e]=new qe(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Be[e]=new qe(e,5,!1,e.toLowerCase(),null,!1,!1)});var Au=/[\-:]([a-z])/g;function Ou(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Au,Ou);Be[t]=new qe(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Au,Ou);Be[t]=new qe(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Au,Ou);Be[t]=new qe(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Be[e]=new qe(e,1,!1,e.toLowerCase(),null,!1,!1)});Be.xlinkHref=new qe("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Be[e]=new qe(e,1,!1,e.toLowerCase(),null,!0,!0)});function Pu(e,t,n,r){var s=Be.hasOwnProperty(t)?Be[t]:null;(s!==null?s.type!==0:r||!(2o||s[i]!==l[o]){var u=` -`+s[i].replace(" at new "," at ");return e.displayName&&u.includes("")&&(u=u.replace("",e.displayName)),u}while(1<=i&&0<=o);break}}}finally{vo=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?ms(e):""}function E1(e){switch(e.tag){case 5:return ms(e.type);case 16:return ms("Lazy");case 13:return ms("Suspense");case 19:return ms("SuspenseList");case 0:case 2:case 15:return e=yo(e.type,!1),e;case 11:return e=yo(e.type.render,!1),e;case 1:return e=yo(e.type,!0),e;default:return""}}function au(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case yr:return"Fragment";case vr:return"Portal";case iu:return"Profiler";case La:return"StrictMode";case ou:return"Suspense";case uu:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case sp:return(e.displayName||"Context")+".Consumer";case rp:return(e._context.displayName||"Context")+".Provider";case Ta:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ra:return t=e.displayName||null,t!==null?t:au(e.type)||"Memo";case En:t=e._payload,e=e._init;try{return au(e(t))}catch{}}return null}function _1(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return au(t);case 8:return t===La?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Bn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ip(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function C1(e){var t=ip(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,l=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(i){r=""+i,l.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ml(e){e._valueTracker||(e._valueTracker=C1(e))}function op(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=ip(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function ti(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function cu(e,t){var n=t.checked;return Ce({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function xf(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Bn(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function up(e,t){t=t.checked,t!=null&&Pa(e,"checked",t,!1)}function fu(e,t){up(e,t);var n=Bn(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?du(e,t.type,n):t.hasOwnProperty("defaultValue")&&du(e,t.type,Bn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Ef(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function du(e,t,n){(t!=="number"||ti(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var gs=Array.isArray;function Ir(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s"+t.valueOf().toString()+"",t=gl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Bs(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var ks={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},k1=["Webkit","ms","Moz","O"];Object.keys(ks).forEach(function(e){k1.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ks[t]=ks[e]})});function dp(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||ks.hasOwnProperty(e)&&ks[e]?(""+t).trim():t+"px"}function hp(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=dp(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var A1=Ce({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function mu(e,t){if(t){if(A1[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(I(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(I(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(I(61))}if(t.style!=null&&typeof t.style!="object")throw Error(I(62))}}function gu(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var vu=null;function Na(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var yu=null,Fr=null,Dr=null;function kf(e){if(e=ll(e)){if(typeof yu!="function")throw Error(I(280));var t=e.stateNode;t&&(t=Wi(t),yu(e.stateNode,e.type,t))}}function pp(e){Fr?Dr?Dr.push(e):Dr=[e]:Fr=e}function mp(){if(Fr){var e=Fr,t=Dr;if(Dr=Fr=null,kf(e),t)for(e=0;e>>=0,e===0?32:31-(b1(e)/j1|0)|0}var vl=64,yl=4194304;function vs(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function li(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,l=e.pingedLanes,i=n&268435455;if(i!==0){var o=i&~s;o!==0?r=vs(o):(l&=i,l!==0&&(r=vs(l)))}else i=n&~s,i!==0?r=vs(i):l!==0&&(r=vs(l));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,l=t&-t,s>=l||s===16&&(l&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function rl(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Dt(t),e[t]=n}function V1(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Os),If=" ",Ff=!1;function Fp(e,t){switch(e){case"keyup":return gw.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Dp(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var wr=!1;function yw(e,t){switch(e){case"compositionend":return Dp(t);case"keypress":return t.which!==32?null:(Ff=!0,If);case"textInput":return e=t.data,e===If&&Ff?null:e;default:return null}}function ww(e,t){if(wr)return e==="compositionend"||!Ba&&Fp(e,t)?(e=Mp(),zl=ba=An=null,wr=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=zf(n)}}function Bp(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Bp(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Up(){for(var e=window,t=ti();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ti(e.document)}return t}function Ua(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Pw(e){var t=Up(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Bp(n.ownerDocument.documentElement,n)){if(r!==null&&Ua(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,l=Math.min(r.start,s);r=r.end===void 0?l:Math.min(r.end,s),!e.extend&&l>r&&(s=r,r=l,l=s),s=Bf(n,l);var i=Bf(n,r);s&&i&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),l>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Sr=null,Cu=null,Ls=null,ku=!1;function Uf(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ku||Sr==null||Sr!==ti(r)||(r=Sr,"selectionStart"in r&&Ua(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Ls&&Qs(Ls,r)||(Ls=r,r=ui(Cu,"onSelect"),0_r||(e.current=Ru[_r],Ru[_r]=null,_r--)}function he(e,t){_r++,Ru[_r]=e.current,e.current=t}var Un={},Ke=Hn(Un),lt=Hn(!1),sr=Un;function Qr(e,t){var n=e.type.contextTypes;if(!n)return Un;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},l;for(l in n)s[l]=t[l];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function it(e){return e=e.childContextTypes,e!=null}function ci(){me(lt),me(Ke)}function Gf(e,t,n){if(Ke.current!==Un)throw Error(I(168));he(Ke,t),he(lt,n)}function Zp(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(I(108,_1(e)||"Unknown",s));return Ce({},n,r)}function fi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Un,sr=Ke.current,he(Ke,e),he(lt,lt.current),!0}function Yf(e,t,n){var r=e.stateNode;if(!r)throw Error(I(169));n?(e=Zp(e,t,sr),r.__reactInternalMemoizedMergedChildContext=e,me(lt),me(Ke),he(Ke,e)):me(lt),he(lt,n)}var nn=null,Qi=!1,No=!1;function Jp(e){nn===null?nn=[e]:nn.push(e)}function Bw(e){Qi=!0,Jp(e)}function $n(){if(!No&&nn!==null){No=!0;var e=0,t=fe;try{var n=nn;for(fe=1;e>=i,s-=i,sn=1<<32-Dt(t)+s|n<R?(D=k,k=null):D=k.sibling;var U=p(m,k,h[R],y);if(U===null){k===null&&(k=D);break}e&&k&&U.alternate===null&&t(m,k),f=l(U,f,R),C===null?S=U:C.sibling=U,C=U,k=D}if(R===h.length)return n(m,k),we&&Kn(m,R),S;if(k===null){for(;RR?(D=k,k=null):D=k.sibling;var ee=p(m,k,U.value,y);if(ee===null){k===null&&(k=D);break}e&&k&&ee.alternate===null&&t(m,k),f=l(ee,f,R),C===null?S=ee:C.sibling=ee,C=ee,k=D}if(U.done)return n(m,k),we&&Kn(m,R),S;if(k===null){for(;!U.done;R++,U=h.next())U=d(m,U.value,y),U!==null&&(f=l(U,f,R),C===null?S=U:C.sibling=U,C=U);return we&&Kn(m,R),S}for(k=r(m,k);!U.done;R++,U=h.next())U=w(k,m,R,U.value,y),U!==null&&(e&&U.alternate!==null&&k.delete(U.key===null?R:U.key),f=l(U,f,R),C===null?S=U:C.sibling=U,C=U);return e&&k.forEach(function(ke){return t(m,ke)}),we&&Kn(m,R),S}function L(m,f,h,y){if(typeof h=="object"&&h!==null&&h.type===yr&&h.key===null&&(h=h.props.children),typeof h=="object"&&h!==null){switch(h.$$typeof){case pl:e:{for(var S=h.key,C=f;C!==null;){if(C.key===S){if(S=h.type,S===yr){if(C.tag===7){n(m,C.sibling),f=s(C,h.props.children),f.return=m,m=f;break e}}else if(C.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===En&&nd(S)===C.type){n(m,C.sibling),f=s(C,h.props),f.ref=fs(m,C,h),f.return=m,m=f;break e}n(m,C);break}else t(m,C);C=C.sibling}h.type===yr?(f=rr(h.props.children,m.mode,y,h.key),f.return=m,m=f):(y=Kl(h.type,h.key,h.props,null,m.mode,y),y.ref=fs(m,f,h),y.return=m,m=y)}return i(m);case vr:e:{for(C=h.key;f!==null;){if(f.key===C)if(f.tag===4&&f.stateNode.containerInfo===h.containerInfo&&f.stateNode.implementation===h.implementation){n(m,f.sibling),f=s(f,h.children||[]),f.return=m,m=f;break e}else{n(m,f);break}else t(m,f);f=f.sibling}f=Bo(h,m.mode,y),f.return=m,m=f}return i(m);case En:return C=h._init,L(m,f,C(h._payload),y)}if(gs(h))return x(m,f,h,y);if(is(h))return _(m,f,h,y);kl(m,h)}return typeof h=="string"&&h!==""||typeof h=="number"?(h=""+h,f!==null&&f.tag===6?(n(m,f.sibling),f=s(f,h),f.return=m,m=f):(n(m,f),f=zo(h,m.mode,y),f.return=m,m=f),i(m)):n(m,f)}return L}var Gr=lm(!0),im=lm(!1),il={},Zt=Hn(il),Zs=Hn(il),Js=Hn(il);function Xn(e){if(e===il)throw Error(I(174));return e}function Za(e,t){switch(he(Js,t),he(Zs,e),he(Zt,il),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:pu(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=pu(t,e)}me(Zt),he(Zt,t)}function Yr(){me(Zt),me(Zs),me(Js)}function om(e){Xn(Js.current);var t=Xn(Zt.current),n=pu(t,e.type);t!==n&&(he(Zs,e),he(Zt,n))}function Ja(e){Zs.current===e&&(me(Zt),me(Zs))}var Ee=Hn(0);function vi(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Mo=[];function Xa(){for(var e=0;en?n:4,e(!0);var r=Io.transition;Io.transition={};try{e(!1),t()}finally{fe=n,Io.transition=r}}function _m(){return kt().memoizedState}function $w(e,t,n){var r=Dn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Cm(e))km(t,n);else if(n=tm(e,t,n,r),n!==null){var s=Je();bt(n,e,r,s),Am(n,t,r)}}function Ww(e,t,n){var r=Dn(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Cm(e))km(t,s);else{var l=e.alternate;if(e.lanes===0&&(l===null||l.lanes===0)&&(l=t.lastRenderedReducer,l!==null))try{var i=t.lastRenderedState,o=l(i,n);if(s.hasEagerState=!0,s.eagerState=o,zt(o,i)){var u=t.interleaved;u===null?(s.next=s,Ga(t)):(s.next=u.next,u.next=s),t.interleaved=s;return}}catch{}finally{}n=tm(e,t,s,r),n!==null&&(s=Je(),bt(n,e,r,s),Am(n,t,r))}}function Cm(e){var t=e.alternate;return e===_e||t!==null&&t===_e}function km(e,t){Ts=yi=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Am(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ia(e,n)}}var wi={readContext:Ct,useCallback:Ue,useContext:Ue,useEffect:Ue,useImperativeHandle:Ue,useInsertionEffect:Ue,useLayoutEffect:Ue,useMemo:Ue,useReducer:Ue,useRef:Ue,useState:Ue,useDebugValue:Ue,useDeferredValue:Ue,useTransition:Ue,useMutableSource:Ue,useSyncExternalStore:Ue,useId:Ue,unstable_isNewReconciler:!1},Qw={readContext:Ct,useCallback:function(e,t){return Wt().memoizedState=[e,t===void 0?null:t],e},useContext:Ct,useEffect:sd,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Hl(4194308,4,ym.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Hl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Hl(4,2,e,t)},useMemo:function(e,t){var n=Wt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Wt();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=$w.bind(null,_e,e),[r.memoizedState,e]},useRef:function(e){var t=Wt();return e={current:e},t.memoizedState=e},useState:rd,useDebugValue:rc,useDeferredValue:function(e){return Wt().memoizedState=e},useTransition:function(){var e=rd(!1),t=e[0];return e=Hw.bind(null,e[1]),Wt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=_e,s=Wt();if(we){if(n===void 0)throw Error(I(407));n=n()}else{if(n=t(),Fe===null)throw Error(I(349));ir&30||cm(r,t,n)}s.memoizedState=n;var l={value:n,getSnapshot:t};return s.queue=l,sd(dm.bind(null,r,l,e),[e]),r.flags|=2048,el(9,fm.bind(null,r,l,n,t),void 0,null),n},useId:function(){var e=Wt(),t=Fe.identifierPrefix;if(we){var n=ln,r=sn;n=(r&~(1<<32-Dt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Xs++,0o||s[i]!==l[o]){var a=` +`+s[i].replace(" at new "," at ");return e.displayName&&a.includes("")&&(a=a.replace("",e.displayName)),a}while(1<=i&&0<=o);break}}}finally{vo=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?ms(e):""}function E1(e){switch(e.tag){case 5:return ms(e.type);case 16:return ms("Lazy");case 13:return ms("Suspense");case 19:return ms("SuspenseList");case 0:case 2:case 15:return e=yo(e.type,!1),e;case 11:return e=yo(e.type.render,!1),e;case 1:return e=yo(e.type,!0),e;default:return""}}function ua(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case yr:return"Fragment";case vr:return"Portal";case ia:return"Profiler";case Lu:return"StrictMode";case oa:return"Suspense";case aa:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case sp:return(e.displayName||"Context")+".Consumer";case rp:return(e._context.displayName||"Context")+".Provider";case Tu:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ru:return t=e.displayName||null,t!==null?t:ua(e.type)||"Memo";case En:t=e._payload,e=e._init;try{return ua(e(t))}catch{}}return null}function _1(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ua(t);case 8:return t===Lu?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Bn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ip(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function C1(e){var t=ip(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,l=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(i){r=""+i,l.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ml(e){e._valueTracker||(e._valueTracker=C1(e))}function op(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=ip(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function ti(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function ca(e,t){var n=t.checked;return Ce({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function xf(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Bn(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function ap(e,t){t=t.checked,t!=null&&Pu(e,"checked",t,!1)}function fa(e,t){ap(e,t);var n=Bn(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?da(e,t.type,n):t.hasOwnProperty("defaultValue")&&da(e,t.type,Bn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Ef(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function da(e,t,n){(t!=="number"||ti(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var gs=Array.isArray;function Fr(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s"+t.valueOf().toString()+"",t=gl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Bs(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var ks={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},k1=["Webkit","ms","Moz","O"];Object.keys(ks).forEach(function(e){k1.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ks[t]=ks[e]})});function dp(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||ks.hasOwnProperty(e)&&ks[e]?(""+t).trim():t+"px"}function hp(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=dp(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var A1=Ce({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ma(e,t){if(t){if(A1[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(F(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(F(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(F(61))}if(t.style!=null&&typeof t.style!="object")throw Error(F(62))}}function ga(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var va=null;function Nu(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ya=null,Ir=null,Dr=null;function kf(e){if(e=ll(e)){if(typeof ya!="function")throw Error(F(280));var t=e.stateNode;t&&(t=Wi(t),ya(e.stateNode,e.type,t))}}function pp(e){Ir?Dr?Dr.push(e):Dr=[e]:Ir=e}function mp(){if(Ir){var e=Ir,t=Dr;if(Dr=Ir=null,kf(e),t)for(e=0;e>>=0,e===0?32:31-(b1(e)/j1|0)|0}var vl=64,yl=4194304;function vs(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function li(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,l=e.pingedLanes,i=n&268435455;if(i!==0){var o=i&~s;o!==0?r=vs(o):(l&=i,l!==0&&(r=vs(l)))}else i=n&~s,i!==0?r=vs(i):l!==0&&(r=vs(l));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,l=t&-t,s>=l||s===16&&(l&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function rl(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Dt(t),e[t]=n}function V1(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Os),Ff=" ",If=!1;function Ip(e,t){switch(e){case"keyup":return gw.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Dp(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var wr=!1;function yw(e,t){switch(e){case"compositionend":return Dp(t);case"keypress":return t.which!==32?null:(If=!0,Ff);case"textInput":return e=t.data,e===Ff&&If?null:e;default:return null}}function ww(e,t){if(wr)return e==="compositionend"||!Bu&&Ip(e,t)?(e=Mp(),zl=bu=An=null,wr=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=zf(n)}}function Bp(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Bp(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Up(){for(var e=window,t=ti();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ti(e.document)}return t}function Uu(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Pw(e){var t=Up(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Bp(n.ownerDocument.documentElement,n)){if(r!==null&&Uu(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,l=Math.min(r.start,s);r=r.end===void 0?l:Math.min(r.end,s),!e.extend&&l>r&&(s=r,r=l,l=s),s=Bf(n,l);var i=Bf(n,r);s&&i&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),l>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Sr=null,Ca=null,Ls=null,ka=!1;function Uf(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ka||Sr==null||Sr!==ti(r)||(r=Sr,"selectionStart"in r&&Uu(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Ls&&Qs(Ls,r)||(Ls=r,r=ai(Ca,"onSelect"),0_r||(e.current=Ra[_r],Ra[_r]=null,_r--)}function he(e,t){_r++,Ra[_r]=e.current,e.current=t}var Un={},Ke=Hn(Un),lt=Hn(!1),sr=Un;function Qr(e,t){var n=e.type.contextTypes;if(!n)return Un;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},l;for(l in n)s[l]=t[l];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function it(e){return e=e.childContextTypes,e!=null}function ci(){me(lt),me(Ke)}function Gf(e,t,n){if(Ke.current!==Un)throw Error(F(168));he(Ke,t),he(lt,n)}function Zp(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(F(108,_1(e)||"Unknown",s));return Ce({},n,r)}function fi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Un,sr=Ke.current,he(Ke,e),he(lt,lt.current),!0}function Yf(e,t,n){var r=e.stateNode;if(!r)throw Error(F(169));n?(e=Zp(e,t,sr),r.__reactInternalMemoizedMergedChildContext=e,me(lt),me(Ke),he(Ke,e)):me(lt),he(lt,n)}var nn=null,Qi=!1,No=!1;function Jp(e){nn===null?nn=[e]:nn.push(e)}function Bw(e){Qi=!0,Jp(e)}function $n(){if(!No&&nn!==null){No=!0;var e=0,t=fe;try{var n=nn;for(fe=1;e>=i,s-=i,sn=1<<32-Dt(t)+s|n<R?(D=k,k=null):D=k.sibling;var U=p(m,k,h[R],y);if(U===null){k===null&&(k=D);break}e&&k&&U.alternate===null&&t(m,k),f=l(U,f,R),C===null?S=U:C.sibling=U,C=U,k=D}if(R===h.length)return n(m,k),we&&Kn(m,R),S;if(k===null){for(;RR?(D=k,k=null):D=k.sibling;var ee=p(m,k,U.value,y);if(ee===null){k===null&&(k=D);break}e&&k&&ee.alternate===null&&t(m,k),f=l(ee,f,R),C===null?S=ee:C.sibling=ee,C=ee,k=D}if(U.done)return n(m,k),we&&Kn(m,R),S;if(k===null){for(;!U.done;R++,U=h.next())U=d(m,U.value,y),U!==null&&(f=l(U,f,R),C===null?S=U:C.sibling=U,C=U);return we&&Kn(m,R),S}for(k=r(m,k);!U.done;R++,U=h.next())U=w(k,m,R,U.value,y),U!==null&&(e&&U.alternate!==null&&k.delete(U.key===null?R:U.key),f=l(U,f,R),C===null?S=U:C.sibling=U,C=U);return e&&k.forEach(function(ke){return t(m,ke)}),we&&Kn(m,R),S}function L(m,f,h,y){if(typeof h=="object"&&h!==null&&h.type===yr&&h.key===null&&(h=h.props.children),typeof h=="object"&&h!==null){switch(h.$$typeof){case pl:e:{for(var S=h.key,C=f;C!==null;){if(C.key===S){if(S=h.type,S===yr){if(C.tag===7){n(m,C.sibling),f=s(C,h.props.children),f.return=m,m=f;break e}}else if(C.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===En&&nd(S)===C.type){n(m,C.sibling),f=s(C,h.props),f.ref=fs(m,C,h),f.return=m,m=f;break e}n(m,C);break}else t(m,C);C=C.sibling}h.type===yr?(f=rr(h.props.children,m.mode,y,h.key),f.return=m,m=f):(y=Kl(h.type,h.key,h.props,null,m.mode,y),y.ref=fs(m,f,h),y.return=m,m=y)}return i(m);case vr:e:{for(C=h.key;f!==null;){if(f.key===C)if(f.tag===4&&f.stateNode.containerInfo===h.containerInfo&&f.stateNode.implementation===h.implementation){n(m,f.sibling),f=s(f,h.children||[]),f.return=m,m=f;break e}else{n(m,f);break}else t(m,f);f=f.sibling}f=Bo(h,m.mode,y),f.return=m,m=f}return i(m);case En:return C=h._init,L(m,f,C(h._payload),y)}if(gs(h))return x(m,f,h,y);if(is(h))return _(m,f,h,y);kl(m,h)}return typeof h=="string"&&h!==""||typeof h=="number"?(h=""+h,f!==null&&f.tag===6?(n(m,f.sibling),f=s(f,h),f.return=m,m=f):(n(m,f),f=zo(h,m.mode,y),f.return=m,m=f),i(m)):n(m,f)}return L}var Gr=lm(!0),im=lm(!1),il={},Zt=Hn(il),Zs=Hn(il),Js=Hn(il);function Xn(e){if(e===il)throw Error(F(174));return e}function Zu(e,t){switch(he(Js,t),he(Zs,e),he(Zt,il),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:pa(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=pa(t,e)}me(Zt),he(Zt,t)}function Yr(){me(Zt),me(Zs),me(Js)}function om(e){Xn(Js.current);var t=Xn(Zt.current),n=pa(t,e.type);t!==n&&(he(Zs,e),he(Zt,n))}function Ju(e){Zs.current===e&&(me(Zt),me(Zs))}var Ee=Hn(0);function vi(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Mo=[];function Xu(){for(var e=0;en?n:4,e(!0);var r=Fo.transition;Fo.transition={};try{e(!1),t()}finally{fe=n,Fo.transition=r}}function _m(){return kt().memoizedState}function $w(e,t,n){var r=Dn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Cm(e))km(t,n);else if(n=tm(e,t,n,r),n!==null){var s=Je();bt(n,e,r,s),Am(n,t,r)}}function Ww(e,t,n){var r=Dn(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Cm(e))km(t,s);else{var l=e.alternate;if(e.lanes===0&&(l===null||l.lanes===0)&&(l=t.lastRenderedReducer,l!==null))try{var i=t.lastRenderedState,o=l(i,n);if(s.hasEagerState=!0,s.eagerState=o,zt(o,i)){var a=t.interleaved;a===null?(s.next=s,Gu(t)):(s.next=a.next,a.next=s),t.interleaved=s;return}}catch{}finally{}n=tm(e,t,s,r),n!==null&&(s=Je(),bt(n,e,r,s),Am(n,t,r))}}function Cm(e){var t=e.alternate;return e===_e||t!==null&&t===_e}function km(e,t){Ts=yi=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Am(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Fu(e,n)}}var wi={readContext:Ct,useCallback:Ue,useContext:Ue,useEffect:Ue,useImperativeHandle:Ue,useInsertionEffect:Ue,useLayoutEffect:Ue,useMemo:Ue,useReducer:Ue,useRef:Ue,useState:Ue,useDebugValue:Ue,useDeferredValue:Ue,useTransition:Ue,useMutableSource:Ue,useSyncExternalStore:Ue,useId:Ue,unstable_isNewReconciler:!1},Qw={readContext:Ct,useCallback:function(e,t){return Wt().memoizedState=[e,t===void 0?null:t],e},useContext:Ct,useEffect:sd,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Hl(4194308,4,ym.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Hl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Hl(4,2,e,t)},useMemo:function(e,t){var n=Wt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Wt();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=$w.bind(null,_e,e),[r.memoizedState,e]},useRef:function(e){var t=Wt();return e={current:e},t.memoizedState=e},useState:rd,useDebugValue:rc,useDeferredValue:function(e){return Wt().memoizedState=e},useTransition:function(){var e=rd(!1),t=e[0];return e=Hw.bind(null,e[1]),Wt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=_e,s=Wt();if(we){if(n===void 0)throw Error(F(407));n=n()}else{if(n=t(),Ie===null)throw Error(F(349));ir&30||cm(r,t,n)}s.memoizedState=n;var l={value:n,getSnapshot:t};return s.queue=l,sd(dm.bind(null,r,l,e),[e]),r.flags|=2048,el(9,fm.bind(null,r,l,n,t),void 0,null),n},useId:function(){var e=Wt(),t=Ie.identifierPrefix;if(we){var n=ln,r=sn;n=(r&~(1<<32-Dt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Xs++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[Gt]=t,e[Ys]=r,Fm(e,t,!1,!1),t.stateNode=e;e:{switch(i=gu(n,r),n){case"dialog":pe("cancel",e),pe("close",e),s=r;break;case"iframe":case"object":case"embed":pe("load",e),s=r;break;case"video":case"audio":for(s=0;sJr&&(t.flags|=128,r=!0,ds(l,!1),t.lanes=4194304)}else{if(!r)if(e=vi(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ds(l,!0),l.tail===null&&l.tailMode==="hidden"&&!i.alternate&&!we)return Ve(t),null}else 2*Oe()-l.renderingStartTime>Jr&&n!==1073741824&&(t.flags|=128,r=!0,ds(l,!1),t.lanes=4194304);l.isBackwards?(i.sibling=t.child,t.child=i):(n=l.last,n!==null?n.sibling=i:t.child=i,l.last=i)}return l.tail!==null?(t=l.tail,l.rendering=t,l.tail=t.sibling,l.renderingStartTime=Oe(),t.sibling=null,n=Ee.current,he(Ee,r?n&1|2:n&1),t):(Ve(t),null);case 22:case 23:return ac(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?dt&1073741824&&(Ve(t),t.subtreeFlags&6&&(t.flags|=8192)):Ve(t),null;case 24:return null;case 25:return null}throw Error(I(156,t.tag))}function eS(e,t){switch(Ha(t),t.tag){case 1:return it(t.type)&&ci(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Yr(),me(lt),me(Ke),Xa(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ja(t),null;case 13:if(me(Ee),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(I(340));Kr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return me(Ee),null;case 4:return Yr(),null;case 10:return Ka(t.type._context),null;case 22:case 23:return ac(),null;case 24:return null;default:return null}}var Ol=!1,$e=!1,tS=typeof WeakSet=="function"?WeakSet:Set,$=null;function Or(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Ae(e,t,r)}else n.current=null}function Hu(e,t,n){try{n()}catch(r){Ae(e,t,r)}}var hd=!1;function nS(e,t){if(Au=ii,e=Up(),Ua(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,l=r.focusNode;r=r.focusOffset;try{n.nodeType,l.nodeType}catch{n=null;break e}var i=0,o=-1,u=-1,a=0,c=0,d=e,p=null;t:for(;;){for(var w;d!==n||s!==0&&d.nodeType!==3||(o=i+s),d!==l||r!==0&&d.nodeType!==3||(u=i+r),d.nodeType===3&&(i+=d.nodeValue.length),(w=d.firstChild)!==null;)p=d,d=w;for(;;){if(d===e)break t;if(p===n&&++a===s&&(o=i),p===l&&++c===r&&(u=i),(w=d.nextSibling)!==null)break;d=p,p=d.parentNode}d=w}n=o===-1||u===-1?null:{start:o,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ou={focusedElem:e,selectionRange:n},ii=!1,$=t;$!==null;)if(t=$,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,$=e;else for(;$!==null;){t=$;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var _=x.memoizedProps,L=x.memoizedState,m=t.stateNode,f=m.getSnapshotBeforeUpdate(t.elementType===t.type?_:Tt(t.type,_),L);m.__reactInternalSnapshotBeforeUpdate=f}break;case 3:var h=t.stateNode.containerInfo;h.nodeType===1?h.textContent="":h.nodeType===9&&h.documentElement&&h.removeChild(h.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(I(163))}}catch(y){Ae(t,t.return,y)}if(e=t.sibling,e!==null){e.return=t.return,$=e;break}$=t.return}return x=hd,hd=!1,x}function Rs(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var l=s.destroy;s.destroy=void 0,l!==void 0&&Hu(t,n,l)}s=s.next}while(s!==r)}}function Yi(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function $u(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function jm(e){var t=e.alternate;t!==null&&(e.alternate=null,jm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Gt],delete t[Ys],delete t[Tu],delete t[jw],delete t[zw])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function zm(e){return e.tag===5||e.tag===3||e.tag===4}function pd(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||zm(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Wu(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=ai));else if(r!==4&&(e=e.child,e!==null))for(Wu(e,t,n),e=e.sibling;e!==null;)Wu(e,t,n),e=e.sibling}function Qu(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Qu(e,t,n),e=e.sibling;e!==null;)Qu(e,t,n),e=e.sibling}var De=null,Rt=!1;function yn(e,t,n){for(n=n.child;n!==null;)Bm(e,t,n),n=n.sibling}function Bm(e,t,n){if(Yt&&typeof Yt.onCommitFiberUnmount=="function")try{Yt.onCommitFiberUnmount(Ui,n)}catch{}switch(n.tag){case 5:$e||Or(n,t);case 6:var r=De,s=Rt;De=null,yn(e,t,n),De=r,Rt=s,De!==null&&(Rt?(e=De,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):De.removeChild(n.stateNode));break;case 18:De!==null&&(Rt?(e=De,n=n.stateNode,e.nodeType===8?Ro(e.parentNode,n):e.nodeType===1&&Ro(e,n),$s(e)):Ro(De,n.stateNode));break;case 4:r=De,s=Rt,De=n.stateNode.containerInfo,Rt=!0,yn(e,t,n),De=r,Rt=s;break;case 0:case 11:case 14:case 15:if(!$e&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var l=s,i=l.destroy;l=l.tag,i!==void 0&&(l&2||l&4)&&Hu(n,t,i),s=s.next}while(s!==r)}yn(e,t,n);break;case 1:if(!$e&&(Or(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(o){Ae(n,t,o)}yn(e,t,n);break;case 21:yn(e,t,n);break;case 22:n.mode&1?($e=(r=$e)||n.memoizedState!==null,yn(e,t,n),$e=r):yn(e,t,n);break;default:yn(e,t,n)}}function md(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new tS),t.forEach(function(r){var s=fS.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Pt(e,t){var n=t.deletions;if(n!==null)for(var r=0;rs&&(s=i),r&=~l}if(r=s,r=Oe()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*sS(r/1960))-r,10e?16:e,On===null)var r=!1;else{if(e=On,On=null,Ei=0,oe&6)throw Error(I(331));var s=oe;for(oe|=4,$=e.current;$!==null;){var l=$,i=l.child;if($.flags&16){var o=l.deletions;if(o!==null){for(var u=0;uOe()-oc?nr(e,0):ic|=n),ot(e,t)}function Gm(e,t){t===0&&(e.mode&1?(t=yl,yl<<=1,!(yl&130023424)&&(yl=4194304)):t=1);var n=Je();e=dn(e,t),e!==null&&(rl(e,t,n),ot(e,n))}function cS(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Gm(e,n)}function fS(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(I(314))}r!==null&&r.delete(t),Gm(e,n)}var Ym;Ym=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||lt.current)st=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return st=!1,Xw(e,t,n);st=!!(e.flags&131072)}else st=!1,we&&t.flags&1048576&&Xp(t,hi,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;$l(e,t),e=t.pendingProps;var s=Qr(t,Ke.current);jr(t,n),s=ec(null,t,r,e,s,n);var l=tc();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,it(r)?(l=!0,fi(t)):l=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Ya(t),s.updater=Ki,t.stateNode=s,s._reactInternals=t,Du(t,r,e,n),t=zu(null,t,r,!0,l,n)):(t.tag=0,we&&l&&Va(t),Ye(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch($l(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=hS(r),e=Tt(r,e),s){case 0:t=ju(null,t,r,e,n);break e;case 1:t=cd(null,t,r,e,n);break e;case 11:t=ud(null,t,r,e,n);break e;case 14:t=ad(null,t,r,Tt(r.type,e),n);break e}throw Error(I(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Tt(r,s),ju(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Tt(r,s),cd(e,t,r,s,n);case 3:e:{if(Nm(t),e===null)throw Error(I(387));r=t.pendingProps,l=t.memoizedState,s=l.element,nm(e,t),gi(t,r,null,n);var i=t.memoizedState;if(r=i.element,l.isDehydrated)if(l={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=l,t.memoizedState=l,t.flags&256){s=Zr(Error(I(423)),t),t=fd(e,t,r,n,s);break e}else if(r!==s){s=Zr(Error(I(424)),t),t=fd(e,t,r,n,s);break e}else for(ht=Mn(t.stateNode.containerInfo.firstChild),pt=t,we=!0,Nt=null,n=im(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Kr(),r===s){t=hn(e,t,n);break e}Ye(e,t,r,n)}t=t.child}return t;case 5:return om(t),e===null&&Mu(t),r=t.type,s=t.pendingProps,l=e!==null?e.memoizedProps:null,i=s.children,Pu(r,s)?i=null:l!==null&&Pu(r,l)&&(t.flags|=32),Rm(e,t),Ye(e,t,i,n),t.child;case 6:return e===null&&Mu(t),null;case 13:return Mm(e,t,n);case 4:return Za(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Gr(t,null,r,n):Ye(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Tt(r,s),ud(e,t,r,s,n);case 7:return Ye(e,t,t.pendingProps,n),t.child;case 8:return Ye(e,t,t.pendingProps.children,n),t.child;case 12:return Ye(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,l=t.memoizedProps,i=s.value,he(pi,r._currentValue),r._currentValue=i,l!==null)if(zt(l.value,i)){if(l.children===s.children&&!lt.current){t=hn(e,t,n);break e}}else for(l=t.child,l!==null&&(l.return=t);l!==null;){var o=l.dependencies;if(o!==null){i=l.child;for(var u=o.firstContext;u!==null;){if(u.context===r){if(l.tag===1){u=an(-1,n&-n),u.tag=2;var a=l.updateQueue;if(a!==null){a=a.shared;var c=a.pending;c===null?u.next=u:(u.next=c.next,c.next=u),a.pending=u}}l.lanes|=n,u=l.alternate,u!==null&&(u.lanes|=n),Iu(l.return,n,t),o.lanes|=n;break}u=u.next}}else if(l.tag===10)i=l.type===t.type?null:l.child;else if(l.tag===18){if(i=l.return,i===null)throw Error(I(341));i.lanes|=n,o=i.alternate,o!==null&&(o.lanes|=n),Iu(i,n,t),i=l.sibling}else i=l.child;if(i!==null)i.return=l;else for(i=l;i!==null;){if(i===t){i=null;break}if(l=i.sibling,l!==null){l.return=i.return,i=l;break}i=i.return}l=i}Ye(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,jr(t,n),s=Ct(s),r=r(s),t.flags|=1,Ye(e,t,r,n),t.child;case 14:return r=t.type,s=Tt(r,t.pendingProps),s=Tt(r.type,s),ad(e,t,r,s,n);case 15:return Lm(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Tt(r,s),$l(e,t),t.tag=1,it(r)?(e=!0,fi(t)):e=!1,jr(t,n),sm(t,r,s),Du(t,r,s,n),zu(null,t,r,!0,e,n);case 19:return Im(e,t,n);case 22:return Tm(e,t,n)}throw Error(I(156,t.tag))};function Zm(e,t){return Ep(e,t)}function dS(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Et(e,t,n,r){return new dS(e,t,n,r)}function fc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function hS(e){if(typeof e=="function")return fc(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ta)return 11;if(e===Ra)return 14}return 2}function bn(e,t){var n=e.alternate;return n===null?(n=Et(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Kl(e,t,n,r,s,l){var i=2;if(r=e,typeof e=="function")fc(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case yr:return rr(n.children,s,l,t);case La:i=8,s|=8;break;case iu:return e=Et(12,n,t,s|2),e.elementType=iu,e.lanes=l,e;case ou:return e=Et(13,n,t,s),e.elementType=ou,e.lanes=l,e;case uu:return e=Et(19,n,t,s),e.elementType=uu,e.lanes=l,e;case lp:return Ji(n,s,l,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case rp:i=10;break e;case sp:i=9;break e;case Ta:i=11;break e;case Ra:i=14;break e;case En:i=16,r=null;break e}throw Error(I(130,e==null?e:typeof e,""))}return t=Et(i,n,t,s),t.elementType=e,t.type=r,t.lanes=l,t}function rr(e,t,n,r){return e=Et(7,e,r,t),e.lanes=n,e}function Ji(e,t,n,r){return e=Et(22,e,r,t),e.elementType=lp,e.lanes=n,e.stateNode={isHidden:!1},e}function zo(e,t,n){return e=Et(6,e,null,t),e.lanes=n,e}function Bo(e,t,n){return t=Et(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function pS(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=So(0),this.expirationTimes=So(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=So(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function dc(e,t,n,r,s,l,i,o,u){return e=new pS(e,t,n,o,u),t===1?(t=1,l===!0&&(t|=8)):t=0,l=Et(3,null,null,t),e.current=l,l.stateNode=e,l.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ya(l),e}function mS(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(eg)}catch(e){console.error(e)}}eg(),Xh.exports=gt;var SS=Xh.exports,_d=SS;su.createRoot=_d.createRoot,su.hydrateRoot=_d.hydrateRoot;const xS=(e,t)=>{const{id:n=void 0,modelValue:r,style:s={},multiple:l=!1,data:i,settings:o,events:u,children:a}=e,c=nt.useRef(null),d=nt.useRef(),p=nt.useRef();nt.useEffect(()=>{const x={select:c.current,events:{}};i&&(x.data=i),o&&(x.settings=o),u&&(x.events=u),x.events==null&&(x.events={});const _=x.events.afterChange;return x.events.afterChange=function(m){if(Array.isArray(m)&&m.length>0){const f=l?m.map(h=>h.value):m[0].value;p.current!==f&&(p.current=f),x.events&&_&&typeof _=="function"&&_(m)}},d.current=new zh(x),(l?d.current.getSelected():d.current.getSelected()[0])!==r&&r&&d.current.setSelected(r),()=>{var m;d.current&&((m=d.current)==null||m.destroy())}},[r,l,i,o,u,a]);const w=nt.useCallback(x=>{const _=l;return typeof x=="string"?_?[x]:x:Array.isArray(x)?_?x:x[0]:_?[]:""},[l]);return nt.useEffect(()=>{var x;r&&((x=d.current)==null||x.setSelected(w(r)))},[r,w]),nt.useEffect(()=>{var x;i&&((x=d.current)==null||x.setData(i))},[i]),nt.useImperativeHandle(t,()=>({set(x){var _;(_=d.current)==null||_.setSelected(x)},getSlimSelectInstance(){return d.current}}),[]),z.jsx(z.Fragment,{children:z.jsx("select",{style:s,id:n,"data-testid":n,multiple:l,ref:c,children:a})})},Uo=nt.forwardRef(xS),ES=()=>{const[e,t]=nt.useState("2"),[n,r]=nt.useState(["2","3"]);return z.jsxs("div",{id:"react",className:"content",children:[z.jsx("h2",{className:"header",children:"React"}),z.jsx("h3",{children:"Install"}),z.jsx("p",{children:"The react component is in a sub package under SlimSelect. All functionality still work in the implementation."}),z.jsx("div",{className:"code-toolbar",children:z.jsx("pre",{className:"language-bash",children:z.jsx("code",{children:"npm install @slim-select/react"})})}),z.jsx("br",{}),z.jsx("h3",{children:"Simple example"}),z.jsxs("div",{style:{display:"flex",flexDirection:"row",width:"100%"},children:[z.jsxs("div",{style:{flex:.5},children:[z.jsx("strong",{children:"Value"})," ",e,z.jsxs(Uo,{modelValue:e,events:{afterChange:s=>t(s[0].value)},style:{marginLeft:"5px"},ref:null,children:[z.jsx("option",{value:"all",children:"All"}),z.jsx("option",{value:"1",children:"Option 1"}),z.jsx("option",{value:"2",children:"Option 2"}),z.jsx("option",{value:"3",children:"Option 3"})]})]}),z.jsxs("div",{style:{flex:.6,marginLeft:15},children:[z.jsxs("div",{children:[z.jsx("strong",{children:"Value"})," ",JSON.stringify(n)]}),z.jsxs(Uo,{modelValue:n,ref:null,multiple:!0,events:{afterChange:s=>r(s.map(l=>l.value))},children:[z.jsx("option",{value:"1",children:"Option 1"}),z.jsx("option",{value:"2",children:"Option 2"}),z.jsx("option",{value:"3",children:"Value 3"})]})]})]}),z.jsx("div",{className:"code-toolbar",children:z.jsx("pre",{className:"language-javascript",children:z.jsxs("code",{className:"language-javascript",children:['import React from "react" ',z.jsx("br",{}),'import SlimSelect from "@slim-select/react" ',z.jsx("br",{}),"import ","{"," useState ","}",' from "react"',z.jsx("br",{}),z.jsx("br",{}),"export default MySelect = () ","=>"," ","{",z.jsx("br",{}),'const [simpleSingle, setSimpleSingle] = useState("2") ',z.jsx("br",{}),"return ( ",z.jsx("br",{})," setSimpleSingle(values[0].value as unknown as string) }}","> ",z.jsx("br",{}),' ',z.jsx("br",{}),' ',z.jsx("br",{}),' ',z.jsx("br",{}),' ',z.jsx("br",{})," ",z.jsx("br",{})," )","}"]})})}),z.jsx("br",{}),z.jsx("div",{className:"separator"}),z.jsx("br",{}),z.jsx("h3",{children:"Attributes"}),z.jsx("p",{children:"There are certain attributes that are reactive to changes"}),z.jsx("h4",{children:"disabled"}),z.jsxs(Uo,{settings:{disabled:!0},children:[z.jsx("option",{value:"1",children:"Option 1"}),z.jsx("option",{value:"2",children:"Option 2"}),z.jsx("option",{value:"3",children:"Value 3"})]}),z.jsx("div",{className:"code-toolbar",children:z.jsx("pre",{className:"language-javascript",children:z.jsxs("code",{className:"language-javascript",children:['import React from "react" ',z.jsx("br",{}),'import SlimSelect from "@slim-select/react" ',z.jsx("br",{}),"import ","{"," useState ","}",' from "react"',z.jsx("br",{}),z.jsx("br",{}),"export default MySelect = () ","=>"," ","{",z.jsx("br",{}),'const [simpleSingle, setSimpleSingle] = useState("2") ',z.jsx("br",{}),"return ( ",z.jsx("br",{}),"",z.jsx("br",{}),' ',z.jsx("br",{}),' ',z.jsx("br",{}),' ',z.jsx("br",{}),' ',z.jsx("br",{})," ",z.jsx("br",{})," )","}"]})})})]})},_S=document.getElementById("app")?100:0;(function(){window.setInterval(()=>{document.getElementById("react-root")!=null&&document.getElementById("react-hide")!=null&&su.createRoot(document.getElementById("react-root")).render(z.jsx(c1.StrictMode,{children:z.jsx(ES,{})}))},_S)})();export{yt as F,He as O,zh as S,by as _,rn as a,be as b,Eh as c,Mi as d,Fv as e,Fl as f,pf as g,Sa as h,CS as i,AS as j,Gd as k,ah as l,kS as m,na as n,Di as o,Lc as r,hg as t,Wg as w}; +`+l.stack}return{value:e,source:t,stack:s,digest:null}}function bo(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function ba(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Yw=typeof WeakMap=="function"?WeakMap:Map;function Om(e,t,n){n=un(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){xi||(xi=!0,Ka=r),ba(e,t)},n}function Pm(e,t,n){n=un(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var s=t.value;n.payload=function(){return r(s)},n.callback=function(){ba(e,t)}}var l=e.stateNode;return l!==null&&typeof l.componentDidCatch=="function"&&(n.callback=function(){ba(e,t),typeof r!="function"&&(In===null?In=new Set([this]):In.add(this));var i=t.stack;this.componentDidCatch(t.value,{componentStack:i!==null?i:""})}),n}function ld(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Yw;var s=new Set;r.set(t,s)}else s=r.get(t),s===void 0&&(s=new Set,r.set(t,s));s.has(n)||(s.add(n),e=uS.bind(null,e,t,n),t.then(e,e))}function id(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function od(e,t,n,r,s){return e.mode&1?(e.flags|=65536,e.lanes=s,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=un(-1,1),t.tag=2,Fn(n,t,1))),n.lanes|=1),e)}var Zw=mn.ReactCurrentOwner,st=!1;function Ye(e,t,n,r){t.child=e===null?im(t,null,n,r):Gr(t,e.child,n,r)}function ad(e,t,n,r,s){n=n.render;var l=t.ref;return jr(t,s),r=ec(e,t,n,r,l,s),n=tc(),e!==null&&!st?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,hn(e,t,s)):(we&&n&&Vu(t),t.flags|=1,Ye(e,t,r,s),t.child)}function ud(e,t,n,r,s){if(e===null){var l=n.type;return typeof l=="function"&&!fc(l)&&l.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=l,Lm(e,t,l,r,s)):(e=Kl(n.type,null,r,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(l=e.child,!(e.lanes&s)){var i=l.memoizedProps;if(n=n.compare,n=n!==null?n:Qs,n(i,r)&&e.ref===t.ref)return hn(e,t,s)}return t.flags|=1,e=bn(l,r),e.ref=t.ref,e.return=t,t.child=e}function Lm(e,t,n,r,s){if(e!==null){var l=e.memoizedProps;if(Qs(l,r)&&e.ref===t.ref)if(st=!1,t.pendingProps=r=l,(e.lanes&s)!==0)e.flags&131072&&(st=!0);else return t.lanes=e.lanes,hn(e,t,s)}return ja(e,t,n,r,s)}function Tm(e,t,n){var r=t.pendingProps,s=r.children,l=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},he(Pr,dt),dt|=n;else{if(!(n&1073741824))return e=l!==null?l.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,he(Pr,dt),dt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=l!==null?l.baseLanes:n,he(Pr,dt),dt|=r}else l!==null?(r=l.baseLanes|n,t.memoizedState=null):r=n,he(Pr,dt),dt|=r;return Ye(e,t,s,n),t.child}function Rm(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function ja(e,t,n,r,s){var l=it(n)?sr:Ke.current;return l=Qr(t,l),jr(t,s),n=ec(e,t,n,r,l,s),r=tc(),e!==null&&!st?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,hn(e,t,s)):(we&&r&&Vu(t),t.flags|=1,Ye(e,t,n,s),t.child)}function cd(e,t,n,r,s){if(it(n)){var l=!0;fi(t)}else l=!1;if(jr(t,s),t.stateNode===null)$l(e,t),sm(t,n,r),Da(t,n,r,s),r=!0;else if(e===null){var i=t.stateNode,o=t.memoizedProps;i.props=o;var a=i.context,u=n.contextType;typeof u=="object"&&u!==null?u=Ct(u):(u=it(n)?sr:Ke.current,u=Qr(t,u));var c=n.getDerivedStateFromProps,d=typeof c=="function"||typeof i.getSnapshotBeforeUpdate=="function";d||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(o!==r||a!==u)&&td(t,i,r,u),_n=!1;var p=t.memoizedState;i.state=p,gi(t,r,i,s),a=t.memoizedState,o!==r||p!==a||lt.current||_n?(typeof c=="function"&&(Ia(t,n,c,r),a=t.memoizedState),(o=_n||ed(t,n,o,r,p,a,u))?(d||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount()),typeof i.componentDidMount=="function"&&(t.flags|=4194308)):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=a),i.props=r,i.state=a,i.context=u,r=o):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,nm(e,t),o=t.memoizedProps,u=t.type===t.elementType?o:Tt(t.type,o),i.props=u,d=t.pendingProps,p=i.context,a=n.contextType,typeof a=="object"&&a!==null?a=Ct(a):(a=it(n)?sr:Ke.current,a=Qr(t,a));var w=n.getDerivedStateFromProps;(c=typeof w=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(o!==d||p!==a)&&td(t,i,r,a),_n=!1,p=t.memoizedState,i.state=p,gi(t,r,i,s);var x=t.memoizedState;o!==d||p!==x||lt.current||_n?(typeof w=="function"&&(Ia(t,n,w,r),x=t.memoizedState),(u=_n||ed(t,n,u,r,p,x,a)||!1)?(c||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(r,x,a),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(r,x,a)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||o===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=x),i.props=r,i.state=x,i.context=a,r=u):(typeof i.componentDidUpdate!="function"||o===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),r=!1)}return za(e,t,n,r,l,s)}function za(e,t,n,r,s,l){Rm(e,t);var i=(t.flags&128)!==0;if(!r&&!i)return s&&Yf(t,n,!1),hn(e,t,l);r=t.stateNode,Zw.current=t;var o=i&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&i?(t.child=Gr(t,e.child,null,l),t.child=Gr(t,null,o,l)):Ye(e,t,o,l),t.memoizedState=r.state,s&&Yf(t,n,!0),t.child}function Nm(e){var t=e.stateNode;t.pendingContext?Gf(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Gf(e,t.context,!1),Zu(e,t.containerInfo)}function fd(e,t,n,r,s){return Kr(),$u(s),t.flags|=256,Ye(e,t,n,r),t.child}var Ba={dehydrated:null,treeContext:null,retryLane:0};function Ua(e){return{baseLanes:e,cachePool:null,transitions:null}}function Mm(e,t,n){var r=t.pendingProps,s=Ee.current,l=!1,i=(t.flags&128)!==0,o;if((o=i)||(o=e!==null&&e.memoizedState===null?!1:(s&2)!==0),o?(l=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),he(Ee,s&1),e===null)return Ma(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(i=r.children,e=r.fallback,l?(r=t.mode,l=t.child,i={mode:"hidden",children:i},!(r&1)&&l!==null?(l.childLanes=0,l.pendingProps=i):l=Ji(i,r,0,null),e=rr(e,r,n,null),l.return=t,e.return=t,l.sibling=e,t.child=l,t.child.memoizedState=Ua(n),t.memoizedState=Ba,e):sc(t,i));if(s=e.memoizedState,s!==null&&(o=s.dehydrated,o!==null))return Jw(e,t,i,r,o,s,n);if(l){l=r.fallback,i=t.mode,s=e.child,o=s.sibling;var a={mode:"hidden",children:r.children};return!(i&1)&&t.child!==s?(r=t.child,r.childLanes=0,r.pendingProps=a,t.deletions=null):(r=bn(s,a),r.subtreeFlags=s.subtreeFlags&14680064),o!==null?l=bn(o,l):(l=rr(l,i,n,null),l.flags|=2),l.return=t,r.return=t,r.sibling=l,t.child=r,r=l,l=t.child,i=e.child.memoizedState,i=i===null?Ua(n):{baseLanes:i.baseLanes|n,cachePool:null,transitions:i.transitions},l.memoizedState=i,l.childLanes=e.childLanes&~n,t.memoizedState=Ba,r}return l=e.child,e=l.sibling,r=bn(l,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function sc(e,t){return t=Ji({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Al(e,t,n,r){return r!==null&&$u(r),Gr(t,e.child,null,n),e=sc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Jw(e,t,n,r,s,l,i){if(n)return t.flags&256?(t.flags&=-257,r=bo(Error(F(422))),Al(e,t,i,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(l=r.fallback,s=t.mode,r=Ji({mode:"visible",children:r.children},s,0,null),l=rr(l,s,i,null),l.flags|=2,r.return=t,l.return=t,r.sibling=l,t.child=r,t.mode&1&&Gr(t,e.child,null,i),t.child.memoizedState=Ua(i),t.memoizedState=Ba,l);if(!(t.mode&1))return Al(e,t,i,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var o=r.dgst;return r=o,l=Error(F(419)),r=bo(l,r,void 0),Al(e,t,i,r)}if(o=(i&e.childLanes)!==0,st||o){if(r=Ie,r!==null){switch(i&-i){case 4:s=2;break;case 16:s=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(r.suspendedLanes|i)?0:s,s!==0&&s!==l.retryLane&&(l.retryLane=s,dn(e,s),bt(r,e,s,-1))}return cc(),r=bo(Error(F(421))),Al(e,t,i,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=cS.bind(null,e),s._reactRetry=t,null):(e=l.treeContext,ht=Mn(s.nextSibling),pt=t,we=!0,Nt=null,e!==null&&(wt[St++]=sn,wt[St++]=ln,wt[St++]=lr,sn=e.id,ln=e.overflow,lr=t),t=sc(t,r.children),t.flags|=4096,t)}function dd(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Fa(e.return,t,n)}function jo(e,t,n,r,s){var l=e.memoizedState;l===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s}:(l.isBackwards=t,l.rendering=null,l.renderingStartTime=0,l.last=r,l.tail=n,l.tailMode=s)}function Fm(e,t,n){var r=t.pendingProps,s=r.revealOrder,l=r.tail;if(Ye(e,t,r.children,n),r=Ee.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&dd(e,n,t);else if(e.tag===19)dd(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(he(Ee,r),!(t.mode&1))t.memoizedState=null;else switch(s){case"forwards":for(n=t.child,s=null;n!==null;)e=n.alternate,e!==null&&vi(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),jo(t,!1,s,n,l);break;case"backwards":for(n=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&vi(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}jo(t,!0,n,null,l);break;case"together":jo(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function $l(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function hn(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),or|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(F(153));if(t.child!==null){for(e=t.child,n=bn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=bn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Xw(e,t,n){switch(t.tag){case 3:Nm(t),Kr();break;case 5:om(t);break;case 1:it(t.type)&&fi(t);break;case 4:Zu(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;he(pi,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(he(Ee,Ee.current&1),t.flags|=128,null):n&t.child.childLanes?Mm(e,t,n):(he(Ee,Ee.current&1),e=hn(e,t,n),e!==null?e.sibling:null);he(Ee,Ee.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Fm(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),he(Ee,Ee.current),r)break;return null;case 22:case 23:return t.lanes=0,Tm(e,t,n)}return hn(e,t,n)}var Im,Va,Dm,bm;Im=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Va=function(){};Dm=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,Xn(Zt.current);var l=null;switch(n){case"input":s=ca(e,s),r=ca(e,r),l=[];break;case"select":s=Ce({},s,{value:void 0}),r=Ce({},r,{value:void 0}),l=[];break;case"textarea":s=ha(e,s),r=ha(e,r),l=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=ui)}ma(n,r);var i;n=null;for(u in s)if(!r.hasOwnProperty(u)&&s.hasOwnProperty(u)&&s[u]!=null)if(u==="style"){var o=s[u];for(i in o)o.hasOwnProperty(i)&&(n||(n={}),n[i]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(zs.hasOwnProperty(u)?l||(l=[]):(l=l||[]).push(u,null));for(u in r){var a=r[u];if(o=s!=null?s[u]:void 0,r.hasOwnProperty(u)&&a!==o&&(a!=null||o!=null))if(u==="style")if(o){for(i in o)!o.hasOwnProperty(i)||a&&a.hasOwnProperty(i)||(n||(n={}),n[i]="");for(i in a)a.hasOwnProperty(i)&&o[i]!==a[i]&&(n||(n={}),n[i]=a[i])}else n||(l||(l=[]),l.push(u,n)),n=a;else u==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,o=o?o.__html:void 0,a!=null&&o!==a&&(l=l||[]).push(u,a)):u==="children"?typeof a!="string"&&typeof a!="number"||(l=l||[]).push(u,""+a):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(zs.hasOwnProperty(u)?(a!=null&&u==="onScroll"&&pe("scroll",e),l||o===a||(l=[])):(l=l||[]).push(u,a))}n&&(l=l||[]).push("style",n);var u=l;(t.updateQueue=u)&&(t.flags|=4)}};bm=function(e,t,n,r){n!==r&&(t.flags|=4)};function ds(e,t){if(!we)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Ve(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function qw(e,t,n){var r=t.pendingProps;switch(Hu(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ve(t),null;case 1:return it(t.type)&&ci(),Ve(t),null;case 3:return r=t.stateNode,Yr(),me(lt),me(Ke),Xu(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Cl(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Nt!==null&&(Za(Nt),Nt=null))),Va(e,t),Ve(t),null;case 5:Ju(t);var s=Xn(Js.current);if(n=t.type,e!==null&&t.stateNode!=null)Dm(e,t,n,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(F(166));return Ve(t),null}if(e=Xn(Zt.current),Cl(t)){r=t.stateNode,n=t.type;var l=t.memoizedProps;switch(r[Gt]=t,r[Ys]=l,e=(t.mode&1)!==0,n){case"dialog":pe("cancel",r),pe("close",r);break;case"iframe":case"object":case"embed":pe("load",r);break;case"video":case"audio":for(s=0;s<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[Gt]=t,e[Ys]=r,Im(e,t,!1,!1),t.stateNode=e;e:{switch(i=ga(n,r),n){case"dialog":pe("cancel",e),pe("close",e),s=r;break;case"iframe":case"object":case"embed":pe("load",e),s=r;break;case"video":case"audio":for(s=0;sJr&&(t.flags|=128,r=!0,ds(l,!1),t.lanes=4194304)}else{if(!r)if(e=vi(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ds(l,!0),l.tail===null&&l.tailMode==="hidden"&&!i.alternate&&!we)return Ve(t),null}else 2*Oe()-l.renderingStartTime>Jr&&n!==1073741824&&(t.flags|=128,r=!0,ds(l,!1),t.lanes=4194304);l.isBackwards?(i.sibling=t.child,t.child=i):(n=l.last,n!==null?n.sibling=i:t.child=i,l.last=i)}return l.tail!==null?(t=l.tail,l.rendering=t,l.tail=t.sibling,l.renderingStartTime=Oe(),t.sibling=null,n=Ee.current,he(Ee,r?n&1|2:n&1),t):(Ve(t),null);case 22:case 23:return uc(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?dt&1073741824&&(Ve(t),t.subtreeFlags&6&&(t.flags|=8192)):Ve(t),null;case 24:return null;case 25:return null}throw Error(F(156,t.tag))}function eS(e,t){switch(Hu(t),t.tag){case 1:return it(t.type)&&ci(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Yr(),me(lt),me(Ke),Xu(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ju(t),null;case 13:if(me(Ee),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(F(340));Kr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return me(Ee),null;case 4:return Yr(),null;case 10:return Ku(t.type._context),null;case 22:case 23:return uc(),null;case 24:return null;default:return null}}var Ol=!1,$e=!1,tS=typeof WeakSet=="function"?WeakSet:Set,$=null;function Or(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Ae(e,t,r)}else n.current=null}function Ha(e,t,n){try{n()}catch(r){Ae(e,t,r)}}var hd=!1;function nS(e,t){if(Aa=ii,e=Up(),Uu(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,l=r.focusNode;r=r.focusOffset;try{n.nodeType,l.nodeType}catch{n=null;break e}var i=0,o=-1,a=-1,u=0,c=0,d=e,p=null;t:for(;;){for(var w;d!==n||s!==0&&d.nodeType!==3||(o=i+s),d!==l||r!==0&&d.nodeType!==3||(a=i+r),d.nodeType===3&&(i+=d.nodeValue.length),(w=d.firstChild)!==null;)p=d,d=w;for(;;){if(d===e)break t;if(p===n&&++u===s&&(o=i),p===l&&++c===r&&(a=i),(w=d.nextSibling)!==null)break;d=p,p=d.parentNode}d=w}n=o===-1||a===-1?null:{start:o,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(Oa={focusedElem:e,selectionRange:n},ii=!1,$=t;$!==null;)if(t=$,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,$=e;else for(;$!==null;){t=$;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var _=x.memoizedProps,L=x.memoizedState,m=t.stateNode,f=m.getSnapshotBeforeUpdate(t.elementType===t.type?_:Tt(t.type,_),L);m.__reactInternalSnapshotBeforeUpdate=f}break;case 3:var h=t.stateNode.containerInfo;h.nodeType===1?h.textContent="":h.nodeType===9&&h.documentElement&&h.removeChild(h.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(F(163))}}catch(y){Ae(t,t.return,y)}if(e=t.sibling,e!==null){e.return=t.return,$=e;break}$=t.return}return x=hd,hd=!1,x}function Rs(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var l=s.destroy;s.destroy=void 0,l!==void 0&&Ha(t,n,l)}s=s.next}while(s!==r)}}function Yi(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function $a(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function jm(e){var t=e.alternate;t!==null&&(e.alternate=null,jm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Gt],delete t[Ys],delete t[Ta],delete t[jw],delete t[zw])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function zm(e){return e.tag===5||e.tag===3||e.tag===4}function pd(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||zm(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Wa(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=ui));else if(r!==4&&(e=e.child,e!==null))for(Wa(e,t,n),e=e.sibling;e!==null;)Wa(e,t,n),e=e.sibling}function Qa(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Qa(e,t,n),e=e.sibling;e!==null;)Qa(e,t,n),e=e.sibling}var De=null,Rt=!1;function yn(e,t,n){for(n=n.child;n!==null;)Bm(e,t,n),n=n.sibling}function Bm(e,t,n){if(Yt&&typeof Yt.onCommitFiberUnmount=="function")try{Yt.onCommitFiberUnmount(Ui,n)}catch{}switch(n.tag){case 5:$e||Or(n,t);case 6:var r=De,s=Rt;De=null,yn(e,t,n),De=r,Rt=s,De!==null&&(Rt?(e=De,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):De.removeChild(n.stateNode));break;case 18:De!==null&&(Rt?(e=De,n=n.stateNode,e.nodeType===8?Ro(e.parentNode,n):e.nodeType===1&&Ro(e,n),$s(e)):Ro(De,n.stateNode));break;case 4:r=De,s=Rt,De=n.stateNode.containerInfo,Rt=!0,yn(e,t,n),De=r,Rt=s;break;case 0:case 11:case 14:case 15:if(!$e&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var l=s,i=l.destroy;l=l.tag,i!==void 0&&(l&2||l&4)&&Ha(n,t,i),s=s.next}while(s!==r)}yn(e,t,n);break;case 1:if(!$e&&(Or(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(o){Ae(n,t,o)}yn(e,t,n);break;case 21:yn(e,t,n);break;case 22:n.mode&1?($e=(r=$e)||n.memoizedState!==null,yn(e,t,n),$e=r):yn(e,t,n);break;default:yn(e,t,n)}}function md(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new tS),t.forEach(function(r){var s=fS.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Pt(e,t){var n=t.deletions;if(n!==null)for(var r=0;rs&&(s=i),r&=~l}if(r=s,r=Oe()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*sS(r/1960))-r,10e?16:e,On===null)var r=!1;else{if(e=On,On=null,Ei=0,oe&6)throw Error(F(331));var s=oe;for(oe|=4,$=e.current;$!==null;){var l=$,i=l.child;if($.flags&16){var o=l.deletions;if(o!==null){for(var a=0;aOe()-oc?nr(e,0):ic|=n),ot(e,t)}function Gm(e,t){t===0&&(e.mode&1?(t=yl,yl<<=1,!(yl&130023424)&&(yl=4194304)):t=1);var n=Je();e=dn(e,t),e!==null&&(rl(e,t,n),ot(e,n))}function cS(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Gm(e,n)}function fS(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(F(314))}r!==null&&r.delete(t),Gm(e,n)}var Ym;Ym=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||lt.current)st=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return st=!1,Xw(e,t,n);st=!!(e.flags&131072)}else st=!1,we&&t.flags&1048576&&Xp(t,hi,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;$l(e,t),e=t.pendingProps;var s=Qr(t,Ke.current);jr(t,n),s=ec(null,t,r,e,s,n);var l=tc();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,it(r)?(l=!0,fi(t)):l=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Yu(t),s.updater=Ki,t.stateNode=s,s._reactInternals=t,Da(t,r,e,n),t=za(null,t,r,!0,l,n)):(t.tag=0,we&&l&&Vu(t),Ye(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch($l(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=hS(r),e=Tt(r,e),s){case 0:t=ja(null,t,r,e,n);break e;case 1:t=cd(null,t,r,e,n);break e;case 11:t=ad(null,t,r,e,n);break e;case 14:t=ud(null,t,r,Tt(r.type,e),n);break e}throw Error(F(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Tt(r,s),ja(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Tt(r,s),cd(e,t,r,s,n);case 3:e:{if(Nm(t),e===null)throw Error(F(387));r=t.pendingProps,l=t.memoizedState,s=l.element,nm(e,t),gi(t,r,null,n);var i=t.memoizedState;if(r=i.element,l.isDehydrated)if(l={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=l,t.memoizedState=l,t.flags&256){s=Zr(Error(F(423)),t),t=fd(e,t,r,n,s);break e}else if(r!==s){s=Zr(Error(F(424)),t),t=fd(e,t,r,n,s);break e}else for(ht=Mn(t.stateNode.containerInfo.firstChild),pt=t,we=!0,Nt=null,n=im(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Kr(),r===s){t=hn(e,t,n);break e}Ye(e,t,r,n)}t=t.child}return t;case 5:return om(t),e===null&&Ma(t),r=t.type,s=t.pendingProps,l=e!==null?e.memoizedProps:null,i=s.children,Pa(r,s)?i=null:l!==null&&Pa(r,l)&&(t.flags|=32),Rm(e,t),Ye(e,t,i,n),t.child;case 6:return e===null&&Ma(t),null;case 13:return Mm(e,t,n);case 4:return Zu(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Gr(t,null,r,n):Ye(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Tt(r,s),ad(e,t,r,s,n);case 7:return Ye(e,t,t.pendingProps,n),t.child;case 8:return Ye(e,t,t.pendingProps.children,n),t.child;case 12:return Ye(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,l=t.memoizedProps,i=s.value,he(pi,r._currentValue),r._currentValue=i,l!==null)if(zt(l.value,i)){if(l.children===s.children&&!lt.current){t=hn(e,t,n);break e}}else for(l=t.child,l!==null&&(l.return=t);l!==null;){var o=l.dependencies;if(o!==null){i=l.child;for(var a=o.firstContext;a!==null;){if(a.context===r){if(l.tag===1){a=un(-1,n&-n),a.tag=2;var u=l.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?a.next=a:(a.next=c.next,c.next=a),u.pending=a}}l.lanes|=n,a=l.alternate,a!==null&&(a.lanes|=n),Fa(l.return,n,t),o.lanes|=n;break}a=a.next}}else if(l.tag===10)i=l.type===t.type?null:l.child;else if(l.tag===18){if(i=l.return,i===null)throw Error(F(341));i.lanes|=n,o=i.alternate,o!==null&&(o.lanes|=n),Fa(i,n,t),i=l.sibling}else i=l.child;if(i!==null)i.return=l;else for(i=l;i!==null;){if(i===t){i=null;break}if(l=i.sibling,l!==null){l.return=i.return,i=l;break}i=i.return}l=i}Ye(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,jr(t,n),s=Ct(s),r=r(s),t.flags|=1,Ye(e,t,r,n),t.child;case 14:return r=t.type,s=Tt(r,t.pendingProps),s=Tt(r.type,s),ud(e,t,r,s,n);case 15:return Lm(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Tt(r,s),$l(e,t),t.tag=1,it(r)?(e=!0,fi(t)):e=!1,jr(t,n),sm(t,r,s),Da(t,r,s,n),za(null,t,r,!0,e,n);case 19:return Fm(e,t,n);case 22:return Tm(e,t,n)}throw Error(F(156,t.tag))};function Zm(e,t){return Ep(e,t)}function dS(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Et(e,t,n,r){return new dS(e,t,n,r)}function fc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function hS(e){if(typeof e=="function")return fc(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Tu)return 11;if(e===Ru)return 14}return 2}function bn(e,t){var n=e.alternate;return n===null?(n=Et(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Kl(e,t,n,r,s,l){var i=2;if(r=e,typeof e=="function")fc(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case yr:return rr(n.children,s,l,t);case Lu:i=8,s|=8;break;case ia:return e=Et(12,n,t,s|2),e.elementType=ia,e.lanes=l,e;case oa:return e=Et(13,n,t,s),e.elementType=oa,e.lanes=l,e;case aa:return e=Et(19,n,t,s),e.elementType=aa,e.lanes=l,e;case lp:return Ji(n,s,l,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case rp:i=10;break e;case sp:i=9;break e;case Tu:i=11;break e;case Ru:i=14;break e;case En:i=16,r=null;break e}throw Error(F(130,e==null?e:typeof e,""))}return t=Et(i,n,t,s),t.elementType=e,t.type=r,t.lanes=l,t}function rr(e,t,n,r){return e=Et(7,e,r,t),e.lanes=n,e}function Ji(e,t,n,r){return e=Et(22,e,r,t),e.elementType=lp,e.lanes=n,e.stateNode={isHidden:!1},e}function zo(e,t,n){return e=Et(6,e,null,t),e.lanes=n,e}function Bo(e,t,n){return t=Et(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function pS(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=So(0),this.expirationTimes=So(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=So(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function dc(e,t,n,r,s,l,i,o,a){return e=new pS(e,t,n,o,a),t===1?(t=1,l===!0&&(t|=8)):t=0,l=Et(3,null,null,t),e.current=l,l.stateNode=e,l.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Yu(l),e}function mS(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(eg)}catch(e){console.error(e)}}eg(),Xh.exports=gt;var SS=Xh.exports,_d=SS;sa.createRoot=_d.createRoot,sa.hydrateRoot=_d.hydrateRoot;const xS=(e,t)=>{const{id:n=void 0,modelValue:r,style:s={},multiple:l=!1,data:i,settings:o,events:a,children:u}=e,c=nt.useRef(null),d=nt.useRef(),p=nt.useRef();nt.useEffect(()=>{const x={select:c.current,events:{}};i&&(x.data=i),o&&(x.settings=o),a&&(x.events=a),x.events==null&&(x.events={});const _=x.events.afterChange;return x.events.afterChange=function(m){if(Array.isArray(m)&&m.length>0){const f=l?m.map(h=>h.value):m[0].value;p.current!==f&&(p.current=f),x.events&&_&&typeof _=="function"&&_(m)}},d.current=new zh(x),(l?d.current.getSelected():d.current.getSelected()[0])!==r&&r&&d.current.setSelected(r),()=>{var m;d.current&&((m=d.current)==null||m.destroy())}},[r,l,i,o,a,u]);const w=nt.useCallback(x=>{const _=l;return typeof x=="string"?_?[x]:x:Array.isArray(x)?_?x:x[0]:_?[]:""},[l]);return nt.useEffect(()=>{var x;r&&((x=d.current)==null||x.setSelected(w(r)))},[r,w]),nt.useEffect(()=>{var x;i&&((x=d.current)==null||x.setData(i))},[i]),nt.useImperativeHandle(t,()=>({set(x){var _;(_=d.current)==null||_.setSelected(x)},getSlimSelectInstance(){return d.current}}),[]),z.jsx(z.Fragment,{children:z.jsx("select",{style:s,id:n,"data-testid":n,multiple:l,ref:c,children:u})})},Uo=nt.forwardRef(xS),ES=()=>{const[e,t]=nt.useState("2"),[n,r]=nt.useState(["2","3"]);return z.jsxs("div",{id:"react",className:"content",children:[z.jsx("h2",{className:"header",children:"React"}),z.jsx("h3",{children:"Install"}),z.jsx("p",{children:"The react component is in a sub package under SlimSelect. All functionality still work in the implementation."}),z.jsx("div",{className:"code-toolbar",children:z.jsx("pre",{className:"language-bash",children:z.jsx("code",{children:"npm install @slim-select/react"})})}),z.jsx("br",{}),z.jsx("h3",{children:"Simple example"}),z.jsxs("div",{style:{display:"flex",flexDirection:"row",width:"100%"},children:[z.jsxs("div",{style:{flex:.5},children:[z.jsx("strong",{children:"Value"})," ",e,z.jsxs(Uo,{modelValue:e,events:{afterChange:s=>t(s[0].value)},style:{marginLeft:"5px"},ref:null,children:[z.jsx("option",{value:"all",children:"All"}),z.jsx("option",{value:"1",children:"Option 1"}),z.jsx("option",{value:"2",children:"Option 2"}),z.jsx("option",{value:"3",children:"Option 3"})]})]}),z.jsxs("div",{style:{flex:.6,marginLeft:15},children:[z.jsxs("div",{children:[z.jsx("strong",{children:"Value"})," ",JSON.stringify(n)]}),z.jsxs(Uo,{modelValue:n,ref:null,multiple:!0,events:{afterChange:s=>r(s.map(l=>l.value))},children:[z.jsx("option",{value:"1",children:"Option 1"}),z.jsx("option",{value:"2",children:"Option 2"}),z.jsx("option",{value:"3",children:"Value 3"})]})]})]}),z.jsx("div",{className:"code-toolbar",children:z.jsx("pre",{className:"language-javascript",children:z.jsxs("code",{className:"language-javascript",children:['import React from "react" ',z.jsx("br",{}),'import SlimSelect from "@slim-select/react" ',z.jsx("br",{}),"import ","{"," useState ","}",' from "react"',z.jsx("br",{}),z.jsx("br",{}),"export default MySelect = () ","=>"," ","{",z.jsx("br",{}),'const [simpleSingle, setSimpleSingle] = useState("2") ',z.jsx("br",{}),"return ( ",z.jsx("br",{})," setSimpleSingle(values[0].value as unknown as string) }}","> ",z.jsx("br",{}),' ',z.jsx("br",{}),' ',z.jsx("br",{}),' ',z.jsx("br",{}),' ',z.jsx("br",{})," ",z.jsx("br",{})," )","}"]})})}),z.jsx("br",{}),z.jsx("div",{className:"separator"}),z.jsx("br",{}),z.jsx("h3",{children:"Attributes"}),z.jsx("p",{children:"There are certain attributes that are reactive to changes"}),z.jsx("h4",{children:"disabled"}),z.jsxs(Uo,{settings:{disabled:!0},children:[z.jsx("option",{value:"1",children:"Option 1"}),z.jsx("option",{value:"2",children:"Option 2"}),z.jsx("option",{value:"3",children:"Value 3"})]}),z.jsx("div",{className:"code-toolbar",children:z.jsx("pre",{className:"language-javascript",children:z.jsxs("code",{className:"language-javascript",children:['import React from "react" ',z.jsx("br",{}),'import SlimSelect from "@slim-select/react" ',z.jsx("br",{}),"import ","{"," useState ","}",' from "react"',z.jsx("br",{}),z.jsx("br",{}),"export default MySelect = () ","=>"," ","{",z.jsx("br",{}),'const [simpleSingle, setSimpleSingle] = useState("2") ',z.jsx("br",{}),"return ( ",z.jsx("br",{}),"",z.jsx("br",{}),' ',z.jsx("br",{}),' ',z.jsx("br",{}),' ',z.jsx("br",{}),' ',z.jsx("br",{})," ",z.jsx("br",{})," )","}"]})})})]})},_S=document.getElementById("app")?100:0;(function(){window.setInterval(()=>{document.getElementById("react-root")!=null&&document.getElementById("react-hide")!=null&&sa.createRoot(document.getElementById("react-root")).render(z.jsx(c1.StrictMode,{children:z.jsx(ES,{})}))},_S)})();export{yt as F,He as O,zh as S,by as _,rn as a,be as b,Eh as c,Mi as d,Iv as e,Il as f,pf as g,Su as h,CS as i,AS as j,Gd as k,uh as l,kS as m,nu as n,Di as o,Lc as r,hg as t,Wg as w}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { __vite__mapDeps.viteFileDeps = ["assets/home.js","assets/home.css","assets/index2.js","assets/index2.css"] diff --git a/src/slim-select/index.ts b/src/slim-select/index.ts index 4c4cbbb0..51c34ac9 100644 --- a/src/slim-select/index.ts +++ b/src/slim-select/index.ts @@ -102,9 +102,9 @@ export default class SlimSelect { this.select.hideUI() // Hide the original select element // Add select listeners - this.select.onValueChange = (values: string[]) => { + this.select.onValueChange = (options: Option[]) => { // Run set selected from the values given - this.setSelected(values) + this.setSelected(options.map(option => option.id)) } this.select.onClassChange = (classes: string[]) => { // Update settings with new class @@ -248,12 +248,12 @@ export default class SlimSelect { return this.store.getSelected() } - public setSelected(value: string | string[], runAfterChange = true): void { + public setSelected(id: string | string[], runAfterChange = true): void { // Get original selected values const selected = this.store.getSelected() // Update the store - this.store.setSelectedBy('value', Array.isArray(value) ? value : [value]) + this.store.setSelectedBy('id', Array.isArray(id) ? id : [id]) const data = this.store.getData() // Update the select element diff --git a/src/slim-select/render.ts b/src/slim-select/render.ts index f2bd6632..005a2525 100644 --- a/src/slim-select/render.ts +++ b/src/slim-select/render.ts @@ -321,9 +321,9 @@ export default class Render { } else { // Get first option and set it as selected const firstOption = this.store.getFirstOption() - const value = firstOption ? firstOption.value : '' + const id = firstOption ? firstOption.id : '' - this.callbacks.setSelected(value, false) + this.callbacks.setSelected(id, false) } // Check if we need to close the dropdown @@ -592,20 +592,20 @@ export default class Render { } if (shouldDelete) { - // Loop through after and append values to a variable called selected - let selectedValues: string[] = [] + // Loop through after and append ids to a variable called selected + let selectedIds: string[] = [] for (const o of after) { if (o instanceof Optgroup) { for (const c of o.options) { - selectedValues.push(c.value) + selectedIds.push(c.id) } } if (o instanceof Option) { - selectedValues.push(o.value) + selectedIds.push(o.id) } } - this.callbacks.setSelected(selectedValues, false) + this.callbacks.setSelected(selectedIds, false) // Check if we need to close the dropdown if (this.settings.closeOnSelect) { @@ -790,11 +790,11 @@ export default class Render { // set selected value for single and multiple if (this.settings.isMultiple) { - let values = this.store.getSelected() - values.push(newOption.value) - this.callbacks.setSelected(values, true) + let ids = this.store.getSelected() + ids.push(newOption.id) + this.callbacks.setSelected(ids, true) } else { - this.callbacks.setSelected([newOption.value], true) + this.callbacks.setSelected([newOption.id], true) } // Clear search @@ -1074,7 +1074,7 @@ export default class Render { // Put together new list minus all options in this optgroup const newSelected = currentSelected.filter((s) => { for (const o of d.options) { - if (s === o.value) { + if (s === o.id) { return false } } @@ -1086,7 +1086,7 @@ export default class Render { return } else { // Put together new list with all options in this optgroup - const newSelected = currentSelected.concat(d.options.map((o) => o.value)) + const newSelected = currentSelected.concat(d.options.map((o) => o.id)) // Loop through options and if they don't exist in the store // run addOption callback @@ -1315,7 +1315,7 @@ export default class Render { // Get values from after and set as selected this.callbacks.setSelected( - after.map((o: Option) => o.value), + after.map((o: Option) => o.id), false, ) diff --git a/src/slim-select/select.ts b/src/slim-select/select.ts index e56c83f4..c946b418 100644 --- a/src/slim-select/select.ts +++ b/src/slim-select/select.ts @@ -5,7 +5,7 @@ export default class Select { public select: HTMLSelectElement // Mutation observer fields - public onValueChange?: (value: string[]) => void + public onValueChange?: (value: Option[]) => void public onClassChange?: (classes: string[]) => void public onDisabledChange?: (disabled: boolean) => void public onOptionsChange?: (data: DataArrayPartial) => void @@ -77,7 +77,7 @@ export default class Select { // and will call the onValueChange function if it exists public valueChange(ev: Event): boolean { if (this.listen && this.onValueChange) { - this.onValueChange(this.getSelectedValues()) + this.onValueChange(this.getSelectedOptions()) } // Allow bubbling back to other change event listeners @@ -194,19 +194,19 @@ export default class Select { } as Option } - public getSelectedValues(): string[] { - let values = [] + public getSelectedOptions(): Option[] { + let options = [] // Loop through options and set selected - const options = this.select.childNodes as any as (HTMLOptGroupElement | HTMLOptionElement)[] - for (const o of options) { + const opts = this.select.childNodes as any as (HTMLOptGroupElement | HTMLOptionElement)[] + for (const o of opts) { if (o.nodeName === 'OPTGROUP') { const optgroupOptions = o.childNodes as any as HTMLOptionElement[] for (const oo of optgroupOptions) { if (oo.nodeName === 'OPTION') { const option = oo as HTMLOptionElement if (option.selected) { - values.push(option.value) + options.push(this.getDataFromOption(option)) } } } @@ -215,15 +215,19 @@ export default class Select { if (o.nodeName === 'OPTION') { const option = o as HTMLOptionElement if (option.selected) { - values.push(option.value) + options.push(this.getDataFromOption(option)) } } } - return values + return options + } + + public getSelectedValues(): string[] { + return this.getSelectedOptions().map(option => option.value); } - public setSelected(value: string[]): void { + public setSelected(ids: string[]): void { // Stop listening to changes this.changeListen(false) @@ -236,14 +240,14 @@ export default class Select { for (const oo of optgroupOptions) { if (oo.nodeName === 'OPTION') { const option = oo as HTMLOptionElement - option.selected = value.includes(option.value) + option.selected = ids.includes(option.id) } } } if (o.nodeName === 'OPTION') { const option = o as HTMLOptionElement - option.selected = value.includes(option.value) + option.selected = ids.includes(option.id) } } diff --git a/src/slim-select/store.ts b/src/slim-select/store.ts index 25fe3f96..2c924ec7 100644 --- a/src/slim-select/store.ts +++ b/src/slim-select/store.ts @@ -169,7 +169,7 @@ export default class Store { // Run this.data through setSelected by value // to set the selected property and clean any wrong selected if (this.selectType === 'single') { - this.setSelectedBy('value', this.getSelected()) + this.setSelectedBy('id', this.getSelected()) } } @@ -236,15 +236,7 @@ export default class Store { } public getSelected(): string[] { - let selectedOptions = this.getSelectedOptions() - let selectedValues: string[] = [] - - // Loop through each option and get the value - selectedOptions.forEach((option: Option) => { - selectedValues.push(option.value) - }) - - return selectedValues + return this.getSelectedOptions().map(option => option.id) } public getSelectedOptions(): Option[] { @@ -253,17 +245,6 @@ export default class Store { }, false) as Option[] } - public getSelectedIDs(): string[] { - let selectedOptions = this.getSelectedOptions() - - let selectedIDs: string[] = [] - selectedOptions.forEach((op: Option) => { - selectedIDs.push(op.id) - }) - - return selectedIDs - } - public getOptgroupByID(id: string): Optgroup | null { // Loop through each data object // and if optgroup is found, return it diff --git a/src/vue/dist/slim-select/index.d.ts b/src/vue/dist/slim-select/index.d.ts index e90aa361..4296bbe5 100644 --- a/src/vue/dist/slim-select/index.d.ts +++ b/src/vue/dist/slim-select/index.d.ts @@ -33,7 +33,7 @@ export default class SlimSelect { getData(): DataArray; setData(data: DataArrayPartial): void; getSelected(): string[]; - setSelected(value: string | string[], runAfterChange?: boolean): void; + setSelected(id: string | string[], runAfterChange?: boolean): void; addOption(option: OptionOptional): void; open(): void; close(eventType?: string | null): void; diff --git a/src/vue/dist/slim-select/select.d.ts b/src/vue/dist/slim-select/select.d.ts index 3b9dd83e..62b6f779 100644 --- a/src/vue/dist/slim-select/select.d.ts +++ b/src/vue/dist/slim-select/select.d.ts @@ -1,7 +1,7 @@ import { DataArray, DataArrayPartial, Optgroup, OptgroupOptional, Option } from './store'; export default class Select { select: HTMLSelectElement; - onValueChange?: (value: string[]) => void; + onValueChange?: (value: Option[]) => void; onClassChange?: (classes: string[]) => void; onDisabledChange?: (disabled: boolean) => void; onOptionsChange?: (data: DataArrayPartial) => void; @@ -18,8 +18,9 @@ export default class Select { getData(): DataArrayPartial; getDataFromOptgroup(optgroup: HTMLOptGroupElement): OptgroupOptional; getDataFromOption(option: HTMLOptionElement): Option; + getSelectedOptions(): Option[]; getSelectedValues(): string[]; - setSelected(value: string[]): void; + setSelected(ids: string[]): void; updateSelect(id?: string, style?: string, classes?: string[]): void; updateOptions(data: DataArray): void; createOptgroup(optgroup: Optgroup): HTMLOptGroupElement; diff --git a/src/vue/dist/slim-select/store.d.ts b/src/vue/dist/slim-select/store.d.ts index ad71bb55..e00d0d80 100644 --- a/src/vue/dist/slim-select/store.d.ts +++ b/src/vue/dist/slim-select/store.d.ts @@ -67,7 +67,6 @@ export default class Store { setSelectedBy(selectedType: 'id' | 'value', selectedValues: string[]): void; getSelected(): string[]; getSelectedOptions(): Option[]; - getSelectedIDs(): string[]; getOptgroupByID(id: string): Optgroup | null; getOptionByID(id: string): Option | null; getSelectType(): string; diff --git a/src/vue/dist/slimselectvue.es.js b/src/vue/dist/slimselectvue.es.js index 1b02a947..5f2c9b85 100644 --- a/src/vue/dist/slimselectvue.es.js +++ b/src/vue/dist/slimselectvue.es.js @@ -143,7 +143,7 @@ class Store { setData(data) { this.data = this.partialToFullData(data); if (this.selectType === 'single') { - this.setSelectedBy('value', this.getSelected()); + this.setSelectedBy('id', this.getSelected()); } } getData() { @@ -185,26 +185,13 @@ class Store { } } getSelected() { - let selectedOptions = this.getSelectedOptions(); - let selectedValues = []; - selectedOptions.forEach((option) => { - selectedValues.push(option.value); - }); - return selectedValues; + return this.getSelectedOptions().map(option => option.id); } getSelectedOptions() { return this.filter((opt) => { return opt.selected; }, false); } - getSelectedIDs() { - let selectedOptions = this.getSelectedOptions(); - let selectedIDs = []; - selectedOptions.forEach((op) => { - selectedIDs.push(op.id); - }); - return selectedIDs; - } getOptgroupByID(id) { for (let dataObj of this.data) { if (dataObj instanceof Optgroup && dataObj.id === id) { @@ -456,8 +443,8 @@ class Render { } else { const firstOption = this.store.getFirstOption(); - const value = firstOption ? firstOption.value : ''; - this.callbacks.setSelected(value, false); + const id = firstOption ? firstOption.id : ''; + this.callbacks.setSelected(id, false); } if (this.settings.closeOnSelect) { this.callbacks.close(); @@ -657,18 +644,18 @@ class Render { shouldDelete = this.callbacks.beforeChange(after, before) === true; } if (shouldDelete) { - let selectedValues = []; + let selectedIds = []; for (const o of after) { if (o instanceof Optgroup) { for (const c of o.options) { - selectedValues.push(c.value); + selectedIds.push(c.id); } } if (o instanceof Option) { - selectedValues.push(o.value); + selectedIds.push(o.id); } } - this.callbacks.setSelected(selectedValues, false); + this.callbacks.setSelected(selectedIds, false); if (this.settings.closeOnSelect) { this.callbacks.close(); } @@ -797,12 +784,12 @@ class Render { let newOption = new Option(oo); this.callbacks.addOption(newOption); if (this.settings.isMultiple) { - let values = this.store.getSelected(); - values.push(newOption.value); - this.callbacks.setSelected(values, true); + let ids = this.store.getSelected(); + ids.push(newOption.id); + this.callbacks.setSelected(ids, true); } else { - this.callbacks.setSelected([newOption.value], true); + this.callbacks.setSelected([newOption.id], true); } this.callbacks.search(''); if (this.settings.closeOnSelect) { @@ -990,7 +977,7 @@ class Render { if (allSelected) { const newSelected = currentSelected.filter((s) => { for (const o of d.options) { - if (s === o.value) { + if (s === o.id) { return false; } } @@ -1000,7 +987,7 @@ class Render { return; } else { - const newSelected = currentSelected.concat(d.options.map((o) => o.value)); + const newSelected = currentSelected.concat(d.options.map((o) => o.id)); for (const o of d.options) { if (!this.store.getOptionByID(o.id)) { this.callbacks.addOption(o); @@ -1157,7 +1144,7 @@ class Render { if (!this.store.getOptionByID(elementID)) { this.callbacks.addOption(option); } - this.callbacks.setSelected(after.map((o) => o.value), false); + this.callbacks.setSelected(after.map((o) => o.id), false); if (this.settings.closeOnSelect) { this.callbacks.close(); } @@ -1303,7 +1290,7 @@ class Select { } valueChange(ev) { if (this.listen && this.onValueChange) { - this.onValueChange(this.getSelectedValues()); + this.onValueChange(this.getSelectedOptions()); } return true; } @@ -1387,17 +1374,17 @@ class Select { data: option.dataset, }; } - getSelectedValues() { - let values = []; - const options = this.select.childNodes; - for (const o of options) { + getSelectedOptions() { + let options = []; + const opts = this.select.childNodes; + for (const o of opts) { if (o.nodeName === 'OPTGROUP') { const optgroupOptions = o.childNodes; for (const oo of optgroupOptions) { if (oo.nodeName === 'OPTION') { const option = oo; if (option.selected) { - values.push(option.value); + options.push(this.getDataFromOption(option)); } } } @@ -1405,13 +1392,16 @@ class Select { if (o.nodeName === 'OPTION') { const option = o; if (option.selected) { - values.push(option.value); + options.push(this.getDataFromOption(option)); } } } - return values; + return options; + } + getSelectedValues() { + return this.getSelectedOptions().map(option => option.value); } - setSelected(value) { + setSelected(ids) { this.changeListen(false); const options = this.select.childNodes; for (const o of options) { @@ -1421,13 +1411,13 @@ class Select { for (const oo of optgroupOptions) { if (oo.nodeName === 'OPTION') { const option = oo; - option.selected = value.includes(option.value); + option.selected = ids.includes(option.id); } } } if (o.nodeName === 'OPTION') { const option = o; - option.selected = value.includes(option.value); + option.selected = ids.includes(option.id); } } this.changeListen(true); @@ -1645,8 +1635,8 @@ class SlimSelect { this.select = new Select(this.selectEl); this.select.updateSelect(this.settings.id, this.settings.style, this.settings.class); this.select.hideUI(); - this.select.onValueChange = (values) => { - this.setSelected(values); + this.select.onValueChange = (options) => { + this.setSelected(options.map(option => option.id)); }; this.select.onClassChange = (classes) => { this.settings.class = classes; @@ -1738,9 +1728,9 @@ class SlimSelect { getSelected() { return this.store.getSelected(); } - setSelected(value, runAfterChange = true) { + setSelected(id, runAfterChange = true) { const selected = this.store.getSelected(); - this.store.setSelectedBy('value', Array.isArray(value) ? value : [value]); + this.store.setSelectedBy('id', Array.isArray(id) ? id : [id]); const data = this.store.getData(); this.select.updateOptions(data); this.render.renderValues(); diff --git a/src/vue/dist/slimselectvue.global.js b/src/vue/dist/slimselectvue.global.js index 07ecc1c5..d025cac3 100644 --- a/src/vue/dist/slimselectvue.global.js +++ b/src/vue/dist/slimselectvue.global.js @@ -144,7 +144,7 @@ var SlimSelectVue = (function (vue) { setData(data) { this.data = this.partialToFullData(data); if (this.selectType === 'single') { - this.setSelectedBy('value', this.getSelected()); + this.setSelectedBy('id', this.getSelected()); } } getData() { @@ -186,26 +186,13 @@ var SlimSelectVue = (function (vue) { } } getSelected() { - let selectedOptions = this.getSelectedOptions(); - let selectedValues = []; - selectedOptions.forEach((option) => { - selectedValues.push(option.value); - }); - return selectedValues; + return this.getSelectedOptions().map(option => option.id); } getSelectedOptions() { return this.filter((opt) => { return opt.selected; }, false); } - getSelectedIDs() { - let selectedOptions = this.getSelectedOptions(); - let selectedIDs = []; - selectedOptions.forEach((op) => { - selectedIDs.push(op.id); - }); - return selectedIDs; - } getOptgroupByID(id) { for (let dataObj of this.data) { if (dataObj instanceof Optgroup && dataObj.id === id) { @@ -457,8 +444,8 @@ var SlimSelectVue = (function (vue) { } else { const firstOption = this.store.getFirstOption(); - const value = firstOption ? firstOption.value : ''; - this.callbacks.setSelected(value, false); + const id = firstOption ? firstOption.id : ''; + this.callbacks.setSelected(id, false); } if (this.settings.closeOnSelect) { this.callbacks.close(); @@ -658,18 +645,18 @@ var SlimSelectVue = (function (vue) { shouldDelete = this.callbacks.beforeChange(after, before) === true; } if (shouldDelete) { - let selectedValues = []; + let selectedIds = []; for (const o of after) { if (o instanceof Optgroup) { for (const c of o.options) { - selectedValues.push(c.value); + selectedIds.push(c.id); } } if (o instanceof Option) { - selectedValues.push(o.value); + selectedIds.push(o.id); } } - this.callbacks.setSelected(selectedValues, false); + this.callbacks.setSelected(selectedIds, false); if (this.settings.closeOnSelect) { this.callbacks.close(); } @@ -798,12 +785,12 @@ var SlimSelectVue = (function (vue) { let newOption = new Option(oo); this.callbacks.addOption(newOption); if (this.settings.isMultiple) { - let values = this.store.getSelected(); - values.push(newOption.value); - this.callbacks.setSelected(values, true); + let ids = this.store.getSelected(); + ids.push(newOption.id); + this.callbacks.setSelected(ids, true); } else { - this.callbacks.setSelected([newOption.value], true); + this.callbacks.setSelected([newOption.id], true); } this.callbacks.search(''); if (this.settings.closeOnSelect) { @@ -991,7 +978,7 @@ var SlimSelectVue = (function (vue) { if (allSelected) { const newSelected = currentSelected.filter((s) => { for (const o of d.options) { - if (s === o.value) { + if (s === o.id) { return false; } } @@ -1001,7 +988,7 @@ var SlimSelectVue = (function (vue) { return; } else { - const newSelected = currentSelected.concat(d.options.map((o) => o.value)); + const newSelected = currentSelected.concat(d.options.map((o) => o.id)); for (const o of d.options) { if (!this.store.getOptionByID(o.id)) { this.callbacks.addOption(o); @@ -1158,7 +1145,7 @@ var SlimSelectVue = (function (vue) { if (!this.store.getOptionByID(elementID)) { this.callbacks.addOption(option); } - this.callbacks.setSelected(after.map((o) => o.value), false); + this.callbacks.setSelected(after.map((o) => o.id), false); if (this.settings.closeOnSelect) { this.callbacks.close(); } @@ -1304,7 +1291,7 @@ var SlimSelectVue = (function (vue) { } valueChange(ev) { if (this.listen && this.onValueChange) { - this.onValueChange(this.getSelectedValues()); + this.onValueChange(this.getSelectedOptions()); } return true; } @@ -1388,17 +1375,17 @@ var SlimSelectVue = (function (vue) { data: option.dataset, }; } - getSelectedValues() { - let values = []; - const options = this.select.childNodes; - for (const o of options) { + getSelectedOptions() { + let options = []; + const opts = this.select.childNodes; + for (const o of opts) { if (o.nodeName === 'OPTGROUP') { const optgroupOptions = o.childNodes; for (const oo of optgroupOptions) { if (oo.nodeName === 'OPTION') { const option = oo; if (option.selected) { - values.push(option.value); + options.push(this.getDataFromOption(option)); } } } @@ -1406,13 +1393,16 @@ var SlimSelectVue = (function (vue) { if (o.nodeName === 'OPTION') { const option = o; if (option.selected) { - values.push(option.value); + options.push(this.getDataFromOption(option)); } } } - return values; + return options; + } + getSelectedValues() { + return this.getSelectedOptions().map(option => option.value); } - setSelected(value) { + setSelected(ids) { this.changeListen(false); const options = this.select.childNodes; for (const o of options) { @@ -1422,13 +1412,13 @@ var SlimSelectVue = (function (vue) { for (const oo of optgroupOptions) { if (oo.nodeName === 'OPTION') { const option = oo; - option.selected = value.includes(option.value); + option.selected = ids.includes(option.id); } } } if (o.nodeName === 'OPTION') { const option = o; - option.selected = value.includes(option.value); + option.selected = ids.includes(option.id); } } this.changeListen(true); @@ -1646,8 +1636,8 @@ var SlimSelectVue = (function (vue) { this.select = new Select(this.selectEl); this.select.updateSelect(this.settings.id, this.settings.style, this.settings.class); this.select.hideUI(); - this.select.onValueChange = (values) => { - this.setSelected(values); + this.select.onValueChange = (options) => { + this.setSelected(options.map(option => option.id)); }; this.select.onClassChange = (classes) => { this.settings.class = classes; @@ -1739,9 +1729,9 @@ var SlimSelectVue = (function (vue) { getSelected() { return this.store.getSelected(); } - setSelected(value, runAfterChange = true) { + setSelected(id, runAfterChange = true) { const selected = this.store.getSelected(); - this.store.setSelectedBy('value', Array.isArray(value) ? value : [value]); + this.store.setSelectedBy('id', Array.isArray(id) ? id : [id]); const data = this.store.getData(); this.select.updateOptions(data); this.render.renderValues(); diff --git a/src/vue/dist/slimselectvue.ssr.js b/src/vue/dist/slimselectvue.ssr.js index 84db412e..e810c2f4 100644 --- a/src/vue/dist/slimselectvue.ssr.js +++ b/src/vue/dist/slimselectvue.ssr.js @@ -145,7 +145,7 @@ class Store { setData(data) { this.data = this.partialToFullData(data); if (this.selectType === 'single') { - this.setSelectedBy('value', this.getSelected()); + this.setSelectedBy('id', this.getSelected()); } } getData() { @@ -187,26 +187,13 @@ class Store { } } getSelected() { - let selectedOptions = this.getSelectedOptions(); - let selectedValues = []; - selectedOptions.forEach((option) => { - selectedValues.push(option.value); - }); - return selectedValues; + return this.getSelectedOptions().map(option => option.id); } getSelectedOptions() { return this.filter((opt) => { return opt.selected; }, false); } - getSelectedIDs() { - let selectedOptions = this.getSelectedOptions(); - let selectedIDs = []; - selectedOptions.forEach((op) => { - selectedIDs.push(op.id); - }); - return selectedIDs; - } getOptgroupByID(id) { for (let dataObj of this.data) { if (dataObj instanceof Optgroup && dataObj.id === id) { @@ -458,8 +445,8 @@ class Render { } else { const firstOption = this.store.getFirstOption(); - const value = firstOption ? firstOption.value : ''; - this.callbacks.setSelected(value, false); + const id = firstOption ? firstOption.id : ''; + this.callbacks.setSelected(id, false); } if (this.settings.closeOnSelect) { this.callbacks.close(); @@ -659,18 +646,18 @@ class Render { shouldDelete = this.callbacks.beforeChange(after, before) === true; } if (shouldDelete) { - let selectedValues = []; + let selectedIds = []; for (const o of after) { if (o instanceof Optgroup) { for (const c of o.options) { - selectedValues.push(c.value); + selectedIds.push(c.id); } } if (o instanceof Option) { - selectedValues.push(o.value); + selectedIds.push(o.id); } } - this.callbacks.setSelected(selectedValues, false); + this.callbacks.setSelected(selectedIds, false); if (this.settings.closeOnSelect) { this.callbacks.close(); } @@ -799,12 +786,12 @@ class Render { let newOption = new Option(oo); this.callbacks.addOption(newOption); if (this.settings.isMultiple) { - let values = this.store.getSelected(); - values.push(newOption.value); - this.callbacks.setSelected(values, true); + let ids = this.store.getSelected(); + ids.push(newOption.id); + this.callbacks.setSelected(ids, true); } else { - this.callbacks.setSelected([newOption.value], true); + this.callbacks.setSelected([newOption.id], true); } this.callbacks.search(''); if (this.settings.closeOnSelect) { @@ -992,7 +979,7 @@ class Render { if (allSelected) { const newSelected = currentSelected.filter((s) => { for (const o of d.options) { - if (s === o.value) { + if (s === o.id) { return false; } } @@ -1002,7 +989,7 @@ class Render { return; } else { - const newSelected = currentSelected.concat(d.options.map((o) => o.value)); + const newSelected = currentSelected.concat(d.options.map((o) => o.id)); for (const o of d.options) { if (!this.store.getOptionByID(o.id)) { this.callbacks.addOption(o); @@ -1159,7 +1146,7 @@ class Render { if (!this.store.getOptionByID(elementID)) { this.callbacks.addOption(option); } - this.callbacks.setSelected(after.map((o) => o.value), false); + this.callbacks.setSelected(after.map((o) => o.id), false); if (this.settings.closeOnSelect) { this.callbacks.close(); } @@ -1305,7 +1292,7 @@ class Select { } valueChange(ev) { if (this.listen && this.onValueChange) { - this.onValueChange(this.getSelectedValues()); + this.onValueChange(this.getSelectedOptions()); } return true; } @@ -1389,17 +1376,17 @@ class Select { data: option.dataset, }; } - getSelectedValues() { - let values = []; - const options = this.select.childNodes; - for (const o of options) { + getSelectedOptions() { + let options = []; + const opts = this.select.childNodes; + for (const o of opts) { if (o.nodeName === 'OPTGROUP') { const optgroupOptions = o.childNodes; for (const oo of optgroupOptions) { if (oo.nodeName === 'OPTION') { const option = oo; if (option.selected) { - values.push(option.value); + options.push(this.getDataFromOption(option)); } } } @@ -1407,13 +1394,16 @@ class Select { if (o.nodeName === 'OPTION') { const option = o; if (option.selected) { - values.push(option.value); + options.push(this.getDataFromOption(option)); } } } - return values; + return options; + } + getSelectedValues() { + return this.getSelectedOptions().map(option => option.value); } - setSelected(value) { + setSelected(ids) { this.changeListen(false); const options = this.select.childNodes; for (const o of options) { @@ -1423,13 +1413,13 @@ class Select { for (const oo of optgroupOptions) { if (oo.nodeName === 'OPTION') { const option = oo; - option.selected = value.includes(option.value); + option.selected = ids.includes(option.id); } } } if (o.nodeName === 'OPTION') { const option = o; - option.selected = value.includes(option.value); + option.selected = ids.includes(option.id); } } this.changeListen(true); @@ -1647,8 +1637,8 @@ class SlimSelect { this.select = new Select(this.selectEl); this.select.updateSelect(this.settings.id, this.settings.style, this.settings.class); this.select.hideUI(); - this.select.onValueChange = (values) => { - this.setSelected(values); + this.select.onValueChange = (options) => { + this.setSelected(options.map(option => option.id)); }; this.select.onClassChange = (classes) => { this.settings.class = classes; @@ -1740,9 +1730,9 @@ class SlimSelect { getSelected() { return this.store.getSelected(); } - setSelected(value, runAfterChange = true) { + setSelected(id, runAfterChange = true) { const selected = this.store.getSelected(); - this.store.setSelectedBy('value', Array.isArray(value) ? value : [value]); + this.store.setSelectedBy('id', Array.isArray(id) ? id : [id]); const data = this.store.getData(); this.select.updateOptions(data); this.render.renderValues(); diff --git a/src/vue/dist/vue/slimselect.vue.d.ts b/src/vue/dist/vue/slimselect.vue.d.ts index 3c1e3b48..14442a7d 100644 --- a/src/vue/dist/vue/slimselect.vue.d.ts +++ b/src/vue/dist/vue/slimselect.vue.d.ts @@ -70,7 +70,7 @@ declare const _default: import("vue").DefineComponent<{ }; select: { select: HTMLSelectElement; - onValueChange?: ((value: string[]) => void) | undefined; + onValueChange?: ((value: Option[]) => void) | undefined; onClassChange?: ((classes: string[]) => void) | undefined; onDisabledChange?: ((disabled: boolean) => void) | undefined; onOptionsChange?: ((data: DataArrayPartial) => void) | undefined; @@ -84,8 +84,9 @@ declare const _default: import("vue").DefineComponent<{ getData: () => DataArrayPartial; getDataFromOptgroup: (optgroup: HTMLOptGroupElement) => import("../slim-select/store").OptgroupOptional; getDataFromOption: (option: HTMLOptionElement) => Option; + getSelectedOptions: () => Option[]; getSelectedValues: () => string[]; - setSelected: (value: string[]) => void; + setSelected: (ids: string[]) => void; updateSelect: (id?: string | undefined, style?: string | undefined, classes?: string[] | undefined) => void; updateOptions: (data: import("../slim-select/store").DataArray) => void; createOptgroup: (optgroup: import("../slim-select/store").Optgroup) => HTMLOptGroupElement; @@ -103,7 +104,6 @@ declare const _default: import("vue").DefineComponent<{ setSelectedBy: (selectedType: "id" | "value", selectedValues: string[]) => void; getSelected: () => string[]; getSelectedOptions: () => Option[]; - getSelectedIDs: () => string[]; getOptgroupByID: (id: string) => import("../slim-select/store").Optgroup | null; getOptionByID: (id: string) => Option | null; getSelectType: () => string; @@ -161,7 +161,6 @@ declare const _default: import("vue").DefineComponent<{ setSelectedBy: (selectedType: "id" | "value", selectedValues: string[]) => void; getSelected: () => string[]; getSelectedOptions: () => Option[]; - getSelectedIDs: () => string[]; getOptgroupByID: (id: string) => import("../slim-select/store").Optgroup | null; getOptionByID: (id: string) => Option | null; getSelectType: () => string; @@ -293,7 +292,7 @@ declare const _default: import("vue").DefineComponent<{ getData: () => import("../slim-select/store").DataArray; setData: (data: DataArrayPartial) => void; getSelected: () => string[]; - setSelected: (value: string | string[], runAfterChange?: boolean) => void; + setSelected: (id: string | string[], runAfterChange?: boolean) => void; addOption: (option: import("../slim-select/store").OptionOptional) => void; open: () => void; close: (eventType?: string | null) => void; From 35b1ec4297846334385d72b895473af01acc01d1 Mon Sep 17 00:00:00 2001 From: Ruben Fileti Date: Wed, 26 Jun 2024 13:41:40 +0200 Subject: [PATCH 2/3] Formatting --- src/slim-select/index.ts | 2 +- src/slim-select/select.ts | 2 +- src/slim-select/store.ts | 3 +- src/vue/dist/slim-select/helpers.d.ts | 14 +- src/vue/dist/slim-select/index.d.ts | 80 +-- src/vue/dist/slim-select/render.d.ts | 220 ++++---- src/vue/dist/slim-select/select.d.ts | 54 +- src/vue/dist/slim-select/settings.d.ts | 62 +-- src/vue/dist/slim-select/store.d.ts | 141 ++--- src/vue/dist/vue/hello.d.ts | 4 +- src/vue/dist/vue/slimselect.vue.d.ts | 683 +++++++++++++------------ 11 files changed, 663 insertions(+), 602 deletions(-) diff --git a/src/slim-select/index.ts b/src/slim-select/index.ts index 51c34ac9..47bc4d43 100644 --- a/src/slim-select/index.ts +++ b/src/slim-select/index.ts @@ -104,7 +104,7 @@ export default class SlimSelect { // Add select listeners this.select.onValueChange = (options: Option[]) => { // Run set selected from the values given - this.setSelected(options.map(option => option.id)) + this.setSelected(options.map((option) => option.id)) } this.select.onClassChange = (classes: string[]) => { // Update settings with new class diff --git a/src/slim-select/select.ts b/src/slim-select/select.ts index c946b418..647a201c 100644 --- a/src/slim-select/select.ts +++ b/src/slim-select/select.ts @@ -224,7 +224,7 @@ export default class Select { } public getSelectedValues(): string[] { - return this.getSelectedOptions().map(option => option.value); + return this.getSelectedOptions().map((option) => option.value) } public setSelected(ids: string[]): void { diff --git a/src/slim-select/store.ts b/src/slim-select/store.ts index 2c924ec7..a2fd5831 100644 --- a/src/slim-select/store.ts +++ b/src/slim-select/store.ts @@ -236,7 +236,7 @@ export default class Store { } public getSelected(): string[] { - return this.getSelectedOptions().map(option => option.id) + return this.getSelectedOptions().map((option) => option.id) } public getSelectedOptions(): Option[] { @@ -342,5 +342,4 @@ export default class Store { return dataSearch } - } diff --git a/src/vue/dist/slim-select/helpers.d.ts b/src/vue/dist/slim-select/helpers.d.ts index 88972fef..df354571 100644 --- a/src/vue/dist/slim-select/helpers.d.ts +++ b/src/vue/dist/slim-select/helpers.d.ts @@ -1,5 +1,9 @@ -export declare function generateID(): string; -export declare function hasClassInTree(element: HTMLElement, className: string): any; -export declare function debounce void>(func: T, wait?: number, immediate?: boolean): () => void; -export declare function isEqual(a: any, b: any): boolean; -export declare function kebabCase(str: string): string; +export declare function generateID(): string +export declare function hasClassInTree(element: HTMLElement, className: string): any +export declare function debounce void>( + func: T, + wait?: number, + immediate?: boolean, +): () => void +export declare function isEqual(a: any, b: any): boolean +export declare function kebabCase(str: string): string diff --git a/src/vue/dist/slim-select/index.d.ts b/src/vue/dist/slim-select/index.d.ts index 4296bbe5..babd1b93 100644 --- a/src/vue/dist/slim-select/index.d.ts +++ b/src/vue/dist/slim-select/index.d.ts @@ -1,46 +1,46 @@ -import Render from './render'; -import Select from './select'; -import Settings, { SettingsPartial } from './settings'; -import Store, { DataArray, DataArrayPartial, Option, OptionOptional } from './store'; +import Render from './render' +import Select from './select' +import Settings, { SettingsPartial } from './settings' +import Store, { DataArray, DataArrayPartial, Option, OptionOptional } from './store' export interface Config { - select: string | Element; - data?: DataArrayPartial; - settings?: SettingsPartial; - events?: Events; + select: string | Element + data?: DataArrayPartial + settings?: SettingsPartial + events?: Events } export interface Events { - search?: (searchValue: string, currentData: DataArray) => Promise | DataArrayPartial; - searchFilter?: (option: Option, search: string) => boolean; - addable?: (value: string) => Promise | OptionOptional | string | false | null | undefined; - beforeChange?: (newVal: Option[], oldVal: Option[]) => boolean | void; - afterChange?: (newVal: Option[]) => void; - beforeOpen?: () => void; - afterOpen?: () => void; - beforeClose?: () => void; - afterClose?: () => void; - error?: (err: Error) => void; + search?: (searchValue: string, currentData: DataArray) => Promise | DataArrayPartial + searchFilter?: (option: Option, search: string) => boolean + addable?: (value: string) => Promise | OptionOptional | string | false | null | undefined + beforeChange?: (newVal: Option[], oldVal: Option[]) => boolean | void + afterChange?: (newVal: Option[]) => void + beforeOpen?: () => void + afterOpen?: () => void + beforeClose?: () => void + afterClose?: () => void + error?: (err: Error) => void } export default class SlimSelect { - selectEl: HTMLSelectElement; - settings: Settings; - select: Select; - store: Store; - render: Render; - events: Events; - constructor(config: Config); - enable(): void; - disable(): void; - getData(): DataArray; - setData(data: DataArrayPartial): void; - getSelected(): string[]; - setSelected(id: string | string[], runAfterChange?: boolean): void; - addOption(option: OptionOptional): void; - open(): void; - close(eventType?: string | null): void; - search(value: string): void; - destroy(): void; - private windowResize; - private windowScroll; - private documentClick; - private windowVisibilityChange; + selectEl: HTMLSelectElement + settings: Settings + select: Select + store: Store + render: Render + events: Events + constructor(config: Config) + enable(): void + disable(): void + getData(): DataArray + setData(data: DataArrayPartial): void + getSelected(): string[] + setSelected(id: string | string[], runAfterChange?: boolean): void + addOption(option: OptionOptional): void + open(): void + close(eventType?: string | null): void + search(value: string): void + destroy(): void + private windowResize + private windowScroll + private documentClick + private windowVisibilityChange } diff --git a/src/vue/dist/slim-select/render.d.ts b/src/vue/dist/slim-select/render.d.ts index ca88f0c2..5f3250e6 100644 --- a/src/vue/dist/slim-select/render.d.ts +++ b/src/vue/dist/slim-select/render.d.ts @@ -1,120 +1,120 @@ -import Settings from './settings'; -import Store, { DataArray, Option, OptionOptional } from './store'; +import Settings from './settings' +import Store, { DataArray, Option, OptionOptional } from './store' export interface Callbacks { - open: () => void; - close: () => void; - addable?: (value: string) => Promise | OptionOptional | string | false | undefined | null; - setSelected: (value: string | string[], runAfterChange: boolean) => void; - addOption: (option: Option) => void; - search: (search: string) => void; - beforeChange?: (newVal: Option[], oldVal: Option[]) => boolean | void; - afterChange?: (newVal: Option[]) => void; + open: () => void + close: () => void + addable?: (value: string) => Promise | OptionOptional | string | false | undefined | null + setSelected: (value: string | string[], runAfterChange: boolean) => void + addOption: (option: Option) => void + search: (search: string) => void + beforeChange?: (newVal: Option[], oldVal: Option[]) => boolean | void + afterChange?: (newVal: Option[]) => void } export interface Main { - main: HTMLDivElement; - values: HTMLDivElement; - deselect: { - main: HTMLDivElement; - svg: SVGSVGElement; - path: SVGPathElement; - }; - arrow: { - main: SVGSVGElement; - path: SVGPathElement; - }; + main: HTMLDivElement + values: HTMLDivElement + deselect: { + main: HTMLDivElement + svg: SVGSVGElement + path: SVGPathElement + } + arrow: { + main: SVGSVGElement + path: SVGPathElement + } } export interface Content { - main: HTMLDivElement; - search: Search; - list: HTMLDivElement; + main: HTMLDivElement + search: Search + list: HTMLDivElement } export interface Search { - main: HTMLDivElement; - input: HTMLInputElement; - addable?: { - main: HTMLDivElement; - svg: SVGSVGElement; - path: SVGPathElement; - }; + main: HTMLDivElement + input: HTMLInputElement + addable?: { + main: HTMLDivElement + svg: SVGSVGElement + path: SVGPathElement + } } export default class Render { - settings: Settings; - store: Store; - callbacks: Callbacks; - main: Main; - content: Content; - classes: { - main: string; - placeholder: string; - values: string; - single: string; - max: string; - value: string; - valueText: string; - valueDelete: string; - valueOut: string; - deselect: string; - deselectPath: string; - arrow: string; - arrowClose: string; - arrowOpen: string; - content: string; - openAbove: string; - openBelow: string; - search: string; - searchHighlighter: string; - searching: string; - addable: string; - addablePath: string; - list: string; - optgroup: string; - optgroupLabel: string; - optgroupLabelText: string; - optgroupActions: string; - optgroupSelectAll: string; - optgroupSelectAllBox: string; - optgroupSelectAllCheck: string; - optgroupClosable: string; - option: string; - optionDelete: string; - highlighted: string; - open: string; - close: string; - selected: string; - error: string; - disabled: string; - hide: string; - }; - constructor(settings: Required, store: Store, callbacks: Callbacks); - enable(): void; - disable(): void; - open(): void; - close(): void; - updateClassStyles(): void; - updateAriaAttributes(): void; - mainDiv(): Main; - mainFocus(eventType: string | null): void; - placeholder(): HTMLDivElement; - renderValues(): void; - private renderSingleValue; - private renderMultipleValues; - multipleValue(option: Option): HTMLDivElement; - contentDiv(): Content; - moveContent(): void; - searchDiv(): Search; - searchFocus(): void; - getOptions(notPlaceholder?: boolean, notDisabled?: boolean, notHidden?: boolean): HTMLDivElement[]; - highlight(dir: 'up' | 'down'): void; - listDiv(): HTMLDivElement; - renderError(error: string): void; - renderSearching(): void; - renderOptions(data: DataArray): void; - option(option: Option): HTMLDivElement; - destroy(): void; - private highlightText; - moveContentAbove(): void; - moveContentBelow(): void; - ensureElementInView(container: HTMLElement, element: HTMLElement): void; - putContent(): 'up' | 'down'; - updateDeselectAll(): void; + settings: Settings + store: Store + callbacks: Callbacks + main: Main + content: Content + classes: { + main: string + placeholder: string + values: string + single: string + max: string + value: string + valueText: string + valueDelete: string + valueOut: string + deselect: string + deselectPath: string + arrow: string + arrowClose: string + arrowOpen: string + content: string + openAbove: string + openBelow: string + search: string + searchHighlighter: string + searching: string + addable: string + addablePath: string + list: string + optgroup: string + optgroupLabel: string + optgroupLabelText: string + optgroupActions: string + optgroupSelectAll: string + optgroupSelectAllBox: string + optgroupSelectAllCheck: string + optgroupClosable: string + option: string + optionDelete: string + highlighted: string + open: string + close: string + selected: string + error: string + disabled: string + hide: string + } + constructor(settings: Required, store: Store, callbacks: Callbacks) + enable(): void + disable(): void + open(): void + close(): void + updateClassStyles(): void + updateAriaAttributes(): void + mainDiv(): Main + mainFocus(eventType: string | null): void + placeholder(): HTMLDivElement + renderValues(): void + private renderSingleValue + private renderMultipleValues + multipleValue(option: Option): HTMLDivElement + contentDiv(): Content + moveContent(): void + searchDiv(): Search + searchFocus(): void + getOptions(notPlaceholder?: boolean, notDisabled?: boolean, notHidden?: boolean): HTMLDivElement[] + highlight(dir: 'up' | 'down'): void + listDiv(): HTMLDivElement + renderError(error: string): void + renderSearching(): void + renderOptions(data: DataArray): void + option(option: Option): HTMLDivElement + destroy(): void + private highlightText + moveContentAbove(): void + moveContentBelow(): void + ensureElementInView(container: HTMLElement, element: HTMLElement): void + putContent(): 'up' | 'down' + updateDeselectAll(): void } diff --git a/src/vue/dist/slim-select/select.d.ts b/src/vue/dist/slim-select/select.d.ts index 62b6f779..6b531cfa 100644 --- a/src/vue/dist/slim-select/select.d.ts +++ b/src/vue/dist/slim-select/select.d.ts @@ -1,29 +1,29 @@ -import { DataArray, DataArrayPartial, Optgroup, OptgroupOptional, Option } from './store'; +import { DataArray, DataArrayPartial, Optgroup, OptgroupOptional, Option } from './store' export default class Select { - select: HTMLSelectElement; - onValueChange?: (value: Option[]) => void; - onClassChange?: (classes: string[]) => void; - onDisabledChange?: (disabled: boolean) => void; - onOptionsChange?: (data: DataArrayPartial) => void; - listen: boolean; - private observer; - constructor(select: HTMLSelectElement); - enable(): void; - disable(): void; - hideUI(): void; - showUI(): void; - changeListen(listen: boolean): void; - valueChange(ev: Event): boolean; - private observeCall; - getData(): DataArrayPartial; - getDataFromOptgroup(optgroup: HTMLOptGroupElement): OptgroupOptional; - getDataFromOption(option: HTMLOptionElement): Option; - getSelectedOptions(): Option[]; - getSelectedValues(): string[]; - setSelected(ids: string[]): void; - updateSelect(id?: string, style?: string, classes?: string[]): void; - updateOptions(data: DataArray): void; - createOptgroup(optgroup: Optgroup): HTMLOptGroupElement; - createOption(info: Option): HTMLOptionElement; - destroy(): void; + select: HTMLSelectElement + onValueChange?: (value: Option[]) => void + onClassChange?: (classes: string[]) => void + onDisabledChange?: (disabled: boolean) => void + onOptionsChange?: (data: DataArrayPartial) => void + listen: boolean + private observer + constructor(select: HTMLSelectElement) + enable(): void + disable(): void + hideUI(): void + showUI(): void + changeListen(listen: boolean): void + valueChange(ev: Event): boolean + private observeCall + getData(): DataArrayPartial + getDataFromOptgroup(optgroup: HTMLOptGroupElement): OptgroupOptional + getDataFromOption(option: HTMLOptionElement): Option + getSelectedOptions(): Option[] + getSelectedValues(): string[] + setSelected(ids: string[]): void + updateSelect(id?: string, style?: string, classes?: string[]): void + updateOptions(data: DataArray): void + createOptgroup(optgroup: Optgroup): HTMLOptGroupElement + createOption(info: Option): HTMLOptionElement + destroy(): void } diff --git a/src/vue/dist/slim-select/settings.d.ts b/src/vue/dist/slim-select/settings.d.ts index 107b4528..bfa88c9a 100644 --- a/src/vue/dist/slim-select/settings.d.ts +++ b/src/vue/dist/slim-select/settings.d.ts @@ -1,34 +1,34 @@ /// -export type SettingsPartial = Partial; +export type SettingsPartial = Partial export default class Settings { - id: string; - style: string; - class: string[]; - isMultiple: boolean; - isOpen: boolean; - isFullOpen: boolean; - intervalMove: NodeJS.Timeout | null; - disabled: boolean; - alwaysOpen: boolean; - showSearch: boolean; - ariaLabel: string; - searchPlaceholder: string; - searchText: string; - searchingText: string; - searchHighlight: boolean; - closeOnSelect: boolean; - contentLocation: HTMLElement; - contentPosition: 'relative' | 'absolute'; - openPosition: 'auto' | 'up' | 'down'; - placeholderText: string; - allowDeselect: boolean; - hideSelected: boolean; - keepOrder: boolean; - showOptionTooltips: boolean; - minSelected: number; - maxSelected: number; - timeoutDelay: number; - maxValuesShown: number; - maxValuesMessage: string; - constructor(settings?: SettingsPartial); + id: string + style: string + class: string[] + isMultiple: boolean + isOpen: boolean + isFullOpen: boolean + intervalMove: NodeJS.Timeout | null + disabled: boolean + alwaysOpen: boolean + showSearch: boolean + ariaLabel: string + searchPlaceholder: string + searchText: string + searchingText: string + searchHighlight: boolean + closeOnSelect: boolean + contentLocation: HTMLElement + contentPosition: 'relative' | 'absolute' + openPosition: 'auto' | 'up' | 'down' + placeholderText: string + allowDeselect: boolean + hideSelected: boolean + keepOrder: boolean + showOptionTooltips: boolean + minSelected: number + maxSelected: number + timeoutDelay: number + maxValuesShown: number + maxValuesMessage: string + constructor(settings?: SettingsPartial) } diff --git a/src/vue/dist/slim-select/store.d.ts b/src/vue/dist/slim-select/store.d.ts index e00d0d80..507f447b 100644 --- a/src/vue/dist/slim-select/store.d.ts +++ b/src/vue/dist/slim-select/store.d.ts @@ -1,79 +1,82 @@ -export type DataArray = DataObject[]; -export type DataObject = Optgroup | Option; -export type DataArrayPartial = DataObjectPartial[]; -export type DataObjectPartial = OptgroupOptional | OptionOptional; -type selectType = 'single' | 'multiple'; +export type DataArray = DataObject[] +export type DataObject = Optgroup | Option +export type DataArrayPartial = DataObjectPartial[] +export type DataObjectPartial = OptgroupOptional | OptionOptional +type selectType = 'single' | 'multiple' export interface OptgroupOptional { - id?: string; - label: string; - selectAll?: boolean; - selectAllText?: string; - closable?: 'off' | 'open' | 'close'; - options?: OptionOptional[]; + id?: string + label: string + selectAll?: boolean + selectAllText?: string + closable?: 'off' | 'open' | 'close' + options?: OptionOptional[] } export declare class Optgroup { - id: string; - label: string; - selectAll: boolean; - selectAllText: string; - closable: 'off' | 'open' | 'close'; - options: Option[]; - constructor(optgroup: OptgroupOptional); + id: string + label: string + selectAll: boolean + selectAllText: string + closable: 'off' | 'open' | 'close' + options: Option[] + constructor(optgroup: OptgroupOptional) } export interface OptionOptional { - id?: string; - value?: string; - text: string; - html?: string; - selected?: boolean; - display?: boolean; - disabled?: boolean; - mandatory?: boolean; - placeholder?: boolean; - class?: string; - style?: string; - data?: { - [key: string]: string; - }; + id?: string + value?: string + text: string + html?: string + selected?: boolean + display?: boolean + disabled?: boolean + mandatory?: boolean + placeholder?: boolean + class?: string + style?: string + data?: { + [key: string]: string + } } export declare class Option { - id: string; - value: string; - text: string; - html: string; - selected: boolean; - display: boolean; - disabled: boolean; - placeholder: boolean; - class: string; - style: string; - data: { - [key: string]: string; - }; - mandatory: boolean; - constructor(option: OptionOptional); + id: string + value: string + text: string + html: string + selected: boolean + display: boolean + disabled: boolean + placeholder: boolean + class: string + style: string + data: { + [key: string]: string + } + mandatory: boolean + constructor(option: OptionOptional) } export default class Store { - private selectType; - private data; - constructor(type: selectType, data: DataArrayPartial); - validateDataArray(data: DataArray | DataArrayPartial): Error | null; - validateOption(option: Option | OptionOptional): Error | null; - partialToFullData(data: DataArrayPartial): DataArray; - setData(data: DataArray | DataArrayPartial): void; - getData(): DataArray; - getDataOptions(): Option[]; - addOption(option: OptionOptional): void; - setSelectedBy(selectedType: 'id' | 'value', selectedValues: string[]): void; - getSelected(): string[]; - getSelectedOptions(): Option[]; - getOptgroupByID(id: string): Optgroup | null; - getOptionByID(id: string): Option | null; - getSelectType(): string; - getFirstOption(): Option | null; - search(search: string, searchFilter: (opt: Option, search: string) => boolean): DataArray; - filter(filter: { - (opt: Option): boolean; - } | null, includeOptgroup: boolean): DataArray; + private selectType + private data + constructor(type: selectType, data: DataArrayPartial) + validateDataArray(data: DataArray | DataArrayPartial): Error | null + validateOption(option: Option | OptionOptional): Error | null + partialToFullData(data: DataArrayPartial): DataArray + setData(data: DataArray | DataArrayPartial): void + getData(): DataArray + getDataOptions(): Option[] + addOption(option: OptionOptional): void + setSelectedBy(selectedType: 'id' | 'value', selectedValues: string[]): void + getSelected(): string[] + getSelectedOptions(): Option[] + getOptgroupByID(id: string): Optgroup | null + getOptionByID(id: string): Option | null + getSelectType(): string + getFirstOption(): Option | null + search(search: string, searchFilter: (opt: Option, search: string) => boolean): DataArray + filter( + filter: { + (opt: Option): boolean + } | null, + includeOptgroup: boolean, + ): DataArray } -export {}; +export {} diff --git a/src/vue/dist/vue/hello.d.ts b/src/vue/dist/vue/hello.d.ts index f6842d9a..f6646e23 100644 --- a/src/vue/dist/vue/hello.d.ts +++ b/src/vue/dist/vue/hello.d.ts @@ -1,2 +1,2 @@ -declare const hello = "hello world"; -export default hello; +declare const hello = 'hello world' +export default hello diff --git a/src/vue/dist/vue/slimselect.vue.d.ts b/src/vue/dist/vue/slimselect.vue.d.ts index 14442a7d..87eb64f6 100644 --- a/src/vue/dist/vue/slimselect.vue.d.ts +++ b/src/vue/dist/vue/slimselect.vue.d.ts @@ -1,325 +1,380 @@ /// /// -import { PropType } from 'vue'; -import SlimSelect, { Events } from '../slim-select'; -import { DataArrayPartial, Option } from '../slim-select/store'; -declare const _default: import("vue").DefineComponent<{ +import { PropType } from 'vue' +import SlimSelect, { Events } from '../slim-select' +import { DataArrayPartial, Option } from '../slim-select/store' +declare const _default: import('vue').DefineComponent< + { modelValue: { - type: PropType; - }; + type: PropType + } multiple: { - type: BooleanConstructor; - default: boolean; - }; + type: BooleanConstructor + default: boolean + } data: { - type: PropType; - }; + type: PropType + } settings: { - type: PropType>; - }; + type: PropType> + } events: { - type: PropType; - }; -}, unknown, { - slim: SlimSelect | null; -}, { + type: PropType + } + }, + unknown, + { + slim: SlimSelect | null + }, + { value: { - get(): string | string[]; - set(value: string | string[]): void; - }; -}, { + get(): string | string[] + set(value: string | string[]): void + } + }, + { getSlimSelect(): { - selectEl: HTMLSelectElement; + selectEl: HTMLSelectElement + settings: { + id: string + style: string + class: string[] + isMultiple: boolean + isOpen: boolean + isFullOpen: boolean + intervalMove: { + ref: () => NodeJS.Timeout + unref: () => NodeJS.Timeout + hasRef: () => boolean + refresh: () => NodeJS.Timeout + [Symbol.toPrimitive]: () => number + [Symbol.dispose]: () => void + } | null + disabled: boolean + alwaysOpen: boolean + showSearch: boolean + ariaLabel: string + searchPlaceholder: string + searchText: string + searchingText: string + searchHighlight: boolean + closeOnSelect: boolean + contentLocation: HTMLElement + contentPosition: 'relative' | 'absolute' + openPosition: 'auto' | 'up' | 'down' + placeholderText: string + allowDeselect: boolean + hideSelected: boolean + keepOrder: boolean + showOptionTooltips: boolean + minSelected: number + maxSelected: number + timeoutDelay: number + maxValuesShown: number + maxValuesMessage: string + } + select: { + select: HTMLSelectElement + onValueChange?: ((value: Option[]) => void) | undefined + onClassChange?: ((classes: string[]) => void) | undefined + onDisabledChange?: ((disabled: boolean) => void) | undefined + onOptionsChange?: ((data: DataArrayPartial) => void) | undefined + listen: boolean + enable: () => void + disable: () => void + hideUI: () => void + showUI: () => void + changeListen: (listen: boolean) => void + valueChange: (ev: Event) => boolean + getData: () => DataArrayPartial + getDataFromOptgroup: (optgroup: HTMLOptGroupElement) => import('../slim-select/store').OptgroupOptional + getDataFromOption: (option: HTMLOptionElement) => Option + getSelectedOptions: () => Option[] + getSelectedValues: () => string[] + setSelected: (ids: string[]) => void + updateSelect: (id?: string | undefined, style?: string | undefined, classes?: string[] | undefined) => void + updateOptions: (data: import('../slim-select/store').DataArray) => void + createOptgroup: (optgroup: import('../slim-select/store').Optgroup) => HTMLOptGroupElement + createOption: (info: Option) => HTMLOptionElement + destroy: () => void + } + store: { + validateDataArray: (data: DataArrayPartial | import('../slim-select/store').DataArray) => Error | null + validateOption: (option: import('../slim-select/store').OptionOptional | Option) => Error | null + partialToFullData: (data: DataArrayPartial) => import('../slim-select/store').DataArray + setData: (data: DataArrayPartial | import('../slim-select/store').DataArray) => void + getData: () => import('../slim-select/store').DataArray + getDataOptions: () => Option[] + addOption: (option: import('../slim-select/store').OptionOptional) => void + setSelectedBy: (selectedType: 'id' | 'value', selectedValues: string[]) => void + getSelected: () => string[] + getSelectedOptions: () => Option[] + getOptgroupByID: (id: string) => import('../slim-select/store').Optgroup | null + getOptionByID: (id: string) => Option | null + getSelectType: () => string + getFirstOption: () => Option | null + search: ( + search: string, + searchFilter: (opt: Option, search: string) => boolean, + ) => import('../slim-select/store').DataArray + filter: ( + filter: ((opt: Option) => boolean) | null, + includeOptgroup: boolean, + ) => import('../slim-select/store').DataArray + } + render: { settings: { - id: string; - style: string; - class: string[]; - isMultiple: boolean; - isOpen: boolean; - isFullOpen: boolean; - intervalMove: { - ref: () => NodeJS.Timeout; - unref: () => NodeJS.Timeout; - hasRef: () => boolean; - refresh: () => NodeJS.Timeout; - [Symbol.toPrimitive]: () => number; - [Symbol.dispose]: () => void; - } | null; - disabled: boolean; - alwaysOpen: boolean; - showSearch: boolean; - ariaLabel: string; - searchPlaceholder: string; - searchText: string; - searchingText: string; - searchHighlight: boolean; - closeOnSelect: boolean; - contentLocation: HTMLElement; - contentPosition: "relative" | "absolute"; - openPosition: "auto" | "up" | "down"; - placeholderText: string; - allowDeselect: boolean; - hideSelected: boolean; - keepOrder: boolean; - showOptionTooltips: boolean; - minSelected: number; - maxSelected: number; - timeoutDelay: number; - maxValuesShown: number; - maxValuesMessage: string; - }; - select: { - select: HTMLSelectElement; - onValueChange?: ((value: Option[]) => void) | undefined; - onClassChange?: ((classes: string[]) => void) | undefined; - onDisabledChange?: ((disabled: boolean) => void) | undefined; - onOptionsChange?: ((data: DataArrayPartial) => void) | undefined; - listen: boolean; - enable: () => void; - disable: () => void; - hideUI: () => void; - showUI: () => void; - changeListen: (listen: boolean) => void; - valueChange: (ev: Event) => boolean; - getData: () => DataArrayPartial; - getDataFromOptgroup: (optgroup: HTMLOptGroupElement) => import("../slim-select/store").OptgroupOptional; - getDataFromOption: (option: HTMLOptionElement) => Option; - getSelectedOptions: () => Option[]; - getSelectedValues: () => string[]; - setSelected: (ids: string[]) => void; - updateSelect: (id?: string | undefined, style?: string | undefined, classes?: string[] | undefined) => void; - updateOptions: (data: import("../slim-select/store").DataArray) => void; - createOptgroup: (optgroup: import("../slim-select/store").Optgroup) => HTMLOptGroupElement; - createOption: (info: Option) => HTMLOptionElement; - destroy: () => void; - }; + id: string + style: string + class: string[] + isMultiple: boolean + isOpen: boolean + isFullOpen: boolean + intervalMove: { + ref: () => NodeJS.Timeout + unref: () => NodeJS.Timeout + hasRef: () => boolean + refresh: () => NodeJS.Timeout + [Symbol.toPrimitive]: () => number + [Symbol.dispose]: () => void + } | null + disabled: boolean + alwaysOpen: boolean + showSearch: boolean + ariaLabel: string + searchPlaceholder: string + searchText: string + searchingText: string + searchHighlight: boolean + closeOnSelect: boolean + contentLocation: HTMLElement + contentPosition: 'relative' | 'absolute' + openPosition: 'auto' | 'up' | 'down' + placeholderText: string + allowDeselect: boolean + hideSelected: boolean + keepOrder: boolean + showOptionTooltips: boolean + minSelected: number + maxSelected: number + timeoutDelay: number + maxValuesShown: number + maxValuesMessage: string + } store: { - validateDataArray: (data: DataArrayPartial | import("../slim-select/store").DataArray) => Error | null; - validateOption: (option: import("../slim-select/store").OptionOptional | Option) => Error | null; - partialToFullData: (data: DataArrayPartial) => import("../slim-select/store").DataArray; - setData: (data: DataArrayPartial | import("../slim-select/store").DataArray) => void; - getData: () => import("../slim-select/store").DataArray; - getDataOptions: () => Option[]; - addOption: (option: import("../slim-select/store").OptionOptional) => void; - setSelectedBy: (selectedType: "id" | "value", selectedValues: string[]) => void; - getSelected: () => string[]; - getSelectedOptions: () => Option[]; - getOptgroupByID: (id: string) => import("../slim-select/store").Optgroup | null; - getOptionByID: (id: string) => Option | null; - getSelectType: () => string; - getFirstOption: () => Option | null; - search: (search: string, searchFilter: (opt: Option, search: string) => boolean) => import("../slim-select/store").DataArray; - filter: (filter: ((opt: Option) => boolean) | null, includeOptgroup: boolean) => import("../slim-select/store").DataArray; - }; - render: { - settings: { - id: string; - style: string; - class: string[]; - isMultiple: boolean; - isOpen: boolean; - isFullOpen: boolean; - intervalMove: { - ref: () => NodeJS.Timeout; - unref: () => NodeJS.Timeout; - hasRef: () => boolean; - refresh: () => NodeJS.Timeout; - [Symbol.toPrimitive]: () => number; - [Symbol.dispose]: () => void; - } | null; - disabled: boolean; - alwaysOpen: boolean; - showSearch: boolean; - ariaLabel: string; - searchPlaceholder: string; - searchText: string; - searchingText: string; - searchHighlight: boolean; - closeOnSelect: boolean; - contentLocation: HTMLElement; - contentPosition: "relative" | "absolute"; - openPosition: "auto" | "up" | "down"; - placeholderText: string; - allowDeselect: boolean; - hideSelected: boolean; - keepOrder: boolean; - showOptionTooltips: boolean; - minSelected: number; - maxSelected: number; - timeoutDelay: number; - maxValuesShown: number; - maxValuesMessage: string; - }; - store: { - validateDataArray: (data: DataArrayPartial | import("../slim-select/store").DataArray) => Error | null; - validateOption: (option: import("../slim-select/store").OptionOptional | Option) => Error | null; - partialToFullData: (data: DataArrayPartial) => import("../slim-select/store").DataArray; - setData: (data: DataArrayPartial | import("../slim-select/store").DataArray) => void; - getData: () => import("../slim-select/store").DataArray; - getDataOptions: () => Option[]; - addOption: (option: import("../slim-select/store").OptionOptional) => void; - setSelectedBy: (selectedType: "id" | "value", selectedValues: string[]) => void; - getSelected: () => string[]; - getSelectedOptions: () => Option[]; - getOptgroupByID: (id: string) => import("../slim-select/store").Optgroup | null; - getOptionByID: (id: string) => Option | null; - getSelectType: () => string; - getFirstOption: () => Option | null; - search: (search: string, searchFilter: (opt: Option, search: string) => boolean) => import("../slim-select/store").DataArray; - filter: (filter: ((opt: Option) => boolean) | null, includeOptgroup: boolean) => import("../slim-select/store").DataArray; - }; - callbacks: { - open: () => void; - close: () => void; - addable?: ((value: string) => string | false | import("../slim-select/store").OptionOptional | Promise | null | undefined) | undefined; - setSelected: (value: string | string[], runAfterChange: boolean) => void; - addOption: (option: Option) => void; - search: (search: string) => void; - beforeChange?: ((newVal: Option[], oldVal: Option[]) => boolean | void) | undefined; - afterChange?: ((newVal: Option[]) => void) | undefined; - }; - main: { - main: HTMLDivElement; - values: HTMLDivElement; - deselect: { - main: HTMLDivElement; - svg: SVGSVGElement; - path: SVGPathElement; - }; - arrow: { - main: SVGSVGElement; - path: SVGPathElement; - }; - }; - content: { - main: HTMLDivElement; - search: { - main: HTMLDivElement; - input: HTMLInputElement; - addable?: { - main: HTMLDivElement; - svg: SVGSVGElement; - path: SVGPathElement; - } | undefined; - }; - list: HTMLDivElement; - }; - classes: { - main: string; - placeholder: string; - values: string; - single: string; - max: string; - value: string; - valueText: string; - valueDelete: string; - valueOut: string; - deselect: string; - deselectPath: string; - arrow: string; - arrowClose: string; - arrowOpen: string; - content: string; - openAbove: string; - openBelow: string; - search: string; - searchHighlighter: string; - searching: string; - addable: string; - addablePath: string; - list: string; - optgroup: string; - optgroupLabel: string; - optgroupLabelText: string; - optgroupActions: string; - optgroupSelectAll: string; - optgroupSelectAllBox: string; - optgroupSelectAllCheck: string; - optgroupClosable: string; - option: string; - optionDelete: string; - highlighted: string; - open: string; - close: string; - selected: string; - error: string; - disabled: string; - hide: string; - }; - enable: () => void; - disable: () => void; - open: () => void; - close: () => void; - updateClassStyles: () => void; - updateAriaAttributes: () => void; - mainDiv: () => import("../slim-select/render").Main; - mainFocus: (eventType: string | null) => void; - placeholder: () => HTMLDivElement; - renderValues: () => void; - multipleValue: (option: Option) => HTMLDivElement; - contentDiv: () => import("../slim-select/render").Content; - moveContent: () => void; - searchDiv: () => import("../slim-select/render").Search; - searchFocus: () => void; - getOptions: (notPlaceholder?: boolean, notDisabled?: boolean, notHidden?: boolean) => HTMLDivElement[]; - highlight: (dir: "up" | "down") => void; - listDiv: () => HTMLDivElement; - renderError: (error: string) => void; - renderSearching: () => void; - renderOptions: (data: import("../slim-select/store").DataArray) => void; - option: (option: Option) => HTMLDivElement; - destroy: () => void; - moveContentAbove: () => void; - moveContentBelow: () => void; - ensureElementInView: (container: HTMLElement, element: HTMLElement) => void; - putContent: () => "up" | "down"; - updateDeselectAll: () => void; - }; - events: { - search?: ((searchValue: string, currentData: import("../slim-select/store").DataArray) => DataArrayPartial | Promise) | undefined; - searchFilter?: ((option: Option, search: string) => boolean) | undefined; - addable?: ((value: string) => string | false | import("../slim-select/store").OptionOptional | Promise | null | undefined) | undefined; - beforeChange?: ((newVal: Option[], oldVal: Option[]) => boolean | void) | undefined; - afterChange?: ((newVal: Option[]) => void) | undefined; - beforeOpen?: (() => void) | undefined; - afterOpen?: (() => void) | undefined; - beforeClose?: (() => void) | undefined; - afterClose?: (() => void) | undefined; - error?: ((err: Error) => void) | undefined; - }; - enable: () => void; - disable: () => void; - getData: () => import("../slim-select/store").DataArray; - setData: (data: DataArrayPartial) => void; - getSelected: () => string[]; - setSelected: (id: string | string[], runAfterChange?: boolean) => void; - addOption: (option: import("../slim-select/store").OptionOptional) => void; - open: () => void; - close: (eventType?: string | null) => void; - search: (value: string) => void; - destroy: () => void; - } | null; - getCleanValue(val: string | string[] | undefined): string | string[]; -}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").PublicProps, Readonly; - }; - multiple: { - type: BooleanConstructor; - default: boolean; - }; - data: { - type: PropType; - }; - settings: { - type: PropType>; - }; - events: { - type: PropType; - }; -}>> & { - "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined; -}, { - multiple: boolean; -}, {}>; -export default _default; + validateDataArray: (data: DataArrayPartial | import('../slim-select/store').DataArray) => Error | null + validateOption: (option: import('../slim-select/store').OptionOptional | Option) => Error | null + partialToFullData: (data: DataArrayPartial) => import('../slim-select/store').DataArray + setData: (data: DataArrayPartial | import('../slim-select/store').DataArray) => void + getData: () => import('../slim-select/store').DataArray + getDataOptions: () => Option[] + addOption: (option: import('../slim-select/store').OptionOptional) => void + setSelectedBy: (selectedType: 'id' | 'value', selectedValues: string[]) => void + getSelected: () => string[] + getSelectedOptions: () => Option[] + getOptgroupByID: (id: string) => import('../slim-select/store').Optgroup | null + getOptionByID: (id: string) => Option | null + getSelectType: () => string + getFirstOption: () => Option | null + search: ( + search: string, + searchFilter: (opt: Option, search: string) => boolean, + ) => import('../slim-select/store').DataArray + filter: ( + filter: ((opt: Option) => boolean) | null, + includeOptgroup: boolean, + ) => import('../slim-select/store').DataArray + } + callbacks: { + open: () => void + close: () => void + addable?: + | (( + value: string, + ) => + | string + | false + | import('../slim-select/store').OptionOptional + | Promise + | null + | undefined) + | undefined + setSelected: (value: string | string[], runAfterChange: boolean) => void + addOption: (option: Option) => void + search: (search: string) => void + beforeChange?: ((newVal: Option[], oldVal: Option[]) => boolean | void) | undefined + afterChange?: ((newVal: Option[]) => void) | undefined + } + main: { + main: HTMLDivElement + values: HTMLDivElement + deselect: { + main: HTMLDivElement + svg: SVGSVGElement + path: SVGPathElement + } + arrow: { + main: SVGSVGElement + path: SVGPathElement + } + } + content: { + main: HTMLDivElement + search: { + main: HTMLDivElement + input: HTMLInputElement + addable?: + | { + main: HTMLDivElement + svg: SVGSVGElement + path: SVGPathElement + } + | undefined + } + list: HTMLDivElement + } + classes: { + main: string + placeholder: string + values: string + single: string + max: string + value: string + valueText: string + valueDelete: string + valueOut: string + deselect: string + deselectPath: string + arrow: string + arrowClose: string + arrowOpen: string + content: string + openAbove: string + openBelow: string + search: string + searchHighlighter: string + searching: string + addable: string + addablePath: string + list: string + optgroup: string + optgroupLabel: string + optgroupLabelText: string + optgroupActions: string + optgroupSelectAll: string + optgroupSelectAllBox: string + optgroupSelectAllCheck: string + optgroupClosable: string + option: string + optionDelete: string + highlighted: string + open: string + close: string + selected: string + error: string + disabled: string + hide: string + } + enable: () => void + disable: () => void + open: () => void + close: () => void + updateClassStyles: () => void + updateAriaAttributes: () => void + mainDiv: () => import('../slim-select/render').Main + mainFocus: (eventType: string | null) => void + placeholder: () => HTMLDivElement + renderValues: () => void + multipleValue: (option: Option) => HTMLDivElement + contentDiv: () => import('../slim-select/render').Content + moveContent: () => void + searchDiv: () => import('../slim-select/render').Search + searchFocus: () => void + getOptions: (notPlaceholder?: boolean, notDisabled?: boolean, notHidden?: boolean) => HTMLDivElement[] + highlight: (dir: 'up' | 'down') => void + listDiv: () => HTMLDivElement + renderError: (error: string) => void + renderSearching: () => void + renderOptions: (data: import('../slim-select/store').DataArray) => void + option: (option: Option) => HTMLDivElement + destroy: () => void + moveContentAbove: () => void + moveContentBelow: () => void + ensureElementInView: (container: HTMLElement, element: HTMLElement) => void + putContent: () => 'up' | 'down' + updateDeselectAll: () => void + } + events: { + search?: + | (( + searchValue: string, + currentData: import('../slim-select/store').DataArray, + ) => DataArrayPartial | Promise) + | undefined + searchFilter?: ((option: Option, search: string) => boolean) | undefined + addable?: + | (( + value: string, + ) => + | string + | false + | import('../slim-select/store').OptionOptional + | Promise + | null + | undefined) + | undefined + beforeChange?: ((newVal: Option[], oldVal: Option[]) => boolean | void) | undefined + afterChange?: ((newVal: Option[]) => void) | undefined + beforeOpen?: (() => void) | undefined + afterOpen?: (() => void) | undefined + beforeClose?: (() => void) | undefined + afterClose?: (() => void) | undefined + error?: ((err: Error) => void) | undefined + } + enable: () => void + disable: () => void + getData: () => import('../slim-select/store').DataArray + setData: (data: DataArrayPartial) => void + getSelected: () => string[] + setSelected: (id: string | string[], runAfterChange?: boolean) => void + addOption: (option: import('../slim-select/store').OptionOptional) => void + open: () => void + close: (eventType?: string | null) => void + search: (value: string) => void + destroy: () => void + } | null + getCleanValue(val: string | string[] | undefined): string | string[] + }, + import('vue').ComponentOptionsMixin, + import('vue').ComponentOptionsMixin, + 'update:modelValue'[], + 'update:modelValue', + import('vue').PublicProps, + Readonly< + import('vue').ExtractPropTypes<{ + modelValue: { + type: PropType + } + multiple: { + type: BooleanConstructor + default: boolean + } + data: { + type: PropType + } + settings: { + type: PropType> + } + events: { + type: PropType + } + }> + > & { + 'onUpdate:modelValue'?: ((...args: any[]) => any) | undefined + }, + { + multiple: boolean + }, + {} +> +export default _default From 84924923c077da5069f140d4cb39158404d71d08 Mon Sep 17 00:00:00 2001 From: Ruben Fileti Date: Wed, 26 Jun 2024 14:41:10 +0200 Subject: [PATCH 3/3] Fixes for API backcompatibility --- dist/index.d.ts | 2 +- dist/slimselect.cjs.js | 24 +- dist/slimselect.es.js | 24 +- dist/slimselect.global.js | 24 +- dist/slimselect.js | 24 +- dist/slimselect.min.js | 2 +- dist/slimselect.umd.js | 24 +- dist/slimselect.umd.min.js | 2 +- docs/assets/index.js | 2 +- src/slim-select/index.ts | 22 +- src/vue/dist/slim-select/helpers.d.ts | 14 +- src/vue/dist/slim-select/index.d.ts | 80 +-- src/vue/dist/slim-select/render.d.ts | 220 ++++---- src/vue/dist/slim-select/select.d.ts | 54 +- src/vue/dist/slim-select/settings.d.ts | 62 +-- src/vue/dist/slim-select/store.d.ts | 141 +++-- src/vue/dist/slimselectvue.es.js | 24 +- src/vue/dist/slimselectvue.global.js | 24 +- src/vue/dist/slimselectvue.ssr.js | 24 +- src/vue/dist/vue/hello.d.ts | 4 +- src/vue/dist/vue/slimselect.vue.d.ts | 683 ++++++++++++------------- 21 files changed, 765 insertions(+), 715 deletions(-) diff --git a/dist/index.d.ts b/dist/index.d.ts index 4296bbe5..4e3fcedf 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -33,7 +33,7 @@ export default class SlimSelect { getData(): DataArray; setData(data: DataArrayPartial): void; getSelected(): string[]; - setSelected(id: string | string[], runAfterChange?: boolean): void; + setSelected(values: string | string[], runAfterChange?: boolean): void; addOption(option: OptionOptional): void; open(): void; close(eventType?: string | null): void; diff --git a/dist/slimselect.cjs.js b/dist/slimselect.cjs.js index 67ac8a6c..00e1ef5f 100644 --- a/dist/slimselect.cjs.js +++ b/dist/slimselect.cjs.js @@ -185,7 +185,7 @@ class Store { } } getSelected() { - return this.getSelectedOptions().map(option => option.id); + return this.getSelectedOptions().map((option) => option.id); } getSelectedOptions() { return this.filter((opt) => { @@ -1399,7 +1399,7 @@ class Select { return options; } getSelectedValues() { - return this.getSelectedOptions().map(option => option.value); + return this.getSelectedOptions().map((option) => option.value); } setSelected(ids) { this.changeListen(false); @@ -1636,7 +1636,7 @@ class SlimSelect { this.select.updateSelect(this.settings.id, this.settings.style, this.settings.class); this.select.hideUI(); this.select.onValueChange = (options) => { - this.setSelected(options.map(option => option.id)); + this.setSelected(options.map((option) => option.id)); }; this.select.onClassChange = (classes) => { this.settings.class = classes; @@ -1726,11 +1726,23 @@ class SlimSelect { } } getSelected() { - return this.store.getSelected(); + return this.store.getSelectedOptions().map((option) => option.value); } - setSelected(id, runAfterChange = true) { + setSelected(values, runAfterChange = true) { const selected = this.store.getSelected(); - this.store.setSelectedBy('id', Array.isArray(id) ? id : [id]); + const options = this.store.getDataOptions(); + values = Array.isArray(values) ? values : [values]; + const ids = []; + for (const value of values) { + if (options.find((option) => option.id == value)) { + ids.push(value); + continue; + } + for (const option of options.filter((option) => option.value == value)) { + ids.push(option.id); + } + } + this.store.setSelectedBy('id', ids); const data = this.store.getData(); this.select.updateOptions(data); this.render.renderValues(); diff --git a/dist/slimselect.es.js b/dist/slimselect.es.js index 8ad9e3eb..9258dd49 100644 --- a/dist/slimselect.es.js +++ b/dist/slimselect.es.js @@ -183,7 +183,7 @@ class Store { } } getSelected() { - return this.getSelectedOptions().map(option => option.id); + return this.getSelectedOptions().map((option) => option.id); } getSelectedOptions() { return this.filter((opt) => { @@ -1397,7 +1397,7 @@ class Select { return options; } getSelectedValues() { - return this.getSelectedOptions().map(option => option.value); + return this.getSelectedOptions().map((option) => option.value); } setSelected(ids) { this.changeListen(false); @@ -1634,7 +1634,7 @@ class SlimSelect { this.select.updateSelect(this.settings.id, this.settings.style, this.settings.class); this.select.hideUI(); this.select.onValueChange = (options) => { - this.setSelected(options.map(option => option.id)); + this.setSelected(options.map((option) => option.id)); }; this.select.onClassChange = (classes) => { this.settings.class = classes; @@ -1724,11 +1724,23 @@ class SlimSelect { } } getSelected() { - return this.store.getSelected(); + return this.store.getSelectedOptions().map((option) => option.value); } - setSelected(id, runAfterChange = true) { + setSelected(values, runAfterChange = true) { const selected = this.store.getSelected(); - this.store.setSelectedBy('id', Array.isArray(id) ? id : [id]); + const options = this.store.getDataOptions(); + values = Array.isArray(values) ? values : [values]; + const ids = []; + for (const value of values) { + if (options.find((option) => option.id == value)) { + ids.push(value); + continue; + } + for (const option of options.filter((option) => option.value == value)) { + ids.push(option.id); + } + } + this.store.setSelectedBy('id', ids); const data = this.store.getData(); this.select.updateOptions(data); this.render.renderValues(); diff --git a/dist/slimselect.global.js b/dist/slimselect.global.js index a2bc1a77..4139b6d3 100644 --- a/dist/slimselect.global.js +++ b/dist/slimselect.global.js @@ -186,7 +186,7 @@ var SlimSelect = (function () { } } getSelected() { - return this.getSelectedOptions().map(option => option.id); + return this.getSelectedOptions().map((option) => option.id); } getSelectedOptions() { return this.filter((opt) => { @@ -1400,7 +1400,7 @@ var SlimSelect = (function () { return options; } getSelectedValues() { - return this.getSelectedOptions().map(option => option.value); + return this.getSelectedOptions().map((option) => option.value); } setSelected(ids) { this.changeListen(false); @@ -1637,7 +1637,7 @@ var SlimSelect = (function () { this.select.updateSelect(this.settings.id, this.settings.style, this.settings.class); this.select.hideUI(); this.select.onValueChange = (options) => { - this.setSelected(options.map(option => option.id)); + this.setSelected(options.map((option) => option.id)); }; this.select.onClassChange = (classes) => { this.settings.class = classes; @@ -1727,11 +1727,23 @@ var SlimSelect = (function () { } } getSelected() { - return this.store.getSelected(); + return this.store.getSelectedOptions().map((option) => option.value); } - setSelected(id, runAfterChange = true) { + setSelected(values, runAfterChange = true) { const selected = this.store.getSelected(); - this.store.setSelectedBy('id', Array.isArray(id) ? id : [id]); + const options = this.store.getDataOptions(); + values = Array.isArray(values) ? values : [values]; + const ids = []; + for (const value of values) { + if (options.find((option) => option.id == value)) { + ids.push(value); + continue; + } + for (const option of options.filter((option) => option.value == value)) { + ids.push(option.id); + } + } + this.store.setSelectedBy('id', ids); const data = this.store.getData(); this.select.updateOptions(data); this.render.renderValues(); diff --git a/dist/slimselect.js b/dist/slimselect.js index 0e8ad964..1f31de2e 100644 --- a/dist/slimselect.js +++ b/dist/slimselect.js @@ -189,7 +189,7 @@ } } getSelected() { - return this.getSelectedOptions().map(option => option.id); + return this.getSelectedOptions().map((option) => option.id); } getSelectedOptions() { return this.filter((opt) => { @@ -1403,7 +1403,7 @@ return options; } getSelectedValues() { - return this.getSelectedOptions().map(option => option.value); + return this.getSelectedOptions().map((option) => option.value); } setSelected(ids) { this.changeListen(false); @@ -1640,7 +1640,7 @@ this.select.updateSelect(this.settings.id, this.settings.style, this.settings.class); this.select.hideUI(); this.select.onValueChange = (options) => { - this.setSelected(options.map(option => option.id)); + this.setSelected(options.map((option) => option.id)); }; this.select.onClassChange = (classes) => { this.settings.class = classes; @@ -1730,11 +1730,23 @@ } } getSelected() { - return this.store.getSelected(); + return this.store.getSelectedOptions().map((option) => option.value); } - setSelected(id, runAfterChange = true) { + setSelected(values, runAfterChange = true) { const selected = this.store.getSelected(); - this.store.setSelectedBy('id', Array.isArray(id) ? id : [id]); + const options = this.store.getDataOptions(); + values = Array.isArray(values) ? values : [values]; + const ids = []; + for (const value of values) { + if (options.find((option) => option.id == value)) { + ids.push(value); + continue; + } + for (const option of options.filter((option) => option.value == value)) { + ids.push(option.id); + } + } + this.store.setSelectedBy('id', ids); const data = this.store.getData(); this.select.updateOptions(data); this.render.renderValues(); diff --git a/dist/slimselect.min.js b/dist/slimselect.min.js index 8fde4b4e..b8ae4226 100644 --- a/dist/slimselect.min.js +++ b/dist/slimselect.min.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).SlimSelect=e()}(this,(function(){"use strict";function t(){return Math.random().toString(36).substring(2,10)}function e(t,e=50,s=!1){let i;return function(...n){const a=self,l=s&&!i;clearTimeout(i),i=setTimeout((()=>{i=null,s||t.apply(a,n)}),e),l&&t.apply(a,n)}}function s(t,e){return JSON.stringify(t)===JSON.stringify(e)}class i{constructor(e){if(this.id=e.id&&""!==e.id?e.id:t(),this.label=e.label||"",this.selectAll=void 0!==e.selectAll&&e.selectAll,this.selectAllText=e.selectAllText||"Select All",this.closable=e.closable||"off",this.options=[],e.options)for(const t of e.options)this.options.push(new n(t))}}class n{constructor(e){this.id=e.id&&""!==e.id?e.id:t(),this.value=void 0===e.value?e.text:e.value,this.text=e.text||"",this.html=e.html||"",this.selected=void 0!==e.selected&&e.selected,this.display=void 0===e.display||e.display,this.disabled=void 0!==e.disabled&&e.disabled,this.mandatory=void 0!==e.mandatory&&e.mandatory,this.placeholder=void 0!==e.placeholder&&e.placeholder,this.class=e.class||"",this.style=e.style||"",this.data=e.data||{}}}class a{constructor(t,e){this.selectType="single",this.data=[],this.selectType=t,this.setData(e)}validateDataArray(t){if(!Array.isArray(t))return new Error("Data must be an array");for(let e of t){if(!(e instanceof i||"label"in e))return e instanceof n||"text"in e?this.validateOption(e):new Error("Data object must be a valid optgroup or option");if(!("label"in e))return new Error("Optgroup must have a label");if("options"in e&&e.options)for(let t of e.options)return this.validateOption(t)}return null}validateOption(t){return"text"in t?null:new Error("Option must have a text")}partialToFullData(t){let e=[];return t.forEach((t=>{if(t instanceof i||"label"in t){let s=[];"options"in t&&t.options&&t.options.forEach((t=>{s.push(new n(t))})),s.length>0&&e.push(new i(t))}(t instanceof n||"text"in t)&&e.push(new n(t))})),e}setData(t){this.data=this.partialToFullData(t),"single"===this.selectType&&this.setSelectedBy("id",this.getSelected())}getData(){return this.filter(null,!0)}getDataOptions(){return this.filter(null,!1)}addOption(t){this.setData(this.getData().concat(new n(t)))}setSelectedBy(t,e){let s=null,a=!1;for(let l of this.data){if(l instanceof i)for(let i of l.options)s||(s=i),i.selected=!a&&e.includes(i[t]),i.selected&&"single"===this.selectType&&(a=!0);l instanceof n&&(s||(s=l),l.selected=!a&&e.includes(l[t]),l.selected&&"single"===this.selectType&&(a=!0))}"single"===this.selectType&&s&&!a&&(s.selected=!0)}getSelected(){return this.getSelectedOptions().map((t=>t.id))}getSelectedOptions(){return this.filter((t=>t.selected),!1)}getOptgroupByID(t){for(let e of this.data)if(e instanceof i&&e.id===t)return e;return null}getOptionByID(t){let e=this.filter((e=>e.id===t),!1);return e.length?e[0]:null}getSelectType(){return this.selectType}getFirstOption(){let t=null;for(let e of this.data)if(e instanceof i?t=e.options[0]:e instanceof n&&(t=e),t)break;return t}search(t,e){return""===(t=t.trim())?this.getData():this.filter((s=>e(s,t)),!0)}filter(t,e){const s=[];return this.data.forEach((a=>{if(a instanceof i){let l=[];if(a.options.forEach((i=>{t&&!t(i)||(e?l.push(new n(i)):s.push(new n(i)))})),l.length>0){let t=new i(a);t.options=l,s.push(t)}}a instanceof n&&(t&&!t(a)||s.push(new n(a)))})),s}}class l{constructor(t,e,s){this.classes={main:"ss-main",placeholder:"ss-placeholder",values:"ss-values",single:"ss-single",max:"ss-max",value:"ss-value",valueText:"ss-value-text",valueDelete:"ss-value-delete",valueOut:"ss-value-out",deselect:"ss-deselect",deselectPath:"M10,10 L90,90 M10,90 L90,10",arrow:"ss-arrow",arrowClose:"M10,30 L50,70 L90,30",arrowOpen:"M10,70 L50,30 L90,70",content:"ss-content",openAbove:"ss-open-above",openBelow:"ss-open-below",search:"ss-search",searchHighlighter:"ss-search-highlight",searching:"ss-searching",addable:"ss-addable",addablePath:"M50,10 L50,90 M10,50 L90,50",list:"ss-list",optgroup:"ss-optgroup",optgroupLabel:"ss-optgroup-label",optgroupLabelText:"ss-optgroup-label-text",optgroupActions:"ss-optgroup-actions",optgroupSelectAll:"ss-selectall",optgroupSelectAllBox:"M60,10 L10,10 L10,90 L90,90 L90,50",optgroupSelectAllCheck:"M30,45 L50,70 L90,10",optgroupClosable:"ss-closable",option:"ss-option",optionDelete:"M10,10 L90,90 M10,90 L90,10",highlighted:"ss-highlighted",open:"ss-open",close:"ss-close",selected:"ss-selected",error:"ss-error",disabled:"ss-disabled",hide:"ss-hide"},this.store=e,this.settings=t,this.callbacks=s,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes(),this.settings.contentLocation.appendChild(this.content.main)}enable(){this.main.main.classList.remove(this.classes.disabled),this.content.search.input.disabled=!1}disable(){this.main.main.classList.add(this.classes.disabled),this.content.search.input.disabled=!0}open(){this.main.arrow.path.setAttribute("d",this.classes.arrowOpen),this.main.main.classList.add("up"===this.settings.openPosition?this.classes.openAbove:this.classes.openBelow),this.main.main.setAttribute("aria-expanded","true"),this.moveContent();const t=this.store.getSelectedOptions();if(t.length){const e=t[t.length-1].id,s=this.content.list.querySelector('[data-id="'+e+'"]');s&&this.ensureElementInView(this.content.list,s)}}close(){this.main.main.classList.remove(this.classes.openAbove),this.main.main.classList.remove(this.classes.openBelow),this.main.main.setAttribute("aria-expanded","false"),this.content.main.classList.remove(this.classes.openAbove),this.content.main.classList.remove(this.classes.openBelow),this.main.arrow.path.setAttribute("d",this.classes.arrowClose)}updateClassStyles(){if(this.main.main.className="",this.main.main.removeAttribute("style"),this.content.main.className="",this.content.main.removeAttribute("style"),this.main.main.classList.add(this.classes.main),this.content.main.classList.add(this.classes.content),""!==this.settings.style&&(this.main.main.style.cssText=this.settings.style,this.content.main.style.cssText=this.settings.style),this.settings.class.length)for(const t of this.settings.class)""!==t.trim()&&(this.main.main.classList.add(t.trim()),this.content.main.classList.add(t.trim()));"relative"===this.settings.contentPosition&&this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){this.main.main.role="combobox",this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.main.id),this.main.main.setAttribute("aria-expanded","false"),this.content.main.setAttribute("role","listbox")}mainDiv(){var t;const e=document.createElement("div");e.dataset.id=this.settings.id,e.setAttribute("aria-label",this.settings.ariaLabel),e.tabIndex=0,e.onkeydown=t=>{switch(t.key){case"ArrowUp":case"ArrowDown":return this.callbacks.open(),"ArrowDown"===t.key?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Enter":case" ":this.callbacks.open();const e=this.content.list.querySelector("."+this.classes.highlighted);return e&&e.click(),!1;case"Escape":return this.callbacks.close(),!1}return!1},e.onclick=t=>{this.settings.disabled||(this.settings.isOpen?this.callbacks.close():this.callbacks.open())};const s=document.createElement("div");s.classList.add(this.classes.values),e.appendChild(s);const i=document.createElement("div");i.classList.add(this.classes.deselect);const n=null===(t=this.store)||void 0===t?void 0:t.getSelectedOptions();!this.settings.allowDeselect||this.settings.isMultiple&&n&&n.length<=0?i.classList.add(this.classes.hide):i.classList.remove(this.classes.hide),i.onclick=t=>{if(t.stopPropagation(),this.settings.disabled)return;let e=!0;const s=this.store.getSelectedOptions(),i=[];if(this.callbacks.beforeChange&&(e=!0===this.callbacks.beforeChange(i,s)),e){if(this.settings.isMultiple)this.callbacks.setSelected([],!1),this.updateDeselectAll();else{const t=this.store.getFirstOption(),e=t?t.id:"";this.callbacks.setSelected(e,!1)}this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(this.store.getSelectedOptions())}};const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100");const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.deselectPath),a.appendChild(l),i.appendChild(a),e.appendChild(i);const o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.classList.add(this.classes.arrow),o.setAttribute("viewBox","0 0 100 100");const c=document.createElementNS("http://www.w3.org/2000/svg","path");return c.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&o.classList.add(this.classes.hide),o.appendChild(c),e.appendChild(o),{main:e,values:s,deselect:{main:i,svg:a,path:l},arrow:{main:o,path:c}}}mainFocus(t){"click"!==t&&this.main.main.focus({preventScroll:!0})}placeholder(){const t=this.store.filter((t=>t.placeholder),!1);let e=this.settings.placeholderText;t.length&&(""!==t[0].html?e=t[0].html:""!==t[0].text&&(e=t[0].text));const s=document.createElement("div");return s.classList.add(this.classes.placeholder),s.innerHTML=e,s}renderValues(){this.settings.isMultiple?(this.renderMultipleValues(),this.updateDeselectAll()):this.renderSingleValue()}renderSingleValue(){const t=this.store.filter((t=>t.selected&&!t.placeholder),!1),e=t.length>0?t[0]:null;if(e){const t=document.createElement("div");t.classList.add(this.classes.single),e.html?t.innerHTML=e.html:t.innerText=e.text,this.main.values.innerHTML=t.outerHTML}else this.main.values.innerHTML=this.placeholder().outerHTML;this.settings.allowDeselect&&t.length?this.main.deselect.main.classList.remove(this.classes.hide):this.main.deselect.main.classList.add(this.classes.hide)}renderMultipleValues(){let t=this.main.values.childNodes,e=this.store.filter((t=>t.selected&&t.display),!1);if(0===e.length)return void(this.main.values.innerHTML=this.placeholder().outerHTML);{const t=this.main.values.querySelector("."+this.classes.placeholder);t&&t.remove()}if(e.length>this.settings.maxValuesShown){const t=document.createElement("div");return t.classList.add(this.classes.max),t.textContent=this.settings.maxValuesMessage.replace("{number}",e.length.toString()),void(this.main.values.innerHTML=t.outerHTML)}{const t=this.main.values.querySelector("."+this.classes.max);t&&t.remove()}let s=[];for(let i=0;it.id===a),!1).length||s.push(n)}}for(const t of s)t.classList.add(this.classes.valueOut),setTimeout((()=>{this.main.values.hasChildNodes()&&this.main.values.contains(t)&&this.main.values.removeChild(t)}),100);t=this.main.values.childNodes;for(let s=0;s{if(e.preventDefault(),e.stopPropagation(),this.settings.disabled)return;let s=!0;const a=this.store.getSelectedOptions(),l=a.filter((e=>e.selected&&e.id!==t.id),!0);if(!(this.settings.minSelected&&l.length{this.callbacks.search(t.target.value)}),100),s.onkeydown=t=>{switch(t.key){case"ArrowUp":case"ArrowDown":return"ArrowDown"===t.key?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Escape":return this.callbacks.close(),!1;case"Enter":case" ":if(this.callbacks.addable&&t.ctrlKey)return i.click(),!1;{const t=this.content.list.querySelector("."+this.classes.highlighted);if(t)return t.click(),!1}return!0}return!0},t.appendChild(s),this.callbacks.addable){i.classList.add(this.classes.addable);const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 100 100");const s=document.createElementNS("http://www.w3.org/2000/svg","path");s.setAttribute("d",this.classes.addablePath),e.appendChild(s),i.appendChild(e),i.onclick=t=>{if(t.preventDefault(),t.stopPropagation(),!this.callbacks.addable)return;const e=this.content.search.input.value.trim();if(""===e)return void this.content.search.input.focus();const s=t=>{let e=new n(t);if(this.callbacks.addOption(e),this.settings.isMultiple){let t=this.store.getSelected();t.push(e.id),this.callbacks.setSelected(t,!0)}else this.callbacks.setSelected([e.id],!0);this.callbacks.search(""),this.settings.closeOnSelect&&setTimeout((()=>{this.callbacks.close()}),100)},i=this.callbacks.addable(e);!1!==i&&null!=i&&(i instanceof Promise?i.then((t=>{s("string"==typeof t?{text:t,value:t}:t)})):s("string"==typeof i?{text:i,value:i}:i))},t.appendChild(i),a.addable={main:i,svg:e,path:s}}return a}searchFocus(){this.content.search.input.focus()}getOptions(t=!1,e=!1,s=!1){let i="."+this.classes.option;return t&&(i+=":not(."+this.classes.placeholder+")"),e&&(i+=":not(."+this.classes.disabled+")"),s&&(i+=":not(."+this.classes.hide+")"),Array.from(this.content.list.querySelectorAll(i))}highlight(t){const e=this.getOptions(!0,!0,!0);if(0===e.length)return;if(1===e.length&&!e[0].classList.contains(this.classes.highlighted))return void e[0].classList.add(this.classes.highlighted);let s=!1;for(const t of e)t.classList.contains(this.classes.highlighted)&&(s=!0);if(!s)for(const t of e)if(t.classList.contains(this.classes.selected)){t.classList.add(this.classes.highlighted);break}for(let s=0;s=0?s-1:e.length-1];a.classList.add(this.classes.highlighted),this.ensureElementInView(this.content.list,a);const l=a.parentElement;if(l&&l.classList.contains(this.classes.close)){const t=l.querySelector("."+this.classes.optgroupLabel);t&&t.click()}return}e["down"===t?0:e.length-1].classList.add(this.classes.highlighted),this.ensureElementInView(this.content.list,e["down"===t?0:e.length-1])}listDiv(){const t=document.createElement("div");return t.classList.add(this.classes.list),t}renderError(t){this.content.list.innerHTML="";const e=document.createElement("div");e.classList.add(this.classes.error),e.textContent=t,this.content.list.appendChild(e)}renderSearching(){this.content.list.innerHTML="";const t=document.createElement("div");t.classList.add(this.classes.searching),t.textContent=this.settings.searchingText,this.content.list.appendChild(t)}renderOptions(t){if(this.content.list.innerHTML="",0===t.length){const t=document.createElement("div");return t.classList.add(this.classes.search),t.innerHTML=this.settings.searchText,void this.content.list.appendChild(t)}for(const e of t){if(e instanceof i){const t=document.createElement("div");t.classList.add(this.classes.optgroup);const s=document.createElement("div");s.classList.add(this.classes.optgroupLabel),t.appendChild(s);const i=document.createElement("div");i.classList.add(this.classes.optgroupLabelText),i.textContent=e.label,s.appendChild(i);const n=document.createElement("div");if(n.classList.add(this.classes.optgroupActions),s.appendChild(n),this.settings.isMultiple&&e.selectAll){const t=document.createElement("div");t.classList.add(this.classes.optgroupSelectAll);let s=!0;for(const t of e.options)if(!t.selected){s=!1;break}s&&t.classList.add(this.classes.selected);const i=document.createElement("span");i.textContent=e.selectAllText,t.appendChild(i);const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100"),t.appendChild(a);const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.optgroupSelectAllBox),a.appendChild(l);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.optgroupSelectAllCheck),a.appendChild(o),t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const i=this.store.getSelected();if(s){const t=i.filter((t=>{for(const s of e.options)if(t===s.id)return!1;return!0}));this.callbacks.setSelected(t,!0)}else{const t=i.concat(e.options.map((t=>t.id)));for(const t of e.options)this.store.getOptionByID(t.id)||this.callbacks.addOption(t);this.callbacks.setSelected(t,!0)}})),n.appendChild(t)}if("off"!==e.closable){const i=document.createElement("div");i.classList.add(this.classes.optgroupClosable);const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100"),a.classList.add(this.classes.arrow),i.appendChild(a);const l=document.createElementNS("http://www.w3.org/2000/svg","path");a.appendChild(l),e.options.some((t=>t.selected))||""!==this.content.search.input.value.trim()?(i.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"open"===e.closable?(t.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"close"===e.closable&&(t.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose)),s.addEventListener("click",(e=>{e.preventDefault(),e.stopPropagation(),t.classList.contains(this.classes.close)?(t.classList.remove(this.classes.close),t.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):(t.classList.remove(this.classes.open),t.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose))})),n.appendChild(i)}t.appendChild(s);for(const s of e.options)t.appendChild(this.option(s));this.content.list.appendChild(t)}e instanceof n&&this.content.list.appendChild(this.option(e))}}option(t){if(t.placeholder){const t=document.createElement("div");return t.classList.add(this.classes.option),t.classList.add(this.classes.hide),t}const e=document.createElement("div");return e.dataset.id=t.id,e.id=t.id,e.classList.add(this.classes.option),e.setAttribute("role","option"),t.class&&t.class.split(" ").forEach((t=>{e.classList.add(t)})),t.style&&(e.style.cssText=t.style),this.settings.searchHighlight&&""!==this.content.search.input.value.trim()?e.innerHTML=this.highlightText(""!==t.html?t.html:t.text,this.content.search.input.value,this.classes.searchHighlighter):""!==t.html?e.innerHTML=t.html:e.textContent=t.text,this.settings.showOptionTooltips&&e.textContent&&e.setAttribute("title",e.textContent),t.display||e.classList.add(this.classes.hide),t.disabled&&e.classList.add(this.classes.disabled),t.selected&&this.settings.hideSelected&&e.classList.add(this.classes.hide),t.selected?(e.classList.add(this.classes.selected),e.setAttribute("aria-selected","true"),this.main.main.setAttribute("aria-activedescendant",e.id)):(e.classList.remove(this.classes.selected),e.setAttribute("aria-selected","false")),e.addEventListener("click",(e=>{e.preventDefault(),e.stopPropagation();const s=this.store.getSelected(),i=e.currentTarget,n=String(i.dataset.id);if(t.disabled||t.selected&&!this.settings.allowDeselect)return;if(this.settings.isMultiple&&this.settings.maxSelected<=s.length&&!t.selected||this.settings.isMultiple&&this.settings.minSelected>=s.length&&t.selected)return;let a=!1;const l=this.store.getSelectedOptions();let o=[];this.settings.isMultiple&&(o=t.selected?l.filter((t=>t.id!==n)):l.concat(t)),this.settings.isMultiple||(o=t.selected?[]:[t]),this.callbacks.beforeChange||(a=!0),this.callbacks.beforeChange&&(a=!1!==this.callbacks.beforeChange(o,l)),a&&(this.store.getOptionByID(n)||this.callbacks.addOption(t),this.callbacks.setSelected(o.map((t=>t.id)),!1),this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(o))})),e}destroy(){this.main.main.remove(),this.content.main.remove()}highlightText(t,e,s){let i=t;const n=new RegExp("("+e.trim()+")(?![^<]*>[^<>]*${o}`),i}moveContentAbove(){const t=this.main.main.offsetHeight,e=this.content.main.offsetHeight;this.main.main.classList.remove(this.classes.openBelow),this.main.main.classList.add(this.classes.openAbove),this.content.main.classList.remove(this.classes.openBelow),this.content.main.classList.add(this.classes.openAbove);const s=this.main.main.getBoundingClientRect();this.content.main.style.margin="-"+(t+e-1)+"px 0px 0px 0px",this.content.main.style.top=s.top+s.height+window.scrollY+"px",this.content.main.style.left=s.left+window.scrollX+"px",this.content.main.style.width=s.width+"px"}moveContentBelow(){this.main.main.classList.remove(this.classes.openAbove),this.main.main.classList.add(this.classes.openBelow),this.content.main.classList.remove(this.classes.openAbove),this.content.main.classList.add(this.classes.openBelow);const t=this.main.main.getBoundingClientRect();this.content.main.style.margin="-1px 0px 0px 0px","relative"!==this.settings.contentPosition&&(this.content.main.style.top=t.top+t.height+window.scrollY+"px",this.content.main.style.left=t.left+window.scrollX+"px",this.content.main.style.width=t.width+"px")}ensureElementInView(t,e){const s=t.scrollTop+t.offsetTop,i=s+t.clientHeight,n=e.offsetTop,a=n+e.clientHeight;ni&&(t.scrollTop+=a-i)}putContent(){const t=this.main.main.offsetHeight,e=this.main.main.getBoundingClientRect(),s=this.content.main.offsetHeight;return window.innerHeight-(e.top+t)<=s&&e.top>s?"up":"down"}updateDeselectAll(){if(!this.store||!this.settings)return;const t=this.store.getSelectedOptions(),e=t&&t.length>0,s=this.settings.isMultiple,i=this.settings.allowDeselect,n=this.main.deselect.main,a=this.classes.hide;!i||s&&!e?n.classList.add(a):n.classList.remove(a)}}class o{constructor(t){this.listen=!1,this.observer=null,this.select=t,this.valueChange=this.valueChange.bind(this),this.select.addEventListener("change",this.valueChange,{passive:!0}),this.observer=new MutationObserver(this.observeCall.bind(this)),this.changeListen(!0)}enable(){this.select.disabled=!1}disable(){this.select.disabled=!0}hideUI(){this.select.tabIndex=-1,this.select.style.display="none",this.select.setAttribute("aria-hidden","true")}showUI(){this.select.removeAttribute("tabindex"),this.select.style.display="",this.select.removeAttribute("aria-hidden")}changeListen(t){this.listen=t,t&&this.observer&&this.observer.observe(this.select,{subtree:!0,childList:!0,attributes:!0}),t||this.observer&&this.observer.disconnect()}valueChange(t){return this.listen&&this.onValueChange&&this.onValueChange(this.getSelectedOptions()),!0}observeCall(t){if(!this.listen)return;let e=!1,s=!1,i=!1;for(const n of t)n.target===this.select&&("disabled"===n.attributeName&&(s=!0),"class"===n.attributeName&&(e=!0)),"OPTGROUP"!==n.target.nodeName&&"OPTION"!==n.target.nodeName||(i=!0);e&&this.onClassChange&&this.onClassChange(this.select.className.split(" ")),s&&this.onDisabledChange&&(this.changeListen(!1),this.onDisabledChange(this.select.disabled),this.changeListen(!0)),i&&this.onOptionsChange&&(this.changeListen(!1),this.onOptionsChange(this.getData()),this.changeListen(!0))}getData(){let t=[];const e=this.select.childNodes;for(const s of e)"OPTGROUP"===s.nodeName&&t.push(this.getDataFromOptgroup(s)),"OPTION"===s.nodeName&&t.push(this.getDataFromOption(s));return t}getDataFromOptgroup(t){let e={id:t.id,label:t.label,selectAll:!!t.dataset&&"true"===t.dataset.selectall,selectAllText:t.dataset?t.dataset.selectalltext:"Select all",closable:t.dataset?t.dataset.closable:"off",options:[]};const s=t.childNodes;for(const t of s)"OPTION"===t.nodeName&&e.options.push(this.getDataFromOption(t));return e}getDataFromOption(t){return{id:t.id,value:t.value,text:t.text,html:t.dataset&&t.dataset.html?t.dataset.html:"",selected:t.selected,display:"none"!==t.style.display,disabled:t.disabled,mandatory:!!t.dataset&&"true"===t.dataset.mandatory,placeholder:"true"===t.dataset.placeholder,class:t.className,style:t.style.cssText,data:t.dataset}}getSelectedOptions(){let t=[];const e=this.select.childNodes;for(const s of e){if("OPTGROUP"===s.nodeName){const e=s.childNodes;for(const s of e)if("OPTION"===s.nodeName){const e=s;e.selected&&t.push(this.getDataFromOption(e))}}if("OPTION"===s.nodeName){const e=s;e.selected&&t.push(this.getDataFromOption(e))}}return t}getSelectedValues(){return this.getSelectedOptions().map((t=>t.value))}setSelected(t){this.changeListen(!1);const e=this.select.childNodes;for(const s of e){if("OPTGROUP"===s.nodeName){const e=s.childNodes;for(const s of e)if("OPTION"===s.nodeName){const e=s;e.selected=t.includes(e.id)}}if("OPTION"===s.nodeName){const e=s;e.selected=t.includes(e.id)}}this.changeListen(!0)}updateSelect(t,e,s){this.changeListen(!1),t&&(this.select.dataset.id=t),e&&(this.select.style.cssText=e),s&&(this.select.className="",s.forEach((t=>{""!==t.trim()&&this.select.classList.add(t.trim())}))),this.changeListen(!0)}updateOptions(t){this.changeListen(!1),this.select.innerHTML="";for(const e of t)e instanceof i&&this.select.appendChild(this.createOptgroup(e)),e instanceof n&&this.select.appendChild(this.createOption(e));this.select.dispatchEvent(new Event("change")),this.changeListen(!0)}createOptgroup(t){const e=document.createElement("optgroup");if(e.id=t.id,e.label=t.label,t.selectAll&&(e.dataset.selectAll="true"),"off"!==t.closable&&(e.dataset.closable=t.closable),t.options)for(const s of t.options)e.appendChild(this.createOption(s));return e}createOption(t){const e=document.createElement("option");return e.id=t.id,e.value=t.value,e.innerHTML=t.text,""!==t.html&&e.setAttribute("data-html",t.html),t.selected&&(e.selected=t.selected),t.disabled&&(e.disabled=!0),!1===t.display&&(e.style.display="none"),t.placeholder&&e.setAttribute("data-placeholder","true"),t.mandatory&&e.setAttribute("data-mandatory","true"),t.class&&t.class.split(" ").forEach((t=>{e.classList.add(t)})),t.data&&"object"==typeof t.data&&Object.keys(t.data).forEach((s=>{e.setAttribute("data-"+function(t){const e=t.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,(t=>"-"+t.toLowerCase()));return t[0]===t[0].toUpperCase()?e.substring(1):e}(s),t.data[s])})),e}destroy(){this.changeListen(!1),this.select.removeEventListener("change",this.valueChange),this.observer&&(this.observer.disconnect(),this.observer=null),delete this.select.dataset.id,this.showUI()}}class c{constructor(e){this.id="",this.style="",this.class=[],this.isMultiple=!1,this.isOpen=!1,this.isFullOpen=!1,this.intervalMove=null,e||(e={}),this.id="ss-"+t(),this.style=e.style||"",this.class=e.class||[],this.disabled=void 0!==e.disabled&&e.disabled,this.alwaysOpen=void 0!==e.alwaysOpen&&e.alwaysOpen,this.showSearch=void 0===e.showSearch||e.showSearch,this.ariaLabel=e.ariaLabel||"Combobox",this.searchPlaceholder=e.searchPlaceholder||"Search",this.searchText=e.searchText||"No Results",this.searchingText=e.searchingText||"Searching...",this.searchHighlight=void 0!==e.searchHighlight&&e.searchHighlight,this.closeOnSelect=void 0===e.closeOnSelect||e.closeOnSelect,this.contentLocation=e.contentLocation||document.body,this.contentPosition=e.contentPosition||"absolute",this.openPosition=e.openPosition||"auto",this.placeholderText=void 0!==e.placeholderText?e.placeholderText:"Select Value",this.allowDeselect=void 0!==e.allowDeselect&&e.allowDeselect,this.hideSelected=void 0!==e.hideSelected&&e.hideSelected,this.keepOrder=void 0!==e.keepOrder&&e.keepOrder,this.showOptionTooltips=void 0!==e.showOptionTooltips&&e.showOptionTooltips,this.minSelected=e.minSelected||0,this.maxSelected=e.maxSelected||1e3,this.timeoutDelay=e.timeoutDelay||200,this.maxValuesShown=e.maxValuesShown||20,this.maxValuesMessage=e.maxValuesMessage||"{number} selected"}}return class{constructor(t){var s;if(this.events={search:void 0,searchFilter:(t,e)=>-1!==t.text.toLowerCase().indexOf(e.toLowerCase()),addable:void 0,beforeChange:void 0,afterChange:void 0,beforeOpen:void 0,afterOpen:void 0,beforeClose:void 0,afterClose:void 0},this.windowResize=e((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.windowScroll=e((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.documentClick=t=>{this.settings.isOpen&&t.target&&!function(t,e){function s(t,s){return s&&t&&t.classList&&t.classList.contains(s)||s&&t&&t.dataset&&t.dataset.id&&t.dataset.id===e?t:null}return s(t,e)||function t(e,i){return e&&e!==document?s(e,i)?e:t(e.parentNode,i):null}(t,e)}(t.target,this.settings.id)&&this.close(t.type)},this.windowVisibilityChange=()=>{document.hidden&&this.close()},this.selectEl="string"==typeof t.select?document.querySelector(t.select):t.select,!this.selectEl)return void(t.events&&t.events.error&&t.events.error(new Error("Could not find select element")));if("SELECT"!==this.selectEl.tagName)return void(t.events&&t.events.error&&t.events.error(new Error("Element isnt of type select")));this.selectEl.dataset.ssid&&this.destroy(),this.settings=new c(t.settings);const i=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const s in t.events)t.events.hasOwnProperty(s)&&(-1!==i.indexOf(s)?this.events[s]=e(t.events[s],100):this.events[s]=t.events[s]);this.settings.disabled=(null===(s=t.settings)||void 0===s?void 0:s.disabled)?t.settings.disabled:this.selectEl.disabled,this.settings.isMultiple=this.selectEl.multiple,this.settings.style=this.selectEl.style.cssText,this.settings.class=this.selectEl.className.split(" "),this.select=new o(this.selectEl),this.select.updateSelect(this.settings.id,this.settings.style,this.settings.class),this.select.hideUI(),this.select.onValueChange=t=>{this.setSelected(t.map((t=>t.id)))},this.select.onClassChange=t=>{this.settings.class=t,this.render.updateClassStyles()},this.select.onDisabledChange=t=>{t?this.disable():this.enable()},this.select.onOptionsChange=t=>{this.setData(t)},this.store=new a(this.settings.isMultiple?"multiple":"single",t.data?t.data:this.select.getData()),t.data&&this.select.updateOptions(this.store.getData());const n={open:this.open.bind(this),close:this.close.bind(this),addable:this.events.addable?this.events.addable:void 0,setSelected:this.setSelected.bind(this),addOption:this.addOption.bind(this),search:this.search.bind(this),beforeChange:this.events.beforeChange,afterChange:this.events.afterChange};this.render=new l(this.settings,this.store,n),this.render.renderValues(),this.render.renderOptions(this.store.getData());const h=this.selectEl.getAttribute("aria-label"),r=this.selectEl.getAttribute("aria-labelledby");h?this.render.main.main.setAttribute("aria-label",h):r&&this.render.main.main.setAttribute("aria-labelledby",r),this.selectEl.parentNode&&this.selectEl.parentNode.insertBefore(this.render.main.main,this.selectEl.nextSibling),window.addEventListener("resize",this.windowResize,!1),"auto"===this.settings.openPosition&&window.addEventListener("scroll",this.windowScroll,!1),document.addEventListener("visibilitychange",this.windowVisibilityChange),this.settings.disabled&&this.disable(),this.settings.alwaysOpen&&this.open(),this.selectEl.slim=this}enable(){this.settings.disabled=!1,this.select.enable(),this.render.enable()}disable(){this.settings.disabled=!0,this.select.disable(),this.render.disable()}getData(){return this.store.getData()}setData(t){const e=this.store.getSelected(),i=this.store.validateDataArray(t);if(i)return void(this.events.error&&this.events.error(i));this.store.setData(t);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!s(e,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){return this.store.getSelected()}setSelected(t,e=!0){const i=this.store.getSelected();this.store.setSelectedBy("id",Array.isArray(t)?t:[t]);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),""!==this.render.content.search.input.value?this.search(this.render.content.search.input.value):this.render.renderOptions(n),e&&this.events.afterChange&&!s(i,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}addOption(t){const e=this.store.getSelected();this.store.getDataOptions().some((e=>{var s;return e.value===(null!==(s=t.value)&&void 0!==s?s:t.text)}))||this.store.addOption(t);const i=this.store.getData();this.select.updateOptions(i),this.render.renderValues(),this.render.renderOptions(i),this.events.afterChange&&!s(e,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}open(){this.settings.disabled||this.settings.isOpen||(this.events.beforeOpen&&this.events.beforeOpen(),this.render.open(),this.settings.showSearch&&this.render.searchFocus(),this.settings.isOpen=!0,setTimeout((()=>{this.events.afterOpen&&this.events.afterOpen(),this.settings.isOpen&&(this.settings.isFullOpen=!0),document.addEventListener("click",this.documentClick)}),this.settings.timeoutDelay),"absolute"===this.settings.contentPosition&&(this.settings.intervalMove&&clearInterval(this.settings.intervalMove),this.settings.intervalMove=setInterval(this.render.moveContent.bind(this.render),500)))}close(t=null){this.settings.isOpen&&!this.settings.alwaysOpen&&(this.events.beforeClose&&this.events.beforeClose(),this.render.close(),""!==this.render.content.search.input.value&&this.search(""),this.render.mainFocus(t),this.settings.isOpen=!1,this.settings.isFullOpen=!1,setTimeout((()=>{this.events.afterClose&&this.events.afterClose(),document.removeEventListener("click",this.documentClick)}),this.settings.timeoutDelay),this.settings.intervalMove&&clearInterval(this.settings.intervalMove))}search(t){if(this.render.content.search.input.value!==t&&(this.render.content.search.input.value=t),!this.events.search)return void this.render.renderOptions(""===t?this.store.getData():this.store.search(t,this.events.searchFilter));this.render.renderSearching();const e=this.events.search(t,this.store.getSelectedOptions());e instanceof Promise?e.then((t=>{this.render.renderOptions(this.store.partialToFullData(t))})).catch((t=>{this.render.renderError("string"==typeof t?t:t.message)})):Array.isArray(e)?this.render.renderOptions(this.store.partialToFullData(e)):this.render.renderError("Search event must return a promise or an array of data")}destroy(){document.removeEventListener("click",this.documentClick),window.removeEventListener("resize",this.windowResize,!1),"auto"===this.settings.openPosition&&window.removeEventListener("scroll",this.windowScroll,!1),document.removeEventListener("visibilitychange",this.windowVisibilityChange),this.store.setData([]),this.render.destroy(),this.select.destroy()}}})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).SlimSelect=e()}(this,(function(){"use strict";function t(){return Math.random().toString(36).substring(2,10)}function e(t,e=50,s=!1){let i;return function(...n){const a=self,l=s&&!i;clearTimeout(i),i=setTimeout((()=>{i=null,s||t.apply(a,n)}),e),l&&t.apply(a,n)}}function s(t,e){return JSON.stringify(t)===JSON.stringify(e)}class i{constructor(e){if(this.id=e.id&&""!==e.id?e.id:t(),this.label=e.label||"",this.selectAll=void 0!==e.selectAll&&e.selectAll,this.selectAllText=e.selectAllText||"Select All",this.closable=e.closable||"off",this.options=[],e.options)for(const t of e.options)this.options.push(new n(t))}}class n{constructor(e){this.id=e.id&&""!==e.id?e.id:t(),this.value=void 0===e.value?e.text:e.value,this.text=e.text||"",this.html=e.html||"",this.selected=void 0!==e.selected&&e.selected,this.display=void 0===e.display||e.display,this.disabled=void 0!==e.disabled&&e.disabled,this.mandatory=void 0!==e.mandatory&&e.mandatory,this.placeholder=void 0!==e.placeholder&&e.placeholder,this.class=e.class||"",this.style=e.style||"",this.data=e.data||{}}}class a{constructor(t,e){this.selectType="single",this.data=[],this.selectType=t,this.setData(e)}validateDataArray(t){if(!Array.isArray(t))return new Error("Data must be an array");for(let e of t){if(!(e instanceof i||"label"in e))return e instanceof n||"text"in e?this.validateOption(e):new Error("Data object must be a valid optgroup or option");if(!("label"in e))return new Error("Optgroup must have a label");if("options"in e&&e.options)for(let t of e.options)return this.validateOption(t)}return null}validateOption(t){return"text"in t?null:new Error("Option must have a text")}partialToFullData(t){let e=[];return t.forEach((t=>{if(t instanceof i||"label"in t){let s=[];"options"in t&&t.options&&t.options.forEach((t=>{s.push(new n(t))})),s.length>0&&e.push(new i(t))}(t instanceof n||"text"in t)&&e.push(new n(t))})),e}setData(t){this.data=this.partialToFullData(t),"single"===this.selectType&&this.setSelectedBy("id",this.getSelected())}getData(){return this.filter(null,!0)}getDataOptions(){return this.filter(null,!1)}addOption(t){this.setData(this.getData().concat(new n(t)))}setSelectedBy(t,e){let s=null,a=!1;for(let l of this.data){if(l instanceof i)for(let i of l.options)s||(s=i),i.selected=!a&&e.includes(i[t]),i.selected&&"single"===this.selectType&&(a=!0);l instanceof n&&(s||(s=l),l.selected=!a&&e.includes(l[t]),l.selected&&"single"===this.selectType&&(a=!0))}"single"===this.selectType&&s&&!a&&(s.selected=!0)}getSelected(){return this.getSelectedOptions().map((t=>t.id))}getSelectedOptions(){return this.filter((t=>t.selected),!1)}getOptgroupByID(t){for(let e of this.data)if(e instanceof i&&e.id===t)return e;return null}getOptionByID(t){let e=this.filter((e=>e.id===t),!1);return e.length?e[0]:null}getSelectType(){return this.selectType}getFirstOption(){let t=null;for(let e of this.data)if(e instanceof i?t=e.options[0]:e instanceof n&&(t=e),t)break;return t}search(t,e){return""===(t=t.trim())?this.getData():this.filter((s=>e(s,t)),!0)}filter(t,e){const s=[];return this.data.forEach((a=>{if(a instanceof i){let l=[];if(a.options.forEach((i=>{t&&!t(i)||(e?l.push(new n(i)):s.push(new n(i)))})),l.length>0){let t=new i(a);t.options=l,s.push(t)}}a instanceof n&&(t&&!t(a)||s.push(new n(a)))})),s}}class l{constructor(t,e,s){this.classes={main:"ss-main",placeholder:"ss-placeholder",values:"ss-values",single:"ss-single",max:"ss-max",value:"ss-value",valueText:"ss-value-text",valueDelete:"ss-value-delete",valueOut:"ss-value-out",deselect:"ss-deselect",deselectPath:"M10,10 L90,90 M10,90 L90,10",arrow:"ss-arrow",arrowClose:"M10,30 L50,70 L90,30",arrowOpen:"M10,70 L50,30 L90,70",content:"ss-content",openAbove:"ss-open-above",openBelow:"ss-open-below",search:"ss-search",searchHighlighter:"ss-search-highlight",searching:"ss-searching",addable:"ss-addable",addablePath:"M50,10 L50,90 M10,50 L90,50",list:"ss-list",optgroup:"ss-optgroup",optgroupLabel:"ss-optgroup-label",optgroupLabelText:"ss-optgroup-label-text",optgroupActions:"ss-optgroup-actions",optgroupSelectAll:"ss-selectall",optgroupSelectAllBox:"M60,10 L10,10 L10,90 L90,90 L90,50",optgroupSelectAllCheck:"M30,45 L50,70 L90,10",optgroupClosable:"ss-closable",option:"ss-option",optionDelete:"M10,10 L90,90 M10,90 L90,10",highlighted:"ss-highlighted",open:"ss-open",close:"ss-close",selected:"ss-selected",error:"ss-error",disabled:"ss-disabled",hide:"ss-hide"},this.store=e,this.settings=t,this.callbacks=s,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes(),this.settings.contentLocation.appendChild(this.content.main)}enable(){this.main.main.classList.remove(this.classes.disabled),this.content.search.input.disabled=!1}disable(){this.main.main.classList.add(this.classes.disabled),this.content.search.input.disabled=!0}open(){this.main.arrow.path.setAttribute("d",this.classes.arrowOpen),this.main.main.classList.add("up"===this.settings.openPosition?this.classes.openAbove:this.classes.openBelow),this.main.main.setAttribute("aria-expanded","true"),this.moveContent();const t=this.store.getSelectedOptions();if(t.length){const e=t[t.length-1].id,s=this.content.list.querySelector('[data-id="'+e+'"]');s&&this.ensureElementInView(this.content.list,s)}}close(){this.main.main.classList.remove(this.classes.openAbove),this.main.main.classList.remove(this.classes.openBelow),this.main.main.setAttribute("aria-expanded","false"),this.content.main.classList.remove(this.classes.openAbove),this.content.main.classList.remove(this.classes.openBelow),this.main.arrow.path.setAttribute("d",this.classes.arrowClose)}updateClassStyles(){if(this.main.main.className="",this.main.main.removeAttribute("style"),this.content.main.className="",this.content.main.removeAttribute("style"),this.main.main.classList.add(this.classes.main),this.content.main.classList.add(this.classes.content),""!==this.settings.style&&(this.main.main.style.cssText=this.settings.style,this.content.main.style.cssText=this.settings.style),this.settings.class.length)for(const t of this.settings.class)""!==t.trim()&&(this.main.main.classList.add(t.trim()),this.content.main.classList.add(t.trim()));"relative"===this.settings.contentPosition&&this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){this.main.main.role="combobox",this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.main.id),this.main.main.setAttribute("aria-expanded","false"),this.content.main.setAttribute("role","listbox")}mainDiv(){var t;const e=document.createElement("div");e.dataset.id=this.settings.id,e.setAttribute("aria-label",this.settings.ariaLabel),e.tabIndex=0,e.onkeydown=t=>{switch(t.key){case"ArrowUp":case"ArrowDown":return this.callbacks.open(),"ArrowDown"===t.key?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Enter":case" ":this.callbacks.open();const e=this.content.list.querySelector("."+this.classes.highlighted);return e&&e.click(),!1;case"Escape":return this.callbacks.close(),!1}return!1},e.onclick=t=>{this.settings.disabled||(this.settings.isOpen?this.callbacks.close():this.callbacks.open())};const s=document.createElement("div");s.classList.add(this.classes.values),e.appendChild(s);const i=document.createElement("div");i.classList.add(this.classes.deselect);const n=null===(t=this.store)||void 0===t?void 0:t.getSelectedOptions();!this.settings.allowDeselect||this.settings.isMultiple&&n&&n.length<=0?i.classList.add(this.classes.hide):i.classList.remove(this.classes.hide),i.onclick=t=>{if(t.stopPropagation(),this.settings.disabled)return;let e=!0;const s=this.store.getSelectedOptions(),i=[];if(this.callbacks.beforeChange&&(e=!0===this.callbacks.beforeChange(i,s)),e){if(this.settings.isMultiple)this.callbacks.setSelected([],!1),this.updateDeselectAll();else{const t=this.store.getFirstOption(),e=t?t.id:"";this.callbacks.setSelected(e,!1)}this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(this.store.getSelectedOptions())}};const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100");const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.deselectPath),a.appendChild(l),i.appendChild(a),e.appendChild(i);const o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.classList.add(this.classes.arrow),o.setAttribute("viewBox","0 0 100 100");const c=document.createElementNS("http://www.w3.org/2000/svg","path");return c.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&o.classList.add(this.classes.hide),o.appendChild(c),e.appendChild(o),{main:e,values:s,deselect:{main:i,svg:a,path:l},arrow:{main:o,path:c}}}mainFocus(t){"click"!==t&&this.main.main.focus({preventScroll:!0})}placeholder(){const t=this.store.filter((t=>t.placeholder),!1);let e=this.settings.placeholderText;t.length&&(""!==t[0].html?e=t[0].html:""!==t[0].text&&(e=t[0].text));const s=document.createElement("div");return s.classList.add(this.classes.placeholder),s.innerHTML=e,s}renderValues(){this.settings.isMultiple?(this.renderMultipleValues(),this.updateDeselectAll()):this.renderSingleValue()}renderSingleValue(){const t=this.store.filter((t=>t.selected&&!t.placeholder),!1),e=t.length>0?t[0]:null;if(e){const t=document.createElement("div");t.classList.add(this.classes.single),e.html?t.innerHTML=e.html:t.innerText=e.text,this.main.values.innerHTML=t.outerHTML}else this.main.values.innerHTML=this.placeholder().outerHTML;this.settings.allowDeselect&&t.length?this.main.deselect.main.classList.remove(this.classes.hide):this.main.deselect.main.classList.add(this.classes.hide)}renderMultipleValues(){let t=this.main.values.childNodes,e=this.store.filter((t=>t.selected&&t.display),!1);if(0===e.length)return void(this.main.values.innerHTML=this.placeholder().outerHTML);{const t=this.main.values.querySelector("."+this.classes.placeholder);t&&t.remove()}if(e.length>this.settings.maxValuesShown){const t=document.createElement("div");return t.classList.add(this.classes.max),t.textContent=this.settings.maxValuesMessage.replace("{number}",e.length.toString()),void(this.main.values.innerHTML=t.outerHTML)}{const t=this.main.values.querySelector("."+this.classes.max);t&&t.remove()}let s=[];for(let i=0;it.id===a),!1).length||s.push(n)}}for(const t of s)t.classList.add(this.classes.valueOut),setTimeout((()=>{this.main.values.hasChildNodes()&&this.main.values.contains(t)&&this.main.values.removeChild(t)}),100);t=this.main.values.childNodes;for(let s=0;s{if(e.preventDefault(),e.stopPropagation(),this.settings.disabled)return;let s=!0;const a=this.store.getSelectedOptions(),l=a.filter((e=>e.selected&&e.id!==t.id),!0);if(!(this.settings.minSelected&&l.length{this.callbacks.search(t.target.value)}),100),s.onkeydown=t=>{switch(t.key){case"ArrowUp":case"ArrowDown":return"ArrowDown"===t.key?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Escape":return this.callbacks.close(),!1;case"Enter":case" ":if(this.callbacks.addable&&t.ctrlKey)return i.click(),!1;{const t=this.content.list.querySelector("."+this.classes.highlighted);if(t)return t.click(),!1}return!0}return!0},t.appendChild(s),this.callbacks.addable){i.classList.add(this.classes.addable);const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 100 100");const s=document.createElementNS("http://www.w3.org/2000/svg","path");s.setAttribute("d",this.classes.addablePath),e.appendChild(s),i.appendChild(e),i.onclick=t=>{if(t.preventDefault(),t.stopPropagation(),!this.callbacks.addable)return;const e=this.content.search.input.value.trim();if(""===e)return void this.content.search.input.focus();const s=t=>{let e=new n(t);if(this.callbacks.addOption(e),this.settings.isMultiple){let t=this.store.getSelected();t.push(e.id),this.callbacks.setSelected(t,!0)}else this.callbacks.setSelected([e.id],!0);this.callbacks.search(""),this.settings.closeOnSelect&&setTimeout((()=>{this.callbacks.close()}),100)},i=this.callbacks.addable(e);!1!==i&&null!=i&&(i instanceof Promise?i.then((t=>{s("string"==typeof t?{text:t,value:t}:t)})):s("string"==typeof i?{text:i,value:i}:i))},t.appendChild(i),a.addable={main:i,svg:e,path:s}}return a}searchFocus(){this.content.search.input.focus()}getOptions(t=!1,e=!1,s=!1){let i="."+this.classes.option;return t&&(i+=":not(."+this.classes.placeholder+")"),e&&(i+=":not(."+this.classes.disabled+")"),s&&(i+=":not(."+this.classes.hide+")"),Array.from(this.content.list.querySelectorAll(i))}highlight(t){const e=this.getOptions(!0,!0,!0);if(0===e.length)return;if(1===e.length&&!e[0].classList.contains(this.classes.highlighted))return void e[0].classList.add(this.classes.highlighted);let s=!1;for(const t of e)t.classList.contains(this.classes.highlighted)&&(s=!0);if(!s)for(const t of e)if(t.classList.contains(this.classes.selected)){t.classList.add(this.classes.highlighted);break}for(let s=0;s=0?s-1:e.length-1];a.classList.add(this.classes.highlighted),this.ensureElementInView(this.content.list,a);const l=a.parentElement;if(l&&l.classList.contains(this.classes.close)){const t=l.querySelector("."+this.classes.optgroupLabel);t&&t.click()}return}e["down"===t?0:e.length-1].classList.add(this.classes.highlighted),this.ensureElementInView(this.content.list,e["down"===t?0:e.length-1])}listDiv(){const t=document.createElement("div");return t.classList.add(this.classes.list),t}renderError(t){this.content.list.innerHTML="";const e=document.createElement("div");e.classList.add(this.classes.error),e.textContent=t,this.content.list.appendChild(e)}renderSearching(){this.content.list.innerHTML="";const t=document.createElement("div");t.classList.add(this.classes.searching),t.textContent=this.settings.searchingText,this.content.list.appendChild(t)}renderOptions(t){if(this.content.list.innerHTML="",0===t.length){const t=document.createElement("div");return t.classList.add(this.classes.search),t.innerHTML=this.settings.searchText,void this.content.list.appendChild(t)}for(const e of t){if(e instanceof i){const t=document.createElement("div");t.classList.add(this.classes.optgroup);const s=document.createElement("div");s.classList.add(this.classes.optgroupLabel),t.appendChild(s);const i=document.createElement("div");i.classList.add(this.classes.optgroupLabelText),i.textContent=e.label,s.appendChild(i);const n=document.createElement("div");if(n.classList.add(this.classes.optgroupActions),s.appendChild(n),this.settings.isMultiple&&e.selectAll){const t=document.createElement("div");t.classList.add(this.classes.optgroupSelectAll);let s=!0;for(const t of e.options)if(!t.selected){s=!1;break}s&&t.classList.add(this.classes.selected);const i=document.createElement("span");i.textContent=e.selectAllText,t.appendChild(i);const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100"),t.appendChild(a);const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.optgroupSelectAllBox),a.appendChild(l);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.optgroupSelectAllCheck),a.appendChild(o),t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const i=this.store.getSelected();if(s){const t=i.filter((t=>{for(const s of e.options)if(t===s.id)return!1;return!0}));this.callbacks.setSelected(t,!0)}else{const t=i.concat(e.options.map((t=>t.id)));for(const t of e.options)this.store.getOptionByID(t.id)||this.callbacks.addOption(t);this.callbacks.setSelected(t,!0)}})),n.appendChild(t)}if("off"!==e.closable){const i=document.createElement("div");i.classList.add(this.classes.optgroupClosable);const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100"),a.classList.add(this.classes.arrow),i.appendChild(a);const l=document.createElementNS("http://www.w3.org/2000/svg","path");a.appendChild(l),e.options.some((t=>t.selected))||""!==this.content.search.input.value.trim()?(i.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"open"===e.closable?(t.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"close"===e.closable&&(t.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose)),s.addEventListener("click",(e=>{e.preventDefault(),e.stopPropagation(),t.classList.contains(this.classes.close)?(t.classList.remove(this.classes.close),t.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):(t.classList.remove(this.classes.open),t.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose))})),n.appendChild(i)}t.appendChild(s);for(const s of e.options)t.appendChild(this.option(s));this.content.list.appendChild(t)}e instanceof n&&this.content.list.appendChild(this.option(e))}}option(t){if(t.placeholder){const t=document.createElement("div");return t.classList.add(this.classes.option),t.classList.add(this.classes.hide),t}const e=document.createElement("div");return e.dataset.id=t.id,e.id=t.id,e.classList.add(this.classes.option),e.setAttribute("role","option"),t.class&&t.class.split(" ").forEach((t=>{e.classList.add(t)})),t.style&&(e.style.cssText=t.style),this.settings.searchHighlight&&""!==this.content.search.input.value.trim()?e.innerHTML=this.highlightText(""!==t.html?t.html:t.text,this.content.search.input.value,this.classes.searchHighlighter):""!==t.html?e.innerHTML=t.html:e.textContent=t.text,this.settings.showOptionTooltips&&e.textContent&&e.setAttribute("title",e.textContent),t.display||e.classList.add(this.classes.hide),t.disabled&&e.classList.add(this.classes.disabled),t.selected&&this.settings.hideSelected&&e.classList.add(this.classes.hide),t.selected?(e.classList.add(this.classes.selected),e.setAttribute("aria-selected","true"),this.main.main.setAttribute("aria-activedescendant",e.id)):(e.classList.remove(this.classes.selected),e.setAttribute("aria-selected","false")),e.addEventListener("click",(e=>{e.preventDefault(),e.stopPropagation();const s=this.store.getSelected(),i=e.currentTarget,n=String(i.dataset.id);if(t.disabled||t.selected&&!this.settings.allowDeselect)return;if(this.settings.isMultiple&&this.settings.maxSelected<=s.length&&!t.selected||this.settings.isMultiple&&this.settings.minSelected>=s.length&&t.selected)return;let a=!1;const l=this.store.getSelectedOptions();let o=[];this.settings.isMultiple&&(o=t.selected?l.filter((t=>t.id!==n)):l.concat(t)),this.settings.isMultiple||(o=t.selected?[]:[t]),this.callbacks.beforeChange||(a=!0),this.callbacks.beforeChange&&(a=!1!==this.callbacks.beforeChange(o,l)),a&&(this.store.getOptionByID(n)||this.callbacks.addOption(t),this.callbacks.setSelected(o.map((t=>t.id)),!1),this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(o))})),e}destroy(){this.main.main.remove(),this.content.main.remove()}highlightText(t,e,s){let i=t;const n=new RegExp("("+e.trim()+")(?![^<]*>[^<>]*${o}`),i}moveContentAbove(){const t=this.main.main.offsetHeight,e=this.content.main.offsetHeight;this.main.main.classList.remove(this.classes.openBelow),this.main.main.classList.add(this.classes.openAbove),this.content.main.classList.remove(this.classes.openBelow),this.content.main.classList.add(this.classes.openAbove);const s=this.main.main.getBoundingClientRect();this.content.main.style.margin="-"+(t+e-1)+"px 0px 0px 0px",this.content.main.style.top=s.top+s.height+window.scrollY+"px",this.content.main.style.left=s.left+window.scrollX+"px",this.content.main.style.width=s.width+"px"}moveContentBelow(){this.main.main.classList.remove(this.classes.openAbove),this.main.main.classList.add(this.classes.openBelow),this.content.main.classList.remove(this.classes.openAbove),this.content.main.classList.add(this.classes.openBelow);const t=this.main.main.getBoundingClientRect();this.content.main.style.margin="-1px 0px 0px 0px","relative"!==this.settings.contentPosition&&(this.content.main.style.top=t.top+t.height+window.scrollY+"px",this.content.main.style.left=t.left+window.scrollX+"px",this.content.main.style.width=t.width+"px")}ensureElementInView(t,e){const s=t.scrollTop+t.offsetTop,i=s+t.clientHeight,n=e.offsetTop,a=n+e.clientHeight;ni&&(t.scrollTop+=a-i)}putContent(){const t=this.main.main.offsetHeight,e=this.main.main.getBoundingClientRect(),s=this.content.main.offsetHeight;return window.innerHeight-(e.top+t)<=s&&e.top>s?"up":"down"}updateDeselectAll(){if(!this.store||!this.settings)return;const t=this.store.getSelectedOptions(),e=t&&t.length>0,s=this.settings.isMultiple,i=this.settings.allowDeselect,n=this.main.deselect.main,a=this.classes.hide;!i||s&&!e?n.classList.add(a):n.classList.remove(a)}}class o{constructor(t){this.listen=!1,this.observer=null,this.select=t,this.valueChange=this.valueChange.bind(this),this.select.addEventListener("change",this.valueChange,{passive:!0}),this.observer=new MutationObserver(this.observeCall.bind(this)),this.changeListen(!0)}enable(){this.select.disabled=!1}disable(){this.select.disabled=!0}hideUI(){this.select.tabIndex=-1,this.select.style.display="none",this.select.setAttribute("aria-hidden","true")}showUI(){this.select.removeAttribute("tabindex"),this.select.style.display="",this.select.removeAttribute("aria-hidden")}changeListen(t){this.listen=t,t&&this.observer&&this.observer.observe(this.select,{subtree:!0,childList:!0,attributes:!0}),t||this.observer&&this.observer.disconnect()}valueChange(t){return this.listen&&this.onValueChange&&this.onValueChange(this.getSelectedOptions()),!0}observeCall(t){if(!this.listen)return;let e=!1,s=!1,i=!1;for(const n of t)n.target===this.select&&("disabled"===n.attributeName&&(s=!0),"class"===n.attributeName&&(e=!0)),"OPTGROUP"!==n.target.nodeName&&"OPTION"!==n.target.nodeName||(i=!0);e&&this.onClassChange&&this.onClassChange(this.select.className.split(" ")),s&&this.onDisabledChange&&(this.changeListen(!1),this.onDisabledChange(this.select.disabled),this.changeListen(!0)),i&&this.onOptionsChange&&(this.changeListen(!1),this.onOptionsChange(this.getData()),this.changeListen(!0))}getData(){let t=[];const e=this.select.childNodes;for(const s of e)"OPTGROUP"===s.nodeName&&t.push(this.getDataFromOptgroup(s)),"OPTION"===s.nodeName&&t.push(this.getDataFromOption(s));return t}getDataFromOptgroup(t){let e={id:t.id,label:t.label,selectAll:!!t.dataset&&"true"===t.dataset.selectall,selectAllText:t.dataset?t.dataset.selectalltext:"Select all",closable:t.dataset?t.dataset.closable:"off",options:[]};const s=t.childNodes;for(const t of s)"OPTION"===t.nodeName&&e.options.push(this.getDataFromOption(t));return e}getDataFromOption(t){return{id:t.id,value:t.value,text:t.text,html:t.dataset&&t.dataset.html?t.dataset.html:"",selected:t.selected,display:"none"!==t.style.display,disabled:t.disabled,mandatory:!!t.dataset&&"true"===t.dataset.mandatory,placeholder:"true"===t.dataset.placeholder,class:t.className,style:t.style.cssText,data:t.dataset}}getSelectedOptions(){let t=[];const e=this.select.childNodes;for(const s of e){if("OPTGROUP"===s.nodeName){const e=s.childNodes;for(const s of e)if("OPTION"===s.nodeName){const e=s;e.selected&&t.push(this.getDataFromOption(e))}}if("OPTION"===s.nodeName){const e=s;e.selected&&t.push(this.getDataFromOption(e))}}return t}getSelectedValues(){return this.getSelectedOptions().map((t=>t.value))}setSelected(t){this.changeListen(!1);const e=this.select.childNodes;for(const s of e){if("OPTGROUP"===s.nodeName){const e=s.childNodes;for(const s of e)if("OPTION"===s.nodeName){const e=s;e.selected=t.includes(e.id)}}if("OPTION"===s.nodeName){const e=s;e.selected=t.includes(e.id)}}this.changeListen(!0)}updateSelect(t,e,s){this.changeListen(!1),t&&(this.select.dataset.id=t),e&&(this.select.style.cssText=e),s&&(this.select.className="",s.forEach((t=>{""!==t.trim()&&this.select.classList.add(t.trim())}))),this.changeListen(!0)}updateOptions(t){this.changeListen(!1),this.select.innerHTML="";for(const e of t)e instanceof i&&this.select.appendChild(this.createOptgroup(e)),e instanceof n&&this.select.appendChild(this.createOption(e));this.select.dispatchEvent(new Event("change")),this.changeListen(!0)}createOptgroup(t){const e=document.createElement("optgroup");if(e.id=t.id,e.label=t.label,t.selectAll&&(e.dataset.selectAll="true"),"off"!==t.closable&&(e.dataset.closable=t.closable),t.options)for(const s of t.options)e.appendChild(this.createOption(s));return e}createOption(t){const e=document.createElement("option");return e.id=t.id,e.value=t.value,e.innerHTML=t.text,""!==t.html&&e.setAttribute("data-html",t.html),t.selected&&(e.selected=t.selected),t.disabled&&(e.disabled=!0),!1===t.display&&(e.style.display="none"),t.placeholder&&e.setAttribute("data-placeholder","true"),t.mandatory&&e.setAttribute("data-mandatory","true"),t.class&&t.class.split(" ").forEach((t=>{e.classList.add(t)})),t.data&&"object"==typeof t.data&&Object.keys(t.data).forEach((s=>{e.setAttribute("data-"+function(t){const e=t.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,(t=>"-"+t.toLowerCase()));return t[0]===t[0].toUpperCase()?e.substring(1):e}(s),t.data[s])})),e}destroy(){this.changeListen(!1),this.select.removeEventListener("change",this.valueChange),this.observer&&(this.observer.disconnect(),this.observer=null),delete this.select.dataset.id,this.showUI()}}class c{constructor(e){this.id="",this.style="",this.class=[],this.isMultiple=!1,this.isOpen=!1,this.isFullOpen=!1,this.intervalMove=null,e||(e={}),this.id="ss-"+t(),this.style=e.style||"",this.class=e.class||[],this.disabled=void 0!==e.disabled&&e.disabled,this.alwaysOpen=void 0!==e.alwaysOpen&&e.alwaysOpen,this.showSearch=void 0===e.showSearch||e.showSearch,this.ariaLabel=e.ariaLabel||"Combobox",this.searchPlaceholder=e.searchPlaceholder||"Search",this.searchText=e.searchText||"No Results",this.searchingText=e.searchingText||"Searching...",this.searchHighlight=void 0!==e.searchHighlight&&e.searchHighlight,this.closeOnSelect=void 0===e.closeOnSelect||e.closeOnSelect,this.contentLocation=e.contentLocation||document.body,this.contentPosition=e.contentPosition||"absolute",this.openPosition=e.openPosition||"auto",this.placeholderText=void 0!==e.placeholderText?e.placeholderText:"Select Value",this.allowDeselect=void 0!==e.allowDeselect&&e.allowDeselect,this.hideSelected=void 0!==e.hideSelected&&e.hideSelected,this.keepOrder=void 0!==e.keepOrder&&e.keepOrder,this.showOptionTooltips=void 0!==e.showOptionTooltips&&e.showOptionTooltips,this.minSelected=e.minSelected||0,this.maxSelected=e.maxSelected||1e3,this.timeoutDelay=e.timeoutDelay||200,this.maxValuesShown=e.maxValuesShown||20,this.maxValuesMessage=e.maxValuesMessage||"{number} selected"}}return class{constructor(t){var s;if(this.events={search:void 0,searchFilter:(t,e)=>-1!==t.text.toLowerCase().indexOf(e.toLowerCase()),addable:void 0,beforeChange:void 0,afterChange:void 0,beforeOpen:void 0,afterOpen:void 0,beforeClose:void 0,afterClose:void 0},this.windowResize=e((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.windowScroll=e((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.documentClick=t=>{this.settings.isOpen&&t.target&&!function(t,e){function s(t,s){return s&&t&&t.classList&&t.classList.contains(s)||s&&t&&t.dataset&&t.dataset.id&&t.dataset.id===e?t:null}return s(t,e)||function t(e,i){return e&&e!==document?s(e,i)?e:t(e.parentNode,i):null}(t,e)}(t.target,this.settings.id)&&this.close(t.type)},this.windowVisibilityChange=()=>{document.hidden&&this.close()},this.selectEl="string"==typeof t.select?document.querySelector(t.select):t.select,!this.selectEl)return void(t.events&&t.events.error&&t.events.error(new Error("Could not find select element")));if("SELECT"!==this.selectEl.tagName)return void(t.events&&t.events.error&&t.events.error(new Error("Element isnt of type select")));this.selectEl.dataset.ssid&&this.destroy(),this.settings=new c(t.settings);const i=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const s in t.events)t.events.hasOwnProperty(s)&&(-1!==i.indexOf(s)?this.events[s]=e(t.events[s],100):this.events[s]=t.events[s]);this.settings.disabled=(null===(s=t.settings)||void 0===s?void 0:s.disabled)?t.settings.disabled:this.selectEl.disabled,this.settings.isMultiple=this.selectEl.multiple,this.settings.style=this.selectEl.style.cssText,this.settings.class=this.selectEl.className.split(" "),this.select=new o(this.selectEl),this.select.updateSelect(this.settings.id,this.settings.style,this.settings.class),this.select.hideUI(),this.select.onValueChange=t=>{this.setSelected(t.map((t=>t.id)))},this.select.onClassChange=t=>{this.settings.class=t,this.render.updateClassStyles()},this.select.onDisabledChange=t=>{t?this.disable():this.enable()},this.select.onOptionsChange=t=>{this.setData(t)},this.store=new a(this.settings.isMultiple?"multiple":"single",t.data?t.data:this.select.getData()),t.data&&this.select.updateOptions(this.store.getData());const n={open:this.open.bind(this),close:this.close.bind(this),addable:this.events.addable?this.events.addable:void 0,setSelected:this.setSelected.bind(this),addOption:this.addOption.bind(this),search:this.search.bind(this),beforeChange:this.events.beforeChange,afterChange:this.events.afterChange};this.render=new l(this.settings,this.store,n),this.render.renderValues(),this.render.renderOptions(this.store.getData());const h=this.selectEl.getAttribute("aria-label"),r=this.selectEl.getAttribute("aria-labelledby");h?this.render.main.main.setAttribute("aria-label",h):r&&this.render.main.main.setAttribute("aria-labelledby",r),this.selectEl.parentNode&&this.selectEl.parentNode.insertBefore(this.render.main.main,this.selectEl.nextSibling),window.addEventListener("resize",this.windowResize,!1),"auto"===this.settings.openPosition&&window.addEventListener("scroll",this.windowScroll,!1),document.addEventListener("visibilitychange",this.windowVisibilityChange),this.settings.disabled&&this.disable(),this.settings.alwaysOpen&&this.open(),this.selectEl.slim=this}enable(){this.settings.disabled=!1,this.select.enable(),this.render.enable()}disable(){this.settings.disabled=!0,this.select.disable(),this.render.disable()}getData(){return this.store.getData()}setData(t){const e=this.store.getSelected(),i=this.store.validateDataArray(t);if(i)return void(this.events.error&&this.events.error(i));this.store.setData(t);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!s(e,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){return this.store.getSelectedOptions().map((t=>t.value))}setSelected(t,e=!0){const i=this.store.getSelected(),n=this.store.getDataOptions();t=Array.isArray(t)?t:[t];const a=[];for(const e of t)if(n.find((t=>t.id==e)))a.push(e);else for(const t of n.filter((t=>t.value==e)))a.push(t.id);this.store.setSelectedBy("id",a);const l=this.store.getData();this.select.updateOptions(l),this.render.renderValues(),""!==this.render.content.search.input.value?this.search(this.render.content.search.input.value):this.render.renderOptions(l),e&&this.events.afterChange&&!s(i,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}addOption(t){const e=this.store.getSelected();this.store.getDataOptions().some((e=>{var s;return e.value===(null!==(s=t.value)&&void 0!==s?s:t.text)}))||this.store.addOption(t);const i=this.store.getData();this.select.updateOptions(i),this.render.renderValues(),this.render.renderOptions(i),this.events.afterChange&&!s(e,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}open(){this.settings.disabled||this.settings.isOpen||(this.events.beforeOpen&&this.events.beforeOpen(),this.render.open(),this.settings.showSearch&&this.render.searchFocus(),this.settings.isOpen=!0,setTimeout((()=>{this.events.afterOpen&&this.events.afterOpen(),this.settings.isOpen&&(this.settings.isFullOpen=!0),document.addEventListener("click",this.documentClick)}),this.settings.timeoutDelay),"absolute"===this.settings.contentPosition&&(this.settings.intervalMove&&clearInterval(this.settings.intervalMove),this.settings.intervalMove=setInterval(this.render.moveContent.bind(this.render),500)))}close(t=null){this.settings.isOpen&&!this.settings.alwaysOpen&&(this.events.beforeClose&&this.events.beforeClose(),this.render.close(),""!==this.render.content.search.input.value&&this.search(""),this.render.mainFocus(t),this.settings.isOpen=!1,this.settings.isFullOpen=!1,setTimeout((()=>{this.events.afterClose&&this.events.afterClose(),document.removeEventListener("click",this.documentClick)}),this.settings.timeoutDelay),this.settings.intervalMove&&clearInterval(this.settings.intervalMove))}search(t){if(this.render.content.search.input.value!==t&&(this.render.content.search.input.value=t),!this.events.search)return void this.render.renderOptions(""===t?this.store.getData():this.store.search(t,this.events.searchFilter));this.render.renderSearching();const e=this.events.search(t,this.store.getSelectedOptions());e instanceof Promise?e.then((t=>{this.render.renderOptions(this.store.partialToFullData(t))})).catch((t=>{this.render.renderError("string"==typeof t?t:t.message)})):Array.isArray(e)?this.render.renderOptions(this.store.partialToFullData(e)):this.render.renderError("Search event must return a promise or an array of data")}destroy(){document.removeEventListener("click",this.documentClick),window.removeEventListener("resize",this.windowResize,!1),"auto"===this.settings.openPosition&&window.removeEventListener("scroll",this.windowScroll,!1),document.removeEventListener("visibilitychange",this.windowVisibilityChange),this.store.setData([]),this.render.destroy(),this.select.destroy()}}})); diff --git a/dist/slimselect.umd.js b/dist/slimselect.umd.js index 0e8ad964..1f31de2e 100644 --- a/dist/slimselect.umd.js +++ b/dist/slimselect.umd.js @@ -189,7 +189,7 @@ } } getSelected() { - return this.getSelectedOptions().map(option => option.id); + return this.getSelectedOptions().map((option) => option.id); } getSelectedOptions() { return this.filter((opt) => { @@ -1403,7 +1403,7 @@ return options; } getSelectedValues() { - return this.getSelectedOptions().map(option => option.value); + return this.getSelectedOptions().map((option) => option.value); } setSelected(ids) { this.changeListen(false); @@ -1640,7 +1640,7 @@ this.select.updateSelect(this.settings.id, this.settings.style, this.settings.class); this.select.hideUI(); this.select.onValueChange = (options) => { - this.setSelected(options.map(option => option.id)); + this.setSelected(options.map((option) => option.id)); }; this.select.onClassChange = (classes) => { this.settings.class = classes; @@ -1730,11 +1730,23 @@ } } getSelected() { - return this.store.getSelected(); + return this.store.getSelectedOptions().map((option) => option.value); } - setSelected(id, runAfterChange = true) { + setSelected(values, runAfterChange = true) { const selected = this.store.getSelected(); - this.store.setSelectedBy('id', Array.isArray(id) ? id : [id]); + const options = this.store.getDataOptions(); + values = Array.isArray(values) ? values : [values]; + const ids = []; + for (const value of values) { + if (options.find((option) => option.id == value)) { + ids.push(value); + continue; + } + for (const option of options.filter((option) => option.value == value)) { + ids.push(option.id); + } + } + this.store.setSelectedBy('id', ids); const data = this.store.getData(); this.select.updateOptions(data); this.render.renderValues(); diff --git a/dist/slimselect.umd.min.js b/dist/slimselect.umd.min.js index 8fde4b4e..b8ae4226 100644 --- a/dist/slimselect.umd.min.js +++ b/dist/slimselect.umd.min.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).SlimSelect=e()}(this,(function(){"use strict";function t(){return Math.random().toString(36).substring(2,10)}function e(t,e=50,s=!1){let i;return function(...n){const a=self,l=s&&!i;clearTimeout(i),i=setTimeout((()=>{i=null,s||t.apply(a,n)}),e),l&&t.apply(a,n)}}function s(t,e){return JSON.stringify(t)===JSON.stringify(e)}class i{constructor(e){if(this.id=e.id&&""!==e.id?e.id:t(),this.label=e.label||"",this.selectAll=void 0!==e.selectAll&&e.selectAll,this.selectAllText=e.selectAllText||"Select All",this.closable=e.closable||"off",this.options=[],e.options)for(const t of e.options)this.options.push(new n(t))}}class n{constructor(e){this.id=e.id&&""!==e.id?e.id:t(),this.value=void 0===e.value?e.text:e.value,this.text=e.text||"",this.html=e.html||"",this.selected=void 0!==e.selected&&e.selected,this.display=void 0===e.display||e.display,this.disabled=void 0!==e.disabled&&e.disabled,this.mandatory=void 0!==e.mandatory&&e.mandatory,this.placeholder=void 0!==e.placeholder&&e.placeholder,this.class=e.class||"",this.style=e.style||"",this.data=e.data||{}}}class a{constructor(t,e){this.selectType="single",this.data=[],this.selectType=t,this.setData(e)}validateDataArray(t){if(!Array.isArray(t))return new Error("Data must be an array");for(let e of t){if(!(e instanceof i||"label"in e))return e instanceof n||"text"in e?this.validateOption(e):new Error("Data object must be a valid optgroup or option");if(!("label"in e))return new Error("Optgroup must have a label");if("options"in e&&e.options)for(let t of e.options)return this.validateOption(t)}return null}validateOption(t){return"text"in t?null:new Error("Option must have a text")}partialToFullData(t){let e=[];return t.forEach((t=>{if(t instanceof i||"label"in t){let s=[];"options"in t&&t.options&&t.options.forEach((t=>{s.push(new n(t))})),s.length>0&&e.push(new i(t))}(t instanceof n||"text"in t)&&e.push(new n(t))})),e}setData(t){this.data=this.partialToFullData(t),"single"===this.selectType&&this.setSelectedBy("id",this.getSelected())}getData(){return this.filter(null,!0)}getDataOptions(){return this.filter(null,!1)}addOption(t){this.setData(this.getData().concat(new n(t)))}setSelectedBy(t,e){let s=null,a=!1;for(let l of this.data){if(l instanceof i)for(let i of l.options)s||(s=i),i.selected=!a&&e.includes(i[t]),i.selected&&"single"===this.selectType&&(a=!0);l instanceof n&&(s||(s=l),l.selected=!a&&e.includes(l[t]),l.selected&&"single"===this.selectType&&(a=!0))}"single"===this.selectType&&s&&!a&&(s.selected=!0)}getSelected(){return this.getSelectedOptions().map((t=>t.id))}getSelectedOptions(){return this.filter((t=>t.selected),!1)}getOptgroupByID(t){for(let e of this.data)if(e instanceof i&&e.id===t)return e;return null}getOptionByID(t){let e=this.filter((e=>e.id===t),!1);return e.length?e[0]:null}getSelectType(){return this.selectType}getFirstOption(){let t=null;for(let e of this.data)if(e instanceof i?t=e.options[0]:e instanceof n&&(t=e),t)break;return t}search(t,e){return""===(t=t.trim())?this.getData():this.filter((s=>e(s,t)),!0)}filter(t,e){const s=[];return this.data.forEach((a=>{if(a instanceof i){let l=[];if(a.options.forEach((i=>{t&&!t(i)||(e?l.push(new n(i)):s.push(new n(i)))})),l.length>0){let t=new i(a);t.options=l,s.push(t)}}a instanceof n&&(t&&!t(a)||s.push(new n(a)))})),s}}class l{constructor(t,e,s){this.classes={main:"ss-main",placeholder:"ss-placeholder",values:"ss-values",single:"ss-single",max:"ss-max",value:"ss-value",valueText:"ss-value-text",valueDelete:"ss-value-delete",valueOut:"ss-value-out",deselect:"ss-deselect",deselectPath:"M10,10 L90,90 M10,90 L90,10",arrow:"ss-arrow",arrowClose:"M10,30 L50,70 L90,30",arrowOpen:"M10,70 L50,30 L90,70",content:"ss-content",openAbove:"ss-open-above",openBelow:"ss-open-below",search:"ss-search",searchHighlighter:"ss-search-highlight",searching:"ss-searching",addable:"ss-addable",addablePath:"M50,10 L50,90 M10,50 L90,50",list:"ss-list",optgroup:"ss-optgroup",optgroupLabel:"ss-optgroup-label",optgroupLabelText:"ss-optgroup-label-text",optgroupActions:"ss-optgroup-actions",optgroupSelectAll:"ss-selectall",optgroupSelectAllBox:"M60,10 L10,10 L10,90 L90,90 L90,50",optgroupSelectAllCheck:"M30,45 L50,70 L90,10",optgroupClosable:"ss-closable",option:"ss-option",optionDelete:"M10,10 L90,90 M10,90 L90,10",highlighted:"ss-highlighted",open:"ss-open",close:"ss-close",selected:"ss-selected",error:"ss-error",disabled:"ss-disabled",hide:"ss-hide"},this.store=e,this.settings=t,this.callbacks=s,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes(),this.settings.contentLocation.appendChild(this.content.main)}enable(){this.main.main.classList.remove(this.classes.disabled),this.content.search.input.disabled=!1}disable(){this.main.main.classList.add(this.classes.disabled),this.content.search.input.disabled=!0}open(){this.main.arrow.path.setAttribute("d",this.classes.arrowOpen),this.main.main.classList.add("up"===this.settings.openPosition?this.classes.openAbove:this.classes.openBelow),this.main.main.setAttribute("aria-expanded","true"),this.moveContent();const t=this.store.getSelectedOptions();if(t.length){const e=t[t.length-1].id,s=this.content.list.querySelector('[data-id="'+e+'"]');s&&this.ensureElementInView(this.content.list,s)}}close(){this.main.main.classList.remove(this.classes.openAbove),this.main.main.classList.remove(this.classes.openBelow),this.main.main.setAttribute("aria-expanded","false"),this.content.main.classList.remove(this.classes.openAbove),this.content.main.classList.remove(this.classes.openBelow),this.main.arrow.path.setAttribute("d",this.classes.arrowClose)}updateClassStyles(){if(this.main.main.className="",this.main.main.removeAttribute("style"),this.content.main.className="",this.content.main.removeAttribute("style"),this.main.main.classList.add(this.classes.main),this.content.main.classList.add(this.classes.content),""!==this.settings.style&&(this.main.main.style.cssText=this.settings.style,this.content.main.style.cssText=this.settings.style),this.settings.class.length)for(const t of this.settings.class)""!==t.trim()&&(this.main.main.classList.add(t.trim()),this.content.main.classList.add(t.trim()));"relative"===this.settings.contentPosition&&this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){this.main.main.role="combobox",this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.main.id),this.main.main.setAttribute("aria-expanded","false"),this.content.main.setAttribute("role","listbox")}mainDiv(){var t;const e=document.createElement("div");e.dataset.id=this.settings.id,e.setAttribute("aria-label",this.settings.ariaLabel),e.tabIndex=0,e.onkeydown=t=>{switch(t.key){case"ArrowUp":case"ArrowDown":return this.callbacks.open(),"ArrowDown"===t.key?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Enter":case" ":this.callbacks.open();const e=this.content.list.querySelector("."+this.classes.highlighted);return e&&e.click(),!1;case"Escape":return this.callbacks.close(),!1}return!1},e.onclick=t=>{this.settings.disabled||(this.settings.isOpen?this.callbacks.close():this.callbacks.open())};const s=document.createElement("div");s.classList.add(this.classes.values),e.appendChild(s);const i=document.createElement("div");i.classList.add(this.classes.deselect);const n=null===(t=this.store)||void 0===t?void 0:t.getSelectedOptions();!this.settings.allowDeselect||this.settings.isMultiple&&n&&n.length<=0?i.classList.add(this.classes.hide):i.classList.remove(this.classes.hide),i.onclick=t=>{if(t.stopPropagation(),this.settings.disabled)return;let e=!0;const s=this.store.getSelectedOptions(),i=[];if(this.callbacks.beforeChange&&(e=!0===this.callbacks.beforeChange(i,s)),e){if(this.settings.isMultiple)this.callbacks.setSelected([],!1),this.updateDeselectAll();else{const t=this.store.getFirstOption(),e=t?t.id:"";this.callbacks.setSelected(e,!1)}this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(this.store.getSelectedOptions())}};const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100");const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.deselectPath),a.appendChild(l),i.appendChild(a),e.appendChild(i);const o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.classList.add(this.classes.arrow),o.setAttribute("viewBox","0 0 100 100");const c=document.createElementNS("http://www.w3.org/2000/svg","path");return c.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&o.classList.add(this.classes.hide),o.appendChild(c),e.appendChild(o),{main:e,values:s,deselect:{main:i,svg:a,path:l},arrow:{main:o,path:c}}}mainFocus(t){"click"!==t&&this.main.main.focus({preventScroll:!0})}placeholder(){const t=this.store.filter((t=>t.placeholder),!1);let e=this.settings.placeholderText;t.length&&(""!==t[0].html?e=t[0].html:""!==t[0].text&&(e=t[0].text));const s=document.createElement("div");return s.classList.add(this.classes.placeholder),s.innerHTML=e,s}renderValues(){this.settings.isMultiple?(this.renderMultipleValues(),this.updateDeselectAll()):this.renderSingleValue()}renderSingleValue(){const t=this.store.filter((t=>t.selected&&!t.placeholder),!1),e=t.length>0?t[0]:null;if(e){const t=document.createElement("div");t.classList.add(this.classes.single),e.html?t.innerHTML=e.html:t.innerText=e.text,this.main.values.innerHTML=t.outerHTML}else this.main.values.innerHTML=this.placeholder().outerHTML;this.settings.allowDeselect&&t.length?this.main.deselect.main.classList.remove(this.classes.hide):this.main.deselect.main.classList.add(this.classes.hide)}renderMultipleValues(){let t=this.main.values.childNodes,e=this.store.filter((t=>t.selected&&t.display),!1);if(0===e.length)return void(this.main.values.innerHTML=this.placeholder().outerHTML);{const t=this.main.values.querySelector("."+this.classes.placeholder);t&&t.remove()}if(e.length>this.settings.maxValuesShown){const t=document.createElement("div");return t.classList.add(this.classes.max),t.textContent=this.settings.maxValuesMessage.replace("{number}",e.length.toString()),void(this.main.values.innerHTML=t.outerHTML)}{const t=this.main.values.querySelector("."+this.classes.max);t&&t.remove()}let s=[];for(let i=0;it.id===a),!1).length||s.push(n)}}for(const t of s)t.classList.add(this.classes.valueOut),setTimeout((()=>{this.main.values.hasChildNodes()&&this.main.values.contains(t)&&this.main.values.removeChild(t)}),100);t=this.main.values.childNodes;for(let s=0;s{if(e.preventDefault(),e.stopPropagation(),this.settings.disabled)return;let s=!0;const a=this.store.getSelectedOptions(),l=a.filter((e=>e.selected&&e.id!==t.id),!0);if(!(this.settings.minSelected&&l.length{this.callbacks.search(t.target.value)}),100),s.onkeydown=t=>{switch(t.key){case"ArrowUp":case"ArrowDown":return"ArrowDown"===t.key?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Escape":return this.callbacks.close(),!1;case"Enter":case" ":if(this.callbacks.addable&&t.ctrlKey)return i.click(),!1;{const t=this.content.list.querySelector("."+this.classes.highlighted);if(t)return t.click(),!1}return!0}return!0},t.appendChild(s),this.callbacks.addable){i.classList.add(this.classes.addable);const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 100 100");const s=document.createElementNS("http://www.w3.org/2000/svg","path");s.setAttribute("d",this.classes.addablePath),e.appendChild(s),i.appendChild(e),i.onclick=t=>{if(t.preventDefault(),t.stopPropagation(),!this.callbacks.addable)return;const e=this.content.search.input.value.trim();if(""===e)return void this.content.search.input.focus();const s=t=>{let e=new n(t);if(this.callbacks.addOption(e),this.settings.isMultiple){let t=this.store.getSelected();t.push(e.id),this.callbacks.setSelected(t,!0)}else this.callbacks.setSelected([e.id],!0);this.callbacks.search(""),this.settings.closeOnSelect&&setTimeout((()=>{this.callbacks.close()}),100)},i=this.callbacks.addable(e);!1!==i&&null!=i&&(i instanceof Promise?i.then((t=>{s("string"==typeof t?{text:t,value:t}:t)})):s("string"==typeof i?{text:i,value:i}:i))},t.appendChild(i),a.addable={main:i,svg:e,path:s}}return a}searchFocus(){this.content.search.input.focus()}getOptions(t=!1,e=!1,s=!1){let i="."+this.classes.option;return t&&(i+=":not(."+this.classes.placeholder+")"),e&&(i+=":not(."+this.classes.disabled+")"),s&&(i+=":not(."+this.classes.hide+")"),Array.from(this.content.list.querySelectorAll(i))}highlight(t){const e=this.getOptions(!0,!0,!0);if(0===e.length)return;if(1===e.length&&!e[0].classList.contains(this.classes.highlighted))return void e[0].classList.add(this.classes.highlighted);let s=!1;for(const t of e)t.classList.contains(this.classes.highlighted)&&(s=!0);if(!s)for(const t of e)if(t.classList.contains(this.classes.selected)){t.classList.add(this.classes.highlighted);break}for(let s=0;s=0?s-1:e.length-1];a.classList.add(this.classes.highlighted),this.ensureElementInView(this.content.list,a);const l=a.parentElement;if(l&&l.classList.contains(this.classes.close)){const t=l.querySelector("."+this.classes.optgroupLabel);t&&t.click()}return}e["down"===t?0:e.length-1].classList.add(this.classes.highlighted),this.ensureElementInView(this.content.list,e["down"===t?0:e.length-1])}listDiv(){const t=document.createElement("div");return t.classList.add(this.classes.list),t}renderError(t){this.content.list.innerHTML="";const e=document.createElement("div");e.classList.add(this.classes.error),e.textContent=t,this.content.list.appendChild(e)}renderSearching(){this.content.list.innerHTML="";const t=document.createElement("div");t.classList.add(this.classes.searching),t.textContent=this.settings.searchingText,this.content.list.appendChild(t)}renderOptions(t){if(this.content.list.innerHTML="",0===t.length){const t=document.createElement("div");return t.classList.add(this.classes.search),t.innerHTML=this.settings.searchText,void this.content.list.appendChild(t)}for(const e of t){if(e instanceof i){const t=document.createElement("div");t.classList.add(this.classes.optgroup);const s=document.createElement("div");s.classList.add(this.classes.optgroupLabel),t.appendChild(s);const i=document.createElement("div");i.classList.add(this.classes.optgroupLabelText),i.textContent=e.label,s.appendChild(i);const n=document.createElement("div");if(n.classList.add(this.classes.optgroupActions),s.appendChild(n),this.settings.isMultiple&&e.selectAll){const t=document.createElement("div");t.classList.add(this.classes.optgroupSelectAll);let s=!0;for(const t of e.options)if(!t.selected){s=!1;break}s&&t.classList.add(this.classes.selected);const i=document.createElement("span");i.textContent=e.selectAllText,t.appendChild(i);const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100"),t.appendChild(a);const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.optgroupSelectAllBox),a.appendChild(l);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.optgroupSelectAllCheck),a.appendChild(o),t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const i=this.store.getSelected();if(s){const t=i.filter((t=>{for(const s of e.options)if(t===s.id)return!1;return!0}));this.callbacks.setSelected(t,!0)}else{const t=i.concat(e.options.map((t=>t.id)));for(const t of e.options)this.store.getOptionByID(t.id)||this.callbacks.addOption(t);this.callbacks.setSelected(t,!0)}})),n.appendChild(t)}if("off"!==e.closable){const i=document.createElement("div");i.classList.add(this.classes.optgroupClosable);const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100"),a.classList.add(this.classes.arrow),i.appendChild(a);const l=document.createElementNS("http://www.w3.org/2000/svg","path");a.appendChild(l),e.options.some((t=>t.selected))||""!==this.content.search.input.value.trim()?(i.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"open"===e.closable?(t.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"close"===e.closable&&(t.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose)),s.addEventListener("click",(e=>{e.preventDefault(),e.stopPropagation(),t.classList.contains(this.classes.close)?(t.classList.remove(this.classes.close),t.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):(t.classList.remove(this.classes.open),t.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose))})),n.appendChild(i)}t.appendChild(s);for(const s of e.options)t.appendChild(this.option(s));this.content.list.appendChild(t)}e instanceof n&&this.content.list.appendChild(this.option(e))}}option(t){if(t.placeholder){const t=document.createElement("div");return t.classList.add(this.classes.option),t.classList.add(this.classes.hide),t}const e=document.createElement("div");return e.dataset.id=t.id,e.id=t.id,e.classList.add(this.classes.option),e.setAttribute("role","option"),t.class&&t.class.split(" ").forEach((t=>{e.classList.add(t)})),t.style&&(e.style.cssText=t.style),this.settings.searchHighlight&&""!==this.content.search.input.value.trim()?e.innerHTML=this.highlightText(""!==t.html?t.html:t.text,this.content.search.input.value,this.classes.searchHighlighter):""!==t.html?e.innerHTML=t.html:e.textContent=t.text,this.settings.showOptionTooltips&&e.textContent&&e.setAttribute("title",e.textContent),t.display||e.classList.add(this.classes.hide),t.disabled&&e.classList.add(this.classes.disabled),t.selected&&this.settings.hideSelected&&e.classList.add(this.classes.hide),t.selected?(e.classList.add(this.classes.selected),e.setAttribute("aria-selected","true"),this.main.main.setAttribute("aria-activedescendant",e.id)):(e.classList.remove(this.classes.selected),e.setAttribute("aria-selected","false")),e.addEventListener("click",(e=>{e.preventDefault(),e.stopPropagation();const s=this.store.getSelected(),i=e.currentTarget,n=String(i.dataset.id);if(t.disabled||t.selected&&!this.settings.allowDeselect)return;if(this.settings.isMultiple&&this.settings.maxSelected<=s.length&&!t.selected||this.settings.isMultiple&&this.settings.minSelected>=s.length&&t.selected)return;let a=!1;const l=this.store.getSelectedOptions();let o=[];this.settings.isMultiple&&(o=t.selected?l.filter((t=>t.id!==n)):l.concat(t)),this.settings.isMultiple||(o=t.selected?[]:[t]),this.callbacks.beforeChange||(a=!0),this.callbacks.beforeChange&&(a=!1!==this.callbacks.beforeChange(o,l)),a&&(this.store.getOptionByID(n)||this.callbacks.addOption(t),this.callbacks.setSelected(o.map((t=>t.id)),!1),this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(o))})),e}destroy(){this.main.main.remove(),this.content.main.remove()}highlightText(t,e,s){let i=t;const n=new RegExp("("+e.trim()+")(?![^<]*>[^<>]*${o}`),i}moveContentAbove(){const t=this.main.main.offsetHeight,e=this.content.main.offsetHeight;this.main.main.classList.remove(this.classes.openBelow),this.main.main.classList.add(this.classes.openAbove),this.content.main.classList.remove(this.classes.openBelow),this.content.main.classList.add(this.classes.openAbove);const s=this.main.main.getBoundingClientRect();this.content.main.style.margin="-"+(t+e-1)+"px 0px 0px 0px",this.content.main.style.top=s.top+s.height+window.scrollY+"px",this.content.main.style.left=s.left+window.scrollX+"px",this.content.main.style.width=s.width+"px"}moveContentBelow(){this.main.main.classList.remove(this.classes.openAbove),this.main.main.classList.add(this.classes.openBelow),this.content.main.classList.remove(this.classes.openAbove),this.content.main.classList.add(this.classes.openBelow);const t=this.main.main.getBoundingClientRect();this.content.main.style.margin="-1px 0px 0px 0px","relative"!==this.settings.contentPosition&&(this.content.main.style.top=t.top+t.height+window.scrollY+"px",this.content.main.style.left=t.left+window.scrollX+"px",this.content.main.style.width=t.width+"px")}ensureElementInView(t,e){const s=t.scrollTop+t.offsetTop,i=s+t.clientHeight,n=e.offsetTop,a=n+e.clientHeight;ni&&(t.scrollTop+=a-i)}putContent(){const t=this.main.main.offsetHeight,e=this.main.main.getBoundingClientRect(),s=this.content.main.offsetHeight;return window.innerHeight-(e.top+t)<=s&&e.top>s?"up":"down"}updateDeselectAll(){if(!this.store||!this.settings)return;const t=this.store.getSelectedOptions(),e=t&&t.length>0,s=this.settings.isMultiple,i=this.settings.allowDeselect,n=this.main.deselect.main,a=this.classes.hide;!i||s&&!e?n.classList.add(a):n.classList.remove(a)}}class o{constructor(t){this.listen=!1,this.observer=null,this.select=t,this.valueChange=this.valueChange.bind(this),this.select.addEventListener("change",this.valueChange,{passive:!0}),this.observer=new MutationObserver(this.observeCall.bind(this)),this.changeListen(!0)}enable(){this.select.disabled=!1}disable(){this.select.disabled=!0}hideUI(){this.select.tabIndex=-1,this.select.style.display="none",this.select.setAttribute("aria-hidden","true")}showUI(){this.select.removeAttribute("tabindex"),this.select.style.display="",this.select.removeAttribute("aria-hidden")}changeListen(t){this.listen=t,t&&this.observer&&this.observer.observe(this.select,{subtree:!0,childList:!0,attributes:!0}),t||this.observer&&this.observer.disconnect()}valueChange(t){return this.listen&&this.onValueChange&&this.onValueChange(this.getSelectedOptions()),!0}observeCall(t){if(!this.listen)return;let e=!1,s=!1,i=!1;for(const n of t)n.target===this.select&&("disabled"===n.attributeName&&(s=!0),"class"===n.attributeName&&(e=!0)),"OPTGROUP"!==n.target.nodeName&&"OPTION"!==n.target.nodeName||(i=!0);e&&this.onClassChange&&this.onClassChange(this.select.className.split(" ")),s&&this.onDisabledChange&&(this.changeListen(!1),this.onDisabledChange(this.select.disabled),this.changeListen(!0)),i&&this.onOptionsChange&&(this.changeListen(!1),this.onOptionsChange(this.getData()),this.changeListen(!0))}getData(){let t=[];const e=this.select.childNodes;for(const s of e)"OPTGROUP"===s.nodeName&&t.push(this.getDataFromOptgroup(s)),"OPTION"===s.nodeName&&t.push(this.getDataFromOption(s));return t}getDataFromOptgroup(t){let e={id:t.id,label:t.label,selectAll:!!t.dataset&&"true"===t.dataset.selectall,selectAllText:t.dataset?t.dataset.selectalltext:"Select all",closable:t.dataset?t.dataset.closable:"off",options:[]};const s=t.childNodes;for(const t of s)"OPTION"===t.nodeName&&e.options.push(this.getDataFromOption(t));return e}getDataFromOption(t){return{id:t.id,value:t.value,text:t.text,html:t.dataset&&t.dataset.html?t.dataset.html:"",selected:t.selected,display:"none"!==t.style.display,disabled:t.disabled,mandatory:!!t.dataset&&"true"===t.dataset.mandatory,placeholder:"true"===t.dataset.placeholder,class:t.className,style:t.style.cssText,data:t.dataset}}getSelectedOptions(){let t=[];const e=this.select.childNodes;for(const s of e){if("OPTGROUP"===s.nodeName){const e=s.childNodes;for(const s of e)if("OPTION"===s.nodeName){const e=s;e.selected&&t.push(this.getDataFromOption(e))}}if("OPTION"===s.nodeName){const e=s;e.selected&&t.push(this.getDataFromOption(e))}}return t}getSelectedValues(){return this.getSelectedOptions().map((t=>t.value))}setSelected(t){this.changeListen(!1);const e=this.select.childNodes;for(const s of e){if("OPTGROUP"===s.nodeName){const e=s.childNodes;for(const s of e)if("OPTION"===s.nodeName){const e=s;e.selected=t.includes(e.id)}}if("OPTION"===s.nodeName){const e=s;e.selected=t.includes(e.id)}}this.changeListen(!0)}updateSelect(t,e,s){this.changeListen(!1),t&&(this.select.dataset.id=t),e&&(this.select.style.cssText=e),s&&(this.select.className="",s.forEach((t=>{""!==t.trim()&&this.select.classList.add(t.trim())}))),this.changeListen(!0)}updateOptions(t){this.changeListen(!1),this.select.innerHTML="";for(const e of t)e instanceof i&&this.select.appendChild(this.createOptgroup(e)),e instanceof n&&this.select.appendChild(this.createOption(e));this.select.dispatchEvent(new Event("change")),this.changeListen(!0)}createOptgroup(t){const e=document.createElement("optgroup");if(e.id=t.id,e.label=t.label,t.selectAll&&(e.dataset.selectAll="true"),"off"!==t.closable&&(e.dataset.closable=t.closable),t.options)for(const s of t.options)e.appendChild(this.createOption(s));return e}createOption(t){const e=document.createElement("option");return e.id=t.id,e.value=t.value,e.innerHTML=t.text,""!==t.html&&e.setAttribute("data-html",t.html),t.selected&&(e.selected=t.selected),t.disabled&&(e.disabled=!0),!1===t.display&&(e.style.display="none"),t.placeholder&&e.setAttribute("data-placeholder","true"),t.mandatory&&e.setAttribute("data-mandatory","true"),t.class&&t.class.split(" ").forEach((t=>{e.classList.add(t)})),t.data&&"object"==typeof t.data&&Object.keys(t.data).forEach((s=>{e.setAttribute("data-"+function(t){const e=t.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,(t=>"-"+t.toLowerCase()));return t[0]===t[0].toUpperCase()?e.substring(1):e}(s),t.data[s])})),e}destroy(){this.changeListen(!1),this.select.removeEventListener("change",this.valueChange),this.observer&&(this.observer.disconnect(),this.observer=null),delete this.select.dataset.id,this.showUI()}}class c{constructor(e){this.id="",this.style="",this.class=[],this.isMultiple=!1,this.isOpen=!1,this.isFullOpen=!1,this.intervalMove=null,e||(e={}),this.id="ss-"+t(),this.style=e.style||"",this.class=e.class||[],this.disabled=void 0!==e.disabled&&e.disabled,this.alwaysOpen=void 0!==e.alwaysOpen&&e.alwaysOpen,this.showSearch=void 0===e.showSearch||e.showSearch,this.ariaLabel=e.ariaLabel||"Combobox",this.searchPlaceholder=e.searchPlaceholder||"Search",this.searchText=e.searchText||"No Results",this.searchingText=e.searchingText||"Searching...",this.searchHighlight=void 0!==e.searchHighlight&&e.searchHighlight,this.closeOnSelect=void 0===e.closeOnSelect||e.closeOnSelect,this.contentLocation=e.contentLocation||document.body,this.contentPosition=e.contentPosition||"absolute",this.openPosition=e.openPosition||"auto",this.placeholderText=void 0!==e.placeholderText?e.placeholderText:"Select Value",this.allowDeselect=void 0!==e.allowDeselect&&e.allowDeselect,this.hideSelected=void 0!==e.hideSelected&&e.hideSelected,this.keepOrder=void 0!==e.keepOrder&&e.keepOrder,this.showOptionTooltips=void 0!==e.showOptionTooltips&&e.showOptionTooltips,this.minSelected=e.minSelected||0,this.maxSelected=e.maxSelected||1e3,this.timeoutDelay=e.timeoutDelay||200,this.maxValuesShown=e.maxValuesShown||20,this.maxValuesMessage=e.maxValuesMessage||"{number} selected"}}return class{constructor(t){var s;if(this.events={search:void 0,searchFilter:(t,e)=>-1!==t.text.toLowerCase().indexOf(e.toLowerCase()),addable:void 0,beforeChange:void 0,afterChange:void 0,beforeOpen:void 0,afterOpen:void 0,beforeClose:void 0,afterClose:void 0},this.windowResize=e((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.windowScroll=e((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.documentClick=t=>{this.settings.isOpen&&t.target&&!function(t,e){function s(t,s){return s&&t&&t.classList&&t.classList.contains(s)||s&&t&&t.dataset&&t.dataset.id&&t.dataset.id===e?t:null}return s(t,e)||function t(e,i){return e&&e!==document?s(e,i)?e:t(e.parentNode,i):null}(t,e)}(t.target,this.settings.id)&&this.close(t.type)},this.windowVisibilityChange=()=>{document.hidden&&this.close()},this.selectEl="string"==typeof t.select?document.querySelector(t.select):t.select,!this.selectEl)return void(t.events&&t.events.error&&t.events.error(new Error("Could not find select element")));if("SELECT"!==this.selectEl.tagName)return void(t.events&&t.events.error&&t.events.error(new Error("Element isnt of type select")));this.selectEl.dataset.ssid&&this.destroy(),this.settings=new c(t.settings);const i=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const s in t.events)t.events.hasOwnProperty(s)&&(-1!==i.indexOf(s)?this.events[s]=e(t.events[s],100):this.events[s]=t.events[s]);this.settings.disabled=(null===(s=t.settings)||void 0===s?void 0:s.disabled)?t.settings.disabled:this.selectEl.disabled,this.settings.isMultiple=this.selectEl.multiple,this.settings.style=this.selectEl.style.cssText,this.settings.class=this.selectEl.className.split(" "),this.select=new o(this.selectEl),this.select.updateSelect(this.settings.id,this.settings.style,this.settings.class),this.select.hideUI(),this.select.onValueChange=t=>{this.setSelected(t.map((t=>t.id)))},this.select.onClassChange=t=>{this.settings.class=t,this.render.updateClassStyles()},this.select.onDisabledChange=t=>{t?this.disable():this.enable()},this.select.onOptionsChange=t=>{this.setData(t)},this.store=new a(this.settings.isMultiple?"multiple":"single",t.data?t.data:this.select.getData()),t.data&&this.select.updateOptions(this.store.getData());const n={open:this.open.bind(this),close:this.close.bind(this),addable:this.events.addable?this.events.addable:void 0,setSelected:this.setSelected.bind(this),addOption:this.addOption.bind(this),search:this.search.bind(this),beforeChange:this.events.beforeChange,afterChange:this.events.afterChange};this.render=new l(this.settings,this.store,n),this.render.renderValues(),this.render.renderOptions(this.store.getData());const h=this.selectEl.getAttribute("aria-label"),r=this.selectEl.getAttribute("aria-labelledby");h?this.render.main.main.setAttribute("aria-label",h):r&&this.render.main.main.setAttribute("aria-labelledby",r),this.selectEl.parentNode&&this.selectEl.parentNode.insertBefore(this.render.main.main,this.selectEl.nextSibling),window.addEventListener("resize",this.windowResize,!1),"auto"===this.settings.openPosition&&window.addEventListener("scroll",this.windowScroll,!1),document.addEventListener("visibilitychange",this.windowVisibilityChange),this.settings.disabled&&this.disable(),this.settings.alwaysOpen&&this.open(),this.selectEl.slim=this}enable(){this.settings.disabled=!1,this.select.enable(),this.render.enable()}disable(){this.settings.disabled=!0,this.select.disable(),this.render.disable()}getData(){return this.store.getData()}setData(t){const e=this.store.getSelected(),i=this.store.validateDataArray(t);if(i)return void(this.events.error&&this.events.error(i));this.store.setData(t);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!s(e,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){return this.store.getSelected()}setSelected(t,e=!0){const i=this.store.getSelected();this.store.setSelectedBy("id",Array.isArray(t)?t:[t]);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),""!==this.render.content.search.input.value?this.search(this.render.content.search.input.value):this.render.renderOptions(n),e&&this.events.afterChange&&!s(i,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}addOption(t){const e=this.store.getSelected();this.store.getDataOptions().some((e=>{var s;return e.value===(null!==(s=t.value)&&void 0!==s?s:t.text)}))||this.store.addOption(t);const i=this.store.getData();this.select.updateOptions(i),this.render.renderValues(),this.render.renderOptions(i),this.events.afterChange&&!s(e,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}open(){this.settings.disabled||this.settings.isOpen||(this.events.beforeOpen&&this.events.beforeOpen(),this.render.open(),this.settings.showSearch&&this.render.searchFocus(),this.settings.isOpen=!0,setTimeout((()=>{this.events.afterOpen&&this.events.afterOpen(),this.settings.isOpen&&(this.settings.isFullOpen=!0),document.addEventListener("click",this.documentClick)}),this.settings.timeoutDelay),"absolute"===this.settings.contentPosition&&(this.settings.intervalMove&&clearInterval(this.settings.intervalMove),this.settings.intervalMove=setInterval(this.render.moveContent.bind(this.render),500)))}close(t=null){this.settings.isOpen&&!this.settings.alwaysOpen&&(this.events.beforeClose&&this.events.beforeClose(),this.render.close(),""!==this.render.content.search.input.value&&this.search(""),this.render.mainFocus(t),this.settings.isOpen=!1,this.settings.isFullOpen=!1,setTimeout((()=>{this.events.afterClose&&this.events.afterClose(),document.removeEventListener("click",this.documentClick)}),this.settings.timeoutDelay),this.settings.intervalMove&&clearInterval(this.settings.intervalMove))}search(t){if(this.render.content.search.input.value!==t&&(this.render.content.search.input.value=t),!this.events.search)return void this.render.renderOptions(""===t?this.store.getData():this.store.search(t,this.events.searchFilter));this.render.renderSearching();const e=this.events.search(t,this.store.getSelectedOptions());e instanceof Promise?e.then((t=>{this.render.renderOptions(this.store.partialToFullData(t))})).catch((t=>{this.render.renderError("string"==typeof t?t:t.message)})):Array.isArray(e)?this.render.renderOptions(this.store.partialToFullData(e)):this.render.renderError("Search event must return a promise or an array of data")}destroy(){document.removeEventListener("click",this.documentClick),window.removeEventListener("resize",this.windowResize,!1),"auto"===this.settings.openPosition&&window.removeEventListener("scroll",this.windowScroll,!1),document.removeEventListener("visibilitychange",this.windowVisibilityChange),this.store.setData([]),this.render.destroy(),this.select.destroy()}}})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).SlimSelect=e()}(this,(function(){"use strict";function t(){return Math.random().toString(36).substring(2,10)}function e(t,e=50,s=!1){let i;return function(...n){const a=self,l=s&&!i;clearTimeout(i),i=setTimeout((()=>{i=null,s||t.apply(a,n)}),e),l&&t.apply(a,n)}}function s(t,e){return JSON.stringify(t)===JSON.stringify(e)}class i{constructor(e){if(this.id=e.id&&""!==e.id?e.id:t(),this.label=e.label||"",this.selectAll=void 0!==e.selectAll&&e.selectAll,this.selectAllText=e.selectAllText||"Select All",this.closable=e.closable||"off",this.options=[],e.options)for(const t of e.options)this.options.push(new n(t))}}class n{constructor(e){this.id=e.id&&""!==e.id?e.id:t(),this.value=void 0===e.value?e.text:e.value,this.text=e.text||"",this.html=e.html||"",this.selected=void 0!==e.selected&&e.selected,this.display=void 0===e.display||e.display,this.disabled=void 0!==e.disabled&&e.disabled,this.mandatory=void 0!==e.mandatory&&e.mandatory,this.placeholder=void 0!==e.placeholder&&e.placeholder,this.class=e.class||"",this.style=e.style||"",this.data=e.data||{}}}class a{constructor(t,e){this.selectType="single",this.data=[],this.selectType=t,this.setData(e)}validateDataArray(t){if(!Array.isArray(t))return new Error("Data must be an array");for(let e of t){if(!(e instanceof i||"label"in e))return e instanceof n||"text"in e?this.validateOption(e):new Error("Data object must be a valid optgroup or option");if(!("label"in e))return new Error("Optgroup must have a label");if("options"in e&&e.options)for(let t of e.options)return this.validateOption(t)}return null}validateOption(t){return"text"in t?null:new Error("Option must have a text")}partialToFullData(t){let e=[];return t.forEach((t=>{if(t instanceof i||"label"in t){let s=[];"options"in t&&t.options&&t.options.forEach((t=>{s.push(new n(t))})),s.length>0&&e.push(new i(t))}(t instanceof n||"text"in t)&&e.push(new n(t))})),e}setData(t){this.data=this.partialToFullData(t),"single"===this.selectType&&this.setSelectedBy("id",this.getSelected())}getData(){return this.filter(null,!0)}getDataOptions(){return this.filter(null,!1)}addOption(t){this.setData(this.getData().concat(new n(t)))}setSelectedBy(t,e){let s=null,a=!1;for(let l of this.data){if(l instanceof i)for(let i of l.options)s||(s=i),i.selected=!a&&e.includes(i[t]),i.selected&&"single"===this.selectType&&(a=!0);l instanceof n&&(s||(s=l),l.selected=!a&&e.includes(l[t]),l.selected&&"single"===this.selectType&&(a=!0))}"single"===this.selectType&&s&&!a&&(s.selected=!0)}getSelected(){return this.getSelectedOptions().map((t=>t.id))}getSelectedOptions(){return this.filter((t=>t.selected),!1)}getOptgroupByID(t){for(let e of this.data)if(e instanceof i&&e.id===t)return e;return null}getOptionByID(t){let e=this.filter((e=>e.id===t),!1);return e.length?e[0]:null}getSelectType(){return this.selectType}getFirstOption(){let t=null;for(let e of this.data)if(e instanceof i?t=e.options[0]:e instanceof n&&(t=e),t)break;return t}search(t,e){return""===(t=t.trim())?this.getData():this.filter((s=>e(s,t)),!0)}filter(t,e){const s=[];return this.data.forEach((a=>{if(a instanceof i){let l=[];if(a.options.forEach((i=>{t&&!t(i)||(e?l.push(new n(i)):s.push(new n(i)))})),l.length>0){let t=new i(a);t.options=l,s.push(t)}}a instanceof n&&(t&&!t(a)||s.push(new n(a)))})),s}}class l{constructor(t,e,s){this.classes={main:"ss-main",placeholder:"ss-placeholder",values:"ss-values",single:"ss-single",max:"ss-max",value:"ss-value",valueText:"ss-value-text",valueDelete:"ss-value-delete",valueOut:"ss-value-out",deselect:"ss-deselect",deselectPath:"M10,10 L90,90 M10,90 L90,10",arrow:"ss-arrow",arrowClose:"M10,30 L50,70 L90,30",arrowOpen:"M10,70 L50,30 L90,70",content:"ss-content",openAbove:"ss-open-above",openBelow:"ss-open-below",search:"ss-search",searchHighlighter:"ss-search-highlight",searching:"ss-searching",addable:"ss-addable",addablePath:"M50,10 L50,90 M10,50 L90,50",list:"ss-list",optgroup:"ss-optgroup",optgroupLabel:"ss-optgroup-label",optgroupLabelText:"ss-optgroup-label-text",optgroupActions:"ss-optgroup-actions",optgroupSelectAll:"ss-selectall",optgroupSelectAllBox:"M60,10 L10,10 L10,90 L90,90 L90,50",optgroupSelectAllCheck:"M30,45 L50,70 L90,10",optgroupClosable:"ss-closable",option:"ss-option",optionDelete:"M10,10 L90,90 M10,90 L90,10",highlighted:"ss-highlighted",open:"ss-open",close:"ss-close",selected:"ss-selected",error:"ss-error",disabled:"ss-disabled",hide:"ss-hide"},this.store=e,this.settings=t,this.callbacks=s,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes(),this.settings.contentLocation.appendChild(this.content.main)}enable(){this.main.main.classList.remove(this.classes.disabled),this.content.search.input.disabled=!1}disable(){this.main.main.classList.add(this.classes.disabled),this.content.search.input.disabled=!0}open(){this.main.arrow.path.setAttribute("d",this.classes.arrowOpen),this.main.main.classList.add("up"===this.settings.openPosition?this.classes.openAbove:this.classes.openBelow),this.main.main.setAttribute("aria-expanded","true"),this.moveContent();const t=this.store.getSelectedOptions();if(t.length){const e=t[t.length-1].id,s=this.content.list.querySelector('[data-id="'+e+'"]');s&&this.ensureElementInView(this.content.list,s)}}close(){this.main.main.classList.remove(this.classes.openAbove),this.main.main.classList.remove(this.classes.openBelow),this.main.main.setAttribute("aria-expanded","false"),this.content.main.classList.remove(this.classes.openAbove),this.content.main.classList.remove(this.classes.openBelow),this.main.arrow.path.setAttribute("d",this.classes.arrowClose)}updateClassStyles(){if(this.main.main.className="",this.main.main.removeAttribute("style"),this.content.main.className="",this.content.main.removeAttribute("style"),this.main.main.classList.add(this.classes.main),this.content.main.classList.add(this.classes.content),""!==this.settings.style&&(this.main.main.style.cssText=this.settings.style,this.content.main.style.cssText=this.settings.style),this.settings.class.length)for(const t of this.settings.class)""!==t.trim()&&(this.main.main.classList.add(t.trim()),this.content.main.classList.add(t.trim()));"relative"===this.settings.contentPosition&&this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){this.main.main.role="combobox",this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.main.id),this.main.main.setAttribute("aria-expanded","false"),this.content.main.setAttribute("role","listbox")}mainDiv(){var t;const e=document.createElement("div");e.dataset.id=this.settings.id,e.setAttribute("aria-label",this.settings.ariaLabel),e.tabIndex=0,e.onkeydown=t=>{switch(t.key){case"ArrowUp":case"ArrowDown":return this.callbacks.open(),"ArrowDown"===t.key?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Enter":case" ":this.callbacks.open();const e=this.content.list.querySelector("."+this.classes.highlighted);return e&&e.click(),!1;case"Escape":return this.callbacks.close(),!1}return!1},e.onclick=t=>{this.settings.disabled||(this.settings.isOpen?this.callbacks.close():this.callbacks.open())};const s=document.createElement("div");s.classList.add(this.classes.values),e.appendChild(s);const i=document.createElement("div");i.classList.add(this.classes.deselect);const n=null===(t=this.store)||void 0===t?void 0:t.getSelectedOptions();!this.settings.allowDeselect||this.settings.isMultiple&&n&&n.length<=0?i.classList.add(this.classes.hide):i.classList.remove(this.classes.hide),i.onclick=t=>{if(t.stopPropagation(),this.settings.disabled)return;let e=!0;const s=this.store.getSelectedOptions(),i=[];if(this.callbacks.beforeChange&&(e=!0===this.callbacks.beforeChange(i,s)),e){if(this.settings.isMultiple)this.callbacks.setSelected([],!1),this.updateDeselectAll();else{const t=this.store.getFirstOption(),e=t?t.id:"";this.callbacks.setSelected(e,!1)}this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(this.store.getSelectedOptions())}};const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100");const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.deselectPath),a.appendChild(l),i.appendChild(a),e.appendChild(i);const o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.classList.add(this.classes.arrow),o.setAttribute("viewBox","0 0 100 100");const c=document.createElementNS("http://www.w3.org/2000/svg","path");return c.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&o.classList.add(this.classes.hide),o.appendChild(c),e.appendChild(o),{main:e,values:s,deselect:{main:i,svg:a,path:l},arrow:{main:o,path:c}}}mainFocus(t){"click"!==t&&this.main.main.focus({preventScroll:!0})}placeholder(){const t=this.store.filter((t=>t.placeholder),!1);let e=this.settings.placeholderText;t.length&&(""!==t[0].html?e=t[0].html:""!==t[0].text&&(e=t[0].text));const s=document.createElement("div");return s.classList.add(this.classes.placeholder),s.innerHTML=e,s}renderValues(){this.settings.isMultiple?(this.renderMultipleValues(),this.updateDeselectAll()):this.renderSingleValue()}renderSingleValue(){const t=this.store.filter((t=>t.selected&&!t.placeholder),!1),e=t.length>0?t[0]:null;if(e){const t=document.createElement("div");t.classList.add(this.classes.single),e.html?t.innerHTML=e.html:t.innerText=e.text,this.main.values.innerHTML=t.outerHTML}else this.main.values.innerHTML=this.placeholder().outerHTML;this.settings.allowDeselect&&t.length?this.main.deselect.main.classList.remove(this.classes.hide):this.main.deselect.main.classList.add(this.classes.hide)}renderMultipleValues(){let t=this.main.values.childNodes,e=this.store.filter((t=>t.selected&&t.display),!1);if(0===e.length)return void(this.main.values.innerHTML=this.placeholder().outerHTML);{const t=this.main.values.querySelector("."+this.classes.placeholder);t&&t.remove()}if(e.length>this.settings.maxValuesShown){const t=document.createElement("div");return t.classList.add(this.classes.max),t.textContent=this.settings.maxValuesMessage.replace("{number}",e.length.toString()),void(this.main.values.innerHTML=t.outerHTML)}{const t=this.main.values.querySelector("."+this.classes.max);t&&t.remove()}let s=[];for(let i=0;it.id===a),!1).length||s.push(n)}}for(const t of s)t.classList.add(this.classes.valueOut),setTimeout((()=>{this.main.values.hasChildNodes()&&this.main.values.contains(t)&&this.main.values.removeChild(t)}),100);t=this.main.values.childNodes;for(let s=0;s{if(e.preventDefault(),e.stopPropagation(),this.settings.disabled)return;let s=!0;const a=this.store.getSelectedOptions(),l=a.filter((e=>e.selected&&e.id!==t.id),!0);if(!(this.settings.minSelected&&l.length{this.callbacks.search(t.target.value)}),100),s.onkeydown=t=>{switch(t.key){case"ArrowUp":case"ArrowDown":return"ArrowDown"===t.key?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Escape":return this.callbacks.close(),!1;case"Enter":case" ":if(this.callbacks.addable&&t.ctrlKey)return i.click(),!1;{const t=this.content.list.querySelector("."+this.classes.highlighted);if(t)return t.click(),!1}return!0}return!0},t.appendChild(s),this.callbacks.addable){i.classList.add(this.classes.addable);const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 100 100");const s=document.createElementNS("http://www.w3.org/2000/svg","path");s.setAttribute("d",this.classes.addablePath),e.appendChild(s),i.appendChild(e),i.onclick=t=>{if(t.preventDefault(),t.stopPropagation(),!this.callbacks.addable)return;const e=this.content.search.input.value.trim();if(""===e)return void this.content.search.input.focus();const s=t=>{let e=new n(t);if(this.callbacks.addOption(e),this.settings.isMultiple){let t=this.store.getSelected();t.push(e.id),this.callbacks.setSelected(t,!0)}else this.callbacks.setSelected([e.id],!0);this.callbacks.search(""),this.settings.closeOnSelect&&setTimeout((()=>{this.callbacks.close()}),100)},i=this.callbacks.addable(e);!1!==i&&null!=i&&(i instanceof Promise?i.then((t=>{s("string"==typeof t?{text:t,value:t}:t)})):s("string"==typeof i?{text:i,value:i}:i))},t.appendChild(i),a.addable={main:i,svg:e,path:s}}return a}searchFocus(){this.content.search.input.focus()}getOptions(t=!1,e=!1,s=!1){let i="."+this.classes.option;return t&&(i+=":not(."+this.classes.placeholder+")"),e&&(i+=":not(."+this.classes.disabled+")"),s&&(i+=":not(."+this.classes.hide+")"),Array.from(this.content.list.querySelectorAll(i))}highlight(t){const e=this.getOptions(!0,!0,!0);if(0===e.length)return;if(1===e.length&&!e[0].classList.contains(this.classes.highlighted))return void e[0].classList.add(this.classes.highlighted);let s=!1;for(const t of e)t.classList.contains(this.classes.highlighted)&&(s=!0);if(!s)for(const t of e)if(t.classList.contains(this.classes.selected)){t.classList.add(this.classes.highlighted);break}for(let s=0;s=0?s-1:e.length-1];a.classList.add(this.classes.highlighted),this.ensureElementInView(this.content.list,a);const l=a.parentElement;if(l&&l.classList.contains(this.classes.close)){const t=l.querySelector("."+this.classes.optgroupLabel);t&&t.click()}return}e["down"===t?0:e.length-1].classList.add(this.classes.highlighted),this.ensureElementInView(this.content.list,e["down"===t?0:e.length-1])}listDiv(){const t=document.createElement("div");return t.classList.add(this.classes.list),t}renderError(t){this.content.list.innerHTML="";const e=document.createElement("div");e.classList.add(this.classes.error),e.textContent=t,this.content.list.appendChild(e)}renderSearching(){this.content.list.innerHTML="";const t=document.createElement("div");t.classList.add(this.classes.searching),t.textContent=this.settings.searchingText,this.content.list.appendChild(t)}renderOptions(t){if(this.content.list.innerHTML="",0===t.length){const t=document.createElement("div");return t.classList.add(this.classes.search),t.innerHTML=this.settings.searchText,void this.content.list.appendChild(t)}for(const e of t){if(e instanceof i){const t=document.createElement("div");t.classList.add(this.classes.optgroup);const s=document.createElement("div");s.classList.add(this.classes.optgroupLabel),t.appendChild(s);const i=document.createElement("div");i.classList.add(this.classes.optgroupLabelText),i.textContent=e.label,s.appendChild(i);const n=document.createElement("div");if(n.classList.add(this.classes.optgroupActions),s.appendChild(n),this.settings.isMultiple&&e.selectAll){const t=document.createElement("div");t.classList.add(this.classes.optgroupSelectAll);let s=!0;for(const t of e.options)if(!t.selected){s=!1;break}s&&t.classList.add(this.classes.selected);const i=document.createElement("span");i.textContent=e.selectAllText,t.appendChild(i);const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100"),t.appendChild(a);const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.optgroupSelectAllBox),a.appendChild(l);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.optgroupSelectAllCheck),a.appendChild(o),t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const i=this.store.getSelected();if(s){const t=i.filter((t=>{for(const s of e.options)if(t===s.id)return!1;return!0}));this.callbacks.setSelected(t,!0)}else{const t=i.concat(e.options.map((t=>t.id)));for(const t of e.options)this.store.getOptionByID(t.id)||this.callbacks.addOption(t);this.callbacks.setSelected(t,!0)}})),n.appendChild(t)}if("off"!==e.closable){const i=document.createElement("div");i.classList.add(this.classes.optgroupClosable);const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100"),a.classList.add(this.classes.arrow),i.appendChild(a);const l=document.createElementNS("http://www.w3.org/2000/svg","path");a.appendChild(l),e.options.some((t=>t.selected))||""!==this.content.search.input.value.trim()?(i.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"open"===e.closable?(t.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"close"===e.closable&&(t.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose)),s.addEventListener("click",(e=>{e.preventDefault(),e.stopPropagation(),t.classList.contains(this.classes.close)?(t.classList.remove(this.classes.close),t.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):(t.classList.remove(this.classes.open),t.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose))})),n.appendChild(i)}t.appendChild(s);for(const s of e.options)t.appendChild(this.option(s));this.content.list.appendChild(t)}e instanceof n&&this.content.list.appendChild(this.option(e))}}option(t){if(t.placeholder){const t=document.createElement("div");return t.classList.add(this.classes.option),t.classList.add(this.classes.hide),t}const e=document.createElement("div");return e.dataset.id=t.id,e.id=t.id,e.classList.add(this.classes.option),e.setAttribute("role","option"),t.class&&t.class.split(" ").forEach((t=>{e.classList.add(t)})),t.style&&(e.style.cssText=t.style),this.settings.searchHighlight&&""!==this.content.search.input.value.trim()?e.innerHTML=this.highlightText(""!==t.html?t.html:t.text,this.content.search.input.value,this.classes.searchHighlighter):""!==t.html?e.innerHTML=t.html:e.textContent=t.text,this.settings.showOptionTooltips&&e.textContent&&e.setAttribute("title",e.textContent),t.display||e.classList.add(this.classes.hide),t.disabled&&e.classList.add(this.classes.disabled),t.selected&&this.settings.hideSelected&&e.classList.add(this.classes.hide),t.selected?(e.classList.add(this.classes.selected),e.setAttribute("aria-selected","true"),this.main.main.setAttribute("aria-activedescendant",e.id)):(e.classList.remove(this.classes.selected),e.setAttribute("aria-selected","false")),e.addEventListener("click",(e=>{e.preventDefault(),e.stopPropagation();const s=this.store.getSelected(),i=e.currentTarget,n=String(i.dataset.id);if(t.disabled||t.selected&&!this.settings.allowDeselect)return;if(this.settings.isMultiple&&this.settings.maxSelected<=s.length&&!t.selected||this.settings.isMultiple&&this.settings.minSelected>=s.length&&t.selected)return;let a=!1;const l=this.store.getSelectedOptions();let o=[];this.settings.isMultiple&&(o=t.selected?l.filter((t=>t.id!==n)):l.concat(t)),this.settings.isMultiple||(o=t.selected?[]:[t]),this.callbacks.beforeChange||(a=!0),this.callbacks.beforeChange&&(a=!1!==this.callbacks.beforeChange(o,l)),a&&(this.store.getOptionByID(n)||this.callbacks.addOption(t),this.callbacks.setSelected(o.map((t=>t.id)),!1),this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(o))})),e}destroy(){this.main.main.remove(),this.content.main.remove()}highlightText(t,e,s){let i=t;const n=new RegExp("("+e.trim()+")(?![^<]*>[^<>]*${o}`),i}moveContentAbove(){const t=this.main.main.offsetHeight,e=this.content.main.offsetHeight;this.main.main.classList.remove(this.classes.openBelow),this.main.main.classList.add(this.classes.openAbove),this.content.main.classList.remove(this.classes.openBelow),this.content.main.classList.add(this.classes.openAbove);const s=this.main.main.getBoundingClientRect();this.content.main.style.margin="-"+(t+e-1)+"px 0px 0px 0px",this.content.main.style.top=s.top+s.height+window.scrollY+"px",this.content.main.style.left=s.left+window.scrollX+"px",this.content.main.style.width=s.width+"px"}moveContentBelow(){this.main.main.classList.remove(this.classes.openAbove),this.main.main.classList.add(this.classes.openBelow),this.content.main.classList.remove(this.classes.openAbove),this.content.main.classList.add(this.classes.openBelow);const t=this.main.main.getBoundingClientRect();this.content.main.style.margin="-1px 0px 0px 0px","relative"!==this.settings.contentPosition&&(this.content.main.style.top=t.top+t.height+window.scrollY+"px",this.content.main.style.left=t.left+window.scrollX+"px",this.content.main.style.width=t.width+"px")}ensureElementInView(t,e){const s=t.scrollTop+t.offsetTop,i=s+t.clientHeight,n=e.offsetTop,a=n+e.clientHeight;ni&&(t.scrollTop+=a-i)}putContent(){const t=this.main.main.offsetHeight,e=this.main.main.getBoundingClientRect(),s=this.content.main.offsetHeight;return window.innerHeight-(e.top+t)<=s&&e.top>s?"up":"down"}updateDeselectAll(){if(!this.store||!this.settings)return;const t=this.store.getSelectedOptions(),e=t&&t.length>0,s=this.settings.isMultiple,i=this.settings.allowDeselect,n=this.main.deselect.main,a=this.classes.hide;!i||s&&!e?n.classList.add(a):n.classList.remove(a)}}class o{constructor(t){this.listen=!1,this.observer=null,this.select=t,this.valueChange=this.valueChange.bind(this),this.select.addEventListener("change",this.valueChange,{passive:!0}),this.observer=new MutationObserver(this.observeCall.bind(this)),this.changeListen(!0)}enable(){this.select.disabled=!1}disable(){this.select.disabled=!0}hideUI(){this.select.tabIndex=-1,this.select.style.display="none",this.select.setAttribute("aria-hidden","true")}showUI(){this.select.removeAttribute("tabindex"),this.select.style.display="",this.select.removeAttribute("aria-hidden")}changeListen(t){this.listen=t,t&&this.observer&&this.observer.observe(this.select,{subtree:!0,childList:!0,attributes:!0}),t||this.observer&&this.observer.disconnect()}valueChange(t){return this.listen&&this.onValueChange&&this.onValueChange(this.getSelectedOptions()),!0}observeCall(t){if(!this.listen)return;let e=!1,s=!1,i=!1;for(const n of t)n.target===this.select&&("disabled"===n.attributeName&&(s=!0),"class"===n.attributeName&&(e=!0)),"OPTGROUP"!==n.target.nodeName&&"OPTION"!==n.target.nodeName||(i=!0);e&&this.onClassChange&&this.onClassChange(this.select.className.split(" ")),s&&this.onDisabledChange&&(this.changeListen(!1),this.onDisabledChange(this.select.disabled),this.changeListen(!0)),i&&this.onOptionsChange&&(this.changeListen(!1),this.onOptionsChange(this.getData()),this.changeListen(!0))}getData(){let t=[];const e=this.select.childNodes;for(const s of e)"OPTGROUP"===s.nodeName&&t.push(this.getDataFromOptgroup(s)),"OPTION"===s.nodeName&&t.push(this.getDataFromOption(s));return t}getDataFromOptgroup(t){let e={id:t.id,label:t.label,selectAll:!!t.dataset&&"true"===t.dataset.selectall,selectAllText:t.dataset?t.dataset.selectalltext:"Select all",closable:t.dataset?t.dataset.closable:"off",options:[]};const s=t.childNodes;for(const t of s)"OPTION"===t.nodeName&&e.options.push(this.getDataFromOption(t));return e}getDataFromOption(t){return{id:t.id,value:t.value,text:t.text,html:t.dataset&&t.dataset.html?t.dataset.html:"",selected:t.selected,display:"none"!==t.style.display,disabled:t.disabled,mandatory:!!t.dataset&&"true"===t.dataset.mandatory,placeholder:"true"===t.dataset.placeholder,class:t.className,style:t.style.cssText,data:t.dataset}}getSelectedOptions(){let t=[];const e=this.select.childNodes;for(const s of e){if("OPTGROUP"===s.nodeName){const e=s.childNodes;for(const s of e)if("OPTION"===s.nodeName){const e=s;e.selected&&t.push(this.getDataFromOption(e))}}if("OPTION"===s.nodeName){const e=s;e.selected&&t.push(this.getDataFromOption(e))}}return t}getSelectedValues(){return this.getSelectedOptions().map((t=>t.value))}setSelected(t){this.changeListen(!1);const e=this.select.childNodes;for(const s of e){if("OPTGROUP"===s.nodeName){const e=s.childNodes;for(const s of e)if("OPTION"===s.nodeName){const e=s;e.selected=t.includes(e.id)}}if("OPTION"===s.nodeName){const e=s;e.selected=t.includes(e.id)}}this.changeListen(!0)}updateSelect(t,e,s){this.changeListen(!1),t&&(this.select.dataset.id=t),e&&(this.select.style.cssText=e),s&&(this.select.className="",s.forEach((t=>{""!==t.trim()&&this.select.classList.add(t.trim())}))),this.changeListen(!0)}updateOptions(t){this.changeListen(!1),this.select.innerHTML="";for(const e of t)e instanceof i&&this.select.appendChild(this.createOptgroup(e)),e instanceof n&&this.select.appendChild(this.createOption(e));this.select.dispatchEvent(new Event("change")),this.changeListen(!0)}createOptgroup(t){const e=document.createElement("optgroup");if(e.id=t.id,e.label=t.label,t.selectAll&&(e.dataset.selectAll="true"),"off"!==t.closable&&(e.dataset.closable=t.closable),t.options)for(const s of t.options)e.appendChild(this.createOption(s));return e}createOption(t){const e=document.createElement("option");return e.id=t.id,e.value=t.value,e.innerHTML=t.text,""!==t.html&&e.setAttribute("data-html",t.html),t.selected&&(e.selected=t.selected),t.disabled&&(e.disabled=!0),!1===t.display&&(e.style.display="none"),t.placeholder&&e.setAttribute("data-placeholder","true"),t.mandatory&&e.setAttribute("data-mandatory","true"),t.class&&t.class.split(" ").forEach((t=>{e.classList.add(t)})),t.data&&"object"==typeof t.data&&Object.keys(t.data).forEach((s=>{e.setAttribute("data-"+function(t){const e=t.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,(t=>"-"+t.toLowerCase()));return t[0]===t[0].toUpperCase()?e.substring(1):e}(s),t.data[s])})),e}destroy(){this.changeListen(!1),this.select.removeEventListener("change",this.valueChange),this.observer&&(this.observer.disconnect(),this.observer=null),delete this.select.dataset.id,this.showUI()}}class c{constructor(e){this.id="",this.style="",this.class=[],this.isMultiple=!1,this.isOpen=!1,this.isFullOpen=!1,this.intervalMove=null,e||(e={}),this.id="ss-"+t(),this.style=e.style||"",this.class=e.class||[],this.disabled=void 0!==e.disabled&&e.disabled,this.alwaysOpen=void 0!==e.alwaysOpen&&e.alwaysOpen,this.showSearch=void 0===e.showSearch||e.showSearch,this.ariaLabel=e.ariaLabel||"Combobox",this.searchPlaceholder=e.searchPlaceholder||"Search",this.searchText=e.searchText||"No Results",this.searchingText=e.searchingText||"Searching...",this.searchHighlight=void 0!==e.searchHighlight&&e.searchHighlight,this.closeOnSelect=void 0===e.closeOnSelect||e.closeOnSelect,this.contentLocation=e.contentLocation||document.body,this.contentPosition=e.contentPosition||"absolute",this.openPosition=e.openPosition||"auto",this.placeholderText=void 0!==e.placeholderText?e.placeholderText:"Select Value",this.allowDeselect=void 0!==e.allowDeselect&&e.allowDeselect,this.hideSelected=void 0!==e.hideSelected&&e.hideSelected,this.keepOrder=void 0!==e.keepOrder&&e.keepOrder,this.showOptionTooltips=void 0!==e.showOptionTooltips&&e.showOptionTooltips,this.minSelected=e.minSelected||0,this.maxSelected=e.maxSelected||1e3,this.timeoutDelay=e.timeoutDelay||200,this.maxValuesShown=e.maxValuesShown||20,this.maxValuesMessage=e.maxValuesMessage||"{number} selected"}}return class{constructor(t){var s;if(this.events={search:void 0,searchFilter:(t,e)=>-1!==t.text.toLowerCase().indexOf(e.toLowerCase()),addable:void 0,beforeChange:void 0,afterChange:void 0,beforeOpen:void 0,afterOpen:void 0,beforeClose:void 0,afterClose:void 0},this.windowResize=e((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.windowScroll=e((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.documentClick=t=>{this.settings.isOpen&&t.target&&!function(t,e){function s(t,s){return s&&t&&t.classList&&t.classList.contains(s)||s&&t&&t.dataset&&t.dataset.id&&t.dataset.id===e?t:null}return s(t,e)||function t(e,i){return e&&e!==document?s(e,i)?e:t(e.parentNode,i):null}(t,e)}(t.target,this.settings.id)&&this.close(t.type)},this.windowVisibilityChange=()=>{document.hidden&&this.close()},this.selectEl="string"==typeof t.select?document.querySelector(t.select):t.select,!this.selectEl)return void(t.events&&t.events.error&&t.events.error(new Error("Could not find select element")));if("SELECT"!==this.selectEl.tagName)return void(t.events&&t.events.error&&t.events.error(new Error("Element isnt of type select")));this.selectEl.dataset.ssid&&this.destroy(),this.settings=new c(t.settings);const i=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const s in t.events)t.events.hasOwnProperty(s)&&(-1!==i.indexOf(s)?this.events[s]=e(t.events[s],100):this.events[s]=t.events[s]);this.settings.disabled=(null===(s=t.settings)||void 0===s?void 0:s.disabled)?t.settings.disabled:this.selectEl.disabled,this.settings.isMultiple=this.selectEl.multiple,this.settings.style=this.selectEl.style.cssText,this.settings.class=this.selectEl.className.split(" "),this.select=new o(this.selectEl),this.select.updateSelect(this.settings.id,this.settings.style,this.settings.class),this.select.hideUI(),this.select.onValueChange=t=>{this.setSelected(t.map((t=>t.id)))},this.select.onClassChange=t=>{this.settings.class=t,this.render.updateClassStyles()},this.select.onDisabledChange=t=>{t?this.disable():this.enable()},this.select.onOptionsChange=t=>{this.setData(t)},this.store=new a(this.settings.isMultiple?"multiple":"single",t.data?t.data:this.select.getData()),t.data&&this.select.updateOptions(this.store.getData());const n={open:this.open.bind(this),close:this.close.bind(this),addable:this.events.addable?this.events.addable:void 0,setSelected:this.setSelected.bind(this),addOption:this.addOption.bind(this),search:this.search.bind(this),beforeChange:this.events.beforeChange,afterChange:this.events.afterChange};this.render=new l(this.settings,this.store,n),this.render.renderValues(),this.render.renderOptions(this.store.getData());const h=this.selectEl.getAttribute("aria-label"),r=this.selectEl.getAttribute("aria-labelledby");h?this.render.main.main.setAttribute("aria-label",h):r&&this.render.main.main.setAttribute("aria-labelledby",r),this.selectEl.parentNode&&this.selectEl.parentNode.insertBefore(this.render.main.main,this.selectEl.nextSibling),window.addEventListener("resize",this.windowResize,!1),"auto"===this.settings.openPosition&&window.addEventListener("scroll",this.windowScroll,!1),document.addEventListener("visibilitychange",this.windowVisibilityChange),this.settings.disabled&&this.disable(),this.settings.alwaysOpen&&this.open(),this.selectEl.slim=this}enable(){this.settings.disabled=!1,this.select.enable(),this.render.enable()}disable(){this.settings.disabled=!0,this.select.disable(),this.render.disable()}getData(){return this.store.getData()}setData(t){const e=this.store.getSelected(),i=this.store.validateDataArray(t);if(i)return void(this.events.error&&this.events.error(i));this.store.setData(t);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!s(e,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){return this.store.getSelectedOptions().map((t=>t.value))}setSelected(t,e=!0){const i=this.store.getSelected(),n=this.store.getDataOptions();t=Array.isArray(t)?t:[t];const a=[];for(const e of t)if(n.find((t=>t.id==e)))a.push(e);else for(const t of n.filter((t=>t.value==e)))a.push(t.id);this.store.setSelectedBy("id",a);const l=this.store.getData();this.select.updateOptions(l),this.render.renderValues(),""!==this.render.content.search.input.value?this.search(this.render.content.search.input.value):this.render.renderOptions(l),e&&this.events.afterChange&&!s(i,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}addOption(t){const e=this.store.getSelected();this.store.getDataOptions().some((e=>{var s;return e.value===(null!==(s=t.value)&&void 0!==s?s:t.text)}))||this.store.addOption(t);const i=this.store.getData();this.select.updateOptions(i),this.render.renderValues(),this.render.renderOptions(i),this.events.afterChange&&!s(e,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}open(){this.settings.disabled||this.settings.isOpen||(this.events.beforeOpen&&this.events.beforeOpen(),this.render.open(),this.settings.showSearch&&this.render.searchFocus(),this.settings.isOpen=!0,setTimeout((()=>{this.events.afterOpen&&this.events.afterOpen(),this.settings.isOpen&&(this.settings.isFullOpen=!0),document.addEventListener("click",this.documentClick)}),this.settings.timeoutDelay),"absolute"===this.settings.contentPosition&&(this.settings.intervalMove&&clearInterval(this.settings.intervalMove),this.settings.intervalMove=setInterval(this.render.moveContent.bind(this.render),500)))}close(t=null){this.settings.isOpen&&!this.settings.alwaysOpen&&(this.events.beforeClose&&this.events.beforeClose(),this.render.close(),""!==this.render.content.search.input.value&&this.search(""),this.render.mainFocus(t),this.settings.isOpen=!1,this.settings.isFullOpen=!1,setTimeout((()=>{this.events.afterClose&&this.events.afterClose(),document.removeEventListener("click",this.documentClick)}),this.settings.timeoutDelay),this.settings.intervalMove&&clearInterval(this.settings.intervalMove))}search(t){if(this.render.content.search.input.value!==t&&(this.render.content.search.input.value=t),!this.events.search)return void this.render.renderOptions(""===t?this.store.getData():this.store.search(t,this.events.searchFilter));this.render.renderSearching();const e=this.events.search(t,this.store.getSelectedOptions());e instanceof Promise?e.then((t=>{this.render.renderOptions(this.store.partialToFullData(t))})).catch((t=>{this.render.renderError("string"==typeof t?t:t.message)})):Array.isArray(e)?this.render.renderOptions(this.store.partialToFullData(e)):this.render.renderError("Search event must return a promise or an array of data")}destroy(){document.removeEventListener("click",this.documentClick),window.removeEventListener("resize",this.windowResize,!1),"auto"===this.settings.openPosition&&window.removeEventListener("scroll",this.windowScroll,!1),document.removeEventListener("visibilitychange",this.windowVisibilityChange),this.store.setData([]),this.render.destroy(),this.select.destroy()}}})); diff --git a/docs/assets/index.js b/docs/assets/index.js index bb13c721..db047fd8 100644 --- a/docs/assets/index.js +++ b/docs/assets/index.js @@ -2,7 +2,7 @@ * vue-router v4.2.5 * (c) 2023 Eduardo San Martin Morote * @license MIT - */const mr=typeof window<"u";function x0(e){return e.__esModule||e[Symbol.toStringTag]==="Module"}const ce=Object.assign;function co(e,t){const n={};for(const r in t){const s=t[r];n[r]=jt(s)?s.map(e):e(s)}return n}const Es=()=>{},jt=Array.isArray,E0=/\/$/,_0=e=>e.replace(E0,"");function fo(e,t,n="/"){let r,s={},l="",i="";const o=t.indexOf("#");let a=t.indexOf("?");return o=0&&(a=-1),a>-1&&(r=t.slice(0,a),l=t.slice(a+1,o>-1?o:t.length),s=e(l)),o>-1&&(r=r||t.slice(0,o),i=t.slice(o,t.length)),r=O0(r??t,n),{fullPath:r+(l&&"?")+l+i,path:r,query:s,hash:i}}function C0(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function Jc(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function k0(e,t,n){const r=t.matched.length-1,s=n.matched.length-1;return r>-1&&r===s&&Hr(t.matched[r],n.matched[s])&&Ph(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function Hr(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function Ph(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(!A0(e[n],t[n]))return!1;return!0}function A0(e,t){return jt(e)?Xc(e,t):jt(t)?Xc(t,e):e===t}function Xc(e,t){return jt(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function O0(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),r=e.split("/"),s=r[r.length-1];(s===".."||s===".")&&r.push("");let l=n.length-1,i,o;for(i=0;i1&&l--;else break;return n.slice(0,l).join("/")+"/"+r.slice(i-(i===r.length?1:0)).join("/")}var js;(function(e){e.pop="pop",e.push="push"})(js||(js={}));var _s;(function(e){e.back="back",e.forward="forward",e.unknown=""})(_s||(_s={}));function P0(e){if(!e)if(mr){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),_0(e)}const L0=/^[^#]+#/;function T0(e,t){return e.replace(L0,"#")+t}function R0(e,t){const n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect();return{behavior:t.behavior,left:r.left-n.left-(t.left||0),top:r.top-n.top-(t.top||0)}}const zi=()=>({left:window.pageXOffset,top:window.pageYOffset});function N0(e){let t;if("el"in e){const n=e.el,r=typeof n=="string"&&n.startsWith("#"),s=typeof n=="string"?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!s)return;t=R0(s,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.pageXOffset,t.top!=null?t.top:window.pageYOffset)}function qc(e,t){return(history.state?history.state.position-t:-1)+e}const ta=new Map;function M0(e,t){ta.set(e,t)}function F0(e){const t=ta.get(e);return ta.delete(e),t}let I0=()=>location.protocol+"//"+location.host;function Lh(e,t){const{pathname:n,search:r,hash:s}=t,l=e.indexOf("#");if(l>-1){let o=s.includes(e.slice(l))?e.slice(l).length:1,a=s.slice(o);return a[0]!=="/"&&(a="/"+a),Jc(a,"")}return Jc(n,e)+r+s}function D0(e,t,n,r){let s=[],l=[],i=null;const o=({state:p})=>{const w=Lh(e,location),x=n.value,_=t.value;let L=0;if(p){if(n.value=w,t.value=p,i&&i===x){i=null;return}L=_?p.position-_.position:0}else r(w);s.forEach(m=>{m(n.value,x,{delta:L,type:js.pop,direction:L?L>0?_s.forward:_s.back:_s.unknown})})};function a(){i=n.value}function u(p){s.push(p);const w=()=>{const x=s.indexOf(p);x>-1&&s.splice(x,1)};return l.push(w),w}function c(){const{history:p}=window;p.state&&p.replaceState(ce({},p.state,{scroll:zi()}),"")}function d(){for(const p of l)p();l=[],window.removeEventListener("popstate",o),window.removeEventListener("beforeunload",c)}return window.addEventListener("popstate",o),window.addEventListener("beforeunload",c,{passive:!0}),{pauseListeners:a,listen:u,destroy:d}}function ef(e,t,n,r=!1,s=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:s?zi():null}}function b0(e){const{history:t,location:n}=window,r={value:Lh(e,n)},s={value:t.state};s.value||l(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function l(a,u,c){const d=e.indexOf("#"),p=d>-1?(n.host&&document.querySelector("base")?e:e.slice(d))+a:I0()+e+a;try{t[c?"replaceState":"pushState"](u,"",p),s.value=u}catch(w){console.error(w),n[c?"replace":"assign"](p)}}function i(a,u){const c=ce({},t.state,ef(s.value.back,a,s.value.forward,!0),u,{position:s.value.position});l(a,c,!0),r.value=a}function o(a,u){const c=ce({},s.value,t.state,{forward:a,scroll:zi()});l(c.current,c,!0);const d=ce({},ef(r.value,a,null),{position:c.position+1},u);l(a,d,!1),r.value=a}return{location:r,state:s,push:o,replace:i}}function j0(e){e=P0(e);const t=b0(e),n=D0(e,t.state,t.location,t.replace);function r(l,i=!0){i||n.pauseListeners(),history.go(l)}const s=ce({location:"",base:e,go:r,createHref:T0.bind(null,e)},t,n);return Object.defineProperty(s,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(s,"state",{enumerable:!0,get:()=>t.state.value}),s}function z0(e){return typeof e=="string"||e&&typeof e=="object"}function Th(e){return typeof e=="string"||typeof e=="symbol"}const vn={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0},Rh=Symbol("");var tf;(function(e){e[e.aborted=4]="aborted",e[e.cancelled=8]="cancelled",e[e.duplicated=16]="duplicated"})(tf||(tf={}));function $r(e,t){return ce(new Error,{type:e,[Rh]:!0},t)}function qt(e,t){return e instanceof Error&&Rh in e&&(t==null||!!(e.type&t))}const nf="[^/]+?",B0={sensitive:!1,strict:!1,start:!0,end:!0},U0=/[.+*?^${}()[\]/\\]/g;function V0(e,t){const n=ce({},B0,t),r=[];let s=n.start?"^":"";const l=[];for(const u of e){const c=u.length?[]:[90];n.strict&&!u.length&&(s+="/");for(let d=0;dt.length?t.length===1&&t[0]===80?1:-1:0}function $0(e,t){let n=0;const r=e.score,s=t.score;for(;n0&&t[t.length-1]<0}const W0={type:0,value:""},Q0=/[a-zA-Z0-9_]/;function K0(e){if(!e)return[[]];if(e==="/")return[[W0]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(w){throw new Error(`ERR (${n})/"${u}": ${w}`)}let n=0,r=n;const s=[];let l;function i(){l&&s.push(l),l=[]}let o=0,a,u="",c="";function d(){u&&(n===0?l.push({type:0,value:u}):n===1||n===2||n===3?(l.length>1&&(a==="*"||a==="+")&&t(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),l.push({type:1,value:u,regexp:c,repeatable:a==="*"||a==="+",optional:a==="*"||a==="?"})):t("Invalid state to consume buffer"),u="")}function p(){u+=a}for(;o{i(f)}:Es}function i(c){if(Th(c)){const d=r.get(c);d&&(r.delete(c),n.splice(n.indexOf(d),1),d.children.forEach(i),d.alias.forEach(i))}else{const d=n.indexOf(c);d>-1&&(n.splice(d,1),c.record.name&&r.delete(c.record.name),c.children.forEach(i),c.alias.forEach(i))}}function o(){return n}function a(c){let d=0;for(;d=0&&(c.record.path!==n[d].record.path||!Nh(c,n[d]));)d++;n.splice(d,0,c),c.record.name&&!lf(c)&&r.set(c.record.name,c)}function u(c,d){let p,w={},x,_;if("name"in c&&c.name){if(p=r.get(c.name),!p)throw $r(1,{location:c});_=p.record.name,w=ce(sf(d.params,p.keys.filter(f=>!f.optional).map(f=>f.name)),c.params&&sf(c.params,p.keys.map(f=>f.name))),x=p.stringify(w)}else if("path"in c)x=c.path,p=n.find(f=>f.re.test(x)),p&&(w=p.parse(x),_=p.record.name);else{if(p=d.name?r.get(d.name):n.find(f=>f.re.test(d.path)),!p)throw $r(1,{location:c,currentLocation:d});_=p.record.name,w=ce({},d.params,c.params),x=p.stringify(w)}const L=[];let m=p;for(;m;)L.unshift(m.record),m=m.parent;return{name:_,path:x,params:w,matched:L,meta:X0(L)}}return e.forEach(c=>l(c)),{addRoute:l,resolve:u,removeRoute:i,getRoutes:o,getRecordMatcher:s}}function sf(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function Z0(e){return{path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:void 0,beforeEnter:e.beforeEnter,props:J0(e),children:e.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in e?e.components||null:e.component&&{default:e.component}}}function J0(e){const t={},n=e.props||!1;if("component"in e)t.default=n;else for(const r in e.components)t[r]=typeof n=="object"?n[r]:n;return t}function lf(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function X0(e){return e.reduce((t,n)=>ce(t,n.meta),{})}function of(e,t){const n={};for(const r in e)n[r]=r in t?t[r]:e[r];return n}function Nh(e,t){return t.children.some(n=>n===e||Nh(e,n))}const Mh=/#/g,q0=/&/g,ey=/\//g,ty=/=/g,ny=/\?/g,Fh=/\+/g,ry=/%5B/g,sy=/%5D/g,Ih=/%5E/g,ly=/%60/g,Dh=/%7B/g,iy=/%7C/g,bh=/%7D/g,oy=/%20/g;function vu(e){return encodeURI(""+e).replace(iy,"|").replace(ry,"[").replace(sy,"]")}function ay(e){return vu(e).replace(Dh,"{").replace(bh,"}").replace(Ih,"^")}function na(e){return vu(e).replace(Fh,"%2B").replace(oy,"+").replace(Mh,"%23").replace(q0,"%26").replace(ly,"`").replace(Dh,"{").replace(bh,"}").replace(Ih,"^")}function uy(e){return na(e).replace(ty,"%3D")}function cy(e){return vu(e).replace(Mh,"%23").replace(ny,"%3F")}function fy(e){return e==null?"":cy(e).replace(ey,"%2F")}function ei(e){try{return decodeURIComponent(""+e)}catch{}return""+e}function dy(e){const t={};if(e===""||e==="?")return t;const r=(e[0]==="?"?e.slice(1):e).split("&");for(let s=0;sl&&na(l)):[r&&na(r)]).forEach(l=>{l!==void 0&&(t+=(t.length?"&":"")+n,l!=null&&(t+="="+l))})}return t}function hy(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=jt(r)?r.map(s=>s==null?null:""+s):r==null?r:""+r)}return t}const py=Symbol(""),uf=Symbol(""),yu=Symbol(""),jh=Symbol(""),ra=Symbol("");function ls(){let e=[];function t(r){return e.push(r),()=>{const s=e.indexOf(r);s>-1&&e.splice(s,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function xn(e,t,n,r,s){const l=r&&(r.enterCallbacks[s]=r.enterCallbacks[s]||[]);return()=>new Promise((i,o)=>{const a=d=>{d===!1?o($r(4,{from:n,to:t})):d instanceof Error?o(d):z0(d)?o($r(2,{from:t,to:d})):(l&&r.enterCallbacks[s]===l&&typeof d=="function"&&l.push(d),i())},u=e.call(r&&r.instances[s],t,n,a);let c=Promise.resolve(u);e.length<3&&(c=c.then(a)),c.catch(d=>o(d))})}function ho(e,t,n,r){const s=[];for(const l of e)for(const i in l.components){let o=l.components[i];if(!(t!=="beforeRouteEnter"&&!l.instances[i]))if(my(o)){const u=(o.__vccOpts||o)[t];u&&s.push(xn(u,n,r,l,i))}else{let a=o();s.push(()=>a.then(u=>{if(!u)return Promise.reject(new Error(`Couldn't resolve component "${i}" at "${l.path}"`));const c=x0(u)?u.default:u;l.components[i]=c;const p=(c.__vccOpts||c)[t];return p&&xn(p,n,r,l,i)()}))}}return s}function my(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function cf(e){const t=an(yu),n=an(jh),r=Mt(()=>t.resolve(Nr(e.to))),s=Mt(()=>{const{matched:a}=r.value,{length:u}=a,c=a[u-1],d=n.matched;if(!c||!d.length)return-1;const p=d.findIndex(Hr.bind(null,c));if(p>-1)return p;const w=ff(a[u-2]);return u>1&&ff(c)===w&&d[d.length-1].path!==w?d.findIndex(Hr.bind(null,a[u-2])):p}),l=Mt(()=>s.value>-1&&wy(n.params,r.value.params)),i=Mt(()=>s.value>-1&&s.value===n.matched.length-1&&Ph(n.params,r.value.params));function o(a={}){return yy(a)?t[Nr(e.replace)?"replace":"push"](Nr(e.to)).catch(Es):Promise.resolve()}return{route:r,href:Mt(()=>r.value.href),isActive:l,isExactActive:i,navigate:o}}const gy=Mi({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"}},useLink:cf,setup(e,{slots:t}){const n=Ti(cf(e)),{options:r}=an(yu),s=Mt(()=>({[df(e.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[df(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const l=t.default&&t.default(n);return e.custom?l:Oh("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:s.value},l)}}}),vy=gy;function yy(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){const t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function wy(e,t){for(const n in t){const r=t[n],s=e[n];if(typeof r=="string"){if(r!==s)return!1}else if(!jt(s)||s.length!==r.length||r.some((l,i)=>l!==s[i]))return!1}return!0}function ff(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const df=(e,t,n)=>e??t??n,Sy=Mi({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const r=an(ra),s=Mt(()=>e.route||r.value),l=an(uf,0),i=Mt(()=>{let u=Nr(l);const{matched:c}=s.value;let d;for(;(d=c[u])&&!d.components;)u++;return u}),o=Mt(()=>s.value.matched[i.value]);Nl(uf,Mt(()=>i.value+1)),Nl(py,o),Nl(ra,s);const a=Gd();return Rl(()=>[a.value,o.value,e.name],([u,c,d],[p,w,x])=>{c&&(c.instances[d]=u,w&&w!==c&&u&&u===p&&(c.leaveGuards.size||(c.leaveGuards=w.leaveGuards),c.updateGuards.size||(c.updateGuards=w.updateGuards))),u&&c&&(!w||!Hr(c,w)||!p)&&(c.enterCallbacks[d]||[]).forEach(_=>_(u))},{flush:"post"}),()=>{const u=s.value,c=e.name,d=o.value,p=d&&d.components[c];if(!p)return hf(n.default,{Component:p,route:u});const w=d.props[c],x=w?w===!0?u.params:typeof w=="function"?w(u):w:null,L=Oh(p,ce({},x,t,{onVnodeUnmounted:m=>{m.component.isUnmounted&&(d.instances[c]=null)},ref:a}));return hf(n.default,{Component:L,route:u})||L}}});function hf(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const xy=Sy;function Ey(e){const t=Y0(e.routes,e),n=e.parseQuery||dy,r=e.stringifyQuery||af,s=e.history,l=ls(),i=ls(),o=ls(),a=Dg(vn);let u=vn;mr&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=co.bind(null,A=>""+A),d=co.bind(null,fy),p=co.bind(null,ei);function w(A,V){let b,Q;return Th(A)?(b=t.getRecordMatcher(A),Q=V):Q=A,t.addRoute(Q,b)}function x(A){const V=t.getRecordMatcher(A);V&&t.removeRoute(V)}function _(){return t.getRoutes().map(A=>A.record)}function L(A){return!!t.getRecordMatcher(A)}function m(A,V){if(V=ce({},V||a.value),typeof A=="string"){const E=fo(n,A,V.path),O=t.resolve({path:E.path},V),T=s.createHref(E.fullPath);return ce(E,O,{params:p(O.params),hash:ei(E.hash),redirectedFrom:void 0,href:T})}let b;if("path"in A)b=ce({},A,{path:fo(n,A.path,V.path).path});else{const E=ce({},A.params);for(const O in E)E[O]==null&&delete E[O];b=ce({},A,{params:d(E)}),V.params=d(V.params)}const Q=t.resolve(b,V),le=A.hash||"";Q.params=c(p(Q.params));const g=C0(r,ce({},A,{hash:ay(le),path:Q.path})),v=s.createHref(g);return ce({fullPath:g,hash:le,query:r===af?hy(A.query):A.query||{}},Q,{redirectedFrom:void 0,href:v})}function f(A){return typeof A=="string"?fo(n,A,a.value.path):ce({},A)}function h(A,V){if(u!==A)return $r(8,{from:V,to:A})}function y(A){return k(A)}function S(A){return y(ce(f(A),{replace:!0}))}function C(A){const V=A.matched[A.matched.length-1];if(V&&V.redirect){const{redirect:b}=V;let Q=typeof b=="function"?b(A):b;return typeof Q=="string"&&(Q=Q.includes("?")||Q.includes("#")?Q=f(Q):{path:Q},Q.params={}),ce({query:A.query,hash:A.hash,params:"path"in Q?{}:A.params},Q)}}function k(A,V){const b=u=m(A),Q=a.value,le=A.state,g=A.force,v=A.replace===!0,E=C(b);if(E)return k(ce(f(E),{state:typeof E=="object"?ce({},le,E.state):le,force:g,replace:v}),V||b);const O=b;O.redirectedFrom=V;let T;return!g&&k0(r,Q,b)&&(T=$r(16,{to:O,from:Q}),te(Q,Q,!0,!1)),(T?Promise.resolve(T):U(O,Q)).catch(N=>qt(N)?qt(N,2)?N:K(N):P(N,O,Q)).then(N=>{if(N){if(qt(N,2))return k(ce({replace:v},f(N.to),{state:typeof N.to=="object"?ce({},le,N.to.state):le,force:g}),V||O)}else N=ke(O,Q,!0,v,le);return ee(O,Q,N),N})}function R(A,V){const b=h(A,V);return b?Promise.reject(b):Promise.resolve()}function D(A){const V=xe.values().next().value;return V&&typeof V.runWithContext=="function"?V.runWithContext(A):A()}function U(A,V){let b;const[Q,le,g]=_y(A,V);b=ho(Q.reverse(),"beforeRouteLeave",A,V);for(const E of Q)E.leaveGuards.forEach(O=>{b.push(xn(O,A,V))});const v=R.bind(null,A,V);return b.push(v),ue(b).then(()=>{b=[];for(const E of l.list())b.push(xn(E,A,V));return b.push(v),ue(b)}).then(()=>{b=ho(le,"beforeRouteUpdate",A,V);for(const E of le)E.updateGuards.forEach(O=>{b.push(xn(O,A,V))});return b.push(v),ue(b)}).then(()=>{b=[];for(const E of g)if(E.beforeEnter)if(jt(E.beforeEnter))for(const O of E.beforeEnter)b.push(xn(O,A,V));else b.push(xn(E.beforeEnter,A,V));return b.push(v),ue(b)}).then(()=>(A.matched.forEach(E=>E.enterCallbacks={}),b=ho(g,"beforeRouteEnter",A,V),b.push(v),ue(b))).then(()=>{b=[];for(const E of i.list())b.push(xn(E,A,V));return b.push(v),ue(b)}).catch(E=>qt(E,8)?E:Promise.reject(E))}function ee(A,V,b){o.list().forEach(Q=>D(()=>Q(A,V,b)))}function ke(A,V,b,Q,le){const g=h(A,V);if(g)return g;const v=V===vn,E=mr?history.state:{};b&&(Q||v?s.replace(A.fullPath,ce({scroll:v&&E&&E.scroll},le)):s.push(A.fullPath,le)),a.value=A,te(A,V,b,v),K()}let Le;function At(){Le||(Le=s.listen((A,V,b)=>{if(!et.listening)return;const Q=m(A),le=C(Q);if(le){k(ce(le,{replace:!0}),Q).catch(Es);return}u=Q;const g=a.value;mr&&M0(qc(g.fullPath,b.delta),zi()),U(Q,g).catch(v=>qt(v,12)?v:qt(v,2)?(k(v.to,Q).then(E=>{qt(E,20)&&!b.delta&&b.type===js.pop&&s.go(-1,!1)}).catch(Es),Promise.reject()):(b.delta&&s.go(-b.delta,!1),P(v,Q,g))).then(v=>{v=v||ke(Q,g,!1),v&&(b.delta&&!qt(v,8)?s.go(-b.delta,!1):b.type===js.pop&&qt(v,20)&&s.go(-1,!1)),ee(Q,g,v)}).catch(Es)}))}let Bt=ls(),ge=ls(),se;function P(A,V,b){K(A);const Q=ge.list();return Q.length?Q.forEach(le=>le(A,V,b)):console.error(A),Promise.reject(A)}function W(){return se&&a.value!==vn?Promise.resolve():new Promise((A,V)=>{Bt.add([A,V])})}function K(A){return se||(se=!A,At(),Bt.list().forEach(([V,b])=>A?b(A):V()),Bt.reset()),A}function te(A,V,b,Q){const{scrollBehavior:le}=e;if(!mr||!le)return Promise.resolve();const g=!b&&F0(qc(A.fullPath,0))||(Q||!b)&&history.state&&history.state.scroll||null;return Xd().then(()=>le(A,V,g)).then(v=>v&&N0(v)).catch(v=>P(v,A,V))}const Z=A=>s.go(A);let ct;const xe=new Set,et={currentRoute:a,listening:!0,addRoute:w,removeRoute:x,hasRoute:L,getRoutes:_,resolve:m,options:e,push:y,replace:S,go:Z,back:()=>Z(-1),forward:()=>Z(1),beforeEach:l.add,beforeResolve:i.add,afterEach:o.add,onError:ge.add,isReady:W,install(A){const V=this;A.component("RouterLink",vy),A.component("RouterView",xy),A.config.globalProperties.$router=V,Object.defineProperty(A.config.globalProperties,"$route",{enumerable:!0,get:()=>Nr(a)}),mr&&!ct&&a.value===vn&&(ct=!0,y(s.location).catch(le=>{}));const b={};for(const le in vn)Object.defineProperty(b,le,{get:()=>a.value[le],enumerable:!0});A.provide(yu,V),A.provide(jh,Vd(b)),A.provide(ra,a);const Q=A.unmount;xe.add(A),A.unmount=function(){xe.delete(A),xe.size<1&&(u=vn,Le&&Le(),Le=null,a.value=vn,ct=!1,se=!1),Q()}}};function ue(A){return A.reduce((V,b)=>V.then(()=>D(b)),Promise.resolve())}return et}function _y(e,t){const n=[],r=[],s=[],l=Math.max(t.matched.length,e.matched.length);for(let i=0;iHr(u,o))?r.push(o):n.push(o));const a=e.matched[i];a&&(t.matched.find(u=>Hr(u,a))||s.push(a))}return[n,r,s]}const Cy=Ey({history:j0(),linkActiveClass:"active",routes:[{path:"/",name:"Home",component:()=>Xt(()=>import("./home.js"),__vite__mapDeps([0,1]))},{path:"/install",name:"Install",component:()=>Xt(()=>import("./install.js"),__vite__mapDeps([]))},{path:"/selects",name:"Selects",component:()=>Xt(()=>import("./selects.js"),__vite__mapDeps([]))},{path:"/data",name:"Data",component:()=>Xt(()=>import("./data.js"),__vite__mapDeps([]))},{path:"/settings",name:"Settings",component:()=>Xt(()=>import("./index2.js"),__vite__mapDeps([2,3]))},{path:"/events",name:"Events",component:()=>Xt(()=>import("./index3.js"),__vite__mapDeps([]))},{path:"/methods",name:"Methods",component:()=>Xt(()=>import("./index4.js"),__vite__mapDeps([]))},{path:"/vue",name:"Vue",component:()=>Xt(()=>import("./vue.js"),__vite__mapDeps([]))},{path:"/react",name:"React",component:()=>Xt(()=>import("./react.js"),__vite__mapDeps([]))}]});function wu(){return Math.random().toString(36).substring(2,10)}function ky(e,t){function n(s,l){return l&&s&&s.classList&&s.classList.contains(l)||l&&s&&s.dataset&&s.dataset.id&&s.dataset.id===t?s:null}function r(s,l){return!s||s===document?null:n(s,l)?s:r(s.parentNode,l)}return n(e,t)||r(e,t)}function Cs(e,t=50,n=!1){let r;return function(...s){const l=self,i=()=>{r=null,n||e.apply(l,s)},o=n&&!r;clearTimeout(r),r=setTimeout(i,t),o&&e.apply(l,s)}}function po(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Ay(e){const t=e.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,n=>"-"+n.toLowerCase());return e[0]===e[0].toUpperCase()?t.substring(1):t}class Lt{constructor(t){if(this.id=!t.id||t.id===""?wu():t.id,this.label=t.label||"",this.selectAll=t.selectAll===void 0?!1:t.selectAll,this.selectAllText=t.selectAllText||"Select All",this.closable=t.closable||"off",this.options=[],t.options)for(const n of t.options)this.options.push(new He(n))}}class He{constructor(t){this.id=!t.id||t.id===""?wu():t.id,this.value=t.value===void 0?t.text:t.value,this.text=t.text||"",this.html=t.html||"",this.selected=t.selected!==void 0?t.selected:!1,this.display=t.display!==void 0?t.display:!0,this.disabled=t.disabled!==void 0?t.disabled:!1,this.mandatory=t.mandatory!==void 0?t.mandatory:!1,this.placeholder=t.placeholder!==void 0?t.placeholder:!1,this.class=t.class||"",this.style=t.style||"",this.data=t.data||{}}}class Oy{constructor(t,n){this.selectType="single",this.data=[],this.selectType=t,this.setData(n)}validateDataArray(t){if(!Array.isArray(t))return new Error("Data must be an array");for(let n of t)if(n instanceof Lt||"label"in n){if(!("label"in n))return new Error("Optgroup must have a label");if("options"in n&&n.options)for(let r of n.options)return this.validateOption(r)}else return n instanceof He||"text"in n?this.validateOption(n):new Error("Data object must be a valid optgroup or option");return null}validateOption(t){return"text"in t?null:new Error("Option must have a text")}partialToFullData(t){let n=[];return t.forEach(r=>{if(r instanceof Lt||"label"in r){let s=[];"options"in r&&r.options&&r.options.forEach(l=>{s.push(new He(l))}),s.length>0&&n.push(new Lt(r))}(r instanceof He||"text"in r)&&n.push(new He(r))}),n}setData(t){this.data=this.partialToFullData(t),this.selectType==="single"&&this.setSelectedBy("id",this.getSelected())}getData(){return this.filter(null,!0)}getDataOptions(){return this.filter(null,!1)}addOption(t){this.setData(this.getData().concat(new He(t)))}setSelectedBy(t,n){let r=null,s=!1;for(let l of this.data){if(l instanceof Lt)for(let i of l.options)r||(r=i),i.selected=s?!1:n.includes(i[t]),i.selected&&this.selectType==="single"&&(s=!0);l instanceof He&&(r||(r=l),l.selected=s?!1:n.includes(l[t]),l.selected&&this.selectType==="single"&&(s=!0))}this.selectType==="single"&&r&&!s&&(r.selected=!0)}getSelected(){return this.getSelectedOptions().map(t=>t.id)}getSelectedOptions(){return this.filter(t=>t.selected,!1)}getOptgroupByID(t){for(let n of this.data)if(n instanceof Lt&&n.id===t)return n;return null}getOptionByID(t){let n=this.filter(r=>r.id===t,!1);return n.length?n[0]:null}getSelectType(){return this.selectType}getFirstOption(){let t=null;for(let n of this.data)if(n instanceof Lt?t=n.options[0]:n instanceof He&&(t=n),t)break;return t}search(t,n){return t=t.trim(),t===""?this.getData():this.filter(r=>n(r,t),!0)}filter(t,n){const r=[];return this.data.forEach(s=>{if(s instanceof Lt){let l=[];if(s.options.forEach(i=>{(!t||t(i))&&(n?l.push(new He(i)):r.push(new He(i)))}),l.length>0){let i=new Lt(s);i.options=l,r.push(i)}}s instanceof He&&(!t||t(s))&&r.push(new He(s))}),r}}class Py{constructor(t,n,r){this.classes={main:"ss-main",placeholder:"ss-placeholder",values:"ss-values",single:"ss-single",max:"ss-max",value:"ss-value",valueText:"ss-value-text",valueDelete:"ss-value-delete",valueOut:"ss-value-out",deselect:"ss-deselect",deselectPath:"M10,10 L90,90 M10,90 L90,10",arrow:"ss-arrow",arrowClose:"M10,30 L50,70 L90,30",arrowOpen:"M10,70 L50,30 L90,70",content:"ss-content",openAbove:"ss-open-above",openBelow:"ss-open-below",search:"ss-search",searchHighlighter:"ss-search-highlight",searching:"ss-searching",addable:"ss-addable",addablePath:"M50,10 L50,90 M10,50 L90,50",list:"ss-list",optgroup:"ss-optgroup",optgroupLabel:"ss-optgroup-label",optgroupLabelText:"ss-optgroup-label-text",optgroupActions:"ss-optgroup-actions",optgroupSelectAll:"ss-selectall",optgroupSelectAllBox:"M60,10 L10,10 L10,90 L90,90 L90,50",optgroupSelectAllCheck:"M30,45 L50,70 L90,10",optgroupClosable:"ss-closable",option:"ss-option",optionDelete:"M10,10 L90,90 M10,90 L90,10",highlighted:"ss-highlighted",open:"ss-open",close:"ss-close",selected:"ss-selected",error:"ss-error",disabled:"ss-disabled",hide:"ss-hide"},this.store=n,this.settings=t,this.callbacks=r,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes(),this.settings.contentLocation.appendChild(this.content.main)}enable(){this.main.main.classList.remove(this.classes.disabled),this.content.search.input.disabled=!1}disable(){this.main.main.classList.add(this.classes.disabled),this.content.search.input.disabled=!0}open(){this.main.arrow.path.setAttribute("d",this.classes.arrowOpen),this.main.main.classList.add(this.settings.openPosition==="up"?this.classes.openAbove:this.classes.openBelow),this.main.main.setAttribute("aria-expanded","true"),this.moveContent();const t=this.store.getSelectedOptions();if(t.length){const n=t[t.length-1].id,r=this.content.list.querySelector('[data-id="'+n+'"]');r&&this.ensureElementInView(this.content.list,r)}}close(){this.main.main.classList.remove(this.classes.openAbove),this.main.main.classList.remove(this.classes.openBelow),this.main.main.setAttribute("aria-expanded","false"),this.content.main.classList.remove(this.classes.openAbove),this.content.main.classList.remove(this.classes.openBelow),this.main.arrow.path.setAttribute("d",this.classes.arrowClose)}updateClassStyles(){if(this.main.main.className="",this.main.main.removeAttribute("style"),this.content.main.className="",this.content.main.removeAttribute("style"),this.main.main.classList.add(this.classes.main),this.content.main.classList.add(this.classes.content),this.settings.style!==""&&(this.main.main.style.cssText=this.settings.style,this.content.main.style.cssText=this.settings.style),this.settings.class.length)for(const t of this.settings.class)t.trim()!==""&&(this.main.main.classList.add(t.trim()),this.content.main.classList.add(t.trim()));this.settings.contentPosition==="relative"&&this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){this.main.main.role="combobox",this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.main.id),this.main.main.setAttribute("aria-expanded","false"),this.content.main.setAttribute("role","listbox")}mainDiv(){var u;const t=document.createElement("div");t.dataset.id=this.settings.id,t.setAttribute("aria-label",this.settings.ariaLabel),t.tabIndex=0,t.onkeydown=c=>{switch(c.key){case"ArrowUp":case"ArrowDown":return this.callbacks.open(),c.key==="ArrowDown"?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Enter":case" ":this.callbacks.open();const d=this.content.list.querySelector("."+this.classes.highlighted);return d&&d.click(),!1;case"Escape":return this.callbacks.close(),!1}return!1},t.onclick=c=>{this.settings.disabled||(this.settings.isOpen?this.callbacks.close():this.callbacks.open())};const n=document.createElement("div");n.classList.add(this.classes.values),t.appendChild(n);const r=document.createElement("div");r.classList.add(this.classes.deselect);const s=(u=this.store)==null?void 0:u.getSelectedOptions();!this.settings.allowDeselect||this.settings.isMultiple&&s&&s.length<=0?r.classList.add(this.classes.hide):r.classList.remove(this.classes.hide),r.onclick=c=>{if(c.stopPropagation(),this.settings.disabled)return;let d=!0;const p=this.store.getSelectedOptions(),w=[];if(this.callbacks.beforeChange&&(d=this.callbacks.beforeChange(w,p)===!0),d){if(this.settings.isMultiple)this.callbacks.setSelected([],!1),this.updateDeselectAll();else{const x=this.store.getFirstOption(),_=x?x.id:"";this.callbacks.setSelected(_,!1)}this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(this.store.getSelectedOptions())}};const l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.setAttribute("viewBox","0 0 100 100");const i=document.createElementNS("http://www.w3.org/2000/svg","path");i.setAttribute("d",this.classes.deselectPath),l.appendChild(i),r.appendChild(l),t.appendChild(r);const o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.classList.add(this.classes.arrow),o.setAttribute("viewBox","0 0 100 100");const a=document.createElementNS("http://www.w3.org/2000/svg","path");return a.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&o.classList.add(this.classes.hide),o.appendChild(a),t.appendChild(o),{main:t,values:n,deselect:{main:r,svg:l,path:i},arrow:{main:o,path:a}}}mainFocus(t){t!=="click"&&this.main.main.focus({preventScroll:!0})}placeholder(){const t=this.store.filter(s=>s.placeholder,!1);let n=this.settings.placeholderText;t.length&&(t[0].html!==""?n=t[0].html:t[0].text!==""&&(n=t[0].text));const r=document.createElement("div");return r.classList.add(this.classes.placeholder),r.innerHTML=n,r}renderValues(){if(!this.settings.isMultiple){this.renderSingleValue();return}this.renderMultipleValues(),this.updateDeselectAll()}renderSingleValue(){const t=this.store.filter(r=>r.selected&&!r.placeholder,!1),n=t.length>0?t[0]:null;if(!n)this.main.values.innerHTML=this.placeholder().outerHTML;else{const r=document.createElement("div");r.classList.add(this.classes.single),n.html?r.innerHTML=n.html:r.innerText=n.text,this.main.values.innerHTML=r.outerHTML}!this.settings.allowDeselect||!t.length?this.main.deselect.main.classList.add(this.classes.hide):this.main.deselect.main.classList.remove(this.classes.hide)}renderMultipleValues(){let t=this.main.values.childNodes,n=this.store.filter(s=>s.selected&&s.display,!1);if(n.length===0){this.main.values.innerHTML=this.placeholder().outerHTML;return}else{const s=this.main.values.querySelector("."+this.classes.placeholder);s&&s.remove()}if(n.length>this.settings.maxValuesShown){const s=document.createElement("div");s.classList.add(this.classes.max),s.textContent=this.settings.maxValuesMessage.replace("{number}",n.length.toString()),this.main.values.innerHTML=s.outerHTML;return}else{const s=this.main.values.querySelector("."+this.classes.max);s&&s.remove()}let r=[];for(let s=0;sa.id===i,!1).length||r.push(l))}for(const s of r)s.classList.add(this.classes.valueOut),setTimeout(()=>{this.main.values.hasChildNodes()&&this.main.values.contains(s)&&this.main.values.removeChild(s)},100);t=this.main.values.childNodes;for(let s=0;s{if(o.preventDefault(),o.stopPropagation(),this.settings.disabled)return;let a=!0;const u=this.store.getSelectedOptions(),c=u.filter(d=>d.selected&&d.id!==t.id,!0);if(!(this.settings.minSelected&&c.length{this.callbacks.search(l.target.value)},100),n.onkeydown=l=>{switch(l.key){case"ArrowUp":case"ArrowDown":return l.key==="ArrowDown"?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Escape":return this.callbacks.close(),!1;case"Enter":case" ":if(this.callbacks.addable&&l.ctrlKey)return r.click(),!1;{const i=this.content.list.querySelector("."+this.classes.highlighted);if(i)return i.click(),!1}return!0}return!0},t.appendChild(n),this.callbacks.addable){r.classList.add(this.classes.addable);const l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.setAttribute("viewBox","0 0 100 100");const i=document.createElementNS("http://www.w3.org/2000/svg","path");i.setAttribute("d",this.classes.addablePath),l.appendChild(i),r.appendChild(l),r.onclick=o=>{if(o.preventDefault(),o.stopPropagation(),!this.callbacks.addable)return;const a=this.content.search.input.value.trim();if(a===""){this.content.search.input.focus();return}const u=d=>{let p=new He(d);if(this.callbacks.addOption(p),this.settings.isMultiple){let w=this.store.getSelected();w.push(p.id),this.callbacks.setSelected(w,!0)}else this.callbacks.setSelected([p.id],!0);this.callbacks.search(""),this.settings.closeOnSelect&&setTimeout(()=>{this.callbacks.close()},100)},c=this.callbacks.addable(a);c===!1||c===void 0||c===null||(c instanceof Promise?c.then(d=>{u(typeof d=="string"?{text:d,value:d}:d)}):u(typeof c=="string"?{text:c,value:c}:c))},t.appendChild(r),s.addable={main:r,svg:l,path:i}}return s}searchFocus(){this.content.search.input.focus()}getOptions(t=!1,n=!1,r=!1){let s="."+this.classes.option;return t&&(s+=":not(."+this.classes.placeholder+")"),n&&(s+=":not(."+this.classes.disabled+")"),r&&(s+=":not(."+this.classes.hide+")"),Array.from(this.content.list.querySelectorAll(s))}highlight(t){const n=this.getOptions(!0,!0,!0);if(n.length===0)return;if(n.length===1&&!n[0].classList.contains(this.classes.highlighted)){n[0].classList.add(this.classes.highlighted);return}let r=!1;for(const s of n)s.classList.contains(this.classes.highlighted)&&(r=!0);if(!r){for(const s of n)if(s.classList.contains(this.classes.selected)){s.classList.add(this.classes.highlighted);break}}for(let s=0;s=0?s-1:n.length-1];o.classList.add(this.classes.highlighted),this.ensureElementInView(this.content.list,o);const a=o.parentElement;if(a&&a.classList.contains(this.classes.close)){const u=a.querySelector("."+this.classes.optgroupLabel);u&&u.click()}return}n[t==="down"?0:n.length-1].classList.add(this.classes.highlighted),this.ensureElementInView(this.content.list,n[t==="down"?0:n.length-1])}listDiv(){const t=document.createElement("div");return t.classList.add(this.classes.list),t}renderError(t){this.content.list.innerHTML="";const n=document.createElement("div");n.classList.add(this.classes.error),n.textContent=t,this.content.list.appendChild(n)}renderSearching(){this.content.list.innerHTML="";const t=document.createElement("div");t.classList.add(this.classes.searching),t.textContent=this.settings.searchingText,this.content.list.appendChild(t)}renderOptions(t){if(this.content.list.innerHTML="",t.length===0){const n=document.createElement("div");n.classList.add(this.classes.search),n.innerHTML=this.settings.searchText,this.content.list.appendChild(n);return}for(const n of t){if(n instanceof Lt){const r=document.createElement("div");r.classList.add(this.classes.optgroup);const s=document.createElement("div");s.classList.add(this.classes.optgroupLabel),r.appendChild(s);const l=document.createElement("div");l.classList.add(this.classes.optgroupLabelText),l.textContent=n.label,s.appendChild(l);const i=document.createElement("div");if(i.classList.add(this.classes.optgroupActions),s.appendChild(i),this.settings.isMultiple&&n.selectAll){const o=document.createElement("div");o.classList.add(this.classes.optgroupSelectAll);let a=!0;for(const w of n.options)if(!w.selected){a=!1;break}a&&o.classList.add(this.classes.selected);const u=document.createElement("span");u.textContent=n.selectAllText,o.appendChild(u);const c=document.createElementNS("http://www.w3.org/2000/svg","svg");c.setAttribute("viewBox","0 0 100 100"),o.appendChild(c);const d=document.createElementNS("http://www.w3.org/2000/svg","path");d.setAttribute("d",this.classes.optgroupSelectAllBox),c.appendChild(d);const p=document.createElementNS("http://www.w3.org/2000/svg","path");p.setAttribute("d",this.classes.optgroupSelectAllCheck),c.appendChild(p),o.addEventListener("click",w=>{w.preventDefault(),w.stopPropagation();const x=this.store.getSelected();if(a){const _=x.filter(L=>{for(const m of n.options)if(L===m.id)return!1;return!0});this.callbacks.setSelected(_,!0);return}else{const _=x.concat(n.options.map(L=>L.id));for(const L of n.options)this.store.getOptionByID(L.id)||this.callbacks.addOption(L);this.callbacks.setSelected(_,!0);return}}),i.appendChild(o)}if(n.closable!=="off"){const o=document.createElement("div");o.classList.add(this.classes.optgroupClosable);const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100"),a.classList.add(this.classes.arrow),o.appendChild(a);const u=document.createElementNS("http://www.w3.org/2000/svg","path");a.appendChild(u),n.options.some(c=>c.selected)||this.content.search.input.value.trim()!==""?(o.classList.add(this.classes.open),u.setAttribute("d",this.classes.arrowOpen)):n.closable==="open"?(r.classList.add(this.classes.open),u.setAttribute("d",this.classes.arrowOpen)):n.closable==="close"&&(r.classList.add(this.classes.close),u.setAttribute("d",this.classes.arrowClose)),s.addEventListener("click",c=>{c.preventDefault(),c.stopPropagation(),r.classList.contains(this.classes.close)?(r.classList.remove(this.classes.close),r.classList.add(this.classes.open),u.setAttribute("d",this.classes.arrowOpen)):(r.classList.remove(this.classes.open),r.classList.add(this.classes.close),u.setAttribute("d",this.classes.arrowClose))}),i.appendChild(o)}r.appendChild(s);for(const o of n.options)r.appendChild(this.option(o));this.content.list.appendChild(r)}n instanceof He&&this.content.list.appendChild(this.option(n))}}option(t){if(t.placeholder){const r=document.createElement("div");return r.classList.add(this.classes.option),r.classList.add(this.classes.hide),r}const n=document.createElement("div");return n.dataset.id=t.id,n.id=t.id,n.classList.add(this.classes.option),n.setAttribute("role","option"),t.class&&t.class.split(" ").forEach(r=>{n.classList.add(r)}),t.style&&(n.style.cssText=t.style),this.settings.searchHighlight&&this.content.search.input.value.trim()!==""?n.innerHTML=this.highlightText(t.html!==""?t.html:t.text,this.content.search.input.value,this.classes.searchHighlighter):t.html!==""?n.innerHTML=t.html:n.textContent=t.text,this.settings.showOptionTooltips&&n.textContent&&n.setAttribute("title",n.textContent),t.display||n.classList.add(this.classes.hide),t.disabled&&n.classList.add(this.classes.disabled),t.selected&&this.settings.hideSelected&&n.classList.add(this.classes.hide),t.selected?(n.classList.add(this.classes.selected),n.setAttribute("aria-selected","true"),this.main.main.setAttribute("aria-activedescendant",n.id)):(n.classList.remove(this.classes.selected),n.setAttribute("aria-selected","false")),n.addEventListener("click",r=>{r.preventDefault(),r.stopPropagation();const s=this.store.getSelected(),l=r.currentTarget,i=String(l.dataset.id);if(t.disabled||t.selected&&!this.settings.allowDeselect||this.settings.isMultiple&&this.settings.maxSelected<=s.length&&!t.selected||this.settings.isMultiple&&this.settings.minSelected>=s.length&&t.selected)return;let o=!1;const a=this.store.getSelectedOptions();let u=[];this.settings.isMultiple&&(t.selected?u=a.filter(c=>c.id!==i):u=a.concat(t)),this.settings.isMultiple||(t.selected?u=[]:u=[t]),this.callbacks.beforeChange||(o=!0),this.callbacks.beforeChange&&(this.callbacks.beforeChange(u,a)===!1?o=!1:o=!0),o&&(this.store.getOptionByID(i)||this.callbacks.addOption(t),this.callbacks.setSelected(u.map(c=>c.id),!1),this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(u))}),n}destroy(){this.main.main.remove(),this.content.main.remove()}highlightText(t,n,r){let s=t;const l=new RegExp("("+n.trim()+")(?![^<]*>[^<>]*${a}`),s}moveContentAbove(){const t=this.main.main.offsetHeight,n=this.content.main.offsetHeight;this.main.main.classList.remove(this.classes.openBelow),this.main.main.classList.add(this.classes.openAbove),this.content.main.classList.remove(this.classes.openBelow),this.content.main.classList.add(this.classes.openAbove);const r=this.main.main.getBoundingClientRect();this.content.main.style.margin="-"+(t+n-1)+"px 0px 0px 0px",this.content.main.style.top=r.top+r.height+window.scrollY+"px",this.content.main.style.left=r.left+window.scrollX+"px",this.content.main.style.width=r.width+"px"}moveContentBelow(){this.main.main.classList.remove(this.classes.openAbove),this.main.main.classList.add(this.classes.openBelow),this.content.main.classList.remove(this.classes.openAbove),this.content.main.classList.add(this.classes.openBelow);const t=this.main.main.getBoundingClientRect();this.content.main.style.margin="-1px 0px 0px 0px",this.settings.contentPosition!=="relative"&&(this.content.main.style.top=t.top+t.height+window.scrollY+"px",this.content.main.style.left=t.left+window.scrollX+"px",this.content.main.style.width=t.width+"px")}ensureElementInView(t,n){const r=t.scrollTop+t.offsetTop,s=r+t.clientHeight,l=n.offsetTop,i=l+n.clientHeight;ls&&(t.scrollTop+=i-s)}putContent(){const t=this.main.main.offsetHeight,n=this.main.main.getBoundingClientRect(),r=this.content.main.offsetHeight;return window.innerHeight-(n.top+t)<=r&&n.top>r?"up":"down"}updateDeselectAll(){if(!this.store||!this.settings)return;const t=this.store.getSelectedOptions(),n=t&&t.length>0,r=this.settings.isMultiple,s=this.settings.allowDeselect,l=this.main.deselect.main,i=this.classes.hide;s&&!(r&&!n)?l.classList.remove(i):l.classList.add(i)}}class Ly{constructor(t){this.listen=!1,this.observer=null,this.select=t,this.valueChange=this.valueChange.bind(this),this.select.addEventListener("change",this.valueChange,{passive:!0}),this.observer=new MutationObserver(this.observeCall.bind(this)),this.changeListen(!0)}enable(){this.select.disabled=!1}disable(){this.select.disabled=!0}hideUI(){this.select.tabIndex=-1,this.select.style.display="none",this.select.setAttribute("aria-hidden","true")}showUI(){this.select.removeAttribute("tabindex"),this.select.style.display="",this.select.removeAttribute("aria-hidden")}changeListen(t){this.listen=t,t&&this.observer&&this.observer.observe(this.select,{subtree:!0,childList:!0,attributes:!0}),t||this.observer&&this.observer.disconnect()}valueChange(t){return this.listen&&this.onValueChange&&this.onValueChange(this.getSelectedOptions()),!0}observeCall(t){if(!this.listen)return;let n=!1,r=!1,s=!1;for(const l of t)l.target===this.select&&(l.attributeName==="disabled"&&(r=!0),l.attributeName==="class"&&(n=!0)),(l.target.nodeName==="OPTGROUP"||l.target.nodeName==="OPTION")&&(s=!0);n&&this.onClassChange&&this.onClassChange(this.select.className.split(" ")),r&&this.onDisabledChange&&(this.changeListen(!1),this.onDisabledChange(this.select.disabled),this.changeListen(!0)),s&&this.onOptionsChange&&(this.changeListen(!1),this.onOptionsChange(this.getData()),this.changeListen(!0))}getData(){let t=[];const n=this.select.childNodes;for(const r of n)r.nodeName==="OPTGROUP"&&t.push(this.getDataFromOptgroup(r)),r.nodeName==="OPTION"&&t.push(this.getDataFromOption(r));return t}getDataFromOptgroup(t){let n={id:t.id,label:t.label,selectAll:t.dataset?t.dataset.selectall==="true":!1,selectAllText:t.dataset?t.dataset.selectalltext:"Select all",closable:t.dataset?t.dataset.closable:"off",options:[]};const r=t.childNodes;for(const s of r)s.nodeName==="OPTION"&&n.options.push(this.getDataFromOption(s));return n}getDataFromOption(t){return{id:t.id,value:t.value,text:t.text,html:t.dataset&&t.dataset.html?t.dataset.html:"",selected:t.selected,display:t.style.display!=="none",disabled:t.disabled,mandatory:t.dataset?t.dataset.mandatory==="true":!1,placeholder:t.dataset.placeholder==="true",class:t.className,style:t.style.cssText,data:t.dataset}}getSelectedOptions(){let t=[];const n=this.select.childNodes;for(const r of n){if(r.nodeName==="OPTGROUP"){const s=r.childNodes;for(const l of s)if(l.nodeName==="OPTION"){const i=l;i.selected&&t.push(this.getDataFromOption(i))}}if(r.nodeName==="OPTION"){const s=r;s.selected&&t.push(this.getDataFromOption(s))}}return t}getSelectedValues(){return this.getSelectedOptions().map(t=>t.value)}setSelected(t){this.changeListen(!1);const n=this.select.childNodes;for(const r of n){if(r.nodeName==="OPTGROUP"){const l=r.childNodes;for(const i of l)if(i.nodeName==="OPTION"){const o=i;o.selected=t.includes(o.id)}}if(r.nodeName==="OPTION"){const s=r;s.selected=t.includes(s.id)}}this.changeListen(!0)}updateSelect(t,n,r){this.changeListen(!1),t&&(this.select.dataset.id=t),n&&(this.select.style.cssText=n),r&&(this.select.className="",r.forEach(s=>{s.trim()!==""&&this.select.classList.add(s.trim())})),this.changeListen(!0)}updateOptions(t){this.changeListen(!1),this.select.innerHTML="";for(const n of t)n instanceof Lt&&this.select.appendChild(this.createOptgroup(n)),n instanceof He&&this.select.appendChild(this.createOption(n));this.select.dispatchEvent(new Event("change")),this.changeListen(!0)}createOptgroup(t){const n=document.createElement("optgroup");if(n.id=t.id,n.label=t.label,t.selectAll&&(n.dataset.selectAll="true"),t.closable!=="off"&&(n.dataset.closable=t.closable),t.options)for(const r of t.options)n.appendChild(this.createOption(r));return n}createOption(t){const n=document.createElement("option");return n.id=t.id,n.value=t.value,n.innerHTML=t.text,t.html!==""&&n.setAttribute("data-html",t.html),t.selected&&(n.selected=t.selected),t.disabled&&(n.disabled=!0),t.display===!1&&(n.style.display="none"),t.placeholder&&n.setAttribute("data-placeholder","true"),t.mandatory&&n.setAttribute("data-mandatory","true"),t.class&&t.class.split(" ").forEach(r=>{n.classList.add(r)}),t.data&&typeof t.data=="object"&&Object.keys(t.data).forEach(r=>{n.setAttribute("data-"+Ay(r),t.data[r])}),n}destroy(){this.changeListen(!1),this.select.removeEventListener("change",this.valueChange),this.observer&&(this.observer.disconnect(),this.observer=null),delete this.select.dataset.id,this.showUI()}}class Ty{constructor(t){this.id="",this.style="",this.class=[],this.isMultiple=!1,this.isOpen=!1,this.isFullOpen=!1,this.intervalMove=null,t||(t={}),this.id="ss-"+wu(),this.style=t.style||"",this.class=t.class||[],this.disabled=t.disabled!==void 0?t.disabled:!1,this.alwaysOpen=t.alwaysOpen!==void 0?t.alwaysOpen:!1,this.showSearch=t.showSearch!==void 0?t.showSearch:!0,this.ariaLabel=t.ariaLabel||"Combobox",this.searchPlaceholder=t.searchPlaceholder||"Search",this.searchText=t.searchText||"No Results",this.searchingText=t.searchingText||"Searching...",this.searchHighlight=t.searchHighlight!==void 0?t.searchHighlight:!1,this.closeOnSelect=t.closeOnSelect!==void 0?t.closeOnSelect:!0,this.contentLocation=t.contentLocation||document.body,this.contentPosition=t.contentPosition||"absolute",this.openPosition=t.openPosition||"auto",this.placeholderText=t.placeholderText!==void 0?t.placeholderText:"Select Value",this.allowDeselect=t.allowDeselect!==void 0?t.allowDeselect:!1,this.hideSelected=t.hideSelected!==void 0?t.hideSelected:!1,this.keepOrder=t.keepOrder!==void 0?t.keepOrder:!1,this.showOptionTooltips=t.showOptionTooltips!==void 0?t.showOptionTooltips:!1,this.minSelected=t.minSelected||0,this.maxSelected=t.maxSelected||1e3,this.timeoutDelay=t.timeoutDelay||200,this.maxValuesShown=t.maxValuesShown||20,this.maxValuesMessage=t.maxValuesMessage||"{number} selected"}}let zh=class{constructor(t){var i;if(this.events={search:void 0,searchFilter:(o,a)=>o.text.toLowerCase().indexOf(a.toLowerCase())!==-1,addable:void 0,beforeChange:void 0,afterChange:void 0,beforeOpen:void 0,afterOpen:void 0,beforeClose:void 0,afterClose:void 0},this.windowResize=Cs(()=>{!this.settings.isOpen&&!this.settings.isFullOpen||this.render.moveContent()}),this.windowScroll=Cs(()=>{!this.settings.isOpen&&!this.settings.isFullOpen||this.render.moveContent()}),this.documentClick=o=>{this.settings.isOpen&&o.target&&!ky(o.target,this.settings.id)&&this.close(o.type)},this.windowVisibilityChange=()=>{document.hidden&&this.close()},this.selectEl=typeof t.select=="string"?document.querySelector(t.select):t.select,!this.selectEl){t.events&&t.events.error&&t.events.error(new Error("Could not find select element"));return}if(this.selectEl.tagName!=="SELECT"){t.events&&t.events.error&&t.events.error(new Error("Element isnt of type select"));return}this.selectEl.dataset.ssid&&this.destroy(),this.settings=new Ty(t.settings);const n=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const o in t.events)t.events.hasOwnProperty(o)&&(n.indexOf(o)!==-1?this.events[o]=Cs(t.events[o],100):this.events[o]=t.events[o]);this.settings.disabled=(i=t.settings)!=null&&i.disabled?t.settings.disabled:this.selectEl.disabled,this.settings.isMultiple=this.selectEl.multiple,this.settings.style=this.selectEl.style.cssText,this.settings.class=this.selectEl.className.split(" "),this.select=new Ly(this.selectEl),this.select.updateSelect(this.settings.id,this.settings.style,this.settings.class),this.select.hideUI(),this.select.onValueChange=o=>{this.setSelected(o.map(a=>a.id))},this.select.onClassChange=o=>{this.settings.class=o,this.render.updateClassStyles()},this.select.onDisabledChange=o=>{o?this.disable():this.enable()},this.select.onOptionsChange=o=>{this.setData(o)},this.store=new Oy(this.settings.isMultiple?"multiple":"single",t.data?t.data:this.select.getData()),t.data&&this.select.updateOptions(this.store.getData());const r={open:this.open.bind(this),close:this.close.bind(this),addable:this.events.addable?this.events.addable:void 0,setSelected:this.setSelected.bind(this),addOption:this.addOption.bind(this),search:this.search.bind(this),beforeChange:this.events.beforeChange,afterChange:this.events.afterChange};this.render=new Py(this.settings,this.store,r),this.render.renderValues(),this.render.renderOptions(this.store.getData());const s=this.selectEl.getAttribute("aria-label"),l=this.selectEl.getAttribute("aria-labelledby");s?this.render.main.main.setAttribute("aria-label",s):l&&this.render.main.main.setAttribute("aria-labelledby",l),this.selectEl.parentNode&&this.selectEl.parentNode.insertBefore(this.render.main.main,this.selectEl.nextSibling),window.addEventListener("resize",this.windowResize,!1),this.settings.openPosition==="auto"&&window.addEventListener("scroll",this.windowScroll,!1),document.addEventListener("visibilitychange",this.windowVisibilityChange),this.settings.disabled&&this.disable(),this.settings.alwaysOpen&&this.open(),this.selectEl.slim=this}enable(){this.settings.disabled=!1,this.select.enable(),this.render.enable()}disable(){this.settings.disabled=!0,this.select.disable(),this.render.disable()}getData(){return this.store.getData()}setData(t){const n=this.store.getSelected(),r=this.store.validateDataArray(t);if(r){this.events.error&&this.events.error(r);return}this.store.setData(t);const s=this.store.getData();this.select.updateOptions(s),this.render.renderValues(),this.render.renderOptions(s),this.events.afterChange&&!po(n,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){return this.store.getSelected()}setSelected(t,n=!0){const r=this.store.getSelected();this.store.setSelectedBy("id",Array.isArray(t)?t:[t]);const s=this.store.getData();this.select.updateOptions(s),this.render.renderValues(),this.render.content.search.input.value!==""?this.search(this.render.content.search.input.value):this.render.renderOptions(s),n&&this.events.afterChange&&!po(r,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}addOption(t){const n=this.store.getSelected();this.store.getDataOptions().some(s=>s.value===(t.value??t.text))||this.store.addOption(t);const r=this.store.getData();this.select.updateOptions(r),this.render.renderValues(),this.render.renderOptions(r),this.events.afterChange&&!po(n,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}open(){this.settings.disabled||this.settings.isOpen||(this.events.beforeOpen&&this.events.beforeOpen(),this.render.open(),this.settings.showSearch&&this.render.searchFocus(),this.settings.isOpen=!0,setTimeout(()=>{this.events.afterOpen&&this.events.afterOpen(),this.settings.isOpen&&(this.settings.isFullOpen=!0),document.addEventListener("click",this.documentClick)},this.settings.timeoutDelay),this.settings.contentPosition==="absolute"&&(this.settings.intervalMove&&clearInterval(this.settings.intervalMove),this.settings.intervalMove=setInterval(this.render.moveContent.bind(this.render),500)))}close(t=null){!this.settings.isOpen||this.settings.alwaysOpen||(this.events.beforeClose&&this.events.beforeClose(),this.render.close(),this.render.content.search.input.value!==""&&this.search(""),this.render.mainFocus(t),this.settings.isOpen=!1,this.settings.isFullOpen=!1,setTimeout(()=>{this.events.afterClose&&this.events.afterClose(),document.removeEventListener("click",this.documentClick)},this.settings.timeoutDelay),this.settings.intervalMove&&clearInterval(this.settings.intervalMove))}search(t){if(this.render.content.search.input.value!==t&&(this.render.content.search.input.value=t),!this.events.search){this.render.renderOptions(t===""?this.store.getData():this.store.search(t,this.events.searchFilter));return}this.render.renderSearching();const n=this.events.search(t,this.store.getSelectedOptions());if(n instanceof Promise){n.then(r=>{this.render.renderOptions(this.store.partialToFullData(r))}).catch(r=>{this.render.renderError(typeof r=="string"?r:r.message)});return}else Array.isArray(n)?this.render.renderOptions(this.store.partialToFullData(n)):this.render.renderError("Search event must return a promise or an array of data")}destroy(){document.removeEventListener("click",this.documentClick),window.removeEventListener("resize",this.windowResize,!1),this.settings.openPosition==="auto"&&window.removeEventListener("scroll",this.windowScroll,!1),document.removeEventListener("visibilitychange",this.windowVisibilityChange),this.store.setData([]),this.render.destroy(),this.select.destroy()}};const Ry="CWYDT23U",Ny="slimselectjscom",My=Mi({__name:"carbonad",setup(e){const t=Gd(null);let n=!1;return uh(()=>{if(!n){n=!0;const r=document.createElement("script");r.id="_carbonads_js",r.src=`//cdn.carbonads.com/carbon.js?serve=${Ry}&placement=${Ny}`,r.async=!0,t.value&&t.value.appendChild(r)}}),(r,s)=>(Di(),Eh("div",{class:"carbon-container",ref_key:"container",ref:t},null,512))}}),Fy=Mi({name:"App",components:{CarbonAd:My},data(){return{nav:null,navDebounce:Cs(()=>{this.setDemensions()},100),year:new Date().getFullYear(),width:0,height:0,navData:[{text:"Home",value:"/",class:"label"},{label:"Install",closable:"close",options:[{text:"npm",value:"install#npm"},{text:"cdn",value:"install#cdn"},{text:"download",value:"install#download"}]},{label:"Selects",closable:"close",options:[{text:"single",value:"selects#single"},{text:"multiple",value:"selects#multiple"}]},{label:"Data",closable:"close",options:[{text:"types",value:"data#types"},{text:"field",value:"data#field"}]},{label:"Settings",closable:"close",options:[{text:"select",value:"settings#select"},{text:"alwaysOpen",value:"settings#alwaysOpen"},{text:"contentLocation",value:"settings#contentLocation"},{text:"contentPosition",value:"settings#contentPosition"},{text:"openPosition",value:"settings#openPosition"},{text:"placeholder",value:"settings#placeholder"},{text:"selectAll",value:"settings#selectAll"},{text:"allowDeselect",value:"settings#allowDeselect"},{text:"display",value:"settings#display"},{text:"disabled",value:"settings#disabled"},{text:"mandatory",value:"settings#mandatory"},{text:"minmax",value:"settings#minmax"},{text:"dataAttributes",value:"settings#dataAttributes"},{text:"cssClass",value:"settings#cssClass"},{text:"inlineStyles",value:"settings#inlineStyles"},{text:"html",value:"settings#html"},{text:"keepOrder",value:"settings#keepOrder"},{text:"search",value:"settings#search"},{text:"closeOnSelect",value:"settings#closeOnSelect"},{text:"showOptionTooltips",value:"settings#showOptionTooltips"},{text:"closable",value:"settings#closable"},{text:"hideSelected",value:"settings#hideSelected"},{text:"maxValuesShown",value:"settings#maxValuesShown"}]},{label:"Events",closable:"close",options:[{text:"error",value:"events#error"},{text:"beforeChange",value:"events#beforeChange"},{text:"afterChange",value:"events#afterChange"},{text:"open",value:"events#open"},{text:"search",value:"events#search"},{text:"searchFilter",value:"events#searchFilter"},{text:"addable",value:"events#addable"}]},{label:"Methods",closable:"close",options:[{text:"getSelected",value:"methods#getSelected"},{text:"setSelected",value:"methods#setSelected"},{text:"getData",value:"methods#getData"},{text:"setData",value:"methods#setData"},{text:"enableDisable",value:"methods#enableDisable"},{text:"openClose",value:"methods#openClose"},{text:"search",value:"methods#search"},{text:"destroy",value:"methods#destroy"}]},{label:"Frameworks",closable:"close",options:[{text:"vue",value:"vue"},{text:"react",value:"react"}]}]}},mounted(){this.runNav(),this.$router.isReady().then(()=>{this.nav&&this.nav.setSelected(this.$router.currentRoute.value.fullPath.replace("/",""))}),this.$router.afterEach(()=>{if(this.$route.query.p){setTimeout(()=>{this.$route.query.p&&this.$router.push({path:this.$route.query.p.toString(),hash:this.$route.hash})},200);return}setTimeout(()=>{const e=this.$route.hash;if(e===""&&window.scroll({top:0,behavior:"smooth"}),e){const t=document.querySelector(e);if(t){const n=document.querySelector("header"),r=document.querySelector("nav"),s=n?n.clientHeight+(window.innerWidth<700?r.clientHeight:0)+8:0;window.scroll({top:t.offsetTop-s,behavior:"smooth"})}}},200)}),this.setDemensions(),window.addEventListener("resize",this.navDebounce)},unmounted(){var e;window.removeEventListener("resize",this.navDebounce),(e=this.nav)==null||e.destroy()},watch:{width(){this.runNav()}},methods:{setDemensions(){this.width=document.documentElement.clientWidth,this.height=document.documentElement.clientHeight},runNav(){this.nav&&(this.nav.destroy(),this.nav=null);let e={searchHighlight:!0,openContent:"below"};this.width>700&&(e.alwaysOpen=!0,e.contentPosition="relative",e.contentLocation=this.$refs.navContent),this.nav=new zh({select:this.$refs.nav,data:this.navData,settings:e,events:{afterChange:t=>{const r=t[0].value.split("#"),s=r[0],l=r[1]?"#"+r[1]:void 0;this.$router.push({path:s,hash:l})}}})}}}),Iy="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpFNTE3OEEyRTk5QTAxMUUyOUExNUJDMTA0NkE4OTA0RCIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpFNTE3OEEyRjk5QTAxMUUyOUExNUJDMTA0NkE4OTA0RCI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkU1MTc4QTJDOTlBMDExRTI5QTE1QkMxMDQ2QTg5MDREIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkU1MTc4QTJEOTlBMDExRTI5QTE1QkMxMDQ2QTg5MDREIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+FYrpWAAABrNJREFUeNrkW2lsVFUUvjMWirYUkS5BXApUa2vd6gL+wAWjoP5RiW2EUBajAiqSuPADQ0w1UUQTrcFAUUSJEKriEuMWFKuJIElFSS24YNpQK6WoBbuAktbva880M8O8vnfevJm+CSf5cme599xzvnfffffce17AJFjycnLzUVwDXAgUAucBY4BMIEOqdQIdwJ/Az4J64OvWtoONibQvkACHgyiuBe4CbgLOjVNlE/AZsAmoBSE9viQAjueieBCYC5yVoAvWDKwHqkBEmy8IgON09lHgXmCESY4cBaqBlSCieUgIgOPDUCwBngBOM0MjXdL/CyDiv6QRAOcvR7EBKDL+kD3AbJBQl1AC4DjrLwaeBYYbf8m/ciu+BCJ6PScAzp+K4nXgTuNveQuYAxK6PSMAzo9C8TFwtUkN2Q7cDBIOx02AOP8FUGpSSzgf3GBHQsDGec7unwOTTWrKDiGhS02ATHjvALeb1JZ3gRlWE+MpVq0yMzIekRk/1YWP6o7Ors5vHI8AXH1Odl8BaTbKrwd4j10MTAduS8JqkKvA94BPgN0A56htNm2OMyDDKNhuSwCcT5dIrMBG6S4oLI1qezqKBcBjwGiPHW8HVgCr0W97VL/fobjMpv2vQAnaHgv/MdYVXurAeSNPhggRw56BQatRVgL3A0H5+xDwI8Dw9g/5Hlq+clmdDYwF8iV0zpb/GP2tApZHOx4m2xwQUCC+VVqOABg+AUUDkO6AgHkwaL2DJXORxPVNylUnw+gpXObaLXFRlxHoaw7U8uoXQ99vViNgqUPnKQfsKojhdW7GuxDW5JUtIuni432hH4JhLJ7Dq6qwcZiPZnpNXDJPfI0kQEJbjVM5PiIgW3nhlkQQILH9LGWnV/iIAK0ts8TngREwDchVKrnKRwRobckVnwcIKFcq4ONrkY8IWBT2SHUq5eEE3Khs/CRm6Z1+8V5sqVQ26/M5gHuhSJ79TqUFmIhOj/ppwQ8/Rshqb5yiWXFQFhsaWeU352UU0KaXlc2mBI1+Y3OzjyO/Gm2kSAIKFQ2awfQ+v3oP23gL/K5oUhh0GPiEZG8KxP97FHULgsqwtTUFCDioqHsGCRipaHA8BQjQrAcyg4roj5KVAgSMUtRNDyqVj0wBAlQ2koBuRf3xKUBAvqJuN1eCrYpAiHNAltNjpyFYDfL47oix38wdmDA5AvYr+kjzWRgcLVcqnKfsJwGNyk5u9TEBtyjrNwaVgRClTPKA/Db8aVOZslkDG2nD2vEuOkqGlLmYpHcGJLlJu8LjtvJFgx06Jvnq8xC33gUBeUE4waWjduua5wdVPrr6VS6cr6PvoXv5Ixed3g3mH/fB1V9OW1w07fM5IEouUEZR4bIWWJzsTRJ55r8I3ONSRRFs3hsIU8hkgkkulf0CPAx8qElQcuk4beYp9Epgoks138LOvqSPgfyAzIwMZlnFSobgIegc4H3gH6AkxmKDub9Mjb0DeoYDrZ1dne0eO14AvfPx8RXgAYaycahbBvt+GLgFpIM0md3PjqrMTMxpYKxB6p1v+s/n7bbSuMCqldmZyc+fRh9ND+IsAxrmG3C3qtj0J1uP84hLrnwnwJbjEQRIxzw0XB2jER93C9Bog9TjsRgzLpzuJr0BzHV6e8gwf9XoziqdCv1YE/oSTQBHwfem/3w+5syPxuukLtfdO0zk+WIs+YuPKLQ7ohzyWTIix3joPPMTLg1d/Yg5gIL7ogf32U/4WGGhYDr+34J6bUALPpPA62w6XYMOP9BaCv3HoD/PeJubODN6U/eEq4cKTIurttpBAZ4L+87TmKdtOt0ah8FbPXS+WnyLEKskqUy5FaweM5dA2e6w+pNkZuajhfMD3/zYBfDKb3Y6+cWwgytOL7bh98nQ73BEgHReIvd4Roy/a6Cs3CRYJOnq7zjV8HWcybC33mpLLKZIA84FPRYhcSokUNL2Civnjd0MjoZbUCy0+PtNkDDD5wQsFB8sxWm2+GJZd8eSt4HnZXnZ66Nb4CHYYxuxat4XmI1inbHeczskq77DMrK4z8AgK3+Q/L5EEMBn/PzQos0zAsQgvg5XY3TpNKOTSAD3NsrQX63TBqq9PVHM9NgvfXi/06ZSjfNqAoQEHj9Pled+pw8cpw2co6aKbSoJxDlJnYniKdP/sqSVrrEw7IBL/TnG+rSXEy7fYVoG/S1uffDkzVEYypB1qewJRCdb5rp9yxN6mQDZFmOS2wisCIXo8Yin7w7LiKiQEcFYfhOMnBmnzo1CLIO09Qyt47niJxDQ29trTmY56Qn4X4ABAFR7IoDmVT5NAAAAAElFTkSuQmCC",Dy="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACAAQMAAAD58POIAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZQTFRFyzg3////IltC9QAAAAFiS0dEAf8CLd4AAAAJcEhZcwAACxMAAAsTAQCanBgAAAAkSURBVEjHY2AYBYMV/IeDUQG4AJgeFRgVGBUYFSBNYBQMPgAARjtdvxo6xaMAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTEtMDUtMzBUMjM6MTA6NDQtMDc6MDCm4GvfAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDEwLTEyLTA2VDEyOjIwOjEyLTA4OjAwpIGEmQAAADJ0RVh0UE5HOmNIUk0AY2h1bmsgd2FzIGZvdW5kIChzZWUgQ2hyb21hdGljaXR5LCBhYm92ZSkH0UjaAAAAKXRFWHRQTkc6Z0FNQQBnYW1tYT0wLjQ1NDU1IChTZWUgR2FtbWEsIGFib3ZlKRISLKcAAAAUdEVYdFBORzpJSERSLmJpdF9kZXB0aAA4KYV+UAAAABV0RVh0UE5HOklIRFIuY29sb3JfdHlwZQA2BkqnKwAAABt0RVh0UE5HOklIRFIuaW50ZXJsYWNlX21ldGhvZAAw+zsHjAAAABx0RVh0UE5HOklIRFIud2lkdGgsaGVpZ2h0ADE2LCAxNjjVBg0AAAAodEVYdFBORzpwSFlzAHhfcmVzPTI4MzUsIHlfcmVzPTI4MzUsIHVuaXRzPTGCKXI+AAAAKHRFWHRQTkc6c1JHQgBpbnRlbnQ9MCAoU2VlIFJlbmRlcmluZyBpbnRlbnQp8hEU9QAAAABJRU5ErkJggg==",by=(e,t)=>{const n=e.__vccOpts||e;for(const[r,s]of t)n[r]=s;return n},jy=Iv('

Slim Select 2.0

Advanced select dropdown
',1),zy={ref:"nav"},By={class:"nav-content",ref:"navContent"},Uy=rn("a",{href:"http://webiswhatido.com",style:{color:"#ffffff"},target:"_blank"},"Brian Voelker",-1),Vy=rn("br",null,null,-1);function Hy(e,t,n,r,s,l){const i=Lc("CarbonAd"),o=Lc("router-view");return Di(),Eh(yt,null,[jy,rn("nav",null,[rn("select",zy,null,512),rn("div",By,null,512),be(i)]),rn("main",null,[be(o),rn("footer",null,[Il(" © "+hg(e.year)+" ",1),Uy,Il(". "),Vy,Il(" Slim Select is under the MIT license. ")])])],64)}const $y=by(Fy,[["render",Hy]]);var pf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Su(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Bh={exports:{}};(function(e){var t=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};/** + */const mr=typeof window<"u";function x0(e){return e.__esModule||e[Symbol.toStringTag]==="Module"}const ce=Object.assign;function co(e,t){const n={};for(const r in t){const s=t[r];n[r]=jt(s)?s.map(e):e(s)}return n}const Es=()=>{},jt=Array.isArray,E0=/\/$/,_0=e=>e.replace(E0,"");function fo(e,t,n="/"){let r,s={},l="",i="";const o=t.indexOf("#");let a=t.indexOf("?");return o=0&&(a=-1),a>-1&&(r=t.slice(0,a),l=t.slice(a+1,o>-1?o:t.length),s=e(l)),o>-1&&(r=r||t.slice(0,o),i=t.slice(o,t.length)),r=O0(r??t,n),{fullPath:r+(l&&"?")+l+i,path:r,query:s,hash:i}}function C0(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function Jc(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function k0(e,t,n){const r=t.matched.length-1,s=n.matched.length-1;return r>-1&&r===s&&Hr(t.matched[r],n.matched[s])&&Ph(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function Hr(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function Ph(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(!A0(e[n],t[n]))return!1;return!0}function A0(e,t){return jt(e)?Xc(e,t):jt(t)?Xc(t,e):e===t}function Xc(e,t){return jt(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function O0(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),r=e.split("/"),s=r[r.length-1];(s===".."||s===".")&&r.push("");let l=n.length-1,i,o;for(i=0;i1&&l--;else break;return n.slice(0,l).join("/")+"/"+r.slice(i-(i===r.length?1:0)).join("/")}var js;(function(e){e.pop="pop",e.push="push"})(js||(js={}));var _s;(function(e){e.back="back",e.forward="forward",e.unknown=""})(_s||(_s={}));function P0(e){if(!e)if(mr){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),_0(e)}const L0=/^[^#]+#/;function T0(e,t){return e.replace(L0,"#")+t}function R0(e,t){const n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect();return{behavior:t.behavior,left:r.left-n.left-(t.left||0),top:r.top-n.top-(t.top||0)}}const zi=()=>({left:window.pageXOffset,top:window.pageYOffset});function N0(e){let t;if("el"in e){const n=e.el,r=typeof n=="string"&&n.startsWith("#"),s=typeof n=="string"?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!s)return;t=R0(s,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.pageXOffset,t.top!=null?t.top:window.pageYOffset)}function qc(e,t){return(history.state?history.state.position-t:-1)+e}const ta=new Map;function M0(e,t){ta.set(e,t)}function F0(e){const t=ta.get(e);return ta.delete(e),t}let I0=()=>location.protocol+"//"+location.host;function Lh(e,t){const{pathname:n,search:r,hash:s}=t,l=e.indexOf("#");if(l>-1){let o=s.includes(e.slice(l))?e.slice(l).length:1,a=s.slice(o);return a[0]!=="/"&&(a="/"+a),Jc(a,"")}return Jc(n,e)+r+s}function D0(e,t,n,r){let s=[],l=[],i=null;const o=({state:p})=>{const w=Lh(e,location),x=n.value,_=t.value;let L=0;if(p){if(n.value=w,t.value=p,i&&i===x){i=null;return}L=_?p.position-_.position:0}else r(w);s.forEach(m=>{m(n.value,x,{delta:L,type:js.pop,direction:L?L>0?_s.forward:_s.back:_s.unknown})})};function a(){i=n.value}function u(p){s.push(p);const w=()=>{const x=s.indexOf(p);x>-1&&s.splice(x,1)};return l.push(w),w}function c(){const{history:p}=window;p.state&&p.replaceState(ce({},p.state,{scroll:zi()}),"")}function d(){for(const p of l)p();l=[],window.removeEventListener("popstate",o),window.removeEventListener("beforeunload",c)}return window.addEventListener("popstate",o),window.addEventListener("beforeunload",c,{passive:!0}),{pauseListeners:a,listen:u,destroy:d}}function ef(e,t,n,r=!1,s=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:s?zi():null}}function b0(e){const{history:t,location:n}=window,r={value:Lh(e,n)},s={value:t.state};s.value||l(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function l(a,u,c){const d=e.indexOf("#"),p=d>-1?(n.host&&document.querySelector("base")?e:e.slice(d))+a:I0()+e+a;try{t[c?"replaceState":"pushState"](u,"",p),s.value=u}catch(w){console.error(w),n[c?"replace":"assign"](p)}}function i(a,u){const c=ce({},t.state,ef(s.value.back,a,s.value.forward,!0),u,{position:s.value.position});l(a,c,!0),r.value=a}function o(a,u){const c=ce({},s.value,t.state,{forward:a,scroll:zi()});l(c.current,c,!0);const d=ce({},ef(r.value,a,null),{position:c.position+1},u);l(a,d,!1),r.value=a}return{location:r,state:s,push:o,replace:i}}function j0(e){e=P0(e);const t=b0(e),n=D0(e,t.state,t.location,t.replace);function r(l,i=!0){i||n.pauseListeners(),history.go(l)}const s=ce({location:"",base:e,go:r,createHref:T0.bind(null,e)},t,n);return Object.defineProperty(s,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(s,"state",{enumerable:!0,get:()=>t.state.value}),s}function z0(e){return typeof e=="string"||e&&typeof e=="object"}function Th(e){return typeof e=="string"||typeof e=="symbol"}const vn={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0},Rh=Symbol("");var tf;(function(e){e[e.aborted=4]="aborted",e[e.cancelled=8]="cancelled",e[e.duplicated=16]="duplicated"})(tf||(tf={}));function $r(e,t){return ce(new Error,{type:e,[Rh]:!0},t)}function qt(e,t){return e instanceof Error&&Rh in e&&(t==null||!!(e.type&t))}const nf="[^/]+?",B0={sensitive:!1,strict:!1,start:!0,end:!0},U0=/[.+*?^${}()[\]/\\]/g;function V0(e,t){const n=ce({},B0,t),r=[];let s=n.start?"^":"";const l=[];for(const u of e){const c=u.length?[]:[90];n.strict&&!u.length&&(s+="/");for(let d=0;dt.length?t.length===1&&t[0]===80?1:-1:0}function $0(e,t){let n=0;const r=e.score,s=t.score;for(;n0&&t[t.length-1]<0}const W0={type:0,value:""},Q0=/[a-zA-Z0-9_]/;function K0(e){if(!e)return[[]];if(e==="/")return[[W0]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(w){throw new Error(`ERR (${n})/"${u}": ${w}`)}let n=0,r=n;const s=[];let l;function i(){l&&s.push(l),l=[]}let o=0,a,u="",c="";function d(){u&&(n===0?l.push({type:0,value:u}):n===1||n===2||n===3?(l.length>1&&(a==="*"||a==="+")&&t(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),l.push({type:1,value:u,regexp:c,repeatable:a==="*"||a==="+",optional:a==="*"||a==="?"})):t("Invalid state to consume buffer"),u="")}function p(){u+=a}for(;o{i(f)}:Es}function i(c){if(Th(c)){const d=r.get(c);d&&(r.delete(c),n.splice(n.indexOf(d),1),d.children.forEach(i),d.alias.forEach(i))}else{const d=n.indexOf(c);d>-1&&(n.splice(d,1),c.record.name&&r.delete(c.record.name),c.children.forEach(i),c.alias.forEach(i))}}function o(){return n}function a(c){let d=0;for(;d=0&&(c.record.path!==n[d].record.path||!Nh(c,n[d]));)d++;n.splice(d,0,c),c.record.name&&!lf(c)&&r.set(c.record.name,c)}function u(c,d){let p,w={},x,_;if("name"in c&&c.name){if(p=r.get(c.name),!p)throw $r(1,{location:c});_=p.record.name,w=ce(sf(d.params,p.keys.filter(f=>!f.optional).map(f=>f.name)),c.params&&sf(c.params,p.keys.map(f=>f.name))),x=p.stringify(w)}else if("path"in c)x=c.path,p=n.find(f=>f.re.test(x)),p&&(w=p.parse(x),_=p.record.name);else{if(p=d.name?r.get(d.name):n.find(f=>f.re.test(d.path)),!p)throw $r(1,{location:c,currentLocation:d});_=p.record.name,w=ce({},d.params,c.params),x=p.stringify(w)}const L=[];let m=p;for(;m;)L.unshift(m.record),m=m.parent;return{name:_,path:x,params:w,matched:L,meta:X0(L)}}return e.forEach(c=>l(c)),{addRoute:l,resolve:u,removeRoute:i,getRoutes:o,getRecordMatcher:s}}function sf(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function Z0(e){return{path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:void 0,beforeEnter:e.beforeEnter,props:J0(e),children:e.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in e?e.components||null:e.component&&{default:e.component}}}function J0(e){const t={},n=e.props||!1;if("component"in e)t.default=n;else for(const r in e.components)t[r]=typeof n=="object"?n[r]:n;return t}function lf(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function X0(e){return e.reduce((t,n)=>ce(t,n.meta),{})}function of(e,t){const n={};for(const r in e)n[r]=r in t?t[r]:e[r];return n}function Nh(e,t){return t.children.some(n=>n===e||Nh(e,n))}const Mh=/#/g,q0=/&/g,ey=/\//g,ty=/=/g,ny=/\?/g,Fh=/\+/g,ry=/%5B/g,sy=/%5D/g,Ih=/%5E/g,ly=/%60/g,Dh=/%7B/g,iy=/%7C/g,bh=/%7D/g,oy=/%20/g;function vu(e){return encodeURI(""+e).replace(iy,"|").replace(ry,"[").replace(sy,"]")}function ay(e){return vu(e).replace(Dh,"{").replace(bh,"}").replace(Ih,"^")}function na(e){return vu(e).replace(Fh,"%2B").replace(oy,"+").replace(Mh,"%23").replace(q0,"%26").replace(ly,"`").replace(Dh,"{").replace(bh,"}").replace(Ih,"^")}function uy(e){return na(e).replace(ty,"%3D")}function cy(e){return vu(e).replace(Mh,"%23").replace(ny,"%3F")}function fy(e){return e==null?"":cy(e).replace(ey,"%2F")}function ei(e){try{return decodeURIComponent(""+e)}catch{}return""+e}function dy(e){const t={};if(e===""||e==="?")return t;const r=(e[0]==="?"?e.slice(1):e).split("&");for(let s=0;sl&&na(l)):[r&&na(r)]).forEach(l=>{l!==void 0&&(t+=(t.length?"&":"")+n,l!=null&&(t+="="+l))})}return t}function hy(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=jt(r)?r.map(s=>s==null?null:""+s):r==null?r:""+r)}return t}const py=Symbol(""),uf=Symbol(""),yu=Symbol(""),jh=Symbol(""),ra=Symbol("");function ls(){let e=[];function t(r){return e.push(r),()=>{const s=e.indexOf(r);s>-1&&e.splice(s,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function xn(e,t,n,r,s){const l=r&&(r.enterCallbacks[s]=r.enterCallbacks[s]||[]);return()=>new Promise((i,o)=>{const a=d=>{d===!1?o($r(4,{from:n,to:t})):d instanceof Error?o(d):z0(d)?o($r(2,{from:t,to:d})):(l&&r.enterCallbacks[s]===l&&typeof d=="function"&&l.push(d),i())},u=e.call(r&&r.instances[s],t,n,a);let c=Promise.resolve(u);e.length<3&&(c=c.then(a)),c.catch(d=>o(d))})}function ho(e,t,n,r){const s=[];for(const l of e)for(const i in l.components){let o=l.components[i];if(!(t!=="beforeRouteEnter"&&!l.instances[i]))if(my(o)){const u=(o.__vccOpts||o)[t];u&&s.push(xn(u,n,r,l,i))}else{let a=o();s.push(()=>a.then(u=>{if(!u)return Promise.reject(new Error(`Couldn't resolve component "${i}" at "${l.path}"`));const c=x0(u)?u.default:u;l.components[i]=c;const p=(c.__vccOpts||c)[t];return p&&xn(p,n,r,l,i)()}))}}return s}function my(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function cf(e){const t=an(yu),n=an(jh),r=Mt(()=>t.resolve(Nr(e.to))),s=Mt(()=>{const{matched:a}=r.value,{length:u}=a,c=a[u-1],d=n.matched;if(!c||!d.length)return-1;const p=d.findIndex(Hr.bind(null,c));if(p>-1)return p;const w=ff(a[u-2]);return u>1&&ff(c)===w&&d[d.length-1].path!==w?d.findIndex(Hr.bind(null,a[u-2])):p}),l=Mt(()=>s.value>-1&&wy(n.params,r.value.params)),i=Mt(()=>s.value>-1&&s.value===n.matched.length-1&&Ph(n.params,r.value.params));function o(a={}){return yy(a)?t[Nr(e.replace)?"replace":"push"](Nr(e.to)).catch(Es):Promise.resolve()}return{route:r,href:Mt(()=>r.value.href),isActive:l,isExactActive:i,navigate:o}}const gy=Mi({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"}},useLink:cf,setup(e,{slots:t}){const n=Ti(cf(e)),{options:r}=an(yu),s=Mt(()=>({[df(e.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[df(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const l=t.default&&t.default(n);return e.custom?l:Oh("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:s.value},l)}}}),vy=gy;function yy(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){const t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function wy(e,t){for(const n in t){const r=t[n],s=e[n];if(typeof r=="string"){if(r!==s)return!1}else if(!jt(s)||s.length!==r.length||r.some((l,i)=>l!==s[i]))return!1}return!0}function ff(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const df=(e,t,n)=>e??t??n,Sy=Mi({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const r=an(ra),s=Mt(()=>e.route||r.value),l=an(uf,0),i=Mt(()=>{let u=Nr(l);const{matched:c}=s.value;let d;for(;(d=c[u])&&!d.components;)u++;return u}),o=Mt(()=>s.value.matched[i.value]);Nl(uf,Mt(()=>i.value+1)),Nl(py,o),Nl(ra,s);const a=Gd();return Rl(()=>[a.value,o.value,e.name],([u,c,d],[p,w,x])=>{c&&(c.instances[d]=u,w&&w!==c&&u&&u===p&&(c.leaveGuards.size||(c.leaveGuards=w.leaveGuards),c.updateGuards.size||(c.updateGuards=w.updateGuards))),u&&c&&(!w||!Hr(c,w)||!p)&&(c.enterCallbacks[d]||[]).forEach(_=>_(u))},{flush:"post"}),()=>{const u=s.value,c=e.name,d=o.value,p=d&&d.components[c];if(!p)return hf(n.default,{Component:p,route:u});const w=d.props[c],x=w?w===!0?u.params:typeof w=="function"?w(u):w:null,L=Oh(p,ce({},x,t,{onVnodeUnmounted:m=>{m.component.isUnmounted&&(d.instances[c]=null)},ref:a}));return hf(n.default,{Component:L,route:u})||L}}});function hf(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const xy=Sy;function Ey(e){const t=Y0(e.routes,e),n=e.parseQuery||dy,r=e.stringifyQuery||af,s=e.history,l=ls(),i=ls(),o=ls(),a=Dg(vn);let u=vn;mr&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=co.bind(null,A=>""+A),d=co.bind(null,fy),p=co.bind(null,ei);function w(A,V){let b,Q;return Th(A)?(b=t.getRecordMatcher(A),Q=V):Q=A,t.addRoute(Q,b)}function x(A){const V=t.getRecordMatcher(A);V&&t.removeRoute(V)}function _(){return t.getRoutes().map(A=>A.record)}function L(A){return!!t.getRecordMatcher(A)}function m(A,V){if(V=ce({},V||a.value),typeof A=="string"){const E=fo(n,A,V.path),O=t.resolve({path:E.path},V),T=s.createHref(E.fullPath);return ce(E,O,{params:p(O.params),hash:ei(E.hash),redirectedFrom:void 0,href:T})}let b;if("path"in A)b=ce({},A,{path:fo(n,A.path,V.path).path});else{const E=ce({},A.params);for(const O in E)E[O]==null&&delete E[O];b=ce({},A,{params:d(E)}),V.params=d(V.params)}const Q=t.resolve(b,V),le=A.hash||"";Q.params=c(p(Q.params));const g=C0(r,ce({},A,{hash:ay(le),path:Q.path})),v=s.createHref(g);return ce({fullPath:g,hash:le,query:r===af?hy(A.query):A.query||{}},Q,{redirectedFrom:void 0,href:v})}function f(A){return typeof A=="string"?fo(n,A,a.value.path):ce({},A)}function h(A,V){if(u!==A)return $r(8,{from:V,to:A})}function y(A){return k(A)}function S(A){return y(ce(f(A),{replace:!0}))}function C(A){const V=A.matched[A.matched.length-1];if(V&&V.redirect){const{redirect:b}=V;let Q=typeof b=="function"?b(A):b;return typeof Q=="string"&&(Q=Q.includes("?")||Q.includes("#")?Q=f(Q):{path:Q},Q.params={}),ce({query:A.query,hash:A.hash,params:"path"in Q?{}:A.params},Q)}}function k(A,V){const b=u=m(A),Q=a.value,le=A.state,g=A.force,v=A.replace===!0,E=C(b);if(E)return k(ce(f(E),{state:typeof E=="object"?ce({},le,E.state):le,force:g,replace:v}),V||b);const O=b;O.redirectedFrom=V;let T;return!g&&k0(r,Q,b)&&(T=$r(16,{to:O,from:Q}),te(Q,Q,!0,!1)),(T?Promise.resolve(T):U(O,Q)).catch(N=>qt(N)?qt(N,2)?N:K(N):P(N,O,Q)).then(N=>{if(N){if(qt(N,2))return k(ce({replace:v},f(N.to),{state:typeof N.to=="object"?ce({},le,N.to.state):le,force:g}),V||O)}else N=ke(O,Q,!0,v,le);return ee(O,Q,N),N})}function R(A,V){const b=h(A,V);return b?Promise.reject(b):Promise.resolve()}function D(A){const V=xe.values().next().value;return V&&typeof V.runWithContext=="function"?V.runWithContext(A):A()}function U(A,V){let b;const[Q,le,g]=_y(A,V);b=ho(Q.reverse(),"beforeRouteLeave",A,V);for(const E of Q)E.leaveGuards.forEach(O=>{b.push(xn(O,A,V))});const v=R.bind(null,A,V);return b.push(v),ue(b).then(()=>{b=[];for(const E of l.list())b.push(xn(E,A,V));return b.push(v),ue(b)}).then(()=>{b=ho(le,"beforeRouteUpdate",A,V);for(const E of le)E.updateGuards.forEach(O=>{b.push(xn(O,A,V))});return b.push(v),ue(b)}).then(()=>{b=[];for(const E of g)if(E.beforeEnter)if(jt(E.beforeEnter))for(const O of E.beforeEnter)b.push(xn(O,A,V));else b.push(xn(E.beforeEnter,A,V));return b.push(v),ue(b)}).then(()=>(A.matched.forEach(E=>E.enterCallbacks={}),b=ho(g,"beforeRouteEnter",A,V),b.push(v),ue(b))).then(()=>{b=[];for(const E of i.list())b.push(xn(E,A,V));return b.push(v),ue(b)}).catch(E=>qt(E,8)?E:Promise.reject(E))}function ee(A,V,b){o.list().forEach(Q=>D(()=>Q(A,V,b)))}function ke(A,V,b,Q,le){const g=h(A,V);if(g)return g;const v=V===vn,E=mr?history.state:{};b&&(Q||v?s.replace(A.fullPath,ce({scroll:v&&E&&E.scroll},le)):s.push(A.fullPath,le)),a.value=A,te(A,V,b,v),K()}let Le;function At(){Le||(Le=s.listen((A,V,b)=>{if(!et.listening)return;const Q=m(A),le=C(Q);if(le){k(ce(le,{replace:!0}),Q).catch(Es);return}u=Q;const g=a.value;mr&&M0(qc(g.fullPath,b.delta),zi()),U(Q,g).catch(v=>qt(v,12)?v:qt(v,2)?(k(v.to,Q).then(E=>{qt(E,20)&&!b.delta&&b.type===js.pop&&s.go(-1,!1)}).catch(Es),Promise.reject()):(b.delta&&s.go(-b.delta,!1),P(v,Q,g))).then(v=>{v=v||ke(Q,g,!1),v&&(b.delta&&!qt(v,8)?s.go(-b.delta,!1):b.type===js.pop&&qt(v,20)&&s.go(-1,!1)),ee(Q,g,v)}).catch(Es)}))}let Bt=ls(),ge=ls(),se;function P(A,V,b){K(A);const Q=ge.list();return Q.length?Q.forEach(le=>le(A,V,b)):console.error(A),Promise.reject(A)}function W(){return se&&a.value!==vn?Promise.resolve():new Promise((A,V)=>{Bt.add([A,V])})}function K(A){return se||(se=!A,At(),Bt.list().forEach(([V,b])=>A?b(A):V()),Bt.reset()),A}function te(A,V,b,Q){const{scrollBehavior:le}=e;if(!mr||!le)return Promise.resolve();const g=!b&&F0(qc(A.fullPath,0))||(Q||!b)&&history.state&&history.state.scroll||null;return Xd().then(()=>le(A,V,g)).then(v=>v&&N0(v)).catch(v=>P(v,A,V))}const Z=A=>s.go(A);let ct;const xe=new Set,et={currentRoute:a,listening:!0,addRoute:w,removeRoute:x,hasRoute:L,getRoutes:_,resolve:m,options:e,push:y,replace:S,go:Z,back:()=>Z(-1),forward:()=>Z(1),beforeEach:l.add,beforeResolve:i.add,afterEach:o.add,onError:ge.add,isReady:W,install(A){const V=this;A.component("RouterLink",vy),A.component("RouterView",xy),A.config.globalProperties.$router=V,Object.defineProperty(A.config.globalProperties,"$route",{enumerable:!0,get:()=>Nr(a)}),mr&&!ct&&a.value===vn&&(ct=!0,y(s.location).catch(le=>{}));const b={};for(const le in vn)Object.defineProperty(b,le,{get:()=>a.value[le],enumerable:!0});A.provide(yu,V),A.provide(jh,Vd(b)),A.provide(ra,a);const Q=A.unmount;xe.add(A),A.unmount=function(){xe.delete(A),xe.size<1&&(u=vn,Le&&Le(),Le=null,a.value=vn,ct=!1,se=!1),Q()}}};function ue(A){return A.reduce((V,b)=>V.then(()=>D(b)),Promise.resolve())}return et}function _y(e,t){const n=[],r=[],s=[],l=Math.max(t.matched.length,e.matched.length);for(let i=0;iHr(u,o))?r.push(o):n.push(o));const a=e.matched[i];a&&(t.matched.find(u=>Hr(u,a))||s.push(a))}return[n,r,s]}const Cy=Ey({history:j0(),linkActiveClass:"active",routes:[{path:"/",name:"Home",component:()=>Xt(()=>import("./home.js"),__vite__mapDeps([0,1]))},{path:"/install",name:"Install",component:()=>Xt(()=>import("./install.js"),__vite__mapDeps([]))},{path:"/selects",name:"Selects",component:()=>Xt(()=>import("./selects.js"),__vite__mapDeps([]))},{path:"/data",name:"Data",component:()=>Xt(()=>import("./data.js"),__vite__mapDeps([]))},{path:"/settings",name:"Settings",component:()=>Xt(()=>import("./index2.js"),__vite__mapDeps([2,3]))},{path:"/events",name:"Events",component:()=>Xt(()=>import("./index3.js"),__vite__mapDeps([]))},{path:"/methods",name:"Methods",component:()=>Xt(()=>import("./index4.js"),__vite__mapDeps([]))},{path:"/vue",name:"Vue",component:()=>Xt(()=>import("./vue.js"),__vite__mapDeps([]))},{path:"/react",name:"React",component:()=>Xt(()=>import("./react.js"),__vite__mapDeps([]))}]});function wu(){return Math.random().toString(36).substring(2,10)}function ky(e,t){function n(s,l){return l&&s&&s.classList&&s.classList.contains(l)||l&&s&&s.dataset&&s.dataset.id&&s.dataset.id===t?s:null}function r(s,l){return!s||s===document?null:n(s,l)?s:r(s.parentNode,l)}return n(e,t)||r(e,t)}function Cs(e,t=50,n=!1){let r;return function(...s){const l=self,i=()=>{r=null,n||e.apply(l,s)},o=n&&!r;clearTimeout(r),r=setTimeout(i,t),o&&e.apply(l,s)}}function po(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Ay(e){const t=e.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,n=>"-"+n.toLowerCase());return e[0]===e[0].toUpperCase()?t.substring(1):t}class Lt{constructor(t){if(this.id=!t.id||t.id===""?wu():t.id,this.label=t.label||"",this.selectAll=t.selectAll===void 0?!1:t.selectAll,this.selectAllText=t.selectAllText||"Select All",this.closable=t.closable||"off",this.options=[],t.options)for(const n of t.options)this.options.push(new He(n))}}class He{constructor(t){this.id=!t.id||t.id===""?wu():t.id,this.value=t.value===void 0?t.text:t.value,this.text=t.text||"",this.html=t.html||"",this.selected=t.selected!==void 0?t.selected:!1,this.display=t.display!==void 0?t.display:!0,this.disabled=t.disabled!==void 0?t.disabled:!1,this.mandatory=t.mandatory!==void 0?t.mandatory:!1,this.placeholder=t.placeholder!==void 0?t.placeholder:!1,this.class=t.class||"",this.style=t.style||"",this.data=t.data||{}}}class Oy{constructor(t,n){this.selectType="single",this.data=[],this.selectType=t,this.setData(n)}validateDataArray(t){if(!Array.isArray(t))return new Error("Data must be an array");for(let n of t)if(n instanceof Lt||"label"in n){if(!("label"in n))return new Error("Optgroup must have a label");if("options"in n&&n.options)for(let r of n.options)return this.validateOption(r)}else return n instanceof He||"text"in n?this.validateOption(n):new Error("Data object must be a valid optgroup or option");return null}validateOption(t){return"text"in t?null:new Error("Option must have a text")}partialToFullData(t){let n=[];return t.forEach(r=>{if(r instanceof Lt||"label"in r){let s=[];"options"in r&&r.options&&r.options.forEach(l=>{s.push(new He(l))}),s.length>0&&n.push(new Lt(r))}(r instanceof He||"text"in r)&&n.push(new He(r))}),n}setData(t){this.data=this.partialToFullData(t),this.selectType==="single"&&this.setSelectedBy("id",this.getSelected())}getData(){return this.filter(null,!0)}getDataOptions(){return this.filter(null,!1)}addOption(t){this.setData(this.getData().concat(new He(t)))}setSelectedBy(t,n){let r=null,s=!1;for(let l of this.data){if(l instanceof Lt)for(let i of l.options)r||(r=i),i.selected=s?!1:n.includes(i[t]),i.selected&&this.selectType==="single"&&(s=!0);l instanceof He&&(r||(r=l),l.selected=s?!1:n.includes(l[t]),l.selected&&this.selectType==="single"&&(s=!0))}this.selectType==="single"&&r&&!s&&(r.selected=!0)}getSelected(){return this.getSelectedOptions().map(t=>t.id)}getSelectedOptions(){return this.filter(t=>t.selected,!1)}getOptgroupByID(t){for(let n of this.data)if(n instanceof Lt&&n.id===t)return n;return null}getOptionByID(t){let n=this.filter(r=>r.id===t,!1);return n.length?n[0]:null}getSelectType(){return this.selectType}getFirstOption(){let t=null;for(let n of this.data)if(n instanceof Lt?t=n.options[0]:n instanceof He&&(t=n),t)break;return t}search(t,n){return t=t.trim(),t===""?this.getData():this.filter(r=>n(r,t),!0)}filter(t,n){const r=[];return this.data.forEach(s=>{if(s instanceof Lt){let l=[];if(s.options.forEach(i=>{(!t||t(i))&&(n?l.push(new He(i)):r.push(new He(i)))}),l.length>0){let i=new Lt(s);i.options=l,r.push(i)}}s instanceof He&&(!t||t(s))&&r.push(new He(s))}),r}}class Py{constructor(t,n,r){this.classes={main:"ss-main",placeholder:"ss-placeholder",values:"ss-values",single:"ss-single",max:"ss-max",value:"ss-value",valueText:"ss-value-text",valueDelete:"ss-value-delete",valueOut:"ss-value-out",deselect:"ss-deselect",deselectPath:"M10,10 L90,90 M10,90 L90,10",arrow:"ss-arrow",arrowClose:"M10,30 L50,70 L90,30",arrowOpen:"M10,70 L50,30 L90,70",content:"ss-content",openAbove:"ss-open-above",openBelow:"ss-open-below",search:"ss-search",searchHighlighter:"ss-search-highlight",searching:"ss-searching",addable:"ss-addable",addablePath:"M50,10 L50,90 M10,50 L90,50",list:"ss-list",optgroup:"ss-optgroup",optgroupLabel:"ss-optgroup-label",optgroupLabelText:"ss-optgroup-label-text",optgroupActions:"ss-optgroup-actions",optgroupSelectAll:"ss-selectall",optgroupSelectAllBox:"M60,10 L10,10 L10,90 L90,90 L90,50",optgroupSelectAllCheck:"M30,45 L50,70 L90,10",optgroupClosable:"ss-closable",option:"ss-option",optionDelete:"M10,10 L90,90 M10,90 L90,10",highlighted:"ss-highlighted",open:"ss-open",close:"ss-close",selected:"ss-selected",error:"ss-error",disabled:"ss-disabled",hide:"ss-hide"},this.store=n,this.settings=t,this.callbacks=r,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes(),this.settings.contentLocation.appendChild(this.content.main)}enable(){this.main.main.classList.remove(this.classes.disabled),this.content.search.input.disabled=!1}disable(){this.main.main.classList.add(this.classes.disabled),this.content.search.input.disabled=!0}open(){this.main.arrow.path.setAttribute("d",this.classes.arrowOpen),this.main.main.classList.add(this.settings.openPosition==="up"?this.classes.openAbove:this.classes.openBelow),this.main.main.setAttribute("aria-expanded","true"),this.moveContent();const t=this.store.getSelectedOptions();if(t.length){const n=t[t.length-1].id,r=this.content.list.querySelector('[data-id="'+n+'"]');r&&this.ensureElementInView(this.content.list,r)}}close(){this.main.main.classList.remove(this.classes.openAbove),this.main.main.classList.remove(this.classes.openBelow),this.main.main.setAttribute("aria-expanded","false"),this.content.main.classList.remove(this.classes.openAbove),this.content.main.classList.remove(this.classes.openBelow),this.main.arrow.path.setAttribute("d",this.classes.arrowClose)}updateClassStyles(){if(this.main.main.className="",this.main.main.removeAttribute("style"),this.content.main.className="",this.content.main.removeAttribute("style"),this.main.main.classList.add(this.classes.main),this.content.main.classList.add(this.classes.content),this.settings.style!==""&&(this.main.main.style.cssText=this.settings.style,this.content.main.style.cssText=this.settings.style),this.settings.class.length)for(const t of this.settings.class)t.trim()!==""&&(this.main.main.classList.add(t.trim()),this.content.main.classList.add(t.trim()));this.settings.contentPosition==="relative"&&this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){this.main.main.role="combobox",this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.main.id),this.main.main.setAttribute("aria-expanded","false"),this.content.main.setAttribute("role","listbox")}mainDiv(){var u;const t=document.createElement("div");t.dataset.id=this.settings.id,t.setAttribute("aria-label",this.settings.ariaLabel),t.tabIndex=0,t.onkeydown=c=>{switch(c.key){case"ArrowUp":case"ArrowDown":return this.callbacks.open(),c.key==="ArrowDown"?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Enter":case" ":this.callbacks.open();const d=this.content.list.querySelector("."+this.classes.highlighted);return d&&d.click(),!1;case"Escape":return this.callbacks.close(),!1}return!1},t.onclick=c=>{this.settings.disabled||(this.settings.isOpen?this.callbacks.close():this.callbacks.open())};const n=document.createElement("div");n.classList.add(this.classes.values),t.appendChild(n);const r=document.createElement("div");r.classList.add(this.classes.deselect);const s=(u=this.store)==null?void 0:u.getSelectedOptions();!this.settings.allowDeselect||this.settings.isMultiple&&s&&s.length<=0?r.classList.add(this.classes.hide):r.classList.remove(this.classes.hide),r.onclick=c=>{if(c.stopPropagation(),this.settings.disabled)return;let d=!0;const p=this.store.getSelectedOptions(),w=[];if(this.callbacks.beforeChange&&(d=this.callbacks.beforeChange(w,p)===!0),d){if(this.settings.isMultiple)this.callbacks.setSelected([],!1),this.updateDeselectAll();else{const x=this.store.getFirstOption(),_=x?x.id:"";this.callbacks.setSelected(_,!1)}this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(this.store.getSelectedOptions())}};const l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.setAttribute("viewBox","0 0 100 100");const i=document.createElementNS("http://www.w3.org/2000/svg","path");i.setAttribute("d",this.classes.deselectPath),l.appendChild(i),r.appendChild(l),t.appendChild(r);const o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.classList.add(this.classes.arrow),o.setAttribute("viewBox","0 0 100 100");const a=document.createElementNS("http://www.w3.org/2000/svg","path");return a.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&o.classList.add(this.classes.hide),o.appendChild(a),t.appendChild(o),{main:t,values:n,deselect:{main:r,svg:l,path:i},arrow:{main:o,path:a}}}mainFocus(t){t!=="click"&&this.main.main.focus({preventScroll:!0})}placeholder(){const t=this.store.filter(s=>s.placeholder,!1);let n=this.settings.placeholderText;t.length&&(t[0].html!==""?n=t[0].html:t[0].text!==""&&(n=t[0].text));const r=document.createElement("div");return r.classList.add(this.classes.placeholder),r.innerHTML=n,r}renderValues(){if(!this.settings.isMultiple){this.renderSingleValue();return}this.renderMultipleValues(),this.updateDeselectAll()}renderSingleValue(){const t=this.store.filter(r=>r.selected&&!r.placeholder,!1),n=t.length>0?t[0]:null;if(!n)this.main.values.innerHTML=this.placeholder().outerHTML;else{const r=document.createElement("div");r.classList.add(this.classes.single),n.html?r.innerHTML=n.html:r.innerText=n.text,this.main.values.innerHTML=r.outerHTML}!this.settings.allowDeselect||!t.length?this.main.deselect.main.classList.add(this.classes.hide):this.main.deselect.main.classList.remove(this.classes.hide)}renderMultipleValues(){let t=this.main.values.childNodes,n=this.store.filter(s=>s.selected&&s.display,!1);if(n.length===0){this.main.values.innerHTML=this.placeholder().outerHTML;return}else{const s=this.main.values.querySelector("."+this.classes.placeholder);s&&s.remove()}if(n.length>this.settings.maxValuesShown){const s=document.createElement("div");s.classList.add(this.classes.max),s.textContent=this.settings.maxValuesMessage.replace("{number}",n.length.toString()),this.main.values.innerHTML=s.outerHTML;return}else{const s=this.main.values.querySelector("."+this.classes.max);s&&s.remove()}let r=[];for(let s=0;sa.id===i,!1).length||r.push(l))}for(const s of r)s.classList.add(this.classes.valueOut),setTimeout(()=>{this.main.values.hasChildNodes()&&this.main.values.contains(s)&&this.main.values.removeChild(s)},100);t=this.main.values.childNodes;for(let s=0;s{if(o.preventDefault(),o.stopPropagation(),this.settings.disabled)return;let a=!0;const u=this.store.getSelectedOptions(),c=u.filter(d=>d.selected&&d.id!==t.id,!0);if(!(this.settings.minSelected&&c.length{this.callbacks.search(l.target.value)},100),n.onkeydown=l=>{switch(l.key){case"ArrowUp":case"ArrowDown":return l.key==="ArrowDown"?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Escape":return this.callbacks.close(),!1;case"Enter":case" ":if(this.callbacks.addable&&l.ctrlKey)return r.click(),!1;{const i=this.content.list.querySelector("."+this.classes.highlighted);if(i)return i.click(),!1}return!0}return!0},t.appendChild(n),this.callbacks.addable){r.classList.add(this.classes.addable);const l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.setAttribute("viewBox","0 0 100 100");const i=document.createElementNS("http://www.w3.org/2000/svg","path");i.setAttribute("d",this.classes.addablePath),l.appendChild(i),r.appendChild(l),r.onclick=o=>{if(o.preventDefault(),o.stopPropagation(),!this.callbacks.addable)return;const a=this.content.search.input.value.trim();if(a===""){this.content.search.input.focus();return}const u=d=>{let p=new He(d);if(this.callbacks.addOption(p),this.settings.isMultiple){let w=this.store.getSelected();w.push(p.id),this.callbacks.setSelected(w,!0)}else this.callbacks.setSelected([p.id],!0);this.callbacks.search(""),this.settings.closeOnSelect&&setTimeout(()=>{this.callbacks.close()},100)},c=this.callbacks.addable(a);c===!1||c===void 0||c===null||(c instanceof Promise?c.then(d=>{u(typeof d=="string"?{text:d,value:d}:d)}):u(typeof c=="string"?{text:c,value:c}:c))},t.appendChild(r),s.addable={main:r,svg:l,path:i}}return s}searchFocus(){this.content.search.input.focus()}getOptions(t=!1,n=!1,r=!1){let s="."+this.classes.option;return t&&(s+=":not(."+this.classes.placeholder+")"),n&&(s+=":not(."+this.classes.disabled+")"),r&&(s+=":not(."+this.classes.hide+")"),Array.from(this.content.list.querySelectorAll(s))}highlight(t){const n=this.getOptions(!0,!0,!0);if(n.length===0)return;if(n.length===1&&!n[0].classList.contains(this.classes.highlighted)){n[0].classList.add(this.classes.highlighted);return}let r=!1;for(const s of n)s.classList.contains(this.classes.highlighted)&&(r=!0);if(!r){for(const s of n)if(s.classList.contains(this.classes.selected)){s.classList.add(this.classes.highlighted);break}}for(let s=0;s=0?s-1:n.length-1];o.classList.add(this.classes.highlighted),this.ensureElementInView(this.content.list,o);const a=o.parentElement;if(a&&a.classList.contains(this.classes.close)){const u=a.querySelector("."+this.classes.optgroupLabel);u&&u.click()}return}n[t==="down"?0:n.length-1].classList.add(this.classes.highlighted),this.ensureElementInView(this.content.list,n[t==="down"?0:n.length-1])}listDiv(){const t=document.createElement("div");return t.classList.add(this.classes.list),t}renderError(t){this.content.list.innerHTML="";const n=document.createElement("div");n.classList.add(this.classes.error),n.textContent=t,this.content.list.appendChild(n)}renderSearching(){this.content.list.innerHTML="";const t=document.createElement("div");t.classList.add(this.classes.searching),t.textContent=this.settings.searchingText,this.content.list.appendChild(t)}renderOptions(t){if(this.content.list.innerHTML="",t.length===0){const n=document.createElement("div");n.classList.add(this.classes.search),n.innerHTML=this.settings.searchText,this.content.list.appendChild(n);return}for(const n of t){if(n instanceof Lt){const r=document.createElement("div");r.classList.add(this.classes.optgroup);const s=document.createElement("div");s.classList.add(this.classes.optgroupLabel),r.appendChild(s);const l=document.createElement("div");l.classList.add(this.classes.optgroupLabelText),l.textContent=n.label,s.appendChild(l);const i=document.createElement("div");if(i.classList.add(this.classes.optgroupActions),s.appendChild(i),this.settings.isMultiple&&n.selectAll){const o=document.createElement("div");o.classList.add(this.classes.optgroupSelectAll);let a=!0;for(const w of n.options)if(!w.selected){a=!1;break}a&&o.classList.add(this.classes.selected);const u=document.createElement("span");u.textContent=n.selectAllText,o.appendChild(u);const c=document.createElementNS("http://www.w3.org/2000/svg","svg");c.setAttribute("viewBox","0 0 100 100"),o.appendChild(c);const d=document.createElementNS("http://www.w3.org/2000/svg","path");d.setAttribute("d",this.classes.optgroupSelectAllBox),c.appendChild(d);const p=document.createElementNS("http://www.w3.org/2000/svg","path");p.setAttribute("d",this.classes.optgroupSelectAllCheck),c.appendChild(p),o.addEventListener("click",w=>{w.preventDefault(),w.stopPropagation();const x=this.store.getSelected();if(a){const _=x.filter(L=>{for(const m of n.options)if(L===m.id)return!1;return!0});this.callbacks.setSelected(_,!0);return}else{const _=x.concat(n.options.map(L=>L.id));for(const L of n.options)this.store.getOptionByID(L.id)||this.callbacks.addOption(L);this.callbacks.setSelected(_,!0);return}}),i.appendChild(o)}if(n.closable!=="off"){const o=document.createElement("div");o.classList.add(this.classes.optgroupClosable);const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100"),a.classList.add(this.classes.arrow),o.appendChild(a);const u=document.createElementNS("http://www.w3.org/2000/svg","path");a.appendChild(u),n.options.some(c=>c.selected)||this.content.search.input.value.trim()!==""?(o.classList.add(this.classes.open),u.setAttribute("d",this.classes.arrowOpen)):n.closable==="open"?(r.classList.add(this.classes.open),u.setAttribute("d",this.classes.arrowOpen)):n.closable==="close"&&(r.classList.add(this.classes.close),u.setAttribute("d",this.classes.arrowClose)),s.addEventListener("click",c=>{c.preventDefault(),c.stopPropagation(),r.classList.contains(this.classes.close)?(r.classList.remove(this.classes.close),r.classList.add(this.classes.open),u.setAttribute("d",this.classes.arrowOpen)):(r.classList.remove(this.classes.open),r.classList.add(this.classes.close),u.setAttribute("d",this.classes.arrowClose))}),i.appendChild(o)}r.appendChild(s);for(const o of n.options)r.appendChild(this.option(o));this.content.list.appendChild(r)}n instanceof He&&this.content.list.appendChild(this.option(n))}}option(t){if(t.placeholder){const r=document.createElement("div");return r.classList.add(this.classes.option),r.classList.add(this.classes.hide),r}const n=document.createElement("div");return n.dataset.id=t.id,n.id=t.id,n.classList.add(this.classes.option),n.setAttribute("role","option"),t.class&&t.class.split(" ").forEach(r=>{n.classList.add(r)}),t.style&&(n.style.cssText=t.style),this.settings.searchHighlight&&this.content.search.input.value.trim()!==""?n.innerHTML=this.highlightText(t.html!==""?t.html:t.text,this.content.search.input.value,this.classes.searchHighlighter):t.html!==""?n.innerHTML=t.html:n.textContent=t.text,this.settings.showOptionTooltips&&n.textContent&&n.setAttribute("title",n.textContent),t.display||n.classList.add(this.classes.hide),t.disabled&&n.classList.add(this.classes.disabled),t.selected&&this.settings.hideSelected&&n.classList.add(this.classes.hide),t.selected?(n.classList.add(this.classes.selected),n.setAttribute("aria-selected","true"),this.main.main.setAttribute("aria-activedescendant",n.id)):(n.classList.remove(this.classes.selected),n.setAttribute("aria-selected","false")),n.addEventListener("click",r=>{r.preventDefault(),r.stopPropagation();const s=this.store.getSelected(),l=r.currentTarget,i=String(l.dataset.id);if(t.disabled||t.selected&&!this.settings.allowDeselect||this.settings.isMultiple&&this.settings.maxSelected<=s.length&&!t.selected||this.settings.isMultiple&&this.settings.minSelected>=s.length&&t.selected)return;let o=!1;const a=this.store.getSelectedOptions();let u=[];this.settings.isMultiple&&(t.selected?u=a.filter(c=>c.id!==i):u=a.concat(t)),this.settings.isMultiple||(t.selected?u=[]:u=[t]),this.callbacks.beforeChange||(o=!0),this.callbacks.beforeChange&&(this.callbacks.beforeChange(u,a)===!1?o=!1:o=!0),o&&(this.store.getOptionByID(i)||this.callbacks.addOption(t),this.callbacks.setSelected(u.map(c=>c.id),!1),this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(u))}),n}destroy(){this.main.main.remove(),this.content.main.remove()}highlightText(t,n,r){let s=t;const l=new RegExp("("+n.trim()+")(?![^<]*>[^<>]*${a}`),s}moveContentAbove(){const t=this.main.main.offsetHeight,n=this.content.main.offsetHeight;this.main.main.classList.remove(this.classes.openBelow),this.main.main.classList.add(this.classes.openAbove),this.content.main.classList.remove(this.classes.openBelow),this.content.main.classList.add(this.classes.openAbove);const r=this.main.main.getBoundingClientRect();this.content.main.style.margin="-"+(t+n-1)+"px 0px 0px 0px",this.content.main.style.top=r.top+r.height+window.scrollY+"px",this.content.main.style.left=r.left+window.scrollX+"px",this.content.main.style.width=r.width+"px"}moveContentBelow(){this.main.main.classList.remove(this.classes.openAbove),this.main.main.classList.add(this.classes.openBelow),this.content.main.classList.remove(this.classes.openAbove),this.content.main.classList.add(this.classes.openBelow);const t=this.main.main.getBoundingClientRect();this.content.main.style.margin="-1px 0px 0px 0px",this.settings.contentPosition!=="relative"&&(this.content.main.style.top=t.top+t.height+window.scrollY+"px",this.content.main.style.left=t.left+window.scrollX+"px",this.content.main.style.width=t.width+"px")}ensureElementInView(t,n){const r=t.scrollTop+t.offsetTop,s=r+t.clientHeight,l=n.offsetTop,i=l+n.clientHeight;ls&&(t.scrollTop+=i-s)}putContent(){const t=this.main.main.offsetHeight,n=this.main.main.getBoundingClientRect(),r=this.content.main.offsetHeight;return window.innerHeight-(n.top+t)<=r&&n.top>r?"up":"down"}updateDeselectAll(){if(!this.store||!this.settings)return;const t=this.store.getSelectedOptions(),n=t&&t.length>0,r=this.settings.isMultiple,s=this.settings.allowDeselect,l=this.main.deselect.main,i=this.classes.hide;s&&!(r&&!n)?l.classList.remove(i):l.classList.add(i)}}class Ly{constructor(t){this.listen=!1,this.observer=null,this.select=t,this.valueChange=this.valueChange.bind(this),this.select.addEventListener("change",this.valueChange,{passive:!0}),this.observer=new MutationObserver(this.observeCall.bind(this)),this.changeListen(!0)}enable(){this.select.disabled=!1}disable(){this.select.disabled=!0}hideUI(){this.select.tabIndex=-1,this.select.style.display="none",this.select.setAttribute("aria-hidden","true")}showUI(){this.select.removeAttribute("tabindex"),this.select.style.display="",this.select.removeAttribute("aria-hidden")}changeListen(t){this.listen=t,t&&this.observer&&this.observer.observe(this.select,{subtree:!0,childList:!0,attributes:!0}),t||this.observer&&this.observer.disconnect()}valueChange(t){return this.listen&&this.onValueChange&&this.onValueChange(this.getSelectedOptions()),!0}observeCall(t){if(!this.listen)return;let n=!1,r=!1,s=!1;for(const l of t)l.target===this.select&&(l.attributeName==="disabled"&&(r=!0),l.attributeName==="class"&&(n=!0)),(l.target.nodeName==="OPTGROUP"||l.target.nodeName==="OPTION")&&(s=!0);n&&this.onClassChange&&this.onClassChange(this.select.className.split(" ")),r&&this.onDisabledChange&&(this.changeListen(!1),this.onDisabledChange(this.select.disabled),this.changeListen(!0)),s&&this.onOptionsChange&&(this.changeListen(!1),this.onOptionsChange(this.getData()),this.changeListen(!0))}getData(){let t=[];const n=this.select.childNodes;for(const r of n)r.nodeName==="OPTGROUP"&&t.push(this.getDataFromOptgroup(r)),r.nodeName==="OPTION"&&t.push(this.getDataFromOption(r));return t}getDataFromOptgroup(t){let n={id:t.id,label:t.label,selectAll:t.dataset?t.dataset.selectall==="true":!1,selectAllText:t.dataset?t.dataset.selectalltext:"Select all",closable:t.dataset?t.dataset.closable:"off",options:[]};const r=t.childNodes;for(const s of r)s.nodeName==="OPTION"&&n.options.push(this.getDataFromOption(s));return n}getDataFromOption(t){return{id:t.id,value:t.value,text:t.text,html:t.dataset&&t.dataset.html?t.dataset.html:"",selected:t.selected,display:t.style.display!=="none",disabled:t.disabled,mandatory:t.dataset?t.dataset.mandatory==="true":!1,placeholder:t.dataset.placeholder==="true",class:t.className,style:t.style.cssText,data:t.dataset}}getSelectedOptions(){let t=[];const n=this.select.childNodes;for(const r of n){if(r.nodeName==="OPTGROUP"){const s=r.childNodes;for(const l of s)if(l.nodeName==="OPTION"){const i=l;i.selected&&t.push(this.getDataFromOption(i))}}if(r.nodeName==="OPTION"){const s=r;s.selected&&t.push(this.getDataFromOption(s))}}return t}getSelectedValues(){return this.getSelectedOptions().map(t=>t.value)}setSelected(t){this.changeListen(!1);const n=this.select.childNodes;for(const r of n){if(r.nodeName==="OPTGROUP"){const l=r.childNodes;for(const i of l)if(i.nodeName==="OPTION"){const o=i;o.selected=t.includes(o.id)}}if(r.nodeName==="OPTION"){const s=r;s.selected=t.includes(s.id)}}this.changeListen(!0)}updateSelect(t,n,r){this.changeListen(!1),t&&(this.select.dataset.id=t),n&&(this.select.style.cssText=n),r&&(this.select.className="",r.forEach(s=>{s.trim()!==""&&this.select.classList.add(s.trim())})),this.changeListen(!0)}updateOptions(t){this.changeListen(!1),this.select.innerHTML="";for(const n of t)n instanceof Lt&&this.select.appendChild(this.createOptgroup(n)),n instanceof He&&this.select.appendChild(this.createOption(n));this.select.dispatchEvent(new Event("change")),this.changeListen(!0)}createOptgroup(t){const n=document.createElement("optgroup");if(n.id=t.id,n.label=t.label,t.selectAll&&(n.dataset.selectAll="true"),t.closable!=="off"&&(n.dataset.closable=t.closable),t.options)for(const r of t.options)n.appendChild(this.createOption(r));return n}createOption(t){const n=document.createElement("option");return n.id=t.id,n.value=t.value,n.innerHTML=t.text,t.html!==""&&n.setAttribute("data-html",t.html),t.selected&&(n.selected=t.selected),t.disabled&&(n.disabled=!0),t.display===!1&&(n.style.display="none"),t.placeholder&&n.setAttribute("data-placeholder","true"),t.mandatory&&n.setAttribute("data-mandatory","true"),t.class&&t.class.split(" ").forEach(r=>{n.classList.add(r)}),t.data&&typeof t.data=="object"&&Object.keys(t.data).forEach(r=>{n.setAttribute("data-"+Ay(r),t.data[r])}),n}destroy(){this.changeListen(!1),this.select.removeEventListener("change",this.valueChange),this.observer&&(this.observer.disconnect(),this.observer=null),delete this.select.dataset.id,this.showUI()}}class Ty{constructor(t){this.id="",this.style="",this.class=[],this.isMultiple=!1,this.isOpen=!1,this.isFullOpen=!1,this.intervalMove=null,t||(t={}),this.id="ss-"+wu(),this.style=t.style||"",this.class=t.class||[],this.disabled=t.disabled!==void 0?t.disabled:!1,this.alwaysOpen=t.alwaysOpen!==void 0?t.alwaysOpen:!1,this.showSearch=t.showSearch!==void 0?t.showSearch:!0,this.ariaLabel=t.ariaLabel||"Combobox",this.searchPlaceholder=t.searchPlaceholder||"Search",this.searchText=t.searchText||"No Results",this.searchingText=t.searchingText||"Searching...",this.searchHighlight=t.searchHighlight!==void 0?t.searchHighlight:!1,this.closeOnSelect=t.closeOnSelect!==void 0?t.closeOnSelect:!0,this.contentLocation=t.contentLocation||document.body,this.contentPosition=t.contentPosition||"absolute",this.openPosition=t.openPosition||"auto",this.placeholderText=t.placeholderText!==void 0?t.placeholderText:"Select Value",this.allowDeselect=t.allowDeselect!==void 0?t.allowDeselect:!1,this.hideSelected=t.hideSelected!==void 0?t.hideSelected:!1,this.keepOrder=t.keepOrder!==void 0?t.keepOrder:!1,this.showOptionTooltips=t.showOptionTooltips!==void 0?t.showOptionTooltips:!1,this.minSelected=t.minSelected||0,this.maxSelected=t.maxSelected||1e3,this.timeoutDelay=t.timeoutDelay||200,this.maxValuesShown=t.maxValuesShown||20,this.maxValuesMessage=t.maxValuesMessage||"{number} selected"}}let zh=class{constructor(t){var i;if(this.events={search:void 0,searchFilter:(o,a)=>o.text.toLowerCase().indexOf(a.toLowerCase())!==-1,addable:void 0,beforeChange:void 0,afterChange:void 0,beforeOpen:void 0,afterOpen:void 0,beforeClose:void 0,afterClose:void 0},this.windowResize=Cs(()=>{!this.settings.isOpen&&!this.settings.isFullOpen||this.render.moveContent()}),this.windowScroll=Cs(()=>{!this.settings.isOpen&&!this.settings.isFullOpen||this.render.moveContent()}),this.documentClick=o=>{this.settings.isOpen&&o.target&&!ky(o.target,this.settings.id)&&this.close(o.type)},this.windowVisibilityChange=()=>{document.hidden&&this.close()},this.selectEl=typeof t.select=="string"?document.querySelector(t.select):t.select,!this.selectEl){t.events&&t.events.error&&t.events.error(new Error("Could not find select element"));return}if(this.selectEl.tagName!=="SELECT"){t.events&&t.events.error&&t.events.error(new Error("Element isnt of type select"));return}this.selectEl.dataset.ssid&&this.destroy(),this.settings=new Ty(t.settings);const n=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const o in t.events)t.events.hasOwnProperty(o)&&(n.indexOf(o)!==-1?this.events[o]=Cs(t.events[o],100):this.events[o]=t.events[o]);this.settings.disabled=(i=t.settings)!=null&&i.disabled?t.settings.disabled:this.selectEl.disabled,this.settings.isMultiple=this.selectEl.multiple,this.settings.style=this.selectEl.style.cssText,this.settings.class=this.selectEl.className.split(" "),this.select=new Ly(this.selectEl),this.select.updateSelect(this.settings.id,this.settings.style,this.settings.class),this.select.hideUI(),this.select.onValueChange=o=>{this.setSelected(o.map(a=>a.id))},this.select.onClassChange=o=>{this.settings.class=o,this.render.updateClassStyles()},this.select.onDisabledChange=o=>{o?this.disable():this.enable()},this.select.onOptionsChange=o=>{this.setData(o)},this.store=new Oy(this.settings.isMultiple?"multiple":"single",t.data?t.data:this.select.getData()),t.data&&this.select.updateOptions(this.store.getData());const r={open:this.open.bind(this),close:this.close.bind(this),addable:this.events.addable?this.events.addable:void 0,setSelected:this.setSelected.bind(this),addOption:this.addOption.bind(this),search:this.search.bind(this),beforeChange:this.events.beforeChange,afterChange:this.events.afterChange};this.render=new Py(this.settings,this.store,r),this.render.renderValues(),this.render.renderOptions(this.store.getData());const s=this.selectEl.getAttribute("aria-label"),l=this.selectEl.getAttribute("aria-labelledby");s?this.render.main.main.setAttribute("aria-label",s):l&&this.render.main.main.setAttribute("aria-labelledby",l),this.selectEl.parentNode&&this.selectEl.parentNode.insertBefore(this.render.main.main,this.selectEl.nextSibling),window.addEventListener("resize",this.windowResize,!1),this.settings.openPosition==="auto"&&window.addEventListener("scroll",this.windowScroll,!1),document.addEventListener("visibilitychange",this.windowVisibilityChange),this.settings.disabled&&this.disable(),this.settings.alwaysOpen&&this.open(),this.selectEl.slim=this}enable(){this.settings.disabled=!1,this.select.enable(),this.render.enable()}disable(){this.settings.disabled=!0,this.select.disable(),this.render.disable()}getData(){return this.store.getData()}setData(t){const n=this.store.getSelected(),r=this.store.validateDataArray(t);if(r){this.events.error&&this.events.error(r);return}this.store.setData(t);const s=this.store.getData();this.select.updateOptions(s),this.render.renderValues(),this.render.renderOptions(s),this.events.afterChange&&!po(n,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){return this.store.getSelectedOptions().map(t=>t.value)}setSelected(t,n=!0){const r=this.store.getSelected(),s=this.store.getDataOptions();t=Array.isArray(t)?t:[t];const l=[];for(const o of t){if(s.find(a=>a.id==o)){l.push(o);continue}for(const a of s.filter(u=>u.value==o))l.push(a.id)}this.store.setSelectedBy("id",l);const i=this.store.getData();this.select.updateOptions(i),this.render.renderValues(),this.render.content.search.input.value!==""?this.search(this.render.content.search.input.value):this.render.renderOptions(i),n&&this.events.afterChange&&!po(r,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}addOption(t){const n=this.store.getSelected();this.store.getDataOptions().some(s=>s.value===(t.value??t.text))||this.store.addOption(t);const r=this.store.getData();this.select.updateOptions(r),this.render.renderValues(),this.render.renderOptions(r),this.events.afterChange&&!po(n,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}open(){this.settings.disabled||this.settings.isOpen||(this.events.beforeOpen&&this.events.beforeOpen(),this.render.open(),this.settings.showSearch&&this.render.searchFocus(),this.settings.isOpen=!0,setTimeout(()=>{this.events.afterOpen&&this.events.afterOpen(),this.settings.isOpen&&(this.settings.isFullOpen=!0),document.addEventListener("click",this.documentClick)},this.settings.timeoutDelay),this.settings.contentPosition==="absolute"&&(this.settings.intervalMove&&clearInterval(this.settings.intervalMove),this.settings.intervalMove=setInterval(this.render.moveContent.bind(this.render),500)))}close(t=null){!this.settings.isOpen||this.settings.alwaysOpen||(this.events.beforeClose&&this.events.beforeClose(),this.render.close(),this.render.content.search.input.value!==""&&this.search(""),this.render.mainFocus(t),this.settings.isOpen=!1,this.settings.isFullOpen=!1,setTimeout(()=>{this.events.afterClose&&this.events.afterClose(),document.removeEventListener("click",this.documentClick)},this.settings.timeoutDelay),this.settings.intervalMove&&clearInterval(this.settings.intervalMove))}search(t){if(this.render.content.search.input.value!==t&&(this.render.content.search.input.value=t),!this.events.search){this.render.renderOptions(t===""?this.store.getData():this.store.search(t,this.events.searchFilter));return}this.render.renderSearching();const n=this.events.search(t,this.store.getSelectedOptions());if(n instanceof Promise){n.then(r=>{this.render.renderOptions(this.store.partialToFullData(r))}).catch(r=>{this.render.renderError(typeof r=="string"?r:r.message)});return}else Array.isArray(n)?this.render.renderOptions(this.store.partialToFullData(n)):this.render.renderError("Search event must return a promise or an array of data")}destroy(){document.removeEventListener("click",this.documentClick),window.removeEventListener("resize",this.windowResize,!1),this.settings.openPosition==="auto"&&window.removeEventListener("scroll",this.windowScroll,!1),document.removeEventListener("visibilitychange",this.windowVisibilityChange),this.store.setData([]),this.render.destroy(),this.select.destroy()}};const Ry="CWYDT23U",Ny="slimselectjscom",My=Mi({__name:"carbonad",setup(e){const t=Gd(null);let n=!1;return uh(()=>{if(!n){n=!0;const r=document.createElement("script");r.id="_carbonads_js",r.src=`//cdn.carbonads.com/carbon.js?serve=${Ry}&placement=${Ny}`,r.async=!0,t.value&&t.value.appendChild(r)}}),(r,s)=>(Di(),Eh("div",{class:"carbon-container",ref_key:"container",ref:t},null,512))}}),Fy=Mi({name:"App",components:{CarbonAd:My},data(){return{nav:null,navDebounce:Cs(()=>{this.setDemensions()},100),year:new Date().getFullYear(),width:0,height:0,navData:[{text:"Home",value:"/",class:"label"},{label:"Install",closable:"close",options:[{text:"npm",value:"install#npm"},{text:"cdn",value:"install#cdn"},{text:"download",value:"install#download"}]},{label:"Selects",closable:"close",options:[{text:"single",value:"selects#single"},{text:"multiple",value:"selects#multiple"}]},{label:"Data",closable:"close",options:[{text:"types",value:"data#types"},{text:"field",value:"data#field"}]},{label:"Settings",closable:"close",options:[{text:"select",value:"settings#select"},{text:"alwaysOpen",value:"settings#alwaysOpen"},{text:"contentLocation",value:"settings#contentLocation"},{text:"contentPosition",value:"settings#contentPosition"},{text:"openPosition",value:"settings#openPosition"},{text:"placeholder",value:"settings#placeholder"},{text:"selectAll",value:"settings#selectAll"},{text:"allowDeselect",value:"settings#allowDeselect"},{text:"display",value:"settings#display"},{text:"disabled",value:"settings#disabled"},{text:"mandatory",value:"settings#mandatory"},{text:"minmax",value:"settings#minmax"},{text:"dataAttributes",value:"settings#dataAttributes"},{text:"cssClass",value:"settings#cssClass"},{text:"inlineStyles",value:"settings#inlineStyles"},{text:"html",value:"settings#html"},{text:"keepOrder",value:"settings#keepOrder"},{text:"search",value:"settings#search"},{text:"closeOnSelect",value:"settings#closeOnSelect"},{text:"showOptionTooltips",value:"settings#showOptionTooltips"},{text:"closable",value:"settings#closable"},{text:"hideSelected",value:"settings#hideSelected"},{text:"maxValuesShown",value:"settings#maxValuesShown"}]},{label:"Events",closable:"close",options:[{text:"error",value:"events#error"},{text:"beforeChange",value:"events#beforeChange"},{text:"afterChange",value:"events#afterChange"},{text:"open",value:"events#open"},{text:"search",value:"events#search"},{text:"searchFilter",value:"events#searchFilter"},{text:"addable",value:"events#addable"}]},{label:"Methods",closable:"close",options:[{text:"getSelected",value:"methods#getSelected"},{text:"setSelected",value:"methods#setSelected"},{text:"getData",value:"methods#getData"},{text:"setData",value:"methods#setData"},{text:"enableDisable",value:"methods#enableDisable"},{text:"openClose",value:"methods#openClose"},{text:"search",value:"methods#search"},{text:"destroy",value:"methods#destroy"}]},{label:"Frameworks",closable:"close",options:[{text:"vue",value:"vue"},{text:"react",value:"react"}]}]}},mounted(){this.runNav(),this.$router.isReady().then(()=>{this.nav&&this.nav.setSelected(this.$router.currentRoute.value.fullPath.replace("/",""))}),this.$router.afterEach(()=>{if(this.$route.query.p){setTimeout(()=>{this.$route.query.p&&this.$router.push({path:this.$route.query.p.toString(),hash:this.$route.hash})},200);return}setTimeout(()=>{const e=this.$route.hash;if(e===""&&window.scroll({top:0,behavior:"smooth"}),e){const t=document.querySelector(e);if(t){const n=document.querySelector("header"),r=document.querySelector("nav"),s=n?n.clientHeight+(window.innerWidth<700?r.clientHeight:0)+8:0;window.scroll({top:t.offsetTop-s,behavior:"smooth"})}}},200)}),this.setDemensions(),window.addEventListener("resize",this.navDebounce)},unmounted(){var e;window.removeEventListener("resize",this.navDebounce),(e=this.nav)==null||e.destroy()},watch:{width(){this.runNav()}},methods:{setDemensions(){this.width=document.documentElement.clientWidth,this.height=document.documentElement.clientHeight},runNav(){this.nav&&(this.nav.destroy(),this.nav=null);let e={searchHighlight:!0,openContent:"below"};this.width>700&&(e.alwaysOpen=!0,e.contentPosition="relative",e.contentLocation=this.$refs.navContent),this.nav=new zh({select:this.$refs.nav,data:this.navData,settings:e,events:{afterChange:t=>{const r=t[0].value.split("#"),s=r[0],l=r[1]?"#"+r[1]:void 0;this.$router.push({path:s,hash:l})}}})}}}),Iy="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpFNTE3OEEyRTk5QTAxMUUyOUExNUJDMTA0NkE4OTA0RCIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpFNTE3OEEyRjk5QTAxMUUyOUExNUJDMTA0NkE4OTA0RCI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkU1MTc4QTJDOTlBMDExRTI5QTE1QkMxMDQ2QTg5MDREIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkU1MTc4QTJEOTlBMDExRTI5QTE1QkMxMDQ2QTg5MDREIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+FYrpWAAABrNJREFUeNrkW2lsVFUUvjMWirYUkS5BXApUa2vd6gL+wAWjoP5RiW2EUBajAiqSuPADQ0w1UUQTrcFAUUSJEKriEuMWFKuJIElFSS24YNpQK6WoBbuAktbva880M8O8vnfevJm+CSf5cme599xzvnfffffce17AJFjycnLzUVwDXAgUAucBY4BMIEOqdQIdwJ/Az4J64OvWtoONibQvkACHgyiuBe4CbgLOjVNlE/AZsAmoBSE9viQAjueieBCYC5yVoAvWDKwHqkBEmy8IgON09lHgXmCESY4cBaqBlSCieUgIgOPDUCwBngBOM0MjXdL/CyDiv6QRAOcvR7EBKDL+kD3AbJBQl1AC4DjrLwaeBYYbf8m/ciu+BCJ6PScAzp+K4nXgTuNveQuYAxK6PSMAzo9C8TFwtUkN2Q7cDBIOx02AOP8FUGpSSzgf3GBHQsDGec7unwOTTWrKDiGhS02ATHjvALeb1JZ3gRlWE+MpVq0yMzIekRk/1YWP6o7Ors5vHI8AXH1Odl8BaTbKrwd4j10MTAduS8JqkKvA94BPgN0A56htNm2OMyDDKNhuSwCcT5dIrMBG6S4oLI1qezqKBcBjwGiPHW8HVgCr0W97VL/fobjMpv2vQAnaHgv/MdYVXurAeSNPhggRw56BQatRVgL3A0H5+xDwI8Dw9g/5Hlq+clmdDYwF8iV0zpb/GP2tApZHOx4m2xwQUCC+VVqOABg+AUUDkO6AgHkwaL2DJXORxPVNylUnw+gpXObaLXFRlxHoaw7U8uoXQ99vViNgqUPnKQfsKojhdW7GuxDW5JUtIuni432hH4JhLJ7Dq6qwcZiPZnpNXDJPfI0kQEJbjVM5PiIgW3nhlkQQILH9LGWnV/iIAK0ts8TngREwDchVKrnKRwRobckVnwcIKFcq4ONrkY8IWBT2SHUq5eEE3Khs/CRm6Z1+8V5sqVQ26/M5gHuhSJ79TqUFmIhOj/ppwQ8/Rshqb5yiWXFQFhsaWeU352UU0KaXlc2mBI1+Y3OzjyO/Gm2kSAIKFQ2awfQ+v3oP23gL/K5oUhh0GPiEZG8KxP97FHULgsqwtTUFCDioqHsGCRipaHA8BQjQrAcyg4roj5KVAgSMUtRNDyqVj0wBAlQ2koBuRf3xKUBAvqJuN1eCrYpAiHNAltNjpyFYDfL47oix38wdmDA5AvYr+kjzWRgcLVcqnKfsJwGNyk5u9TEBtyjrNwaVgRClTPKA/Db8aVOZslkDG2nD2vEuOkqGlLmYpHcGJLlJu8LjtvJFgx06Jvnq8xC33gUBeUE4waWjduua5wdVPrr6VS6cr6PvoXv5Ixed3g3mH/fB1V9OW1w07fM5IEouUEZR4bIWWJzsTRJ55r8I3ONSRRFs3hsIU8hkgkkulf0CPAx8qElQcuk4beYp9Epgoks138LOvqSPgfyAzIwMZlnFSobgIegc4H3gH6AkxmKDub9Mjb0DeoYDrZ1dne0eO14AvfPx8RXgAYaycahbBvt+GLgFpIM0md3PjqrMTMxpYKxB6p1v+s/n7bbSuMCqldmZyc+fRh9ND+IsAxrmG3C3qtj0J1uP84hLrnwnwJbjEQRIxzw0XB2jER93C9Bog9TjsRgzLpzuJr0BzHV6e8gwf9XoziqdCv1YE/oSTQBHwfem/3w+5syPxuukLtfdO0zk+WIs+YuPKLQ7ohzyWTIix3joPPMTLg1d/Yg5gIL7ogf32U/4WGGhYDr+34J6bUALPpPA62w6XYMOP9BaCv3HoD/PeJubODN6U/eEq4cKTIurttpBAZ4L+87TmKdtOt0ah8FbPXS+WnyLEKskqUy5FaweM5dA2e6w+pNkZuajhfMD3/zYBfDKb3Y6+cWwgytOL7bh98nQ73BEgHReIvd4Roy/a6Cs3CRYJOnq7zjV8HWcybC33mpLLKZIA84FPRYhcSokUNL2Civnjd0MjoZbUCy0+PtNkDDD5wQsFB8sxWm2+GJZd8eSt4HnZXnZ66Nb4CHYYxuxat4XmI1inbHeczskq77DMrK4z8AgK3+Q/L5EEMBn/PzQos0zAsQgvg5XY3TpNKOTSAD3NsrQX63TBqq9PVHM9NgvfXi/06ZSjfNqAoQEHj9Pled+pw8cpw2co6aKbSoJxDlJnYniKdP/sqSVrrEw7IBL/TnG+rSXEy7fYVoG/S1uffDkzVEYypB1qewJRCdb5rp9yxN6mQDZFmOS2wisCIXo8Yin7w7LiKiQEcFYfhOMnBmnzo1CLIO09Qyt47niJxDQ29trTmY56Qn4X4ABAFR7IoDmVT5NAAAAAElFTkSuQmCC",Dy="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACAAQMAAAD58POIAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZQTFRFyzg3////IltC9QAAAAFiS0dEAf8CLd4AAAAJcEhZcwAACxMAAAsTAQCanBgAAAAkSURBVEjHY2AYBYMV/IeDUQG4AJgeFRgVGBUYFSBNYBQMPgAARjtdvxo6xaMAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTEtMDUtMzBUMjM6MTA6NDQtMDc6MDCm4GvfAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDEwLTEyLTA2VDEyOjIwOjEyLTA4OjAwpIGEmQAAADJ0RVh0UE5HOmNIUk0AY2h1bmsgd2FzIGZvdW5kIChzZWUgQ2hyb21hdGljaXR5LCBhYm92ZSkH0UjaAAAAKXRFWHRQTkc6Z0FNQQBnYW1tYT0wLjQ1NDU1IChTZWUgR2FtbWEsIGFib3ZlKRISLKcAAAAUdEVYdFBORzpJSERSLmJpdF9kZXB0aAA4KYV+UAAAABV0RVh0UE5HOklIRFIuY29sb3JfdHlwZQA2BkqnKwAAABt0RVh0UE5HOklIRFIuaW50ZXJsYWNlX21ldGhvZAAw+zsHjAAAABx0RVh0UE5HOklIRFIud2lkdGgsaGVpZ2h0ADE2LCAxNjjVBg0AAAAodEVYdFBORzpwSFlzAHhfcmVzPTI4MzUsIHlfcmVzPTI4MzUsIHVuaXRzPTGCKXI+AAAAKHRFWHRQTkc6c1JHQgBpbnRlbnQ9MCAoU2VlIFJlbmRlcmluZyBpbnRlbnQp8hEU9QAAAABJRU5ErkJggg==",by=(e,t)=>{const n=e.__vccOpts||e;for(const[r,s]of t)n[r]=s;return n},jy=Iv('

Slim Select 2.0

Advanced select dropdown
',1),zy={ref:"nav"},By={class:"nav-content",ref:"navContent"},Uy=rn("a",{href:"http://webiswhatido.com",style:{color:"#ffffff"},target:"_blank"},"Brian Voelker",-1),Vy=rn("br",null,null,-1);function Hy(e,t,n,r,s,l){const i=Lc("CarbonAd"),o=Lc("router-view");return Di(),Eh(yt,null,[jy,rn("nav",null,[rn("select",zy,null,512),rn("div",By,null,512),be(i)]),rn("main",null,[be(o),rn("footer",null,[Il(" © "+hg(e.year)+" ",1),Uy,Il(". "),Vy,Il(" Slim Select is under the MIT license. ")])])],64)}const $y=by(Fy,[["render",Hy]]);var pf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Su(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Bh={exports:{}};(function(e){var t=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};/** * Prism: Lightweight, robust, elegant syntax highlighting * * @license MIT diff --git a/src/slim-select/index.ts b/src/slim-select/index.ts index 47bc4d43..7aa065c8 100644 --- a/src/slim-select/index.ts +++ b/src/slim-select/index.ts @@ -245,15 +245,31 @@ export default class SlimSelect { } public getSelected(): string[] { - return this.store.getSelected() + return this.store.getSelectedOptions().map((option) => option.value) } - public setSelected(id: string | string[], runAfterChange = true): void { + public setSelected(values: string | string[], runAfterChange = true): void { // Get original selected values const selected = this.store.getSelected() + const options = this.store.getDataOptions() + values = Array.isArray(values) ? values : [values] + const ids = [] + + // for back-compatibility support both, set by id and set by value + for (const value of values) { + if (options.find((option) => option.id == value)) { + ids.push(value) + continue + } + + // if option with given id is not found try to search by value + for (const option of options.filter((option) => option.value == value)) { + ids.push(option.id) + } + } // Update the store - this.store.setSelectedBy('id', Array.isArray(id) ? id : [id]) + this.store.setSelectedBy('id', ids) const data = this.store.getData() // Update the select element diff --git a/src/vue/dist/slim-select/helpers.d.ts b/src/vue/dist/slim-select/helpers.d.ts index df354571..88972fef 100644 --- a/src/vue/dist/slim-select/helpers.d.ts +++ b/src/vue/dist/slim-select/helpers.d.ts @@ -1,9 +1,5 @@ -export declare function generateID(): string -export declare function hasClassInTree(element: HTMLElement, className: string): any -export declare function debounce void>( - func: T, - wait?: number, - immediate?: boolean, -): () => void -export declare function isEqual(a: any, b: any): boolean -export declare function kebabCase(str: string): string +export declare function generateID(): string; +export declare function hasClassInTree(element: HTMLElement, className: string): any; +export declare function debounce void>(func: T, wait?: number, immediate?: boolean): () => void; +export declare function isEqual(a: any, b: any): boolean; +export declare function kebabCase(str: string): string; diff --git a/src/vue/dist/slim-select/index.d.ts b/src/vue/dist/slim-select/index.d.ts index babd1b93..4e3fcedf 100644 --- a/src/vue/dist/slim-select/index.d.ts +++ b/src/vue/dist/slim-select/index.d.ts @@ -1,46 +1,46 @@ -import Render from './render' -import Select from './select' -import Settings, { SettingsPartial } from './settings' -import Store, { DataArray, DataArrayPartial, Option, OptionOptional } from './store' +import Render from './render'; +import Select from './select'; +import Settings, { SettingsPartial } from './settings'; +import Store, { DataArray, DataArrayPartial, Option, OptionOptional } from './store'; export interface Config { - select: string | Element - data?: DataArrayPartial - settings?: SettingsPartial - events?: Events + select: string | Element; + data?: DataArrayPartial; + settings?: SettingsPartial; + events?: Events; } export interface Events { - search?: (searchValue: string, currentData: DataArray) => Promise | DataArrayPartial - searchFilter?: (option: Option, search: string) => boolean - addable?: (value: string) => Promise | OptionOptional | string | false | null | undefined - beforeChange?: (newVal: Option[], oldVal: Option[]) => boolean | void - afterChange?: (newVal: Option[]) => void - beforeOpen?: () => void - afterOpen?: () => void - beforeClose?: () => void - afterClose?: () => void - error?: (err: Error) => void + search?: (searchValue: string, currentData: DataArray) => Promise | DataArrayPartial; + searchFilter?: (option: Option, search: string) => boolean; + addable?: (value: string) => Promise | OptionOptional | string | false | null | undefined; + beforeChange?: (newVal: Option[], oldVal: Option[]) => boolean | void; + afterChange?: (newVal: Option[]) => void; + beforeOpen?: () => void; + afterOpen?: () => void; + beforeClose?: () => void; + afterClose?: () => void; + error?: (err: Error) => void; } export default class SlimSelect { - selectEl: HTMLSelectElement - settings: Settings - select: Select - store: Store - render: Render - events: Events - constructor(config: Config) - enable(): void - disable(): void - getData(): DataArray - setData(data: DataArrayPartial): void - getSelected(): string[] - setSelected(id: string | string[], runAfterChange?: boolean): void - addOption(option: OptionOptional): void - open(): void - close(eventType?: string | null): void - search(value: string): void - destroy(): void - private windowResize - private windowScroll - private documentClick - private windowVisibilityChange + selectEl: HTMLSelectElement; + settings: Settings; + select: Select; + store: Store; + render: Render; + events: Events; + constructor(config: Config); + enable(): void; + disable(): void; + getData(): DataArray; + setData(data: DataArrayPartial): void; + getSelected(): string[]; + setSelected(values: string | string[], runAfterChange?: boolean): void; + addOption(option: OptionOptional): void; + open(): void; + close(eventType?: string | null): void; + search(value: string): void; + destroy(): void; + private windowResize; + private windowScroll; + private documentClick; + private windowVisibilityChange; } diff --git a/src/vue/dist/slim-select/render.d.ts b/src/vue/dist/slim-select/render.d.ts index 5f3250e6..ca88f0c2 100644 --- a/src/vue/dist/slim-select/render.d.ts +++ b/src/vue/dist/slim-select/render.d.ts @@ -1,120 +1,120 @@ -import Settings from './settings' -import Store, { DataArray, Option, OptionOptional } from './store' +import Settings from './settings'; +import Store, { DataArray, Option, OptionOptional } from './store'; export interface Callbacks { - open: () => void - close: () => void - addable?: (value: string) => Promise | OptionOptional | string | false | undefined | null - setSelected: (value: string | string[], runAfterChange: boolean) => void - addOption: (option: Option) => void - search: (search: string) => void - beforeChange?: (newVal: Option[], oldVal: Option[]) => boolean | void - afterChange?: (newVal: Option[]) => void + open: () => void; + close: () => void; + addable?: (value: string) => Promise | OptionOptional | string | false | undefined | null; + setSelected: (value: string | string[], runAfterChange: boolean) => void; + addOption: (option: Option) => void; + search: (search: string) => void; + beforeChange?: (newVal: Option[], oldVal: Option[]) => boolean | void; + afterChange?: (newVal: Option[]) => void; } export interface Main { - main: HTMLDivElement - values: HTMLDivElement - deselect: { - main: HTMLDivElement - svg: SVGSVGElement - path: SVGPathElement - } - arrow: { - main: SVGSVGElement - path: SVGPathElement - } + main: HTMLDivElement; + values: HTMLDivElement; + deselect: { + main: HTMLDivElement; + svg: SVGSVGElement; + path: SVGPathElement; + }; + arrow: { + main: SVGSVGElement; + path: SVGPathElement; + }; } export interface Content { - main: HTMLDivElement - search: Search - list: HTMLDivElement + main: HTMLDivElement; + search: Search; + list: HTMLDivElement; } export interface Search { - main: HTMLDivElement - input: HTMLInputElement - addable?: { - main: HTMLDivElement - svg: SVGSVGElement - path: SVGPathElement - } + main: HTMLDivElement; + input: HTMLInputElement; + addable?: { + main: HTMLDivElement; + svg: SVGSVGElement; + path: SVGPathElement; + }; } export default class Render { - settings: Settings - store: Store - callbacks: Callbacks - main: Main - content: Content - classes: { - main: string - placeholder: string - values: string - single: string - max: string - value: string - valueText: string - valueDelete: string - valueOut: string - deselect: string - deselectPath: string - arrow: string - arrowClose: string - arrowOpen: string - content: string - openAbove: string - openBelow: string - search: string - searchHighlighter: string - searching: string - addable: string - addablePath: string - list: string - optgroup: string - optgroupLabel: string - optgroupLabelText: string - optgroupActions: string - optgroupSelectAll: string - optgroupSelectAllBox: string - optgroupSelectAllCheck: string - optgroupClosable: string - option: string - optionDelete: string - highlighted: string - open: string - close: string - selected: string - error: string - disabled: string - hide: string - } - constructor(settings: Required, store: Store, callbacks: Callbacks) - enable(): void - disable(): void - open(): void - close(): void - updateClassStyles(): void - updateAriaAttributes(): void - mainDiv(): Main - mainFocus(eventType: string | null): void - placeholder(): HTMLDivElement - renderValues(): void - private renderSingleValue - private renderMultipleValues - multipleValue(option: Option): HTMLDivElement - contentDiv(): Content - moveContent(): void - searchDiv(): Search - searchFocus(): void - getOptions(notPlaceholder?: boolean, notDisabled?: boolean, notHidden?: boolean): HTMLDivElement[] - highlight(dir: 'up' | 'down'): void - listDiv(): HTMLDivElement - renderError(error: string): void - renderSearching(): void - renderOptions(data: DataArray): void - option(option: Option): HTMLDivElement - destroy(): void - private highlightText - moveContentAbove(): void - moveContentBelow(): void - ensureElementInView(container: HTMLElement, element: HTMLElement): void - putContent(): 'up' | 'down' - updateDeselectAll(): void + settings: Settings; + store: Store; + callbacks: Callbacks; + main: Main; + content: Content; + classes: { + main: string; + placeholder: string; + values: string; + single: string; + max: string; + value: string; + valueText: string; + valueDelete: string; + valueOut: string; + deselect: string; + deselectPath: string; + arrow: string; + arrowClose: string; + arrowOpen: string; + content: string; + openAbove: string; + openBelow: string; + search: string; + searchHighlighter: string; + searching: string; + addable: string; + addablePath: string; + list: string; + optgroup: string; + optgroupLabel: string; + optgroupLabelText: string; + optgroupActions: string; + optgroupSelectAll: string; + optgroupSelectAllBox: string; + optgroupSelectAllCheck: string; + optgroupClosable: string; + option: string; + optionDelete: string; + highlighted: string; + open: string; + close: string; + selected: string; + error: string; + disabled: string; + hide: string; + }; + constructor(settings: Required, store: Store, callbacks: Callbacks); + enable(): void; + disable(): void; + open(): void; + close(): void; + updateClassStyles(): void; + updateAriaAttributes(): void; + mainDiv(): Main; + mainFocus(eventType: string | null): void; + placeholder(): HTMLDivElement; + renderValues(): void; + private renderSingleValue; + private renderMultipleValues; + multipleValue(option: Option): HTMLDivElement; + contentDiv(): Content; + moveContent(): void; + searchDiv(): Search; + searchFocus(): void; + getOptions(notPlaceholder?: boolean, notDisabled?: boolean, notHidden?: boolean): HTMLDivElement[]; + highlight(dir: 'up' | 'down'): void; + listDiv(): HTMLDivElement; + renderError(error: string): void; + renderSearching(): void; + renderOptions(data: DataArray): void; + option(option: Option): HTMLDivElement; + destroy(): void; + private highlightText; + moveContentAbove(): void; + moveContentBelow(): void; + ensureElementInView(container: HTMLElement, element: HTMLElement): void; + putContent(): 'up' | 'down'; + updateDeselectAll(): void; } diff --git a/src/vue/dist/slim-select/select.d.ts b/src/vue/dist/slim-select/select.d.ts index 6b531cfa..62b6f779 100644 --- a/src/vue/dist/slim-select/select.d.ts +++ b/src/vue/dist/slim-select/select.d.ts @@ -1,29 +1,29 @@ -import { DataArray, DataArrayPartial, Optgroup, OptgroupOptional, Option } from './store' +import { DataArray, DataArrayPartial, Optgroup, OptgroupOptional, Option } from './store'; export default class Select { - select: HTMLSelectElement - onValueChange?: (value: Option[]) => void - onClassChange?: (classes: string[]) => void - onDisabledChange?: (disabled: boolean) => void - onOptionsChange?: (data: DataArrayPartial) => void - listen: boolean - private observer - constructor(select: HTMLSelectElement) - enable(): void - disable(): void - hideUI(): void - showUI(): void - changeListen(listen: boolean): void - valueChange(ev: Event): boolean - private observeCall - getData(): DataArrayPartial - getDataFromOptgroup(optgroup: HTMLOptGroupElement): OptgroupOptional - getDataFromOption(option: HTMLOptionElement): Option - getSelectedOptions(): Option[] - getSelectedValues(): string[] - setSelected(ids: string[]): void - updateSelect(id?: string, style?: string, classes?: string[]): void - updateOptions(data: DataArray): void - createOptgroup(optgroup: Optgroup): HTMLOptGroupElement - createOption(info: Option): HTMLOptionElement - destroy(): void + select: HTMLSelectElement; + onValueChange?: (value: Option[]) => void; + onClassChange?: (classes: string[]) => void; + onDisabledChange?: (disabled: boolean) => void; + onOptionsChange?: (data: DataArrayPartial) => void; + listen: boolean; + private observer; + constructor(select: HTMLSelectElement); + enable(): void; + disable(): void; + hideUI(): void; + showUI(): void; + changeListen(listen: boolean): void; + valueChange(ev: Event): boolean; + private observeCall; + getData(): DataArrayPartial; + getDataFromOptgroup(optgroup: HTMLOptGroupElement): OptgroupOptional; + getDataFromOption(option: HTMLOptionElement): Option; + getSelectedOptions(): Option[]; + getSelectedValues(): string[]; + setSelected(ids: string[]): void; + updateSelect(id?: string, style?: string, classes?: string[]): void; + updateOptions(data: DataArray): void; + createOptgroup(optgroup: Optgroup): HTMLOptGroupElement; + createOption(info: Option): HTMLOptionElement; + destroy(): void; } diff --git a/src/vue/dist/slim-select/settings.d.ts b/src/vue/dist/slim-select/settings.d.ts index bfa88c9a..107b4528 100644 --- a/src/vue/dist/slim-select/settings.d.ts +++ b/src/vue/dist/slim-select/settings.d.ts @@ -1,34 +1,34 @@ /// -export type SettingsPartial = Partial +export type SettingsPartial = Partial; export default class Settings { - id: string - style: string - class: string[] - isMultiple: boolean - isOpen: boolean - isFullOpen: boolean - intervalMove: NodeJS.Timeout | null - disabled: boolean - alwaysOpen: boolean - showSearch: boolean - ariaLabel: string - searchPlaceholder: string - searchText: string - searchingText: string - searchHighlight: boolean - closeOnSelect: boolean - contentLocation: HTMLElement - contentPosition: 'relative' | 'absolute' - openPosition: 'auto' | 'up' | 'down' - placeholderText: string - allowDeselect: boolean - hideSelected: boolean - keepOrder: boolean - showOptionTooltips: boolean - minSelected: number - maxSelected: number - timeoutDelay: number - maxValuesShown: number - maxValuesMessage: string - constructor(settings?: SettingsPartial) + id: string; + style: string; + class: string[]; + isMultiple: boolean; + isOpen: boolean; + isFullOpen: boolean; + intervalMove: NodeJS.Timeout | null; + disabled: boolean; + alwaysOpen: boolean; + showSearch: boolean; + ariaLabel: string; + searchPlaceholder: string; + searchText: string; + searchingText: string; + searchHighlight: boolean; + closeOnSelect: boolean; + contentLocation: HTMLElement; + contentPosition: 'relative' | 'absolute'; + openPosition: 'auto' | 'up' | 'down'; + placeholderText: string; + allowDeselect: boolean; + hideSelected: boolean; + keepOrder: boolean; + showOptionTooltips: boolean; + minSelected: number; + maxSelected: number; + timeoutDelay: number; + maxValuesShown: number; + maxValuesMessage: string; + constructor(settings?: SettingsPartial); } diff --git a/src/vue/dist/slim-select/store.d.ts b/src/vue/dist/slim-select/store.d.ts index 507f447b..e00d0d80 100644 --- a/src/vue/dist/slim-select/store.d.ts +++ b/src/vue/dist/slim-select/store.d.ts @@ -1,82 +1,79 @@ -export type DataArray = DataObject[] -export type DataObject = Optgroup | Option -export type DataArrayPartial = DataObjectPartial[] -export type DataObjectPartial = OptgroupOptional | OptionOptional -type selectType = 'single' | 'multiple' +export type DataArray = DataObject[]; +export type DataObject = Optgroup | Option; +export type DataArrayPartial = DataObjectPartial[]; +export type DataObjectPartial = OptgroupOptional | OptionOptional; +type selectType = 'single' | 'multiple'; export interface OptgroupOptional { - id?: string - label: string - selectAll?: boolean - selectAllText?: string - closable?: 'off' | 'open' | 'close' - options?: OptionOptional[] + id?: string; + label: string; + selectAll?: boolean; + selectAllText?: string; + closable?: 'off' | 'open' | 'close'; + options?: OptionOptional[]; } export declare class Optgroup { - id: string - label: string - selectAll: boolean - selectAllText: string - closable: 'off' | 'open' | 'close' - options: Option[] - constructor(optgroup: OptgroupOptional) + id: string; + label: string; + selectAll: boolean; + selectAllText: string; + closable: 'off' | 'open' | 'close'; + options: Option[]; + constructor(optgroup: OptgroupOptional); } export interface OptionOptional { - id?: string - value?: string - text: string - html?: string - selected?: boolean - display?: boolean - disabled?: boolean - mandatory?: boolean - placeholder?: boolean - class?: string - style?: string - data?: { - [key: string]: string - } + id?: string; + value?: string; + text: string; + html?: string; + selected?: boolean; + display?: boolean; + disabled?: boolean; + mandatory?: boolean; + placeholder?: boolean; + class?: string; + style?: string; + data?: { + [key: string]: string; + }; } export declare class Option { - id: string - value: string - text: string - html: string - selected: boolean - display: boolean - disabled: boolean - placeholder: boolean - class: string - style: string - data: { - [key: string]: string - } - mandatory: boolean - constructor(option: OptionOptional) + id: string; + value: string; + text: string; + html: string; + selected: boolean; + display: boolean; + disabled: boolean; + placeholder: boolean; + class: string; + style: string; + data: { + [key: string]: string; + }; + mandatory: boolean; + constructor(option: OptionOptional); } export default class Store { - private selectType - private data - constructor(type: selectType, data: DataArrayPartial) - validateDataArray(data: DataArray | DataArrayPartial): Error | null - validateOption(option: Option | OptionOptional): Error | null - partialToFullData(data: DataArrayPartial): DataArray - setData(data: DataArray | DataArrayPartial): void - getData(): DataArray - getDataOptions(): Option[] - addOption(option: OptionOptional): void - setSelectedBy(selectedType: 'id' | 'value', selectedValues: string[]): void - getSelected(): string[] - getSelectedOptions(): Option[] - getOptgroupByID(id: string): Optgroup | null - getOptionByID(id: string): Option | null - getSelectType(): string - getFirstOption(): Option | null - search(search: string, searchFilter: (opt: Option, search: string) => boolean): DataArray - filter( - filter: { - (opt: Option): boolean - } | null, - includeOptgroup: boolean, - ): DataArray + private selectType; + private data; + constructor(type: selectType, data: DataArrayPartial); + validateDataArray(data: DataArray | DataArrayPartial): Error | null; + validateOption(option: Option | OptionOptional): Error | null; + partialToFullData(data: DataArrayPartial): DataArray; + setData(data: DataArray | DataArrayPartial): void; + getData(): DataArray; + getDataOptions(): Option[]; + addOption(option: OptionOptional): void; + setSelectedBy(selectedType: 'id' | 'value', selectedValues: string[]): void; + getSelected(): string[]; + getSelectedOptions(): Option[]; + getOptgroupByID(id: string): Optgroup | null; + getOptionByID(id: string): Option | null; + getSelectType(): string; + getFirstOption(): Option | null; + search(search: string, searchFilter: (opt: Option, search: string) => boolean): DataArray; + filter(filter: { + (opt: Option): boolean; + } | null, includeOptgroup: boolean): DataArray; } -export {} +export {}; diff --git a/src/vue/dist/slimselectvue.es.js b/src/vue/dist/slimselectvue.es.js index 5f2c9b85..e2153f18 100644 --- a/src/vue/dist/slimselectvue.es.js +++ b/src/vue/dist/slimselectvue.es.js @@ -185,7 +185,7 @@ class Store { } } getSelected() { - return this.getSelectedOptions().map(option => option.id); + return this.getSelectedOptions().map((option) => option.id); } getSelectedOptions() { return this.filter((opt) => { @@ -1399,7 +1399,7 @@ class Select { return options; } getSelectedValues() { - return this.getSelectedOptions().map(option => option.value); + return this.getSelectedOptions().map((option) => option.value); } setSelected(ids) { this.changeListen(false); @@ -1636,7 +1636,7 @@ class SlimSelect { this.select.updateSelect(this.settings.id, this.settings.style, this.settings.class); this.select.hideUI(); this.select.onValueChange = (options) => { - this.setSelected(options.map(option => option.id)); + this.setSelected(options.map((option) => option.id)); }; this.select.onClassChange = (classes) => { this.settings.class = classes; @@ -1726,11 +1726,23 @@ class SlimSelect { } } getSelected() { - return this.store.getSelected(); + return this.store.getSelectedOptions().map((option) => option.value); } - setSelected(id, runAfterChange = true) { + setSelected(values, runAfterChange = true) { const selected = this.store.getSelected(); - this.store.setSelectedBy('id', Array.isArray(id) ? id : [id]); + const options = this.store.getDataOptions(); + values = Array.isArray(values) ? values : [values]; + const ids = []; + for (const value of values) { + if (options.find((option) => option.id == value)) { + ids.push(value); + continue; + } + for (const option of options.filter((option) => option.value == value)) { + ids.push(option.id); + } + } + this.store.setSelectedBy('id', ids); const data = this.store.getData(); this.select.updateOptions(data); this.render.renderValues(); diff --git a/src/vue/dist/slimselectvue.global.js b/src/vue/dist/slimselectvue.global.js index d025cac3..af015f81 100644 --- a/src/vue/dist/slimselectvue.global.js +++ b/src/vue/dist/slimselectvue.global.js @@ -186,7 +186,7 @@ var SlimSelectVue = (function (vue) { } } getSelected() { - return this.getSelectedOptions().map(option => option.id); + return this.getSelectedOptions().map((option) => option.id); } getSelectedOptions() { return this.filter((opt) => { @@ -1400,7 +1400,7 @@ var SlimSelectVue = (function (vue) { return options; } getSelectedValues() { - return this.getSelectedOptions().map(option => option.value); + return this.getSelectedOptions().map((option) => option.value); } setSelected(ids) { this.changeListen(false); @@ -1637,7 +1637,7 @@ var SlimSelectVue = (function (vue) { this.select.updateSelect(this.settings.id, this.settings.style, this.settings.class); this.select.hideUI(); this.select.onValueChange = (options) => { - this.setSelected(options.map(option => option.id)); + this.setSelected(options.map((option) => option.id)); }; this.select.onClassChange = (classes) => { this.settings.class = classes; @@ -1727,11 +1727,23 @@ var SlimSelectVue = (function (vue) { } } getSelected() { - return this.store.getSelected(); + return this.store.getSelectedOptions().map((option) => option.value); } - setSelected(id, runAfterChange = true) { + setSelected(values, runAfterChange = true) { const selected = this.store.getSelected(); - this.store.setSelectedBy('id', Array.isArray(id) ? id : [id]); + const options = this.store.getDataOptions(); + values = Array.isArray(values) ? values : [values]; + const ids = []; + for (const value of values) { + if (options.find((option) => option.id == value)) { + ids.push(value); + continue; + } + for (const option of options.filter((option) => option.value == value)) { + ids.push(option.id); + } + } + this.store.setSelectedBy('id', ids); const data = this.store.getData(); this.select.updateOptions(data); this.render.renderValues(); diff --git a/src/vue/dist/slimselectvue.ssr.js b/src/vue/dist/slimselectvue.ssr.js index e810c2f4..948ffed6 100644 --- a/src/vue/dist/slimselectvue.ssr.js +++ b/src/vue/dist/slimselectvue.ssr.js @@ -187,7 +187,7 @@ class Store { } } getSelected() { - return this.getSelectedOptions().map(option => option.id); + return this.getSelectedOptions().map((option) => option.id); } getSelectedOptions() { return this.filter((opt) => { @@ -1401,7 +1401,7 @@ class Select { return options; } getSelectedValues() { - return this.getSelectedOptions().map(option => option.value); + return this.getSelectedOptions().map((option) => option.value); } setSelected(ids) { this.changeListen(false); @@ -1638,7 +1638,7 @@ class SlimSelect { this.select.updateSelect(this.settings.id, this.settings.style, this.settings.class); this.select.hideUI(); this.select.onValueChange = (options) => { - this.setSelected(options.map(option => option.id)); + this.setSelected(options.map((option) => option.id)); }; this.select.onClassChange = (classes) => { this.settings.class = classes; @@ -1728,11 +1728,23 @@ class SlimSelect { } } getSelected() { - return this.store.getSelected(); + return this.store.getSelectedOptions().map((option) => option.value); } - setSelected(id, runAfterChange = true) { + setSelected(values, runAfterChange = true) { const selected = this.store.getSelected(); - this.store.setSelectedBy('id', Array.isArray(id) ? id : [id]); + const options = this.store.getDataOptions(); + values = Array.isArray(values) ? values : [values]; + const ids = []; + for (const value of values) { + if (options.find((option) => option.id == value)) { + ids.push(value); + continue; + } + for (const option of options.filter((option) => option.value == value)) { + ids.push(option.id); + } + } + this.store.setSelectedBy('id', ids); const data = this.store.getData(); this.select.updateOptions(data); this.render.renderValues(); diff --git a/src/vue/dist/vue/hello.d.ts b/src/vue/dist/vue/hello.d.ts index f6646e23..f6842d9a 100644 --- a/src/vue/dist/vue/hello.d.ts +++ b/src/vue/dist/vue/hello.d.ts @@ -1,2 +1,2 @@ -declare const hello = 'hello world' -export default hello +declare const hello = "hello world"; +export default hello; diff --git a/src/vue/dist/vue/slimselect.vue.d.ts b/src/vue/dist/vue/slimselect.vue.d.ts index 87eb64f6..2e7459df 100644 --- a/src/vue/dist/vue/slimselect.vue.d.ts +++ b/src/vue/dist/vue/slimselect.vue.d.ts @@ -1,380 +1,325 @@ /// /// -import { PropType } from 'vue' -import SlimSelect, { Events } from '../slim-select' -import { DataArrayPartial, Option } from '../slim-select/store' -declare const _default: import('vue').DefineComponent< - { +import { PropType } from 'vue'; +import SlimSelect, { Events } from '../slim-select'; +import { DataArrayPartial, Option } from '../slim-select/store'; +declare const _default: import("vue").DefineComponent<{ modelValue: { - type: PropType - } + type: PropType; + }; multiple: { - type: BooleanConstructor - default: boolean - } + type: BooleanConstructor; + default: boolean; + }; data: { - type: PropType - } + type: PropType; + }; settings: { - type: PropType> - } + type: PropType>; + }; events: { - type: PropType - } - }, - unknown, - { - slim: SlimSelect | null - }, - { + type: PropType; + }; +}, unknown, { + slim: SlimSelect | null; +}, { value: { - get(): string | string[] - set(value: string | string[]): void - } - }, - { + get(): string | string[]; + set(value: string | string[]): void; + }; +}, { getSlimSelect(): { - selectEl: HTMLSelectElement - settings: { - id: string - style: string - class: string[] - isMultiple: boolean - isOpen: boolean - isFullOpen: boolean - intervalMove: { - ref: () => NodeJS.Timeout - unref: () => NodeJS.Timeout - hasRef: () => boolean - refresh: () => NodeJS.Timeout - [Symbol.toPrimitive]: () => number - [Symbol.dispose]: () => void - } | null - disabled: boolean - alwaysOpen: boolean - showSearch: boolean - ariaLabel: string - searchPlaceholder: string - searchText: string - searchingText: string - searchHighlight: boolean - closeOnSelect: boolean - contentLocation: HTMLElement - contentPosition: 'relative' | 'absolute' - openPosition: 'auto' | 'up' | 'down' - placeholderText: string - allowDeselect: boolean - hideSelected: boolean - keepOrder: boolean - showOptionTooltips: boolean - minSelected: number - maxSelected: number - timeoutDelay: number - maxValuesShown: number - maxValuesMessage: string - } - select: { - select: HTMLSelectElement - onValueChange?: ((value: Option[]) => void) | undefined - onClassChange?: ((classes: string[]) => void) | undefined - onDisabledChange?: ((disabled: boolean) => void) | undefined - onOptionsChange?: ((data: DataArrayPartial) => void) | undefined - listen: boolean - enable: () => void - disable: () => void - hideUI: () => void - showUI: () => void - changeListen: (listen: boolean) => void - valueChange: (ev: Event) => boolean - getData: () => DataArrayPartial - getDataFromOptgroup: (optgroup: HTMLOptGroupElement) => import('../slim-select/store').OptgroupOptional - getDataFromOption: (option: HTMLOptionElement) => Option - getSelectedOptions: () => Option[] - getSelectedValues: () => string[] - setSelected: (ids: string[]) => void - updateSelect: (id?: string | undefined, style?: string | undefined, classes?: string[] | undefined) => void - updateOptions: (data: import('../slim-select/store').DataArray) => void - createOptgroup: (optgroup: import('../slim-select/store').Optgroup) => HTMLOptGroupElement - createOption: (info: Option) => HTMLOptionElement - destroy: () => void - } - store: { - validateDataArray: (data: DataArrayPartial | import('../slim-select/store').DataArray) => Error | null - validateOption: (option: import('../slim-select/store').OptionOptional | Option) => Error | null - partialToFullData: (data: DataArrayPartial) => import('../slim-select/store').DataArray - setData: (data: DataArrayPartial | import('../slim-select/store').DataArray) => void - getData: () => import('../slim-select/store').DataArray - getDataOptions: () => Option[] - addOption: (option: import('../slim-select/store').OptionOptional) => void - setSelectedBy: (selectedType: 'id' | 'value', selectedValues: string[]) => void - getSelected: () => string[] - getSelectedOptions: () => Option[] - getOptgroupByID: (id: string) => import('../slim-select/store').Optgroup | null - getOptionByID: (id: string) => Option | null - getSelectType: () => string - getFirstOption: () => Option | null - search: ( - search: string, - searchFilter: (opt: Option, search: string) => boolean, - ) => import('../slim-select/store').DataArray - filter: ( - filter: ((opt: Option) => boolean) | null, - includeOptgroup: boolean, - ) => import('../slim-select/store').DataArray - } - render: { + selectEl: HTMLSelectElement; settings: { - id: string - style: string - class: string[] - isMultiple: boolean - isOpen: boolean - isFullOpen: boolean - intervalMove: { - ref: () => NodeJS.Timeout - unref: () => NodeJS.Timeout - hasRef: () => boolean - refresh: () => NodeJS.Timeout - [Symbol.toPrimitive]: () => number - [Symbol.dispose]: () => void - } | null - disabled: boolean - alwaysOpen: boolean - showSearch: boolean - ariaLabel: string - searchPlaceholder: string - searchText: string - searchingText: string - searchHighlight: boolean - closeOnSelect: boolean - contentLocation: HTMLElement - contentPosition: 'relative' | 'absolute' - openPosition: 'auto' | 'up' | 'down' - placeholderText: string - allowDeselect: boolean - hideSelected: boolean - keepOrder: boolean - showOptionTooltips: boolean - minSelected: number - maxSelected: number - timeoutDelay: number - maxValuesShown: number - maxValuesMessage: string - } + id: string; + style: string; + class: string[]; + isMultiple: boolean; + isOpen: boolean; + isFullOpen: boolean; + intervalMove: { + ref: () => NodeJS.Timeout; + unref: () => NodeJS.Timeout; + hasRef: () => boolean; + refresh: () => NodeJS.Timeout; + [Symbol.toPrimitive]: () => number; + [Symbol.dispose]: () => void; + } | null; + disabled: boolean; + alwaysOpen: boolean; + showSearch: boolean; + ariaLabel: string; + searchPlaceholder: string; + searchText: string; + searchingText: string; + searchHighlight: boolean; + closeOnSelect: boolean; + contentLocation: HTMLElement; + contentPosition: "relative" | "absolute"; + openPosition: "auto" | "up" | "down"; + placeholderText: string; + allowDeselect: boolean; + hideSelected: boolean; + keepOrder: boolean; + showOptionTooltips: boolean; + minSelected: number; + maxSelected: number; + timeoutDelay: number; + maxValuesShown: number; + maxValuesMessage: string; + }; + select: { + select: HTMLSelectElement; + onValueChange?: ((value: Option[]) => void) | undefined; + onClassChange?: ((classes: string[]) => void) | undefined; + onDisabledChange?: ((disabled: boolean) => void) | undefined; + onOptionsChange?: ((data: DataArrayPartial) => void) | undefined; + listen: boolean; + enable: () => void; + disable: () => void; + hideUI: () => void; + showUI: () => void; + changeListen: (listen: boolean) => void; + valueChange: (ev: Event) => boolean; + getData: () => DataArrayPartial; + getDataFromOptgroup: (optgroup: HTMLOptGroupElement) => import("../slim-select/store").OptgroupOptional; + getDataFromOption: (option: HTMLOptionElement) => Option; + getSelectedOptions: () => Option[]; + getSelectedValues: () => string[]; + setSelected: (ids: string[]) => void; + updateSelect: (id?: string | undefined, style?: string | undefined, classes?: string[] | undefined) => void; + updateOptions: (data: import("../slim-select/store").DataArray) => void; + createOptgroup: (optgroup: import("../slim-select/store").Optgroup) => HTMLOptGroupElement; + createOption: (info: Option) => HTMLOptionElement; + destroy: () => void; + }; store: { - validateDataArray: (data: DataArrayPartial | import('../slim-select/store').DataArray) => Error | null - validateOption: (option: import('../slim-select/store').OptionOptional | Option) => Error | null - partialToFullData: (data: DataArrayPartial) => import('../slim-select/store').DataArray - setData: (data: DataArrayPartial | import('../slim-select/store').DataArray) => void - getData: () => import('../slim-select/store').DataArray - getDataOptions: () => Option[] - addOption: (option: import('../slim-select/store').OptionOptional) => void - setSelectedBy: (selectedType: 'id' | 'value', selectedValues: string[]) => void - getSelected: () => string[] - getSelectedOptions: () => Option[] - getOptgroupByID: (id: string) => import('../slim-select/store').Optgroup | null - getOptionByID: (id: string) => Option | null - getSelectType: () => string - getFirstOption: () => Option | null - search: ( - search: string, - searchFilter: (opt: Option, search: string) => boolean, - ) => import('../slim-select/store').DataArray - filter: ( - filter: ((opt: Option) => boolean) | null, - includeOptgroup: boolean, - ) => import('../slim-select/store').DataArray - } - callbacks: { - open: () => void - close: () => void - addable?: - | (( - value: string, - ) => - | string - | false - | import('../slim-select/store').OptionOptional - | Promise - | null - | undefined) - | undefined - setSelected: (value: string | string[], runAfterChange: boolean) => void - addOption: (option: Option) => void - search: (search: string) => void - beforeChange?: ((newVal: Option[], oldVal: Option[]) => boolean | void) | undefined - afterChange?: ((newVal: Option[]) => void) | undefined - } - main: { - main: HTMLDivElement - values: HTMLDivElement - deselect: { - main: HTMLDivElement - svg: SVGSVGElement - path: SVGPathElement - } - arrow: { - main: SVGSVGElement - path: SVGPathElement - } - } - content: { - main: HTMLDivElement - search: { - main: HTMLDivElement - input: HTMLInputElement - addable?: - | { - main: HTMLDivElement - svg: SVGSVGElement - path: SVGPathElement - } - | undefined - } - list: HTMLDivElement - } - classes: { - main: string - placeholder: string - values: string - single: string - max: string - value: string - valueText: string - valueDelete: string - valueOut: string - deselect: string - deselectPath: string - arrow: string - arrowClose: string - arrowOpen: string - content: string - openAbove: string - openBelow: string - search: string - searchHighlighter: string - searching: string - addable: string - addablePath: string - list: string - optgroup: string - optgroupLabel: string - optgroupLabelText: string - optgroupActions: string - optgroupSelectAll: string - optgroupSelectAllBox: string - optgroupSelectAllCheck: string - optgroupClosable: string - option: string - optionDelete: string - highlighted: string - open: string - close: string - selected: string - error: string - disabled: string - hide: string - } - enable: () => void - disable: () => void - open: () => void - close: () => void - updateClassStyles: () => void - updateAriaAttributes: () => void - mainDiv: () => import('../slim-select/render').Main - mainFocus: (eventType: string | null) => void - placeholder: () => HTMLDivElement - renderValues: () => void - multipleValue: (option: Option) => HTMLDivElement - contentDiv: () => import('../slim-select/render').Content - moveContent: () => void - searchDiv: () => import('../slim-select/render').Search - searchFocus: () => void - getOptions: (notPlaceholder?: boolean, notDisabled?: boolean, notHidden?: boolean) => HTMLDivElement[] - highlight: (dir: 'up' | 'down') => void - listDiv: () => HTMLDivElement - renderError: (error: string) => void - renderSearching: () => void - renderOptions: (data: import('../slim-select/store').DataArray) => void - option: (option: Option) => HTMLDivElement - destroy: () => void - moveContentAbove: () => void - moveContentBelow: () => void - ensureElementInView: (container: HTMLElement, element: HTMLElement) => void - putContent: () => 'up' | 'down' - updateDeselectAll: () => void - } - events: { - search?: - | (( - searchValue: string, - currentData: import('../slim-select/store').DataArray, - ) => DataArrayPartial | Promise) - | undefined - searchFilter?: ((option: Option, search: string) => boolean) | undefined - addable?: - | (( - value: string, - ) => - | string - | false - | import('../slim-select/store').OptionOptional - | Promise - | null - | undefined) - | undefined - beforeChange?: ((newVal: Option[], oldVal: Option[]) => boolean | void) | undefined - afterChange?: ((newVal: Option[]) => void) | undefined - beforeOpen?: (() => void) | undefined - afterOpen?: (() => void) | undefined - beforeClose?: (() => void) | undefined - afterClose?: (() => void) | undefined - error?: ((err: Error) => void) | undefined - } - enable: () => void - disable: () => void - getData: () => import('../slim-select/store').DataArray - setData: (data: DataArrayPartial) => void - getSelected: () => string[] - setSelected: (id: string | string[], runAfterChange?: boolean) => void - addOption: (option: import('../slim-select/store').OptionOptional) => void - open: () => void - close: (eventType?: string | null) => void - search: (value: string) => void - destroy: () => void - } | null - getCleanValue(val: string | string[] | undefined): string | string[] - }, - import('vue').ComponentOptionsMixin, - import('vue').ComponentOptionsMixin, - 'update:modelValue'[], - 'update:modelValue', - import('vue').PublicProps, - Readonly< - import('vue').ExtractPropTypes<{ - modelValue: { - type: PropType - } - multiple: { - type: BooleanConstructor - default: boolean - } - data: { - type: PropType - } - settings: { - type: PropType> - } - events: { - type: PropType - } - }> - > & { - 'onUpdate:modelValue'?: ((...args: any[]) => any) | undefined - }, - { - multiple: boolean - }, - {} -> -export default _default + validateDataArray: (data: DataArrayPartial | import("../slim-select/store").DataArray) => Error | null; + validateOption: (option: import("../slim-select/store").OptionOptional | Option) => Error | null; + partialToFullData: (data: DataArrayPartial) => import("../slim-select/store").DataArray; + setData: (data: DataArrayPartial | import("../slim-select/store").DataArray) => void; + getData: () => import("../slim-select/store").DataArray; + getDataOptions: () => Option[]; + addOption: (option: import("../slim-select/store").OptionOptional) => void; + setSelectedBy: (selectedType: "id" | "value", selectedValues: string[]) => void; + getSelected: () => string[]; + getSelectedOptions: () => Option[]; + getOptgroupByID: (id: string) => import("../slim-select/store").Optgroup | null; + getOptionByID: (id: string) => Option | null; + getSelectType: () => string; + getFirstOption: () => Option | null; + search: (search: string, searchFilter: (opt: Option, search: string) => boolean) => import("../slim-select/store").DataArray; + filter: (filter: ((opt: Option) => boolean) | null, includeOptgroup: boolean) => import("../slim-select/store").DataArray; + }; + render: { + settings: { + id: string; + style: string; + class: string[]; + isMultiple: boolean; + isOpen: boolean; + isFullOpen: boolean; + intervalMove: { + ref: () => NodeJS.Timeout; + unref: () => NodeJS.Timeout; + hasRef: () => boolean; + refresh: () => NodeJS.Timeout; + [Symbol.toPrimitive]: () => number; + [Symbol.dispose]: () => void; + } | null; + disabled: boolean; + alwaysOpen: boolean; + showSearch: boolean; + ariaLabel: string; + searchPlaceholder: string; + searchText: string; + searchingText: string; + searchHighlight: boolean; + closeOnSelect: boolean; + contentLocation: HTMLElement; + contentPosition: "relative" | "absolute"; + openPosition: "auto" | "up" | "down"; + placeholderText: string; + allowDeselect: boolean; + hideSelected: boolean; + keepOrder: boolean; + showOptionTooltips: boolean; + minSelected: number; + maxSelected: number; + timeoutDelay: number; + maxValuesShown: number; + maxValuesMessage: string; + }; + store: { + validateDataArray: (data: DataArrayPartial | import("../slim-select/store").DataArray) => Error | null; + validateOption: (option: import("../slim-select/store").OptionOptional | Option) => Error | null; + partialToFullData: (data: DataArrayPartial) => import("../slim-select/store").DataArray; + setData: (data: DataArrayPartial | import("../slim-select/store").DataArray) => void; + getData: () => import("../slim-select/store").DataArray; + getDataOptions: () => Option[]; + addOption: (option: import("../slim-select/store").OptionOptional) => void; + setSelectedBy: (selectedType: "id" | "value", selectedValues: string[]) => void; + getSelected: () => string[]; + getSelectedOptions: () => Option[]; + getOptgroupByID: (id: string) => import("../slim-select/store").Optgroup | null; + getOptionByID: (id: string) => Option | null; + getSelectType: () => string; + getFirstOption: () => Option | null; + search: (search: string, searchFilter: (opt: Option, search: string) => boolean) => import("../slim-select/store").DataArray; + filter: (filter: ((opt: Option) => boolean) | null, includeOptgroup: boolean) => import("../slim-select/store").DataArray; + }; + callbacks: { + open: () => void; + close: () => void; + addable?: ((value: string) => string | false | import("../slim-select/store").OptionOptional | Promise | null | undefined) | undefined; + setSelected: (value: string | string[], runAfterChange: boolean) => void; + addOption: (option: Option) => void; + search: (search: string) => void; + beforeChange?: ((newVal: Option[], oldVal: Option[]) => boolean | void) | undefined; + afterChange?: ((newVal: Option[]) => void) | undefined; + }; + main: { + main: HTMLDivElement; + values: HTMLDivElement; + deselect: { + main: HTMLDivElement; + svg: SVGSVGElement; + path: SVGPathElement; + }; + arrow: { + main: SVGSVGElement; + path: SVGPathElement; + }; + }; + content: { + main: HTMLDivElement; + search: { + main: HTMLDivElement; + input: HTMLInputElement; + addable?: { + main: HTMLDivElement; + svg: SVGSVGElement; + path: SVGPathElement; + } | undefined; + }; + list: HTMLDivElement; + }; + classes: { + main: string; + placeholder: string; + values: string; + single: string; + max: string; + value: string; + valueText: string; + valueDelete: string; + valueOut: string; + deselect: string; + deselectPath: string; + arrow: string; + arrowClose: string; + arrowOpen: string; + content: string; + openAbove: string; + openBelow: string; + search: string; + searchHighlighter: string; + searching: string; + addable: string; + addablePath: string; + list: string; + optgroup: string; + optgroupLabel: string; + optgroupLabelText: string; + optgroupActions: string; + optgroupSelectAll: string; + optgroupSelectAllBox: string; + optgroupSelectAllCheck: string; + optgroupClosable: string; + option: string; + optionDelete: string; + highlighted: string; + open: string; + close: string; + selected: string; + error: string; + disabled: string; + hide: string; + }; + enable: () => void; + disable: () => void; + open: () => void; + close: () => void; + updateClassStyles: () => void; + updateAriaAttributes: () => void; + mainDiv: () => import("../slim-select/render").Main; + mainFocus: (eventType: string | null) => void; + placeholder: () => HTMLDivElement; + renderValues: () => void; + multipleValue: (option: Option) => HTMLDivElement; + contentDiv: () => import("../slim-select/render").Content; + moveContent: () => void; + searchDiv: () => import("../slim-select/render").Search; + searchFocus: () => void; + getOptions: (notPlaceholder?: boolean, notDisabled?: boolean, notHidden?: boolean) => HTMLDivElement[]; + highlight: (dir: "up" | "down") => void; + listDiv: () => HTMLDivElement; + renderError: (error: string) => void; + renderSearching: () => void; + renderOptions: (data: import("../slim-select/store").DataArray) => void; + option: (option: Option) => HTMLDivElement; + destroy: () => void; + moveContentAbove: () => void; + moveContentBelow: () => void; + ensureElementInView: (container: HTMLElement, element: HTMLElement) => void; + putContent: () => "up" | "down"; + updateDeselectAll: () => void; + }; + events: { + search?: ((searchValue: string, currentData: import("../slim-select/store").DataArray) => DataArrayPartial | Promise) | undefined; + searchFilter?: ((option: Option, search: string) => boolean) | undefined; + addable?: ((value: string) => string | false | import("../slim-select/store").OptionOptional | Promise | null | undefined) | undefined; + beforeChange?: ((newVal: Option[], oldVal: Option[]) => boolean | void) | undefined; + afterChange?: ((newVal: Option[]) => void) | undefined; + beforeOpen?: (() => void) | undefined; + afterOpen?: (() => void) | undefined; + beforeClose?: (() => void) | undefined; + afterClose?: (() => void) | undefined; + error?: ((err: Error) => void) | undefined; + }; + enable: () => void; + disable: () => void; + getData: () => import("../slim-select/store").DataArray; + setData: (data: DataArrayPartial) => void; + getSelected: () => string[]; + setSelected: (values: string | string[], runAfterChange?: boolean) => void; + addOption: (option: import("../slim-select/store").OptionOptional) => void; + open: () => void; + close: (eventType?: string | null) => void; + search: (value: string) => void; + destroy: () => void; + } | null; + getCleanValue(val: string | string[] | undefined): string | string[]; +}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").PublicProps, Readonly; + }; + multiple: { + type: BooleanConstructor; + default: boolean; + }; + data: { + type: PropType; + }; + settings: { + type: PropType>; + }; + events: { + type: PropType; + }; +}>> & { + "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined; +}, { + multiple: boolean; +}, {}>; +export default _default;