From f18a73c71a31f53d8ec1bf3eabe3d1a948b0043f Mon Sep 17 00:00:00 2001 From: Tiberiu Dumitru Date: Tue, 12 Aug 2025 00:09:50 +0300 Subject: [PATCH 1/8] Improve accessibility aria codes. --- src/docs/assets/scss/misc.scss | 12 +++ src/slim-select/render.test.ts | 150 +++++++++++++++++++++++++- src/slim-select/render.ts | 191 ++++++++++++++++++++++++++++----- src/slim-select/settings.ts | 8 ++ 4 files changed, 334 insertions(+), 27 deletions(-) diff --git a/src/docs/assets/scss/misc.scss b/src/docs/assets/scss/misc.scss index 7ec8dbaf..5c596308 100644 --- a/src/docs/assets/scss/misc.scss +++ b/src/docs/assets/scss/misc.scss @@ -166,3 +166,15 @@ p { .mar-l-l { margin-left: var(--spacing); } + +.sr-only { + position: absolute; + width: 1px; + height: 1px; + margin: -1px; + padding: 0; + border: 0; + clip: rect(0, 0, 0, 0); + clip-path: inset(50%); + overflow: hidden; +} diff --git a/src/slim-select/render.test.ts b/src/slim-select/render.test.ts index 18dc0603..16f2a289 100644 --- a/src/slim-select/render.test.ts +++ b/src/slim-select/render.test.ts @@ -200,7 +200,7 @@ describe('render module', () => { expect(render.main.main.role).toBe('combobox') expect(render.main.main.getAttribute('aria-haspopup')).toBe('listbox') - expect(render.main.main.getAttribute('aria-controls')).toBe(render.content.main.id) + expect(render.main.main.getAttribute('aria-controls')).toBe(render.content.main.id + '-list') expect(render.main.main.getAttribute('aria-expanded')).toBe('false') expect(render.content.list.getAttribute('role')).toBe('listbox') expect(render.content.list.getAttribute('aria-label')).toBe(render.settings.contentAriaLabel) @@ -1286,4 +1286,152 @@ describe('render module', () => { describe('putContent', () => {}) describe('updateDeselectAll', () => {}) + + describe('accessibility (a11y)', () => { + + test('search input gets ARIA wiring (controls + autocomplete + label fallback)', () => { + render.updateAriaAttributes() + + expect(render.content.search.input.getAttribute('aria-controls')).toBe(render.content.list.id) + expect(render.content.search.input.getAttribute('aria-autocomplete')).toBe('list') + expect(render.content.search.input.getAttribute('aria-label')).toBe('Search options') + }) + + + + test('deselect control has button semantics and label', () => { + const deselectEl = render.main.main.querySelector('.' + render.classes.deselect) as HTMLDivElement + + expect(deselectEl.getAttribute('role')).toBe('button') + expect(deselectEl.getAttribute('tabindex')).toBe('0') + expect(deselectEl.getAttribute('aria-label')).toBe(render.settings.clearAllAriaLabel) + }) + + + + test('token delete control (multi) has button semantics', () => { + const opt = new Option({ text: 'Alpha', value: 'alpha', selected: true }) + const token = render.multipleValue(opt) + + const del = token.querySelector('.' + render.classes.valueDelete) as HTMLDivElement + + expect(del).toBeInstanceOf(HTMLDivElement) + expect(del.getAttribute('role')).toBe('button') + expect(del.getAttribute('tabindex')).toBe('0') + expect(del.getAttribute('aria-label')).toBe('Remove selection') + expect(del.getAttribute('title')).toBe('Remove selection') + }) + + + + test('renderSearching sets aria-busy and announces via polite live region', () => { + const rafOrig = (global as any).requestAnimationFrame + ;(global as any).requestAnimationFrame = (cb: Function) => cb() + + render.settings.searchingText = 'Searching…' + render.renderSearching() + + expect(render.content.list.getAttribute('aria-busy')).toBe('true') + + const live = document.getElementById('ss-live-polite') as HTMLDivElement + expect(live).toBeTruthy() + expect(live.getAttribute('role')).toBe('status') + expect(live.getAttribute('aria-live')).toBe('polite') + expect(live.textContent).toBe('Searching…') + + ;(global as any).requestAnimationFrame = rafOrig + }) + + + + test('renderError clears aria-busy and announces via assertive live region', () => { + const rafOrig = (global as any).requestAnimationFrame + ;(global as any).requestAnimationFrame = (cb: Function) => cb() + + render.renderError('Something went wrong') + + expect(render.content.list.hasAttribute('aria-busy')).toBe(false) + + const live = document.getElementById('ss-live-assertive') as HTMLDivElement + expect(live).toBeTruthy() + expect(live.getAttribute('role')).toBe('status') + expect(live.getAttribute('aria-live')).toBe('assertive') + expect(live.textContent).toBe('Something went wrong') + + ;(global as any).requestAnimationFrame = rafOrig + }) + + + + test('renderOptions sets aria-setsize and each option gets aria-posinset', () => { + render.renderOptions( + render.store.partialToFullData([ + { text: 'One' }, + { text: 'Two' }, + { text: 'Three' } + ]) + ) + + expect(render.content.list.getAttribute('aria-setsize')).toBe('3') + + const opts = render.getOptions(true, true, true) + expect(opts[0].getAttribute('aria-posinset')).toBe('1') + expect(opts[1].getAttribute('aria-posinset')).toBe('2') + expect(opts[2].getAttribute('aria-posinset')).toBe('3') + }) + + + + test('empty results announce and keep aria-setsize = 0', () => { + const rafOrig = (global as any).requestAnimationFrame + ;(global as any).requestAnimationFrame = (cb: Function) => cb() + + render.renderOptions([]) + + expect(render.content.list.getAttribute('aria-setsize')).toBe('0') + + const polite = document.getElementById('ss-live-polite') as HTMLDivElement + expect(polite).toBeTruthy() + expect(polite.textContent && polite.textContent.length).toBeGreaterThan(0) + + ;(global as any).requestAnimationFrame = rafOrig + }) + + + + test('highlight updates aria-activedescendant, close clears it', () => { + render.renderOptions( + render.store.partialToFullData([ + { text: 'A' }, + { text: 'B' }, + { text: 'C' } + ]) + ) + + render.highlight('down') + + const firstVisible = render.getOptions(true, true, true)[0] + const active = render.main.main.getAttribute('aria-activedescendant') + + expect(active).toBe(firstVisible.id) + + render.close() + expect(render.main.main.hasAttribute('aria-activedescendant')).toBe(false) + }) + + + + test('selected option sets aria-selected and updates activedescendant immediately', () => { + const el = render.option( + new Option({ + text: 'Picked', + selected: true + }) + ) + + expect(el.getAttribute('aria-selected')).toBe('true') + expect(render.main.main.getAttribute('aria-activedescendant')).toBe(el.id) + }) + + }) }) diff --git a/src/slim-select/render.ts b/src/slim-select/render.ts index 08b17789..339ca1ef 100644 --- a/src/slim-select/render.ts +++ b/src/slim-select/render.ts @@ -52,6 +52,28 @@ export default class Render { public callbacks: Callbacks // Used to compute the range selection private lastSelectedOption: Option | null + private static _livePolite: HTMLDivElement | null = null; + private static _liveAssertive: HTMLDivElement | null = null; + + private static getLiveAssertive(): HTMLDivElement { + let el = document.getElementById('ss-live-assertive') as HTMLDivElement | null; + if (!el) { + el = document.createElement('div'); + el.id = 'ss-live-assertive'; + el.setAttribute('role', 'status'); + el.setAttribute('aria-live', 'assertive'); + el.setAttribute('aria-atomic', 'true'); + el.className = 'sr-only'; + document.body.appendChild(el); + } + return el; + } + + private _announceAssertive(msg: string) { + const el = (Render._liveAssertive ||= Render.getLiveAssertive()); + el.textContent = ''; + requestAnimationFrame(() => { el.textContent = msg; }); + } // Elements public main: Main @@ -89,6 +111,26 @@ export default class Render { } } + private static getLivePolite(): HTMLDivElement { + let el = document.getElementById('ss-live-polite') as HTMLDivElement | null; + if (!el) { + el = document.createElement('div'); + el.id = 'ss-live-polite'; + el.setAttribute('role', 'status'); + el.setAttribute('aria-live', 'polite'); + el.setAttribute('aria-atomic', 'true'); + el.className = 'sr-only'; + document.body.appendChild(el); + } + return el; + } + + private _announcePolite(msg: string) { + const el = (Render._livePolite ||= Render.getLivePolite()); + el.textContent = ''; + requestAnimationFrame(() => { el.textContent = msg; }); + } + // Remove disabled classes public enable(): void { // Remove disabled class @@ -136,6 +178,7 @@ export default class Render { window.addEventListener('scroll', this.scrollHandler, true); // capture phase window.addEventListener('resize', this.resizeHandler); } + this.searchFocus(); } public close(): void { @@ -155,6 +198,8 @@ export default class Render { window.removeEventListener('resize', this.resizeHandler); this.resizeHandler = undefined; } + this.main.main.focus({ preventScroll: true }); + this.main.main.removeAttribute('aria-activedescendant'); } public updateClassStyles(): void { @@ -194,12 +239,36 @@ export default class Render { } public 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.list.setAttribute('role', 'listbox') - this.content.list.setAttribute('aria-label', this.settings.contentAriaLabel) + this.content.list.setAttribute('role', 'listbox'); + this.content.list.setAttribute('id', this.content.main.id + '-list'); + this.content.list.setAttribute('aria-label', this.settings.contentAriaLabel); + if (this.settings.isMultiple) { + this.content.list.setAttribute('aria-multiselectable', 'true'); + } else { + this.content.list.removeAttribute('aria-multiselectable'); + } + + // Combobox AFTER list has an id + this.main.main.setAttribute('role', 'combobox') + this.main.main.setAttribute('aria-haspopup', 'listbox'); + this.main.main.setAttribute('aria-controls', this.content.list.id); + this.main.main.setAttribute('aria-expanded', 'false'); + this.main.main.setAttribute('aria-autocomplete', 'list'); + + // Label logic + if (this.settings.ariaLabelledBy && this.settings.ariaLabelledBy.trim()) { + this.main.main.setAttribute('aria-labelledby', this.settings.ariaLabelledBy); + this.main.main.removeAttribute('aria-label'); + } else if (this.settings.ariaLabel && this.settings.ariaLabel.trim()) { + this.main.main.setAttribute('aria-label', this.settings.ariaLabel); + } + + // Relations + this.main.main.setAttribute('aria-owns', this.content.list.id); + + // Search input + this.content.search.input.setAttribute('aria-controls', this.content.list.id); + this.content.search.input.setAttribute('aria-autocomplete', 'list'); } public mainDiv(): Main { @@ -208,9 +277,6 @@ export default class Render { main.id = this.settings.id + '-main' - // Add label - main.setAttribute('aria-label', this.settings.ariaLabel) - // Set tabable to allow tabbing to the element main.tabIndex = 0 @@ -268,6 +334,16 @@ export default class Render { const deselect = document.createElement('div') deselect.classList.add(this.classes.deselect) + deselect.setAttribute('role', 'button'); + deselect.setAttribute('tabindex', '0'); + deselect.setAttribute('aria-label', this.settings.clearAllAriaLabel); + deselect.addEventListener('keydown', (e: KeyboardEvent) => { // ADD + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault(); + deselect.click(); + } + }); + // Check if deselect is to be shown or not const selectedOptions = this.store?.getSelectedOptions() if (!this.settings.allowDeselect || (this.settings.isMultiple && selectedOptions && selectedOptions.length <= 0)) { @@ -322,6 +398,8 @@ export default class Render { // Add deselect svg const deselectSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg') deselectSvg.setAttribute('viewBox', '0 0 100 100') + deselectSvg.setAttribute('aria-hidden', 'true') + deselectSvg.setAttribute('focusable', 'false') const deselectPath = document.createElementNS('http://www.w3.org/2000/svg', 'path') deselectPath.setAttribute('d', this.classes.deselectPath) deselectSvg.appendChild(deselectPath) @@ -332,6 +410,8 @@ export default class Render { const arrow = document.createElementNS('http://www.w3.org/2000/svg', 'svg') arrow.classList.add(this.classes.arrow) arrow.setAttribute('viewBox', '0 0 100 100') + arrow.setAttribute('aria-hidden', 'true') + arrow.setAttribute('focusable', 'false') const arrowPath = document.createElementNS('http://www.w3.org/2000/svg', 'path') arrowPath.setAttribute('d', this.classes.arrowClose) if (this.settings.alwaysOpen) { @@ -549,7 +629,10 @@ export default class Render { // Create delete div element const deleteDiv = document.createElement('div') deleteDiv.classList.add(this.classes.valueDelete) - deleteDiv.setAttribute('tabindex', '0') // Make the div focusable for tab navigation + deleteDiv.setAttribute('role', 'button'); + deleteDiv.setAttribute('aria-label', 'Remove selection'); + deleteDiv.setAttribute('title', 'Remove selection'); + deleteDiv.setAttribute('tabindex', '0'); // Add delete onclick event deleteDiv.onclick = (e: Event) => { @@ -611,6 +694,8 @@ export default class Render { // Add delete svg const deleteSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg') deleteSvg.setAttribute('viewBox', '0 0 100 100') + deleteSvg.setAttribute('aria-hidden', 'true') + deleteSvg.setAttribute('focusable', 'false') const deletePath = document.createElementNS('http://www.w3.org/2000/svg', 'path') deletePath.setAttribute('d', this.classes.optionDelete) deleteSvg.appendChild(deletePath) @@ -621,7 +706,8 @@ export default class Render { // Add keydown event listener for keyboard navigation (Enter key) deleteDiv.onkeydown = (e) => { - if (e.key === 'Enter') { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault(); deleteDiv.click() // Trigger the click event when Enter is pressed } } @@ -695,7 +781,13 @@ export default class Render { input.type = 'search' input.placeholder = this.settings.searchPlaceholder input.tabIndex = -1 - input.setAttribute('aria-label', this.settings.searchPlaceholder) + if (this.settings.searchLabelledBy && this.settings.searchLabelledBy.trim()) { + input.setAttribute('aria-labelledby', this.settings.searchLabelledBy); + } else if (this.settings.searchAriaLabel && this.settings.searchAriaLabel.trim()) { + input.setAttribute('aria-label', this.settings.searchAriaLabel); + } else { + input.setAttribute('aria-label', 'Search options'); // sensible default + } input.setAttribute('autocapitalize', 'off') input.setAttribute('autocomplete', 'off') input.setAttribute('autocorrect', 'off') @@ -755,6 +847,8 @@ export default class Render { // Add svg icon const plus = document.createElementNS('http://www.w3.org/2000/svg', 'svg') plus.setAttribute('viewBox', '0 0 100 100') + plus.setAttribute('aria-hidden', 'true') + plus.setAttribute('focusable', 'false') const plusPath = document.createElementNS('http://www.w3.org/2000/svg', 'path') plusPath.setAttribute('d', this.classes.addablePath) plus.appendChild(plusPath) @@ -933,6 +1027,7 @@ export default class Render { let selectOption = options[dir === 'down' ? (i + 1 < options.length ? i + 1 : 0) : i - 1 >= 0 ? i - 1 : options.length - 1] selectOption.classList.add(this.classes.highlighted) + this.main.main.setAttribute('aria-activedescendant', selectOption.id); this.ensureElementInView(this.content.list, selectOption) // If selected option has parent classes ss-optgroup with ss-close then click it @@ -950,10 +1045,14 @@ export default class Render { // If we get here, there is no highlighted option // So we will highlight the first or last based upon direction - options[dir === 'down' ? 0 : options.length - 1].classList.add(this.classes.highlighted) + const newly = options[dir === 'down' ? 0 : options.length - 1]; + newly.classList.add(this.classes.highlighted); + + // ADD: set aria-activedescendant to the highlighted option's ID + this.main.main.setAttribute('aria-activedescendant', newly.id); // Scroll to highlighted one - this.ensureElementInView(this.content.list, options[dir === 'down' ? 0 : options.length - 1]) + this.ensureElementInView(this.content.list, newly); } // Create main container that options will reside @@ -967,40 +1066,47 @@ export default class Render { public renderError(error: string) { // Clear out innerHtml this.content.list.innerHTML = '' + this.content.list.removeAttribute('aria-busy') const errorDiv = document.createElement('div') errorDiv.classList.add(this.classes.error) errorDiv.textContent = error this.content.list.appendChild(errorDiv) + this._announceAssertive(error); } public renderSearching() { // Clear out innerHtml this.content.list.innerHTML = '' + this.content.list.setAttribute('aria-busy', 'true') const searchingDiv = document.createElement('div') searchingDiv.classList.add(this.classes.searching) searchingDiv.textContent = this.settings.searchingText this.content.list.appendChild(searchingDiv) + this._announcePolite(this.settings.searchingText); } // Take in data and add options to public renderOptions(data: DataArray): void { // Clear out innerHtml this.content.list.innerHTML = '' + this.content.list.removeAttribute('aria-busy') // If no results show no results text if (data.length === 0) { const noResults = document.createElement('div') noResults.classList.add(this.classes.search) + const msg = this.callbacks.addable + ? this.settings.addableText.replace('{value}', this.content.search.input.value) + : this.settings.searchText - // - if (this.callbacks.addable) { - noResults.innerHTML = this.settings.addableText.replace('{value}', this.content.search.input.value) - } else { - noResults.innerHTML = this.settings.searchText - } + this._announcePolite(msg) + noResults.innerHTML = msg this.content.list.appendChild(noResults) + + // Keep setsize accurate on empty state + this.content.list.setAttribute('aria-setsize', '0') return } @@ -1023,12 +1129,27 @@ export default class Render { // Append individual options to div container const fragment = document.createDocumentFragment() + let count = 0; // counts only visible, enabled, non-placeholder items + + const tagPos = (el: HTMLDivElement) => { + // mirror the same visibility you use for aria-setsize (not placeholder, not disabled, not hidden) + if ( + !el.classList.contains(this.classes.placeholder) && + !el.classList.contains(this.classes.disabled) && + !el.classList.contains(this.classes.hide) + ) { + el.setAttribute('aria-posinset', String(++count)) + } + } + for (const d of data) { // Create optgroup if (d instanceof Optgroup) { // Create optgroup const optgroupEl = document.createElement('div') optgroupEl.classList.add(this.classes.optgroup) + optgroupEl.setAttribute('role', 'group') + optgroupEl.setAttribute('aria-label', d.label) // Create label const optgroupLabel = document.createElement('div') @@ -1074,6 +1195,8 @@ export default class Render { // Create new svg for checkbox const selectAllSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg') selectAllSvg.setAttribute('viewBox', '0 0 100 100') + selectAllSvg.setAttribute('aria-hidden', 'true') + selectAllSvg.setAttribute('focusable', 'false') selectAll.appendChild(selectAllSvg) // Create new path for box @@ -1141,6 +1264,8 @@ export default class Render { const optgroupClosableSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg') optgroupClosableSvg.setAttribute('viewBox', '0 0 100 100') optgroupClosableSvg.classList.add(this.classes.arrow) + optgroupClosableSvg.setAttribute('aria-hidden', 'true') + optgroupClosableSvg.setAttribute('focusable', 'false') optgroupClosable.appendChild(optgroupClosableSvg) // Create new path for arrow @@ -1149,7 +1274,7 @@ export default class Render { // If any options are selected or someone is searching, set optgroup to open if (d.options.some((o) => o.selected) || this.content.search.input.value.trim() !== '') { - optgroupClosable.classList.add(this.classes.open) + optgroupEl.classList.add(this.classes.open) optgroupClosableArrow.setAttribute('d', this.classes.arrowOpen) } else if (d.closable === 'open') { optgroupEl.classList.add(this.classes.open) @@ -1185,19 +1310,32 @@ export default class Render { // Loop through options for (const o of d.options) { - optgroupEl.appendChild(this.option(o)) - fragment.appendChild(optgroupEl) + const optEl = this.option(o) + tagPos(optEl) + optgroupEl.appendChild(optEl) } + fragment.appendChild(optgroupEl) } // Create option if (d instanceof Option) { - fragment.appendChild(this.option(d as Option)) + const optEl = this.option(d as Option) + tagPos(optEl) + fragment.appendChild(optEl) } } // Append fragment to list this.content.list.appendChild(fragment) + + this.content.list.removeAttribute('aria-busy') + + const visibleCount = this.getOptions(true, true, true).length + this.content.list.setAttribute('aria-setsize', String(visibleCount)) + + this._announcePolite( + `${visibleCount} option${visibleCount === 1 ? '' : 's'} available` + ) } // Create option div element @@ -1212,8 +1350,8 @@ export default class Render { // Create option const optionEl = document.createElement('div') - // optionEl.dataset.id = option.id // Dataset id for identifying an option - optionEl.id = option.id + optionEl.dataset.id = option.id // Dataset id for identifying an option + optionEl.id = `${this.settings.id}__opt__${option.id}`; optionEl.classList.add(this.classes.option) optionEl.setAttribute('role', 'option') // WCAG attribute if (option.class) { @@ -1251,6 +1389,7 @@ export default class Render { // If allowed to deselect, null onclick and add disabled if (option.disabled) { optionEl.classList.add(this.classes.disabled) + optionEl.setAttribute('aria-disabled', 'true') } // If option is selected and hideSelectedOption is true, hide it diff --git a/src/slim-select/settings.ts b/src/slim-select/settings.ts index 5e0998b8..ba387e8c 100644 --- a/src/slim-select/settings.ts +++ b/src/slim-select/settings.ts @@ -39,6 +39,10 @@ export default class Settings { public maxValuesShown: number public maxValuesMessage: string public addableText: string + public ariaLabelledBy: string + public searchAriaLabel: string + public searchLabelledBy: string + public clearAllAriaLabel: string constructor(settings?: SettingsPartial) { if (!settings) { @@ -74,5 +78,9 @@ export default class Settings { this.maxValuesShown = settings.maxValuesShown || 20 this.maxValuesMessage = settings.maxValuesMessage || '{number} selected' this.addableText = settings.addableText || 'Press "Enter" to add {value}' + this.ariaLabelledBy = settings.ariaLabelledBy || '' + this.searchAriaLabel = settings.searchAriaLabel || 'Search options' + this.searchLabelledBy = settings.searchLabelledBy || '' + this.clearAllAriaLabel = settings.clearAllAriaLabel || 'Clear selection' } } From a454133102a7b04d70175d7c2003fb3d202bbc5a Mon Sep 17 00:00:00 2001 From: Tiberiu Dumitru Date: Tue, 12 Aug 2025 00:10:22 +0300 Subject: [PATCH 2/8] Build. --- dist/render.d.ts | 6 ++ dist/settings.d.ts | 4 + dist/slimselect.cjs.js | 163 ++++++++++++++++++++++++++++++++----- dist/slimselect.es.js | 163 ++++++++++++++++++++++++++++++++----- dist/slimselect.global.js | 163 ++++++++++++++++++++++++++++++++----- dist/slimselect.js | 163 ++++++++++++++++++++++++++++++++----- dist/slimselect.min.js | 2 +- dist/slimselect.umd.js | 163 ++++++++++++++++++++++++++++++++----- dist/slimselect.umd.min.js | 2 +- docs/assets/index.css | 2 +- docs/assets/index.js | 16 ++-- 11 files changed, 736 insertions(+), 111 deletions(-) diff --git a/dist/render.d.ts b/dist/render.d.ts index f831d26a..2f485532 100644 --- a/dist/render.d.ts +++ b/dist/render.d.ts @@ -43,12 +43,18 @@ export default class Render { store: Store; callbacks: Callbacks; private lastSelectedOption; + private static _livePolite; + private static _liveAssertive; + private static getLiveAssertive; + private _announceAssertive; main: Main; content: Content; private scrollHandler; private resizeHandler; classes: CssClasses; constructor(settings: Required, classes: Required, store: Store, callbacks: Callbacks); + private static getLivePolite; + private _announcePolite; enable(): void; disable(): void; open(): void; diff --git a/dist/settings.d.ts b/dist/settings.d.ts index 138bf45e..ad26c1bf 100644 --- a/dist/settings.d.ts +++ b/dist/settings.d.ts @@ -32,5 +32,9 @@ export default class Settings { maxValuesShown: number; maxValuesMessage: string; addableText: string; + ariaLabelledBy: string; + searchAriaLabel: string; + searchLabelledBy: string; + clearAllAriaLabel: string; constructor(settings?: SettingsPartial); } diff --git a/dist/slimselect.cjs.js b/dist/slimselect.cjs.js index b94f5af9..69740cc6 100644 --- a/dist/slimselect.cjs.js +++ b/dist/slimselect.cjs.js @@ -365,6 +365,24 @@ class Store { } class Render { + static getLiveAssertive() { + let el = document.getElementById('ss-live-assertive'); + if (!el) { + el = document.createElement('div'); + el.id = 'ss-live-assertive'; + el.setAttribute('role', 'status'); + el.setAttribute('aria-live', 'assertive'); + el.setAttribute('aria-atomic', 'true'); + el.className = 'sr-only'; + document.body.appendChild(el); + } + return el; + } + _announceAssertive(msg) { + const el = (Render._liveAssertive || (Render._liveAssertive = Render.getLiveAssertive())); + el.textContent = ''; + requestAnimationFrame(() => { el.textContent = msg; }); + } constructor(settings, classes, store, callbacks) { var _a; this.store = store; @@ -385,6 +403,24 @@ class Render { this.settings.contentLocation.appendChild(this.content.main); } } + static getLivePolite() { + let el = document.getElementById('ss-live-polite'); + if (!el) { + el = document.createElement('div'); + el.id = 'ss-live-polite'; + el.setAttribute('role', 'status'); + el.setAttribute('aria-live', 'polite'); + el.setAttribute('aria-atomic', 'true'); + el.className = 'sr-only'; + document.body.appendChild(el); + } + return el; + } + _announcePolite(msg) { + const el = (Render._livePolite || (Render._livePolite = Render.getLivePolite())); + el.textContent = ''; + requestAnimationFrame(() => { el.textContent = msg; }); + } enable() { this.main.main.classList.remove(this.classes.disabled); this.content.search.input.disabled = false; @@ -413,6 +449,7 @@ class Render { window.addEventListener('scroll', this.scrollHandler, true); window.addEventListener('resize', this.resizeHandler); } + this.searchFocus(); } close() { this.main.main.classList.remove(this.classes.openAbove); @@ -429,6 +466,8 @@ class Render { window.removeEventListener('resize', this.resizeHandler); this.resizeHandler = undefined; } + this.main.main.focus({ preventScroll: true }); + this.main.main.removeAttribute('aria-activedescendant'); } updateClassStyles() { this.main.main.className = ''; @@ -456,18 +495,35 @@ class Render { } } 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.list.setAttribute('role', 'listbox'); + this.content.list.setAttribute('id', this.content.main.id + '-list'); this.content.list.setAttribute('aria-label', this.settings.contentAriaLabel); + if (this.settings.isMultiple) { + this.content.list.setAttribute('aria-multiselectable', 'true'); + } + else { + this.content.list.removeAttribute('aria-multiselectable'); + } + this.main.main.setAttribute('role', 'combobox'); + this.main.main.setAttribute('aria-haspopup', 'listbox'); + this.main.main.setAttribute('aria-controls', this.content.list.id); + this.main.main.setAttribute('aria-expanded', 'false'); + this.main.main.setAttribute('aria-autocomplete', 'list'); + if (this.settings.ariaLabelledBy && this.settings.ariaLabelledBy.trim()) { + this.main.main.setAttribute('aria-labelledby', this.settings.ariaLabelledBy); + this.main.main.removeAttribute('aria-label'); + } + else if (this.settings.ariaLabel && this.settings.ariaLabel.trim()) { + this.main.main.setAttribute('aria-label', this.settings.ariaLabel); + } + this.main.main.setAttribute('aria-owns', this.content.list.id); + this.content.search.input.setAttribute('aria-controls', this.content.list.id); + this.content.search.input.setAttribute('aria-autocomplete', 'list'); } mainDiv() { var _a; const main = document.createElement('div'); main.id = this.settings.id + '-main'; - main.setAttribute('aria-label', this.settings.ariaLabel); main.tabIndex = 0; main.onkeydown = (e) => { switch (e.key) { @@ -507,6 +563,15 @@ class Render { main.appendChild(values); const deselect = document.createElement('div'); deselect.classList.add(this.classes.deselect); + deselect.setAttribute('role', 'button'); + deselect.setAttribute('tabindex', '0'); + deselect.setAttribute('aria-label', this.settings.clearAllAriaLabel); + deselect.addEventListener('keydown', (e) => { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault(); + deselect.click(); + } + }); const selectedOptions = (_a = this.store) === null || _a === void 0 ? void 0 : _a.getSelectedOptions(); if (!this.settings.allowDeselect || (this.settings.isMultiple && selectedOptions && selectedOptions.length <= 0)) { deselect.classList.add(this.classes.hide); @@ -545,6 +610,8 @@ class Render { }; const deselectSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); deselectSvg.setAttribute('viewBox', '0 0 100 100'); + deselectSvg.setAttribute('aria-hidden', 'true'); + deselectSvg.setAttribute('focusable', 'false'); const deselectPath = document.createElementNS('http://www.w3.org/2000/svg', 'path'); deselectPath.setAttribute('d', this.classes.deselectPath); deselectSvg.appendChild(deselectPath); @@ -553,6 +620,8 @@ class Render { const arrow = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); arrow.classList.add(this.classes.arrow); arrow.setAttribute('viewBox', '0 0 100 100'); + arrow.setAttribute('aria-hidden', 'true'); + arrow.setAttribute('focusable', 'false'); const arrowPath = document.createElementNS('http://www.w3.org/2000/svg', 'path'); arrowPath.setAttribute('d', this.classes.arrowClose); if (this.settings.alwaysOpen) { @@ -718,6 +787,9 @@ class Render { if (!option.mandatory) { const deleteDiv = document.createElement('div'); deleteDiv.classList.add(this.classes.valueDelete); + deleteDiv.setAttribute('role', 'button'); + deleteDiv.setAttribute('aria-label', 'Remove selection'); + deleteDiv.setAttribute('title', 'Remove selection'); deleteDiv.setAttribute('tabindex', '0'); deleteDiv.onclick = (e) => { e.preventDefault(); @@ -760,13 +832,16 @@ class Render { }; const deleteSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); deleteSvg.setAttribute('viewBox', '0 0 100 100'); + deleteSvg.setAttribute('aria-hidden', 'true'); + deleteSvg.setAttribute('focusable', 'false'); const deletePath = document.createElementNS('http://www.w3.org/2000/svg', 'path'); deletePath.setAttribute('d', this.classes.optionDelete); deleteSvg.appendChild(deletePath); deleteDiv.appendChild(deleteSvg); value.appendChild(deleteDiv); deleteDiv.onkeydown = (e) => { - if (e.key === 'Enter') { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault(); deleteDiv.click(); } }; @@ -822,7 +897,15 @@ class Render { input.type = 'search'; input.placeholder = this.settings.searchPlaceholder; input.tabIndex = -1; - input.setAttribute('aria-label', this.settings.searchPlaceholder); + if (this.settings.searchLabelledBy && this.settings.searchLabelledBy.trim()) { + input.setAttribute('aria-labelledby', this.settings.searchLabelledBy); + } + else if (this.settings.searchAriaLabel && this.settings.searchAriaLabel.trim()) { + input.setAttribute('aria-label', this.settings.searchAriaLabel); + } + else { + input.setAttribute('aria-label', 'Search options'); + } input.setAttribute('autocapitalize', 'off'); input.setAttribute('autocomplete', 'off'); input.setAttribute('autocorrect', 'off'); @@ -869,6 +952,8 @@ class Render { addable.classList.add(this.classes.addable); const plus = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); plus.setAttribute('viewBox', '0 0 100 100'); + plus.setAttribute('aria-hidden', 'true'); + plus.setAttribute('focusable', 'false'); const plusPath = document.createElementNS('http://www.w3.org/2000/svg', 'path'); plusPath.setAttribute('d', this.classes.addablePath); plus.appendChild(plusPath); @@ -999,6 +1084,7 @@ class Render { } let selectOption = options[dir === 'down' ? (i + 1 < options.length ? i + 1 : 0) : i - 1 >= 0 ? i - 1 : options.length - 1]; selectOption.classList.add(this.classes.highlighted); + this.main.main.setAttribute('aria-activedescendant', selectOption.id); this.ensureElementInView(this.content.list, selectOption); const selectParent = selectOption.parentElement; if (selectParent && selectParent.classList.contains(this.classes.close)) { @@ -1010,8 +1096,10 @@ class Render { return; } } - options[dir === 'down' ? 0 : options.length - 1].classList.add(this.classes.highlighted); - this.ensureElementInView(this.content.list, options[dir === 'down' ? 0 : options.length - 1]); + const newly = options[dir === 'down' ? 0 : options.length - 1]; + newly.classList.add(this.classes.highlighted); + this.main.main.setAttribute('aria-activedescendant', newly.id); + this.ensureElementInView(this.content.list, newly); } listDiv() { const options = document.createElement('div'); @@ -1020,30 +1108,35 @@ class Render { } renderError(error) { this.content.list.innerHTML = ''; + this.content.list.removeAttribute('aria-busy'); const errorDiv = document.createElement('div'); errorDiv.classList.add(this.classes.error); errorDiv.textContent = error; this.content.list.appendChild(errorDiv); + this._announceAssertive(error); } renderSearching() { this.content.list.innerHTML = ''; + this.content.list.setAttribute('aria-busy', 'true'); const searchingDiv = document.createElement('div'); searchingDiv.classList.add(this.classes.searching); searchingDiv.textContent = this.settings.searchingText; this.content.list.appendChild(searchingDiv); + this._announcePolite(this.settings.searchingText); } renderOptions(data) { this.content.list.innerHTML = ''; + this.content.list.removeAttribute('aria-busy'); if (data.length === 0) { const noResults = document.createElement('div'); noResults.classList.add(this.classes.search); - if (this.callbacks.addable) { - noResults.innerHTML = this.settings.addableText.replace('{value}', this.content.search.input.value); - } - else { - noResults.innerHTML = this.settings.searchText; - } + const msg = this.callbacks.addable + ? this.settings.addableText.replace('{value}', this.content.search.input.value) + : this.settings.searchText; + this._announcePolite(msg); + noResults.innerHTML = msg; this.content.list.appendChild(noResults); + this.content.list.setAttribute('aria-setsize', '0'); return; } if (this.settings.allowDeselect && !this.settings.isMultiple) { @@ -1058,10 +1151,20 @@ class Render { } } const fragment = document.createDocumentFragment(); + let count = 0; + const tagPos = (el) => { + if (!el.classList.contains(this.classes.placeholder) && + !el.classList.contains(this.classes.disabled) && + !el.classList.contains(this.classes.hide)) { + el.setAttribute('aria-posinset', String(++count)); + } + }; for (const d of data) { if (d instanceof Optgroup) { const optgroupEl = document.createElement('div'); optgroupEl.classList.add(this.classes.optgroup); + optgroupEl.setAttribute('role', 'group'); + optgroupEl.setAttribute('aria-label', d.label); const optgroupLabel = document.createElement('div'); optgroupLabel.classList.add(this.classes.optgroupLabel); optgroupEl.appendChild(optgroupLabel); @@ -1090,6 +1193,8 @@ class Render { selectAll.appendChild(selectAllText); const selectAllSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); selectAllSvg.setAttribute('viewBox', '0 0 100 100'); + selectAllSvg.setAttribute('aria-hidden', 'true'); + selectAllSvg.setAttribute('focusable', 'false'); selectAll.appendChild(selectAllSvg); const selectAllBox = document.createElementNS('http://www.w3.org/2000/svg', 'path'); selectAllBox.setAttribute('d', this.classes.optgroupSelectAllBox); @@ -1132,11 +1237,13 @@ class Render { const optgroupClosableSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); optgroupClosableSvg.setAttribute('viewBox', '0 0 100 100'); optgroupClosableSvg.classList.add(this.classes.arrow); + optgroupClosableSvg.setAttribute('aria-hidden', 'true'); + optgroupClosableSvg.setAttribute('focusable', 'false'); optgroupClosable.appendChild(optgroupClosableSvg); const optgroupClosableArrow = document.createElementNS('http://www.w3.org/2000/svg', 'path'); optgroupClosableSvg.appendChild(optgroupClosableArrow); if (d.options.some((o) => o.selected) || this.content.search.input.value.trim() !== '') { - optgroupClosable.classList.add(this.classes.open); + optgroupEl.classList.add(this.classes.open); optgroupClosableArrow.setAttribute('d', this.classes.arrowOpen); } else if (d.closable === 'open') { @@ -1165,15 +1272,23 @@ class Render { } optgroupEl.appendChild(optgroupLabel); for (const o of d.options) { - optgroupEl.appendChild(this.option(o)); - fragment.appendChild(optgroupEl); + const optEl = this.option(o); + tagPos(optEl); + optgroupEl.appendChild(optEl); } + fragment.appendChild(optgroupEl); } if (d instanceof Option) { - fragment.appendChild(this.option(d)); + const optEl = this.option(d); + tagPos(optEl); + fragment.appendChild(optEl); } } this.content.list.appendChild(fragment); + this.content.list.removeAttribute('aria-busy'); + const visibleCount = this.getOptions(true, true, true).length; + this.content.list.setAttribute('aria-setsize', String(visibleCount)); + this._announcePolite(`${visibleCount} option${visibleCount === 1 ? '' : 's'} available`); } option(option) { if (option.placeholder) { @@ -1183,7 +1298,8 @@ class Render { return placeholder; } const optionEl = document.createElement('div'); - optionEl.id = option.id; + optionEl.dataset.id = option.id; + optionEl.id = `${this.settings.id}__opt__${option.id}`; optionEl.classList.add(this.classes.option); optionEl.setAttribute('role', 'option'); if (option.class) { @@ -1211,6 +1327,7 @@ class Render { } if (option.disabled) { optionEl.classList.add(this.classes.disabled); + optionEl.setAttribute('aria-disabled', 'true'); } if (option.selected && this.settings.hideSelected) { optionEl.classList.add(this.classes.hide); @@ -1394,6 +1511,8 @@ class Render { } } } +Render._livePolite = null; +Render._liveAssertive = null; class Select { constructor(select) { @@ -1740,6 +1859,10 @@ class Settings { this.maxValuesShown = settings.maxValuesShown || 20; this.maxValuesMessage = settings.maxValuesMessage || '{number} selected'; this.addableText = settings.addableText || 'Press "Enter" to add {value}'; + this.ariaLabelledBy = settings.ariaLabelledBy || ''; + this.searchAriaLabel = settings.searchAriaLabel || 'Search options'; + this.searchLabelledBy = settings.searchLabelledBy || ''; + this.clearAllAriaLabel = settings.clearAllAriaLabel || 'Clear selection'; } } diff --git a/dist/slimselect.es.js b/dist/slimselect.es.js index d558d2b0..4e4a9bec 100644 --- a/dist/slimselect.es.js +++ b/dist/slimselect.es.js @@ -363,6 +363,24 @@ class Store { } class Render { + static getLiveAssertive() { + let el = document.getElementById('ss-live-assertive'); + if (!el) { + el = document.createElement('div'); + el.id = 'ss-live-assertive'; + el.setAttribute('role', 'status'); + el.setAttribute('aria-live', 'assertive'); + el.setAttribute('aria-atomic', 'true'); + el.className = 'sr-only'; + document.body.appendChild(el); + } + return el; + } + _announceAssertive(msg) { + const el = (Render._liveAssertive || (Render._liveAssertive = Render.getLiveAssertive())); + el.textContent = ''; + requestAnimationFrame(() => { el.textContent = msg; }); + } constructor(settings, classes, store, callbacks) { var _a; this.store = store; @@ -383,6 +401,24 @@ class Render { this.settings.contentLocation.appendChild(this.content.main); } } + static getLivePolite() { + let el = document.getElementById('ss-live-polite'); + if (!el) { + el = document.createElement('div'); + el.id = 'ss-live-polite'; + el.setAttribute('role', 'status'); + el.setAttribute('aria-live', 'polite'); + el.setAttribute('aria-atomic', 'true'); + el.className = 'sr-only'; + document.body.appendChild(el); + } + return el; + } + _announcePolite(msg) { + const el = (Render._livePolite || (Render._livePolite = Render.getLivePolite())); + el.textContent = ''; + requestAnimationFrame(() => { el.textContent = msg; }); + } enable() { this.main.main.classList.remove(this.classes.disabled); this.content.search.input.disabled = false; @@ -411,6 +447,7 @@ class Render { window.addEventListener('scroll', this.scrollHandler, true); window.addEventListener('resize', this.resizeHandler); } + this.searchFocus(); } close() { this.main.main.classList.remove(this.classes.openAbove); @@ -427,6 +464,8 @@ class Render { window.removeEventListener('resize', this.resizeHandler); this.resizeHandler = undefined; } + this.main.main.focus({ preventScroll: true }); + this.main.main.removeAttribute('aria-activedescendant'); } updateClassStyles() { this.main.main.className = ''; @@ -454,18 +493,35 @@ class Render { } } 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.list.setAttribute('role', 'listbox'); + this.content.list.setAttribute('id', this.content.main.id + '-list'); this.content.list.setAttribute('aria-label', this.settings.contentAriaLabel); + if (this.settings.isMultiple) { + this.content.list.setAttribute('aria-multiselectable', 'true'); + } + else { + this.content.list.removeAttribute('aria-multiselectable'); + } + this.main.main.setAttribute('role', 'combobox'); + this.main.main.setAttribute('aria-haspopup', 'listbox'); + this.main.main.setAttribute('aria-controls', this.content.list.id); + this.main.main.setAttribute('aria-expanded', 'false'); + this.main.main.setAttribute('aria-autocomplete', 'list'); + if (this.settings.ariaLabelledBy && this.settings.ariaLabelledBy.trim()) { + this.main.main.setAttribute('aria-labelledby', this.settings.ariaLabelledBy); + this.main.main.removeAttribute('aria-label'); + } + else if (this.settings.ariaLabel && this.settings.ariaLabel.trim()) { + this.main.main.setAttribute('aria-label', this.settings.ariaLabel); + } + this.main.main.setAttribute('aria-owns', this.content.list.id); + this.content.search.input.setAttribute('aria-controls', this.content.list.id); + this.content.search.input.setAttribute('aria-autocomplete', 'list'); } mainDiv() { var _a; const main = document.createElement('div'); main.id = this.settings.id + '-main'; - main.setAttribute('aria-label', this.settings.ariaLabel); main.tabIndex = 0; main.onkeydown = (e) => { switch (e.key) { @@ -505,6 +561,15 @@ class Render { main.appendChild(values); const deselect = document.createElement('div'); deselect.classList.add(this.classes.deselect); + deselect.setAttribute('role', 'button'); + deselect.setAttribute('tabindex', '0'); + deselect.setAttribute('aria-label', this.settings.clearAllAriaLabel); + deselect.addEventListener('keydown', (e) => { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault(); + deselect.click(); + } + }); const selectedOptions = (_a = this.store) === null || _a === void 0 ? void 0 : _a.getSelectedOptions(); if (!this.settings.allowDeselect || (this.settings.isMultiple && selectedOptions && selectedOptions.length <= 0)) { deselect.classList.add(this.classes.hide); @@ -543,6 +608,8 @@ class Render { }; const deselectSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); deselectSvg.setAttribute('viewBox', '0 0 100 100'); + deselectSvg.setAttribute('aria-hidden', 'true'); + deselectSvg.setAttribute('focusable', 'false'); const deselectPath = document.createElementNS('http://www.w3.org/2000/svg', 'path'); deselectPath.setAttribute('d', this.classes.deselectPath); deselectSvg.appendChild(deselectPath); @@ -551,6 +618,8 @@ class Render { const arrow = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); arrow.classList.add(this.classes.arrow); arrow.setAttribute('viewBox', '0 0 100 100'); + arrow.setAttribute('aria-hidden', 'true'); + arrow.setAttribute('focusable', 'false'); const arrowPath = document.createElementNS('http://www.w3.org/2000/svg', 'path'); arrowPath.setAttribute('d', this.classes.arrowClose); if (this.settings.alwaysOpen) { @@ -716,6 +785,9 @@ class Render { if (!option.mandatory) { const deleteDiv = document.createElement('div'); deleteDiv.classList.add(this.classes.valueDelete); + deleteDiv.setAttribute('role', 'button'); + deleteDiv.setAttribute('aria-label', 'Remove selection'); + deleteDiv.setAttribute('title', 'Remove selection'); deleteDiv.setAttribute('tabindex', '0'); deleteDiv.onclick = (e) => { e.preventDefault(); @@ -758,13 +830,16 @@ class Render { }; const deleteSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); deleteSvg.setAttribute('viewBox', '0 0 100 100'); + deleteSvg.setAttribute('aria-hidden', 'true'); + deleteSvg.setAttribute('focusable', 'false'); const deletePath = document.createElementNS('http://www.w3.org/2000/svg', 'path'); deletePath.setAttribute('d', this.classes.optionDelete); deleteSvg.appendChild(deletePath); deleteDiv.appendChild(deleteSvg); value.appendChild(deleteDiv); deleteDiv.onkeydown = (e) => { - if (e.key === 'Enter') { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault(); deleteDiv.click(); } }; @@ -820,7 +895,15 @@ class Render { input.type = 'search'; input.placeholder = this.settings.searchPlaceholder; input.tabIndex = -1; - input.setAttribute('aria-label', this.settings.searchPlaceholder); + if (this.settings.searchLabelledBy && this.settings.searchLabelledBy.trim()) { + input.setAttribute('aria-labelledby', this.settings.searchLabelledBy); + } + else if (this.settings.searchAriaLabel && this.settings.searchAriaLabel.trim()) { + input.setAttribute('aria-label', this.settings.searchAriaLabel); + } + else { + input.setAttribute('aria-label', 'Search options'); + } input.setAttribute('autocapitalize', 'off'); input.setAttribute('autocomplete', 'off'); input.setAttribute('autocorrect', 'off'); @@ -867,6 +950,8 @@ class Render { addable.classList.add(this.classes.addable); const plus = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); plus.setAttribute('viewBox', '0 0 100 100'); + plus.setAttribute('aria-hidden', 'true'); + plus.setAttribute('focusable', 'false'); const plusPath = document.createElementNS('http://www.w3.org/2000/svg', 'path'); plusPath.setAttribute('d', this.classes.addablePath); plus.appendChild(plusPath); @@ -997,6 +1082,7 @@ class Render { } let selectOption = options[dir === 'down' ? (i + 1 < options.length ? i + 1 : 0) : i - 1 >= 0 ? i - 1 : options.length - 1]; selectOption.classList.add(this.classes.highlighted); + this.main.main.setAttribute('aria-activedescendant', selectOption.id); this.ensureElementInView(this.content.list, selectOption); const selectParent = selectOption.parentElement; if (selectParent && selectParent.classList.contains(this.classes.close)) { @@ -1008,8 +1094,10 @@ class Render { return; } } - options[dir === 'down' ? 0 : options.length - 1].classList.add(this.classes.highlighted); - this.ensureElementInView(this.content.list, options[dir === 'down' ? 0 : options.length - 1]); + const newly = options[dir === 'down' ? 0 : options.length - 1]; + newly.classList.add(this.classes.highlighted); + this.main.main.setAttribute('aria-activedescendant', newly.id); + this.ensureElementInView(this.content.list, newly); } listDiv() { const options = document.createElement('div'); @@ -1018,30 +1106,35 @@ class Render { } renderError(error) { this.content.list.innerHTML = ''; + this.content.list.removeAttribute('aria-busy'); const errorDiv = document.createElement('div'); errorDiv.classList.add(this.classes.error); errorDiv.textContent = error; this.content.list.appendChild(errorDiv); + this._announceAssertive(error); } renderSearching() { this.content.list.innerHTML = ''; + this.content.list.setAttribute('aria-busy', 'true'); const searchingDiv = document.createElement('div'); searchingDiv.classList.add(this.classes.searching); searchingDiv.textContent = this.settings.searchingText; this.content.list.appendChild(searchingDiv); + this._announcePolite(this.settings.searchingText); } renderOptions(data) { this.content.list.innerHTML = ''; + this.content.list.removeAttribute('aria-busy'); if (data.length === 0) { const noResults = document.createElement('div'); noResults.classList.add(this.classes.search); - if (this.callbacks.addable) { - noResults.innerHTML = this.settings.addableText.replace('{value}', this.content.search.input.value); - } - else { - noResults.innerHTML = this.settings.searchText; - } + const msg = this.callbacks.addable + ? this.settings.addableText.replace('{value}', this.content.search.input.value) + : this.settings.searchText; + this._announcePolite(msg); + noResults.innerHTML = msg; this.content.list.appendChild(noResults); + this.content.list.setAttribute('aria-setsize', '0'); return; } if (this.settings.allowDeselect && !this.settings.isMultiple) { @@ -1056,10 +1149,20 @@ class Render { } } const fragment = document.createDocumentFragment(); + let count = 0; + const tagPos = (el) => { + if (!el.classList.contains(this.classes.placeholder) && + !el.classList.contains(this.classes.disabled) && + !el.classList.contains(this.classes.hide)) { + el.setAttribute('aria-posinset', String(++count)); + } + }; for (const d of data) { if (d instanceof Optgroup) { const optgroupEl = document.createElement('div'); optgroupEl.classList.add(this.classes.optgroup); + optgroupEl.setAttribute('role', 'group'); + optgroupEl.setAttribute('aria-label', d.label); const optgroupLabel = document.createElement('div'); optgroupLabel.classList.add(this.classes.optgroupLabel); optgroupEl.appendChild(optgroupLabel); @@ -1088,6 +1191,8 @@ class Render { selectAll.appendChild(selectAllText); const selectAllSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); selectAllSvg.setAttribute('viewBox', '0 0 100 100'); + selectAllSvg.setAttribute('aria-hidden', 'true'); + selectAllSvg.setAttribute('focusable', 'false'); selectAll.appendChild(selectAllSvg); const selectAllBox = document.createElementNS('http://www.w3.org/2000/svg', 'path'); selectAllBox.setAttribute('d', this.classes.optgroupSelectAllBox); @@ -1130,11 +1235,13 @@ class Render { const optgroupClosableSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); optgroupClosableSvg.setAttribute('viewBox', '0 0 100 100'); optgroupClosableSvg.classList.add(this.classes.arrow); + optgroupClosableSvg.setAttribute('aria-hidden', 'true'); + optgroupClosableSvg.setAttribute('focusable', 'false'); optgroupClosable.appendChild(optgroupClosableSvg); const optgroupClosableArrow = document.createElementNS('http://www.w3.org/2000/svg', 'path'); optgroupClosableSvg.appendChild(optgroupClosableArrow); if (d.options.some((o) => o.selected) || this.content.search.input.value.trim() !== '') { - optgroupClosable.classList.add(this.classes.open); + optgroupEl.classList.add(this.classes.open); optgroupClosableArrow.setAttribute('d', this.classes.arrowOpen); } else if (d.closable === 'open') { @@ -1163,15 +1270,23 @@ class Render { } optgroupEl.appendChild(optgroupLabel); for (const o of d.options) { - optgroupEl.appendChild(this.option(o)); - fragment.appendChild(optgroupEl); + const optEl = this.option(o); + tagPos(optEl); + optgroupEl.appendChild(optEl); } + fragment.appendChild(optgroupEl); } if (d instanceof Option) { - fragment.appendChild(this.option(d)); + const optEl = this.option(d); + tagPos(optEl); + fragment.appendChild(optEl); } } this.content.list.appendChild(fragment); + this.content.list.removeAttribute('aria-busy'); + const visibleCount = this.getOptions(true, true, true).length; + this.content.list.setAttribute('aria-setsize', String(visibleCount)); + this._announcePolite(`${visibleCount} option${visibleCount === 1 ? '' : 's'} available`); } option(option) { if (option.placeholder) { @@ -1181,7 +1296,8 @@ class Render { return placeholder; } const optionEl = document.createElement('div'); - optionEl.id = option.id; + optionEl.dataset.id = option.id; + optionEl.id = `${this.settings.id}__opt__${option.id}`; optionEl.classList.add(this.classes.option); optionEl.setAttribute('role', 'option'); if (option.class) { @@ -1209,6 +1325,7 @@ class Render { } if (option.disabled) { optionEl.classList.add(this.classes.disabled); + optionEl.setAttribute('aria-disabled', 'true'); } if (option.selected && this.settings.hideSelected) { optionEl.classList.add(this.classes.hide); @@ -1392,6 +1509,8 @@ class Render { } } } +Render._livePolite = null; +Render._liveAssertive = null; class Select { constructor(select) { @@ -1738,6 +1857,10 @@ class Settings { this.maxValuesShown = settings.maxValuesShown || 20; this.maxValuesMessage = settings.maxValuesMessage || '{number} selected'; this.addableText = settings.addableText || 'Press "Enter" to add {value}'; + this.ariaLabelledBy = settings.ariaLabelledBy || ''; + this.searchAriaLabel = settings.searchAriaLabel || 'Search options'; + this.searchLabelledBy = settings.searchLabelledBy || ''; + this.clearAllAriaLabel = settings.clearAllAriaLabel || 'Clear selection'; } } diff --git a/dist/slimselect.global.js b/dist/slimselect.global.js index d4a43aee..de977d71 100644 --- a/dist/slimselect.global.js +++ b/dist/slimselect.global.js @@ -366,6 +366,24 @@ var SlimSelect = (function () { } class Render { + static getLiveAssertive() { + let el = document.getElementById('ss-live-assertive'); + if (!el) { + el = document.createElement('div'); + el.id = 'ss-live-assertive'; + el.setAttribute('role', 'status'); + el.setAttribute('aria-live', 'assertive'); + el.setAttribute('aria-atomic', 'true'); + el.className = 'sr-only'; + document.body.appendChild(el); + } + return el; + } + _announceAssertive(msg) { + const el = (Render._liveAssertive || (Render._liveAssertive = Render.getLiveAssertive())); + el.textContent = ''; + requestAnimationFrame(() => { el.textContent = msg; }); + } constructor(settings, classes, store, callbacks) { var _a; this.store = store; @@ -386,6 +404,24 @@ var SlimSelect = (function () { this.settings.contentLocation.appendChild(this.content.main); } } + static getLivePolite() { + let el = document.getElementById('ss-live-polite'); + if (!el) { + el = document.createElement('div'); + el.id = 'ss-live-polite'; + el.setAttribute('role', 'status'); + el.setAttribute('aria-live', 'polite'); + el.setAttribute('aria-atomic', 'true'); + el.className = 'sr-only'; + document.body.appendChild(el); + } + return el; + } + _announcePolite(msg) { + const el = (Render._livePolite || (Render._livePolite = Render.getLivePolite())); + el.textContent = ''; + requestAnimationFrame(() => { el.textContent = msg; }); + } enable() { this.main.main.classList.remove(this.classes.disabled); this.content.search.input.disabled = false; @@ -414,6 +450,7 @@ var SlimSelect = (function () { window.addEventListener('scroll', this.scrollHandler, true); window.addEventListener('resize', this.resizeHandler); } + this.searchFocus(); } close() { this.main.main.classList.remove(this.classes.openAbove); @@ -430,6 +467,8 @@ var SlimSelect = (function () { window.removeEventListener('resize', this.resizeHandler); this.resizeHandler = undefined; } + this.main.main.focus({ preventScroll: true }); + this.main.main.removeAttribute('aria-activedescendant'); } updateClassStyles() { this.main.main.className = ''; @@ -457,18 +496,35 @@ var SlimSelect = (function () { } } 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.list.setAttribute('role', 'listbox'); + this.content.list.setAttribute('id', this.content.main.id + '-list'); this.content.list.setAttribute('aria-label', this.settings.contentAriaLabel); + if (this.settings.isMultiple) { + this.content.list.setAttribute('aria-multiselectable', 'true'); + } + else { + this.content.list.removeAttribute('aria-multiselectable'); + } + this.main.main.setAttribute('role', 'combobox'); + this.main.main.setAttribute('aria-haspopup', 'listbox'); + this.main.main.setAttribute('aria-controls', this.content.list.id); + this.main.main.setAttribute('aria-expanded', 'false'); + this.main.main.setAttribute('aria-autocomplete', 'list'); + if (this.settings.ariaLabelledBy && this.settings.ariaLabelledBy.trim()) { + this.main.main.setAttribute('aria-labelledby', this.settings.ariaLabelledBy); + this.main.main.removeAttribute('aria-label'); + } + else if (this.settings.ariaLabel && this.settings.ariaLabel.trim()) { + this.main.main.setAttribute('aria-label', this.settings.ariaLabel); + } + this.main.main.setAttribute('aria-owns', this.content.list.id); + this.content.search.input.setAttribute('aria-controls', this.content.list.id); + this.content.search.input.setAttribute('aria-autocomplete', 'list'); } mainDiv() { var _a; const main = document.createElement('div'); main.id = this.settings.id + '-main'; - main.setAttribute('aria-label', this.settings.ariaLabel); main.tabIndex = 0; main.onkeydown = (e) => { switch (e.key) { @@ -508,6 +564,15 @@ var SlimSelect = (function () { main.appendChild(values); const deselect = document.createElement('div'); deselect.classList.add(this.classes.deselect); + deselect.setAttribute('role', 'button'); + deselect.setAttribute('tabindex', '0'); + deselect.setAttribute('aria-label', this.settings.clearAllAriaLabel); + deselect.addEventListener('keydown', (e) => { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault(); + deselect.click(); + } + }); const selectedOptions = (_a = this.store) === null || _a === void 0 ? void 0 : _a.getSelectedOptions(); if (!this.settings.allowDeselect || (this.settings.isMultiple && selectedOptions && selectedOptions.length <= 0)) { deselect.classList.add(this.classes.hide); @@ -546,6 +611,8 @@ var SlimSelect = (function () { }; const deselectSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); deselectSvg.setAttribute('viewBox', '0 0 100 100'); + deselectSvg.setAttribute('aria-hidden', 'true'); + deselectSvg.setAttribute('focusable', 'false'); const deselectPath = document.createElementNS('http://www.w3.org/2000/svg', 'path'); deselectPath.setAttribute('d', this.classes.deselectPath); deselectSvg.appendChild(deselectPath); @@ -554,6 +621,8 @@ var SlimSelect = (function () { const arrow = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); arrow.classList.add(this.classes.arrow); arrow.setAttribute('viewBox', '0 0 100 100'); + arrow.setAttribute('aria-hidden', 'true'); + arrow.setAttribute('focusable', 'false'); const arrowPath = document.createElementNS('http://www.w3.org/2000/svg', 'path'); arrowPath.setAttribute('d', this.classes.arrowClose); if (this.settings.alwaysOpen) { @@ -719,6 +788,9 @@ var SlimSelect = (function () { if (!option.mandatory) { const deleteDiv = document.createElement('div'); deleteDiv.classList.add(this.classes.valueDelete); + deleteDiv.setAttribute('role', 'button'); + deleteDiv.setAttribute('aria-label', 'Remove selection'); + deleteDiv.setAttribute('title', 'Remove selection'); deleteDiv.setAttribute('tabindex', '0'); deleteDiv.onclick = (e) => { e.preventDefault(); @@ -761,13 +833,16 @@ var SlimSelect = (function () { }; const deleteSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); deleteSvg.setAttribute('viewBox', '0 0 100 100'); + deleteSvg.setAttribute('aria-hidden', 'true'); + deleteSvg.setAttribute('focusable', 'false'); const deletePath = document.createElementNS('http://www.w3.org/2000/svg', 'path'); deletePath.setAttribute('d', this.classes.optionDelete); deleteSvg.appendChild(deletePath); deleteDiv.appendChild(deleteSvg); value.appendChild(deleteDiv); deleteDiv.onkeydown = (e) => { - if (e.key === 'Enter') { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault(); deleteDiv.click(); } }; @@ -823,7 +898,15 @@ var SlimSelect = (function () { input.type = 'search'; input.placeholder = this.settings.searchPlaceholder; input.tabIndex = -1; - input.setAttribute('aria-label', this.settings.searchPlaceholder); + if (this.settings.searchLabelledBy && this.settings.searchLabelledBy.trim()) { + input.setAttribute('aria-labelledby', this.settings.searchLabelledBy); + } + else if (this.settings.searchAriaLabel && this.settings.searchAriaLabel.trim()) { + input.setAttribute('aria-label', this.settings.searchAriaLabel); + } + else { + input.setAttribute('aria-label', 'Search options'); + } input.setAttribute('autocapitalize', 'off'); input.setAttribute('autocomplete', 'off'); input.setAttribute('autocorrect', 'off'); @@ -870,6 +953,8 @@ var SlimSelect = (function () { addable.classList.add(this.classes.addable); const plus = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); plus.setAttribute('viewBox', '0 0 100 100'); + plus.setAttribute('aria-hidden', 'true'); + plus.setAttribute('focusable', 'false'); const plusPath = document.createElementNS('http://www.w3.org/2000/svg', 'path'); plusPath.setAttribute('d', this.classes.addablePath); plus.appendChild(plusPath); @@ -1000,6 +1085,7 @@ var SlimSelect = (function () { } let selectOption = options[dir === 'down' ? (i + 1 < options.length ? i + 1 : 0) : i - 1 >= 0 ? i - 1 : options.length - 1]; selectOption.classList.add(this.classes.highlighted); + this.main.main.setAttribute('aria-activedescendant', selectOption.id); this.ensureElementInView(this.content.list, selectOption); const selectParent = selectOption.parentElement; if (selectParent && selectParent.classList.contains(this.classes.close)) { @@ -1011,8 +1097,10 @@ var SlimSelect = (function () { return; } } - options[dir === 'down' ? 0 : options.length - 1].classList.add(this.classes.highlighted); - this.ensureElementInView(this.content.list, options[dir === 'down' ? 0 : options.length - 1]); + const newly = options[dir === 'down' ? 0 : options.length - 1]; + newly.classList.add(this.classes.highlighted); + this.main.main.setAttribute('aria-activedescendant', newly.id); + this.ensureElementInView(this.content.list, newly); } listDiv() { const options = document.createElement('div'); @@ -1021,30 +1109,35 @@ var SlimSelect = (function () { } renderError(error) { this.content.list.innerHTML = ''; + this.content.list.removeAttribute('aria-busy'); const errorDiv = document.createElement('div'); errorDiv.classList.add(this.classes.error); errorDiv.textContent = error; this.content.list.appendChild(errorDiv); + this._announceAssertive(error); } renderSearching() { this.content.list.innerHTML = ''; + this.content.list.setAttribute('aria-busy', 'true'); const searchingDiv = document.createElement('div'); searchingDiv.classList.add(this.classes.searching); searchingDiv.textContent = this.settings.searchingText; this.content.list.appendChild(searchingDiv); + this._announcePolite(this.settings.searchingText); } renderOptions(data) { this.content.list.innerHTML = ''; + this.content.list.removeAttribute('aria-busy'); if (data.length === 0) { const noResults = document.createElement('div'); noResults.classList.add(this.classes.search); - if (this.callbacks.addable) { - noResults.innerHTML = this.settings.addableText.replace('{value}', this.content.search.input.value); - } - else { - noResults.innerHTML = this.settings.searchText; - } + const msg = this.callbacks.addable + ? this.settings.addableText.replace('{value}', this.content.search.input.value) + : this.settings.searchText; + this._announcePolite(msg); + noResults.innerHTML = msg; this.content.list.appendChild(noResults); + this.content.list.setAttribute('aria-setsize', '0'); return; } if (this.settings.allowDeselect && !this.settings.isMultiple) { @@ -1059,10 +1152,20 @@ var SlimSelect = (function () { } } const fragment = document.createDocumentFragment(); + let count = 0; + const tagPos = (el) => { + if (!el.classList.contains(this.classes.placeholder) && + !el.classList.contains(this.classes.disabled) && + !el.classList.contains(this.classes.hide)) { + el.setAttribute('aria-posinset', String(++count)); + } + }; for (const d of data) { if (d instanceof Optgroup) { const optgroupEl = document.createElement('div'); optgroupEl.classList.add(this.classes.optgroup); + optgroupEl.setAttribute('role', 'group'); + optgroupEl.setAttribute('aria-label', d.label); const optgroupLabel = document.createElement('div'); optgroupLabel.classList.add(this.classes.optgroupLabel); optgroupEl.appendChild(optgroupLabel); @@ -1091,6 +1194,8 @@ var SlimSelect = (function () { selectAll.appendChild(selectAllText); const selectAllSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); selectAllSvg.setAttribute('viewBox', '0 0 100 100'); + selectAllSvg.setAttribute('aria-hidden', 'true'); + selectAllSvg.setAttribute('focusable', 'false'); selectAll.appendChild(selectAllSvg); const selectAllBox = document.createElementNS('http://www.w3.org/2000/svg', 'path'); selectAllBox.setAttribute('d', this.classes.optgroupSelectAllBox); @@ -1133,11 +1238,13 @@ var SlimSelect = (function () { const optgroupClosableSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); optgroupClosableSvg.setAttribute('viewBox', '0 0 100 100'); optgroupClosableSvg.classList.add(this.classes.arrow); + optgroupClosableSvg.setAttribute('aria-hidden', 'true'); + optgroupClosableSvg.setAttribute('focusable', 'false'); optgroupClosable.appendChild(optgroupClosableSvg); const optgroupClosableArrow = document.createElementNS('http://www.w3.org/2000/svg', 'path'); optgroupClosableSvg.appendChild(optgroupClosableArrow); if (d.options.some((o) => o.selected) || this.content.search.input.value.trim() !== '') { - optgroupClosable.classList.add(this.classes.open); + optgroupEl.classList.add(this.classes.open); optgroupClosableArrow.setAttribute('d', this.classes.arrowOpen); } else if (d.closable === 'open') { @@ -1166,15 +1273,23 @@ var SlimSelect = (function () { } optgroupEl.appendChild(optgroupLabel); for (const o of d.options) { - optgroupEl.appendChild(this.option(o)); - fragment.appendChild(optgroupEl); + const optEl = this.option(o); + tagPos(optEl); + optgroupEl.appendChild(optEl); } + fragment.appendChild(optgroupEl); } if (d instanceof Option) { - fragment.appendChild(this.option(d)); + const optEl = this.option(d); + tagPos(optEl); + fragment.appendChild(optEl); } } this.content.list.appendChild(fragment); + this.content.list.removeAttribute('aria-busy'); + const visibleCount = this.getOptions(true, true, true).length; + this.content.list.setAttribute('aria-setsize', String(visibleCount)); + this._announcePolite(`${visibleCount} option${visibleCount === 1 ? '' : 's'} available`); } option(option) { if (option.placeholder) { @@ -1184,7 +1299,8 @@ var SlimSelect = (function () { return placeholder; } const optionEl = document.createElement('div'); - optionEl.id = option.id; + optionEl.dataset.id = option.id; + optionEl.id = `${this.settings.id}__opt__${option.id}`; optionEl.classList.add(this.classes.option); optionEl.setAttribute('role', 'option'); if (option.class) { @@ -1212,6 +1328,7 @@ var SlimSelect = (function () { } if (option.disabled) { optionEl.classList.add(this.classes.disabled); + optionEl.setAttribute('aria-disabled', 'true'); } if (option.selected && this.settings.hideSelected) { optionEl.classList.add(this.classes.hide); @@ -1395,6 +1512,8 @@ var SlimSelect = (function () { } } } + Render._livePolite = null; + Render._liveAssertive = null; class Select { constructor(select) { @@ -1741,6 +1860,10 @@ var SlimSelect = (function () { this.maxValuesShown = settings.maxValuesShown || 20; this.maxValuesMessage = settings.maxValuesMessage || '{number} selected'; this.addableText = settings.addableText || 'Press "Enter" to add {value}'; + this.ariaLabelledBy = settings.ariaLabelledBy || ''; + this.searchAriaLabel = settings.searchAriaLabel || 'Search options'; + this.searchLabelledBy = settings.searchLabelledBy || ''; + this.clearAllAriaLabel = settings.clearAllAriaLabel || 'Clear selection'; } } diff --git a/dist/slimselect.js b/dist/slimselect.js index c3a9da82..7275e921 100644 --- a/dist/slimselect.js +++ b/dist/slimselect.js @@ -369,6 +369,24 @@ } class Render { + static getLiveAssertive() { + let el = document.getElementById('ss-live-assertive'); + if (!el) { + el = document.createElement('div'); + el.id = 'ss-live-assertive'; + el.setAttribute('role', 'status'); + el.setAttribute('aria-live', 'assertive'); + el.setAttribute('aria-atomic', 'true'); + el.className = 'sr-only'; + document.body.appendChild(el); + } + return el; + } + _announceAssertive(msg) { + const el = (Render._liveAssertive || (Render._liveAssertive = Render.getLiveAssertive())); + el.textContent = ''; + requestAnimationFrame(() => { el.textContent = msg; }); + } constructor(settings, classes, store, callbacks) { var _a; this.store = store; @@ -389,6 +407,24 @@ this.settings.contentLocation.appendChild(this.content.main); } } + static getLivePolite() { + let el = document.getElementById('ss-live-polite'); + if (!el) { + el = document.createElement('div'); + el.id = 'ss-live-polite'; + el.setAttribute('role', 'status'); + el.setAttribute('aria-live', 'polite'); + el.setAttribute('aria-atomic', 'true'); + el.className = 'sr-only'; + document.body.appendChild(el); + } + return el; + } + _announcePolite(msg) { + const el = (Render._livePolite || (Render._livePolite = Render.getLivePolite())); + el.textContent = ''; + requestAnimationFrame(() => { el.textContent = msg; }); + } enable() { this.main.main.classList.remove(this.classes.disabled); this.content.search.input.disabled = false; @@ -417,6 +453,7 @@ window.addEventListener('scroll', this.scrollHandler, true); window.addEventListener('resize', this.resizeHandler); } + this.searchFocus(); } close() { this.main.main.classList.remove(this.classes.openAbove); @@ -433,6 +470,8 @@ window.removeEventListener('resize', this.resizeHandler); this.resizeHandler = undefined; } + this.main.main.focus({ preventScroll: true }); + this.main.main.removeAttribute('aria-activedescendant'); } updateClassStyles() { this.main.main.className = ''; @@ -460,18 +499,35 @@ } } 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.list.setAttribute('role', 'listbox'); + this.content.list.setAttribute('id', this.content.main.id + '-list'); this.content.list.setAttribute('aria-label', this.settings.contentAriaLabel); + if (this.settings.isMultiple) { + this.content.list.setAttribute('aria-multiselectable', 'true'); + } + else { + this.content.list.removeAttribute('aria-multiselectable'); + } + this.main.main.setAttribute('role', 'combobox'); + this.main.main.setAttribute('aria-haspopup', 'listbox'); + this.main.main.setAttribute('aria-controls', this.content.list.id); + this.main.main.setAttribute('aria-expanded', 'false'); + this.main.main.setAttribute('aria-autocomplete', 'list'); + if (this.settings.ariaLabelledBy && this.settings.ariaLabelledBy.trim()) { + this.main.main.setAttribute('aria-labelledby', this.settings.ariaLabelledBy); + this.main.main.removeAttribute('aria-label'); + } + else if (this.settings.ariaLabel && this.settings.ariaLabel.trim()) { + this.main.main.setAttribute('aria-label', this.settings.ariaLabel); + } + this.main.main.setAttribute('aria-owns', this.content.list.id); + this.content.search.input.setAttribute('aria-controls', this.content.list.id); + this.content.search.input.setAttribute('aria-autocomplete', 'list'); } mainDiv() { var _a; const main = document.createElement('div'); main.id = this.settings.id + '-main'; - main.setAttribute('aria-label', this.settings.ariaLabel); main.tabIndex = 0; main.onkeydown = (e) => { switch (e.key) { @@ -511,6 +567,15 @@ main.appendChild(values); const deselect = document.createElement('div'); deselect.classList.add(this.classes.deselect); + deselect.setAttribute('role', 'button'); + deselect.setAttribute('tabindex', '0'); + deselect.setAttribute('aria-label', this.settings.clearAllAriaLabel); + deselect.addEventListener('keydown', (e) => { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault(); + deselect.click(); + } + }); const selectedOptions = (_a = this.store) === null || _a === void 0 ? void 0 : _a.getSelectedOptions(); if (!this.settings.allowDeselect || (this.settings.isMultiple && selectedOptions && selectedOptions.length <= 0)) { deselect.classList.add(this.classes.hide); @@ -549,6 +614,8 @@ }; const deselectSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); deselectSvg.setAttribute('viewBox', '0 0 100 100'); + deselectSvg.setAttribute('aria-hidden', 'true'); + deselectSvg.setAttribute('focusable', 'false'); const deselectPath = document.createElementNS('http://www.w3.org/2000/svg', 'path'); deselectPath.setAttribute('d', this.classes.deselectPath); deselectSvg.appendChild(deselectPath); @@ -557,6 +624,8 @@ const arrow = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); arrow.classList.add(this.classes.arrow); arrow.setAttribute('viewBox', '0 0 100 100'); + arrow.setAttribute('aria-hidden', 'true'); + arrow.setAttribute('focusable', 'false'); const arrowPath = document.createElementNS('http://www.w3.org/2000/svg', 'path'); arrowPath.setAttribute('d', this.classes.arrowClose); if (this.settings.alwaysOpen) { @@ -722,6 +791,9 @@ if (!option.mandatory) { const deleteDiv = document.createElement('div'); deleteDiv.classList.add(this.classes.valueDelete); + deleteDiv.setAttribute('role', 'button'); + deleteDiv.setAttribute('aria-label', 'Remove selection'); + deleteDiv.setAttribute('title', 'Remove selection'); deleteDiv.setAttribute('tabindex', '0'); deleteDiv.onclick = (e) => { e.preventDefault(); @@ -764,13 +836,16 @@ }; const deleteSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); deleteSvg.setAttribute('viewBox', '0 0 100 100'); + deleteSvg.setAttribute('aria-hidden', 'true'); + deleteSvg.setAttribute('focusable', 'false'); const deletePath = document.createElementNS('http://www.w3.org/2000/svg', 'path'); deletePath.setAttribute('d', this.classes.optionDelete); deleteSvg.appendChild(deletePath); deleteDiv.appendChild(deleteSvg); value.appendChild(deleteDiv); deleteDiv.onkeydown = (e) => { - if (e.key === 'Enter') { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault(); deleteDiv.click(); } }; @@ -826,7 +901,15 @@ input.type = 'search'; input.placeholder = this.settings.searchPlaceholder; input.tabIndex = -1; - input.setAttribute('aria-label', this.settings.searchPlaceholder); + if (this.settings.searchLabelledBy && this.settings.searchLabelledBy.trim()) { + input.setAttribute('aria-labelledby', this.settings.searchLabelledBy); + } + else if (this.settings.searchAriaLabel && this.settings.searchAriaLabel.trim()) { + input.setAttribute('aria-label', this.settings.searchAriaLabel); + } + else { + input.setAttribute('aria-label', 'Search options'); + } input.setAttribute('autocapitalize', 'off'); input.setAttribute('autocomplete', 'off'); input.setAttribute('autocorrect', 'off'); @@ -873,6 +956,8 @@ addable.classList.add(this.classes.addable); const plus = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); plus.setAttribute('viewBox', '0 0 100 100'); + plus.setAttribute('aria-hidden', 'true'); + plus.setAttribute('focusable', 'false'); const plusPath = document.createElementNS('http://www.w3.org/2000/svg', 'path'); plusPath.setAttribute('d', this.classes.addablePath); plus.appendChild(plusPath); @@ -1003,6 +1088,7 @@ } let selectOption = options[dir === 'down' ? (i + 1 < options.length ? i + 1 : 0) : i - 1 >= 0 ? i - 1 : options.length - 1]; selectOption.classList.add(this.classes.highlighted); + this.main.main.setAttribute('aria-activedescendant', selectOption.id); this.ensureElementInView(this.content.list, selectOption); const selectParent = selectOption.parentElement; if (selectParent && selectParent.classList.contains(this.classes.close)) { @@ -1014,8 +1100,10 @@ return; } } - options[dir === 'down' ? 0 : options.length - 1].classList.add(this.classes.highlighted); - this.ensureElementInView(this.content.list, options[dir === 'down' ? 0 : options.length - 1]); + const newly = options[dir === 'down' ? 0 : options.length - 1]; + newly.classList.add(this.classes.highlighted); + this.main.main.setAttribute('aria-activedescendant', newly.id); + this.ensureElementInView(this.content.list, newly); } listDiv() { const options = document.createElement('div'); @@ -1024,30 +1112,35 @@ } renderError(error) { this.content.list.innerHTML = ''; + this.content.list.removeAttribute('aria-busy'); const errorDiv = document.createElement('div'); errorDiv.classList.add(this.classes.error); errorDiv.textContent = error; this.content.list.appendChild(errorDiv); + this._announceAssertive(error); } renderSearching() { this.content.list.innerHTML = ''; + this.content.list.setAttribute('aria-busy', 'true'); const searchingDiv = document.createElement('div'); searchingDiv.classList.add(this.classes.searching); searchingDiv.textContent = this.settings.searchingText; this.content.list.appendChild(searchingDiv); + this._announcePolite(this.settings.searchingText); } renderOptions(data) { this.content.list.innerHTML = ''; + this.content.list.removeAttribute('aria-busy'); if (data.length === 0) { const noResults = document.createElement('div'); noResults.classList.add(this.classes.search); - if (this.callbacks.addable) { - noResults.innerHTML = this.settings.addableText.replace('{value}', this.content.search.input.value); - } - else { - noResults.innerHTML = this.settings.searchText; - } + const msg = this.callbacks.addable + ? this.settings.addableText.replace('{value}', this.content.search.input.value) + : this.settings.searchText; + this._announcePolite(msg); + noResults.innerHTML = msg; this.content.list.appendChild(noResults); + this.content.list.setAttribute('aria-setsize', '0'); return; } if (this.settings.allowDeselect && !this.settings.isMultiple) { @@ -1062,10 +1155,20 @@ } } const fragment = document.createDocumentFragment(); + let count = 0; + const tagPos = (el) => { + if (!el.classList.contains(this.classes.placeholder) && + !el.classList.contains(this.classes.disabled) && + !el.classList.contains(this.classes.hide)) { + el.setAttribute('aria-posinset', String(++count)); + } + }; for (const d of data) { if (d instanceof Optgroup) { const optgroupEl = document.createElement('div'); optgroupEl.classList.add(this.classes.optgroup); + optgroupEl.setAttribute('role', 'group'); + optgroupEl.setAttribute('aria-label', d.label); const optgroupLabel = document.createElement('div'); optgroupLabel.classList.add(this.classes.optgroupLabel); optgroupEl.appendChild(optgroupLabel); @@ -1094,6 +1197,8 @@ selectAll.appendChild(selectAllText); const selectAllSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); selectAllSvg.setAttribute('viewBox', '0 0 100 100'); + selectAllSvg.setAttribute('aria-hidden', 'true'); + selectAllSvg.setAttribute('focusable', 'false'); selectAll.appendChild(selectAllSvg); const selectAllBox = document.createElementNS('http://www.w3.org/2000/svg', 'path'); selectAllBox.setAttribute('d', this.classes.optgroupSelectAllBox); @@ -1136,11 +1241,13 @@ const optgroupClosableSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); optgroupClosableSvg.setAttribute('viewBox', '0 0 100 100'); optgroupClosableSvg.classList.add(this.classes.arrow); + optgroupClosableSvg.setAttribute('aria-hidden', 'true'); + optgroupClosableSvg.setAttribute('focusable', 'false'); optgroupClosable.appendChild(optgroupClosableSvg); const optgroupClosableArrow = document.createElementNS('http://www.w3.org/2000/svg', 'path'); optgroupClosableSvg.appendChild(optgroupClosableArrow); if (d.options.some((o) => o.selected) || this.content.search.input.value.trim() !== '') { - optgroupClosable.classList.add(this.classes.open); + optgroupEl.classList.add(this.classes.open); optgroupClosableArrow.setAttribute('d', this.classes.arrowOpen); } else if (d.closable === 'open') { @@ -1169,15 +1276,23 @@ } optgroupEl.appendChild(optgroupLabel); for (const o of d.options) { - optgroupEl.appendChild(this.option(o)); - fragment.appendChild(optgroupEl); + const optEl = this.option(o); + tagPos(optEl); + optgroupEl.appendChild(optEl); } + fragment.appendChild(optgroupEl); } if (d instanceof Option) { - fragment.appendChild(this.option(d)); + const optEl = this.option(d); + tagPos(optEl); + fragment.appendChild(optEl); } } this.content.list.appendChild(fragment); + this.content.list.removeAttribute('aria-busy'); + const visibleCount = this.getOptions(true, true, true).length; + this.content.list.setAttribute('aria-setsize', String(visibleCount)); + this._announcePolite(`${visibleCount} option${visibleCount === 1 ? '' : 's'} available`); } option(option) { if (option.placeholder) { @@ -1187,7 +1302,8 @@ return placeholder; } const optionEl = document.createElement('div'); - optionEl.id = option.id; + optionEl.dataset.id = option.id; + optionEl.id = `${this.settings.id}__opt__${option.id}`; optionEl.classList.add(this.classes.option); optionEl.setAttribute('role', 'option'); if (option.class) { @@ -1215,6 +1331,7 @@ } if (option.disabled) { optionEl.classList.add(this.classes.disabled); + optionEl.setAttribute('aria-disabled', 'true'); } if (option.selected && this.settings.hideSelected) { optionEl.classList.add(this.classes.hide); @@ -1398,6 +1515,8 @@ } } } + Render._livePolite = null; + Render._liveAssertive = null; class Select { constructor(select) { @@ -1744,6 +1863,10 @@ this.maxValuesShown = settings.maxValuesShown || 20; this.maxValuesMessage = settings.maxValuesMessage || '{number} selected'; this.addableText = settings.addableText || 'Press "Enter" to add {value}'; + this.ariaLabelledBy = settings.ariaLabelledBy || ''; + this.searchAriaLabel = settings.searchAriaLabel || 'Search options'; + this.searchLabelledBy = settings.searchLabelledBy || ''; + this.clearAllAriaLabel = settings.clearAllAriaLabel || 'Clear selection'; } } diff --git a/dist/slimselect.min.js b/dist/slimselect.min.js index 27dffae2..2f4d0f93 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";class t{constructor(t){t||(t={}),this.main=t.main||"ss-main",this.placeholder=t.placeholder||"ss-placeholder",this.values=t.values||"ss-values",this.single=t.single||"ss-single",this.max=t.max||"ss-max",this.value=t.value||"ss-value",this.valueText=t.valueText||"ss-value-text",this.valueDelete=t.valueDelete||"ss-value-delete",this.valueOut=t.valueOut||"ss-value-out",this.deselect=t.deselect||"ss-deselect",this.deselectPath=t.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=t.arrow||"ss-arrow",this.arrowClose=t.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=t.arrowOpen||"M10,70 L50,30 L90,70",this.content=t.content||"ss-content",this.openAbove=t.openAbove||"ss-open-above",this.openBelow=t.openBelow||"ss-open-below",this.search=t.search||"ss-search",this.searchHighlighter=t.searchHighlighter||"ss-search-highlight",this.searching=t.searching||"ss-searching",this.addable=t.addable||"ss-addable",this.addablePath=t.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=t.list||"ss-list",this.optgroup=t.optgroup||"ss-optgroup",this.optgroupLabel=t.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=t.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=t.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=t.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=t.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=t.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=t.optgroupClosable||"ss-closable",this.option=t.option||"ss-option",this.optionDelete=t.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=t.highlighted||"ss-highlighted",this.open=t.open||"ss-open",this.close=t.close||"ss-close",this.selected=t.selected||"ss-selected",this.error=t.error||"ss-error",this.disabled=t.disabled||"ss-disabled",this.hide=t.hide||"ss-hide"}}function e(){return Math.random().toString(36).substring(2,10)}function s(t,e=50,s=!1){let i;return function(...n){const l=self,a=s&&!i;clearTimeout(i),i=setTimeout((()=>{i=null,s||t.apply(l,n)}),e),a&&t.apply(l,n)}}function i(t,e){return JSON.stringify(t)===JSON.stringify(e)}class n{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 l(e))}}class l{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.defaultSelected=void 0!==t.defaultSelected&&t.defaultSelected,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(t,e){this.selectType="single",this.data=[],this.selectedOrder=[],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 n||"label"in e){if(!("label"in e))return new Error("Optgroup must have a label");if("options"in e&&e.options)for(let t of e.options){const e=this.validateOption(t);if(e)return e}}else{if(!(e instanceof l||"text"in e))return new Error("Data object must be a valid optgroup or option");{const t=this.validateOption(e);if(t)return 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 n||"label"in t){let s=[];"options"in t&&t.options&&t.options.forEach((t=>{s.push(new l(t))})),s.length>0&&e.push(new n(t))}(t instanceof l||"text"in t)&&e.push(new l(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,e=!1){if(e){let e=[new l(t)];this.setData(e.concat(this.getData()))}else this.setData(this.getData().concat(new l(t)))}setSelectedBy(t,e){let s=null,i=!1;const a=[];for(let o of this.data){if(o instanceof n)for(let n of o.options)s||(s=n),n.selected=!i&&e.includes(n[t]),n.selected&&(a.push(n),"single"===this.selectType&&(i=!0));o instanceof l&&(s||(s=o),o.selected=!i&&e.includes(o[t]),o.selected&&(a.push(o),"single"===this.selectType&&(i=!0)))}"single"===this.selectType&&s&&!i&&(s.selected=!0,a.push(s));const o=e.map((e=>{var s;return(null===(s=a.find((s=>s[t]===e)))||void 0===s?void 0:s.id)||""}));this.selectedOrder=o}getSelected(){return this.getSelectedOptions().map((t=>t.id))}getSelectedValues(){return this.getSelectedOptions().map((t=>t.value))}getSelectedOptions(){return this.filter((t=>t.selected),!1)}getOptgroupByID(t){for(let e of this.data)if(e instanceof n&&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 n?t=e.options[0]:e instanceof l&&(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((i=>{if(i instanceof n){let a=[];if(i.options.forEach((i=>{t&&!t(i)||(e?a.push(new l(i)):s.push(new l(i)))})),a.length>0){let t=new n(i);t.options=a,s.push(t)}}i instanceof l&&(t&&!t(i)||s.push(new l(i)))})),s}selectedOrderOptions(t){const e=[];return this.selectedOrder.forEach((s=>{const i=t.find((t=>t.id===s));i&&e.push(i)})),t.forEach((t=>{let s=!1;e.forEach((e=>{t.id!==e.id||(s=!0)})),s||e.push(t)})),e}}class o{constructor(t,e,s,i){var n;this.store=s,this.settings=t,this.classes=e,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes();const l=null===(n=document.querySelector(`[data-id="${this.settings.id}"]`))||void 0===n?void 0:n.closest(".offcanvas-body");l?l.appendChild(this.content.main):this.settings.contentLocation&&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)}"fixed"===this.settings.contentPosition&&(this.moveContent(),this.scrollHandler=()=>this.moveContent(),this.resizeHandler=()=>this.moveContent(),window.addEventListener("scroll",this.scrollHandler,!0),window.addEventListener("resize",this.resizeHandler))}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),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=void 0),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=void 0)}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.main.main.classList.add("ss-2"),this.content.main.classList.add(this.classes.content),this.content.main.classList.add("ss-content-2"),""!==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&&"fixed"!==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.list.setAttribute("role","listbox"),this.content.list.setAttribute("aria-label",this.settings.contentAriaLabel)}mainDiv(){var t;const e=document.createElement("div");e.id=this.settings.id+"-main",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===t.key.length&&this.callbacks.open(),!0},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 l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.setAttribute("viewBox","0 0 100 100");const a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("d",this.classes.deselectPath),l.appendChild(a),i.appendChild(l),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:l,path:a},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()}this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e));let s=[];for(let i=0;it.id===l),!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 i=this.store.getSelectedOptions(),a=i.filter((e=>e.selected&&e.id!==t.id),!0);if(!(this.settings.minSelected&&a.length{"Enter"===t.key&&s.click()}}return e}contentDiv(){const t=document.createElement("div");t.id=this.settings.id+"-content";const e=this.searchDiv();t.appendChild(e.main);const s=this.listDiv();return t.appendChild(s),{main:t,search:e,list:s}}moveContent(){"relative"!==this.settings.contentPosition&&"down"!==this.settings.openPosition?"up"!==this.settings.openPosition?"up"===this.putContent()?this.moveContentAbove():this.moveContentBelow():this.moveContentAbove():this.moveContentBelow()}searchDiv(){const t=document.createElement("div"),e=document.createElement("input"),i=document.createElement("div");t.classList.add(this.classes.search);const n={main:t,input:e};if(this.settings.showSearch||(t.classList.add(this.classes.hide),e.readOnly=!0),e.type="search",e.placeholder=this.settings.searchPlaceholder,e.tabIndex=-1,e.setAttribute("aria-label",this.settings.searchPlaceholder),e.setAttribute("autocapitalize","off"),e.setAttribute("autocomplete","off"),e.setAttribute("autocorrect","off"),e.oninput=s((t=>{this.callbacks.search(t.target.value)}),100),e.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" ":const e=this.content.list.querySelector("."+this.classes.highlighted);return!e||(e.click(),!1);case"Enter":if(this.callbacks.addable)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(e),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 l(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=>{"string"==typeof t?s({text:t,value:t}):i instanceof Error?this.renderError(i.message):s(t)})):"string"==typeof i?s({text:i,value:i}):i instanceof Error?this.renderError(i.message):s(i))},t.appendChild(i),n.addable={main:i,svg:e,path:s}}return n}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];l.classList.add(this.classes.highlighted),this.ensureElementInView(this.content.list,l);const a=l.parentElement;if(a&&a.classList.contains(this.classes.close)){const t=a.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),this.callbacks.addable?t.innerHTML=this.settings.addableText.replace("{value}",this.content.search.input.value):t.innerHTML=this.settings.searchText,void this.content.list.appendChild(t)}if(this.settings.allowDeselect&&!this.settings.isMultiple){this.store.filter((t=>t.placeholder),!1).length||this.store.addOption(new l({text:"",value:"",selected:!1,placeholder:!0}),!0)}const e=document.createDocumentFragment();for(const s of t){if(s instanceof n){const t=document.createElement("div");t.classList.add(this.classes.optgroup);const i=document.createElement("div");i.classList.add(this.classes.optgroupLabel),t.appendChild(i);const n=document.createElement("div");n.classList.add(this.classes.optgroupLabelText),n.textContent=s.label,i.appendChild(n);const l=document.createElement("div");if(l.classList.add(this.classes.optgroupActions),i.appendChild(l),this.settings.isMultiple&&s.selectAll){const t=document.createElement("div");t.classList.add(this.classes.optgroupSelectAll);let e=!0;for(const t of s.options)if(!t.selected){e=!1;break}e&&t.classList.add(this.classes.selected);const i=document.createElement("span");i.textContent=s.selectAllText,t.appendChild(i);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),t.appendChild(n);const a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("d",this.classes.optgroupSelectAllBox),n.appendChild(a);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.optgroupSelectAllCheck),n.appendChild(o),t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const i=this.store.getSelected();if(e){const t=i.filter((t=>{for(const e of s.options)if(t===e.id)return!1;return!0}));this.callbacks.setSelected(t,!0)}else{const t=i.concat(s.options.map((t=>t.id)));for(const t of s.options)this.store.getOptionByID(t.id)||this.callbacks.addOption(t);this.callbacks.setSelected(t,!0)}})),l.appendChild(t)}if("off"!==s.closable){const e=document.createElement("div");e.classList.add(this.classes.optgroupClosable);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.classList.add(this.classes.arrow),e.appendChild(n);const a=document.createElementNS("http://www.w3.org/2000/svg","path");n.appendChild(a),s.options.some((t=>t.selected))||""!==this.content.search.input.value.trim()?(e.classList.add(this.classes.open),a.setAttribute("d",this.classes.arrowOpen)):"open"===s.closable?(t.classList.add(this.classes.open),a.setAttribute("d",this.classes.arrowOpen)):"close"===s.closable&&(t.classList.add(this.classes.close),a.setAttribute("d",this.classes.arrowClose)),i.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),a.setAttribute("d",this.classes.arrowOpen)):(t.classList.remove(this.classes.open),t.classList.add(this.classes.close),a.setAttribute("d",this.classes.arrowClose))})),l.appendChild(e)}t.appendChild(i);for(const i of s.options)t.appendChild(this.option(i)),e.appendChild(t)}s instanceof l&&e.appendChild(this.option(s))}this.content.list.appendChild(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.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 l=!1;const a=this.store.getSelectedOptions();let o=[];if(this.settings.isMultiple)if(t.selected)o=a.filter((t=>t.id!==n));else if(o=a.concat(t),!this.settings.closeOnSelect)if(e.shiftKey&&this.lastSelectedOption){const e=this.store.getDataOptions();let s=e.findIndex((t=>t.id===this.lastSelectedOption.id)),i=e.findIndex((e=>e.id===t.id));if(s>=0&&i>=0){const t=Math.min(s,i),n=Math.max(s,i),l=e.slice(t,n+1);l.length>0&&l.length!a.find((e=>e.id===t.id))))))}}else t.selected||(this.lastSelectedOption=t);this.settings.isMultiple||(o=t.selected?[]:[t]),this.callbacks.beforeChange||(l=!0),this.callbacks.beforeChange&&(l=!1!==this.callbacks.beforeChange(o,a)),l&&(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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=s.left+("fixed"===this.settings.contentPosition?0: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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=t.left+("fixed"===this.settings.contentPosition?0: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,l=n+e.clientHeight;ni&&(t.scrollTop+=l-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,l=this.classes.hide;!i||s&&!e?n.classList.add(l):n.classList.remove(l)}}class c{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){if(n.target===this.select&&("disabled"===n.attributeName&&(s=!0),"class"===n.attributeName&&(e=!0),"childList"===n.type)){for(const t of n.addedNodes)if("OPTION"===t.nodeName&&t.value===this.select.value){this.select.dispatchEvent(new Event("change"));break}i=!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:"",defaultSelected:t.defaultSelected,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)}setSelectedByValue(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.value)}}if("OPTION"===s.nodeName){const e=s;e.selected=t.includes(e.value)}}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 n&&this.select.appendChild(this.createOptgroup(e)),e instanceof l&&this.select.appendChild(this.createOption(e));this.select.dispatchEvent(new Event("change",{bubbles:!0})),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.textContent=t.text,""!==t.html&&e.setAttribute("data-html",t.html),e.defaultSelected=t.defaultSelected,e.selected=t.selected,t.disabled&&(e.disabled=!0),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 h{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.focusSearch=void 0===t.focusSearch||t.focusSearch,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.contentAriaLabel=void 0!==t.contentAriaLabel?t.contentAriaLabel:"Select an option",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",this.addableText=t.addableText||'Press "Enter" to add {value}'}}return class{constructor(e){var i;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=s((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.windowScroll=s((()=>{(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 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 h(e.settings),this.cssClasses=new t(e.cssClasses);const n=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const t in e.events)e.events.hasOwnProperty(t)&&(-1!==n.indexOf(t)?this.events[t]=s(e.events[t],100):this.events[t]=e.events[t]);this.settings.disabled=(null===(i=e.settings)||void 0===i?void 0:i.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 c(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",e.data?e.data:this.select.getData()),e.data&&this.select.updateOptions(this.store.getData());const l={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 o(this.settings,this.cssClasses,this.store,l),this.render.renderValues(),this.render.renderOptions(this.store.getData());const r=this.selectEl.getAttribute("aria-label"),d=this.selectEl.getAttribute("aria-labelledby");r?this.render.main.main.setAttribute("aria-label",r):d&&this.render.main.main.setAttribute("aria-labelledby",d),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(),s=this.store.validateDataArray(t);if(s)return void(this.events.error&&this.events.error(s));this.store.setData(t);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!i(e,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let t=this.store.getSelectedOptions();return this.settings.keepOrder&&(t=this.store.selectedOrderOptions(t)),t.map((t=>t.value))}setSelected(t,e=!0){const s=this.store.getSelected(),n=this.store.getDataOptions();t=Array.isArray(t)?t:[t];const l=[];for(const e of t)if(n.find((t=>t.id==e)))l.push(e);else for(const t of n.filter((t=>t.value==e)))l.push(t.id);this.store.setSelectedBy("id",l);const a=this.store.getData();this.select.updateOptions(a),this.render.renderValues(),""!==this.render.content.search.input.value?this.search(this.render.content.search.input.value):this.render.renderOptions(a),e&&this.events.afterChange&&!i(s,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 s=this.store.getData();this.select.updateOptions(s),this.render.renderValues(),this.render.renderOptions(s),this.events.afterChange&&!i(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.settings.focusSearch&&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";class t{constructor(t){t||(t={}),this.main=t.main||"ss-main",this.placeholder=t.placeholder||"ss-placeholder",this.values=t.values||"ss-values",this.single=t.single||"ss-single",this.max=t.max||"ss-max",this.value=t.value||"ss-value",this.valueText=t.valueText||"ss-value-text",this.valueDelete=t.valueDelete||"ss-value-delete",this.valueOut=t.valueOut||"ss-value-out",this.deselect=t.deselect||"ss-deselect",this.deselectPath=t.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=t.arrow||"ss-arrow",this.arrowClose=t.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=t.arrowOpen||"M10,70 L50,30 L90,70",this.content=t.content||"ss-content",this.openAbove=t.openAbove||"ss-open-above",this.openBelow=t.openBelow||"ss-open-below",this.search=t.search||"ss-search",this.searchHighlighter=t.searchHighlighter||"ss-search-highlight",this.searching=t.searching||"ss-searching",this.addable=t.addable||"ss-addable",this.addablePath=t.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=t.list||"ss-list",this.optgroup=t.optgroup||"ss-optgroup",this.optgroupLabel=t.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=t.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=t.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=t.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=t.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=t.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=t.optgroupClosable||"ss-closable",this.option=t.option||"ss-option",this.optionDelete=t.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=t.highlighted||"ss-highlighted",this.open=t.open||"ss-open",this.close=t.close||"ss-close",this.selected=t.selected||"ss-selected",this.error=t.error||"ss-error",this.disabled=t.disabled||"ss-disabled",this.hide=t.hide||"ss-hide"}}function e(){return Math.random().toString(36).substring(2,10)}function s(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 i(t,e){return JSON.stringify(t)===JSON.stringify(e)}class n{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 a(e))}}class a{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.defaultSelected=void 0!==t.defaultSelected&&t.defaultSelected,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 l{constructor(t,e){this.selectType="single",this.data=[],this.selectedOrder=[],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 n||"label"in e){if(!("label"in e))return new Error("Optgroup must have a label");if("options"in e&&e.options)for(let t of e.options){const e=this.validateOption(t);if(e)return e}}else{if(!(e instanceof a||"text"in e))return new Error("Data object must be a valid optgroup or option");{const t=this.validateOption(e);if(t)return 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 n||"label"in t){let s=[];"options"in t&&t.options&&t.options.forEach((t=>{s.push(new a(t))})),s.length>0&&e.push(new n(t))}(t instanceof a||"text"in t)&&e.push(new a(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,e=!1){if(e){let e=[new a(t)];this.setData(e.concat(this.getData()))}else this.setData(this.getData().concat(new a(t)))}setSelectedBy(t,e){let s=null,i=!1;const l=[];for(let o of this.data){if(o instanceof n)for(let n of o.options)s||(s=n),n.selected=!i&&e.includes(n[t]),n.selected&&(l.push(n),"single"===this.selectType&&(i=!0));o instanceof a&&(s||(s=o),o.selected=!i&&e.includes(o[t]),o.selected&&(l.push(o),"single"===this.selectType&&(i=!0)))}"single"===this.selectType&&s&&!i&&(s.selected=!0,l.push(s));const o=e.map((e=>{var s;return(null===(s=l.find((s=>s[t]===e)))||void 0===s?void 0:s.id)||""}));this.selectedOrder=o}getSelected(){return this.getSelectedOptions().map((t=>t.id))}getSelectedValues(){return this.getSelectedOptions().map((t=>t.value))}getSelectedOptions(){return this.filter((t=>t.selected),!1)}getOptgroupByID(t){for(let e of this.data)if(e instanceof n&&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 n?t=e.options[0]:e instanceof a&&(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((i=>{if(i instanceof n){let l=[];if(i.options.forEach((i=>{t&&!t(i)||(e?l.push(new a(i)):s.push(new a(i)))})),l.length>0){let t=new n(i);t.options=l,s.push(t)}}i instanceof a&&(t&&!t(i)||s.push(new a(i)))})),s}selectedOrderOptions(t){const e=[];return this.selectedOrder.forEach((s=>{const i=t.find((t=>t.id===s));i&&e.push(i)})),t.forEach((t=>{let s=!1;e.forEach((e=>{t.id!==e.id||(s=!0)})),s||e.push(t)})),e}}class o{static getLiveAssertive(){let t=document.getElementById("ss-live-assertive");return t||(t=document.createElement("div"),t.id="ss-live-assertive",t.setAttribute("role","status"),t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true"),t.className="sr-only",document.body.appendChild(t)),t}_announceAssertive(t){const e=o._liveAssertive||(o._liveAssertive=o.getLiveAssertive());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}constructor(t,e,s,i){var n;this.store=s,this.settings=t,this.classes=e,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes();const a=null===(n=document.querySelector(`[data-id="${this.settings.id}"]`))||void 0===n?void 0:n.closest(".offcanvas-body");a?a.appendChild(this.content.main):this.settings.contentLocation&&this.settings.contentLocation.appendChild(this.content.main)}static getLivePolite(){let t=document.getElementById("ss-live-polite");return t||(t=document.createElement("div"),t.id="ss-live-polite",t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.className="sr-only",document.body.appendChild(t)),t}_announcePolite(t){const e=o._livePolite||(o._livePolite=o.getLivePolite());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}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)}"fixed"===this.settings.contentPosition&&(this.moveContent(),this.scrollHandler=()=>this.moveContent(),this.resizeHandler=()=>this.moveContent(),window.addEventListener("scroll",this.scrollHandler,!0),window.addEventListener("resize",this.resizeHandler)),this.searchFocus()}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),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=void 0),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=void 0),this.main.main.focus({preventScroll:!0}),this.main.main.removeAttribute("aria-activedescendant")}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.main.main.classList.add("ss-2"),this.content.main.classList.add(this.classes.content),this.content.main.classList.add("ss-content-2"),""!==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&&"fixed"!==this.settings.contentPosition||this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){this.content.list.setAttribute("role","listbox"),this.content.list.setAttribute("id",this.content.main.id+"-list"),this.content.list.setAttribute("aria-label",this.settings.contentAriaLabel),this.settings.isMultiple?this.content.list.setAttribute("aria-multiselectable","true"):this.content.list.removeAttribute("aria-multiselectable"),this.main.main.setAttribute("role","combobox"),this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.list.id),this.main.main.setAttribute("aria-expanded","false"),this.main.main.setAttribute("aria-autocomplete","list"),this.settings.ariaLabelledBy&&this.settings.ariaLabelledBy.trim()?(this.main.main.setAttribute("aria-labelledby",this.settings.ariaLabelledBy),this.main.main.removeAttribute("aria-label")):this.settings.ariaLabel&&this.settings.ariaLabel.trim()&&this.main.main.setAttribute("aria-label",this.settings.ariaLabel),this.main.main.setAttribute("aria-owns",this.content.list.id),this.content.search.input.setAttribute("aria-controls",this.content.list.id),this.content.search.input.setAttribute("aria-autocomplete","list")}mainDiv(){var t;const e=document.createElement("div");e.id=this.settings.id+"-main",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===t.key.length&&this.callbacks.open(),!0},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),i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("aria-label",this.settings.clearAllAriaLabel),i.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i.click())}));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"),a.setAttribute("aria-hidden","true"),a.setAttribute("focusable","false");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"),o.setAttribute("aria-hidden","true"),o.setAttribute("focusable","false");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()}this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e));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 i=this.store.getSelectedOptions(),l=i.filter((e=>e.selected&&e.id!==t.id),!0);if(!(this.settings.minSelected&&l.length{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),s.click())}}return e}contentDiv(){const t=document.createElement("div");t.id=this.settings.id+"-content";const e=this.searchDiv();t.appendChild(e.main);const s=this.listDiv();return t.appendChild(s),{main:t,search:e,list:s}}moveContent(){"relative"!==this.settings.contentPosition&&"down"!==this.settings.openPosition?"up"!==this.settings.openPosition?"up"===this.putContent()?this.moveContentAbove():this.moveContentBelow():this.moveContentAbove():this.moveContentBelow()}searchDiv(){const t=document.createElement("div"),e=document.createElement("input"),i=document.createElement("div");t.classList.add(this.classes.search);const n={main:t,input:e};if(this.settings.showSearch||(t.classList.add(this.classes.hide),e.readOnly=!0),e.type="search",e.placeholder=this.settings.searchPlaceholder,e.tabIndex=-1,this.settings.searchLabelledBy&&this.settings.searchLabelledBy.trim()?e.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel&&this.settings.searchAriaLabel.trim()?e.setAttribute("aria-label",this.settings.searchAriaLabel):e.setAttribute("aria-label","Search options"),e.setAttribute("autocapitalize","off"),e.setAttribute("autocomplete","off"),e.setAttribute("autocorrect","off"),e.oninput=s((t=>{this.callbacks.search(t.target.value)}),100),e.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" ":const e=this.content.list.querySelector("."+this.classes.highlighted);return!e||(e.click(),!1);case"Enter":if(this.callbacks.addable)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(e),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"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false");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 a(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=>{"string"==typeof t?s({text:t,value:t}):i instanceof Error?this.renderError(i.message):s(t)})):"string"==typeof i?s({text:i,value:i}):i instanceof Error?this.renderError(i.message):s(i))},t.appendChild(i),n.addable={main:i,svg:e,path:s}}return n}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.main.main.setAttribute("aria-activedescendant",a.id),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}const i=e["down"===t?0:e.length-1];i.classList.add(this.classes.highlighted),this.main.main.setAttribute("aria-activedescendant",i.id),this.ensureElementInView(this.content.list,i)}listDiv(){const t=document.createElement("div");return t.classList.add(this.classes.list),t}renderError(t){this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy");const e=document.createElement("div");e.classList.add(this.classes.error),e.textContent=t,this.content.list.appendChild(e),this._announceAssertive(t)}renderSearching(){this.content.list.innerHTML="",this.content.list.setAttribute("aria-busy","true");const t=document.createElement("div");t.classList.add(this.classes.searching),t.textContent=this.settings.searchingText,this.content.list.appendChild(t),this._announcePolite(this.settings.searchingText)}renderOptions(t){if(this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy"),0===t.length){const t=document.createElement("div");t.classList.add(this.classes.search);const e=this.callbacks.addable?this.settings.addableText.replace("{value}",this.content.search.input.value):this.settings.searchText;return this._announcePolite(e),t.innerHTML=e,this.content.list.appendChild(t),void this.content.list.setAttribute("aria-setsize","0")}if(this.settings.allowDeselect&&!this.settings.isMultiple){this.store.filter((t=>t.placeholder),!1).length||this.store.addOption(new a({text:"",value:"",selected:!1,placeholder:!0}),!0)}const e=document.createDocumentFragment();let s=0;const i=t=>{t.classList.contains(this.classes.placeholder)||t.classList.contains(this.classes.disabled)||t.classList.contains(this.classes.hide)||t.setAttribute("aria-posinset",String(++s))};for(const s of t){if(s instanceof n){const t=document.createElement("div");t.classList.add(this.classes.optgroup),t.setAttribute("role","group"),t.setAttribute("aria-label",s.label);const n=document.createElement("div");n.classList.add(this.classes.optgroupLabel),t.appendChild(n);const a=document.createElement("div");a.classList.add(this.classes.optgroupLabelText),a.textContent=s.label,n.appendChild(a);const l=document.createElement("div");if(l.classList.add(this.classes.optgroupActions),n.appendChild(l),this.settings.isMultiple&&s.selectAll){const t=document.createElement("div");t.classList.add(this.classes.optgroupSelectAll);let e=!0;for(const t of s.options)if(!t.selected){e=!1;break}e&&t.classList.add(this.classes.selected);const i=document.createElement("span");i.textContent=s.selectAllText,t.appendChild(i);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),t.appendChild(n);const a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("d",this.classes.optgroupSelectAllBox),n.appendChild(a);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.optgroupSelectAllCheck),n.appendChild(o),t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const i=this.store.getSelected();if(e){const t=i.filter((t=>{for(const e of s.options)if(t===e.id)return!1;return!0}));this.callbacks.setSelected(t,!0)}else{const t=i.concat(s.options.map((t=>t.id)));for(const t of s.options)this.store.getOptionByID(t.id)||this.callbacks.addOption(t);this.callbacks.setSelected(t,!0)}})),l.appendChild(t)}if("off"!==s.closable){const e=document.createElement("div");e.classList.add(this.classes.optgroupClosable);const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("viewBox","0 0 100 100"),i.classList.add(this.classes.arrow),i.setAttribute("aria-hidden","true"),i.setAttribute("focusable","false"),e.appendChild(i);const a=document.createElementNS("http://www.w3.org/2000/svg","path");i.appendChild(a),s.options.some((t=>t.selected))||""!==this.content.search.input.value.trim()||"open"===s.closable?(t.classList.add(this.classes.open),a.setAttribute("d",this.classes.arrowOpen)):"close"===s.closable&&(t.classList.add(this.classes.close),a.setAttribute("d",this.classes.arrowClose)),n.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),a.setAttribute("d",this.classes.arrowOpen)):(t.classList.remove(this.classes.open),t.classList.add(this.classes.close),a.setAttribute("d",this.classes.arrowClose))})),l.appendChild(e)}t.appendChild(n);for(const e of s.options){const s=this.option(e);i(s),t.appendChild(s)}e.appendChild(t)}if(s instanceof a){const t=this.option(s);i(t),e.appendChild(t)}}this.content.list.appendChild(e),this.content.list.removeAttribute("aria-busy");const l=this.getOptions(!0,!0,!0).length;this.content.list.setAttribute("aria-setsize",String(l)),this._announcePolite(`${l} option${1===l?"":"s"} available`)}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=`${this.settings.id}__opt__${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),e.setAttribute("aria-disabled","true")),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=[];if(this.settings.isMultiple)if(t.selected)o=l.filter((t=>t.id!==n));else if(o=l.concat(t),!this.settings.closeOnSelect)if(e.shiftKey&&this.lastSelectedOption){const e=this.store.getDataOptions();let s=e.findIndex((t=>t.id===this.lastSelectedOption.id)),i=e.findIndex((e=>e.id===t.id));if(s>=0&&i>=0){const t=Math.min(s,i),n=Math.max(s,i),a=e.slice(t,n+1);a.length>0&&a.length!l.find((e=>e.id===t.id))))))}}else t.selected||(this.lastSelectedOption=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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=s.left+("fixed"===this.settings.contentPosition?0: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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=t.left+("fixed"===this.settings.contentPosition?0: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)}}o._livePolite=null,o._liveAssertive=null;class c{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){if(n.target===this.select&&("disabled"===n.attributeName&&(s=!0),"class"===n.attributeName&&(e=!0),"childList"===n.type)){for(const t of n.addedNodes)if("OPTION"===t.nodeName&&t.value===this.select.value){this.select.dispatchEvent(new Event("change"));break}i=!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:"",defaultSelected:t.defaultSelected,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)}setSelectedByValue(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.value)}}if("OPTION"===s.nodeName){const e=s;e.selected=t.includes(e.value)}}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 n&&this.select.appendChild(this.createOptgroup(e)),e instanceof a&&this.select.appendChild(this.createOption(e));this.select.dispatchEvent(new Event("change",{bubbles:!0})),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.textContent=t.text,""!==t.html&&e.setAttribute("data-html",t.html),e.defaultSelected=t.defaultSelected,e.selected=t.selected,t.disabled&&(e.disabled=!0),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 r{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.focusSearch=void 0===t.focusSearch||t.focusSearch,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.contentAriaLabel=void 0!==t.contentAriaLabel?t.contentAriaLabel:"Select an option",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",this.addableText=t.addableText||'Press "Enter" to add {value}',this.ariaLabelledBy=t.ariaLabelledBy||"",this.searchAriaLabel=t.searchAriaLabel||"Search options",this.searchLabelledBy=t.searchLabelledBy||"",this.clearAllAriaLabel=t.clearAllAriaLabel||"Clear selection"}}return class{constructor(e){var i;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=s((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.windowScroll=s((()=>{(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 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 r(e.settings),this.cssClasses=new t(e.cssClasses);const n=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const t in e.events)e.events.hasOwnProperty(t)&&(-1!==n.indexOf(t)?this.events[t]=s(e.events[t],100):this.events[t]=e.events[t]);this.settings.disabled=(null===(i=e.settings)||void 0===i?void 0:i.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 c(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 l(this.settings.isMultiple?"multiple":"single",e.data?e.data:this.select.getData()),e.data&&this.select.updateOptions(this.store.getData());const a={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 o(this.settings,this.cssClasses,this.store,a),this.render.renderValues(),this.render.renderOptions(this.store.getData());const h=this.selectEl.getAttribute("aria-label"),d=this.selectEl.getAttribute("aria-labelledby");h?this.render.main.main.setAttribute("aria-label",h):d&&this.render.main.main.setAttribute("aria-labelledby",d),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(),s=this.store.validateDataArray(t);if(s)return void(this.events.error&&this.events.error(s));this.store.setData(t);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!i(e,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let t=this.store.getSelectedOptions();return this.settings.keepOrder&&(t=this.store.selectedOrderOptions(t)),t.map((t=>t.value))}setSelected(t,e=!0){const s=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&&!i(s,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 s=this.store.getData();this.select.updateOptions(s),this.render.renderValues(),this.render.renderOptions(s),this.events.afterChange&&!i(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.settings.focusSearch&&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 c3a9da82..7275e921 100644 --- a/dist/slimselect.umd.js +++ b/dist/slimselect.umd.js @@ -369,6 +369,24 @@ } class Render { + static getLiveAssertive() { + let el = document.getElementById('ss-live-assertive'); + if (!el) { + el = document.createElement('div'); + el.id = 'ss-live-assertive'; + el.setAttribute('role', 'status'); + el.setAttribute('aria-live', 'assertive'); + el.setAttribute('aria-atomic', 'true'); + el.className = 'sr-only'; + document.body.appendChild(el); + } + return el; + } + _announceAssertive(msg) { + const el = (Render._liveAssertive || (Render._liveAssertive = Render.getLiveAssertive())); + el.textContent = ''; + requestAnimationFrame(() => { el.textContent = msg; }); + } constructor(settings, classes, store, callbacks) { var _a; this.store = store; @@ -389,6 +407,24 @@ this.settings.contentLocation.appendChild(this.content.main); } } + static getLivePolite() { + let el = document.getElementById('ss-live-polite'); + if (!el) { + el = document.createElement('div'); + el.id = 'ss-live-polite'; + el.setAttribute('role', 'status'); + el.setAttribute('aria-live', 'polite'); + el.setAttribute('aria-atomic', 'true'); + el.className = 'sr-only'; + document.body.appendChild(el); + } + return el; + } + _announcePolite(msg) { + const el = (Render._livePolite || (Render._livePolite = Render.getLivePolite())); + el.textContent = ''; + requestAnimationFrame(() => { el.textContent = msg; }); + } enable() { this.main.main.classList.remove(this.classes.disabled); this.content.search.input.disabled = false; @@ -417,6 +453,7 @@ window.addEventListener('scroll', this.scrollHandler, true); window.addEventListener('resize', this.resizeHandler); } + this.searchFocus(); } close() { this.main.main.classList.remove(this.classes.openAbove); @@ -433,6 +470,8 @@ window.removeEventListener('resize', this.resizeHandler); this.resizeHandler = undefined; } + this.main.main.focus({ preventScroll: true }); + this.main.main.removeAttribute('aria-activedescendant'); } updateClassStyles() { this.main.main.className = ''; @@ -460,18 +499,35 @@ } } 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.list.setAttribute('role', 'listbox'); + this.content.list.setAttribute('id', this.content.main.id + '-list'); this.content.list.setAttribute('aria-label', this.settings.contentAriaLabel); + if (this.settings.isMultiple) { + this.content.list.setAttribute('aria-multiselectable', 'true'); + } + else { + this.content.list.removeAttribute('aria-multiselectable'); + } + this.main.main.setAttribute('role', 'combobox'); + this.main.main.setAttribute('aria-haspopup', 'listbox'); + this.main.main.setAttribute('aria-controls', this.content.list.id); + this.main.main.setAttribute('aria-expanded', 'false'); + this.main.main.setAttribute('aria-autocomplete', 'list'); + if (this.settings.ariaLabelledBy && this.settings.ariaLabelledBy.trim()) { + this.main.main.setAttribute('aria-labelledby', this.settings.ariaLabelledBy); + this.main.main.removeAttribute('aria-label'); + } + else if (this.settings.ariaLabel && this.settings.ariaLabel.trim()) { + this.main.main.setAttribute('aria-label', this.settings.ariaLabel); + } + this.main.main.setAttribute('aria-owns', this.content.list.id); + this.content.search.input.setAttribute('aria-controls', this.content.list.id); + this.content.search.input.setAttribute('aria-autocomplete', 'list'); } mainDiv() { var _a; const main = document.createElement('div'); main.id = this.settings.id + '-main'; - main.setAttribute('aria-label', this.settings.ariaLabel); main.tabIndex = 0; main.onkeydown = (e) => { switch (e.key) { @@ -511,6 +567,15 @@ main.appendChild(values); const deselect = document.createElement('div'); deselect.classList.add(this.classes.deselect); + deselect.setAttribute('role', 'button'); + deselect.setAttribute('tabindex', '0'); + deselect.setAttribute('aria-label', this.settings.clearAllAriaLabel); + deselect.addEventListener('keydown', (e) => { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault(); + deselect.click(); + } + }); const selectedOptions = (_a = this.store) === null || _a === void 0 ? void 0 : _a.getSelectedOptions(); if (!this.settings.allowDeselect || (this.settings.isMultiple && selectedOptions && selectedOptions.length <= 0)) { deselect.classList.add(this.classes.hide); @@ -549,6 +614,8 @@ }; const deselectSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); deselectSvg.setAttribute('viewBox', '0 0 100 100'); + deselectSvg.setAttribute('aria-hidden', 'true'); + deselectSvg.setAttribute('focusable', 'false'); const deselectPath = document.createElementNS('http://www.w3.org/2000/svg', 'path'); deselectPath.setAttribute('d', this.classes.deselectPath); deselectSvg.appendChild(deselectPath); @@ -557,6 +624,8 @@ const arrow = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); arrow.classList.add(this.classes.arrow); arrow.setAttribute('viewBox', '0 0 100 100'); + arrow.setAttribute('aria-hidden', 'true'); + arrow.setAttribute('focusable', 'false'); const arrowPath = document.createElementNS('http://www.w3.org/2000/svg', 'path'); arrowPath.setAttribute('d', this.classes.arrowClose); if (this.settings.alwaysOpen) { @@ -722,6 +791,9 @@ if (!option.mandatory) { const deleteDiv = document.createElement('div'); deleteDiv.classList.add(this.classes.valueDelete); + deleteDiv.setAttribute('role', 'button'); + deleteDiv.setAttribute('aria-label', 'Remove selection'); + deleteDiv.setAttribute('title', 'Remove selection'); deleteDiv.setAttribute('tabindex', '0'); deleteDiv.onclick = (e) => { e.preventDefault(); @@ -764,13 +836,16 @@ }; const deleteSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); deleteSvg.setAttribute('viewBox', '0 0 100 100'); + deleteSvg.setAttribute('aria-hidden', 'true'); + deleteSvg.setAttribute('focusable', 'false'); const deletePath = document.createElementNS('http://www.w3.org/2000/svg', 'path'); deletePath.setAttribute('d', this.classes.optionDelete); deleteSvg.appendChild(deletePath); deleteDiv.appendChild(deleteSvg); value.appendChild(deleteDiv); deleteDiv.onkeydown = (e) => { - if (e.key === 'Enter') { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault(); deleteDiv.click(); } }; @@ -826,7 +901,15 @@ input.type = 'search'; input.placeholder = this.settings.searchPlaceholder; input.tabIndex = -1; - input.setAttribute('aria-label', this.settings.searchPlaceholder); + if (this.settings.searchLabelledBy && this.settings.searchLabelledBy.trim()) { + input.setAttribute('aria-labelledby', this.settings.searchLabelledBy); + } + else if (this.settings.searchAriaLabel && this.settings.searchAriaLabel.trim()) { + input.setAttribute('aria-label', this.settings.searchAriaLabel); + } + else { + input.setAttribute('aria-label', 'Search options'); + } input.setAttribute('autocapitalize', 'off'); input.setAttribute('autocomplete', 'off'); input.setAttribute('autocorrect', 'off'); @@ -873,6 +956,8 @@ addable.classList.add(this.classes.addable); const plus = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); plus.setAttribute('viewBox', '0 0 100 100'); + plus.setAttribute('aria-hidden', 'true'); + plus.setAttribute('focusable', 'false'); const plusPath = document.createElementNS('http://www.w3.org/2000/svg', 'path'); plusPath.setAttribute('d', this.classes.addablePath); plus.appendChild(plusPath); @@ -1003,6 +1088,7 @@ } let selectOption = options[dir === 'down' ? (i + 1 < options.length ? i + 1 : 0) : i - 1 >= 0 ? i - 1 : options.length - 1]; selectOption.classList.add(this.classes.highlighted); + this.main.main.setAttribute('aria-activedescendant', selectOption.id); this.ensureElementInView(this.content.list, selectOption); const selectParent = selectOption.parentElement; if (selectParent && selectParent.classList.contains(this.classes.close)) { @@ -1014,8 +1100,10 @@ return; } } - options[dir === 'down' ? 0 : options.length - 1].classList.add(this.classes.highlighted); - this.ensureElementInView(this.content.list, options[dir === 'down' ? 0 : options.length - 1]); + const newly = options[dir === 'down' ? 0 : options.length - 1]; + newly.classList.add(this.classes.highlighted); + this.main.main.setAttribute('aria-activedescendant', newly.id); + this.ensureElementInView(this.content.list, newly); } listDiv() { const options = document.createElement('div'); @@ -1024,30 +1112,35 @@ } renderError(error) { this.content.list.innerHTML = ''; + this.content.list.removeAttribute('aria-busy'); const errorDiv = document.createElement('div'); errorDiv.classList.add(this.classes.error); errorDiv.textContent = error; this.content.list.appendChild(errorDiv); + this._announceAssertive(error); } renderSearching() { this.content.list.innerHTML = ''; + this.content.list.setAttribute('aria-busy', 'true'); const searchingDiv = document.createElement('div'); searchingDiv.classList.add(this.classes.searching); searchingDiv.textContent = this.settings.searchingText; this.content.list.appendChild(searchingDiv); + this._announcePolite(this.settings.searchingText); } renderOptions(data) { this.content.list.innerHTML = ''; + this.content.list.removeAttribute('aria-busy'); if (data.length === 0) { const noResults = document.createElement('div'); noResults.classList.add(this.classes.search); - if (this.callbacks.addable) { - noResults.innerHTML = this.settings.addableText.replace('{value}', this.content.search.input.value); - } - else { - noResults.innerHTML = this.settings.searchText; - } + const msg = this.callbacks.addable + ? this.settings.addableText.replace('{value}', this.content.search.input.value) + : this.settings.searchText; + this._announcePolite(msg); + noResults.innerHTML = msg; this.content.list.appendChild(noResults); + this.content.list.setAttribute('aria-setsize', '0'); return; } if (this.settings.allowDeselect && !this.settings.isMultiple) { @@ -1062,10 +1155,20 @@ } } const fragment = document.createDocumentFragment(); + let count = 0; + const tagPos = (el) => { + if (!el.classList.contains(this.classes.placeholder) && + !el.classList.contains(this.classes.disabled) && + !el.classList.contains(this.classes.hide)) { + el.setAttribute('aria-posinset', String(++count)); + } + }; for (const d of data) { if (d instanceof Optgroup) { const optgroupEl = document.createElement('div'); optgroupEl.classList.add(this.classes.optgroup); + optgroupEl.setAttribute('role', 'group'); + optgroupEl.setAttribute('aria-label', d.label); const optgroupLabel = document.createElement('div'); optgroupLabel.classList.add(this.classes.optgroupLabel); optgroupEl.appendChild(optgroupLabel); @@ -1094,6 +1197,8 @@ selectAll.appendChild(selectAllText); const selectAllSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); selectAllSvg.setAttribute('viewBox', '0 0 100 100'); + selectAllSvg.setAttribute('aria-hidden', 'true'); + selectAllSvg.setAttribute('focusable', 'false'); selectAll.appendChild(selectAllSvg); const selectAllBox = document.createElementNS('http://www.w3.org/2000/svg', 'path'); selectAllBox.setAttribute('d', this.classes.optgroupSelectAllBox); @@ -1136,11 +1241,13 @@ const optgroupClosableSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); optgroupClosableSvg.setAttribute('viewBox', '0 0 100 100'); optgroupClosableSvg.classList.add(this.classes.arrow); + optgroupClosableSvg.setAttribute('aria-hidden', 'true'); + optgroupClosableSvg.setAttribute('focusable', 'false'); optgroupClosable.appendChild(optgroupClosableSvg); const optgroupClosableArrow = document.createElementNS('http://www.w3.org/2000/svg', 'path'); optgroupClosableSvg.appendChild(optgroupClosableArrow); if (d.options.some((o) => o.selected) || this.content.search.input.value.trim() !== '') { - optgroupClosable.classList.add(this.classes.open); + optgroupEl.classList.add(this.classes.open); optgroupClosableArrow.setAttribute('d', this.classes.arrowOpen); } else if (d.closable === 'open') { @@ -1169,15 +1276,23 @@ } optgroupEl.appendChild(optgroupLabel); for (const o of d.options) { - optgroupEl.appendChild(this.option(o)); - fragment.appendChild(optgroupEl); + const optEl = this.option(o); + tagPos(optEl); + optgroupEl.appendChild(optEl); } + fragment.appendChild(optgroupEl); } if (d instanceof Option) { - fragment.appendChild(this.option(d)); + const optEl = this.option(d); + tagPos(optEl); + fragment.appendChild(optEl); } } this.content.list.appendChild(fragment); + this.content.list.removeAttribute('aria-busy'); + const visibleCount = this.getOptions(true, true, true).length; + this.content.list.setAttribute('aria-setsize', String(visibleCount)); + this._announcePolite(`${visibleCount} option${visibleCount === 1 ? '' : 's'} available`); } option(option) { if (option.placeholder) { @@ -1187,7 +1302,8 @@ return placeholder; } const optionEl = document.createElement('div'); - optionEl.id = option.id; + optionEl.dataset.id = option.id; + optionEl.id = `${this.settings.id}__opt__${option.id}`; optionEl.classList.add(this.classes.option); optionEl.setAttribute('role', 'option'); if (option.class) { @@ -1215,6 +1331,7 @@ } if (option.disabled) { optionEl.classList.add(this.classes.disabled); + optionEl.setAttribute('aria-disabled', 'true'); } if (option.selected && this.settings.hideSelected) { optionEl.classList.add(this.classes.hide); @@ -1398,6 +1515,8 @@ } } } + Render._livePolite = null; + Render._liveAssertive = null; class Select { constructor(select) { @@ -1744,6 +1863,10 @@ this.maxValuesShown = settings.maxValuesShown || 20; this.maxValuesMessage = settings.maxValuesMessage || '{number} selected'; this.addableText = settings.addableText || 'Press "Enter" to add {value}'; + this.ariaLabelledBy = settings.ariaLabelledBy || ''; + this.searchAriaLabel = settings.searchAriaLabel || 'Search options'; + this.searchLabelledBy = settings.searchLabelledBy || ''; + this.clearAllAriaLabel = settings.clearAllAriaLabel || 'Clear selection'; } } diff --git a/dist/slimselect.umd.min.js b/dist/slimselect.umd.min.js index 27dffae2..2f4d0f93 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";class t{constructor(t){t||(t={}),this.main=t.main||"ss-main",this.placeholder=t.placeholder||"ss-placeholder",this.values=t.values||"ss-values",this.single=t.single||"ss-single",this.max=t.max||"ss-max",this.value=t.value||"ss-value",this.valueText=t.valueText||"ss-value-text",this.valueDelete=t.valueDelete||"ss-value-delete",this.valueOut=t.valueOut||"ss-value-out",this.deselect=t.deselect||"ss-deselect",this.deselectPath=t.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=t.arrow||"ss-arrow",this.arrowClose=t.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=t.arrowOpen||"M10,70 L50,30 L90,70",this.content=t.content||"ss-content",this.openAbove=t.openAbove||"ss-open-above",this.openBelow=t.openBelow||"ss-open-below",this.search=t.search||"ss-search",this.searchHighlighter=t.searchHighlighter||"ss-search-highlight",this.searching=t.searching||"ss-searching",this.addable=t.addable||"ss-addable",this.addablePath=t.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=t.list||"ss-list",this.optgroup=t.optgroup||"ss-optgroup",this.optgroupLabel=t.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=t.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=t.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=t.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=t.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=t.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=t.optgroupClosable||"ss-closable",this.option=t.option||"ss-option",this.optionDelete=t.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=t.highlighted||"ss-highlighted",this.open=t.open||"ss-open",this.close=t.close||"ss-close",this.selected=t.selected||"ss-selected",this.error=t.error||"ss-error",this.disabled=t.disabled||"ss-disabled",this.hide=t.hide||"ss-hide"}}function e(){return Math.random().toString(36).substring(2,10)}function s(t,e=50,s=!1){let i;return function(...n){const l=self,a=s&&!i;clearTimeout(i),i=setTimeout((()=>{i=null,s||t.apply(l,n)}),e),a&&t.apply(l,n)}}function i(t,e){return JSON.stringify(t)===JSON.stringify(e)}class n{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 l(e))}}class l{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.defaultSelected=void 0!==t.defaultSelected&&t.defaultSelected,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(t,e){this.selectType="single",this.data=[],this.selectedOrder=[],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 n||"label"in e){if(!("label"in e))return new Error("Optgroup must have a label");if("options"in e&&e.options)for(let t of e.options){const e=this.validateOption(t);if(e)return e}}else{if(!(e instanceof l||"text"in e))return new Error("Data object must be a valid optgroup or option");{const t=this.validateOption(e);if(t)return 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 n||"label"in t){let s=[];"options"in t&&t.options&&t.options.forEach((t=>{s.push(new l(t))})),s.length>0&&e.push(new n(t))}(t instanceof l||"text"in t)&&e.push(new l(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,e=!1){if(e){let e=[new l(t)];this.setData(e.concat(this.getData()))}else this.setData(this.getData().concat(new l(t)))}setSelectedBy(t,e){let s=null,i=!1;const a=[];for(let o of this.data){if(o instanceof n)for(let n of o.options)s||(s=n),n.selected=!i&&e.includes(n[t]),n.selected&&(a.push(n),"single"===this.selectType&&(i=!0));o instanceof l&&(s||(s=o),o.selected=!i&&e.includes(o[t]),o.selected&&(a.push(o),"single"===this.selectType&&(i=!0)))}"single"===this.selectType&&s&&!i&&(s.selected=!0,a.push(s));const o=e.map((e=>{var s;return(null===(s=a.find((s=>s[t]===e)))||void 0===s?void 0:s.id)||""}));this.selectedOrder=o}getSelected(){return this.getSelectedOptions().map((t=>t.id))}getSelectedValues(){return this.getSelectedOptions().map((t=>t.value))}getSelectedOptions(){return this.filter((t=>t.selected),!1)}getOptgroupByID(t){for(let e of this.data)if(e instanceof n&&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 n?t=e.options[0]:e instanceof l&&(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((i=>{if(i instanceof n){let a=[];if(i.options.forEach((i=>{t&&!t(i)||(e?a.push(new l(i)):s.push(new l(i)))})),a.length>0){let t=new n(i);t.options=a,s.push(t)}}i instanceof l&&(t&&!t(i)||s.push(new l(i)))})),s}selectedOrderOptions(t){const e=[];return this.selectedOrder.forEach((s=>{const i=t.find((t=>t.id===s));i&&e.push(i)})),t.forEach((t=>{let s=!1;e.forEach((e=>{t.id!==e.id||(s=!0)})),s||e.push(t)})),e}}class o{constructor(t,e,s,i){var n;this.store=s,this.settings=t,this.classes=e,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes();const l=null===(n=document.querySelector(`[data-id="${this.settings.id}"]`))||void 0===n?void 0:n.closest(".offcanvas-body");l?l.appendChild(this.content.main):this.settings.contentLocation&&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)}"fixed"===this.settings.contentPosition&&(this.moveContent(),this.scrollHandler=()=>this.moveContent(),this.resizeHandler=()=>this.moveContent(),window.addEventListener("scroll",this.scrollHandler,!0),window.addEventListener("resize",this.resizeHandler))}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),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=void 0),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=void 0)}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.main.main.classList.add("ss-2"),this.content.main.classList.add(this.classes.content),this.content.main.classList.add("ss-content-2"),""!==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&&"fixed"!==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.list.setAttribute("role","listbox"),this.content.list.setAttribute("aria-label",this.settings.contentAriaLabel)}mainDiv(){var t;const e=document.createElement("div");e.id=this.settings.id+"-main",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===t.key.length&&this.callbacks.open(),!0},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 l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.setAttribute("viewBox","0 0 100 100");const a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("d",this.classes.deselectPath),l.appendChild(a),i.appendChild(l),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:l,path:a},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()}this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e));let s=[];for(let i=0;it.id===l),!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 i=this.store.getSelectedOptions(),a=i.filter((e=>e.selected&&e.id!==t.id),!0);if(!(this.settings.minSelected&&a.length{"Enter"===t.key&&s.click()}}return e}contentDiv(){const t=document.createElement("div");t.id=this.settings.id+"-content";const e=this.searchDiv();t.appendChild(e.main);const s=this.listDiv();return t.appendChild(s),{main:t,search:e,list:s}}moveContent(){"relative"!==this.settings.contentPosition&&"down"!==this.settings.openPosition?"up"!==this.settings.openPosition?"up"===this.putContent()?this.moveContentAbove():this.moveContentBelow():this.moveContentAbove():this.moveContentBelow()}searchDiv(){const t=document.createElement("div"),e=document.createElement("input"),i=document.createElement("div");t.classList.add(this.classes.search);const n={main:t,input:e};if(this.settings.showSearch||(t.classList.add(this.classes.hide),e.readOnly=!0),e.type="search",e.placeholder=this.settings.searchPlaceholder,e.tabIndex=-1,e.setAttribute("aria-label",this.settings.searchPlaceholder),e.setAttribute("autocapitalize","off"),e.setAttribute("autocomplete","off"),e.setAttribute("autocorrect","off"),e.oninput=s((t=>{this.callbacks.search(t.target.value)}),100),e.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" ":const e=this.content.list.querySelector("."+this.classes.highlighted);return!e||(e.click(),!1);case"Enter":if(this.callbacks.addable)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(e),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 l(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=>{"string"==typeof t?s({text:t,value:t}):i instanceof Error?this.renderError(i.message):s(t)})):"string"==typeof i?s({text:i,value:i}):i instanceof Error?this.renderError(i.message):s(i))},t.appendChild(i),n.addable={main:i,svg:e,path:s}}return n}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];l.classList.add(this.classes.highlighted),this.ensureElementInView(this.content.list,l);const a=l.parentElement;if(a&&a.classList.contains(this.classes.close)){const t=a.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),this.callbacks.addable?t.innerHTML=this.settings.addableText.replace("{value}",this.content.search.input.value):t.innerHTML=this.settings.searchText,void this.content.list.appendChild(t)}if(this.settings.allowDeselect&&!this.settings.isMultiple){this.store.filter((t=>t.placeholder),!1).length||this.store.addOption(new l({text:"",value:"",selected:!1,placeholder:!0}),!0)}const e=document.createDocumentFragment();for(const s of t){if(s instanceof n){const t=document.createElement("div");t.classList.add(this.classes.optgroup);const i=document.createElement("div");i.classList.add(this.classes.optgroupLabel),t.appendChild(i);const n=document.createElement("div");n.classList.add(this.classes.optgroupLabelText),n.textContent=s.label,i.appendChild(n);const l=document.createElement("div");if(l.classList.add(this.classes.optgroupActions),i.appendChild(l),this.settings.isMultiple&&s.selectAll){const t=document.createElement("div");t.classList.add(this.classes.optgroupSelectAll);let e=!0;for(const t of s.options)if(!t.selected){e=!1;break}e&&t.classList.add(this.classes.selected);const i=document.createElement("span");i.textContent=s.selectAllText,t.appendChild(i);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),t.appendChild(n);const a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("d",this.classes.optgroupSelectAllBox),n.appendChild(a);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.optgroupSelectAllCheck),n.appendChild(o),t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const i=this.store.getSelected();if(e){const t=i.filter((t=>{for(const e of s.options)if(t===e.id)return!1;return!0}));this.callbacks.setSelected(t,!0)}else{const t=i.concat(s.options.map((t=>t.id)));for(const t of s.options)this.store.getOptionByID(t.id)||this.callbacks.addOption(t);this.callbacks.setSelected(t,!0)}})),l.appendChild(t)}if("off"!==s.closable){const e=document.createElement("div");e.classList.add(this.classes.optgroupClosable);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.classList.add(this.classes.arrow),e.appendChild(n);const a=document.createElementNS("http://www.w3.org/2000/svg","path");n.appendChild(a),s.options.some((t=>t.selected))||""!==this.content.search.input.value.trim()?(e.classList.add(this.classes.open),a.setAttribute("d",this.classes.arrowOpen)):"open"===s.closable?(t.classList.add(this.classes.open),a.setAttribute("d",this.classes.arrowOpen)):"close"===s.closable&&(t.classList.add(this.classes.close),a.setAttribute("d",this.classes.arrowClose)),i.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),a.setAttribute("d",this.classes.arrowOpen)):(t.classList.remove(this.classes.open),t.classList.add(this.classes.close),a.setAttribute("d",this.classes.arrowClose))})),l.appendChild(e)}t.appendChild(i);for(const i of s.options)t.appendChild(this.option(i)),e.appendChild(t)}s instanceof l&&e.appendChild(this.option(s))}this.content.list.appendChild(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.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 l=!1;const a=this.store.getSelectedOptions();let o=[];if(this.settings.isMultiple)if(t.selected)o=a.filter((t=>t.id!==n));else if(o=a.concat(t),!this.settings.closeOnSelect)if(e.shiftKey&&this.lastSelectedOption){const e=this.store.getDataOptions();let s=e.findIndex((t=>t.id===this.lastSelectedOption.id)),i=e.findIndex((e=>e.id===t.id));if(s>=0&&i>=0){const t=Math.min(s,i),n=Math.max(s,i),l=e.slice(t,n+1);l.length>0&&l.length!a.find((e=>e.id===t.id))))))}}else t.selected||(this.lastSelectedOption=t);this.settings.isMultiple||(o=t.selected?[]:[t]),this.callbacks.beforeChange||(l=!0),this.callbacks.beforeChange&&(l=!1!==this.callbacks.beforeChange(o,a)),l&&(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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=s.left+("fixed"===this.settings.contentPosition?0: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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=t.left+("fixed"===this.settings.contentPosition?0: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,l=n+e.clientHeight;ni&&(t.scrollTop+=l-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,l=this.classes.hide;!i||s&&!e?n.classList.add(l):n.classList.remove(l)}}class c{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){if(n.target===this.select&&("disabled"===n.attributeName&&(s=!0),"class"===n.attributeName&&(e=!0),"childList"===n.type)){for(const t of n.addedNodes)if("OPTION"===t.nodeName&&t.value===this.select.value){this.select.dispatchEvent(new Event("change"));break}i=!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:"",defaultSelected:t.defaultSelected,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)}setSelectedByValue(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.value)}}if("OPTION"===s.nodeName){const e=s;e.selected=t.includes(e.value)}}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 n&&this.select.appendChild(this.createOptgroup(e)),e instanceof l&&this.select.appendChild(this.createOption(e));this.select.dispatchEvent(new Event("change",{bubbles:!0})),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.textContent=t.text,""!==t.html&&e.setAttribute("data-html",t.html),e.defaultSelected=t.defaultSelected,e.selected=t.selected,t.disabled&&(e.disabled=!0),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 h{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.focusSearch=void 0===t.focusSearch||t.focusSearch,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.contentAriaLabel=void 0!==t.contentAriaLabel?t.contentAriaLabel:"Select an option",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",this.addableText=t.addableText||'Press "Enter" to add {value}'}}return class{constructor(e){var i;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=s((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.windowScroll=s((()=>{(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 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 h(e.settings),this.cssClasses=new t(e.cssClasses);const n=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const t in e.events)e.events.hasOwnProperty(t)&&(-1!==n.indexOf(t)?this.events[t]=s(e.events[t],100):this.events[t]=e.events[t]);this.settings.disabled=(null===(i=e.settings)||void 0===i?void 0:i.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 c(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",e.data?e.data:this.select.getData()),e.data&&this.select.updateOptions(this.store.getData());const l={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 o(this.settings,this.cssClasses,this.store,l),this.render.renderValues(),this.render.renderOptions(this.store.getData());const r=this.selectEl.getAttribute("aria-label"),d=this.selectEl.getAttribute("aria-labelledby");r?this.render.main.main.setAttribute("aria-label",r):d&&this.render.main.main.setAttribute("aria-labelledby",d),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(),s=this.store.validateDataArray(t);if(s)return void(this.events.error&&this.events.error(s));this.store.setData(t);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!i(e,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let t=this.store.getSelectedOptions();return this.settings.keepOrder&&(t=this.store.selectedOrderOptions(t)),t.map((t=>t.value))}setSelected(t,e=!0){const s=this.store.getSelected(),n=this.store.getDataOptions();t=Array.isArray(t)?t:[t];const l=[];for(const e of t)if(n.find((t=>t.id==e)))l.push(e);else for(const t of n.filter((t=>t.value==e)))l.push(t.id);this.store.setSelectedBy("id",l);const a=this.store.getData();this.select.updateOptions(a),this.render.renderValues(),""!==this.render.content.search.input.value?this.search(this.render.content.search.input.value):this.render.renderOptions(a),e&&this.events.afterChange&&!i(s,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 s=this.store.getData();this.select.updateOptions(s),this.render.renderValues(),this.render.renderOptions(s),this.events.afterChange&&!i(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.settings.focusSearch&&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";class t{constructor(t){t||(t={}),this.main=t.main||"ss-main",this.placeholder=t.placeholder||"ss-placeholder",this.values=t.values||"ss-values",this.single=t.single||"ss-single",this.max=t.max||"ss-max",this.value=t.value||"ss-value",this.valueText=t.valueText||"ss-value-text",this.valueDelete=t.valueDelete||"ss-value-delete",this.valueOut=t.valueOut||"ss-value-out",this.deselect=t.deselect||"ss-deselect",this.deselectPath=t.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=t.arrow||"ss-arrow",this.arrowClose=t.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=t.arrowOpen||"M10,70 L50,30 L90,70",this.content=t.content||"ss-content",this.openAbove=t.openAbove||"ss-open-above",this.openBelow=t.openBelow||"ss-open-below",this.search=t.search||"ss-search",this.searchHighlighter=t.searchHighlighter||"ss-search-highlight",this.searching=t.searching||"ss-searching",this.addable=t.addable||"ss-addable",this.addablePath=t.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=t.list||"ss-list",this.optgroup=t.optgroup||"ss-optgroup",this.optgroupLabel=t.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=t.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=t.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=t.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=t.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=t.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=t.optgroupClosable||"ss-closable",this.option=t.option||"ss-option",this.optionDelete=t.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=t.highlighted||"ss-highlighted",this.open=t.open||"ss-open",this.close=t.close||"ss-close",this.selected=t.selected||"ss-selected",this.error=t.error||"ss-error",this.disabled=t.disabled||"ss-disabled",this.hide=t.hide||"ss-hide"}}function e(){return Math.random().toString(36).substring(2,10)}function s(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 i(t,e){return JSON.stringify(t)===JSON.stringify(e)}class n{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 a(e))}}class a{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.defaultSelected=void 0!==t.defaultSelected&&t.defaultSelected,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 l{constructor(t,e){this.selectType="single",this.data=[],this.selectedOrder=[],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 n||"label"in e){if(!("label"in e))return new Error("Optgroup must have a label");if("options"in e&&e.options)for(let t of e.options){const e=this.validateOption(t);if(e)return e}}else{if(!(e instanceof a||"text"in e))return new Error("Data object must be a valid optgroup or option");{const t=this.validateOption(e);if(t)return 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 n||"label"in t){let s=[];"options"in t&&t.options&&t.options.forEach((t=>{s.push(new a(t))})),s.length>0&&e.push(new n(t))}(t instanceof a||"text"in t)&&e.push(new a(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,e=!1){if(e){let e=[new a(t)];this.setData(e.concat(this.getData()))}else this.setData(this.getData().concat(new a(t)))}setSelectedBy(t,e){let s=null,i=!1;const l=[];for(let o of this.data){if(o instanceof n)for(let n of o.options)s||(s=n),n.selected=!i&&e.includes(n[t]),n.selected&&(l.push(n),"single"===this.selectType&&(i=!0));o instanceof a&&(s||(s=o),o.selected=!i&&e.includes(o[t]),o.selected&&(l.push(o),"single"===this.selectType&&(i=!0)))}"single"===this.selectType&&s&&!i&&(s.selected=!0,l.push(s));const o=e.map((e=>{var s;return(null===(s=l.find((s=>s[t]===e)))||void 0===s?void 0:s.id)||""}));this.selectedOrder=o}getSelected(){return this.getSelectedOptions().map((t=>t.id))}getSelectedValues(){return this.getSelectedOptions().map((t=>t.value))}getSelectedOptions(){return this.filter((t=>t.selected),!1)}getOptgroupByID(t){for(let e of this.data)if(e instanceof n&&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 n?t=e.options[0]:e instanceof a&&(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((i=>{if(i instanceof n){let l=[];if(i.options.forEach((i=>{t&&!t(i)||(e?l.push(new a(i)):s.push(new a(i)))})),l.length>0){let t=new n(i);t.options=l,s.push(t)}}i instanceof a&&(t&&!t(i)||s.push(new a(i)))})),s}selectedOrderOptions(t){const e=[];return this.selectedOrder.forEach((s=>{const i=t.find((t=>t.id===s));i&&e.push(i)})),t.forEach((t=>{let s=!1;e.forEach((e=>{t.id!==e.id||(s=!0)})),s||e.push(t)})),e}}class o{static getLiveAssertive(){let t=document.getElementById("ss-live-assertive");return t||(t=document.createElement("div"),t.id="ss-live-assertive",t.setAttribute("role","status"),t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true"),t.className="sr-only",document.body.appendChild(t)),t}_announceAssertive(t){const e=o._liveAssertive||(o._liveAssertive=o.getLiveAssertive());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}constructor(t,e,s,i){var n;this.store=s,this.settings=t,this.classes=e,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes();const a=null===(n=document.querySelector(`[data-id="${this.settings.id}"]`))||void 0===n?void 0:n.closest(".offcanvas-body");a?a.appendChild(this.content.main):this.settings.contentLocation&&this.settings.contentLocation.appendChild(this.content.main)}static getLivePolite(){let t=document.getElementById("ss-live-polite");return t||(t=document.createElement("div"),t.id="ss-live-polite",t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.className="sr-only",document.body.appendChild(t)),t}_announcePolite(t){const e=o._livePolite||(o._livePolite=o.getLivePolite());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}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)}"fixed"===this.settings.contentPosition&&(this.moveContent(),this.scrollHandler=()=>this.moveContent(),this.resizeHandler=()=>this.moveContent(),window.addEventListener("scroll",this.scrollHandler,!0),window.addEventListener("resize",this.resizeHandler)),this.searchFocus()}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),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=void 0),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=void 0),this.main.main.focus({preventScroll:!0}),this.main.main.removeAttribute("aria-activedescendant")}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.main.main.classList.add("ss-2"),this.content.main.classList.add(this.classes.content),this.content.main.classList.add("ss-content-2"),""!==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&&"fixed"!==this.settings.contentPosition||this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){this.content.list.setAttribute("role","listbox"),this.content.list.setAttribute("id",this.content.main.id+"-list"),this.content.list.setAttribute("aria-label",this.settings.contentAriaLabel),this.settings.isMultiple?this.content.list.setAttribute("aria-multiselectable","true"):this.content.list.removeAttribute("aria-multiselectable"),this.main.main.setAttribute("role","combobox"),this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.list.id),this.main.main.setAttribute("aria-expanded","false"),this.main.main.setAttribute("aria-autocomplete","list"),this.settings.ariaLabelledBy&&this.settings.ariaLabelledBy.trim()?(this.main.main.setAttribute("aria-labelledby",this.settings.ariaLabelledBy),this.main.main.removeAttribute("aria-label")):this.settings.ariaLabel&&this.settings.ariaLabel.trim()&&this.main.main.setAttribute("aria-label",this.settings.ariaLabel),this.main.main.setAttribute("aria-owns",this.content.list.id),this.content.search.input.setAttribute("aria-controls",this.content.list.id),this.content.search.input.setAttribute("aria-autocomplete","list")}mainDiv(){var t;const e=document.createElement("div");e.id=this.settings.id+"-main",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===t.key.length&&this.callbacks.open(),!0},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),i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("aria-label",this.settings.clearAllAriaLabel),i.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i.click())}));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"),a.setAttribute("aria-hidden","true"),a.setAttribute("focusable","false");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"),o.setAttribute("aria-hidden","true"),o.setAttribute("focusable","false");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()}this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e));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 i=this.store.getSelectedOptions(),l=i.filter((e=>e.selected&&e.id!==t.id),!0);if(!(this.settings.minSelected&&l.length{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),s.click())}}return e}contentDiv(){const t=document.createElement("div");t.id=this.settings.id+"-content";const e=this.searchDiv();t.appendChild(e.main);const s=this.listDiv();return t.appendChild(s),{main:t,search:e,list:s}}moveContent(){"relative"!==this.settings.contentPosition&&"down"!==this.settings.openPosition?"up"!==this.settings.openPosition?"up"===this.putContent()?this.moveContentAbove():this.moveContentBelow():this.moveContentAbove():this.moveContentBelow()}searchDiv(){const t=document.createElement("div"),e=document.createElement("input"),i=document.createElement("div");t.classList.add(this.classes.search);const n={main:t,input:e};if(this.settings.showSearch||(t.classList.add(this.classes.hide),e.readOnly=!0),e.type="search",e.placeholder=this.settings.searchPlaceholder,e.tabIndex=-1,this.settings.searchLabelledBy&&this.settings.searchLabelledBy.trim()?e.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel&&this.settings.searchAriaLabel.trim()?e.setAttribute("aria-label",this.settings.searchAriaLabel):e.setAttribute("aria-label","Search options"),e.setAttribute("autocapitalize","off"),e.setAttribute("autocomplete","off"),e.setAttribute("autocorrect","off"),e.oninput=s((t=>{this.callbacks.search(t.target.value)}),100),e.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" ":const e=this.content.list.querySelector("."+this.classes.highlighted);return!e||(e.click(),!1);case"Enter":if(this.callbacks.addable)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(e),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"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false");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 a(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=>{"string"==typeof t?s({text:t,value:t}):i instanceof Error?this.renderError(i.message):s(t)})):"string"==typeof i?s({text:i,value:i}):i instanceof Error?this.renderError(i.message):s(i))},t.appendChild(i),n.addable={main:i,svg:e,path:s}}return n}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.main.main.setAttribute("aria-activedescendant",a.id),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}const i=e["down"===t?0:e.length-1];i.classList.add(this.classes.highlighted),this.main.main.setAttribute("aria-activedescendant",i.id),this.ensureElementInView(this.content.list,i)}listDiv(){const t=document.createElement("div");return t.classList.add(this.classes.list),t}renderError(t){this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy");const e=document.createElement("div");e.classList.add(this.classes.error),e.textContent=t,this.content.list.appendChild(e),this._announceAssertive(t)}renderSearching(){this.content.list.innerHTML="",this.content.list.setAttribute("aria-busy","true");const t=document.createElement("div");t.classList.add(this.classes.searching),t.textContent=this.settings.searchingText,this.content.list.appendChild(t),this._announcePolite(this.settings.searchingText)}renderOptions(t){if(this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy"),0===t.length){const t=document.createElement("div");t.classList.add(this.classes.search);const e=this.callbacks.addable?this.settings.addableText.replace("{value}",this.content.search.input.value):this.settings.searchText;return this._announcePolite(e),t.innerHTML=e,this.content.list.appendChild(t),void this.content.list.setAttribute("aria-setsize","0")}if(this.settings.allowDeselect&&!this.settings.isMultiple){this.store.filter((t=>t.placeholder),!1).length||this.store.addOption(new a({text:"",value:"",selected:!1,placeholder:!0}),!0)}const e=document.createDocumentFragment();let s=0;const i=t=>{t.classList.contains(this.classes.placeholder)||t.classList.contains(this.classes.disabled)||t.classList.contains(this.classes.hide)||t.setAttribute("aria-posinset",String(++s))};for(const s of t){if(s instanceof n){const t=document.createElement("div");t.classList.add(this.classes.optgroup),t.setAttribute("role","group"),t.setAttribute("aria-label",s.label);const n=document.createElement("div");n.classList.add(this.classes.optgroupLabel),t.appendChild(n);const a=document.createElement("div");a.classList.add(this.classes.optgroupLabelText),a.textContent=s.label,n.appendChild(a);const l=document.createElement("div");if(l.classList.add(this.classes.optgroupActions),n.appendChild(l),this.settings.isMultiple&&s.selectAll){const t=document.createElement("div");t.classList.add(this.classes.optgroupSelectAll);let e=!0;for(const t of s.options)if(!t.selected){e=!1;break}e&&t.classList.add(this.classes.selected);const i=document.createElement("span");i.textContent=s.selectAllText,t.appendChild(i);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),t.appendChild(n);const a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("d",this.classes.optgroupSelectAllBox),n.appendChild(a);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.optgroupSelectAllCheck),n.appendChild(o),t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const i=this.store.getSelected();if(e){const t=i.filter((t=>{for(const e of s.options)if(t===e.id)return!1;return!0}));this.callbacks.setSelected(t,!0)}else{const t=i.concat(s.options.map((t=>t.id)));for(const t of s.options)this.store.getOptionByID(t.id)||this.callbacks.addOption(t);this.callbacks.setSelected(t,!0)}})),l.appendChild(t)}if("off"!==s.closable){const e=document.createElement("div");e.classList.add(this.classes.optgroupClosable);const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("viewBox","0 0 100 100"),i.classList.add(this.classes.arrow),i.setAttribute("aria-hidden","true"),i.setAttribute("focusable","false"),e.appendChild(i);const a=document.createElementNS("http://www.w3.org/2000/svg","path");i.appendChild(a),s.options.some((t=>t.selected))||""!==this.content.search.input.value.trim()||"open"===s.closable?(t.classList.add(this.classes.open),a.setAttribute("d",this.classes.arrowOpen)):"close"===s.closable&&(t.classList.add(this.classes.close),a.setAttribute("d",this.classes.arrowClose)),n.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),a.setAttribute("d",this.classes.arrowOpen)):(t.classList.remove(this.classes.open),t.classList.add(this.classes.close),a.setAttribute("d",this.classes.arrowClose))})),l.appendChild(e)}t.appendChild(n);for(const e of s.options){const s=this.option(e);i(s),t.appendChild(s)}e.appendChild(t)}if(s instanceof a){const t=this.option(s);i(t),e.appendChild(t)}}this.content.list.appendChild(e),this.content.list.removeAttribute("aria-busy");const l=this.getOptions(!0,!0,!0).length;this.content.list.setAttribute("aria-setsize",String(l)),this._announcePolite(`${l} option${1===l?"":"s"} available`)}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=`${this.settings.id}__opt__${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),e.setAttribute("aria-disabled","true")),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=[];if(this.settings.isMultiple)if(t.selected)o=l.filter((t=>t.id!==n));else if(o=l.concat(t),!this.settings.closeOnSelect)if(e.shiftKey&&this.lastSelectedOption){const e=this.store.getDataOptions();let s=e.findIndex((t=>t.id===this.lastSelectedOption.id)),i=e.findIndex((e=>e.id===t.id));if(s>=0&&i>=0){const t=Math.min(s,i),n=Math.max(s,i),a=e.slice(t,n+1);a.length>0&&a.length!l.find((e=>e.id===t.id))))))}}else t.selected||(this.lastSelectedOption=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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=s.left+("fixed"===this.settings.contentPosition?0: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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=t.left+("fixed"===this.settings.contentPosition?0: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)}}o._livePolite=null,o._liveAssertive=null;class c{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){if(n.target===this.select&&("disabled"===n.attributeName&&(s=!0),"class"===n.attributeName&&(e=!0),"childList"===n.type)){for(const t of n.addedNodes)if("OPTION"===t.nodeName&&t.value===this.select.value){this.select.dispatchEvent(new Event("change"));break}i=!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:"",defaultSelected:t.defaultSelected,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)}setSelectedByValue(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.value)}}if("OPTION"===s.nodeName){const e=s;e.selected=t.includes(e.value)}}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 n&&this.select.appendChild(this.createOptgroup(e)),e instanceof a&&this.select.appendChild(this.createOption(e));this.select.dispatchEvent(new Event("change",{bubbles:!0})),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.textContent=t.text,""!==t.html&&e.setAttribute("data-html",t.html),e.defaultSelected=t.defaultSelected,e.selected=t.selected,t.disabled&&(e.disabled=!0),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 r{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.focusSearch=void 0===t.focusSearch||t.focusSearch,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.contentAriaLabel=void 0!==t.contentAriaLabel?t.contentAriaLabel:"Select an option",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",this.addableText=t.addableText||'Press "Enter" to add {value}',this.ariaLabelledBy=t.ariaLabelledBy||"",this.searchAriaLabel=t.searchAriaLabel||"Search options",this.searchLabelledBy=t.searchLabelledBy||"",this.clearAllAriaLabel=t.clearAllAriaLabel||"Clear selection"}}return class{constructor(e){var i;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=s((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.windowScroll=s((()=>{(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 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 r(e.settings),this.cssClasses=new t(e.cssClasses);const n=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const t in e.events)e.events.hasOwnProperty(t)&&(-1!==n.indexOf(t)?this.events[t]=s(e.events[t],100):this.events[t]=e.events[t]);this.settings.disabled=(null===(i=e.settings)||void 0===i?void 0:i.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 c(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 l(this.settings.isMultiple?"multiple":"single",e.data?e.data:this.select.getData()),e.data&&this.select.updateOptions(this.store.getData());const a={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 o(this.settings,this.cssClasses,this.store,a),this.render.renderValues(),this.render.renderOptions(this.store.getData());const h=this.selectEl.getAttribute("aria-label"),d=this.selectEl.getAttribute("aria-labelledby");h?this.render.main.main.setAttribute("aria-label",h):d&&this.render.main.main.setAttribute("aria-labelledby",d),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(),s=this.store.validateDataArray(t);if(s)return void(this.events.error&&this.events.error(s));this.store.setData(t);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!i(e,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let t=this.store.getSelectedOptions();return this.settings.keepOrder&&(t=this.store.selectedOrderOptions(t)),t.map((t=>t.value))}setSelected(t,e=!0){const s=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&&!i(s,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 s=this.store.getData();this.select.updateOptions(s),this.render.renderValues(),this.render.renderOptions(s),this.events.afterChange&&!i(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.settings.focusSearch&&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.css b/docs/assets/index.css index 713d7139..132b2b98 100644 --- a/docs/assets/index.css +++ b/docs/assets/index.css @@ -1 +1 @@ -@import"https://fonts.googleapis.com/css?family=Montserrat:300,400,700";code[class*=language-],pre[class*=language-]{color:#f8f8f2;background:none;text-shadow:0 1px rgba(0,0,0,.3);font-family:Consolas,Monaco,Andale Mono,Ubuntu Mono,monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto;border-radius:.3em}:not(pre)>code[class*=language-],pre[class*=language-]{background:#272822}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}.token.comment,.token.prolog,.token.doctype,.token.cdata{color:#8292a2}.token.punctuation{color:#f8f8f2}.token.namespace{opacity:.7}.token.property,.token.tag,.token.constant,.token.symbol,.token.deleted{color:#f92672}.token.boolean,.token.number{color:#ae81ff}.token.selector,.token.attr-name,.token.string,.token.char,.token.builtin,.token.inserted{color:#a6e22e}.token.operator,.token.entity,.token.url,.language-css .token.string,.style .token.string,.token.variable{color:#f8f8f2}.token.atrule,.token.attr-value,.token.function,.token.class-name{color:#e6db74}.token.keyword{color:#66d9ef}.token.regex,.token.important{color:#fd971f}.token.important,.token.bold{font-weight:700}.token.entity{cursor:help}:root{--color-primary: #5897fb;--color-secondary: #666666;--color-header-bg: #ffffff;--color-border: #dcdee2;--color-font: #66666;--color-white: #ffffff;--color-alert-info: #cfe2ff;--color-alert-info-border: #b6d4fe;--color-ads-background: #7cadfa;--width-max: 1000px;--height-header: 90px;--width-nav: 200px;--height-nav: 30px;--border-radius: 4px;--font-size: 14px;--spacing: 16px;--spacing-half: 8px;--spacing-quarter: 4px}html{height:100%;padding:0;margin:0;background-color:var(--color-primary)}body{font-family:Montserrat,sans-serif,Helvetica;font-size:var(--font-size);color:var(--color-font);width:100%;padding:0;margin:0}body #app{display:grid;grid-template-columns:var(--width-nav) 1fr;grid-template-rows:calc(var(--height-header) + var(--spacing-half)) 1fr;grid-template-areas:"header header" "nav main";width:100%;max-width:var(--width-max);height:100%;padding:0;margin:0 auto;overflow-x:hidden;box-sizing:border-box}@media (max-width: 700px){body #app{grid-template-columns:1fr;grid-template-rows:calc(var(--height-header) - var(--height-nav) + var(--spacing-half)) var(--height-nav) 1fr;grid-template-areas:"header" "nav" "main"}}body #app>*{box-sizing:border-box}body #app header{position:fixed;top:0;grid-area:header;display:flex;flex-direction:column;justify-content:flex-end;color:var(--color-white);height:var(--height-header);width:100%;max-width:var(--width-max);margin:0;padding:var(--spacing-half) 0 0 0;z-index:100000;background-color:var(--color-primary)}@media (max-width: 700px){body #app header{height:calc(var(--height-header) - var(--height-nav))}}body #app header .top{display:flex;flex-direction:row;justify-content:space-between;padding:0 0 var(--spacing-half) 0}body #app header .top .text{flex:1 1 auto;color:var(--color-font)}body #app header .top .text .logo{line-height:1;font-size:40px;font-weight:300;padding:0;margin:0}body #app header .top .socials{flex:0 1 auto;display:flex;justify-content:flex-end;gap:var(--spacing-half);color:var(--color-font);margin:0 auto;padding:var(--spacing-half) 0 0 0}body #app header .top .socials a,body #app header .top .socials img{height:30px}body #app header .bar{display:flex;flex-direction:row;justify-content:space-between;height:var(--height-nav);border:solid 1.5px var(--color-white)}@media (max-width: 700px){body #app header .bar{display:none}}body #app header .bar .tagline{flex:1 1 auto;display:inline-flex;justify-content:flex-start;align-items:center;line-height:1;font-size:16px;padding:var(--spacing-quarter) var(--spacing-quarter) var(--spacing-quarter) var(--spacing-half);margin:0 auto}body #app header .bar .drop{display:flex;flex:0 1 auto;border-left:solid 1.5px var(--color-white);margin:auto var(--spacing-quarter) auto var(--spacing-quarter);padding:0 var(--spacing-quarter) 0 var(--spacing-half)}body #app header .bar .drop svg{display:flex;align-items:center;justify-content:flex-end;flex:0 1 auto;height:12px;width:12px;margin:0 auto}body #app header .bar .drop svg path{fill:none;stroke:var(--color-white);stroke-width:18;stroke-linecap:round;stroke-linejoin:round}body #app nav{position:fixed;grid-area:nav;display:flex;flex-direction:column;top:calc(var(--height-header) + var(--spacing-half));width:var(--width-nav);max-width:var(--width-max);max-height:calc(100vh - var(--height-header) - var(--spacing));overflow:hidden;z-index:100000}@media (max-width: 700px){body #app nav{top:calc(var(--height-header) - var(--height-nav));height:auto;width:100%}}body #app nav .ss-main{flex:0 1 auto;height:var(--height-nav);font-weight:700}body #app nav .nav-content{flex:1 1 auto;overflow:hidden;padding:0 0 var(--spacing-half) 0}@media (max-width: 700px){body #app nav .nav-content{display:none}}body #app nav .nav-content .ss-content{max-height:calc(100vh - var(--height-header) - var(--height-nav) - 200px)}body #app nav .nav-content .ss-content .label{font-weight:700}body #app main{grid-area:main;display:flex;flex-direction:column;gap:var(--spacing-half);padding:0 0 0 var(--spacing);overflow:auto}@media (max-width: 700px){body #app main{padding:0}}body #app main .contents{display:flex;flex-direction:column;gap:var(--spacing)}body #app main .content{flex:1 1 auto;padding:var(--spacing);background-color:var(--color-white);border-radius:var(--border-radius)}@media screen and (max-width: 700px){body #app main .content{box-shadow:none}}body #app main .content .row{display:flex;flex-direction:row;gap:var(--spacing-half)}body #app main .content .row>*{flex:1 1 auto}body #app main .content .row .btn{flex:0 1 auto}body #app main footer{grid-area:footer;color:var(--color-white);padding:var(--spacing-quarter) 0 var(--spacing-quarter) 0;line-height:1.2;font-size:calc(var(--font-size) - 2px);text-align:center}body #app main footer a{color:var(--color-font)}code[class*=language-],pre[class*=language-]{color:#a9b7c6;font-family:Consolas,Monaco,Andale Mono,monospace;direction:ltr;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;line-height:1.5;border-radius:4px;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*=language-]::-moz-selection,pre[class*=language-] ::-moz-selection,code[class*=language-]::-moz-selection,code[class*=language-] ::-moz-selection{color:inherit;background:#214283d9}pre[class*=language-]::selection,pre[class*=language-] ::selection,code[class*=language-]::selection,code[class*=language-] ::selection{color:inherit;background:#214283d9}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*=language-],pre[class*=language-]{background:#2b2b2b}:not(pre)>code[class*=language-]{padding:.1em;border-radius:2px}.token.comment,.token.prolog,.token.cdata{color:gray}.token.delimiter,.token.boolean,.token.keyword,.token.selector,.token.important,.token.atrule{color:#cc7832}.token.operator,.token.punctuation,.token.attr-name{color:#a9b7c6}.token.tag,.token.tag .punctuation,.token.doctype,.token.builtin{color:#e8bf6a}.token.entity,.token.number,.token.symbol{color:#6897bb}.token.property,.token.constant,.token.variable{color:#9876aa}.token.string,.token.char{color:#6a8759}.token.attr-value,.token.attr-value .punctuation{color:#a5c261}.token.attr-value .punctuation:first-child{color:#a9b7c6}.token.url{color:#287bde;text-decoration:underline}.token.function{color:#ffc66d}.token.regex{background:#364135}.token.bold{font-weight:700}.token.italic{font-style:italic}.token.inserted{background:#294436}.token.deleted{background:#484a4a}code.language-css .token.property,code.language-css .token.property+.token.punctuation{color:#a9b7c6}code.language-css .token.id{color:#ffc66d}code.language-css .token.selector>.token.class,code.language-css .token.selector>.token.attribute,code.language-css .token.selector>.token.pseudo-class,code.language-css .token.selector>.token.pseudo-element{color:#ffc66d}h1{font-size:40px;margin:0 0 var(--spacing-half) 0;padding:0 0 var(--spacing-quarter) 0}h2{font-size:32px;margin:0 0 var(--spacing-half) 0;padding:0 0 var(--spacing-quarter) 0}h2 .header{border-bottom:solid 1px var(--color-border)}h3{font-size:24px;margin:0 0 var(--spacing-half) 0;padding:0 0 var(--spacing-quarter) 0}h4{font-size:20px;margin:0 0 var(--spacing-half) 0;padding:0 0 var(--spacing-quarter) 0}h5{font-size:16px;margin:0 0 var(--spacing-half) 0;padding:0 0 var(--spacing-quarter) 0}a{color:var(--primary-color)}a:hover{color:var(--color-secondary)}p{margin:0 0 var(--spacing-half) 0}.separator{height:1px;width:100%;margin:var(--spacing-half) 0 var(--spacing-half) 0;background-color:var(--color-border)}.separator.vertical{width:1px;height:100%;margin:0 var(--spacing-half) 0 var(--spacing-half)}.bold{font-weight:700}.pad-s{padding:var(--spacing-quarter)}.pad-t-s{padding-top:var(--spacing-quarter)}.pad-r-s{padding-right:var(--spacing-quarter)}.pad-b-s{padding-bottom:var(--spacing-quarter)}.pad-l-s{padding-left:var(--spacing-quarter)}.pad-m{padding:var(--spacing-half)}.pad-t-m{padding-top:var(--spacing-half)}.pad-r-m{padding-right:var(--spacing-half)}.pad-b-m{padding-bottom:var(--spacing-half)}.pad-l-m{padding-left:var(--spacing-half)}.pad-l{padding:var(--spacing)}.pad-t-l{padding-top:var(--spacing)}.pad-r-l{padding-right:var(--spacing)}.pad-b-l{padding-bottom:var(--spacing)}.pad-l-l{padding-left:var(--spacing)}.mar-s{margin:var(--spacing-quarter)}.mar-t-s{margin-top:var(--spacing-quarter)}.mar-r-s{margin-right:var(--spacing-quarter)}.mar-b-s{margin-bottom:var(--spacing-quarter)}.mar-l-s{margin-left:var(--spacing-quarter)}.mar-m{margin:var(--spacing-half)}.mar-t-m{margin-top:var(--spacing-half)}.mar-r-m{margin-right:var(--spacing-half)}.mar-b-m{margin-bottom:var(--spacing-half)}.mar-l-m{margin-left:var(--spacing-half)}.mar-l{margin:var(--spacing)}.mar-t-l{margin-top:var(--spacing)}.mar-r-l{margin-right:var(--spacing)}.mar-b-l{margin-bottom:var(--spacing)}.mar-l-l{margin-left:var(--spacing)}.fade-enter-active,.fade-leave-active{transition:opacity .3s ease-in-out}.fade-enter,.fade-leave-to{opacity:0}button,.btn{display:inline-flex;align-items:center;color:var(--color-white);height:30px;width:auto;max-width:100%;min-width:auto;padding:0 var(--spacing-half) 0 var(--spacing-half);cursor:pointer;background-color:var(--color-primary);text-align:center;line-height:18px;-webkit-user-select:none;user-select:none;white-space:nowrap;border-radius:var(--border-radius);vertical-align:middle;box-shadow:0 0 0 1px transparent inset,0 0 #22242626 inset;box-sizing:content-box;border:0}input{color:var(--color-font)}.alert{position:relative;color:var(--color-font);padding:var(--spacing-half) var(--spacing);margin:0 0 var(--spacing-half) 0;border-radius:var(--border-radius)}.alert.info{background-color:var(--color-alert-info);border-color:var(--color-alert-info-border)}:root{--ss-primary-color: #5897fb;--ss-bg-color: #ffffff;--ss-font-color: #4d4d4d;--ss-font-placeholder-color: #8d8d8d;--ss-disabled-color: #dcdee2;--ss-border-color: #dcdee2;--ss-highlight-color: #fffb8c;--ss-success-color: #00b755;--ss-error-color: #dc3545;--ss-focus-color: #5897fb;--ss-main-height: 30px;--ss-content-height: 300px;--ss-spacing-l: 7px;--ss-spacing-m: 5px;--ss-spacing-s: 3px;--ss-animation-timing: .2s;--ss-border-radius: 4px}@keyframes ss-valueIn{0%{transform:scale(0);opacity:0}to{transform:scale(1);opacity:1}}@keyframes ss-valueOut{0%{transform:scale(1);opacity:1}to{transform:scale(0);opacity:0}}.ss-hide{display:none!important}.ss-main.ss-2{display:flex;flex-direction:row;position:relative;-webkit-user-select:none;user-select:none;color:var(--ss-font-color);min-height:var(--ss-main-height);width:100%;padding:var(--ss-spacing-s);cursor:pointer;border:1px solid var(--ss-border-color);border-radius:var(--ss-border-radius);background-color:var(--ss-bg-color);outline:0;box-sizing:border-box;transition:background-color var(--ss-animation-timing);overflow:hidden}.ss-main.ss-2:focus{box-shadow:0 0 5px var(--ss-focus-color)}.ss-main.ss-2.ss-disabled{background-color:var(--ss-disabled-color);cursor:not-allowed}.ss-main.ss-2.ss-disabled .ss-values .ss-disabled{color:var(--ss-font-color)}.ss-main.ss-2.ss-disabled .ss-values .ss-value .ss-value-delete{cursor:not-allowed}.ss-main.ss-2.ss-open-above{border-top-left-radius:0;border-top-right-radius:0}.ss-main.ss-2.ss-open-below{border-bottom-left-radius:0;border-bottom-right-radius:0}.ss-main.ss-2 .ss-values{display:inline-flex;flex-wrap:wrap;gap:var(--ss-spacing-m);flex:1 1 100%}.ss-main.ss-2 .ss-values .ss-placeholder{display:flex;padding:var(--ss-spacing-s) var(--ss-spacing-m) var(--ss-spacing-s) var(--ss-spacing-m);margin:auto 0;line-height:1em;align-items:center;width:100%;color:var(--ss-font-placeholder-color);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ss-main.ss-2 .ss-values .ss-max{display:flex;-webkit-user-select:none;user-select:none;align-items:center;width:fit-content;font-size:12px;color:var(--ss-bg-color);line-height:1;padding:var(--ss-spacing-s) var(--ss-spacing-m);background-color:var(--ss-primary-color);border-radius:var(--ss-border-radius)}.ss-main.ss-2 .ss-values .ss-single{display:flex;margin:auto 0px auto var(--ss-spacing-s)}.ss-main.ss-2 .ss-values .ss-value{display:flex;-webkit-user-select:none;user-select:none;align-items:center;width:fit-content;background-color:var(--ss-primary-color);border-radius:var(--ss-border-radius);animation-name:ss-valueIn;animation-duration:var(--ss-animation-timing);animation-timing-function:ease-out;animation-fill-mode:both}.ss-main.ss-2 .ss-values .ss-value.ss-value-out{animation-name:ss-valueOut;animation-duration:var(--ss-animation-timing);animation-timing-function:ease-out}.ss-main.ss-2 .ss-values .ss-value .ss-value-text{font-size:12px;color:var(--ss-bg-color);line-height:1;padding:var(--ss-spacing-s) var(--ss-spacing-m)}.ss-main.ss-2 .ss-values .ss-value .ss-value-delete{display:flex;align-items:center;height:var(--ss-spacing-l);width:var(--ss-spacing-l);padding:var(--ss-spacing-s) var(--ss-spacing-m);cursor:pointer;border-left:solid 1px var(--ss-bg-color);box-sizing:content-box}.ss-main.ss-2 .ss-values .ss-value .ss-value-delete svg{height:var(--ss-spacing-l);width:var(--ss-spacing-l)}.ss-main.ss-2 .ss-values .ss-value .ss-value-delete svg path{fill:none;stroke:var(--ss-bg-color);stroke-width:18;stroke-linecap:round;stroke-linejoin:round}.ss-main.ss-2 .ss-deselect{flex:0 1 auto;display:flex;align-items:center;justify-content:center;width:fit-content;height:auto;padding:0 var(--ss-spacing-m) 0 var(--ss-spacing-m)}.ss-main.ss-2 .ss-deselect svg{width:8px;height:8px}.ss-main.ss-2 .ss-deselect svg path{fill:none;stroke:var(--ss-font-color);stroke-width:20;stroke-linecap:round;stroke-linejoin:round}.ss-main.ss-2 .ss-arrow{flex:0 1 auto;display:flex;align-items:center;justify-content:flex-end;width:12px;height:12px;margin:auto var(--ss-spacing-m) auto var(--ss-spacing-m)}.ss-main.ss-2 .ss-arrow path{fill:none;stroke:var(--ss-font-color);stroke-width:18;stroke-linecap:round;stroke-linejoin:round;transition-timing-function:ease-out;transition:var(--ss-animation-timing)}.ss-content{position:absolute;display:flex;height:auto;flex-direction:column;width:auto;max-height:var(--ss-content-height);box-sizing:border-box;border:solid 1px var(--ss-border-color);background-color:var(--ss-bg-color);transition:transform var(--ss-animation-timing),opacity var(--ss-animation-timing);opacity:0;transform:scaleY(0);transform-origin:center top;overflow:hidden;z-index:10000}.ss-content.ss-relative{position:relative;height:100%}.ss-content.ss-fixed{position:fixed}.ss-content.ss-open-above{flex-direction:column-reverse;opacity:1;transform:scaleY(1);transform-origin:center bottom;border-top-left-radius:var(--ss-border-radius);border-top-right-radius:var(--ss-border-radius)}.ss-content.ss-open-below{opacity:1;transform:scaleY(1);transform-origin:center top;border-bottom-left-radius:var(--ss-border-radius);border-bottom-right-radius:var(--ss-border-radius)}.ss-content .ss-search{flex:0 1 auto;display:flex;flex-direction:row;padding:var(--ss-spacing-l) var(--ss-spacing-l) var(--ss-spacing-m) var(--ss-spacing-l)}.ss-content .ss-search input{display:inline-flex;font-size:inherit;line-height:inherit;flex:1 1 auto;width:100%;min-width:0px;padding:var(--ss-spacing-m) var(--ss-spacing-l);margin:0;border:1px solid var(--ss-border-color);border-radius:var(--ss-border-radius);background-color:var(--ss-bg-color);outline:0;text-align:left;box-sizing:border-box}.ss-content .ss-search input::placeholder{color:var(--ss-font-placeholder-color);vertical-align:middle}.ss-content .ss-search input:focus{box-shadow:0 0 5px var(--ss-focus-color)}.ss-content .ss-search .ss-addable{display:inline-flex;justify-content:center;align-items:center;cursor:pointer;flex:0 0 auto;height:auto;margin:0 0 0 var(--ss-spacing-m);border:1px solid var(--ss-border-color);border-radius:var(--ss-border-radius)}.ss-content .ss-search .ss-addable svg{display:flex;align-items:center;justify-content:flex-end;flex:0 1 auto;width:12px;height:12px;margin:auto var(--ss-spacing-m) auto var(--ss-spacing-m)}.ss-content .ss-search .ss-addable svg path{fill:none;stroke:var(--ss-font-color);stroke-width:18;stroke-linecap:round;stroke-linejoin:round}.ss-content .ss-list{flex:1 1 auto;height:auto;overflow-x:hidden;overflow-y:auto}.ss-content .ss-list .ss-error{color:var(--ss-error-color);padding:var(--ss-spacing-l)}.ss-content .ss-list .ss-searching{color:var(--ss-font-color);padding:var(--ss-spacing-l)}.ss-content .ss-list .ss-optgroup.ss-close .ss-option{display:none!important}.ss-content .ss-list .ss-optgroup .ss-optgroup-label{display:flex;flex-direction:row;align-items:center;justify-content:space-between;padding:var(--ss-spacing-m) var(--ss-spacing-l) var(--ss-spacing-m) var(--ss-spacing-l)}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-label-text{flex:1 1 auto;font-weight:700;color:var(--ss-font-color)}.ss-content .ss-list .ss-optgroup .ss-optgroup-label:has(.ss-arrow){cursor:pointer}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions{flex:0 1 auto;display:flex;flex-direction:row;align-items:center;justify-content:center;gap:var(--ss-spacing-m)}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall{flex:0 0 auto;display:flex;flex-direction:row;cursor:pointer}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall:hover{opacity:.5}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall.ss-selected svg path{stroke:var(--ss-error-color)}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall span{flex:0 1 auto;display:flex;align-items:center;justify-content:center;font-size:60%;text-align:center;padding:0 var(--ss-spacing-s) 0 0}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall svg{flex:0 1 auto;width:13px;height:13px}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall svg path{fill:none;stroke:var(--ss-success-color);stroke-linecap:round;stroke-linejoin:round}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall svg:first-child{stroke-width:5}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall svg:last-child{stroke-width:11}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-closable{flex:0 1 auto;display:flex;flex-direction:row;cursor:pointer}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-closable .ss-arrow{flex:1 1 auto;width:10px;height:10px}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-closable .ss-arrow path{fill:none;stroke:var(--ss-font-color);stroke-width:18;stroke-linecap:round;stroke-linejoin:round;transition-timing-function:ease-out;transition:var(--ss-animation-timing)}.ss-content .ss-list .ss-optgroup .ss-option{padding:var(--ss-spacing-s) var(--ss-spacing-s) var(--ss-spacing-s) calc(var(--ss-spacing-l) * 3)}.ss-content .ss-list .ss-option{display:block;padding:var(--ss-spacing-m) var(--ss-spacing-l) var(--ss-spacing-m) var(--ss-spacing-l);white-space:normal;color:var(--ss-font-color);cursor:pointer;-webkit-user-select:none;user-select:none}.ss-content .ss-list .ss-option:hover{color:var(--ss-bg-color);background-color:var(--ss-primary-color)}.ss-content .ss-list .ss-option.ss-highlighted,.ss-content .ss-list .ss-option:not(.ss-disabled).ss-selected{color:var(--ss-bg-color);background-color:var(--ss-primary-color)}.ss-content .ss-list .ss-option.ss-disabled{cursor:not-allowed;background-color:var(--ss-disabled-color)}.ss-content .ss-list .ss-option.ss-disabled:hover{color:var(--ss-font-color)}.ss-content .ss-list .ss-option .ss-search-highlight{display:inline-block;background-color:var(--ss-highlight-color)}.ss-main.error,.ss-content.error{border:solid 1px red!important;color:red!important}.carbon-container #carbonads *{margin:initial;padding:initial}.carbon-container #carbonads{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,Helvetica,Arial,sans-serif}.carbon-container #carbonads{display:flex;max-width:100%;background-color:var(--color-ads-background);box-shadow:none;z-index:100}.carbon-container #carbonads a{color:inherit;text-decoration:none}.carbon-container #carbonads a:hover{color:inherit}.carbon-container #carbonads span{position:relative;display:block;overflow:hidden}.carbon-container #carbonads .carbon-wrap{display:flex;flex-direction:column}.carbon-container #carbonads .carbon-img{display:block;margin-bottom:0;line-height:1}.carbon-container #carbonads .carbon-img img{display:block}.carbon-container #carbonads .carbon-text{font-size:12px;padding:var(--spacing-quarter);margin-bottom:16px;line-height:1.5;text-align:left}.carbon-container #carbonads .carbon-poweredby{display:block;padding:var(--spacing-quarter);background:#f1f1f2;text-align:center;text-transform:uppercase;letter-spacing:.5px;font-weight:600;font-size:8px;line-height:1;border-top-left-radius:3px;position:absolute;bottom:0;right:0} +@import"https://fonts.googleapis.com/css?family=Montserrat:300,400,700";code[class*=language-],pre[class*=language-]{color:#f8f8f2;background:none;text-shadow:0 1px rgba(0,0,0,.3);font-family:Consolas,Monaco,Andale Mono,Ubuntu Mono,monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto;border-radius:.3em}:not(pre)>code[class*=language-],pre[class*=language-]{background:#272822}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}.token.comment,.token.prolog,.token.doctype,.token.cdata{color:#8292a2}.token.punctuation{color:#f8f8f2}.token.namespace{opacity:.7}.token.property,.token.tag,.token.constant,.token.symbol,.token.deleted{color:#f92672}.token.boolean,.token.number{color:#ae81ff}.token.selector,.token.attr-name,.token.string,.token.char,.token.builtin,.token.inserted{color:#a6e22e}.token.operator,.token.entity,.token.url,.language-css .token.string,.style .token.string,.token.variable{color:#f8f8f2}.token.atrule,.token.attr-value,.token.function,.token.class-name{color:#e6db74}.token.keyword{color:#66d9ef}.token.regex,.token.important{color:#fd971f}.token.important,.token.bold{font-weight:700}.token.entity{cursor:help}:root{--color-primary: #5897fb;--color-secondary: #666666;--color-header-bg: #ffffff;--color-border: #dcdee2;--color-font: #66666;--color-white: #ffffff;--color-alert-info: #cfe2ff;--color-alert-info-border: #b6d4fe;--color-ads-background: #7cadfa;--width-max: 1000px;--height-header: 90px;--width-nav: 200px;--height-nav: 30px;--border-radius: 4px;--font-size: 14px;--spacing: 16px;--spacing-half: 8px;--spacing-quarter: 4px}html{height:100%;padding:0;margin:0;background-color:var(--color-primary)}body{font-family:Montserrat,sans-serif,Helvetica;font-size:var(--font-size);color:var(--color-font);width:100%;padding:0;margin:0}body #app{display:grid;grid-template-columns:var(--width-nav) 1fr;grid-template-rows:calc(var(--height-header) + var(--spacing-half)) 1fr;grid-template-areas:"header header" "nav main";width:100%;max-width:var(--width-max);height:100%;padding:0;margin:0 auto;overflow-x:hidden;box-sizing:border-box}@media (max-width: 700px){body #app{grid-template-columns:1fr;grid-template-rows:calc(var(--height-header) - var(--height-nav) + var(--spacing-half)) var(--height-nav) 1fr;grid-template-areas:"header" "nav" "main"}}body #app>*{box-sizing:border-box}body #app header{position:fixed;top:0;grid-area:header;display:flex;flex-direction:column;justify-content:flex-end;color:var(--color-white);height:var(--height-header);width:100%;max-width:var(--width-max);margin:0;padding:var(--spacing-half) 0 0 0;z-index:100000;background-color:var(--color-primary)}@media (max-width: 700px){body #app header{height:calc(var(--height-header) - var(--height-nav))}}body #app header .top{display:flex;flex-direction:row;justify-content:space-between;padding:0 0 var(--spacing-half) 0}body #app header .top .text{flex:1 1 auto;color:var(--color-font)}body #app header .top .text .logo{line-height:1;font-size:40px;font-weight:300;padding:0;margin:0}body #app header .top .socials{flex:0 1 auto;display:flex;justify-content:flex-end;gap:var(--spacing-half);color:var(--color-font);margin:0 auto;padding:var(--spacing-half) 0 0 0}body #app header .top .socials a,body #app header .top .socials img{height:30px}body #app header .bar{display:flex;flex-direction:row;justify-content:space-between;height:var(--height-nav);border:solid 1.5px var(--color-white)}@media (max-width: 700px){body #app header .bar{display:none}}body #app header .bar .tagline{flex:1 1 auto;display:inline-flex;justify-content:flex-start;align-items:center;line-height:1;font-size:16px;padding:var(--spacing-quarter) var(--spacing-quarter) var(--spacing-quarter) var(--spacing-half);margin:0 auto}body #app header .bar .drop{display:flex;flex:0 1 auto;border-left:solid 1.5px var(--color-white);margin:auto var(--spacing-quarter) auto var(--spacing-quarter);padding:0 var(--spacing-quarter) 0 var(--spacing-half)}body #app header .bar .drop svg{display:flex;align-items:center;justify-content:flex-end;flex:0 1 auto;height:12px;width:12px;margin:0 auto}body #app header .bar .drop svg path{fill:none;stroke:var(--color-white);stroke-width:18;stroke-linecap:round;stroke-linejoin:round}body #app nav{position:fixed;grid-area:nav;display:flex;flex-direction:column;top:calc(var(--height-header) + var(--spacing-half));width:var(--width-nav);max-width:var(--width-max);max-height:calc(100vh - var(--height-header) - var(--spacing));overflow:hidden;z-index:100000}@media (max-width: 700px){body #app nav{top:calc(var(--height-header) - var(--height-nav));height:auto;width:100%}}body #app nav .ss-main{flex:0 1 auto;height:var(--height-nav);font-weight:700}body #app nav .nav-content{flex:1 1 auto;overflow:hidden;padding:0 0 var(--spacing-half) 0}@media (max-width: 700px){body #app nav .nav-content{display:none}}body #app nav .nav-content .ss-content{max-height:calc(100vh - var(--height-header) - var(--height-nav) - 200px)}body #app nav .nav-content .ss-content .label{font-weight:700}body #app main{grid-area:main;display:flex;flex-direction:column;gap:var(--spacing-half);padding:0 0 0 var(--spacing);overflow:auto}@media (max-width: 700px){body #app main{padding:0}}body #app main .contents{display:flex;flex-direction:column;gap:var(--spacing)}body #app main .content{flex:1 1 auto;padding:var(--spacing);background-color:var(--color-white);border-radius:var(--border-radius)}@media screen and (max-width: 700px){body #app main .content{box-shadow:none}}body #app main .content .row{display:flex;flex-direction:row;gap:var(--spacing-half)}body #app main .content .row>*{flex:1 1 auto}body #app main .content .row .btn{flex:0 1 auto}body #app main footer{grid-area:footer;color:var(--color-white);padding:var(--spacing-quarter) 0 var(--spacing-quarter) 0;line-height:1.2;font-size:calc(var(--font-size) - 2px);text-align:center}body #app main footer a{color:var(--color-font)}code[class*=language-],pre[class*=language-]{color:#a9b7c6;font-family:Consolas,Monaco,Andale Mono,monospace;direction:ltr;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;line-height:1.5;border-radius:4px;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*=language-]::-moz-selection,pre[class*=language-] ::-moz-selection,code[class*=language-]::-moz-selection,code[class*=language-] ::-moz-selection{color:inherit;background:#214283d9}pre[class*=language-]::selection,pre[class*=language-] ::selection,code[class*=language-]::selection,code[class*=language-] ::selection{color:inherit;background:#214283d9}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*=language-],pre[class*=language-]{background:#2b2b2b}:not(pre)>code[class*=language-]{padding:.1em;border-radius:2px}.token.comment,.token.prolog,.token.cdata{color:gray}.token.delimiter,.token.boolean,.token.keyword,.token.selector,.token.important,.token.atrule{color:#cc7832}.token.operator,.token.punctuation,.token.attr-name{color:#a9b7c6}.token.tag,.token.tag .punctuation,.token.doctype,.token.builtin{color:#e8bf6a}.token.entity,.token.number,.token.symbol{color:#6897bb}.token.property,.token.constant,.token.variable{color:#9876aa}.token.string,.token.char{color:#6a8759}.token.attr-value,.token.attr-value .punctuation{color:#a5c261}.token.attr-value .punctuation:first-child{color:#a9b7c6}.token.url{color:#287bde;text-decoration:underline}.token.function{color:#ffc66d}.token.regex{background:#364135}.token.bold{font-weight:700}.token.italic{font-style:italic}.token.inserted{background:#294436}.token.deleted{background:#484a4a}code.language-css .token.property,code.language-css .token.property+.token.punctuation{color:#a9b7c6}code.language-css .token.id{color:#ffc66d}code.language-css .token.selector>.token.class,code.language-css .token.selector>.token.attribute,code.language-css .token.selector>.token.pseudo-class,code.language-css .token.selector>.token.pseudo-element{color:#ffc66d}h1{font-size:40px;margin:0 0 var(--spacing-half) 0;padding:0 0 var(--spacing-quarter) 0}h2{font-size:32px;margin:0 0 var(--spacing-half) 0;padding:0 0 var(--spacing-quarter) 0}h2 .header{border-bottom:solid 1px var(--color-border)}h3{font-size:24px;margin:0 0 var(--spacing-half) 0;padding:0 0 var(--spacing-quarter) 0}h4{font-size:20px;margin:0 0 var(--spacing-half) 0;padding:0 0 var(--spacing-quarter) 0}h5{font-size:16px;margin:0 0 var(--spacing-half) 0;padding:0 0 var(--spacing-quarter) 0}a{color:var(--primary-color)}a:hover{color:var(--color-secondary)}p{margin:0 0 var(--spacing-half) 0}.separator{height:1px;width:100%;margin:var(--spacing-half) 0 var(--spacing-half) 0;background-color:var(--color-border)}.separator.vertical{width:1px;height:100%;margin:0 var(--spacing-half) 0 var(--spacing-half)}.bold{font-weight:700}.pad-s{padding:var(--spacing-quarter)}.pad-t-s{padding-top:var(--spacing-quarter)}.pad-r-s{padding-right:var(--spacing-quarter)}.pad-b-s{padding-bottom:var(--spacing-quarter)}.pad-l-s{padding-left:var(--spacing-quarter)}.pad-m{padding:var(--spacing-half)}.pad-t-m{padding-top:var(--spacing-half)}.pad-r-m{padding-right:var(--spacing-half)}.pad-b-m{padding-bottom:var(--spacing-half)}.pad-l-m{padding-left:var(--spacing-half)}.pad-l{padding:var(--spacing)}.pad-t-l{padding-top:var(--spacing)}.pad-r-l{padding-right:var(--spacing)}.pad-b-l{padding-bottom:var(--spacing)}.pad-l-l{padding-left:var(--spacing)}.mar-s{margin:var(--spacing-quarter)}.mar-t-s{margin-top:var(--spacing-quarter)}.mar-r-s{margin-right:var(--spacing-quarter)}.mar-b-s{margin-bottom:var(--spacing-quarter)}.mar-l-s{margin-left:var(--spacing-quarter)}.mar-m{margin:var(--spacing-half)}.mar-t-m{margin-top:var(--spacing-half)}.mar-r-m{margin-right:var(--spacing-half)}.mar-b-m{margin-bottom:var(--spacing-half)}.mar-l-m{margin-left:var(--spacing-half)}.mar-l{margin:var(--spacing)}.mar-t-l{margin-top:var(--spacing)}.mar-r-l{margin-right:var(--spacing)}.mar-b-l{margin-bottom:var(--spacing)}.mar-l-l{margin-left:var(--spacing)}.sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;clip:rect(0,0,0,0);clip-path:inset(50%);overflow:hidden}.fade-enter-active,.fade-leave-active{transition:opacity .3s ease-in-out}.fade-enter,.fade-leave-to{opacity:0}button,.btn{display:inline-flex;align-items:center;color:var(--color-white);height:30px;width:auto;max-width:100%;min-width:auto;padding:0 var(--spacing-half) 0 var(--spacing-half);cursor:pointer;background-color:var(--color-primary);text-align:center;line-height:18px;-webkit-user-select:none;user-select:none;white-space:nowrap;border-radius:var(--border-radius);vertical-align:middle;box-shadow:0 0 0 1px transparent inset,0 0 #22242626 inset;box-sizing:content-box;border:0}input{color:var(--color-font)}.alert{position:relative;color:var(--color-font);padding:var(--spacing-half) var(--spacing);margin:0 0 var(--spacing-half) 0;border-radius:var(--border-radius)}.alert.info{background-color:var(--color-alert-info);border-color:var(--color-alert-info-border)}:root{--ss-primary-color: #5897fb;--ss-bg-color: #ffffff;--ss-font-color: #4d4d4d;--ss-font-placeholder-color: #8d8d8d;--ss-disabled-color: #dcdee2;--ss-border-color: #dcdee2;--ss-highlight-color: #fffb8c;--ss-success-color: #00b755;--ss-error-color: #dc3545;--ss-focus-color: #5897fb;--ss-main-height: 30px;--ss-content-height: 300px;--ss-spacing-l: 7px;--ss-spacing-m: 5px;--ss-spacing-s: 3px;--ss-animation-timing: .2s;--ss-border-radius: 4px}@keyframes ss-valueIn{0%{transform:scale(0);opacity:0}to{transform:scale(1);opacity:1}}@keyframes ss-valueOut{0%{transform:scale(1);opacity:1}to{transform:scale(0);opacity:0}}.ss-hide{display:none!important}.ss-main.ss-2{display:flex;flex-direction:row;position:relative;-webkit-user-select:none;user-select:none;color:var(--ss-font-color);min-height:var(--ss-main-height);width:100%;padding:var(--ss-spacing-s);cursor:pointer;border:1px solid var(--ss-border-color);border-radius:var(--ss-border-radius);background-color:var(--ss-bg-color);outline:0;box-sizing:border-box;transition:background-color var(--ss-animation-timing);overflow:hidden}.ss-main.ss-2:focus{box-shadow:0 0 5px var(--ss-focus-color)}.ss-main.ss-2.ss-disabled{background-color:var(--ss-disabled-color);cursor:not-allowed}.ss-main.ss-2.ss-disabled .ss-values .ss-disabled{color:var(--ss-font-color)}.ss-main.ss-2.ss-disabled .ss-values .ss-value .ss-value-delete{cursor:not-allowed}.ss-main.ss-2.ss-open-above{border-top-left-radius:0;border-top-right-radius:0}.ss-main.ss-2.ss-open-below{border-bottom-left-radius:0;border-bottom-right-radius:0}.ss-main.ss-2 .ss-values{display:inline-flex;flex-wrap:wrap;gap:var(--ss-spacing-m);flex:1 1 100%}.ss-main.ss-2 .ss-values .ss-placeholder{display:flex;padding:var(--ss-spacing-s) var(--ss-spacing-m) var(--ss-spacing-s) var(--ss-spacing-m);margin:auto 0;line-height:1em;align-items:center;width:100%;color:var(--ss-font-placeholder-color);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ss-main.ss-2 .ss-values .ss-max{display:flex;-webkit-user-select:none;user-select:none;align-items:center;width:fit-content;font-size:12px;color:var(--ss-bg-color);line-height:1;padding:var(--ss-spacing-s) var(--ss-spacing-m);background-color:var(--ss-primary-color);border-radius:var(--ss-border-radius)}.ss-main.ss-2 .ss-values .ss-single{display:flex;margin:auto 0px auto var(--ss-spacing-s)}.ss-main.ss-2 .ss-values .ss-value{display:flex;-webkit-user-select:none;user-select:none;align-items:center;width:fit-content;background-color:var(--ss-primary-color);border-radius:var(--ss-border-radius);animation-name:ss-valueIn;animation-duration:var(--ss-animation-timing);animation-timing-function:ease-out;animation-fill-mode:both}.ss-main.ss-2 .ss-values .ss-value.ss-value-out{animation-name:ss-valueOut;animation-duration:var(--ss-animation-timing);animation-timing-function:ease-out}.ss-main.ss-2 .ss-values .ss-value .ss-value-text{font-size:12px;color:var(--ss-bg-color);line-height:1;padding:var(--ss-spacing-s) var(--ss-spacing-m)}.ss-main.ss-2 .ss-values .ss-value .ss-value-delete{display:flex;align-items:center;height:var(--ss-spacing-l);width:var(--ss-spacing-l);padding:var(--ss-spacing-s) var(--ss-spacing-m);cursor:pointer;border-left:solid 1px var(--ss-bg-color);box-sizing:content-box}.ss-main.ss-2 .ss-values .ss-value .ss-value-delete svg{height:var(--ss-spacing-l);width:var(--ss-spacing-l)}.ss-main.ss-2 .ss-values .ss-value .ss-value-delete svg path{fill:none;stroke:var(--ss-bg-color);stroke-width:18;stroke-linecap:round;stroke-linejoin:round}.ss-main.ss-2 .ss-deselect{flex:0 1 auto;display:flex;align-items:center;justify-content:center;width:fit-content;height:auto;padding:0 var(--ss-spacing-m) 0 var(--ss-spacing-m)}.ss-main.ss-2 .ss-deselect svg{width:8px;height:8px}.ss-main.ss-2 .ss-deselect svg path{fill:none;stroke:var(--ss-font-color);stroke-width:20;stroke-linecap:round;stroke-linejoin:round}.ss-main.ss-2 .ss-arrow{flex:0 1 auto;display:flex;align-items:center;justify-content:flex-end;width:12px;height:12px;margin:auto var(--ss-spacing-m) auto var(--ss-spacing-m)}.ss-main.ss-2 .ss-arrow path{fill:none;stroke:var(--ss-font-color);stroke-width:18;stroke-linecap:round;stroke-linejoin:round;transition-timing-function:ease-out;transition:var(--ss-animation-timing)}.ss-content{position:absolute;display:flex;height:auto;flex-direction:column;width:auto;max-height:var(--ss-content-height);box-sizing:border-box;border:solid 1px var(--ss-border-color);background-color:var(--ss-bg-color);transition:transform var(--ss-animation-timing),opacity var(--ss-animation-timing);opacity:0;transform:scaleY(0);transform-origin:center top;overflow:hidden;z-index:10000}.ss-content.ss-relative{position:relative;height:100%}.ss-content.ss-fixed{position:fixed}.ss-content.ss-open-above{flex-direction:column-reverse;opacity:1;transform:scaleY(1);transform-origin:center bottom;border-top-left-radius:var(--ss-border-radius);border-top-right-radius:var(--ss-border-radius)}.ss-content.ss-open-below{opacity:1;transform:scaleY(1);transform-origin:center top;border-bottom-left-radius:var(--ss-border-radius);border-bottom-right-radius:var(--ss-border-radius)}.ss-content .ss-search{flex:0 1 auto;display:flex;flex-direction:row;padding:var(--ss-spacing-l) var(--ss-spacing-l) var(--ss-spacing-m) var(--ss-spacing-l)}.ss-content .ss-search input{display:inline-flex;font-size:inherit;line-height:inherit;flex:1 1 auto;width:100%;min-width:0px;padding:var(--ss-spacing-m) var(--ss-spacing-l);margin:0;border:1px solid var(--ss-border-color);border-radius:var(--ss-border-radius);background-color:var(--ss-bg-color);outline:0;text-align:left;box-sizing:border-box}.ss-content .ss-search input::placeholder{color:var(--ss-font-placeholder-color);vertical-align:middle}.ss-content .ss-search input:focus{box-shadow:0 0 5px var(--ss-focus-color)}.ss-content .ss-search .ss-addable{display:inline-flex;justify-content:center;align-items:center;cursor:pointer;flex:0 0 auto;height:auto;margin:0 0 0 var(--ss-spacing-m);border:1px solid var(--ss-border-color);border-radius:var(--ss-border-radius)}.ss-content .ss-search .ss-addable svg{display:flex;align-items:center;justify-content:flex-end;flex:0 1 auto;width:12px;height:12px;margin:auto var(--ss-spacing-m) auto var(--ss-spacing-m)}.ss-content .ss-search .ss-addable svg path{fill:none;stroke:var(--ss-font-color);stroke-width:18;stroke-linecap:round;stroke-linejoin:round}.ss-content .ss-list{flex:1 1 auto;height:auto;overflow-x:hidden;overflow-y:auto}.ss-content .ss-list .ss-error{color:var(--ss-error-color);padding:var(--ss-spacing-l)}.ss-content .ss-list .ss-searching{color:var(--ss-font-color);padding:var(--ss-spacing-l)}.ss-content .ss-list .ss-optgroup.ss-close .ss-option{display:none!important}.ss-content .ss-list .ss-optgroup .ss-optgroup-label{display:flex;flex-direction:row;align-items:center;justify-content:space-between;padding:var(--ss-spacing-m) var(--ss-spacing-l) var(--ss-spacing-m) var(--ss-spacing-l)}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-label-text{flex:1 1 auto;font-weight:700;color:var(--ss-font-color)}.ss-content .ss-list .ss-optgroup .ss-optgroup-label:has(.ss-arrow){cursor:pointer}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions{flex:0 1 auto;display:flex;flex-direction:row;align-items:center;justify-content:center;gap:var(--ss-spacing-m)}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall{flex:0 0 auto;display:flex;flex-direction:row;cursor:pointer}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall:hover{opacity:.5}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall.ss-selected svg path{stroke:var(--ss-error-color)}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall span{flex:0 1 auto;display:flex;align-items:center;justify-content:center;font-size:60%;text-align:center;padding:0 var(--ss-spacing-s) 0 0}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall svg{flex:0 1 auto;width:13px;height:13px}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall svg path{fill:none;stroke:var(--ss-success-color);stroke-linecap:round;stroke-linejoin:round}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall svg:first-child{stroke-width:5}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall svg:last-child{stroke-width:11}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-closable{flex:0 1 auto;display:flex;flex-direction:row;cursor:pointer}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-closable .ss-arrow{flex:1 1 auto;width:10px;height:10px}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-closable .ss-arrow path{fill:none;stroke:var(--ss-font-color);stroke-width:18;stroke-linecap:round;stroke-linejoin:round;transition-timing-function:ease-out;transition:var(--ss-animation-timing)}.ss-content .ss-list .ss-optgroup .ss-option{padding:var(--ss-spacing-s) var(--ss-spacing-s) var(--ss-spacing-s) calc(var(--ss-spacing-l) * 3)}.ss-content .ss-list .ss-option{display:block;padding:var(--ss-spacing-m) var(--ss-spacing-l) var(--ss-spacing-m) var(--ss-spacing-l);white-space:normal;color:var(--ss-font-color);cursor:pointer;-webkit-user-select:none;user-select:none}.ss-content .ss-list .ss-option:hover{color:var(--ss-bg-color);background-color:var(--ss-primary-color)}.ss-content .ss-list .ss-option.ss-highlighted,.ss-content .ss-list .ss-option:not(.ss-disabled).ss-selected{color:var(--ss-bg-color);background-color:var(--ss-primary-color)}.ss-content .ss-list .ss-option.ss-disabled{cursor:not-allowed;background-color:var(--ss-disabled-color)}.ss-content .ss-list .ss-option.ss-disabled:hover{color:var(--ss-font-color)}.ss-content .ss-list .ss-option .ss-search-highlight{display:inline-block;background-color:var(--ss-highlight-color)}.ss-main.error,.ss-content.error{border:solid 1px red!important;color:red!important}.carbon-container #carbonads *{margin:initial;padding:initial}.carbon-container #carbonads{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,Helvetica,Arial,sans-serif}.carbon-container #carbonads{display:flex;max-width:100%;background-color:var(--color-ads-background);box-shadow:none;z-index:100}.carbon-container #carbonads a{color:inherit;text-decoration:none}.carbon-container #carbonads a:hover{color:inherit}.carbon-container #carbonads span{position:relative;display:block;overflow:hidden}.carbon-container #carbonads .carbon-wrap{display:flex;flex-direction:column}.carbon-container #carbonads .carbon-img{display:block;margin-bottom:0;line-height:1}.carbon-container #carbonads .carbon-img img{display:block}.carbon-container #carbonads .carbon-text{font-size:12px;padding:var(--spacing-quarter);margin-bottom:16px;line-height:1.5;text-align:left}.carbon-container #carbonads .carbon-poweredby{display:block;padding:var(--spacing-quarter);background:#f1f1f2;text-align:center;text-transform:uppercase;letter-spacing:.5px;font-weight:600;font-size:8px;line-height:1;border-top-left-radius:3px;position:absolute;bottom:0;right:0} diff --git a/docs/assets/index.js b/docs/assets/index.js index ec71479d..4f3b476a 100644 --- a/docs/assets/index.js +++ b/docs/assets/index.js @@ -3,31 +3,31 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/home.js","asset * @vue/shared v3.5.17 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT -**//*! #__NO_SIDE_EFFECTS__ */function fn(t){const e=Object.create(null);for(const s of t.split(","))e[s]=1;return s=>s in e}const ie={},Ct=[],Ge=()=>{},tl=()=>!1,ws=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),hn=t=>t.startsWith("onUpdate:"),be=Object.assign,dn=(t,e)=>{const s=t.indexOf(e);s>-1&&t.splice(s,1)},sl=Object.prototype.hasOwnProperty,X=(t,e)=>sl.call(t,e),z=Array.isArray,_t=t=>As(t)==="[object Map]",Di=t=>As(t)==="[object Set]",G=t=>typeof t=="function",ce=t=>typeof t=="string",it=t=>typeof t=="symbol",le=t=>t!==null&&typeof t=="object",ki=t=>(le(t)||G(t))&&G(t.then)&&G(t.catch),Fi=Object.prototype.toString,As=t=>Fi.call(t),nl=t=>As(t).slice(8,-1),Ii=t=>As(t)==="[object Object]",pn=t=>ce(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,Bt=fn(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),xs=t=>{const e=Object.create(null);return s=>e[s]||(e[s]=t(s))},il=/-(\w)/g,Fe=xs(t=>t.replace(il,(e,s)=>s?s.toUpperCase():"")),rl=/\B([A-Z])/g,At=xs(t=>t.replace(rl,"-$1").toLowerCase()),Ss=xs(t=>t.charAt(0).toUpperCase()+t.slice(1)),ks=xs(t=>t?`on${Ss(t)}`:""),pt=(t,e)=>!Object.is(t,e),Fs=(t,...e)=>{for(let s=0;s{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:n,value:s})},ll=t=>{const e=parseFloat(t);return isNaN(e)?t:e};let Mn;const Es=()=>Mn||(Mn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function gn(t){if(z(t)){const e={};for(let s=0;s{if(s){const n=s.split(al);n.length>1&&(e[n[0].trim()]=n[1].trim())}}),e}function mn(t){let e="";if(ce(t))e=t;else if(z(t))for(let s=0;s!!(t&&t.__v_isRef===!0),Hi=t=>ce(t)?t:t==null?"":z(t)||le(t)&&(t.toString===Fi||!G(t.toString))?Ni(t)?Hi(t.value):JSON.stringify(t,Bi,2):String(t),Bi=(t,e)=>Ni(e)?Bi(t,e.value):_t(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((s,[n,i],r)=>(s[Is(n,r)+" =>"]=i,s),{})}:Di(e)?{[`Set(${e.size})`]:[...e.values()].map(s=>Is(s))}:it(e)?Is(e):le(e)&&!z(e)&&!Ii(e)?String(e):e,Is=(t,e="")=>{var s;return it(t)?`Symbol(${(s=t.description)!=null?s:e})`:t};/** +**//*! #__NO_SIDE_EFFECTS__ */function dn(t){const e=Object.create(null);for(const s of t.split(","))e[s]=1;return s=>s in e}const ie={},_t=[],qe=()=>{},nl=()=>!1,ws=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),pn=t=>t.startsWith("onUpdate:"),be=Object.assign,gn=(t,e)=>{const s=t.indexOf(e);s>-1&&t.splice(s,1)},il=Object.prototype.hasOwnProperty,X=(t,e)=>il.call(t,e),z=Array.isArray,Ot=t=>xs(t)==="[object Map]",Fi=t=>xs(t)==="[object Set]",G=t=>typeof t=="function",ce=t=>typeof t=="string",rt=t=>typeof t=="symbol",le=t=>t!==null&&typeof t=="object",Ii=t=>(le(t)||G(t))&&G(t.then)&&G(t.catch),Mi=Object.prototype.toString,xs=t=>Mi.call(t),rl=t=>xs(t).slice(8,-1),Ni=t=>xs(t)==="[object Object]",mn=t=>ce(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,Vt=dn(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Ss=t=>{const e=Object.create(null);return s=>e[s]||(e[s]=t(s))},ll=/-(\w)/g,Ie=Ss(t=>t.replace(ll,(e,s)=>s?s.toUpperCase():"")),ol=/\B([A-Z])/g,xt=Ss(t=>t.replace(ol,"-$1").toLowerCase()),Es=Ss(t=>t.charAt(0).toUpperCase()+t.slice(1)),Fs=Ss(t=>t?`on${Es(t)}`:""),gt=(t,e)=>!Object.is(t,e),Is=(t,...e)=>{for(let s=0;s{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:n,value:s})},al=t=>{const e=parseFloat(t);return isNaN(e)?t:e};let Bn;const Cs=()=>Bn||(Bn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function vn(t){if(z(t)){const e={};for(let s=0;s{if(s){const n=s.split(ul);n.length>1&&(e[n[0].trim()]=n[1].trim())}}),e}function bn(t){let e="";if(ce(t))e=t;else if(z(t))for(let s=0;s!!(t&&t.__v_isRef===!0),Vi=t=>ce(t)?t:t==null?"":z(t)||le(t)&&(t.toString===Mi||!G(t.toString))?Hi(t)?Vi(t.value):JSON.stringify(t,Ui,2):String(t),Ui=(t,e)=>Hi(e)?Ui(t,e.value):Ot(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((s,[n,i],r)=>(s[Ms(n,r)+" =>"]=i,s),{})}:Fi(e)?{[`Set(${e.size})`]:[...e.values()].map(s=>Ms(s))}:rt(e)?Ms(e):le(e)&&!z(e)&&!Ni(e)?String(e):e,Ms=(t,e="")=>{var s;return rt(t)?`Symbol(${(s=t.description)!=null?s:e})`:t};/** * @vue/reactivity v3.5.17 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT -**/let Oe;class dl{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=Oe,!e&&Oe&&(this.index=(Oe.scopes||(Oe.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,s;if(this.scopes)for(e=0,s=this.scopes.length;e0&&--this._on===0&&(Oe=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){this._active=!1;let s,n;for(s=0,n=this.effects.length;s0)return;if(Ut){let e=Ut;for(Ut=void 0;e;){const s=e.next;e.next=void 0,e.flags&=-9,e=s}}let t;for(;Vt;){let e=Vt;for(Vt=void 0;e;){const s=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(n){t||(t=n)}e=s}}if(t)throw t}function $i(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function zi(t){let e,s=t.depsTail,n=s;for(;n;){const i=n.prevDep;n.version===-1?(n===s&&(s=i),yn(n),gl(n)):e=n,n.dep.activeLink=n.prevActiveLink,n.prevActiveLink=void 0,n=i}t.deps=e,t.depsTail=s}function Qs(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(Wi(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function Wi(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===qt)||(t.globalVersion=qt,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!Qs(t))))return;t.flags|=2;const e=t.dep,s=ne,n=Ne;ne=t,Ne=!0;try{$i(t);const i=t.fn(t._value);(e.version===0||pt(i,t._value))&&(t.flags|=128,t._value=i,e.version++)}catch(i){throw e.version++,i}finally{ne=s,Ne=n,zi(t),t.flags&=-3}}function yn(t,e=!1){const{dep:s,prevSub:n,nextSub:i}=t;if(n&&(n.nextSub=i,t.prevSub=void 0),i&&(i.prevSub=n,t.nextSub=void 0),s.subs===t&&(s.subs=n,!n&&s.computed)){s.computed.flags&=-5;for(let r=s.computed.deps;r;r=r.nextDep)yn(r,!0)}!e&&!--s.sc&&s.map&&s.map.delete(s.key)}function gl(t){const{prevDep:e,nextDep:s}=t;e&&(e.nextDep=s,t.prevDep=void 0),s&&(s.prevDep=e,t.nextDep=void 0)}let Ne=!0;const Gi=[];function tt(){Gi.push(Ne),Ne=!1}function st(){const t=Gi.pop();Ne=t===void 0?!0:t}function Nn(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const s=ne;ne=void 0;try{e()}finally{ne=s}}}let qt=0;class ml{constructor(e,s){this.sub=e,this.dep=s,this.version=s.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class wn{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!ne||!Ne||ne===this.computed)return;let s=this.activeLink;if(s===void 0||s.sub!==ne)s=this.activeLink=new ml(ne,this),ne.deps?(s.prevDep=ne.depsTail,ne.depsTail.nextDep=s,ne.depsTail=s):ne.deps=ne.depsTail=s,Ki(s);else if(s.version===-1&&(s.version=this.version,s.nextDep)){const n=s.nextDep;n.prevDep=s.prevDep,s.prevDep&&(s.prevDep.nextDep=n),s.prevDep=ne.depsTail,s.nextDep=void 0,ne.depsTail.nextDep=s,ne.depsTail=s,ne.deps===s&&(ne.deps=n)}return s}trigger(e){this.version++,qt++,this.notify(e)}notify(e){vn();try{for(let s=this.subs;s;s=s.prevSub)s.sub.notify()&&s.sub.dep.notify()}finally{bn()}}}function Ki(t){if(t.dep.sc++,t.sub.flags&4){const e=t.dep.computed;if(e&&!t.dep.subs){e.flags|=20;for(let n=e.deps;n;n=n.nextDep)Ki(n)}const s=t.dep.subs;s!==t&&(t.prevSub=s,s&&(s.nextSub=t)),t.dep.subs=t}}const Js=new WeakMap,yt=Symbol(""),Zs=Symbol(""),Yt=Symbol("");function ge(t,e,s){if(Ne&&ne){let n=Js.get(t);n||Js.set(t,n=new Map);let i=n.get(s);i||(n.set(s,i=new wn),i.map=n,i.key=s),i.track()}}function Xe(t,e,s,n,i,r){const o=Js.get(t);if(!o){qt++;return}const l=a=>{a&&a.trigger()};if(vn(),e==="clear")o.forEach(l);else{const a=z(t),u=a&&pn(s);if(a&&s==="length"){const c=Number(n);o.forEach((f,p)=>{(p==="length"||p===Yt||!it(p)&&p>=c)&&l(f)})}else switch((s!==void 0||o.has(void 0))&&l(o.get(s)),u&&l(o.get(Yt)),e){case"add":a?u&&l(o.get("length")):(l(o.get(yt)),_t(t)&&l(o.get(Zs)));break;case"delete":a||(l(o.get(yt)),_t(t)&&l(o.get(Zs)));break;case"set":_t(t)&&l(o.get(yt));break}}bn()}function xt(t){const e=Z(t);return e===t?e:(ge(e,"iterate",Yt),ke(t)?e:e.map(he))}function Cs(t){return ge(t=Z(t),"iterate",Yt),t}const vl={__proto__:null,[Symbol.iterator](){return Ns(this,Symbol.iterator,he)},concat(...t){return xt(this).concat(...t.map(e=>z(e)?xt(e):e))},entries(){return Ns(this,"entries",t=>(t[1]=he(t[1]),t))},every(t,e){return qe(this,"every",t,e,void 0,arguments)},filter(t,e){return qe(this,"filter",t,e,s=>s.map(he),arguments)},find(t,e){return qe(this,"find",t,e,he,arguments)},findIndex(t,e){return qe(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return qe(this,"findLast",t,e,he,arguments)},findLastIndex(t,e){return qe(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return qe(this,"forEach",t,e,void 0,arguments)},includes(...t){return Hs(this,"includes",t)},indexOf(...t){return Hs(this,"indexOf",t)},join(t){return xt(this).join(t)},lastIndexOf(...t){return Hs(this,"lastIndexOf",t)},map(t,e){return qe(this,"map",t,e,void 0,arguments)},pop(){return It(this,"pop")},push(...t){return It(this,"push",t)},reduce(t,...e){return Hn(this,"reduce",t,e)},reduceRight(t,...e){return Hn(this,"reduceRight",t,e)},shift(){return It(this,"shift")},some(t,e){return qe(this,"some",t,e,void 0,arguments)},splice(...t){return It(this,"splice",t)},toReversed(){return xt(this).toReversed()},toSorted(t){return xt(this).toSorted(t)},toSpliced(...t){return xt(this).toSpliced(...t)},unshift(...t){return It(this,"unshift",t)},values(){return Ns(this,"values",he)}};function Ns(t,e,s){const n=Cs(t),i=n[e]();return n!==t&&!ke(t)&&(i._next=i.next,i.next=()=>{const r=i._next();return r.value&&(r.value=s(r.value)),r}),i}const bl=Array.prototype;function qe(t,e,s,n,i,r){const o=Cs(t),l=o!==t&&!ke(t),a=o[e];if(a!==bl[e]){const f=a.apply(t,r);return l?he(f):f}let u=s;o!==t&&(l?u=function(f,p){return s.call(this,he(f),p,t)}:s.length>2&&(u=function(f,p){return s.call(this,f,p,t)}));const c=a.call(o,u,n);return l&&i?i(c):c}function Hn(t,e,s,n){const i=Cs(t);let r=s;return i!==t&&(ke(t)?s.length>3&&(r=function(o,l,a){return s.call(this,o,l,a,t)}):r=function(o,l,a){return s.call(this,o,he(l),a,t)}),i[e](r,...n)}function Hs(t,e,s){const n=Z(t);ge(n,"iterate",Yt);const i=n[e](...s);return(i===-1||i===!1)&&Sn(s[0])?(s[0]=Z(s[0]),n[e](...s)):i}function It(t,e,s=[]){tt(),vn();const n=Z(t)[e].apply(t,s);return bn(),st(),n}const yl=fn("__proto__,__v_isRef,__isVue"),qi=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(it));function wl(t){it(t)||(t=String(t));const e=Z(this);return ge(e,"has",t),e.hasOwnProperty(t)}class Yi{constructor(e=!1,s=!1){this._isReadonly=e,this._isShallow=s}get(e,s,n){if(s==="__v_skip")return e.__v_skip;const i=this._isReadonly,r=this._isShallow;if(s==="__v_isReactive")return!i;if(s==="__v_isReadonly")return i;if(s==="__v_isShallow")return r;if(s==="__v_raw")return n===(i?r?Pl:Xi:r?Zi:Ji).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const o=z(e);if(!i){let a;if(o&&(a=vl[s]))return a;if(s==="hasOwnProperty")return wl}const l=Reflect.get(e,s,ve(e)?e:n);return(it(s)?qi.has(s):yl(s))||(i||ge(e,"get",s),r)?l:ve(l)?o&&pn(s)?l:l.value:le(l)?i?tr(l):_s(l):l}}class Qi extends Yi{constructor(e=!1){super(!1,e)}set(e,s,n,i){let r=e[s];if(!this._isShallow){const a=gt(r);if(!ke(n)&&!gt(n)&&(r=Z(r),n=Z(n)),!z(e)&&ve(r)&&!ve(n))return a?!1:(r.value=n,!0)}const o=z(e)&&pn(s)?Number(s)t,rs=t=>Reflect.getPrototypeOf(t);function Cl(t,e,s){return function(...n){const i=this.__v_raw,r=Z(i),o=_t(r),l=t==="entries"||t===Symbol.iterator&&o,a=t==="keys"&&o,u=i[t](...n),c=s?Xs:e?ps:he;return!e&&ge(r,"iterate",a?Zs:yt),{next(){const{value:f,done:p}=u.next();return p?{value:f,done:p}:{value:l?[c(f[0]),c(f[1])]:c(f),done:p}},[Symbol.iterator](){return this}}}}function ls(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function _l(t,e){const s={get(i){const r=this.__v_raw,o=Z(r),l=Z(i);t||(pt(i,l)&&ge(o,"get",i),ge(o,"get",l));const{has:a}=rs(o),u=e?Xs:t?ps:he;if(a.call(o,i))return u(r.get(i));if(a.call(o,l))return u(r.get(l));r!==o&&r.get(i)},get size(){const i=this.__v_raw;return!t&&ge(Z(i),"iterate",yt),Reflect.get(i,"size",i)},has(i){const r=this.__v_raw,o=Z(r),l=Z(i);return t||(pt(i,l)&&ge(o,"has",i),ge(o,"has",l)),i===l?r.has(i):r.has(i)||r.has(l)},forEach(i,r){const o=this,l=o.__v_raw,a=Z(l),u=e?Xs:t?ps:he;return!t&&ge(a,"iterate",yt),l.forEach((c,f)=>i.call(r,u(c),u(f),o))}};return be(s,t?{add:ls("add"),set:ls("set"),delete:ls("delete"),clear:ls("clear")}:{add(i){!e&&!ke(i)&&!gt(i)&&(i=Z(i));const r=Z(this);return rs(r).has.call(r,i)||(r.add(i),Xe(r,"add",i,i)),this},set(i,r){!e&&!ke(r)&&!gt(r)&&(r=Z(r));const o=Z(this),{has:l,get:a}=rs(o);let u=l.call(o,i);u||(i=Z(i),u=l.call(o,i));const c=a.call(o,i);return o.set(i,r),u?pt(r,c)&&Xe(o,"set",i,r):Xe(o,"add",i,r),this},delete(i){const r=Z(this),{has:o,get:l}=rs(r);let a=o.call(r,i);a||(i=Z(i),a=o.call(r,i)),l&&l.call(r,i);const u=r.delete(i);return a&&Xe(r,"delete",i,void 0),u},clear(){const i=Z(this),r=i.size!==0,o=i.clear();return r&&Xe(i,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(i=>{s[i]=Cl(i,t,e)}),s}function An(t,e){const s=_l(t,e);return(n,i,r)=>i==="__v_isReactive"?!t:i==="__v_isReadonly"?t:i==="__v_raw"?n:Reflect.get(X(s,i)&&i in n?s:n,i,r)}const Ol={get:An(!1,!1)},Tl={get:An(!1,!0)},Ll={get:An(!0,!1)};const Ji=new WeakMap,Zi=new WeakMap,Xi=new WeakMap,Pl=new WeakMap;function Rl(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Dl(t){return t.__v_skip||!Object.isExtensible(t)?0:Rl(nl(t))}function _s(t){return gt(t)?t:xn(t,!1,xl,Ol,Ji)}function er(t){return xn(t,!1,El,Tl,Zi)}function tr(t){return xn(t,!0,Sl,Ll,Xi)}function xn(t,e,s,n,i){if(!le(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const r=Dl(t);if(r===0)return t;const o=i.get(t);if(o)return o;const l=new Proxy(t,r===2?n:s);return i.set(t,l),l}function Ot(t){return gt(t)?Ot(t.__v_raw):!!(t&&t.__v_isReactive)}function gt(t){return!!(t&&t.__v_isReadonly)}function ke(t){return!!(t&&t.__v_isShallow)}function Sn(t){return t?!!t.__v_raw:!1}function Z(t){const e=t&&t.__v_raw;return e?Z(e):t}function kl(t){return!X(t,"__v_skip")&&Object.isExtensible(t)&&Ys(t,"__v_skip",!0),t}const he=t=>le(t)?_s(t):t,ps=t=>le(t)?tr(t):t;function ve(t){return t?t.__v_isRef===!0:!1}function sr(t){return nr(t,!1)}function Fl(t){return nr(t,!0)}function nr(t,e){return ve(t)?t:new Il(t,e)}class Il{constructor(e,s){this.dep=new wn,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=s?e:Z(e),this._value=s?e:he(e),this.__v_isShallow=s}get value(){return this.dep.track(),this._value}set value(e){const s=this._rawValue,n=this.__v_isShallow||ke(e)||gt(e);e=n?e:Z(e),pt(e,s)&&(this._rawValue=e,this._value=n?e:he(e),this.dep.trigger())}}function wt(t){return ve(t)?t.value:t}const Ml={get:(t,e,s)=>e==="__v_raw"?t:wt(Reflect.get(t,e,s)),set:(t,e,s,n)=>{const i=t[e];return ve(i)&&!ve(s)?(i.value=s,!0):Reflect.set(t,e,s,n)}};function ir(t){return Ot(t)?t:new Proxy(t,Ml)}class Nl{constructor(e,s,n){this.fn=e,this.setter=s,this._value=void 0,this.dep=new wn(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=qt-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!s,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&ne!==this)return ji(this,!0),!0}get value(){const e=this.dep.track();return Wi(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function Hl(t,e,s=!1){let n,i;return G(t)?n=t:(n=t.get,i=t.set),new Nl(n,i,s)}const os={},gs=new WeakMap;let bt;function Bl(t,e=!1,s=bt){if(s){let n=gs.get(s);n||gs.set(s,n=[]),n.push(t)}}function Vl(t,e,s=ie){const{immediate:n,deep:i,once:r,scheduler:o,augmentJob:l,call:a}=s,u=y=>i?y:ke(y)||i===!1||i===0?dt(y,1):dt(y);let c,f,p,g,T=!1,C=!1;if(ve(t)?(f=()=>t.value,T=ke(t)):Ot(t)?(f=()=>u(t),T=!0):z(t)?(C=!0,T=t.some(y=>Ot(y)||ke(y)),f=()=>t.map(y=>{if(ve(y))return y.value;if(Ot(y))return u(y);if(G(y))return a?a(y,2):y()})):G(t)?e?f=a?()=>a(t,2):t:f=()=>{if(p){tt();try{p()}finally{st()}}const y=bt;bt=c;try{return a?a(t,3,[g]):t(g)}finally{bt=y}}:f=Ge,e&&i){const y=f,E=i===!0?1/0:i;f=()=>dt(y(),E)}const D=pl(),L=()=>{c.stop(),D&&D.active&&dn(D.effects,c)};if(r&&e){const y=e;e=(...E)=>{y(...E),L()}}let m=C?new Array(t.length).fill(os):os;const b=y=>{if(!(!(c.flags&1)||!c.dirty&&!y))if(e){const E=c.run();if(i||T||(C?E.some((O,F)=>pt(O,m[F])):pt(E,m))){p&&p();const O=bt;bt=c;try{const F=[E,m===os?void 0:C&&m[0]===os?[]:m,g];m=E,a?a(e,3,F):e(...F)}finally{bt=O}}}else c.run()};return l&&l(b),c=new Vi(f),c.scheduler=o?()=>o(b,!1):b,g=y=>Bl(y,!1,c),p=c.onStop=()=>{const y=gs.get(c);if(y){if(a)a(y,4);else for(const E of y)E();gs.delete(c)}},e?n?b(!0):m=c.run():o?o(b.bind(null,!0),!0):c.run(),L.pause=c.pause.bind(c),L.resume=c.resume.bind(c),L.stop=L,L}function dt(t,e=1/0,s){if(e<=0||!le(t)||t.__v_skip||(s=s||new Set,s.has(t)))return t;if(s.add(t),e--,ve(t))dt(t.value,e,s);else if(z(t))for(let n=0;n{dt(n,e,s)});else if(Ii(t)){for(const n in t)dt(t[n],e,s);for(const n of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,n)&&dt(t[n],e,s)}return t}/** +**/let Oe;class gl{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=Oe,!e&&Oe&&(this.index=(Oe.scopes||(Oe.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,s;if(this.scopes)for(e=0,s=this.scopes.length;e0&&--this._on===0&&(Oe=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){this._active=!1;let s,n;for(s=0,n=this.effects.length;s0)return;if($t){let e=$t;for($t=void 0;e;){const s=e.next;e.next=void 0,e.flags&=-9,e=s}}let t;for(;Ut;){let e=Ut;for(Ut=void 0;e;){const s=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(n){t||(t=n)}e=s}}if(t)throw t}function Wi(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function Gi(t){let e,s=t.depsTail,n=s;for(;n;){const i=n.prevDep;n.version===-1?(n===s&&(s=i),wn(n),vl(n)):e=n,n.dep.activeLink=n.prevActiveLink,n.prevActiveLink=void 0,n=i}t.deps=e,t.depsTail=s}function Js(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(qi(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function qi(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===Yt)||(t.globalVersion=Yt,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!Js(t))))return;t.flags|=2;const e=t.dep,s=ne,n=Be;ne=t,Be=!0;try{Wi(t);const i=t.fn(t._value);(e.version===0||gt(i,t._value))&&(t.flags|=128,t._value=i,e.version++)}catch(i){throw e.version++,i}finally{ne=s,Be=n,Gi(t),t.flags&=-3}}function wn(t,e=!1){const{dep:s,prevSub:n,nextSub:i}=t;if(n&&(n.nextSub=i,t.prevSub=void 0),i&&(i.prevSub=n,t.nextSub=void 0),s.subs===t&&(s.subs=n,!n&&s.computed)){s.computed.flags&=-5;for(let r=s.computed.deps;r;r=r.nextDep)wn(r,!0)}!e&&!--s.sc&&s.map&&s.map.delete(s.key)}function vl(t){const{prevDep:e,nextDep:s}=t;e&&(e.nextDep=s,t.prevDep=void 0),s&&(s.prevDep=e,t.nextDep=void 0)}let Be=!0;const Ki=[];function st(){Ki.push(Be),Be=!1}function nt(){const t=Ki.pop();Be=t===void 0?!0:t}function Hn(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const s=ne;ne=void 0;try{e()}finally{ne=s}}}let Yt=0;class bl{constructor(e,s){this.sub=e,this.dep=s,this.version=s.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class xn{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!ne||!Be||ne===this.computed)return;let s=this.activeLink;if(s===void 0||s.sub!==ne)s=this.activeLink=new bl(ne,this),ne.deps?(s.prevDep=ne.depsTail,ne.depsTail.nextDep=s,ne.depsTail=s):ne.deps=ne.depsTail=s,Yi(s);else if(s.version===-1&&(s.version=this.version,s.nextDep)){const n=s.nextDep;n.prevDep=s.prevDep,s.prevDep&&(s.prevDep.nextDep=n),s.prevDep=ne.depsTail,s.nextDep=void 0,ne.depsTail.nextDep=s,ne.depsTail=s,ne.deps===s&&(ne.deps=n)}return s}trigger(e){this.version++,Yt++,this.notify(e)}notify(e){yn();try{for(let s=this.subs;s;s=s.prevSub)s.sub.notify()&&s.sub.dep.notify()}finally{An()}}}function Yi(t){if(t.dep.sc++,t.sub.flags&4){const e=t.dep.computed;if(e&&!t.dep.subs){e.flags|=20;for(let n=e.deps;n;n=n.nextDep)Yi(n)}const s=t.dep.subs;s!==t&&(t.prevSub=s,s&&(s.nextSub=t)),t.dep.subs=t}}const Zs=new WeakMap,At=Symbol(""),Xs=Symbol(""),Qt=Symbol("");function ge(t,e,s){if(Be&&ne){let n=Zs.get(t);n||Zs.set(t,n=new Map);let i=n.get(s);i||(n.set(s,i=new xn),i.map=n,i.key=s),i.track()}}function et(t,e,s,n,i,r){const o=Zs.get(t);if(!o){Yt++;return}const l=a=>{a&&a.trigger()};if(yn(),e==="clear")o.forEach(l);else{const a=z(t),u=a&&mn(s);if(a&&s==="length"){const c=Number(n);o.forEach((f,p)=>{(p==="length"||p===Qt||!rt(p)&&p>=c)&&l(f)})}else switch((s!==void 0||o.has(void 0))&&l(o.get(s)),u&&l(o.get(Qt)),e){case"add":a?u&&l(o.get("length")):(l(o.get(At)),Ot(t)&&l(o.get(Xs)));break;case"delete":a||(l(o.get(At)),Ot(t)&&l(o.get(Xs)));break;case"set":Ot(t)&&l(o.get(At));break}}An()}function St(t){const e=Z(t);return e===t?e:(ge(e,"iterate",Qt),Fe(t)?e:e.map(he))}function _s(t){return ge(t=Z(t),"iterate",Qt),t}const yl={__proto__:null,[Symbol.iterator](){return Bs(this,Symbol.iterator,he)},concat(...t){return St(this).concat(...t.map(e=>z(e)?St(e):e))},entries(){return Bs(this,"entries",t=>(t[1]=he(t[1]),t))},every(t,e){return Ye(this,"every",t,e,void 0,arguments)},filter(t,e){return Ye(this,"filter",t,e,s=>s.map(he),arguments)},find(t,e){return Ye(this,"find",t,e,he,arguments)},findIndex(t,e){return Ye(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return Ye(this,"findLast",t,e,he,arguments)},findLastIndex(t,e){return Ye(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return Ye(this,"forEach",t,e,void 0,arguments)},includes(...t){return Hs(this,"includes",t)},indexOf(...t){return Hs(this,"indexOf",t)},join(t){return St(this).join(t)},lastIndexOf(...t){return Hs(this,"lastIndexOf",t)},map(t,e){return Ye(this,"map",t,e,void 0,arguments)},pop(){return Mt(this,"pop")},push(...t){return Mt(this,"push",t)},reduce(t,...e){return Vn(this,"reduce",t,e)},reduceRight(t,...e){return Vn(this,"reduceRight",t,e)},shift(){return Mt(this,"shift")},some(t,e){return Ye(this,"some",t,e,void 0,arguments)},splice(...t){return Mt(this,"splice",t)},toReversed(){return St(this).toReversed()},toSorted(t){return St(this).toSorted(t)},toSpliced(...t){return St(this).toSpliced(...t)},unshift(...t){return Mt(this,"unshift",t)},values(){return Bs(this,"values",he)}};function Bs(t,e,s){const n=_s(t),i=n[e]();return n!==t&&!Fe(t)&&(i._next=i.next,i.next=()=>{const r=i._next();return r.value&&(r.value=s(r.value)),r}),i}const Al=Array.prototype;function Ye(t,e,s,n,i,r){const o=_s(t),l=o!==t&&!Fe(t),a=o[e];if(a!==Al[e]){const f=a.apply(t,r);return l?he(f):f}let u=s;o!==t&&(l?u=function(f,p){return s.call(this,he(f),p,t)}:s.length>2&&(u=function(f,p){return s.call(this,f,p,t)}));const c=a.call(o,u,n);return l&&i?i(c):c}function Vn(t,e,s,n){const i=_s(t);let r=s;return i!==t&&(Fe(t)?s.length>3&&(r=function(o,l,a){return s.call(this,o,l,a,t)}):r=function(o,l,a){return s.call(this,o,he(l),a,t)}),i[e](r,...n)}function Hs(t,e,s){const n=Z(t);ge(n,"iterate",Qt);const i=n[e](...s);return(i===-1||i===!1)&&Cn(s[0])?(s[0]=Z(s[0]),n[e](...s)):i}function Mt(t,e,s=[]){st(),yn();const n=Z(t)[e].apply(t,s);return An(),nt(),n}const wl=dn("__proto__,__v_isRef,__isVue"),Qi=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(rt));function xl(t){rt(t)||(t=String(t));const e=Z(this);return ge(e,"has",t),e.hasOwnProperty(t)}class Ji{constructor(e=!1,s=!1){this._isReadonly=e,this._isShallow=s}get(e,s,n){if(s==="__v_skip")return e.__v_skip;const i=this._isReadonly,r=this._isShallow;if(s==="__v_isReactive")return!i;if(s==="__v_isReadonly")return i;if(s==="__v_isShallow")return r;if(s==="__v_raw")return n===(i?r?Dl:tr:r?er:Xi).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const o=z(e);if(!i){let a;if(o&&(a=yl[s]))return a;if(s==="hasOwnProperty")return xl}const l=Reflect.get(e,s,ve(e)?e:n);return(rt(s)?Qi.has(s):wl(s))||(i||ge(e,"get",s),r)?l:ve(l)?o&&mn(s)?l:l.value:le(l)?i?nr(l):Os(l):l}}class Zi extends Ji{constructor(e=!1){super(!1,e)}set(e,s,n,i){let r=e[s];if(!this._isShallow){const a=mt(r);if(!Fe(n)&&!mt(n)&&(r=Z(r),n=Z(n)),!z(e)&&ve(r)&&!ve(n))return a?!1:(r.value=n,!0)}const o=z(e)&&mn(s)?Number(s)t,ls=t=>Reflect.getPrototypeOf(t);function Ol(t,e,s){return function(...n){const i=this.__v_raw,r=Z(i),o=Ot(r),l=t==="entries"||t===Symbol.iterator&&o,a=t==="keys"&&o,u=i[t](...n),c=s?en:e?gs:he;return!e&&ge(r,"iterate",a?Xs:At),{next(){const{value:f,done:p}=u.next();return p?{value:f,done:p}:{value:l?[c(f[0]),c(f[1])]:c(f),done:p}},[Symbol.iterator](){return this}}}}function os(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function Ll(t,e){const s={get(i){const r=this.__v_raw,o=Z(r),l=Z(i);t||(gt(i,l)&&ge(o,"get",i),ge(o,"get",l));const{has:a}=ls(o),u=e?en:t?gs:he;if(a.call(o,i))return u(r.get(i));if(a.call(o,l))return u(r.get(l));r!==o&&r.get(i)},get size(){const i=this.__v_raw;return!t&&ge(Z(i),"iterate",At),Reflect.get(i,"size",i)},has(i){const r=this.__v_raw,o=Z(r),l=Z(i);return t||(gt(i,l)&&ge(o,"has",i),ge(o,"has",l)),i===l?r.has(i):r.has(i)||r.has(l)},forEach(i,r){const o=this,l=o.__v_raw,a=Z(l),u=e?en:t?gs:he;return!t&&ge(a,"iterate",At),l.forEach((c,f)=>i.call(r,u(c),u(f),o))}};return be(s,t?{add:os("add"),set:os("set"),delete:os("delete"),clear:os("clear")}:{add(i){!e&&!Fe(i)&&!mt(i)&&(i=Z(i));const r=Z(this);return ls(r).has.call(r,i)||(r.add(i),et(r,"add",i,i)),this},set(i,r){!e&&!Fe(r)&&!mt(r)&&(r=Z(r));const o=Z(this),{has:l,get:a}=ls(o);let u=l.call(o,i);u||(i=Z(i),u=l.call(o,i));const c=a.call(o,i);return o.set(i,r),u?gt(r,c)&&et(o,"set",i,r):et(o,"add",i,r),this},delete(i){const r=Z(this),{has:o,get:l}=ls(r);let a=o.call(r,i);a||(i=Z(i),a=o.call(r,i)),l&&l.call(r,i);const u=r.delete(i);return a&&et(r,"delete",i,void 0),u},clear(){const i=Z(this),r=i.size!==0,o=i.clear();return r&&et(i,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(i=>{s[i]=Ol(i,t,e)}),s}function Sn(t,e){const s=Ll(t,e);return(n,i,r)=>i==="__v_isReactive"?!t:i==="__v_isReadonly"?t:i==="__v_raw"?n:Reflect.get(X(s,i)&&i in n?s:n,i,r)}const Tl={get:Sn(!1,!1)},Pl={get:Sn(!1,!0)},Rl={get:Sn(!0,!1)};const Xi=new WeakMap,er=new WeakMap,tr=new WeakMap,Dl=new WeakMap;function kl(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Fl(t){return t.__v_skip||!Object.isExtensible(t)?0:kl(rl(t))}function Os(t){return mt(t)?t:En(t,!1,El,Tl,Xi)}function sr(t){return En(t,!1,_l,Pl,er)}function nr(t){return En(t,!0,Cl,Rl,tr)}function En(t,e,s,n,i){if(!le(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const r=Fl(t);if(r===0)return t;const o=i.get(t);if(o)return o;const l=new Proxy(t,r===2?n:s);return i.set(t,l),l}function Lt(t){return mt(t)?Lt(t.__v_raw):!!(t&&t.__v_isReactive)}function mt(t){return!!(t&&t.__v_isReadonly)}function Fe(t){return!!(t&&t.__v_isShallow)}function Cn(t){return t?!!t.__v_raw:!1}function Z(t){const e=t&&t.__v_raw;return e?Z(e):t}function Il(t){return!X(t,"__v_skip")&&Object.isExtensible(t)&&Qs(t,"__v_skip",!0),t}const he=t=>le(t)?Os(t):t,gs=t=>le(t)?nr(t):t;function ve(t){return t?t.__v_isRef===!0:!1}function ir(t){return rr(t,!1)}function Ml(t){return rr(t,!0)}function rr(t,e){return ve(t)?t:new Nl(t,e)}class Nl{constructor(e,s){this.dep=new xn,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=s?e:Z(e),this._value=s?e:he(e),this.__v_isShallow=s}get value(){return this.dep.track(),this._value}set value(e){const s=this._rawValue,n=this.__v_isShallow||Fe(e)||mt(e);e=n?e:Z(e),gt(e,s)&&(this._rawValue=e,this._value=n?e:he(e),this.dep.trigger())}}function wt(t){return ve(t)?t.value:t}const Bl={get:(t,e,s)=>e==="__v_raw"?t:wt(Reflect.get(t,e,s)),set:(t,e,s,n)=>{const i=t[e];return ve(i)&&!ve(s)?(i.value=s,!0):Reflect.set(t,e,s,n)}};function lr(t){return Lt(t)?t:new Proxy(t,Bl)}class Hl{constructor(e,s,n){this.fn=e,this.setter=s,this._value=void 0,this.dep=new xn(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Yt-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!s,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&ne!==this)return zi(this,!0),!0}get value(){const e=this.dep.track();return qi(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function Vl(t,e,s=!1){let n,i;return G(t)?n=t:(n=t.get,i=t.set),new Hl(n,i,s)}const as={},ms=new WeakMap;let yt;function Ul(t,e=!1,s=yt){if(s){let n=ms.get(s);n||ms.set(s,n=[]),n.push(t)}}function $l(t,e,s=ie){const{immediate:n,deep:i,once:r,scheduler:o,augmentJob:l,call:a}=s,u=y=>i?y:Fe(y)||i===!1||i===0?pt(y,1):pt(y);let c,f,p,g,C=!1,_=!1;if(ve(t)?(f=()=>t.value,C=Fe(t)):Lt(t)?(f=()=>u(t),C=!0):z(t)?(_=!0,C=t.some(y=>Lt(y)||Fe(y)),f=()=>t.map(y=>{if(ve(y))return y.value;if(Lt(y))return u(y);if(G(y))return a?a(y,2):y()})):G(t)?e?f=a?()=>a(t,2):t:f=()=>{if(p){st();try{p()}finally{nt()}}const y=yt;yt=c;try{return a?a(t,3,[g]):t(g)}finally{yt=y}}:f=qe,e&&i){const y=f,E=i===!0?1/0:i;f=()=>pt(y(),E)}const D=ml(),T=()=>{c.stop(),D&&D.active&&gn(D.effects,c)};if(r&&e){const y=e;e=(...E)=>{y(...E),T()}}let m=_?new Array(t.length).fill(as):as;const v=y=>{if(!(!(c.flags&1)||!c.dirty&&!y))if(e){const E=c.run();if(i||C||(_?E.some((L,F)=>gt(L,m[F])):gt(E,m))){p&&p();const L=yt;yt=c;try{const F=[E,m===as?void 0:_&&m[0]===as?[]:m,g];m=E,a?a(e,3,F):e(...F)}finally{yt=L}}}else c.run()};return l&&l(v),c=new $i(f),c.scheduler=o?()=>o(v,!1):v,g=y=>Ul(y,!1,c),p=c.onStop=()=>{const y=ms.get(c);if(y){if(a)a(y,4);else for(const E of y)E();ms.delete(c)}},e?n?v(!0):m=c.run():o?o(v.bind(null,!0),!0):c.run(),T.pause=c.pause.bind(c),T.resume=c.resume.bind(c),T.stop=T,T}function pt(t,e=1/0,s){if(e<=0||!le(t)||t.__v_skip||(s=s||new Set,s.has(t)))return t;if(s.add(t),e--,ve(t))pt(t.value,e,s);else if(z(t))for(let n=0;n{pt(n,e,s)});else if(Ni(t)){for(const n in t)pt(t[n],e,s);for(const n of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,n)&&pt(t[n],e,s)}return t}/** * @vue/runtime-core v3.5.17 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT -**/function ns(t,e,s,n){try{return n?t(...n):t()}catch(i){Os(i,e,s)}}function Ke(t,e,s,n){if(G(t)){const i=ns(t,e,s,n);return i&&ki(i)&&i.catch(r=>{Os(r,e,s)}),i}if(z(t)){const i=[];for(let r=0;r>>1,i=Se[n],r=Qt(i);r=Qt(s)?Se.push(t):Se.splice(jl(e),0,t),t.flags|=1,or()}}function or(){ms||(ms=rr.then(cr))}function $l(t){z(t)?Tt.push(...t):ut&&t.id===-1?ut.splice(St+1,0,t):t.flags&1||(Tt.push(t),t.flags|=1),or()}function Bn(t,e,s=ze+1){for(;sQt(s)-Qt(n));if(Tt.length=0,ut){ut.push(...e);return}for(ut=e,St=0;Stt.id==null?t.flags&2?-1:1/0:t.id;function cr(t){try{for(ze=0;ze{n._d&&Qn(-1);const r=vs(e);let o;try{o=t(...i)}finally{vs(r),n._d&&Qn(1)}return o};return n._n=!0,n._c=!0,n._d=!0,n}function mt(t,e,s,n){const i=t.dirs,r=e&&e.dirs;for(let o=0;ot.__isTeleport;function Cn(t,e){t.shapeFlag&6&&t.component?(t.transition=e,Cn(t.component.subTree,e)):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}/*! #__NO_SIDE_EFFECTS__ */function Ts(t,e){return G(t)?be({name:t.name},e,{setup:t}):t}function fr(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function jt(t,e,s,n,i=!1){if(z(t)){t.forEach((T,C)=>jt(T,e&&(z(e)?e[C]:e),s,n,i));return}if(Lt(n)&&!i){n.shapeFlag&512&&n.type.__asyncResolved&&n.component.subTree.component&&jt(t,e,s,n.component.subTree);return}const r=n.shapeFlag&4?Ln(n.component):n.el,o=i?null:r,{i:l,r:a}=t,u=e&&e.r,c=l.refs===ie?l.refs={}:l.refs,f=l.setupState,p=Z(f),g=f===ie?()=>!1:T=>X(p,T);if(u!=null&&u!==a&&(ce(u)?(c[u]=null,g(u)&&(f[u]=null)):ve(u)&&(u.value=null)),G(a))ns(a,l,12,[o,c]);else{const T=ce(a),C=ve(a);if(T||C){const D=()=>{if(t.f){const L=T?g(a)?f[a]:c[a]:a.value;i?z(L)&&dn(L,r):z(L)?L.includes(r)||L.push(r):T?(c[a]=[r],g(a)&&(f[a]=c[a])):(a.value=[r],t.k&&(c[t.k]=a.value))}else T?(c[a]=o,g(a)&&(f[a]=o)):C&&(a.value=o,t.k&&(c[t.k]=o))};o?(D.id=-1,Pe(D,s)):D()}}}Es().requestIdleCallback;Es().cancelIdleCallback;const Lt=t=>!!t.type.__asyncLoader,hr=t=>t.type.__isKeepAlive;function Kl(t,e){dr(t,"a",e)}function ql(t,e){dr(t,"da",e)}function dr(t,e,s=me){const n=t.__wdc||(t.__wdc=()=>{let i=s;for(;i;){if(i.isDeactivated)return;i=i.parent}return t()});if(Ls(e,n,s),s){let i=s.parent;for(;i&&i.parent;)hr(i.parent.vnode)&&Yl(n,e,s,i),i=i.parent}}function Yl(t,e,s,n){const i=Ls(e,t,n,!0);gr(()=>{dn(n[e],i)},s)}function Ls(t,e,s=me,n=!1){if(s){const i=s[t]||(s[t]=[]),r=e.__weh||(e.__weh=(...o)=>{tt();const l=is(s),a=Ke(e,s,t,o);return l(),st(),a});return n?i.unshift(r):i.push(r),r}}const rt=t=>(e,s=me)=>{(!es||t==="sp")&&Ls(t,(...n)=>e(...n),s)},Ql=rt("bm"),pr=rt("m"),Jl=rt("bu"),Zl=rt("u"),Xl=rt("bum"),gr=rt("um"),eo=rt("sp"),to=rt("rtg"),so=rt("rtc");function no(t,e=me){Ls("ec",t,e)}const io="components";function Vn(t,e){return lo(io,t,!0,e)||t}const ro=Symbol.for("v-ndc");function lo(t,e,s=!0,n=!1){const i=Ee||me;if(i){const r=i.type;{const l=Yo(r,!1);if(l&&(l===e||l===Fe(e)||l===Ss(Fe(e))))return r}const o=Un(i[t]||r[t],e)||Un(i.appContext[t],e);return!o&&n?r:o}}function Un(t,e){return t&&(t[e]||t[Fe(e)]||t[Ss(Fe(e))])}function eu(t,e,s,n){let i;const r=s,o=z(t);if(o||ce(t)){const l=o&&Ot(t);let a=!1,u=!1;l&&(a=!ke(t),u=gt(t),t=Cs(t)),i=new Array(t.length);for(let c=0,f=t.length;ce(l,a,void 0,r));else{const l=Object.keys(t);i=new Array(l.length);for(let a=0,u=l.length;aXt(e)?!(e.type===nt||e.type===Re&&!mr(e.children)):!0)?t:null}const en=t=>t?Nr(t)?Ln(t):en(t.parent):null,$t=be(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>en(t.parent),$root:t=>en(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>br(t),$forceUpdate:t=>t.f||(t.f=()=>{En(t.update)}),$nextTick:t=>t.n||(t.n=lr.bind(t.proxy)),$watch:t=>To.bind(t)}),Bs=(t,e)=>t!==ie&&!t.__isScriptSetup&&X(t,e),oo={get({_:t},e){if(e==="__v_skip")return!0;const{ctx:s,setupState:n,data:i,props:r,accessCache:o,type:l,appContext:a}=t;let u;if(e[0]!=="$"){const g=o[e];if(g!==void 0)switch(g){case 1:return n[e];case 2:return i[e];case 4:return s[e];case 3:return r[e]}else{if(Bs(n,e))return o[e]=1,n[e];if(i!==ie&&X(i,e))return o[e]=2,i[e];if((u=t.propsOptions[0])&&X(u,e))return o[e]=3,r[e];if(s!==ie&&X(s,e))return o[e]=4,s[e];tn&&(o[e]=0)}}const c=$t[e];let f,p;if(c)return e==="$attrs"&&ge(t.attrs,"get",""),c(t);if((f=l.__cssModules)&&(f=f[e]))return f;if(s!==ie&&X(s,e))return o[e]=4,s[e];if(p=a.config.globalProperties,X(p,e))return p[e]},set({_:t},e,s){const{data:n,setupState:i,ctx:r}=t;return Bs(i,e)?(i[e]=s,!0):n!==ie&&X(n,e)?(n[e]=s,!0):X(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(r[e]=s,!0)},has({_:{data:t,setupState:e,accessCache:s,ctx:n,appContext:i,propsOptions:r}},o){let l;return!!s[o]||t!==ie&&X(t,o)||Bs(e,o)||(l=r[0])&&X(l,o)||X(n,o)||X($t,o)||X(i.config.globalProperties,o)},defineProperty(t,e,s){return s.get!=null?t._.accessCache[e]=0:X(s,"value")&&this.set(t,e,s.value,null),Reflect.defineProperty(t,e,s)}};function jn(t){return z(t)?t.reduce((e,s)=>(e[s]=null,e),{}):t}let tn=!0;function ao(t){const e=br(t),s=t.proxy,n=t.ctx;tn=!1,e.beforeCreate&&$n(e.beforeCreate,t,"bc");const{data:i,computed:r,methods:o,watch:l,provide:a,inject:u,created:c,beforeMount:f,mounted:p,beforeUpdate:g,updated:T,activated:C,deactivated:D,beforeDestroy:L,beforeUnmount:m,destroyed:b,unmounted:y,render:E,renderTracked:O,renderTriggered:F,errorCaptured:W,serverPrefetch:B,expose:q,inheritAttrs:re,components:pe,directives:Te,filters:lt}=e;if(u&&co(u,n,null),o)for(const Q in o){const j=o[Q];G(j)&&(n[Q]=j.bind(s))}if(i){const Q=i.call(s,s);le(Q)&&(t.data=_s(Q))}if(tn=!0,r)for(const Q in r){const j=r[Q],ae=G(j)?j.bind(s,s):G(j.get)?j.get.bind(s,s):Ge,ye=!G(j)&&G(j.set)?j.set.bind(s):Ge,we=Me({get:ae,set:ye});Object.defineProperty(n,Q,{enumerable:!0,configurable:!0,get:()=>we.value,set:te=>we.value=te})}if(l)for(const Q in l)vr(l[Q],n,s,Q);if(a){const Q=G(a)?a.call(s):a;Reflect.ownKeys(Q).forEach(j=>{as(j,Q[j])})}c&&$n(c,t,"c");function oe(Q,j){z(j)?j.forEach(ae=>Q(ae.bind(s))):j&&Q(j.bind(s))}if(oe(Ql,f),oe(pr,p),oe(Jl,g),oe(Zl,T),oe(Kl,C),oe(ql,D),oe(no,W),oe(so,O),oe(to,F),oe(Xl,m),oe(gr,y),oe(eo,B),z(q))if(q.length){const Q=t.exposed||(t.exposed={});q.forEach(j=>{Object.defineProperty(Q,j,{get:()=>s[j],set:ae=>s[j]=ae})})}else t.exposed||(t.exposed={});E&&t.render===Ge&&(t.render=E),re!=null&&(t.inheritAttrs=re),pe&&(t.components=pe),Te&&(t.directives=Te),B&&fr(t)}function co(t,e,s=Ge){z(t)&&(t=sn(t));for(const n in t){const i=t[n];let r;le(i)?"default"in i?r=et(i.from||n,i.default,!0):r=et(i.from||n):r=et(i),ve(r)?Object.defineProperty(e,n,{enumerable:!0,configurable:!0,get:()=>r.value,set:o=>r.value=o}):e[n]=r}}function $n(t,e,s){Ke(z(t)?t.map(n=>n.bind(e.proxy)):t.bind(e.proxy),e,s)}function vr(t,e,s,n){let i=n.includes(".")?Rr(s,n):()=>s[n];if(ce(t)){const r=e[t];G(r)&&cs(i,r)}else if(G(t))cs(i,t.bind(s));else if(le(t))if(z(t))t.forEach(r=>vr(r,e,s,n));else{const r=G(t.handler)?t.handler.bind(s):e[t.handler];G(r)&&cs(i,r,t)}}function br(t){const e=t.type,{mixins:s,extends:n}=e,{mixins:i,optionsCache:r,config:{optionMergeStrategies:o}}=t.appContext,l=r.get(e);let a;return l?a=l:!i.length&&!s&&!n?a=e:(a={},i.length&&i.forEach(u=>bs(a,u,o,!0)),bs(a,e,o)),le(e)&&r.set(e,a),a}function bs(t,e,s,n=!1){const{mixins:i,extends:r}=e;r&&bs(t,r,s,!0),i&&i.forEach(o=>bs(t,o,s,!0));for(const o in e)if(!(n&&o==="expose")){const l=uo[o]||s&&s[o];t[o]=l?l(t[o],e[o]):e[o]}return t}const uo={data:zn,props:Wn,emits:Wn,methods:Ht,computed:Ht,beforeCreate:xe,created:xe,beforeMount:xe,mounted:xe,beforeUpdate:xe,updated:xe,beforeDestroy:xe,beforeUnmount:xe,destroyed:xe,unmounted:xe,activated:xe,deactivated:xe,errorCaptured:xe,serverPrefetch:xe,components:Ht,directives:Ht,watch:ho,provide:zn,inject:fo};function zn(t,e){return e?t?function(){return be(G(t)?t.call(this,this):t,G(e)?e.call(this,this):e)}:e:t}function fo(t,e){return Ht(sn(t),sn(e))}function sn(t){if(z(t)){const e={};for(let s=0;s1)return s&&G(e)?e.call(n&&n.proxy):e}}const wr={},Ar=()=>Object.create(wr),xr=t=>Object.getPrototypeOf(t)===wr;function mo(t,e,s,n=!1){const i={},r=Ar();t.propsDefaults=Object.create(null),Sr(t,e,i,r);for(const o in t.propsOptions[0])o in i||(i[o]=void 0);s?t.props=n?i:er(i):t.type.props?t.props=i:t.props=r,t.attrs=r}function vo(t,e,s,n){const{props:i,attrs:r,vnode:{patchFlag:o}}=t,l=Z(i),[a]=t.propsOptions;let u=!1;if((n||o>0)&&!(o&16)){if(o&8){const c=t.vnode.dynamicProps;for(let f=0;f{a=!0;const[p,g]=Er(f,e,!0);be(o,p),g&&l.push(...g)};!s&&e.mixins.length&&e.mixins.forEach(c),t.extends&&c(t.extends),t.mixins&&t.mixins.forEach(c)}if(!r&&!a)return le(t)&&n.set(t,Ct),Ct;if(z(r))for(let c=0;ct[0]==="_"||t==="$stable",On=t=>z(t)?t.map(We):[We(t)],yo=(t,e,s)=>{if(e._n)return e;const n=zl((...i)=>On(e(...i)),s);return n._c=!1,n},Cr=(t,e,s)=>{const n=t._ctx;for(const i in t){if(_n(i))continue;const r=t[i];if(G(r))e[i]=yo(i,r,n);else if(r!=null){const o=On(r);e[i]=()=>o}}},_r=(t,e)=>{const s=On(e);t.slots.default=()=>s},Or=(t,e,s)=>{for(const n in e)(s||!_n(n))&&(t[n]=e[n])},wo=(t,e,s)=>{const n=t.slots=Ar();if(t.vnode.shapeFlag&32){const i=e.__;i&&Ys(n,"__",i,!0);const r=e._;r?(Or(n,e,s),s&&Ys(n,"_",r,!0)):Cr(e,n)}else e&&_r(t,e)},Ao=(t,e,s)=>{const{vnode:n,slots:i}=t;let r=!0,o=ie;if(n.shapeFlag&32){const l=e._;l?s&&l===1?r=!1:Or(i,e,s):(r=!e.$stable,Cr(e,i)),o=e}else e&&(_r(t,e),o={default:1});if(r)for(const l in i)!_n(l)&&o[l]==null&&delete i[l]},Pe=Io;function xo(t){return So(t)}function So(t,e){const s=Es();s.__VUE__=!0;const{insert:n,remove:i,patchProp:r,createElement:o,createText:l,createComment:a,setText:u,setElementText:c,parentNode:f,nextSibling:p,setScopeId:g=Ge,insertStaticContent:T}=t,C=(h,d,v,A=null,S=null,x=null,I=void 0,R=null,P=!!d.dynamicChildren)=>{if(h===d)return;h&&!Mt(h,d)&&(A=w(h),te(h,S,x,!0),h=null),d.patchFlag===-2&&(P=!1,d.dynamicChildren=null);const{type:_,ref:U,shapeFlag:M}=d;switch(_){case Rs:D(h,d,v,A);break;case nt:L(h,d,v,A);break;case us:h==null&&m(d,v,A,I);break;case Re:pe(h,d,v,A,S,x,I,R,P);break;default:M&1?E(h,d,v,A,S,x,I,R,P):M&6?Te(h,d,v,A,S,x,I,R,P):(M&64||M&128)&&_.process(h,d,v,A,S,x,I,R,P,H)}U!=null&&S?jt(U,h&&h.ref,x,d||h,!d):U==null&&h&&h.ref!=null&&jt(h.ref,null,x,h,!0)},D=(h,d,v,A)=>{if(h==null)n(d.el=l(d.children),v,A);else{const S=d.el=h.el;d.children!==h.children&&u(S,d.children)}},L=(h,d,v,A)=>{h==null?n(d.el=a(d.children||""),v,A):d.el=h.el},m=(h,d,v,A)=>{[h.el,h.anchor]=T(h.children,d,v,A,h.el,h.anchor)},b=({el:h,anchor:d},v,A)=>{let S;for(;h&&h!==d;)S=p(h),n(h,v,A),h=S;n(d,v,A)},y=({el:h,anchor:d})=>{let v;for(;h&&h!==d;)v=p(h),i(h),h=v;i(d)},E=(h,d,v,A,S,x,I,R,P)=>{d.type==="svg"?I="svg":d.type==="math"&&(I="mathml"),h==null?O(d,v,A,S,x,I,R,P):B(h,d,S,x,I,R,P)},O=(h,d,v,A,S,x,I,R)=>{let P,_;const{props:U,shapeFlag:M,transition:V,dirs:$}=h;if(P=h.el=o(h.type,x,U&&U.is,U),M&8?c(P,h.children):M&16&&W(h.children,P,null,A,S,Vs(h,x),I,R),$&&mt(h,null,A,"created"),F(P,h,h.scopeId,I,A),U){for(const se in U)se!=="value"&&!Bt(se)&&r(P,se,null,U[se],x,A);"value"in U&&r(P,"value",null,U.value,x),(_=U.onVnodeBeforeMount)&&$e(_,A,h)}$&&mt(h,null,A,"beforeMount");const K=Eo(S,V);K&&V.beforeEnter(P),n(P,d,v),((_=U&&U.onVnodeMounted)||K||$)&&Pe(()=>{_&&$e(_,A,h),K&&V.enter(P),$&&mt(h,null,A,"mounted")},S)},F=(h,d,v,A,S)=>{if(v&&g(h,v),A)for(let x=0;x{for(let _=P;_{const R=d.el=h.el;let{patchFlag:P,dynamicChildren:_,dirs:U}=d;P|=h.patchFlag&16;const M=h.props||ie,V=d.props||ie;let $;if(v&&vt(v,!1),($=V.onVnodeBeforeUpdate)&&$e($,v,d,h),U&&mt(d,h,v,"beforeUpdate"),v&&vt(v,!0),(M.innerHTML&&V.innerHTML==null||M.textContent&&V.textContent==null)&&c(R,""),_?q(h.dynamicChildren,_,R,v,A,Vs(d,S),x):I||j(h,d,R,null,v,A,Vs(d,S),x,!1),P>0){if(P&16)re(R,M,V,v,S);else if(P&2&&M.class!==V.class&&r(R,"class",null,V.class,S),P&4&&r(R,"style",M.style,V.style,S),P&8){const K=d.dynamicProps;for(let se=0;se{$&&$e($,v,d,h),U&&mt(d,h,v,"updated")},A)},q=(h,d,v,A,S,x,I)=>{for(let R=0;R{if(d!==v){if(d!==ie)for(const x in d)!Bt(x)&&!(x in v)&&r(h,x,d[x],null,S,A);for(const x in v){if(Bt(x))continue;const I=v[x],R=d[x];I!==R&&x!=="value"&&r(h,x,R,I,S,A)}"value"in v&&r(h,"value",d.value,v.value,S)}},pe=(h,d,v,A,S,x,I,R,P)=>{const _=d.el=h?h.el:l(""),U=d.anchor=h?h.anchor:l("");let{patchFlag:M,dynamicChildren:V,slotScopeIds:$}=d;$&&(R=R?R.concat($):$),h==null?(n(_,v,A),n(U,v,A),W(d.children||[],v,U,S,x,I,R,P)):M>0&&M&64&&V&&h.dynamicChildren?(q(h.dynamicChildren,V,v,S,x,I,R),(d.key!=null||S&&d===S.subTree)&&Tr(h,d,!0)):j(h,d,v,U,S,x,I,R,P)},Te=(h,d,v,A,S,x,I,R,P)=>{d.slotScopeIds=R,h==null?d.shapeFlag&512?S.ctx.activate(d,v,A,I,P):lt(d,v,A,S,x,I,P):ot(h,d,P)},lt=(h,d,v,A,S,x,I)=>{const R=h.component=zo(h,A,S);if(hr(h)&&(R.ctx.renderer=H),Wo(R,!1,I),R.asyncDep){if(S&&S.registerDep(R,oe,I),!h.el){const P=R.subTree=de(nt);L(null,P,d,v)}}else oe(R,h,d,v,S,x,I)},ot=(h,d,v)=>{const A=d.component=h.component;if(ko(h,d,v))if(A.asyncDep&&!A.asyncResolved){Q(A,d,v);return}else A.next=d,A.update();else d.el=h.el,A.vnode=d},oe=(h,d,v,A,S,x,I)=>{const R=()=>{if(h.isMounted){let{next:M,bu:V,u:$,parent:K,vnode:se}=h;{const Ue=Lr(h);if(Ue){M&&(M.el=se.el,Q(h,M,I)),Ue.asyncDep.then(()=>{h.isUnmounted||R()});return}}let ee=M,Ce;vt(h,!1),M?(M.el=se.el,Q(h,M,I)):M=se,V&&Fs(V),(Ce=M.props&&M.props.onVnodeBeforeUpdate)&&$e(Ce,K,M,se),vt(h,!0);const _e=qn(h),Ve=h.subTree;h.subTree=_e,C(Ve,_e,f(Ve.el),w(Ve),h,S,x),M.el=_e.el,ee===null&&Fo(h,_e.el),$&&Pe($,S),(Ce=M.props&&M.props.onVnodeUpdated)&&Pe(()=>$e(Ce,K,M,se),S)}else{let M;const{el:V,props:$}=d,{bm:K,m:se,parent:ee,root:Ce,type:_e}=h,Ve=Lt(d);vt(h,!1),K&&Fs(K),!Ve&&(M=$&&$.onVnodeBeforeMount)&&$e(M,ee,d),vt(h,!0);{Ce.ce&&Ce.ce._def.shadowRoot!==!1&&Ce.ce._injectChildStyle(_e);const Ue=h.subTree=qn(h);C(null,Ue,v,A,h,S,x),d.el=Ue.el}if(se&&Pe(se,S),!Ve&&(M=$&&$.onVnodeMounted)){const Ue=d;Pe(()=>$e(M,ee,Ue),S)}(d.shapeFlag&256||ee&&Lt(ee.vnode)&&ee.vnode.shapeFlag&256)&&h.a&&Pe(h.a,S),h.isMounted=!0,d=v=A=null}};h.scope.on();const P=h.effect=new Vi(R);h.scope.off();const _=h.update=P.run.bind(P),U=h.job=P.runIfDirty.bind(P);U.i=h,U.id=h.uid,P.scheduler=()=>En(U),vt(h,!0),_()},Q=(h,d,v)=>{d.component=h;const A=h.vnode.props;h.vnode=d,h.next=null,vo(h,d.props,A,v),Ao(h,d.children,v),tt(),Bn(h),st()},j=(h,d,v,A,S,x,I,R,P=!1)=>{const _=h&&h.children,U=h?h.shapeFlag:0,M=d.children,{patchFlag:V,shapeFlag:$}=d;if(V>0){if(V&128){ye(_,M,v,A,S,x,I,R,P);return}else if(V&256){ae(_,M,v,A,S,x,I,R,P);return}}$&8?(U&16&&fe(_,S,x),M!==_&&c(v,M)):U&16?$&16?ye(_,M,v,A,S,x,I,R,P):fe(_,S,x,!0):(U&8&&c(v,""),$&16&&W(M,v,A,S,x,I,R,P))},ae=(h,d,v,A,S,x,I,R,P)=>{h=h||Ct,d=d||Ct;const _=h.length,U=d.length,M=Math.min(_,U);let V;for(V=0;VU?fe(h,S,x,!0,!1,M):W(d,v,A,S,x,I,R,P,M)},ye=(h,d,v,A,S,x,I,R,P)=>{let _=0;const U=d.length;let M=h.length-1,V=U-1;for(;_<=M&&_<=V;){const $=h[_],K=d[_]=P?ft(d[_]):We(d[_]);if(Mt($,K))C($,K,v,null,S,x,I,R,P);else break;_++}for(;_<=M&&_<=V;){const $=h[M],K=d[V]=P?ft(d[V]):We(d[V]);if(Mt($,K))C($,K,v,null,S,x,I,R,P);else break;M--,V--}if(_>M){if(_<=V){const $=V+1,K=$V)for(;_<=M;)te(h[_],S,x,!0),_++;else{const $=_,K=_,se=new Map;for(_=K;_<=V;_++){const Le=d[_]=P?ft(d[_]):We(d[_]);Le.key!=null&&se.set(Le.key,_)}let ee,Ce=0;const _e=V-K+1;let Ve=!1,Ue=0;const Ft=new Array(_e);for(_=0;_<_e;_++)Ft[_]=0;for(_=$;_<=M;_++){const Le=h[_];if(Ce>=_e){te(Le,S,x,!0);continue}let je;if(Le.key!=null)je=se.get(Le.key);else for(ee=K;ee<=V;ee++)if(Ft[ee-K]===0&&Mt(Le,d[ee])){je=ee;break}je===void 0?te(Le,S,x,!0):(Ft[je-K]=_+1,je>=Ue?Ue=je:Ve=!0,C(Le,d[je],v,null,S,x,I,R,P),Ce++)}const Fn=Ve?Co(Ft):Ct;for(ee=Fn.length-1,_=_e-1;_>=0;_--){const Le=K+_,je=d[Le],In=Le+1{const{el:x,type:I,transition:R,children:P,shapeFlag:_}=h;if(_&6){we(h.component.subTree,d,v,A);return}if(_&128){h.suspense.move(d,v,A);return}if(_&64){I.move(h,d,v,H);return}if(I===Re){n(x,d,v);for(let M=0;MR.enter(x),S);else{const{leave:M,delayLeave:V,afterLeave:$}=R,K=()=>{h.ctx.isUnmounted?i(x):n(x,d,v)},se=()=>{M(x,()=>{K(),$&&$()})};V?V(x,K,se):se()}else n(x,d,v)},te=(h,d,v,A=!1,S=!1)=>{const{type:x,props:I,ref:R,children:P,dynamicChildren:_,shapeFlag:U,patchFlag:M,dirs:V,cacheIndex:$}=h;if(M===-2&&(S=!1),R!=null&&(tt(),jt(R,null,v,h,!0),st()),$!=null&&(d.renderCache[$]=void 0),U&256){d.ctx.deactivate(h);return}const K=U&1&&V,se=!Lt(h);let ee;if(se&&(ee=I&&I.onVnodeBeforeUnmount)&&$e(ee,d,h),U&6)Be(h.component,v,A);else{if(U&128){h.suspense.unmount(v,A);return}K&&mt(h,null,d,"beforeUnmount"),U&64?h.type.remove(h,d,v,H,A):_&&!_.hasOnce&&(x!==Re||M>0&&M&64)?fe(_,d,v,!1,!0):(x===Re&&M&384||!S&&U&16)&&fe(P,d,v),A&&at(h)}(se&&(ee=I&&I.onVnodeUnmounted)||K)&&Pe(()=>{ee&&$e(ee,d,h),K&&mt(h,null,d,"unmounted")},v)},at=h=>{const{type:d,el:v,anchor:A,transition:S}=h;if(d===Re){Ae(v,A);return}if(d===us){y(h);return}const x=()=>{i(v),S&&!S.persisted&&S.afterLeave&&S.afterLeave()};if(h.shapeFlag&1&&S&&!S.persisted){const{leave:I,delayLeave:R}=S,P=()=>I(v,x);R?R(h.el,x,P):P()}else x()},Ae=(h,d)=>{let v;for(;h!==d;)v=p(h),i(h),h=v;i(d)},Be=(h,d,v)=>{const{bum:A,scope:S,job:x,subTree:I,um:R,m:P,a:_,parent:U,slots:{__:M}}=h;Kn(P),Kn(_),A&&Fs(A),U&&z(M)&&M.forEach(V=>{U.renderCache[V]=void 0}),S.stop(),x&&(x.flags|=8,te(I,h,d,v)),R&&Pe(R,d),Pe(()=>{h.isUnmounted=!0},d),d&&d.pendingBranch&&!d.isUnmounted&&h.asyncDep&&!h.asyncResolved&&h.suspenseId===d.pendingId&&(d.deps--,d.deps===0&&d.resolve())},fe=(h,d,v,A=!1,S=!1,x=0)=>{for(let I=x;I{if(h.shapeFlag&6)return w(h.component.subTree);if(h.shapeFlag&128)return h.suspense.next();const d=p(h.anchor||h.el),v=d&&d[Wl];return v?p(v):d};let N=!1;const k=(h,d,v)=>{h==null?d._vnode&&te(d._vnode,null,null,!0):C(d._vnode||null,h,d,null,null,null,v),d._vnode=h,N||(N=!0,Bn(),ar(),N=!1)},H={p:C,um:te,m:we,r:at,mt:lt,mc:W,pc:j,pbc:q,n:w,o:t};return{render:k,hydrate:void 0,createApp:go(k)}}function Vs({type:t,props:e},s){return s==="svg"&&t==="foreignObject"||s==="mathml"&&t==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:s}function vt({effect:t,job:e},s){s?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function Eo(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function Tr(t,e,s=!1){const n=t.children,i=e.children;if(z(n)&&z(i))for(let r=0;r>1,t[s[l]]0&&(e[n]=s[r-1]),s[r]=n)}}for(r=s.length,o=s[r-1];r-- >0;)s[r]=o,o=e[o];return s}function Lr(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:Lr(e)}function Kn(t){if(t)for(let e=0;eet(_o);function cs(t,e,s){return Pr(t,e,s)}function Pr(t,e,s=ie){const{immediate:n,deep:i,flush:r,once:o}=s,l=be({},s),a=e&&n||!e&&r!=="post";let u;if(es){if(r==="sync"){const g=Oo();u=g.__watcherHandles||(g.__watcherHandles=[])}else if(!a){const g=()=>{};return g.stop=Ge,g.resume=Ge,g.pause=Ge,g}}const c=me;l.call=(g,T,C)=>Ke(g,c,T,C);let f=!1;r==="post"?l.scheduler=g=>{Pe(g,c&&c.suspense)}:r!=="sync"&&(f=!0,l.scheduler=(g,T)=>{T?g():En(g)}),l.augmentJob=g=>{e&&(g.flags|=4),f&&(g.flags|=2,c&&(g.id=c.uid,g.i=c))};const p=Vl(t,e,l);return es&&(u?u.push(p):a&&p()),p}function To(t,e,s){const n=this.proxy,i=ce(t)?t.includes(".")?Rr(n,t):()=>n[t]:t.bind(n,n);let r;G(e)?r=e:(r=e.handler,s=e);const o=is(this),l=Pr(i,r.bind(n),s);return o(),l}function Rr(t,e){const s=e.split(".");return()=>{let n=t;for(let i=0;ie==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${Fe(e)}Modifiers`]||t[`${At(e)}Modifiers`];function Po(t,e,...s){if(t.isUnmounted)return;const n=t.vnode.props||ie;let i=s;const r=e.startsWith("update:"),o=r&&Lo(n,e.slice(7));o&&(o.trim&&(i=s.map(c=>ce(c)?c.trim():c)),o.number&&(i=s.map(ll)));let l,a=n[l=ks(e)]||n[l=ks(Fe(e))];!a&&r&&(a=n[l=ks(At(e))]),a&&Ke(a,t,6,i);const u=n[l+"Once"];if(u){if(!t.emitted)t.emitted={};else if(t.emitted[l])return;t.emitted[l]=!0,Ke(u,t,6,i)}}function Dr(t,e,s=!1){const n=e.emitsCache,i=n.get(t);if(i!==void 0)return i;const r=t.emits;let o={},l=!1;if(!G(t)){const a=u=>{const c=Dr(u,e,!0);c&&(l=!0,be(o,c))};!s&&e.mixins.length&&e.mixins.forEach(a),t.extends&&a(t.extends),t.mixins&&t.mixins.forEach(a)}return!r&&!l?(le(t)&&n.set(t,null),null):(z(r)?r.forEach(a=>o[a]=null):be(o,r),le(t)&&n.set(t,o),o)}function Ps(t,e){return!t||!ws(e)?!1:(e=e.slice(2).replace(/Once$/,""),X(t,e[0].toLowerCase()+e.slice(1))||X(t,At(e))||X(t,e))}function qn(t){const{type:e,vnode:s,proxy:n,withProxy:i,propsOptions:[r],slots:o,attrs:l,emit:a,render:u,renderCache:c,props:f,data:p,setupState:g,ctx:T,inheritAttrs:C}=t,D=vs(t);let L,m;try{if(s.shapeFlag&4){const y=i||n,E=y;L=We(u.call(E,y,c,f,g,p,T)),m=l}else{const y=e;L=We(y.length>1?y(f,{attrs:l,slots:o,emit:a}):y(f,null)),m=e.props?l:Ro(l)}}catch(y){zt.length=0,Os(y,t,1),L=de(nt)}let b=L;if(m&&C!==!1){const y=Object.keys(m),{shapeFlag:E}=b;y.length&&E&7&&(r&&y.some(hn)&&(m=Do(m,r)),b=Rt(b,m,!1,!0))}return s.dirs&&(b=Rt(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(s.dirs):s.dirs),s.transition&&Cn(b,s.transition),L=b,vs(D),L}const Ro=t=>{let e;for(const s in t)(s==="class"||s==="style"||ws(s))&&((e||(e={}))[s]=t[s]);return e},Do=(t,e)=>{const s={};for(const n in t)(!hn(n)||!(n.slice(9)in e))&&(s[n]=t[n]);return s};function ko(t,e,s){const{props:n,children:i,component:r}=t,{props:o,children:l,patchFlag:a}=e,u=r.emitsOptions;if(e.dirs||e.transition)return!0;if(s&&a>=0){if(a&1024)return!0;if(a&16)return n?Yn(n,o,u):!!o;if(a&8){const c=e.dynamicProps;for(let f=0;ft.__isSuspense;function Io(t,e){e&&e.pendingBranch?z(t)?e.effects.push(...t):e.effects.push(t):$l(t)}const Re=Symbol.for("v-fgt"),Rs=Symbol.for("v-txt"),nt=Symbol.for("v-cmt"),us=Symbol.for("v-stc"),zt=[];let De=null;function Jt(t=!1){zt.push(De=t?null:[])}function Mo(){zt.pop(),De=zt[zt.length-1]||null}let Zt=1;function Qn(t,e=!1){Zt+=t,t<0&&De&&e&&(De.hasOnce=!0)}function Fr(t){return t.dynamicChildren=Zt>0?De||Ct:null,Mo(),Zt>0&&De&&De.push(t),t}function Ir(t,e,s,n,i,r){return Fr(Je(t,e,s,n,i,r,!0))}function rn(t,e,s,n,i){return Fr(de(t,e,s,n,i,!0))}function Xt(t){return t?t.__v_isVNode===!0:!1}function Mt(t,e){return t.type===e.type&&t.key===e.key}const Mr=({key:t})=>t??null,fs=({ref:t,ref_key:e,ref_for:s})=>(typeof t=="number"&&(t=""+t),t!=null?ce(t)||ve(t)||G(t)?{i:Ee,r:t,k:e,f:!!s}:t:null);function Je(t,e=null,s=null,n=0,i=null,r=t===Re?0:1,o=!1,l=!1){const a={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&Mr(e),ref:e&&fs(e),scopeId:ur,slotScopeIds:null,children:s,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:r,patchFlag:n,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:Ee};return l?(Tn(a,s),r&128&&t.normalize(a)):s&&(a.shapeFlag|=ce(s)?8:16),Zt>0&&!o&&De&&(a.patchFlag>0||r&6)&&a.patchFlag!==32&&De.push(a),a}const de=No;function No(t,e=null,s=null,n=0,i=null,r=!1){if((!t||t===ro)&&(t=nt),Xt(t)){const l=Rt(t,e,!0);return s&&Tn(l,s),Zt>0&&!r&&De&&(l.shapeFlag&6?De[De.indexOf(t)]=l:De.push(l)),l.patchFlag=-2,l}if(Qo(t)&&(t=t.__vccOpts),e){e=Ho(e);let{class:l,style:a}=e;l&&!ce(l)&&(e.class=mn(l)),le(a)&&(Sn(a)&&!z(a)&&(a=be({},a)),e.style=gn(a))}const o=ce(t)?1:kr(t)?128:Gl(t)?64:le(t)?4:G(t)?2:0;return Je(t,e,s,n,i,o,r,!0)}function Ho(t){return t?Sn(t)||xr(t)?be({},t):t:null}function Rt(t,e,s=!1,n=!1){const{props:i,ref:r,patchFlag:o,children:l,transition:a}=t,u=e?Uo(i||{},e):i,c={__v_isVNode:!0,__v_skip:!0,type:t.type,props:u,key:u&&Mr(u),ref:e&&e.ref?s&&r?z(r)?r.concat(fs(e)):[r,fs(e)]:fs(e):r,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:l,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==Re?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:a,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&Rt(t.ssContent),ssFallback:t.ssFallback&&Rt(t.ssFallback),el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return a&&n&&Cn(c,a.clone(c)),c}function hs(t=" ",e=0){return de(Rs,null,t,e)}function Bo(t,e){const s=de(us,null,t);return s.staticCount=e,s}function Vo(t="",e=!1){return e?(Jt(),rn(nt,null,t)):de(nt,null,t)}function We(t){return t==null||typeof t=="boolean"?de(nt):z(t)?de(Re,null,t.slice()):Xt(t)?ft(t):de(Rs,null,String(t))}function ft(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:Rt(t)}function Tn(t,e){let s=0;const{shapeFlag:n}=t;if(e==null)e=null;else if(z(e))s=16;else if(typeof e=="object")if(n&65){const i=e.default;i&&(i._c&&(i._d=!1),Tn(t,i()),i._c&&(i._d=!0));return}else{s=32;const i=e._;!i&&!xr(e)?e._ctx=Ee:i===3&&Ee&&(Ee.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else G(e)?(e={default:e,_ctx:Ee},s=32):(e=String(e),n&64?(s=16,e=[hs(e)]):s=8);t.children=e,t.shapeFlag|=s}function Uo(...t){const e={};for(let s=0;s{let i;return(i=t[s])||(i=t[s]=[]),i.push(n),r=>{i.length>1?i.forEach(o=>o(r)):i[0](r)}};ys=e("__VUE_INSTANCE_SETTERS__",s=>me=s),ln=e("__VUE_SSR_SETTERS__",s=>es=s)}const is=t=>{const e=me;return ys(t),t.scope.on(),()=>{t.scope.off(),ys(e)}},Jn=()=>{me&&me.scope.off(),ys(null)};function Nr(t){return t.vnode.shapeFlag&4}let es=!1;function Wo(t,e=!1,s=!1){e&&ln(e);const{props:n,children:i}=t.vnode,r=Nr(t);mo(t,n,r,e),wo(t,i,s||e);const o=r?Go(t,e):void 0;return e&&ln(!1),o}function Go(t,e){const s=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,oo);const{setup:n}=s;if(n){tt();const i=t.setupContext=n.length>1?qo(t):null,r=is(t),o=ns(n,t,0,[t.props,i]),l=ki(o);if(st(),r(),(l||t.sp)&&!Lt(t)&&fr(t),l){if(o.then(Jn,Jn),e)return o.then(a=>{Zn(t,a)}).catch(a=>{Os(a,t,0)});t.asyncDep=o}else Zn(t,o)}else Hr(t)}function Zn(t,e,s){G(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:le(e)&&(t.setupState=ir(e)),Hr(t)}function Hr(t,e,s){const n=t.type;t.render||(t.render=n.render||Ge);{const i=is(t);tt();try{ao(t)}finally{st(),i()}}}const Ko={get(t,e){return ge(t,"get",""),t[e]}};function qo(t){const e=s=>{t.exposed=s||{}};return{attrs:new Proxy(t.attrs,Ko),slots:t.slots,emit:t.emit,expose:e}}function Ln(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(ir(kl(t.exposed)),{get(e,s){if(s in e)return e[s];if(s in $t)return $t[s](t)},has(e,s){return s in e||s in $t}})):t.proxy}function Yo(t,e=!0){return G(t)?t.displayName||t.name:t.name||e&&t.__name}function Qo(t){return G(t)&&"__vccOpts"in t}const Me=(t,e)=>Hl(t,e,es);function Br(t,e,s){const n=arguments.length;return n===2?le(e)&&!z(e)?Xt(e)?de(t,null,[e]):de(t,e):de(t,null,e):(n>3?s=Array.prototype.slice.call(arguments,2):n===3&&Xt(s)&&(s=[s]),de(t,e,s))}const Jo="3.5.17";/** +**/function is(t,e,s,n){try{return n?t(...n):t()}catch(i){Ls(i,e,s)}}function Ke(t,e,s,n){if(G(t)){const i=is(t,e,s,n);return i&&Ii(i)&&i.catch(r=>{Ls(r,e,s)}),i}if(z(t)){const i=[];for(let r=0;r>>1,i=Se[n],r=Jt(i);r=Jt(s)?Se.push(t):Se.splice(zl(e),0,t),t.flags|=1,cr()}}function cr(){vs||(vs=or.then(fr))}function Wl(t){z(t)?Tt.push(...t):ft&&t.id===-1?ft.splice(Et+1,0,t):t.flags&1||(Tt.push(t),t.flags|=1),cr()}function Un(t,e,s=We+1){for(;sJt(s)-Jt(n));if(Tt.length=0,ft){ft.push(...e);return}for(ft=e,Et=0;Ett.id==null?t.flags&2?-1:1/0:t.id;function fr(t){try{for(We=0;We{n._d&&Zn(-1);const r=bs(e);let o;try{o=t(...i)}finally{bs(r),n._d&&Zn(1)}return o};return n._n=!0,n._c=!0,n._d=!0,n}function vt(t,e,s,n){const i=t.dirs,r=e&&e.dirs;for(let o=0;ot.__isTeleport;function On(t,e){t.shapeFlag&6&&t.component?(t.transition=e,On(t.component.subTree,e)):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}/*! #__NO_SIDE_EFFECTS__ */function Ts(t,e){return G(t)?be({name:t.name},e,{setup:t}):t}function dr(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function jt(t,e,s,n,i=!1){if(z(t)){t.forEach((C,_)=>jt(C,e&&(z(e)?e[_]:e),s,n,i));return}if(Pt(n)&&!i){n.shapeFlag&512&&n.type.__asyncResolved&&n.component.subTree.component&&jt(t,e,s,n.component.subTree);return}const r=n.shapeFlag&4?Rn(n.component):n.el,o=i?null:r,{i:l,r:a}=t,u=e&&e.r,c=l.refs===ie?l.refs={}:l.refs,f=l.setupState,p=Z(f),g=f===ie?()=>!1:C=>X(p,C);if(u!=null&&u!==a&&(ce(u)?(c[u]=null,g(u)&&(f[u]=null)):ve(u)&&(u.value=null)),G(a))is(a,l,12,[o,c]);else{const C=ce(a),_=ve(a);if(C||_){const D=()=>{if(t.f){const T=C?g(a)?f[a]:c[a]:a.value;i?z(T)&&gn(T,r):z(T)?T.includes(r)||T.push(r):C?(c[a]=[r],g(a)&&(f[a]=c[a])):(a.value=[r],t.k&&(c[t.k]=a.value))}else C?(c[a]=o,g(a)&&(f[a]=o)):_&&(a.value=o,t.k&&(c[t.k]=o))};o?(D.id=-1,Pe(D,s)):D()}}}Cs().requestIdleCallback;Cs().cancelIdleCallback;const Pt=t=>!!t.type.__asyncLoader,pr=t=>t.type.__isKeepAlive;function Yl(t,e){gr(t,"a",e)}function Ql(t,e){gr(t,"da",e)}function gr(t,e,s=me){const n=t.__wdc||(t.__wdc=()=>{let i=s;for(;i;){if(i.isDeactivated)return;i=i.parent}return t()});if(Ps(e,n,s),s){let i=s.parent;for(;i&&i.parent;)pr(i.parent.vnode)&&Jl(n,e,s,i),i=i.parent}}function Jl(t,e,s,n){const i=Ps(e,t,n,!0);vr(()=>{gn(n[e],i)},s)}function Ps(t,e,s=me,n=!1){if(s){const i=s[t]||(s[t]=[]),r=e.__weh||(e.__weh=(...o)=>{st();const l=rs(s),a=Ke(e,s,t,o);return l(),nt(),a});return n?i.unshift(r):i.push(r),r}}const lt=t=>(e,s=me)=>{(!ts||t==="sp")&&Ps(t,(...n)=>e(...n),s)},Zl=lt("bm"),mr=lt("m"),Xl=lt("bu"),eo=lt("u"),to=lt("bum"),vr=lt("um"),so=lt("sp"),no=lt("rtg"),io=lt("rtc");function ro(t,e=me){Ps("ec",t,e)}const lo="components";function $n(t,e){return ao(lo,t,!0,e)||t}const oo=Symbol.for("v-ndc");function ao(t,e,s=!0,n=!1){const i=Ee||me;if(i){const r=i.type;{const l=Jo(r,!1);if(l&&(l===e||l===Ie(e)||l===Es(Ie(e))))return r}const o=jn(i[t]||r[t],e)||jn(i.appContext[t],e);return!o&&n?r:o}}function jn(t,e){return t&&(t[e]||t[Ie(e)]||t[Es(Ie(e))])}function tu(t,e,s,n){let i;const r=s,o=z(t);if(o||ce(t)){const l=o&&Lt(t);let a=!1,u=!1;l&&(a=!Fe(t),u=mt(t),t=_s(t)),i=new Array(t.length);for(let c=0,f=t.length;ce(l,a,void 0,r));else{const l=Object.keys(t);i=new Array(l.length);for(let a=0,u=l.length;aes(e)?!(e.type===it||e.type===Re&&!br(e.children)):!0)?t:null}const tn=t=>t?Hr(t)?Rn(t):tn(t.parent):null,zt=be(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>tn(t.parent),$root:t=>tn(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>Ar(t),$forceUpdate:t=>t.f||(t.f=()=>{_n(t.update)}),$nextTick:t=>t.n||(t.n=ar.bind(t.proxy)),$watch:t=>Po.bind(t)}),Vs=(t,e)=>t!==ie&&!t.__isScriptSetup&&X(t,e),co={get({_:t},e){if(e==="__v_skip")return!0;const{ctx:s,setupState:n,data:i,props:r,accessCache:o,type:l,appContext:a}=t;let u;if(e[0]!=="$"){const g=o[e];if(g!==void 0)switch(g){case 1:return n[e];case 2:return i[e];case 4:return s[e];case 3:return r[e]}else{if(Vs(n,e))return o[e]=1,n[e];if(i!==ie&&X(i,e))return o[e]=2,i[e];if((u=t.propsOptions[0])&&X(u,e))return o[e]=3,r[e];if(s!==ie&&X(s,e))return o[e]=4,s[e];sn&&(o[e]=0)}}const c=zt[e];let f,p;if(c)return e==="$attrs"&&ge(t.attrs,"get",""),c(t);if((f=l.__cssModules)&&(f=f[e]))return f;if(s!==ie&&X(s,e))return o[e]=4,s[e];if(p=a.config.globalProperties,X(p,e))return p[e]},set({_:t},e,s){const{data:n,setupState:i,ctx:r}=t;return Vs(i,e)?(i[e]=s,!0):n!==ie&&X(n,e)?(n[e]=s,!0):X(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(r[e]=s,!0)},has({_:{data:t,setupState:e,accessCache:s,ctx:n,appContext:i,propsOptions:r}},o){let l;return!!s[o]||t!==ie&&X(t,o)||Vs(e,o)||(l=r[0])&&X(l,o)||X(n,o)||X(zt,o)||X(i.config.globalProperties,o)},defineProperty(t,e,s){return s.get!=null?t._.accessCache[e]=0:X(s,"value")&&this.set(t,e,s.value,null),Reflect.defineProperty(t,e,s)}};function zn(t){return z(t)?t.reduce((e,s)=>(e[s]=null,e),{}):t}let sn=!0;function uo(t){const e=Ar(t),s=t.proxy,n=t.ctx;sn=!1,e.beforeCreate&&Wn(e.beforeCreate,t,"bc");const{data:i,computed:r,methods:o,watch:l,provide:a,inject:u,created:c,beforeMount:f,mounted:p,beforeUpdate:g,updated:C,activated:_,deactivated:D,beforeDestroy:T,beforeUnmount:m,destroyed:v,unmounted:y,render:E,renderTracked:L,renderTriggered:F,errorCaptured:W,serverPrefetch:H,expose:K,inheritAttrs:re,components:pe,directives:Le,filters:ot}=e;if(u&&fo(u,n,null),o)for(const Q in o){const $=o[Q];G($)&&(n[Q]=$.bind(s))}if(i){const Q=i.call(s,s);le(Q)&&(t.data=Os(Q))}if(sn=!0,r)for(const Q in r){const $=r[Q],ae=G($)?$.bind(s,s):G($.get)?$.get.bind(s,s):qe,ye=!G($)&&G($.set)?$.set.bind(s):qe,Ae=Ne({get:ae,set:ye});Object.defineProperty(n,Q,{enumerable:!0,configurable:!0,get:()=>Ae.value,set:te=>Ae.value=te})}if(l)for(const Q in l)yr(l[Q],n,s,Q);if(a){const Q=G(a)?a.call(s):a;Reflect.ownKeys(Q).forEach($=>{cs($,Q[$])})}c&&Wn(c,t,"c");function oe(Q,$){z($)?$.forEach(ae=>Q(ae.bind(s))):$&&Q($.bind(s))}if(oe(Zl,f),oe(mr,p),oe(Xl,g),oe(eo,C),oe(Yl,_),oe(Ql,D),oe(ro,W),oe(io,L),oe(no,F),oe(to,m),oe(vr,y),oe(so,H),z(K))if(K.length){const Q=t.exposed||(t.exposed={});K.forEach($=>{Object.defineProperty(Q,$,{get:()=>s[$],set:ae=>s[$]=ae})})}else t.exposed||(t.exposed={});E&&t.render===qe&&(t.render=E),re!=null&&(t.inheritAttrs=re),pe&&(t.components=pe),Le&&(t.directives=Le),H&&dr(t)}function fo(t,e,s=qe){z(t)&&(t=nn(t));for(const n in t){const i=t[n];let r;le(i)?"default"in i?r=tt(i.from||n,i.default,!0):r=tt(i.from||n):r=tt(i),ve(r)?Object.defineProperty(e,n,{enumerable:!0,configurable:!0,get:()=>r.value,set:o=>r.value=o}):e[n]=r}}function Wn(t,e,s){Ke(z(t)?t.map(n=>n.bind(e.proxy)):t.bind(e.proxy),e,s)}function yr(t,e,s,n){let i=n.includes(".")?kr(s,n):()=>s[n];if(ce(t)){const r=e[t];G(r)&&us(i,r)}else if(G(t))us(i,t.bind(s));else if(le(t))if(z(t))t.forEach(r=>yr(r,e,s,n));else{const r=G(t.handler)?t.handler.bind(s):e[t.handler];G(r)&&us(i,r,t)}}function Ar(t){const e=t.type,{mixins:s,extends:n}=e,{mixins:i,optionsCache:r,config:{optionMergeStrategies:o}}=t.appContext,l=r.get(e);let a;return l?a=l:!i.length&&!s&&!n?a=e:(a={},i.length&&i.forEach(u=>ys(a,u,o,!0)),ys(a,e,o)),le(e)&&r.set(e,a),a}function ys(t,e,s,n=!1){const{mixins:i,extends:r}=e;r&&ys(t,r,s,!0),i&&i.forEach(o=>ys(t,o,s,!0));for(const o in e)if(!(n&&o==="expose")){const l=ho[o]||s&&s[o];t[o]=l?l(t[o],e[o]):e[o]}return t}const ho={data:Gn,props:qn,emits:qn,methods:Ht,computed:Ht,beforeCreate:xe,created:xe,beforeMount:xe,mounted:xe,beforeUpdate:xe,updated:xe,beforeDestroy:xe,beforeUnmount:xe,destroyed:xe,unmounted:xe,activated:xe,deactivated:xe,errorCaptured:xe,serverPrefetch:xe,components:Ht,directives:Ht,watch:go,provide:Gn,inject:po};function Gn(t,e){return e?t?function(){return be(G(t)?t.call(this,this):t,G(e)?e.call(this,this):e)}:e:t}function po(t,e){return Ht(nn(t),nn(e))}function nn(t){if(z(t)){const e={};for(let s=0;s1)return s&&G(e)?e.call(n&&n.proxy):e}}const xr={},Sr=()=>Object.create(xr),Er=t=>Object.getPrototypeOf(t)===xr;function bo(t,e,s,n=!1){const i={},r=Sr();t.propsDefaults=Object.create(null),Cr(t,e,i,r);for(const o in t.propsOptions[0])o in i||(i[o]=void 0);s?t.props=n?i:sr(i):t.type.props?t.props=i:t.props=r,t.attrs=r}function yo(t,e,s,n){const{props:i,attrs:r,vnode:{patchFlag:o}}=t,l=Z(i),[a]=t.propsOptions;let u=!1;if((n||o>0)&&!(o&16)){if(o&8){const c=t.vnode.dynamicProps;for(let f=0;f{a=!0;const[p,g]=_r(f,e,!0);be(o,p),g&&l.push(...g)};!s&&e.mixins.length&&e.mixins.forEach(c),t.extends&&c(t.extends),t.mixins&&t.mixins.forEach(c)}if(!r&&!a)return le(t)&&n.set(t,_t),_t;if(z(r))for(let c=0;ct[0]==="_"||t==="$stable",Tn=t=>z(t)?t.map(Ge):[Ge(t)],wo=(t,e,s)=>{if(e._n)return e;const n=Gl((...i)=>Tn(e(...i)),s);return n._c=!1,n},Or=(t,e,s)=>{const n=t._ctx;for(const i in t){if(Ln(i))continue;const r=t[i];if(G(r))e[i]=wo(i,r,n);else if(r!=null){const o=Tn(r);e[i]=()=>o}}},Lr=(t,e)=>{const s=Tn(e);t.slots.default=()=>s},Tr=(t,e,s)=>{for(const n in e)(s||!Ln(n))&&(t[n]=e[n])},xo=(t,e,s)=>{const n=t.slots=Sr();if(t.vnode.shapeFlag&32){const i=e.__;i&&Qs(n,"__",i,!0);const r=e._;r?(Tr(n,e,s),s&&Qs(n,"_",r,!0)):Or(e,n)}else e&&Lr(t,e)},So=(t,e,s)=>{const{vnode:n,slots:i}=t;let r=!0,o=ie;if(n.shapeFlag&32){const l=e._;l?s&&l===1?r=!1:Tr(i,e,s):(r=!e.$stable,Or(e,i)),o=e}else e&&(Lr(t,e),o={default:1});if(r)for(const l in i)!Ln(l)&&o[l]==null&&delete i[l]},Pe=No;function Eo(t){return Co(t)}function Co(t,e){const s=Cs();s.__VUE__=!0;const{insert:n,remove:i,patchProp:r,createElement:o,createText:l,createComment:a,setText:u,setElementText:c,parentNode:f,nextSibling:p,setScopeId:g=qe,insertStaticContent:C}=t,_=(h,d,b,w=null,S=null,x=null,I=void 0,R=null,P=!!d.dynamicChildren)=>{if(h===d)return;h&&!Nt(h,d)&&(w=A(h),te(h,S,x,!0),h=null),d.patchFlag===-2&&(P=!1,d.dynamicChildren=null);const{type:O,ref:U,shapeFlag:M}=d;switch(O){case Ds:D(h,d,b,w);break;case it:T(h,d,b,w);break;case fs:h==null&&m(d,b,w,I);break;case Re:pe(h,d,b,w,S,x,I,R,P);break;default:M&1?E(h,d,b,w,S,x,I,R,P):M&6?Le(h,d,b,w,S,x,I,R,P):(M&64||M&128)&&O.process(h,d,b,w,S,x,I,R,P,B)}U!=null&&S?jt(U,h&&h.ref,x,d||h,!d):U==null&&h&&h.ref!=null&&jt(h.ref,null,x,h,!0)},D=(h,d,b,w)=>{if(h==null)n(d.el=l(d.children),b,w);else{const S=d.el=h.el;d.children!==h.children&&u(S,d.children)}},T=(h,d,b,w)=>{h==null?n(d.el=a(d.children||""),b,w):d.el=h.el},m=(h,d,b,w)=>{[h.el,h.anchor]=C(h.children,d,b,w,h.el,h.anchor)},v=({el:h,anchor:d},b,w)=>{let S;for(;h&&h!==d;)S=p(h),n(h,b,w),h=S;n(d,b,w)},y=({el:h,anchor:d})=>{let b;for(;h&&h!==d;)b=p(h),i(h),h=b;i(d)},E=(h,d,b,w,S,x,I,R,P)=>{d.type==="svg"?I="svg":d.type==="math"&&(I="mathml"),h==null?L(d,b,w,S,x,I,R,P):H(h,d,S,x,I,R,P)},L=(h,d,b,w,S,x,I,R)=>{let P,O;const{props:U,shapeFlag:M,transition:V,dirs:j}=h;if(P=h.el=o(h.type,x,U&&U.is,U),M&8?c(P,h.children):M&16&&W(h.children,P,null,w,S,Us(h,x),I,R),j&&vt(h,null,w,"created"),F(P,h,h.scopeId,I,w),U){for(const se in U)se!=="value"&&!Vt(se)&&r(P,se,null,U[se],x,w);"value"in U&&r(P,"value",null,U.value,x),(O=U.onVnodeBeforeMount)&&ze(O,w,h)}j&&vt(h,null,w,"beforeMount");const q=_o(S,V);q&&V.beforeEnter(P),n(P,d,b),((O=U&&U.onVnodeMounted)||q||j)&&Pe(()=>{O&&ze(O,w,h),q&&V.enter(P),j&&vt(h,null,w,"mounted")},S)},F=(h,d,b,w,S)=>{if(b&&g(h,b),w)for(let x=0;x{for(let O=P;O{const R=d.el=h.el;let{patchFlag:P,dynamicChildren:O,dirs:U}=d;P|=h.patchFlag&16;const M=h.props||ie,V=d.props||ie;let j;if(b&&bt(b,!1),(j=V.onVnodeBeforeUpdate)&&ze(j,b,d,h),U&&vt(d,h,b,"beforeUpdate"),b&&bt(b,!0),(M.innerHTML&&V.innerHTML==null||M.textContent&&V.textContent==null)&&c(R,""),O?K(h.dynamicChildren,O,R,b,w,Us(d,S),x):I||$(h,d,R,null,b,w,Us(d,S),x,!1),P>0){if(P&16)re(R,M,V,b,S);else if(P&2&&M.class!==V.class&&r(R,"class",null,V.class,S),P&4&&r(R,"style",M.style,V.style,S),P&8){const q=d.dynamicProps;for(let se=0;se{j&&ze(j,b,d,h),U&&vt(d,h,b,"updated")},w)},K=(h,d,b,w,S,x,I)=>{for(let R=0;R{if(d!==b){if(d!==ie)for(const x in d)!Vt(x)&&!(x in b)&&r(h,x,d[x],null,S,w);for(const x in b){if(Vt(x))continue;const I=b[x],R=d[x];I!==R&&x!=="value"&&r(h,x,R,I,S,w)}"value"in b&&r(h,"value",d.value,b.value,S)}},pe=(h,d,b,w,S,x,I,R,P)=>{const O=d.el=h?h.el:l(""),U=d.anchor=h?h.anchor:l("");let{patchFlag:M,dynamicChildren:V,slotScopeIds:j}=d;j&&(R=R?R.concat(j):j),h==null?(n(O,b,w),n(U,b,w),W(d.children||[],b,U,S,x,I,R,P)):M>0&&M&64&&V&&h.dynamicChildren?(K(h.dynamicChildren,V,b,S,x,I,R),(d.key!=null||S&&d===S.subTree)&&Pr(h,d,!0)):$(h,d,b,U,S,x,I,R,P)},Le=(h,d,b,w,S,x,I,R,P)=>{d.slotScopeIds=R,h==null?d.shapeFlag&512?S.ctx.activate(d,b,w,I,P):ot(d,b,w,S,x,I,P):at(h,d,P)},ot=(h,d,b,w,S,x,I)=>{const R=h.component=Go(h,w,S);if(pr(h)&&(R.ctx.renderer=B),qo(R,!1,I),R.asyncDep){if(S&&S.registerDep(R,oe,I),!h.el){const P=R.subTree=de(it);T(null,P,d,b)}}else oe(R,h,d,b,S,x,I)},at=(h,d,b)=>{const w=d.component=h.component;if(Io(h,d,b))if(w.asyncDep&&!w.asyncResolved){Q(w,d,b);return}else w.next=d,w.update();else d.el=h.el,w.vnode=d},oe=(h,d,b,w,S,x,I)=>{const R=()=>{if(h.isMounted){let{next:M,bu:V,u:j,parent:q,vnode:se}=h;{const $e=Rr(h);if($e){M&&(M.el=se.el,Q(h,M,I)),$e.asyncDep.then(()=>{h.isUnmounted||R()});return}}let ee=M,Ce;bt(h,!1),M?(M.el=se.el,Q(h,M,I)):M=se,V&&Is(V),(Ce=M.props&&M.props.onVnodeBeforeUpdate)&&ze(Ce,q,M,se),bt(h,!0);const _e=Qn(h),Ue=h.subTree;h.subTree=_e,_(Ue,_e,f(Ue.el),A(Ue),h,S,x),M.el=_e.el,ee===null&&Mo(h,_e.el),j&&Pe(j,S),(Ce=M.props&&M.props.onVnodeUpdated)&&Pe(()=>ze(Ce,q,M,se),S)}else{let M;const{el:V,props:j}=d,{bm:q,m:se,parent:ee,root:Ce,type:_e}=h,Ue=Pt(d);bt(h,!1),q&&Is(q),!Ue&&(M=j&&j.onVnodeBeforeMount)&&ze(M,ee,d),bt(h,!0);{Ce.ce&&Ce.ce._def.shadowRoot!==!1&&Ce.ce._injectChildStyle(_e);const $e=h.subTree=Qn(h);_(null,$e,b,w,h,S,x),d.el=$e.el}if(se&&Pe(se,S),!Ue&&(M=j&&j.onVnodeMounted)){const $e=d;Pe(()=>ze(M,ee,$e),S)}(d.shapeFlag&256||ee&&Pt(ee.vnode)&&ee.vnode.shapeFlag&256)&&h.a&&Pe(h.a,S),h.isMounted=!0,d=b=w=null}};h.scope.on();const P=h.effect=new $i(R);h.scope.off();const O=h.update=P.run.bind(P),U=h.job=P.runIfDirty.bind(P);U.i=h,U.id=h.uid,P.scheduler=()=>_n(U),bt(h,!0),O()},Q=(h,d,b)=>{d.component=h;const w=h.vnode.props;h.vnode=d,h.next=null,yo(h,d.props,w,b),So(h,d.children,b),st(),Un(h),nt()},$=(h,d,b,w,S,x,I,R,P=!1)=>{const O=h&&h.children,U=h?h.shapeFlag:0,M=d.children,{patchFlag:V,shapeFlag:j}=d;if(V>0){if(V&128){ye(O,M,b,w,S,x,I,R,P);return}else if(V&256){ae(O,M,b,w,S,x,I,R,P);return}}j&8?(U&16&&fe(O,S,x),M!==O&&c(b,M)):U&16?j&16?ye(O,M,b,w,S,x,I,R,P):fe(O,S,x,!0):(U&8&&c(b,""),j&16&&W(M,b,w,S,x,I,R,P))},ae=(h,d,b,w,S,x,I,R,P)=>{h=h||_t,d=d||_t;const O=h.length,U=d.length,M=Math.min(O,U);let V;for(V=0;VU?fe(h,S,x,!0,!1,M):W(d,b,w,S,x,I,R,P,M)},ye=(h,d,b,w,S,x,I,R,P)=>{let O=0;const U=d.length;let M=h.length-1,V=U-1;for(;O<=M&&O<=V;){const j=h[O],q=d[O]=P?ht(d[O]):Ge(d[O]);if(Nt(j,q))_(j,q,b,null,S,x,I,R,P);else break;O++}for(;O<=M&&O<=V;){const j=h[M],q=d[V]=P?ht(d[V]):Ge(d[V]);if(Nt(j,q))_(j,q,b,null,S,x,I,R,P);else break;M--,V--}if(O>M){if(O<=V){const j=V+1,q=jV)for(;O<=M;)te(h[O],S,x,!0),O++;else{const j=O,q=O,se=new Map;for(O=q;O<=V;O++){const Te=d[O]=P?ht(d[O]):Ge(d[O]);Te.key!=null&&se.set(Te.key,O)}let ee,Ce=0;const _e=V-q+1;let Ue=!1,$e=0;const It=new Array(_e);for(O=0;O<_e;O++)It[O]=0;for(O=j;O<=M;O++){const Te=h[O];if(Ce>=_e){te(Te,S,x,!0);continue}let je;if(Te.key!=null)je=se.get(Te.key);else for(ee=q;ee<=V;ee++)if(It[ee-q]===0&&Nt(Te,d[ee])){je=ee;break}je===void 0?te(Te,S,x,!0):(It[je-q]=O+1,je>=$e?$e=je:Ue=!0,_(Te,d[je],b,null,S,x,I,R,P),Ce++)}const Mn=Ue?Oo(It):_t;for(ee=Mn.length-1,O=_e-1;O>=0;O--){const Te=q+O,je=d[Te],Nn=Te+1{const{el:x,type:I,transition:R,children:P,shapeFlag:O}=h;if(O&6){Ae(h.component.subTree,d,b,w);return}if(O&128){h.suspense.move(d,b,w);return}if(O&64){I.move(h,d,b,B);return}if(I===Re){n(x,d,b);for(let M=0;MR.enter(x),S);else{const{leave:M,delayLeave:V,afterLeave:j}=R,q=()=>{h.ctx.isUnmounted?i(x):n(x,d,b)},se=()=>{M(x,()=>{q(),j&&j()})};V?V(x,q,se):se()}else n(x,d,b)},te=(h,d,b,w=!1,S=!1)=>{const{type:x,props:I,ref:R,children:P,dynamicChildren:O,shapeFlag:U,patchFlag:M,dirs:V,cacheIndex:j}=h;if(M===-2&&(S=!1),R!=null&&(st(),jt(R,null,b,h,!0),nt()),j!=null&&(d.renderCache[j]=void 0),U&256){d.ctx.deactivate(h);return}const q=U&1&&V,se=!Pt(h);let ee;if(se&&(ee=I&&I.onVnodeBeforeUnmount)&&ze(ee,d,h),U&6)Ve(h.component,b,w);else{if(U&128){h.suspense.unmount(b,w);return}q&&vt(h,null,d,"beforeUnmount"),U&64?h.type.remove(h,d,b,B,w):O&&!O.hasOnce&&(x!==Re||M>0&&M&64)?fe(O,d,b,!1,!0):(x===Re&&M&384||!S&&U&16)&&fe(P,d,b),w&&ct(h)}(se&&(ee=I&&I.onVnodeUnmounted)||q)&&Pe(()=>{ee&&ze(ee,d,h),q&&vt(h,null,d,"unmounted")},b)},ct=h=>{const{type:d,el:b,anchor:w,transition:S}=h;if(d===Re){we(b,w);return}if(d===fs){y(h);return}const x=()=>{i(b),S&&!S.persisted&&S.afterLeave&&S.afterLeave()};if(h.shapeFlag&1&&S&&!S.persisted){const{leave:I,delayLeave:R}=S,P=()=>I(b,x);R?R(h.el,x,P):P()}else x()},we=(h,d)=>{let b;for(;h!==d;)b=p(h),i(h),h=b;i(d)},Ve=(h,d,b)=>{const{bum:w,scope:S,job:x,subTree:I,um:R,m:P,a:O,parent:U,slots:{__:M}}=h;Yn(P),Yn(O),w&&Is(w),U&&z(M)&&M.forEach(V=>{U.renderCache[V]=void 0}),S.stop(),x&&(x.flags|=8,te(I,h,d,b)),R&&Pe(R,d),Pe(()=>{h.isUnmounted=!0},d),d&&d.pendingBranch&&!d.isUnmounted&&h.asyncDep&&!h.asyncResolved&&h.suspenseId===d.pendingId&&(d.deps--,d.deps===0&&d.resolve())},fe=(h,d,b,w=!1,S=!1,x=0)=>{for(let I=x;I{if(h.shapeFlag&6)return A(h.component.subTree);if(h.shapeFlag&128)return h.suspense.next();const d=p(h.anchor||h.el),b=d&&d[ql];return b?p(b):d};let N=!1;const k=(h,d,b)=>{h==null?d._vnode&&te(d._vnode,null,null,!0):_(d._vnode||null,h,d,null,null,null,b),d._vnode=h,N||(N=!0,Un(),ur(),N=!1)},B={p:_,um:te,m:Ae,r:ct,mt:ot,mc:W,pc:$,pbc:K,n:A,o:t};return{render:k,hydrate:void 0,createApp:vo(k)}}function Us({type:t,props:e},s){return s==="svg"&&t==="foreignObject"||s==="mathml"&&t==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:s}function bt({effect:t,job:e},s){s?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function _o(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function Pr(t,e,s=!1){const n=t.children,i=e.children;if(z(n)&&z(i))for(let r=0;r>1,t[s[l]]0&&(e[n]=s[r-1]),s[r]=n)}}for(r=s.length,o=s[r-1];r-- >0;)s[r]=o,o=e[o];return s}function Rr(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:Rr(e)}function Yn(t){if(t)for(let e=0;ett(Lo);function us(t,e,s){return Dr(t,e,s)}function Dr(t,e,s=ie){const{immediate:n,deep:i,flush:r,once:o}=s,l=be({},s),a=e&&n||!e&&r!=="post";let u;if(ts){if(r==="sync"){const g=To();u=g.__watcherHandles||(g.__watcherHandles=[])}else if(!a){const g=()=>{};return g.stop=qe,g.resume=qe,g.pause=qe,g}}const c=me;l.call=(g,C,_)=>Ke(g,c,C,_);let f=!1;r==="post"?l.scheduler=g=>{Pe(g,c&&c.suspense)}:r!=="sync"&&(f=!0,l.scheduler=(g,C)=>{C?g():_n(g)}),l.augmentJob=g=>{e&&(g.flags|=4),f&&(g.flags|=2,c&&(g.id=c.uid,g.i=c))};const p=$l(t,e,l);return ts&&(u?u.push(p):a&&p()),p}function Po(t,e,s){const n=this.proxy,i=ce(t)?t.includes(".")?kr(n,t):()=>n[t]:t.bind(n,n);let r;G(e)?r=e:(r=e.handler,s=e);const o=rs(this),l=Dr(i,r.bind(n),s);return o(),l}function kr(t,e){const s=e.split(".");return()=>{let n=t;for(let i=0;ie==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${Ie(e)}Modifiers`]||t[`${xt(e)}Modifiers`];function Do(t,e,...s){if(t.isUnmounted)return;const n=t.vnode.props||ie;let i=s;const r=e.startsWith("update:"),o=r&&Ro(n,e.slice(7));o&&(o.trim&&(i=s.map(c=>ce(c)?c.trim():c)),o.number&&(i=s.map(al)));let l,a=n[l=Fs(e)]||n[l=Fs(Ie(e))];!a&&r&&(a=n[l=Fs(xt(e))]),a&&Ke(a,t,6,i);const u=n[l+"Once"];if(u){if(!t.emitted)t.emitted={};else if(t.emitted[l])return;t.emitted[l]=!0,Ke(u,t,6,i)}}function Fr(t,e,s=!1){const n=e.emitsCache,i=n.get(t);if(i!==void 0)return i;const r=t.emits;let o={},l=!1;if(!G(t)){const a=u=>{const c=Fr(u,e,!0);c&&(l=!0,be(o,c))};!s&&e.mixins.length&&e.mixins.forEach(a),t.extends&&a(t.extends),t.mixins&&t.mixins.forEach(a)}return!r&&!l?(le(t)&&n.set(t,null),null):(z(r)?r.forEach(a=>o[a]=null):be(o,r),le(t)&&n.set(t,o),o)}function Rs(t,e){return!t||!ws(e)?!1:(e=e.slice(2).replace(/Once$/,""),X(t,e[0].toLowerCase()+e.slice(1))||X(t,xt(e))||X(t,e))}function Qn(t){const{type:e,vnode:s,proxy:n,withProxy:i,propsOptions:[r],slots:o,attrs:l,emit:a,render:u,renderCache:c,props:f,data:p,setupState:g,ctx:C,inheritAttrs:_}=t,D=bs(t);let T,m;try{if(s.shapeFlag&4){const y=i||n,E=y;T=Ge(u.call(E,y,c,f,g,p,C)),m=l}else{const y=e;T=Ge(y.length>1?y(f,{attrs:l,slots:o,emit:a}):y(f,null)),m=e.props?l:ko(l)}}catch(y){Wt.length=0,Ls(y,t,1),T=de(it)}let v=T;if(m&&_!==!1){const y=Object.keys(m),{shapeFlag:E}=v;y.length&&E&7&&(r&&y.some(pn)&&(m=Fo(m,r)),v=Dt(v,m,!1,!0))}return s.dirs&&(v=Dt(v,null,!1,!0),v.dirs=v.dirs?v.dirs.concat(s.dirs):s.dirs),s.transition&&On(v,s.transition),T=v,bs(D),T}const ko=t=>{let e;for(const s in t)(s==="class"||s==="style"||ws(s))&&((e||(e={}))[s]=t[s]);return e},Fo=(t,e)=>{const s={};for(const n in t)(!pn(n)||!(n.slice(9)in e))&&(s[n]=t[n]);return s};function Io(t,e,s){const{props:n,children:i,component:r}=t,{props:o,children:l,patchFlag:a}=e,u=r.emitsOptions;if(e.dirs||e.transition)return!0;if(s&&a>=0){if(a&1024)return!0;if(a&16)return n?Jn(n,o,u):!!o;if(a&8){const c=e.dynamicProps;for(let f=0;ft.__isSuspense;function No(t,e){e&&e.pendingBranch?z(t)?e.effects.push(...t):e.effects.push(t):Wl(t)}const Re=Symbol.for("v-fgt"),Ds=Symbol.for("v-txt"),it=Symbol.for("v-cmt"),fs=Symbol.for("v-stc"),Wt=[];let De=null;function Zt(t=!1){Wt.push(De=t?null:[])}function Bo(){Wt.pop(),De=Wt[Wt.length-1]||null}let Xt=1;function Zn(t,e=!1){Xt+=t,t<0&&De&&e&&(De.hasOnce=!0)}function Mr(t){return t.dynamicChildren=Xt>0?De||_t:null,Bo(),Xt>0&&De&&De.push(t),t}function Nr(t,e,s,n,i,r){return Mr(Ze(t,e,s,n,i,r,!0))}function ln(t,e,s,n,i){return Mr(de(t,e,s,n,i,!0))}function es(t){return t?t.__v_isVNode===!0:!1}function Nt(t,e){return t.type===e.type&&t.key===e.key}const Br=({key:t})=>t??null,hs=({ref:t,ref_key:e,ref_for:s})=>(typeof t=="number"&&(t=""+t),t!=null?ce(t)||ve(t)||G(t)?{i:Ee,r:t,k:e,f:!!s}:t:null);function Ze(t,e=null,s=null,n=0,i=null,r=t===Re?0:1,o=!1,l=!1){const a={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&Br(e),ref:e&&hs(e),scopeId:hr,slotScopeIds:null,children:s,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:r,patchFlag:n,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:Ee};return l?(Pn(a,s),r&128&&t.normalize(a)):s&&(a.shapeFlag|=ce(s)?8:16),Xt>0&&!o&&De&&(a.patchFlag>0||r&6)&&a.patchFlag!==32&&De.push(a),a}const de=Ho;function Ho(t,e=null,s=null,n=0,i=null,r=!1){if((!t||t===oo)&&(t=it),es(t)){const l=Dt(t,e,!0);return s&&Pn(l,s),Xt>0&&!r&&De&&(l.shapeFlag&6?De[De.indexOf(t)]=l:De.push(l)),l.patchFlag=-2,l}if(Zo(t)&&(t=t.__vccOpts),e){e=Vo(e);let{class:l,style:a}=e;l&&!ce(l)&&(e.class=bn(l)),le(a)&&(Cn(a)&&!z(a)&&(a=be({},a)),e.style=vn(a))}const o=ce(t)?1:Ir(t)?128:Kl(t)?64:le(t)?4:G(t)?2:0;return Ze(t,e,s,n,i,o,r,!0)}function Vo(t){return t?Cn(t)||Er(t)?be({},t):t:null}function Dt(t,e,s=!1,n=!1){const{props:i,ref:r,patchFlag:o,children:l,transition:a}=t,u=e?jo(i||{},e):i,c={__v_isVNode:!0,__v_skip:!0,type:t.type,props:u,key:u&&Br(u),ref:e&&e.ref?s&&r?z(r)?r.concat(hs(e)):[r,hs(e)]:hs(e):r,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:l,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==Re?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:a,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&Dt(t.ssContent),ssFallback:t.ssFallback&&Dt(t.ssFallback),el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return a&&n&&On(c,a.clone(c)),c}function ds(t=" ",e=0){return de(Ds,null,t,e)}function Uo(t,e){const s=de(fs,null,t);return s.staticCount=e,s}function $o(t="",e=!1){return e?(Zt(),ln(it,null,t)):de(it,null,t)}function Ge(t){return t==null||typeof t=="boolean"?de(it):z(t)?de(Re,null,t.slice()):es(t)?ht(t):de(Ds,null,String(t))}function ht(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:Dt(t)}function Pn(t,e){let s=0;const{shapeFlag:n}=t;if(e==null)e=null;else if(z(e))s=16;else if(typeof e=="object")if(n&65){const i=e.default;i&&(i._c&&(i._d=!1),Pn(t,i()),i._c&&(i._d=!0));return}else{s=32;const i=e._;!i&&!Er(e)?e._ctx=Ee:i===3&&Ee&&(Ee.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else G(e)?(e={default:e,_ctx:Ee},s=32):(e=String(e),n&64?(s=16,e=[ds(e)]):s=8);t.children=e,t.shapeFlag|=s}function jo(...t){const e={};for(let s=0;s{let i;return(i=t[s])||(i=t[s]=[]),i.push(n),r=>{i.length>1?i.forEach(o=>o(r)):i[0](r)}};As=e("__VUE_INSTANCE_SETTERS__",s=>me=s),on=e("__VUE_SSR_SETTERS__",s=>ts=s)}const rs=t=>{const e=me;return As(t),t.scope.on(),()=>{t.scope.off(),As(e)}},Xn=()=>{me&&me.scope.off(),As(null)};function Hr(t){return t.vnode.shapeFlag&4}let ts=!1;function qo(t,e=!1,s=!1){e&&on(e);const{props:n,children:i}=t.vnode,r=Hr(t);bo(t,n,r,e),xo(t,i,s||e);const o=r?Ko(t,e):void 0;return e&&on(!1),o}function Ko(t,e){const s=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,co);const{setup:n}=s;if(n){st();const i=t.setupContext=n.length>1?Qo(t):null,r=rs(t),o=is(n,t,0,[t.props,i]),l=Ii(o);if(nt(),r(),(l||t.sp)&&!Pt(t)&&dr(t),l){if(o.then(Xn,Xn),e)return o.then(a=>{ei(t,a)}).catch(a=>{Ls(a,t,0)});t.asyncDep=o}else ei(t,o)}else Vr(t)}function ei(t,e,s){G(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:le(e)&&(t.setupState=lr(e)),Vr(t)}function Vr(t,e,s){const n=t.type;t.render||(t.render=n.render||qe);{const i=rs(t);st();try{uo(t)}finally{nt(),i()}}}const Yo={get(t,e){return ge(t,"get",""),t[e]}};function Qo(t){const e=s=>{t.exposed=s||{}};return{attrs:new Proxy(t.attrs,Yo),slots:t.slots,emit:t.emit,expose:e}}function Rn(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(lr(Il(t.exposed)),{get(e,s){if(s in e)return e[s];if(s in zt)return zt[s](t)},has(e,s){return s in e||s in zt}})):t.proxy}function Jo(t,e=!0){return G(t)?t.displayName||t.name:t.name||e&&t.__name}function Zo(t){return G(t)&&"__vccOpts"in t}const Ne=(t,e)=>Vl(t,e,ts);function Ur(t,e,s){const n=arguments.length;return n===2?le(e)&&!z(e)?es(e)?de(t,null,[e]):de(t,e):de(t,null,e):(n>3?s=Array.prototype.slice.call(arguments,2):n===3&&es(s)&&(s=[s]),de(t,e,s))}const Xo="3.5.17";/** * @vue/runtime-dom v3.5.17 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT -**/let on;const Xn=typeof window<"u"&&window.trustedTypes;if(Xn)try{on=Xn.createPolicy("vue",{createHTML:t=>t})}catch{}const Vr=on?t=>on.createHTML(t):t=>t,Zo="http://www.w3.org/2000/svg",Xo="http://www.w3.org/1998/Math/MathML",Ze=typeof document<"u"?document:null,ei=Ze&&Ze.createElement("template"),ea={insert:(t,e,s)=>{e.insertBefore(t,s||null)},remove:t=>{const e=t.parentNode;e&&e.removeChild(t)},createElement:(t,e,s,n)=>{const i=e==="svg"?Ze.createElementNS(Zo,t):e==="mathml"?Ze.createElementNS(Xo,t):s?Ze.createElement(t,{is:s}):Ze.createElement(t);return t==="select"&&n&&n.multiple!=null&&i.setAttribute("multiple",n.multiple),i},createText:t=>Ze.createTextNode(t),createComment:t=>Ze.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>Ze.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},insertStaticContent(t,e,s,n,i,r){const o=s?s.previousSibling:e.lastChild;if(i&&(i===r||i.nextSibling))for(;e.insertBefore(i.cloneNode(!0),s),!(i===r||!(i=i.nextSibling)););else{ei.innerHTML=Vr(n==="svg"?`${t}`:n==="mathml"?`${t}`:t);const l=ei.content;if(n==="svg"||n==="mathml"){const a=l.firstChild;for(;a.firstChild;)l.appendChild(a.firstChild);l.removeChild(a)}e.insertBefore(l,s)}return[o?o.nextSibling:e.firstChild,s?s.previousSibling:e.lastChild]}},ta=Symbol("_vtc");function sa(t,e,s){const n=t[ta];n&&(e=(e?[e,...n]:[...n]).join(" ")),e==null?t.removeAttribute("class"):s?t.setAttribute("class",e):t.className=e}const ti=Symbol("_vod"),na=Symbol("_vsh"),ia=Symbol(""),ra=/(^|;)\s*display\s*:/;function la(t,e,s){const n=t.style,i=ce(s);let r=!1;if(s&&!i){if(e)if(ce(e))for(const o of e.split(";")){const l=o.slice(0,o.indexOf(":")).trim();s[l]==null&&ds(n,l,"")}else for(const o in e)s[o]==null&&ds(n,o,"");for(const o in s)o==="display"&&(r=!0),ds(n,o,s[o])}else if(i){if(e!==s){const o=n[ia];o&&(s+=";"+o),n.cssText=s,r=ra.test(s)}}else e&&t.removeAttribute("style");ti in t&&(t[ti]=r?n.display:"",t[na]&&(n.display="none"))}const si=/\s*!important$/;function ds(t,e,s){if(z(s))s.forEach(n=>ds(t,e,n));else if(s==null&&(s=""),e.startsWith("--"))t.setProperty(e,s);else{const n=oa(t,e);si.test(s)?t.setProperty(At(n),s.replace(si,""),"important"):t[n]=s}}const ni=["Webkit","Moz","ms"],Us={};function oa(t,e){const s=Us[e];if(s)return s;let n=Fe(e);if(n!=="filter"&&n in t)return Us[e]=n;n=Ss(n);for(let i=0;ijs||(ha.then(()=>js=0),js=Date.now());function pa(t,e){const s=n=>{if(!n._vts)n._vts=Date.now();else if(n._vts<=s.attached)return;Ke(ga(n,s.value),e,5,[n])};return s.value=t,s.attached=da(),s}function ga(t,e){if(z(e)){const s=t.stopImmediatePropagation;return t.stopImmediatePropagation=()=>{s.call(t),t._stopped=!0},e.map(n=>i=>!i._stopped&&n&&n(i))}else return e}const ci=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,ma=(t,e,s,n,i,r)=>{const o=i==="svg";e==="class"?sa(t,n,o):e==="style"?la(t,s,n):ws(e)?hn(e)||ua(t,e,s,n,r):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):va(t,e,n,o))?(li(t,e,n),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&ri(t,e,n,o,r,e!=="value")):t._isVueCE&&(/[A-Z]/.test(e)||!ce(n))?li(t,Fe(e),n,r,e):(e==="true-value"?t._trueValue=n:e==="false-value"&&(t._falseValue=n),ri(t,e,n,o))};function va(t,e,s,n){if(n)return!!(e==="innerHTML"||e==="textContent"||e in t&&ci(e)&&G(s));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="form"||e==="list"&&t.tagName==="INPUT"||e==="type"&&t.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const i=t.tagName;if(i==="IMG"||i==="VIDEO"||i==="CANVAS"||i==="SOURCE")return!1}return ci(e)&&ce(s)?!1:e in t}const ba=be({patchProp:ma},ea);let ui;function ya(){return ui||(ui=xo(ba))}const wa=(...t)=>{const e=ya().createApp(...t),{mount:s}=e;return e.mount=n=>{const i=xa(n);if(!i)return;const r=e._component;!G(r)&&!r.render&&!r.template&&(r.template=i.innerHTML),i.nodeType===1&&(i.textContent="");const o=s(i,!1,Aa(i));return i instanceof Element&&(i.removeAttribute("v-cloak"),i.setAttribute("data-v-app","")),o},e};function Aa(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function xa(t){return ce(t)?document.querySelector(t):t}const Sa="modulepreload",Ea=function(t){return"/"+t},fi={},Ye=function(e,s,n){let i=Promise.resolve();if(s&&s.length>0){let o=function(u){return Promise.all(u.map(c=>Promise.resolve(c).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),a=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));i=o(s.map(u=>{if(u=Ea(u),u in fi)return;fi[u]=!0;const c=u.endsWith(".css"),f=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${f}`))return;const p=document.createElement("link");if(p.rel=c?"stylesheet":Sa,c||(p.as="script"),p.crossOrigin="",p.href=u,a&&p.setAttribute("nonce",a),document.head.appendChild(p),c)return new Promise((g,T)=>{p.addEventListener("load",g),p.addEventListener("error",()=>T(new Error(`Unable to preload CSS for ${u}`)))})}))}function r(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return i.then(o=>{for(const l of o||[])l.status==="rejected"&&r(l.reason);return e().catch(r)})};/*! +**/let an;const ti=typeof window<"u"&&window.trustedTypes;if(ti)try{an=ti.createPolicy("vue",{createHTML:t=>t})}catch{}const $r=an?t=>an.createHTML(t):t=>t,ea="http://www.w3.org/2000/svg",ta="http://www.w3.org/1998/Math/MathML",Xe=typeof document<"u"?document:null,si=Xe&&Xe.createElement("template"),sa={insert:(t,e,s)=>{e.insertBefore(t,s||null)},remove:t=>{const e=t.parentNode;e&&e.removeChild(t)},createElement:(t,e,s,n)=>{const i=e==="svg"?Xe.createElementNS(ea,t):e==="mathml"?Xe.createElementNS(ta,t):s?Xe.createElement(t,{is:s}):Xe.createElement(t);return t==="select"&&n&&n.multiple!=null&&i.setAttribute("multiple",n.multiple),i},createText:t=>Xe.createTextNode(t),createComment:t=>Xe.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>Xe.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},insertStaticContent(t,e,s,n,i,r){const o=s?s.previousSibling:e.lastChild;if(i&&(i===r||i.nextSibling))for(;e.insertBefore(i.cloneNode(!0),s),!(i===r||!(i=i.nextSibling)););else{si.innerHTML=$r(n==="svg"?`${t}`:n==="mathml"?`${t}`:t);const l=si.content;if(n==="svg"||n==="mathml"){const a=l.firstChild;for(;a.firstChild;)l.appendChild(a.firstChild);l.removeChild(a)}e.insertBefore(l,s)}return[o?o.nextSibling:e.firstChild,s?s.previousSibling:e.lastChild]}},na=Symbol("_vtc");function ia(t,e,s){const n=t[na];n&&(e=(e?[e,...n]:[...n]).join(" ")),e==null?t.removeAttribute("class"):s?t.setAttribute("class",e):t.className=e}const ni=Symbol("_vod"),ra=Symbol("_vsh"),la=Symbol(""),oa=/(^|;)\s*display\s*:/;function aa(t,e,s){const n=t.style,i=ce(s);let r=!1;if(s&&!i){if(e)if(ce(e))for(const o of e.split(";")){const l=o.slice(0,o.indexOf(":")).trim();s[l]==null&&ps(n,l,"")}else for(const o in e)s[o]==null&&ps(n,o,"");for(const o in s)o==="display"&&(r=!0),ps(n,o,s[o])}else if(i){if(e!==s){const o=n[la];o&&(s+=";"+o),n.cssText=s,r=oa.test(s)}}else e&&t.removeAttribute("style");ni in t&&(t[ni]=r?n.display:"",t[ra]&&(n.display="none"))}const ii=/\s*!important$/;function ps(t,e,s){if(z(s))s.forEach(n=>ps(t,e,n));else if(s==null&&(s=""),e.startsWith("--"))t.setProperty(e,s);else{const n=ca(t,e);ii.test(s)?t.setProperty(xt(n),s.replace(ii,""),"important"):t[n]=s}}const ri=["Webkit","Moz","ms"],$s={};function ca(t,e){const s=$s[e];if(s)return s;let n=Ie(e);if(n!=="filter"&&n in t)return $s[e]=n;n=Es(n);for(let i=0;ijs||(pa.then(()=>js=0),js=Date.now());function ma(t,e){const s=n=>{if(!n._vts)n._vts=Date.now();else if(n._vts<=s.attached)return;Ke(va(n,s.value),e,5,[n])};return s.value=t,s.attached=ga(),s}function va(t,e){if(z(e)){const s=t.stopImmediatePropagation;return t.stopImmediatePropagation=()=>{s.call(t),t._stopped=!0},e.map(n=>i=>!i._stopped&&n&&n(i))}else return e}const fi=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,ba=(t,e,s,n,i,r)=>{const o=i==="svg";e==="class"?ia(t,n,o):e==="style"?aa(t,s,n):ws(e)?pn(e)||ha(t,e,s,n,r):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):ya(t,e,n,o))?(ai(t,e,n),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&oi(t,e,n,o,r,e!=="value")):t._isVueCE&&(/[A-Z]/.test(e)||!ce(n))?ai(t,Ie(e),n,r,e):(e==="true-value"?t._trueValue=n:e==="false-value"&&(t._falseValue=n),oi(t,e,n,o))};function ya(t,e,s,n){if(n)return!!(e==="innerHTML"||e==="textContent"||e in t&&fi(e)&&G(s));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="form"||e==="list"&&t.tagName==="INPUT"||e==="type"&&t.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const i=t.tagName;if(i==="IMG"||i==="VIDEO"||i==="CANVAS"||i==="SOURCE")return!1}return fi(e)&&ce(s)?!1:e in t}const Aa=be({patchProp:ba},sa);let hi;function wa(){return hi||(hi=Eo(Aa))}const xa=(...t)=>{const e=wa().createApp(...t),{mount:s}=e;return e.mount=n=>{const i=Ea(n);if(!i)return;const r=e._component;!G(r)&&!r.render&&!r.template&&(r.template=i.innerHTML),i.nodeType===1&&(i.textContent="");const o=s(i,!1,Sa(i));return i instanceof Element&&(i.removeAttribute("v-cloak"),i.setAttribute("data-v-app","")),o},e};function Sa(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function Ea(t){return ce(t)?document.querySelector(t):t}const Ca="modulepreload",_a=function(t){return"/"+t},di={},Qe=function(e,s,n){let i=Promise.resolve();if(s&&s.length>0){let o=function(u){return Promise.all(u.map(c=>Promise.resolve(c).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),a=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));i=o(s.map(u=>{if(u=_a(u),u in di)return;di[u]=!0;const c=u.endsWith(".css"),f=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${f}`))return;const p=document.createElement("link");if(p.rel=c?"stylesheet":Ca,c||(p.as="script"),p.crossOrigin="",p.href=u,a&&p.setAttribute("nonce",a),document.head.appendChild(p),c)return new Promise((g,C)=>{p.addEventListener("load",g),p.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${u}`)))})}))}function r(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return i.then(o=>{for(const l of o||[])l.status==="rejected"&&r(l.reason);return e().catch(r)})};/*! * vue-router v4.5.1 * (c) 2025 Eduardo San Martin Morote * @license MIT - */const Et=typeof document<"u";function Ur(t){return typeof t=="object"||"displayName"in t||"props"in t||"__vccOpts"in t}function Ca(t){return t.__esModule||t[Symbol.toStringTag]==="Module"||t.default&&Ur(t.default)}const J=Object.assign;function $s(t,e){const s={};for(const n in e){const i=e[n];s[n]=He(i)?i.map(t):t(i)}return s}const Wt=()=>{},He=Array.isArray,jr=/#/g,_a=/&/g,Oa=/\//g,Ta=/=/g,La=/\?/g,$r=/\+/g,Pa=/%5B/g,Ra=/%5D/g,zr=/%5E/g,Da=/%60/g,Wr=/%7B/g,ka=/%7C/g,Gr=/%7D/g,Fa=/%20/g;function Pn(t){return encodeURI(""+t).replace(ka,"|").replace(Pa,"[").replace(Ra,"]")}function Ia(t){return Pn(t).replace(Wr,"{").replace(Gr,"}").replace(zr,"^")}function an(t){return Pn(t).replace($r,"%2B").replace(Fa,"+").replace(jr,"%23").replace(_a,"%26").replace(Da,"`").replace(Wr,"{").replace(Gr,"}").replace(zr,"^")}function Ma(t){return an(t).replace(Ta,"%3D")}function Na(t){return Pn(t).replace(jr,"%23").replace(La,"%3F")}function Ha(t){return t==null?"":Na(t).replace(Oa,"%2F")}function ts(t){try{return decodeURIComponent(""+t)}catch{}return""+t}const Ba=/\/$/,Va=t=>t.replace(Ba,"");function zs(t,e,s="/"){let n,i={},r="",o="";const l=e.indexOf("#");let a=e.indexOf("?");return l=0&&(a=-1),a>-1&&(n=e.slice(0,a),r=e.slice(a+1,l>-1?l:e.length),i=t(r)),l>-1&&(n=n||e.slice(0,l),o=e.slice(l,e.length)),n=za(n??e,s),{fullPath:n+(r&&"?")+r+o,path:n,query:i,hash:ts(o)}}function Ua(t,e){const s=e.query?t(e.query):"";return e.path+(s&&"?")+s+(e.hash||"")}function hi(t,e){return!e||!t.toLowerCase().startsWith(e.toLowerCase())?t:t.slice(e.length)||"/"}function ja(t,e,s){const n=e.matched.length-1,i=s.matched.length-1;return n>-1&&n===i&&Dt(e.matched[n],s.matched[i])&&Kr(e.params,s.params)&&t(e.query)===t(s.query)&&e.hash===s.hash}function Dt(t,e){return(t.aliasOf||t)===(e.aliasOf||e)}function Kr(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(!$a(t[s],e[s]))return!1;return!0}function $a(t,e){return He(t)?di(t,e):He(e)?di(e,t):t===e}function di(t,e){return He(e)?t.length===e.length&&t.every((s,n)=>s===e[n]):t.length===1&&t[0]===e}function za(t,e){if(t.startsWith("/"))return t;if(!t)return e;const s=e.split("/"),n=t.split("/"),i=n[n.length-1];(i===".."||i===".")&&n.push("");let r=s.length-1,o,l;for(o=0;o1&&r--;else break;return s.slice(0,r).join("/")+"/"+n.slice(o).join("/")}const ct={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};var ss;(function(t){t.pop="pop",t.push="push"})(ss||(ss={}));var Gt;(function(t){t.back="back",t.forward="forward",t.unknown=""})(Gt||(Gt={}));function Wa(t){if(!t)if(Et){const e=document.querySelector("base");t=e&&e.getAttribute("href")||"/",t=t.replace(/^\w+:\/\/[^\/]+/,"")}else t="/";return t[0]!=="/"&&t[0]!=="#"&&(t="/"+t),Va(t)}const Ga=/^[^#]+#/;function Ka(t,e){return t.replace(Ga,"#")+e}function qa(t,e){const s=document.documentElement.getBoundingClientRect(),n=t.getBoundingClientRect();return{behavior:e.behavior,left:n.left-s.left-(e.left||0),top:n.top-s.top-(e.top||0)}}const Ds=()=>({left:window.scrollX,top:window.scrollY});function Ya(t){let e;if("el"in t){const s=t.el,n=typeof s=="string"&&s.startsWith("#"),i=typeof s=="string"?n?document.getElementById(s.slice(1)):document.querySelector(s):s;if(!i)return;e=qa(i,t)}else e=t;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.scrollX,e.top!=null?e.top:window.scrollY)}function pi(t,e){return(history.state?history.state.position-e:-1)+t}const cn=new Map;function Qa(t,e){cn.set(t,e)}function Ja(t){const e=cn.get(t);return cn.delete(t),e}let Za=()=>location.protocol+"//"+location.host;function qr(t,e){const{pathname:s,search:n,hash:i}=e,r=t.indexOf("#");if(r>-1){let l=i.includes(t.slice(r))?t.slice(r).length:1,a=i.slice(l);return a[0]!=="/"&&(a="/"+a),hi(a,"")}return hi(s,t)+n+i}function Xa(t,e,s,n){let i=[],r=[],o=null;const l=({state:p})=>{const g=qr(t,location),T=s.value,C=e.value;let D=0;if(p){if(s.value=g,e.value=p,o&&o===T){o=null;return}D=C?p.position-C.position:0}else n(g);i.forEach(L=>{L(s.value,T,{delta:D,type:ss.pop,direction:D?D>0?Gt.forward:Gt.back:Gt.unknown})})};function a(){o=s.value}function u(p){i.push(p);const g=()=>{const T=i.indexOf(p);T>-1&&i.splice(T,1)};return r.push(g),g}function c(){const{history:p}=window;p.state&&p.replaceState(J({},p.state,{scroll:Ds()}),"")}function f(){for(const p of r)p();r=[],window.removeEventListener("popstate",l),window.removeEventListener("beforeunload",c)}return window.addEventListener("popstate",l),window.addEventListener("beforeunload",c,{passive:!0}),{pauseListeners:a,listen:u,destroy:f}}function gi(t,e,s,n=!1,i=!1){return{back:t,current:e,forward:s,replaced:n,position:window.history.length,scroll:i?Ds():null}}function ec(t){const{history:e,location:s}=window,n={value:qr(t,s)},i={value:e.state};i.value||r(n.value,{back:null,current:n.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function r(a,u,c){const f=t.indexOf("#"),p=f>-1?(s.host&&document.querySelector("base")?t:t.slice(f))+a:Za()+t+a;try{e[c?"replaceState":"pushState"](u,"",p),i.value=u}catch(g){console.error(g),s[c?"replace":"assign"](p)}}function o(a,u){const c=J({},e.state,gi(i.value.back,a,i.value.forward,!0),u,{position:i.value.position});r(a,c,!0),n.value=a}function l(a,u){const c=J({},i.value,e.state,{forward:a,scroll:Ds()});r(c.current,c,!0);const f=J({},gi(n.value,a,null),{position:c.position+1},u);r(a,f,!1),n.value=a}return{location:n,state:i,push:l,replace:o}}function tc(t){t=Wa(t);const e=ec(t),s=Xa(t,e.state,e.location,e.replace);function n(r,o=!0){o||s.pauseListeners(),history.go(r)}const i=J({location:"",base:t,go:n,createHref:Ka.bind(null,t)},e,s);return Object.defineProperty(i,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(i,"state",{enumerable:!0,get:()=>e.state.value}),i}function sc(t){return typeof t=="string"||t&&typeof t=="object"}function Yr(t){return typeof t=="string"||typeof t=="symbol"}const Qr=Symbol("");var mi;(function(t){t[t.aborted=4]="aborted",t[t.cancelled=8]="cancelled",t[t.duplicated=16]="duplicated"})(mi||(mi={}));function kt(t,e){return J(new Error,{type:t,[Qr]:!0},e)}function Qe(t,e){return t instanceof Error&&Qr in t&&(e==null||!!(t.type&e))}const vi="[^/]+?",nc={sensitive:!1,strict:!1,start:!0,end:!0},ic=/[.+*?^${}()[\]/\\]/g;function rc(t,e){const s=J({},nc,e),n=[];let i=s.start?"^":"";const r=[];for(const u of t){const c=u.length?[]:[90];s.strict&&!u.length&&(i+="/");for(let f=0;fe.length?e.length===1&&e[0]===80?1:-1:0}function Jr(t,e){let s=0;const n=t.score,i=e.score;for(;s0&&e[e.length-1]<0}const oc={type:0,value:""},ac=/[a-zA-Z0-9_]/;function cc(t){if(!t)return[[]];if(t==="/")return[[oc]];if(!t.startsWith("/"))throw new Error(`Invalid path "${t}"`);function e(g){throw new Error(`ERR (${s})/"${u}": ${g}`)}let s=0,n=s;const i=[];let r;function o(){r&&i.push(r),r=[]}let l=0,a,u="",c="";function f(){u&&(s===0?r.push({type:0,value:u}):s===1||s===2||s===3?(r.length>1&&(a==="*"||a==="+")&&e(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),r.push({type:1,value:u,regexp:c,repeatable:a==="*"||a==="+",optional:a==="*"||a==="?"})):e("Invalid state to consume buffer"),u="")}function p(){u+=a}for(;l{o(b)}:Wt}function o(f){if(Yr(f)){const p=n.get(f);p&&(n.delete(f),s.splice(s.indexOf(p),1),p.children.forEach(o),p.alias.forEach(o))}else{const p=s.indexOf(f);p>-1&&(s.splice(p,1),f.record.name&&n.delete(f.record.name),f.children.forEach(o),f.alias.forEach(o))}}function l(){return s}function a(f){const p=pc(f,s);s.splice(p,0,f),f.record.name&&!Ai(f)&&n.set(f.record.name,f)}function u(f,p){let g,T={},C,D;if("name"in f&&f.name){if(g=n.get(f.name),!g)throw kt(1,{location:f});D=g.record.name,T=J(yi(p.params,g.keys.filter(b=>!b.optional).concat(g.parent?g.parent.keys.filter(b=>b.optional):[]).map(b=>b.name)),f.params&&yi(f.params,g.keys.map(b=>b.name))),C=g.stringify(T)}else if(f.path!=null)C=f.path,g=s.find(b=>b.re.test(C)),g&&(T=g.parse(C),D=g.record.name);else{if(g=p.name?n.get(p.name):s.find(b=>b.re.test(p.path)),!g)throw kt(1,{location:f,currentLocation:p});D=g.record.name,T=J({},p.params,f.params),C=g.stringify(T)}const L=[];let m=g;for(;m;)L.unshift(m.record),m=m.parent;return{name:D,path:C,params:T,matched:L,meta:dc(L)}}t.forEach(f=>r(f));function c(){s.length=0,n.clear()}return{addRoute:r,resolve:u,removeRoute:o,clearRoutes:c,getRoutes:l,getRecordMatcher:i}}function yi(t,e){const s={};for(const n of e)n in t&&(s[n]=t[n]);return s}function wi(t){const e={path:t.path,redirect:t.redirect,name:t.name,meta:t.meta||{},aliasOf:t.aliasOf,beforeEnter:t.beforeEnter,props:hc(t),children:t.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in t?t.components||null:t.component&&{default:t.component}};return Object.defineProperty(e,"mods",{value:{}}),e}function hc(t){const e={},s=t.props||!1;if("component"in t)e.default=s;else for(const n in t.components)e[n]=typeof s=="object"?s[n]:s;return e}function Ai(t){for(;t;){if(t.record.aliasOf)return!0;t=t.parent}return!1}function dc(t){return t.reduce((e,s)=>J(e,s.meta),{})}function xi(t,e){const s={};for(const n in t)s[n]=n in e?e[n]:t[n];return s}function pc(t,e){let s=0,n=e.length;for(;s!==n;){const r=s+n>>1;Jr(t,e[r])<0?n=r:s=r+1}const i=gc(t);return i&&(n=e.lastIndexOf(i,n-1)),n}function gc(t){let e=t;for(;e=e.parent;)if(Zr(e)&&Jr(t,e)===0)return e}function Zr({record:t}){return!!(t.name||t.components&&Object.keys(t.components).length||t.redirect)}function mc(t){const e={};if(t===""||t==="?")return e;const n=(t[0]==="?"?t.slice(1):t).split("&");for(let i=0;ir&&an(r)):[n&&an(n)]).forEach(r=>{r!==void 0&&(e+=(e.length?"&":"")+s,r!=null&&(e+="="+r))})}return e}function vc(t){const e={};for(const s in t){const n=t[s];n!==void 0&&(e[s]=He(n)?n.map(i=>i==null?null:""+i):n==null?n:""+n)}return e}const bc=Symbol(""),Ei=Symbol(""),Rn=Symbol(""),Xr=Symbol(""),un=Symbol("");function Nt(){let t=[];function e(n){return t.push(n),()=>{const i=t.indexOf(n);i>-1&&t.splice(i,1)}}function s(){t=[]}return{add:e,list:()=>t.slice(),reset:s}}function ht(t,e,s,n,i,r=o=>o()){const o=n&&(n.enterCallbacks[i]=n.enterCallbacks[i]||[]);return()=>new Promise((l,a)=>{const u=p=>{p===!1?a(kt(4,{from:s,to:e})):p instanceof Error?a(p):sc(p)?a(kt(2,{from:e,to:p})):(o&&n.enterCallbacks[i]===o&&typeof p=="function"&&o.push(p),l())},c=r(()=>t.call(n&&n.instances[i],e,s,u));let f=Promise.resolve(c);t.length<3&&(f=f.then(u)),f.catch(p=>a(p))})}function Ws(t,e,s,n,i=r=>r()){const r=[];for(const o of t)for(const l in o.components){let a=o.components[l];if(!(e!=="beforeRouteEnter"&&!o.instances[l]))if(Ur(a)){const c=(a.__vccOpts||a)[e];c&&r.push(ht(c,s,n,o,l,i))}else{let u=a();r.push(()=>u.then(c=>{if(!c)throw new Error(`Couldn't resolve component "${l}" at "${o.path}"`);const f=Ca(c)?c.default:c;o.mods[l]=c,o.components[l]=f;const g=(f.__vccOpts||f)[e];return g&&ht(g,s,n,o,l,i)()}))}}return r}function Ci(t){const e=et(Rn),s=et(Xr),n=Me(()=>{const a=wt(t.to);return e.resolve(a)}),i=Me(()=>{const{matched:a}=n.value,{length:u}=a,c=a[u-1],f=s.matched;if(!c||!f.length)return-1;const p=f.findIndex(Dt.bind(null,c));if(p>-1)return p;const g=_i(a[u-2]);return u>1&&_i(c)===g&&f[f.length-1].path!==g?f.findIndex(Dt.bind(null,a[u-2])):p}),r=Me(()=>i.value>-1&&Sc(s.params,n.value.params)),o=Me(()=>i.value>-1&&i.value===s.matched.length-1&&Kr(s.params,n.value.params));function l(a={}){if(xc(a)){const u=e[wt(t.replace)?"replace":"push"](wt(t.to)).catch(Wt);return t.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>u),u}return Promise.resolve()}return{route:n,href:Me(()=>n.value.href),isActive:r,isExactActive:o,navigate:l}}function yc(t){return t.length===1?t[0]:t}const wc=Ts({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"},viewTransition:Boolean},useLink:Ci,setup(t,{slots:e}){const s=_s(Ci(t)),{options:n}=et(Rn),i=Me(()=>({[Oi(t.activeClass,n.linkActiveClass,"router-link-active")]:s.isActive,[Oi(t.exactActiveClass,n.linkExactActiveClass,"router-link-exact-active")]:s.isExactActive}));return()=>{const r=e.default&&yc(e.default(s));return t.custom?r:Br("a",{"aria-current":s.isExactActive?t.ariaCurrentValue:null,href:s.href,onClick:s.navigate,class:i.value},r)}}}),Ac=wc;function xc(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&!(t.button!==void 0&&t.button!==0)){if(t.currentTarget&&t.currentTarget.getAttribute){const e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function Sc(t,e){for(const s in e){const n=e[s],i=t[s];if(typeof n=="string"){if(n!==i)return!1}else if(!He(i)||i.length!==n.length||n.some((r,o)=>r!==i[o]))return!1}return!0}function _i(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const Oi=(t,e,s)=>t??e??s,Ec=Ts({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(t,{attrs:e,slots:s}){const n=et(un),i=Me(()=>t.route||n.value),r=et(Ei,0),o=Me(()=>{let u=wt(r);const{matched:c}=i.value;let f;for(;(f=c[u])&&!f.components;)u++;return u}),l=Me(()=>i.value.matched[o.value]);as(Ei,Me(()=>o.value+1)),as(bc,l),as(un,i);const a=sr();return cs(()=>[a.value,l.value,t.name],([u,c,f],[p,g,T])=>{c&&(c.instances[f]=u,g&&g!==c&&u&&u===p&&(c.leaveGuards.size||(c.leaveGuards=g.leaveGuards),c.updateGuards.size||(c.updateGuards=g.updateGuards))),u&&c&&(!g||!Dt(c,g)||!p)&&(c.enterCallbacks[f]||[]).forEach(C=>C(u))},{flush:"post"}),()=>{const u=i.value,c=t.name,f=l.value,p=f&&f.components[c];if(!p)return Ti(s.default,{Component:p,route:u});const g=f.props[c],T=g?g===!0?u.params:typeof g=="function"?g(u):g:null,D=Br(p,J({},T,e,{onVnodeUnmounted:L=>{L.component.isUnmounted&&(f.instances[c]=null)},ref:a}));return Ti(s.default,{Component:D,route:u})||D}}});function Ti(t,e){if(!t)return null;const s=t(e);return s.length===1?s[0]:s}const Cc=Ec;function _c(t){const e=fc(t.routes,t),s=t.parseQuery||mc,n=t.stringifyQuery||Si,i=t.history,r=Nt(),o=Nt(),l=Nt(),a=Fl(ct);let u=ct;Et&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=$s.bind(null,w=>""+w),f=$s.bind(null,Ha),p=$s.bind(null,ts);function g(w,N){let k,H;return Yr(w)?(k=e.getRecordMatcher(w),H=N):H=w,e.addRoute(H,k)}function T(w){const N=e.getRecordMatcher(w);N&&e.removeRoute(N)}function C(){return e.getRoutes().map(w=>w.record)}function D(w){return!!e.getRecordMatcher(w)}function L(w,N){if(N=J({},N||a.value),typeof w=="string"){const v=zs(s,w,N.path),A=e.resolve({path:v.path},N),S=i.createHref(v.fullPath);return J(v,A,{params:p(A.params),hash:ts(v.hash),redirectedFrom:void 0,href:S})}let k;if(w.path!=null)k=J({},w,{path:zs(s,w.path,N.path).path});else{const v=J({},w.params);for(const A in v)v[A]==null&&delete v[A];k=J({},w,{params:f(v)}),N.params=f(N.params)}const H=e.resolve(k,N),Y=w.hash||"";H.params=c(p(H.params));const h=Ua(n,J({},w,{hash:Ia(Y),path:H.path})),d=i.createHref(h);return J({fullPath:h,hash:Y,query:n===Si?vc(w.query):w.query||{}},H,{redirectedFrom:void 0,href:d})}function m(w){return typeof w=="string"?zs(s,w,a.value.path):J({},w)}function b(w,N){if(u!==w)return kt(8,{from:N,to:w})}function y(w){return F(w)}function E(w){return y(J(m(w),{replace:!0}))}function O(w){const N=w.matched[w.matched.length-1];if(N&&N.redirect){const{redirect:k}=N;let H=typeof k=="function"?k(w):k;return typeof H=="string"&&(H=H.includes("?")||H.includes("#")?H=m(H):{path:H},H.params={}),J({query:w.query,hash:w.hash,params:H.path!=null?{}:w.params},H)}}function F(w,N){const k=u=L(w),H=a.value,Y=w.state,h=w.force,d=w.replace===!0,v=O(k);if(v)return F(J(m(v),{state:typeof v=="object"?J({},Y,v.state):Y,force:h,replace:d}),N||k);const A=k;A.redirectedFrom=N;let S;return!h&&ja(n,H,k)&&(S=kt(16,{to:A,from:H}),we(H,H,!0,!1)),(S?Promise.resolve(S):q(A,H)).catch(x=>Qe(x)?Qe(x,2)?x:ye(x):j(x,A,H)).then(x=>{if(x){if(Qe(x,2))return F(J({replace:d},m(x.to),{state:typeof x.to=="object"?J({},Y,x.to.state):Y,force:h}),N||A)}else x=pe(A,H,!0,d,Y);return re(A,H,x),x})}function W(w,N){const k=b(w,N);return k?Promise.reject(k):Promise.resolve()}function B(w){const N=Ae.values().next().value;return N&&typeof N.runWithContext=="function"?N.runWithContext(w):w()}function q(w,N){let k;const[H,Y,h]=Oc(w,N);k=Ws(H.reverse(),"beforeRouteLeave",w,N);for(const v of H)v.leaveGuards.forEach(A=>{k.push(ht(A,w,N))});const d=W.bind(null,w,N);return k.push(d),fe(k).then(()=>{k=[];for(const v of r.list())k.push(ht(v,w,N));return k.push(d),fe(k)}).then(()=>{k=Ws(Y,"beforeRouteUpdate",w,N);for(const v of Y)v.updateGuards.forEach(A=>{k.push(ht(A,w,N))});return k.push(d),fe(k)}).then(()=>{k=[];for(const v of h)if(v.beforeEnter)if(He(v.beforeEnter))for(const A of v.beforeEnter)k.push(ht(A,w,N));else k.push(ht(v.beforeEnter,w,N));return k.push(d),fe(k)}).then(()=>(w.matched.forEach(v=>v.enterCallbacks={}),k=Ws(h,"beforeRouteEnter",w,N,B),k.push(d),fe(k))).then(()=>{k=[];for(const v of o.list())k.push(ht(v,w,N));return k.push(d),fe(k)}).catch(v=>Qe(v,8)?v:Promise.reject(v))}function re(w,N,k){l.list().forEach(H=>B(()=>H(w,N,k)))}function pe(w,N,k,H,Y){const h=b(w,N);if(h)return h;const d=N===ct,v=Et?history.state:{};k&&(H||d?i.replace(w.fullPath,J({scroll:d&&v&&v.scroll},Y)):i.push(w.fullPath,Y)),a.value=w,we(w,N,k,d),ye()}let Te;function lt(){Te||(Te=i.listen((w,N,k)=>{if(!Be.listening)return;const H=L(w),Y=O(H);if(Y){F(J(Y,{replace:!0,force:!0}),H).catch(Wt);return}u=H;const h=a.value;Et&&Qa(pi(h.fullPath,k.delta),Ds()),q(H,h).catch(d=>Qe(d,12)?d:Qe(d,2)?(F(J(m(d.to),{force:!0}),H).then(v=>{Qe(v,20)&&!k.delta&&k.type===ss.pop&&i.go(-1,!1)}).catch(Wt),Promise.reject()):(k.delta&&i.go(-k.delta,!1),j(d,H,h))).then(d=>{d=d||pe(H,h,!1),d&&(k.delta&&!Qe(d,8)?i.go(-k.delta,!1):k.type===ss.pop&&Qe(d,20)&&i.go(-1,!1)),re(H,h,d)}).catch(Wt)}))}let ot=Nt(),oe=Nt(),Q;function j(w,N,k){ye(w);const H=oe.list();return H.length?H.forEach(Y=>Y(w,N,k)):console.error(w),Promise.reject(w)}function ae(){return Q&&a.value!==ct?Promise.resolve():new Promise((w,N)=>{ot.add([w,N])})}function ye(w){return Q||(Q=!w,lt(),ot.list().forEach(([N,k])=>w?k(w):N()),ot.reset()),w}function we(w,N,k,H){const{scrollBehavior:Y}=t;if(!Et||!Y)return Promise.resolve();const h=!k&&Ja(pi(w.fullPath,0))||(H||!k)&&history.state&&history.state.scroll||null;return lr().then(()=>Y(w,N,h)).then(d=>d&&Ya(d)).catch(d=>j(d,w,N))}const te=w=>i.go(w);let at;const Ae=new Set,Be={currentRoute:a,listening:!0,addRoute:g,removeRoute:T,clearRoutes:e.clearRoutes,hasRoute:D,getRoutes:C,resolve:L,options:t,push:y,replace:E,go:te,back:()=>te(-1),forward:()=>te(1),beforeEach:r.add,beforeResolve:o.add,afterEach:l.add,onError:oe.add,isReady:ae,install(w){const N=this;w.component("RouterLink",Ac),w.component("RouterView",Cc),w.config.globalProperties.$router=N,Object.defineProperty(w.config.globalProperties,"$route",{enumerable:!0,get:()=>wt(a)}),Et&&!at&&a.value===ct&&(at=!0,y(i.location).catch(Y=>{}));const k={};for(const Y in ct)Object.defineProperty(k,Y,{get:()=>a.value[Y],enumerable:!0});w.provide(Rn,N),w.provide(Xr,er(k)),w.provide(un,a);const H=w.unmount;Ae.add(w),w.unmount=function(){Ae.delete(w),Ae.size<1&&(u=ct,Te&&Te(),Te=null,a.value=ct,at=!1,Q=!1),H()}}};function fe(w){return w.reduce((N,k)=>N.then(()=>B(k)),Promise.resolve())}return Be}function Oc(t,e){const s=[],n=[],i=[],r=Math.max(e.matched.length,t.matched.length);for(let o=0;oDt(u,l))?n.push(l):s.push(l));const a=t.matched[o];a&&(e.matched.find(u=>Dt(u,a))||i.push(a))}return[s,n,i]}const Tc=_c({history:tc(),linkActiveClass:"active",routes:[{path:"/",name:"Home",component:()=>Ye(()=>import("./home.js"),__vite__mapDeps([0,1]))},{path:"/install",name:"Install",component:()=>Ye(()=>import("./install.js"),[])},{path:"/selects",name:"Selects",component:()=>Ye(()=>import("./selects.js"),[])},{path:"/data",name:"Data",component:()=>Ye(()=>import("./data.js"),[])},{path:"/examples",name:"Examples",component:()=>Ye(()=>import("./index2.js"),__vite__mapDeps([2,3]))},{path:"/settings",name:"Settings",component:()=>Ye(()=>import("./index3.js"),__vite__mapDeps([4,5]))},{path:"/events",name:"Events",component:()=>Ye(()=>import("./index4.js"),[])},{path:"/methods",name:"Methods",component:()=>Ye(()=>import("./index5.js"),[])},{path:"/vue",name:"Vue",component:()=>Ye(()=>import("./vue.js"),[])}]});class Lc{constructor(e){e||(e={}),this.main=e.main||"ss-main",this.placeholder=e.placeholder||"ss-placeholder",this.values=e.values||"ss-values",this.single=e.single||"ss-single",this.max=e.max||"ss-max",this.value=e.value||"ss-value",this.valueText=e.valueText||"ss-value-text",this.valueDelete=e.valueDelete||"ss-value-delete",this.valueOut=e.valueOut||"ss-value-out",this.deselect=e.deselect||"ss-deselect",this.deselectPath=e.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=e.arrow||"ss-arrow",this.arrowClose=e.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=e.arrowOpen||"M10,70 L50,30 L90,70",this.content=e.content||"ss-content",this.openAbove=e.openAbove||"ss-open-above",this.openBelow=e.openBelow||"ss-open-below",this.search=e.search||"ss-search",this.searchHighlighter=e.searchHighlighter||"ss-search-highlight",this.searching=e.searching||"ss-searching",this.addable=e.addable||"ss-addable",this.addablePath=e.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=e.list||"ss-list",this.optgroup=e.optgroup||"ss-optgroup",this.optgroupLabel=e.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=e.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=e.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=e.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=e.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=e.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=e.optgroupClosable||"ss-closable",this.option=e.option||"ss-option",this.optionDelete=e.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=e.highlighted||"ss-highlighted",this.open=e.open||"ss-open",this.close=e.close||"ss-close",this.selected=e.selected||"ss-selected",this.error=e.error||"ss-error",this.disabled=e.disabled||"ss-disabled",this.hide=e.hide||"ss-hide"}}function Dn(){return Math.random().toString(36).substring(2,10)}function Pc(t,e){function s(i,r){return r&&i&&i.classList&&i.classList.contains(r)||r&&i&&i.dataset&&i.dataset.id&&i.dataset.id===e?i:null}function n(i,r){return!i||i===document?null:s(i,r)?i:n(i.parentNode,r)}return s(t,e)||n(t,e)}function Kt(t,e=50,s=!1){let n;return function(...i){const r=self,o=()=>{n=null,s||t.apply(r,i)},l=s&&!n;clearTimeout(n),n=setTimeout(o,e),l&&t.apply(r,i)}}function Gs(t,e){return JSON.stringify(t)===JSON.stringify(e)}function Rc(t){const e=t.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,s=>"-"+s.toLowerCase());return t[0]===t[0].toUpperCase()?e.substring(1):e}class Ie{constructor(e){if(this.id=!e.id||e.id===""?Dn():e.id,this.label=e.label||"",this.selectAll=e.selectAll===void 0?!1:e.selectAll,this.selectAllText=e.selectAllText||"Select All",this.closable=e.closable||"off",this.options=[],e.options)for(const s of e.options)this.options.push(new ue(s))}}class ue{constructor(e){this.id=!e.id||e.id===""?Dn():e.id,this.value=e.value===void 0?e.text:e.value,this.text=e.text||"",this.html=e.html||"",this.defaultSelected=e.defaultSelected!==void 0?e.defaultSelected:!1,this.selected=e.selected!==void 0?e.selected:!1,this.display=e.display!==void 0?e.display:!0,this.disabled=e.disabled!==void 0?e.disabled:!1,this.mandatory=e.mandatory!==void 0?e.mandatory:!1,this.placeholder=e.placeholder!==void 0?e.placeholder:!1,this.class=e.class||"",this.style=e.style||"",this.data=e.data||{}}}class Dc{constructor(e,s){this.selectType="single",this.data=[],this.selectedOrder=[],this.selectType=e,this.setData(s)}validateDataArray(e){if(!Array.isArray(e))return new Error("Data must be an array");for(let s of e)if(s instanceof Ie||"label"in s){if(!("label"in s))return new Error("Optgroup must have a label");if("options"in s&&s.options)for(let n of s.options){const i=this.validateOption(n);if(i)return i}}else if(s instanceof ue||"text"in s){const n=this.validateOption(s);if(n)return n}else return new Error("Data object must be a valid optgroup or option");return null}validateOption(e){return"text"in e?null:new Error("Option must have a text")}partialToFullData(e){let s=[];return e.forEach(n=>{if(n instanceof Ie||"label"in n){let i=[];"options"in n&&n.options&&n.options.forEach(r=>{i.push(new ue(r))}),i.length>0&&s.push(new Ie(n))}(n instanceof ue||"text"in n)&&s.push(new ue(n))}),s}setData(e){this.data=this.partialToFullData(e),this.selectType==="single"&&this.setSelectedBy("id",this.getSelected())}getData(){return this.filter(null,!0)}getDataOptions(){return this.filter(null,!1)}addOption(e,s=!1){if(s){let n=[new ue(e)];this.setData(n.concat(this.getData()))}else this.setData(this.getData().concat(new ue(e)))}setSelectedBy(e,s){let n=null,i=!1;const r=[];for(let l of this.data){if(l instanceof Ie)for(let a of l.options)n||(n=a),a.selected=i?!1:s.includes(a[e]),a.selected&&(r.push(a),this.selectType==="single"&&(i=!0));l instanceof ue&&(n||(n=l),l.selected=i?!1:s.includes(l[e]),l.selected&&(r.push(l),this.selectType==="single"&&(i=!0)))}this.selectType==="single"&&n&&!i&&(n.selected=!0,r.push(n));const o=s.map(l=>{var a;return((a=r.find(u=>u[e]===l))==null?void 0:a.id)||""});this.selectedOrder=o}getSelected(){return this.getSelectedOptions().map(e=>e.id)}getSelectedValues(){return this.getSelectedOptions().map(e=>e.value)}getSelectedOptions(){return this.filter(e=>e.selected,!1)}getOptgroupByID(e){for(let s of this.data)if(s instanceof Ie&&s.id===e)return s;return null}getOptionByID(e){let s=this.filter(n=>n.id===e,!1);return s.length?s[0]:null}getSelectType(){return this.selectType}getFirstOption(){let e=null;for(let s of this.data)if(s instanceof Ie?e=s.options[0]:s instanceof ue&&(e=s),e)break;return e}search(e,s){return e=e.trim(),e===""?this.getData():this.filter(n=>s(n,e),!0)}filter(e,s){const n=[];return this.data.forEach(i=>{if(i instanceof Ie){let r=[];if(i.options.forEach(o=>{(!e||e(o))&&(s?r.push(new ue(o)):n.push(new ue(o)))}),r.length>0){let o=new Ie(i);o.options=r,n.push(o)}}i instanceof ue&&(!e||e(i))&&n.push(new ue(i))}),n}selectedOrderOptions(e){const s=[];return this.selectedOrder.forEach(n=>{const i=e.find(r=>r.id===n);i&&s.push(i)}),e.forEach(n=>{let i=!1;s.forEach(r=>{if(n.id===r.id){i=!0;return}}),i||s.push(n)}),s}}class kc{constructor(e,s,n,i){var o;this.store=n,this.settings=e,this.classes=s,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes();const r=(o=document.querySelector(`[data-id="${this.settings.id}"]`))==null?void 0:o.closest(".offcanvas-body");r?r.appendChild(this.content.main):this.settings.contentLocation&&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 e=this.store.getSelectedOptions();if(e.length){const s=e[e.length-1].id,n=this.content.list.querySelector('[data-id="'+s+'"]');n&&this.ensureElementInView(this.content.list,n)}this.settings.contentPosition==="fixed"&&(this.moveContent(),this.scrollHandler=()=>this.moveContent(),this.resizeHandler=()=>this.moveContent(),window.addEventListener("scroll",this.scrollHandler,!0),window.addEventListener("resize",this.resizeHandler))}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),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=void 0),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=void 0)}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.main.main.classList.add("ss-2"),this.content.main.classList.add(this.classes.content),this.content.main.classList.add("ss-content-2"),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()));(this.settings.contentPosition==="relative"||this.settings.contentPosition==="fixed")&&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.list.setAttribute("role","listbox"),this.content.list.setAttribute("aria-label",this.settings.contentAriaLabel)}mainDiv(){var u;const e=document.createElement("div");e.id=this.settings.id+"-main",e.setAttribute("aria-label",this.settings.ariaLabel),e.tabIndex=0,e.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 f=this.content.list.querySelector("."+this.classes.highlighted);return f&&f.click(),!1;case"Escape":return this.callbacks.close(),!1}return c.key.length===1&&this.callbacks.open(),!0},e.onclick=c=>{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 n=document.createElement("div");n.classList.add(this.classes.deselect);const i=(u=this.store)==null?void 0:u.getSelectedOptions();!this.settings.allowDeselect||this.settings.isMultiple&&i&&i.length<=0?n.classList.add(this.classes.hide):n.classList.remove(this.classes.hide),n.onclick=c=>{if(c.stopPropagation(),this.settings.disabled)return;let f=!0;const p=this.store.getSelectedOptions(),g=[];if(this.callbacks.beforeChange&&(f=this.callbacks.beforeChange(g,p)===!0),f){if(this.settings.isMultiple)this.callbacks.setSelected([],!1),this.updateDeselectAll();else{const T=this.store.getFirstOption(),C=T?T.id:"";this.callbacks.setSelected(C,!1)}this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(this.store.getSelectedOptions())}};const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("viewBox","0 0 100 100");const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.deselectPath),r.appendChild(o),n.appendChild(r),e.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.classList.add(this.classes.arrow),l.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&&l.classList.add(this.classes.hide),l.appendChild(a),e.appendChild(l),{main:e,values:s,deselect:{main:n,svg:r,path:o},arrow:{main:l,path:a}}}mainFocus(e){e!=="click"&&this.main.main.focus({preventScroll:!0})}placeholder(){const e=this.store.filter(i=>i.placeholder,!1);let s=this.settings.placeholderText;e.length&&(e[0].html!==""?s=e[0].html:e[0].text!==""&&(s=e[0].text));const n=document.createElement("div");return n.classList.add(this.classes.placeholder),n.innerHTML=s,n}renderValues(){if(!this.settings.isMultiple){this.renderSingleValue();return}this.renderMultipleValues(),this.updateDeselectAll()}renderSingleValue(){const e=this.store.filter(n=>n.selected&&!n.placeholder,!1),s=e.length>0?e[0]:null;if(!s)this.main.values.innerHTML=this.placeholder().outerHTML;else{const n=document.createElement("div");n.classList.add(this.classes.single),s.html?n.innerHTML=s.html:n.innerText=s.text,this.main.values.innerHTML=n.outerHTML}!this.settings.allowDeselect||!e.length?this.main.deselect.main.classList.add(this.classes.hide):this.main.deselect.main.classList.remove(this.classes.hide)}renderMultipleValues(){let e=this.main.values.childNodes,s=this.store.filter(i=>i.selected&&i.display,!1);if(s.length===0){this.main.values.innerHTML=this.placeholder().outerHTML;return}else{const i=this.main.values.querySelector("."+this.classes.placeholder);i&&i.remove()}if(s.length>this.settings.maxValuesShown){const i=document.createElement("div");i.classList.add(this.classes.max),i.textContent=this.settings.maxValuesMessage.replace("{number}",s.length.toString()),this.main.values.innerHTML=i.outerHTML;return}else{const i=this.main.values.querySelector("."+this.classes.max);i&&i.remove()}this.settings.keepOrder&&(s=this.store.selectedOrderOptions(s));let n=[];for(let i=0;ia.id===o,!1).length||n.push(r))}for(const i of n)i.classList.add(this.classes.valueOut),setTimeout(()=>{this.main.values.hasChildNodes()&&this.main.values.contains(i)&&this.main.values.removeChild(i)},100);e=this.main.values.childNodes;for(let i=0;i{if(l.preventDefault(),l.stopPropagation(),this.settings.disabled)return;let a=!0;const u=this.store.getSelectedOptions(),c=u.filter(f=>f.selected&&f.id!==e.id,!0);if(!(this.settings.minSelected&&c.length{l.key==="Enter"&&i.click()}}return s}contentDiv(){const e=document.createElement("div");e.id=this.settings.id+"-content";const s=this.searchDiv();e.appendChild(s.main);const n=this.listDiv();return e.appendChild(n),{main:e,search:s,list:n}}moveContent(){if(this.settings.contentPosition==="relative"){this.moveContentBelow();return}if(this.settings.openPosition==="down"){this.moveContentBelow();return}else if(this.settings.openPosition==="up"){this.moveContentAbove();return}this.putContent()==="up"?this.moveContentAbove():this.moveContentBelow()}searchDiv(){const e=document.createElement("div"),s=document.createElement("input"),n=document.createElement("div");e.classList.add(this.classes.search);const i={main:e,input:s};if(this.settings.showSearch||(e.classList.add(this.classes.hide),s.readOnly=!0),s.type="search",s.placeholder=this.settings.searchPlaceholder,s.tabIndex=-1,s.setAttribute("aria-label",this.settings.searchPlaceholder),s.setAttribute("autocapitalize","off"),s.setAttribute("autocomplete","off"),s.setAttribute("autocorrect","off"),s.oninput=Kt(r=>{this.callbacks.search(r.target.value)},100),s.onkeydown=r=>{switch(r.key){case"ArrowUp":case"ArrowDown":return r.key==="ArrowDown"?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Escape":return this.callbacks.close(),!1;case" ":const o=this.content.list.querySelector("."+this.classes.highlighted);return o?(o.click(),!1):!0;case"Enter":if(this.callbacks.addable)return n.click(),!1;{const l=this.content.list.querySelector("."+this.classes.highlighted);if(l)return l.click(),!1}return!0}return!0},e.appendChild(s),this.callbacks.addable){n.classList.add(this.classes.addable);const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("viewBox","0 0 100 100");const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.addablePath),r.appendChild(o),n.appendChild(r),n.onclick=l=>{if(l.preventDefault(),l.stopPropagation(),!this.callbacks.addable)return;const a=this.content.search.input.value.trim();if(a===""){this.content.search.input.focus();return}const u=f=>{let p=new ue(f);if(this.callbacks.addOption(p),this.settings.isMultiple){let g=this.store.getSelected();g.push(p.id),this.callbacks.setSelected(g,!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(f=>{typeof f=="string"?u({text:f,value:f}):c instanceof Error?this.renderError(c.message):u(f)}):typeof c=="string"?u({text:c,value:c}):c instanceof Error?this.renderError(c.message):u(c))},e.appendChild(n),i.addable={main:n,svg:r,path:o}}return i}searchFocus(){this.content.search.input.focus()}getOptions(e=!1,s=!1,n=!1){let i="."+this.classes.option;return e&&(i+=":not(."+this.classes.placeholder+")"),s&&(i+=":not(."+this.classes.disabled+")"),n&&(i+=":not(."+this.classes.hide+")"),Array.from(this.content.list.querySelectorAll(i))}highlight(e){const s=this.getOptions(!0,!0,!0);if(s.length===0)return;if(s.length===1&&!s[0].classList.contains(this.classes.highlighted)){s[0].classList.add(this.classes.highlighted);return}let n=!1;for(const i of s)i.classList.contains(this.classes.highlighted)&&(n=!0);if(!n){for(const i of s)if(i.classList.contains(this.classes.selected)){i.classList.add(this.classes.highlighted);break}}for(let i=0;i=0?i-1:s.length-1];l.classList.add(this.classes.highlighted),this.ensureElementInView(this.content.list,l);const a=l.parentElement;if(a&&a.classList.contains(this.classes.close)){const u=a.querySelector("."+this.classes.optgroupLabel);u&&u.click()}return}s[e==="down"?0:s.length-1].classList.add(this.classes.highlighted),this.ensureElementInView(this.content.list,s[e==="down"?0:s.length-1])}listDiv(){const e=document.createElement("div");return e.classList.add(this.classes.list),e}renderError(e){this.content.list.innerHTML="";const s=document.createElement("div");s.classList.add(this.classes.error),s.textContent=e,this.content.list.appendChild(s)}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="",e.length===0){const n=document.createElement("div");n.classList.add(this.classes.search),this.callbacks.addable?n.innerHTML=this.settings.addableText.replace("{value}",this.content.search.input.value):n.innerHTML=this.settings.searchText,this.content.list.appendChild(n);return}this.settings.allowDeselect&&!this.settings.isMultiple&&(this.store.filter(i=>i.placeholder,!1).length||this.store.addOption(new ue({text:"",value:"",selected:!1,placeholder:!0}),!0));const s=document.createDocumentFragment();for(const n of e){if(n instanceof Ie){const i=document.createElement("div");i.classList.add(this.classes.optgroup);const r=document.createElement("div");r.classList.add(this.classes.optgroupLabel),i.appendChild(r);const o=document.createElement("div");o.classList.add(this.classes.optgroupLabelText),o.textContent=n.label,r.appendChild(o);const l=document.createElement("div");if(l.classList.add(this.classes.optgroupActions),r.appendChild(l),this.settings.isMultiple&&n.selectAll){const a=document.createElement("div");a.classList.add(this.classes.optgroupSelectAll);let u=!0;for(const T of n.options)if(!T.selected){u=!1;break}u&&a.classList.add(this.classes.selected);const c=document.createElement("span");c.textContent=n.selectAllText,a.appendChild(c);const f=document.createElementNS("http://www.w3.org/2000/svg","svg");f.setAttribute("viewBox","0 0 100 100"),a.appendChild(f);const p=document.createElementNS("http://www.w3.org/2000/svg","path");p.setAttribute("d",this.classes.optgroupSelectAllBox),f.appendChild(p);const g=document.createElementNS("http://www.w3.org/2000/svg","path");g.setAttribute("d",this.classes.optgroupSelectAllCheck),f.appendChild(g),a.addEventListener("click",T=>{T.preventDefault(),T.stopPropagation();const C=this.store.getSelected();if(u){const D=C.filter(L=>{for(const m of n.options)if(L===m.id)return!1;return!0});this.callbacks.setSelected(D,!0);return}else{const D=C.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(D,!0);return}}),l.appendChild(a)}if(n.closable!=="off"){const a=document.createElement("div");a.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),a.appendChild(u);const c=document.createElementNS("http://www.w3.org/2000/svg","path");u.appendChild(c),n.options.some(f=>f.selected)||this.content.search.input.value.trim()!==""?(a.classList.add(this.classes.open),c.setAttribute("d",this.classes.arrowOpen)):n.closable==="open"?(i.classList.add(this.classes.open),c.setAttribute("d",this.classes.arrowOpen)):n.closable==="close"&&(i.classList.add(this.classes.close),c.setAttribute("d",this.classes.arrowClose)),r.addEventListener("click",f=>{f.preventDefault(),f.stopPropagation(),i.classList.contains(this.classes.close)?(i.classList.remove(this.classes.close),i.classList.add(this.classes.open),c.setAttribute("d",this.classes.arrowOpen)):(i.classList.remove(this.classes.open),i.classList.add(this.classes.close),c.setAttribute("d",this.classes.arrowClose))}),l.appendChild(a)}i.appendChild(r);for(const a of n.options)i.appendChild(this.option(a)),s.appendChild(i)}n instanceof ue&&s.appendChild(this.option(n))}this.content.list.appendChild(s)}option(e){if(e.placeholder){const n=document.createElement("div");return n.classList.add(this.classes.option),n.classList.add(this.classes.hide),n}const s=document.createElement("div");return s.id=e.id,s.classList.add(this.classes.option),s.setAttribute("role","option"),e.class&&e.class.split(" ").forEach(n=>{s.classList.add(n)}),e.style&&(s.style.cssText=e.style),this.settings.searchHighlight&&this.content.search.input.value.trim()!==""?s.innerHTML=this.highlightText(e.html!==""?e.html:e.text,this.content.search.input.value,this.classes.searchHighlighter):e.html!==""?s.innerHTML=e.html:s.textContent=e.text,this.settings.showOptionTooltips&&s.textContent&&s.setAttribute("title",s.textContent),e.display||s.classList.add(this.classes.hide),e.disabled&&s.classList.add(this.classes.disabled),e.selected&&this.settings.hideSelected&&s.classList.add(this.classes.hide),e.selected?(s.classList.add(this.classes.selected),s.setAttribute("aria-selected","true"),this.main.main.setAttribute("aria-activedescendant",s.id)):(s.classList.remove(this.classes.selected),s.setAttribute("aria-selected","false")),s.addEventListener("click",n=>{n.preventDefault(),n.stopPropagation();const i=this.store.getSelected(),r=n.currentTarget,o=String(r.dataset.id);if(e.disabled||e.selected&&!this.settings.allowDeselect||this.settings.isMultiple&&this.settings.maxSelected<=i.length&&!e.selected||this.settings.isMultiple&&this.settings.minSelected>=i.length&&e.selected)return;let l=!1;const a=this.store.getSelectedOptions();let u=[];if(this.settings.isMultiple){if(e.selected)u=a.filter(c=>c.id!==o);else if(u=a.concat(e),!this.settings.closeOnSelect)if(n.shiftKey&&this.lastSelectedOption){const c=this.store.getDataOptions();let f=c.findIndex(g=>g.id===this.lastSelectedOption.id),p=c.findIndex(g=>g.id===e.id);if(f>=0&&p>=0){const g=Math.min(f,p),T=Math.max(f,p),C=c.slice(g,T+1);C.length>0&&C.length!a.find(L=>L.id===D.id))))}}else e.selected||(this.lastSelectedOption=e)}this.settings.isMultiple||(e.selected?u=[]:u=[e]),this.callbacks.beforeChange||(l=!0),this.callbacks.beforeChange&&(this.callbacks.beforeChange(u,a)===!1?l=!1:l=!0),l&&(this.store.getOptionByID(o)||this.callbacks.addOption(e),this.callbacks.setSelected(u.map(c=>c.id),!1),this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(u))}),s}destroy(){this.main.main.remove(),this.content.main.remove()}highlightText(e,s,n){let i=e;const r=new RegExp("(?![^<]*>)("+s.trim()+")(?![^<]*>[^<>]*${a}`),i}moveContentAbove(){const e=this.main.main.offsetHeight,s=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 n=this.main.main.getBoundingClientRect();this.content.main.style.margin="-"+(e+s-1)+"px 0px 0px 0px",this.content.main.style.top=n.top+n.height+(this.settings.contentPosition==="fixed"?0:window.scrollY)+"px",this.content.main.style.left=n.left+(this.settings.contentPosition==="fixed"?0:window.scrollX)+"px",this.content.main.style.width=n.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",this.settings.contentPosition!=="relative"&&(this.content.main.style.top=e.top+e.height+(this.settings.contentPosition==="fixed"?0:window.scrollY)+"px",this.content.main.style.left=e.left+(this.settings.contentPosition==="fixed"?0:window.scrollX)+"px",this.content.main.style.width=e.width+"px")}ensureElementInView(e,s){const n=e.scrollTop+e.offsetTop,i=n+e.clientHeight,r=s.offsetTop,o=r+s.clientHeight;ri&&(e.scrollTop+=o-i)}putContent(){const e=this.main.main.offsetHeight,s=this.main.main.getBoundingClientRect(),n=this.content.main.offsetHeight;return window.innerHeight-(s.top+e)<=n&&s.top>n?"up":"down"}updateDeselectAll(){if(!this.store||!this.settings)return;const e=this.store.getSelectedOptions(),s=e&&e.length>0,n=this.settings.isMultiple,i=this.settings.allowDeselect,r=this.main.deselect.main,o=this.classes.hide;i&&!(n&&!s)?r.classList.remove(o):r.classList.add(o)}}class Fc{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.getSelectedOptions()),!0}observeCall(e){if(!this.listen)return;let s=!1,n=!1,i=!1;for(const r of e){if(r.target===this.select&&(r.attributeName==="disabled"&&(n=!0),r.attributeName==="class"&&(s=!0),r.type==="childList")){for(const o of r.addedNodes)if(o.nodeName==="OPTION"&&o.value===this.select.value){this.select.dispatchEvent(new Event("change"));break}i=!0}(r.target.nodeName==="OPTGROUP"||r.target.nodeName==="OPTION")&&(i=!0)}s&&this.onClassChange&&this.onClassChange(this.select.className.split(" ")),n&&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 s=this.select.childNodes;for(const n of s)n.nodeName==="OPTGROUP"&&e.push(this.getDataFromOptgroup(n)),n.nodeName==="OPTION"&&e.push(this.getDataFromOption(n));return e}getDataFromOptgroup(e){let s={id:e.id,label:e.label,selectAll:e.dataset?e.dataset.selectall==="true":!1,selectAllText:e.dataset?e.dataset.selectalltext:"Select all",closable:e.dataset?e.dataset.closable:"off",options:[]};const n=e.childNodes;for(const i of n)i.nodeName==="OPTION"&&s.options.push(this.getDataFromOption(i));return s}getDataFromOption(e){return{id:e.id,value:e.value,text:e.text,html:e.dataset&&e.dataset.html?e.dataset.html:"",defaultSelected:e.defaultSelected,selected:e.selected,display:e.style.display!=="none",disabled:e.disabled,mandatory:e.dataset?e.dataset.mandatory==="true":!1,placeholder:e.dataset.placeholder==="true",class:e.className,style:e.style.cssText,data:e.dataset}}getSelectedOptions(){let e=[];const s=this.select.childNodes;for(const n of s){if(n.nodeName==="OPTGROUP"){const i=n.childNodes;for(const r of i)if(r.nodeName==="OPTION"){const o=r;o.selected&&e.push(this.getDataFromOption(o))}}if(n.nodeName==="OPTION"){const i=n;i.selected&&e.push(this.getDataFromOption(i))}}return e}getSelectedValues(){return this.getSelectedOptions().map(e=>e.value)}setSelected(e){this.changeListen(!1);const s=this.select.childNodes;for(const n of s){if(n.nodeName==="OPTGROUP"){const r=n.childNodes;for(const o of r)if(o.nodeName==="OPTION"){const l=o;l.selected=e.includes(l.id)}}if(n.nodeName==="OPTION"){const i=n;i.selected=e.includes(i.id)}}this.changeListen(!0)}setSelectedByValue(e){this.changeListen(!1);const s=this.select.childNodes;for(const n of s){if(n.nodeName==="OPTGROUP"){const r=n.childNodes;for(const o of r)if(o.nodeName==="OPTION"){const l=o;l.selected=e.includes(l.value)}}if(n.nodeName==="OPTION"){const i=n;i.selected=e.includes(i.value)}}this.changeListen(!0)}updateSelect(e,s,n){this.changeListen(!1),e&&(this.select.dataset.id=e),s&&(this.select.style.cssText=s),n&&(this.select.className="",n.forEach(i=>{i.trim()!==""&&this.select.classList.add(i.trim())})),this.changeListen(!0)}updateOptions(e){this.changeListen(!1),this.select.innerHTML="";for(const s of e)s instanceof Ie&&this.select.appendChild(this.createOptgroup(s)),s instanceof ue&&this.select.appendChild(this.createOption(s));this.select.dispatchEvent(new Event("change",{bubbles:!0})),this.changeListen(!0)}createOptgroup(e){const s=document.createElement("optgroup");if(s.id=e.id,s.label=e.label,e.selectAll&&(s.dataset.selectAll="true"),e.closable!=="off"&&(s.dataset.closable=e.closable),e.options)for(const n of e.options)s.appendChild(this.createOption(n));return s}createOption(e){const s=document.createElement("option");return s.id=e.id,s.value=e.value,s.textContent=e.text,e.html!==""&&s.setAttribute("data-html",e.html),s.defaultSelected=e.defaultSelected,s.selected=e.selected,e.disabled&&(s.disabled=!0),e.display||(s.style.display="none"),e.placeholder&&s.setAttribute("data-placeholder","true"),e.mandatory&&s.setAttribute("data-mandatory","true"),e.class&&e.class.split(" ").forEach(n=>{s.classList.add(n)}),e.data&&typeof e.data=="object"&&Object.keys(e.data).forEach(n=>{s.setAttribute("data-"+Rc(n),e.data[n])}),s}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 Ic{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-"+Dn(),this.style=e.style||"",this.class=e.class||[],this.disabled=e.disabled!==void 0?e.disabled:!1,this.alwaysOpen=e.alwaysOpen!==void 0?e.alwaysOpen:!1,this.showSearch=e.showSearch!==void 0?e.showSearch:!0,this.focusSearch=e.focusSearch!==void 0?e.focusSearch:!0,this.ariaLabel=e.ariaLabel||"Combobox",this.searchPlaceholder=e.searchPlaceholder||"Search",this.searchText=e.searchText||"No Results",this.searchingText=e.searchingText||"Searching...",this.searchHighlight=e.searchHighlight!==void 0?e.searchHighlight:!1,this.closeOnSelect=e.closeOnSelect!==void 0?e.closeOnSelect:!0,this.contentLocation=e.contentLocation||document.body,this.contentPosition=e.contentPosition||"absolute",this.openPosition=e.openPosition||"auto",this.contentAriaLabel=e.contentAriaLabel!==void 0?e.contentAriaLabel:"Select an option",this.placeholderText=e.placeholderText!==void 0?e.placeholderText:"Select Value",this.allowDeselect=e.allowDeselect!==void 0?e.allowDeselect:!1,this.hideSelected=e.hideSelected!==void 0?e.hideSelected:!1,this.keepOrder=e.keepOrder!==void 0?e.keepOrder:!1,this.showOptionTooltips=e.showOptionTooltips!==void 0?e.showOptionTooltips:!1,this.minSelected=e.minSelected||0,this.maxSelected=e.maxSelected||1e3,this.timeoutDelay=e.timeoutDelay||200,this.maxValuesShown=e.maxValuesShown||20,this.maxValuesMessage=e.maxValuesMessage||"{number} selected",this.addableText=e.addableText||'Press "Enter" to add {value}'}}class Mc{constructor(e){var o;if(this.events={search:void 0,searchFilter:(l,a)=>l.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=Kt(()=>{!this.settings.isOpen&&!this.settings.isFullOpen||this.render.moveContent()}),this.windowScroll=Kt(()=>{!this.settings.isOpen&&!this.settings.isFullOpen||this.render.moveContent()}),this.documentClick=l=>{this.settings.isOpen&&l.target&&!Pc(l.target,this.settings.id)&&this.close(l.type)},this.windowVisibilityChange=()=>{document.hidden&&this.close()},this.selectEl=typeof e.select=="string"?document.querySelector(e.select):e.select,!this.selectEl){e.events&&e.events.error&&e.events.error(new Error("Could not find select element"));return}if(this.selectEl.tagName!=="SELECT"){e.events&&e.events.error&&e.events.error(new Error("Element isnt of type select"));return}this.selectEl.dataset.ssid&&this.destroy(),this.settings=new Ic(e.settings),this.cssClasses=new Lc(e.cssClasses);const s=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const l in e.events)e.events.hasOwnProperty(l)&&(s.indexOf(l)!==-1?this.events[l]=Kt(e.events[l],100):this.events[l]=e.events[l]);this.settings.disabled=(o=e.settings)!=null&&o.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 Fc(this.selectEl),this.select.updateSelect(this.settings.id,this.settings.style,this.settings.class),this.select.hideUI(),this.select.onValueChange=l=>{this.setSelected(l.map(a=>a.id))},this.select.onClassChange=l=>{this.settings.class=l,this.render.updateClassStyles()},this.select.onDisabledChange=l=>{l?this.disable():this.enable()},this.select.onOptionsChange=l=>{this.setData(l)},this.store=new Dc(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 kc(this.settings,this.cssClasses,this.store,n),this.render.renderValues(),this.render.renderOptions(this.store.getData());const i=this.selectEl.getAttribute("aria-label"),r=this.selectEl.getAttribute("aria-labelledby");i?this.render.main.main.setAttribute("aria-label",i):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),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(e){const s=this.store.getSelected(),n=this.store.validateDataArray(e);if(n){this.events.error&&this.events.error(n);return}this.store.setData(e);const i=this.store.getData();this.select.updateOptions(i),this.render.renderValues(),this.render.renderOptions(i),this.events.afterChange&&!Gs(s,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let e=this.store.getSelectedOptions();return this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e)),e.map(s=>s.value)}setSelected(e,s=!0){const n=this.store.getSelected(),i=this.store.getDataOptions();e=Array.isArray(e)?e:[e];const r=[];for(const l of e){if(i.find(a=>a.id==l)){r.push(l);continue}for(const a of i.filter(u=>u.value==l))r.push(a.id)}this.store.setSelectedBy("id",r);const o=this.store.getData();this.select.updateOptions(o),this.render.renderValues(),this.render.content.search.input.value!==""?this.search(this.render.content.search.input.value):this.render.renderOptions(o),s&&this.events.afterChange&&!Gs(n,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}addOption(e){const s=this.store.getSelected();this.store.getDataOptions().some(i=>i.value===(e.value??e.text))||this.store.addOption(e);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!Gs(s,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.settings.focusSearch&&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(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){this.render.renderOptions(e===""?this.store.getData():this.store.search(e,this.events.searchFilter));return}this.render.renderSearching();const s=this.events.search(e,this.store.getSelectedOptions());if(s instanceof Promise){s.then(n=>{this.render.renderOptions(this.store.partialToFullData(n))}).catch(n=>{this.render.renderError(typeof n=="string"?n:n.message)});return}else Array.isArray(s)?this.render.renderOptions(this.store.partialToFullData(s)):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 Nc="CWYDT23U",Hc="slimselectjscom",Bc=Ts({__name:"carbonad",setup(t){const e=sr(null);let s=!1;return pr(()=>{const n=window.location.hostname==="localhost";if(!s&&!n){s=!0;const i=document.createElement("script");i.id="_carbonads_js",i.src=`//cdn.carbonads.com/carbon.js?serve=${Nc}&placement=${Hc}`,i.async=!0,e.value&&e.value.appendChild(i)}}),(n,i)=>wt(s)?(Jt(),Ir("div",{key:0,class:"carbon-container",ref_key:"container",ref:e},null,512)):Vo("",!0)}}),Vc=Ts({name:"App",components:{CarbonAd:Bc},data(){return{nav:null,navDebounce:Kt(()=>{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:"Examples",closable:"close",options:[{text:"countries",value:"examples#countries"},{text:"form reset",value:"examples#formReset"}]},{label:"Settings",closable:"close",options:[{text:"select",value:"settings#select"},{text:"cssClasses",value:"settings#cssClasses"},{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"}]}]}},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 t=this.$route.hash;if(t===""&&window.scroll({top:0,behavior:"smooth"}),t){const e=document.querySelector(t);if(e){const s=document.querySelector("header"),n=document.querySelector("nav"),i=s?s.clientHeight+(window.innerWidth<700?n.clientHeight:0)+8:0;window.scroll({top:e.offsetTop-i,behavior:"smooth"})}}},200)}),this.setDemensions(),window.addEventListener("resize",this.navDebounce),window.addEventListener("nav-updated",this.updateNav)},unmounted(){var t;window.removeEventListener("resize",this.navDebounce),window.removeEventListener("nav-updated",this.updateNav),(t=this.nav)==null||t.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 t={searchHighlight:!0,openContent:"below"};this.width>700&&(t.alwaysOpen=!0,t.contentPosition="relative",t.contentLocation=this.$refs.navContent),this.nav=new Mc({select:this.$refs.nav,data:this.navData,settings:t,events:{afterChange:e=>{const n=e[0].value.split("#"),i=n[0],r=n[1]?"#"+n[1]:void 0;this.$router.push({path:i,hash:r})}}})},updateNav(){setTimeout(()=>{this.nav&&this.nav.setSelected(this.$router.currentRoute.value.fullPath.replace("/",""))},0)}}}),Uc="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",jc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACAAQMAAAD58POIAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZQTFRFyzg3////IltC9QAAAAFiS0dEAf8CLd4AAAAJcEhZcwAACxMAAAsTAQCanBgAAAAkSURBVEjHY2AYBYMV/IeDUQG4AJgeFRgVGBUYFSBNYBQMPgAARjtdvxo6xaMAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTEtMDUtMzBUMjM6MTA6NDQtMDc6MDCm4GvfAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDEwLTEyLTA2VDEyOjIwOjEyLTA4OjAwpIGEmQAAADJ0RVh0UE5HOmNIUk0AY2h1bmsgd2FzIGZvdW5kIChzZWUgQ2hyb21hdGljaXR5LCBhYm92ZSkH0UjaAAAAKXRFWHRQTkc6Z0FNQQBnYW1tYT0wLjQ1NDU1IChTZWUgR2FtbWEsIGFib3ZlKRISLKcAAAAUdEVYdFBORzpJSERSLmJpdF9kZXB0aAA4KYV+UAAAABV0RVh0UE5HOklIRFIuY29sb3JfdHlwZQA2BkqnKwAAABt0RVh0UE5HOklIRFIuaW50ZXJsYWNlX21ldGhvZAAw+zsHjAAAABx0RVh0UE5HOklIRFIud2lkdGgsaGVpZ2h0ADE2LCAxNjjVBg0AAAAodEVYdFBORzpwSFlzAHhfcmVzPTI4MzUsIHlfcmVzPTI4MzUsIHVuaXRzPTGCKXI+AAAAKHRFWHRQTkc6c1JHQgBpbnRlbnQ9MCAoU2VlIFJlbmRlcmluZyBpbnRlbnQp8hEU9QAAAABJRU5ErkJggg==",$c=(t,e)=>{const s=t.__vccOpts||t;for(const[n,i]of e)s[n]=i;return s},zc={ref:"nav"},Wc={class:"nav-content",ref:"navContent"};function Gc(t,e,s,n,i,r){const o=Vn("CarbonAd"),l=Vn("router-view");return Jt(),Ir(Re,null,[e[4]||(e[4]=Bo('

Slim Select 2.0

Advanced select dropdown
',1)),Je("nav",null,[Je("select",zc,null,512),Je("div",Wc,null,512),de(o)]),Je("main",null,[de(l),Je("footer",null,[hs(" © "+Hi(t.year)+" ",1),e[0]||(e[0]=Je("a",{href:"http://webiswhatido.com",style:{color:"#ffffff"},target:"_blank"},"Brian Voelker",-1)),e[1]||(e[1]=hs(". ")),e[2]||(e[2]=Je("br",null,null,-1)),e[3]||(e[3]=hs(" Slim Select is under the MIT license. "))])])],64)}const Kc=$c(Vc,[["render",Gc]]);var Li=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function el(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ks={exports:{}},Pi;function qc(){return Pi||(Pi=1,function(t){var e=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};/** + */const Ct=typeof document<"u";function jr(t){return typeof t=="object"||"displayName"in t||"props"in t||"__vccOpts"in t}function Oa(t){return t.__esModule||t[Symbol.toStringTag]==="Module"||t.default&&jr(t.default)}const J=Object.assign;function zs(t,e){const s={};for(const n in e){const i=e[n];s[n]=He(i)?i.map(t):t(i)}return s}const Gt=()=>{},He=Array.isArray,zr=/#/g,La=/&/g,Ta=/\//g,Pa=/=/g,Ra=/\?/g,Wr=/\+/g,Da=/%5B/g,ka=/%5D/g,Gr=/%5E/g,Fa=/%60/g,qr=/%7B/g,Ia=/%7C/g,Kr=/%7D/g,Ma=/%20/g;function Dn(t){return encodeURI(""+t).replace(Ia,"|").replace(Da,"[").replace(ka,"]")}function Na(t){return Dn(t).replace(qr,"{").replace(Kr,"}").replace(Gr,"^")}function cn(t){return Dn(t).replace(Wr,"%2B").replace(Ma,"+").replace(zr,"%23").replace(La,"%26").replace(Fa,"`").replace(qr,"{").replace(Kr,"}").replace(Gr,"^")}function Ba(t){return cn(t).replace(Pa,"%3D")}function Ha(t){return Dn(t).replace(zr,"%23").replace(Ra,"%3F")}function Va(t){return t==null?"":Ha(t).replace(Ta,"%2F")}function ss(t){try{return decodeURIComponent(""+t)}catch{}return""+t}const Ua=/\/$/,$a=t=>t.replace(Ua,"");function Ws(t,e,s="/"){let n,i={},r="",o="";const l=e.indexOf("#");let a=e.indexOf("?");return l=0&&(a=-1),a>-1&&(n=e.slice(0,a),r=e.slice(a+1,l>-1?l:e.length),i=t(r)),l>-1&&(n=n||e.slice(0,l),o=e.slice(l,e.length)),n=Ga(n??e,s),{fullPath:n+(r&&"?")+r+o,path:n,query:i,hash:ss(o)}}function ja(t,e){const s=e.query?t(e.query):"";return e.path+(s&&"?")+s+(e.hash||"")}function pi(t,e){return!e||!t.toLowerCase().startsWith(e.toLowerCase())?t:t.slice(e.length)||"/"}function za(t,e,s){const n=e.matched.length-1,i=s.matched.length-1;return n>-1&&n===i&&kt(e.matched[n],s.matched[i])&&Yr(e.params,s.params)&&t(e.query)===t(s.query)&&e.hash===s.hash}function kt(t,e){return(t.aliasOf||t)===(e.aliasOf||e)}function Yr(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(!Wa(t[s],e[s]))return!1;return!0}function Wa(t,e){return He(t)?gi(t,e):He(e)?gi(e,t):t===e}function gi(t,e){return He(e)?t.length===e.length&&t.every((s,n)=>s===e[n]):t.length===1&&t[0]===e}function Ga(t,e){if(t.startsWith("/"))return t;if(!t)return e;const s=e.split("/"),n=t.split("/"),i=n[n.length-1];(i===".."||i===".")&&n.push("");let r=s.length-1,o,l;for(o=0;o1&&r--;else break;return s.slice(0,r).join("/")+"/"+n.slice(o).join("/")}const ut={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};var ns;(function(t){t.pop="pop",t.push="push"})(ns||(ns={}));var qt;(function(t){t.back="back",t.forward="forward",t.unknown=""})(qt||(qt={}));function qa(t){if(!t)if(Ct){const e=document.querySelector("base");t=e&&e.getAttribute("href")||"/",t=t.replace(/^\w+:\/\/[^\/]+/,"")}else t="/";return t[0]!=="/"&&t[0]!=="#"&&(t="/"+t),$a(t)}const Ka=/^[^#]+#/;function Ya(t,e){return t.replace(Ka,"#")+e}function Qa(t,e){const s=document.documentElement.getBoundingClientRect(),n=t.getBoundingClientRect();return{behavior:e.behavior,left:n.left-s.left-(e.left||0),top:n.top-s.top-(e.top||0)}}const ks=()=>({left:window.scrollX,top:window.scrollY});function Ja(t){let e;if("el"in t){const s=t.el,n=typeof s=="string"&&s.startsWith("#"),i=typeof s=="string"?n?document.getElementById(s.slice(1)):document.querySelector(s):s;if(!i)return;e=Qa(i,t)}else e=t;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.scrollX,e.top!=null?e.top:window.scrollY)}function mi(t,e){return(history.state?history.state.position-e:-1)+t}const un=new Map;function Za(t,e){un.set(t,e)}function Xa(t){const e=un.get(t);return un.delete(t),e}let ec=()=>location.protocol+"//"+location.host;function Qr(t,e){const{pathname:s,search:n,hash:i}=e,r=t.indexOf("#");if(r>-1){let l=i.includes(t.slice(r))?t.slice(r).length:1,a=i.slice(l);return a[0]!=="/"&&(a="/"+a),pi(a,"")}return pi(s,t)+n+i}function tc(t,e,s,n){let i=[],r=[],o=null;const l=({state:p})=>{const g=Qr(t,location),C=s.value,_=e.value;let D=0;if(p){if(s.value=g,e.value=p,o&&o===C){o=null;return}D=_?p.position-_.position:0}else n(g);i.forEach(T=>{T(s.value,C,{delta:D,type:ns.pop,direction:D?D>0?qt.forward:qt.back:qt.unknown})})};function a(){o=s.value}function u(p){i.push(p);const g=()=>{const C=i.indexOf(p);C>-1&&i.splice(C,1)};return r.push(g),g}function c(){const{history:p}=window;p.state&&p.replaceState(J({},p.state,{scroll:ks()}),"")}function f(){for(const p of r)p();r=[],window.removeEventListener("popstate",l),window.removeEventListener("beforeunload",c)}return window.addEventListener("popstate",l),window.addEventListener("beforeunload",c,{passive:!0}),{pauseListeners:a,listen:u,destroy:f}}function vi(t,e,s,n=!1,i=!1){return{back:t,current:e,forward:s,replaced:n,position:window.history.length,scroll:i?ks():null}}function sc(t){const{history:e,location:s}=window,n={value:Qr(t,s)},i={value:e.state};i.value||r(n.value,{back:null,current:n.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function r(a,u,c){const f=t.indexOf("#"),p=f>-1?(s.host&&document.querySelector("base")?t:t.slice(f))+a:ec()+t+a;try{e[c?"replaceState":"pushState"](u,"",p),i.value=u}catch(g){console.error(g),s[c?"replace":"assign"](p)}}function o(a,u){const c=J({},e.state,vi(i.value.back,a,i.value.forward,!0),u,{position:i.value.position});r(a,c,!0),n.value=a}function l(a,u){const c=J({},i.value,e.state,{forward:a,scroll:ks()});r(c.current,c,!0);const f=J({},vi(n.value,a,null),{position:c.position+1},u);r(a,f,!1),n.value=a}return{location:n,state:i,push:l,replace:o}}function nc(t){t=qa(t);const e=sc(t),s=tc(t,e.state,e.location,e.replace);function n(r,o=!0){o||s.pauseListeners(),history.go(r)}const i=J({location:"",base:t,go:n,createHref:Ya.bind(null,t)},e,s);return Object.defineProperty(i,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(i,"state",{enumerable:!0,get:()=>e.state.value}),i}function ic(t){return typeof t=="string"||t&&typeof t=="object"}function Jr(t){return typeof t=="string"||typeof t=="symbol"}const Zr=Symbol("");var bi;(function(t){t[t.aborted=4]="aborted",t[t.cancelled=8]="cancelled",t[t.duplicated=16]="duplicated"})(bi||(bi={}));function Ft(t,e){return J(new Error,{type:t,[Zr]:!0},e)}function Je(t,e){return t instanceof Error&&Zr in t&&(e==null||!!(t.type&e))}const yi="[^/]+?",rc={sensitive:!1,strict:!1,start:!0,end:!0},lc=/[.+*?^${}()[\]/\\]/g;function oc(t,e){const s=J({},rc,e),n=[];let i=s.start?"^":"";const r=[];for(const u of t){const c=u.length?[]:[90];s.strict&&!u.length&&(i+="/");for(let f=0;fe.length?e.length===1&&e[0]===80?1:-1:0}function Xr(t,e){let s=0;const n=t.score,i=e.score;for(;s0&&e[e.length-1]<0}const cc={type:0,value:""},uc=/[a-zA-Z0-9_]/;function fc(t){if(!t)return[[]];if(t==="/")return[[cc]];if(!t.startsWith("/"))throw new Error(`Invalid path "${t}"`);function e(g){throw new Error(`ERR (${s})/"${u}": ${g}`)}let s=0,n=s;const i=[];let r;function o(){r&&i.push(r),r=[]}let l=0,a,u="",c="";function f(){u&&(s===0?r.push({type:0,value:u}):s===1||s===2||s===3?(r.length>1&&(a==="*"||a==="+")&&e(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),r.push({type:1,value:u,regexp:c,repeatable:a==="*"||a==="+",optional:a==="*"||a==="?"})):e("Invalid state to consume buffer"),u="")}function p(){u+=a}for(;l{o(v)}:Gt}function o(f){if(Jr(f)){const p=n.get(f);p&&(n.delete(f),s.splice(s.indexOf(p),1),p.children.forEach(o),p.alias.forEach(o))}else{const p=s.indexOf(f);p>-1&&(s.splice(p,1),f.record.name&&n.delete(f.record.name),f.children.forEach(o),f.alias.forEach(o))}}function l(){return s}function a(f){const p=mc(f,s);s.splice(p,0,f),f.record.name&&!Si(f)&&n.set(f.record.name,f)}function u(f,p){let g,C={},_,D;if("name"in f&&f.name){if(g=n.get(f.name),!g)throw Ft(1,{location:f});D=g.record.name,C=J(wi(p.params,g.keys.filter(v=>!v.optional).concat(g.parent?g.parent.keys.filter(v=>v.optional):[]).map(v=>v.name)),f.params&&wi(f.params,g.keys.map(v=>v.name))),_=g.stringify(C)}else if(f.path!=null)_=f.path,g=s.find(v=>v.re.test(_)),g&&(C=g.parse(_),D=g.record.name);else{if(g=p.name?n.get(p.name):s.find(v=>v.re.test(p.path)),!g)throw Ft(1,{location:f,currentLocation:p});D=g.record.name,C=J({},p.params,f.params),_=g.stringify(C)}const T=[];let m=g;for(;m;)T.unshift(m.record),m=m.parent;return{name:D,path:_,params:C,matched:T,meta:gc(T)}}t.forEach(f=>r(f));function c(){s.length=0,n.clear()}return{addRoute:r,resolve:u,removeRoute:o,clearRoutes:c,getRoutes:l,getRecordMatcher:i}}function wi(t,e){const s={};for(const n of e)n in t&&(s[n]=t[n]);return s}function xi(t){const e={path:t.path,redirect:t.redirect,name:t.name,meta:t.meta||{},aliasOf:t.aliasOf,beforeEnter:t.beforeEnter,props:pc(t),children:t.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in t?t.components||null:t.component&&{default:t.component}};return Object.defineProperty(e,"mods",{value:{}}),e}function pc(t){const e={},s=t.props||!1;if("component"in t)e.default=s;else for(const n in t.components)e[n]=typeof s=="object"?s[n]:s;return e}function Si(t){for(;t;){if(t.record.aliasOf)return!0;t=t.parent}return!1}function gc(t){return t.reduce((e,s)=>J(e,s.meta),{})}function Ei(t,e){const s={};for(const n in t)s[n]=n in e?e[n]:t[n];return s}function mc(t,e){let s=0,n=e.length;for(;s!==n;){const r=s+n>>1;Xr(t,e[r])<0?n=r:s=r+1}const i=vc(t);return i&&(n=e.lastIndexOf(i,n-1)),n}function vc(t){let e=t;for(;e=e.parent;)if(el(e)&&Xr(t,e)===0)return e}function el({record:t}){return!!(t.name||t.components&&Object.keys(t.components).length||t.redirect)}function bc(t){const e={};if(t===""||t==="?")return e;const n=(t[0]==="?"?t.slice(1):t).split("&");for(let i=0;ir&&cn(r)):[n&&cn(n)]).forEach(r=>{r!==void 0&&(e+=(e.length?"&":"")+s,r!=null&&(e+="="+r))})}return e}function yc(t){const e={};for(const s in t){const n=t[s];n!==void 0&&(e[s]=He(n)?n.map(i=>i==null?null:""+i):n==null?n:""+n)}return e}const Ac=Symbol(""),_i=Symbol(""),kn=Symbol(""),tl=Symbol(""),fn=Symbol("");function Bt(){let t=[];function e(n){return t.push(n),()=>{const i=t.indexOf(n);i>-1&&t.splice(i,1)}}function s(){t=[]}return{add:e,list:()=>t.slice(),reset:s}}function dt(t,e,s,n,i,r=o=>o()){const o=n&&(n.enterCallbacks[i]=n.enterCallbacks[i]||[]);return()=>new Promise((l,a)=>{const u=p=>{p===!1?a(Ft(4,{from:s,to:e})):p instanceof Error?a(p):ic(p)?a(Ft(2,{from:e,to:p})):(o&&n.enterCallbacks[i]===o&&typeof p=="function"&&o.push(p),l())},c=r(()=>t.call(n&&n.instances[i],e,s,u));let f=Promise.resolve(c);t.length<3&&(f=f.then(u)),f.catch(p=>a(p))})}function Gs(t,e,s,n,i=r=>r()){const r=[];for(const o of t)for(const l in o.components){let a=o.components[l];if(!(e!=="beforeRouteEnter"&&!o.instances[l]))if(jr(a)){const c=(a.__vccOpts||a)[e];c&&r.push(dt(c,s,n,o,l,i))}else{let u=a();r.push(()=>u.then(c=>{if(!c)throw new Error(`Couldn't resolve component "${l}" at "${o.path}"`);const f=Oa(c)?c.default:c;o.mods[l]=c,o.components[l]=f;const g=(f.__vccOpts||f)[e];return g&&dt(g,s,n,o,l,i)()}))}}return r}function Oi(t){const e=tt(kn),s=tt(tl),n=Ne(()=>{const a=wt(t.to);return e.resolve(a)}),i=Ne(()=>{const{matched:a}=n.value,{length:u}=a,c=a[u-1],f=s.matched;if(!c||!f.length)return-1;const p=f.findIndex(kt.bind(null,c));if(p>-1)return p;const g=Li(a[u-2]);return u>1&&Li(c)===g&&f[f.length-1].path!==g?f.findIndex(kt.bind(null,a[u-2])):p}),r=Ne(()=>i.value>-1&&Cc(s.params,n.value.params)),o=Ne(()=>i.value>-1&&i.value===s.matched.length-1&&Yr(s.params,n.value.params));function l(a={}){if(Ec(a)){const u=e[wt(t.replace)?"replace":"push"](wt(t.to)).catch(Gt);return t.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>u),u}return Promise.resolve()}return{route:n,href:Ne(()=>n.value.href),isActive:r,isExactActive:o,navigate:l}}function wc(t){return t.length===1?t[0]:t}const xc=Ts({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"},viewTransition:Boolean},useLink:Oi,setup(t,{slots:e}){const s=Os(Oi(t)),{options:n}=tt(kn),i=Ne(()=>({[Ti(t.activeClass,n.linkActiveClass,"router-link-active")]:s.isActive,[Ti(t.exactActiveClass,n.linkExactActiveClass,"router-link-exact-active")]:s.isExactActive}));return()=>{const r=e.default&&wc(e.default(s));return t.custom?r:Ur("a",{"aria-current":s.isExactActive?t.ariaCurrentValue:null,href:s.href,onClick:s.navigate,class:i.value},r)}}}),Sc=xc;function Ec(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&!(t.button!==void 0&&t.button!==0)){if(t.currentTarget&&t.currentTarget.getAttribute){const e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function Cc(t,e){for(const s in e){const n=e[s],i=t[s];if(typeof n=="string"){if(n!==i)return!1}else if(!He(i)||i.length!==n.length||n.some((r,o)=>r!==i[o]))return!1}return!0}function Li(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const Ti=(t,e,s)=>t??e??s,_c=Ts({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(t,{attrs:e,slots:s}){const n=tt(fn),i=Ne(()=>t.route||n.value),r=tt(_i,0),o=Ne(()=>{let u=wt(r);const{matched:c}=i.value;let f;for(;(f=c[u])&&!f.components;)u++;return u}),l=Ne(()=>i.value.matched[o.value]);cs(_i,Ne(()=>o.value+1)),cs(Ac,l),cs(fn,i);const a=ir();return us(()=>[a.value,l.value,t.name],([u,c,f],[p,g,C])=>{c&&(c.instances[f]=u,g&&g!==c&&u&&u===p&&(c.leaveGuards.size||(c.leaveGuards=g.leaveGuards),c.updateGuards.size||(c.updateGuards=g.updateGuards))),u&&c&&(!g||!kt(c,g)||!p)&&(c.enterCallbacks[f]||[]).forEach(_=>_(u))},{flush:"post"}),()=>{const u=i.value,c=t.name,f=l.value,p=f&&f.components[c];if(!p)return Pi(s.default,{Component:p,route:u});const g=f.props[c],C=g?g===!0?u.params:typeof g=="function"?g(u):g:null,D=Ur(p,J({},C,e,{onVnodeUnmounted:T=>{T.component.isUnmounted&&(f.instances[c]=null)},ref:a}));return Pi(s.default,{Component:D,route:u})||D}}});function Pi(t,e){if(!t)return null;const s=t(e);return s.length===1?s[0]:s}const Oc=_c;function Lc(t){const e=dc(t.routes,t),s=t.parseQuery||bc,n=t.stringifyQuery||Ci,i=t.history,r=Bt(),o=Bt(),l=Bt(),a=Ml(ut);let u=ut;Ct&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=zs.bind(null,A=>""+A),f=zs.bind(null,Va),p=zs.bind(null,ss);function g(A,N){let k,B;return Jr(A)?(k=e.getRecordMatcher(A),B=N):B=A,e.addRoute(B,k)}function C(A){const N=e.getRecordMatcher(A);N&&e.removeRoute(N)}function _(){return e.getRoutes().map(A=>A.record)}function D(A){return!!e.getRecordMatcher(A)}function T(A,N){if(N=J({},N||a.value),typeof A=="string"){const b=Ws(s,A,N.path),w=e.resolve({path:b.path},N),S=i.createHref(b.fullPath);return J(b,w,{params:p(w.params),hash:ss(b.hash),redirectedFrom:void 0,href:S})}let k;if(A.path!=null)k=J({},A,{path:Ws(s,A.path,N.path).path});else{const b=J({},A.params);for(const w in b)b[w]==null&&delete b[w];k=J({},A,{params:f(b)}),N.params=f(N.params)}const B=e.resolve(k,N),Y=A.hash||"";B.params=c(p(B.params));const h=ja(n,J({},A,{hash:Na(Y),path:B.path})),d=i.createHref(h);return J({fullPath:h,hash:Y,query:n===Ci?yc(A.query):A.query||{}},B,{redirectedFrom:void 0,href:d})}function m(A){return typeof A=="string"?Ws(s,A,a.value.path):J({},A)}function v(A,N){if(u!==A)return Ft(8,{from:N,to:A})}function y(A){return F(A)}function E(A){return y(J(m(A),{replace:!0}))}function L(A){const N=A.matched[A.matched.length-1];if(N&&N.redirect){const{redirect:k}=N;let B=typeof k=="function"?k(A):k;return typeof B=="string"&&(B=B.includes("?")||B.includes("#")?B=m(B):{path:B},B.params={}),J({query:A.query,hash:A.hash,params:B.path!=null?{}:A.params},B)}}function F(A,N){const k=u=T(A),B=a.value,Y=A.state,h=A.force,d=A.replace===!0,b=L(k);if(b)return F(J(m(b),{state:typeof b=="object"?J({},Y,b.state):Y,force:h,replace:d}),N||k);const w=k;w.redirectedFrom=N;let S;return!h&&za(n,B,k)&&(S=Ft(16,{to:w,from:B}),Ae(B,B,!0,!1)),(S?Promise.resolve(S):K(w,B)).catch(x=>Je(x)?Je(x,2)?x:ye(x):$(x,w,B)).then(x=>{if(x){if(Je(x,2))return F(J({replace:d},m(x.to),{state:typeof x.to=="object"?J({},Y,x.to.state):Y,force:h}),N||w)}else x=pe(w,B,!0,d,Y);return re(w,B,x),x})}function W(A,N){const k=v(A,N);return k?Promise.reject(k):Promise.resolve()}function H(A){const N=we.values().next().value;return N&&typeof N.runWithContext=="function"?N.runWithContext(A):A()}function K(A,N){let k;const[B,Y,h]=Tc(A,N);k=Gs(B.reverse(),"beforeRouteLeave",A,N);for(const b of B)b.leaveGuards.forEach(w=>{k.push(dt(w,A,N))});const d=W.bind(null,A,N);return k.push(d),fe(k).then(()=>{k=[];for(const b of r.list())k.push(dt(b,A,N));return k.push(d),fe(k)}).then(()=>{k=Gs(Y,"beforeRouteUpdate",A,N);for(const b of Y)b.updateGuards.forEach(w=>{k.push(dt(w,A,N))});return k.push(d),fe(k)}).then(()=>{k=[];for(const b of h)if(b.beforeEnter)if(He(b.beforeEnter))for(const w of b.beforeEnter)k.push(dt(w,A,N));else k.push(dt(b.beforeEnter,A,N));return k.push(d),fe(k)}).then(()=>(A.matched.forEach(b=>b.enterCallbacks={}),k=Gs(h,"beforeRouteEnter",A,N,H),k.push(d),fe(k))).then(()=>{k=[];for(const b of o.list())k.push(dt(b,A,N));return k.push(d),fe(k)}).catch(b=>Je(b,8)?b:Promise.reject(b))}function re(A,N,k){l.list().forEach(B=>H(()=>B(A,N,k)))}function pe(A,N,k,B,Y){const h=v(A,N);if(h)return h;const d=N===ut,b=Ct?history.state:{};k&&(B||d?i.replace(A.fullPath,J({scroll:d&&b&&b.scroll},Y)):i.push(A.fullPath,Y)),a.value=A,Ae(A,N,k,d),ye()}let Le;function ot(){Le||(Le=i.listen((A,N,k)=>{if(!Ve.listening)return;const B=T(A),Y=L(B);if(Y){F(J(Y,{replace:!0,force:!0}),B).catch(Gt);return}u=B;const h=a.value;Ct&&Za(mi(h.fullPath,k.delta),ks()),K(B,h).catch(d=>Je(d,12)?d:Je(d,2)?(F(J(m(d.to),{force:!0}),B).then(b=>{Je(b,20)&&!k.delta&&k.type===ns.pop&&i.go(-1,!1)}).catch(Gt),Promise.reject()):(k.delta&&i.go(-k.delta,!1),$(d,B,h))).then(d=>{d=d||pe(B,h,!1),d&&(k.delta&&!Je(d,8)?i.go(-k.delta,!1):k.type===ns.pop&&Je(d,20)&&i.go(-1,!1)),re(B,h,d)}).catch(Gt)}))}let at=Bt(),oe=Bt(),Q;function $(A,N,k){ye(A);const B=oe.list();return B.length?B.forEach(Y=>Y(A,N,k)):console.error(A),Promise.reject(A)}function ae(){return Q&&a.value!==ut?Promise.resolve():new Promise((A,N)=>{at.add([A,N])})}function ye(A){return Q||(Q=!A,ot(),at.list().forEach(([N,k])=>A?k(A):N()),at.reset()),A}function Ae(A,N,k,B){const{scrollBehavior:Y}=t;if(!Ct||!Y)return Promise.resolve();const h=!k&&Xa(mi(A.fullPath,0))||(B||!k)&&history.state&&history.state.scroll||null;return ar().then(()=>Y(A,N,h)).then(d=>d&&Ja(d)).catch(d=>$(d,A,N))}const te=A=>i.go(A);let ct;const we=new Set,Ve={currentRoute:a,listening:!0,addRoute:g,removeRoute:C,clearRoutes:e.clearRoutes,hasRoute:D,getRoutes:_,resolve:T,options:t,push:y,replace:E,go:te,back:()=>te(-1),forward:()=>te(1),beforeEach:r.add,beforeResolve:o.add,afterEach:l.add,onError:oe.add,isReady:ae,install(A){const N=this;A.component("RouterLink",Sc),A.component("RouterView",Oc),A.config.globalProperties.$router=N,Object.defineProperty(A.config.globalProperties,"$route",{enumerable:!0,get:()=>wt(a)}),Ct&&!ct&&a.value===ut&&(ct=!0,y(i.location).catch(Y=>{}));const k={};for(const Y in ut)Object.defineProperty(k,Y,{get:()=>a.value[Y],enumerable:!0});A.provide(kn,N),A.provide(tl,sr(k)),A.provide(fn,a);const B=A.unmount;we.add(A),A.unmount=function(){we.delete(A),we.size<1&&(u=ut,Le&&Le(),Le=null,a.value=ut,ct=!1,Q=!1),B()}}};function fe(A){return A.reduce((N,k)=>N.then(()=>H(k)),Promise.resolve())}return Ve}function Tc(t,e){const s=[],n=[],i=[],r=Math.max(e.matched.length,t.matched.length);for(let o=0;okt(u,l))?n.push(l):s.push(l));const a=t.matched[o];a&&(e.matched.find(u=>kt(u,a))||i.push(a))}return[s,n,i]}const Pc=Lc({history:nc(),linkActiveClass:"active",routes:[{path:"/",name:"Home",component:()=>Qe(()=>import("./home.js"),__vite__mapDeps([0,1]))},{path:"/install",name:"Install",component:()=>Qe(()=>import("./install.js"),[])},{path:"/selects",name:"Selects",component:()=>Qe(()=>import("./selects.js"),[])},{path:"/data",name:"Data",component:()=>Qe(()=>import("./data.js"),[])},{path:"/examples",name:"Examples",component:()=>Qe(()=>import("./index2.js"),__vite__mapDeps([2,3]))},{path:"/settings",name:"Settings",component:()=>Qe(()=>import("./index3.js"),__vite__mapDeps([4,5]))},{path:"/events",name:"Events",component:()=>Qe(()=>import("./index4.js"),[])},{path:"/methods",name:"Methods",component:()=>Qe(()=>import("./index5.js"),[])},{path:"/vue",name:"Vue",component:()=>Qe(()=>import("./vue.js"),[])}]});class Rc{constructor(e){e||(e={}),this.main=e.main||"ss-main",this.placeholder=e.placeholder||"ss-placeholder",this.values=e.values||"ss-values",this.single=e.single||"ss-single",this.max=e.max||"ss-max",this.value=e.value||"ss-value",this.valueText=e.valueText||"ss-value-text",this.valueDelete=e.valueDelete||"ss-value-delete",this.valueOut=e.valueOut||"ss-value-out",this.deselect=e.deselect||"ss-deselect",this.deselectPath=e.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=e.arrow||"ss-arrow",this.arrowClose=e.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=e.arrowOpen||"M10,70 L50,30 L90,70",this.content=e.content||"ss-content",this.openAbove=e.openAbove||"ss-open-above",this.openBelow=e.openBelow||"ss-open-below",this.search=e.search||"ss-search",this.searchHighlighter=e.searchHighlighter||"ss-search-highlight",this.searching=e.searching||"ss-searching",this.addable=e.addable||"ss-addable",this.addablePath=e.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=e.list||"ss-list",this.optgroup=e.optgroup||"ss-optgroup",this.optgroupLabel=e.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=e.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=e.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=e.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=e.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=e.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=e.optgroupClosable||"ss-closable",this.option=e.option||"ss-option",this.optionDelete=e.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=e.highlighted||"ss-highlighted",this.open=e.open||"ss-open",this.close=e.close||"ss-close",this.selected=e.selected||"ss-selected",this.error=e.error||"ss-error",this.disabled=e.disabled||"ss-disabled",this.hide=e.hide||"ss-hide"}}function Fn(){return Math.random().toString(36).substring(2,10)}function Dc(t,e){function s(i,r){return r&&i&&i.classList&&i.classList.contains(r)||r&&i&&i.dataset&&i.dataset.id&&i.dataset.id===e?i:null}function n(i,r){return!i||i===document?null:s(i,r)?i:n(i.parentNode,r)}return s(t,e)||n(t,e)}function Kt(t,e=50,s=!1){let n;return function(...i){const r=self,o=()=>{n=null,s||t.apply(r,i)},l=s&&!n;clearTimeout(n),n=setTimeout(o,e),l&&t.apply(r,i)}}function qs(t,e){return JSON.stringify(t)===JSON.stringify(e)}function kc(t){const e=t.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,s=>"-"+s.toLowerCase());return t[0]===t[0].toUpperCase()?e.substring(1):e}class Me{constructor(e){if(this.id=!e.id||e.id===""?Fn():e.id,this.label=e.label||"",this.selectAll=e.selectAll===void 0?!1:e.selectAll,this.selectAllText=e.selectAllText||"Select All",this.closable=e.closable||"off",this.options=[],e.options)for(const s of e.options)this.options.push(new ue(s))}}class ue{constructor(e){this.id=!e.id||e.id===""?Fn():e.id,this.value=e.value===void 0?e.text:e.value,this.text=e.text||"",this.html=e.html||"",this.defaultSelected=e.defaultSelected!==void 0?e.defaultSelected:!1,this.selected=e.selected!==void 0?e.selected:!1,this.display=e.display!==void 0?e.display:!0,this.disabled=e.disabled!==void 0?e.disabled:!1,this.mandatory=e.mandatory!==void 0?e.mandatory:!1,this.placeholder=e.placeholder!==void 0?e.placeholder:!1,this.class=e.class||"",this.style=e.style||"",this.data=e.data||{}}}class Fc{constructor(e,s){this.selectType="single",this.data=[],this.selectedOrder=[],this.selectType=e,this.setData(s)}validateDataArray(e){if(!Array.isArray(e))return new Error("Data must be an array");for(let s of e)if(s instanceof Me||"label"in s){if(!("label"in s))return new Error("Optgroup must have a label");if("options"in s&&s.options)for(let n of s.options){const i=this.validateOption(n);if(i)return i}}else if(s instanceof ue||"text"in s){const n=this.validateOption(s);if(n)return n}else return new Error("Data object must be a valid optgroup or option");return null}validateOption(e){return"text"in e?null:new Error("Option must have a text")}partialToFullData(e){let s=[];return e.forEach(n=>{if(n instanceof Me||"label"in n){let i=[];"options"in n&&n.options&&n.options.forEach(r=>{i.push(new ue(r))}),i.length>0&&s.push(new Me(n))}(n instanceof ue||"text"in n)&&s.push(new ue(n))}),s}setData(e){this.data=this.partialToFullData(e),this.selectType==="single"&&this.setSelectedBy("id",this.getSelected())}getData(){return this.filter(null,!0)}getDataOptions(){return this.filter(null,!1)}addOption(e,s=!1){if(s){let n=[new ue(e)];this.setData(n.concat(this.getData()))}else this.setData(this.getData().concat(new ue(e)))}setSelectedBy(e,s){let n=null,i=!1;const r=[];for(let l of this.data){if(l instanceof Me)for(let a of l.options)n||(n=a),a.selected=i?!1:s.includes(a[e]),a.selected&&(r.push(a),this.selectType==="single"&&(i=!0));l instanceof ue&&(n||(n=l),l.selected=i?!1:s.includes(l[e]),l.selected&&(r.push(l),this.selectType==="single"&&(i=!0)))}this.selectType==="single"&&n&&!i&&(n.selected=!0,r.push(n));const o=s.map(l=>{var a;return((a=r.find(u=>u[e]===l))==null?void 0:a.id)||""});this.selectedOrder=o}getSelected(){return this.getSelectedOptions().map(e=>e.id)}getSelectedValues(){return this.getSelectedOptions().map(e=>e.value)}getSelectedOptions(){return this.filter(e=>e.selected,!1)}getOptgroupByID(e){for(let s of this.data)if(s instanceof Me&&s.id===e)return s;return null}getOptionByID(e){let s=this.filter(n=>n.id===e,!1);return s.length?s[0]:null}getSelectType(){return this.selectType}getFirstOption(){let e=null;for(let s of this.data)if(s instanceof Me?e=s.options[0]:s instanceof ue&&(e=s),e)break;return e}search(e,s){return e=e.trim(),e===""?this.getData():this.filter(n=>s(n,e),!0)}filter(e,s){const n=[];return this.data.forEach(i=>{if(i instanceof Me){let r=[];if(i.options.forEach(o=>{(!e||e(o))&&(s?r.push(new ue(o)):n.push(new ue(o)))}),r.length>0){let o=new Me(i);o.options=r,n.push(o)}}i instanceof ue&&(!e||e(i))&&n.push(new ue(i))}),n}selectedOrderOptions(e){const s=[];return this.selectedOrder.forEach(n=>{const i=e.find(r=>r.id===n);i&&s.push(i)}),e.forEach(n=>{let i=!1;s.forEach(r=>{if(n.id===r.id){i=!0;return}}),i||s.push(n)}),s}}const ke=class ke{static getLiveAssertive(){let e=document.getElementById("ss-live-assertive");return e||(e=document.createElement("div"),e.id="ss-live-assertive",e.setAttribute("role","status"),e.setAttribute("aria-live","assertive"),e.setAttribute("aria-atomic","true"),e.className="sr-only",document.body.appendChild(e)),e}_announceAssertive(e){const s=ke._liveAssertive||(ke._liveAssertive=ke.getLiveAssertive());s.textContent="",requestAnimationFrame(()=>{s.textContent=e})}constructor(e,s,n,i){var o;this.store=n,this.settings=e,this.classes=s,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes();const r=(o=document.querySelector(`[data-id="${this.settings.id}"]`))==null?void 0:o.closest(".offcanvas-body");r?r.appendChild(this.content.main):this.settings.contentLocation&&this.settings.contentLocation.appendChild(this.content.main)}static getLivePolite(){let e=document.getElementById("ss-live-polite");return e||(e=document.createElement("div"),e.id="ss-live-polite",e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),e.className="sr-only",document.body.appendChild(e)),e}_announcePolite(e){const s=ke._livePolite||(ke._livePolite=ke.getLivePolite());s.textContent="",requestAnimationFrame(()=>{s.textContent=e})}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 e=this.store.getSelectedOptions();if(e.length){const s=e[e.length-1].id,n=this.content.list.querySelector('[data-id="'+s+'"]');n&&this.ensureElementInView(this.content.list,n)}this.settings.contentPosition==="fixed"&&(this.moveContent(),this.scrollHandler=()=>this.moveContent(),this.resizeHandler=()=>this.moveContent(),window.addEventListener("scroll",this.scrollHandler,!0),window.addEventListener("resize",this.resizeHandler)),this.searchFocus()}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),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=void 0),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=void 0),this.main.main.focus({preventScroll:!0}),this.main.main.removeAttribute("aria-activedescendant")}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.main.main.classList.add("ss-2"),this.content.main.classList.add(this.classes.content),this.content.main.classList.add("ss-content-2"),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()));(this.settings.contentPosition==="relative"||this.settings.contentPosition==="fixed")&&this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){this.content.list.setAttribute("role","listbox"),this.content.list.setAttribute("id",this.content.main.id+"-list"),this.content.list.setAttribute("aria-label",this.settings.contentAriaLabel),this.settings.isMultiple?this.content.list.setAttribute("aria-multiselectable","true"):this.content.list.removeAttribute("aria-multiselectable"),this.main.main.setAttribute("role","combobox"),this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.list.id),this.main.main.setAttribute("aria-expanded","false"),this.main.main.setAttribute("aria-autocomplete","list"),this.settings.ariaLabelledBy&&this.settings.ariaLabelledBy.trim()?(this.main.main.setAttribute("aria-labelledby",this.settings.ariaLabelledBy),this.main.main.removeAttribute("aria-label")):this.settings.ariaLabel&&this.settings.ariaLabel.trim()&&this.main.main.setAttribute("aria-label",this.settings.ariaLabel),this.main.main.setAttribute("aria-owns",this.content.list.id),this.content.search.input.setAttribute("aria-controls",this.content.list.id),this.content.search.input.setAttribute("aria-autocomplete","list")}mainDiv(){var u;const e=document.createElement("div");e.id=this.settings.id+"-main",e.tabIndex=0,e.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 f=this.content.list.querySelector("."+this.classes.highlighted);return f&&f.click(),!1;case"Escape":return this.callbacks.close(),!1}return c.key.length===1&&this.callbacks.open(),!0},e.onclick=c=>{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 n=document.createElement("div");n.classList.add(this.classes.deselect),n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label",this.settings.clearAllAriaLabel),n.addEventListener("keydown",c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),n.click())});const i=(u=this.store)==null?void 0:u.getSelectedOptions();!this.settings.allowDeselect||this.settings.isMultiple&&i&&i.length<=0?n.classList.add(this.classes.hide):n.classList.remove(this.classes.hide),n.onclick=c=>{if(c.stopPropagation(),this.settings.disabled)return;let f=!0;const p=this.store.getSelectedOptions(),g=[];if(this.callbacks.beforeChange&&(f=this.callbacks.beforeChange(g,p)===!0),f){if(this.settings.isMultiple)this.callbacks.setSelected([],!1),this.updateDeselectAll();else{const C=this.store.getFirstOption(),_=C?C.id:"";this.callbacks.setSelected(_,!1)}this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(this.store.getSelectedOptions())}};const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("viewBox","0 0 100 100"),r.setAttribute("aria-hidden","true"),r.setAttribute("focusable","false");const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.deselectPath),r.appendChild(o),n.appendChild(r),e.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.classList.add(this.classes.arrow),l.setAttribute("viewBox","0 0 100 100"),l.setAttribute("aria-hidden","true"),l.setAttribute("focusable","false");const a=document.createElementNS("http://www.w3.org/2000/svg","path");return a.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&l.classList.add(this.classes.hide),l.appendChild(a),e.appendChild(l),{main:e,values:s,deselect:{main:n,svg:r,path:o},arrow:{main:l,path:a}}}mainFocus(e){e!=="click"&&this.main.main.focus({preventScroll:!0})}placeholder(){const e=this.store.filter(i=>i.placeholder,!1);let s=this.settings.placeholderText;e.length&&(e[0].html!==""?s=e[0].html:e[0].text!==""&&(s=e[0].text));const n=document.createElement("div");return n.classList.add(this.classes.placeholder),n.innerHTML=s,n}renderValues(){if(!this.settings.isMultiple){this.renderSingleValue();return}this.renderMultipleValues(),this.updateDeselectAll()}renderSingleValue(){const e=this.store.filter(n=>n.selected&&!n.placeholder,!1),s=e.length>0?e[0]:null;if(!s)this.main.values.innerHTML=this.placeholder().outerHTML;else{const n=document.createElement("div");n.classList.add(this.classes.single),s.html?n.innerHTML=s.html:n.innerText=s.text,this.main.values.innerHTML=n.outerHTML}!this.settings.allowDeselect||!e.length?this.main.deselect.main.classList.add(this.classes.hide):this.main.deselect.main.classList.remove(this.classes.hide)}renderMultipleValues(){let e=this.main.values.childNodes,s=this.store.filter(i=>i.selected&&i.display,!1);if(s.length===0){this.main.values.innerHTML=this.placeholder().outerHTML;return}else{const i=this.main.values.querySelector("."+this.classes.placeholder);i&&i.remove()}if(s.length>this.settings.maxValuesShown){const i=document.createElement("div");i.classList.add(this.classes.max),i.textContent=this.settings.maxValuesMessage.replace("{number}",s.length.toString()),this.main.values.innerHTML=i.outerHTML;return}else{const i=this.main.values.querySelector("."+this.classes.max);i&&i.remove()}this.settings.keepOrder&&(s=this.store.selectedOrderOptions(s));let n=[];for(let i=0;ia.id===o,!1).length||n.push(r))}for(const i of n)i.classList.add(this.classes.valueOut),setTimeout(()=>{this.main.values.hasChildNodes()&&this.main.values.contains(i)&&this.main.values.removeChild(i)},100);e=this.main.values.childNodes;for(let i=0;i{if(l.preventDefault(),l.stopPropagation(),this.settings.disabled)return;let a=!0;const u=this.store.getSelectedOptions(),c=u.filter(f=>f.selected&&f.id!==e.id,!0);if(!(this.settings.minSelected&&c.length{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),i.click())}}return s}contentDiv(){const e=document.createElement("div");e.id=this.settings.id+"-content";const s=this.searchDiv();e.appendChild(s.main);const n=this.listDiv();return e.appendChild(n),{main:e,search:s,list:n}}moveContent(){if(this.settings.contentPosition==="relative"){this.moveContentBelow();return}if(this.settings.openPosition==="down"){this.moveContentBelow();return}else if(this.settings.openPosition==="up"){this.moveContentAbove();return}this.putContent()==="up"?this.moveContentAbove():this.moveContentBelow()}searchDiv(){const e=document.createElement("div"),s=document.createElement("input"),n=document.createElement("div");e.classList.add(this.classes.search);const i={main:e,input:s};if(this.settings.showSearch||(e.classList.add(this.classes.hide),s.readOnly=!0),s.type="search",s.placeholder=this.settings.searchPlaceholder,s.tabIndex=-1,this.settings.searchLabelledBy&&this.settings.searchLabelledBy.trim()?s.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel&&this.settings.searchAriaLabel.trim()?s.setAttribute("aria-label",this.settings.searchAriaLabel):s.setAttribute("aria-label","Search options"),s.setAttribute("autocapitalize","off"),s.setAttribute("autocomplete","off"),s.setAttribute("autocorrect","off"),s.oninput=Kt(r=>{this.callbacks.search(r.target.value)},100),s.onkeydown=r=>{switch(r.key){case"ArrowUp":case"ArrowDown":return r.key==="ArrowDown"?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Escape":return this.callbacks.close(),!1;case" ":const o=this.content.list.querySelector("."+this.classes.highlighted);return o?(o.click(),!1):!0;case"Enter":if(this.callbacks.addable)return n.click(),!1;{const l=this.content.list.querySelector("."+this.classes.highlighted);if(l)return l.click(),!1}return!0}return!0},e.appendChild(s),this.callbacks.addable){n.classList.add(this.classes.addable);const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("viewBox","0 0 100 100"),r.setAttribute("aria-hidden","true"),r.setAttribute("focusable","false");const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.addablePath),r.appendChild(o),n.appendChild(r),n.onclick=l=>{if(l.preventDefault(),l.stopPropagation(),!this.callbacks.addable)return;const a=this.content.search.input.value.trim();if(a===""){this.content.search.input.focus();return}const u=f=>{let p=new ue(f);if(this.callbacks.addOption(p),this.settings.isMultiple){let g=this.store.getSelected();g.push(p.id),this.callbacks.setSelected(g,!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(f=>{typeof f=="string"?u({text:f,value:f}):c instanceof Error?this.renderError(c.message):u(f)}):typeof c=="string"?u({text:c,value:c}):c instanceof Error?this.renderError(c.message):u(c))},e.appendChild(n),i.addable={main:n,svg:r,path:o}}return i}searchFocus(){this.content.search.input.focus()}getOptions(e=!1,s=!1,n=!1){let i="."+this.classes.option;return e&&(i+=":not(."+this.classes.placeholder+")"),s&&(i+=":not(."+this.classes.disabled+")"),n&&(i+=":not(."+this.classes.hide+")"),Array.from(this.content.list.querySelectorAll(i))}highlight(e){const s=this.getOptions(!0,!0,!0);if(s.length===0)return;if(s.length===1&&!s[0].classList.contains(this.classes.highlighted)){s[0].classList.add(this.classes.highlighted);return}let n=!1;for(const r of s)r.classList.contains(this.classes.highlighted)&&(n=!0);if(!n){for(const r of s)if(r.classList.contains(this.classes.selected)){r.classList.add(this.classes.highlighted);break}}for(let r=0;r=0?r-1:s.length-1];a.classList.add(this.classes.highlighted),this.main.main.setAttribute("aria-activedescendant",a.id),this.ensureElementInView(this.content.list,a);const u=a.parentElement;if(u&&u.classList.contains(this.classes.close)){const c=u.querySelector("."+this.classes.optgroupLabel);c&&c.click()}return}const i=s[e==="down"?0:s.length-1];i.classList.add(this.classes.highlighted),this.main.main.setAttribute("aria-activedescendant",i.id),this.ensureElementInView(this.content.list,i)}listDiv(){const e=document.createElement("div");return e.classList.add(this.classes.list),e}renderError(e){this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy");const s=document.createElement("div");s.classList.add(this.classes.error),s.textContent=e,this.content.list.appendChild(s),this._announceAssertive(e)}renderSearching(){this.content.list.innerHTML="",this.content.list.setAttribute("aria-busy","true");const e=document.createElement("div");e.classList.add(this.classes.searching),e.textContent=this.settings.searchingText,this.content.list.appendChild(e),this._announcePolite(this.settings.searchingText)}renderOptions(e){if(this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy"),e.length===0){const o=document.createElement("div");o.classList.add(this.classes.search);const l=this.callbacks.addable?this.settings.addableText.replace("{value}",this.content.search.input.value):this.settings.searchText;this._announcePolite(l),o.innerHTML=l,this.content.list.appendChild(o),this.content.list.setAttribute("aria-setsize","0");return}this.settings.allowDeselect&&!this.settings.isMultiple&&(this.store.filter(l=>l.placeholder,!1).length||this.store.addOption(new ue({text:"",value:"",selected:!1,placeholder:!0}),!0));const s=document.createDocumentFragment();let n=0;const i=o=>{!o.classList.contains(this.classes.placeholder)&&!o.classList.contains(this.classes.disabled)&&!o.classList.contains(this.classes.hide)&&o.setAttribute("aria-posinset",String(++n))};for(const o of e){if(o instanceof Me){const l=document.createElement("div");l.classList.add(this.classes.optgroup),l.setAttribute("role","group"),l.setAttribute("aria-label",o.label);const a=document.createElement("div");a.classList.add(this.classes.optgroupLabel),l.appendChild(a);const u=document.createElement("div");u.classList.add(this.classes.optgroupLabelText),u.textContent=o.label,a.appendChild(u);const c=document.createElement("div");if(c.classList.add(this.classes.optgroupActions),a.appendChild(c),this.settings.isMultiple&&o.selectAll){const f=document.createElement("div");f.classList.add(this.classes.optgroupSelectAll);let p=!0;for(const T of o.options)if(!T.selected){p=!1;break}p&&f.classList.add(this.classes.selected);const g=document.createElement("span");g.textContent=o.selectAllText,f.appendChild(g);const C=document.createElementNS("http://www.w3.org/2000/svg","svg");C.setAttribute("viewBox","0 0 100 100"),C.setAttribute("aria-hidden","true"),C.setAttribute("focusable","false"),f.appendChild(C);const _=document.createElementNS("http://www.w3.org/2000/svg","path");_.setAttribute("d",this.classes.optgroupSelectAllBox),C.appendChild(_);const D=document.createElementNS("http://www.w3.org/2000/svg","path");D.setAttribute("d",this.classes.optgroupSelectAllCheck),C.appendChild(D),f.addEventListener("click",T=>{T.preventDefault(),T.stopPropagation();const m=this.store.getSelected();if(p){const v=m.filter(y=>{for(const E of o.options)if(y===E.id)return!1;return!0});this.callbacks.setSelected(v,!0);return}else{const v=m.concat(o.options.map(y=>y.id));for(const y of o.options)this.store.getOptionByID(y.id)||this.callbacks.addOption(y);this.callbacks.setSelected(v,!0);return}}),c.appendChild(f)}if(o.closable!=="off"){const f=document.createElement("div");f.classList.add(this.classes.optgroupClosable);const p=document.createElementNS("http://www.w3.org/2000/svg","svg");p.setAttribute("viewBox","0 0 100 100"),p.classList.add(this.classes.arrow),p.setAttribute("aria-hidden","true"),p.setAttribute("focusable","false"),f.appendChild(p);const g=document.createElementNS("http://www.w3.org/2000/svg","path");p.appendChild(g),o.options.some(C=>C.selected)||this.content.search.input.value.trim()!==""?(l.classList.add(this.classes.open),g.setAttribute("d",this.classes.arrowOpen)):o.closable==="open"?(l.classList.add(this.classes.open),g.setAttribute("d",this.classes.arrowOpen)):o.closable==="close"&&(l.classList.add(this.classes.close),g.setAttribute("d",this.classes.arrowClose)),a.addEventListener("click",C=>{C.preventDefault(),C.stopPropagation(),l.classList.contains(this.classes.close)?(l.classList.remove(this.classes.close),l.classList.add(this.classes.open),g.setAttribute("d",this.classes.arrowOpen)):(l.classList.remove(this.classes.open),l.classList.add(this.classes.close),g.setAttribute("d",this.classes.arrowClose))}),c.appendChild(f)}l.appendChild(a);for(const f of o.options){const p=this.option(f);i(p),l.appendChild(p)}s.appendChild(l)}if(o instanceof ue){const l=this.option(o);i(l),s.appendChild(l)}}this.content.list.appendChild(s),this.content.list.removeAttribute("aria-busy");const r=this.getOptions(!0,!0,!0).length;this.content.list.setAttribute("aria-setsize",String(r)),this._announcePolite(`${r} option${r===1?"":"s"} available`)}option(e){if(e.placeholder){const n=document.createElement("div");return n.classList.add(this.classes.option),n.classList.add(this.classes.hide),n}const s=document.createElement("div");return s.dataset.id=e.id,s.id=`${this.settings.id}__opt__${e.id}`,s.classList.add(this.classes.option),s.setAttribute("role","option"),e.class&&e.class.split(" ").forEach(n=>{s.classList.add(n)}),e.style&&(s.style.cssText=e.style),this.settings.searchHighlight&&this.content.search.input.value.trim()!==""?s.innerHTML=this.highlightText(e.html!==""?e.html:e.text,this.content.search.input.value,this.classes.searchHighlighter):e.html!==""?s.innerHTML=e.html:s.textContent=e.text,this.settings.showOptionTooltips&&s.textContent&&s.setAttribute("title",s.textContent),e.display||s.classList.add(this.classes.hide),e.disabled&&(s.classList.add(this.classes.disabled),s.setAttribute("aria-disabled","true")),e.selected&&this.settings.hideSelected&&s.classList.add(this.classes.hide),e.selected?(s.classList.add(this.classes.selected),s.setAttribute("aria-selected","true"),this.main.main.setAttribute("aria-activedescendant",s.id)):(s.classList.remove(this.classes.selected),s.setAttribute("aria-selected","false")),s.addEventListener("click",n=>{n.preventDefault(),n.stopPropagation();const i=this.store.getSelected(),r=n.currentTarget,o=String(r.dataset.id);if(e.disabled||e.selected&&!this.settings.allowDeselect||this.settings.isMultiple&&this.settings.maxSelected<=i.length&&!e.selected||this.settings.isMultiple&&this.settings.minSelected>=i.length&&e.selected)return;let l=!1;const a=this.store.getSelectedOptions();let u=[];if(this.settings.isMultiple){if(e.selected)u=a.filter(c=>c.id!==o);else if(u=a.concat(e),!this.settings.closeOnSelect)if(n.shiftKey&&this.lastSelectedOption){const c=this.store.getDataOptions();let f=c.findIndex(g=>g.id===this.lastSelectedOption.id),p=c.findIndex(g=>g.id===e.id);if(f>=0&&p>=0){const g=Math.min(f,p),C=Math.max(f,p),_=c.slice(g,C+1);_.length>0&&_.length!a.find(T=>T.id===D.id))))}}else e.selected||(this.lastSelectedOption=e)}this.settings.isMultiple||(e.selected?u=[]:u=[e]),this.callbacks.beforeChange||(l=!0),this.callbacks.beforeChange&&(this.callbacks.beforeChange(u,a)===!1?l=!1:l=!0),l&&(this.store.getOptionByID(o)||this.callbacks.addOption(e),this.callbacks.setSelected(u.map(c=>c.id),!1),this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(u))}),s}destroy(){this.main.main.remove(),this.content.main.remove()}highlightText(e,s,n){let i=e;const r=new RegExp("(?![^<]*>)("+s.trim()+")(?![^<]*>[^<>]*${a}`),i}moveContentAbove(){const e=this.main.main.offsetHeight,s=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 n=this.main.main.getBoundingClientRect();this.content.main.style.margin="-"+(e+s-1)+"px 0px 0px 0px",this.content.main.style.top=n.top+n.height+(this.settings.contentPosition==="fixed"?0:window.scrollY)+"px",this.content.main.style.left=n.left+(this.settings.contentPosition==="fixed"?0:window.scrollX)+"px",this.content.main.style.width=n.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",this.settings.contentPosition!=="relative"&&(this.content.main.style.top=e.top+e.height+(this.settings.contentPosition==="fixed"?0:window.scrollY)+"px",this.content.main.style.left=e.left+(this.settings.contentPosition==="fixed"?0:window.scrollX)+"px",this.content.main.style.width=e.width+"px")}ensureElementInView(e,s){const n=e.scrollTop+e.offsetTop,i=n+e.clientHeight,r=s.offsetTop,o=r+s.clientHeight;ri&&(e.scrollTop+=o-i)}putContent(){const e=this.main.main.offsetHeight,s=this.main.main.getBoundingClientRect(),n=this.content.main.offsetHeight;return window.innerHeight-(s.top+e)<=n&&s.top>n?"up":"down"}updateDeselectAll(){if(!this.store||!this.settings)return;const e=this.store.getSelectedOptions(),s=e&&e.length>0,n=this.settings.isMultiple,i=this.settings.allowDeselect,r=this.main.deselect.main,o=this.classes.hide;i&&!(n&&!s)?r.classList.remove(o):r.classList.add(o)}};ke._livePolite=null,ke._liveAssertive=null;let hn=ke;class Ic{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.getSelectedOptions()),!0}observeCall(e){if(!this.listen)return;let s=!1,n=!1,i=!1;for(const r of e){if(r.target===this.select&&(r.attributeName==="disabled"&&(n=!0),r.attributeName==="class"&&(s=!0),r.type==="childList")){for(const o of r.addedNodes)if(o.nodeName==="OPTION"&&o.value===this.select.value){this.select.dispatchEvent(new Event("change"));break}i=!0}(r.target.nodeName==="OPTGROUP"||r.target.nodeName==="OPTION")&&(i=!0)}s&&this.onClassChange&&this.onClassChange(this.select.className.split(" ")),n&&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 s=this.select.childNodes;for(const n of s)n.nodeName==="OPTGROUP"&&e.push(this.getDataFromOptgroup(n)),n.nodeName==="OPTION"&&e.push(this.getDataFromOption(n));return e}getDataFromOptgroup(e){let s={id:e.id,label:e.label,selectAll:e.dataset?e.dataset.selectall==="true":!1,selectAllText:e.dataset?e.dataset.selectalltext:"Select all",closable:e.dataset?e.dataset.closable:"off",options:[]};const n=e.childNodes;for(const i of n)i.nodeName==="OPTION"&&s.options.push(this.getDataFromOption(i));return s}getDataFromOption(e){return{id:e.id,value:e.value,text:e.text,html:e.dataset&&e.dataset.html?e.dataset.html:"",defaultSelected:e.defaultSelected,selected:e.selected,display:e.style.display!=="none",disabled:e.disabled,mandatory:e.dataset?e.dataset.mandatory==="true":!1,placeholder:e.dataset.placeholder==="true",class:e.className,style:e.style.cssText,data:e.dataset}}getSelectedOptions(){let e=[];const s=this.select.childNodes;for(const n of s){if(n.nodeName==="OPTGROUP"){const i=n.childNodes;for(const r of i)if(r.nodeName==="OPTION"){const o=r;o.selected&&e.push(this.getDataFromOption(o))}}if(n.nodeName==="OPTION"){const i=n;i.selected&&e.push(this.getDataFromOption(i))}}return e}getSelectedValues(){return this.getSelectedOptions().map(e=>e.value)}setSelected(e){this.changeListen(!1);const s=this.select.childNodes;for(const n of s){if(n.nodeName==="OPTGROUP"){const r=n.childNodes;for(const o of r)if(o.nodeName==="OPTION"){const l=o;l.selected=e.includes(l.id)}}if(n.nodeName==="OPTION"){const i=n;i.selected=e.includes(i.id)}}this.changeListen(!0)}setSelectedByValue(e){this.changeListen(!1);const s=this.select.childNodes;for(const n of s){if(n.nodeName==="OPTGROUP"){const r=n.childNodes;for(const o of r)if(o.nodeName==="OPTION"){const l=o;l.selected=e.includes(l.value)}}if(n.nodeName==="OPTION"){const i=n;i.selected=e.includes(i.value)}}this.changeListen(!0)}updateSelect(e,s,n){this.changeListen(!1),e&&(this.select.dataset.id=e),s&&(this.select.style.cssText=s),n&&(this.select.className="",n.forEach(i=>{i.trim()!==""&&this.select.classList.add(i.trim())})),this.changeListen(!0)}updateOptions(e){this.changeListen(!1),this.select.innerHTML="";for(const s of e)s instanceof Me&&this.select.appendChild(this.createOptgroup(s)),s instanceof ue&&this.select.appendChild(this.createOption(s));this.select.dispatchEvent(new Event("change",{bubbles:!0})),this.changeListen(!0)}createOptgroup(e){const s=document.createElement("optgroup");if(s.id=e.id,s.label=e.label,e.selectAll&&(s.dataset.selectAll="true"),e.closable!=="off"&&(s.dataset.closable=e.closable),e.options)for(const n of e.options)s.appendChild(this.createOption(n));return s}createOption(e){const s=document.createElement("option");return s.id=e.id,s.value=e.value,s.textContent=e.text,e.html!==""&&s.setAttribute("data-html",e.html),s.defaultSelected=e.defaultSelected,s.selected=e.selected,e.disabled&&(s.disabled=!0),e.display||(s.style.display="none"),e.placeholder&&s.setAttribute("data-placeholder","true"),e.mandatory&&s.setAttribute("data-mandatory","true"),e.class&&e.class.split(" ").forEach(n=>{s.classList.add(n)}),e.data&&typeof e.data=="object"&&Object.keys(e.data).forEach(n=>{s.setAttribute("data-"+kc(n),e.data[n])}),s}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 Mc{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-"+Fn(),this.style=e.style||"",this.class=e.class||[],this.disabled=e.disabled!==void 0?e.disabled:!1,this.alwaysOpen=e.alwaysOpen!==void 0?e.alwaysOpen:!1,this.showSearch=e.showSearch!==void 0?e.showSearch:!0,this.focusSearch=e.focusSearch!==void 0?e.focusSearch:!0,this.ariaLabel=e.ariaLabel||"Combobox",this.searchPlaceholder=e.searchPlaceholder||"Search",this.searchText=e.searchText||"No Results",this.searchingText=e.searchingText||"Searching...",this.searchHighlight=e.searchHighlight!==void 0?e.searchHighlight:!1,this.closeOnSelect=e.closeOnSelect!==void 0?e.closeOnSelect:!0,this.contentLocation=e.contentLocation||document.body,this.contentPosition=e.contentPosition||"absolute",this.openPosition=e.openPosition||"auto",this.contentAriaLabel=e.contentAriaLabel!==void 0?e.contentAriaLabel:"Select an option",this.placeholderText=e.placeholderText!==void 0?e.placeholderText:"Select Value",this.allowDeselect=e.allowDeselect!==void 0?e.allowDeselect:!1,this.hideSelected=e.hideSelected!==void 0?e.hideSelected:!1,this.keepOrder=e.keepOrder!==void 0?e.keepOrder:!1,this.showOptionTooltips=e.showOptionTooltips!==void 0?e.showOptionTooltips:!1,this.minSelected=e.minSelected||0,this.maxSelected=e.maxSelected||1e3,this.timeoutDelay=e.timeoutDelay||200,this.maxValuesShown=e.maxValuesShown||20,this.maxValuesMessage=e.maxValuesMessage||"{number} selected",this.addableText=e.addableText||'Press "Enter" to add {value}',this.ariaLabelledBy=e.ariaLabelledBy||"",this.searchAriaLabel=e.searchAriaLabel||"Search options",this.searchLabelledBy=e.searchLabelledBy||"",this.clearAllAriaLabel=e.clearAllAriaLabel||"Clear selection"}}class Nc{constructor(e){var o;if(this.events={search:void 0,searchFilter:(l,a)=>l.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=Kt(()=>{!this.settings.isOpen&&!this.settings.isFullOpen||this.render.moveContent()}),this.windowScroll=Kt(()=>{!this.settings.isOpen&&!this.settings.isFullOpen||this.render.moveContent()}),this.documentClick=l=>{this.settings.isOpen&&l.target&&!Dc(l.target,this.settings.id)&&this.close(l.type)},this.windowVisibilityChange=()=>{document.hidden&&this.close()},this.selectEl=typeof e.select=="string"?document.querySelector(e.select):e.select,!this.selectEl){e.events&&e.events.error&&e.events.error(new Error("Could not find select element"));return}if(this.selectEl.tagName!=="SELECT"){e.events&&e.events.error&&e.events.error(new Error("Element isnt of type select"));return}this.selectEl.dataset.ssid&&this.destroy(),this.settings=new Mc(e.settings),this.cssClasses=new Rc(e.cssClasses);const s=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const l in e.events)e.events.hasOwnProperty(l)&&(s.indexOf(l)!==-1?this.events[l]=Kt(e.events[l],100):this.events[l]=e.events[l]);this.settings.disabled=(o=e.settings)!=null&&o.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 Ic(this.selectEl),this.select.updateSelect(this.settings.id,this.settings.style,this.settings.class),this.select.hideUI(),this.select.onValueChange=l=>{this.setSelected(l.map(a=>a.id))},this.select.onClassChange=l=>{this.settings.class=l,this.render.updateClassStyles()},this.select.onDisabledChange=l=>{l?this.disable():this.enable()},this.select.onOptionsChange=l=>{this.setData(l)},this.store=new Fc(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 hn(this.settings,this.cssClasses,this.store,n),this.render.renderValues(),this.render.renderOptions(this.store.getData());const i=this.selectEl.getAttribute("aria-label"),r=this.selectEl.getAttribute("aria-labelledby");i?this.render.main.main.setAttribute("aria-label",i):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),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(e){const s=this.store.getSelected(),n=this.store.validateDataArray(e);if(n){this.events.error&&this.events.error(n);return}this.store.setData(e);const i=this.store.getData();this.select.updateOptions(i),this.render.renderValues(),this.render.renderOptions(i),this.events.afterChange&&!qs(s,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let e=this.store.getSelectedOptions();return this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e)),e.map(s=>s.value)}setSelected(e,s=!0){const n=this.store.getSelected(),i=this.store.getDataOptions();e=Array.isArray(e)?e:[e];const r=[];for(const l of e){if(i.find(a=>a.id==l)){r.push(l);continue}for(const a of i.filter(u=>u.value==l))r.push(a.id)}this.store.setSelectedBy("id",r);const o=this.store.getData();this.select.updateOptions(o),this.render.renderValues(),this.render.content.search.input.value!==""?this.search(this.render.content.search.input.value):this.render.renderOptions(o),s&&this.events.afterChange&&!qs(n,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}addOption(e){const s=this.store.getSelected();this.store.getDataOptions().some(i=>i.value===(e.value??e.text))||this.store.addOption(e);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!qs(s,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.settings.focusSearch&&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(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){this.render.renderOptions(e===""?this.store.getData():this.store.search(e,this.events.searchFilter));return}this.render.renderSearching();const s=this.events.search(e,this.store.getSelectedOptions());if(s instanceof Promise){s.then(n=>{this.render.renderOptions(this.store.partialToFullData(n))}).catch(n=>{this.render.renderError(typeof n=="string"?n:n.message)});return}else Array.isArray(s)?this.render.renderOptions(this.store.partialToFullData(s)):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 Bc="CWYDT23U",Hc="slimselectjscom",Vc=Ts({__name:"carbonad",setup(t){const e=ir(null);let s=!1;return mr(()=>{const n=window.location.hostname==="localhost";if(!s&&!n){s=!0;const i=document.createElement("script");i.id="_carbonads_js",i.src=`//cdn.carbonads.com/carbon.js?serve=${Bc}&placement=${Hc}`,i.async=!0,e.value&&e.value.appendChild(i)}}),(n,i)=>wt(s)?(Zt(),Nr("div",{key:0,class:"carbon-container",ref_key:"container",ref:e},null,512)):$o("",!0)}}),Uc=Ts({name:"App",components:{CarbonAd:Vc},data(){return{nav:null,navDebounce:Kt(()=>{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:"Examples",closable:"close",options:[{text:"countries",value:"examples#countries"},{text:"form reset",value:"examples#formReset"}]},{label:"Settings",closable:"close",options:[{text:"select",value:"settings#select"},{text:"cssClasses",value:"settings#cssClasses"},{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"}]}]}},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 t=this.$route.hash;if(t===""&&window.scroll({top:0,behavior:"smooth"}),t){const e=document.querySelector(t);if(e){const s=document.querySelector("header"),n=document.querySelector("nav"),i=s?s.clientHeight+(window.innerWidth<700?n.clientHeight:0)+8:0;window.scroll({top:e.offsetTop-i,behavior:"smooth"})}}},200)}),this.setDemensions(),window.addEventListener("resize",this.navDebounce),window.addEventListener("nav-updated",this.updateNav)},unmounted(){var t;window.removeEventListener("resize",this.navDebounce),window.removeEventListener("nav-updated",this.updateNav),(t=this.nav)==null||t.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 t={searchHighlight:!0,openContent:"below"};this.width>700&&(t.alwaysOpen=!0,t.contentPosition="relative",t.contentLocation=this.$refs.navContent),this.nav=new Nc({select:this.$refs.nav,data:this.navData,settings:t,events:{afterChange:e=>{const n=e[0].value.split("#"),i=n[0],r=n[1]?"#"+n[1]:void 0;this.$router.push({path:i,hash:r})}}})},updateNav(){setTimeout(()=>{this.nav&&this.nav.setSelected(this.$router.currentRoute.value.fullPath.replace("/",""))},0)}}}),$c="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",jc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACAAQMAAAD58POIAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZQTFRFyzg3////IltC9QAAAAFiS0dEAf8CLd4AAAAJcEhZcwAACxMAAAsTAQCanBgAAAAkSURBVEjHY2AYBYMV/IeDUQG4AJgeFRgVGBUYFSBNYBQMPgAARjtdvxo6xaMAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTEtMDUtMzBUMjM6MTA6NDQtMDc6MDCm4GvfAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDEwLTEyLTA2VDEyOjIwOjEyLTA4OjAwpIGEmQAAADJ0RVh0UE5HOmNIUk0AY2h1bmsgd2FzIGZvdW5kIChzZWUgQ2hyb21hdGljaXR5LCBhYm92ZSkH0UjaAAAAKXRFWHRQTkc6Z0FNQQBnYW1tYT0wLjQ1NDU1IChTZWUgR2FtbWEsIGFib3ZlKRISLKcAAAAUdEVYdFBORzpJSERSLmJpdF9kZXB0aAA4KYV+UAAAABV0RVh0UE5HOklIRFIuY29sb3JfdHlwZQA2BkqnKwAAABt0RVh0UE5HOklIRFIuaW50ZXJsYWNlX21ldGhvZAAw+zsHjAAAABx0RVh0UE5HOklIRFIud2lkdGgsaGVpZ2h0ADE2LCAxNjjVBg0AAAAodEVYdFBORzpwSFlzAHhfcmVzPTI4MzUsIHlfcmVzPTI4MzUsIHVuaXRzPTGCKXI+AAAAKHRFWHRQTkc6c1JHQgBpbnRlbnQ9MCAoU2VlIFJlbmRlcmluZyBpbnRlbnQp8hEU9QAAAABJRU5ErkJggg==",zc=(t,e)=>{const s=t.__vccOpts||t;for(const[n,i]of e)s[n]=i;return s},Wc={ref:"nav"},Gc={class:"nav-content",ref:"navContent"};function qc(t,e,s,n,i,r){const o=$n("CarbonAd"),l=$n("router-view");return Zt(),Nr(Re,null,[e[4]||(e[4]=Uo('

Slim Select 2.0

Advanced select dropdown
',1)),Ze("nav",null,[Ze("select",Wc,null,512),Ze("div",Gc,null,512),de(o)]),Ze("main",null,[de(l),Ze("footer",null,[ds(" © "+Vi(t.year)+" ",1),e[0]||(e[0]=Ze("a",{href:"http://webiswhatido.com",style:{color:"#ffffff"},target:"_blank"},"Brian Voelker",-1)),e[1]||(e[1]=ds(". ")),e[2]||(e[2]=Ze("br",null,null,-1)),e[3]||(e[3]=ds(" Slim Select is under the MIT license. "))])])],64)}const Kc=zc(Uc,[["render",qc]]);var Ri=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function sl(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ks={exports:{}},Di;function Yc(){return Di||(Di=1,function(t){var e=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 s=function(n){var i=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,r=0,o={},l={manual:n.Prism&&n.Prism.manual,disableWorkerMessageHandler:n.Prism&&n.Prism.disableWorkerMessageHandler,util:{encode:function m(b){return b instanceof a?new a(b.type,m(b.content),b.alias):Array.isArray(b)?b.map(m):b.replace(/&/g,"&").replace(/"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(E){var m=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(E.stack)||[])[1];if(m){var b=document.getElementsByTagName("script");for(var y in b)if(b[y].src==m)return b[y]}return null}},isActive:function(m,b,y){for(var E="no-"+b;m;){var O=m.classList;if(O.contains(b))return!0;if(O.contains(E))return!1;m=m.parentElement}return!!y}},languages:{plain:o,plaintext:o,text:o,txt:o,extend:function(m,b){var y=l.util.clone(l.languages[m]);for(var E in b)y[E]=b[E];return y},insertBefore:function(m,b,y,E){E=E||l.languages;var O=E[m],F={};for(var W in O)if(O.hasOwnProperty(W)){if(W==b)for(var B in y)y.hasOwnProperty(B)&&(F[B]=y[B]);y.hasOwnProperty(W)||(F[W]=O[W])}var q=E[m];return E[m]=F,l.languages.DFS(l.languages,function(re,pe){pe===q&&re!=m&&(this[re]=F)}),F},DFS:function m(b,y,E,O){O=O||{};var F=l.util.objId;for(var W in b)if(b.hasOwnProperty(W)){y.call(b,W,b[W],E||W);var B=b[W],q=l.util.type(B);q==="Object"&&!O[F(B)]?(O[F(B)]=!0,m(B,y,null,O)):q==="Array"&&!O[F(B)]&&(O[F(B)]=!0,m(B,y,W,O))}}},plugins:{},highlightAll:function(m,b){l.highlightAllUnder(document,m,b)},highlightAllUnder:function(m,b,y){var E={callback:y,container:m,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};l.hooks.run("before-highlightall",E),E.elements=Array.prototype.slice.apply(E.container.querySelectorAll(E.selector)),l.hooks.run("before-all-elements-highlight",E);for(var O=0,F;F=E.elements[O++];)l.highlightElement(F,b===!0,E.callback)},highlightElement:function(m,b,y){var E=l.util.getLanguage(m),O=l.languages[E];l.util.setLanguage(m,E);var F=m.parentElement;F&&F.nodeName.toLowerCase()==="pre"&&l.util.setLanguage(F,E);var W=m.textContent,B={element:m,language:E,grammar:O,code:W};function q(pe){B.highlightedCode=pe,l.hooks.run("before-insert",B),B.element.innerHTML=B.highlightedCode,l.hooks.run("after-highlight",B),l.hooks.run("complete",B),y&&y.call(B.element)}if(l.hooks.run("before-sanity-check",B),F=B.element.parentElement,F&&F.nodeName.toLowerCase()==="pre"&&!F.hasAttribute("tabindex")&&F.setAttribute("tabindex","0"),!B.code){l.hooks.run("complete",B),y&&y.call(B.element);return}if(l.hooks.run("before-highlight",B),!B.grammar){q(l.util.encode(B.code));return}if(b&&n.Worker){var re=new Worker(l.filename);re.onmessage=function(pe){q(pe.data)},re.postMessage(JSON.stringify({language:B.language,code:B.code,immediateClose:!0}))}else q(l.highlight(B.code,B.grammar,B.language))},highlight:function(m,b,y){var E={code:m,grammar:b,language:y};if(l.hooks.run("before-tokenize",E),!E.grammar)throw new Error('The language "'+E.language+'" has no grammar.');return E.tokens=l.tokenize(E.code,E.grammar),l.hooks.run("after-tokenize",E),a.stringify(l.util.encode(E.tokens),E.language)},tokenize:function(m,b){var y=b.rest;if(y){for(var E in y)b[E]=y[E];delete b.rest}var O=new f;return p(O,O.head,m),c(m,O,b,O.head,0),T(O)},hooks:{all:{},add:function(m,b){var y=l.hooks.all;y[m]=y[m]||[],y[m].push(b)},run:function(m,b){var y=l.hooks.all[m];if(!(!y||!y.length))for(var E=0,O;O=y[E++];)O(b)}},Token:a};n.Prism=l;function a(m,b,y,E){this.type=m,this.content=b,this.alias=y,this.length=(E||"").length|0}a.stringify=function m(b,y){if(typeof b=="string")return b;if(Array.isArray(b)){var E="";return b.forEach(function(q){E+=m(q,y)}),E}var O={type:b.type,content:m(b.content,y),tag:"span",classes:["token",b.type],attributes:{},language:y},F=b.alias;F&&(Array.isArray(F)?Array.prototype.push.apply(O.classes,F):O.classes.push(F)),l.hooks.run("wrap",O);var W="";for(var B in O.attributes)W+=" "+B+'="'+(O.attributes[B]||"").replace(/"/g,""")+'"';return"<"+O.tag+' class="'+O.classes.join(" ")+'"'+W+">"+O.content+""};function u(m,b,y,E){m.lastIndex=b;var O=m.exec(y);if(O&&E&&O[1]){var F=O[1].length;O.index+=F,O[0]=O[0].slice(F)}return O}function c(m,b,y,E,O,F){for(var W in y)if(!(!y.hasOwnProperty(W)||!y[W])){var B=y[W];B=Array.isArray(B)?B:[B];for(var q=0;q=F.reach);ae+=j.value.length,j=j.next){var ye=j.value;if(b.length>m.length)return;if(!(ye instanceof a)){var we=1,te;if(lt){if(te=u(Q,ae,m,Te),!te||te.index>=m.length)break;var fe=te.index,at=te.index+te[0].length,Ae=ae;for(Ae+=j.value.length;fe>=Ae;)j=j.next,Ae+=j.value.length;if(Ae-=j.value.length,ae=Ae,j.value instanceof a)continue;for(var Be=j;Be!==b.tail&&(AeF.reach&&(F.reach=H);var Y=j.prev;N&&(Y=p(b,Y,N),ae+=N.length),g(b,Y,we);var h=new a(W,pe?l.tokenize(w,pe):w,ot,w);if(j=p(b,Y,h),k&&p(b,j,k),we>1){var d={cause:W+","+q,reach:H};c(m,b,y,j.prev,ae,d),F&&d.reach>F.reach&&(F.reach=d.reach)}}}}}}function f(){var m={value:null,prev:null,next:null},b={value:null,prev:m,next:null};m.next=b,this.head=m,this.tail=b,this.length=0}function p(m,b,y){var E=b.next,O={value:y,prev:b,next:E};return b.next=O,E.prev=O,m.length++,O}function g(m,b,y){for(var E=b.next,O=0;O/,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]},s.languages.markup.tag.inside["attr-value"].inside.entity=s.languages.markup.entity,s.languages.markup.doctype.inside["internal-subset"].inside=s.languages.markup,s.hooks.add("wrap",function(n){n.type==="entity"&&(n.attributes.title=n.content.replace(/&/,"&"))}),Object.defineProperty(s.languages.markup.tag,"addInlined",{value:function(i,r){var o={};o["language-"+r]={pattern:/(^$)/i,lookbehind:!0,inside:s.languages[r]},o.cdata=/^$/i;var l={"included-cdata":{pattern://i,inside:o}};l["language-"+r]={pattern:/[\s\S]+/,inside:s.languages[r]};var a={};a[i]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return i}),"i"),lookbehind:!0,greedy:!0,inside:l},s.languages.insertBefore("markup","cdata",a)}}),Object.defineProperty(s.languages.markup.tag,"addAttribute",{value:function(n,i){s.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+n+")"+/\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:[i,"language-"+i],inside:s.languages[i]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),s.languages.html=s.languages.markup,s.languages.mathml=s.languages.markup,s.languages.svg=s.languages.markup,s.languages.xml=s.languages.extend("markup",{}),s.languages.ssml=s.languages.xml,s.languages.atom=s.languages.xml,s.languages.rss=s.languages.xml,function(n){var i=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;n.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+i.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\\((?:"+i.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+i.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+i.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:i,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:/[(){};:,]/},n.languages.css.atrule.inside.rest=n.languages.css;var r=n.languages.markup;r&&(r.tag.addInlined("style","css"),r.tag.addAttribute("style","css"))}(s),s.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:/[{}[\];(),.:]/},s.languages.javascript=s.languages.extend("clike",{"class-name":[s.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}|\?\?=?|\?\.?|[~:]/}),s.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,s.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:s.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:s.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:s.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:s.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:s.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),s.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:s.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"}}),s.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),s.languages.markup&&(s.languages.markup.tag.addInlined("script","javascript"),s.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")),s.languages.js=s.languages.javascript,function(){if(typeof s>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var n="Loading…",i=function(C,D){return"✖ Error "+C+" while fetching file: "+D},r="✖ Error: File does not exist or is empty",o={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},l="data-src-status",a="loading",u="loaded",c="failed",f="pre[data-src]:not(["+l+'="'+u+'"]):not(['+l+'="'+a+'"])';function p(C,D,L){var m=new XMLHttpRequest;m.open("GET",C,!0),m.onreadystatechange=function(){m.readyState==4&&(m.status<400&&m.responseText?D(m.responseText):m.status>=400?L(i(m.status,m.statusText)):L(r))},m.send(null)}function g(C){var D=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(C||"");if(D){var L=Number(D[1]),m=D[2],b=D[3];return m?b?[L,Number(b)]:[L,void 0]:[L,L]}}s.hooks.add("before-highlightall",function(C){C.selector+=", "+f}),s.hooks.add("before-sanity-check",function(C){var D=C.element;if(D.matches(f)){C.code="",D.setAttribute(l,a);var L=D.appendChild(document.createElement("CODE"));L.textContent=n;var m=D.getAttribute("data-src"),b=C.language;if(b==="none"){var y=(/\.(\w+)$/.exec(m)||[,"none"])[1];b=o[y]||y}s.util.setLanguage(L,b),s.util.setLanguage(D,b);var E=s.plugins.autoloader;E&&E.loadLanguages(b),p(m,function(O){D.setAttribute(l,u);var F=g(D.getAttribute("data-range"));if(F){var W=O.split(/\r\n?|\n/g),B=F[0],q=F[1]==null?W.length:F[1];B<0&&(B+=W.length),B=Math.max(0,Math.min(B-1,W.length)),q<0&&(q+=W.length),q=Math.max(0,Math.min(q,W.length)),O=W.slice(B,q).join(` -`),D.hasAttribute("data-start")||D.setAttribute("data-start",String(B+1))}L.textContent=O,s.highlightElement(L)},function(O){D.setAttribute(l,c),L.textContent=O})}}),s.plugins.fileHighlight={highlight:function(D){for(var L=(D||document).querySelectorAll(f),m=0,b;b=L[m++];)s.highlightElement(b)}};var T=!1;s.fileHighlight=function(){T||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),T=!0),s.plugins.fileHighlight.highlight.apply(this,arguments)}}()}(Ks)),Ks.exports}var Yc=qc();const Qc=el(Yc);var qs={exports:{}},Ri;function Jc(){return Ri||(Ri=1,function(t){(function(){if(typeof Prism>"u")return;var e=Object.assign||function(o,l){for(var a in l)l.hasOwnProperty(a)&&(o[a]=l[a]);return o};function s(o){this.defaults=e({},o)}function n(o){return o.replace(/-(\w)/g,function(l,a){return a.toUpperCase()})}function i(o){for(var l=0,a=0;a"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(E){var m=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(E.stack)||[])[1];if(m){var v=document.getElementsByTagName("script");for(var y in v)if(v[y].src==m)return v[y]}return null}},isActive:function(m,v,y){for(var E="no-"+v;m;){var L=m.classList;if(L.contains(v))return!0;if(L.contains(E))return!1;m=m.parentElement}return!!y}},languages:{plain:o,plaintext:o,text:o,txt:o,extend:function(m,v){var y=l.util.clone(l.languages[m]);for(var E in v)y[E]=v[E];return y},insertBefore:function(m,v,y,E){E=E||l.languages;var L=E[m],F={};for(var W in L)if(L.hasOwnProperty(W)){if(W==v)for(var H in y)y.hasOwnProperty(H)&&(F[H]=y[H]);y.hasOwnProperty(W)||(F[W]=L[W])}var K=E[m];return E[m]=F,l.languages.DFS(l.languages,function(re,pe){pe===K&&re!=m&&(this[re]=F)}),F},DFS:function m(v,y,E,L){L=L||{};var F=l.util.objId;for(var W in v)if(v.hasOwnProperty(W)){y.call(v,W,v[W],E||W);var H=v[W],K=l.util.type(H);K==="Object"&&!L[F(H)]?(L[F(H)]=!0,m(H,y,null,L)):K==="Array"&&!L[F(H)]&&(L[F(H)]=!0,m(H,y,W,L))}}},plugins:{},highlightAll:function(m,v){l.highlightAllUnder(document,m,v)},highlightAllUnder:function(m,v,y){var E={callback:y,container:m,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};l.hooks.run("before-highlightall",E),E.elements=Array.prototype.slice.apply(E.container.querySelectorAll(E.selector)),l.hooks.run("before-all-elements-highlight",E);for(var L=0,F;F=E.elements[L++];)l.highlightElement(F,v===!0,E.callback)},highlightElement:function(m,v,y){var E=l.util.getLanguage(m),L=l.languages[E];l.util.setLanguage(m,E);var F=m.parentElement;F&&F.nodeName.toLowerCase()==="pre"&&l.util.setLanguage(F,E);var W=m.textContent,H={element:m,language:E,grammar:L,code:W};function K(pe){H.highlightedCode=pe,l.hooks.run("before-insert",H),H.element.innerHTML=H.highlightedCode,l.hooks.run("after-highlight",H),l.hooks.run("complete",H),y&&y.call(H.element)}if(l.hooks.run("before-sanity-check",H),F=H.element.parentElement,F&&F.nodeName.toLowerCase()==="pre"&&!F.hasAttribute("tabindex")&&F.setAttribute("tabindex","0"),!H.code){l.hooks.run("complete",H),y&&y.call(H.element);return}if(l.hooks.run("before-highlight",H),!H.grammar){K(l.util.encode(H.code));return}if(v&&n.Worker){var re=new Worker(l.filename);re.onmessage=function(pe){K(pe.data)},re.postMessage(JSON.stringify({language:H.language,code:H.code,immediateClose:!0}))}else K(l.highlight(H.code,H.grammar,H.language))},highlight:function(m,v,y){var E={code:m,grammar:v,language:y};if(l.hooks.run("before-tokenize",E),!E.grammar)throw new Error('The language "'+E.language+'" has no grammar.');return E.tokens=l.tokenize(E.code,E.grammar),l.hooks.run("after-tokenize",E),a.stringify(l.util.encode(E.tokens),E.language)},tokenize:function(m,v){var y=v.rest;if(y){for(var E in y)v[E]=y[E];delete v.rest}var L=new f;return p(L,L.head,m),c(m,L,v,L.head,0),C(L)},hooks:{all:{},add:function(m,v){var y=l.hooks.all;y[m]=y[m]||[],y[m].push(v)},run:function(m,v){var y=l.hooks.all[m];if(!(!y||!y.length))for(var E=0,L;L=y[E++];)L(v)}},Token:a};n.Prism=l;function a(m,v,y,E){this.type=m,this.content=v,this.alias=y,this.length=(E||"").length|0}a.stringify=function m(v,y){if(typeof v=="string")return v;if(Array.isArray(v)){var E="";return v.forEach(function(K){E+=m(K,y)}),E}var L={type:v.type,content:m(v.content,y),tag:"span",classes:["token",v.type],attributes:{},language:y},F=v.alias;F&&(Array.isArray(F)?Array.prototype.push.apply(L.classes,F):L.classes.push(F)),l.hooks.run("wrap",L);var W="";for(var H in L.attributes)W+=" "+H+'="'+(L.attributes[H]||"").replace(/"/g,""")+'"';return"<"+L.tag+' class="'+L.classes.join(" ")+'"'+W+">"+L.content+""};function u(m,v,y,E){m.lastIndex=v;var L=m.exec(y);if(L&&E&&L[1]){var F=L[1].length;L.index+=F,L[0]=L[0].slice(F)}return L}function c(m,v,y,E,L,F){for(var W in y)if(!(!y.hasOwnProperty(W)||!y[W])){var H=y[W];H=Array.isArray(H)?H:[H];for(var K=0;K=F.reach);ae+=$.value.length,$=$.next){var ye=$.value;if(v.length>m.length)return;if(!(ye instanceof a)){var Ae=1,te;if(ot){if(te=u(Q,ae,m,Le),!te||te.index>=m.length)break;var fe=te.index,ct=te.index+te[0].length,we=ae;for(we+=$.value.length;fe>=we;)$=$.next,we+=$.value.length;if(we-=$.value.length,ae=we,$.value instanceof a)continue;for(var Ve=$;Ve!==v.tail&&(weF.reach&&(F.reach=B);var Y=$.prev;N&&(Y=p(v,Y,N),ae+=N.length),g(v,Y,Ae);var h=new a(W,pe?l.tokenize(A,pe):A,at,A);if($=p(v,Y,h),k&&p(v,$,k),Ae>1){var d={cause:W+","+K,reach:B};c(m,v,y,$.prev,ae,d),F&&d.reach>F.reach&&(F.reach=d.reach)}}}}}}function f(){var m={value:null,prev:null,next:null},v={value:null,prev:m,next:null};m.next=v,this.head=m,this.tail=v,this.length=0}function p(m,v,y){var E=v.next,L={value:y,prev:v,next:E};return v.next=L,E.prev=L,m.length++,L}function g(m,v,y){for(var E=v.next,L=0;L/,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]},s.languages.markup.tag.inside["attr-value"].inside.entity=s.languages.markup.entity,s.languages.markup.doctype.inside["internal-subset"].inside=s.languages.markup,s.hooks.add("wrap",function(n){n.type==="entity"&&(n.attributes.title=n.content.replace(/&/,"&"))}),Object.defineProperty(s.languages.markup.tag,"addInlined",{value:function(i,r){var o={};o["language-"+r]={pattern:/(^$)/i,lookbehind:!0,inside:s.languages[r]},o.cdata=/^$/i;var l={"included-cdata":{pattern://i,inside:o}};l["language-"+r]={pattern:/[\s\S]+/,inside:s.languages[r]};var a={};a[i]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return i}),"i"),lookbehind:!0,greedy:!0,inside:l},s.languages.insertBefore("markup","cdata",a)}}),Object.defineProperty(s.languages.markup.tag,"addAttribute",{value:function(n,i){s.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+n+")"+/\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:[i,"language-"+i],inside:s.languages[i]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),s.languages.html=s.languages.markup,s.languages.mathml=s.languages.markup,s.languages.svg=s.languages.markup,s.languages.xml=s.languages.extend("markup",{}),s.languages.ssml=s.languages.xml,s.languages.atom=s.languages.xml,s.languages.rss=s.languages.xml,function(n){var i=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;n.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+i.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\\((?:"+i.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+i.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+i.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:i,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:/[(){};:,]/},n.languages.css.atrule.inside.rest=n.languages.css;var r=n.languages.markup;r&&(r.tag.addInlined("style","css"),r.tag.addAttribute("style","css"))}(s),s.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:/[{}[\];(),.:]/},s.languages.javascript=s.languages.extend("clike",{"class-name":[s.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}|\?\?=?|\?\.?|[~:]/}),s.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,s.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:s.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:s.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:s.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:s.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:s.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),s.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:s.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"}}),s.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),s.languages.markup&&(s.languages.markup.tag.addInlined("script","javascript"),s.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")),s.languages.js=s.languages.javascript,function(){if(typeof s>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var n="Loading…",i=function(_,D){return"✖ Error "+_+" while fetching file: "+D},r="✖ Error: File does not exist or is empty",o={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},l="data-src-status",a="loading",u="loaded",c="failed",f="pre[data-src]:not(["+l+'="'+u+'"]):not(['+l+'="'+a+'"])';function p(_,D,T){var m=new XMLHttpRequest;m.open("GET",_,!0),m.onreadystatechange=function(){m.readyState==4&&(m.status<400&&m.responseText?D(m.responseText):m.status>=400?T(i(m.status,m.statusText)):T(r))},m.send(null)}function g(_){var D=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(_||"");if(D){var T=Number(D[1]),m=D[2],v=D[3];return m?v?[T,Number(v)]:[T,void 0]:[T,T]}}s.hooks.add("before-highlightall",function(_){_.selector+=", "+f}),s.hooks.add("before-sanity-check",function(_){var D=_.element;if(D.matches(f)){_.code="",D.setAttribute(l,a);var T=D.appendChild(document.createElement("CODE"));T.textContent=n;var m=D.getAttribute("data-src"),v=_.language;if(v==="none"){var y=(/\.(\w+)$/.exec(m)||[,"none"])[1];v=o[y]||y}s.util.setLanguage(T,v),s.util.setLanguage(D,v);var E=s.plugins.autoloader;E&&E.loadLanguages(v),p(m,function(L){D.setAttribute(l,u);var F=g(D.getAttribute("data-range"));if(F){var W=L.split(/\r\n?|\n/g),H=F[0],K=F[1]==null?W.length:F[1];H<0&&(H+=W.length),H=Math.max(0,Math.min(H-1,W.length)),K<0&&(K+=W.length),K=Math.max(0,Math.min(K,W.length)),L=W.slice(H,K).join(` +`),D.hasAttribute("data-start")||D.setAttribute("data-start",String(H+1))}T.textContent=L,s.highlightElement(T)},function(L){D.setAttribute(l,c),T.textContent=L})}}),s.plugins.fileHighlight={highlight:function(D){for(var T=(D||document).querySelectorAll(f),m=0,v;v=T[m++];)s.highlightElement(v)}};var C=!1;s.fileHighlight=function(){C||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),C=!0),s.plugins.fileHighlight.highlight.apply(this,arguments)}}()}(Ks)),Ks.exports}var Qc=Yc();const Jc=sl(Qc);var Ys={exports:{}},ki;function Zc(){return ki||(ki=1,function(t){(function(){if(typeof Prism>"u")return;var e=Object.assign||function(o,l){for(var a in l)l.hasOwnProperty(a)&&(o[a]=l[a]);return o};function s(o){this.defaults=e({},o)}function n(o){return o.replace(/-(\w)/g,function(l,a){return a.toUpperCase()})}function i(o){for(var l=0,a=0;al&&(c[p]=` `+c[p],f=g)}a[u]=c.join("")}return a.join(` -`)}},t.exports&&(t.exports=s),Prism.plugins.NormalizeWhitespace=new s({"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0}),Prism.hooks.add("before-sanity-check",function(o){var l=Prism.plugins.NormalizeWhitespace;if(!(o.settings&&o.settings["whitespace-normalization"]===!1)&&Prism.util.isActive(o.element,"whitespace-normalization",!0)){if((!o.element||!o.element.parentNode)&&o.code){o.code=l.normalize(o.code,o.settings);return}var a=o.element.parentNode;if(!(!o.code||!a||a.nodeName.toLowerCase()!=="pre")){o.settings==null&&(o.settings={});for(var u in r)if(Object.hasOwnProperty.call(r,u)){var c=r[u];if(a.hasAttribute("data-"+u))try{var f=JSON.parse(a.getAttribute("data-"+u)||"true");typeof f===c&&(o.settings[u]=f)}catch{}}for(var p=a.childNodes,g="",T="",C=!1,D=0;D"u"||typeof document>"u")return;var t=[],e={},s=function(){};Prism.plugins.toolbar={};var n=Prism.plugins.toolbar.registerButton=function(o,l){var a;if(typeof l=="function"?a=l:a=function(u){var c;return typeof l.onClick=="function"?(c=document.createElement("button"),c.type="button",c.addEventListener("click",function(){l.onClick.call(this,u)})):typeof l.url=="string"?(c=document.createElement("a"),c.href=l.url):c=document.createElement("span"),l.className&&c.classList.add(l.className),c.textContent=l.text,c},o in e){console.warn('There is a button with the key "'+o+'" registered already.');return}t.push(e[o]=a)};function i(o){for(;o;){var l=o.getAttribute("data-toolbar-order");if(l!=null)return l=l.trim(),l.length?l.split(/\s*,\s*/g):[];o=o.parentElement}}var r=Prism.plugins.toolbar.hook=function(o){var l=o.element.parentNode;if(!(!l||!/pre/i.test(l.nodeName))&&!l.parentNode.classList.contains("code-toolbar")){var a=document.createElement("div");a.classList.add("code-toolbar"),l.parentNode.insertBefore(a,l),a.appendChild(l);var u=document.createElement("div");u.classList.add("toolbar");var c=t,f=i(o.element);f&&(c=f.map(function(p){return e[p]||s})),c.forEach(function(p){var g=p(o);if(g){var T=document.createElement("div");T.classList.add("toolbar-item"),T.appendChild(g),u.appendChild(T)}}),a.appendChild(u)}};n("label",function(o){var l=o.element.parentNode;if(!(!l||!/pre/i.test(l.nodeName))&&l.hasAttribute("data-label")){var a,u,c=l.getAttribute("data-label");try{u=document.querySelector("template#"+c)}catch{}return u?a=u.content:(l.hasAttribute("data-url")?(a=document.createElement("a"),a.href=l.getAttribute("data-url")):a=document.createElement("span"),a.textContent=c),a}}),Prism.hooks.add("complete",r)})();new Xc({"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0});const kn=wa(Kc);kn.use(Tc);kn.mixin({updated(){Qc.highlightAll()}});kn.mount("#app");export{Re as F,ue as O,Mc as S,$c as _,Je as a,Bo as b,Ir as c,Ts as d,hs as e,de as f,el as g,eu as h,Vo as i,sr as j,pr as k,tu as l,mn as n,Jt as o,Vn as r,Hi as t,zl as w}; +`)}},t.exports&&(t.exports=s),Prism.plugins.NormalizeWhitespace=new s({"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0}),Prism.hooks.add("before-sanity-check",function(o){var l=Prism.plugins.NormalizeWhitespace;if(!(o.settings&&o.settings["whitespace-normalization"]===!1)&&Prism.util.isActive(o.element,"whitespace-normalization",!0)){if((!o.element||!o.element.parentNode)&&o.code){o.code=l.normalize(o.code,o.settings);return}var a=o.element.parentNode;if(!(!o.code||!a||a.nodeName.toLowerCase()!=="pre")){o.settings==null&&(o.settings={});for(var u in r)if(Object.hasOwnProperty.call(r,u)){var c=r[u];if(a.hasAttribute("data-"+u))try{var f=JSON.parse(a.getAttribute("data-"+u)||"true");typeof f===c&&(o.settings[u]=f)}catch{}}for(var p=a.childNodes,g="",C="",_=!1,D=0;D"u"||typeof document>"u")return;var t=[],e={},s=function(){};Prism.plugins.toolbar={};var n=Prism.plugins.toolbar.registerButton=function(o,l){var a;if(typeof l=="function"?a=l:a=function(u){var c;return typeof l.onClick=="function"?(c=document.createElement("button"),c.type="button",c.addEventListener("click",function(){l.onClick.call(this,u)})):typeof l.url=="string"?(c=document.createElement("a"),c.href=l.url):c=document.createElement("span"),l.className&&c.classList.add(l.className),c.textContent=l.text,c},o in e){console.warn('There is a button with the key "'+o+'" registered already.');return}t.push(e[o]=a)};function i(o){for(;o;){var l=o.getAttribute("data-toolbar-order");if(l!=null)return l=l.trim(),l.length?l.split(/\s*,\s*/g):[];o=o.parentElement}}var r=Prism.plugins.toolbar.hook=function(o){var l=o.element.parentNode;if(!(!l||!/pre/i.test(l.nodeName))&&!l.parentNode.classList.contains("code-toolbar")){var a=document.createElement("div");a.classList.add("code-toolbar"),l.parentNode.insertBefore(a,l),a.appendChild(l);var u=document.createElement("div");u.classList.add("toolbar");var c=t,f=i(o.element);f&&(c=f.map(function(p){return e[p]||s})),c.forEach(function(p){var g=p(o);if(g){var C=document.createElement("div");C.classList.add("toolbar-item"),C.appendChild(g),u.appendChild(C)}}),a.appendChild(u)}};n("label",function(o){var l=o.element.parentNode;if(!(!l||!/pre/i.test(l.nodeName))&&l.hasAttribute("data-label")){var a,u,c=l.getAttribute("data-label");try{u=document.querySelector("template#"+c)}catch{}return u?a=u.content:(l.hasAttribute("data-url")?(a=document.createElement("a"),a.href=l.getAttribute("data-url")):a=document.createElement("span"),a.textContent=c),a}}),Prism.hooks.add("complete",r)})();new eu({"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0});const In=xa(Kc);In.use(Pc);In.mixin({updated(){Jc.highlightAll()}});In.mount("#app");export{Re as F,ue as O,Nc as S,zc as _,Ze as a,Uo as b,Nr as c,Ts as d,ds as e,de as f,sl as g,tu as h,$o as i,ir as j,mr as k,su as l,bn as n,Zt as o,$n as r,Vi as t,Gl as w}; From 6e5a5d362fe738494a99a83e3c43266e730d855f Mon Sep 17 00:00:00 2001 From: Tiberiu Dumitru Date: Tue, 12 Aug 2025 17:59:23 +0300 Subject: [PATCH 3/8] Set size aria. --- dist/slimselect.cjs.js | 10 +++++++--- dist/slimselect.css | 2 +- dist/slimselect.css.map | 2 +- dist/slimselect.es.js | 10 +++++++--- dist/slimselect.global.js | 10 +++++++--- dist/slimselect.js | 10 +++++++--- dist/slimselect.min.js | 2 +- dist/slimselect.umd.js | 10 +++++++--- dist/slimselect.umd.min.js | 2 +- docs/assets/index.css | 2 +- docs/assets/index.js | 14 +++++++------- src/docs/assets/scss/misc.scss | 2 +- src/slim-select/render.test.ts | 14 +++++++++----- src/slim-select/render.ts | 15 +++++++++++---- src/slim-select/slimselect.scss | 12 ++++++++++++ 15 files changed, 80 insertions(+), 37 deletions(-) diff --git a/dist/slimselect.cjs.js b/dist/slimselect.cjs.js index 69740cc6..01390f76 100644 --- a/dist/slimselect.cjs.js +++ b/dist/slimselect.cjs.js @@ -373,7 +373,7 @@ class Render { el.setAttribute('role', 'status'); el.setAttribute('aria-live', 'assertive'); el.setAttribute('aria-atomic', 'true'); - el.className = 'sr-only'; + el.className = 'ss-sr-only'; document.body.appendChild(el); } return el; @@ -411,7 +411,7 @@ class Render { el.setAttribute('role', 'status'); el.setAttribute('aria-live', 'polite'); el.setAttribute('aria-atomic', 'true'); - el.className = 'sr-only'; + el.className = 'ss-sr-only'; document.body.appendChild(el); } return el; @@ -1152,11 +1152,16 @@ class Render { } const fragment = document.createDocumentFragment(); let count = 0; + const totalOptions = data.filter((d) => d instanceof Option && + !d.placeholder && + d.display && + !d.disabled).length; const tagPos = (el) => { if (!el.classList.contains(this.classes.placeholder) && !el.classList.contains(this.classes.disabled) && !el.classList.contains(this.classes.hide)) { el.setAttribute('aria-posinset', String(++count)); + el.setAttribute('aria-setsize', String(totalOptions)); } }; for (const d of data) { @@ -1287,7 +1292,6 @@ class Render { this.content.list.appendChild(fragment); this.content.list.removeAttribute('aria-busy'); const visibleCount = this.getOptions(true, true, true).length; - this.content.list.setAttribute('aria-setsize', String(visibleCount)); this._announcePolite(`${visibleCount} option${visibleCount === 1 ? '' : 's'} available`); } option(option) { diff --git a/dist/slimselect.css b/dist/slimselect.css index 2bf6e26c..f9e85b9f 100644 --- a/dist/slimselect.css +++ b/dist/slimselect.css @@ -1 +1 @@ -:root{--ss-primary-color: #5897fb;--ss-bg-color: #ffffff;--ss-font-color: #4d4d4d;--ss-font-placeholder-color: #8d8d8d;--ss-disabled-color: #dcdee2;--ss-border-color: #dcdee2;--ss-highlight-color: #fffb8c;--ss-success-color: #00b755;--ss-error-color: #dc3545;--ss-focus-color: #5897fb;--ss-main-height: 30px;--ss-content-height: 300px;--ss-spacing-l: 7px;--ss-spacing-m: 5px;--ss-spacing-s: 3px;--ss-animation-timing: 0.2s;--ss-border-radius: 4px}@keyframes ss-valueIn{0%{transform:scale(0);opacity:0}100%{transform:scale(1);opacity:1}}@keyframes ss-valueOut{0%{transform:scale(1);opacity:1}100%{transform:scale(0);opacity:0}}.ss-hide{display:none !important}.ss-main.ss-2{display:flex;flex-direction:row;position:relative;user-select:none;color:var(--ss-font-color);min-height:var(--ss-main-height);width:100%;padding:var(--ss-spacing-s);cursor:pointer;border:1px solid var(--ss-border-color);border-radius:var(--ss-border-radius);background-color:var(--ss-bg-color);outline:0;box-sizing:border-box;transition:background-color var(--ss-animation-timing);overflow:hidden}.ss-main.ss-2:focus{box-shadow:0 0 5px var(--ss-focus-color)}.ss-main.ss-2.ss-disabled{background-color:var(--ss-disabled-color);cursor:not-allowed}.ss-main.ss-2.ss-disabled .ss-values .ss-disabled{color:var(--ss-font-color)}.ss-main.ss-2.ss-disabled .ss-values .ss-value .ss-value-delete{cursor:not-allowed}.ss-main.ss-2.ss-open-above{border-top-left-radius:0px;border-top-right-radius:0px}.ss-main.ss-2.ss-open-below{border-bottom-left-radius:0px;border-bottom-right-radius:0px}.ss-main.ss-2 .ss-values{display:inline-flex;flex-wrap:wrap;gap:var(--ss-spacing-m);flex:1 1 100%}.ss-main.ss-2 .ss-values .ss-placeholder{display:flex;padding:var(--ss-spacing-s) var(--ss-spacing-m) var(--ss-spacing-s) var(--ss-spacing-m);margin:auto 0px auto 0px;line-height:1em;align-items:center;width:100%;color:var(--ss-font-placeholder-color);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ss-main.ss-2 .ss-values .ss-max{display:flex;user-select:none;align-items:center;width:fit-content;font-size:12px;color:var(--ss-bg-color);line-height:1;padding:var(--ss-spacing-s) var(--ss-spacing-m);background-color:var(--ss-primary-color);border-radius:var(--ss-border-radius)}.ss-main.ss-2 .ss-values .ss-single{display:flex;margin:auto 0px auto var(--ss-spacing-s)}.ss-main.ss-2 .ss-values .ss-value{display:flex;user-select:none;align-items:center;width:fit-content;background-color:var(--ss-primary-color);border-radius:var(--ss-border-radius);animation-name:ss-valueIn;animation-duration:var(--ss-animation-timing);animation-timing-function:ease-out;animation-fill-mode:both}.ss-main.ss-2 .ss-values .ss-value.ss-value-out{animation-name:ss-valueOut;animation-duration:var(--ss-animation-timing);animation-timing-function:ease-out}.ss-main.ss-2 .ss-values .ss-value .ss-value-text{font-size:12px;color:var(--ss-bg-color);line-height:1;padding:var(--ss-spacing-s) var(--ss-spacing-m)}.ss-main.ss-2 .ss-values .ss-value .ss-value-delete{display:flex;align-items:center;height:var(--ss-spacing-l);width:var(--ss-spacing-l);padding:var(--ss-spacing-s) var(--ss-spacing-m);cursor:pointer;border-left:solid 1px var(--ss-bg-color);box-sizing:content-box}.ss-main.ss-2 .ss-values .ss-value .ss-value-delete svg{height:var(--ss-spacing-l);width:var(--ss-spacing-l)}.ss-main.ss-2 .ss-values .ss-value .ss-value-delete svg path{fill:none;stroke:var(--ss-bg-color);stroke-width:18;stroke-linecap:round;stroke-linejoin:round}.ss-main.ss-2 .ss-deselect{flex:0 1 auto;display:flex;align-items:center;justify-content:center;width:fit-content;height:auto;padding:0 var(--ss-spacing-m) 0 var(--ss-spacing-m)}.ss-main.ss-2 .ss-deselect svg{width:8px;height:8px}.ss-main.ss-2 .ss-deselect svg path{fill:none;stroke:var(--ss-font-color);stroke-width:20;stroke-linecap:round;stroke-linejoin:round}.ss-main.ss-2 .ss-arrow{flex:0 1 auto;display:flex;align-items:center;justify-content:flex-end;width:12px;height:12px;margin:auto var(--ss-spacing-m) auto var(--ss-spacing-m)}.ss-main.ss-2 .ss-arrow path{fill:none;stroke:var(--ss-font-color);stroke-width:18;stroke-linecap:round;stroke-linejoin:round;transition-timing-function:ease-out;transition:var(--ss-animation-timing)}.ss-content{position:absolute;display:flex;height:auto;flex-direction:column;width:auto;max-height:var(--ss-content-height);box-sizing:border-box;border:solid 1px var(--ss-border-color);background-color:var(--ss-bg-color);transition:transform var(--ss-animation-timing),opacity var(--ss-animation-timing);opacity:0;transform:scaleY(0);transform-origin:center top;overflow:hidden;z-index:10000}.ss-content.ss-relative{position:relative;height:100%}.ss-content.ss-fixed{position:fixed}.ss-content.ss-open-above{flex-direction:column-reverse;opacity:1;transform:scaleY(1);transform-origin:center bottom;border-top-left-radius:var(--ss-border-radius);border-top-right-radius:var(--ss-border-radius)}.ss-content.ss-open-below{opacity:1;transform:scaleY(1);transform-origin:center top;border-bottom-left-radius:var(--ss-border-radius);border-bottom-right-radius:var(--ss-border-radius)}.ss-content .ss-search{flex:0 1 auto;display:flex;flex-direction:row;padding:var(--ss-spacing-l) var(--ss-spacing-l) var(--ss-spacing-m) var(--ss-spacing-l)}.ss-content .ss-search input{display:inline-flex;font-size:inherit;line-height:inherit;flex:1 1 auto;width:100%;min-width:0px;padding:var(--ss-spacing-m) var(--ss-spacing-l);margin:0;border:1px solid var(--ss-border-color);border-radius:var(--ss-border-radius);background-color:var(--ss-bg-color);outline:0;text-align:left;box-sizing:border-box}.ss-content .ss-search input::placeholder{color:var(--ss-font-placeholder-color);vertical-align:middle}.ss-content .ss-search input:focus{box-shadow:0 0 5px var(--ss-focus-color)}.ss-content .ss-search .ss-addable{display:inline-flex;justify-content:center;align-items:center;cursor:pointer;flex:0 0 auto;height:auto;margin:0 0 0 var(--ss-spacing-m);border:1px solid var(--ss-border-color);border-radius:var(--ss-border-radius)}.ss-content .ss-search .ss-addable svg{display:flex;align-items:center;justify-content:flex-end;flex:0 1 auto;width:12px;height:12px;margin:auto var(--ss-spacing-m) auto var(--ss-spacing-m)}.ss-content .ss-search .ss-addable svg path{fill:none;stroke:var(--ss-font-color);stroke-width:18;stroke-linecap:round;stroke-linejoin:round}.ss-content .ss-list{flex:1 1 auto;height:auto;overflow-x:hidden;overflow-y:auto}.ss-content .ss-list .ss-error{color:var(--ss-error-color);padding:var(--ss-spacing-l)}.ss-content .ss-list .ss-searching{color:var(--ss-font-color);padding:var(--ss-spacing-l)}.ss-content .ss-list .ss-optgroup.ss-close .ss-option{display:none !important}.ss-content .ss-list .ss-optgroup .ss-optgroup-label{display:flex;flex-direction:row;align-items:center;justify-content:space-between;padding:var(--ss-spacing-m) var(--ss-spacing-l) var(--ss-spacing-m) var(--ss-spacing-l)}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-label-text{flex:1 1 auto;font-weight:bold;color:var(--ss-font-color)}.ss-content .ss-list .ss-optgroup .ss-optgroup-label:has(.ss-arrow){cursor:pointer}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions{flex:0 1 auto;display:flex;flex-direction:row;align-items:center;justify-content:center;gap:var(--ss-spacing-m)}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall{flex:0 0 auto;display:flex;flex-direction:row;cursor:pointer}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall:hover{opacity:.5}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall.ss-selected svg path{stroke:var(--ss-error-color)}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall span{flex:0 1 auto;display:flex;align-items:center;justify-content:center;font-size:60%;text-align:center;padding:0 var(--ss-spacing-s) 0 0}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall svg{flex:0 1 auto;width:13px;height:13px}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall svg path{fill:none;stroke:var(--ss-success-color);stroke-linecap:round;stroke-linejoin:round}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall svg:first-child{stroke-width:5}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall svg:last-child{stroke-width:11}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-closable{flex:0 1 auto;display:flex;flex-direction:row;cursor:pointer}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-closable .ss-arrow{flex:1 1 auto;width:10px;height:10px}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-closable .ss-arrow path{fill:none;stroke:var(--ss-font-color);stroke-width:18;stroke-linecap:round;stroke-linejoin:round;transition-timing-function:ease-out;transition:var(--ss-animation-timing)}.ss-content .ss-list .ss-optgroup .ss-option{padding:var(--ss-spacing-s) var(--ss-spacing-s) var(--ss-spacing-s) calc(var(--ss-spacing-l)*3)}.ss-content .ss-list .ss-option{display:block;padding:var(--ss-spacing-m) var(--ss-spacing-l) var(--ss-spacing-m) var(--ss-spacing-l);white-space:normal;color:var(--ss-font-color);cursor:pointer;user-select:none}.ss-content .ss-list .ss-option:hover{color:var(--ss-bg-color);background-color:var(--ss-primary-color)}.ss-content .ss-list .ss-option.ss-highlighted,.ss-content .ss-list .ss-option:not(.ss-disabled).ss-selected{color:var(--ss-bg-color);background-color:var(--ss-primary-color)}.ss-content .ss-list .ss-option.ss-disabled{cursor:not-allowed;background-color:var(--ss-disabled-color)}.ss-content .ss-list .ss-option.ss-disabled:hover{color:var(--ss-font-color)}.ss-content .ss-list .ss-option .ss-search-highlight{display:inline-block;background-color:var(--ss-highlight-color)}/*# sourceMappingURL=slimselect.css.map */ +:root{--ss-primary-color: #5897fb;--ss-bg-color: #ffffff;--ss-font-color: #4d4d4d;--ss-font-placeholder-color: #8d8d8d;--ss-disabled-color: #dcdee2;--ss-border-color: #dcdee2;--ss-highlight-color: #fffb8c;--ss-success-color: #00b755;--ss-error-color: #dc3545;--ss-focus-color: #5897fb;--ss-main-height: 30px;--ss-content-height: 300px;--ss-spacing-l: 7px;--ss-spacing-m: 5px;--ss-spacing-s: 3px;--ss-animation-timing: 0.2s;--ss-border-radius: 4px}@keyframes ss-valueIn{0%{transform:scale(0);opacity:0}100%{transform:scale(1);opacity:1}}@keyframes ss-valueOut{0%{transform:scale(1);opacity:1}100%{transform:scale(0);opacity:0}}.ss-hide{display:none !important}.ss-main.ss-2{display:flex;flex-direction:row;position:relative;user-select:none;color:var(--ss-font-color);min-height:var(--ss-main-height);width:100%;padding:var(--ss-spacing-s);cursor:pointer;border:1px solid var(--ss-border-color);border-radius:var(--ss-border-radius);background-color:var(--ss-bg-color);outline:0;box-sizing:border-box;transition:background-color var(--ss-animation-timing);overflow:hidden}.ss-main.ss-2:focus{box-shadow:0 0 5px var(--ss-focus-color)}.ss-main.ss-2.ss-disabled{background-color:var(--ss-disabled-color);cursor:not-allowed}.ss-main.ss-2.ss-disabled .ss-values .ss-disabled{color:var(--ss-font-color)}.ss-main.ss-2.ss-disabled .ss-values .ss-value .ss-value-delete{cursor:not-allowed}.ss-main.ss-2.ss-open-above{border-top-left-radius:0px;border-top-right-radius:0px}.ss-main.ss-2.ss-open-below{border-bottom-left-radius:0px;border-bottom-right-radius:0px}.ss-main.ss-2 .ss-values{display:inline-flex;flex-wrap:wrap;gap:var(--ss-spacing-m);flex:1 1 100%}.ss-main.ss-2 .ss-values .ss-placeholder{display:flex;padding:var(--ss-spacing-s) var(--ss-spacing-m) var(--ss-spacing-s) var(--ss-spacing-m);margin:auto 0px auto 0px;line-height:1em;align-items:center;width:100%;color:var(--ss-font-placeholder-color);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ss-main.ss-2 .ss-values .ss-max{display:flex;user-select:none;align-items:center;width:fit-content;font-size:12px;color:var(--ss-bg-color);line-height:1;padding:var(--ss-spacing-s) var(--ss-spacing-m);background-color:var(--ss-primary-color);border-radius:var(--ss-border-radius)}.ss-main.ss-2 .ss-values .ss-single{display:flex;margin:auto 0px auto var(--ss-spacing-s)}.ss-main.ss-2 .ss-values .ss-value{display:flex;user-select:none;align-items:center;width:fit-content;background-color:var(--ss-primary-color);border-radius:var(--ss-border-radius);animation-name:ss-valueIn;animation-duration:var(--ss-animation-timing);animation-timing-function:ease-out;animation-fill-mode:both}.ss-main.ss-2 .ss-values .ss-value.ss-value-out{animation-name:ss-valueOut;animation-duration:var(--ss-animation-timing);animation-timing-function:ease-out}.ss-main.ss-2 .ss-values .ss-value .ss-value-text{font-size:12px;color:var(--ss-bg-color);line-height:1;padding:var(--ss-spacing-s) var(--ss-spacing-m)}.ss-main.ss-2 .ss-values .ss-value .ss-value-delete{display:flex;align-items:center;height:var(--ss-spacing-l);width:var(--ss-spacing-l);padding:var(--ss-spacing-s) var(--ss-spacing-m);cursor:pointer;border-left:solid 1px var(--ss-bg-color);box-sizing:content-box}.ss-main.ss-2 .ss-values .ss-value .ss-value-delete svg{height:var(--ss-spacing-l);width:var(--ss-spacing-l)}.ss-main.ss-2 .ss-values .ss-value .ss-value-delete svg path{fill:none;stroke:var(--ss-bg-color);stroke-width:18;stroke-linecap:round;stroke-linejoin:round}.ss-main.ss-2 .ss-deselect{flex:0 1 auto;display:flex;align-items:center;justify-content:center;width:fit-content;height:auto;padding:0 var(--ss-spacing-m) 0 var(--ss-spacing-m)}.ss-main.ss-2 .ss-deselect svg{width:8px;height:8px}.ss-main.ss-2 .ss-deselect svg path{fill:none;stroke:var(--ss-font-color);stroke-width:20;stroke-linecap:round;stroke-linejoin:round}.ss-main.ss-2 .ss-arrow{flex:0 1 auto;display:flex;align-items:center;justify-content:flex-end;width:12px;height:12px;margin:auto var(--ss-spacing-m) auto var(--ss-spacing-m)}.ss-main.ss-2 .ss-arrow path{fill:none;stroke:var(--ss-font-color);stroke-width:18;stroke-linecap:round;stroke-linejoin:round;transition-timing-function:ease-out;transition:var(--ss-animation-timing)}.ss-content{position:absolute;display:flex;height:auto;flex-direction:column;width:auto;max-height:var(--ss-content-height);box-sizing:border-box;border:solid 1px var(--ss-border-color);background-color:var(--ss-bg-color);transition:transform var(--ss-animation-timing),opacity var(--ss-animation-timing);opacity:0;transform:scaleY(0);transform-origin:center top;overflow:hidden;z-index:10000}.ss-content.ss-relative{position:relative;height:100%}.ss-content.ss-fixed{position:fixed}.ss-content.ss-open-above{flex-direction:column-reverse;opacity:1;transform:scaleY(1);transform-origin:center bottom;border-top-left-radius:var(--ss-border-radius);border-top-right-radius:var(--ss-border-radius)}.ss-content.ss-open-below{opacity:1;transform:scaleY(1);transform-origin:center top;border-bottom-left-radius:var(--ss-border-radius);border-bottom-right-radius:var(--ss-border-radius)}.ss-content .ss-search{flex:0 1 auto;display:flex;flex-direction:row;padding:var(--ss-spacing-l) var(--ss-spacing-l) var(--ss-spacing-m) var(--ss-spacing-l)}.ss-content .ss-search input{display:inline-flex;font-size:inherit;line-height:inherit;flex:1 1 auto;width:100%;min-width:0px;padding:var(--ss-spacing-m) var(--ss-spacing-l);margin:0;border:1px solid var(--ss-border-color);border-radius:var(--ss-border-radius);background-color:var(--ss-bg-color);outline:0;text-align:left;box-sizing:border-box}.ss-content .ss-search input::placeholder{color:var(--ss-font-placeholder-color);vertical-align:middle}.ss-content .ss-search input:focus{box-shadow:0 0 5px var(--ss-focus-color)}.ss-content .ss-search .ss-addable{display:inline-flex;justify-content:center;align-items:center;cursor:pointer;flex:0 0 auto;height:auto;margin:0 0 0 var(--ss-spacing-m);border:1px solid var(--ss-border-color);border-radius:var(--ss-border-radius)}.ss-content .ss-search .ss-addable svg{display:flex;align-items:center;justify-content:flex-end;flex:0 1 auto;width:12px;height:12px;margin:auto var(--ss-spacing-m) auto var(--ss-spacing-m)}.ss-content .ss-search .ss-addable svg path{fill:none;stroke:var(--ss-font-color);stroke-width:18;stroke-linecap:round;stroke-linejoin:round}.ss-content .ss-list{flex:1 1 auto;height:auto;overflow-x:hidden;overflow-y:auto}.ss-content .ss-list .ss-error{color:var(--ss-error-color);padding:var(--ss-spacing-l)}.ss-content .ss-list .ss-searching{color:var(--ss-font-color);padding:var(--ss-spacing-l)}.ss-content .ss-list .ss-optgroup.ss-close .ss-option{display:none !important}.ss-content .ss-list .ss-optgroup .ss-optgroup-label{display:flex;flex-direction:row;align-items:center;justify-content:space-between;padding:var(--ss-spacing-m) var(--ss-spacing-l) var(--ss-spacing-m) var(--ss-spacing-l)}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-label-text{flex:1 1 auto;font-weight:bold;color:var(--ss-font-color)}.ss-content .ss-list .ss-optgroup .ss-optgroup-label:has(.ss-arrow){cursor:pointer}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions{flex:0 1 auto;display:flex;flex-direction:row;align-items:center;justify-content:center;gap:var(--ss-spacing-m)}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall{flex:0 0 auto;display:flex;flex-direction:row;cursor:pointer}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall:hover{opacity:.5}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall.ss-selected svg path{stroke:var(--ss-error-color)}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall span{flex:0 1 auto;display:flex;align-items:center;justify-content:center;font-size:60%;text-align:center;padding:0 var(--ss-spacing-s) 0 0}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall svg{flex:0 1 auto;width:13px;height:13px}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall svg path{fill:none;stroke:var(--ss-success-color);stroke-linecap:round;stroke-linejoin:round}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall svg:first-child{stroke-width:5}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall svg:last-child{stroke-width:11}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-closable{flex:0 1 auto;display:flex;flex-direction:row;cursor:pointer}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-closable .ss-arrow{flex:1 1 auto;width:10px;height:10px}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-closable .ss-arrow path{fill:none;stroke:var(--ss-font-color);stroke-width:18;stroke-linecap:round;stroke-linejoin:round;transition-timing-function:ease-out;transition:var(--ss-animation-timing)}.ss-content .ss-list .ss-optgroup .ss-option{padding:var(--ss-spacing-s) var(--ss-spacing-s) var(--ss-spacing-s) calc(var(--ss-spacing-l)*3)}.ss-content .ss-list .ss-option{display:block;padding:var(--ss-spacing-m) var(--ss-spacing-l) var(--ss-spacing-m) var(--ss-spacing-l);white-space:normal;color:var(--ss-font-color);cursor:pointer;user-select:none}.ss-content .ss-list .ss-option:hover{color:var(--ss-bg-color);background-color:var(--ss-primary-color)}.ss-content .ss-list .ss-option.ss-highlighted,.ss-content .ss-list .ss-option:not(.ss-disabled).ss-selected{color:var(--ss-bg-color);background-color:var(--ss-primary-color)}.ss-content .ss-list .ss-option.ss-disabled{cursor:not-allowed;background-color:var(--ss-disabled-color)}.ss-content .ss-list .ss-option.ss-disabled:hover{color:var(--ss-font-color)}.ss-content .ss-list .ss-option .ss-search-highlight{display:inline-block;background-color:var(--ss-highlight-color)}.ss-sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;clip:rect(0, 0, 0, 0);clip-path:inset(50%);overflow:hidden}/*# sourceMappingURL=slimselect.css.map */ diff --git a/dist/slimselect.css.map b/dist/slimselect.css.map index 36c36e43..bc977452 100644 --- a/dist/slimselect.css.map +++ b/dist/slimselect.css.map @@ -1 +1 @@ -{"version":3,"sourceRoot":"","sources":["../src/slim-select/slimselect.scss"],"names":[],"mappings":"AAAA,MAEE,4BACA,uBACA,yBACA,qCACA,6BACA,2BACA,8BACA,4BACA,0BACA,0BAGA,uBACA,2BAGA,oBACA,oBACA,oBAGA,4BACA,wBAIF,sBACE,GACE,mBACA,UAEF,KACE,mBACA,WAGJ,uBACE,GACE,mBACA,UAEF,KACE,mBACA,WAKJ,SACE,wBAIF,cACE,aACA,mBACA,kBACA,iBACA,2BACA,iCACA,WACA,4BACA,eACA,wCACA,sCACA,oCACA,UACA,sBACA,uDACA,gBAEA,oBACE,yCAGF,0BACE,0CACA,mBAGE,kDACE,2BAIA,gEACE,mBAMR,4BACE,2BACA,4BAEF,4BACE,8BACA,+BAGF,yBACE,oBACA,eACA,wBACA,cAEA,yCACE,aACA,wFACA,yBACA,gBACA,mBACA,WACA,uCACA,gBACA,uBACA,mBAIF,iCACE,aACA,iBACA,mBACA,kBACA,eACA,yBACA,cACA,gDACA,yCACA,sCAIF,oCACE,aACA,yCAIF,mCACE,aACA,iBACA,mBACA,kBACA,yCACA,sCACA,0BACA,8CACA,mCACA,yBAEA,gDACE,2BACA,8CACA,mCAGF,kDACE,eACA,yBACA,cACA,gDAGF,oDACE,aACA,mBACA,2BACA,0BACA,gDACA,eACA,yCACA,uBAEA,wDACE,2BACA,0BAEA,6DACE,UACA,0BACA,gBACA,qBACA,sBAOV,2BACE,cACA,aACA,mBACA,uBACA,kBACA,YACA,oDAEA,+BACE,UACA,WAEA,oCACE,UACA,4BACA,gBACA,qBACA,sBAKN,wBACE,cACA,aACA,mBACA,yBACA,WACA,YACA,yDAEA,6BACE,UACA,4BACA,gBACA,qBACA,sBACA,oCACA,sCAMN,YACE,kBACA,aACA,YACA,sBACA,WACA,oCACA,sBACA,wCACA,oCACA,WACE,wEAEF,UACA,oBACA,4BACA,gBACA,cAEA,wBACE,kBACA,YAGF,qBACE,eAGF,0BACE,8BACA,UACA,oBACA,+BACA,+CACA,gDAGF,0BACE,UACA,oBACA,4BACA,kDACA,mDAGF,uBACE,cACA,aACA,mBACA,wFAEA,6BACE,oBACA,kBACA,oBACA,cACA,WACA,cACA,gDACA,SACA,wCACA,sCACA,oCACA,UACA,gBACA,sBAEA,0CACE,uCACA,sBAGF,mCACE,yCAIJ,mCACE,oBACA,uBACA,mBACA,eACA,cACA,YACA,iCACA,wCACA,sCAEA,uCACE,aACA,mBACA,yBACA,cACA,WACA,YACA,yDAEA,4CACE,UACA,4BACA,gBACA,qBACA,sBAMR,qBACE,cACA,YACA,kBACA,gBAEA,+BACE,4BACA,4BAGF,mCACE,2BACA,4BAME,sDACE,wBAIJ,qDACE,aACA,mBACA,mBACA,8BACA,wFAEA,6EACE,cACA,iBACA,2BAIF,oEACE,eAGF,0EACE,cACA,aACA,mBACA,mBACA,uBACA,wBAEA,wFACE,cACA,aACA,mBACA,eAEA,8FACE,WAKE,6GACE,6BAKN,6FACE,cACA,aACA,mBACA,uBACA,cACA,kBACA,kCAGF,4FACE,cACA,WACA,YAEA,iGACE,UACA,+BACA,qBACA,sBAGF,wGACE,eAEF,uGACE,gBAKN,uFACE,cACA,aACA,mBACA,eAEA,iGACE,cACA,WACA,YAEA,sGACE,UACA,4BACA,gBACA,qBACA,sBACA,oCACA,sCAOV,6CACE,gGAIJ,gCACE,cACA,wFACA,mBACA,2BACA,eACA,iBAEA,sCACE,yBACA,yCAGF,6GAEE,yBACA,yCAGF,4CACE,mBACA,0CAEA,kDACE,2BAKJ,qDACE,qBACA","file":"slimselect.css"} \ No newline at end of file +{"version":3,"sourceRoot":"","sources":["../src/slim-select/slimselect.scss"],"names":[],"mappings":"AAAA,MAEE,4BACA,uBACA,yBACA,qCACA,6BACA,2BACA,8BACA,4BACA,0BACA,0BAGA,uBACA,2BAGA,oBACA,oBACA,oBAGA,4BACA,wBAIF,sBACE,GACE,mBACA,UAEF,KACE,mBACA,WAGJ,uBACE,GACE,mBACA,UAEF,KACE,mBACA,WAKJ,SACE,wBAIF,cACE,aACA,mBACA,kBACA,iBACA,2BACA,iCACA,WACA,4BACA,eACA,wCACA,sCACA,oCACA,UACA,sBACA,uDACA,gBAEA,oBACE,yCAGF,0BACE,0CACA,mBAGE,kDACE,2BAIA,gEACE,mBAMR,4BACE,2BACA,4BAEF,4BACE,8BACA,+BAGF,yBACE,oBACA,eACA,wBACA,cAEA,yCACE,aACA,wFACA,yBACA,gBACA,mBACA,WACA,uCACA,gBACA,uBACA,mBAIF,iCACE,aACA,iBACA,mBACA,kBACA,eACA,yBACA,cACA,gDACA,yCACA,sCAIF,oCACE,aACA,yCAIF,mCACE,aACA,iBACA,mBACA,kBACA,yCACA,sCACA,0BACA,8CACA,mCACA,yBAEA,gDACE,2BACA,8CACA,mCAGF,kDACE,eACA,yBACA,cACA,gDAGF,oDACE,aACA,mBACA,2BACA,0BACA,gDACA,eACA,yCACA,uBAEA,wDACE,2BACA,0BAEA,6DACE,UACA,0BACA,gBACA,qBACA,sBAOV,2BACE,cACA,aACA,mBACA,uBACA,kBACA,YACA,oDAEA,+BACE,UACA,WAEA,oCACE,UACA,4BACA,gBACA,qBACA,sBAKN,wBACE,cACA,aACA,mBACA,yBACA,WACA,YACA,yDAEA,6BACE,UACA,4BACA,gBACA,qBACA,sBACA,oCACA,sCAMN,YACE,kBACA,aACA,YACA,sBACA,WACA,oCACA,sBACA,wCACA,oCACA,WACE,wEAEF,UACA,oBACA,4BACA,gBACA,cAEA,wBACE,kBACA,YAGF,qBACE,eAGF,0BACE,8BACA,UACA,oBACA,+BACA,+CACA,gDAGF,0BACE,UACA,oBACA,4BACA,kDACA,mDAGF,uBACE,cACA,aACA,mBACA,wFAEA,6BACE,oBACA,kBACA,oBACA,cACA,WACA,cACA,gDACA,SACA,wCACA,sCACA,oCACA,UACA,gBACA,sBAEA,0CACE,uCACA,sBAGF,mCACE,yCAIJ,mCACE,oBACA,uBACA,mBACA,eACA,cACA,YACA,iCACA,wCACA,sCAEA,uCACE,aACA,mBACA,yBACA,cACA,WACA,YACA,yDAEA,4CACE,UACA,4BACA,gBACA,qBACA,sBAMR,qBACE,cACA,YACA,kBACA,gBAEA,+BACE,4BACA,4BAGF,mCACE,2BACA,4BAME,sDACE,wBAIJ,qDACE,aACA,mBACA,mBACA,8BACA,wFAEA,6EACE,cACA,iBACA,2BAIF,oEACE,eAGF,0EACE,cACA,aACA,mBACA,mBACA,uBACA,wBAEA,wFACE,cACA,aACA,mBACA,eAEA,8FACE,WAKE,6GACE,6BAKN,6FACE,cACA,aACA,mBACA,uBACA,cACA,kBACA,kCAGF,4FACE,cACA,WACA,YAEA,iGACE,UACA,+BACA,qBACA,sBAGF,wGACE,eAEF,uGACE,gBAKN,uFACE,cACA,aACA,mBACA,eAEA,iGACE,cACA,WACA,YAEA,sGACE,UACA,4BACA,gBACA,qBACA,sBACA,oCACA,sCAOV,6CACE,gGAIJ,gCACE,cACA,wFACA,mBACA,2BACA,eACA,iBAEA,sCACE,yBACA,yCAGF,6GAEE,yBACA,yCAGF,4CACE,mBACA,0CAEA,kDACE,2BAKJ,qDACE,qBACA,2CAMR,YACE,kBACA,UACA,WACA,YACA,UACA,SACA,sBACA,qBACA","file":"slimselect.css"} \ No newline at end of file diff --git a/dist/slimselect.es.js b/dist/slimselect.es.js index 4e4a9bec..5bef1ab5 100644 --- a/dist/slimselect.es.js +++ b/dist/slimselect.es.js @@ -371,7 +371,7 @@ class Render { el.setAttribute('role', 'status'); el.setAttribute('aria-live', 'assertive'); el.setAttribute('aria-atomic', 'true'); - el.className = 'sr-only'; + el.className = 'ss-sr-only'; document.body.appendChild(el); } return el; @@ -409,7 +409,7 @@ class Render { el.setAttribute('role', 'status'); el.setAttribute('aria-live', 'polite'); el.setAttribute('aria-atomic', 'true'); - el.className = 'sr-only'; + el.className = 'ss-sr-only'; document.body.appendChild(el); } return el; @@ -1150,11 +1150,16 @@ class Render { } const fragment = document.createDocumentFragment(); let count = 0; + const totalOptions = data.filter((d) => d instanceof Option && + !d.placeholder && + d.display && + !d.disabled).length; const tagPos = (el) => { if (!el.classList.contains(this.classes.placeholder) && !el.classList.contains(this.classes.disabled) && !el.classList.contains(this.classes.hide)) { el.setAttribute('aria-posinset', String(++count)); + el.setAttribute('aria-setsize', String(totalOptions)); } }; for (const d of data) { @@ -1285,7 +1290,6 @@ class Render { this.content.list.appendChild(fragment); this.content.list.removeAttribute('aria-busy'); const visibleCount = this.getOptions(true, true, true).length; - this.content.list.setAttribute('aria-setsize', String(visibleCount)); this._announcePolite(`${visibleCount} option${visibleCount === 1 ? '' : 's'} available`); } option(option) { diff --git a/dist/slimselect.global.js b/dist/slimselect.global.js index de977d71..786417e5 100644 --- a/dist/slimselect.global.js +++ b/dist/slimselect.global.js @@ -374,7 +374,7 @@ var SlimSelect = (function () { el.setAttribute('role', 'status'); el.setAttribute('aria-live', 'assertive'); el.setAttribute('aria-atomic', 'true'); - el.className = 'sr-only'; + el.className = 'ss-sr-only'; document.body.appendChild(el); } return el; @@ -412,7 +412,7 @@ var SlimSelect = (function () { el.setAttribute('role', 'status'); el.setAttribute('aria-live', 'polite'); el.setAttribute('aria-atomic', 'true'); - el.className = 'sr-only'; + el.className = 'ss-sr-only'; document.body.appendChild(el); } return el; @@ -1153,11 +1153,16 @@ var SlimSelect = (function () { } const fragment = document.createDocumentFragment(); let count = 0; + const totalOptions = data.filter((d) => d instanceof Option && + !d.placeholder && + d.display && + !d.disabled).length; const tagPos = (el) => { if (!el.classList.contains(this.classes.placeholder) && !el.classList.contains(this.classes.disabled) && !el.classList.contains(this.classes.hide)) { el.setAttribute('aria-posinset', String(++count)); + el.setAttribute('aria-setsize', String(totalOptions)); } }; for (const d of data) { @@ -1288,7 +1293,6 @@ var SlimSelect = (function () { this.content.list.appendChild(fragment); this.content.list.removeAttribute('aria-busy'); const visibleCount = this.getOptions(true, true, true).length; - this.content.list.setAttribute('aria-setsize', String(visibleCount)); this._announcePolite(`${visibleCount} option${visibleCount === 1 ? '' : 's'} available`); } option(option) { diff --git a/dist/slimselect.js b/dist/slimselect.js index 7275e921..c7ab95d4 100644 --- a/dist/slimselect.js +++ b/dist/slimselect.js @@ -377,7 +377,7 @@ el.setAttribute('role', 'status'); el.setAttribute('aria-live', 'assertive'); el.setAttribute('aria-atomic', 'true'); - el.className = 'sr-only'; + el.className = 'ss-sr-only'; document.body.appendChild(el); } return el; @@ -415,7 +415,7 @@ el.setAttribute('role', 'status'); el.setAttribute('aria-live', 'polite'); el.setAttribute('aria-atomic', 'true'); - el.className = 'sr-only'; + el.className = 'ss-sr-only'; document.body.appendChild(el); } return el; @@ -1156,11 +1156,16 @@ } const fragment = document.createDocumentFragment(); let count = 0; + const totalOptions = data.filter((d) => d instanceof Option && + !d.placeholder && + d.display && + !d.disabled).length; const tagPos = (el) => { if (!el.classList.contains(this.classes.placeholder) && !el.classList.contains(this.classes.disabled) && !el.classList.contains(this.classes.hide)) { el.setAttribute('aria-posinset', String(++count)); + el.setAttribute('aria-setsize', String(totalOptions)); } }; for (const d of data) { @@ -1291,7 +1296,6 @@ this.content.list.appendChild(fragment); this.content.list.removeAttribute('aria-busy'); const visibleCount = this.getOptions(true, true, true).length; - this.content.list.setAttribute('aria-setsize', String(visibleCount)); this._announcePolite(`${visibleCount} option${visibleCount === 1 ? '' : 's'} available`); } option(option) { diff --git a/dist/slimselect.min.js b/dist/slimselect.min.js index 2f4d0f93..91ab7b55 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";class t{constructor(t){t||(t={}),this.main=t.main||"ss-main",this.placeholder=t.placeholder||"ss-placeholder",this.values=t.values||"ss-values",this.single=t.single||"ss-single",this.max=t.max||"ss-max",this.value=t.value||"ss-value",this.valueText=t.valueText||"ss-value-text",this.valueDelete=t.valueDelete||"ss-value-delete",this.valueOut=t.valueOut||"ss-value-out",this.deselect=t.deselect||"ss-deselect",this.deselectPath=t.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=t.arrow||"ss-arrow",this.arrowClose=t.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=t.arrowOpen||"M10,70 L50,30 L90,70",this.content=t.content||"ss-content",this.openAbove=t.openAbove||"ss-open-above",this.openBelow=t.openBelow||"ss-open-below",this.search=t.search||"ss-search",this.searchHighlighter=t.searchHighlighter||"ss-search-highlight",this.searching=t.searching||"ss-searching",this.addable=t.addable||"ss-addable",this.addablePath=t.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=t.list||"ss-list",this.optgroup=t.optgroup||"ss-optgroup",this.optgroupLabel=t.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=t.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=t.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=t.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=t.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=t.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=t.optgroupClosable||"ss-closable",this.option=t.option||"ss-option",this.optionDelete=t.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=t.highlighted||"ss-highlighted",this.open=t.open||"ss-open",this.close=t.close||"ss-close",this.selected=t.selected||"ss-selected",this.error=t.error||"ss-error",this.disabled=t.disabled||"ss-disabled",this.hide=t.hide||"ss-hide"}}function e(){return Math.random().toString(36).substring(2,10)}function s(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 i(t,e){return JSON.stringify(t)===JSON.stringify(e)}class n{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 a(e))}}class a{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.defaultSelected=void 0!==t.defaultSelected&&t.defaultSelected,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 l{constructor(t,e){this.selectType="single",this.data=[],this.selectedOrder=[],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 n||"label"in e){if(!("label"in e))return new Error("Optgroup must have a label");if("options"in e&&e.options)for(let t of e.options){const e=this.validateOption(t);if(e)return e}}else{if(!(e instanceof a||"text"in e))return new Error("Data object must be a valid optgroup or option");{const t=this.validateOption(e);if(t)return 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 n||"label"in t){let s=[];"options"in t&&t.options&&t.options.forEach((t=>{s.push(new a(t))})),s.length>0&&e.push(new n(t))}(t instanceof a||"text"in t)&&e.push(new a(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,e=!1){if(e){let e=[new a(t)];this.setData(e.concat(this.getData()))}else this.setData(this.getData().concat(new a(t)))}setSelectedBy(t,e){let s=null,i=!1;const l=[];for(let o of this.data){if(o instanceof n)for(let n of o.options)s||(s=n),n.selected=!i&&e.includes(n[t]),n.selected&&(l.push(n),"single"===this.selectType&&(i=!0));o instanceof a&&(s||(s=o),o.selected=!i&&e.includes(o[t]),o.selected&&(l.push(o),"single"===this.selectType&&(i=!0)))}"single"===this.selectType&&s&&!i&&(s.selected=!0,l.push(s));const o=e.map((e=>{var s;return(null===(s=l.find((s=>s[t]===e)))||void 0===s?void 0:s.id)||""}));this.selectedOrder=o}getSelected(){return this.getSelectedOptions().map((t=>t.id))}getSelectedValues(){return this.getSelectedOptions().map((t=>t.value))}getSelectedOptions(){return this.filter((t=>t.selected),!1)}getOptgroupByID(t){for(let e of this.data)if(e instanceof n&&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 n?t=e.options[0]:e instanceof a&&(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((i=>{if(i instanceof n){let l=[];if(i.options.forEach((i=>{t&&!t(i)||(e?l.push(new a(i)):s.push(new a(i)))})),l.length>0){let t=new n(i);t.options=l,s.push(t)}}i instanceof a&&(t&&!t(i)||s.push(new a(i)))})),s}selectedOrderOptions(t){const e=[];return this.selectedOrder.forEach((s=>{const i=t.find((t=>t.id===s));i&&e.push(i)})),t.forEach((t=>{let s=!1;e.forEach((e=>{t.id!==e.id||(s=!0)})),s||e.push(t)})),e}}class o{static getLiveAssertive(){let t=document.getElementById("ss-live-assertive");return t||(t=document.createElement("div"),t.id="ss-live-assertive",t.setAttribute("role","status"),t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true"),t.className="sr-only",document.body.appendChild(t)),t}_announceAssertive(t){const e=o._liveAssertive||(o._liveAssertive=o.getLiveAssertive());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}constructor(t,e,s,i){var n;this.store=s,this.settings=t,this.classes=e,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes();const a=null===(n=document.querySelector(`[data-id="${this.settings.id}"]`))||void 0===n?void 0:n.closest(".offcanvas-body");a?a.appendChild(this.content.main):this.settings.contentLocation&&this.settings.contentLocation.appendChild(this.content.main)}static getLivePolite(){let t=document.getElementById("ss-live-polite");return t||(t=document.createElement("div"),t.id="ss-live-polite",t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.className="sr-only",document.body.appendChild(t)),t}_announcePolite(t){const e=o._livePolite||(o._livePolite=o.getLivePolite());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}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)}"fixed"===this.settings.contentPosition&&(this.moveContent(),this.scrollHandler=()=>this.moveContent(),this.resizeHandler=()=>this.moveContent(),window.addEventListener("scroll",this.scrollHandler,!0),window.addEventListener("resize",this.resizeHandler)),this.searchFocus()}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),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=void 0),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=void 0),this.main.main.focus({preventScroll:!0}),this.main.main.removeAttribute("aria-activedescendant")}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.main.main.classList.add("ss-2"),this.content.main.classList.add(this.classes.content),this.content.main.classList.add("ss-content-2"),""!==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&&"fixed"!==this.settings.contentPosition||this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){this.content.list.setAttribute("role","listbox"),this.content.list.setAttribute("id",this.content.main.id+"-list"),this.content.list.setAttribute("aria-label",this.settings.contentAriaLabel),this.settings.isMultiple?this.content.list.setAttribute("aria-multiselectable","true"):this.content.list.removeAttribute("aria-multiselectable"),this.main.main.setAttribute("role","combobox"),this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.list.id),this.main.main.setAttribute("aria-expanded","false"),this.main.main.setAttribute("aria-autocomplete","list"),this.settings.ariaLabelledBy&&this.settings.ariaLabelledBy.trim()?(this.main.main.setAttribute("aria-labelledby",this.settings.ariaLabelledBy),this.main.main.removeAttribute("aria-label")):this.settings.ariaLabel&&this.settings.ariaLabel.trim()&&this.main.main.setAttribute("aria-label",this.settings.ariaLabel),this.main.main.setAttribute("aria-owns",this.content.list.id),this.content.search.input.setAttribute("aria-controls",this.content.list.id),this.content.search.input.setAttribute("aria-autocomplete","list")}mainDiv(){var t;const e=document.createElement("div");e.id=this.settings.id+"-main",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===t.key.length&&this.callbacks.open(),!0},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),i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("aria-label",this.settings.clearAllAriaLabel),i.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i.click())}));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"),a.setAttribute("aria-hidden","true"),a.setAttribute("focusable","false");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"),o.setAttribute("aria-hidden","true"),o.setAttribute("focusable","false");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()}this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e));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 i=this.store.getSelectedOptions(),l=i.filter((e=>e.selected&&e.id!==t.id),!0);if(!(this.settings.minSelected&&l.length{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),s.click())}}return e}contentDiv(){const t=document.createElement("div");t.id=this.settings.id+"-content";const e=this.searchDiv();t.appendChild(e.main);const s=this.listDiv();return t.appendChild(s),{main:t,search:e,list:s}}moveContent(){"relative"!==this.settings.contentPosition&&"down"!==this.settings.openPosition?"up"!==this.settings.openPosition?"up"===this.putContent()?this.moveContentAbove():this.moveContentBelow():this.moveContentAbove():this.moveContentBelow()}searchDiv(){const t=document.createElement("div"),e=document.createElement("input"),i=document.createElement("div");t.classList.add(this.classes.search);const n={main:t,input:e};if(this.settings.showSearch||(t.classList.add(this.classes.hide),e.readOnly=!0),e.type="search",e.placeholder=this.settings.searchPlaceholder,e.tabIndex=-1,this.settings.searchLabelledBy&&this.settings.searchLabelledBy.trim()?e.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel&&this.settings.searchAriaLabel.trim()?e.setAttribute("aria-label",this.settings.searchAriaLabel):e.setAttribute("aria-label","Search options"),e.setAttribute("autocapitalize","off"),e.setAttribute("autocomplete","off"),e.setAttribute("autocorrect","off"),e.oninput=s((t=>{this.callbacks.search(t.target.value)}),100),e.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" ":const e=this.content.list.querySelector("."+this.classes.highlighted);return!e||(e.click(),!1);case"Enter":if(this.callbacks.addable)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(e),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"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false");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 a(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=>{"string"==typeof t?s({text:t,value:t}):i instanceof Error?this.renderError(i.message):s(t)})):"string"==typeof i?s({text:i,value:i}):i instanceof Error?this.renderError(i.message):s(i))},t.appendChild(i),n.addable={main:i,svg:e,path:s}}return n}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.main.main.setAttribute("aria-activedescendant",a.id),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}const i=e["down"===t?0:e.length-1];i.classList.add(this.classes.highlighted),this.main.main.setAttribute("aria-activedescendant",i.id),this.ensureElementInView(this.content.list,i)}listDiv(){const t=document.createElement("div");return t.classList.add(this.classes.list),t}renderError(t){this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy");const e=document.createElement("div");e.classList.add(this.classes.error),e.textContent=t,this.content.list.appendChild(e),this._announceAssertive(t)}renderSearching(){this.content.list.innerHTML="",this.content.list.setAttribute("aria-busy","true");const t=document.createElement("div");t.classList.add(this.classes.searching),t.textContent=this.settings.searchingText,this.content.list.appendChild(t),this._announcePolite(this.settings.searchingText)}renderOptions(t){if(this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy"),0===t.length){const t=document.createElement("div");t.classList.add(this.classes.search);const e=this.callbacks.addable?this.settings.addableText.replace("{value}",this.content.search.input.value):this.settings.searchText;return this._announcePolite(e),t.innerHTML=e,this.content.list.appendChild(t),void this.content.list.setAttribute("aria-setsize","0")}if(this.settings.allowDeselect&&!this.settings.isMultiple){this.store.filter((t=>t.placeholder),!1).length||this.store.addOption(new a({text:"",value:"",selected:!1,placeholder:!0}),!0)}const e=document.createDocumentFragment();let s=0;const i=t=>{t.classList.contains(this.classes.placeholder)||t.classList.contains(this.classes.disabled)||t.classList.contains(this.classes.hide)||t.setAttribute("aria-posinset",String(++s))};for(const s of t){if(s instanceof n){const t=document.createElement("div");t.classList.add(this.classes.optgroup),t.setAttribute("role","group"),t.setAttribute("aria-label",s.label);const n=document.createElement("div");n.classList.add(this.classes.optgroupLabel),t.appendChild(n);const a=document.createElement("div");a.classList.add(this.classes.optgroupLabelText),a.textContent=s.label,n.appendChild(a);const l=document.createElement("div");if(l.classList.add(this.classes.optgroupActions),n.appendChild(l),this.settings.isMultiple&&s.selectAll){const t=document.createElement("div");t.classList.add(this.classes.optgroupSelectAll);let e=!0;for(const t of s.options)if(!t.selected){e=!1;break}e&&t.classList.add(this.classes.selected);const i=document.createElement("span");i.textContent=s.selectAllText,t.appendChild(i);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),t.appendChild(n);const a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("d",this.classes.optgroupSelectAllBox),n.appendChild(a);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.optgroupSelectAllCheck),n.appendChild(o),t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const i=this.store.getSelected();if(e){const t=i.filter((t=>{for(const e of s.options)if(t===e.id)return!1;return!0}));this.callbacks.setSelected(t,!0)}else{const t=i.concat(s.options.map((t=>t.id)));for(const t of s.options)this.store.getOptionByID(t.id)||this.callbacks.addOption(t);this.callbacks.setSelected(t,!0)}})),l.appendChild(t)}if("off"!==s.closable){const e=document.createElement("div");e.classList.add(this.classes.optgroupClosable);const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("viewBox","0 0 100 100"),i.classList.add(this.classes.arrow),i.setAttribute("aria-hidden","true"),i.setAttribute("focusable","false"),e.appendChild(i);const a=document.createElementNS("http://www.w3.org/2000/svg","path");i.appendChild(a),s.options.some((t=>t.selected))||""!==this.content.search.input.value.trim()||"open"===s.closable?(t.classList.add(this.classes.open),a.setAttribute("d",this.classes.arrowOpen)):"close"===s.closable&&(t.classList.add(this.classes.close),a.setAttribute("d",this.classes.arrowClose)),n.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),a.setAttribute("d",this.classes.arrowOpen)):(t.classList.remove(this.classes.open),t.classList.add(this.classes.close),a.setAttribute("d",this.classes.arrowClose))})),l.appendChild(e)}t.appendChild(n);for(const e of s.options){const s=this.option(e);i(s),t.appendChild(s)}e.appendChild(t)}if(s instanceof a){const t=this.option(s);i(t),e.appendChild(t)}}this.content.list.appendChild(e),this.content.list.removeAttribute("aria-busy");const l=this.getOptions(!0,!0,!0).length;this.content.list.setAttribute("aria-setsize",String(l)),this._announcePolite(`${l} option${1===l?"":"s"} available`)}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=`${this.settings.id}__opt__${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),e.setAttribute("aria-disabled","true")),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=[];if(this.settings.isMultiple)if(t.selected)o=l.filter((t=>t.id!==n));else if(o=l.concat(t),!this.settings.closeOnSelect)if(e.shiftKey&&this.lastSelectedOption){const e=this.store.getDataOptions();let s=e.findIndex((t=>t.id===this.lastSelectedOption.id)),i=e.findIndex((e=>e.id===t.id));if(s>=0&&i>=0){const t=Math.min(s,i),n=Math.max(s,i),a=e.slice(t,n+1);a.length>0&&a.length!l.find((e=>e.id===t.id))))))}}else t.selected||(this.lastSelectedOption=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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=s.left+("fixed"===this.settings.contentPosition?0: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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=t.left+("fixed"===this.settings.contentPosition?0: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)}}o._livePolite=null,o._liveAssertive=null;class c{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){if(n.target===this.select&&("disabled"===n.attributeName&&(s=!0),"class"===n.attributeName&&(e=!0),"childList"===n.type)){for(const t of n.addedNodes)if("OPTION"===t.nodeName&&t.value===this.select.value){this.select.dispatchEvent(new Event("change"));break}i=!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:"",defaultSelected:t.defaultSelected,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)}setSelectedByValue(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.value)}}if("OPTION"===s.nodeName){const e=s;e.selected=t.includes(e.value)}}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 n&&this.select.appendChild(this.createOptgroup(e)),e instanceof a&&this.select.appendChild(this.createOption(e));this.select.dispatchEvent(new Event("change",{bubbles:!0})),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.textContent=t.text,""!==t.html&&e.setAttribute("data-html",t.html),e.defaultSelected=t.defaultSelected,e.selected=t.selected,t.disabled&&(e.disabled=!0),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 r{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.focusSearch=void 0===t.focusSearch||t.focusSearch,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.contentAriaLabel=void 0!==t.contentAriaLabel?t.contentAriaLabel:"Select an option",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",this.addableText=t.addableText||'Press "Enter" to add {value}',this.ariaLabelledBy=t.ariaLabelledBy||"",this.searchAriaLabel=t.searchAriaLabel||"Search options",this.searchLabelledBy=t.searchLabelledBy||"",this.clearAllAriaLabel=t.clearAllAriaLabel||"Clear selection"}}return class{constructor(e){var i;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=s((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.windowScroll=s((()=>{(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 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 r(e.settings),this.cssClasses=new t(e.cssClasses);const n=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const t in e.events)e.events.hasOwnProperty(t)&&(-1!==n.indexOf(t)?this.events[t]=s(e.events[t],100):this.events[t]=e.events[t]);this.settings.disabled=(null===(i=e.settings)||void 0===i?void 0:i.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 c(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 l(this.settings.isMultiple?"multiple":"single",e.data?e.data:this.select.getData()),e.data&&this.select.updateOptions(this.store.getData());const a={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 o(this.settings,this.cssClasses,this.store,a),this.render.renderValues(),this.render.renderOptions(this.store.getData());const h=this.selectEl.getAttribute("aria-label"),d=this.selectEl.getAttribute("aria-labelledby");h?this.render.main.main.setAttribute("aria-label",h):d&&this.render.main.main.setAttribute("aria-labelledby",d),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(),s=this.store.validateDataArray(t);if(s)return void(this.events.error&&this.events.error(s));this.store.setData(t);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!i(e,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let t=this.store.getSelectedOptions();return this.settings.keepOrder&&(t=this.store.selectedOrderOptions(t)),t.map((t=>t.value))}setSelected(t,e=!0){const s=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&&!i(s,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 s=this.store.getData();this.select.updateOptions(s),this.render.renderValues(),this.render.renderOptions(s),this.events.afterChange&&!i(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.settings.focusSearch&&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";class t{constructor(t){t||(t={}),this.main=t.main||"ss-main",this.placeholder=t.placeholder||"ss-placeholder",this.values=t.values||"ss-values",this.single=t.single||"ss-single",this.max=t.max||"ss-max",this.value=t.value||"ss-value",this.valueText=t.valueText||"ss-value-text",this.valueDelete=t.valueDelete||"ss-value-delete",this.valueOut=t.valueOut||"ss-value-out",this.deselect=t.deselect||"ss-deselect",this.deselectPath=t.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=t.arrow||"ss-arrow",this.arrowClose=t.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=t.arrowOpen||"M10,70 L50,30 L90,70",this.content=t.content||"ss-content",this.openAbove=t.openAbove||"ss-open-above",this.openBelow=t.openBelow||"ss-open-below",this.search=t.search||"ss-search",this.searchHighlighter=t.searchHighlighter||"ss-search-highlight",this.searching=t.searching||"ss-searching",this.addable=t.addable||"ss-addable",this.addablePath=t.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=t.list||"ss-list",this.optgroup=t.optgroup||"ss-optgroup",this.optgroupLabel=t.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=t.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=t.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=t.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=t.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=t.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=t.optgroupClosable||"ss-closable",this.option=t.option||"ss-option",this.optionDelete=t.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=t.highlighted||"ss-highlighted",this.open=t.open||"ss-open",this.close=t.close||"ss-close",this.selected=t.selected||"ss-selected",this.error=t.error||"ss-error",this.disabled=t.disabled||"ss-disabled",this.hide=t.hide||"ss-hide"}}function e(){return Math.random().toString(36).substring(2,10)}function s(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 i(t,e){return JSON.stringify(t)===JSON.stringify(e)}class n{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 a(e))}}class a{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.defaultSelected=void 0!==t.defaultSelected&&t.defaultSelected,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 l{constructor(t,e){this.selectType="single",this.data=[],this.selectedOrder=[],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 n||"label"in e){if(!("label"in e))return new Error("Optgroup must have a label");if("options"in e&&e.options)for(let t of e.options){const e=this.validateOption(t);if(e)return e}}else{if(!(e instanceof a||"text"in e))return new Error("Data object must be a valid optgroup or option");{const t=this.validateOption(e);if(t)return 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 n||"label"in t){let s=[];"options"in t&&t.options&&t.options.forEach((t=>{s.push(new a(t))})),s.length>0&&e.push(new n(t))}(t instanceof a||"text"in t)&&e.push(new a(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,e=!1){if(e){let e=[new a(t)];this.setData(e.concat(this.getData()))}else this.setData(this.getData().concat(new a(t)))}setSelectedBy(t,e){let s=null,i=!1;const l=[];for(let o of this.data){if(o instanceof n)for(let n of o.options)s||(s=n),n.selected=!i&&e.includes(n[t]),n.selected&&(l.push(n),"single"===this.selectType&&(i=!0));o instanceof a&&(s||(s=o),o.selected=!i&&e.includes(o[t]),o.selected&&(l.push(o),"single"===this.selectType&&(i=!0)))}"single"===this.selectType&&s&&!i&&(s.selected=!0,l.push(s));const o=e.map((e=>{var s;return(null===(s=l.find((s=>s[t]===e)))||void 0===s?void 0:s.id)||""}));this.selectedOrder=o}getSelected(){return this.getSelectedOptions().map((t=>t.id))}getSelectedValues(){return this.getSelectedOptions().map((t=>t.value))}getSelectedOptions(){return this.filter((t=>t.selected),!1)}getOptgroupByID(t){for(let e of this.data)if(e instanceof n&&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 n?t=e.options[0]:e instanceof a&&(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((i=>{if(i instanceof n){let l=[];if(i.options.forEach((i=>{t&&!t(i)||(e?l.push(new a(i)):s.push(new a(i)))})),l.length>0){let t=new n(i);t.options=l,s.push(t)}}i instanceof a&&(t&&!t(i)||s.push(new a(i)))})),s}selectedOrderOptions(t){const e=[];return this.selectedOrder.forEach((s=>{const i=t.find((t=>t.id===s));i&&e.push(i)})),t.forEach((t=>{let s=!1;e.forEach((e=>{t.id!==e.id||(s=!0)})),s||e.push(t)})),e}}class o{static getLiveAssertive(){let t=document.getElementById("ss-live-assertive");return t||(t=document.createElement("div"),t.id="ss-live-assertive",t.setAttribute("role","status"),t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true"),t.className="ss-sr-only",document.body.appendChild(t)),t}_announceAssertive(t){const e=o._liveAssertive||(o._liveAssertive=o.getLiveAssertive());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}constructor(t,e,s,i){var n;this.store=s,this.settings=t,this.classes=e,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes();const a=null===(n=document.querySelector(`[data-id="${this.settings.id}"]`))||void 0===n?void 0:n.closest(".offcanvas-body");a?a.appendChild(this.content.main):this.settings.contentLocation&&this.settings.contentLocation.appendChild(this.content.main)}static getLivePolite(){let t=document.getElementById("ss-live-polite");return t||(t=document.createElement("div"),t.id="ss-live-polite",t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.className="ss-sr-only",document.body.appendChild(t)),t}_announcePolite(t){const e=o._livePolite||(o._livePolite=o.getLivePolite());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}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)}"fixed"===this.settings.contentPosition&&(this.moveContent(),this.scrollHandler=()=>this.moveContent(),this.resizeHandler=()=>this.moveContent(),window.addEventListener("scroll",this.scrollHandler,!0),window.addEventListener("resize",this.resizeHandler)),this.searchFocus()}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),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=void 0),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=void 0),this.main.main.focus({preventScroll:!0}),this.main.main.removeAttribute("aria-activedescendant")}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.main.main.classList.add("ss-2"),this.content.main.classList.add(this.classes.content),this.content.main.classList.add("ss-content-2"),""!==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&&"fixed"!==this.settings.contentPosition||this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){this.content.list.setAttribute("role","listbox"),this.content.list.setAttribute("id",this.content.main.id+"-list"),this.content.list.setAttribute("aria-label",this.settings.contentAriaLabel),this.settings.isMultiple?this.content.list.setAttribute("aria-multiselectable","true"):this.content.list.removeAttribute("aria-multiselectable"),this.main.main.setAttribute("role","combobox"),this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.list.id),this.main.main.setAttribute("aria-expanded","false"),this.main.main.setAttribute("aria-autocomplete","list"),this.settings.ariaLabelledBy&&this.settings.ariaLabelledBy.trim()?(this.main.main.setAttribute("aria-labelledby",this.settings.ariaLabelledBy),this.main.main.removeAttribute("aria-label")):this.settings.ariaLabel&&this.settings.ariaLabel.trim()&&this.main.main.setAttribute("aria-label",this.settings.ariaLabel),this.main.main.setAttribute("aria-owns",this.content.list.id),this.content.search.input.setAttribute("aria-controls",this.content.list.id),this.content.search.input.setAttribute("aria-autocomplete","list")}mainDiv(){var t;const e=document.createElement("div");e.id=this.settings.id+"-main",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===t.key.length&&this.callbacks.open(),!0},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),i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("aria-label",this.settings.clearAllAriaLabel),i.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i.click())}));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"),a.setAttribute("aria-hidden","true"),a.setAttribute("focusable","false");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"),o.setAttribute("aria-hidden","true"),o.setAttribute("focusable","false");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()}this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e));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 i=this.store.getSelectedOptions(),l=i.filter((e=>e.selected&&e.id!==t.id),!0);if(!(this.settings.minSelected&&l.length{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),s.click())}}return e}contentDiv(){const t=document.createElement("div");t.id=this.settings.id+"-content";const e=this.searchDiv();t.appendChild(e.main);const s=this.listDiv();return t.appendChild(s),{main:t,search:e,list:s}}moveContent(){"relative"!==this.settings.contentPosition&&"down"!==this.settings.openPosition?"up"!==this.settings.openPosition?"up"===this.putContent()?this.moveContentAbove():this.moveContentBelow():this.moveContentAbove():this.moveContentBelow()}searchDiv(){const t=document.createElement("div"),e=document.createElement("input"),i=document.createElement("div");t.classList.add(this.classes.search);const n={main:t,input:e};if(this.settings.showSearch||(t.classList.add(this.classes.hide),e.readOnly=!0),e.type="search",e.placeholder=this.settings.searchPlaceholder,e.tabIndex=-1,this.settings.searchLabelledBy&&this.settings.searchLabelledBy.trim()?e.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel&&this.settings.searchAriaLabel.trim()?e.setAttribute("aria-label",this.settings.searchAriaLabel):e.setAttribute("aria-label","Search options"),e.setAttribute("autocapitalize","off"),e.setAttribute("autocomplete","off"),e.setAttribute("autocorrect","off"),e.oninput=s((t=>{this.callbacks.search(t.target.value)}),100),e.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" ":const e=this.content.list.querySelector("."+this.classes.highlighted);return!e||(e.click(),!1);case"Enter":if(this.callbacks.addable)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(e),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"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false");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 a(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=>{"string"==typeof t?s({text:t,value:t}):i instanceof Error?this.renderError(i.message):s(t)})):"string"==typeof i?s({text:i,value:i}):i instanceof Error?this.renderError(i.message):s(i))},t.appendChild(i),n.addable={main:i,svg:e,path:s}}return n}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.main.main.setAttribute("aria-activedescendant",a.id),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}const i=e["down"===t?0:e.length-1];i.classList.add(this.classes.highlighted),this.main.main.setAttribute("aria-activedescendant",i.id),this.ensureElementInView(this.content.list,i)}listDiv(){const t=document.createElement("div");return t.classList.add(this.classes.list),t}renderError(t){this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy");const e=document.createElement("div");e.classList.add(this.classes.error),e.textContent=t,this.content.list.appendChild(e),this._announceAssertive(t)}renderSearching(){this.content.list.innerHTML="",this.content.list.setAttribute("aria-busy","true");const t=document.createElement("div");t.classList.add(this.classes.searching),t.textContent=this.settings.searchingText,this.content.list.appendChild(t),this._announcePolite(this.settings.searchingText)}renderOptions(t){if(this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy"),0===t.length){const t=document.createElement("div");t.classList.add(this.classes.search);const e=this.callbacks.addable?this.settings.addableText.replace("{value}",this.content.search.input.value):this.settings.searchText;return this._announcePolite(e),t.innerHTML=e,this.content.list.appendChild(t),void this.content.list.setAttribute("aria-setsize","0")}if(this.settings.allowDeselect&&!this.settings.isMultiple){this.store.filter((t=>t.placeholder),!1).length||this.store.addOption(new a({text:"",value:"",selected:!1,placeholder:!0}),!0)}const e=document.createDocumentFragment();let s=0;const i=t.filter((t=>t instanceof a&&!t.placeholder&&t.display&&!t.disabled)).length,l=t=>{t.classList.contains(this.classes.placeholder)||t.classList.contains(this.classes.disabled)||t.classList.contains(this.classes.hide)||(t.setAttribute("aria-posinset",String(++s)),t.setAttribute("aria-setsize",String(i)))};for(const s of t){if(s instanceof n){const t=document.createElement("div");t.classList.add(this.classes.optgroup),t.setAttribute("role","group"),t.setAttribute("aria-label",s.label);const i=document.createElement("div");i.classList.add(this.classes.optgroupLabel),t.appendChild(i);const n=document.createElement("div");n.classList.add(this.classes.optgroupLabelText),n.textContent=s.label,i.appendChild(n);const a=document.createElement("div");if(a.classList.add(this.classes.optgroupActions),i.appendChild(a),this.settings.isMultiple&&s.selectAll){const t=document.createElement("div");t.classList.add(this.classes.optgroupSelectAll);let e=!0;for(const t of s.options)if(!t.selected){e=!1;break}e&&t.classList.add(this.classes.selected);const i=document.createElement("span");i.textContent=s.selectAllText,t.appendChild(i);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),t.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.optgroupSelectAllBox),n.appendChild(l);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.optgroupSelectAllCheck),n.appendChild(o),t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const i=this.store.getSelected();if(e){const t=i.filter((t=>{for(const e of s.options)if(t===e.id)return!1;return!0}));this.callbacks.setSelected(t,!0)}else{const t=i.concat(s.options.map((t=>t.id)));for(const t of s.options)this.store.getOptionByID(t.id)||this.callbacks.addOption(t);this.callbacks.setSelected(t,!0)}})),a.appendChild(t)}if("off"!==s.closable){const e=document.createElement("div");e.classList.add(this.classes.optgroupClosable);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.classList.add(this.classes.arrow),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),e.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","path");n.appendChild(l),s.options.some((t=>t.selected))||""!==this.content.search.input.value.trim()||"open"===s.closable?(t.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"close"===s.closable&&(t.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose)),i.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))})),a.appendChild(e)}t.appendChild(i);for(const e of s.options){const s=this.option(e);l(s),t.appendChild(s)}e.appendChild(t)}if(s instanceof a){const t=this.option(s);l(t),e.appendChild(t)}}this.content.list.appendChild(e),this.content.list.removeAttribute("aria-busy");const o=this.getOptions(!0,!0,!0).length;this._announcePolite(`${o} option${1===o?"":"s"} available`)}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=`${this.settings.id}__opt__${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),e.setAttribute("aria-disabled","true")),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=[];if(this.settings.isMultiple)if(t.selected)o=l.filter((t=>t.id!==n));else if(o=l.concat(t),!this.settings.closeOnSelect)if(e.shiftKey&&this.lastSelectedOption){const e=this.store.getDataOptions();let s=e.findIndex((t=>t.id===this.lastSelectedOption.id)),i=e.findIndex((e=>e.id===t.id));if(s>=0&&i>=0){const t=Math.min(s,i),n=Math.max(s,i),a=e.slice(t,n+1);a.length>0&&a.length!l.find((e=>e.id===t.id))))))}}else t.selected||(this.lastSelectedOption=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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=s.left+("fixed"===this.settings.contentPosition?0: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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=t.left+("fixed"===this.settings.contentPosition?0: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)}}o._livePolite=null,o._liveAssertive=null;class c{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){if(n.target===this.select&&("disabled"===n.attributeName&&(s=!0),"class"===n.attributeName&&(e=!0),"childList"===n.type)){for(const t of n.addedNodes)if("OPTION"===t.nodeName&&t.value===this.select.value){this.select.dispatchEvent(new Event("change"));break}i=!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:"",defaultSelected:t.defaultSelected,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)}setSelectedByValue(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.value)}}if("OPTION"===s.nodeName){const e=s;e.selected=t.includes(e.value)}}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 n&&this.select.appendChild(this.createOptgroup(e)),e instanceof a&&this.select.appendChild(this.createOption(e));this.select.dispatchEvent(new Event("change",{bubbles:!0})),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.textContent=t.text,""!==t.html&&e.setAttribute("data-html",t.html),e.defaultSelected=t.defaultSelected,e.selected=t.selected,t.disabled&&(e.disabled=!0),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 r{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.focusSearch=void 0===t.focusSearch||t.focusSearch,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.contentAriaLabel=void 0!==t.contentAriaLabel?t.contentAriaLabel:"Select an option",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",this.addableText=t.addableText||'Press "Enter" to add {value}',this.ariaLabelledBy=t.ariaLabelledBy||"",this.searchAriaLabel=t.searchAriaLabel||"Search options",this.searchLabelledBy=t.searchLabelledBy||"",this.clearAllAriaLabel=t.clearAllAriaLabel||"Clear selection"}}return class{constructor(e){var i;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=s((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.windowScroll=s((()=>{(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 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 r(e.settings),this.cssClasses=new t(e.cssClasses);const n=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const t in e.events)e.events.hasOwnProperty(t)&&(-1!==n.indexOf(t)?this.events[t]=s(e.events[t],100):this.events[t]=e.events[t]);this.settings.disabled=(null===(i=e.settings)||void 0===i?void 0:i.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 c(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 l(this.settings.isMultiple?"multiple":"single",e.data?e.data:this.select.getData()),e.data&&this.select.updateOptions(this.store.getData());const a={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 o(this.settings,this.cssClasses,this.store,a),this.render.renderValues(),this.render.renderOptions(this.store.getData());const h=this.selectEl.getAttribute("aria-label"),d=this.selectEl.getAttribute("aria-labelledby");h?this.render.main.main.setAttribute("aria-label",h):d&&this.render.main.main.setAttribute("aria-labelledby",d),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(),s=this.store.validateDataArray(t);if(s)return void(this.events.error&&this.events.error(s));this.store.setData(t);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!i(e,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let t=this.store.getSelectedOptions();return this.settings.keepOrder&&(t=this.store.selectedOrderOptions(t)),t.map((t=>t.value))}setSelected(t,e=!0){const s=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&&!i(s,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 s=this.store.getData();this.select.updateOptions(s),this.render.renderValues(),this.render.renderOptions(s),this.events.afterChange&&!i(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.settings.focusSearch&&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 7275e921..c7ab95d4 100644 --- a/dist/slimselect.umd.js +++ b/dist/slimselect.umd.js @@ -377,7 +377,7 @@ el.setAttribute('role', 'status'); el.setAttribute('aria-live', 'assertive'); el.setAttribute('aria-atomic', 'true'); - el.className = 'sr-only'; + el.className = 'ss-sr-only'; document.body.appendChild(el); } return el; @@ -415,7 +415,7 @@ el.setAttribute('role', 'status'); el.setAttribute('aria-live', 'polite'); el.setAttribute('aria-atomic', 'true'); - el.className = 'sr-only'; + el.className = 'ss-sr-only'; document.body.appendChild(el); } return el; @@ -1156,11 +1156,16 @@ } const fragment = document.createDocumentFragment(); let count = 0; + const totalOptions = data.filter((d) => d instanceof Option && + !d.placeholder && + d.display && + !d.disabled).length; const tagPos = (el) => { if (!el.classList.contains(this.classes.placeholder) && !el.classList.contains(this.classes.disabled) && !el.classList.contains(this.classes.hide)) { el.setAttribute('aria-posinset', String(++count)); + el.setAttribute('aria-setsize', String(totalOptions)); } }; for (const d of data) { @@ -1291,7 +1296,6 @@ this.content.list.appendChild(fragment); this.content.list.removeAttribute('aria-busy'); const visibleCount = this.getOptions(true, true, true).length; - this.content.list.setAttribute('aria-setsize', String(visibleCount)); this._announcePolite(`${visibleCount} option${visibleCount === 1 ? '' : 's'} available`); } option(option) { diff --git a/dist/slimselect.umd.min.js b/dist/slimselect.umd.min.js index 2f4d0f93..91ab7b55 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";class t{constructor(t){t||(t={}),this.main=t.main||"ss-main",this.placeholder=t.placeholder||"ss-placeholder",this.values=t.values||"ss-values",this.single=t.single||"ss-single",this.max=t.max||"ss-max",this.value=t.value||"ss-value",this.valueText=t.valueText||"ss-value-text",this.valueDelete=t.valueDelete||"ss-value-delete",this.valueOut=t.valueOut||"ss-value-out",this.deselect=t.deselect||"ss-deselect",this.deselectPath=t.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=t.arrow||"ss-arrow",this.arrowClose=t.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=t.arrowOpen||"M10,70 L50,30 L90,70",this.content=t.content||"ss-content",this.openAbove=t.openAbove||"ss-open-above",this.openBelow=t.openBelow||"ss-open-below",this.search=t.search||"ss-search",this.searchHighlighter=t.searchHighlighter||"ss-search-highlight",this.searching=t.searching||"ss-searching",this.addable=t.addable||"ss-addable",this.addablePath=t.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=t.list||"ss-list",this.optgroup=t.optgroup||"ss-optgroup",this.optgroupLabel=t.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=t.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=t.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=t.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=t.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=t.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=t.optgroupClosable||"ss-closable",this.option=t.option||"ss-option",this.optionDelete=t.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=t.highlighted||"ss-highlighted",this.open=t.open||"ss-open",this.close=t.close||"ss-close",this.selected=t.selected||"ss-selected",this.error=t.error||"ss-error",this.disabled=t.disabled||"ss-disabled",this.hide=t.hide||"ss-hide"}}function e(){return Math.random().toString(36).substring(2,10)}function s(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 i(t,e){return JSON.stringify(t)===JSON.stringify(e)}class n{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 a(e))}}class a{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.defaultSelected=void 0!==t.defaultSelected&&t.defaultSelected,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 l{constructor(t,e){this.selectType="single",this.data=[],this.selectedOrder=[],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 n||"label"in e){if(!("label"in e))return new Error("Optgroup must have a label");if("options"in e&&e.options)for(let t of e.options){const e=this.validateOption(t);if(e)return e}}else{if(!(e instanceof a||"text"in e))return new Error("Data object must be a valid optgroup or option");{const t=this.validateOption(e);if(t)return 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 n||"label"in t){let s=[];"options"in t&&t.options&&t.options.forEach((t=>{s.push(new a(t))})),s.length>0&&e.push(new n(t))}(t instanceof a||"text"in t)&&e.push(new a(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,e=!1){if(e){let e=[new a(t)];this.setData(e.concat(this.getData()))}else this.setData(this.getData().concat(new a(t)))}setSelectedBy(t,e){let s=null,i=!1;const l=[];for(let o of this.data){if(o instanceof n)for(let n of o.options)s||(s=n),n.selected=!i&&e.includes(n[t]),n.selected&&(l.push(n),"single"===this.selectType&&(i=!0));o instanceof a&&(s||(s=o),o.selected=!i&&e.includes(o[t]),o.selected&&(l.push(o),"single"===this.selectType&&(i=!0)))}"single"===this.selectType&&s&&!i&&(s.selected=!0,l.push(s));const o=e.map((e=>{var s;return(null===(s=l.find((s=>s[t]===e)))||void 0===s?void 0:s.id)||""}));this.selectedOrder=o}getSelected(){return this.getSelectedOptions().map((t=>t.id))}getSelectedValues(){return this.getSelectedOptions().map((t=>t.value))}getSelectedOptions(){return this.filter((t=>t.selected),!1)}getOptgroupByID(t){for(let e of this.data)if(e instanceof n&&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 n?t=e.options[0]:e instanceof a&&(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((i=>{if(i instanceof n){let l=[];if(i.options.forEach((i=>{t&&!t(i)||(e?l.push(new a(i)):s.push(new a(i)))})),l.length>0){let t=new n(i);t.options=l,s.push(t)}}i instanceof a&&(t&&!t(i)||s.push(new a(i)))})),s}selectedOrderOptions(t){const e=[];return this.selectedOrder.forEach((s=>{const i=t.find((t=>t.id===s));i&&e.push(i)})),t.forEach((t=>{let s=!1;e.forEach((e=>{t.id!==e.id||(s=!0)})),s||e.push(t)})),e}}class o{static getLiveAssertive(){let t=document.getElementById("ss-live-assertive");return t||(t=document.createElement("div"),t.id="ss-live-assertive",t.setAttribute("role","status"),t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true"),t.className="sr-only",document.body.appendChild(t)),t}_announceAssertive(t){const e=o._liveAssertive||(o._liveAssertive=o.getLiveAssertive());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}constructor(t,e,s,i){var n;this.store=s,this.settings=t,this.classes=e,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes();const a=null===(n=document.querySelector(`[data-id="${this.settings.id}"]`))||void 0===n?void 0:n.closest(".offcanvas-body");a?a.appendChild(this.content.main):this.settings.contentLocation&&this.settings.contentLocation.appendChild(this.content.main)}static getLivePolite(){let t=document.getElementById("ss-live-polite");return t||(t=document.createElement("div"),t.id="ss-live-polite",t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.className="sr-only",document.body.appendChild(t)),t}_announcePolite(t){const e=o._livePolite||(o._livePolite=o.getLivePolite());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}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)}"fixed"===this.settings.contentPosition&&(this.moveContent(),this.scrollHandler=()=>this.moveContent(),this.resizeHandler=()=>this.moveContent(),window.addEventListener("scroll",this.scrollHandler,!0),window.addEventListener("resize",this.resizeHandler)),this.searchFocus()}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),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=void 0),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=void 0),this.main.main.focus({preventScroll:!0}),this.main.main.removeAttribute("aria-activedescendant")}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.main.main.classList.add("ss-2"),this.content.main.classList.add(this.classes.content),this.content.main.classList.add("ss-content-2"),""!==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&&"fixed"!==this.settings.contentPosition||this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){this.content.list.setAttribute("role","listbox"),this.content.list.setAttribute("id",this.content.main.id+"-list"),this.content.list.setAttribute("aria-label",this.settings.contentAriaLabel),this.settings.isMultiple?this.content.list.setAttribute("aria-multiselectable","true"):this.content.list.removeAttribute("aria-multiselectable"),this.main.main.setAttribute("role","combobox"),this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.list.id),this.main.main.setAttribute("aria-expanded","false"),this.main.main.setAttribute("aria-autocomplete","list"),this.settings.ariaLabelledBy&&this.settings.ariaLabelledBy.trim()?(this.main.main.setAttribute("aria-labelledby",this.settings.ariaLabelledBy),this.main.main.removeAttribute("aria-label")):this.settings.ariaLabel&&this.settings.ariaLabel.trim()&&this.main.main.setAttribute("aria-label",this.settings.ariaLabel),this.main.main.setAttribute("aria-owns",this.content.list.id),this.content.search.input.setAttribute("aria-controls",this.content.list.id),this.content.search.input.setAttribute("aria-autocomplete","list")}mainDiv(){var t;const e=document.createElement("div");e.id=this.settings.id+"-main",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===t.key.length&&this.callbacks.open(),!0},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),i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("aria-label",this.settings.clearAllAriaLabel),i.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i.click())}));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"),a.setAttribute("aria-hidden","true"),a.setAttribute("focusable","false");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"),o.setAttribute("aria-hidden","true"),o.setAttribute("focusable","false");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()}this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e));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 i=this.store.getSelectedOptions(),l=i.filter((e=>e.selected&&e.id!==t.id),!0);if(!(this.settings.minSelected&&l.length{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),s.click())}}return e}contentDiv(){const t=document.createElement("div");t.id=this.settings.id+"-content";const e=this.searchDiv();t.appendChild(e.main);const s=this.listDiv();return t.appendChild(s),{main:t,search:e,list:s}}moveContent(){"relative"!==this.settings.contentPosition&&"down"!==this.settings.openPosition?"up"!==this.settings.openPosition?"up"===this.putContent()?this.moveContentAbove():this.moveContentBelow():this.moveContentAbove():this.moveContentBelow()}searchDiv(){const t=document.createElement("div"),e=document.createElement("input"),i=document.createElement("div");t.classList.add(this.classes.search);const n={main:t,input:e};if(this.settings.showSearch||(t.classList.add(this.classes.hide),e.readOnly=!0),e.type="search",e.placeholder=this.settings.searchPlaceholder,e.tabIndex=-1,this.settings.searchLabelledBy&&this.settings.searchLabelledBy.trim()?e.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel&&this.settings.searchAriaLabel.trim()?e.setAttribute("aria-label",this.settings.searchAriaLabel):e.setAttribute("aria-label","Search options"),e.setAttribute("autocapitalize","off"),e.setAttribute("autocomplete","off"),e.setAttribute("autocorrect","off"),e.oninput=s((t=>{this.callbacks.search(t.target.value)}),100),e.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" ":const e=this.content.list.querySelector("."+this.classes.highlighted);return!e||(e.click(),!1);case"Enter":if(this.callbacks.addable)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(e),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"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false");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 a(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=>{"string"==typeof t?s({text:t,value:t}):i instanceof Error?this.renderError(i.message):s(t)})):"string"==typeof i?s({text:i,value:i}):i instanceof Error?this.renderError(i.message):s(i))},t.appendChild(i),n.addable={main:i,svg:e,path:s}}return n}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.main.main.setAttribute("aria-activedescendant",a.id),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}const i=e["down"===t?0:e.length-1];i.classList.add(this.classes.highlighted),this.main.main.setAttribute("aria-activedescendant",i.id),this.ensureElementInView(this.content.list,i)}listDiv(){const t=document.createElement("div");return t.classList.add(this.classes.list),t}renderError(t){this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy");const e=document.createElement("div");e.classList.add(this.classes.error),e.textContent=t,this.content.list.appendChild(e),this._announceAssertive(t)}renderSearching(){this.content.list.innerHTML="",this.content.list.setAttribute("aria-busy","true");const t=document.createElement("div");t.classList.add(this.classes.searching),t.textContent=this.settings.searchingText,this.content.list.appendChild(t),this._announcePolite(this.settings.searchingText)}renderOptions(t){if(this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy"),0===t.length){const t=document.createElement("div");t.classList.add(this.classes.search);const e=this.callbacks.addable?this.settings.addableText.replace("{value}",this.content.search.input.value):this.settings.searchText;return this._announcePolite(e),t.innerHTML=e,this.content.list.appendChild(t),void this.content.list.setAttribute("aria-setsize","0")}if(this.settings.allowDeselect&&!this.settings.isMultiple){this.store.filter((t=>t.placeholder),!1).length||this.store.addOption(new a({text:"",value:"",selected:!1,placeholder:!0}),!0)}const e=document.createDocumentFragment();let s=0;const i=t=>{t.classList.contains(this.classes.placeholder)||t.classList.contains(this.classes.disabled)||t.classList.contains(this.classes.hide)||t.setAttribute("aria-posinset",String(++s))};for(const s of t){if(s instanceof n){const t=document.createElement("div");t.classList.add(this.classes.optgroup),t.setAttribute("role","group"),t.setAttribute("aria-label",s.label);const n=document.createElement("div");n.classList.add(this.classes.optgroupLabel),t.appendChild(n);const a=document.createElement("div");a.classList.add(this.classes.optgroupLabelText),a.textContent=s.label,n.appendChild(a);const l=document.createElement("div");if(l.classList.add(this.classes.optgroupActions),n.appendChild(l),this.settings.isMultiple&&s.selectAll){const t=document.createElement("div");t.classList.add(this.classes.optgroupSelectAll);let e=!0;for(const t of s.options)if(!t.selected){e=!1;break}e&&t.classList.add(this.classes.selected);const i=document.createElement("span");i.textContent=s.selectAllText,t.appendChild(i);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),t.appendChild(n);const a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("d",this.classes.optgroupSelectAllBox),n.appendChild(a);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.optgroupSelectAllCheck),n.appendChild(o),t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const i=this.store.getSelected();if(e){const t=i.filter((t=>{for(const e of s.options)if(t===e.id)return!1;return!0}));this.callbacks.setSelected(t,!0)}else{const t=i.concat(s.options.map((t=>t.id)));for(const t of s.options)this.store.getOptionByID(t.id)||this.callbacks.addOption(t);this.callbacks.setSelected(t,!0)}})),l.appendChild(t)}if("off"!==s.closable){const e=document.createElement("div");e.classList.add(this.classes.optgroupClosable);const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("viewBox","0 0 100 100"),i.classList.add(this.classes.arrow),i.setAttribute("aria-hidden","true"),i.setAttribute("focusable","false"),e.appendChild(i);const a=document.createElementNS("http://www.w3.org/2000/svg","path");i.appendChild(a),s.options.some((t=>t.selected))||""!==this.content.search.input.value.trim()||"open"===s.closable?(t.classList.add(this.classes.open),a.setAttribute("d",this.classes.arrowOpen)):"close"===s.closable&&(t.classList.add(this.classes.close),a.setAttribute("d",this.classes.arrowClose)),n.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),a.setAttribute("d",this.classes.arrowOpen)):(t.classList.remove(this.classes.open),t.classList.add(this.classes.close),a.setAttribute("d",this.classes.arrowClose))})),l.appendChild(e)}t.appendChild(n);for(const e of s.options){const s=this.option(e);i(s),t.appendChild(s)}e.appendChild(t)}if(s instanceof a){const t=this.option(s);i(t),e.appendChild(t)}}this.content.list.appendChild(e),this.content.list.removeAttribute("aria-busy");const l=this.getOptions(!0,!0,!0).length;this.content.list.setAttribute("aria-setsize",String(l)),this._announcePolite(`${l} option${1===l?"":"s"} available`)}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=`${this.settings.id}__opt__${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),e.setAttribute("aria-disabled","true")),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=[];if(this.settings.isMultiple)if(t.selected)o=l.filter((t=>t.id!==n));else if(o=l.concat(t),!this.settings.closeOnSelect)if(e.shiftKey&&this.lastSelectedOption){const e=this.store.getDataOptions();let s=e.findIndex((t=>t.id===this.lastSelectedOption.id)),i=e.findIndex((e=>e.id===t.id));if(s>=0&&i>=0){const t=Math.min(s,i),n=Math.max(s,i),a=e.slice(t,n+1);a.length>0&&a.length!l.find((e=>e.id===t.id))))))}}else t.selected||(this.lastSelectedOption=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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=s.left+("fixed"===this.settings.contentPosition?0: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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=t.left+("fixed"===this.settings.contentPosition?0: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)}}o._livePolite=null,o._liveAssertive=null;class c{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){if(n.target===this.select&&("disabled"===n.attributeName&&(s=!0),"class"===n.attributeName&&(e=!0),"childList"===n.type)){for(const t of n.addedNodes)if("OPTION"===t.nodeName&&t.value===this.select.value){this.select.dispatchEvent(new Event("change"));break}i=!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:"",defaultSelected:t.defaultSelected,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)}setSelectedByValue(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.value)}}if("OPTION"===s.nodeName){const e=s;e.selected=t.includes(e.value)}}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 n&&this.select.appendChild(this.createOptgroup(e)),e instanceof a&&this.select.appendChild(this.createOption(e));this.select.dispatchEvent(new Event("change",{bubbles:!0})),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.textContent=t.text,""!==t.html&&e.setAttribute("data-html",t.html),e.defaultSelected=t.defaultSelected,e.selected=t.selected,t.disabled&&(e.disabled=!0),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 r{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.focusSearch=void 0===t.focusSearch||t.focusSearch,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.contentAriaLabel=void 0!==t.contentAriaLabel?t.contentAriaLabel:"Select an option",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",this.addableText=t.addableText||'Press "Enter" to add {value}',this.ariaLabelledBy=t.ariaLabelledBy||"",this.searchAriaLabel=t.searchAriaLabel||"Search options",this.searchLabelledBy=t.searchLabelledBy||"",this.clearAllAriaLabel=t.clearAllAriaLabel||"Clear selection"}}return class{constructor(e){var i;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=s((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.windowScroll=s((()=>{(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 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 r(e.settings),this.cssClasses=new t(e.cssClasses);const n=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const t in e.events)e.events.hasOwnProperty(t)&&(-1!==n.indexOf(t)?this.events[t]=s(e.events[t],100):this.events[t]=e.events[t]);this.settings.disabled=(null===(i=e.settings)||void 0===i?void 0:i.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 c(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 l(this.settings.isMultiple?"multiple":"single",e.data?e.data:this.select.getData()),e.data&&this.select.updateOptions(this.store.getData());const a={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 o(this.settings,this.cssClasses,this.store,a),this.render.renderValues(),this.render.renderOptions(this.store.getData());const h=this.selectEl.getAttribute("aria-label"),d=this.selectEl.getAttribute("aria-labelledby");h?this.render.main.main.setAttribute("aria-label",h):d&&this.render.main.main.setAttribute("aria-labelledby",d),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(),s=this.store.validateDataArray(t);if(s)return void(this.events.error&&this.events.error(s));this.store.setData(t);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!i(e,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let t=this.store.getSelectedOptions();return this.settings.keepOrder&&(t=this.store.selectedOrderOptions(t)),t.map((t=>t.value))}setSelected(t,e=!0){const s=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&&!i(s,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 s=this.store.getData();this.select.updateOptions(s),this.render.renderValues(),this.render.renderOptions(s),this.events.afterChange&&!i(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.settings.focusSearch&&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";class t{constructor(t){t||(t={}),this.main=t.main||"ss-main",this.placeholder=t.placeholder||"ss-placeholder",this.values=t.values||"ss-values",this.single=t.single||"ss-single",this.max=t.max||"ss-max",this.value=t.value||"ss-value",this.valueText=t.valueText||"ss-value-text",this.valueDelete=t.valueDelete||"ss-value-delete",this.valueOut=t.valueOut||"ss-value-out",this.deselect=t.deselect||"ss-deselect",this.deselectPath=t.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=t.arrow||"ss-arrow",this.arrowClose=t.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=t.arrowOpen||"M10,70 L50,30 L90,70",this.content=t.content||"ss-content",this.openAbove=t.openAbove||"ss-open-above",this.openBelow=t.openBelow||"ss-open-below",this.search=t.search||"ss-search",this.searchHighlighter=t.searchHighlighter||"ss-search-highlight",this.searching=t.searching||"ss-searching",this.addable=t.addable||"ss-addable",this.addablePath=t.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=t.list||"ss-list",this.optgroup=t.optgroup||"ss-optgroup",this.optgroupLabel=t.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=t.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=t.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=t.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=t.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=t.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=t.optgroupClosable||"ss-closable",this.option=t.option||"ss-option",this.optionDelete=t.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=t.highlighted||"ss-highlighted",this.open=t.open||"ss-open",this.close=t.close||"ss-close",this.selected=t.selected||"ss-selected",this.error=t.error||"ss-error",this.disabled=t.disabled||"ss-disabled",this.hide=t.hide||"ss-hide"}}function e(){return Math.random().toString(36).substring(2,10)}function s(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 i(t,e){return JSON.stringify(t)===JSON.stringify(e)}class n{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 a(e))}}class a{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.defaultSelected=void 0!==t.defaultSelected&&t.defaultSelected,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 l{constructor(t,e){this.selectType="single",this.data=[],this.selectedOrder=[],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 n||"label"in e){if(!("label"in e))return new Error("Optgroup must have a label");if("options"in e&&e.options)for(let t of e.options){const e=this.validateOption(t);if(e)return e}}else{if(!(e instanceof a||"text"in e))return new Error("Data object must be a valid optgroup or option");{const t=this.validateOption(e);if(t)return 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 n||"label"in t){let s=[];"options"in t&&t.options&&t.options.forEach((t=>{s.push(new a(t))})),s.length>0&&e.push(new n(t))}(t instanceof a||"text"in t)&&e.push(new a(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,e=!1){if(e){let e=[new a(t)];this.setData(e.concat(this.getData()))}else this.setData(this.getData().concat(new a(t)))}setSelectedBy(t,e){let s=null,i=!1;const l=[];for(let o of this.data){if(o instanceof n)for(let n of o.options)s||(s=n),n.selected=!i&&e.includes(n[t]),n.selected&&(l.push(n),"single"===this.selectType&&(i=!0));o instanceof a&&(s||(s=o),o.selected=!i&&e.includes(o[t]),o.selected&&(l.push(o),"single"===this.selectType&&(i=!0)))}"single"===this.selectType&&s&&!i&&(s.selected=!0,l.push(s));const o=e.map((e=>{var s;return(null===(s=l.find((s=>s[t]===e)))||void 0===s?void 0:s.id)||""}));this.selectedOrder=o}getSelected(){return this.getSelectedOptions().map((t=>t.id))}getSelectedValues(){return this.getSelectedOptions().map((t=>t.value))}getSelectedOptions(){return this.filter((t=>t.selected),!1)}getOptgroupByID(t){for(let e of this.data)if(e instanceof n&&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 n?t=e.options[0]:e instanceof a&&(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((i=>{if(i instanceof n){let l=[];if(i.options.forEach((i=>{t&&!t(i)||(e?l.push(new a(i)):s.push(new a(i)))})),l.length>0){let t=new n(i);t.options=l,s.push(t)}}i instanceof a&&(t&&!t(i)||s.push(new a(i)))})),s}selectedOrderOptions(t){const e=[];return this.selectedOrder.forEach((s=>{const i=t.find((t=>t.id===s));i&&e.push(i)})),t.forEach((t=>{let s=!1;e.forEach((e=>{t.id!==e.id||(s=!0)})),s||e.push(t)})),e}}class o{static getLiveAssertive(){let t=document.getElementById("ss-live-assertive");return t||(t=document.createElement("div"),t.id="ss-live-assertive",t.setAttribute("role","status"),t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true"),t.className="ss-sr-only",document.body.appendChild(t)),t}_announceAssertive(t){const e=o._liveAssertive||(o._liveAssertive=o.getLiveAssertive());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}constructor(t,e,s,i){var n;this.store=s,this.settings=t,this.classes=e,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes();const a=null===(n=document.querySelector(`[data-id="${this.settings.id}"]`))||void 0===n?void 0:n.closest(".offcanvas-body");a?a.appendChild(this.content.main):this.settings.contentLocation&&this.settings.contentLocation.appendChild(this.content.main)}static getLivePolite(){let t=document.getElementById("ss-live-polite");return t||(t=document.createElement("div"),t.id="ss-live-polite",t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.className="ss-sr-only",document.body.appendChild(t)),t}_announcePolite(t){const e=o._livePolite||(o._livePolite=o.getLivePolite());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}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)}"fixed"===this.settings.contentPosition&&(this.moveContent(),this.scrollHandler=()=>this.moveContent(),this.resizeHandler=()=>this.moveContent(),window.addEventListener("scroll",this.scrollHandler,!0),window.addEventListener("resize",this.resizeHandler)),this.searchFocus()}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),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=void 0),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=void 0),this.main.main.focus({preventScroll:!0}),this.main.main.removeAttribute("aria-activedescendant")}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.main.main.classList.add("ss-2"),this.content.main.classList.add(this.classes.content),this.content.main.classList.add("ss-content-2"),""!==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&&"fixed"!==this.settings.contentPosition||this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){this.content.list.setAttribute("role","listbox"),this.content.list.setAttribute("id",this.content.main.id+"-list"),this.content.list.setAttribute("aria-label",this.settings.contentAriaLabel),this.settings.isMultiple?this.content.list.setAttribute("aria-multiselectable","true"):this.content.list.removeAttribute("aria-multiselectable"),this.main.main.setAttribute("role","combobox"),this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.list.id),this.main.main.setAttribute("aria-expanded","false"),this.main.main.setAttribute("aria-autocomplete","list"),this.settings.ariaLabelledBy&&this.settings.ariaLabelledBy.trim()?(this.main.main.setAttribute("aria-labelledby",this.settings.ariaLabelledBy),this.main.main.removeAttribute("aria-label")):this.settings.ariaLabel&&this.settings.ariaLabel.trim()&&this.main.main.setAttribute("aria-label",this.settings.ariaLabel),this.main.main.setAttribute("aria-owns",this.content.list.id),this.content.search.input.setAttribute("aria-controls",this.content.list.id),this.content.search.input.setAttribute("aria-autocomplete","list")}mainDiv(){var t;const e=document.createElement("div");e.id=this.settings.id+"-main",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===t.key.length&&this.callbacks.open(),!0},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),i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("aria-label",this.settings.clearAllAriaLabel),i.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i.click())}));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"),a.setAttribute("aria-hidden","true"),a.setAttribute("focusable","false");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"),o.setAttribute("aria-hidden","true"),o.setAttribute("focusable","false");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()}this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e));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 i=this.store.getSelectedOptions(),l=i.filter((e=>e.selected&&e.id!==t.id),!0);if(!(this.settings.minSelected&&l.length{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),s.click())}}return e}contentDiv(){const t=document.createElement("div");t.id=this.settings.id+"-content";const e=this.searchDiv();t.appendChild(e.main);const s=this.listDiv();return t.appendChild(s),{main:t,search:e,list:s}}moveContent(){"relative"!==this.settings.contentPosition&&"down"!==this.settings.openPosition?"up"!==this.settings.openPosition?"up"===this.putContent()?this.moveContentAbove():this.moveContentBelow():this.moveContentAbove():this.moveContentBelow()}searchDiv(){const t=document.createElement("div"),e=document.createElement("input"),i=document.createElement("div");t.classList.add(this.classes.search);const n={main:t,input:e};if(this.settings.showSearch||(t.classList.add(this.classes.hide),e.readOnly=!0),e.type="search",e.placeholder=this.settings.searchPlaceholder,e.tabIndex=-1,this.settings.searchLabelledBy&&this.settings.searchLabelledBy.trim()?e.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel&&this.settings.searchAriaLabel.trim()?e.setAttribute("aria-label",this.settings.searchAriaLabel):e.setAttribute("aria-label","Search options"),e.setAttribute("autocapitalize","off"),e.setAttribute("autocomplete","off"),e.setAttribute("autocorrect","off"),e.oninput=s((t=>{this.callbacks.search(t.target.value)}),100),e.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" ":const e=this.content.list.querySelector("."+this.classes.highlighted);return!e||(e.click(),!1);case"Enter":if(this.callbacks.addable)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(e),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"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false");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 a(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=>{"string"==typeof t?s({text:t,value:t}):i instanceof Error?this.renderError(i.message):s(t)})):"string"==typeof i?s({text:i,value:i}):i instanceof Error?this.renderError(i.message):s(i))},t.appendChild(i),n.addable={main:i,svg:e,path:s}}return n}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.main.main.setAttribute("aria-activedescendant",a.id),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}const i=e["down"===t?0:e.length-1];i.classList.add(this.classes.highlighted),this.main.main.setAttribute("aria-activedescendant",i.id),this.ensureElementInView(this.content.list,i)}listDiv(){const t=document.createElement("div");return t.classList.add(this.classes.list),t}renderError(t){this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy");const e=document.createElement("div");e.classList.add(this.classes.error),e.textContent=t,this.content.list.appendChild(e),this._announceAssertive(t)}renderSearching(){this.content.list.innerHTML="",this.content.list.setAttribute("aria-busy","true");const t=document.createElement("div");t.classList.add(this.classes.searching),t.textContent=this.settings.searchingText,this.content.list.appendChild(t),this._announcePolite(this.settings.searchingText)}renderOptions(t){if(this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy"),0===t.length){const t=document.createElement("div");t.classList.add(this.classes.search);const e=this.callbacks.addable?this.settings.addableText.replace("{value}",this.content.search.input.value):this.settings.searchText;return this._announcePolite(e),t.innerHTML=e,this.content.list.appendChild(t),void this.content.list.setAttribute("aria-setsize","0")}if(this.settings.allowDeselect&&!this.settings.isMultiple){this.store.filter((t=>t.placeholder),!1).length||this.store.addOption(new a({text:"",value:"",selected:!1,placeholder:!0}),!0)}const e=document.createDocumentFragment();let s=0;const i=t.filter((t=>t instanceof a&&!t.placeholder&&t.display&&!t.disabled)).length,l=t=>{t.classList.contains(this.classes.placeholder)||t.classList.contains(this.classes.disabled)||t.classList.contains(this.classes.hide)||(t.setAttribute("aria-posinset",String(++s)),t.setAttribute("aria-setsize",String(i)))};for(const s of t){if(s instanceof n){const t=document.createElement("div");t.classList.add(this.classes.optgroup),t.setAttribute("role","group"),t.setAttribute("aria-label",s.label);const i=document.createElement("div");i.classList.add(this.classes.optgroupLabel),t.appendChild(i);const n=document.createElement("div");n.classList.add(this.classes.optgroupLabelText),n.textContent=s.label,i.appendChild(n);const a=document.createElement("div");if(a.classList.add(this.classes.optgroupActions),i.appendChild(a),this.settings.isMultiple&&s.selectAll){const t=document.createElement("div");t.classList.add(this.classes.optgroupSelectAll);let e=!0;for(const t of s.options)if(!t.selected){e=!1;break}e&&t.classList.add(this.classes.selected);const i=document.createElement("span");i.textContent=s.selectAllText,t.appendChild(i);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),t.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.optgroupSelectAllBox),n.appendChild(l);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.optgroupSelectAllCheck),n.appendChild(o),t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const i=this.store.getSelected();if(e){const t=i.filter((t=>{for(const e of s.options)if(t===e.id)return!1;return!0}));this.callbacks.setSelected(t,!0)}else{const t=i.concat(s.options.map((t=>t.id)));for(const t of s.options)this.store.getOptionByID(t.id)||this.callbacks.addOption(t);this.callbacks.setSelected(t,!0)}})),a.appendChild(t)}if("off"!==s.closable){const e=document.createElement("div");e.classList.add(this.classes.optgroupClosable);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.classList.add(this.classes.arrow),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),e.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","path");n.appendChild(l),s.options.some((t=>t.selected))||""!==this.content.search.input.value.trim()||"open"===s.closable?(t.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"close"===s.closable&&(t.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose)),i.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))})),a.appendChild(e)}t.appendChild(i);for(const e of s.options){const s=this.option(e);l(s),t.appendChild(s)}e.appendChild(t)}if(s instanceof a){const t=this.option(s);l(t),e.appendChild(t)}}this.content.list.appendChild(e),this.content.list.removeAttribute("aria-busy");const o=this.getOptions(!0,!0,!0).length;this._announcePolite(`${o} option${1===o?"":"s"} available`)}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=`${this.settings.id}__opt__${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),e.setAttribute("aria-disabled","true")),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=[];if(this.settings.isMultiple)if(t.selected)o=l.filter((t=>t.id!==n));else if(o=l.concat(t),!this.settings.closeOnSelect)if(e.shiftKey&&this.lastSelectedOption){const e=this.store.getDataOptions();let s=e.findIndex((t=>t.id===this.lastSelectedOption.id)),i=e.findIndex((e=>e.id===t.id));if(s>=0&&i>=0){const t=Math.min(s,i),n=Math.max(s,i),a=e.slice(t,n+1);a.length>0&&a.length!l.find((e=>e.id===t.id))))))}}else t.selected||(this.lastSelectedOption=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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=s.left+("fixed"===this.settings.contentPosition?0: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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=t.left+("fixed"===this.settings.contentPosition?0: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)}}o._livePolite=null,o._liveAssertive=null;class c{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){if(n.target===this.select&&("disabled"===n.attributeName&&(s=!0),"class"===n.attributeName&&(e=!0),"childList"===n.type)){for(const t of n.addedNodes)if("OPTION"===t.nodeName&&t.value===this.select.value){this.select.dispatchEvent(new Event("change"));break}i=!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:"",defaultSelected:t.defaultSelected,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)}setSelectedByValue(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.value)}}if("OPTION"===s.nodeName){const e=s;e.selected=t.includes(e.value)}}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 n&&this.select.appendChild(this.createOptgroup(e)),e instanceof a&&this.select.appendChild(this.createOption(e));this.select.dispatchEvent(new Event("change",{bubbles:!0})),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.textContent=t.text,""!==t.html&&e.setAttribute("data-html",t.html),e.defaultSelected=t.defaultSelected,e.selected=t.selected,t.disabled&&(e.disabled=!0),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 r{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.focusSearch=void 0===t.focusSearch||t.focusSearch,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.contentAriaLabel=void 0!==t.contentAriaLabel?t.contentAriaLabel:"Select an option",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",this.addableText=t.addableText||'Press "Enter" to add {value}',this.ariaLabelledBy=t.ariaLabelledBy||"",this.searchAriaLabel=t.searchAriaLabel||"Search options",this.searchLabelledBy=t.searchLabelledBy||"",this.clearAllAriaLabel=t.clearAllAriaLabel||"Clear selection"}}return class{constructor(e){var i;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=s((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.windowScroll=s((()=>{(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 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 r(e.settings),this.cssClasses=new t(e.cssClasses);const n=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const t in e.events)e.events.hasOwnProperty(t)&&(-1!==n.indexOf(t)?this.events[t]=s(e.events[t],100):this.events[t]=e.events[t]);this.settings.disabled=(null===(i=e.settings)||void 0===i?void 0:i.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 c(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 l(this.settings.isMultiple?"multiple":"single",e.data?e.data:this.select.getData()),e.data&&this.select.updateOptions(this.store.getData());const a={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 o(this.settings,this.cssClasses,this.store,a),this.render.renderValues(),this.render.renderOptions(this.store.getData());const h=this.selectEl.getAttribute("aria-label"),d=this.selectEl.getAttribute("aria-labelledby");h?this.render.main.main.setAttribute("aria-label",h):d&&this.render.main.main.setAttribute("aria-labelledby",d),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(),s=this.store.validateDataArray(t);if(s)return void(this.events.error&&this.events.error(s));this.store.setData(t);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!i(e,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let t=this.store.getSelectedOptions();return this.settings.keepOrder&&(t=this.store.selectedOrderOptions(t)),t.map((t=>t.value))}setSelected(t,e=!0){const s=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&&!i(s,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 s=this.store.getData();this.select.updateOptions(s),this.render.renderValues(),this.render.renderOptions(s),this.events.afterChange&&!i(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.settings.focusSearch&&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.css b/docs/assets/index.css index 132b2b98..dfe1f224 100644 --- a/docs/assets/index.css +++ b/docs/assets/index.css @@ -1 +1 @@ -@import"https://fonts.googleapis.com/css?family=Montserrat:300,400,700";code[class*=language-],pre[class*=language-]{color:#f8f8f2;background:none;text-shadow:0 1px rgba(0,0,0,.3);font-family:Consolas,Monaco,Andale Mono,Ubuntu Mono,monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto;border-radius:.3em}:not(pre)>code[class*=language-],pre[class*=language-]{background:#272822}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}.token.comment,.token.prolog,.token.doctype,.token.cdata{color:#8292a2}.token.punctuation{color:#f8f8f2}.token.namespace{opacity:.7}.token.property,.token.tag,.token.constant,.token.symbol,.token.deleted{color:#f92672}.token.boolean,.token.number{color:#ae81ff}.token.selector,.token.attr-name,.token.string,.token.char,.token.builtin,.token.inserted{color:#a6e22e}.token.operator,.token.entity,.token.url,.language-css .token.string,.style .token.string,.token.variable{color:#f8f8f2}.token.atrule,.token.attr-value,.token.function,.token.class-name{color:#e6db74}.token.keyword{color:#66d9ef}.token.regex,.token.important{color:#fd971f}.token.important,.token.bold{font-weight:700}.token.entity{cursor:help}:root{--color-primary: #5897fb;--color-secondary: #666666;--color-header-bg: #ffffff;--color-border: #dcdee2;--color-font: #66666;--color-white: #ffffff;--color-alert-info: #cfe2ff;--color-alert-info-border: #b6d4fe;--color-ads-background: #7cadfa;--width-max: 1000px;--height-header: 90px;--width-nav: 200px;--height-nav: 30px;--border-radius: 4px;--font-size: 14px;--spacing: 16px;--spacing-half: 8px;--spacing-quarter: 4px}html{height:100%;padding:0;margin:0;background-color:var(--color-primary)}body{font-family:Montserrat,sans-serif,Helvetica;font-size:var(--font-size);color:var(--color-font);width:100%;padding:0;margin:0}body #app{display:grid;grid-template-columns:var(--width-nav) 1fr;grid-template-rows:calc(var(--height-header) + var(--spacing-half)) 1fr;grid-template-areas:"header header" "nav main";width:100%;max-width:var(--width-max);height:100%;padding:0;margin:0 auto;overflow-x:hidden;box-sizing:border-box}@media (max-width: 700px){body #app{grid-template-columns:1fr;grid-template-rows:calc(var(--height-header) - var(--height-nav) + var(--spacing-half)) var(--height-nav) 1fr;grid-template-areas:"header" "nav" "main"}}body #app>*{box-sizing:border-box}body #app header{position:fixed;top:0;grid-area:header;display:flex;flex-direction:column;justify-content:flex-end;color:var(--color-white);height:var(--height-header);width:100%;max-width:var(--width-max);margin:0;padding:var(--spacing-half) 0 0 0;z-index:100000;background-color:var(--color-primary)}@media (max-width: 700px){body #app header{height:calc(var(--height-header) - var(--height-nav))}}body #app header .top{display:flex;flex-direction:row;justify-content:space-between;padding:0 0 var(--spacing-half) 0}body #app header .top .text{flex:1 1 auto;color:var(--color-font)}body #app header .top .text .logo{line-height:1;font-size:40px;font-weight:300;padding:0;margin:0}body #app header .top .socials{flex:0 1 auto;display:flex;justify-content:flex-end;gap:var(--spacing-half);color:var(--color-font);margin:0 auto;padding:var(--spacing-half) 0 0 0}body #app header .top .socials a,body #app header .top .socials img{height:30px}body #app header .bar{display:flex;flex-direction:row;justify-content:space-between;height:var(--height-nav);border:solid 1.5px var(--color-white)}@media (max-width: 700px){body #app header .bar{display:none}}body #app header .bar .tagline{flex:1 1 auto;display:inline-flex;justify-content:flex-start;align-items:center;line-height:1;font-size:16px;padding:var(--spacing-quarter) var(--spacing-quarter) var(--spacing-quarter) var(--spacing-half);margin:0 auto}body #app header .bar .drop{display:flex;flex:0 1 auto;border-left:solid 1.5px var(--color-white);margin:auto var(--spacing-quarter) auto var(--spacing-quarter);padding:0 var(--spacing-quarter) 0 var(--spacing-half)}body #app header .bar .drop svg{display:flex;align-items:center;justify-content:flex-end;flex:0 1 auto;height:12px;width:12px;margin:0 auto}body #app header .bar .drop svg path{fill:none;stroke:var(--color-white);stroke-width:18;stroke-linecap:round;stroke-linejoin:round}body #app nav{position:fixed;grid-area:nav;display:flex;flex-direction:column;top:calc(var(--height-header) + var(--spacing-half));width:var(--width-nav);max-width:var(--width-max);max-height:calc(100vh - var(--height-header) - var(--spacing));overflow:hidden;z-index:100000}@media (max-width: 700px){body #app nav{top:calc(var(--height-header) - var(--height-nav));height:auto;width:100%}}body #app nav .ss-main{flex:0 1 auto;height:var(--height-nav);font-weight:700}body #app nav .nav-content{flex:1 1 auto;overflow:hidden;padding:0 0 var(--spacing-half) 0}@media (max-width: 700px){body #app nav .nav-content{display:none}}body #app nav .nav-content .ss-content{max-height:calc(100vh - var(--height-header) - var(--height-nav) - 200px)}body #app nav .nav-content .ss-content .label{font-weight:700}body #app main{grid-area:main;display:flex;flex-direction:column;gap:var(--spacing-half);padding:0 0 0 var(--spacing);overflow:auto}@media (max-width: 700px){body #app main{padding:0}}body #app main .contents{display:flex;flex-direction:column;gap:var(--spacing)}body #app main .content{flex:1 1 auto;padding:var(--spacing);background-color:var(--color-white);border-radius:var(--border-radius)}@media screen and (max-width: 700px){body #app main .content{box-shadow:none}}body #app main .content .row{display:flex;flex-direction:row;gap:var(--spacing-half)}body #app main .content .row>*{flex:1 1 auto}body #app main .content .row .btn{flex:0 1 auto}body #app main footer{grid-area:footer;color:var(--color-white);padding:var(--spacing-quarter) 0 var(--spacing-quarter) 0;line-height:1.2;font-size:calc(var(--font-size) - 2px);text-align:center}body #app main footer a{color:var(--color-font)}code[class*=language-],pre[class*=language-]{color:#a9b7c6;font-family:Consolas,Monaco,Andale Mono,monospace;direction:ltr;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;line-height:1.5;border-radius:4px;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*=language-]::-moz-selection,pre[class*=language-] ::-moz-selection,code[class*=language-]::-moz-selection,code[class*=language-] ::-moz-selection{color:inherit;background:#214283d9}pre[class*=language-]::selection,pre[class*=language-] ::selection,code[class*=language-]::selection,code[class*=language-] ::selection{color:inherit;background:#214283d9}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*=language-],pre[class*=language-]{background:#2b2b2b}:not(pre)>code[class*=language-]{padding:.1em;border-radius:2px}.token.comment,.token.prolog,.token.cdata{color:gray}.token.delimiter,.token.boolean,.token.keyword,.token.selector,.token.important,.token.atrule{color:#cc7832}.token.operator,.token.punctuation,.token.attr-name{color:#a9b7c6}.token.tag,.token.tag .punctuation,.token.doctype,.token.builtin{color:#e8bf6a}.token.entity,.token.number,.token.symbol{color:#6897bb}.token.property,.token.constant,.token.variable{color:#9876aa}.token.string,.token.char{color:#6a8759}.token.attr-value,.token.attr-value .punctuation{color:#a5c261}.token.attr-value .punctuation:first-child{color:#a9b7c6}.token.url{color:#287bde;text-decoration:underline}.token.function{color:#ffc66d}.token.regex{background:#364135}.token.bold{font-weight:700}.token.italic{font-style:italic}.token.inserted{background:#294436}.token.deleted{background:#484a4a}code.language-css .token.property,code.language-css .token.property+.token.punctuation{color:#a9b7c6}code.language-css .token.id{color:#ffc66d}code.language-css .token.selector>.token.class,code.language-css .token.selector>.token.attribute,code.language-css .token.selector>.token.pseudo-class,code.language-css .token.selector>.token.pseudo-element{color:#ffc66d}h1{font-size:40px;margin:0 0 var(--spacing-half) 0;padding:0 0 var(--spacing-quarter) 0}h2{font-size:32px;margin:0 0 var(--spacing-half) 0;padding:0 0 var(--spacing-quarter) 0}h2 .header{border-bottom:solid 1px var(--color-border)}h3{font-size:24px;margin:0 0 var(--spacing-half) 0;padding:0 0 var(--spacing-quarter) 0}h4{font-size:20px;margin:0 0 var(--spacing-half) 0;padding:0 0 var(--spacing-quarter) 0}h5{font-size:16px;margin:0 0 var(--spacing-half) 0;padding:0 0 var(--spacing-quarter) 0}a{color:var(--primary-color)}a:hover{color:var(--color-secondary)}p{margin:0 0 var(--spacing-half) 0}.separator{height:1px;width:100%;margin:var(--spacing-half) 0 var(--spacing-half) 0;background-color:var(--color-border)}.separator.vertical{width:1px;height:100%;margin:0 var(--spacing-half) 0 var(--spacing-half)}.bold{font-weight:700}.pad-s{padding:var(--spacing-quarter)}.pad-t-s{padding-top:var(--spacing-quarter)}.pad-r-s{padding-right:var(--spacing-quarter)}.pad-b-s{padding-bottom:var(--spacing-quarter)}.pad-l-s{padding-left:var(--spacing-quarter)}.pad-m{padding:var(--spacing-half)}.pad-t-m{padding-top:var(--spacing-half)}.pad-r-m{padding-right:var(--spacing-half)}.pad-b-m{padding-bottom:var(--spacing-half)}.pad-l-m{padding-left:var(--spacing-half)}.pad-l{padding:var(--spacing)}.pad-t-l{padding-top:var(--spacing)}.pad-r-l{padding-right:var(--spacing)}.pad-b-l{padding-bottom:var(--spacing)}.pad-l-l{padding-left:var(--spacing)}.mar-s{margin:var(--spacing-quarter)}.mar-t-s{margin-top:var(--spacing-quarter)}.mar-r-s{margin-right:var(--spacing-quarter)}.mar-b-s{margin-bottom:var(--spacing-quarter)}.mar-l-s{margin-left:var(--spacing-quarter)}.mar-m{margin:var(--spacing-half)}.mar-t-m{margin-top:var(--spacing-half)}.mar-r-m{margin-right:var(--spacing-half)}.mar-b-m{margin-bottom:var(--spacing-half)}.mar-l-m{margin-left:var(--spacing-half)}.mar-l{margin:var(--spacing)}.mar-t-l{margin-top:var(--spacing)}.mar-r-l{margin-right:var(--spacing)}.mar-b-l{margin-bottom:var(--spacing)}.mar-l-l{margin-left:var(--spacing)}.sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;clip:rect(0,0,0,0);clip-path:inset(50%);overflow:hidden}.fade-enter-active,.fade-leave-active{transition:opacity .3s ease-in-out}.fade-enter,.fade-leave-to{opacity:0}button,.btn{display:inline-flex;align-items:center;color:var(--color-white);height:30px;width:auto;max-width:100%;min-width:auto;padding:0 var(--spacing-half) 0 var(--spacing-half);cursor:pointer;background-color:var(--color-primary);text-align:center;line-height:18px;-webkit-user-select:none;user-select:none;white-space:nowrap;border-radius:var(--border-radius);vertical-align:middle;box-shadow:0 0 0 1px transparent inset,0 0 #22242626 inset;box-sizing:content-box;border:0}input{color:var(--color-font)}.alert{position:relative;color:var(--color-font);padding:var(--spacing-half) var(--spacing);margin:0 0 var(--spacing-half) 0;border-radius:var(--border-radius)}.alert.info{background-color:var(--color-alert-info);border-color:var(--color-alert-info-border)}:root{--ss-primary-color: #5897fb;--ss-bg-color: #ffffff;--ss-font-color: #4d4d4d;--ss-font-placeholder-color: #8d8d8d;--ss-disabled-color: #dcdee2;--ss-border-color: #dcdee2;--ss-highlight-color: #fffb8c;--ss-success-color: #00b755;--ss-error-color: #dc3545;--ss-focus-color: #5897fb;--ss-main-height: 30px;--ss-content-height: 300px;--ss-spacing-l: 7px;--ss-spacing-m: 5px;--ss-spacing-s: 3px;--ss-animation-timing: .2s;--ss-border-radius: 4px}@keyframes ss-valueIn{0%{transform:scale(0);opacity:0}to{transform:scale(1);opacity:1}}@keyframes ss-valueOut{0%{transform:scale(1);opacity:1}to{transform:scale(0);opacity:0}}.ss-hide{display:none!important}.ss-main.ss-2{display:flex;flex-direction:row;position:relative;-webkit-user-select:none;user-select:none;color:var(--ss-font-color);min-height:var(--ss-main-height);width:100%;padding:var(--ss-spacing-s);cursor:pointer;border:1px solid var(--ss-border-color);border-radius:var(--ss-border-radius);background-color:var(--ss-bg-color);outline:0;box-sizing:border-box;transition:background-color var(--ss-animation-timing);overflow:hidden}.ss-main.ss-2:focus{box-shadow:0 0 5px var(--ss-focus-color)}.ss-main.ss-2.ss-disabled{background-color:var(--ss-disabled-color);cursor:not-allowed}.ss-main.ss-2.ss-disabled .ss-values .ss-disabled{color:var(--ss-font-color)}.ss-main.ss-2.ss-disabled .ss-values .ss-value .ss-value-delete{cursor:not-allowed}.ss-main.ss-2.ss-open-above{border-top-left-radius:0;border-top-right-radius:0}.ss-main.ss-2.ss-open-below{border-bottom-left-radius:0;border-bottom-right-radius:0}.ss-main.ss-2 .ss-values{display:inline-flex;flex-wrap:wrap;gap:var(--ss-spacing-m);flex:1 1 100%}.ss-main.ss-2 .ss-values .ss-placeholder{display:flex;padding:var(--ss-spacing-s) var(--ss-spacing-m) var(--ss-spacing-s) var(--ss-spacing-m);margin:auto 0;line-height:1em;align-items:center;width:100%;color:var(--ss-font-placeholder-color);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ss-main.ss-2 .ss-values .ss-max{display:flex;-webkit-user-select:none;user-select:none;align-items:center;width:fit-content;font-size:12px;color:var(--ss-bg-color);line-height:1;padding:var(--ss-spacing-s) var(--ss-spacing-m);background-color:var(--ss-primary-color);border-radius:var(--ss-border-radius)}.ss-main.ss-2 .ss-values .ss-single{display:flex;margin:auto 0px auto var(--ss-spacing-s)}.ss-main.ss-2 .ss-values .ss-value{display:flex;-webkit-user-select:none;user-select:none;align-items:center;width:fit-content;background-color:var(--ss-primary-color);border-radius:var(--ss-border-radius);animation-name:ss-valueIn;animation-duration:var(--ss-animation-timing);animation-timing-function:ease-out;animation-fill-mode:both}.ss-main.ss-2 .ss-values .ss-value.ss-value-out{animation-name:ss-valueOut;animation-duration:var(--ss-animation-timing);animation-timing-function:ease-out}.ss-main.ss-2 .ss-values .ss-value .ss-value-text{font-size:12px;color:var(--ss-bg-color);line-height:1;padding:var(--ss-spacing-s) var(--ss-spacing-m)}.ss-main.ss-2 .ss-values .ss-value .ss-value-delete{display:flex;align-items:center;height:var(--ss-spacing-l);width:var(--ss-spacing-l);padding:var(--ss-spacing-s) var(--ss-spacing-m);cursor:pointer;border-left:solid 1px var(--ss-bg-color);box-sizing:content-box}.ss-main.ss-2 .ss-values .ss-value .ss-value-delete svg{height:var(--ss-spacing-l);width:var(--ss-spacing-l)}.ss-main.ss-2 .ss-values .ss-value .ss-value-delete svg path{fill:none;stroke:var(--ss-bg-color);stroke-width:18;stroke-linecap:round;stroke-linejoin:round}.ss-main.ss-2 .ss-deselect{flex:0 1 auto;display:flex;align-items:center;justify-content:center;width:fit-content;height:auto;padding:0 var(--ss-spacing-m) 0 var(--ss-spacing-m)}.ss-main.ss-2 .ss-deselect svg{width:8px;height:8px}.ss-main.ss-2 .ss-deselect svg path{fill:none;stroke:var(--ss-font-color);stroke-width:20;stroke-linecap:round;stroke-linejoin:round}.ss-main.ss-2 .ss-arrow{flex:0 1 auto;display:flex;align-items:center;justify-content:flex-end;width:12px;height:12px;margin:auto var(--ss-spacing-m) auto var(--ss-spacing-m)}.ss-main.ss-2 .ss-arrow path{fill:none;stroke:var(--ss-font-color);stroke-width:18;stroke-linecap:round;stroke-linejoin:round;transition-timing-function:ease-out;transition:var(--ss-animation-timing)}.ss-content{position:absolute;display:flex;height:auto;flex-direction:column;width:auto;max-height:var(--ss-content-height);box-sizing:border-box;border:solid 1px var(--ss-border-color);background-color:var(--ss-bg-color);transition:transform var(--ss-animation-timing),opacity var(--ss-animation-timing);opacity:0;transform:scaleY(0);transform-origin:center top;overflow:hidden;z-index:10000}.ss-content.ss-relative{position:relative;height:100%}.ss-content.ss-fixed{position:fixed}.ss-content.ss-open-above{flex-direction:column-reverse;opacity:1;transform:scaleY(1);transform-origin:center bottom;border-top-left-radius:var(--ss-border-radius);border-top-right-radius:var(--ss-border-radius)}.ss-content.ss-open-below{opacity:1;transform:scaleY(1);transform-origin:center top;border-bottom-left-radius:var(--ss-border-radius);border-bottom-right-radius:var(--ss-border-radius)}.ss-content .ss-search{flex:0 1 auto;display:flex;flex-direction:row;padding:var(--ss-spacing-l) var(--ss-spacing-l) var(--ss-spacing-m) var(--ss-spacing-l)}.ss-content .ss-search input{display:inline-flex;font-size:inherit;line-height:inherit;flex:1 1 auto;width:100%;min-width:0px;padding:var(--ss-spacing-m) var(--ss-spacing-l);margin:0;border:1px solid var(--ss-border-color);border-radius:var(--ss-border-radius);background-color:var(--ss-bg-color);outline:0;text-align:left;box-sizing:border-box}.ss-content .ss-search input::placeholder{color:var(--ss-font-placeholder-color);vertical-align:middle}.ss-content .ss-search input:focus{box-shadow:0 0 5px var(--ss-focus-color)}.ss-content .ss-search .ss-addable{display:inline-flex;justify-content:center;align-items:center;cursor:pointer;flex:0 0 auto;height:auto;margin:0 0 0 var(--ss-spacing-m);border:1px solid var(--ss-border-color);border-radius:var(--ss-border-radius)}.ss-content .ss-search .ss-addable svg{display:flex;align-items:center;justify-content:flex-end;flex:0 1 auto;width:12px;height:12px;margin:auto var(--ss-spacing-m) auto var(--ss-spacing-m)}.ss-content .ss-search .ss-addable svg path{fill:none;stroke:var(--ss-font-color);stroke-width:18;stroke-linecap:round;stroke-linejoin:round}.ss-content .ss-list{flex:1 1 auto;height:auto;overflow-x:hidden;overflow-y:auto}.ss-content .ss-list .ss-error{color:var(--ss-error-color);padding:var(--ss-spacing-l)}.ss-content .ss-list .ss-searching{color:var(--ss-font-color);padding:var(--ss-spacing-l)}.ss-content .ss-list .ss-optgroup.ss-close .ss-option{display:none!important}.ss-content .ss-list .ss-optgroup .ss-optgroup-label{display:flex;flex-direction:row;align-items:center;justify-content:space-between;padding:var(--ss-spacing-m) var(--ss-spacing-l) var(--ss-spacing-m) var(--ss-spacing-l)}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-label-text{flex:1 1 auto;font-weight:700;color:var(--ss-font-color)}.ss-content .ss-list .ss-optgroup .ss-optgroup-label:has(.ss-arrow){cursor:pointer}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions{flex:0 1 auto;display:flex;flex-direction:row;align-items:center;justify-content:center;gap:var(--ss-spacing-m)}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall{flex:0 0 auto;display:flex;flex-direction:row;cursor:pointer}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall:hover{opacity:.5}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall.ss-selected svg path{stroke:var(--ss-error-color)}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall span{flex:0 1 auto;display:flex;align-items:center;justify-content:center;font-size:60%;text-align:center;padding:0 var(--ss-spacing-s) 0 0}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall svg{flex:0 1 auto;width:13px;height:13px}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall svg path{fill:none;stroke:var(--ss-success-color);stroke-linecap:round;stroke-linejoin:round}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall svg:first-child{stroke-width:5}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall svg:last-child{stroke-width:11}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-closable{flex:0 1 auto;display:flex;flex-direction:row;cursor:pointer}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-closable .ss-arrow{flex:1 1 auto;width:10px;height:10px}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-closable .ss-arrow path{fill:none;stroke:var(--ss-font-color);stroke-width:18;stroke-linecap:round;stroke-linejoin:round;transition-timing-function:ease-out;transition:var(--ss-animation-timing)}.ss-content .ss-list .ss-optgroup .ss-option{padding:var(--ss-spacing-s) var(--ss-spacing-s) var(--ss-spacing-s) calc(var(--ss-spacing-l) * 3)}.ss-content .ss-list .ss-option{display:block;padding:var(--ss-spacing-m) var(--ss-spacing-l) var(--ss-spacing-m) var(--ss-spacing-l);white-space:normal;color:var(--ss-font-color);cursor:pointer;-webkit-user-select:none;user-select:none}.ss-content .ss-list .ss-option:hover{color:var(--ss-bg-color);background-color:var(--ss-primary-color)}.ss-content .ss-list .ss-option.ss-highlighted,.ss-content .ss-list .ss-option:not(.ss-disabled).ss-selected{color:var(--ss-bg-color);background-color:var(--ss-primary-color)}.ss-content .ss-list .ss-option.ss-disabled{cursor:not-allowed;background-color:var(--ss-disabled-color)}.ss-content .ss-list .ss-option.ss-disabled:hover{color:var(--ss-font-color)}.ss-content .ss-list .ss-option .ss-search-highlight{display:inline-block;background-color:var(--ss-highlight-color)}.ss-main.error,.ss-content.error{border:solid 1px red!important;color:red!important}.carbon-container #carbonads *{margin:initial;padding:initial}.carbon-container #carbonads{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,Helvetica,Arial,sans-serif}.carbon-container #carbonads{display:flex;max-width:100%;background-color:var(--color-ads-background);box-shadow:none;z-index:100}.carbon-container #carbonads a{color:inherit;text-decoration:none}.carbon-container #carbonads a:hover{color:inherit}.carbon-container #carbonads span{position:relative;display:block;overflow:hidden}.carbon-container #carbonads .carbon-wrap{display:flex;flex-direction:column}.carbon-container #carbonads .carbon-img{display:block;margin-bottom:0;line-height:1}.carbon-container #carbonads .carbon-img img{display:block}.carbon-container #carbonads .carbon-text{font-size:12px;padding:var(--spacing-quarter);margin-bottom:16px;line-height:1.5;text-align:left}.carbon-container #carbonads .carbon-poweredby{display:block;padding:var(--spacing-quarter);background:#f1f1f2;text-align:center;text-transform:uppercase;letter-spacing:.5px;font-weight:600;font-size:8px;line-height:1;border-top-left-radius:3px;position:absolute;bottom:0;right:0} +@import"https://fonts.googleapis.com/css?family=Montserrat:300,400,700";code[class*=language-],pre[class*=language-]{color:#f8f8f2;background:none;text-shadow:0 1px rgba(0,0,0,.3);font-family:Consolas,Monaco,Andale Mono,Ubuntu Mono,monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto;border-radius:.3em}:not(pre)>code[class*=language-],pre[class*=language-]{background:#272822}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}.token.comment,.token.prolog,.token.doctype,.token.cdata{color:#8292a2}.token.punctuation{color:#f8f8f2}.token.namespace{opacity:.7}.token.property,.token.tag,.token.constant,.token.symbol,.token.deleted{color:#f92672}.token.boolean,.token.number{color:#ae81ff}.token.selector,.token.attr-name,.token.string,.token.char,.token.builtin,.token.inserted{color:#a6e22e}.token.operator,.token.entity,.token.url,.language-css .token.string,.style .token.string,.token.variable{color:#f8f8f2}.token.atrule,.token.attr-value,.token.function,.token.class-name{color:#e6db74}.token.keyword{color:#66d9ef}.token.regex,.token.important{color:#fd971f}.token.important,.token.bold{font-weight:700}.token.entity{cursor:help}:root{--color-primary: #5897fb;--color-secondary: #666666;--color-header-bg: #ffffff;--color-border: #dcdee2;--color-font: #66666;--color-white: #ffffff;--color-alert-info: #cfe2ff;--color-alert-info-border: #b6d4fe;--color-ads-background: #7cadfa;--width-max: 1000px;--height-header: 90px;--width-nav: 200px;--height-nav: 30px;--border-radius: 4px;--font-size: 14px;--spacing: 16px;--spacing-half: 8px;--spacing-quarter: 4px}html{height:100%;padding:0;margin:0;background-color:var(--color-primary)}body{font-family:Montserrat,sans-serif,Helvetica;font-size:var(--font-size);color:var(--color-font);width:100%;padding:0;margin:0}body #app{display:grid;grid-template-columns:var(--width-nav) 1fr;grid-template-rows:calc(var(--height-header) + var(--spacing-half)) 1fr;grid-template-areas:"header header" "nav main";width:100%;max-width:var(--width-max);height:100%;padding:0;margin:0 auto;overflow-x:hidden;box-sizing:border-box}@media (max-width: 700px){body #app{grid-template-columns:1fr;grid-template-rows:calc(var(--height-header) - var(--height-nav) + var(--spacing-half)) var(--height-nav) 1fr;grid-template-areas:"header" "nav" "main"}}body #app>*{box-sizing:border-box}body #app header{position:fixed;top:0;grid-area:header;display:flex;flex-direction:column;justify-content:flex-end;color:var(--color-white);height:var(--height-header);width:100%;max-width:var(--width-max);margin:0;padding:var(--spacing-half) 0 0 0;z-index:100000;background-color:var(--color-primary)}@media (max-width: 700px){body #app header{height:calc(var(--height-header) - var(--height-nav))}}body #app header .top{display:flex;flex-direction:row;justify-content:space-between;padding:0 0 var(--spacing-half) 0}body #app header .top .text{flex:1 1 auto;color:var(--color-font)}body #app header .top .text .logo{line-height:1;font-size:40px;font-weight:300;padding:0;margin:0}body #app header .top .socials{flex:0 1 auto;display:flex;justify-content:flex-end;gap:var(--spacing-half);color:var(--color-font);margin:0 auto;padding:var(--spacing-half) 0 0 0}body #app header .top .socials a,body #app header .top .socials img{height:30px}body #app header .bar{display:flex;flex-direction:row;justify-content:space-between;height:var(--height-nav);border:solid 1.5px var(--color-white)}@media (max-width: 700px){body #app header .bar{display:none}}body #app header .bar .tagline{flex:1 1 auto;display:inline-flex;justify-content:flex-start;align-items:center;line-height:1;font-size:16px;padding:var(--spacing-quarter) var(--spacing-quarter) var(--spacing-quarter) var(--spacing-half);margin:0 auto}body #app header .bar .drop{display:flex;flex:0 1 auto;border-left:solid 1.5px var(--color-white);margin:auto var(--spacing-quarter) auto var(--spacing-quarter);padding:0 var(--spacing-quarter) 0 var(--spacing-half)}body #app header .bar .drop svg{display:flex;align-items:center;justify-content:flex-end;flex:0 1 auto;height:12px;width:12px;margin:0 auto}body #app header .bar .drop svg path{fill:none;stroke:var(--color-white);stroke-width:18;stroke-linecap:round;stroke-linejoin:round}body #app nav{position:fixed;grid-area:nav;display:flex;flex-direction:column;top:calc(var(--height-header) + var(--spacing-half));width:var(--width-nav);max-width:var(--width-max);max-height:calc(100vh - var(--height-header) - var(--spacing));overflow:hidden;z-index:100000}@media (max-width: 700px){body #app nav{top:calc(var(--height-header) - var(--height-nav));height:auto;width:100%}}body #app nav .ss-main{flex:0 1 auto;height:var(--height-nav);font-weight:700}body #app nav .nav-content{flex:1 1 auto;overflow:hidden;padding:0 0 var(--spacing-half) 0}@media (max-width: 700px){body #app nav .nav-content{display:none}}body #app nav .nav-content .ss-content{max-height:calc(100vh - var(--height-header) - var(--height-nav) - 200px)}body #app nav .nav-content .ss-content .label{font-weight:700}body #app main{grid-area:main;display:flex;flex-direction:column;gap:var(--spacing-half);padding:0 0 0 var(--spacing);overflow:auto}@media (max-width: 700px){body #app main{padding:0}}body #app main .contents{display:flex;flex-direction:column;gap:var(--spacing)}body #app main .content{flex:1 1 auto;padding:var(--spacing);background-color:var(--color-white);border-radius:var(--border-radius)}@media screen and (max-width: 700px){body #app main .content{box-shadow:none}}body #app main .content .row{display:flex;flex-direction:row;gap:var(--spacing-half)}body #app main .content .row>*{flex:1 1 auto}body #app main .content .row .btn{flex:0 1 auto}body #app main footer{grid-area:footer;color:var(--color-white);padding:var(--spacing-quarter) 0 var(--spacing-quarter) 0;line-height:1.2;font-size:calc(var(--font-size) - 2px);text-align:center}body #app main footer a{color:var(--color-font)}code[class*=language-],pre[class*=language-]{color:#a9b7c6;font-family:Consolas,Monaco,Andale Mono,monospace;direction:ltr;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;line-height:1.5;border-radius:4px;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*=language-]::-moz-selection,pre[class*=language-] ::-moz-selection,code[class*=language-]::-moz-selection,code[class*=language-] ::-moz-selection{color:inherit;background:#214283d9}pre[class*=language-]::selection,pre[class*=language-] ::selection,code[class*=language-]::selection,code[class*=language-] ::selection{color:inherit;background:#214283d9}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*=language-],pre[class*=language-]{background:#2b2b2b}:not(pre)>code[class*=language-]{padding:.1em;border-radius:2px}.token.comment,.token.prolog,.token.cdata{color:gray}.token.delimiter,.token.boolean,.token.keyword,.token.selector,.token.important,.token.atrule{color:#cc7832}.token.operator,.token.punctuation,.token.attr-name{color:#a9b7c6}.token.tag,.token.tag .punctuation,.token.doctype,.token.builtin{color:#e8bf6a}.token.entity,.token.number,.token.symbol{color:#6897bb}.token.property,.token.constant,.token.variable{color:#9876aa}.token.string,.token.char{color:#6a8759}.token.attr-value,.token.attr-value .punctuation{color:#a5c261}.token.attr-value .punctuation:first-child{color:#a9b7c6}.token.url{color:#287bde;text-decoration:underline}.token.function{color:#ffc66d}.token.regex{background:#364135}.token.bold{font-weight:700}.token.italic{font-style:italic}.token.inserted{background:#294436}.token.deleted{background:#484a4a}code.language-css .token.property,code.language-css .token.property+.token.punctuation{color:#a9b7c6}code.language-css .token.id{color:#ffc66d}code.language-css .token.selector>.token.class,code.language-css .token.selector>.token.attribute,code.language-css .token.selector>.token.pseudo-class,code.language-css .token.selector>.token.pseudo-element{color:#ffc66d}h1{font-size:40px;margin:0 0 var(--spacing-half) 0;padding:0 0 var(--spacing-quarter) 0}h2{font-size:32px;margin:0 0 var(--spacing-half) 0;padding:0 0 var(--spacing-quarter) 0}h2 .header{border-bottom:solid 1px var(--color-border)}h3{font-size:24px;margin:0 0 var(--spacing-half) 0;padding:0 0 var(--spacing-quarter) 0}h4{font-size:20px;margin:0 0 var(--spacing-half) 0;padding:0 0 var(--spacing-quarter) 0}h5{font-size:16px;margin:0 0 var(--spacing-half) 0;padding:0 0 var(--spacing-quarter) 0}a{color:var(--primary-color)}a:hover{color:var(--color-secondary)}p{margin:0 0 var(--spacing-half) 0}.separator{height:1px;width:100%;margin:var(--spacing-half) 0 var(--spacing-half) 0;background-color:var(--color-border)}.separator.vertical{width:1px;height:100%;margin:0 var(--spacing-half) 0 var(--spacing-half)}.bold{font-weight:700}.pad-s{padding:var(--spacing-quarter)}.pad-t-s{padding-top:var(--spacing-quarter)}.pad-r-s{padding-right:var(--spacing-quarter)}.pad-b-s{padding-bottom:var(--spacing-quarter)}.pad-l-s{padding-left:var(--spacing-quarter)}.pad-m{padding:var(--spacing-half)}.pad-t-m{padding-top:var(--spacing-half)}.pad-r-m{padding-right:var(--spacing-half)}.pad-b-m{padding-bottom:var(--spacing-half)}.pad-l-m{padding-left:var(--spacing-half)}.pad-l{padding:var(--spacing)}.pad-t-l{padding-top:var(--spacing)}.pad-r-l{padding-right:var(--spacing)}.pad-b-l{padding-bottom:var(--spacing)}.pad-l-l{padding-left:var(--spacing)}.mar-s{margin:var(--spacing-quarter)}.mar-t-s{margin-top:var(--spacing-quarter)}.mar-r-s{margin-right:var(--spacing-quarter)}.mar-b-s{margin-bottom:var(--spacing-quarter)}.mar-l-s{margin-left:var(--spacing-quarter)}.mar-m{margin:var(--spacing-half)}.mar-t-m{margin-top:var(--spacing-half)}.mar-r-m{margin-right:var(--spacing-half)}.mar-b-m{margin-bottom:var(--spacing-half)}.mar-l-m{margin-left:var(--spacing-half)}.mar-l{margin:var(--spacing)}.mar-t-l{margin-top:var(--spacing)}.mar-r-l{margin-right:var(--spacing)}.mar-b-l{margin-bottom:var(--spacing)}.mar-l-l{margin-left:var(--spacing)}.fade-enter-active,.fade-leave-active{transition:opacity .3s ease-in-out}.fade-enter,.fade-leave-to{opacity:0}button,.btn{display:inline-flex;align-items:center;color:var(--color-white);height:30px;width:auto;max-width:100%;min-width:auto;padding:0 var(--spacing-half) 0 var(--spacing-half);cursor:pointer;background-color:var(--color-primary);text-align:center;line-height:18px;-webkit-user-select:none;user-select:none;white-space:nowrap;border-radius:var(--border-radius);vertical-align:middle;box-shadow:0 0 0 1px transparent inset,0 0 #22242626 inset;box-sizing:content-box;border:0}input{color:var(--color-font)}.alert{position:relative;color:var(--color-font);padding:var(--spacing-half) var(--spacing);margin:0 0 var(--spacing-half) 0;border-radius:var(--border-radius)}.alert.info{background-color:var(--color-alert-info);border-color:var(--color-alert-info-border)}:root{--ss-primary-color: #5897fb;--ss-bg-color: #ffffff;--ss-font-color: #4d4d4d;--ss-font-placeholder-color: #8d8d8d;--ss-disabled-color: #dcdee2;--ss-border-color: #dcdee2;--ss-highlight-color: #fffb8c;--ss-success-color: #00b755;--ss-error-color: #dc3545;--ss-focus-color: #5897fb;--ss-main-height: 30px;--ss-content-height: 300px;--ss-spacing-l: 7px;--ss-spacing-m: 5px;--ss-spacing-s: 3px;--ss-animation-timing: .2s;--ss-border-radius: 4px}@keyframes ss-valueIn{0%{transform:scale(0);opacity:0}to{transform:scale(1);opacity:1}}@keyframes ss-valueOut{0%{transform:scale(1);opacity:1}to{transform:scale(0);opacity:0}}.ss-hide{display:none!important}.ss-main.ss-2{display:flex;flex-direction:row;position:relative;-webkit-user-select:none;user-select:none;color:var(--ss-font-color);min-height:var(--ss-main-height);width:100%;padding:var(--ss-spacing-s);cursor:pointer;border:1px solid var(--ss-border-color);border-radius:var(--ss-border-radius);background-color:var(--ss-bg-color);outline:0;box-sizing:border-box;transition:background-color var(--ss-animation-timing);overflow:hidden}.ss-main.ss-2:focus{box-shadow:0 0 5px var(--ss-focus-color)}.ss-main.ss-2.ss-disabled{background-color:var(--ss-disabled-color);cursor:not-allowed}.ss-main.ss-2.ss-disabled .ss-values .ss-disabled{color:var(--ss-font-color)}.ss-main.ss-2.ss-disabled .ss-values .ss-value .ss-value-delete{cursor:not-allowed}.ss-main.ss-2.ss-open-above{border-top-left-radius:0;border-top-right-radius:0}.ss-main.ss-2.ss-open-below{border-bottom-left-radius:0;border-bottom-right-radius:0}.ss-main.ss-2 .ss-values{display:inline-flex;flex-wrap:wrap;gap:var(--ss-spacing-m);flex:1 1 100%}.ss-main.ss-2 .ss-values .ss-placeholder{display:flex;padding:var(--ss-spacing-s) var(--ss-spacing-m) var(--ss-spacing-s) var(--ss-spacing-m);margin:auto 0;line-height:1em;align-items:center;width:100%;color:var(--ss-font-placeholder-color);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ss-main.ss-2 .ss-values .ss-max{display:flex;-webkit-user-select:none;user-select:none;align-items:center;width:fit-content;font-size:12px;color:var(--ss-bg-color);line-height:1;padding:var(--ss-spacing-s) var(--ss-spacing-m);background-color:var(--ss-primary-color);border-radius:var(--ss-border-radius)}.ss-main.ss-2 .ss-values .ss-single{display:flex;margin:auto 0px auto var(--ss-spacing-s)}.ss-main.ss-2 .ss-values .ss-value{display:flex;-webkit-user-select:none;user-select:none;align-items:center;width:fit-content;background-color:var(--ss-primary-color);border-radius:var(--ss-border-radius);animation-name:ss-valueIn;animation-duration:var(--ss-animation-timing);animation-timing-function:ease-out;animation-fill-mode:both}.ss-main.ss-2 .ss-values .ss-value.ss-value-out{animation-name:ss-valueOut;animation-duration:var(--ss-animation-timing);animation-timing-function:ease-out}.ss-main.ss-2 .ss-values .ss-value .ss-value-text{font-size:12px;color:var(--ss-bg-color);line-height:1;padding:var(--ss-spacing-s) var(--ss-spacing-m)}.ss-main.ss-2 .ss-values .ss-value .ss-value-delete{display:flex;align-items:center;height:var(--ss-spacing-l);width:var(--ss-spacing-l);padding:var(--ss-spacing-s) var(--ss-spacing-m);cursor:pointer;border-left:solid 1px var(--ss-bg-color);box-sizing:content-box}.ss-main.ss-2 .ss-values .ss-value .ss-value-delete svg{height:var(--ss-spacing-l);width:var(--ss-spacing-l)}.ss-main.ss-2 .ss-values .ss-value .ss-value-delete svg path{fill:none;stroke:var(--ss-bg-color);stroke-width:18;stroke-linecap:round;stroke-linejoin:round}.ss-main.ss-2 .ss-deselect{flex:0 1 auto;display:flex;align-items:center;justify-content:center;width:fit-content;height:auto;padding:0 var(--ss-spacing-m) 0 var(--ss-spacing-m)}.ss-main.ss-2 .ss-deselect svg{width:8px;height:8px}.ss-main.ss-2 .ss-deselect svg path{fill:none;stroke:var(--ss-font-color);stroke-width:20;stroke-linecap:round;stroke-linejoin:round}.ss-main.ss-2 .ss-arrow{flex:0 1 auto;display:flex;align-items:center;justify-content:flex-end;width:12px;height:12px;margin:auto var(--ss-spacing-m) auto var(--ss-spacing-m)}.ss-main.ss-2 .ss-arrow path{fill:none;stroke:var(--ss-font-color);stroke-width:18;stroke-linecap:round;stroke-linejoin:round;transition-timing-function:ease-out;transition:var(--ss-animation-timing)}.ss-content{position:absolute;display:flex;height:auto;flex-direction:column;width:auto;max-height:var(--ss-content-height);box-sizing:border-box;border:solid 1px var(--ss-border-color);background-color:var(--ss-bg-color);transition:transform var(--ss-animation-timing),opacity var(--ss-animation-timing);opacity:0;transform:scaleY(0);transform-origin:center top;overflow:hidden;z-index:10000}.ss-content.ss-relative{position:relative;height:100%}.ss-content.ss-fixed{position:fixed}.ss-content.ss-open-above{flex-direction:column-reverse;opacity:1;transform:scaleY(1);transform-origin:center bottom;border-top-left-radius:var(--ss-border-radius);border-top-right-radius:var(--ss-border-radius)}.ss-content.ss-open-below{opacity:1;transform:scaleY(1);transform-origin:center top;border-bottom-left-radius:var(--ss-border-radius);border-bottom-right-radius:var(--ss-border-radius)}.ss-content .ss-search{flex:0 1 auto;display:flex;flex-direction:row;padding:var(--ss-spacing-l) var(--ss-spacing-l) var(--ss-spacing-m) var(--ss-spacing-l)}.ss-content .ss-search input{display:inline-flex;font-size:inherit;line-height:inherit;flex:1 1 auto;width:100%;min-width:0px;padding:var(--ss-spacing-m) var(--ss-spacing-l);margin:0;border:1px solid var(--ss-border-color);border-radius:var(--ss-border-radius);background-color:var(--ss-bg-color);outline:0;text-align:left;box-sizing:border-box}.ss-content .ss-search input::placeholder{color:var(--ss-font-placeholder-color);vertical-align:middle}.ss-content .ss-search input:focus{box-shadow:0 0 5px var(--ss-focus-color)}.ss-content .ss-search .ss-addable{display:inline-flex;justify-content:center;align-items:center;cursor:pointer;flex:0 0 auto;height:auto;margin:0 0 0 var(--ss-spacing-m);border:1px solid var(--ss-border-color);border-radius:var(--ss-border-radius)}.ss-content .ss-search .ss-addable svg{display:flex;align-items:center;justify-content:flex-end;flex:0 1 auto;width:12px;height:12px;margin:auto var(--ss-spacing-m) auto var(--ss-spacing-m)}.ss-content .ss-search .ss-addable svg path{fill:none;stroke:var(--ss-font-color);stroke-width:18;stroke-linecap:round;stroke-linejoin:round}.ss-content .ss-list{flex:1 1 auto;height:auto;overflow-x:hidden;overflow-y:auto}.ss-content .ss-list .ss-error{color:var(--ss-error-color);padding:var(--ss-spacing-l)}.ss-content .ss-list .ss-searching{color:var(--ss-font-color);padding:var(--ss-spacing-l)}.ss-content .ss-list .ss-optgroup.ss-close .ss-option{display:none!important}.ss-content .ss-list .ss-optgroup .ss-optgroup-label{display:flex;flex-direction:row;align-items:center;justify-content:space-between;padding:var(--ss-spacing-m) var(--ss-spacing-l) var(--ss-spacing-m) var(--ss-spacing-l)}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-label-text{flex:1 1 auto;font-weight:700;color:var(--ss-font-color)}.ss-content .ss-list .ss-optgroup .ss-optgroup-label:has(.ss-arrow){cursor:pointer}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions{flex:0 1 auto;display:flex;flex-direction:row;align-items:center;justify-content:center;gap:var(--ss-spacing-m)}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall{flex:0 0 auto;display:flex;flex-direction:row;cursor:pointer}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall:hover{opacity:.5}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall.ss-selected svg path{stroke:var(--ss-error-color)}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall span{flex:0 1 auto;display:flex;align-items:center;justify-content:center;font-size:60%;text-align:center;padding:0 var(--ss-spacing-s) 0 0}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall svg{flex:0 1 auto;width:13px;height:13px}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall svg path{fill:none;stroke:var(--ss-success-color);stroke-linecap:round;stroke-linejoin:round}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall svg:first-child{stroke-width:5}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall svg:last-child{stroke-width:11}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-closable{flex:0 1 auto;display:flex;flex-direction:row;cursor:pointer}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-closable .ss-arrow{flex:1 1 auto;width:10px;height:10px}.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-closable .ss-arrow path{fill:none;stroke:var(--ss-font-color);stroke-width:18;stroke-linecap:round;stroke-linejoin:round;transition-timing-function:ease-out;transition:var(--ss-animation-timing)}.ss-content .ss-list .ss-optgroup .ss-option{padding:var(--ss-spacing-s) var(--ss-spacing-s) var(--ss-spacing-s) calc(var(--ss-spacing-l) * 3)}.ss-content .ss-list .ss-option{display:block;padding:var(--ss-spacing-m) var(--ss-spacing-l) var(--ss-spacing-m) var(--ss-spacing-l);white-space:normal;color:var(--ss-font-color);cursor:pointer;-webkit-user-select:none;user-select:none}.ss-content .ss-list .ss-option:hover{color:var(--ss-bg-color);background-color:var(--ss-primary-color)}.ss-content .ss-list .ss-option.ss-highlighted,.ss-content .ss-list .ss-option:not(.ss-disabled).ss-selected{color:var(--ss-bg-color);background-color:var(--ss-primary-color)}.ss-content .ss-list .ss-option.ss-disabled{cursor:not-allowed;background-color:var(--ss-disabled-color)}.ss-content .ss-list .ss-option.ss-disabled:hover{color:var(--ss-font-color)}.ss-content .ss-list .ss-option .ss-search-highlight{display:inline-block;background-color:var(--ss-highlight-color)}.ss-sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;clip:rect(0,0,0,0);clip-path:inset(50%);overflow:hidden}.ss-main.error,.ss-content.error{border:solid 1px red!important;color:red!important}.carbon-container #carbonads *{margin:initial;padding:initial}.carbon-container #carbonads{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,Helvetica,Arial,sans-serif}.carbon-container #carbonads{display:flex;max-width:100%;background-color:var(--color-ads-background);box-shadow:none;z-index:100}.carbon-container #carbonads a{color:inherit;text-decoration:none}.carbon-container #carbonads a:hover{color:inherit}.carbon-container #carbonads span{position:relative;display:block;overflow:hidden}.carbon-container #carbonads .carbon-wrap{display:flex;flex-direction:column}.carbon-container #carbonads .carbon-img{display:block;margin-bottom:0;line-height:1}.carbon-container #carbonads .carbon-img img{display:block}.carbon-container #carbonads .carbon-text{font-size:12px;padding:var(--spacing-quarter);margin-bottom:16px;line-height:1.5;text-align:left}.carbon-container #carbonads .carbon-poweredby{display:block;padding:var(--spacing-quarter);background:#f1f1f2;text-align:center;text-transform:uppercase;letter-spacing:.5px;font-weight:600;font-size:8px;line-height:1;border-top-left-radius:3px;position:absolute;bottom:0;right:0} diff --git a/docs/assets/index.js b/docs/assets/index.js index 4f3b476a..e28d78e4 100644 --- a/docs/assets/index.js +++ b/docs/assets/index.js @@ -7,27 +7,27 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/home.js","asset * @vue/reactivity v3.5.17 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT -**/let Oe;class gl{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=Oe,!e&&Oe&&(this.index=(Oe.scopes||(Oe.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,s;if(this.scopes)for(e=0,s=this.scopes.length;e0&&--this._on===0&&(Oe=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){this._active=!1;let s,n;for(s=0,n=this.effects.length;s0)return;if($t){let e=$t;for($t=void 0;e;){const s=e.next;e.next=void 0,e.flags&=-9,e=s}}let t;for(;Ut;){let e=Ut;for(Ut=void 0;e;){const s=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(n){t||(t=n)}e=s}}if(t)throw t}function Wi(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function Gi(t){let e,s=t.depsTail,n=s;for(;n;){const i=n.prevDep;n.version===-1?(n===s&&(s=i),wn(n),vl(n)):e=n,n.dep.activeLink=n.prevActiveLink,n.prevActiveLink=void 0,n=i}t.deps=e,t.depsTail=s}function Js(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(qi(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function qi(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===Yt)||(t.globalVersion=Yt,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!Js(t))))return;t.flags|=2;const e=t.dep,s=ne,n=Be;ne=t,Be=!0;try{Wi(t);const i=t.fn(t._value);(e.version===0||gt(i,t._value))&&(t.flags|=128,t._value=i,e.version++)}catch(i){throw e.version++,i}finally{ne=s,Be=n,Gi(t),t.flags&=-3}}function wn(t,e=!1){const{dep:s,prevSub:n,nextSub:i}=t;if(n&&(n.nextSub=i,t.prevSub=void 0),i&&(i.prevSub=n,t.nextSub=void 0),s.subs===t&&(s.subs=n,!n&&s.computed)){s.computed.flags&=-5;for(let r=s.computed.deps;r;r=r.nextDep)wn(r,!0)}!e&&!--s.sc&&s.map&&s.map.delete(s.key)}function vl(t){const{prevDep:e,nextDep:s}=t;e&&(e.nextDep=s,t.prevDep=void 0),s&&(s.prevDep=e,t.nextDep=void 0)}let Be=!0;const Ki=[];function st(){Ki.push(Be),Be=!1}function nt(){const t=Ki.pop();Be=t===void 0?!0:t}function Hn(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const s=ne;ne=void 0;try{e()}finally{ne=s}}}let Yt=0;class bl{constructor(e,s){this.sub=e,this.dep=s,this.version=s.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class xn{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!ne||!Be||ne===this.computed)return;let s=this.activeLink;if(s===void 0||s.sub!==ne)s=this.activeLink=new bl(ne,this),ne.deps?(s.prevDep=ne.depsTail,ne.depsTail.nextDep=s,ne.depsTail=s):ne.deps=ne.depsTail=s,Yi(s);else if(s.version===-1&&(s.version=this.version,s.nextDep)){const n=s.nextDep;n.prevDep=s.prevDep,s.prevDep&&(s.prevDep.nextDep=n),s.prevDep=ne.depsTail,s.nextDep=void 0,ne.depsTail.nextDep=s,ne.depsTail=s,ne.deps===s&&(ne.deps=n)}return s}trigger(e){this.version++,Yt++,this.notify(e)}notify(e){yn();try{for(let s=this.subs;s;s=s.prevSub)s.sub.notify()&&s.sub.dep.notify()}finally{An()}}}function Yi(t){if(t.dep.sc++,t.sub.flags&4){const e=t.dep.computed;if(e&&!t.dep.subs){e.flags|=20;for(let n=e.deps;n;n=n.nextDep)Yi(n)}const s=t.dep.subs;s!==t&&(t.prevSub=s,s&&(s.nextSub=t)),t.dep.subs=t}}const Zs=new WeakMap,At=Symbol(""),Xs=Symbol(""),Qt=Symbol("");function ge(t,e,s){if(Be&&ne){let n=Zs.get(t);n||Zs.set(t,n=new Map);let i=n.get(s);i||(n.set(s,i=new xn),i.map=n,i.key=s),i.track()}}function et(t,e,s,n,i,r){const o=Zs.get(t);if(!o){Yt++;return}const l=a=>{a&&a.trigger()};if(yn(),e==="clear")o.forEach(l);else{const a=z(t),u=a&&mn(s);if(a&&s==="length"){const c=Number(n);o.forEach((f,p)=>{(p==="length"||p===Qt||!rt(p)&&p>=c)&&l(f)})}else switch((s!==void 0||o.has(void 0))&&l(o.get(s)),u&&l(o.get(Qt)),e){case"add":a?u&&l(o.get("length")):(l(o.get(At)),Ot(t)&&l(o.get(Xs)));break;case"delete":a||(l(o.get(At)),Ot(t)&&l(o.get(Xs)));break;case"set":Ot(t)&&l(o.get(At));break}}An()}function St(t){const e=Z(t);return e===t?e:(ge(e,"iterate",Qt),Fe(t)?e:e.map(he))}function _s(t){return ge(t=Z(t),"iterate",Qt),t}const yl={__proto__:null,[Symbol.iterator](){return Bs(this,Symbol.iterator,he)},concat(...t){return St(this).concat(...t.map(e=>z(e)?St(e):e))},entries(){return Bs(this,"entries",t=>(t[1]=he(t[1]),t))},every(t,e){return Ye(this,"every",t,e,void 0,arguments)},filter(t,e){return Ye(this,"filter",t,e,s=>s.map(he),arguments)},find(t,e){return Ye(this,"find",t,e,he,arguments)},findIndex(t,e){return Ye(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return Ye(this,"findLast",t,e,he,arguments)},findLastIndex(t,e){return Ye(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return Ye(this,"forEach",t,e,void 0,arguments)},includes(...t){return Hs(this,"includes",t)},indexOf(...t){return Hs(this,"indexOf",t)},join(t){return St(this).join(t)},lastIndexOf(...t){return Hs(this,"lastIndexOf",t)},map(t,e){return Ye(this,"map",t,e,void 0,arguments)},pop(){return Mt(this,"pop")},push(...t){return Mt(this,"push",t)},reduce(t,...e){return Vn(this,"reduce",t,e)},reduceRight(t,...e){return Vn(this,"reduceRight",t,e)},shift(){return Mt(this,"shift")},some(t,e){return Ye(this,"some",t,e,void 0,arguments)},splice(...t){return Mt(this,"splice",t)},toReversed(){return St(this).toReversed()},toSorted(t){return St(this).toSorted(t)},toSpliced(...t){return St(this).toSpliced(...t)},unshift(...t){return Mt(this,"unshift",t)},values(){return Bs(this,"values",he)}};function Bs(t,e,s){const n=_s(t),i=n[e]();return n!==t&&!Fe(t)&&(i._next=i.next,i.next=()=>{const r=i._next();return r.value&&(r.value=s(r.value)),r}),i}const Al=Array.prototype;function Ye(t,e,s,n,i,r){const o=_s(t),l=o!==t&&!Fe(t),a=o[e];if(a!==Al[e]){const f=a.apply(t,r);return l?he(f):f}let u=s;o!==t&&(l?u=function(f,p){return s.call(this,he(f),p,t)}:s.length>2&&(u=function(f,p){return s.call(this,f,p,t)}));const c=a.call(o,u,n);return l&&i?i(c):c}function Vn(t,e,s,n){const i=_s(t);let r=s;return i!==t&&(Fe(t)?s.length>3&&(r=function(o,l,a){return s.call(this,o,l,a,t)}):r=function(o,l,a){return s.call(this,o,he(l),a,t)}),i[e](r,...n)}function Hs(t,e,s){const n=Z(t);ge(n,"iterate",Qt);const i=n[e](...s);return(i===-1||i===!1)&&Cn(s[0])?(s[0]=Z(s[0]),n[e](...s)):i}function Mt(t,e,s=[]){st(),yn();const n=Z(t)[e].apply(t,s);return An(),nt(),n}const wl=dn("__proto__,__v_isRef,__isVue"),Qi=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(rt));function xl(t){rt(t)||(t=String(t));const e=Z(this);return ge(e,"has",t),e.hasOwnProperty(t)}class Ji{constructor(e=!1,s=!1){this._isReadonly=e,this._isShallow=s}get(e,s,n){if(s==="__v_skip")return e.__v_skip;const i=this._isReadonly,r=this._isShallow;if(s==="__v_isReactive")return!i;if(s==="__v_isReadonly")return i;if(s==="__v_isShallow")return r;if(s==="__v_raw")return n===(i?r?Dl:tr:r?er:Xi).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const o=z(e);if(!i){let a;if(o&&(a=yl[s]))return a;if(s==="hasOwnProperty")return xl}const l=Reflect.get(e,s,ve(e)?e:n);return(rt(s)?Qi.has(s):wl(s))||(i||ge(e,"get",s),r)?l:ve(l)?o&&mn(s)?l:l.value:le(l)?i?nr(l):Os(l):l}}class Zi extends Ji{constructor(e=!1){super(!1,e)}set(e,s,n,i){let r=e[s];if(!this._isShallow){const a=mt(r);if(!Fe(n)&&!mt(n)&&(r=Z(r),n=Z(n)),!z(e)&&ve(r)&&!ve(n))return a?!1:(r.value=n,!0)}const o=z(e)&&mn(s)?Number(s)t,ls=t=>Reflect.getPrototypeOf(t);function Ol(t,e,s){return function(...n){const i=this.__v_raw,r=Z(i),o=Ot(r),l=t==="entries"||t===Symbol.iterator&&o,a=t==="keys"&&o,u=i[t](...n),c=s?en:e?gs:he;return!e&&ge(r,"iterate",a?Xs:At),{next(){const{value:f,done:p}=u.next();return p?{value:f,done:p}:{value:l?[c(f[0]),c(f[1])]:c(f),done:p}},[Symbol.iterator](){return this}}}}function os(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function Ll(t,e){const s={get(i){const r=this.__v_raw,o=Z(r),l=Z(i);t||(gt(i,l)&&ge(o,"get",i),ge(o,"get",l));const{has:a}=ls(o),u=e?en:t?gs:he;if(a.call(o,i))return u(r.get(i));if(a.call(o,l))return u(r.get(l));r!==o&&r.get(i)},get size(){const i=this.__v_raw;return!t&&ge(Z(i),"iterate",At),Reflect.get(i,"size",i)},has(i){const r=this.__v_raw,o=Z(r),l=Z(i);return t||(gt(i,l)&&ge(o,"has",i),ge(o,"has",l)),i===l?r.has(i):r.has(i)||r.has(l)},forEach(i,r){const o=this,l=o.__v_raw,a=Z(l),u=e?en:t?gs:he;return!t&&ge(a,"iterate",At),l.forEach((c,f)=>i.call(r,u(c),u(f),o))}};return be(s,t?{add:os("add"),set:os("set"),delete:os("delete"),clear:os("clear")}:{add(i){!e&&!Fe(i)&&!mt(i)&&(i=Z(i));const r=Z(this);return ls(r).has.call(r,i)||(r.add(i),et(r,"add",i,i)),this},set(i,r){!e&&!Fe(r)&&!mt(r)&&(r=Z(r));const o=Z(this),{has:l,get:a}=ls(o);let u=l.call(o,i);u||(i=Z(i),u=l.call(o,i));const c=a.call(o,i);return o.set(i,r),u?gt(r,c)&&et(o,"set",i,r):et(o,"add",i,r),this},delete(i){const r=Z(this),{has:o,get:l}=ls(r);let a=o.call(r,i);a||(i=Z(i),a=o.call(r,i)),l&&l.call(r,i);const u=r.delete(i);return a&&et(r,"delete",i,void 0),u},clear(){const i=Z(this),r=i.size!==0,o=i.clear();return r&&et(i,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(i=>{s[i]=Ol(i,t,e)}),s}function Sn(t,e){const s=Ll(t,e);return(n,i,r)=>i==="__v_isReactive"?!t:i==="__v_isReadonly"?t:i==="__v_raw"?n:Reflect.get(X(s,i)&&i in n?s:n,i,r)}const Tl={get:Sn(!1,!1)},Pl={get:Sn(!1,!0)},Rl={get:Sn(!0,!1)};const Xi=new WeakMap,er=new WeakMap,tr=new WeakMap,Dl=new WeakMap;function kl(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Fl(t){return t.__v_skip||!Object.isExtensible(t)?0:kl(rl(t))}function Os(t){return mt(t)?t:En(t,!1,El,Tl,Xi)}function sr(t){return En(t,!1,_l,Pl,er)}function nr(t){return En(t,!0,Cl,Rl,tr)}function En(t,e,s,n,i){if(!le(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const r=Fl(t);if(r===0)return t;const o=i.get(t);if(o)return o;const l=new Proxy(t,r===2?n:s);return i.set(t,l),l}function Lt(t){return mt(t)?Lt(t.__v_raw):!!(t&&t.__v_isReactive)}function mt(t){return!!(t&&t.__v_isReadonly)}function Fe(t){return!!(t&&t.__v_isShallow)}function Cn(t){return t?!!t.__v_raw:!1}function Z(t){const e=t&&t.__v_raw;return e?Z(e):t}function Il(t){return!X(t,"__v_skip")&&Object.isExtensible(t)&&Qs(t,"__v_skip",!0),t}const he=t=>le(t)?Os(t):t,gs=t=>le(t)?nr(t):t;function ve(t){return t?t.__v_isRef===!0:!1}function ir(t){return rr(t,!1)}function Ml(t){return rr(t,!0)}function rr(t,e){return ve(t)?t:new Nl(t,e)}class Nl{constructor(e,s){this.dep=new xn,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=s?e:Z(e),this._value=s?e:he(e),this.__v_isShallow=s}get value(){return this.dep.track(),this._value}set value(e){const s=this._rawValue,n=this.__v_isShallow||Fe(e)||mt(e);e=n?e:Z(e),gt(e,s)&&(this._rawValue=e,this._value=n?e:he(e),this.dep.trigger())}}function wt(t){return ve(t)?t.value:t}const Bl={get:(t,e,s)=>e==="__v_raw"?t:wt(Reflect.get(t,e,s)),set:(t,e,s,n)=>{const i=t[e];return ve(i)&&!ve(s)?(i.value=s,!0):Reflect.set(t,e,s,n)}};function lr(t){return Lt(t)?t:new Proxy(t,Bl)}class Hl{constructor(e,s,n){this.fn=e,this.setter=s,this._value=void 0,this.dep=new xn(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Yt-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!s,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&ne!==this)return zi(this,!0),!0}get value(){const e=this.dep.track();return qi(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function Vl(t,e,s=!1){let n,i;return G(t)?n=t:(n=t.get,i=t.set),new Hl(n,i,s)}const as={},ms=new WeakMap;let yt;function Ul(t,e=!1,s=yt){if(s){let n=ms.get(s);n||ms.set(s,n=[]),n.push(t)}}function $l(t,e,s=ie){const{immediate:n,deep:i,once:r,scheduler:o,augmentJob:l,call:a}=s,u=y=>i?y:Fe(y)||i===!1||i===0?pt(y,1):pt(y);let c,f,p,g,C=!1,_=!1;if(ve(t)?(f=()=>t.value,C=Fe(t)):Lt(t)?(f=()=>u(t),C=!0):z(t)?(_=!0,C=t.some(y=>Lt(y)||Fe(y)),f=()=>t.map(y=>{if(ve(y))return y.value;if(Lt(y))return u(y);if(G(y))return a?a(y,2):y()})):G(t)?e?f=a?()=>a(t,2):t:f=()=>{if(p){st();try{p()}finally{nt()}}const y=yt;yt=c;try{return a?a(t,3,[g]):t(g)}finally{yt=y}}:f=qe,e&&i){const y=f,E=i===!0?1/0:i;f=()=>pt(y(),E)}const D=ml(),T=()=>{c.stop(),D&&D.active&&gn(D.effects,c)};if(r&&e){const y=e;e=(...E)=>{y(...E),T()}}let m=_?new Array(t.length).fill(as):as;const v=y=>{if(!(!(c.flags&1)||!c.dirty&&!y))if(e){const E=c.run();if(i||C||(_?E.some((L,F)=>gt(L,m[F])):gt(E,m))){p&&p();const L=yt;yt=c;try{const F=[E,m===as?void 0:_&&m[0]===as?[]:m,g];m=E,a?a(e,3,F):e(...F)}finally{yt=L}}}else c.run()};return l&&l(v),c=new $i(f),c.scheduler=o?()=>o(v,!1):v,g=y=>Ul(y,!1,c),p=c.onStop=()=>{const y=ms.get(c);if(y){if(a)a(y,4);else for(const E of y)E();ms.delete(c)}},e?n?v(!0):m=c.run():o?o(v.bind(null,!0),!0):c.run(),T.pause=c.pause.bind(c),T.resume=c.resume.bind(c),T.stop=T,T}function pt(t,e=1/0,s){if(e<=0||!le(t)||t.__v_skip||(s=s||new Set,s.has(t)))return t;if(s.add(t),e--,ve(t))pt(t.value,e,s);else if(z(t))for(let n=0;n{pt(n,e,s)});else if(Ni(t)){for(const n in t)pt(t[n],e,s);for(const n of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,n)&&pt(t[n],e,s)}return t}/** +**/let Oe;class gl{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=Oe,!e&&Oe&&(this.index=(Oe.scopes||(Oe.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,s;if(this.scopes)for(e=0,s=this.scopes.length;e0&&--this._on===0&&(Oe=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){this._active=!1;let s,n;for(s=0,n=this.effects.length;s0)return;if($t){let e=$t;for($t=void 0;e;){const s=e.next;e.next=void 0,e.flags&=-9,e=s}}let t;for(;Ut;){let e=Ut;for(Ut=void 0;e;){const s=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(n){t||(t=n)}e=s}}if(t)throw t}function Wi(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function Gi(t){let e,s=t.depsTail,n=s;for(;n;){const i=n.prevDep;n.version===-1?(n===s&&(s=i),wn(n),vl(n)):e=n,n.dep.activeLink=n.prevActiveLink,n.prevActiveLink=void 0,n=i}t.deps=e,t.depsTail=s}function Js(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(qi(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function qi(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===Yt)||(t.globalVersion=Yt,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!Js(t))))return;t.flags|=2;const e=t.dep,s=ne,n=Be;ne=t,Be=!0;try{Wi(t);const i=t.fn(t._value);(e.version===0||gt(i,t._value))&&(t.flags|=128,t._value=i,e.version++)}catch(i){throw e.version++,i}finally{ne=s,Be=n,Gi(t),t.flags&=-3}}function wn(t,e=!1){const{dep:s,prevSub:n,nextSub:i}=t;if(n&&(n.nextSub=i,t.prevSub=void 0),i&&(i.prevSub=n,t.nextSub=void 0),s.subs===t&&(s.subs=n,!n&&s.computed)){s.computed.flags&=-5;for(let r=s.computed.deps;r;r=r.nextDep)wn(r,!0)}!e&&!--s.sc&&s.map&&s.map.delete(s.key)}function vl(t){const{prevDep:e,nextDep:s}=t;e&&(e.nextDep=s,t.prevDep=void 0),s&&(s.prevDep=e,t.nextDep=void 0)}let Be=!0;const Ki=[];function st(){Ki.push(Be),Be=!1}function nt(){const t=Ki.pop();Be=t===void 0?!0:t}function Hn(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const s=ne;ne=void 0;try{e()}finally{ne=s}}}let Yt=0;class bl{constructor(e,s){this.sub=e,this.dep=s,this.version=s.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class xn{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!ne||!Be||ne===this.computed)return;let s=this.activeLink;if(s===void 0||s.sub!==ne)s=this.activeLink=new bl(ne,this),ne.deps?(s.prevDep=ne.depsTail,ne.depsTail.nextDep=s,ne.depsTail=s):ne.deps=ne.depsTail=s,Yi(s);else if(s.version===-1&&(s.version=this.version,s.nextDep)){const n=s.nextDep;n.prevDep=s.prevDep,s.prevDep&&(s.prevDep.nextDep=n),s.prevDep=ne.depsTail,s.nextDep=void 0,ne.depsTail.nextDep=s,ne.depsTail=s,ne.deps===s&&(ne.deps=n)}return s}trigger(e){this.version++,Yt++,this.notify(e)}notify(e){yn();try{for(let s=this.subs;s;s=s.prevSub)s.sub.notify()&&s.sub.dep.notify()}finally{An()}}}function Yi(t){if(t.dep.sc++,t.sub.flags&4){const e=t.dep.computed;if(e&&!t.dep.subs){e.flags|=20;for(let n=e.deps;n;n=n.nextDep)Yi(n)}const s=t.dep.subs;s!==t&&(t.prevSub=s,s&&(s.nextSub=t)),t.dep.subs=t}}const Zs=new WeakMap,At=Symbol(""),Xs=Symbol(""),Qt=Symbol("");function ge(t,e,s){if(Be&&ne){let n=Zs.get(t);n||Zs.set(t,n=new Map);let i=n.get(s);i||(n.set(s,i=new xn),i.map=n,i.key=s),i.track()}}function et(t,e,s,n,i,r){const o=Zs.get(t);if(!o){Yt++;return}const l=a=>{a&&a.trigger()};if(yn(),e==="clear")o.forEach(l);else{const a=z(t),u=a&&mn(s);if(a&&s==="length"){const c=Number(n);o.forEach((f,p)=>{(p==="length"||p===Qt||!rt(p)&&p>=c)&&l(f)})}else switch((s!==void 0||o.has(void 0))&&l(o.get(s)),u&&l(o.get(Qt)),e){case"add":a?u&&l(o.get("length")):(l(o.get(At)),Ot(t)&&l(o.get(Xs)));break;case"delete":a||(l(o.get(At)),Ot(t)&&l(o.get(Xs)));break;case"set":Ot(t)&&l(o.get(At));break}}An()}function St(t){const e=Z(t);return e===t?e:(ge(e,"iterate",Qt),Fe(t)?e:e.map(he))}function _s(t){return ge(t=Z(t),"iterate",Qt),t}const yl={__proto__:null,[Symbol.iterator](){return Bs(this,Symbol.iterator,he)},concat(...t){return St(this).concat(...t.map(e=>z(e)?St(e):e))},entries(){return Bs(this,"entries",t=>(t[1]=he(t[1]),t))},every(t,e){return Ye(this,"every",t,e,void 0,arguments)},filter(t,e){return Ye(this,"filter",t,e,s=>s.map(he),arguments)},find(t,e){return Ye(this,"find",t,e,he,arguments)},findIndex(t,e){return Ye(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return Ye(this,"findLast",t,e,he,arguments)},findLastIndex(t,e){return Ye(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return Ye(this,"forEach",t,e,void 0,arguments)},includes(...t){return Hs(this,"includes",t)},indexOf(...t){return Hs(this,"indexOf",t)},join(t){return St(this).join(t)},lastIndexOf(...t){return Hs(this,"lastIndexOf",t)},map(t,e){return Ye(this,"map",t,e,void 0,arguments)},pop(){return Mt(this,"pop")},push(...t){return Mt(this,"push",t)},reduce(t,...e){return Vn(this,"reduce",t,e)},reduceRight(t,...e){return Vn(this,"reduceRight",t,e)},shift(){return Mt(this,"shift")},some(t,e){return Ye(this,"some",t,e,void 0,arguments)},splice(...t){return Mt(this,"splice",t)},toReversed(){return St(this).toReversed()},toSorted(t){return St(this).toSorted(t)},toSpliced(...t){return St(this).toSpliced(...t)},unshift(...t){return Mt(this,"unshift",t)},values(){return Bs(this,"values",he)}};function Bs(t,e,s){const n=_s(t),i=n[e]();return n!==t&&!Fe(t)&&(i._next=i.next,i.next=()=>{const r=i._next();return r.value&&(r.value=s(r.value)),r}),i}const Al=Array.prototype;function Ye(t,e,s,n,i,r){const o=_s(t),l=o!==t&&!Fe(t),a=o[e];if(a!==Al[e]){const f=a.apply(t,r);return l?he(f):f}let u=s;o!==t&&(l?u=function(f,p){return s.call(this,he(f),p,t)}:s.length>2&&(u=function(f,p){return s.call(this,f,p,t)}));const c=a.call(o,u,n);return l&&i?i(c):c}function Vn(t,e,s,n){const i=_s(t);let r=s;return i!==t&&(Fe(t)?s.length>3&&(r=function(o,l,a){return s.call(this,o,l,a,t)}):r=function(o,l,a){return s.call(this,o,he(l),a,t)}),i[e](r,...n)}function Hs(t,e,s){const n=Z(t);ge(n,"iterate",Qt);const i=n[e](...s);return(i===-1||i===!1)&&Cn(s[0])?(s[0]=Z(s[0]),n[e](...s)):i}function Mt(t,e,s=[]){st(),yn();const n=Z(t)[e].apply(t,s);return An(),nt(),n}const wl=dn("__proto__,__v_isRef,__isVue"),Qi=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(rt));function xl(t){rt(t)||(t=String(t));const e=Z(this);return ge(e,"has",t),e.hasOwnProperty(t)}class Ji{constructor(e=!1,s=!1){this._isReadonly=e,this._isShallow=s}get(e,s,n){if(s==="__v_skip")return e.__v_skip;const i=this._isReadonly,r=this._isShallow;if(s==="__v_isReactive")return!i;if(s==="__v_isReadonly")return i;if(s==="__v_isShallow")return r;if(s==="__v_raw")return n===(i?r?Dl:tr:r?er:Xi).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const o=z(e);if(!i){let a;if(o&&(a=yl[s]))return a;if(s==="hasOwnProperty")return xl}const l=Reflect.get(e,s,ve(e)?e:n);return(rt(s)?Qi.has(s):wl(s))||(i||ge(e,"get",s),r)?l:ve(l)?o&&mn(s)?l:l.value:le(l)?i?nr(l):Os(l):l}}class Zi extends Ji{constructor(e=!1){super(!1,e)}set(e,s,n,i){let r=e[s];if(!this._isShallow){const a=mt(r);if(!Fe(n)&&!mt(n)&&(r=Z(r),n=Z(n)),!z(e)&&ve(r)&&!ve(n))return a?!1:(r.value=n,!0)}const o=z(e)&&mn(s)?Number(s)t,ls=t=>Reflect.getPrototypeOf(t);function Ol(t,e,s){return function(...n){const i=this.__v_raw,r=Z(i),o=Ot(r),l=t==="entries"||t===Symbol.iterator&&o,a=t==="keys"&&o,u=i[t](...n),c=s?en:e?gs:he;return!e&&ge(r,"iterate",a?Xs:At),{next(){const{value:f,done:p}=u.next();return p?{value:f,done:p}:{value:l?[c(f[0]),c(f[1])]:c(f),done:p}},[Symbol.iterator](){return this}}}}function os(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function Ll(t,e){const s={get(i){const r=this.__v_raw,o=Z(r),l=Z(i);t||(gt(i,l)&&ge(o,"get",i),ge(o,"get",l));const{has:a}=ls(o),u=e?en:t?gs:he;if(a.call(o,i))return u(r.get(i));if(a.call(o,l))return u(r.get(l));r!==o&&r.get(i)},get size(){const i=this.__v_raw;return!t&&ge(Z(i),"iterate",At),Reflect.get(i,"size",i)},has(i){const r=this.__v_raw,o=Z(r),l=Z(i);return t||(gt(i,l)&&ge(o,"has",i),ge(o,"has",l)),i===l?r.has(i):r.has(i)||r.has(l)},forEach(i,r){const o=this,l=o.__v_raw,a=Z(l),u=e?en:t?gs:he;return!t&&ge(a,"iterate",At),l.forEach((c,f)=>i.call(r,u(c),u(f),o))}};return be(s,t?{add:os("add"),set:os("set"),delete:os("delete"),clear:os("clear")}:{add(i){!e&&!Fe(i)&&!mt(i)&&(i=Z(i));const r=Z(this);return ls(r).has.call(r,i)||(r.add(i),et(r,"add",i,i)),this},set(i,r){!e&&!Fe(r)&&!mt(r)&&(r=Z(r));const o=Z(this),{has:l,get:a}=ls(o);let u=l.call(o,i);u||(i=Z(i),u=l.call(o,i));const c=a.call(o,i);return o.set(i,r),u?gt(r,c)&&et(o,"set",i,r):et(o,"add",i,r),this},delete(i){const r=Z(this),{has:o,get:l}=ls(r);let a=o.call(r,i);a||(i=Z(i),a=o.call(r,i)),l&&l.call(r,i);const u=r.delete(i);return a&&et(r,"delete",i,void 0),u},clear(){const i=Z(this),r=i.size!==0,o=i.clear();return r&&et(i,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(i=>{s[i]=Ol(i,t,e)}),s}function Sn(t,e){const s=Ll(t,e);return(n,i,r)=>i==="__v_isReactive"?!t:i==="__v_isReadonly"?t:i==="__v_raw"?n:Reflect.get(X(s,i)&&i in n?s:n,i,r)}const Tl={get:Sn(!1,!1)},Pl={get:Sn(!1,!0)},Rl={get:Sn(!0,!1)};const Xi=new WeakMap,er=new WeakMap,tr=new WeakMap,Dl=new WeakMap;function kl(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Fl(t){return t.__v_skip||!Object.isExtensible(t)?0:kl(rl(t))}function Os(t){return mt(t)?t:En(t,!1,El,Tl,Xi)}function sr(t){return En(t,!1,_l,Pl,er)}function nr(t){return En(t,!0,Cl,Rl,tr)}function En(t,e,s,n,i){if(!le(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const r=Fl(t);if(r===0)return t;const o=i.get(t);if(o)return o;const l=new Proxy(t,r===2?n:s);return i.set(t,l),l}function Lt(t){return mt(t)?Lt(t.__v_raw):!!(t&&t.__v_isReactive)}function mt(t){return!!(t&&t.__v_isReadonly)}function Fe(t){return!!(t&&t.__v_isShallow)}function Cn(t){return t?!!t.__v_raw:!1}function Z(t){const e=t&&t.__v_raw;return e?Z(e):t}function Il(t){return!X(t,"__v_skip")&&Object.isExtensible(t)&&Qs(t,"__v_skip",!0),t}const he=t=>le(t)?Os(t):t,gs=t=>le(t)?nr(t):t;function ve(t){return t?t.__v_isRef===!0:!1}function ir(t){return rr(t,!1)}function Ml(t){return rr(t,!0)}function rr(t,e){return ve(t)?t:new Nl(t,e)}class Nl{constructor(e,s){this.dep=new xn,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=s?e:Z(e),this._value=s?e:he(e),this.__v_isShallow=s}get value(){return this.dep.track(),this._value}set value(e){const s=this._rawValue,n=this.__v_isShallow||Fe(e)||mt(e);e=n?e:Z(e),gt(e,s)&&(this._rawValue=e,this._value=n?e:he(e),this.dep.trigger())}}function wt(t){return ve(t)?t.value:t}const Bl={get:(t,e,s)=>e==="__v_raw"?t:wt(Reflect.get(t,e,s)),set:(t,e,s,n)=>{const i=t[e];return ve(i)&&!ve(s)?(i.value=s,!0):Reflect.set(t,e,s,n)}};function lr(t){return Lt(t)?t:new Proxy(t,Bl)}class Hl{constructor(e,s,n){this.fn=e,this.setter=s,this._value=void 0,this.dep=new xn(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Yt-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!s,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&ne!==this)return zi(this,!0),!0}get value(){const e=this.dep.track();return qi(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function Vl(t,e,s=!1){let n,i;return G(t)?n=t:(n=t.get,i=t.set),new Hl(n,i,s)}const as={},ms=new WeakMap;let yt;function Ul(t,e=!1,s=yt){if(s){let n=ms.get(s);n||ms.set(s,n=[]),n.push(t)}}function $l(t,e,s=ie){const{immediate:n,deep:i,once:r,scheduler:o,augmentJob:l,call:a}=s,u=y=>i?y:Fe(y)||i===!1||i===0?pt(y,1):pt(y);let c,f,p,g,_=!1,C=!1;if(ve(t)?(f=()=>t.value,_=Fe(t)):Lt(t)?(f=()=>u(t),_=!0):z(t)?(C=!0,_=t.some(y=>Lt(y)||Fe(y)),f=()=>t.map(y=>{if(ve(y))return y.value;if(Lt(y))return u(y);if(G(y))return a?a(y,2):y()})):G(t)?e?f=a?()=>a(t,2):t:f=()=>{if(p){st();try{p()}finally{nt()}}const y=yt;yt=c;try{return a?a(t,3,[g]):t(g)}finally{yt=y}}:f=qe,e&&i){const y=f,S=i===!0?1/0:i;f=()=>pt(y(),S)}const D=ml(),T=()=>{c.stop(),D&&D.active&&gn(D.effects,c)};if(r&&e){const y=e;e=(...S)=>{y(...S),T()}}let m=C?new Array(t.length).fill(as):as;const b=y=>{if(!(!(c.flags&1)||!c.dirty&&!y))if(e){const S=c.run();if(i||_||(C?S.some((O,F)=>gt(O,m[F])):gt(S,m))){p&&p();const O=yt;yt=c;try{const F=[S,m===as?void 0:C&&m[0]===as?[]:m,g];m=S,a?a(e,3,F):e(...F)}finally{yt=O}}}else c.run()};return l&&l(b),c=new $i(f),c.scheduler=o?()=>o(b,!1):b,g=y=>Ul(y,!1,c),p=c.onStop=()=>{const y=ms.get(c);if(y){if(a)a(y,4);else for(const S of y)S();ms.delete(c)}},e?n?b(!0):m=c.run():o?o(b.bind(null,!0),!0):c.run(),T.pause=c.pause.bind(c),T.resume=c.resume.bind(c),T.stop=T,T}function pt(t,e=1/0,s){if(e<=0||!le(t)||t.__v_skip||(s=s||new Set,s.has(t)))return t;if(s.add(t),e--,ve(t))pt(t.value,e,s);else if(z(t))for(let n=0;n{pt(n,e,s)});else if(Ni(t)){for(const n in t)pt(t[n],e,s);for(const n of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,n)&&pt(t[n],e,s)}return t}/** * @vue/runtime-core v3.5.17 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT -**/function is(t,e,s,n){try{return n?t(...n):t()}catch(i){Ls(i,e,s)}}function Ke(t,e,s,n){if(G(t)){const i=is(t,e,s,n);return i&&Ii(i)&&i.catch(r=>{Ls(r,e,s)}),i}if(z(t)){const i=[];for(let r=0;r>>1,i=Se[n],r=Jt(i);r=Jt(s)?Se.push(t):Se.splice(zl(e),0,t),t.flags|=1,cr()}}function cr(){vs||(vs=or.then(fr))}function Wl(t){z(t)?Tt.push(...t):ft&&t.id===-1?ft.splice(Et+1,0,t):t.flags&1||(Tt.push(t),t.flags|=1),cr()}function Un(t,e,s=We+1){for(;sJt(s)-Jt(n));if(Tt.length=0,ft){ft.push(...e);return}for(ft=e,Et=0;Ett.id==null?t.flags&2?-1:1/0:t.id;function fr(t){try{for(We=0;We{n._d&&Zn(-1);const r=bs(e);let o;try{o=t(...i)}finally{bs(r),n._d&&Zn(1)}return o};return n._n=!0,n._c=!0,n._d=!0,n}function vt(t,e,s,n){const i=t.dirs,r=e&&e.dirs;for(let o=0;ot.__isTeleport;function On(t,e){t.shapeFlag&6&&t.component?(t.transition=e,On(t.component.subTree,e)):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}/*! #__NO_SIDE_EFFECTS__ */function Ts(t,e){return G(t)?be({name:t.name},e,{setup:t}):t}function dr(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function jt(t,e,s,n,i=!1){if(z(t)){t.forEach((C,_)=>jt(C,e&&(z(e)?e[_]:e),s,n,i));return}if(Pt(n)&&!i){n.shapeFlag&512&&n.type.__asyncResolved&&n.component.subTree.component&&jt(t,e,s,n.component.subTree);return}const r=n.shapeFlag&4?Rn(n.component):n.el,o=i?null:r,{i:l,r:a}=t,u=e&&e.r,c=l.refs===ie?l.refs={}:l.refs,f=l.setupState,p=Z(f),g=f===ie?()=>!1:C=>X(p,C);if(u!=null&&u!==a&&(ce(u)?(c[u]=null,g(u)&&(f[u]=null)):ve(u)&&(u.value=null)),G(a))is(a,l,12,[o,c]);else{const C=ce(a),_=ve(a);if(C||_){const D=()=>{if(t.f){const T=C?g(a)?f[a]:c[a]:a.value;i?z(T)&&gn(T,r):z(T)?T.includes(r)||T.push(r):C?(c[a]=[r],g(a)&&(f[a]=c[a])):(a.value=[r],t.k&&(c[t.k]=a.value))}else C?(c[a]=o,g(a)&&(f[a]=o)):_&&(a.value=o,t.k&&(c[t.k]=o))};o?(D.id=-1,Pe(D,s)):D()}}}Cs().requestIdleCallback;Cs().cancelIdleCallback;const Pt=t=>!!t.type.__asyncLoader,pr=t=>t.type.__isKeepAlive;function Yl(t,e){gr(t,"a",e)}function Ql(t,e){gr(t,"da",e)}function gr(t,e,s=me){const n=t.__wdc||(t.__wdc=()=>{let i=s;for(;i;){if(i.isDeactivated)return;i=i.parent}return t()});if(Ps(e,n,s),s){let i=s.parent;for(;i&&i.parent;)pr(i.parent.vnode)&&Jl(n,e,s,i),i=i.parent}}function Jl(t,e,s,n){const i=Ps(e,t,n,!0);vr(()=>{gn(n[e],i)},s)}function Ps(t,e,s=me,n=!1){if(s){const i=s[t]||(s[t]=[]),r=e.__weh||(e.__weh=(...o)=>{st();const l=rs(s),a=Ke(e,s,t,o);return l(),nt(),a});return n?i.unshift(r):i.push(r),r}}const lt=t=>(e,s=me)=>{(!ts||t==="sp")&&Ps(t,(...n)=>e(...n),s)},Zl=lt("bm"),mr=lt("m"),Xl=lt("bu"),eo=lt("u"),to=lt("bum"),vr=lt("um"),so=lt("sp"),no=lt("rtg"),io=lt("rtc");function ro(t,e=me){Ps("ec",t,e)}const lo="components";function $n(t,e){return ao(lo,t,!0,e)||t}const oo=Symbol.for("v-ndc");function ao(t,e,s=!0,n=!1){const i=Ee||me;if(i){const r=i.type;{const l=Jo(r,!1);if(l&&(l===e||l===Ie(e)||l===Es(Ie(e))))return r}const o=jn(i[t]||r[t],e)||jn(i.appContext[t],e);return!o&&n?r:o}}function jn(t,e){return t&&(t[e]||t[Ie(e)]||t[Es(Ie(e))])}function tu(t,e,s,n){let i;const r=s,o=z(t);if(o||ce(t)){const l=o&&Lt(t);let a=!1,u=!1;l&&(a=!Fe(t),u=mt(t),t=_s(t)),i=new Array(t.length);for(let c=0,f=t.length;ce(l,a,void 0,r));else{const l=Object.keys(t);i=new Array(l.length);for(let a=0,u=l.length;aes(e)?!(e.type===it||e.type===Re&&!br(e.children)):!0)?t:null}const tn=t=>t?Hr(t)?Rn(t):tn(t.parent):null,zt=be(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>tn(t.parent),$root:t=>tn(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>Ar(t),$forceUpdate:t=>t.f||(t.f=()=>{_n(t.update)}),$nextTick:t=>t.n||(t.n=ar.bind(t.proxy)),$watch:t=>Po.bind(t)}),Vs=(t,e)=>t!==ie&&!t.__isScriptSetup&&X(t,e),co={get({_:t},e){if(e==="__v_skip")return!0;const{ctx:s,setupState:n,data:i,props:r,accessCache:o,type:l,appContext:a}=t;let u;if(e[0]!=="$"){const g=o[e];if(g!==void 0)switch(g){case 1:return n[e];case 2:return i[e];case 4:return s[e];case 3:return r[e]}else{if(Vs(n,e))return o[e]=1,n[e];if(i!==ie&&X(i,e))return o[e]=2,i[e];if((u=t.propsOptions[0])&&X(u,e))return o[e]=3,r[e];if(s!==ie&&X(s,e))return o[e]=4,s[e];sn&&(o[e]=0)}}const c=zt[e];let f,p;if(c)return e==="$attrs"&&ge(t.attrs,"get",""),c(t);if((f=l.__cssModules)&&(f=f[e]))return f;if(s!==ie&&X(s,e))return o[e]=4,s[e];if(p=a.config.globalProperties,X(p,e))return p[e]},set({_:t},e,s){const{data:n,setupState:i,ctx:r}=t;return Vs(i,e)?(i[e]=s,!0):n!==ie&&X(n,e)?(n[e]=s,!0):X(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(r[e]=s,!0)},has({_:{data:t,setupState:e,accessCache:s,ctx:n,appContext:i,propsOptions:r}},o){let l;return!!s[o]||t!==ie&&X(t,o)||Vs(e,o)||(l=r[0])&&X(l,o)||X(n,o)||X(zt,o)||X(i.config.globalProperties,o)},defineProperty(t,e,s){return s.get!=null?t._.accessCache[e]=0:X(s,"value")&&this.set(t,e,s.value,null),Reflect.defineProperty(t,e,s)}};function zn(t){return z(t)?t.reduce((e,s)=>(e[s]=null,e),{}):t}let sn=!0;function uo(t){const e=Ar(t),s=t.proxy,n=t.ctx;sn=!1,e.beforeCreate&&Wn(e.beforeCreate,t,"bc");const{data:i,computed:r,methods:o,watch:l,provide:a,inject:u,created:c,beforeMount:f,mounted:p,beforeUpdate:g,updated:C,activated:_,deactivated:D,beforeDestroy:T,beforeUnmount:m,destroyed:v,unmounted:y,render:E,renderTracked:L,renderTriggered:F,errorCaptured:W,serverPrefetch:H,expose:K,inheritAttrs:re,components:pe,directives:Le,filters:ot}=e;if(u&&fo(u,n,null),o)for(const Q in o){const $=o[Q];G($)&&(n[Q]=$.bind(s))}if(i){const Q=i.call(s,s);le(Q)&&(t.data=Os(Q))}if(sn=!0,r)for(const Q in r){const $=r[Q],ae=G($)?$.bind(s,s):G($.get)?$.get.bind(s,s):qe,ye=!G($)&&G($.set)?$.set.bind(s):qe,Ae=Ne({get:ae,set:ye});Object.defineProperty(n,Q,{enumerable:!0,configurable:!0,get:()=>Ae.value,set:te=>Ae.value=te})}if(l)for(const Q in l)yr(l[Q],n,s,Q);if(a){const Q=G(a)?a.call(s):a;Reflect.ownKeys(Q).forEach($=>{cs($,Q[$])})}c&&Wn(c,t,"c");function oe(Q,$){z($)?$.forEach(ae=>Q(ae.bind(s))):$&&Q($.bind(s))}if(oe(Zl,f),oe(mr,p),oe(Xl,g),oe(eo,C),oe(Yl,_),oe(Ql,D),oe(ro,W),oe(io,L),oe(no,F),oe(to,m),oe(vr,y),oe(so,H),z(K))if(K.length){const Q=t.exposed||(t.exposed={});K.forEach($=>{Object.defineProperty(Q,$,{get:()=>s[$],set:ae=>s[$]=ae})})}else t.exposed||(t.exposed={});E&&t.render===qe&&(t.render=E),re!=null&&(t.inheritAttrs=re),pe&&(t.components=pe),Le&&(t.directives=Le),H&&dr(t)}function fo(t,e,s=qe){z(t)&&(t=nn(t));for(const n in t){const i=t[n];let r;le(i)?"default"in i?r=tt(i.from||n,i.default,!0):r=tt(i.from||n):r=tt(i),ve(r)?Object.defineProperty(e,n,{enumerable:!0,configurable:!0,get:()=>r.value,set:o=>r.value=o}):e[n]=r}}function Wn(t,e,s){Ke(z(t)?t.map(n=>n.bind(e.proxy)):t.bind(e.proxy),e,s)}function yr(t,e,s,n){let i=n.includes(".")?kr(s,n):()=>s[n];if(ce(t)){const r=e[t];G(r)&&us(i,r)}else if(G(t))us(i,t.bind(s));else if(le(t))if(z(t))t.forEach(r=>yr(r,e,s,n));else{const r=G(t.handler)?t.handler.bind(s):e[t.handler];G(r)&&us(i,r,t)}}function Ar(t){const e=t.type,{mixins:s,extends:n}=e,{mixins:i,optionsCache:r,config:{optionMergeStrategies:o}}=t.appContext,l=r.get(e);let a;return l?a=l:!i.length&&!s&&!n?a=e:(a={},i.length&&i.forEach(u=>ys(a,u,o,!0)),ys(a,e,o)),le(e)&&r.set(e,a),a}function ys(t,e,s,n=!1){const{mixins:i,extends:r}=e;r&&ys(t,r,s,!0),i&&i.forEach(o=>ys(t,o,s,!0));for(const o in e)if(!(n&&o==="expose")){const l=ho[o]||s&&s[o];t[o]=l?l(t[o],e[o]):e[o]}return t}const ho={data:Gn,props:qn,emits:qn,methods:Ht,computed:Ht,beforeCreate:xe,created:xe,beforeMount:xe,mounted:xe,beforeUpdate:xe,updated:xe,beforeDestroy:xe,beforeUnmount:xe,destroyed:xe,unmounted:xe,activated:xe,deactivated:xe,errorCaptured:xe,serverPrefetch:xe,components:Ht,directives:Ht,watch:go,provide:Gn,inject:po};function Gn(t,e){return e?t?function(){return be(G(t)?t.call(this,this):t,G(e)?e.call(this,this):e)}:e:t}function po(t,e){return Ht(nn(t),nn(e))}function nn(t){if(z(t)){const e={};for(let s=0;s1)return s&&G(e)?e.call(n&&n.proxy):e}}const xr={},Sr=()=>Object.create(xr),Er=t=>Object.getPrototypeOf(t)===xr;function bo(t,e,s,n=!1){const i={},r=Sr();t.propsDefaults=Object.create(null),Cr(t,e,i,r);for(const o in t.propsOptions[0])o in i||(i[o]=void 0);s?t.props=n?i:sr(i):t.type.props?t.props=i:t.props=r,t.attrs=r}function yo(t,e,s,n){const{props:i,attrs:r,vnode:{patchFlag:o}}=t,l=Z(i),[a]=t.propsOptions;let u=!1;if((n||o>0)&&!(o&16)){if(o&8){const c=t.vnode.dynamicProps;for(let f=0;f{a=!0;const[p,g]=_r(f,e,!0);be(o,p),g&&l.push(...g)};!s&&e.mixins.length&&e.mixins.forEach(c),t.extends&&c(t.extends),t.mixins&&t.mixins.forEach(c)}if(!r&&!a)return le(t)&&n.set(t,_t),_t;if(z(r))for(let c=0;ct[0]==="_"||t==="$stable",Tn=t=>z(t)?t.map(Ge):[Ge(t)],wo=(t,e,s)=>{if(e._n)return e;const n=Gl((...i)=>Tn(e(...i)),s);return n._c=!1,n},Or=(t,e,s)=>{const n=t._ctx;for(const i in t){if(Ln(i))continue;const r=t[i];if(G(r))e[i]=wo(i,r,n);else if(r!=null){const o=Tn(r);e[i]=()=>o}}},Lr=(t,e)=>{const s=Tn(e);t.slots.default=()=>s},Tr=(t,e,s)=>{for(const n in e)(s||!Ln(n))&&(t[n]=e[n])},xo=(t,e,s)=>{const n=t.slots=Sr();if(t.vnode.shapeFlag&32){const i=e.__;i&&Qs(n,"__",i,!0);const r=e._;r?(Tr(n,e,s),s&&Qs(n,"_",r,!0)):Or(e,n)}else e&&Lr(t,e)},So=(t,e,s)=>{const{vnode:n,slots:i}=t;let r=!0,o=ie;if(n.shapeFlag&32){const l=e._;l?s&&l===1?r=!1:Tr(i,e,s):(r=!e.$stable,Or(e,i)),o=e}else e&&(Lr(t,e),o={default:1});if(r)for(const l in i)!Ln(l)&&o[l]==null&&delete i[l]},Pe=No;function Eo(t){return Co(t)}function Co(t,e){const s=Cs();s.__VUE__=!0;const{insert:n,remove:i,patchProp:r,createElement:o,createText:l,createComment:a,setText:u,setElementText:c,parentNode:f,nextSibling:p,setScopeId:g=qe,insertStaticContent:C}=t,_=(h,d,b,w=null,S=null,x=null,I=void 0,R=null,P=!!d.dynamicChildren)=>{if(h===d)return;h&&!Nt(h,d)&&(w=A(h),te(h,S,x,!0),h=null),d.patchFlag===-2&&(P=!1,d.dynamicChildren=null);const{type:O,ref:U,shapeFlag:M}=d;switch(O){case Ds:D(h,d,b,w);break;case it:T(h,d,b,w);break;case fs:h==null&&m(d,b,w,I);break;case Re:pe(h,d,b,w,S,x,I,R,P);break;default:M&1?E(h,d,b,w,S,x,I,R,P):M&6?Le(h,d,b,w,S,x,I,R,P):(M&64||M&128)&&O.process(h,d,b,w,S,x,I,R,P,B)}U!=null&&S?jt(U,h&&h.ref,x,d||h,!d):U==null&&h&&h.ref!=null&&jt(h.ref,null,x,h,!0)},D=(h,d,b,w)=>{if(h==null)n(d.el=l(d.children),b,w);else{const S=d.el=h.el;d.children!==h.children&&u(S,d.children)}},T=(h,d,b,w)=>{h==null?n(d.el=a(d.children||""),b,w):d.el=h.el},m=(h,d,b,w)=>{[h.el,h.anchor]=C(h.children,d,b,w,h.el,h.anchor)},v=({el:h,anchor:d},b,w)=>{let S;for(;h&&h!==d;)S=p(h),n(h,b,w),h=S;n(d,b,w)},y=({el:h,anchor:d})=>{let b;for(;h&&h!==d;)b=p(h),i(h),h=b;i(d)},E=(h,d,b,w,S,x,I,R,P)=>{d.type==="svg"?I="svg":d.type==="math"&&(I="mathml"),h==null?L(d,b,w,S,x,I,R,P):H(h,d,S,x,I,R,P)},L=(h,d,b,w,S,x,I,R)=>{let P,O;const{props:U,shapeFlag:M,transition:V,dirs:j}=h;if(P=h.el=o(h.type,x,U&&U.is,U),M&8?c(P,h.children):M&16&&W(h.children,P,null,w,S,Us(h,x),I,R),j&&vt(h,null,w,"created"),F(P,h,h.scopeId,I,w),U){for(const se in U)se!=="value"&&!Vt(se)&&r(P,se,null,U[se],x,w);"value"in U&&r(P,"value",null,U.value,x),(O=U.onVnodeBeforeMount)&&ze(O,w,h)}j&&vt(h,null,w,"beforeMount");const q=_o(S,V);q&&V.beforeEnter(P),n(P,d,b),((O=U&&U.onVnodeMounted)||q||j)&&Pe(()=>{O&&ze(O,w,h),q&&V.enter(P),j&&vt(h,null,w,"mounted")},S)},F=(h,d,b,w,S)=>{if(b&&g(h,b),w)for(let x=0;x{for(let O=P;O{const R=d.el=h.el;let{patchFlag:P,dynamicChildren:O,dirs:U}=d;P|=h.patchFlag&16;const M=h.props||ie,V=d.props||ie;let j;if(b&&bt(b,!1),(j=V.onVnodeBeforeUpdate)&&ze(j,b,d,h),U&&vt(d,h,b,"beforeUpdate"),b&&bt(b,!0),(M.innerHTML&&V.innerHTML==null||M.textContent&&V.textContent==null)&&c(R,""),O?K(h.dynamicChildren,O,R,b,w,Us(d,S),x):I||$(h,d,R,null,b,w,Us(d,S),x,!1),P>0){if(P&16)re(R,M,V,b,S);else if(P&2&&M.class!==V.class&&r(R,"class",null,V.class,S),P&4&&r(R,"style",M.style,V.style,S),P&8){const q=d.dynamicProps;for(let se=0;se{j&&ze(j,b,d,h),U&&vt(d,h,b,"updated")},w)},K=(h,d,b,w,S,x,I)=>{for(let R=0;R{if(d!==b){if(d!==ie)for(const x in d)!Vt(x)&&!(x in b)&&r(h,x,d[x],null,S,w);for(const x in b){if(Vt(x))continue;const I=b[x],R=d[x];I!==R&&x!=="value"&&r(h,x,R,I,S,w)}"value"in b&&r(h,"value",d.value,b.value,S)}},pe=(h,d,b,w,S,x,I,R,P)=>{const O=d.el=h?h.el:l(""),U=d.anchor=h?h.anchor:l("");let{patchFlag:M,dynamicChildren:V,slotScopeIds:j}=d;j&&(R=R?R.concat(j):j),h==null?(n(O,b,w),n(U,b,w),W(d.children||[],b,U,S,x,I,R,P)):M>0&&M&64&&V&&h.dynamicChildren?(K(h.dynamicChildren,V,b,S,x,I,R),(d.key!=null||S&&d===S.subTree)&&Pr(h,d,!0)):$(h,d,b,U,S,x,I,R,P)},Le=(h,d,b,w,S,x,I,R,P)=>{d.slotScopeIds=R,h==null?d.shapeFlag&512?S.ctx.activate(d,b,w,I,P):ot(d,b,w,S,x,I,P):at(h,d,P)},ot=(h,d,b,w,S,x,I)=>{const R=h.component=Go(h,w,S);if(pr(h)&&(R.ctx.renderer=B),qo(R,!1,I),R.asyncDep){if(S&&S.registerDep(R,oe,I),!h.el){const P=R.subTree=de(it);T(null,P,d,b)}}else oe(R,h,d,b,S,x,I)},at=(h,d,b)=>{const w=d.component=h.component;if(Io(h,d,b))if(w.asyncDep&&!w.asyncResolved){Q(w,d,b);return}else w.next=d,w.update();else d.el=h.el,w.vnode=d},oe=(h,d,b,w,S,x,I)=>{const R=()=>{if(h.isMounted){let{next:M,bu:V,u:j,parent:q,vnode:se}=h;{const $e=Rr(h);if($e){M&&(M.el=se.el,Q(h,M,I)),$e.asyncDep.then(()=>{h.isUnmounted||R()});return}}let ee=M,Ce;bt(h,!1),M?(M.el=se.el,Q(h,M,I)):M=se,V&&Is(V),(Ce=M.props&&M.props.onVnodeBeforeUpdate)&&ze(Ce,q,M,se),bt(h,!0);const _e=Qn(h),Ue=h.subTree;h.subTree=_e,_(Ue,_e,f(Ue.el),A(Ue),h,S,x),M.el=_e.el,ee===null&&Mo(h,_e.el),j&&Pe(j,S),(Ce=M.props&&M.props.onVnodeUpdated)&&Pe(()=>ze(Ce,q,M,se),S)}else{let M;const{el:V,props:j}=d,{bm:q,m:se,parent:ee,root:Ce,type:_e}=h,Ue=Pt(d);bt(h,!1),q&&Is(q),!Ue&&(M=j&&j.onVnodeBeforeMount)&&ze(M,ee,d),bt(h,!0);{Ce.ce&&Ce.ce._def.shadowRoot!==!1&&Ce.ce._injectChildStyle(_e);const $e=h.subTree=Qn(h);_(null,$e,b,w,h,S,x),d.el=$e.el}if(se&&Pe(se,S),!Ue&&(M=j&&j.onVnodeMounted)){const $e=d;Pe(()=>ze(M,ee,$e),S)}(d.shapeFlag&256||ee&&Pt(ee.vnode)&&ee.vnode.shapeFlag&256)&&h.a&&Pe(h.a,S),h.isMounted=!0,d=b=w=null}};h.scope.on();const P=h.effect=new $i(R);h.scope.off();const O=h.update=P.run.bind(P),U=h.job=P.runIfDirty.bind(P);U.i=h,U.id=h.uid,P.scheduler=()=>_n(U),bt(h,!0),O()},Q=(h,d,b)=>{d.component=h;const w=h.vnode.props;h.vnode=d,h.next=null,yo(h,d.props,w,b),So(h,d.children,b),st(),Un(h),nt()},$=(h,d,b,w,S,x,I,R,P=!1)=>{const O=h&&h.children,U=h?h.shapeFlag:0,M=d.children,{patchFlag:V,shapeFlag:j}=d;if(V>0){if(V&128){ye(O,M,b,w,S,x,I,R,P);return}else if(V&256){ae(O,M,b,w,S,x,I,R,P);return}}j&8?(U&16&&fe(O,S,x),M!==O&&c(b,M)):U&16?j&16?ye(O,M,b,w,S,x,I,R,P):fe(O,S,x,!0):(U&8&&c(b,""),j&16&&W(M,b,w,S,x,I,R,P))},ae=(h,d,b,w,S,x,I,R,P)=>{h=h||_t,d=d||_t;const O=h.length,U=d.length,M=Math.min(O,U);let V;for(V=0;VU?fe(h,S,x,!0,!1,M):W(d,b,w,S,x,I,R,P,M)},ye=(h,d,b,w,S,x,I,R,P)=>{let O=0;const U=d.length;let M=h.length-1,V=U-1;for(;O<=M&&O<=V;){const j=h[O],q=d[O]=P?ht(d[O]):Ge(d[O]);if(Nt(j,q))_(j,q,b,null,S,x,I,R,P);else break;O++}for(;O<=M&&O<=V;){const j=h[M],q=d[V]=P?ht(d[V]):Ge(d[V]);if(Nt(j,q))_(j,q,b,null,S,x,I,R,P);else break;M--,V--}if(O>M){if(O<=V){const j=V+1,q=jV)for(;O<=M;)te(h[O],S,x,!0),O++;else{const j=O,q=O,se=new Map;for(O=q;O<=V;O++){const Te=d[O]=P?ht(d[O]):Ge(d[O]);Te.key!=null&&se.set(Te.key,O)}let ee,Ce=0;const _e=V-q+1;let Ue=!1,$e=0;const It=new Array(_e);for(O=0;O<_e;O++)It[O]=0;for(O=j;O<=M;O++){const Te=h[O];if(Ce>=_e){te(Te,S,x,!0);continue}let je;if(Te.key!=null)je=se.get(Te.key);else for(ee=q;ee<=V;ee++)if(It[ee-q]===0&&Nt(Te,d[ee])){je=ee;break}je===void 0?te(Te,S,x,!0):(It[je-q]=O+1,je>=$e?$e=je:Ue=!0,_(Te,d[je],b,null,S,x,I,R,P),Ce++)}const Mn=Ue?Oo(It):_t;for(ee=Mn.length-1,O=_e-1;O>=0;O--){const Te=q+O,je=d[Te],Nn=Te+1{const{el:x,type:I,transition:R,children:P,shapeFlag:O}=h;if(O&6){Ae(h.component.subTree,d,b,w);return}if(O&128){h.suspense.move(d,b,w);return}if(O&64){I.move(h,d,b,B);return}if(I===Re){n(x,d,b);for(let M=0;MR.enter(x),S);else{const{leave:M,delayLeave:V,afterLeave:j}=R,q=()=>{h.ctx.isUnmounted?i(x):n(x,d,b)},se=()=>{M(x,()=>{q(),j&&j()})};V?V(x,q,se):se()}else n(x,d,b)},te=(h,d,b,w=!1,S=!1)=>{const{type:x,props:I,ref:R,children:P,dynamicChildren:O,shapeFlag:U,patchFlag:M,dirs:V,cacheIndex:j}=h;if(M===-2&&(S=!1),R!=null&&(st(),jt(R,null,b,h,!0),nt()),j!=null&&(d.renderCache[j]=void 0),U&256){d.ctx.deactivate(h);return}const q=U&1&&V,se=!Pt(h);let ee;if(se&&(ee=I&&I.onVnodeBeforeUnmount)&&ze(ee,d,h),U&6)Ve(h.component,b,w);else{if(U&128){h.suspense.unmount(b,w);return}q&&vt(h,null,d,"beforeUnmount"),U&64?h.type.remove(h,d,b,B,w):O&&!O.hasOnce&&(x!==Re||M>0&&M&64)?fe(O,d,b,!1,!0):(x===Re&&M&384||!S&&U&16)&&fe(P,d,b),w&&ct(h)}(se&&(ee=I&&I.onVnodeUnmounted)||q)&&Pe(()=>{ee&&ze(ee,d,h),q&&vt(h,null,d,"unmounted")},b)},ct=h=>{const{type:d,el:b,anchor:w,transition:S}=h;if(d===Re){we(b,w);return}if(d===fs){y(h);return}const x=()=>{i(b),S&&!S.persisted&&S.afterLeave&&S.afterLeave()};if(h.shapeFlag&1&&S&&!S.persisted){const{leave:I,delayLeave:R}=S,P=()=>I(b,x);R?R(h.el,x,P):P()}else x()},we=(h,d)=>{let b;for(;h!==d;)b=p(h),i(h),h=b;i(d)},Ve=(h,d,b)=>{const{bum:w,scope:S,job:x,subTree:I,um:R,m:P,a:O,parent:U,slots:{__:M}}=h;Yn(P),Yn(O),w&&Is(w),U&&z(M)&&M.forEach(V=>{U.renderCache[V]=void 0}),S.stop(),x&&(x.flags|=8,te(I,h,d,b)),R&&Pe(R,d),Pe(()=>{h.isUnmounted=!0},d),d&&d.pendingBranch&&!d.isUnmounted&&h.asyncDep&&!h.asyncResolved&&h.suspenseId===d.pendingId&&(d.deps--,d.deps===0&&d.resolve())},fe=(h,d,b,w=!1,S=!1,x=0)=>{for(let I=x;I{if(h.shapeFlag&6)return A(h.component.subTree);if(h.shapeFlag&128)return h.suspense.next();const d=p(h.anchor||h.el),b=d&&d[ql];return b?p(b):d};let N=!1;const k=(h,d,b)=>{h==null?d._vnode&&te(d._vnode,null,null,!0):_(d._vnode||null,h,d,null,null,null,b),d._vnode=h,N||(N=!0,Un(),ur(),N=!1)},B={p:_,um:te,m:Ae,r:ct,mt:ot,mc:W,pc:$,pbc:K,n:A,o:t};return{render:k,hydrate:void 0,createApp:vo(k)}}function Us({type:t,props:e},s){return s==="svg"&&t==="foreignObject"||s==="mathml"&&t==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:s}function bt({effect:t,job:e},s){s?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function _o(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function Pr(t,e,s=!1){const n=t.children,i=e.children;if(z(n)&&z(i))for(let r=0;r>1,t[s[l]]0&&(e[n]=s[r-1]),s[r]=n)}}for(r=s.length,o=s[r-1];r-- >0;)s[r]=o,o=e[o];return s}function Rr(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:Rr(e)}function Yn(t){if(t)for(let e=0;ett(Lo);function us(t,e,s){return Dr(t,e,s)}function Dr(t,e,s=ie){const{immediate:n,deep:i,flush:r,once:o}=s,l=be({},s),a=e&&n||!e&&r!=="post";let u;if(ts){if(r==="sync"){const g=To();u=g.__watcherHandles||(g.__watcherHandles=[])}else if(!a){const g=()=>{};return g.stop=qe,g.resume=qe,g.pause=qe,g}}const c=me;l.call=(g,C,_)=>Ke(g,c,C,_);let f=!1;r==="post"?l.scheduler=g=>{Pe(g,c&&c.suspense)}:r!=="sync"&&(f=!0,l.scheduler=(g,C)=>{C?g():_n(g)}),l.augmentJob=g=>{e&&(g.flags|=4),f&&(g.flags|=2,c&&(g.id=c.uid,g.i=c))};const p=$l(t,e,l);return ts&&(u?u.push(p):a&&p()),p}function Po(t,e,s){const n=this.proxy,i=ce(t)?t.includes(".")?kr(n,t):()=>n[t]:t.bind(n,n);let r;G(e)?r=e:(r=e.handler,s=e);const o=rs(this),l=Dr(i,r.bind(n),s);return o(),l}function kr(t,e){const s=e.split(".");return()=>{let n=t;for(let i=0;ie==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${Ie(e)}Modifiers`]||t[`${xt(e)}Modifiers`];function Do(t,e,...s){if(t.isUnmounted)return;const n=t.vnode.props||ie;let i=s;const r=e.startsWith("update:"),o=r&&Ro(n,e.slice(7));o&&(o.trim&&(i=s.map(c=>ce(c)?c.trim():c)),o.number&&(i=s.map(al)));let l,a=n[l=Fs(e)]||n[l=Fs(Ie(e))];!a&&r&&(a=n[l=Fs(xt(e))]),a&&Ke(a,t,6,i);const u=n[l+"Once"];if(u){if(!t.emitted)t.emitted={};else if(t.emitted[l])return;t.emitted[l]=!0,Ke(u,t,6,i)}}function Fr(t,e,s=!1){const n=e.emitsCache,i=n.get(t);if(i!==void 0)return i;const r=t.emits;let o={},l=!1;if(!G(t)){const a=u=>{const c=Fr(u,e,!0);c&&(l=!0,be(o,c))};!s&&e.mixins.length&&e.mixins.forEach(a),t.extends&&a(t.extends),t.mixins&&t.mixins.forEach(a)}return!r&&!l?(le(t)&&n.set(t,null),null):(z(r)?r.forEach(a=>o[a]=null):be(o,r),le(t)&&n.set(t,o),o)}function Rs(t,e){return!t||!ws(e)?!1:(e=e.slice(2).replace(/Once$/,""),X(t,e[0].toLowerCase()+e.slice(1))||X(t,xt(e))||X(t,e))}function Qn(t){const{type:e,vnode:s,proxy:n,withProxy:i,propsOptions:[r],slots:o,attrs:l,emit:a,render:u,renderCache:c,props:f,data:p,setupState:g,ctx:C,inheritAttrs:_}=t,D=bs(t);let T,m;try{if(s.shapeFlag&4){const y=i||n,E=y;T=Ge(u.call(E,y,c,f,g,p,C)),m=l}else{const y=e;T=Ge(y.length>1?y(f,{attrs:l,slots:o,emit:a}):y(f,null)),m=e.props?l:ko(l)}}catch(y){Wt.length=0,Ls(y,t,1),T=de(it)}let v=T;if(m&&_!==!1){const y=Object.keys(m),{shapeFlag:E}=v;y.length&&E&7&&(r&&y.some(pn)&&(m=Fo(m,r)),v=Dt(v,m,!1,!0))}return s.dirs&&(v=Dt(v,null,!1,!0),v.dirs=v.dirs?v.dirs.concat(s.dirs):s.dirs),s.transition&&On(v,s.transition),T=v,bs(D),T}const ko=t=>{let e;for(const s in t)(s==="class"||s==="style"||ws(s))&&((e||(e={}))[s]=t[s]);return e},Fo=(t,e)=>{const s={};for(const n in t)(!pn(n)||!(n.slice(9)in e))&&(s[n]=t[n]);return s};function Io(t,e,s){const{props:n,children:i,component:r}=t,{props:o,children:l,patchFlag:a}=e,u=r.emitsOptions;if(e.dirs||e.transition)return!0;if(s&&a>=0){if(a&1024)return!0;if(a&16)return n?Jn(n,o,u):!!o;if(a&8){const c=e.dynamicProps;for(let f=0;ft.__isSuspense;function No(t,e){e&&e.pendingBranch?z(t)?e.effects.push(...t):e.effects.push(t):Wl(t)}const Re=Symbol.for("v-fgt"),Ds=Symbol.for("v-txt"),it=Symbol.for("v-cmt"),fs=Symbol.for("v-stc"),Wt=[];let De=null;function Zt(t=!1){Wt.push(De=t?null:[])}function Bo(){Wt.pop(),De=Wt[Wt.length-1]||null}let Xt=1;function Zn(t,e=!1){Xt+=t,t<0&&De&&e&&(De.hasOnce=!0)}function Mr(t){return t.dynamicChildren=Xt>0?De||_t:null,Bo(),Xt>0&&De&&De.push(t),t}function Nr(t,e,s,n,i,r){return Mr(Ze(t,e,s,n,i,r,!0))}function ln(t,e,s,n,i){return Mr(de(t,e,s,n,i,!0))}function es(t){return t?t.__v_isVNode===!0:!1}function Nt(t,e){return t.type===e.type&&t.key===e.key}const Br=({key:t})=>t??null,hs=({ref:t,ref_key:e,ref_for:s})=>(typeof t=="number"&&(t=""+t),t!=null?ce(t)||ve(t)||G(t)?{i:Ee,r:t,k:e,f:!!s}:t:null);function Ze(t,e=null,s=null,n=0,i=null,r=t===Re?0:1,o=!1,l=!1){const a={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&Br(e),ref:e&&hs(e),scopeId:hr,slotScopeIds:null,children:s,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:r,patchFlag:n,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:Ee};return l?(Pn(a,s),r&128&&t.normalize(a)):s&&(a.shapeFlag|=ce(s)?8:16),Xt>0&&!o&&De&&(a.patchFlag>0||r&6)&&a.patchFlag!==32&&De.push(a),a}const de=Ho;function Ho(t,e=null,s=null,n=0,i=null,r=!1){if((!t||t===oo)&&(t=it),es(t)){const l=Dt(t,e,!0);return s&&Pn(l,s),Xt>0&&!r&&De&&(l.shapeFlag&6?De[De.indexOf(t)]=l:De.push(l)),l.patchFlag=-2,l}if(Zo(t)&&(t=t.__vccOpts),e){e=Vo(e);let{class:l,style:a}=e;l&&!ce(l)&&(e.class=bn(l)),le(a)&&(Cn(a)&&!z(a)&&(a=be({},a)),e.style=vn(a))}const o=ce(t)?1:Ir(t)?128:Kl(t)?64:le(t)?4:G(t)?2:0;return Ze(t,e,s,n,i,o,r,!0)}function Vo(t){return t?Cn(t)||Er(t)?be({},t):t:null}function Dt(t,e,s=!1,n=!1){const{props:i,ref:r,patchFlag:o,children:l,transition:a}=t,u=e?jo(i||{},e):i,c={__v_isVNode:!0,__v_skip:!0,type:t.type,props:u,key:u&&Br(u),ref:e&&e.ref?s&&r?z(r)?r.concat(hs(e)):[r,hs(e)]:hs(e):r,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:l,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==Re?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:a,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&Dt(t.ssContent),ssFallback:t.ssFallback&&Dt(t.ssFallback),el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return a&&n&&On(c,a.clone(c)),c}function ds(t=" ",e=0){return de(Ds,null,t,e)}function Uo(t,e){const s=de(fs,null,t);return s.staticCount=e,s}function $o(t="",e=!1){return e?(Zt(),ln(it,null,t)):de(it,null,t)}function Ge(t){return t==null||typeof t=="boolean"?de(it):z(t)?de(Re,null,t.slice()):es(t)?ht(t):de(Ds,null,String(t))}function ht(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:Dt(t)}function Pn(t,e){let s=0;const{shapeFlag:n}=t;if(e==null)e=null;else if(z(e))s=16;else if(typeof e=="object")if(n&65){const i=e.default;i&&(i._c&&(i._d=!1),Pn(t,i()),i._c&&(i._d=!0));return}else{s=32;const i=e._;!i&&!Er(e)?e._ctx=Ee:i===3&&Ee&&(Ee.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else G(e)?(e={default:e,_ctx:Ee},s=32):(e=String(e),n&64?(s=16,e=[ds(e)]):s=8);t.children=e,t.shapeFlag|=s}function jo(...t){const e={};for(let s=0;s{let i;return(i=t[s])||(i=t[s]=[]),i.push(n),r=>{i.length>1?i.forEach(o=>o(r)):i[0](r)}};As=e("__VUE_INSTANCE_SETTERS__",s=>me=s),on=e("__VUE_SSR_SETTERS__",s=>ts=s)}const rs=t=>{const e=me;return As(t),t.scope.on(),()=>{t.scope.off(),As(e)}},Xn=()=>{me&&me.scope.off(),As(null)};function Hr(t){return t.vnode.shapeFlag&4}let ts=!1;function qo(t,e=!1,s=!1){e&&on(e);const{props:n,children:i}=t.vnode,r=Hr(t);bo(t,n,r,e),xo(t,i,s||e);const o=r?Ko(t,e):void 0;return e&&on(!1),o}function Ko(t,e){const s=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,co);const{setup:n}=s;if(n){st();const i=t.setupContext=n.length>1?Qo(t):null,r=rs(t),o=is(n,t,0,[t.props,i]),l=Ii(o);if(nt(),r(),(l||t.sp)&&!Pt(t)&&dr(t),l){if(o.then(Xn,Xn),e)return o.then(a=>{ei(t,a)}).catch(a=>{Ls(a,t,0)});t.asyncDep=o}else ei(t,o)}else Vr(t)}function ei(t,e,s){G(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:le(e)&&(t.setupState=lr(e)),Vr(t)}function Vr(t,e,s){const n=t.type;t.render||(t.render=n.render||qe);{const i=rs(t);st();try{uo(t)}finally{nt(),i()}}}const Yo={get(t,e){return ge(t,"get",""),t[e]}};function Qo(t){const e=s=>{t.exposed=s||{}};return{attrs:new Proxy(t.attrs,Yo),slots:t.slots,emit:t.emit,expose:e}}function Rn(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(lr(Il(t.exposed)),{get(e,s){if(s in e)return e[s];if(s in zt)return zt[s](t)},has(e,s){return s in e||s in zt}})):t.proxy}function Jo(t,e=!0){return G(t)?t.displayName||t.name:t.name||e&&t.__name}function Zo(t){return G(t)&&"__vccOpts"in t}const Ne=(t,e)=>Vl(t,e,ts);function Ur(t,e,s){const n=arguments.length;return n===2?le(e)&&!z(e)?es(e)?de(t,null,[e]):de(t,e):de(t,null,e):(n>3?s=Array.prototype.slice.call(arguments,2):n===3&&es(s)&&(s=[s]),de(t,e,s))}const Xo="3.5.17";/** +**/function is(t,e,s,n){try{return n?t(...n):t()}catch(i){Ls(i,e,s)}}function Ke(t,e,s,n){if(G(t)){const i=is(t,e,s,n);return i&&Ii(i)&&i.catch(r=>{Ls(r,e,s)}),i}if(z(t)){const i=[];for(let r=0;r>>1,i=Se[n],r=Jt(i);r=Jt(s)?Se.push(t):Se.splice(zl(e),0,t),t.flags|=1,cr()}}function cr(){vs||(vs=or.then(fr))}function Wl(t){z(t)?Tt.push(...t):ft&&t.id===-1?ft.splice(Et+1,0,t):t.flags&1||(Tt.push(t),t.flags|=1),cr()}function Un(t,e,s=We+1){for(;sJt(s)-Jt(n));if(Tt.length=0,ft){ft.push(...e);return}for(ft=e,Et=0;Ett.id==null?t.flags&2?-1:1/0:t.id;function fr(t){try{for(We=0;We{n._d&&Zn(-1);const r=bs(e);let o;try{o=t(...i)}finally{bs(r),n._d&&Zn(1)}return o};return n._n=!0,n._c=!0,n._d=!0,n}function vt(t,e,s,n){const i=t.dirs,r=e&&e.dirs;for(let o=0;ot.__isTeleport;function On(t,e){t.shapeFlag&6&&t.component?(t.transition=e,On(t.component.subTree,e)):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}/*! #__NO_SIDE_EFFECTS__ */function Ts(t,e){return G(t)?be({name:t.name},e,{setup:t}):t}function dr(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function jt(t,e,s,n,i=!1){if(z(t)){t.forEach((_,C)=>jt(_,e&&(z(e)?e[C]:e),s,n,i));return}if(Pt(n)&&!i){n.shapeFlag&512&&n.type.__asyncResolved&&n.component.subTree.component&&jt(t,e,s,n.component.subTree);return}const r=n.shapeFlag&4?Rn(n.component):n.el,o=i?null:r,{i:l,r:a}=t,u=e&&e.r,c=l.refs===ie?l.refs={}:l.refs,f=l.setupState,p=Z(f),g=f===ie?()=>!1:_=>X(p,_);if(u!=null&&u!==a&&(ce(u)?(c[u]=null,g(u)&&(f[u]=null)):ve(u)&&(u.value=null)),G(a))is(a,l,12,[o,c]);else{const _=ce(a),C=ve(a);if(_||C){const D=()=>{if(t.f){const T=_?g(a)?f[a]:c[a]:a.value;i?z(T)&&gn(T,r):z(T)?T.includes(r)||T.push(r):_?(c[a]=[r],g(a)&&(f[a]=c[a])):(a.value=[r],t.k&&(c[t.k]=a.value))}else _?(c[a]=o,g(a)&&(f[a]=o)):C&&(a.value=o,t.k&&(c[t.k]=o))};o?(D.id=-1,Pe(D,s)):D()}}}Cs().requestIdleCallback;Cs().cancelIdleCallback;const Pt=t=>!!t.type.__asyncLoader,pr=t=>t.type.__isKeepAlive;function Yl(t,e){gr(t,"a",e)}function Ql(t,e){gr(t,"da",e)}function gr(t,e,s=me){const n=t.__wdc||(t.__wdc=()=>{let i=s;for(;i;){if(i.isDeactivated)return;i=i.parent}return t()});if(Ps(e,n,s),s){let i=s.parent;for(;i&&i.parent;)pr(i.parent.vnode)&&Jl(n,e,s,i),i=i.parent}}function Jl(t,e,s,n){const i=Ps(e,t,n,!0);vr(()=>{gn(n[e],i)},s)}function Ps(t,e,s=me,n=!1){if(s){const i=s[t]||(s[t]=[]),r=e.__weh||(e.__weh=(...o)=>{st();const l=rs(s),a=Ke(e,s,t,o);return l(),nt(),a});return n?i.unshift(r):i.push(r),r}}const lt=t=>(e,s=me)=>{(!ts||t==="sp")&&Ps(t,(...n)=>e(...n),s)},Zl=lt("bm"),mr=lt("m"),Xl=lt("bu"),eo=lt("u"),to=lt("bum"),vr=lt("um"),so=lt("sp"),no=lt("rtg"),io=lt("rtc");function ro(t,e=me){Ps("ec",t,e)}const lo="components";function $n(t,e){return ao(lo,t,!0,e)||t}const oo=Symbol.for("v-ndc");function ao(t,e,s=!0,n=!1){const i=Ee||me;if(i){const r=i.type;{const l=Jo(r,!1);if(l&&(l===e||l===Ie(e)||l===Es(Ie(e))))return r}const o=jn(i[t]||r[t],e)||jn(i.appContext[t],e);return!o&&n?r:o}}function jn(t,e){return t&&(t[e]||t[Ie(e)]||t[Es(Ie(e))])}function tu(t,e,s,n){let i;const r=s,o=z(t);if(o||ce(t)){const l=o&&Lt(t);let a=!1,u=!1;l&&(a=!Fe(t),u=mt(t),t=_s(t)),i=new Array(t.length);for(let c=0,f=t.length;ce(l,a,void 0,r));else{const l=Object.keys(t);i=new Array(l.length);for(let a=0,u=l.length;aes(e)?!(e.type===it||e.type===Re&&!br(e.children)):!0)?t:null}const tn=t=>t?Hr(t)?Rn(t):tn(t.parent):null,zt=be(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>tn(t.parent),$root:t=>tn(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>Ar(t),$forceUpdate:t=>t.f||(t.f=()=>{_n(t.update)}),$nextTick:t=>t.n||(t.n=ar.bind(t.proxy)),$watch:t=>Po.bind(t)}),Vs=(t,e)=>t!==ie&&!t.__isScriptSetup&&X(t,e),co={get({_:t},e){if(e==="__v_skip")return!0;const{ctx:s,setupState:n,data:i,props:r,accessCache:o,type:l,appContext:a}=t;let u;if(e[0]!=="$"){const g=o[e];if(g!==void 0)switch(g){case 1:return n[e];case 2:return i[e];case 4:return s[e];case 3:return r[e]}else{if(Vs(n,e))return o[e]=1,n[e];if(i!==ie&&X(i,e))return o[e]=2,i[e];if((u=t.propsOptions[0])&&X(u,e))return o[e]=3,r[e];if(s!==ie&&X(s,e))return o[e]=4,s[e];sn&&(o[e]=0)}}const c=zt[e];let f,p;if(c)return e==="$attrs"&&ge(t.attrs,"get",""),c(t);if((f=l.__cssModules)&&(f=f[e]))return f;if(s!==ie&&X(s,e))return o[e]=4,s[e];if(p=a.config.globalProperties,X(p,e))return p[e]},set({_:t},e,s){const{data:n,setupState:i,ctx:r}=t;return Vs(i,e)?(i[e]=s,!0):n!==ie&&X(n,e)?(n[e]=s,!0):X(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(r[e]=s,!0)},has({_:{data:t,setupState:e,accessCache:s,ctx:n,appContext:i,propsOptions:r}},o){let l;return!!s[o]||t!==ie&&X(t,o)||Vs(e,o)||(l=r[0])&&X(l,o)||X(n,o)||X(zt,o)||X(i.config.globalProperties,o)},defineProperty(t,e,s){return s.get!=null?t._.accessCache[e]=0:X(s,"value")&&this.set(t,e,s.value,null),Reflect.defineProperty(t,e,s)}};function zn(t){return z(t)?t.reduce((e,s)=>(e[s]=null,e),{}):t}let sn=!0;function uo(t){const e=Ar(t),s=t.proxy,n=t.ctx;sn=!1,e.beforeCreate&&Wn(e.beforeCreate,t,"bc");const{data:i,computed:r,methods:o,watch:l,provide:a,inject:u,created:c,beforeMount:f,mounted:p,beforeUpdate:g,updated:_,activated:C,deactivated:D,beforeDestroy:T,beforeUnmount:m,destroyed:b,unmounted:y,render:S,renderTracked:O,renderTriggered:F,errorCaptured:W,serverPrefetch:H,expose:K,inheritAttrs:re,components:pe,directives:Le,filters:ot}=e;if(u&&fo(u,n,null),o)for(const Q in o){const $=o[Q];G($)&&(n[Q]=$.bind(s))}if(i){const Q=i.call(s,s);le(Q)&&(t.data=Os(Q))}if(sn=!0,r)for(const Q in r){const $=r[Q],ae=G($)?$.bind(s,s):G($.get)?$.get.bind(s,s):qe,ye=!G($)&&G($.set)?$.set.bind(s):qe,Ae=Ne({get:ae,set:ye});Object.defineProperty(n,Q,{enumerable:!0,configurable:!0,get:()=>Ae.value,set:te=>Ae.value=te})}if(l)for(const Q in l)yr(l[Q],n,s,Q);if(a){const Q=G(a)?a.call(s):a;Reflect.ownKeys(Q).forEach($=>{cs($,Q[$])})}c&&Wn(c,t,"c");function oe(Q,$){z($)?$.forEach(ae=>Q(ae.bind(s))):$&&Q($.bind(s))}if(oe(Zl,f),oe(mr,p),oe(Xl,g),oe(eo,_),oe(Yl,C),oe(Ql,D),oe(ro,W),oe(io,O),oe(no,F),oe(to,m),oe(vr,y),oe(so,H),z(K))if(K.length){const Q=t.exposed||(t.exposed={});K.forEach($=>{Object.defineProperty(Q,$,{get:()=>s[$],set:ae=>s[$]=ae})})}else t.exposed||(t.exposed={});S&&t.render===qe&&(t.render=S),re!=null&&(t.inheritAttrs=re),pe&&(t.components=pe),Le&&(t.directives=Le),H&&dr(t)}function fo(t,e,s=qe){z(t)&&(t=nn(t));for(const n in t){const i=t[n];let r;le(i)?"default"in i?r=tt(i.from||n,i.default,!0):r=tt(i.from||n):r=tt(i),ve(r)?Object.defineProperty(e,n,{enumerable:!0,configurable:!0,get:()=>r.value,set:o=>r.value=o}):e[n]=r}}function Wn(t,e,s){Ke(z(t)?t.map(n=>n.bind(e.proxy)):t.bind(e.proxy),e,s)}function yr(t,e,s,n){let i=n.includes(".")?kr(s,n):()=>s[n];if(ce(t)){const r=e[t];G(r)&&us(i,r)}else if(G(t))us(i,t.bind(s));else if(le(t))if(z(t))t.forEach(r=>yr(r,e,s,n));else{const r=G(t.handler)?t.handler.bind(s):e[t.handler];G(r)&&us(i,r,t)}}function Ar(t){const e=t.type,{mixins:s,extends:n}=e,{mixins:i,optionsCache:r,config:{optionMergeStrategies:o}}=t.appContext,l=r.get(e);let a;return l?a=l:!i.length&&!s&&!n?a=e:(a={},i.length&&i.forEach(u=>ys(a,u,o,!0)),ys(a,e,o)),le(e)&&r.set(e,a),a}function ys(t,e,s,n=!1){const{mixins:i,extends:r}=e;r&&ys(t,r,s,!0),i&&i.forEach(o=>ys(t,o,s,!0));for(const o in e)if(!(n&&o==="expose")){const l=ho[o]||s&&s[o];t[o]=l?l(t[o],e[o]):e[o]}return t}const ho={data:Gn,props:qn,emits:qn,methods:Ht,computed:Ht,beforeCreate:xe,created:xe,beforeMount:xe,mounted:xe,beforeUpdate:xe,updated:xe,beforeDestroy:xe,beforeUnmount:xe,destroyed:xe,unmounted:xe,activated:xe,deactivated:xe,errorCaptured:xe,serverPrefetch:xe,components:Ht,directives:Ht,watch:go,provide:Gn,inject:po};function Gn(t,e){return e?t?function(){return be(G(t)?t.call(this,this):t,G(e)?e.call(this,this):e)}:e:t}function po(t,e){return Ht(nn(t),nn(e))}function nn(t){if(z(t)){const e={};for(let s=0;s1)return s&&G(e)?e.call(n&&n.proxy):e}}const xr={},Sr=()=>Object.create(xr),Er=t=>Object.getPrototypeOf(t)===xr;function bo(t,e,s,n=!1){const i={},r=Sr();t.propsDefaults=Object.create(null),Cr(t,e,i,r);for(const o in t.propsOptions[0])o in i||(i[o]=void 0);s?t.props=n?i:sr(i):t.type.props?t.props=i:t.props=r,t.attrs=r}function yo(t,e,s,n){const{props:i,attrs:r,vnode:{patchFlag:o}}=t,l=Z(i),[a]=t.propsOptions;let u=!1;if((n||o>0)&&!(o&16)){if(o&8){const c=t.vnode.dynamicProps;for(let f=0;f{a=!0;const[p,g]=_r(f,e,!0);be(o,p),g&&l.push(...g)};!s&&e.mixins.length&&e.mixins.forEach(c),t.extends&&c(t.extends),t.mixins&&t.mixins.forEach(c)}if(!r&&!a)return le(t)&&n.set(t,_t),_t;if(z(r))for(let c=0;ct[0]==="_"||t==="$stable",Tn=t=>z(t)?t.map(Ge):[Ge(t)],wo=(t,e,s)=>{if(e._n)return e;const n=Gl((...i)=>Tn(e(...i)),s);return n._c=!1,n},Or=(t,e,s)=>{const n=t._ctx;for(const i in t){if(Ln(i))continue;const r=t[i];if(G(r))e[i]=wo(i,r,n);else if(r!=null){const o=Tn(r);e[i]=()=>o}}},Lr=(t,e)=>{const s=Tn(e);t.slots.default=()=>s},Tr=(t,e,s)=>{for(const n in e)(s||!Ln(n))&&(t[n]=e[n])},xo=(t,e,s)=>{const n=t.slots=Sr();if(t.vnode.shapeFlag&32){const i=e.__;i&&Qs(n,"__",i,!0);const r=e._;r?(Tr(n,e,s),s&&Qs(n,"_",r,!0)):Or(e,n)}else e&&Lr(t,e)},So=(t,e,s)=>{const{vnode:n,slots:i}=t;let r=!0,o=ie;if(n.shapeFlag&32){const l=e._;l?s&&l===1?r=!1:Tr(i,e,s):(r=!e.$stable,Or(e,i)),o=e}else e&&(Lr(t,e),o={default:1});if(r)for(const l in i)!Ln(l)&&o[l]==null&&delete i[l]},Pe=No;function Eo(t){return Co(t)}function Co(t,e){const s=Cs();s.__VUE__=!0;const{insert:n,remove:i,patchProp:r,createElement:o,createText:l,createComment:a,setText:u,setElementText:c,parentNode:f,nextSibling:p,setScopeId:g=qe,insertStaticContent:_}=t,C=(h,d,v,w=null,E=null,x=null,I=void 0,R=null,P=!!d.dynamicChildren)=>{if(h===d)return;h&&!Nt(h,d)&&(w=A(h),te(h,E,x,!0),h=null),d.patchFlag===-2&&(P=!1,d.dynamicChildren=null);const{type:L,ref:U,shapeFlag:M}=d;switch(L){case Ds:D(h,d,v,w);break;case it:T(h,d,v,w);break;case fs:h==null&&m(d,v,w,I);break;case Re:pe(h,d,v,w,E,x,I,R,P);break;default:M&1?S(h,d,v,w,E,x,I,R,P):M&6?Le(h,d,v,w,E,x,I,R,P):(M&64||M&128)&&L.process(h,d,v,w,E,x,I,R,P,B)}U!=null&&E?jt(U,h&&h.ref,x,d||h,!d):U==null&&h&&h.ref!=null&&jt(h.ref,null,x,h,!0)},D=(h,d,v,w)=>{if(h==null)n(d.el=l(d.children),v,w);else{const E=d.el=h.el;d.children!==h.children&&u(E,d.children)}},T=(h,d,v,w)=>{h==null?n(d.el=a(d.children||""),v,w):d.el=h.el},m=(h,d,v,w)=>{[h.el,h.anchor]=_(h.children,d,v,w,h.el,h.anchor)},b=({el:h,anchor:d},v,w)=>{let E;for(;h&&h!==d;)E=p(h),n(h,v,w),h=E;n(d,v,w)},y=({el:h,anchor:d})=>{let v;for(;h&&h!==d;)v=p(h),i(h),h=v;i(d)},S=(h,d,v,w,E,x,I,R,P)=>{d.type==="svg"?I="svg":d.type==="math"&&(I="mathml"),h==null?O(d,v,w,E,x,I,R,P):H(h,d,E,x,I,R,P)},O=(h,d,v,w,E,x,I,R)=>{let P,L;const{props:U,shapeFlag:M,transition:V,dirs:j}=h;if(P=h.el=o(h.type,x,U&&U.is,U),M&8?c(P,h.children):M&16&&W(h.children,P,null,w,E,Us(h,x),I,R),j&&vt(h,null,w,"created"),F(P,h,h.scopeId,I,w),U){for(const se in U)se!=="value"&&!Vt(se)&&r(P,se,null,U[se],x,w);"value"in U&&r(P,"value",null,U.value,x),(L=U.onVnodeBeforeMount)&&ze(L,w,h)}j&&vt(h,null,w,"beforeMount");const q=_o(E,V);q&&V.beforeEnter(P),n(P,d,v),((L=U&&U.onVnodeMounted)||q||j)&&Pe(()=>{L&&ze(L,w,h),q&&V.enter(P),j&&vt(h,null,w,"mounted")},E)},F=(h,d,v,w,E)=>{if(v&&g(h,v),w)for(let x=0;x{for(let L=P;L{const R=d.el=h.el;let{patchFlag:P,dynamicChildren:L,dirs:U}=d;P|=h.patchFlag&16;const M=h.props||ie,V=d.props||ie;let j;if(v&&bt(v,!1),(j=V.onVnodeBeforeUpdate)&&ze(j,v,d,h),U&&vt(d,h,v,"beforeUpdate"),v&&bt(v,!0),(M.innerHTML&&V.innerHTML==null||M.textContent&&V.textContent==null)&&c(R,""),L?K(h.dynamicChildren,L,R,v,w,Us(d,E),x):I||$(h,d,R,null,v,w,Us(d,E),x,!1),P>0){if(P&16)re(R,M,V,v,E);else if(P&2&&M.class!==V.class&&r(R,"class",null,V.class,E),P&4&&r(R,"style",M.style,V.style,E),P&8){const q=d.dynamicProps;for(let se=0;se{j&&ze(j,v,d,h),U&&vt(d,h,v,"updated")},w)},K=(h,d,v,w,E,x,I)=>{for(let R=0;R{if(d!==v){if(d!==ie)for(const x in d)!Vt(x)&&!(x in v)&&r(h,x,d[x],null,E,w);for(const x in v){if(Vt(x))continue;const I=v[x],R=d[x];I!==R&&x!=="value"&&r(h,x,R,I,E,w)}"value"in v&&r(h,"value",d.value,v.value,E)}},pe=(h,d,v,w,E,x,I,R,P)=>{const L=d.el=h?h.el:l(""),U=d.anchor=h?h.anchor:l("");let{patchFlag:M,dynamicChildren:V,slotScopeIds:j}=d;j&&(R=R?R.concat(j):j),h==null?(n(L,v,w),n(U,v,w),W(d.children||[],v,U,E,x,I,R,P)):M>0&&M&64&&V&&h.dynamicChildren?(K(h.dynamicChildren,V,v,E,x,I,R),(d.key!=null||E&&d===E.subTree)&&Pr(h,d,!0)):$(h,d,v,U,E,x,I,R,P)},Le=(h,d,v,w,E,x,I,R,P)=>{d.slotScopeIds=R,h==null?d.shapeFlag&512?E.ctx.activate(d,v,w,I,P):ot(d,v,w,E,x,I,P):at(h,d,P)},ot=(h,d,v,w,E,x,I)=>{const R=h.component=Go(h,w,E);if(pr(h)&&(R.ctx.renderer=B),qo(R,!1,I),R.asyncDep){if(E&&E.registerDep(R,oe,I),!h.el){const P=R.subTree=de(it);T(null,P,d,v)}}else oe(R,h,d,v,E,x,I)},at=(h,d,v)=>{const w=d.component=h.component;if(Io(h,d,v))if(w.asyncDep&&!w.asyncResolved){Q(w,d,v);return}else w.next=d,w.update();else d.el=h.el,w.vnode=d},oe=(h,d,v,w,E,x,I)=>{const R=()=>{if(h.isMounted){let{next:M,bu:V,u:j,parent:q,vnode:se}=h;{const $e=Rr(h);if($e){M&&(M.el=se.el,Q(h,M,I)),$e.asyncDep.then(()=>{h.isUnmounted||R()});return}}let ee=M,Ce;bt(h,!1),M?(M.el=se.el,Q(h,M,I)):M=se,V&&Is(V),(Ce=M.props&&M.props.onVnodeBeforeUpdate)&&ze(Ce,q,M,se),bt(h,!0);const _e=Qn(h),Ue=h.subTree;h.subTree=_e,C(Ue,_e,f(Ue.el),A(Ue),h,E,x),M.el=_e.el,ee===null&&Mo(h,_e.el),j&&Pe(j,E),(Ce=M.props&&M.props.onVnodeUpdated)&&Pe(()=>ze(Ce,q,M,se),E)}else{let M;const{el:V,props:j}=d,{bm:q,m:se,parent:ee,root:Ce,type:_e}=h,Ue=Pt(d);bt(h,!1),q&&Is(q),!Ue&&(M=j&&j.onVnodeBeforeMount)&&ze(M,ee,d),bt(h,!0);{Ce.ce&&Ce.ce._def.shadowRoot!==!1&&Ce.ce._injectChildStyle(_e);const $e=h.subTree=Qn(h);C(null,$e,v,w,h,E,x),d.el=$e.el}if(se&&Pe(se,E),!Ue&&(M=j&&j.onVnodeMounted)){const $e=d;Pe(()=>ze(M,ee,$e),E)}(d.shapeFlag&256||ee&&Pt(ee.vnode)&&ee.vnode.shapeFlag&256)&&h.a&&Pe(h.a,E),h.isMounted=!0,d=v=w=null}};h.scope.on();const P=h.effect=new $i(R);h.scope.off();const L=h.update=P.run.bind(P),U=h.job=P.runIfDirty.bind(P);U.i=h,U.id=h.uid,P.scheduler=()=>_n(U),bt(h,!0),L()},Q=(h,d,v)=>{d.component=h;const w=h.vnode.props;h.vnode=d,h.next=null,yo(h,d.props,w,v),So(h,d.children,v),st(),Un(h),nt()},$=(h,d,v,w,E,x,I,R,P=!1)=>{const L=h&&h.children,U=h?h.shapeFlag:0,M=d.children,{patchFlag:V,shapeFlag:j}=d;if(V>0){if(V&128){ye(L,M,v,w,E,x,I,R,P);return}else if(V&256){ae(L,M,v,w,E,x,I,R,P);return}}j&8?(U&16&&fe(L,E,x),M!==L&&c(v,M)):U&16?j&16?ye(L,M,v,w,E,x,I,R,P):fe(L,E,x,!0):(U&8&&c(v,""),j&16&&W(M,v,w,E,x,I,R,P))},ae=(h,d,v,w,E,x,I,R,P)=>{h=h||_t,d=d||_t;const L=h.length,U=d.length,M=Math.min(L,U);let V;for(V=0;VU?fe(h,E,x,!0,!1,M):W(d,v,w,E,x,I,R,P,M)},ye=(h,d,v,w,E,x,I,R,P)=>{let L=0;const U=d.length;let M=h.length-1,V=U-1;for(;L<=M&&L<=V;){const j=h[L],q=d[L]=P?ht(d[L]):Ge(d[L]);if(Nt(j,q))C(j,q,v,null,E,x,I,R,P);else break;L++}for(;L<=M&&L<=V;){const j=h[M],q=d[V]=P?ht(d[V]):Ge(d[V]);if(Nt(j,q))C(j,q,v,null,E,x,I,R,P);else break;M--,V--}if(L>M){if(L<=V){const j=V+1,q=jV)for(;L<=M;)te(h[L],E,x,!0),L++;else{const j=L,q=L,se=new Map;for(L=q;L<=V;L++){const Te=d[L]=P?ht(d[L]):Ge(d[L]);Te.key!=null&&se.set(Te.key,L)}let ee,Ce=0;const _e=V-q+1;let Ue=!1,$e=0;const It=new Array(_e);for(L=0;L<_e;L++)It[L]=0;for(L=j;L<=M;L++){const Te=h[L];if(Ce>=_e){te(Te,E,x,!0);continue}let je;if(Te.key!=null)je=se.get(Te.key);else for(ee=q;ee<=V;ee++)if(It[ee-q]===0&&Nt(Te,d[ee])){je=ee;break}je===void 0?te(Te,E,x,!0):(It[je-q]=L+1,je>=$e?$e=je:Ue=!0,C(Te,d[je],v,null,E,x,I,R,P),Ce++)}const Mn=Ue?Oo(It):_t;for(ee=Mn.length-1,L=_e-1;L>=0;L--){const Te=q+L,je=d[Te],Nn=Te+1{const{el:x,type:I,transition:R,children:P,shapeFlag:L}=h;if(L&6){Ae(h.component.subTree,d,v,w);return}if(L&128){h.suspense.move(d,v,w);return}if(L&64){I.move(h,d,v,B);return}if(I===Re){n(x,d,v);for(let M=0;MR.enter(x),E);else{const{leave:M,delayLeave:V,afterLeave:j}=R,q=()=>{h.ctx.isUnmounted?i(x):n(x,d,v)},se=()=>{M(x,()=>{q(),j&&j()})};V?V(x,q,se):se()}else n(x,d,v)},te=(h,d,v,w=!1,E=!1)=>{const{type:x,props:I,ref:R,children:P,dynamicChildren:L,shapeFlag:U,patchFlag:M,dirs:V,cacheIndex:j}=h;if(M===-2&&(E=!1),R!=null&&(st(),jt(R,null,v,h,!0),nt()),j!=null&&(d.renderCache[j]=void 0),U&256){d.ctx.deactivate(h);return}const q=U&1&&V,se=!Pt(h);let ee;if(se&&(ee=I&&I.onVnodeBeforeUnmount)&&ze(ee,d,h),U&6)Ve(h.component,v,w);else{if(U&128){h.suspense.unmount(v,w);return}q&&vt(h,null,d,"beforeUnmount"),U&64?h.type.remove(h,d,v,B,w):L&&!L.hasOnce&&(x!==Re||M>0&&M&64)?fe(L,d,v,!1,!0):(x===Re&&M&384||!E&&U&16)&&fe(P,d,v),w&&ct(h)}(se&&(ee=I&&I.onVnodeUnmounted)||q)&&Pe(()=>{ee&&ze(ee,d,h),q&&vt(h,null,d,"unmounted")},v)},ct=h=>{const{type:d,el:v,anchor:w,transition:E}=h;if(d===Re){we(v,w);return}if(d===fs){y(h);return}const x=()=>{i(v),E&&!E.persisted&&E.afterLeave&&E.afterLeave()};if(h.shapeFlag&1&&E&&!E.persisted){const{leave:I,delayLeave:R}=E,P=()=>I(v,x);R?R(h.el,x,P):P()}else x()},we=(h,d)=>{let v;for(;h!==d;)v=p(h),i(h),h=v;i(d)},Ve=(h,d,v)=>{const{bum:w,scope:E,job:x,subTree:I,um:R,m:P,a:L,parent:U,slots:{__:M}}=h;Yn(P),Yn(L),w&&Is(w),U&&z(M)&&M.forEach(V=>{U.renderCache[V]=void 0}),E.stop(),x&&(x.flags|=8,te(I,h,d,v)),R&&Pe(R,d),Pe(()=>{h.isUnmounted=!0},d),d&&d.pendingBranch&&!d.isUnmounted&&h.asyncDep&&!h.asyncResolved&&h.suspenseId===d.pendingId&&(d.deps--,d.deps===0&&d.resolve())},fe=(h,d,v,w=!1,E=!1,x=0)=>{for(let I=x;I{if(h.shapeFlag&6)return A(h.component.subTree);if(h.shapeFlag&128)return h.suspense.next();const d=p(h.anchor||h.el),v=d&&d[ql];return v?p(v):d};let N=!1;const k=(h,d,v)=>{h==null?d._vnode&&te(d._vnode,null,null,!0):C(d._vnode||null,h,d,null,null,null,v),d._vnode=h,N||(N=!0,Un(),ur(),N=!1)},B={p:C,um:te,m:Ae,r:ct,mt:ot,mc:W,pc:$,pbc:K,n:A,o:t};return{render:k,hydrate:void 0,createApp:vo(k)}}function Us({type:t,props:e},s){return s==="svg"&&t==="foreignObject"||s==="mathml"&&t==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:s}function bt({effect:t,job:e},s){s?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function _o(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function Pr(t,e,s=!1){const n=t.children,i=e.children;if(z(n)&&z(i))for(let r=0;r>1,t[s[l]]0&&(e[n]=s[r-1]),s[r]=n)}}for(r=s.length,o=s[r-1];r-- >0;)s[r]=o,o=e[o];return s}function Rr(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:Rr(e)}function Yn(t){if(t)for(let e=0;ett(Lo);function us(t,e,s){return Dr(t,e,s)}function Dr(t,e,s=ie){const{immediate:n,deep:i,flush:r,once:o}=s,l=be({},s),a=e&&n||!e&&r!=="post";let u;if(ts){if(r==="sync"){const g=To();u=g.__watcherHandles||(g.__watcherHandles=[])}else if(!a){const g=()=>{};return g.stop=qe,g.resume=qe,g.pause=qe,g}}const c=me;l.call=(g,_,C)=>Ke(g,c,_,C);let f=!1;r==="post"?l.scheduler=g=>{Pe(g,c&&c.suspense)}:r!=="sync"&&(f=!0,l.scheduler=(g,_)=>{_?g():_n(g)}),l.augmentJob=g=>{e&&(g.flags|=4),f&&(g.flags|=2,c&&(g.id=c.uid,g.i=c))};const p=$l(t,e,l);return ts&&(u?u.push(p):a&&p()),p}function Po(t,e,s){const n=this.proxy,i=ce(t)?t.includes(".")?kr(n,t):()=>n[t]:t.bind(n,n);let r;G(e)?r=e:(r=e.handler,s=e);const o=rs(this),l=Dr(i,r.bind(n),s);return o(),l}function kr(t,e){const s=e.split(".");return()=>{let n=t;for(let i=0;ie==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${Ie(e)}Modifiers`]||t[`${xt(e)}Modifiers`];function Do(t,e,...s){if(t.isUnmounted)return;const n=t.vnode.props||ie;let i=s;const r=e.startsWith("update:"),o=r&&Ro(n,e.slice(7));o&&(o.trim&&(i=s.map(c=>ce(c)?c.trim():c)),o.number&&(i=s.map(al)));let l,a=n[l=Fs(e)]||n[l=Fs(Ie(e))];!a&&r&&(a=n[l=Fs(xt(e))]),a&&Ke(a,t,6,i);const u=n[l+"Once"];if(u){if(!t.emitted)t.emitted={};else if(t.emitted[l])return;t.emitted[l]=!0,Ke(u,t,6,i)}}function Fr(t,e,s=!1){const n=e.emitsCache,i=n.get(t);if(i!==void 0)return i;const r=t.emits;let o={},l=!1;if(!G(t)){const a=u=>{const c=Fr(u,e,!0);c&&(l=!0,be(o,c))};!s&&e.mixins.length&&e.mixins.forEach(a),t.extends&&a(t.extends),t.mixins&&t.mixins.forEach(a)}return!r&&!l?(le(t)&&n.set(t,null),null):(z(r)?r.forEach(a=>o[a]=null):be(o,r),le(t)&&n.set(t,o),o)}function Rs(t,e){return!t||!ws(e)?!1:(e=e.slice(2).replace(/Once$/,""),X(t,e[0].toLowerCase()+e.slice(1))||X(t,xt(e))||X(t,e))}function Qn(t){const{type:e,vnode:s,proxy:n,withProxy:i,propsOptions:[r],slots:o,attrs:l,emit:a,render:u,renderCache:c,props:f,data:p,setupState:g,ctx:_,inheritAttrs:C}=t,D=bs(t);let T,m;try{if(s.shapeFlag&4){const y=i||n,S=y;T=Ge(u.call(S,y,c,f,g,p,_)),m=l}else{const y=e;T=Ge(y.length>1?y(f,{attrs:l,slots:o,emit:a}):y(f,null)),m=e.props?l:ko(l)}}catch(y){Wt.length=0,Ls(y,t,1),T=de(it)}let b=T;if(m&&C!==!1){const y=Object.keys(m),{shapeFlag:S}=b;y.length&&S&7&&(r&&y.some(pn)&&(m=Fo(m,r)),b=Dt(b,m,!1,!0))}return s.dirs&&(b=Dt(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(s.dirs):s.dirs),s.transition&&On(b,s.transition),T=b,bs(D),T}const ko=t=>{let e;for(const s in t)(s==="class"||s==="style"||ws(s))&&((e||(e={}))[s]=t[s]);return e},Fo=(t,e)=>{const s={};for(const n in t)(!pn(n)||!(n.slice(9)in e))&&(s[n]=t[n]);return s};function Io(t,e,s){const{props:n,children:i,component:r}=t,{props:o,children:l,patchFlag:a}=e,u=r.emitsOptions;if(e.dirs||e.transition)return!0;if(s&&a>=0){if(a&1024)return!0;if(a&16)return n?Jn(n,o,u):!!o;if(a&8){const c=e.dynamicProps;for(let f=0;ft.__isSuspense;function No(t,e){e&&e.pendingBranch?z(t)?e.effects.push(...t):e.effects.push(t):Wl(t)}const Re=Symbol.for("v-fgt"),Ds=Symbol.for("v-txt"),it=Symbol.for("v-cmt"),fs=Symbol.for("v-stc"),Wt=[];let De=null;function Zt(t=!1){Wt.push(De=t?null:[])}function Bo(){Wt.pop(),De=Wt[Wt.length-1]||null}let Xt=1;function Zn(t,e=!1){Xt+=t,t<0&&De&&e&&(De.hasOnce=!0)}function Mr(t){return t.dynamicChildren=Xt>0?De||_t:null,Bo(),Xt>0&&De&&De.push(t),t}function Nr(t,e,s,n,i,r){return Mr(Ze(t,e,s,n,i,r,!0))}function ln(t,e,s,n,i){return Mr(de(t,e,s,n,i,!0))}function es(t){return t?t.__v_isVNode===!0:!1}function Nt(t,e){return t.type===e.type&&t.key===e.key}const Br=({key:t})=>t??null,hs=({ref:t,ref_key:e,ref_for:s})=>(typeof t=="number"&&(t=""+t),t!=null?ce(t)||ve(t)||G(t)?{i:Ee,r:t,k:e,f:!!s}:t:null);function Ze(t,e=null,s=null,n=0,i=null,r=t===Re?0:1,o=!1,l=!1){const a={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&Br(e),ref:e&&hs(e),scopeId:hr,slotScopeIds:null,children:s,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:r,patchFlag:n,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:Ee};return l?(Pn(a,s),r&128&&t.normalize(a)):s&&(a.shapeFlag|=ce(s)?8:16),Xt>0&&!o&&De&&(a.patchFlag>0||r&6)&&a.patchFlag!==32&&De.push(a),a}const de=Ho;function Ho(t,e=null,s=null,n=0,i=null,r=!1){if((!t||t===oo)&&(t=it),es(t)){const l=Dt(t,e,!0);return s&&Pn(l,s),Xt>0&&!r&&De&&(l.shapeFlag&6?De[De.indexOf(t)]=l:De.push(l)),l.patchFlag=-2,l}if(Zo(t)&&(t=t.__vccOpts),e){e=Vo(e);let{class:l,style:a}=e;l&&!ce(l)&&(e.class=bn(l)),le(a)&&(Cn(a)&&!z(a)&&(a=be({},a)),e.style=vn(a))}const o=ce(t)?1:Ir(t)?128:Kl(t)?64:le(t)?4:G(t)?2:0;return Ze(t,e,s,n,i,o,r,!0)}function Vo(t){return t?Cn(t)||Er(t)?be({},t):t:null}function Dt(t,e,s=!1,n=!1){const{props:i,ref:r,patchFlag:o,children:l,transition:a}=t,u=e?jo(i||{},e):i,c={__v_isVNode:!0,__v_skip:!0,type:t.type,props:u,key:u&&Br(u),ref:e&&e.ref?s&&r?z(r)?r.concat(hs(e)):[r,hs(e)]:hs(e):r,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:l,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==Re?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:a,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&Dt(t.ssContent),ssFallback:t.ssFallback&&Dt(t.ssFallback),el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return a&&n&&On(c,a.clone(c)),c}function ds(t=" ",e=0){return de(Ds,null,t,e)}function Uo(t,e){const s=de(fs,null,t);return s.staticCount=e,s}function $o(t="",e=!1){return e?(Zt(),ln(it,null,t)):de(it,null,t)}function Ge(t){return t==null||typeof t=="boolean"?de(it):z(t)?de(Re,null,t.slice()):es(t)?ht(t):de(Ds,null,String(t))}function ht(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:Dt(t)}function Pn(t,e){let s=0;const{shapeFlag:n}=t;if(e==null)e=null;else if(z(e))s=16;else if(typeof e=="object")if(n&65){const i=e.default;i&&(i._c&&(i._d=!1),Pn(t,i()),i._c&&(i._d=!0));return}else{s=32;const i=e._;!i&&!Er(e)?e._ctx=Ee:i===3&&Ee&&(Ee.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else G(e)?(e={default:e,_ctx:Ee},s=32):(e=String(e),n&64?(s=16,e=[ds(e)]):s=8);t.children=e,t.shapeFlag|=s}function jo(...t){const e={};for(let s=0;s{let i;return(i=t[s])||(i=t[s]=[]),i.push(n),r=>{i.length>1?i.forEach(o=>o(r)):i[0](r)}};As=e("__VUE_INSTANCE_SETTERS__",s=>me=s),on=e("__VUE_SSR_SETTERS__",s=>ts=s)}const rs=t=>{const e=me;return As(t),t.scope.on(),()=>{t.scope.off(),As(e)}},Xn=()=>{me&&me.scope.off(),As(null)};function Hr(t){return t.vnode.shapeFlag&4}let ts=!1;function qo(t,e=!1,s=!1){e&&on(e);const{props:n,children:i}=t.vnode,r=Hr(t);bo(t,n,r,e),xo(t,i,s||e);const o=r?Ko(t,e):void 0;return e&&on(!1),o}function Ko(t,e){const s=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,co);const{setup:n}=s;if(n){st();const i=t.setupContext=n.length>1?Qo(t):null,r=rs(t),o=is(n,t,0,[t.props,i]),l=Ii(o);if(nt(),r(),(l||t.sp)&&!Pt(t)&&dr(t),l){if(o.then(Xn,Xn),e)return o.then(a=>{ei(t,a)}).catch(a=>{Ls(a,t,0)});t.asyncDep=o}else ei(t,o)}else Vr(t)}function ei(t,e,s){G(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:le(e)&&(t.setupState=lr(e)),Vr(t)}function Vr(t,e,s){const n=t.type;t.render||(t.render=n.render||qe);{const i=rs(t);st();try{uo(t)}finally{nt(),i()}}}const Yo={get(t,e){return ge(t,"get",""),t[e]}};function Qo(t){const e=s=>{t.exposed=s||{}};return{attrs:new Proxy(t.attrs,Yo),slots:t.slots,emit:t.emit,expose:e}}function Rn(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(lr(Il(t.exposed)),{get(e,s){if(s in e)return e[s];if(s in zt)return zt[s](t)},has(e,s){return s in e||s in zt}})):t.proxy}function Jo(t,e=!0){return G(t)?t.displayName||t.name:t.name||e&&t.__name}function Zo(t){return G(t)&&"__vccOpts"in t}const Ne=(t,e)=>Vl(t,e,ts);function Ur(t,e,s){const n=arguments.length;return n===2?le(e)&&!z(e)?es(e)?de(t,null,[e]):de(t,e):de(t,null,e):(n>3?s=Array.prototype.slice.call(arguments,2):n===3&&es(s)&&(s=[s]),de(t,e,s))}const Xo="3.5.17";/** * @vue/runtime-dom v3.5.17 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT -**/let an;const ti=typeof window<"u"&&window.trustedTypes;if(ti)try{an=ti.createPolicy("vue",{createHTML:t=>t})}catch{}const $r=an?t=>an.createHTML(t):t=>t,ea="http://www.w3.org/2000/svg",ta="http://www.w3.org/1998/Math/MathML",Xe=typeof document<"u"?document:null,si=Xe&&Xe.createElement("template"),sa={insert:(t,e,s)=>{e.insertBefore(t,s||null)},remove:t=>{const e=t.parentNode;e&&e.removeChild(t)},createElement:(t,e,s,n)=>{const i=e==="svg"?Xe.createElementNS(ea,t):e==="mathml"?Xe.createElementNS(ta,t):s?Xe.createElement(t,{is:s}):Xe.createElement(t);return t==="select"&&n&&n.multiple!=null&&i.setAttribute("multiple",n.multiple),i},createText:t=>Xe.createTextNode(t),createComment:t=>Xe.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>Xe.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},insertStaticContent(t,e,s,n,i,r){const o=s?s.previousSibling:e.lastChild;if(i&&(i===r||i.nextSibling))for(;e.insertBefore(i.cloneNode(!0),s),!(i===r||!(i=i.nextSibling)););else{si.innerHTML=$r(n==="svg"?`${t}`:n==="mathml"?`${t}`:t);const l=si.content;if(n==="svg"||n==="mathml"){const a=l.firstChild;for(;a.firstChild;)l.appendChild(a.firstChild);l.removeChild(a)}e.insertBefore(l,s)}return[o?o.nextSibling:e.firstChild,s?s.previousSibling:e.lastChild]}},na=Symbol("_vtc");function ia(t,e,s){const n=t[na];n&&(e=(e?[e,...n]:[...n]).join(" ")),e==null?t.removeAttribute("class"):s?t.setAttribute("class",e):t.className=e}const ni=Symbol("_vod"),ra=Symbol("_vsh"),la=Symbol(""),oa=/(^|;)\s*display\s*:/;function aa(t,e,s){const n=t.style,i=ce(s);let r=!1;if(s&&!i){if(e)if(ce(e))for(const o of e.split(";")){const l=o.slice(0,o.indexOf(":")).trim();s[l]==null&&ps(n,l,"")}else for(const o in e)s[o]==null&&ps(n,o,"");for(const o in s)o==="display"&&(r=!0),ps(n,o,s[o])}else if(i){if(e!==s){const o=n[la];o&&(s+=";"+o),n.cssText=s,r=oa.test(s)}}else e&&t.removeAttribute("style");ni in t&&(t[ni]=r?n.display:"",t[ra]&&(n.display="none"))}const ii=/\s*!important$/;function ps(t,e,s){if(z(s))s.forEach(n=>ps(t,e,n));else if(s==null&&(s=""),e.startsWith("--"))t.setProperty(e,s);else{const n=ca(t,e);ii.test(s)?t.setProperty(xt(n),s.replace(ii,""),"important"):t[n]=s}}const ri=["Webkit","Moz","ms"],$s={};function ca(t,e){const s=$s[e];if(s)return s;let n=Ie(e);if(n!=="filter"&&n in t)return $s[e]=n;n=Es(n);for(let i=0;ijs||(pa.then(()=>js=0),js=Date.now());function ma(t,e){const s=n=>{if(!n._vts)n._vts=Date.now();else if(n._vts<=s.attached)return;Ke(va(n,s.value),e,5,[n])};return s.value=t,s.attached=ga(),s}function va(t,e){if(z(e)){const s=t.stopImmediatePropagation;return t.stopImmediatePropagation=()=>{s.call(t),t._stopped=!0},e.map(n=>i=>!i._stopped&&n&&n(i))}else return e}const fi=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,ba=(t,e,s,n,i,r)=>{const o=i==="svg";e==="class"?ia(t,n,o):e==="style"?aa(t,s,n):ws(e)?pn(e)||ha(t,e,s,n,r):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):ya(t,e,n,o))?(ai(t,e,n),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&oi(t,e,n,o,r,e!=="value")):t._isVueCE&&(/[A-Z]/.test(e)||!ce(n))?ai(t,Ie(e),n,r,e):(e==="true-value"?t._trueValue=n:e==="false-value"&&(t._falseValue=n),oi(t,e,n,o))};function ya(t,e,s,n){if(n)return!!(e==="innerHTML"||e==="textContent"||e in t&&fi(e)&&G(s));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="form"||e==="list"&&t.tagName==="INPUT"||e==="type"&&t.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const i=t.tagName;if(i==="IMG"||i==="VIDEO"||i==="CANVAS"||i==="SOURCE")return!1}return fi(e)&&ce(s)?!1:e in t}const Aa=be({patchProp:ba},sa);let hi;function wa(){return hi||(hi=Eo(Aa))}const xa=(...t)=>{const e=wa().createApp(...t),{mount:s}=e;return e.mount=n=>{const i=Ea(n);if(!i)return;const r=e._component;!G(r)&&!r.render&&!r.template&&(r.template=i.innerHTML),i.nodeType===1&&(i.textContent="");const o=s(i,!1,Sa(i));return i instanceof Element&&(i.removeAttribute("v-cloak"),i.setAttribute("data-v-app","")),o},e};function Sa(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function Ea(t){return ce(t)?document.querySelector(t):t}const Ca="modulepreload",_a=function(t){return"/"+t},di={},Qe=function(e,s,n){let i=Promise.resolve();if(s&&s.length>0){let o=function(u){return Promise.all(u.map(c=>Promise.resolve(c).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),a=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));i=o(s.map(u=>{if(u=_a(u),u in di)return;di[u]=!0;const c=u.endsWith(".css"),f=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${f}`))return;const p=document.createElement("link");if(p.rel=c?"stylesheet":Ca,c||(p.as="script"),p.crossOrigin="",p.href=u,a&&p.setAttribute("nonce",a),document.head.appendChild(p),c)return new Promise((g,C)=>{p.addEventListener("load",g),p.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${u}`)))})}))}function r(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return i.then(o=>{for(const l of o||[])l.status==="rejected"&&r(l.reason);return e().catch(r)})};/*! +**/let an;const ti=typeof window<"u"&&window.trustedTypes;if(ti)try{an=ti.createPolicy("vue",{createHTML:t=>t})}catch{}const $r=an?t=>an.createHTML(t):t=>t,ea="http://www.w3.org/2000/svg",ta="http://www.w3.org/1998/Math/MathML",Xe=typeof document<"u"?document:null,si=Xe&&Xe.createElement("template"),sa={insert:(t,e,s)=>{e.insertBefore(t,s||null)},remove:t=>{const e=t.parentNode;e&&e.removeChild(t)},createElement:(t,e,s,n)=>{const i=e==="svg"?Xe.createElementNS(ea,t):e==="mathml"?Xe.createElementNS(ta,t):s?Xe.createElement(t,{is:s}):Xe.createElement(t);return t==="select"&&n&&n.multiple!=null&&i.setAttribute("multiple",n.multiple),i},createText:t=>Xe.createTextNode(t),createComment:t=>Xe.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>Xe.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},insertStaticContent(t,e,s,n,i,r){const o=s?s.previousSibling:e.lastChild;if(i&&(i===r||i.nextSibling))for(;e.insertBefore(i.cloneNode(!0),s),!(i===r||!(i=i.nextSibling)););else{si.innerHTML=$r(n==="svg"?`${t}`:n==="mathml"?`${t}`:t);const l=si.content;if(n==="svg"||n==="mathml"){const a=l.firstChild;for(;a.firstChild;)l.appendChild(a.firstChild);l.removeChild(a)}e.insertBefore(l,s)}return[o?o.nextSibling:e.firstChild,s?s.previousSibling:e.lastChild]}},na=Symbol("_vtc");function ia(t,e,s){const n=t[na];n&&(e=(e?[e,...n]:[...n]).join(" ")),e==null?t.removeAttribute("class"):s?t.setAttribute("class",e):t.className=e}const ni=Symbol("_vod"),ra=Symbol("_vsh"),la=Symbol(""),oa=/(^|;)\s*display\s*:/;function aa(t,e,s){const n=t.style,i=ce(s);let r=!1;if(s&&!i){if(e)if(ce(e))for(const o of e.split(";")){const l=o.slice(0,o.indexOf(":")).trim();s[l]==null&&ps(n,l,"")}else for(const o in e)s[o]==null&&ps(n,o,"");for(const o in s)o==="display"&&(r=!0),ps(n,o,s[o])}else if(i){if(e!==s){const o=n[la];o&&(s+=";"+o),n.cssText=s,r=oa.test(s)}}else e&&t.removeAttribute("style");ni in t&&(t[ni]=r?n.display:"",t[ra]&&(n.display="none"))}const ii=/\s*!important$/;function ps(t,e,s){if(z(s))s.forEach(n=>ps(t,e,n));else if(s==null&&(s=""),e.startsWith("--"))t.setProperty(e,s);else{const n=ca(t,e);ii.test(s)?t.setProperty(xt(n),s.replace(ii,""),"important"):t[n]=s}}const ri=["Webkit","Moz","ms"],$s={};function ca(t,e){const s=$s[e];if(s)return s;let n=Ie(e);if(n!=="filter"&&n in t)return $s[e]=n;n=Es(n);for(let i=0;ijs||(pa.then(()=>js=0),js=Date.now());function ma(t,e){const s=n=>{if(!n._vts)n._vts=Date.now();else if(n._vts<=s.attached)return;Ke(va(n,s.value),e,5,[n])};return s.value=t,s.attached=ga(),s}function va(t,e){if(z(e)){const s=t.stopImmediatePropagation;return t.stopImmediatePropagation=()=>{s.call(t),t._stopped=!0},e.map(n=>i=>!i._stopped&&n&&n(i))}else return e}const fi=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,ba=(t,e,s,n,i,r)=>{const o=i==="svg";e==="class"?ia(t,n,o):e==="style"?aa(t,s,n):ws(e)?pn(e)||ha(t,e,s,n,r):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):ya(t,e,n,o))?(ai(t,e,n),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&oi(t,e,n,o,r,e!=="value")):t._isVueCE&&(/[A-Z]/.test(e)||!ce(n))?ai(t,Ie(e),n,r,e):(e==="true-value"?t._trueValue=n:e==="false-value"&&(t._falseValue=n),oi(t,e,n,o))};function ya(t,e,s,n){if(n)return!!(e==="innerHTML"||e==="textContent"||e in t&&fi(e)&&G(s));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="form"||e==="list"&&t.tagName==="INPUT"||e==="type"&&t.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const i=t.tagName;if(i==="IMG"||i==="VIDEO"||i==="CANVAS"||i==="SOURCE")return!1}return fi(e)&&ce(s)?!1:e in t}const Aa=be({patchProp:ba},sa);let hi;function wa(){return hi||(hi=Eo(Aa))}const xa=(...t)=>{const e=wa().createApp(...t),{mount:s}=e;return e.mount=n=>{const i=Ea(n);if(!i)return;const r=e._component;!G(r)&&!r.render&&!r.template&&(r.template=i.innerHTML),i.nodeType===1&&(i.textContent="");const o=s(i,!1,Sa(i));return i instanceof Element&&(i.removeAttribute("v-cloak"),i.setAttribute("data-v-app","")),o},e};function Sa(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function Ea(t){return ce(t)?document.querySelector(t):t}const Ca="modulepreload",_a=function(t){return"/"+t},di={},Qe=function(e,s,n){let i=Promise.resolve();if(s&&s.length>0){let o=function(u){return Promise.all(u.map(c=>Promise.resolve(c).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),a=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));i=o(s.map(u=>{if(u=_a(u),u in di)return;di[u]=!0;const c=u.endsWith(".css"),f=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${f}`))return;const p=document.createElement("link");if(p.rel=c?"stylesheet":Ca,c||(p.as="script"),p.crossOrigin="",p.href=u,a&&p.setAttribute("nonce",a),document.head.appendChild(p),c)return new Promise((g,_)=>{p.addEventListener("load",g),p.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${u}`)))})}))}function r(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return i.then(o=>{for(const l of o||[])l.status==="rejected"&&r(l.reason);return e().catch(r)})};/*! * vue-router v4.5.1 * (c) 2025 Eduardo San Martin Morote * @license MIT - */const Ct=typeof document<"u";function jr(t){return typeof t=="object"||"displayName"in t||"props"in t||"__vccOpts"in t}function Oa(t){return t.__esModule||t[Symbol.toStringTag]==="Module"||t.default&&jr(t.default)}const J=Object.assign;function zs(t,e){const s={};for(const n in e){const i=e[n];s[n]=He(i)?i.map(t):t(i)}return s}const Gt=()=>{},He=Array.isArray,zr=/#/g,La=/&/g,Ta=/\//g,Pa=/=/g,Ra=/\?/g,Wr=/\+/g,Da=/%5B/g,ka=/%5D/g,Gr=/%5E/g,Fa=/%60/g,qr=/%7B/g,Ia=/%7C/g,Kr=/%7D/g,Ma=/%20/g;function Dn(t){return encodeURI(""+t).replace(Ia,"|").replace(Da,"[").replace(ka,"]")}function Na(t){return Dn(t).replace(qr,"{").replace(Kr,"}").replace(Gr,"^")}function cn(t){return Dn(t).replace(Wr,"%2B").replace(Ma,"+").replace(zr,"%23").replace(La,"%26").replace(Fa,"`").replace(qr,"{").replace(Kr,"}").replace(Gr,"^")}function Ba(t){return cn(t).replace(Pa,"%3D")}function Ha(t){return Dn(t).replace(zr,"%23").replace(Ra,"%3F")}function Va(t){return t==null?"":Ha(t).replace(Ta,"%2F")}function ss(t){try{return decodeURIComponent(""+t)}catch{}return""+t}const Ua=/\/$/,$a=t=>t.replace(Ua,"");function Ws(t,e,s="/"){let n,i={},r="",o="";const l=e.indexOf("#");let a=e.indexOf("?");return l=0&&(a=-1),a>-1&&(n=e.slice(0,a),r=e.slice(a+1,l>-1?l:e.length),i=t(r)),l>-1&&(n=n||e.slice(0,l),o=e.slice(l,e.length)),n=Ga(n??e,s),{fullPath:n+(r&&"?")+r+o,path:n,query:i,hash:ss(o)}}function ja(t,e){const s=e.query?t(e.query):"";return e.path+(s&&"?")+s+(e.hash||"")}function pi(t,e){return!e||!t.toLowerCase().startsWith(e.toLowerCase())?t:t.slice(e.length)||"/"}function za(t,e,s){const n=e.matched.length-1,i=s.matched.length-1;return n>-1&&n===i&&kt(e.matched[n],s.matched[i])&&Yr(e.params,s.params)&&t(e.query)===t(s.query)&&e.hash===s.hash}function kt(t,e){return(t.aliasOf||t)===(e.aliasOf||e)}function Yr(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(!Wa(t[s],e[s]))return!1;return!0}function Wa(t,e){return He(t)?gi(t,e):He(e)?gi(e,t):t===e}function gi(t,e){return He(e)?t.length===e.length&&t.every((s,n)=>s===e[n]):t.length===1&&t[0]===e}function Ga(t,e){if(t.startsWith("/"))return t;if(!t)return e;const s=e.split("/"),n=t.split("/"),i=n[n.length-1];(i===".."||i===".")&&n.push("");let r=s.length-1,o,l;for(o=0;o1&&r--;else break;return s.slice(0,r).join("/")+"/"+n.slice(o).join("/")}const ut={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};var ns;(function(t){t.pop="pop",t.push="push"})(ns||(ns={}));var qt;(function(t){t.back="back",t.forward="forward",t.unknown=""})(qt||(qt={}));function qa(t){if(!t)if(Ct){const e=document.querySelector("base");t=e&&e.getAttribute("href")||"/",t=t.replace(/^\w+:\/\/[^\/]+/,"")}else t="/";return t[0]!=="/"&&t[0]!=="#"&&(t="/"+t),$a(t)}const Ka=/^[^#]+#/;function Ya(t,e){return t.replace(Ka,"#")+e}function Qa(t,e){const s=document.documentElement.getBoundingClientRect(),n=t.getBoundingClientRect();return{behavior:e.behavior,left:n.left-s.left-(e.left||0),top:n.top-s.top-(e.top||0)}}const ks=()=>({left:window.scrollX,top:window.scrollY});function Ja(t){let e;if("el"in t){const s=t.el,n=typeof s=="string"&&s.startsWith("#"),i=typeof s=="string"?n?document.getElementById(s.slice(1)):document.querySelector(s):s;if(!i)return;e=Qa(i,t)}else e=t;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.scrollX,e.top!=null?e.top:window.scrollY)}function mi(t,e){return(history.state?history.state.position-e:-1)+t}const un=new Map;function Za(t,e){un.set(t,e)}function Xa(t){const e=un.get(t);return un.delete(t),e}let ec=()=>location.protocol+"//"+location.host;function Qr(t,e){const{pathname:s,search:n,hash:i}=e,r=t.indexOf("#");if(r>-1){let l=i.includes(t.slice(r))?t.slice(r).length:1,a=i.slice(l);return a[0]!=="/"&&(a="/"+a),pi(a,"")}return pi(s,t)+n+i}function tc(t,e,s,n){let i=[],r=[],o=null;const l=({state:p})=>{const g=Qr(t,location),C=s.value,_=e.value;let D=0;if(p){if(s.value=g,e.value=p,o&&o===C){o=null;return}D=_?p.position-_.position:0}else n(g);i.forEach(T=>{T(s.value,C,{delta:D,type:ns.pop,direction:D?D>0?qt.forward:qt.back:qt.unknown})})};function a(){o=s.value}function u(p){i.push(p);const g=()=>{const C=i.indexOf(p);C>-1&&i.splice(C,1)};return r.push(g),g}function c(){const{history:p}=window;p.state&&p.replaceState(J({},p.state,{scroll:ks()}),"")}function f(){for(const p of r)p();r=[],window.removeEventListener("popstate",l),window.removeEventListener("beforeunload",c)}return window.addEventListener("popstate",l),window.addEventListener("beforeunload",c,{passive:!0}),{pauseListeners:a,listen:u,destroy:f}}function vi(t,e,s,n=!1,i=!1){return{back:t,current:e,forward:s,replaced:n,position:window.history.length,scroll:i?ks():null}}function sc(t){const{history:e,location:s}=window,n={value:Qr(t,s)},i={value:e.state};i.value||r(n.value,{back:null,current:n.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function r(a,u,c){const f=t.indexOf("#"),p=f>-1?(s.host&&document.querySelector("base")?t:t.slice(f))+a:ec()+t+a;try{e[c?"replaceState":"pushState"](u,"",p),i.value=u}catch(g){console.error(g),s[c?"replace":"assign"](p)}}function o(a,u){const c=J({},e.state,vi(i.value.back,a,i.value.forward,!0),u,{position:i.value.position});r(a,c,!0),n.value=a}function l(a,u){const c=J({},i.value,e.state,{forward:a,scroll:ks()});r(c.current,c,!0);const f=J({},vi(n.value,a,null),{position:c.position+1},u);r(a,f,!1),n.value=a}return{location:n,state:i,push:l,replace:o}}function nc(t){t=qa(t);const e=sc(t),s=tc(t,e.state,e.location,e.replace);function n(r,o=!0){o||s.pauseListeners(),history.go(r)}const i=J({location:"",base:t,go:n,createHref:Ya.bind(null,t)},e,s);return Object.defineProperty(i,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(i,"state",{enumerable:!0,get:()=>e.state.value}),i}function ic(t){return typeof t=="string"||t&&typeof t=="object"}function Jr(t){return typeof t=="string"||typeof t=="symbol"}const Zr=Symbol("");var bi;(function(t){t[t.aborted=4]="aborted",t[t.cancelled=8]="cancelled",t[t.duplicated=16]="duplicated"})(bi||(bi={}));function Ft(t,e){return J(new Error,{type:t,[Zr]:!0},e)}function Je(t,e){return t instanceof Error&&Zr in t&&(e==null||!!(t.type&e))}const yi="[^/]+?",rc={sensitive:!1,strict:!1,start:!0,end:!0},lc=/[.+*?^${}()[\]/\\]/g;function oc(t,e){const s=J({},rc,e),n=[];let i=s.start?"^":"";const r=[];for(const u of t){const c=u.length?[]:[90];s.strict&&!u.length&&(i+="/");for(let f=0;fe.length?e.length===1&&e[0]===80?1:-1:0}function Xr(t,e){let s=0;const n=t.score,i=e.score;for(;s0&&e[e.length-1]<0}const cc={type:0,value:""},uc=/[a-zA-Z0-9_]/;function fc(t){if(!t)return[[]];if(t==="/")return[[cc]];if(!t.startsWith("/"))throw new Error(`Invalid path "${t}"`);function e(g){throw new Error(`ERR (${s})/"${u}": ${g}`)}let s=0,n=s;const i=[];let r;function o(){r&&i.push(r),r=[]}let l=0,a,u="",c="";function f(){u&&(s===0?r.push({type:0,value:u}):s===1||s===2||s===3?(r.length>1&&(a==="*"||a==="+")&&e(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),r.push({type:1,value:u,regexp:c,repeatable:a==="*"||a==="+",optional:a==="*"||a==="?"})):e("Invalid state to consume buffer"),u="")}function p(){u+=a}for(;l{o(v)}:Gt}function o(f){if(Jr(f)){const p=n.get(f);p&&(n.delete(f),s.splice(s.indexOf(p),1),p.children.forEach(o),p.alias.forEach(o))}else{const p=s.indexOf(f);p>-1&&(s.splice(p,1),f.record.name&&n.delete(f.record.name),f.children.forEach(o),f.alias.forEach(o))}}function l(){return s}function a(f){const p=mc(f,s);s.splice(p,0,f),f.record.name&&!Si(f)&&n.set(f.record.name,f)}function u(f,p){let g,C={},_,D;if("name"in f&&f.name){if(g=n.get(f.name),!g)throw Ft(1,{location:f});D=g.record.name,C=J(wi(p.params,g.keys.filter(v=>!v.optional).concat(g.parent?g.parent.keys.filter(v=>v.optional):[]).map(v=>v.name)),f.params&&wi(f.params,g.keys.map(v=>v.name))),_=g.stringify(C)}else if(f.path!=null)_=f.path,g=s.find(v=>v.re.test(_)),g&&(C=g.parse(_),D=g.record.name);else{if(g=p.name?n.get(p.name):s.find(v=>v.re.test(p.path)),!g)throw Ft(1,{location:f,currentLocation:p});D=g.record.name,C=J({},p.params,f.params),_=g.stringify(C)}const T=[];let m=g;for(;m;)T.unshift(m.record),m=m.parent;return{name:D,path:_,params:C,matched:T,meta:gc(T)}}t.forEach(f=>r(f));function c(){s.length=0,n.clear()}return{addRoute:r,resolve:u,removeRoute:o,clearRoutes:c,getRoutes:l,getRecordMatcher:i}}function wi(t,e){const s={};for(const n of e)n in t&&(s[n]=t[n]);return s}function xi(t){const e={path:t.path,redirect:t.redirect,name:t.name,meta:t.meta||{},aliasOf:t.aliasOf,beforeEnter:t.beforeEnter,props:pc(t),children:t.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in t?t.components||null:t.component&&{default:t.component}};return Object.defineProperty(e,"mods",{value:{}}),e}function pc(t){const e={},s=t.props||!1;if("component"in t)e.default=s;else for(const n in t.components)e[n]=typeof s=="object"?s[n]:s;return e}function Si(t){for(;t;){if(t.record.aliasOf)return!0;t=t.parent}return!1}function gc(t){return t.reduce((e,s)=>J(e,s.meta),{})}function Ei(t,e){const s={};for(const n in t)s[n]=n in e?e[n]:t[n];return s}function mc(t,e){let s=0,n=e.length;for(;s!==n;){const r=s+n>>1;Xr(t,e[r])<0?n=r:s=r+1}const i=vc(t);return i&&(n=e.lastIndexOf(i,n-1)),n}function vc(t){let e=t;for(;e=e.parent;)if(el(e)&&Xr(t,e)===0)return e}function el({record:t}){return!!(t.name||t.components&&Object.keys(t.components).length||t.redirect)}function bc(t){const e={};if(t===""||t==="?")return e;const n=(t[0]==="?"?t.slice(1):t).split("&");for(let i=0;ir&&cn(r)):[n&&cn(n)]).forEach(r=>{r!==void 0&&(e+=(e.length?"&":"")+s,r!=null&&(e+="="+r))})}return e}function yc(t){const e={};for(const s in t){const n=t[s];n!==void 0&&(e[s]=He(n)?n.map(i=>i==null?null:""+i):n==null?n:""+n)}return e}const Ac=Symbol(""),_i=Symbol(""),kn=Symbol(""),tl=Symbol(""),fn=Symbol("");function Bt(){let t=[];function e(n){return t.push(n),()=>{const i=t.indexOf(n);i>-1&&t.splice(i,1)}}function s(){t=[]}return{add:e,list:()=>t.slice(),reset:s}}function dt(t,e,s,n,i,r=o=>o()){const o=n&&(n.enterCallbacks[i]=n.enterCallbacks[i]||[]);return()=>new Promise((l,a)=>{const u=p=>{p===!1?a(Ft(4,{from:s,to:e})):p instanceof Error?a(p):ic(p)?a(Ft(2,{from:e,to:p})):(o&&n.enterCallbacks[i]===o&&typeof p=="function"&&o.push(p),l())},c=r(()=>t.call(n&&n.instances[i],e,s,u));let f=Promise.resolve(c);t.length<3&&(f=f.then(u)),f.catch(p=>a(p))})}function Gs(t,e,s,n,i=r=>r()){const r=[];for(const o of t)for(const l in o.components){let a=o.components[l];if(!(e!=="beforeRouteEnter"&&!o.instances[l]))if(jr(a)){const c=(a.__vccOpts||a)[e];c&&r.push(dt(c,s,n,o,l,i))}else{let u=a();r.push(()=>u.then(c=>{if(!c)throw new Error(`Couldn't resolve component "${l}" at "${o.path}"`);const f=Oa(c)?c.default:c;o.mods[l]=c,o.components[l]=f;const g=(f.__vccOpts||f)[e];return g&&dt(g,s,n,o,l,i)()}))}}return r}function Oi(t){const e=tt(kn),s=tt(tl),n=Ne(()=>{const a=wt(t.to);return e.resolve(a)}),i=Ne(()=>{const{matched:a}=n.value,{length:u}=a,c=a[u-1],f=s.matched;if(!c||!f.length)return-1;const p=f.findIndex(kt.bind(null,c));if(p>-1)return p;const g=Li(a[u-2]);return u>1&&Li(c)===g&&f[f.length-1].path!==g?f.findIndex(kt.bind(null,a[u-2])):p}),r=Ne(()=>i.value>-1&&Cc(s.params,n.value.params)),o=Ne(()=>i.value>-1&&i.value===s.matched.length-1&&Yr(s.params,n.value.params));function l(a={}){if(Ec(a)){const u=e[wt(t.replace)?"replace":"push"](wt(t.to)).catch(Gt);return t.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>u),u}return Promise.resolve()}return{route:n,href:Ne(()=>n.value.href),isActive:r,isExactActive:o,navigate:l}}function wc(t){return t.length===1?t[0]:t}const xc=Ts({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"},viewTransition:Boolean},useLink:Oi,setup(t,{slots:e}){const s=Os(Oi(t)),{options:n}=tt(kn),i=Ne(()=>({[Ti(t.activeClass,n.linkActiveClass,"router-link-active")]:s.isActive,[Ti(t.exactActiveClass,n.linkExactActiveClass,"router-link-exact-active")]:s.isExactActive}));return()=>{const r=e.default&&wc(e.default(s));return t.custom?r:Ur("a",{"aria-current":s.isExactActive?t.ariaCurrentValue:null,href:s.href,onClick:s.navigate,class:i.value},r)}}}),Sc=xc;function Ec(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&!(t.button!==void 0&&t.button!==0)){if(t.currentTarget&&t.currentTarget.getAttribute){const e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function Cc(t,e){for(const s in e){const n=e[s],i=t[s];if(typeof n=="string"){if(n!==i)return!1}else if(!He(i)||i.length!==n.length||n.some((r,o)=>r!==i[o]))return!1}return!0}function Li(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const Ti=(t,e,s)=>t??e??s,_c=Ts({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(t,{attrs:e,slots:s}){const n=tt(fn),i=Ne(()=>t.route||n.value),r=tt(_i,0),o=Ne(()=>{let u=wt(r);const{matched:c}=i.value;let f;for(;(f=c[u])&&!f.components;)u++;return u}),l=Ne(()=>i.value.matched[o.value]);cs(_i,Ne(()=>o.value+1)),cs(Ac,l),cs(fn,i);const a=ir();return us(()=>[a.value,l.value,t.name],([u,c,f],[p,g,C])=>{c&&(c.instances[f]=u,g&&g!==c&&u&&u===p&&(c.leaveGuards.size||(c.leaveGuards=g.leaveGuards),c.updateGuards.size||(c.updateGuards=g.updateGuards))),u&&c&&(!g||!kt(c,g)||!p)&&(c.enterCallbacks[f]||[]).forEach(_=>_(u))},{flush:"post"}),()=>{const u=i.value,c=t.name,f=l.value,p=f&&f.components[c];if(!p)return Pi(s.default,{Component:p,route:u});const g=f.props[c],C=g?g===!0?u.params:typeof g=="function"?g(u):g:null,D=Ur(p,J({},C,e,{onVnodeUnmounted:T=>{T.component.isUnmounted&&(f.instances[c]=null)},ref:a}));return Pi(s.default,{Component:D,route:u})||D}}});function Pi(t,e){if(!t)return null;const s=t(e);return s.length===1?s[0]:s}const Oc=_c;function Lc(t){const e=dc(t.routes,t),s=t.parseQuery||bc,n=t.stringifyQuery||Ci,i=t.history,r=Bt(),o=Bt(),l=Bt(),a=Ml(ut);let u=ut;Ct&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=zs.bind(null,A=>""+A),f=zs.bind(null,Va),p=zs.bind(null,ss);function g(A,N){let k,B;return Jr(A)?(k=e.getRecordMatcher(A),B=N):B=A,e.addRoute(B,k)}function C(A){const N=e.getRecordMatcher(A);N&&e.removeRoute(N)}function _(){return e.getRoutes().map(A=>A.record)}function D(A){return!!e.getRecordMatcher(A)}function T(A,N){if(N=J({},N||a.value),typeof A=="string"){const b=Ws(s,A,N.path),w=e.resolve({path:b.path},N),S=i.createHref(b.fullPath);return J(b,w,{params:p(w.params),hash:ss(b.hash),redirectedFrom:void 0,href:S})}let k;if(A.path!=null)k=J({},A,{path:Ws(s,A.path,N.path).path});else{const b=J({},A.params);for(const w in b)b[w]==null&&delete b[w];k=J({},A,{params:f(b)}),N.params=f(N.params)}const B=e.resolve(k,N),Y=A.hash||"";B.params=c(p(B.params));const h=ja(n,J({},A,{hash:Na(Y),path:B.path})),d=i.createHref(h);return J({fullPath:h,hash:Y,query:n===Ci?yc(A.query):A.query||{}},B,{redirectedFrom:void 0,href:d})}function m(A){return typeof A=="string"?Ws(s,A,a.value.path):J({},A)}function v(A,N){if(u!==A)return Ft(8,{from:N,to:A})}function y(A){return F(A)}function E(A){return y(J(m(A),{replace:!0}))}function L(A){const N=A.matched[A.matched.length-1];if(N&&N.redirect){const{redirect:k}=N;let B=typeof k=="function"?k(A):k;return typeof B=="string"&&(B=B.includes("?")||B.includes("#")?B=m(B):{path:B},B.params={}),J({query:A.query,hash:A.hash,params:B.path!=null?{}:A.params},B)}}function F(A,N){const k=u=T(A),B=a.value,Y=A.state,h=A.force,d=A.replace===!0,b=L(k);if(b)return F(J(m(b),{state:typeof b=="object"?J({},Y,b.state):Y,force:h,replace:d}),N||k);const w=k;w.redirectedFrom=N;let S;return!h&&za(n,B,k)&&(S=Ft(16,{to:w,from:B}),Ae(B,B,!0,!1)),(S?Promise.resolve(S):K(w,B)).catch(x=>Je(x)?Je(x,2)?x:ye(x):$(x,w,B)).then(x=>{if(x){if(Je(x,2))return F(J({replace:d},m(x.to),{state:typeof x.to=="object"?J({},Y,x.to.state):Y,force:h}),N||w)}else x=pe(w,B,!0,d,Y);return re(w,B,x),x})}function W(A,N){const k=v(A,N);return k?Promise.reject(k):Promise.resolve()}function H(A){const N=we.values().next().value;return N&&typeof N.runWithContext=="function"?N.runWithContext(A):A()}function K(A,N){let k;const[B,Y,h]=Tc(A,N);k=Gs(B.reverse(),"beforeRouteLeave",A,N);for(const b of B)b.leaveGuards.forEach(w=>{k.push(dt(w,A,N))});const d=W.bind(null,A,N);return k.push(d),fe(k).then(()=>{k=[];for(const b of r.list())k.push(dt(b,A,N));return k.push(d),fe(k)}).then(()=>{k=Gs(Y,"beforeRouteUpdate",A,N);for(const b of Y)b.updateGuards.forEach(w=>{k.push(dt(w,A,N))});return k.push(d),fe(k)}).then(()=>{k=[];for(const b of h)if(b.beforeEnter)if(He(b.beforeEnter))for(const w of b.beforeEnter)k.push(dt(w,A,N));else k.push(dt(b.beforeEnter,A,N));return k.push(d),fe(k)}).then(()=>(A.matched.forEach(b=>b.enterCallbacks={}),k=Gs(h,"beforeRouteEnter",A,N,H),k.push(d),fe(k))).then(()=>{k=[];for(const b of o.list())k.push(dt(b,A,N));return k.push(d),fe(k)}).catch(b=>Je(b,8)?b:Promise.reject(b))}function re(A,N,k){l.list().forEach(B=>H(()=>B(A,N,k)))}function pe(A,N,k,B,Y){const h=v(A,N);if(h)return h;const d=N===ut,b=Ct?history.state:{};k&&(B||d?i.replace(A.fullPath,J({scroll:d&&b&&b.scroll},Y)):i.push(A.fullPath,Y)),a.value=A,Ae(A,N,k,d),ye()}let Le;function ot(){Le||(Le=i.listen((A,N,k)=>{if(!Ve.listening)return;const B=T(A),Y=L(B);if(Y){F(J(Y,{replace:!0,force:!0}),B).catch(Gt);return}u=B;const h=a.value;Ct&&Za(mi(h.fullPath,k.delta),ks()),K(B,h).catch(d=>Je(d,12)?d:Je(d,2)?(F(J(m(d.to),{force:!0}),B).then(b=>{Je(b,20)&&!k.delta&&k.type===ns.pop&&i.go(-1,!1)}).catch(Gt),Promise.reject()):(k.delta&&i.go(-k.delta,!1),$(d,B,h))).then(d=>{d=d||pe(B,h,!1),d&&(k.delta&&!Je(d,8)?i.go(-k.delta,!1):k.type===ns.pop&&Je(d,20)&&i.go(-1,!1)),re(B,h,d)}).catch(Gt)}))}let at=Bt(),oe=Bt(),Q;function $(A,N,k){ye(A);const B=oe.list();return B.length?B.forEach(Y=>Y(A,N,k)):console.error(A),Promise.reject(A)}function ae(){return Q&&a.value!==ut?Promise.resolve():new Promise((A,N)=>{at.add([A,N])})}function ye(A){return Q||(Q=!A,ot(),at.list().forEach(([N,k])=>A?k(A):N()),at.reset()),A}function Ae(A,N,k,B){const{scrollBehavior:Y}=t;if(!Ct||!Y)return Promise.resolve();const h=!k&&Xa(mi(A.fullPath,0))||(B||!k)&&history.state&&history.state.scroll||null;return ar().then(()=>Y(A,N,h)).then(d=>d&&Ja(d)).catch(d=>$(d,A,N))}const te=A=>i.go(A);let ct;const we=new Set,Ve={currentRoute:a,listening:!0,addRoute:g,removeRoute:C,clearRoutes:e.clearRoutes,hasRoute:D,getRoutes:_,resolve:T,options:t,push:y,replace:E,go:te,back:()=>te(-1),forward:()=>te(1),beforeEach:r.add,beforeResolve:o.add,afterEach:l.add,onError:oe.add,isReady:ae,install(A){const N=this;A.component("RouterLink",Sc),A.component("RouterView",Oc),A.config.globalProperties.$router=N,Object.defineProperty(A.config.globalProperties,"$route",{enumerable:!0,get:()=>wt(a)}),Ct&&!ct&&a.value===ut&&(ct=!0,y(i.location).catch(Y=>{}));const k={};for(const Y in ut)Object.defineProperty(k,Y,{get:()=>a.value[Y],enumerable:!0});A.provide(kn,N),A.provide(tl,sr(k)),A.provide(fn,a);const B=A.unmount;we.add(A),A.unmount=function(){we.delete(A),we.size<1&&(u=ut,Le&&Le(),Le=null,a.value=ut,ct=!1,Q=!1),B()}}};function fe(A){return A.reduce((N,k)=>N.then(()=>H(k)),Promise.resolve())}return Ve}function Tc(t,e){const s=[],n=[],i=[],r=Math.max(e.matched.length,t.matched.length);for(let o=0;okt(u,l))?n.push(l):s.push(l));const a=t.matched[o];a&&(e.matched.find(u=>kt(u,a))||i.push(a))}return[s,n,i]}const Pc=Lc({history:nc(),linkActiveClass:"active",routes:[{path:"/",name:"Home",component:()=>Qe(()=>import("./home.js"),__vite__mapDeps([0,1]))},{path:"/install",name:"Install",component:()=>Qe(()=>import("./install.js"),[])},{path:"/selects",name:"Selects",component:()=>Qe(()=>import("./selects.js"),[])},{path:"/data",name:"Data",component:()=>Qe(()=>import("./data.js"),[])},{path:"/examples",name:"Examples",component:()=>Qe(()=>import("./index2.js"),__vite__mapDeps([2,3]))},{path:"/settings",name:"Settings",component:()=>Qe(()=>import("./index3.js"),__vite__mapDeps([4,5]))},{path:"/events",name:"Events",component:()=>Qe(()=>import("./index4.js"),[])},{path:"/methods",name:"Methods",component:()=>Qe(()=>import("./index5.js"),[])},{path:"/vue",name:"Vue",component:()=>Qe(()=>import("./vue.js"),[])}]});class Rc{constructor(e){e||(e={}),this.main=e.main||"ss-main",this.placeholder=e.placeholder||"ss-placeholder",this.values=e.values||"ss-values",this.single=e.single||"ss-single",this.max=e.max||"ss-max",this.value=e.value||"ss-value",this.valueText=e.valueText||"ss-value-text",this.valueDelete=e.valueDelete||"ss-value-delete",this.valueOut=e.valueOut||"ss-value-out",this.deselect=e.deselect||"ss-deselect",this.deselectPath=e.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=e.arrow||"ss-arrow",this.arrowClose=e.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=e.arrowOpen||"M10,70 L50,30 L90,70",this.content=e.content||"ss-content",this.openAbove=e.openAbove||"ss-open-above",this.openBelow=e.openBelow||"ss-open-below",this.search=e.search||"ss-search",this.searchHighlighter=e.searchHighlighter||"ss-search-highlight",this.searching=e.searching||"ss-searching",this.addable=e.addable||"ss-addable",this.addablePath=e.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=e.list||"ss-list",this.optgroup=e.optgroup||"ss-optgroup",this.optgroupLabel=e.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=e.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=e.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=e.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=e.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=e.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=e.optgroupClosable||"ss-closable",this.option=e.option||"ss-option",this.optionDelete=e.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=e.highlighted||"ss-highlighted",this.open=e.open||"ss-open",this.close=e.close||"ss-close",this.selected=e.selected||"ss-selected",this.error=e.error||"ss-error",this.disabled=e.disabled||"ss-disabled",this.hide=e.hide||"ss-hide"}}function Fn(){return Math.random().toString(36).substring(2,10)}function Dc(t,e){function s(i,r){return r&&i&&i.classList&&i.classList.contains(r)||r&&i&&i.dataset&&i.dataset.id&&i.dataset.id===e?i:null}function n(i,r){return!i||i===document?null:s(i,r)?i:n(i.parentNode,r)}return s(t,e)||n(t,e)}function Kt(t,e=50,s=!1){let n;return function(...i){const r=self,o=()=>{n=null,s||t.apply(r,i)},l=s&&!n;clearTimeout(n),n=setTimeout(o,e),l&&t.apply(r,i)}}function qs(t,e){return JSON.stringify(t)===JSON.stringify(e)}function kc(t){const e=t.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,s=>"-"+s.toLowerCase());return t[0]===t[0].toUpperCase()?e.substring(1):e}class Me{constructor(e){if(this.id=!e.id||e.id===""?Fn():e.id,this.label=e.label||"",this.selectAll=e.selectAll===void 0?!1:e.selectAll,this.selectAllText=e.selectAllText||"Select All",this.closable=e.closable||"off",this.options=[],e.options)for(const s of e.options)this.options.push(new ue(s))}}class ue{constructor(e){this.id=!e.id||e.id===""?Fn():e.id,this.value=e.value===void 0?e.text:e.value,this.text=e.text||"",this.html=e.html||"",this.defaultSelected=e.defaultSelected!==void 0?e.defaultSelected:!1,this.selected=e.selected!==void 0?e.selected:!1,this.display=e.display!==void 0?e.display:!0,this.disabled=e.disabled!==void 0?e.disabled:!1,this.mandatory=e.mandatory!==void 0?e.mandatory:!1,this.placeholder=e.placeholder!==void 0?e.placeholder:!1,this.class=e.class||"",this.style=e.style||"",this.data=e.data||{}}}class Fc{constructor(e,s){this.selectType="single",this.data=[],this.selectedOrder=[],this.selectType=e,this.setData(s)}validateDataArray(e){if(!Array.isArray(e))return new Error("Data must be an array");for(let s of e)if(s instanceof Me||"label"in s){if(!("label"in s))return new Error("Optgroup must have a label");if("options"in s&&s.options)for(let n of s.options){const i=this.validateOption(n);if(i)return i}}else if(s instanceof ue||"text"in s){const n=this.validateOption(s);if(n)return n}else return new Error("Data object must be a valid optgroup or option");return null}validateOption(e){return"text"in e?null:new Error("Option must have a text")}partialToFullData(e){let s=[];return e.forEach(n=>{if(n instanceof Me||"label"in n){let i=[];"options"in n&&n.options&&n.options.forEach(r=>{i.push(new ue(r))}),i.length>0&&s.push(new Me(n))}(n instanceof ue||"text"in n)&&s.push(new ue(n))}),s}setData(e){this.data=this.partialToFullData(e),this.selectType==="single"&&this.setSelectedBy("id",this.getSelected())}getData(){return this.filter(null,!0)}getDataOptions(){return this.filter(null,!1)}addOption(e,s=!1){if(s){let n=[new ue(e)];this.setData(n.concat(this.getData()))}else this.setData(this.getData().concat(new ue(e)))}setSelectedBy(e,s){let n=null,i=!1;const r=[];for(let l of this.data){if(l instanceof Me)for(let a of l.options)n||(n=a),a.selected=i?!1:s.includes(a[e]),a.selected&&(r.push(a),this.selectType==="single"&&(i=!0));l instanceof ue&&(n||(n=l),l.selected=i?!1:s.includes(l[e]),l.selected&&(r.push(l),this.selectType==="single"&&(i=!0)))}this.selectType==="single"&&n&&!i&&(n.selected=!0,r.push(n));const o=s.map(l=>{var a;return((a=r.find(u=>u[e]===l))==null?void 0:a.id)||""});this.selectedOrder=o}getSelected(){return this.getSelectedOptions().map(e=>e.id)}getSelectedValues(){return this.getSelectedOptions().map(e=>e.value)}getSelectedOptions(){return this.filter(e=>e.selected,!1)}getOptgroupByID(e){for(let s of this.data)if(s instanceof Me&&s.id===e)return s;return null}getOptionByID(e){let s=this.filter(n=>n.id===e,!1);return s.length?s[0]:null}getSelectType(){return this.selectType}getFirstOption(){let e=null;for(let s of this.data)if(s instanceof Me?e=s.options[0]:s instanceof ue&&(e=s),e)break;return e}search(e,s){return e=e.trim(),e===""?this.getData():this.filter(n=>s(n,e),!0)}filter(e,s){const n=[];return this.data.forEach(i=>{if(i instanceof Me){let r=[];if(i.options.forEach(o=>{(!e||e(o))&&(s?r.push(new ue(o)):n.push(new ue(o)))}),r.length>0){let o=new Me(i);o.options=r,n.push(o)}}i instanceof ue&&(!e||e(i))&&n.push(new ue(i))}),n}selectedOrderOptions(e){const s=[];return this.selectedOrder.forEach(n=>{const i=e.find(r=>r.id===n);i&&s.push(i)}),e.forEach(n=>{let i=!1;s.forEach(r=>{if(n.id===r.id){i=!0;return}}),i||s.push(n)}),s}}const ke=class ke{static getLiveAssertive(){let e=document.getElementById("ss-live-assertive");return e||(e=document.createElement("div"),e.id="ss-live-assertive",e.setAttribute("role","status"),e.setAttribute("aria-live","assertive"),e.setAttribute("aria-atomic","true"),e.className="sr-only",document.body.appendChild(e)),e}_announceAssertive(e){const s=ke._liveAssertive||(ke._liveAssertive=ke.getLiveAssertive());s.textContent="",requestAnimationFrame(()=>{s.textContent=e})}constructor(e,s,n,i){var o;this.store=n,this.settings=e,this.classes=s,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes();const r=(o=document.querySelector(`[data-id="${this.settings.id}"]`))==null?void 0:o.closest(".offcanvas-body");r?r.appendChild(this.content.main):this.settings.contentLocation&&this.settings.contentLocation.appendChild(this.content.main)}static getLivePolite(){let e=document.getElementById("ss-live-polite");return e||(e=document.createElement("div"),e.id="ss-live-polite",e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),e.className="sr-only",document.body.appendChild(e)),e}_announcePolite(e){const s=ke._livePolite||(ke._livePolite=ke.getLivePolite());s.textContent="",requestAnimationFrame(()=>{s.textContent=e})}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 e=this.store.getSelectedOptions();if(e.length){const s=e[e.length-1].id,n=this.content.list.querySelector('[data-id="'+s+'"]');n&&this.ensureElementInView(this.content.list,n)}this.settings.contentPosition==="fixed"&&(this.moveContent(),this.scrollHandler=()=>this.moveContent(),this.resizeHandler=()=>this.moveContent(),window.addEventListener("scroll",this.scrollHandler,!0),window.addEventListener("resize",this.resizeHandler)),this.searchFocus()}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),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=void 0),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=void 0),this.main.main.focus({preventScroll:!0}),this.main.main.removeAttribute("aria-activedescendant")}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.main.main.classList.add("ss-2"),this.content.main.classList.add(this.classes.content),this.content.main.classList.add("ss-content-2"),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()));(this.settings.contentPosition==="relative"||this.settings.contentPosition==="fixed")&&this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){this.content.list.setAttribute("role","listbox"),this.content.list.setAttribute("id",this.content.main.id+"-list"),this.content.list.setAttribute("aria-label",this.settings.contentAriaLabel),this.settings.isMultiple?this.content.list.setAttribute("aria-multiselectable","true"):this.content.list.removeAttribute("aria-multiselectable"),this.main.main.setAttribute("role","combobox"),this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.list.id),this.main.main.setAttribute("aria-expanded","false"),this.main.main.setAttribute("aria-autocomplete","list"),this.settings.ariaLabelledBy&&this.settings.ariaLabelledBy.trim()?(this.main.main.setAttribute("aria-labelledby",this.settings.ariaLabelledBy),this.main.main.removeAttribute("aria-label")):this.settings.ariaLabel&&this.settings.ariaLabel.trim()&&this.main.main.setAttribute("aria-label",this.settings.ariaLabel),this.main.main.setAttribute("aria-owns",this.content.list.id),this.content.search.input.setAttribute("aria-controls",this.content.list.id),this.content.search.input.setAttribute("aria-autocomplete","list")}mainDiv(){var u;const e=document.createElement("div");e.id=this.settings.id+"-main",e.tabIndex=0,e.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 f=this.content.list.querySelector("."+this.classes.highlighted);return f&&f.click(),!1;case"Escape":return this.callbacks.close(),!1}return c.key.length===1&&this.callbacks.open(),!0},e.onclick=c=>{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 n=document.createElement("div");n.classList.add(this.classes.deselect),n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label",this.settings.clearAllAriaLabel),n.addEventListener("keydown",c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),n.click())});const i=(u=this.store)==null?void 0:u.getSelectedOptions();!this.settings.allowDeselect||this.settings.isMultiple&&i&&i.length<=0?n.classList.add(this.classes.hide):n.classList.remove(this.classes.hide),n.onclick=c=>{if(c.stopPropagation(),this.settings.disabled)return;let f=!0;const p=this.store.getSelectedOptions(),g=[];if(this.callbacks.beforeChange&&(f=this.callbacks.beforeChange(g,p)===!0),f){if(this.settings.isMultiple)this.callbacks.setSelected([],!1),this.updateDeselectAll();else{const C=this.store.getFirstOption(),_=C?C.id:"";this.callbacks.setSelected(_,!1)}this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(this.store.getSelectedOptions())}};const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("viewBox","0 0 100 100"),r.setAttribute("aria-hidden","true"),r.setAttribute("focusable","false");const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.deselectPath),r.appendChild(o),n.appendChild(r),e.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.classList.add(this.classes.arrow),l.setAttribute("viewBox","0 0 100 100"),l.setAttribute("aria-hidden","true"),l.setAttribute("focusable","false");const a=document.createElementNS("http://www.w3.org/2000/svg","path");return a.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&l.classList.add(this.classes.hide),l.appendChild(a),e.appendChild(l),{main:e,values:s,deselect:{main:n,svg:r,path:o},arrow:{main:l,path:a}}}mainFocus(e){e!=="click"&&this.main.main.focus({preventScroll:!0})}placeholder(){const e=this.store.filter(i=>i.placeholder,!1);let s=this.settings.placeholderText;e.length&&(e[0].html!==""?s=e[0].html:e[0].text!==""&&(s=e[0].text));const n=document.createElement("div");return n.classList.add(this.classes.placeholder),n.innerHTML=s,n}renderValues(){if(!this.settings.isMultiple){this.renderSingleValue();return}this.renderMultipleValues(),this.updateDeselectAll()}renderSingleValue(){const e=this.store.filter(n=>n.selected&&!n.placeholder,!1),s=e.length>0?e[0]:null;if(!s)this.main.values.innerHTML=this.placeholder().outerHTML;else{const n=document.createElement("div");n.classList.add(this.classes.single),s.html?n.innerHTML=s.html:n.innerText=s.text,this.main.values.innerHTML=n.outerHTML}!this.settings.allowDeselect||!e.length?this.main.deselect.main.classList.add(this.classes.hide):this.main.deselect.main.classList.remove(this.classes.hide)}renderMultipleValues(){let e=this.main.values.childNodes,s=this.store.filter(i=>i.selected&&i.display,!1);if(s.length===0){this.main.values.innerHTML=this.placeholder().outerHTML;return}else{const i=this.main.values.querySelector("."+this.classes.placeholder);i&&i.remove()}if(s.length>this.settings.maxValuesShown){const i=document.createElement("div");i.classList.add(this.classes.max),i.textContent=this.settings.maxValuesMessage.replace("{number}",s.length.toString()),this.main.values.innerHTML=i.outerHTML;return}else{const i=this.main.values.querySelector("."+this.classes.max);i&&i.remove()}this.settings.keepOrder&&(s=this.store.selectedOrderOptions(s));let n=[];for(let i=0;ia.id===o,!1).length||n.push(r))}for(const i of n)i.classList.add(this.classes.valueOut),setTimeout(()=>{this.main.values.hasChildNodes()&&this.main.values.contains(i)&&this.main.values.removeChild(i)},100);e=this.main.values.childNodes;for(let i=0;i{if(l.preventDefault(),l.stopPropagation(),this.settings.disabled)return;let a=!0;const u=this.store.getSelectedOptions(),c=u.filter(f=>f.selected&&f.id!==e.id,!0);if(!(this.settings.minSelected&&c.length{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),i.click())}}return s}contentDiv(){const e=document.createElement("div");e.id=this.settings.id+"-content";const s=this.searchDiv();e.appendChild(s.main);const n=this.listDiv();return e.appendChild(n),{main:e,search:s,list:n}}moveContent(){if(this.settings.contentPosition==="relative"){this.moveContentBelow();return}if(this.settings.openPosition==="down"){this.moveContentBelow();return}else if(this.settings.openPosition==="up"){this.moveContentAbove();return}this.putContent()==="up"?this.moveContentAbove():this.moveContentBelow()}searchDiv(){const e=document.createElement("div"),s=document.createElement("input"),n=document.createElement("div");e.classList.add(this.classes.search);const i={main:e,input:s};if(this.settings.showSearch||(e.classList.add(this.classes.hide),s.readOnly=!0),s.type="search",s.placeholder=this.settings.searchPlaceholder,s.tabIndex=-1,this.settings.searchLabelledBy&&this.settings.searchLabelledBy.trim()?s.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel&&this.settings.searchAriaLabel.trim()?s.setAttribute("aria-label",this.settings.searchAriaLabel):s.setAttribute("aria-label","Search options"),s.setAttribute("autocapitalize","off"),s.setAttribute("autocomplete","off"),s.setAttribute("autocorrect","off"),s.oninput=Kt(r=>{this.callbacks.search(r.target.value)},100),s.onkeydown=r=>{switch(r.key){case"ArrowUp":case"ArrowDown":return r.key==="ArrowDown"?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Escape":return this.callbacks.close(),!1;case" ":const o=this.content.list.querySelector("."+this.classes.highlighted);return o?(o.click(),!1):!0;case"Enter":if(this.callbacks.addable)return n.click(),!1;{const l=this.content.list.querySelector("."+this.classes.highlighted);if(l)return l.click(),!1}return!0}return!0},e.appendChild(s),this.callbacks.addable){n.classList.add(this.classes.addable);const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("viewBox","0 0 100 100"),r.setAttribute("aria-hidden","true"),r.setAttribute("focusable","false");const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.addablePath),r.appendChild(o),n.appendChild(r),n.onclick=l=>{if(l.preventDefault(),l.stopPropagation(),!this.callbacks.addable)return;const a=this.content.search.input.value.trim();if(a===""){this.content.search.input.focus();return}const u=f=>{let p=new ue(f);if(this.callbacks.addOption(p),this.settings.isMultiple){let g=this.store.getSelected();g.push(p.id),this.callbacks.setSelected(g,!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(f=>{typeof f=="string"?u({text:f,value:f}):c instanceof Error?this.renderError(c.message):u(f)}):typeof c=="string"?u({text:c,value:c}):c instanceof Error?this.renderError(c.message):u(c))},e.appendChild(n),i.addable={main:n,svg:r,path:o}}return i}searchFocus(){this.content.search.input.focus()}getOptions(e=!1,s=!1,n=!1){let i="."+this.classes.option;return e&&(i+=":not(."+this.classes.placeholder+")"),s&&(i+=":not(."+this.classes.disabled+")"),n&&(i+=":not(."+this.classes.hide+")"),Array.from(this.content.list.querySelectorAll(i))}highlight(e){const s=this.getOptions(!0,!0,!0);if(s.length===0)return;if(s.length===1&&!s[0].classList.contains(this.classes.highlighted)){s[0].classList.add(this.classes.highlighted);return}let n=!1;for(const r of s)r.classList.contains(this.classes.highlighted)&&(n=!0);if(!n){for(const r of s)if(r.classList.contains(this.classes.selected)){r.classList.add(this.classes.highlighted);break}}for(let r=0;r=0?r-1:s.length-1];a.classList.add(this.classes.highlighted),this.main.main.setAttribute("aria-activedescendant",a.id),this.ensureElementInView(this.content.list,a);const u=a.parentElement;if(u&&u.classList.contains(this.classes.close)){const c=u.querySelector("."+this.classes.optgroupLabel);c&&c.click()}return}const i=s[e==="down"?0:s.length-1];i.classList.add(this.classes.highlighted),this.main.main.setAttribute("aria-activedescendant",i.id),this.ensureElementInView(this.content.list,i)}listDiv(){const e=document.createElement("div");return e.classList.add(this.classes.list),e}renderError(e){this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy");const s=document.createElement("div");s.classList.add(this.classes.error),s.textContent=e,this.content.list.appendChild(s),this._announceAssertive(e)}renderSearching(){this.content.list.innerHTML="",this.content.list.setAttribute("aria-busy","true");const e=document.createElement("div");e.classList.add(this.classes.searching),e.textContent=this.settings.searchingText,this.content.list.appendChild(e),this._announcePolite(this.settings.searchingText)}renderOptions(e){if(this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy"),e.length===0){const o=document.createElement("div");o.classList.add(this.classes.search);const l=this.callbacks.addable?this.settings.addableText.replace("{value}",this.content.search.input.value):this.settings.searchText;this._announcePolite(l),o.innerHTML=l,this.content.list.appendChild(o),this.content.list.setAttribute("aria-setsize","0");return}this.settings.allowDeselect&&!this.settings.isMultiple&&(this.store.filter(l=>l.placeholder,!1).length||this.store.addOption(new ue({text:"",value:"",selected:!1,placeholder:!0}),!0));const s=document.createDocumentFragment();let n=0;const i=o=>{!o.classList.contains(this.classes.placeholder)&&!o.classList.contains(this.classes.disabled)&&!o.classList.contains(this.classes.hide)&&o.setAttribute("aria-posinset",String(++n))};for(const o of e){if(o instanceof Me){const l=document.createElement("div");l.classList.add(this.classes.optgroup),l.setAttribute("role","group"),l.setAttribute("aria-label",o.label);const a=document.createElement("div");a.classList.add(this.classes.optgroupLabel),l.appendChild(a);const u=document.createElement("div");u.classList.add(this.classes.optgroupLabelText),u.textContent=o.label,a.appendChild(u);const c=document.createElement("div");if(c.classList.add(this.classes.optgroupActions),a.appendChild(c),this.settings.isMultiple&&o.selectAll){const f=document.createElement("div");f.classList.add(this.classes.optgroupSelectAll);let p=!0;for(const T of o.options)if(!T.selected){p=!1;break}p&&f.classList.add(this.classes.selected);const g=document.createElement("span");g.textContent=o.selectAllText,f.appendChild(g);const C=document.createElementNS("http://www.w3.org/2000/svg","svg");C.setAttribute("viewBox","0 0 100 100"),C.setAttribute("aria-hidden","true"),C.setAttribute("focusable","false"),f.appendChild(C);const _=document.createElementNS("http://www.w3.org/2000/svg","path");_.setAttribute("d",this.classes.optgroupSelectAllBox),C.appendChild(_);const D=document.createElementNS("http://www.w3.org/2000/svg","path");D.setAttribute("d",this.classes.optgroupSelectAllCheck),C.appendChild(D),f.addEventListener("click",T=>{T.preventDefault(),T.stopPropagation();const m=this.store.getSelected();if(p){const v=m.filter(y=>{for(const E of o.options)if(y===E.id)return!1;return!0});this.callbacks.setSelected(v,!0);return}else{const v=m.concat(o.options.map(y=>y.id));for(const y of o.options)this.store.getOptionByID(y.id)||this.callbacks.addOption(y);this.callbacks.setSelected(v,!0);return}}),c.appendChild(f)}if(o.closable!=="off"){const f=document.createElement("div");f.classList.add(this.classes.optgroupClosable);const p=document.createElementNS("http://www.w3.org/2000/svg","svg");p.setAttribute("viewBox","0 0 100 100"),p.classList.add(this.classes.arrow),p.setAttribute("aria-hidden","true"),p.setAttribute("focusable","false"),f.appendChild(p);const g=document.createElementNS("http://www.w3.org/2000/svg","path");p.appendChild(g),o.options.some(C=>C.selected)||this.content.search.input.value.trim()!==""?(l.classList.add(this.classes.open),g.setAttribute("d",this.classes.arrowOpen)):o.closable==="open"?(l.classList.add(this.classes.open),g.setAttribute("d",this.classes.arrowOpen)):o.closable==="close"&&(l.classList.add(this.classes.close),g.setAttribute("d",this.classes.arrowClose)),a.addEventListener("click",C=>{C.preventDefault(),C.stopPropagation(),l.classList.contains(this.classes.close)?(l.classList.remove(this.classes.close),l.classList.add(this.classes.open),g.setAttribute("d",this.classes.arrowOpen)):(l.classList.remove(this.classes.open),l.classList.add(this.classes.close),g.setAttribute("d",this.classes.arrowClose))}),c.appendChild(f)}l.appendChild(a);for(const f of o.options){const p=this.option(f);i(p),l.appendChild(p)}s.appendChild(l)}if(o instanceof ue){const l=this.option(o);i(l),s.appendChild(l)}}this.content.list.appendChild(s),this.content.list.removeAttribute("aria-busy");const r=this.getOptions(!0,!0,!0).length;this.content.list.setAttribute("aria-setsize",String(r)),this._announcePolite(`${r} option${r===1?"":"s"} available`)}option(e){if(e.placeholder){const n=document.createElement("div");return n.classList.add(this.classes.option),n.classList.add(this.classes.hide),n}const s=document.createElement("div");return s.dataset.id=e.id,s.id=`${this.settings.id}__opt__${e.id}`,s.classList.add(this.classes.option),s.setAttribute("role","option"),e.class&&e.class.split(" ").forEach(n=>{s.classList.add(n)}),e.style&&(s.style.cssText=e.style),this.settings.searchHighlight&&this.content.search.input.value.trim()!==""?s.innerHTML=this.highlightText(e.html!==""?e.html:e.text,this.content.search.input.value,this.classes.searchHighlighter):e.html!==""?s.innerHTML=e.html:s.textContent=e.text,this.settings.showOptionTooltips&&s.textContent&&s.setAttribute("title",s.textContent),e.display||s.classList.add(this.classes.hide),e.disabled&&(s.classList.add(this.classes.disabled),s.setAttribute("aria-disabled","true")),e.selected&&this.settings.hideSelected&&s.classList.add(this.classes.hide),e.selected?(s.classList.add(this.classes.selected),s.setAttribute("aria-selected","true"),this.main.main.setAttribute("aria-activedescendant",s.id)):(s.classList.remove(this.classes.selected),s.setAttribute("aria-selected","false")),s.addEventListener("click",n=>{n.preventDefault(),n.stopPropagation();const i=this.store.getSelected(),r=n.currentTarget,o=String(r.dataset.id);if(e.disabled||e.selected&&!this.settings.allowDeselect||this.settings.isMultiple&&this.settings.maxSelected<=i.length&&!e.selected||this.settings.isMultiple&&this.settings.minSelected>=i.length&&e.selected)return;let l=!1;const a=this.store.getSelectedOptions();let u=[];if(this.settings.isMultiple){if(e.selected)u=a.filter(c=>c.id!==o);else if(u=a.concat(e),!this.settings.closeOnSelect)if(n.shiftKey&&this.lastSelectedOption){const c=this.store.getDataOptions();let f=c.findIndex(g=>g.id===this.lastSelectedOption.id),p=c.findIndex(g=>g.id===e.id);if(f>=0&&p>=0){const g=Math.min(f,p),C=Math.max(f,p),_=c.slice(g,C+1);_.length>0&&_.length!a.find(T=>T.id===D.id))))}}else e.selected||(this.lastSelectedOption=e)}this.settings.isMultiple||(e.selected?u=[]:u=[e]),this.callbacks.beforeChange||(l=!0),this.callbacks.beforeChange&&(this.callbacks.beforeChange(u,a)===!1?l=!1:l=!0),l&&(this.store.getOptionByID(o)||this.callbacks.addOption(e),this.callbacks.setSelected(u.map(c=>c.id),!1),this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(u))}),s}destroy(){this.main.main.remove(),this.content.main.remove()}highlightText(e,s,n){let i=e;const r=new RegExp("(?![^<]*>)("+s.trim()+")(?![^<]*>[^<>]*${a}`),i}moveContentAbove(){const e=this.main.main.offsetHeight,s=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 n=this.main.main.getBoundingClientRect();this.content.main.style.margin="-"+(e+s-1)+"px 0px 0px 0px",this.content.main.style.top=n.top+n.height+(this.settings.contentPosition==="fixed"?0:window.scrollY)+"px",this.content.main.style.left=n.left+(this.settings.contentPosition==="fixed"?0:window.scrollX)+"px",this.content.main.style.width=n.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",this.settings.contentPosition!=="relative"&&(this.content.main.style.top=e.top+e.height+(this.settings.contentPosition==="fixed"?0:window.scrollY)+"px",this.content.main.style.left=e.left+(this.settings.contentPosition==="fixed"?0:window.scrollX)+"px",this.content.main.style.width=e.width+"px")}ensureElementInView(e,s){const n=e.scrollTop+e.offsetTop,i=n+e.clientHeight,r=s.offsetTop,o=r+s.clientHeight;ri&&(e.scrollTop+=o-i)}putContent(){const e=this.main.main.offsetHeight,s=this.main.main.getBoundingClientRect(),n=this.content.main.offsetHeight;return window.innerHeight-(s.top+e)<=n&&s.top>n?"up":"down"}updateDeselectAll(){if(!this.store||!this.settings)return;const e=this.store.getSelectedOptions(),s=e&&e.length>0,n=this.settings.isMultiple,i=this.settings.allowDeselect,r=this.main.deselect.main,o=this.classes.hide;i&&!(n&&!s)?r.classList.remove(o):r.classList.add(o)}};ke._livePolite=null,ke._liveAssertive=null;let hn=ke;class Ic{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.getSelectedOptions()),!0}observeCall(e){if(!this.listen)return;let s=!1,n=!1,i=!1;for(const r of e){if(r.target===this.select&&(r.attributeName==="disabled"&&(n=!0),r.attributeName==="class"&&(s=!0),r.type==="childList")){for(const o of r.addedNodes)if(o.nodeName==="OPTION"&&o.value===this.select.value){this.select.dispatchEvent(new Event("change"));break}i=!0}(r.target.nodeName==="OPTGROUP"||r.target.nodeName==="OPTION")&&(i=!0)}s&&this.onClassChange&&this.onClassChange(this.select.className.split(" ")),n&&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 s=this.select.childNodes;for(const n of s)n.nodeName==="OPTGROUP"&&e.push(this.getDataFromOptgroup(n)),n.nodeName==="OPTION"&&e.push(this.getDataFromOption(n));return e}getDataFromOptgroup(e){let s={id:e.id,label:e.label,selectAll:e.dataset?e.dataset.selectall==="true":!1,selectAllText:e.dataset?e.dataset.selectalltext:"Select all",closable:e.dataset?e.dataset.closable:"off",options:[]};const n=e.childNodes;for(const i of n)i.nodeName==="OPTION"&&s.options.push(this.getDataFromOption(i));return s}getDataFromOption(e){return{id:e.id,value:e.value,text:e.text,html:e.dataset&&e.dataset.html?e.dataset.html:"",defaultSelected:e.defaultSelected,selected:e.selected,display:e.style.display!=="none",disabled:e.disabled,mandatory:e.dataset?e.dataset.mandatory==="true":!1,placeholder:e.dataset.placeholder==="true",class:e.className,style:e.style.cssText,data:e.dataset}}getSelectedOptions(){let e=[];const s=this.select.childNodes;for(const n of s){if(n.nodeName==="OPTGROUP"){const i=n.childNodes;for(const r of i)if(r.nodeName==="OPTION"){const o=r;o.selected&&e.push(this.getDataFromOption(o))}}if(n.nodeName==="OPTION"){const i=n;i.selected&&e.push(this.getDataFromOption(i))}}return e}getSelectedValues(){return this.getSelectedOptions().map(e=>e.value)}setSelected(e){this.changeListen(!1);const s=this.select.childNodes;for(const n of s){if(n.nodeName==="OPTGROUP"){const r=n.childNodes;for(const o of r)if(o.nodeName==="OPTION"){const l=o;l.selected=e.includes(l.id)}}if(n.nodeName==="OPTION"){const i=n;i.selected=e.includes(i.id)}}this.changeListen(!0)}setSelectedByValue(e){this.changeListen(!1);const s=this.select.childNodes;for(const n of s){if(n.nodeName==="OPTGROUP"){const r=n.childNodes;for(const o of r)if(o.nodeName==="OPTION"){const l=o;l.selected=e.includes(l.value)}}if(n.nodeName==="OPTION"){const i=n;i.selected=e.includes(i.value)}}this.changeListen(!0)}updateSelect(e,s,n){this.changeListen(!1),e&&(this.select.dataset.id=e),s&&(this.select.style.cssText=s),n&&(this.select.className="",n.forEach(i=>{i.trim()!==""&&this.select.classList.add(i.trim())})),this.changeListen(!0)}updateOptions(e){this.changeListen(!1),this.select.innerHTML="";for(const s of e)s instanceof Me&&this.select.appendChild(this.createOptgroup(s)),s instanceof ue&&this.select.appendChild(this.createOption(s));this.select.dispatchEvent(new Event("change",{bubbles:!0})),this.changeListen(!0)}createOptgroup(e){const s=document.createElement("optgroup");if(s.id=e.id,s.label=e.label,e.selectAll&&(s.dataset.selectAll="true"),e.closable!=="off"&&(s.dataset.closable=e.closable),e.options)for(const n of e.options)s.appendChild(this.createOption(n));return s}createOption(e){const s=document.createElement("option");return s.id=e.id,s.value=e.value,s.textContent=e.text,e.html!==""&&s.setAttribute("data-html",e.html),s.defaultSelected=e.defaultSelected,s.selected=e.selected,e.disabled&&(s.disabled=!0),e.display||(s.style.display="none"),e.placeholder&&s.setAttribute("data-placeholder","true"),e.mandatory&&s.setAttribute("data-mandatory","true"),e.class&&e.class.split(" ").forEach(n=>{s.classList.add(n)}),e.data&&typeof e.data=="object"&&Object.keys(e.data).forEach(n=>{s.setAttribute("data-"+kc(n),e.data[n])}),s}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 Mc{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-"+Fn(),this.style=e.style||"",this.class=e.class||[],this.disabled=e.disabled!==void 0?e.disabled:!1,this.alwaysOpen=e.alwaysOpen!==void 0?e.alwaysOpen:!1,this.showSearch=e.showSearch!==void 0?e.showSearch:!0,this.focusSearch=e.focusSearch!==void 0?e.focusSearch:!0,this.ariaLabel=e.ariaLabel||"Combobox",this.searchPlaceholder=e.searchPlaceholder||"Search",this.searchText=e.searchText||"No Results",this.searchingText=e.searchingText||"Searching...",this.searchHighlight=e.searchHighlight!==void 0?e.searchHighlight:!1,this.closeOnSelect=e.closeOnSelect!==void 0?e.closeOnSelect:!0,this.contentLocation=e.contentLocation||document.body,this.contentPosition=e.contentPosition||"absolute",this.openPosition=e.openPosition||"auto",this.contentAriaLabel=e.contentAriaLabel!==void 0?e.contentAriaLabel:"Select an option",this.placeholderText=e.placeholderText!==void 0?e.placeholderText:"Select Value",this.allowDeselect=e.allowDeselect!==void 0?e.allowDeselect:!1,this.hideSelected=e.hideSelected!==void 0?e.hideSelected:!1,this.keepOrder=e.keepOrder!==void 0?e.keepOrder:!1,this.showOptionTooltips=e.showOptionTooltips!==void 0?e.showOptionTooltips:!1,this.minSelected=e.minSelected||0,this.maxSelected=e.maxSelected||1e3,this.timeoutDelay=e.timeoutDelay||200,this.maxValuesShown=e.maxValuesShown||20,this.maxValuesMessage=e.maxValuesMessage||"{number} selected",this.addableText=e.addableText||'Press "Enter" to add {value}',this.ariaLabelledBy=e.ariaLabelledBy||"",this.searchAriaLabel=e.searchAriaLabel||"Search options",this.searchLabelledBy=e.searchLabelledBy||"",this.clearAllAriaLabel=e.clearAllAriaLabel||"Clear selection"}}class Nc{constructor(e){var o;if(this.events={search:void 0,searchFilter:(l,a)=>l.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=Kt(()=>{!this.settings.isOpen&&!this.settings.isFullOpen||this.render.moveContent()}),this.windowScroll=Kt(()=>{!this.settings.isOpen&&!this.settings.isFullOpen||this.render.moveContent()}),this.documentClick=l=>{this.settings.isOpen&&l.target&&!Dc(l.target,this.settings.id)&&this.close(l.type)},this.windowVisibilityChange=()=>{document.hidden&&this.close()},this.selectEl=typeof e.select=="string"?document.querySelector(e.select):e.select,!this.selectEl){e.events&&e.events.error&&e.events.error(new Error("Could not find select element"));return}if(this.selectEl.tagName!=="SELECT"){e.events&&e.events.error&&e.events.error(new Error("Element isnt of type select"));return}this.selectEl.dataset.ssid&&this.destroy(),this.settings=new Mc(e.settings),this.cssClasses=new Rc(e.cssClasses);const s=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const l in e.events)e.events.hasOwnProperty(l)&&(s.indexOf(l)!==-1?this.events[l]=Kt(e.events[l],100):this.events[l]=e.events[l]);this.settings.disabled=(o=e.settings)!=null&&o.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 Ic(this.selectEl),this.select.updateSelect(this.settings.id,this.settings.style,this.settings.class),this.select.hideUI(),this.select.onValueChange=l=>{this.setSelected(l.map(a=>a.id))},this.select.onClassChange=l=>{this.settings.class=l,this.render.updateClassStyles()},this.select.onDisabledChange=l=>{l?this.disable():this.enable()},this.select.onOptionsChange=l=>{this.setData(l)},this.store=new Fc(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 hn(this.settings,this.cssClasses,this.store,n),this.render.renderValues(),this.render.renderOptions(this.store.getData());const i=this.selectEl.getAttribute("aria-label"),r=this.selectEl.getAttribute("aria-labelledby");i?this.render.main.main.setAttribute("aria-label",i):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),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(e){const s=this.store.getSelected(),n=this.store.validateDataArray(e);if(n){this.events.error&&this.events.error(n);return}this.store.setData(e);const i=this.store.getData();this.select.updateOptions(i),this.render.renderValues(),this.render.renderOptions(i),this.events.afterChange&&!qs(s,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let e=this.store.getSelectedOptions();return this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e)),e.map(s=>s.value)}setSelected(e,s=!0){const n=this.store.getSelected(),i=this.store.getDataOptions();e=Array.isArray(e)?e:[e];const r=[];for(const l of e){if(i.find(a=>a.id==l)){r.push(l);continue}for(const a of i.filter(u=>u.value==l))r.push(a.id)}this.store.setSelectedBy("id",r);const o=this.store.getData();this.select.updateOptions(o),this.render.renderValues(),this.render.content.search.input.value!==""?this.search(this.render.content.search.input.value):this.render.renderOptions(o),s&&this.events.afterChange&&!qs(n,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}addOption(e){const s=this.store.getSelected();this.store.getDataOptions().some(i=>i.value===(e.value??e.text))||this.store.addOption(e);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!qs(s,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.settings.focusSearch&&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(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){this.render.renderOptions(e===""?this.store.getData():this.store.search(e,this.events.searchFilter));return}this.render.renderSearching();const s=this.events.search(e,this.store.getSelectedOptions());if(s instanceof Promise){s.then(n=>{this.render.renderOptions(this.store.partialToFullData(n))}).catch(n=>{this.render.renderError(typeof n=="string"?n:n.message)});return}else Array.isArray(s)?this.render.renderOptions(this.store.partialToFullData(s)):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 Bc="CWYDT23U",Hc="slimselectjscom",Vc=Ts({__name:"carbonad",setup(t){const e=ir(null);let s=!1;return mr(()=>{const n=window.location.hostname==="localhost";if(!s&&!n){s=!0;const i=document.createElement("script");i.id="_carbonads_js",i.src=`//cdn.carbonads.com/carbon.js?serve=${Bc}&placement=${Hc}`,i.async=!0,e.value&&e.value.appendChild(i)}}),(n,i)=>wt(s)?(Zt(),Nr("div",{key:0,class:"carbon-container",ref_key:"container",ref:e},null,512)):$o("",!0)}}),Uc=Ts({name:"App",components:{CarbonAd:Vc},data(){return{nav:null,navDebounce:Kt(()=>{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:"Examples",closable:"close",options:[{text:"countries",value:"examples#countries"},{text:"form reset",value:"examples#formReset"}]},{label:"Settings",closable:"close",options:[{text:"select",value:"settings#select"},{text:"cssClasses",value:"settings#cssClasses"},{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"}]}]}},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 t=this.$route.hash;if(t===""&&window.scroll({top:0,behavior:"smooth"}),t){const e=document.querySelector(t);if(e){const s=document.querySelector("header"),n=document.querySelector("nav"),i=s?s.clientHeight+(window.innerWidth<700?n.clientHeight:0)+8:0;window.scroll({top:e.offsetTop-i,behavior:"smooth"})}}},200)}),this.setDemensions(),window.addEventListener("resize",this.navDebounce),window.addEventListener("nav-updated",this.updateNav)},unmounted(){var t;window.removeEventListener("resize",this.navDebounce),window.removeEventListener("nav-updated",this.updateNav),(t=this.nav)==null||t.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 t={searchHighlight:!0,openContent:"below"};this.width>700&&(t.alwaysOpen=!0,t.contentPosition="relative",t.contentLocation=this.$refs.navContent),this.nav=new Nc({select:this.$refs.nav,data:this.navData,settings:t,events:{afterChange:e=>{const n=e[0].value.split("#"),i=n[0],r=n[1]?"#"+n[1]:void 0;this.$router.push({path:i,hash:r})}}})},updateNav(){setTimeout(()=>{this.nav&&this.nav.setSelected(this.$router.currentRoute.value.fullPath.replace("/",""))},0)}}}),$c="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",jc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACAAQMAAAD58POIAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZQTFRFyzg3////IltC9QAAAAFiS0dEAf8CLd4AAAAJcEhZcwAACxMAAAsTAQCanBgAAAAkSURBVEjHY2AYBYMV/IeDUQG4AJgeFRgVGBUYFSBNYBQMPgAARjtdvxo6xaMAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTEtMDUtMzBUMjM6MTA6NDQtMDc6MDCm4GvfAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDEwLTEyLTA2VDEyOjIwOjEyLTA4OjAwpIGEmQAAADJ0RVh0UE5HOmNIUk0AY2h1bmsgd2FzIGZvdW5kIChzZWUgQ2hyb21hdGljaXR5LCBhYm92ZSkH0UjaAAAAKXRFWHRQTkc6Z0FNQQBnYW1tYT0wLjQ1NDU1IChTZWUgR2FtbWEsIGFib3ZlKRISLKcAAAAUdEVYdFBORzpJSERSLmJpdF9kZXB0aAA4KYV+UAAAABV0RVh0UE5HOklIRFIuY29sb3JfdHlwZQA2BkqnKwAAABt0RVh0UE5HOklIRFIuaW50ZXJsYWNlX21ldGhvZAAw+zsHjAAAABx0RVh0UE5HOklIRFIud2lkdGgsaGVpZ2h0ADE2LCAxNjjVBg0AAAAodEVYdFBORzpwSFlzAHhfcmVzPTI4MzUsIHlfcmVzPTI4MzUsIHVuaXRzPTGCKXI+AAAAKHRFWHRQTkc6c1JHQgBpbnRlbnQ9MCAoU2VlIFJlbmRlcmluZyBpbnRlbnQp8hEU9QAAAABJRU5ErkJggg==",zc=(t,e)=>{const s=t.__vccOpts||t;for(const[n,i]of e)s[n]=i;return s},Wc={ref:"nav"},Gc={class:"nav-content",ref:"navContent"};function qc(t,e,s,n,i,r){const o=$n("CarbonAd"),l=$n("router-view");return Zt(),Nr(Re,null,[e[4]||(e[4]=Uo('

Slim Select 2.0

Advanced select dropdown
',1)),Ze("nav",null,[Ze("select",Wc,null,512),Ze("div",Gc,null,512),de(o)]),Ze("main",null,[de(l),Ze("footer",null,[ds(" © "+Vi(t.year)+" ",1),e[0]||(e[0]=Ze("a",{href:"http://webiswhatido.com",style:{color:"#ffffff"},target:"_blank"},"Brian Voelker",-1)),e[1]||(e[1]=ds(". ")),e[2]||(e[2]=Ze("br",null,null,-1)),e[3]||(e[3]=ds(" Slim Select is under the MIT license. "))])])],64)}const Kc=zc(Uc,[["render",qc]]);var Ri=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function sl(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ks={exports:{}},Di;function Yc(){return Di||(Di=1,function(t){var e=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};/** + */const Ct=typeof document<"u";function jr(t){return typeof t=="object"||"displayName"in t||"props"in t||"__vccOpts"in t}function Oa(t){return t.__esModule||t[Symbol.toStringTag]==="Module"||t.default&&jr(t.default)}const J=Object.assign;function zs(t,e){const s={};for(const n in e){const i=e[n];s[n]=He(i)?i.map(t):t(i)}return s}const Gt=()=>{},He=Array.isArray,zr=/#/g,La=/&/g,Ta=/\//g,Pa=/=/g,Ra=/\?/g,Wr=/\+/g,Da=/%5B/g,ka=/%5D/g,Gr=/%5E/g,Fa=/%60/g,qr=/%7B/g,Ia=/%7C/g,Kr=/%7D/g,Ma=/%20/g;function Dn(t){return encodeURI(""+t).replace(Ia,"|").replace(Da,"[").replace(ka,"]")}function Na(t){return Dn(t).replace(qr,"{").replace(Kr,"}").replace(Gr,"^")}function cn(t){return Dn(t).replace(Wr,"%2B").replace(Ma,"+").replace(zr,"%23").replace(La,"%26").replace(Fa,"`").replace(qr,"{").replace(Kr,"}").replace(Gr,"^")}function Ba(t){return cn(t).replace(Pa,"%3D")}function Ha(t){return Dn(t).replace(zr,"%23").replace(Ra,"%3F")}function Va(t){return t==null?"":Ha(t).replace(Ta,"%2F")}function ss(t){try{return decodeURIComponent(""+t)}catch{}return""+t}const Ua=/\/$/,$a=t=>t.replace(Ua,"");function Ws(t,e,s="/"){let n,i={},r="",o="";const l=e.indexOf("#");let a=e.indexOf("?");return l=0&&(a=-1),a>-1&&(n=e.slice(0,a),r=e.slice(a+1,l>-1?l:e.length),i=t(r)),l>-1&&(n=n||e.slice(0,l),o=e.slice(l,e.length)),n=Ga(n??e,s),{fullPath:n+(r&&"?")+r+o,path:n,query:i,hash:ss(o)}}function ja(t,e){const s=e.query?t(e.query):"";return e.path+(s&&"?")+s+(e.hash||"")}function pi(t,e){return!e||!t.toLowerCase().startsWith(e.toLowerCase())?t:t.slice(e.length)||"/"}function za(t,e,s){const n=e.matched.length-1,i=s.matched.length-1;return n>-1&&n===i&&kt(e.matched[n],s.matched[i])&&Yr(e.params,s.params)&&t(e.query)===t(s.query)&&e.hash===s.hash}function kt(t,e){return(t.aliasOf||t)===(e.aliasOf||e)}function Yr(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(!Wa(t[s],e[s]))return!1;return!0}function Wa(t,e){return He(t)?gi(t,e):He(e)?gi(e,t):t===e}function gi(t,e){return He(e)?t.length===e.length&&t.every((s,n)=>s===e[n]):t.length===1&&t[0]===e}function Ga(t,e){if(t.startsWith("/"))return t;if(!t)return e;const s=e.split("/"),n=t.split("/"),i=n[n.length-1];(i===".."||i===".")&&n.push("");let r=s.length-1,o,l;for(o=0;o1&&r--;else break;return s.slice(0,r).join("/")+"/"+n.slice(o).join("/")}const ut={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};var ns;(function(t){t.pop="pop",t.push="push"})(ns||(ns={}));var qt;(function(t){t.back="back",t.forward="forward",t.unknown=""})(qt||(qt={}));function qa(t){if(!t)if(Ct){const e=document.querySelector("base");t=e&&e.getAttribute("href")||"/",t=t.replace(/^\w+:\/\/[^\/]+/,"")}else t="/";return t[0]!=="/"&&t[0]!=="#"&&(t="/"+t),$a(t)}const Ka=/^[^#]+#/;function Ya(t,e){return t.replace(Ka,"#")+e}function Qa(t,e){const s=document.documentElement.getBoundingClientRect(),n=t.getBoundingClientRect();return{behavior:e.behavior,left:n.left-s.left-(e.left||0),top:n.top-s.top-(e.top||0)}}const ks=()=>({left:window.scrollX,top:window.scrollY});function Ja(t){let e;if("el"in t){const s=t.el,n=typeof s=="string"&&s.startsWith("#"),i=typeof s=="string"?n?document.getElementById(s.slice(1)):document.querySelector(s):s;if(!i)return;e=Qa(i,t)}else e=t;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.scrollX,e.top!=null?e.top:window.scrollY)}function mi(t,e){return(history.state?history.state.position-e:-1)+t}const un=new Map;function Za(t,e){un.set(t,e)}function Xa(t){const e=un.get(t);return un.delete(t),e}let ec=()=>location.protocol+"//"+location.host;function Qr(t,e){const{pathname:s,search:n,hash:i}=e,r=t.indexOf("#");if(r>-1){let l=i.includes(t.slice(r))?t.slice(r).length:1,a=i.slice(l);return a[0]!=="/"&&(a="/"+a),pi(a,"")}return pi(s,t)+n+i}function tc(t,e,s,n){let i=[],r=[],o=null;const l=({state:p})=>{const g=Qr(t,location),_=s.value,C=e.value;let D=0;if(p){if(s.value=g,e.value=p,o&&o===_){o=null;return}D=C?p.position-C.position:0}else n(g);i.forEach(T=>{T(s.value,_,{delta:D,type:ns.pop,direction:D?D>0?qt.forward:qt.back:qt.unknown})})};function a(){o=s.value}function u(p){i.push(p);const g=()=>{const _=i.indexOf(p);_>-1&&i.splice(_,1)};return r.push(g),g}function c(){const{history:p}=window;p.state&&p.replaceState(J({},p.state,{scroll:ks()}),"")}function f(){for(const p of r)p();r=[],window.removeEventListener("popstate",l),window.removeEventListener("beforeunload",c)}return window.addEventListener("popstate",l),window.addEventListener("beforeunload",c,{passive:!0}),{pauseListeners:a,listen:u,destroy:f}}function vi(t,e,s,n=!1,i=!1){return{back:t,current:e,forward:s,replaced:n,position:window.history.length,scroll:i?ks():null}}function sc(t){const{history:e,location:s}=window,n={value:Qr(t,s)},i={value:e.state};i.value||r(n.value,{back:null,current:n.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function r(a,u,c){const f=t.indexOf("#"),p=f>-1?(s.host&&document.querySelector("base")?t:t.slice(f))+a:ec()+t+a;try{e[c?"replaceState":"pushState"](u,"",p),i.value=u}catch(g){console.error(g),s[c?"replace":"assign"](p)}}function o(a,u){const c=J({},e.state,vi(i.value.back,a,i.value.forward,!0),u,{position:i.value.position});r(a,c,!0),n.value=a}function l(a,u){const c=J({},i.value,e.state,{forward:a,scroll:ks()});r(c.current,c,!0);const f=J({},vi(n.value,a,null),{position:c.position+1},u);r(a,f,!1),n.value=a}return{location:n,state:i,push:l,replace:o}}function nc(t){t=qa(t);const e=sc(t),s=tc(t,e.state,e.location,e.replace);function n(r,o=!0){o||s.pauseListeners(),history.go(r)}const i=J({location:"",base:t,go:n,createHref:Ya.bind(null,t)},e,s);return Object.defineProperty(i,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(i,"state",{enumerable:!0,get:()=>e.state.value}),i}function ic(t){return typeof t=="string"||t&&typeof t=="object"}function Jr(t){return typeof t=="string"||typeof t=="symbol"}const Zr=Symbol("");var bi;(function(t){t[t.aborted=4]="aborted",t[t.cancelled=8]="cancelled",t[t.duplicated=16]="duplicated"})(bi||(bi={}));function Ft(t,e){return J(new Error,{type:t,[Zr]:!0},e)}function Je(t,e){return t instanceof Error&&Zr in t&&(e==null||!!(t.type&e))}const yi="[^/]+?",rc={sensitive:!1,strict:!1,start:!0,end:!0},lc=/[.+*?^${}()[\]/\\]/g;function oc(t,e){const s=J({},rc,e),n=[];let i=s.start?"^":"";const r=[];for(const u of t){const c=u.length?[]:[90];s.strict&&!u.length&&(i+="/");for(let f=0;fe.length?e.length===1&&e[0]===80?1:-1:0}function Xr(t,e){let s=0;const n=t.score,i=e.score;for(;s0&&e[e.length-1]<0}const cc={type:0,value:""},uc=/[a-zA-Z0-9_]/;function fc(t){if(!t)return[[]];if(t==="/")return[[cc]];if(!t.startsWith("/"))throw new Error(`Invalid path "${t}"`);function e(g){throw new Error(`ERR (${s})/"${u}": ${g}`)}let s=0,n=s;const i=[];let r;function o(){r&&i.push(r),r=[]}let l=0,a,u="",c="";function f(){u&&(s===0?r.push({type:0,value:u}):s===1||s===2||s===3?(r.length>1&&(a==="*"||a==="+")&&e(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),r.push({type:1,value:u,regexp:c,repeatable:a==="*"||a==="+",optional:a==="*"||a==="?"})):e("Invalid state to consume buffer"),u="")}function p(){u+=a}for(;l{o(b)}:Gt}function o(f){if(Jr(f)){const p=n.get(f);p&&(n.delete(f),s.splice(s.indexOf(p),1),p.children.forEach(o),p.alias.forEach(o))}else{const p=s.indexOf(f);p>-1&&(s.splice(p,1),f.record.name&&n.delete(f.record.name),f.children.forEach(o),f.alias.forEach(o))}}function l(){return s}function a(f){const p=mc(f,s);s.splice(p,0,f),f.record.name&&!Si(f)&&n.set(f.record.name,f)}function u(f,p){let g,_={},C,D;if("name"in f&&f.name){if(g=n.get(f.name),!g)throw Ft(1,{location:f});D=g.record.name,_=J(wi(p.params,g.keys.filter(b=>!b.optional).concat(g.parent?g.parent.keys.filter(b=>b.optional):[]).map(b=>b.name)),f.params&&wi(f.params,g.keys.map(b=>b.name))),C=g.stringify(_)}else if(f.path!=null)C=f.path,g=s.find(b=>b.re.test(C)),g&&(_=g.parse(C),D=g.record.name);else{if(g=p.name?n.get(p.name):s.find(b=>b.re.test(p.path)),!g)throw Ft(1,{location:f,currentLocation:p});D=g.record.name,_=J({},p.params,f.params),C=g.stringify(_)}const T=[];let m=g;for(;m;)T.unshift(m.record),m=m.parent;return{name:D,path:C,params:_,matched:T,meta:gc(T)}}t.forEach(f=>r(f));function c(){s.length=0,n.clear()}return{addRoute:r,resolve:u,removeRoute:o,clearRoutes:c,getRoutes:l,getRecordMatcher:i}}function wi(t,e){const s={};for(const n of e)n in t&&(s[n]=t[n]);return s}function xi(t){const e={path:t.path,redirect:t.redirect,name:t.name,meta:t.meta||{},aliasOf:t.aliasOf,beforeEnter:t.beforeEnter,props:pc(t),children:t.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in t?t.components||null:t.component&&{default:t.component}};return Object.defineProperty(e,"mods",{value:{}}),e}function pc(t){const e={},s=t.props||!1;if("component"in t)e.default=s;else for(const n in t.components)e[n]=typeof s=="object"?s[n]:s;return e}function Si(t){for(;t;){if(t.record.aliasOf)return!0;t=t.parent}return!1}function gc(t){return t.reduce((e,s)=>J(e,s.meta),{})}function Ei(t,e){const s={};for(const n in t)s[n]=n in e?e[n]:t[n];return s}function mc(t,e){let s=0,n=e.length;for(;s!==n;){const r=s+n>>1;Xr(t,e[r])<0?n=r:s=r+1}const i=vc(t);return i&&(n=e.lastIndexOf(i,n-1)),n}function vc(t){let e=t;for(;e=e.parent;)if(el(e)&&Xr(t,e)===0)return e}function el({record:t}){return!!(t.name||t.components&&Object.keys(t.components).length||t.redirect)}function bc(t){const e={};if(t===""||t==="?")return e;const n=(t[0]==="?"?t.slice(1):t).split("&");for(let i=0;ir&&cn(r)):[n&&cn(n)]).forEach(r=>{r!==void 0&&(e+=(e.length?"&":"")+s,r!=null&&(e+="="+r))})}return e}function yc(t){const e={};for(const s in t){const n=t[s];n!==void 0&&(e[s]=He(n)?n.map(i=>i==null?null:""+i):n==null?n:""+n)}return e}const Ac=Symbol(""),_i=Symbol(""),kn=Symbol(""),tl=Symbol(""),fn=Symbol("");function Bt(){let t=[];function e(n){return t.push(n),()=>{const i=t.indexOf(n);i>-1&&t.splice(i,1)}}function s(){t=[]}return{add:e,list:()=>t.slice(),reset:s}}function dt(t,e,s,n,i,r=o=>o()){const o=n&&(n.enterCallbacks[i]=n.enterCallbacks[i]||[]);return()=>new Promise((l,a)=>{const u=p=>{p===!1?a(Ft(4,{from:s,to:e})):p instanceof Error?a(p):ic(p)?a(Ft(2,{from:e,to:p})):(o&&n.enterCallbacks[i]===o&&typeof p=="function"&&o.push(p),l())},c=r(()=>t.call(n&&n.instances[i],e,s,u));let f=Promise.resolve(c);t.length<3&&(f=f.then(u)),f.catch(p=>a(p))})}function Gs(t,e,s,n,i=r=>r()){const r=[];for(const o of t)for(const l in o.components){let a=o.components[l];if(!(e!=="beforeRouteEnter"&&!o.instances[l]))if(jr(a)){const c=(a.__vccOpts||a)[e];c&&r.push(dt(c,s,n,o,l,i))}else{let u=a();r.push(()=>u.then(c=>{if(!c)throw new Error(`Couldn't resolve component "${l}" at "${o.path}"`);const f=Oa(c)?c.default:c;o.mods[l]=c,o.components[l]=f;const g=(f.__vccOpts||f)[e];return g&&dt(g,s,n,o,l,i)()}))}}return r}function Oi(t){const e=tt(kn),s=tt(tl),n=Ne(()=>{const a=wt(t.to);return e.resolve(a)}),i=Ne(()=>{const{matched:a}=n.value,{length:u}=a,c=a[u-1],f=s.matched;if(!c||!f.length)return-1;const p=f.findIndex(kt.bind(null,c));if(p>-1)return p;const g=Li(a[u-2]);return u>1&&Li(c)===g&&f[f.length-1].path!==g?f.findIndex(kt.bind(null,a[u-2])):p}),r=Ne(()=>i.value>-1&&Cc(s.params,n.value.params)),o=Ne(()=>i.value>-1&&i.value===s.matched.length-1&&Yr(s.params,n.value.params));function l(a={}){if(Ec(a)){const u=e[wt(t.replace)?"replace":"push"](wt(t.to)).catch(Gt);return t.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>u),u}return Promise.resolve()}return{route:n,href:Ne(()=>n.value.href),isActive:r,isExactActive:o,navigate:l}}function wc(t){return t.length===1?t[0]:t}const xc=Ts({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"},viewTransition:Boolean},useLink:Oi,setup(t,{slots:e}){const s=Os(Oi(t)),{options:n}=tt(kn),i=Ne(()=>({[Ti(t.activeClass,n.linkActiveClass,"router-link-active")]:s.isActive,[Ti(t.exactActiveClass,n.linkExactActiveClass,"router-link-exact-active")]:s.isExactActive}));return()=>{const r=e.default&&wc(e.default(s));return t.custom?r:Ur("a",{"aria-current":s.isExactActive?t.ariaCurrentValue:null,href:s.href,onClick:s.navigate,class:i.value},r)}}}),Sc=xc;function Ec(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&!(t.button!==void 0&&t.button!==0)){if(t.currentTarget&&t.currentTarget.getAttribute){const e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function Cc(t,e){for(const s in e){const n=e[s],i=t[s];if(typeof n=="string"){if(n!==i)return!1}else if(!He(i)||i.length!==n.length||n.some((r,o)=>r!==i[o]))return!1}return!0}function Li(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const Ti=(t,e,s)=>t??e??s,_c=Ts({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(t,{attrs:e,slots:s}){const n=tt(fn),i=Ne(()=>t.route||n.value),r=tt(_i,0),o=Ne(()=>{let u=wt(r);const{matched:c}=i.value;let f;for(;(f=c[u])&&!f.components;)u++;return u}),l=Ne(()=>i.value.matched[o.value]);cs(_i,Ne(()=>o.value+1)),cs(Ac,l),cs(fn,i);const a=ir();return us(()=>[a.value,l.value,t.name],([u,c,f],[p,g,_])=>{c&&(c.instances[f]=u,g&&g!==c&&u&&u===p&&(c.leaveGuards.size||(c.leaveGuards=g.leaveGuards),c.updateGuards.size||(c.updateGuards=g.updateGuards))),u&&c&&(!g||!kt(c,g)||!p)&&(c.enterCallbacks[f]||[]).forEach(C=>C(u))},{flush:"post"}),()=>{const u=i.value,c=t.name,f=l.value,p=f&&f.components[c];if(!p)return Pi(s.default,{Component:p,route:u});const g=f.props[c],_=g?g===!0?u.params:typeof g=="function"?g(u):g:null,D=Ur(p,J({},_,e,{onVnodeUnmounted:T=>{T.component.isUnmounted&&(f.instances[c]=null)},ref:a}));return Pi(s.default,{Component:D,route:u})||D}}});function Pi(t,e){if(!t)return null;const s=t(e);return s.length===1?s[0]:s}const Oc=_c;function Lc(t){const e=dc(t.routes,t),s=t.parseQuery||bc,n=t.stringifyQuery||Ci,i=t.history,r=Bt(),o=Bt(),l=Bt(),a=Ml(ut);let u=ut;Ct&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=zs.bind(null,A=>""+A),f=zs.bind(null,Va),p=zs.bind(null,ss);function g(A,N){let k,B;return Jr(A)?(k=e.getRecordMatcher(A),B=N):B=A,e.addRoute(B,k)}function _(A){const N=e.getRecordMatcher(A);N&&e.removeRoute(N)}function C(){return e.getRoutes().map(A=>A.record)}function D(A){return!!e.getRecordMatcher(A)}function T(A,N){if(N=J({},N||a.value),typeof A=="string"){const v=Ws(s,A,N.path),w=e.resolve({path:v.path},N),E=i.createHref(v.fullPath);return J(v,w,{params:p(w.params),hash:ss(v.hash),redirectedFrom:void 0,href:E})}let k;if(A.path!=null)k=J({},A,{path:Ws(s,A.path,N.path).path});else{const v=J({},A.params);for(const w in v)v[w]==null&&delete v[w];k=J({},A,{params:f(v)}),N.params=f(N.params)}const B=e.resolve(k,N),Y=A.hash||"";B.params=c(p(B.params));const h=ja(n,J({},A,{hash:Na(Y),path:B.path})),d=i.createHref(h);return J({fullPath:h,hash:Y,query:n===Ci?yc(A.query):A.query||{}},B,{redirectedFrom:void 0,href:d})}function m(A){return typeof A=="string"?Ws(s,A,a.value.path):J({},A)}function b(A,N){if(u!==A)return Ft(8,{from:N,to:A})}function y(A){return F(A)}function S(A){return y(J(m(A),{replace:!0}))}function O(A){const N=A.matched[A.matched.length-1];if(N&&N.redirect){const{redirect:k}=N;let B=typeof k=="function"?k(A):k;return typeof B=="string"&&(B=B.includes("?")||B.includes("#")?B=m(B):{path:B},B.params={}),J({query:A.query,hash:A.hash,params:B.path!=null?{}:A.params},B)}}function F(A,N){const k=u=T(A),B=a.value,Y=A.state,h=A.force,d=A.replace===!0,v=O(k);if(v)return F(J(m(v),{state:typeof v=="object"?J({},Y,v.state):Y,force:h,replace:d}),N||k);const w=k;w.redirectedFrom=N;let E;return!h&&za(n,B,k)&&(E=Ft(16,{to:w,from:B}),Ae(B,B,!0,!1)),(E?Promise.resolve(E):K(w,B)).catch(x=>Je(x)?Je(x,2)?x:ye(x):$(x,w,B)).then(x=>{if(x){if(Je(x,2))return F(J({replace:d},m(x.to),{state:typeof x.to=="object"?J({},Y,x.to.state):Y,force:h}),N||w)}else x=pe(w,B,!0,d,Y);return re(w,B,x),x})}function W(A,N){const k=b(A,N);return k?Promise.reject(k):Promise.resolve()}function H(A){const N=we.values().next().value;return N&&typeof N.runWithContext=="function"?N.runWithContext(A):A()}function K(A,N){let k;const[B,Y,h]=Tc(A,N);k=Gs(B.reverse(),"beforeRouteLeave",A,N);for(const v of B)v.leaveGuards.forEach(w=>{k.push(dt(w,A,N))});const d=W.bind(null,A,N);return k.push(d),fe(k).then(()=>{k=[];for(const v of r.list())k.push(dt(v,A,N));return k.push(d),fe(k)}).then(()=>{k=Gs(Y,"beforeRouteUpdate",A,N);for(const v of Y)v.updateGuards.forEach(w=>{k.push(dt(w,A,N))});return k.push(d),fe(k)}).then(()=>{k=[];for(const v of h)if(v.beforeEnter)if(He(v.beforeEnter))for(const w of v.beforeEnter)k.push(dt(w,A,N));else k.push(dt(v.beforeEnter,A,N));return k.push(d),fe(k)}).then(()=>(A.matched.forEach(v=>v.enterCallbacks={}),k=Gs(h,"beforeRouteEnter",A,N,H),k.push(d),fe(k))).then(()=>{k=[];for(const v of o.list())k.push(dt(v,A,N));return k.push(d),fe(k)}).catch(v=>Je(v,8)?v:Promise.reject(v))}function re(A,N,k){l.list().forEach(B=>H(()=>B(A,N,k)))}function pe(A,N,k,B,Y){const h=b(A,N);if(h)return h;const d=N===ut,v=Ct?history.state:{};k&&(B||d?i.replace(A.fullPath,J({scroll:d&&v&&v.scroll},Y)):i.push(A.fullPath,Y)),a.value=A,Ae(A,N,k,d),ye()}let Le;function ot(){Le||(Le=i.listen((A,N,k)=>{if(!Ve.listening)return;const B=T(A),Y=O(B);if(Y){F(J(Y,{replace:!0,force:!0}),B).catch(Gt);return}u=B;const h=a.value;Ct&&Za(mi(h.fullPath,k.delta),ks()),K(B,h).catch(d=>Je(d,12)?d:Je(d,2)?(F(J(m(d.to),{force:!0}),B).then(v=>{Je(v,20)&&!k.delta&&k.type===ns.pop&&i.go(-1,!1)}).catch(Gt),Promise.reject()):(k.delta&&i.go(-k.delta,!1),$(d,B,h))).then(d=>{d=d||pe(B,h,!1),d&&(k.delta&&!Je(d,8)?i.go(-k.delta,!1):k.type===ns.pop&&Je(d,20)&&i.go(-1,!1)),re(B,h,d)}).catch(Gt)}))}let at=Bt(),oe=Bt(),Q;function $(A,N,k){ye(A);const B=oe.list();return B.length?B.forEach(Y=>Y(A,N,k)):console.error(A),Promise.reject(A)}function ae(){return Q&&a.value!==ut?Promise.resolve():new Promise((A,N)=>{at.add([A,N])})}function ye(A){return Q||(Q=!A,ot(),at.list().forEach(([N,k])=>A?k(A):N()),at.reset()),A}function Ae(A,N,k,B){const{scrollBehavior:Y}=t;if(!Ct||!Y)return Promise.resolve();const h=!k&&Xa(mi(A.fullPath,0))||(B||!k)&&history.state&&history.state.scroll||null;return ar().then(()=>Y(A,N,h)).then(d=>d&&Ja(d)).catch(d=>$(d,A,N))}const te=A=>i.go(A);let ct;const we=new Set,Ve={currentRoute:a,listening:!0,addRoute:g,removeRoute:_,clearRoutes:e.clearRoutes,hasRoute:D,getRoutes:C,resolve:T,options:t,push:y,replace:S,go:te,back:()=>te(-1),forward:()=>te(1),beforeEach:r.add,beforeResolve:o.add,afterEach:l.add,onError:oe.add,isReady:ae,install(A){const N=this;A.component("RouterLink",Sc),A.component("RouterView",Oc),A.config.globalProperties.$router=N,Object.defineProperty(A.config.globalProperties,"$route",{enumerable:!0,get:()=>wt(a)}),Ct&&!ct&&a.value===ut&&(ct=!0,y(i.location).catch(Y=>{}));const k={};for(const Y in ut)Object.defineProperty(k,Y,{get:()=>a.value[Y],enumerable:!0});A.provide(kn,N),A.provide(tl,sr(k)),A.provide(fn,a);const B=A.unmount;we.add(A),A.unmount=function(){we.delete(A),we.size<1&&(u=ut,Le&&Le(),Le=null,a.value=ut,ct=!1,Q=!1),B()}}};function fe(A){return A.reduce((N,k)=>N.then(()=>H(k)),Promise.resolve())}return Ve}function Tc(t,e){const s=[],n=[],i=[],r=Math.max(e.matched.length,t.matched.length);for(let o=0;okt(u,l))?n.push(l):s.push(l));const a=t.matched[o];a&&(e.matched.find(u=>kt(u,a))||i.push(a))}return[s,n,i]}const Pc=Lc({history:nc(),linkActiveClass:"active",routes:[{path:"/",name:"Home",component:()=>Qe(()=>import("./home.js"),__vite__mapDeps([0,1]))},{path:"/install",name:"Install",component:()=>Qe(()=>import("./install.js"),[])},{path:"/selects",name:"Selects",component:()=>Qe(()=>import("./selects.js"),[])},{path:"/data",name:"Data",component:()=>Qe(()=>import("./data.js"),[])},{path:"/examples",name:"Examples",component:()=>Qe(()=>import("./index2.js"),__vite__mapDeps([2,3]))},{path:"/settings",name:"Settings",component:()=>Qe(()=>import("./index3.js"),__vite__mapDeps([4,5]))},{path:"/events",name:"Events",component:()=>Qe(()=>import("./index4.js"),[])},{path:"/methods",name:"Methods",component:()=>Qe(()=>import("./index5.js"),[])},{path:"/vue",name:"Vue",component:()=>Qe(()=>import("./vue.js"),[])}]});class Rc{constructor(e){e||(e={}),this.main=e.main||"ss-main",this.placeholder=e.placeholder||"ss-placeholder",this.values=e.values||"ss-values",this.single=e.single||"ss-single",this.max=e.max||"ss-max",this.value=e.value||"ss-value",this.valueText=e.valueText||"ss-value-text",this.valueDelete=e.valueDelete||"ss-value-delete",this.valueOut=e.valueOut||"ss-value-out",this.deselect=e.deselect||"ss-deselect",this.deselectPath=e.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=e.arrow||"ss-arrow",this.arrowClose=e.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=e.arrowOpen||"M10,70 L50,30 L90,70",this.content=e.content||"ss-content",this.openAbove=e.openAbove||"ss-open-above",this.openBelow=e.openBelow||"ss-open-below",this.search=e.search||"ss-search",this.searchHighlighter=e.searchHighlighter||"ss-search-highlight",this.searching=e.searching||"ss-searching",this.addable=e.addable||"ss-addable",this.addablePath=e.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=e.list||"ss-list",this.optgroup=e.optgroup||"ss-optgroup",this.optgroupLabel=e.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=e.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=e.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=e.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=e.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=e.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=e.optgroupClosable||"ss-closable",this.option=e.option||"ss-option",this.optionDelete=e.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=e.highlighted||"ss-highlighted",this.open=e.open||"ss-open",this.close=e.close||"ss-close",this.selected=e.selected||"ss-selected",this.error=e.error||"ss-error",this.disabled=e.disabled||"ss-disabled",this.hide=e.hide||"ss-hide"}}function Fn(){return Math.random().toString(36).substring(2,10)}function Dc(t,e){function s(i,r){return r&&i&&i.classList&&i.classList.contains(r)||r&&i&&i.dataset&&i.dataset.id&&i.dataset.id===e?i:null}function n(i,r){return!i||i===document?null:s(i,r)?i:n(i.parentNode,r)}return s(t,e)||n(t,e)}function Kt(t,e=50,s=!1){let n;return function(...i){const r=self,o=()=>{n=null,s||t.apply(r,i)},l=s&&!n;clearTimeout(n),n=setTimeout(o,e),l&&t.apply(r,i)}}function qs(t,e){return JSON.stringify(t)===JSON.stringify(e)}function kc(t){const e=t.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,s=>"-"+s.toLowerCase());return t[0]===t[0].toUpperCase()?e.substring(1):e}class Me{constructor(e){if(this.id=!e.id||e.id===""?Fn():e.id,this.label=e.label||"",this.selectAll=e.selectAll===void 0?!1:e.selectAll,this.selectAllText=e.selectAllText||"Select All",this.closable=e.closable||"off",this.options=[],e.options)for(const s of e.options)this.options.push(new ue(s))}}class ue{constructor(e){this.id=!e.id||e.id===""?Fn():e.id,this.value=e.value===void 0?e.text:e.value,this.text=e.text||"",this.html=e.html||"",this.defaultSelected=e.defaultSelected!==void 0?e.defaultSelected:!1,this.selected=e.selected!==void 0?e.selected:!1,this.display=e.display!==void 0?e.display:!0,this.disabled=e.disabled!==void 0?e.disabled:!1,this.mandatory=e.mandatory!==void 0?e.mandatory:!1,this.placeholder=e.placeholder!==void 0?e.placeholder:!1,this.class=e.class||"",this.style=e.style||"",this.data=e.data||{}}}class Fc{constructor(e,s){this.selectType="single",this.data=[],this.selectedOrder=[],this.selectType=e,this.setData(s)}validateDataArray(e){if(!Array.isArray(e))return new Error("Data must be an array");for(let s of e)if(s instanceof Me||"label"in s){if(!("label"in s))return new Error("Optgroup must have a label");if("options"in s&&s.options)for(let n of s.options){const i=this.validateOption(n);if(i)return i}}else if(s instanceof ue||"text"in s){const n=this.validateOption(s);if(n)return n}else return new Error("Data object must be a valid optgroup or option");return null}validateOption(e){return"text"in e?null:new Error("Option must have a text")}partialToFullData(e){let s=[];return e.forEach(n=>{if(n instanceof Me||"label"in n){let i=[];"options"in n&&n.options&&n.options.forEach(r=>{i.push(new ue(r))}),i.length>0&&s.push(new Me(n))}(n instanceof ue||"text"in n)&&s.push(new ue(n))}),s}setData(e){this.data=this.partialToFullData(e),this.selectType==="single"&&this.setSelectedBy("id",this.getSelected())}getData(){return this.filter(null,!0)}getDataOptions(){return this.filter(null,!1)}addOption(e,s=!1){if(s){let n=[new ue(e)];this.setData(n.concat(this.getData()))}else this.setData(this.getData().concat(new ue(e)))}setSelectedBy(e,s){let n=null,i=!1;const r=[];for(let l of this.data){if(l instanceof Me)for(let a of l.options)n||(n=a),a.selected=i?!1:s.includes(a[e]),a.selected&&(r.push(a),this.selectType==="single"&&(i=!0));l instanceof ue&&(n||(n=l),l.selected=i?!1:s.includes(l[e]),l.selected&&(r.push(l),this.selectType==="single"&&(i=!0)))}this.selectType==="single"&&n&&!i&&(n.selected=!0,r.push(n));const o=s.map(l=>{var a;return((a=r.find(u=>u[e]===l))==null?void 0:a.id)||""});this.selectedOrder=o}getSelected(){return this.getSelectedOptions().map(e=>e.id)}getSelectedValues(){return this.getSelectedOptions().map(e=>e.value)}getSelectedOptions(){return this.filter(e=>e.selected,!1)}getOptgroupByID(e){for(let s of this.data)if(s instanceof Me&&s.id===e)return s;return null}getOptionByID(e){let s=this.filter(n=>n.id===e,!1);return s.length?s[0]:null}getSelectType(){return this.selectType}getFirstOption(){let e=null;for(let s of this.data)if(s instanceof Me?e=s.options[0]:s instanceof ue&&(e=s),e)break;return e}search(e,s){return e=e.trim(),e===""?this.getData():this.filter(n=>s(n,e),!0)}filter(e,s){const n=[];return this.data.forEach(i=>{if(i instanceof Me){let r=[];if(i.options.forEach(o=>{(!e||e(o))&&(s?r.push(new ue(o)):n.push(new ue(o)))}),r.length>0){let o=new Me(i);o.options=r,n.push(o)}}i instanceof ue&&(!e||e(i))&&n.push(new ue(i))}),n}selectedOrderOptions(e){const s=[];return this.selectedOrder.forEach(n=>{const i=e.find(r=>r.id===n);i&&s.push(i)}),e.forEach(n=>{let i=!1;s.forEach(r=>{if(n.id===r.id){i=!0;return}}),i||s.push(n)}),s}}const ke=class ke{static getLiveAssertive(){let e=document.getElementById("ss-live-assertive");return e||(e=document.createElement("div"),e.id="ss-live-assertive",e.setAttribute("role","status"),e.setAttribute("aria-live","assertive"),e.setAttribute("aria-atomic","true"),e.className="ss-sr-only",document.body.appendChild(e)),e}_announceAssertive(e){const s=ke._liveAssertive||(ke._liveAssertive=ke.getLiveAssertive());s.textContent="",requestAnimationFrame(()=>{s.textContent=e})}constructor(e,s,n,i){var o;this.store=n,this.settings=e,this.classes=s,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes();const r=(o=document.querySelector(`[data-id="${this.settings.id}"]`))==null?void 0:o.closest(".offcanvas-body");r?r.appendChild(this.content.main):this.settings.contentLocation&&this.settings.contentLocation.appendChild(this.content.main)}static getLivePolite(){let e=document.getElementById("ss-live-polite");return e||(e=document.createElement("div"),e.id="ss-live-polite",e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),e.className="ss-sr-only",document.body.appendChild(e)),e}_announcePolite(e){const s=ke._livePolite||(ke._livePolite=ke.getLivePolite());s.textContent="",requestAnimationFrame(()=>{s.textContent=e})}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 e=this.store.getSelectedOptions();if(e.length){const s=e[e.length-1].id,n=this.content.list.querySelector('[data-id="'+s+'"]');n&&this.ensureElementInView(this.content.list,n)}this.settings.contentPosition==="fixed"&&(this.moveContent(),this.scrollHandler=()=>this.moveContent(),this.resizeHandler=()=>this.moveContent(),window.addEventListener("scroll",this.scrollHandler,!0),window.addEventListener("resize",this.resizeHandler)),this.searchFocus()}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),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=void 0),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=void 0),this.main.main.focus({preventScroll:!0}),this.main.main.removeAttribute("aria-activedescendant")}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.main.main.classList.add("ss-2"),this.content.main.classList.add(this.classes.content),this.content.main.classList.add("ss-content-2"),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()));(this.settings.contentPosition==="relative"||this.settings.contentPosition==="fixed")&&this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){this.content.list.setAttribute("role","listbox"),this.content.list.setAttribute("id",this.content.main.id+"-list"),this.content.list.setAttribute("aria-label",this.settings.contentAriaLabel),this.settings.isMultiple?this.content.list.setAttribute("aria-multiselectable","true"):this.content.list.removeAttribute("aria-multiselectable"),this.main.main.setAttribute("role","combobox"),this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.list.id),this.main.main.setAttribute("aria-expanded","false"),this.main.main.setAttribute("aria-autocomplete","list"),this.settings.ariaLabelledBy&&this.settings.ariaLabelledBy.trim()?(this.main.main.setAttribute("aria-labelledby",this.settings.ariaLabelledBy),this.main.main.removeAttribute("aria-label")):this.settings.ariaLabel&&this.settings.ariaLabel.trim()&&this.main.main.setAttribute("aria-label",this.settings.ariaLabel),this.main.main.setAttribute("aria-owns",this.content.list.id),this.content.search.input.setAttribute("aria-controls",this.content.list.id),this.content.search.input.setAttribute("aria-autocomplete","list")}mainDiv(){var u;const e=document.createElement("div");e.id=this.settings.id+"-main",e.tabIndex=0,e.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 f=this.content.list.querySelector("."+this.classes.highlighted);return f&&f.click(),!1;case"Escape":return this.callbacks.close(),!1}return c.key.length===1&&this.callbacks.open(),!0},e.onclick=c=>{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 n=document.createElement("div");n.classList.add(this.classes.deselect),n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label",this.settings.clearAllAriaLabel),n.addEventListener("keydown",c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),n.click())});const i=(u=this.store)==null?void 0:u.getSelectedOptions();!this.settings.allowDeselect||this.settings.isMultiple&&i&&i.length<=0?n.classList.add(this.classes.hide):n.classList.remove(this.classes.hide),n.onclick=c=>{if(c.stopPropagation(),this.settings.disabled)return;let f=!0;const p=this.store.getSelectedOptions(),g=[];if(this.callbacks.beforeChange&&(f=this.callbacks.beforeChange(g,p)===!0),f){if(this.settings.isMultiple)this.callbacks.setSelected([],!1),this.updateDeselectAll();else{const _=this.store.getFirstOption(),C=_?_.id:"";this.callbacks.setSelected(C,!1)}this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(this.store.getSelectedOptions())}};const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("viewBox","0 0 100 100"),r.setAttribute("aria-hidden","true"),r.setAttribute("focusable","false");const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.deselectPath),r.appendChild(o),n.appendChild(r),e.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.classList.add(this.classes.arrow),l.setAttribute("viewBox","0 0 100 100"),l.setAttribute("aria-hidden","true"),l.setAttribute("focusable","false");const a=document.createElementNS("http://www.w3.org/2000/svg","path");return a.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&l.classList.add(this.classes.hide),l.appendChild(a),e.appendChild(l),{main:e,values:s,deselect:{main:n,svg:r,path:o},arrow:{main:l,path:a}}}mainFocus(e){e!=="click"&&this.main.main.focus({preventScroll:!0})}placeholder(){const e=this.store.filter(i=>i.placeholder,!1);let s=this.settings.placeholderText;e.length&&(e[0].html!==""?s=e[0].html:e[0].text!==""&&(s=e[0].text));const n=document.createElement("div");return n.classList.add(this.classes.placeholder),n.innerHTML=s,n}renderValues(){if(!this.settings.isMultiple){this.renderSingleValue();return}this.renderMultipleValues(),this.updateDeselectAll()}renderSingleValue(){const e=this.store.filter(n=>n.selected&&!n.placeholder,!1),s=e.length>0?e[0]:null;if(!s)this.main.values.innerHTML=this.placeholder().outerHTML;else{const n=document.createElement("div");n.classList.add(this.classes.single),s.html?n.innerHTML=s.html:n.innerText=s.text,this.main.values.innerHTML=n.outerHTML}!this.settings.allowDeselect||!e.length?this.main.deselect.main.classList.add(this.classes.hide):this.main.deselect.main.classList.remove(this.classes.hide)}renderMultipleValues(){let e=this.main.values.childNodes,s=this.store.filter(i=>i.selected&&i.display,!1);if(s.length===0){this.main.values.innerHTML=this.placeholder().outerHTML;return}else{const i=this.main.values.querySelector("."+this.classes.placeholder);i&&i.remove()}if(s.length>this.settings.maxValuesShown){const i=document.createElement("div");i.classList.add(this.classes.max),i.textContent=this.settings.maxValuesMessage.replace("{number}",s.length.toString()),this.main.values.innerHTML=i.outerHTML;return}else{const i=this.main.values.querySelector("."+this.classes.max);i&&i.remove()}this.settings.keepOrder&&(s=this.store.selectedOrderOptions(s));let n=[];for(let i=0;ia.id===o,!1).length||n.push(r))}for(const i of n)i.classList.add(this.classes.valueOut),setTimeout(()=>{this.main.values.hasChildNodes()&&this.main.values.contains(i)&&this.main.values.removeChild(i)},100);e=this.main.values.childNodes;for(let i=0;i{if(l.preventDefault(),l.stopPropagation(),this.settings.disabled)return;let a=!0;const u=this.store.getSelectedOptions(),c=u.filter(f=>f.selected&&f.id!==e.id,!0);if(!(this.settings.minSelected&&c.length{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),i.click())}}return s}contentDiv(){const e=document.createElement("div");e.id=this.settings.id+"-content";const s=this.searchDiv();e.appendChild(s.main);const n=this.listDiv();return e.appendChild(n),{main:e,search:s,list:n}}moveContent(){if(this.settings.contentPosition==="relative"){this.moveContentBelow();return}if(this.settings.openPosition==="down"){this.moveContentBelow();return}else if(this.settings.openPosition==="up"){this.moveContentAbove();return}this.putContent()==="up"?this.moveContentAbove():this.moveContentBelow()}searchDiv(){const e=document.createElement("div"),s=document.createElement("input"),n=document.createElement("div");e.classList.add(this.classes.search);const i={main:e,input:s};if(this.settings.showSearch||(e.classList.add(this.classes.hide),s.readOnly=!0),s.type="search",s.placeholder=this.settings.searchPlaceholder,s.tabIndex=-1,this.settings.searchLabelledBy&&this.settings.searchLabelledBy.trim()?s.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel&&this.settings.searchAriaLabel.trim()?s.setAttribute("aria-label",this.settings.searchAriaLabel):s.setAttribute("aria-label","Search options"),s.setAttribute("autocapitalize","off"),s.setAttribute("autocomplete","off"),s.setAttribute("autocorrect","off"),s.oninput=Kt(r=>{this.callbacks.search(r.target.value)},100),s.onkeydown=r=>{switch(r.key){case"ArrowUp":case"ArrowDown":return r.key==="ArrowDown"?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Escape":return this.callbacks.close(),!1;case" ":const o=this.content.list.querySelector("."+this.classes.highlighted);return o?(o.click(),!1):!0;case"Enter":if(this.callbacks.addable)return n.click(),!1;{const l=this.content.list.querySelector("."+this.classes.highlighted);if(l)return l.click(),!1}return!0}return!0},e.appendChild(s),this.callbacks.addable){n.classList.add(this.classes.addable);const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("viewBox","0 0 100 100"),r.setAttribute("aria-hidden","true"),r.setAttribute("focusable","false");const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.addablePath),r.appendChild(o),n.appendChild(r),n.onclick=l=>{if(l.preventDefault(),l.stopPropagation(),!this.callbacks.addable)return;const a=this.content.search.input.value.trim();if(a===""){this.content.search.input.focus();return}const u=f=>{let p=new ue(f);if(this.callbacks.addOption(p),this.settings.isMultiple){let g=this.store.getSelected();g.push(p.id),this.callbacks.setSelected(g,!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(f=>{typeof f=="string"?u({text:f,value:f}):c instanceof Error?this.renderError(c.message):u(f)}):typeof c=="string"?u({text:c,value:c}):c instanceof Error?this.renderError(c.message):u(c))},e.appendChild(n),i.addable={main:n,svg:r,path:o}}return i}searchFocus(){this.content.search.input.focus()}getOptions(e=!1,s=!1,n=!1){let i="."+this.classes.option;return e&&(i+=":not(."+this.classes.placeholder+")"),s&&(i+=":not(."+this.classes.disabled+")"),n&&(i+=":not(."+this.classes.hide+")"),Array.from(this.content.list.querySelectorAll(i))}highlight(e){const s=this.getOptions(!0,!0,!0);if(s.length===0)return;if(s.length===1&&!s[0].classList.contains(this.classes.highlighted)){s[0].classList.add(this.classes.highlighted);return}let n=!1;for(const r of s)r.classList.contains(this.classes.highlighted)&&(n=!0);if(!n){for(const r of s)if(r.classList.contains(this.classes.selected)){r.classList.add(this.classes.highlighted);break}}for(let r=0;r=0?r-1:s.length-1];a.classList.add(this.classes.highlighted),this.main.main.setAttribute("aria-activedescendant",a.id),this.ensureElementInView(this.content.list,a);const u=a.parentElement;if(u&&u.classList.contains(this.classes.close)){const c=u.querySelector("."+this.classes.optgroupLabel);c&&c.click()}return}const i=s[e==="down"?0:s.length-1];i.classList.add(this.classes.highlighted),this.main.main.setAttribute("aria-activedescendant",i.id),this.ensureElementInView(this.content.list,i)}listDiv(){const e=document.createElement("div");return e.classList.add(this.classes.list),e}renderError(e){this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy");const s=document.createElement("div");s.classList.add(this.classes.error),s.textContent=e,this.content.list.appendChild(s),this._announceAssertive(e)}renderSearching(){this.content.list.innerHTML="",this.content.list.setAttribute("aria-busy","true");const e=document.createElement("div");e.classList.add(this.classes.searching),e.textContent=this.settings.searchingText,this.content.list.appendChild(e),this._announcePolite(this.settings.searchingText)}renderOptions(e){if(this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy"),e.length===0){const l=document.createElement("div");l.classList.add(this.classes.search);const a=this.callbacks.addable?this.settings.addableText.replace("{value}",this.content.search.input.value):this.settings.searchText;this._announcePolite(a),l.innerHTML=a,this.content.list.appendChild(l),this.content.list.setAttribute("aria-setsize","0");return}this.settings.allowDeselect&&!this.settings.isMultiple&&(this.store.filter(a=>a.placeholder,!1).length||this.store.addOption(new ue({text:"",value:"",selected:!1,placeholder:!0}),!0));const s=document.createDocumentFragment();let n=0;const i=e.filter(l=>l instanceof ue&&!l.placeholder&&l.display&&!l.disabled).length,r=l=>{!l.classList.contains(this.classes.placeholder)&&!l.classList.contains(this.classes.disabled)&&!l.classList.contains(this.classes.hide)&&(l.setAttribute("aria-posinset",String(++n)),l.setAttribute("aria-setsize",String(i)))};for(const l of e){if(l instanceof Me){const a=document.createElement("div");a.classList.add(this.classes.optgroup),a.setAttribute("role","group"),a.setAttribute("aria-label",l.label);const u=document.createElement("div");u.classList.add(this.classes.optgroupLabel),a.appendChild(u);const c=document.createElement("div");c.classList.add(this.classes.optgroupLabelText),c.textContent=l.label,u.appendChild(c);const f=document.createElement("div");if(f.classList.add(this.classes.optgroupActions),u.appendChild(f),this.settings.isMultiple&&l.selectAll){const p=document.createElement("div");p.classList.add(this.classes.optgroupSelectAll);let g=!0;for(const m of l.options)if(!m.selected){g=!1;break}g&&p.classList.add(this.classes.selected);const _=document.createElement("span");_.textContent=l.selectAllText,p.appendChild(_);const C=document.createElementNS("http://www.w3.org/2000/svg","svg");C.setAttribute("viewBox","0 0 100 100"),C.setAttribute("aria-hidden","true"),C.setAttribute("focusable","false"),p.appendChild(C);const D=document.createElementNS("http://www.w3.org/2000/svg","path");D.setAttribute("d",this.classes.optgroupSelectAllBox),C.appendChild(D);const T=document.createElementNS("http://www.w3.org/2000/svg","path");T.setAttribute("d",this.classes.optgroupSelectAllCheck),C.appendChild(T),p.addEventListener("click",m=>{m.preventDefault(),m.stopPropagation();const b=this.store.getSelected();if(g){const y=b.filter(S=>{for(const O of l.options)if(S===O.id)return!1;return!0});this.callbacks.setSelected(y,!0);return}else{const y=b.concat(l.options.map(S=>S.id));for(const S of l.options)this.store.getOptionByID(S.id)||this.callbacks.addOption(S);this.callbacks.setSelected(y,!0);return}}),f.appendChild(p)}if(l.closable!=="off"){const p=document.createElement("div");p.classList.add(this.classes.optgroupClosable);const g=document.createElementNS("http://www.w3.org/2000/svg","svg");g.setAttribute("viewBox","0 0 100 100"),g.classList.add(this.classes.arrow),g.setAttribute("aria-hidden","true"),g.setAttribute("focusable","false"),p.appendChild(g);const _=document.createElementNS("http://www.w3.org/2000/svg","path");g.appendChild(_),l.options.some(C=>C.selected)||this.content.search.input.value.trim()!==""?(a.classList.add(this.classes.open),_.setAttribute("d",this.classes.arrowOpen)):l.closable==="open"?(a.classList.add(this.classes.open),_.setAttribute("d",this.classes.arrowOpen)):l.closable==="close"&&(a.classList.add(this.classes.close),_.setAttribute("d",this.classes.arrowClose)),u.addEventListener("click",C=>{C.preventDefault(),C.stopPropagation(),a.classList.contains(this.classes.close)?(a.classList.remove(this.classes.close),a.classList.add(this.classes.open),_.setAttribute("d",this.classes.arrowOpen)):(a.classList.remove(this.classes.open),a.classList.add(this.classes.close),_.setAttribute("d",this.classes.arrowClose))}),f.appendChild(p)}a.appendChild(u);for(const p of l.options){const g=this.option(p);r(g),a.appendChild(g)}s.appendChild(a)}if(l instanceof ue){const a=this.option(l);r(a),s.appendChild(a)}}this.content.list.appendChild(s),this.content.list.removeAttribute("aria-busy");const o=this.getOptions(!0,!0,!0).length;this._announcePolite(`${o} option${o===1?"":"s"} available`)}option(e){if(e.placeholder){const n=document.createElement("div");return n.classList.add(this.classes.option),n.classList.add(this.classes.hide),n}const s=document.createElement("div");return s.dataset.id=e.id,s.id=`${this.settings.id}__opt__${e.id}`,s.classList.add(this.classes.option),s.setAttribute("role","option"),e.class&&e.class.split(" ").forEach(n=>{s.classList.add(n)}),e.style&&(s.style.cssText=e.style),this.settings.searchHighlight&&this.content.search.input.value.trim()!==""?s.innerHTML=this.highlightText(e.html!==""?e.html:e.text,this.content.search.input.value,this.classes.searchHighlighter):e.html!==""?s.innerHTML=e.html:s.textContent=e.text,this.settings.showOptionTooltips&&s.textContent&&s.setAttribute("title",s.textContent),e.display||s.classList.add(this.classes.hide),e.disabled&&(s.classList.add(this.classes.disabled),s.setAttribute("aria-disabled","true")),e.selected&&this.settings.hideSelected&&s.classList.add(this.classes.hide),e.selected?(s.classList.add(this.classes.selected),s.setAttribute("aria-selected","true"),this.main.main.setAttribute("aria-activedescendant",s.id)):(s.classList.remove(this.classes.selected),s.setAttribute("aria-selected","false")),s.addEventListener("click",n=>{n.preventDefault(),n.stopPropagation();const i=this.store.getSelected(),r=n.currentTarget,o=String(r.dataset.id);if(e.disabled||e.selected&&!this.settings.allowDeselect||this.settings.isMultiple&&this.settings.maxSelected<=i.length&&!e.selected||this.settings.isMultiple&&this.settings.minSelected>=i.length&&e.selected)return;let l=!1;const a=this.store.getSelectedOptions();let u=[];if(this.settings.isMultiple){if(e.selected)u=a.filter(c=>c.id!==o);else if(u=a.concat(e),!this.settings.closeOnSelect)if(n.shiftKey&&this.lastSelectedOption){const c=this.store.getDataOptions();let f=c.findIndex(g=>g.id===this.lastSelectedOption.id),p=c.findIndex(g=>g.id===e.id);if(f>=0&&p>=0){const g=Math.min(f,p),_=Math.max(f,p),C=c.slice(g,_+1);C.length>0&&C.length!a.find(T=>T.id===D.id))))}}else e.selected||(this.lastSelectedOption=e)}this.settings.isMultiple||(e.selected?u=[]:u=[e]),this.callbacks.beforeChange||(l=!0),this.callbacks.beforeChange&&(this.callbacks.beforeChange(u,a)===!1?l=!1:l=!0),l&&(this.store.getOptionByID(o)||this.callbacks.addOption(e),this.callbacks.setSelected(u.map(c=>c.id),!1),this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(u))}),s}destroy(){this.main.main.remove(),this.content.main.remove()}highlightText(e,s,n){let i=e;const r=new RegExp("(?![^<]*>)("+s.trim()+")(?![^<]*>[^<>]*${a}`),i}moveContentAbove(){const e=this.main.main.offsetHeight,s=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 n=this.main.main.getBoundingClientRect();this.content.main.style.margin="-"+(e+s-1)+"px 0px 0px 0px",this.content.main.style.top=n.top+n.height+(this.settings.contentPosition==="fixed"?0:window.scrollY)+"px",this.content.main.style.left=n.left+(this.settings.contentPosition==="fixed"?0:window.scrollX)+"px",this.content.main.style.width=n.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",this.settings.contentPosition!=="relative"&&(this.content.main.style.top=e.top+e.height+(this.settings.contentPosition==="fixed"?0:window.scrollY)+"px",this.content.main.style.left=e.left+(this.settings.contentPosition==="fixed"?0:window.scrollX)+"px",this.content.main.style.width=e.width+"px")}ensureElementInView(e,s){const n=e.scrollTop+e.offsetTop,i=n+e.clientHeight,r=s.offsetTop,o=r+s.clientHeight;ri&&(e.scrollTop+=o-i)}putContent(){const e=this.main.main.offsetHeight,s=this.main.main.getBoundingClientRect(),n=this.content.main.offsetHeight;return window.innerHeight-(s.top+e)<=n&&s.top>n?"up":"down"}updateDeselectAll(){if(!this.store||!this.settings)return;const e=this.store.getSelectedOptions(),s=e&&e.length>0,n=this.settings.isMultiple,i=this.settings.allowDeselect,r=this.main.deselect.main,o=this.classes.hide;i&&!(n&&!s)?r.classList.remove(o):r.classList.add(o)}};ke._livePolite=null,ke._liveAssertive=null;let hn=ke;class Ic{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.getSelectedOptions()),!0}observeCall(e){if(!this.listen)return;let s=!1,n=!1,i=!1;for(const r of e){if(r.target===this.select&&(r.attributeName==="disabled"&&(n=!0),r.attributeName==="class"&&(s=!0),r.type==="childList")){for(const o of r.addedNodes)if(o.nodeName==="OPTION"&&o.value===this.select.value){this.select.dispatchEvent(new Event("change"));break}i=!0}(r.target.nodeName==="OPTGROUP"||r.target.nodeName==="OPTION")&&(i=!0)}s&&this.onClassChange&&this.onClassChange(this.select.className.split(" ")),n&&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 s=this.select.childNodes;for(const n of s)n.nodeName==="OPTGROUP"&&e.push(this.getDataFromOptgroup(n)),n.nodeName==="OPTION"&&e.push(this.getDataFromOption(n));return e}getDataFromOptgroup(e){let s={id:e.id,label:e.label,selectAll:e.dataset?e.dataset.selectall==="true":!1,selectAllText:e.dataset?e.dataset.selectalltext:"Select all",closable:e.dataset?e.dataset.closable:"off",options:[]};const n=e.childNodes;for(const i of n)i.nodeName==="OPTION"&&s.options.push(this.getDataFromOption(i));return s}getDataFromOption(e){return{id:e.id,value:e.value,text:e.text,html:e.dataset&&e.dataset.html?e.dataset.html:"",defaultSelected:e.defaultSelected,selected:e.selected,display:e.style.display!=="none",disabled:e.disabled,mandatory:e.dataset?e.dataset.mandatory==="true":!1,placeholder:e.dataset.placeholder==="true",class:e.className,style:e.style.cssText,data:e.dataset}}getSelectedOptions(){let e=[];const s=this.select.childNodes;for(const n of s){if(n.nodeName==="OPTGROUP"){const i=n.childNodes;for(const r of i)if(r.nodeName==="OPTION"){const o=r;o.selected&&e.push(this.getDataFromOption(o))}}if(n.nodeName==="OPTION"){const i=n;i.selected&&e.push(this.getDataFromOption(i))}}return e}getSelectedValues(){return this.getSelectedOptions().map(e=>e.value)}setSelected(e){this.changeListen(!1);const s=this.select.childNodes;for(const n of s){if(n.nodeName==="OPTGROUP"){const r=n.childNodes;for(const o of r)if(o.nodeName==="OPTION"){const l=o;l.selected=e.includes(l.id)}}if(n.nodeName==="OPTION"){const i=n;i.selected=e.includes(i.id)}}this.changeListen(!0)}setSelectedByValue(e){this.changeListen(!1);const s=this.select.childNodes;for(const n of s){if(n.nodeName==="OPTGROUP"){const r=n.childNodes;for(const o of r)if(o.nodeName==="OPTION"){const l=o;l.selected=e.includes(l.value)}}if(n.nodeName==="OPTION"){const i=n;i.selected=e.includes(i.value)}}this.changeListen(!0)}updateSelect(e,s,n){this.changeListen(!1),e&&(this.select.dataset.id=e),s&&(this.select.style.cssText=s),n&&(this.select.className="",n.forEach(i=>{i.trim()!==""&&this.select.classList.add(i.trim())})),this.changeListen(!0)}updateOptions(e){this.changeListen(!1),this.select.innerHTML="";for(const s of e)s instanceof Me&&this.select.appendChild(this.createOptgroup(s)),s instanceof ue&&this.select.appendChild(this.createOption(s));this.select.dispatchEvent(new Event("change",{bubbles:!0})),this.changeListen(!0)}createOptgroup(e){const s=document.createElement("optgroup");if(s.id=e.id,s.label=e.label,e.selectAll&&(s.dataset.selectAll="true"),e.closable!=="off"&&(s.dataset.closable=e.closable),e.options)for(const n of e.options)s.appendChild(this.createOption(n));return s}createOption(e){const s=document.createElement("option");return s.id=e.id,s.value=e.value,s.textContent=e.text,e.html!==""&&s.setAttribute("data-html",e.html),s.defaultSelected=e.defaultSelected,s.selected=e.selected,e.disabled&&(s.disabled=!0),e.display||(s.style.display="none"),e.placeholder&&s.setAttribute("data-placeholder","true"),e.mandatory&&s.setAttribute("data-mandatory","true"),e.class&&e.class.split(" ").forEach(n=>{s.classList.add(n)}),e.data&&typeof e.data=="object"&&Object.keys(e.data).forEach(n=>{s.setAttribute("data-"+kc(n),e.data[n])}),s}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 Mc{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-"+Fn(),this.style=e.style||"",this.class=e.class||[],this.disabled=e.disabled!==void 0?e.disabled:!1,this.alwaysOpen=e.alwaysOpen!==void 0?e.alwaysOpen:!1,this.showSearch=e.showSearch!==void 0?e.showSearch:!0,this.focusSearch=e.focusSearch!==void 0?e.focusSearch:!0,this.ariaLabel=e.ariaLabel||"Combobox",this.searchPlaceholder=e.searchPlaceholder||"Search",this.searchText=e.searchText||"No Results",this.searchingText=e.searchingText||"Searching...",this.searchHighlight=e.searchHighlight!==void 0?e.searchHighlight:!1,this.closeOnSelect=e.closeOnSelect!==void 0?e.closeOnSelect:!0,this.contentLocation=e.contentLocation||document.body,this.contentPosition=e.contentPosition||"absolute",this.openPosition=e.openPosition||"auto",this.contentAriaLabel=e.contentAriaLabel!==void 0?e.contentAriaLabel:"Select an option",this.placeholderText=e.placeholderText!==void 0?e.placeholderText:"Select Value",this.allowDeselect=e.allowDeselect!==void 0?e.allowDeselect:!1,this.hideSelected=e.hideSelected!==void 0?e.hideSelected:!1,this.keepOrder=e.keepOrder!==void 0?e.keepOrder:!1,this.showOptionTooltips=e.showOptionTooltips!==void 0?e.showOptionTooltips:!1,this.minSelected=e.minSelected||0,this.maxSelected=e.maxSelected||1e3,this.timeoutDelay=e.timeoutDelay||200,this.maxValuesShown=e.maxValuesShown||20,this.maxValuesMessage=e.maxValuesMessage||"{number} selected",this.addableText=e.addableText||'Press "Enter" to add {value}',this.ariaLabelledBy=e.ariaLabelledBy||"",this.searchAriaLabel=e.searchAriaLabel||"Search options",this.searchLabelledBy=e.searchLabelledBy||"",this.clearAllAriaLabel=e.clearAllAriaLabel||"Clear selection"}}class Nc{constructor(e){var o;if(this.events={search:void 0,searchFilter:(l,a)=>l.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=Kt(()=>{!this.settings.isOpen&&!this.settings.isFullOpen||this.render.moveContent()}),this.windowScroll=Kt(()=>{!this.settings.isOpen&&!this.settings.isFullOpen||this.render.moveContent()}),this.documentClick=l=>{this.settings.isOpen&&l.target&&!Dc(l.target,this.settings.id)&&this.close(l.type)},this.windowVisibilityChange=()=>{document.hidden&&this.close()},this.selectEl=typeof e.select=="string"?document.querySelector(e.select):e.select,!this.selectEl){e.events&&e.events.error&&e.events.error(new Error("Could not find select element"));return}if(this.selectEl.tagName!=="SELECT"){e.events&&e.events.error&&e.events.error(new Error("Element isnt of type select"));return}this.selectEl.dataset.ssid&&this.destroy(),this.settings=new Mc(e.settings),this.cssClasses=new Rc(e.cssClasses);const s=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const l in e.events)e.events.hasOwnProperty(l)&&(s.indexOf(l)!==-1?this.events[l]=Kt(e.events[l],100):this.events[l]=e.events[l]);this.settings.disabled=(o=e.settings)!=null&&o.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 Ic(this.selectEl),this.select.updateSelect(this.settings.id,this.settings.style,this.settings.class),this.select.hideUI(),this.select.onValueChange=l=>{this.setSelected(l.map(a=>a.id))},this.select.onClassChange=l=>{this.settings.class=l,this.render.updateClassStyles()},this.select.onDisabledChange=l=>{l?this.disable():this.enable()},this.select.onOptionsChange=l=>{this.setData(l)},this.store=new Fc(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 hn(this.settings,this.cssClasses,this.store,n),this.render.renderValues(),this.render.renderOptions(this.store.getData());const i=this.selectEl.getAttribute("aria-label"),r=this.selectEl.getAttribute("aria-labelledby");i?this.render.main.main.setAttribute("aria-label",i):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),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(e){const s=this.store.getSelected(),n=this.store.validateDataArray(e);if(n){this.events.error&&this.events.error(n);return}this.store.setData(e);const i=this.store.getData();this.select.updateOptions(i),this.render.renderValues(),this.render.renderOptions(i),this.events.afterChange&&!qs(s,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let e=this.store.getSelectedOptions();return this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e)),e.map(s=>s.value)}setSelected(e,s=!0){const n=this.store.getSelected(),i=this.store.getDataOptions();e=Array.isArray(e)?e:[e];const r=[];for(const l of e){if(i.find(a=>a.id==l)){r.push(l);continue}for(const a of i.filter(u=>u.value==l))r.push(a.id)}this.store.setSelectedBy("id",r);const o=this.store.getData();this.select.updateOptions(o),this.render.renderValues(),this.render.content.search.input.value!==""?this.search(this.render.content.search.input.value):this.render.renderOptions(o),s&&this.events.afterChange&&!qs(n,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}addOption(e){const s=this.store.getSelected();this.store.getDataOptions().some(i=>i.value===(e.value??e.text))||this.store.addOption(e);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!qs(s,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.settings.focusSearch&&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(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){this.render.renderOptions(e===""?this.store.getData():this.store.search(e,this.events.searchFilter));return}this.render.renderSearching();const s=this.events.search(e,this.store.getSelectedOptions());if(s instanceof Promise){s.then(n=>{this.render.renderOptions(this.store.partialToFullData(n))}).catch(n=>{this.render.renderError(typeof n=="string"?n:n.message)});return}else Array.isArray(s)?this.render.renderOptions(this.store.partialToFullData(s)):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 Bc="CWYDT23U",Hc="slimselectjscom",Vc=Ts({__name:"carbonad",setup(t){const e=ir(null);let s=!1;return mr(()=>{const n=window.location.hostname==="localhost";if(!s&&!n){s=!0;const i=document.createElement("script");i.id="_carbonads_js",i.src=`//cdn.carbonads.com/carbon.js?serve=${Bc}&placement=${Hc}`,i.async=!0,e.value&&e.value.appendChild(i)}}),(n,i)=>wt(s)?(Zt(),Nr("div",{key:0,class:"carbon-container",ref_key:"container",ref:e},null,512)):$o("",!0)}}),Uc=Ts({name:"App",components:{CarbonAd:Vc},data(){return{nav:null,navDebounce:Kt(()=>{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:"Examples",closable:"close",options:[{text:"countries",value:"examples#countries"},{text:"form reset",value:"examples#formReset"}]},{label:"Settings",closable:"close",options:[{text:"select",value:"settings#select"},{text:"cssClasses",value:"settings#cssClasses"},{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"}]}]}},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 t=this.$route.hash;if(t===""&&window.scroll({top:0,behavior:"smooth"}),t){const e=document.querySelector(t);if(e){const s=document.querySelector("header"),n=document.querySelector("nav"),i=s?s.clientHeight+(window.innerWidth<700?n.clientHeight:0)+8:0;window.scroll({top:e.offsetTop-i,behavior:"smooth"})}}},200)}),this.setDemensions(),window.addEventListener("resize",this.navDebounce),window.addEventListener("nav-updated",this.updateNav)},unmounted(){var t;window.removeEventListener("resize",this.navDebounce),window.removeEventListener("nav-updated",this.updateNav),(t=this.nav)==null||t.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 t={searchHighlight:!0,openContent:"below"};this.width>700&&(t.alwaysOpen=!0,t.contentPosition="relative",t.contentLocation=this.$refs.navContent),this.nav=new Nc({select:this.$refs.nav,data:this.navData,settings:t,events:{afterChange:e=>{const n=e[0].value.split("#"),i=n[0],r=n[1]?"#"+n[1]:void 0;this.$router.push({path:i,hash:r})}}})},updateNav(){setTimeout(()=>{this.nav&&this.nav.setSelected(this.$router.currentRoute.value.fullPath.replace("/",""))},0)}}}),$c="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",jc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACAAQMAAAD58POIAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZQTFRFyzg3////IltC9QAAAAFiS0dEAf8CLd4AAAAJcEhZcwAACxMAAAsTAQCanBgAAAAkSURBVEjHY2AYBYMV/IeDUQG4AJgeFRgVGBUYFSBNYBQMPgAARjtdvxo6xaMAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTEtMDUtMzBUMjM6MTA6NDQtMDc6MDCm4GvfAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDEwLTEyLTA2VDEyOjIwOjEyLTA4OjAwpIGEmQAAADJ0RVh0UE5HOmNIUk0AY2h1bmsgd2FzIGZvdW5kIChzZWUgQ2hyb21hdGljaXR5LCBhYm92ZSkH0UjaAAAAKXRFWHRQTkc6Z0FNQQBnYW1tYT0wLjQ1NDU1IChTZWUgR2FtbWEsIGFib3ZlKRISLKcAAAAUdEVYdFBORzpJSERSLmJpdF9kZXB0aAA4KYV+UAAAABV0RVh0UE5HOklIRFIuY29sb3JfdHlwZQA2BkqnKwAAABt0RVh0UE5HOklIRFIuaW50ZXJsYWNlX21ldGhvZAAw+zsHjAAAABx0RVh0UE5HOklIRFIud2lkdGgsaGVpZ2h0ADE2LCAxNjjVBg0AAAAodEVYdFBORzpwSFlzAHhfcmVzPTI4MzUsIHlfcmVzPTI4MzUsIHVuaXRzPTGCKXI+AAAAKHRFWHRQTkc6c1JHQgBpbnRlbnQ9MCAoU2VlIFJlbmRlcmluZyBpbnRlbnQp8hEU9QAAAABJRU5ErkJggg==",zc=(t,e)=>{const s=t.__vccOpts||t;for(const[n,i]of e)s[n]=i;return s},Wc={ref:"nav"},Gc={class:"nav-content",ref:"navContent"};function qc(t,e,s,n,i,r){const o=$n("CarbonAd"),l=$n("router-view");return Zt(),Nr(Re,null,[e[4]||(e[4]=Uo('

Slim Select 2.0

Advanced select dropdown
',1)),Ze("nav",null,[Ze("select",Wc,null,512),Ze("div",Gc,null,512),de(o)]),Ze("main",null,[de(l),Ze("footer",null,[ds(" © "+Vi(t.year)+" ",1),e[0]||(e[0]=Ze("a",{href:"http://webiswhatido.com",style:{color:"#ffffff"},target:"_blank"},"Brian Voelker",-1)),e[1]||(e[1]=ds(". ")),e[2]||(e[2]=Ze("br",null,null,-1)),e[3]||(e[3]=ds(" Slim Select is under the MIT license. "))])])],64)}const Kc=zc(Uc,[["render",qc]]);var Ri=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function sl(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ks={exports:{}},Di;function Yc(){return Di||(Di=1,function(t){var e=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 s=function(n){var i=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,r=0,o={},l={manual:n.Prism&&n.Prism.manual,disableWorkerMessageHandler:n.Prism&&n.Prism.disableWorkerMessageHandler,util:{encode:function m(v){return v instanceof a?new a(v.type,m(v.content),v.alias):Array.isArray(v)?v.map(m):v.replace(/&/g,"&").replace(/"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(E){var m=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(E.stack)||[])[1];if(m){var v=document.getElementsByTagName("script");for(var y in v)if(v[y].src==m)return v[y]}return null}},isActive:function(m,v,y){for(var E="no-"+v;m;){var L=m.classList;if(L.contains(v))return!0;if(L.contains(E))return!1;m=m.parentElement}return!!y}},languages:{plain:o,plaintext:o,text:o,txt:o,extend:function(m,v){var y=l.util.clone(l.languages[m]);for(var E in v)y[E]=v[E];return y},insertBefore:function(m,v,y,E){E=E||l.languages;var L=E[m],F={};for(var W in L)if(L.hasOwnProperty(W)){if(W==v)for(var H in y)y.hasOwnProperty(H)&&(F[H]=y[H]);y.hasOwnProperty(W)||(F[W]=L[W])}var K=E[m];return E[m]=F,l.languages.DFS(l.languages,function(re,pe){pe===K&&re!=m&&(this[re]=F)}),F},DFS:function m(v,y,E,L){L=L||{};var F=l.util.objId;for(var W in v)if(v.hasOwnProperty(W)){y.call(v,W,v[W],E||W);var H=v[W],K=l.util.type(H);K==="Object"&&!L[F(H)]?(L[F(H)]=!0,m(H,y,null,L)):K==="Array"&&!L[F(H)]&&(L[F(H)]=!0,m(H,y,W,L))}}},plugins:{},highlightAll:function(m,v){l.highlightAllUnder(document,m,v)},highlightAllUnder:function(m,v,y){var E={callback:y,container:m,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};l.hooks.run("before-highlightall",E),E.elements=Array.prototype.slice.apply(E.container.querySelectorAll(E.selector)),l.hooks.run("before-all-elements-highlight",E);for(var L=0,F;F=E.elements[L++];)l.highlightElement(F,v===!0,E.callback)},highlightElement:function(m,v,y){var E=l.util.getLanguage(m),L=l.languages[E];l.util.setLanguage(m,E);var F=m.parentElement;F&&F.nodeName.toLowerCase()==="pre"&&l.util.setLanguage(F,E);var W=m.textContent,H={element:m,language:E,grammar:L,code:W};function K(pe){H.highlightedCode=pe,l.hooks.run("before-insert",H),H.element.innerHTML=H.highlightedCode,l.hooks.run("after-highlight",H),l.hooks.run("complete",H),y&&y.call(H.element)}if(l.hooks.run("before-sanity-check",H),F=H.element.parentElement,F&&F.nodeName.toLowerCase()==="pre"&&!F.hasAttribute("tabindex")&&F.setAttribute("tabindex","0"),!H.code){l.hooks.run("complete",H),y&&y.call(H.element);return}if(l.hooks.run("before-highlight",H),!H.grammar){K(l.util.encode(H.code));return}if(v&&n.Worker){var re=new Worker(l.filename);re.onmessage=function(pe){K(pe.data)},re.postMessage(JSON.stringify({language:H.language,code:H.code,immediateClose:!0}))}else K(l.highlight(H.code,H.grammar,H.language))},highlight:function(m,v,y){var E={code:m,grammar:v,language:y};if(l.hooks.run("before-tokenize",E),!E.grammar)throw new Error('The language "'+E.language+'" has no grammar.');return E.tokens=l.tokenize(E.code,E.grammar),l.hooks.run("after-tokenize",E),a.stringify(l.util.encode(E.tokens),E.language)},tokenize:function(m,v){var y=v.rest;if(y){for(var E in y)v[E]=y[E];delete v.rest}var L=new f;return p(L,L.head,m),c(m,L,v,L.head,0),C(L)},hooks:{all:{},add:function(m,v){var y=l.hooks.all;y[m]=y[m]||[],y[m].push(v)},run:function(m,v){var y=l.hooks.all[m];if(!(!y||!y.length))for(var E=0,L;L=y[E++];)L(v)}},Token:a};n.Prism=l;function a(m,v,y,E){this.type=m,this.content=v,this.alias=y,this.length=(E||"").length|0}a.stringify=function m(v,y){if(typeof v=="string")return v;if(Array.isArray(v)){var E="";return v.forEach(function(K){E+=m(K,y)}),E}var L={type:v.type,content:m(v.content,y),tag:"span",classes:["token",v.type],attributes:{},language:y},F=v.alias;F&&(Array.isArray(F)?Array.prototype.push.apply(L.classes,F):L.classes.push(F)),l.hooks.run("wrap",L);var W="";for(var H in L.attributes)W+=" "+H+'="'+(L.attributes[H]||"").replace(/"/g,""")+'"';return"<"+L.tag+' class="'+L.classes.join(" ")+'"'+W+">"+L.content+""};function u(m,v,y,E){m.lastIndex=v;var L=m.exec(y);if(L&&E&&L[1]){var F=L[1].length;L.index+=F,L[0]=L[0].slice(F)}return L}function c(m,v,y,E,L,F){for(var W in y)if(!(!y.hasOwnProperty(W)||!y[W])){var H=y[W];H=Array.isArray(H)?H:[H];for(var K=0;K=F.reach);ae+=$.value.length,$=$.next){var ye=$.value;if(v.length>m.length)return;if(!(ye instanceof a)){var Ae=1,te;if(ot){if(te=u(Q,ae,m,Le),!te||te.index>=m.length)break;var fe=te.index,ct=te.index+te[0].length,we=ae;for(we+=$.value.length;fe>=we;)$=$.next,we+=$.value.length;if(we-=$.value.length,ae=we,$.value instanceof a)continue;for(var Ve=$;Ve!==v.tail&&(weF.reach&&(F.reach=B);var Y=$.prev;N&&(Y=p(v,Y,N),ae+=N.length),g(v,Y,Ae);var h=new a(W,pe?l.tokenize(A,pe):A,at,A);if($=p(v,Y,h),k&&p(v,$,k),Ae>1){var d={cause:W+","+K,reach:B};c(m,v,y,$.prev,ae,d),F&&d.reach>F.reach&&(F.reach=d.reach)}}}}}}function f(){var m={value:null,prev:null,next:null},v={value:null,prev:m,next:null};m.next=v,this.head=m,this.tail=v,this.length=0}function p(m,v,y){var E=v.next,L={value:y,prev:v,next:E};return v.next=L,E.prev=L,m.length++,L}function g(m,v,y){for(var E=v.next,L=0;L/,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]},s.languages.markup.tag.inside["attr-value"].inside.entity=s.languages.markup.entity,s.languages.markup.doctype.inside["internal-subset"].inside=s.languages.markup,s.hooks.add("wrap",function(n){n.type==="entity"&&(n.attributes.title=n.content.replace(/&/,"&"))}),Object.defineProperty(s.languages.markup.tag,"addInlined",{value:function(i,r){var o={};o["language-"+r]={pattern:/(^$)/i,lookbehind:!0,inside:s.languages[r]},o.cdata=/^$/i;var l={"included-cdata":{pattern://i,inside:o}};l["language-"+r]={pattern:/[\s\S]+/,inside:s.languages[r]};var a={};a[i]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return i}),"i"),lookbehind:!0,greedy:!0,inside:l},s.languages.insertBefore("markup","cdata",a)}}),Object.defineProperty(s.languages.markup.tag,"addAttribute",{value:function(n,i){s.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+n+")"+/\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:[i,"language-"+i],inside:s.languages[i]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),s.languages.html=s.languages.markup,s.languages.mathml=s.languages.markup,s.languages.svg=s.languages.markup,s.languages.xml=s.languages.extend("markup",{}),s.languages.ssml=s.languages.xml,s.languages.atom=s.languages.xml,s.languages.rss=s.languages.xml,function(n){var i=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;n.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+i.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\\((?:"+i.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+i.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+i.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:i,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:/[(){};:,]/},n.languages.css.atrule.inside.rest=n.languages.css;var r=n.languages.markup;r&&(r.tag.addInlined("style","css"),r.tag.addAttribute("style","css"))}(s),s.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:/[{}[\];(),.:]/},s.languages.javascript=s.languages.extend("clike",{"class-name":[s.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}|\?\?=?|\?\.?|[~:]/}),s.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,s.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:s.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:s.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:s.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:s.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:s.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),s.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:s.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"}}),s.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),s.languages.markup&&(s.languages.markup.tag.addInlined("script","javascript"),s.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")),s.languages.js=s.languages.javascript,function(){if(typeof s>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var n="Loading…",i=function(_,D){return"✖ Error "+_+" while fetching file: "+D},r="✖ Error: File does not exist or is empty",o={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},l="data-src-status",a="loading",u="loaded",c="failed",f="pre[data-src]:not(["+l+'="'+u+'"]):not(['+l+'="'+a+'"])';function p(_,D,T){var m=new XMLHttpRequest;m.open("GET",_,!0),m.onreadystatechange=function(){m.readyState==4&&(m.status<400&&m.responseText?D(m.responseText):m.status>=400?T(i(m.status,m.statusText)):T(r))},m.send(null)}function g(_){var D=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(_||"");if(D){var T=Number(D[1]),m=D[2],v=D[3];return m?v?[T,Number(v)]:[T,void 0]:[T,T]}}s.hooks.add("before-highlightall",function(_){_.selector+=", "+f}),s.hooks.add("before-sanity-check",function(_){var D=_.element;if(D.matches(f)){_.code="",D.setAttribute(l,a);var T=D.appendChild(document.createElement("CODE"));T.textContent=n;var m=D.getAttribute("data-src"),v=_.language;if(v==="none"){var y=(/\.(\w+)$/.exec(m)||[,"none"])[1];v=o[y]||y}s.util.setLanguage(T,v),s.util.setLanguage(D,v);var E=s.plugins.autoloader;E&&E.loadLanguages(v),p(m,function(L){D.setAttribute(l,u);var F=g(D.getAttribute("data-range"));if(F){var W=L.split(/\r\n?|\n/g),H=F[0],K=F[1]==null?W.length:F[1];H<0&&(H+=W.length),H=Math.max(0,Math.min(H-1,W.length)),K<0&&(K+=W.length),K=Math.max(0,Math.min(K,W.length)),L=W.slice(H,K).join(` -`),D.hasAttribute("data-start")||D.setAttribute("data-start",String(H+1))}T.textContent=L,s.highlightElement(T)},function(L){D.setAttribute(l,c),T.textContent=L})}}),s.plugins.fileHighlight={highlight:function(D){for(var T=(D||document).querySelectorAll(f),m=0,v;v=T[m++];)s.highlightElement(v)}};var C=!1;s.fileHighlight=function(){C||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),C=!0),s.plugins.fileHighlight.highlight.apply(this,arguments)}}()}(Ks)),Ks.exports}var Qc=Yc();const Jc=sl(Qc);var Ys={exports:{}},ki;function Zc(){return ki||(ki=1,function(t){(function(){if(typeof Prism>"u")return;var e=Object.assign||function(o,l){for(var a in l)l.hasOwnProperty(a)&&(o[a]=l[a]);return o};function s(o){this.defaults=e({},o)}function n(o){return o.replace(/-(\w)/g,function(l,a){return a.toUpperCase()})}function i(o){for(var l=0,a=0;a"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(S){var m=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(S.stack)||[])[1];if(m){var b=document.getElementsByTagName("script");for(var y in b)if(b[y].src==m)return b[y]}return null}},isActive:function(m,b,y){for(var S="no-"+b;m;){var O=m.classList;if(O.contains(b))return!0;if(O.contains(S))return!1;m=m.parentElement}return!!y}},languages:{plain:o,plaintext:o,text:o,txt:o,extend:function(m,b){var y=l.util.clone(l.languages[m]);for(var S in b)y[S]=b[S];return y},insertBefore:function(m,b,y,S){S=S||l.languages;var O=S[m],F={};for(var W in O)if(O.hasOwnProperty(W)){if(W==b)for(var H in y)y.hasOwnProperty(H)&&(F[H]=y[H]);y.hasOwnProperty(W)||(F[W]=O[W])}var K=S[m];return S[m]=F,l.languages.DFS(l.languages,function(re,pe){pe===K&&re!=m&&(this[re]=F)}),F},DFS:function m(b,y,S,O){O=O||{};var F=l.util.objId;for(var W in b)if(b.hasOwnProperty(W)){y.call(b,W,b[W],S||W);var H=b[W],K=l.util.type(H);K==="Object"&&!O[F(H)]?(O[F(H)]=!0,m(H,y,null,O)):K==="Array"&&!O[F(H)]&&(O[F(H)]=!0,m(H,y,W,O))}}},plugins:{},highlightAll:function(m,b){l.highlightAllUnder(document,m,b)},highlightAllUnder:function(m,b,y){var S={callback:y,container:m,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};l.hooks.run("before-highlightall",S),S.elements=Array.prototype.slice.apply(S.container.querySelectorAll(S.selector)),l.hooks.run("before-all-elements-highlight",S);for(var O=0,F;F=S.elements[O++];)l.highlightElement(F,b===!0,S.callback)},highlightElement:function(m,b,y){var S=l.util.getLanguage(m),O=l.languages[S];l.util.setLanguage(m,S);var F=m.parentElement;F&&F.nodeName.toLowerCase()==="pre"&&l.util.setLanguage(F,S);var W=m.textContent,H={element:m,language:S,grammar:O,code:W};function K(pe){H.highlightedCode=pe,l.hooks.run("before-insert",H),H.element.innerHTML=H.highlightedCode,l.hooks.run("after-highlight",H),l.hooks.run("complete",H),y&&y.call(H.element)}if(l.hooks.run("before-sanity-check",H),F=H.element.parentElement,F&&F.nodeName.toLowerCase()==="pre"&&!F.hasAttribute("tabindex")&&F.setAttribute("tabindex","0"),!H.code){l.hooks.run("complete",H),y&&y.call(H.element);return}if(l.hooks.run("before-highlight",H),!H.grammar){K(l.util.encode(H.code));return}if(b&&n.Worker){var re=new Worker(l.filename);re.onmessage=function(pe){K(pe.data)},re.postMessage(JSON.stringify({language:H.language,code:H.code,immediateClose:!0}))}else K(l.highlight(H.code,H.grammar,H.language))},highlight:function(m,b,y){var S={code:m,grammar:b,language:y};if(l.hooks.run("before-tokenize",S),!S.grammar)throw new Error('The language "'+S.language+'" has no grammar.');return S.tokens=l.tokenize(S.code,S.grammar),l.hooks.run("after-tokenize",S),a.stringify(l.util.encode(S.tokens),S.language)},tokenize:function(m,b){var y=b.rest;if(y){for(var S in y)b[S]=y[S];delete b.rest}var O=new f;return p(O,O.head,m),c(m,O,b,O.head,0),_(O)},hooks:{all:{},add:function(m,b){var y=l.hooks.all;y[m]=y[m]||[],y[m].push(b)},run:function(m,b){var y=l.hooks.all[m];if(!(!y||!y.length))for(var S=0,O;O=y[S++];)O(b)}},Token:a};n.Prism=l;function a(m,b,y,S){this.type=m,this.content=b,this.alias=y,this.length=(S||"").length|0}a.stringify=function m(b,y){if(typeof b=="string")return b;if(Array.isArray(b)){var S="";return b.forEach(function(K){S+=m(K,y)}),S}var O={type:b.type,content:m(b.content,y),tag:"span",classes:["token",b.type],attributes:{},language:y},F=b.alias;F&&(Array.isArray(F)?Array.prototype.push.apply(O.classes,F):O.classes.push(F)),l.hooks.run("wrap",O);var W="";for(var H in O.attributes)W+=" "+H+'="'+(O.attributes[H]||"").replace(/"/g,""")+'"';return"<"+O.tag+' class="'+O.classes.join(" ")+'"'+W+">"+O.content+""};function u(m,b,y,S){m.lastIndex=b;var O=m.exec(y);if(O&&S&&O[1]){var F=O[1].length;O.index+=F,O[0]=O[0].slice(F)}return O}function c(m,b,y,S,O,F){for(var W in y)if(!(!y.hasOwnProperty(W)||!y[W])){var H=y[W];H=Array.isArray(H)?H:[H];for(var K=0;K=F.reach);ae+=$.value.length,$=$.next){var ye=$.value;if(b.length>m.length)return;if(!(ye instanceof a)){var Ae=1,te;if(ot){if(te=u(Q,ae,m,Le),!te||te.index>=m.length)break;var fe=te.index,ct=te.index+te[0].length,we=ae;for(we+=$.value.length;fe>=we;)$=$.next,we+=$.value.length;if(we-=$.value.length,ae=we,$.value instanceof a)continue;for(var Ve=$;Ve!==b.tail&&(weF.reach&&(F.reach=B);var Y=$.prev;N&&(Y=p(b,Y,N),ae+=N.length),g(b,Y,Ae);var h=new a(W,pe?l.tokenize(A,pe):A,at,A);if($=p(b,Y,h),k&&p(b,$,k),Ae>1){var d={cause:W+","+K,reach:B};c(m,b,y,$.prev,ae,d),F&&d.reach>F.reach&&(F.reach=d.reach)}}}}}}function f(){var m={value:null,prev:null,next:null},b={value:null,prev:m,next:null};m.next=b,this.head=m,this.tail=b,this.length=0}function p(m,b,y){var S=b.next,O={value:y,prev:b,next:S};return b.next=O,S.prev=O,m.length++,O}function g(m,b,y){for(var S=b.next,O=0;O/,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]},s.languages.markup.tag.inside["attr-value"].inside.entity=s.languages.markup.entity,s.languages.markup.doctype.inside["internal-subset"].inside=s.languages.markup,s.hooks.add("wrap",function(n){n.type==="entity"&&(n.attributes.title=n.content.replace(/&/,"&"))}),Object.defineProperty(s.languages.markup.tag,"addInlined",{value:function(i,r){var o={};o["language-"+r]={pattern:/(^$)/i,lookbehind:!0,inside:s.languages[r]},o.cdata=/^$/i;var l={"included-cdata":{pattern://i,inside:o}};l["language-"+r]={pattern:/[\s\S]+/,inside:s.languages[r]};var a={};a[i]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return i}),"i"),lookbehind:!0,greedy:!0,inside:l},s.languages.insertBefore("markup","cdata",a)}}),Object.defineProperty(s.languages.markup.tag,"addAttribute",{value:function(n,i){s.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+n+")"+/\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:[i,"language-"+i],inside:s.languages[i]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),s.languages.html=s.languages.markup,s.languages.mathml=s.languages.markup,s.languages.svg=s.languages.markup,s.languages.xml=s.languages.extend("markup",{}),s.languages.ssml=s.languages.xml,s.languages.atom=s.languages.xml,s.languages.rss=s.languages.xml,function(n){var i=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;n.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+i.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\\((?:"+i.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+i.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+i.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:i,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:/[(){};:,]/},n.languages.css.atrule.inside.rest=n.languages.css;var r=n.languages.markup;r&&(r.tag.addInlined("style","css"),r.tag.addAttribute("style","css"))}(s),s.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:/[{}[\];(),.:]/},s.languages.javascript=s.languages.extend("clike",{"class-name":[s.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}|\?\?=?|\?\.?|[~:]/}),s.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,s.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:s.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:s.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:s.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:s.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:s.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),s.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:s.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"}}),s.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),s.languages.markup&&(s.languages.markup.tag.addInlined("script","javascript"),s.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")),s.languages.js=s.languages.javascript,function(){if(typeof s>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var n="Loading…",i=function(C,D){return"✖ Error "+C+" while fetching file: "+D},r="✖ Error: File does not exist or is empty",o={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},l="data-src-status",a="loading",u="loaded",c="failed",f="pre[data-src]:not(["+l+'="'+u+'"]):not(['+l+'="'+a+'"])';function p(C,D,T){var m=new XMLHttpRequest;m.open("GET",C,!0),m.onreadystatechange=function(){m.readyState==4&&(m.status<400&&m.responseText?D(m.responseText):m.status>=400?T(i(m.status,m.statusText)):T(r))},m.send(null)}function g(C){var D=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(C||"");if(D){var T=Number(D[1]),m=D[2],b=D[3];return m?b?[T,Number(b)]:[T,void 0]:[T,T]}}s.hooks.add("before-highlightall",function(C){C.selector+=", "+f}),s.hooks.add("before-sanity-check",function(C){var D=C.element;if(D.matches(f)){C.code="",D.setAttribute(l,a);var T=D.appendChild(document.createElement("CODE"));T.textContent=n;var m=D.getAttribute("data-src"),b=C.language;if(b==="none"){var y=(/\.(\w+)$/.exec(m)||[,"none"])[1];b=o[y]||y}s.util.setLanguage(T,b),s.util.setLanguage(D,b);var S=s.plugins.autoloader;S&&S.loadLanguages(b),p(m,function(O){D.setAttribute(l,u);var F=g(D.getAttribute("data-range"));if(F){var W=O.split(/\r\n?|\n/g),H=F[0],K=F[1]==null?W.length:F[1];H<0&&(H+=W.length),H=Math.max(0,Math.min(H-1,W.length)),K<0&&(K+=W.length),K=Math.max(0,Math.min(K,W.length)),O=W.slice(H,K).join(` +`),D.hasAttribute("data-start")||D.setAttribute("data-start",String(H+1))}T.textContent=O,s.highlightElement(T)},function(O){D.setAttribute(l,c),T.textContent=O})}}),s.plugins.fileHighlight={highlight:function(D){for(var T=(D||document).querySelectorAll(f),m=0,b;b=T[m++];)s.highlightElement(b)}};var _=!1;s.fileHighlight=function(){_||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),_=!0),s.plugins.fileHighlight.highlight.apply(this,arguments)}}()}(Ks)),Ks.exports}var Qc=Yc();const Jc=sl(Qc);var Ys={exports:{}},ki;function Zc(){return ki||(ki=1,function(t){(function(){if(typeof Prism>"u")return;var e=Object.assign||function(o,l){for(var a in l)l.hasOwnProperty(a)&&(o[a]=l[a]);return o};function s(o){this.defaults=e({},o)}function n(o){return o.replace(/-(\w)/g,function(l,a){return a.toUpperCase()})}function i(o){for(var l=0,a=0;al&&(c[p]=` `+c[p],f=g)}a[u]=c.join("")}return a.join(` -`)}},t.exports&&(t.exports=s),Prism.plugins.NormalizeWhitespace=new s({"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0}),Prism.hooks.add("before-sanity-check",function(o){var l=Prism.plugins.NormalizeWhitespace;if(!(o.settings&&o.settings["whitespace-normalization"]===!1)&&Prism.util.isActive(o.element,"whitespace-normalization",!0)){if((!o.element||!o.element.parentNode)&&o.code){o.code=l.normalize(o.code,o.settings);return}var a=o.element.parentNode;if(!(!o.code||!a||a.nodeName.toLowerCase()!=="pre")){o.settings==null&&(o.settings={});for(var u in r)if(Object.hasOwnProperty.call(r,u)){var c=r[u];if(a.hasAttribute("data-"+u))try{var f=JSON.parse(a.getAttribute("data-"+u)||"true");typeof f===c&&(o.settings[u]=f)}catch{}}for(var p=a.childNodes,g="",C="",_=!1,D=0;D"u"||typeof document>"u")return;var t=[],e={},s=function(){};Prism.plugins.toolbar={};var n=Prism.plugins.toolbar.registerButton=function(o,l){var a;if(typeof l=="function"?a=l:a=function(u){var c;return typeof l.onClick=="function"?(c=document.createElement("button"),c.type="button",c.addEventListener("click",function(){l.onClick.call(this,u)})):typeof l.url=="string"?(c=document.createElement("a"),c.href=l.url):c=document.createElement("span"),l.className&&c.classList.add(l.className),c.textContent=l.text,c},o in e){console.warn('There is a button with the key "'+o+'" registered already.');return}t.push(e[o]=a)};function i(o){for(;o;){var l=o.getAttribute("data-toolbar-order");if(l!=null)return l=l.trim(),l.length?l.split(/\s*,\s*/g):[];o=o.parentElement}}var r=Prism.plugins.toolbar.hook=function(o){var l=o.element.parentNode;if(!(!l||!/pre/i.test(l.nodeName))&&!l.parentNode.classList.contains("code-toolbar")){var a=document.createElement("div");a.classList.add("code-toolbar"),l.parentNode.insertBefore(a,l),a.appendChild(l);var u=document.createElement("div");u.classList.add("toolbar");var c=t,f=i(o.element);f&&(c=f.map(function(p){return e[p]||s})),c.forEach(function(p){var g=p(o);if(g){var C=document.createElement("div");C.classList.add("toolbar-item"),C.appendChild(g),u.appendChild(C)}}),a.appendChild(u)}};n("label",function(o){var l=o.element.parentNode;if(!(!l||!/pre/i.test(l.nodeName))&&l.hasAttribute("data-label")){var a,u,c=l.getAttribute("data-label");try{u=document.querySelector("template#"+c)}catch{}return u?a=u.content:(l.hasAttribute("data-url")?(a=document.createElement("a"),a.href=l.getAttribute("data-url")):a=document.createElement("span"),a.textContent=c),a}}),Prism.hooks.add("complete",r)})();new eu({"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0});const In=xa(Kc);In.use(Pc);In.mixin({updated(){Jc.highlightAll()}});In.mount("#app");export{Re as F,ue as O,Nc as S,zc as _,Ze as a,Uo as b,Nr as c,Ts as d,ds as e,de as f,sl as g,tu as h,$o as i,ir as j,mr as k,su as l,bn as n,Zt as o,$n as r,Vi as t,Gl as w}; +`)}},t.exports&&(t.exports=s),Prism.plugins.NormalizeWhitespace=new s({"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0}),Prism.hooks.add("before-sanity-check",function(o){var l=Prism.plugins.NormalizeWhitespace;if(!(o.settings&&o.settings["whitespace-normalization"]===!1)&&Prism.util.isActive(o.element,"whitespace-normalization",!0)){if((!o.element||!o.element.parentNode)&&o.code){o.code=l.normalize(o.code,o.settings);return}var a=o.element.parentNode;if(!(!o.code||!a||a.nodeName.toLowerCase()!=="pre")){o.settings==null&&(o.settings={});for(var u in r)if(Object.hasOwnProperty.call(r,u)){var c=r[u];if(a.hasAttribute("data-"+u))try{var f=JSON.parse(a.getAttribute("data-"+u)||"true");typeof f===c&&(o.settings[u]=f)}catch{}}for(var p=a.childNodes,g="",_="",C=!1,D=0;D"u"||typeof document>"u")return;var t=[],e={},s=function(){};Prism.plugins.toolbar={};var n=Prism.plugins.toolbar.registerButton=function(o,l){var a;if(typeof l=="function"?a=l:a=function(u){var c;return typeof l.onClick=="function"?(c=document.createElement("button"),c.type="button",c.addEventListener("click",function(){l.onClick.call(this,u)})):typeof l.url=="string"?(c=document.createElement("a"),c.href=l.url):c=document.createElement("span"),l.className&&c.classList.add(l.className),c.textContent=l.text,c},o in e){console.warn('There is a button with the key "'+o+'" registered already.');return}t.push(e[o]=a)};function i(o){for(;o;){var l=o.getAttribute("data-toolbar-order");if(l!=null)return l=l.trim(),l.length?l.split(/\s*,\s*/g):[];o=o.parentElement}}var r=Prism.plugins.toolbar.hook=function(o){var l=o.element.parentNode;if(!(!l||!/pre/i.test(l.nodeName))&&!l.parentNode.classList.contains("code-toolbar")){var a=document.createElement("div");a.classList.add("code-toolbar"),l.parentNode.insertBefore(a,l),a.appendChild(l);var u=document.createElement("div");u.classList.add("toolbar");var c=t,f=i(o.element);f&&(c=f.map(function(p){return e[p]||s})),c.forEach(function(p){var g=p(o);if(g){var _=document.createElement("div");_.classList.add("toolbar-item"),_.appendChild(g),u.appendChild(_)}}),a.appendChild(u)}};n("label",function(o){var l=o.element.parentNode;if(!(!l||!/pre/i.test(l.nodeName))&&l.hasAttribute("data-label")){var a,u,c=l.getAttribute("data-label");try{u=document.querySelector("template#"+c)}catch{}return u?a=u.content:(l.hasAttribute("data-url")?(a=document.createElement("a"),a.href=l.getAttribute("data-url")):a=document.createElement("span"),a.textContent=c),a}}),Prism.hooks.add("complete",r)})();new eu({"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0});const In=xa(Kc);In.use(Pc);In.mixin({updated(){Jc.highlightAll()}});In.mount("#app");export{Re as F,ue as O,Nc as S,zc as _,Ze as a,Uo as b,Nr as c,Ts as d,ds as e,de as f,sl as g,tu as h,$o as i,ir as j,mr as k,su as l,bn as n,Zt as o,$n as r,Vi as t,Gl as w}; diff --git a/src/docs/assets/scss/misc.scss b/src/docs/assets/scss/misc.scss index 5c596308..ebb836f6 100644 --- a/src/docs/assets/scss/misc.scss +++ b/src/docs/assets/scss/misc.scss @@ -167,7 +167,7 @@ p { margin-left: var(--spacing); } -.sr-only { +.ss-sr-only { position: absolute; width: 1px; height: 1px; diff --git a/src/slim-select/render.test.ts b/src/slim-select/render.test.ts index 16f2a289..8a5a30d5 100644 --- a/src/slim-select/render.test.ts +++ b/src/slim-select/render.test.ts @@ -1372,12 +1372,16 @@ describe('render module', () => { ]) ) - expect(render.content.list.getAttribute('aria-setsize')).toBe('3') + const opts = render.getOptions(true, true, true); + expect(opts).toHaveLength(3); + expect(opts[0].getAttribute('aria-posinset')).toBe('1'); + expect(opts[0].getAttribute('aria-setsize')).toBe('3'); - const opts = render.getOptions(true, true, true) - expect(opts[0].getAttribute('aria-posinset')).toBe('1') - expect(opts[1].getAttribute('aria-posinset')).toBe('2') - expect(opts[2].getAttribute('aria-posinset')).toBe('3') + expect(opts[1].getAttribute('aria-posinset')).toBe('2'); + expect(opts[1].getAttribute('aria-setsize')).toBe('3'); + + expect(opts[2].getAttribute('aria-posinset')).toBe('3'); + expect(opts[2].getAttribute('aria-setsize')).toBe('3'); }) diff --git a/src/slim-select/render.ts b/src/slim-select/render.ts index 339ca1ef..75d246c2 100644 --- a/src/slim-select/render.ts +++ b/src/slim-select/render.ts @@ -63,7 +63,7 @@ export default class Render { el.setAttribute('role', 'status'); el.setAttribute('aria-live', 'assertive'); el.setAttribute('aria-atomic', 'true'); - el.className = 'sr-only'; + el.className = 'ss-sr-only'; document.body.appendChild(el); } return el; @@ -119,7 +119,7 @@ export default class Render { el.setAttribute('role', 'status'); el.setAttribute('aria-live', 'polite'); el.setAttribute('aria-atomic', 'true'); - el.className = 'sr-only'; + el.className = 'ss-sr-only'; document.body.appendChild(el); } return el; @@ -1131,6 +1131,13 @@ export default class Render { const fragment = document.createDocumentFragment() let count = 0; // counts only visible, enabled, non-placeholder items + const totalOptions = data.filter((d) => + d instanceof Option && + !d.placeholder && + d.display && + !d.disabled + ).length; + const tagPos = (el: HTMLDivElement) => { // mirror the same visibility you use for aria-setsize (not placeholder, not disabled, not hidden) if ( @@ -1138,7 +1145,8 @@ export default class Render { !el.classList.contains(this.classes.disabled) && !el.classList.contains(this.classes.hide) ) { - el.setAttribute('aria-posinset', String(++count)) + el.setAttribute('aria-posinset', String(++count)); + el.setAttribute('aria-setsize', String(totalOptions)); } } @@ -1331,7 +1339,6 @@ export default class Render { this.content.list.removeAttribute('aria-busy') const visibleCount = this.getOptions(true, true, true).length - this.content.list.setAttribute('aria-setsize', String(visibleCount)) this._announcePolite( `${visibleCount} option${visibleCount === 1 ? '' : 's'} available` diff --git a/src/slim-select/slimselect.scss b/src/slim-select/slimselect.scss index 7fa7a832..e96f4be4 100644 --- a/src/slim-select/slimselect.scss +++ b/src/slim-select/slimselect.scss @@ -510,3 +510,15 @@ } } } + +.ss-sr-only { + position: absolute; + width: 1px; + height: 1px; + margin: -1px; + padding: 0; + border: 0; + clip: rect(0, 0, 0, 0); + clip-path: inset(50%); + overflow: hidden; +} From d3309c7d7daa56a1cf7d063e3d247dc54645695c Mon Sep 17 00:00:00 2001 From: Tiberiu Dumitru Date: Wed, 13 Aug 2025 11:08:54 +0300 Subject: [PATCH 4/8] Cleanup. --- dist/slimselect.cjs.js | 1 - dist/slimselect.es.js | 1 - dist/slimselect.global.js | 1 - dist/slimselect.js | 1 - dist/slimselect.min.js | 2 +- dist/slimselect.umd.js | 1 - dist/slimselect.umd.min.js | 2 +- docs/assets/index.js | 2 +- src/slim-select/render.ts | 9 +-------- 9 files changed, 4 insertions(+), 16 deletions(-) diff --git a/dist/slimselect.cjs.js b/dist/slimselect.cjs.js index 01390f76..c6ae4b3f 100644 --- a/dist/slimselect.cjs.js +++ b/dist/slimselect.cjs.js @@ -1302,7 +1302,6 @@ class Render { return placeholder; } const optionEl = document.createElement('div'); - optionEl.dataset.id = option.id; optionEl.id = `${this.settings.id}__opt__${option.id}`; optionEl.classList.add(this.classes.option); optionEl.setAttribute('role', 'option'); diff --git a/dist/slimselect.es.js b/dist/slimselect.es.js index 5bef1ab5..6d1b8e53 100644 --- a/dist/slimselect.es.js +++ b/dist/slimselect.es.js @@ -1300,7 +1300,6 @@ class Render { return placeholder; } const optionEl = document.createElement('div'); - optionEl.dataset.id = option.id; optionEl.id = `${this.settings.id}__opt__${option.id}`; optionEl.classList.add(this.classes.option); optionEl.setAttribute('role', 'option'); diff --git a/dist/slimselect.global.js b/dist/slimselect.global.js index 786417e5..b0db4a2f 100644 --- a/dist/slimselect.global.js +++ b/dist/slimselect.global.js @@ -1303,7 +1303,6 @@ var SlimSelect = (function () { return placeholder; } const optionEl = document.createElement('div'); - optionEl.dataset.id = option.id; optionEl.id = `${this.settings.id}__opt__${option.id}`; optionEl.classList.add(this.classes.option); optionEl.setAttribute('role', 'option'); diff --git a/dist/slimselect.js b/dist/slimselect.js index c7ab95d4..9b080e72 100644 --- a/dist/slimselect.js +++ b/dist/slimselect.js @@ -1306,7 +1306,6 @@ return placeholder; } const optionEl = document.createElement('div'); - optionEl.dataset.id = option.id; optionEl.id = `${this.settings.id}__opt__${option.id}`; optionEl.classList.add(this.classes.option); optionEl.setAttribute('role', 'option'); diff --git a/dist/slimselect.min.js b/dist/slimselect.min.js index 91ab7b55..207096b1 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";class t{constructor(t){t||(t={}),this.main=t.main||"ss-main",this.placeholder=t.placeholder||"ss-placeholder",this.values=t.values||"ss-values",this.single=t.single||"ss-single",this.max=t.max||"ss-max",this.value=t.value||"ss-value",this.valueText=t.valueText||"ss-value-text",this.valueDelete=t.valueDelete||"ss-value-delete",this.valueOut=t.valueOut||"ss-value-out",this.deselect=t.deselect||"ss-deselect",this.deselectPath=t.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=t.arrow||"ss-arrow",this.arrowClose=t.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=t.arrowOpen||"M10,70 L50,30 L90,70",this.content=t.content||"ss-content",this.openAbove=t.openAbove||"ss-open-above",this.openBelow=t.openBelow||"ss-open-below",this.search=t.search||"ss-search",this.searchHighlighter=t.searchHighlighter||"ss-search-highlight",this.searching=t.searching||"ss-searching",this.addable=t.addable||"ss-addable",this.addablePath=t.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=t.list||"ss-list",this.optgroup=t.optgroup||"ss-optgroup",this.optgroupLabel=t.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=t.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=t.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=t.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=t.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=t.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=t.optgroupClosable||"ss-closable",this.option=t.option||"ss-option",this.optionDelete=t.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=t.highlighted||"ss-highlighted",this.open=t.open||"ss-open",this.close=t.close||"ss-close",this.selected=t.selected||"ss-selected",this.error=t.error||"ss-error",this.disabled=t.disabled||"ss-disabled",this.hide=t.hide||"ss-hide"}}function e(){return Math.random().toString(36).substring(2,10)}function s(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 i(t,e){return JSON.stringify(t)===JSON.stringify(e)}class n{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 a(e))}}class a{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.defaultSelected=void 0!==t.defaultSelected&&t.defaultSelected,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 l{constructor(t,e){this.selectType="single",this.data=[],this.selectedOrder=[],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 n||"label"in e){if(!("label"in e))return new Error("Optgroup must have a label");if("options"in e&&e.options)for(let t of e.options){const e=this.validateOption(t);if(e)return e}}else{if(!(e instanceof a||"text"in e))return new Error("Data object must be a valid optgroup or option");{const t=this.validateOption(e);if(t)return 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 n||"label"in t){let s=[];"options"in t&&t.options&&t.options.forEach((t=>{s.push(new a(t))})),s.length>0&&e.push(new n(t))}(t instanceof a||"text"in t)&&e.push(new a(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,e=!1){if(e){let e=[new a(t)];this.setData(e.concat(this.getData()))}else this.setData(this.getData().concat(new a(t)))}setSelectedBy(t,e){let s=null,i=!1;const l=[];for(let o of this.data){if(o instanceof n)for(let n of o.options)s||(s=n),n.selected=!i&&e.includes(n[t]),n.selected&&(l.push(n),"single"===this.selectType&&(i=!0));o instanceof a&&(s||(s=o),o.selected=!i&&e.includes(o[t]),o.selected&&(l.push(o),"single"===this.selectType&&(i=!0)))}"single"===this.selectType&&s&&!i&&(s.selected=!0,l.push(s));const o=e.map((e=>{var s;return(null===(s=l.find((s=>s[t]===e)))||void 0===s?void 0:s.id)||""}));this.selectedOrder=o}getSelected(){return this.getSelectedOptions().map((t=>t.id))}getSelectedValues(){return this.getSelectedOptions().map((t=>t.value))}getSelectedOptions(){return this.filter((t=>t.selected),!1)}getOptgroupByID(t){for(let e of this.data)if(e instanceof n&&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 n?t=e.options[0]:e instanceof a&&(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((i=>{if(i instanceof n){let l=[];if(i.options.forEach((i=>{t&&!t(i)||(e?l.push(new a(i)):s.push(new a(i)))})),l.length>0){let t=new n(i);t.options=l,s.push(t)}}i instanceof a&&(t&&!t(i)||s.push(new a(i)))})),s}selectedOrderOptions(t){const e=[];return this.selectedOrder.forEach((s=>{const i=t.find((t=>t.id===s));i&&e.push(i)})),t.forEach((t=>{let s=!1;e.forEach((e=>{t.id!==e.id||(s=!0)})),s||e.push(t)})),e}}class o{static getLiveAssertive(){let t=document.getElementById("ss-live-assertive");return t||(t=document.createElement("div"),t.id="ss-live-assertive",t.setAttribute("role","status"),t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true"),t.className="ss-sr-only",document.body.appendChild(t)),t}_announceAssertive(t){const e=o._liveAssertive||(o._liveAssertive=o.getLiveAssertive());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}constructor(t,e,s,i){var n;this.store=s,this.settings=t,this.classes=e,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes();const a=null===(n=document.querySelector(`[data-id="${this.settings.id}"]`))||void 0===n?void 0:n.closest(".offcanvas-body");a?a.appendChild(this.content.main):this.settings.contentLocation&&this.settings.contentLocation.appendChild(this.content.main)}static getLivePolite(){let t=document.getElementById("ss-live-polite");return t||(t=document.createElement("div"),t.id="ss-live-polite",t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.className="ss-sr-only",document.body.appendChild(t)),t}_announcePolite(t){const e=o._livePolite||(o._livePolite=o.getLivePolite());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}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)}"fixed"===this.settings.contentPosition&&(this.moveContent(),this.scrollHandler=()=>this.moveContent(),this.resizeHandler=()=>this.moveContent(),window.addEventListener("scroll",this.scrollHandler,!0),window.addEventListener("resize",this.resizeHandler)),this.searchFocus()}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),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=void 0),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=void 0),this.main.main.focus({preventScroll:!0}),this.main.main.removeAttribute("aria-activedescendant")}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.main.main.classList.add("ss-2"),this.content.main.classList.add(this.classes.content),this.content.main.classList.add("ss-content-2"),""!==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&&"fixed"!==this.settings.contentPosition||this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){this.content.list.setAttribute("role","listbox"),this.content.list.setAttribute("id",this.content.main.id+"-list"),this.content.list.setAttribute("aria-label",this.settings.contentAriaLabel),this.settings.isMultiple?this.content.list.setAttribute("aria-multiselectable","true"):this.content.list.removeAttribute("aria-multiselectable"),this.main.main.setAttribute("role","combobox"),this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.list.id),this.main.main.setAttribute("aria-expanded","false"),this.main.main.setAttribute("aria-autocomplete","list"),this.settings.ariaLabelledBy&&this.settings.ariaLabelledBy.trim()?(this.main.main.setAttribute("aria-labelledby",this.settings.ariaLabelledBy),this.main.main.removeAttribute("aria-label")):this.settings.ariaLabel&&this.settings.ariaLabel.trim()&&this.main.main.setAttribute("aria-label",this.settings.ariaLabel),this.main.main.setAttribute("aria-owns",this.content.list.id),this.content.search.input.setAttribute("aria-controls",this.content.list.id),this.content.search.input.setAttribute("aria-autocomplete","list")}mainDiv(){var t;const e=document.createElement("div");e.id=this.settings.id+"-main",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===t.key.length&&this.callbacks.open(),!0},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),i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("aria-label",this.settings.clearAllAriaLabel),i.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i.click())}));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"),a.setAttribute("aria-hidden","true"),a.setAttribute("focusable","false");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"),o.setAttribute("aria-hidden","true"),o.setAttribute("focusable","false");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()}this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e));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 i=this.store.getSelectedOptions(),l=i.filter((e=>e.selected&&e.id!==t.id),!0);if(!(this.settings.minSelected&&l.length{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),s.click())}}return e}contentDiv(){const t=document.createElement("div");t.id=this.settings.id+"-content";const e=this.searchDiv();t.appendChild(e.main);const s=this.listDiv();return t.appendChild(s),{main:t,search:e,list:s}}moveContent(){"relative"!==this.settings.contentPosition&&"down"!==this.settings.openPosition?"up"!==this.settings.openPosition?"up"===this.putContent()?this.moveContentAbove():this.moveContentBelow():this.moveContentAbove():this.moveContentBelow()}searchDiv(){const t=document.createElement("div"),e=document.createElement("input"),i=document.createElement("div");t.classList.add(this.classes.search);const n={main:t,input:e};if(this.settings.showSearch||(t.classList.add(this.classes.hide),e.readOnly=!0),e.type="search",e.placeholder=this.settings.searchPlaceholder,e.tabIndex=-1,this.settings.searchLabelledBy&&this.settings.searchLabelledBy.trim()?e.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel&&this.settings.searchAriaLabel.trim()?e.setAttribute("aria-label",this.settings.searchAriaLabel):e.setAttribute("aria-label","Search options"),e.setAttribute("autocapitalize","off"),e.setAttribute("autocomplete","off"),e.setAttribute("autocorrect","off"),e.oninput=s((t=>{this.callbacks.search(t.target.value)}),100),e.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" ":const e=this.content.list.querySelector("."+this.classes.highlighted);return!e||(e.click(),!1);case"Enter":if(this.callbacks.addable)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(e),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"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false");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 a(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=>{"string"==typeof t?s({text:t,value:t}):i instanceof Error?this.renderError(i.message):s(t)})):"string"==typeof i?s({text:i,value:i}):i instanceof Error?this.renderError(i.message):s(i))},t.appendChild(i),n.addable={main:i,svg:e,path:s}}return n}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.main.main.setAttribute("aria-activedescendant",a.id),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}const i=e["down"===t?0:e.length-1];i.classList.add(this.classes.highlighted),this.main.main.setAttribute("aria-activedescendant",i.id),this.ensureElementInView(this.content.list,i)}listDiv(){const t=document.createElement("div");return t.classList.add(this.classes.list),t}renderError(t){this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy");const e=document.createElement("div");e.classList.add(this.classes.error),e.textContent=t,this.content.list.appendChild(e),this._announceAssertive(t)}renderSearching(){this.content.list.innerHTML="",this.content.list.setAttribute("aria-busy","true");const t=document.createElement("div");t.classList.add(this.classes.searching),t.textContent=this.settings.searchingText,this.content.list.appendChild(t),this._announcePolite(this.settings.searchingText)}renderOptions(t){if(this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy"),0===t.length){const t=document.createElement("div");t.classList.add(this.classes.search);const e=this.callbacks.addable?this.settings.addableText.replace("{value}",this.content.search.input.value):this.settings.searchText;return this._announcePolite(e),t.innerHTML=e,this.content.list.appendChild(t),void this.content.list.setAttribute("aria-setsize","0")}if(this.settings.allowDeselect&&!this.settings.isMultiple){this.store.filter((t=>t.placeholder),!1).length||this.store.addOption(new a({text:"",value:"",selected:!1,placeholder:!0}),!0)}const e=document.createDocumentFragment();let s=0;const i=t.filter((t=>t instanceof a&&!t.placeholder&&t.display&&!t.disabled)).length,l=t=>{t.classList.contains(this.classes.placeholder)||t.classList.contains(this.classes.disabled)||t.classList.contains(this.classes.hide)||(t.setAttribute("aria-posinset",String(++s)),t.setAttribute("aria-setsize",String(i)))};for(const s of t){if(s instanceof n){const t=document.createElement("div");t.classList.add(this.classes.optgroup),t.setAttribute("role","group"),t.setAttribute("aria-label",s.label);const i=document.createElement("div");i.classList.add(this.classes.optgroupLabel),t.appendChild(i);const n=document.createElement("div");n.classList.add(this.classes.optgroupLabelText),n.textContent=s.label,i.appendChild(n);const a=document.createElement("div");if(a.classList.add(this.classes.optgroupActions),i.appendChild(a),this.settings.isMultiple&&s.selectAll){const t=document.createElement("div");t.classList.add(this.classes.optgroupSelectAll);let e=!0;for(const t of s.options)if(!t.selected){e=!1;break}e&&t.classList.add(this.classes.selected);const i=document.createElement("span");i.textContent=s.selectAllText,t.appendChild(i);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),t.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.optgroupSelectAllBox),n.appendChild(l);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.optgroupSelectAllCheck),n.appendChild(o),t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const i=this.store.getSelected();if(e){const t=i.filter((t=>{for(const e of s.options)if(t===e.id)return!1;return!0}));this.callbacks.setSelected(t,!0)}else{const t=i.concat(s.options.map((t=>t.id)));for(const t of s.options)this.store.getOptionByID(t.id)||this.callbacks.addOption(t);this.callbacks.setSelected(t,!0)}})),a.appendChild(t)}if("off"!==s.closable){const e=document.createElement("div");e.classList.add(this.classes.optgroupClosable);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.classList.add(this.classes.arrow),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),e.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","path");n.appendChild(l),s.options.some((t=>t.selected))||""!==this.content.search.input.value.trim()||"open"===s.closable?(t.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"close"===s.closable&&(t.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose)),i.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))})),a.appendChild(e)}t.appendChild(i);for(const e of s.options){const s=this.option(e);l(s),t.appendChild(s)}e.appendChild(t)}if(s instanceof a){const t=this.option(s);l(t),e.appendChild(t)}}this.content.list.appendChild(e),this.content.list.removeAttribute("aria-busy");const o=this.getOptions(!0,!0,!0).length;this._announcePolite(`${o} option${1===o?"":"s"} available`)}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=`${this.settings.id}__opt__${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),e.setAttribute("aria-disabled","true")),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=[];if(this.settings.isMultiple)if(t.selected)o=l.filter((t=>t.id!==n));else if(o=l.concat(t),!this.settings.closeOnSelect)if(e.shiftKey&&this.lastSelectedOption){const e=this.store.getDataOptions();let s=e.findIndex((t=>t.id===this.lastSelectedOption.id)),i=e.findIndex((e=>e.id===t.id));if(s>=0&&i>=0){const t=Math.min(s,i),n=Math.max(s,i),a=e.slice(t,n+1);a.length>0&&a.length!l.find((e=>e.id===t.id))))))}}else t.selected||(this.lastSelectedOption=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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=s.left+("fixed"===this.settings.contentPosition?0: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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=t.left+("fixed"===this.settings.contentPosition?0: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)}}o._livePolite=null,o._liveAssertive=null;class c{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){if(n.target===this.select&&("disabled"===n.attributeName&&(s=!0),"class"===n.attributeName&&(e=!0),"childList"===n.type)){for(const t of n.addedNodes)if("OPTION"===t.nodeName&&t.value===this.select.value){this.select.dispatchEvent(new Event("change"));break}i=!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:"",defaultSelected:t.defaultSelected,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)}setSelectedByValue(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.value)}}if("OPTION"===s.nodeName){const e=s;e.selected=t.includes(e.value)}}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 n&&this.select.appendChild(this.createOptgroup(e)),e instanceof a&&this.select.appendChild(this.createOption(e));this.select.dispatchEvent(new Event("change",{bubbles:!0})),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.textContent=t.text,""!==t.html&&e.setAttribute("data-html",t.html),e.defaultSelected=t.defaultSelected,e.selected=t.selected,t.disabled&&(e.disabled=!0),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 r{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.focusSearch=void 0===t.focusSearch||t.focusSearch,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.contentAriaLabel=void 0!==t.contentAriaLabel?t.contentAriaLabel:"Select an option",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",this.addableText=t.addableText||'Press "Enter" to add {value}',this.ariaLabelledBy=t.ariaLabelledBy||"",this.searchAriaLabel=t.searchAriaLabel||"Search options",this.searchLabelledBy=t.searchLabelledBy||"",this.clearAllAriaLabel=t.clearAllAriaLabel||"Clear selection"}}return class{constructor(e){var i;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=s((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.windowScroll=s((()=>{(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 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 r(e.settings),this.cssClasses=new t(e.cssClasses);const n=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const t in e.events)e.events.hasOwnProperty(t)&&(-1!==n.indexOf(t)?this.events[t]=s(e.events[t],100):this.events[t]=e.events[t]);this.settings.disabled=(null===(i=e.settings)||void 0===i?void 0:i.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 c(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 l(this.settings.isMultiple?"multiple":"single",e.data?e.data:this.select.getData()),e.data&&this.select.updateOptions(this.store.getData());const a={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 o(this.settings,this.cssClasses,this.store,a),this.render.renderValues(),this.render.renderOptions(this.store.getData());const h=this.selectEl.getAttribute("aria-label"),d=this.selectEl.getAttribute("aria-labelledby");h?this.render.main.main.setAttribute("aria-label",h):d&&this.render.main.main.setAttribute("aria-labelledby",d),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(),s=this.store.validateDataArray(t);if(s)return void(this.events.error&&this.events.error(s));this.store.setData(t);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!i(e,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let t=this.store.getSelectedOptions();return this.settings.keepOrder&&(t=this.store.selectedOrderOptions(t)),t.map((t=>t.value))}setSelected(t,e=!0){const s=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&&!i(s,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 s=this.store.getData();this.select.updateOptions(s),this.render.renderValues(),this.render.renderOptions(s),this.events.afterChange&&!i(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.settings.focusSearch&&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";class t{constructor(t){t||(t={}),this.main=t.main||"ss-main",this.placeholder=t.placeholder||"ss-placeholder",this.values=t.values||"ss-values",this.single=t.single||"ss-single",this.max=t.max||"ss-max",this.value=t.value||"ss-value",this.valueText=t.valueText||"ss-value-text",this.valueDelete=t.valueDelete||"ss-value-delete",this.valueOut=t.valueOut||"ss-value-out",this.deselect=t.deselect||"ss-deselect",this.deselectPath=t.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=t.arrow||"ss-arrow",this.arrowClose=t.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=t.arrowOpen||"M10,70 L50,30 L90,70",this.content=t.content||"ss-content",this.openAbove=t.openAbove||"ss-open-above",this.openBelow=t.openBelow||"ss-open-below",this.search=t.search||"ss-search",this.searchHighlighter=t.searchHighlighter||"ss-search-highlight",this.searching=t.searching||"ss-searching",this.addable=t.addable||"ss-addable",this.addablePath=t.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=t.list||"ss-list",this.optgroup=t.optgroup||"ss-optgroup",this.optgroupLabel=t.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=t.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=t.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=t.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=t.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=t.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=t.optgroupClosable||"ss-closable",this.option=t.option||"ss-option",this.optionDelete=t.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=t.highlighted||"ss-highlighted",this.open=t.open||"ss-open",this.close=t.close||"ss-close",this.selected=t.selected||"ss-selected",this.error=t.error||"ss-error",this.disabled=t.disabled||"ss-disabled",this.hide=t.hide||"ss-hide"}}function e(){return Math.random().toString(36).substring(2,10)}function s(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 i(t,e){return JSON.stringify(t)===JSON.stringify(e)}class n{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 a(e))}}class a{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.defaultSelected=void 0!==t.defaultSelected&&t.defaultSelected,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 l{constructor(t,e){this.selectType="single",this.data=[],this.selectedOrder=[],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 n||"label"in e){if(!("label"in e))return new Error("Optgroup must have a label");if("options"in e&&e.options)for(let t of e.options){const e=this.validateOption(t);if(e)return e}}else{if(!(e instanceof a||"text"in e))return new Error("Data object must be a valid optgroup or option");{const t=this.validateOption(e);if(t)return 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 n||"label"in t){let s=[];"options"in t&&t.options&&t.options.forEach((t=>{s.push(new a(t))})),s.length>0&&e.push(new n(t))}(t instanceof a||"text"in t)&&e.push(new a(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,e=!1){if(e){let e=[new a(t)];this.setData(e.concat(this.getData()))}else this.setData(this.getData().concat(new a(t)))}setSelectedBy(t,e){let s=null,i=!1;const l=[];for(let o of this.data){if(o instanceof n)for(let n of o.options)s||(s=n),n.selected=!i&&e.includes(n[t]),n.selected&&(l.push(n),"single"===this.selectType&&(i=!0));o instanceof a&&(s||(s=o),o.selected=!i&&e.includes(o[t]),o.selected&&(l.push(o),"single"===this.selectType&&(i=!0)))}"single"===this.selectType&&s&&!i&&(s.selected=!0,l.push(s));const o=e.map((e=>{var s;return(null===(s=l.find((s=>s[t]===e)))||void 0===s?void 0:s.id)||""}));this.selectedOrder=o}getSelected(){return this.getSelectedOptions().map((t=>t.id))}getSelectedValues(){return this.getSelectedOptions().map((t=>t.value))}getSelectedOptions(){return this.filter((t=>t.selected),!1)}getOptgroupByID(t){for(let e of this.data)if(e instanceof n&&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 n?t=e.options[0]:e instanceof a&&(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((i=>{if(i instanceof n){let l=[];if(i.options.forEach((i=>{t&&!t(i)||(e?l.push(new a(i)):s.push(new a(i)))})),l.length>0){let t=new n(i);t.options=l,s.push(t)}}i instanceof a&&(t&&!t(i)||s.push(new a(i)))})),s}selectedOrderOptions(t){const e=[];return this.selectedOrder.forEach((s=>{const i=t.find((t=>t.id===s));i&&e.push(i)})),t.forEach((t=>{let s=!1;e.forEach((e=>{t.id!==e.id||(s=!0)})),s||e.push(t)})),e}}class o{static getLiveAssertive(){let t=document.getElementById("ss-live-assertive");return t||(t=document.createElement("div"),t.id="ss-live-assertive",t.setAttribute("role","status"),t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true"),t.className="ss-sr-only",document.body.appendChild(t)),t}_announceAssertive(t){const e=o._liveAssertive||(o._liveAssertive=o.getLiveAssertive());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}constructor(t,e,s,i){var n;this.store=s,this.settings=t,this.classes=e,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes();const a=null===(n=document.querySelector(`[data-id="${this.settings.id}"]`))||void 0===n?void 0:n.closest(".offcanvas-body");a?a.appendChild(this.content.main):this.settings.contentLocation&&this.settings.contentLocation.appendChild(this.content.main)}static getLivePolite(){let t=document.getElementById("ss-live-polite");return t||(t=document.createElement("div"),t.id="ss-live-polite",t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.className="ss-sr-only",document.body.appendChild(t)),t}_announcePolite(t){const e=o._livePolite||(o._livePolite=o.getLivePolite());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}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)}"fixed"===this.settings.contentPosition&&(this.moveContent(),this.scrollHandler=()=>this.moveContent(),this.resizeHandler=()=>this.moveContent(),window.addEventListener("scroll",this.scrollHandler,!0),window.addEventListener("resize",this.resizeHandler)),this.searchFocus()}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),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=void 0),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=void 0),this.main.main.focus({preventScroll:!0}),this.main.main.removeAttribute("aria-activedescendant")}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.main.main.classList.add("ss-2"),this.content.main.classList.add(this.classes.content),this.content.main.classList.add("ss-content-2"),""!==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&&"fixed"!==this.settings.contentPosition||this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){this.content.list.setAttribute("role","listbox"),this.content.list.setAttribute("id",this.content.main.id+"-list"),this.content.list.setAttribute("aria-label",this.settings.contentAriaLabel),this.settings.isMultiple?this.content.list.setAttribute("aria-multiselectable","true"):this.content.list.removeAttribute("aria-multiselectable"),this.main.main.setAttribute("role","combobox"),this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.list.id),this.main.main.setAttribute("aria-expanded","false"),this.main.main.setAttribute("aria-autocomplete","list"),this.settings.ariaLabelledBy&&this.settings.ariaLabelledBy.trim()?(this.main.main.setAttribute("aria-labelledby",this.settings.ariaLabelledBy),this.main.main.removeAttribute("aria-label")):this.settings.ariaLabel&&this.settings.ariaLabel.trim()&&this.main.main.setAttribute("aria-label",this.settings.ariaLabel),this.main.main.setAttribute("aria-owns",this.content.list.id),this.content.search.input.setAttribute("aria-controls",this.content.list.id),this.content.search.input.setAttribute("aria-autocomplete","list")}mainDiv(){var t;const e=document.createElement("div");e.id=this.settings.id+"-main",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===t.key.length&&this.callbacks.open(),!0},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),i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("aria-label",this.settings.clearAllAriaLabel),i.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i.click())}));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"),a.setAttribute("aria-hidden","true"),a.setAttribute("focusable","false");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"),o.setAttribute("aria-hidden","true"),o.setAttribute("focusable","false");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()}this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e));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 i=this.store.getSelectedOptions(),l=i.filter((e=>e.selected&&e.id!==t.id),!0);if(!(this.settings.minSelected&&l.length{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),s.click())}}return e}contentDiv(){const t=document.createElement("div");t.id=this.settings.id+"-content";const e=this.searchDiv();t.appendChild(e.main);const s=this.listDiv();return t.appendChild(s),{main:t,search:e,list:s}}moveContent(){"relative"!==this.settings.contentPosition&&"down"!==this.settings.openPosition?"up"!==this.settings.openPosition?"up"===this.putContent()?this.moveContentAbove():this.moveContentBelow():this.moveContentAbove():this.moveContentBelow()}searchDiv(){const t=document.createElement("div"),e=document.createElement("input"),i=document.createElement("div");t.classList.add(this.classes.search);const n={main:t,input:e};if(this.settings.showSearch||(t.classList.add(this.classes.hide),e.readOnly=!0),e.type="search",e.placeholder=this.settings.searchPlaceholder,e.tabIndex=-1,this.settings.searchLabelledBy&&this.settings.searchLabelledBy.trim()?e.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel&&this.settings.searchAriaLabel.trim()?e.setAttribute("aria-label",this.settings.searchAriaLabel):e.setAttribute("aria-label","Search options"),e.setAttribute("autocapitalize","off"),e.setAttribute("autocomplete","off"),e.setAttribute("autocorrect","off"),e.oninput=s((t=>{this.callbacks.search(t.target.value)}),100),e.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" ":const e=this.content.list.querySelector("."+this.classes.highlighted);return!e||(e.click(),!1);case"Enter":if(this.callbacks.addable)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(e),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"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false");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 a(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=>{"string"==typeof t?s({text:t,value:t}):i instanceof Error?this.renderError(i.message):s(t)})):"string"==typeof i?s({text:i,value:i}):i instanceof Error?this.renderError(i.message):s(i))},t.appendChild(i),n.addable={main:i,svg:e,path:s}}return n}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.main.main.setAttribute("aria-activedescendant",a.id),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}const i=e["down"===t?0:e.length-1];i.classList.add(this.classes.highlighted),this.main.main.setAttribute("aria-activedescendant",i.id),this.ensureElementInView(this.content.list,i)}listDiv(){const t=document.createElement("div");return t.classList.add(this.classes.list),t}renderError(t){this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy");const e=document.createElement("div");e.classList.add(this.classes.error),e.textContent=t,this.content.list.appendChild(e),this._announceAssertive(t)}renderSearching(){this.content.list.innerHTML="",this.content.list.setAttribute("aria-busy","true");const t=document.createElement("div");t.classList.add(this.classes.searching),t.textContent=this.settings.searchingText,this.content.list.appendChild(t),this._announcePolite(this.settings.searchingText)}renderOptions(t){if(this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy"),0===t.length){const t=document.createElement("div");t.classList.add(this.classes.search);const e=this.callbacks.addable?this.settings.addableText.replace("{value}",this.content.search.input.value):this.settings.searchText;return this._announcePolite(e),t.innerHTML=e,this.content.list.appendChild(t),void this.content.list.setAttribute("aria-setsize","0")}if(this.settings.allowDeselect&&!this.settings.isMultiple){this.store.filter((t=>t.placeholder),!1).length||this.store.addOption(new a({text:"",value:"",selected:!1,placeholder:!0}),!0)}const e=document.createDocumentFragment();let s=0;const i=t.filter((t=>t instanceof a&&!t.placeholder&&t.display&&!t.disabled)).length,l=t=>{t.classList.contains(this.classes.placeholder)||t.classList.contains(this.classes.disabled)||t.classList.contains(this.classes.hide)||(t.setAttribute("aria-posinset",String(++s)),t.setAttribute("aria-setsize",String(i)))};for(const s of t){if(s instanceof n){const t=document.createElement("div");t.classList.add(this.classes.optgroup),t.setAttribute("role","group"),t.setAttribute("aria-label",s.label);const i=document.createElement("div");i.classList.add(this.classes.optgroupLabel),t.appendChild(i);const n=document.createElement("div");n.classList.add(this.classes.optgroupLabelText),n.textContent=s.label,i.appendChild(n);const a=document.createElement("div");if(a.classList.add(this.classes.optgroupActions),i.appendChild(a),this.settings.isMultiple&&s.selectAll){const t=document.createElement("div");t.classList.add(this.classes.optgroupSelectAll);let e=!0;for(const t of s.options)if(!t.selected){e=!1;break}e&&t.classList.add(this.classes.selected);const i=document.createElement("span");i.textContent=s.selectAllText,t.appendChild(i);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),t.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.optgroupSelectAllBox),n.appendChild(l);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.optgroupSelectAllCheck),n.appendChild(o),t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const i=this.store.getSelected();if(e){const t=i.filter((t=>{for(const e of s.options)if(t===e.id)return!1;return!0}));this.callbacks.setSelected(t,!0)}else{const t=i.concat(s.options.map((t=>t.id)));for(const t of s.options)this.store.getOptionByID(t.id)||this.callbacks.addOption(t);this.callbacks.setSelected(t,!0)}})),a.appendChild(t)}if("off"!==s.closable){const e=document.createElement("div");e.classList.add(this.classes.optgroupClosable);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.classList.add(this.classes.arrow),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),e.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","path");n.appendChild(l),s.options.some((t=>t.selected))||""!==this.content.search.input.value.trim()||"open"===s.closable?(t.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"close"===s.closable&&(t.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose)),i.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))})),a.appendChild(e)}t.appendChild(i);for(const e of s.options){const s=this.option(e);l(s),t.appendChild(s)}e.appendChild(t)}if(s instanceof a){const t=this.option(s);l(t),e.appendChild(t)}}this.content.list.appendChild(e),this.content.list.removeAttribute("aria-busy");const o=this.getOptions(!0,!0,!0).length;this._announcePolite(`${o} option${1===o?"":"s"} available`)}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.id=`${this.settings.id}__opt__${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),e.setAttribute("aria-disabled","true")),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=[];if(this.settings.isMultiple)if(t.selected)o=l.filter((t=>t.id!==n));else if(o=l.concat(t),!this.settings.closeOnSelect)if(e.shiftKey&&this.lastSelectedOption){const e=this.store.getDataOptions();let s=e.findIndex((t=>t.id===this.lastSelectedOption.id)),i=e.findIndex((e=>e.id===t.id));if(s>=0&&i>=0){const t=Math.min(s,i),n=Math.max(s,i),a=e.slice(t,n+1);a.length>0&&a.length!l.find((e=>e.id===t.id))))))}}else t.selected||(this.lastSelectedOption=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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=s.left+("fixed"===this.settings.contentPosition?0: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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=t.left+("fixed"===this.settings.contentPosition?0: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)}}o._livePolite=null,o._liveAssertive=null;class c{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){if(n.target===this.select&&("disabled"===n.attributeName&&(s=!0),"class"===n.attributeName&&(e=!0),"childList"===n.type)){for(const t of n.addedNodes)if("OPTION"===t.nodeName&&t.value===this.select.value){this.select.dispatchEvent(new Event("change"));break}i=!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:"",defaultSelected:t.defaultSelected,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)}setSelectedByValue(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.value)}}if("OPTION"===s.nodeName){const e=s;e.selected=t.includes(e.value)}}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 n&&this.select.appendChild(this.createOptgroup(e)),e instanceof a&&this.select.appendChild(this.createOption(e));this.select.dispatchEvent(new Event("change",{bubbles:!0})),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.textContent=t.text,""!==t.html&&e.setAttribute("data-html",t.html),e.defaultSelected=t.defaultSelected,e.selected=t.selected,t.disabled&&(e.disabled=!0),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 r{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.focusSearch=void 0===t.focusSearch||t.focusSearch,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.contentAriaLabel=void 0!==t.contentAriaLabel?t.contentAriaLabel:"Select an option",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",this.addableText=t.addableText||'Press "Enter" to add {value}',this.ariaLabelledBy=t.ariaLabelledBy||"",this.searchAriaLabel=t.searchAriaLabel||"Search options",this.searchLabelledBy=t.searchLabelledBy||"",this.clearAllAriaLabel=t.clearAllAriaLabel||"Clear selection"}}return class{constructor(e){var i;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=s((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.windowScroll=s((()=>{(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 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 r(e.settings),this.cssClasses=new t(e.cssClasses);const n=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const t in e.events)e.events.hasOwnProperty(t)&&(-1!==n.indexOf(t)?this.events[t]=s(e.events[t],100):this.events[t]=e.events[t]);this.settings.disabled=(null===(i=e.settings)||void 0===i?void 0:i.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 c(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 l(this.settings.isMultiple?"multiple":"single",e.data?e.data:this.select.getData()),e.data&&this.select.updateOptions(this.store.getData());const a={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 o(this.settings,this.cssClasses,this.store,a),this.render.renderValues(),this.render.renderOptions(this.store.getData());const h=this.selectEl.getAttribute("aria-label"),d=this.selectEl.getAttribute("aria-labelledby");h?this.render.main.main.setAttribute("aria-label",h):d&&this.render.main.main.setAttribute("aria-labelledby",d),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(),s=this.store.validateDataArray(t);if(s)return void(this.events.error&&this.events.error(s));this.store.setData(t);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!i(e,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let t=this.store.getSelectedOptions();return this.settings.keepOrder&&(t=this.store.selectedOrderOptions(t)),t.map((t=>t.value))}setSelected(t,e=!0){const s=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&&!i(s,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 s=this.store.getData();this.select.updateOptions(s),this.render.renderValues(),this.render.renderOptions(s),this.events.afterChange&&!i(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.settings.focusSearch&&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 c7ab95d4..9b080e72 100644 --- a/dist/slimselect.umd.js +++ b/dist/slimselect.umd.js @@ -1306,7 +1306,6 @@ return placeholder; } const optionEl = document.createElement('div'); - optionEl.dataset.id = option.id; optionEl.id = `${this.settings.id}__opt__${option.id}`; optionEl.classList.add(this.classes.option); optionEl.setAttribute('role', 'option'); diff --git a/dist/slimselect.umd.min.js b/dist/slimselect.umd.min.js index 91ab7b55..207096b1 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";class t{constructor(t){t||(t={}),this.main=t.main||"ss-main",this.placeholder=t.placeholder||"ss-placeholder",this.values=t.values||"ss-values",this.single=t.single||"ss-single",this.max=t.max||"ss-max",this.value=t.value||"ss-value",this.valueText=t.valueText||"ss-value-text",this.valueDelete=t.valueDelete||"ss-value-delete",this.valueOut=t.valueOut||"ss-value-out",this.deselect=t.deselect||"ss-deselect",this.deselectPath=t.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=t.arrow||"ss-arrow",this.arrowClose=t.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=t.arrowOpen||"M10,70 L50,30 L90,70",this.content=t.content||"ss-content",this.openAbove=t.openAbove||"ss-open-above",this.openBelow=t.openBelow||"ss-open-below",this.search=t.search||"ss-search",this.searchHighlighter=t.searchHighlighter||"ss-search-highlight",this.searching=t.searching||"ss-searching",this.addable=t.addable||"ss-addable",this.addablePath=t.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=t.list||"ss-list",this.optgroup=t.optgroup||"ss-optgroup",this.optgroupLabel=t.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=t.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=t.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=t.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=t.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=t.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=t.optgroupClosable||"ss-closable",this.option=t.option||"ss-option",this.optionDelete=t.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=t.highlighted||"ss-highlighted",this.open=t.open||"ss-open",this.close=t.close||"ss-close",this.selected=t.selected||"ss-selected",this.error=t.error||"ss-error",this.disabled=t.disabled||"ss-disabled",this.hide=t.hide||"ss-hide"}}function e(){return Math.random().toString(36).substring(2,10)}function s(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 i(t,e){return JSON.stringify(t)===JSON.stringify(e)}class n{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 a(e))}}class a{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.defaultSelected=void 0!==t.defaultSelected&&t.defaultSelected,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 l{constructor(t,e){this.selectType="single",this.data=[],this.selectedOrder=[],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 n||"label"in e){if(!("label"in e))return new Error("Optgroup must have a label");if("options"in e&&e.options)for(let t of e.options){const e=this.validateOption(t);if(e)return e}}else{if(!(e instanceof a||"text"in e))return new Error("Data object must be a valid optgroup or option");{const t=this.validateOption(e);if(t)return 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 n||"label"in t){let s=[];"options"in t&&t.options&&t.options.forEach((t=>{s.push(new a(t))})),s.length>0&&e.push(new n(t))}(t instanceof a||"text"in t)&&e.push(new a(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,e=!1){if(e){let e=[new a(t)];this.setData(e.concat(this.getData()))}else this.setData(this.getData().concat(new a(t)))}setSelectedBy(t,e){let s=null,i=!1;const l=[];for(let o of this.data){if(o instanceof n)for(let n of o.options)s||(s=n),n.selected=!i&&e.includes(n[t]),n.selected&&(l.push(n),"single"===this.selectType&&(i=!0));o instanceof a&&(s||(s=o),o.selected=!i&&e.includes(o[t]),o.selected&&(l.push(o),"single"===this.selectType&&(i=!0)))}"single"===this.selectType&&s&&!i&&(s.selected=!0,l.push(s));const o=e.map((e=>{var s;return(null===(s=l.find((s=>s[t]===e)))||void 0===s?void 0:s.id)||""}));this.selectedOrder=o}getSelected(){return this.getSelectedOptions().map((t=>t.id))}getSelectedValues(){return this.getSelectedOptions().map((t=>t.value))}getSelectedOptions(){return this.filter((t=>t.selected),!1)}getOptgroupByID(t){for(let e of this.data)if(e instanceof n&&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 n?t=e.options[0]:e instanceof a&&(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((i=>{if(i instanceof n){let l=[];if(i.options.forEach((i=>{t&&!t(i)||(e?l.push(new a(i)):s.push(new a(i)))})),l.length>0){let t=new n(i);t.options=l,s.push(t)}}i instanceof a&&(t&&!t(i)||s.push(new a(i)))})),s}selectedOrderOptions(t){const e=[];return this.selectedOrder.forEach((s=>{const i=t.find((t=>t.id===s));i&&e.push(i)})),t.forEach((t=>{let s=!1;e.forEach((e=>{t.id!==e.id||(s=!0)})),s||e.push(t)})),e}}class o{static getLiveAssertive(){let t=document.getElementById("ss-live-assertive");return t||(t=document.createElement("div"),t.id="ss-live-assertive",t.setAttribute("role","status"),t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true"),t.className="ss-sr-only",document.body.appendChild(t)),t}_announceAssertive(t){const e=o._liveAssertive||(o._liveAssertive=o.getLiveAssertive());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}constructor(t,e,s,i){var n;this.store=s,this.settings=t,this.classes=e,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes();const a=null===(n=document.querySelector(`[data-id="${this.settings.id}"]`))||void 0===n?void 0:n.closest(".offcanvas-body");a?a.appendChild(this.content.main):this.settings.contentLocation&&this.settings.contentLocation.appendChild(this.content.main)}static getLivePolite(){let t=document.getElementById("ss-live-polite");return t||(t=document.createElement("div"),t.id="ss-live-polite",t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.className="ss-sr-only",document.body.appendChild(t)),t}_announcePolite(t){const e=o._livePolite||(o._livePolite=o.getLivePolite());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}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)}"fixed"===this.settings.contentPosition&&(this.moveContent(),this.scrollHandler=()=>this.moveContent(),this.resizeHandler=()=>this.moveContent(),window.addEventListener("scroll",this.scrollHandler,!0),window.addEventListener("resize",this.resizeHandler)),this.searchFocus()}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),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=void 0),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=void 0),this.main.main.focus({preventScroll:!0}),this.main.main.removeAttribute("aria-activedescendant")}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.main.main.classList.add("ss-2"),this.content.main.classList.add(this.classes.content),this.content.main.classList.add("ss-content-2"),""!==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&&"fixed"!==this.settings.contentPosition||this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){this.content.list.setAttribute("role","listbox"),this.content.list.setAttribute("id",this.content.main.id+"-list"),this.content.list.setAttribute("aria-label",this.settings.contentAriaLabel),this.settings.isMultiple?this.content.list.setAttribute("aria-multiselectable","true"):this.content.list.removeAttribute("aria-multiselectable"),this.main.main.setAttribute("role","combobox"),this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.list.id),this.main.main.setAttribute("aria-expanded","false"),this.main.main.setAttribute("aria-autocomplete","list"),this.settings.ariaLabelledBy&&this.settings.ariaLabelledBy.trim()?(this.main.main.setAttribute("aria-labelledby",this.settings.ariaLabelledBy),this.main.main.removeAttribute("aria-label")):this.settings.ariaLabel&&this.settings.ariaLabel.trim()&&this.main.main.setAttribute("aria-label",this.settings.ariaLabel),this.main.main.setAttribute("aria-owns",this.content.list.id),this.content.search.input.setAttribute("aria-controls",this.content.list.id),this.content.search.input.setAttribute("aria-autocomplete","list")}mainDiv(){var t;const e=document.createElement("div");e.id=this.settings.id+"-main",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===t.key.length&&this.callbacks.open(),!0},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),i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("aria-label",this.settings.clearAllAriaLabel),i.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i.click())}));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"),a.setAttribute("aria-hidden","true"),a.setAttribute("focusable","false");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"),o.setAttribute("aria-hidden","true"),o.setAttribute("focusable","false");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()}this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e));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 i=this.store.getSelectedOptions(),l=i.filter((e=>e.selected&&e.id!==t.id),!0);if(!(this.settings.minSelected&&l.length{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),s.click())}}return e}contentDiv(){const t=document.createElement("div");t.id=this.settings.id+"-content";const e=this.searchDiv();t.appendChild(e.main);const s=this.listDiv();return t.appendChild(s),{main:t,search:e,list:s}}moveContent(){"relative"!==this.settings.contentPosition&&"down"!==this.settings.openPosition?"up"!==this.settings.openPosition?"up"===this.putContent()?this.moveContentAbove():this.moveContentBelow():this.moveContentAbove():this.moveContentBelow()}searchDiv(){const t=document.createElement("div"),e=document.createElement("input"),i=document.createElement("div");t.classList.add(this.classes.search);const n={main:t,input:e};if(this.settings.showSearch||(t.classList.add(this.classes.hide),e.readOnly=!0),e.type="search",e.placeholder=this.settings.searchPlaceholder,e.tabIndex=-1,this.settings.searchLabelledBy&&this.settings.searchLabelledBy.trim()?e.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel&&this.settings.searchAriaLabel.trim()?e.setAttribute("aria-label",this.settings.searchAriaLabel):e.setAttribute("aria-label","Search options"),e.setAttribute("autocapitalize","off"),e.setAttribute("autocomplete","off"),e.setAttribute("autocorrect","off"),e.oninput=s((t=>{this.callbacks.search(t.target.value)}),100),e.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" ":const e=this.content.list.querySelector("."+this.classes.highlighted);return!e||(e.click(),!1);case"Enter":if(this.callbacks.addable)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(e),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"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false");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 a(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=>{"string"==typeof t?s({text:t,value:t}):i instanceof Error?this.renderError(i.message):s(t)})):"string"==typeof i?s({text:i,value:i}):i instanceof Error?this.renderError(i.message):s(i))},t.appendChild(i),n.addable={main:i,svg:e,path:s}}return n}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.main.main.setAttribute("aria-activedescendant",a.id),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}const i=e["down"===t?0:e.length-1];i.classList.add(this.classes.highlighted),this.main.main.setAttribute("aria-activedescendant",i.id),this.ensureElementInView(this.content.list,i)}listDiv(){const t=document.createElement("div");return t.classList.add(this.classes.list),t}renderError(t){this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy");const e=document.createElement("div");e.classList.add(this.classes.error),e.textContent=t,this.content.list.appendChild(e),this._announceAssertive(t)}renderSearching(){this.content.list.innerHTML="",this.content.list.setAttribute("aria-busy","true");const t=document.createElement("div");t.classList.add(this.classes.searching),t.textContent=this.settings.searchingText,this.content.list.appendChild(t),this._announcePolite(this.settings.searchingText)}renderOptions(t){if(this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy"),0===t.length){const t=document.createElement("div");t.classList.add(this.classes.search);const e=this.callbacks.addable?this.settings.addableText.replace("{value}",this.content.search.input.value):this.settings.searchText;return this._announcePolite(e),t.innerHTML=e,this.content.list.appendChild(t),void this.content.list.setAttribute("aria-setsize","0")}if(this.settings.allowDeselect&&!this.settings.isMultiple){this.store.filter((t=>t.placeholder),!1).length||this.store.addOption(new a({text:"",value:"",selected:!1,placeholder:!0}),!0)}const e=document.createDocumentFragment();let s=0;const i=t.filter((t=>t instanceof a&&!t.placeholder&&t.display&&!t.disabled)).length,l=t=>{t.classList.contains(this.classes.placeholder)||t.classList.contains(this.classes.disabled)||t.classList.contains(this.classes.hide)||(t.setAttribute("aria-posinset",String(++s)),t.setAttribute("aria-setsize",String(i)))};for(const s of t){if(s instanceof n){const t=document.createElement("div");t.classList.add(this.classes.optgroup),t.setAttribute("role","group"),t.setAttribute("aria-label",s.label);const i=document.createElement("div");i.classList.add(this.classes.optgroupLabel),t.appendChild(i);const n=document.createElement("div");n.classList.add(this.classes.optgroupLabelText),n.textContent=s.label,i.appendChild(n);const a=document.createElement("div");if(a.classList.add(this.classes.optgroupActions),i.appendChild(a),this.settings.isMultiple&&s.selectAll){const t=document.createElement("div");t.classList.add(this.classes.optgroupSelectAll);let e=!0;for(const t of s.options)if(!t.selected){e=!1;break}e&&t.classList.add(this.classes.selected);const i=document.createElement("span");i.textContent=s.selectAllText,t.appendChild(i);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),t.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.optgroupSelectAllBox),n.appendChild(l);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.optgroupSelectAllCheck),n.appendChild(o),t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const i=this.store.getSelected();if(e){const t=i.filter((t=>{for(const e of s.options)if(t===e.id)return!1;return!0}));this.callbacks.setSelected(t,!0)}else{const t=i.concat(s.options.map((t=>t.id)));for(const t of s.options)this.store.getOptionByID(t.id)||this.callbacks.addOption(t);this.callbacks.setSelected(t,!0)}})),a.appendChild(t)}if("off"!==s.closable){const e=document.createElement("div");e.classList.add(this.classes.optgroupClosable);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.classList.add(this.classes.arrow),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),e.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","path");n.appendChild(l),s.options.some((t=>t.selected))||""!==this.content.search.input.value.trim()||"open"===s.closable?(t.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"close"===s.closable&&(t.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose)),i.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))})),a.appendChild(e)}t.appendChild(i);for(const e of s.options){const s=this.option(e);l(s),t.appendChild(s)}e.appendChild(t)}if(s instanceof a){const t=this.option(s);l(t),e.appendChild(t)}}this.content.list.appendChild(e),this.content.list.removeAttribute("aria-busy");const o=this.getOptions(!0,!0,!0).length;this._announcePolite(`${o} option${1===o?"":"s"} available`)}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=`${this.settings.id}__opt__${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),e.setAttribute("aria-disabled","true")),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=[];if(this.settings.isMultiple)if(t.selected)o=l.filter((t=>t.id!==n));else if(o=l.concat(t),!this.settings.closeOnSelect)if(e.shiftKey&&this.lastSelectedOption){const e=this.store.getDataOptions();let s=e.findIndex((t=>t.id===this.lastSelectedOption.id)),i=e.findIndex((e=>e.id===t.id));if(s>=0&&i>=0){const t=Math.min(s,i),n=Math.max(s,i),a=e.slice(t,n+1);a.length>0&&a.length!l.find((e=>e.id===t.id))))))}}else t.selected||(this.lastSelectedOption=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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=s.left+("fixed"===this.settings.contentPosition?0: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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=t.left+("fixed"===this.settings.contentPosition?0: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)}}o._livePolite=null,o._liveAssertive=null;class c{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){if(n.target===this.select&&("disabled"===n.attributeName&&(s=!0),"class"===n.attributeName&&(e=!0),"childList"===n.type)){for(const t of n.addedNodes)if("OPTION"===t.nodeName&&t.value===this.select.value){this.select.dispatchEvent(new Event("change"));break}i=!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:"",defaultSelected:t.defaultSelected,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)}setSelectedByValue(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.value)}}if("OPTION"===s.nodeName){const e=s;e.selected=t.includes(e.value)}}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 n&&this.select.appendChild(this.createOptgroup(e)),e instanceof a&&this.select.appendChild(this.createOption(e));this.select.dispatchEvent(new Event("change",{bubbles:!0})),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.textContent=t.text,""!==t.html&&e.setAttribute("data-html",t.html),e.defaultSelected=t.defaultSelected,e.selected=t.selected,t.disabled&&(e.disabled=!0),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 r{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.focusSearch=void 0===t.focusSearch||t.focusSearch,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.contentAriaLabel=void 0!==t.contentAriaLabel?t.contentAriaLabel:"Select an option",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",this.addableText=t.addableText||'Press "Enter" to add {value}',this.ariaLabelledBy=t.ariaLabelledBy||"",this.searchAriaLabel=t.searchAriaLabel||"Search options",this.searchLabelledBy=t.searchLabelledBy||"",this.clearAllAriaLabel=t.clearAllAriaLabel||"Clear selection"}}return class{constructor(e){var i;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=s((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.windowScroll=s((()=>{(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 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 r(e.settings),this.cssClasses=new t(e.cssClasses);const n=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const t in e.events)e.events.hasOwnProperty(t)&&(-1!==n.indexOf(t)?this.events[t]=s(e.events[t],100):this.events[t]=e.events[t]);this.settings.disabled=(null===(i=e.settings)||void 0===i?void 0:i.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 c(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 l(this.settings.isMultiple?"multiple":"single",e.data?e.data:this.select.getData()),e.data&&this.select.updateOptions(this.store.getData());const a={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 o(this.settings,this.cssClasses,this.store,a),this.render.renderValues(),this.render.renderOptions(this.store.getData());const h=this.selectEl.getAttribute("aria-label"),d=this.selectEl.getAttribute("aria-labelledby");h?this.render.main.main.setAttribute("aria-label",h):d&&this.render.main.main.setAttribute("aria-labelledby",d),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(),s=this.store.validateDataArray(t);if(s)return void(this.events.error&&this.events.error(s));this.store.setData(t);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!i(e,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let t=this.store.getSelectedOptions();return this.settings.keepOrder&&(t=this.store.selectedOrderOptions(t)),t.map((t=>t.value))}setSelected(t,e=!0){const s=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&&!i(s,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 s=this.store.getData();this.select.updateOptions(s),this.render.renderValues(),this.render.renderOptions(s),this.events.afterChange&&!i(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.settings.focusSearch&&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";class t{constructor(t){t||(t={}),this.main=t.main||"ss-main",this.placeholder=t.placeholder||"ss-placeholder",this.values=t.values||"ss-values",this.single=t.single||"ss-single",this.max=t.max||"ss-max",this.value=t.value||"ss-value",this.valueText=t.valueText||"ss-value-text",this.valueDelete=t.valueDelete||"ss-value-delete",this.valueOut=t.valueOut||"ss-value-out",this.deselect=t.deselect||"ss-deselect",this.deselectPath=t.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=t.arrow||"ss-arrow",this.arrowClose=t.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=t.arrowOpen||"M10,70 L50,30 L90,70",this.content=t.content||"ss-content",this.openAbove=t.openAbove||"ss-open-above",this.openBelow=t.openBelow||"ss-open-below",this.search=t.search||"ss-search",this.searchHighlighter=t.searchHighlighter||"ss-search-highlight",this.searching=t.searching||"ss-searching",this.addable=t.addable||"ss-addable",this.addablePath=t.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=t.list||"ss-list",this.optgroup=t.optgroup||"ss-optgroup",this.optgroupLabel=t.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=t.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=t.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=t.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=t.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=t.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=t.optgroupClosable||"ss-closable",this.option=t.option||"ss-option",this.optionDelete=t.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=t.highlighted||"ss-highlighted",this.open=t.open||"ss-open",this.close=t.close||"ss-close",this.selected=t.selected||"ss-selected",this.error=t.error||"ss-error",this.disabled=t.disabled||"ss-disabled",this.hide=t.hide||"ss-hide"}}function e(){return Math.random().toString(36).substring(2,10)}function s(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 i(t,e){return JSON.stringify(t)===JSON.stringify(e)}class n{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 a(e))}}class a{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.defaultSelected=void 0!==t.defaultSelected&&t.defaultSelected,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 l{constructor(t,e){this.selectType="single",this.data=[],this.selectedOrder=[],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 n||"label"in e){if(!("label"in e))return new Error("Optgroup must have a label");if("options"in e&&e.options)for(let t of e.options){const e=this.validateOption(t);if(e)return e}}else{if(!(e instanceof a||"text"in e))return new Error("Data object must be a valid optgroup or option");{const t=this.validateOption(e);if(t)return 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 n||"label"in t){let s=[];"options"in t&&t.options&&t.options.forEach((t=>{s.push(new a(t))})),s.length>0&&e.push(new n(t))}(t instanceof a||"text"in t)&&e.push(new a(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,e=!1){if(e){let e=[new a(t)];this.setData(e.concat(this.getData()))}else this.setData(this.getData().concat(new a(t)))}setSelectedBy(t,e){let s=null,i=!1;const l=[];for(let o of this.data){if(o instanceof n)for(let n of o.options)s||(s=n),n.selected=!i&&e.includes(n[t]),n.selected&&(l.push(n),"single"===this.selectType&&(i=!0));o instanceof a&&(s||(s=o),o.selected=!i&&e.includes(o[t]),o.selected&&(l.push(o),"single"===this.selectType&&(i=!0)))}"single"===this.selectType&&s&&!i&&(s.selected=!0,l.push(s));const o=e.map((e=>{var s;return(null===(s=l.find((s=>s[t]===e)))||void 0===s?void 0:s.id)||""}));this.selectedOrder=o}getSelected(){return this.getSelectedOptions().map((t=>t.id))}getSelectedValues(){return this.getSelectedOptions().map((t=>t.value))}getSelectedOptions(){return this.filter((t=>t.selected),!1)}getOptgroupByID(t){for(let e of this.data)if(e instanceof n&&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 n?t=e.options[0]:e instanceof a&&(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((i=>{if(i instanceof n){let l=[];if(i.options.forEach((i=>{t&&!t(i)||(e?l.push(new a(i)):s.push(new a(i)))})),l.length>0){let t=new n(i);t.options=l,s.push(t)}}i instanceof a&&(t&&!t(i)||s.push(new a(i)))})),s}selectedOrderOptions(t){const e=[];return this.selectedOrder.forEach((s=>{const i=t.find((t=>t.id===s));i&&e.push(i)})),t.forEach((t=>{let s=!1;e.forEach((e=>{t.id!==e.id||(s=!0)})),s||e.push(t)})),e}}class o{static getLiveAssertive(){let t=document.getElementById("ss-live-assertive");return t||(t=document.createElement("div"),t.id="ss-live-assertive",t.setAttribute("role","status"),t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true"),t.className="ss-sr-only",document.body.appendChild(t)),t}_announceAssertive(t){const e=o._liveAssertive||(o._liveAssertive=o.getLiveAssertive());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}constructor(t,e,s,i){var n;this.store=s,this.settings=t,this.classes=e,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes();const a=null===(n=document.querySelector(`[data-id="${this.settings.id}"]`))||void 0===n?void 0:n.closest(".offcanvas-body");a?a.appendChild(this.content.main):this.settings.contentLocation&&this.settings.contentLocation.appendChild(this.content.main)}static getLivePolite(){let t=document.getElementById("ss-live-polite");return t||(t=document.createElement("div"),t.id="ss-live-polite",t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.className="ss-sr-only",document.body.appendChild(t)),t}_announcePolite(t){const e=o._livePolite||(o._livePolite=o.getLivePolite());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}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)}"fixed"===this.settings.contentPosition&&(this.moveContent(),this.scrollHandler=()=>this.moveContent(),this.resizeHandler=()=>this.moveContent(),window.addEventListener("scroll",this.scrollHandler,!0),window.addEventListener("resize",this.resizeHandler)),this.searchFocus()}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),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=void 0),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=void 0),this.main.main.focus({preventScroll:!0}),this.main.main.removeAttribute("aria-activedescendant")}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.main.main.classList.add("ss-2"),this.content.main.classList.add(this.classes.content),this.content.main.classList.add("ss-content-2"),""!==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&&"fixed"!==this.settings.contentPosition||this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){this.content.list.setAttribute("role","listbox"),this.content.list.setAttribute("id",this.content.main.id+"-list"),this.content.list.setAttribute("aria-label",this.settings.contentAriaLabel),this.settings.isMultiple?this.content.list.setAttribute("aria-multiselectable","true"):this.content.list.removeAttribute("aria-multiselectable"),this.main.main.setAttribute("role","combobox"),this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.list.id),this.main.main.setAttribute("aria-expanded","false"),this.main.main.setAttribute("aria-autocomplete","list"),this.settings.ariaLabelledBy&&this.settings.ariaLabelledBy.trim()?(this.main.main.setAttribute("aria-labelledby",this.settings.ariaLabelledBy),this.main.main.removeAttribute("aria-label")):this.settings.ariaLabel&&this.settings.ariaLabel.trim()&&this.main.main.setAttribute("aria-label",this.settings.ariaLabel),this.main.main.setAttribute("aria-owns",this.content.list.id),this.content.search.input.setAttribute("aria-controls",this.content.list.id),this.content.search.input.setAttribute("aria-autocomplete","list")}mainDiv(){var t;const e=document.createElement("div");e.id=this.settings.id+"-main",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===t.key.length&&this.callbacks.open(),!0},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),i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("aria-label",this.settings.clearAllAriaLabel),i.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i.click())}));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"),a.setAttribute("aria-hidden","true"),a.setAttribute("focusable","false");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"),o.setAttribute("aria-hidden","true"),o.setAttribute("focusable","false");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()}this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e));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 i=this.store.getSelectedOptions(),l=i.filter((e=>e.selected&&e.id!==t.id),!0);if(!(this.settings.minSelected&&l.length{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),s.click())}}return e}contentDiv(){const t=document.createElement("div");t.id=this.settings.id+"-content";const e=this.searchDiv();t.appendChild(e.main);const s=this.listDiv();return t.appendChild(s),{main:t,search:e,list:s}}moveContent(){"relative"!==this.settings.contentPosition&&"down"!==this.settings.openPosition?"up"!==this.settings.openPosition?"up"===this.putContent()?this.moveContentAbove():this.moveContentBelow():this.moveContentAbove():this.moveContentBelow()}searchDiv(){const t=document.createElement("div"),e=document.createElement("input"),i=document.createElement("div");t.classList.add(this.classes.search);const n={main:t,input:e};if(this.settings.showSearch||(t.classList.add(this.classes.hide),e.readOnly=!0),e.type="search",e.placeholder=this.settings.searchPlaceholder,e.tabIndex=-1,this.settings.searchLabelledBy&&this.settings.searchLabelledBy.trim()?e.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel&&this.settings.searchAriaLabel.trim()?e.setAttribute("aria-label",this.settings.searchAriaLabel):e.setAttribute("aria-label","Search options"),e.setAttribute("autocapitalize","off"),e.setAttribute("autocomplete","off"),e.setAttribute("autocorrect","off"),e.oninput=s((t=>{this.callbacks.search(t.target.value)}),100),e.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" ":const e=this.content.list.querySelector("."+this.classes.highlighted);return!e||(e.click(),!1);case"Enter":if(this.callbacks.addable)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(e),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"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false");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 a(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=>{"string"==typeof t?s({text:t,value:t}):i instanceof Error?this.renderError(i.message):s(t)})):"string"==typeof i?s({text:i,value:i}):i instanceof Error?this.renderError(i.message):s(i))},t.appendChild(i),n.addable={main:i,svg:e,path:s}}return n}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.main.main.setAttribute("aria-activedescendant",a.id),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}const i=e["down"===t?0:e.length-1];i.classList.add(this.classes.highlighted),this.main.main.setAttribute("aria-activedescendant",i.id),this.ensureElementInView(this.content.list,i)}listDiv(){const t=document.createElement("div");return t.classList.add(this.classes.list),t}renderError(t){this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy");const e=document.createElement("div");e.classList.add(this.classes.error),e.textContent=t,this.content.list.appendChild(e),this._announceAssertive(t)}renderSearching(){this.content.list.innerHTML="",this.content.list.setAttribute("aria-busy","true");const t=document.createElement("div");t.classList.add(this.classes.searching),t.textContent=this.settings.searchingText,this.content.list.appendChild(t),this._announcePolite(this.settings.searchingText)}renderOptions(t){if(this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy"),0===t.length){const t=document.createElement("div");t.classList.add(this.classes.search);const e=this.callbacks.addable?this.settings.addableText.replace("{value}",this.content.search.input.value):this.settings.searchText;return this._announcePolite(e),t.innerHTML=e,this.content.list.appendChild(t),void this.content.list.setAttribute("aria-setsize","0")}if(this.settings.allowDeselect&&!this.settings.isMultiple){this.store.filter((t=>t.placeholder),!1).length||this.store.addOption(new a({text:"",value:"",selected:!1,placeholder:!0}),!0)}const e=document.createDocumentFragment();let s=0;const i=t.filter((t=>t instanceof a&&!t.placeholder&&t.display&&!t.disabled)).length,l=t=>{t.classList.contains(this.classes.placeholder)||t.classList.contains(this.classes.disabled)||t.classList.contains(this.classes.hide)||(t.setAttribute("aria-posinset",String(++s)),t.setAttribute("aria-setsize",String(i)))};for(const s of t){if(s instanceof n){const t=document.createElement("div");t.classList.add(this.classes.optgroup),t.setAttribute("role","group"),t.setAttribute("aria-label",s.label);const i=document.createElement("div");i.classList.add(this.classes.optgroupLabel),t.appendChild(i);const n=document.createElement("div");n.classList.add(this.classes.optgroupLabelText),n.textContent=s.label,i.appendChild(n);const a=document.createElement("div");if(a.classList.add(this.classes.optgroupActions),i.appendChild(a),this.settings.isMultiple&&s.selectAll){const t=document.createElement("div");t.classList.add(this.classes.optgroupSelectAll);let e=!0;for(const t of s.options)if(!t.selected){e=!1;break}e&&t.classList.add(this.classes.selected);const i=document.createElement("span");i.textContent=s.selectAllText,t.appendChild(i);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),t.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.optgroupSelectAllBox),n.appendChild(l);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.optgroupSelectAllCheck),n.appendChild(o),t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const i=this.store.getSelected();if(e){const t=i.filter((t=>{for(const e of s.options)if(t===e.id)return!1;return!0}));this.callbacks.setSelected(t,!0)}else{const t=i.concat(s.options.map((t=>t.id)));for(const t of s.options)this.store.getOptionByID(t.id)||this.callbacks.addOption(t);this.callbacks.setSelected(t,!0)}})),a.appendChild(t)}if("off"!==s.closable){const e=document.createElement("div");e.classList.add(this.classes.optgroupClosable);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.classList.add(this.classes.arrow),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),e.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","path");n.appendChild(l),s.options.some((t=>t.selected))||""!==this.content.search.input.value.trim()||"open"===s.closable?(t.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"close"===s.closable&&(t.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose)),i.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))})),a.appendChild(e)}t.appendChild(i);for(const e of s.options){const s=this.option(e);l(s),t.appendChild(s)}e.appendChild(t)}if(s instanceof a){const t=this.option(s);l(t),e.appendChild(t)}}this.content.list.appendChild(e),this.content.list.removeAttribute("aria-busy");const o=this.getOptions(!0,!0,!0).length;this._announcePolite(`${o} option${1===o?"":"s"} available`)}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.id=`${this.settings.id}__opt__${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),e.setAttribute("aria-disabled","true")),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=[];if(this.settings.isMultiple)if(t.selected)o=l.filter((t=>t.id!==n));else if(o=l.concat(t),!this.settings.closeOnSelect)if(e.shiftKey&&this.lastSelectedOption){const e=this.store.getDataOptions();let s=e.findIndex((t=>t.id===this.lastSelectedOption.id)),i=e.findIndex((e=>e.id===t.id));if(s>=0&&i>=0){const t=Math.min(s,i),n=Math.max(s,i),a=e.slice(t,n+1);a.length>0&&a.length!l.find((e=>e.id===t.id))))))}}else t.selected||(this.lastSelectedOption=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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=s.left+("fixed"===this.settings.contentPosition?0: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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=t.left+("fixed"===this.settings.contentPosition?0: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)}}o._livePolite=null,o._liveAssertive=null;class c{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){if(n.target===this.select&&("disabled"===n.attributeName&&(s=!0),"class"===n.attributeName&&(e=!0),"childList"===n.type)){for(const t of n.addedNodes)if("OPTION"===t.nodeName&&t.value===this.select.value){this.select.dispatchEvent(new Event("change"));break}i=!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:"",defaultSelected:t.defaultSelected,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)}setSelectedByValue(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.value)}}if("OPTION"===s.nodeName){const e=s;e.selected=t.includes(e.value)}}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 n&&this.select.appendChild(this.createOptgroup(e)),e instanceof a&&this.select.appendChild(this.createOption(e));this.select.dispatchEvent(new Event("change",{bubbles:!0})),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.textContent=t.text,""!==t.html&&e.setAttribute("data-html",t.html),e.defaultSelected=t.defaultSelected,e.selected=t.selected,t.disabled&&(e.disabled=!0),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 r{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.focusSearch=void 0===t.focusSearch||t.focusSearch,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.contentAriaLabel=void 0!==t.contentAriaLabel?t.contentAriaLabel:"Select an option",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",this.addableText=t.addableText||'Press "Enter" to add {value}',this.ariaLabelledBy=t.ariaLabelledBy||"",this.searchAriaLabel=t.searchAriaLabel||"Search options",this.searchLabelledBy=t.searchLabelledBy||"",this.clearAllAriaLabel=t.clearAllAriaLabel||"Clear selection"}}return class{constructor(e){var i;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=s((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.windowScroll=s((()=>{(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 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 r(e.settings),this.cssClasses=new t(e.cssClasses);const n=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const t in e.events)e.events.hasOwnProperty(t)&&(-1!==n.indexOf(t)?this.events[t]=s(e.events[t],100):this.events[t]=e.events[t]);this.settings.disabled=(null===(i=e.settings)||void 0===i?void 0:i.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 c(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 l(this.settings.isMultiple?"multiple":"single",e.data?e.data:this.select.getData()),e.data&&this.select.updateOptions(this.store.getData());const a={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 o(this.settings,this.cssClasses,this.store,a),this.render.renderValues(),this.render.renderOptions(this.store.getData());const h=this.selectEl.getAttribute("aria-label"),d=this.selectEl.getAttribute("aria-labelledby");h?this.render.main.main.setAttribute("aria-label",h):d&&this.render.main.main.setAttribute("aria-labelledby",d),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(),s=this.store.validateDataArray(t);if(s)return void(this.events.error&&this.events.error(s));this.store.setData(t);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!i(e,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let t=this.store.getSelectedOptions();return this.settings.keepOrder&&(t=this.store.selectedOrderOptions(t)),t.map((t=>t.value))}setSelected(t,e=!0){const s=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&&!i(s,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 s=this.store.getData();this.select.updateOptions(s),this.render.renderValues(),this.render.renderOptions(s),this.events.afterChange&&!i(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.settings.focusSearch&&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 e28d78e4..65081a6f 100644 --- a/docs/assets/index.js +++ b/docs/assets/index.js @@ -19,7 +19,7 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/home.js","asset * vue-router v4.5.1 * (c) 2025 Eduardo San Martin Morote * @license MIT - */const Ct=typeof document<"u";function jr(t){return typeof t=="object"||"displayName"in t||"props"in t||"__vccOpts"in t}function Oa(t){return t.__esModule||t[Symbol.toStringTag]==="Module"||t.default&&jr(t.default)}const J=Object.assign;function zs(t,e){const s={};for(const n in e){const i=e[n];s[n]=He(i)?i.map(t):t(i)}return s}const Gt=()=>{},He=Array.isArray,zr=/#/g,La=/&/g,Ta=/\//g,Pa=/=/g,Ra=/\?/g,Wr=/\+/g,Da=/%5B/g,ka=/%5D/g,Gr=/%5E/g,Fa=/%60/g,qr=/%7B/g,Ia=/%7C/g,Kr=/%7D/g,Ma=/%20/g;function Dn(t){return encodeURI(""+t).replace(Ia,"|").replace(Da,"[").replace(ka,"]")}function Na(t){return Dn(t).replace(qr,"{").replace(Kr,"}").replace(Gr,"^")}function cn(t){return Dn(t).replace(Wr,"%2B").replace(Ma,"+").replace(zr,"%23").replace(La,"%26").replace(Fa,"`").replace(qr,"{").replace(Kr,"}").replace(Gr,"^")}function Ba(t){return cn(t).replace(Pa,"%3D")}function Ha(t){return Dn(t).replace(zr,"%23").replace(Ra,"%3F")}function Va(t){return t==null?"":Ha(t).replace(Ta,"%2F")}function ss(t){try{return decodeURIComponent(""+t)}catch{}return""+t}const Ua=/\/$/,$a=t=>t.replace(Ua,"");function Ws(t,e,s="/"){let n,i={},r="",o="";const l=e.indexOf("#");let a=e.indexOf("?");return l=0&&(a=-1),a>-1&&(n=e.slice(0,a),r=e.slice(a+1,l>-1?l:e.length),i=t(r)),l>-1&&(n=n||e.slice(0,l),o=e.slice(l,e.length)),n=Ga(n??e,s),{fullPath:n+(r&&"?")+r+o,path:n,query:i,hash:ss(o)}}function ja(t,e){const s=e.query?t(e.query):"";return e.path+(s&&"?")+s+(e.hash||"")}function pi(t,e){return!e||!t.toLowerCase().startsWith(e.toLowerCase())?t:t.slice(e.length)||"/"}function za(t,e,s){const n=e.matched.length-1,i=s.matched.length-1;return n>-1&&n===i&&kt(e.matched[n],s.matched[i])&&Yr(e.params,s.params)&&t(e.query)===t(s.query)&&e.hash===s.hash}function kt(t,e){return(t.aliasOf||t)===(e.aliasOf||e)}function Yr(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(!Wa(t[s],e[s]))return!1;return!0}function Wa(t,e){return He(t)?gi(t,e):He(e)?gi(e,t):t===e}function gi(t,e){return He(e)?t.length===e.length&&t.every((s,n)=>s===e[n]):t.length===1&&t[0]===e}function Ga(t,e){if(t.startsWith("/"))return t;if(!t)return e;const s=e.split("/"),n=t.split("/"),i=n[n.length-1];(i===".."||i===".")&&n.push("");let r=s.length-1,o,l;for(o=0;o1&&r--;else break;return s.slice(0,r).join("/")+"/"+n.slice(o).join("/")}const ut={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};var ns;(function(t){t.pop="pop",t.push="push"})(ns||(ns={}));var qt;(function(t){t.back="back",t.forward="forward",t.unknown=""})(qt||(qt={}));function qa(t){if(!t)if(Ct){const e=document.querySelector("base");t=e&&e.getAttribute("href")||"/",t=t.replace(/^\w+:\/\/[^\/]+/,"")}else t="/";return t[0]!=="/"&&t[0]!=="#"&&(t="/"+t),$a(t)}const Ka=/^[^#]+#/;function Ya(t,e){return t.replace(Ka,"#")+e}function Qa(t,e){const s=document.documentElement.getBoundingClientRect(),n=t.getBoundingClientRect();return{behavior:e.behavior,left:n.left-s.left-(e.left||0),top:n.top-s.top-(e.top||0)}}const ks=()=>({left:window.scrollX,top:window.scrollY});function Ja(t){let e;if("el"in t){const s=t.el,n=typeof s=="string"&&s.startsWith("#"),i=typeof s=="string"?n?document.getElementById(s.slice(1)):document.querySelector(s):s;if(!i)return;e=Qa(i,t)}else e=t;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.scrollX,e.top!=null?e.top:window.scrollY)}function mi(t,e){return(history.state?history.state.position-e:-1)+t}const un=new Map;function Za(t,e){un.set(t,e)}function Xa(t){const e=un.get(t);return un.delete(t),e}let ec=()=>location.protocol+"//"+location.host;function Qr(t,e){const{pathname:s,search:n,hash:i}=e,r=t.indexOf("#");if(r>-1){let l=i.includes(t.slice(r))?t.slice(r).length:1,a=i.slice(l);return a[0]!=="/"&&(a="/"+a),pi(a,"")}return pi(s,t)+n+i}function tc(t,e,s,n){let i=[],r=[],o=null;const l=({state:p})=>{const g=Qr(t,location),_=s.value,C=e.value;let D=0;if(p){if(s.value=g,e.value=p,o&&o===_){o=null;return}D=C?p.position-C.position:0}else n(g);i.forEach(T=>{T(s.value,_,{delta:D,type:ns.pop,direction:D?D>0?qt.forward:qt.back:qt.unknown})})};function a(){o=s.value}function u(p){i.push(p);const g=()=>{const _=i.indexOf(p);_>-1&&i.splice(_,1)};return r.push(g),g}function c(){const{history:p}=window;p.state&&p.replaceState(J({},p.state,{scroll:ks()}),"")}function f(){for(const p of r)p();r=[],window.removeEventListener("popstate",l),window.removeEventListener("beforeunload",c)}return window.addEventListener("popstate",l),window.addEventListener("beforeunload",c,{passive:!0}),{pauseListeners:a,listen:u,destroy:f}}function vi(t,e,s,n=!1,i=!1){return{back:t,current:e,forward:s,replaced:n,position:window.history.length,scroll:i?ks():null}}function sc(t){const{history:e,location:s}=window,n={value:Qr(t,s)},i={value:e.state};i.value||r(n.value,{back:null,current:n.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function r(a,u,c){const f=t.indexOf("#"),p=f>-1?(s.host&&document.querySelector("base")?t:t.slice(f))+a:ec()+t+a;try{e[c?"replaceState":"pushState"](u,"",p),i.value=u}catch(g){console.error(g),s[c?"replace":"assign"](p)}}function o(a,u){const c=J({},e.state,vi(i.value.back,a,i.value.forward,!0),u,{position:i.value.position});r(a,c,!0),n.value=a}function l(a,u){const c=J({},i.value,e.state,{forward:a,scroll:ks()});r(c.current,c,!0);const f=J({},vi(n.value,a,null),{position:c.position+1},u);r(a,f,!1),n.value=a}return{location:n,state:i,push:l,replace:o}}function nc(t){t=qa(t);const e=sc(t),s=tc(t,e.state,e.location,e.replace);function n(r,o=!0){o||s.pauseListeners(),history.go(r)}const i=J({location:"",base:t,go:n,createHref:Ya.bind(null,t)},e,s);return Object.defineProperty(i,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(i,"state",{enumerable:!0,get:()=>e.state.value}),i}function ic(t){return typeof t=="string"||t&&typeof t=="object"}function Jr(t){return typeof t=="string"||typeof t=="symbol"}const Zr=Symbol("");var bi;(function(t){t[t.aborted=4]="aborted",t[t.cancelled=8]="cancelled",t[t.duplicated=16]="duplicated"})(bi||(bi={}));function Ft(t,e){return J(new Error,{type:t,[Zr]:!0},e)}function Je(t,e){return t instanceof Error&&Zr in t&&(e==null||!!(t.type&e))}const yi="[^/]+?",rc={sensitive:!1,strict:!1,start:!0,end:!0},lc=/[.+*?^${}()[\]/\\]/g;function oc(t,e){const s=J({},rc,e),n=[];let i=s.start?"^":"";const r=[];for(const u of t){const c=u.length?[]:[90];s.strict&&!u.length&&(i+="/");for(let f=0;fe.length?e.length===1&&e[0]===80?1:-1:0}function Xr(t,e){let s=0;const n=t.score,i=e.score;for(;s0&&e[e.length-1]<0}const cc={type:0,value:""},uc=/[a-zA-Z0-9_]/;function fc(t){if(!t)return[[]];if(t==="/")return[[cc]];if(!t.startsWith("/"))throw new Error(`Invalid path "${t}"`);function e(g){throw new Error(`ERR (${s})/"${u}": ${g}`)}let s=0,n=s;const i=[];let r;function o(){r&&i.push(r),r=[]}let l=0,a,u="",c="";function f(){u&&(s===0?r.push({type:0,value:u}):s===1||s===2||s===3?(r.length>1&&(a==="*"||a==="+")&&e(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),r.push({type:1,value:u,regexp:c,repeatable:a==="*"||a==="+",optional:a==="*"||a==="?"})):e("Invalid state to consume buffer"),u="")}function p(){u+=a}for(;l{o(b)}:Gt}function o(f){if(Jr(f)){const p=n.get(f);p&&(n.delete(f),s.splice(s.indexOf(p),1),p.children.forEach(o),p.alias.forEach(o))}else{const p=s.indexOf(f);p>-1&&(s.splice(p,1),f.record.name&&n.delete(f.record.name),f.children.forEach(o),f.alias.forEach(o))}}function l(){return s}function a(f){const p=mc(f,s);s.splice(p,0,f),f.record.name&&!Si(f)&&n.set(f.record.name,f)}function u(f,p){let g,_={},C,D;if("name"in f&&f.name){if(g=n.get(f.name),!g)throw Ft(1,{location:f});D=g.record.name,_=J(wi(p.params,g.keys.filter(b=>!b.optional).concat(g.parent?g.parent.keys.filter(b=>b.optional):[]).map(b=>b.name)),f.params&&wi(f.params,g.keys.map(b=>b.name))),C=g.stringify(_)}else if(f.path!=null)C=f.path,g=s.find(b=>b.re.test(C)),g&&(_=g.parse(C),D=g.record.name);else{if(g=p.name?n.get(p.name):s.find(b=>b.re.test(p.path)),!g)throw Ft(1,{location:f,currentLocation:p});D=g.record.name,_=J({},p.params,f.params),C=g.stringify(_)}const T=[];let m=g;for(;m;)T.unshift(m.record),m=m.parent;return{name:D,path:C,params:_,matched:T,meta:gc(T)}}t.forEach(f=>r(f));function c(){s.length=0,n.clear()}return{addRoute:r,resolve:u,removeRoute:o,clearRoutes:c,getRoutes:l,getRecordMatcher:i}}function wi(t,e){const s={};for(const n of e)n in t&&(s[n]=t[n]);return s}function xi(t){const e={path:t.path,redirect:t.redirect,name:t.name,meta:t.meta||{},aliasOf:t.aliasOf,beforeEnter:t.beforeEnter,props:pc(t),children:t.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in t?t.components||null:t.component&&{default:t.component}};return Object.defineProperty(e,"mods",{value:{}}),e}function pc(t){const e={},s=t.props||!1;if("component"in t)e.default=s;else for(const n in t.components)e[n]=typeof s=="object"?s[n]:s;return e}function Si(t){for(;t;){if(t.record.aliasOf)return!0;t=t.parent}return!1}function gc(t){return t.reduce((e,s)=>J(e,s.meta),{})}function Ei(t,e){const s={};for(const n in t)s[n]=n in e?e[n]:t[n];return s}function mc(t,e){let s=0,n=e.length;for(;s!==n;){const r=s+n>>1;Xr(t,e[r])<0?n=r:s=r+1}const i=vc(t);return i&&(n=e.lastIndexOf(i,n-1)),n}function vc(t){let e=t;for(;e=e.parent;)if(el(e)&&Xr(t,e)===0)return e}function el({record:t}){return!!(t.name||t.components&&Object.keys(t.components).length||t.redirect)}function bc(t){const e={};if(t===""||t==="?")return e;const n=(t[0]==="?"?t.slice(1):t).split("&");for(let i=0;ir&&cn(r)):[n&&cn(n)]).forEach(r=>{r!==void 0&&(e+=(e.length?"&":"")+s,r!=null&&(e+="="+r))})}return e}function yc(t){const e={};for(const s in t){const n=t[s];n!==void 0&&(e[s]=He(n)?n.map(i=>i==null?null:""+i):n==null?n:""+n)}return e}const Ac=Symbol(""),_i=Symbol(""),kn=Symbol(""),tl=Symbol(""),fn=Symbol("");function Bt(){let t=[];function e(n){return t.push(n),()=>{const i=t.indexOf(n);i>-1&&t.splice(i,1)}}function s(){t=[]}return{add:e,list:()=>t.slice(),reset:s}}function dt(t,e,s,n,i,r=o=>o()){const o=n&&(n.enterCallbacks[i]=n.enterCallbacks[i]||[]);return()=>new Promise((l,a)=>{const u=p=>{p===!1?a(Ft(4,{from:s,to:e})):p instanceof Error?a(p):ic(p)?a(Ft(2,{from:e,to:p})):(o&&n.enterCallbacks[i]===o&&typeof p=="function"&&o.push(p),l())},c=r(()=>t.call(n&&n.instances[i],e,s,u));let f=Promise.resolve(c);t.length<3&&(f=f.then(u)),f.catch(p=>a(p))})}function Gs(t,e,s,n,i=r=>r()){const r=[];for(const o of t)for(const l in o.components){let a=o.components[l];if(!(e!=="beforeRouteEnter"&&!o.instances[l]))if(jr(a)){const c=(a.__vccOpts||a)[e];c&&r.push(dt(c,s,n,o,l,i))}else{let u=a();r.push(()=>u.then(c=>{if(!c)throw new Error(`Couldn't resolve component "${l}" at "${o.path}"`);const f=Oa(c)?c.default:c;o.mods[l]=c,o.components[l]=f;const g=(f.__vccOpts||f)[e];return g&&dt(g,s,n,o,l,i)()}))}}return r}function Oi(t){const e=tt(kn),s=tt(tl),n=Ne(()=>{const a=wt(t.to);return e.resolve(a)}),i=Ne(()=>{const{matched:a}=n.value,{length:u}=a,c=a[u-1],f=s.matched;if(!c||!f.length)return-1;const p=f.findIndex(kt.bind(null,c));if(p>-1)return p;const g=Li(a[u-2]);return u>1&&Li(c)===g&&f[f.length-1].path!==g?f.findIndex(kt.bind(null,a[u-2])):p}),r=Ne(()=>i.value>-1&&Cc(s.params,n.value.params)),o=Ne(()=>i.value>-1&&i.value===s.matched.length-1&&Yr(s.params,n.value.params));function l(a={}){if(Ec(a)){const u=e[wt(t.replace)?"replace":"push"](wt(t.to)).catch(Gt);return t.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>u),u}return Promise.resolve()}return{route:n,href:Ne(()=>n.value.href),isActive:r,isExactActive:o,navigate:l}}function wc(t){return t.length===1?t[0]:t}const xc=Ts({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"},viewTransition:Boolean},useLink:Oi,setup(t,{slots:e}){const s=Os(Oi(t)),{options:n}=tt(kn),i=Ne(()=>({[Ti(t.activeClass,n.linkActiveClass,"router-link-active")]:s.isActive,[Ti(t.exactActiveClass,n.linkExactActiveClass,"router-link-exact-active")]:s.isExactActive}));return()=>{const r=e.default&&wc(e.default(s));return t.custom?r:Ur("a",{"aria-current":s.isExactActive?t.ariaCurrentValue:null,href:s.href,onClick:s.navigate,class:i.value},r)}}}),Sc=xc;function Ec(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&!(t.button!==void 0&&t.button!==0)){if(t.currentTarget&&t.currentTarget.getAttribute){const e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function Cc(t,e){for(const s in e){const n=e[s],i=t[s];if(typeof n=="string"){if(n!==i)return!1}else if(!He(i)||i.length!==n.length||n.some((r,o)=>r!==i[o]))return!1}return!0}function Li(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const Ti=(t,e,s)=>t??e??s,_c=Ts({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(t,{attrs:e,slots:s}){const n=tt(fn),i=Ne(()=>t.route||n.value),r=tt(_i,0),o=Ne(()=>{let u=wt(r);const{matched:c}=i.value;let f;for(;(f=c[u])&&!f.components;)u++;return u}),l=Ne(()=>i.value.matched[o.value]);cs(_i,Ne(()=>o.value+1)),cs(Ac,l),cs(fn,i);const a=ir();return us(()=>[a.value,l.value,t.name],([u,c,f],[p,g,_])=>{c&&(c.instances[f]=u,g&&g!==c&&u&&u===p&&(c.leaveGuards.size||(c.leaveGuards=g.leaveGuards),c.updateGuards.size||(c.updateGuards=g.updateGuards))),u&&c&&(!g||!kt(c,g)||!p)&&(c.enterCallbacks[f]||[]).forEach(C=>C(u))},{flush:"post"}),()=>{const u=i.value,c=t.name,f=l.value,p=f&&f.components[c];if(!p)return Pi(s.default,{Component:p,route:u});const g=f.props[c],_=g?g===!0?u.params:typeof g=="function"?g(u):g:null,D=Ur(p,J({},_,e,{onVnodeUnmounted:T=>{T.component.isUnmounted&&(f.instances[c]=null)},ref:a}));return Pi(s.default,{Component:D,route:u})||D}}});function Pi(t,e){if(!t)return null;const s=t(e);return s.length===1?s[0]:s}const Oc=_c;function Lc(t){const e=dc(t.routes,t),s=t.parseQuery||bc,n=t.stringifyQuery||Ci,i=t.history,r=Bt(),o=Bt(),l=Bt(),a=Ml(ut);let u=ut;Ct&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=zs.bind(null,A=>""+A),f=zs.bind(null,Va),p=zs.bind(null,ss);function g(A,N){let k,B;return Jr(A)?(k=e.getRecordMatcher(A),B=N):B=A,e.addRoute(B,k)}function _(A){const N=e.getRecordMatcher(A);N&&e.removeRoute(N)}function C(){return e.getRoutes().map(A=>A.record)}function D(A){return!!e.getRecordMatcher(A)}function T(A,N){if(N=J({},N||a.value),typeof A=="string"){const v=Ws(s,A,N.path),w=e.resolve({path:v.path},N),E=i.createHref(v.fullPath);return J(v,w,{params:p(w.params),hash:ss(v.hash),redirectedFrom:void 0,href:E})}let k;if(A.path!=null)k=J({},A,{path:Ws(s,A.path,N.path).path});else{const v=J({},A.params);for(const w in v)v[w]==null&&delete v[w];k=J({},A,{params:f(v)}),N.params=f(N.params)}const B=e.resolve(k,N),Y=A.hash||"";B.params=c(p(B.params));const h=ja(n,J({},A,{hash:Na(Y),path:B.path})),d=i.createHref(h);return J({fullPath:h,hash:Y,query:n===Ci?yc(A.query):A.query||{}},B,{redirectedFrom:void 0,href:d})}function m(A){return typeof A=="string"?Ws(s,A,a.value.path):J({},A)}function b(A,N){if(u!==A)return Ft(8,{from:N,to:A})}function y(A){return F(A)}function S(A){return y(J(m(A),{replace:!0}))}function O(A){const N=A.matched[A.matched.length-1];if(N&&N.redirect){const{redirect:k}=N;let B=typeof k=="function"?k(A):k;return typeof B=="string"&&(B=B.includes("?")||B.includes("#")?B=m(B):{path:B},B.params={}),J({query:A.query,hash:A.hash,params:B.path!=null?{}:A.params},B)}}function F(A,N){const k=u=T(A),B=a.value,Y=A.state,h=A.force,d=A.replace===!0,v=O(k);if(v)return F(J(m(v),{state:typeof v=="object"?J({},Y,v.state):Y,force:h,replace:d}),N||k);const w=k;w.redirectedFrom=N;let E;return!h&&za(n,B,k)&&(E=Ft(16,{to:w,from:B}),Ae(B,B,!0,!1)),(E?Promise.resolve(E):K(w,B)).catch(x=>Je(x)?Je(x,2)?x:ye(x):$(x,w,B)).then(x=>{if(x){if(Je(x,2))return F(J({replace:d},m(x.to),{state:typeof x.to=="object"?J({},Y,x.to.state):Y,force:h}),N||w)}else x=pe(w,B,!0,d,Y);return re(w,B,x),x})}function W(A,N){const k=b(A,N);return k?Promise.reject(k):Promise.resolve()}function H(A){const N=we.values().next().value;return N&&typeof N.runWithContext=="function"?N.runWithContext(A):A()}function K(A,N){let k;const[B,Y,h]=Tc(A,N);k=Gs(B.reverse(),"beforeRouteLeave",A,N);for(const v of B)v.leaveGuards.forEach(w=>{k.push(dt(w,A,N))});const d=W.bind(null,A,N);return k.push(d),fe(k).then(()=>{k=[];for(const v of r.list())k.push(dt(v,A,N));return k.push(d),fe(k)}).then(()=>{k=Gs(Y,"beforeRouteUpdate",A,N);for(const v of Y)v.updateGuards.forEach(w=>{k.push(dt(w,A,N))});return k.push(d),fe(k)}).then(()=>{k=[];for(const v of h)if(v.beforeEnter)if(He(v.beforeEnter))for(const w of v.beforeEnter)k.push(dt(w,A,N));else k.push(dt(v.beforeEnter,A,N));return k.push(d),fe(k)}).then(()=>(A.matched.forEach(v=>v.enterCallbacks={}),k=Gs(h,"beforeRouteEnter",A,N,H),k.push(d),fe(k))).then(()=>{k=[];for(const v of o.list())k.push(dt(v,A,N));return k.push(d),fe(k)}).catch(v=>Je(v,8)?v:Promise.reject(v))}function re(A,N,k){l.list().forEach(B=>H(()=>B(A,N,k)))}function pe(A,N,k,B,Y){const h=b(A,N);if(h)return h;const d=N===ut,v=Ct?history.state:{};k&&(B||d?i.replace(A.fullPath,J({scroll:d&&v&&v.scroll},Y)):i.push(A.fullPath,Y)),a.value=A,Ae(A,N,k,d),ye()}let Le;function ot(){Le||(Le=i.listen((A,N,k)=>{if(!Ve.listening)return;const B=T(A),Y=O(B);if(Y){F(J(Y,{replace:!0,force:!0}),B).catch(Gt);return}u=B;const h=a.value;Ct&&Za(mi(h.fullPath,k.delta),ks()),K(B,h).catch(d=>Je(d,12)?d:Je(d,2)?(F(J(m(d.to),{force:!0}),B).then(v=>{Je(v,20)&&!k.delta&&k.type===ns.pop&&i.go(-1,!1)}).catch(Gt),Promise.reject()):(k.delta&&i.go(-k.delta,!1),$(d,B,h))).then(d=>{d=d||pe(B,h,!1),d&&(k.delta&&!Je(d,8)?i.go(-k.delta,!1):k.type===ns.pop&&Je(d,20)&&i.go(-1,!1)),re(B,h,d)}).catch(Gt)}))}let at=Bt(),oe=Bt(),Q;function $(A,N,k){ye(A);const B=oe.list();return B.length?B.forEach(Y=>Y(A,N,k)):console.error(A),Promise.reject(A)}function ae(){return Q&&a.value!==ut?Promise.resolve():new Promise((A,N)=>{at.add([A,N])})}function ye(A){return Q||(Q=!A,ot(),at.list().forEach(([N,k])=>A?k(A):N()),at.reset()),A}function Ae(A,N,k,B){const{scrollBehavior:Y}=t;if(!Ct||!Y)return Promise.resolve();const h=!k&&Xa(mi(A.fullPath,0))||(B||!k)&&history.state&&history.state.scroll||null;return ar().then(()=>Y(A,N,h)).then(d=>d&&Ja(d)).catch(d=>$(d,A,N))}const te=A=>i.go(A);let ct;const we=new Set,Ve={currentRoute:a,listening:!0,addRoute:g,removeRoute:_,clearRoutes:e.clearRoutes,hasRoute:D,getRoutes:C,resolve:T,options:t,push:y,replace:S,go:te,back:()=>te(-1),forward:()=>te(1),beforeEach:r.add,beforeResolve:o.add,afterEach:l.add,onError:oe.add,isReady:ae,install(A){const N=this;A.component("RouterLink",Sc),A.component("RouterView",Oc),A.config.globalProperties.$router=N,Object.defineProperty(A.config.globalProperties,"$route",{enumerable:!0,get:()=>wt(a)}),Ct&&!ct&&a.value===ut&&(ct=!0,y(i.location).catch(Y=>{}));const k={};for(const Y in ut)Object.defineProperty(k,Y,{get:()=>a.value[Y],enumerable:!0});A.provide(kn,N),A.provide(tl,sr(k)),A.provide(fn,a);const B=A.unmount;we.add(A),A.unmount=function(){we.delete(A),we.size<1&&(u=ut,Le&&Le(),Le=null,a.value=ut,ct=!1,Q=!1),B()}}};function fe(A){return A.reduce((N,k)=>N.then(()=>H(k)),Promise.resolve())}return Ve}function Tc(t,e){const s=[],n=[],i=[],r=Math.max(e.matched.length,t.matched.length);for(let o=0;okt(u,l))?n.push(l):s.push(l));const a=t.matched[o];a&&(e.matched.find(u=>kt(u,a))||i.push(a))}return[s,n,i]}const Pc=Lc({history:nc(),linkActiveClass:"active",routes:[{path:"/",name:"Home",component:()=>Qe(()=>import("./home.js"),__vite__mapDeps([0,1]))},{path:"/install",name:"Install",component:()=>Qe(()=>import("./install.js"),[])},{path:"/selects",name:"Selects",component:()=>Qe(()=>import("./selects.js"),[])},{path:"/data",name:"Data",component:()=>Qe(()=>import("./data.js"),[])},{path:"/examples",name:"Examples",component:()=>Qe(()=>import("./index2.js"),__vite__mapDeps([2,3]))},{path:"/settings",name:"Settings",component:()=>Qe(()=>import("./index3.js"),__vite__mapDeps([4,5]))},{path:"/events",name:"Events",component:()=>Qe(()=>import("./index4.js"),[])},{path:"/methods",name:"Methods",component:()=>Qe(()=>import("./index5.js"),[])},{path:"/vue",name:"Vue",component:()=>Qe(()=>import("./vue.js"),[])}]});class Rc{constructor(e){e||(e={}),this.main=e.main||"ss-main",this.placeholder=e.placeholder||"ss-placeholder",this.values=e.values||"ss-values",this.single=e.single||"ss-single",this.max=e.max||"ss-max",this.value=e.value||"ss-value",this.valueText=e.valueText||"ss-value-text",this.valueDelete=e.valueDelete||"ss-value-delete",this.valueOut=e.valueOut||"ss-value-out",this.deselect=e.deselect||"ss-deselect",this.deselectPath=e.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=e.arrow||"ss-arrow",this.arrowClose=e.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=e.arrowOpen||"M10,70 L50,30 L90,70",this.content=e.content||"ss-content",this.openAbove=e.openAbove||"ss-open-above",this.openBelow=e.openBelow||"ss-open-below",this.search=e.search||"ss-search",this.searchHighlighter=e.searchHighlighter||"ss-search-highlight",this.searching=e.searching||"ss-searching",this.addable=e.addable||"ss-addable",this.addablePath=e.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=e.list||"ss-list",this.optgroup=e.optgroup||"ss-optgroup",this.optgroupLabel=e.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=e.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=e.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=e.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=e.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=e.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=e.optgroupClosable||"ss-closable",this.option=e.option||"ss-option",this.optionDelete=e.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=e.highlighted||"ss-highlighted",this.open=e.open||"ss-open",this.close=e.close||"ss-close",this.selected=e.selected||"ss-selected",this.error=e.error||"ss-error",this.disabled=e.disabled||"ss-disabled",this.hide=e.hide||"ss-hide"}}function Fn(){return Math.random().toString(36).substring(2,10)}function Dc(t,e){function s(i,r){return r&&i&&i.classList&&i.classList.contains(r)||r&&i&&i.dataset&&i.dataset.id&&i.dataset.id===e?i:null}function n(i,r){return!i||i===document?null:s(i,r)?i:n(i.parentNode,r)}return s(t,e)||n(t,e)}function Kt(t,e=50,s=!1){let n;return function(...i){const r=self,o=()=>{n=null,s||t.apply(r,i)},l=s&&!n;clearTimeout(n),n=setTimeout(o,e),l&&t.apply(r,i)}}function qs(t,e){return JSON.stringify(t)===JSON.stringify(e)}function kc(t){const e=t.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,s=>"-"+s.toLowerCase());return t[0]===t[0].toUpperCase()?e.substring(1):e}class Me{constructor(e){if(this.id=!e.id||e.id===""?Fn():e.id,this.label=e.label||"",this.selectAll=e.selectAll===void 0?!1:e.selectAll,this.selectAllText=e.selectAllText||"Select All",this.closable=e.closable||"off",this.options=[],e.options)for(const s of e.options)this.options.push(new ue(s))}}class ue{constructor(e){this.id=!e.id||e.id===""?Fn():e.id,this.value=e.value===void 0?e.text:e.value,this.text=e.text||"",this.html=e.html||"",this.defaultSelected=e.defaultSelected!==void 0?e.defaultSelected:!1,this.selected=e.selected!==void 0?e.selected:!1,this.display=e.display!==void 0?e.display:!0,this.disabled=e.disabled!==void 0?e.disabled:!1,this.mandatory=e.mandatory!==void 0?e.mandatory:!1,this.placeholder=e.placeholder!==void 0?e.placeholder:!1,this.class=e.class||"",this.style=e.style||"",this.data=e.data||{}}}class Fc{constructor(e,s){this.selectType="single",this.data=[],this.selectedOrder=[],this.selectType=e,this.setData(s)}validateDataArray(e){if(!Array.isArray(e))return new Error("Data must be an array");for(let s of e)if(s instanceof Me||"label"in s){if(!("label"in s))return new Error("Optgroup must have a label");if("options"in s&&s.options)for(let n of s.options){const i=this.validateOption(n);if(i)return i}}else if(s instanceof ue||"text"in s){const n=this.validateOption(s);if(n)return n}else return new Error("Data object must be a valid optgroup or option");return null}validateOption(e){return"text"in e?null:new Error("Option must have a text")}partialToFullData(e){let s=[];return e.forEach(n=>{if(n instanceof Me||"label"in n){let i=[];"options"in n&&n.options&&n.options.forEach(r=>{i.push(new ue(r))}),i.length>0&&s.push(new Me(n))}(n instanceof ue||"text"in n)&&s.push(new ue(n))}),s}setData(e){this.data=this.partialToFullData(e),this.selectType==="single"&&this.setSelectedBy("id",this.getSelected())}getData(){return this.filter(null,!0)}getDataOptions(){return this.filter(null,!1)}addOption(e,s=!1){if(s){let n=[new ue(e)];this.setData(n.concat(this.getData()))}else this.setData(this.getData().concat(new ue(e)))}setSelectedBy(e,s){let n=null,i=!1;const r=[];for(let l of this.data){if(l instanceof Me)for(let a of l.options)n||(n=a),a.selected=i?!1:s.includes(a[e]),a.selected&&(r.push(a),this.selectType==="single"&&(i=!0));l instanceof ue&&(n||(n=l),l.selected=i?!1:s.includes(l[e]),l.selected&&(r.push(l),this.selectType==="single"&&(i=!0)))}this.selectType==="single"&&n&&!i&&(n.selected=!0,r.push(n));const o=s.map(l=>{var a;return((a=r.find(u=>u[e]===l))==null?void 0:a.id)||""});this.selectedOrder=o}getSelected(){return this.getSelectedOptions().map(e=>e.id)}getSelectedValues(){return this.getSelectedOptions().map(e=>e.value)}getSelectedOptions(){return this.filter(e=>e.selected,!1)}getOptgroupByID(e){for(let s of this.data)if(s instanceof Me&&s.id===e)return s;return null}getOptionByID(e){let s=this.filter(n=>n.id===e,!1);return s.length?s[0]:null}getSelectType(){return this.selectType}getFirstOption(){let e=null;for(let s of this.data)if(s instanceof Me?e=s.options[0]:s instanceof ue&&(e=s),e)break;return e}search(e,s){return e=e.trim(),e===""?this.getData():this.filter(n=>s(n,e),!0)}filter(e,s){const n=[];return this.data.forEach(i=>{if(i instanceof Me){let r=[];if(i.options.forEach(o=>{(!e||e(o))&&(s?r.push(new ue(o)):n.push(new ue(o)))}),r.length>0){let o=new Me(i);o.options=r,n.push(o)}}i instanceof ue&&(!e||e(i))&&n.push(new ue(i))}),n}selectedOrderOptions(e){const s=[];return this.selectedOrder.forEach(n=>{const i=e.find(r=>r.id===n);i&&s.push(i)}),e.forEach(n=>{let i=!1;s.forEach(r=>{if(n.id===r.id){i=!0;return}}),i||s.push(n)}),s}}const ke=class ke{static getLiveAssertive(){let e=document.getElementById("ss-live-assertive");return e||(e=document.createElement("div"),e.id="ss-live-assertive",e.setAttribute("role","status"),e.setAttribute("aria-live","assertive"),e.setAttribute("aria-atomic","true"),e.className="ss-sr-only",document.body.appendChild(e)),e}_announceAssertive(e){const s=ke._liveAssertive||(ke._liveAssertive=ke.getLiveAssertive());s.textContent="",requestAnimationFrame(()=>{s.textContent=e})}constructor(e,s,n,i){var o;this.store=n,this.settings=e,this.classes=s,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes();const r=(o=document.querySelector(`[data-id="${this.settings.id}"]`))==null?void 0:o.closest(".offcanvas-body");r?r.appendChild(this.content.main):this.settings.contentLocation&&this.settings.contentLocation.appendChild(this.content.main)}static getLivePolite(){let e=document.getElementById("ss-live-polite");return e||(e=document.createElement("div"),e.id="ss-live-polite",e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),e.className="ss-sr-only",document.body.appendChild(e)),e}_announcePolite(e){const s=ke._livePolite||(ke._livePolite=ke.getLivePolite());s.textContent="",requestAnimationFrame(()=>{s.textContent=e})}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 e=this.store.getSelectedOptions();if(e.length){const s=e[e.length-1].id,n=this.content.list.querySelector('[data-id="'+s+'"]');n&&this.ensureElementInView(this.content.list,n)}this.settings.contentPosition==="fixed"&&(this.moveContent(),this.scrollHandler=()=>this.moveContent(),this.resizeHandler=()=>this.moveContent(),window.addEventListener("scroll",this.scrollHandler,!0),window.addEventListener("resize",this.resizeHandler)),this.searchFocus()}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),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=void 0),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=void 0),this.main.main.focus({preventScroll:!0}),this.main.main.removeAttribute("aria-activedescendant")}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.main.main.classList.add("ss-2"),this.content.main.classList.add(this.classes.content),this.content.main.classList.add("ss-content-2"),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()));(this.settings.contentPosition==="relative"||this.settings.contentPosition==="fixed")&&this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){this.content.list.setAttribute("role","listbox"),this.content.list.setAttribute("id",this.content.main.id+"-list"),this.content.list.setAttribute("aria-label",this.settings.contentAriaLabel),this.settings.isMultiple?this.content.list.setAttribute("aria-multiselectable","true"):this.content.list.removeAttribute("aria-multiselectable"),this.main.main.setAttribute("role","combobox"),this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.list.id),this.main.main.setAttribute("aria-expanded","false"),this.main.main.setAttribute("aria-autocomplete","list"),this.settings.ariaLabelledBy&&this.settings.ariaLabelledBy.trim()?(this.main.main.setAttribute("aria-labelledby",this.settings.ariaLabelledBy),this.main.main.removeAttribute("aria-label")):this.settings.ariaLabel&&this.settings.ariaLabel.trim()&&this.main.main.setAttribute("aria-label",this.settings.ariaLabel),this.main.main.setAttribute("aria-owns",this.content.list.id),this.content.search.input.setAttribute("aria-controls",this.content.list.id),this.content.search.input.setAttribute("aria-autocomplete","list")}mainDiv(){var u;const e=document.createElement("div");e.id=this.settings.id+"-main",e.tabIndex=0,e.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 f=this.content.list.querySelector("."+this.classes.highlighted);return f&&f.click(),!1;case"Escape":return this.callbacks.close(),!1}return c.key.length===1&&this.callbacks.open(),!0},e.onclick=c=>{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 n=document.createElement("div");n.classList.add(this.classes.deselect),n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label",this.settings.clearAllAriaLabel),n.addEventListener("keydown",c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),n.click())});const i=(u=this.store)==null?void 0:u.getSelectedOptions();!this.settings.allowDeselect||this.settings.isMultiple&&i&&i.length<=0?n.classList.add(this.classes.hide):n.classList.remove(this.classes.hide),n.onclick=c=>{if(c.stopPropagation(),this.settings.disabled)return;let f=!0;const p=this.store.getSelectedOptions(),g=[];if(this.callbacks.beforeChange&&(f=this.callbacks.beforeChange(g,p)===!0),f){if(this.settings.isMultiple)this.callbacks.setSelected([],!1),this.updateDeselectAll();else{const _=this.store.getFirstOption(),C=_?_.id:"";this.callbacks.setSelected(C,!1)}this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(this.store.getSelectedOptions())}};const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("viewBox","0 0 100 100"),r.setAttribute("aria-hidden","true"),r.setAttribute("focusable","false");const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.deselectPath),r.appendChild(o),n.appendChild(r),e.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.classList.add(this.classes.arrow),l.setAttribute("viewBox","0 0 100 100"),l.setAttribute("aria-hidden","true"),l.setAttribute("focusable","false");const a=document.createElementNS("http://www.w3.org/2000/svg","path");return a.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&l.classList.add(this.classes.hide),l.appendChild(a),e.appendChild(l),{main:e,values:s,deselect:{main:n,svg:r,path:o},arrow:{main:l,path:a}}}mainFocus(e){e!=="click"&&this.main.main.focus({preventScroll:!0})}placeholder(){const e=this.store.filter(i=>i.placeholder,!1);let s=this.settings.placeholderText;e.length&&(e[0].html!==""?s=e[0].html:e[0].text!==""&&(s=e[0].text));const n=document.createElement("div");return n.classList.add(this.classes.placeholder),n.innerHTML=s,n}renderValues(){if(!this.settings.isMultiple){this.renderSingleValue();return}this.renderMultipleValues(),this.updateDeselectAll()}renderSingleValue(){const e=this.store.filter(n=>n.selected&&!n.placeholder,!1),s=e.length>0?e[0]:null;if(!s)this.main.values.innerHTML=this.placeholder().outerHTML;else{const n=document.createElement("div");n.classList.add(this.classes.single),s.html?n.innerHTML=s.html:n.innerText=s.text,this.main.values.innerHTML=n.outerHTML}!this.settings.allowDeselect||!e.length?this.main.deselect.main.classList.add(this.classes.hide):this.main.deselect.main.classList.remove(this.classes.hide)}renderMultipleValues(){let e=this.main.values.childNodes,s=this.store.filter(i=>i.selected&&i.display,!1);if(s.length===0){this.main.values.innerHTML=this.placeholder().outerHTML;return}else{const i=this.main.values.querySelector("."+this.classes.placeholder);i&&i.remove()}if(s.length>this.settings.maxValuesShown){const i=document.createElement("div");i.classList.add(this.classes.max),i.textContent=this.settings.maxValuesMessage.replace("{number}",s.length.toString()),this.main.values.innerHTML=i.outerHTML;return}else{const i=this.main.values.querySelector("."+this.classes.max);i&&i.remove()}this.settings.keepOrder&&(s=this.store.selectedOrderOptions(s));let n=[];for(let i=0;ia.id===o,!1).length||n.push(r))}for(const i of n)i.classList.add(this.classes.valueOut),setTimeout(()=>{this.main.values.hasChildNodes()&&this.main.values.contains(i)&&this.main.values.removeChild(i)},100);e=this.main.values.childNodes;for(let i=0;i{if(l.preventDefault(),l.stopPropagation(),this.settings.disabled)return;let a=!0;const u=this.store.getSelectedOptions(),c=u.filter(f=>f.selected&&f.id!==e.id,!0);if(!(this.settings.minSelected&&c.length{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),i.click())}}return s}contentDiv(){const e=document.createElement("div");e.id=this.settings.id+"-content";const s=this.searchDiv();e.appendChild(s.main);const n=this.listDiv();return e.appendChild(n),{main:e,search:s,list:n}}moveContent(){if(this.settings.contentPosition==="relative"){this.moveContentBelow();return}if(this.settings.openPosition==="down"){this.moveContentBelow();return}else if(this.settings.openPosition==="up"){this.moveContentAbove();return}this.putContent()==="up"?this.moveContentAbove():this.moveContentBelow()}searchDiv(){const e=document.createElement("div"),s=document.createElement("input"),n=document.createElement("div");e.classList.add(this.classes.search);const i={main:e,input:s};if(this.settings.showSearch||(e.classList.add(this.classes.hide),s.readOnly=!0),s.type="search",s.placeholder=this.settings.searchPlaceholder,s.tabIndex=-1,this.settings.searchLabelledBy&&this.settings.searchLabelledBy.trim()?s.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel&&this.settings.searchAriaLabel.trim()?s.setAttribute("aria-label",this.settings.searchAriaLabel):s.setAttribute("aria-label","Search options"),s.setAttribute("autocapitalize","off"),s.setAttribute("autocomplete","off"),s.setAttribute("autocorrect","off"),s.oninput=Kt(r=>{this.callbacks.search(r.target.value)},100),s.onkeydown=r=>{switch(r.key){case"ArrowUp":case"ArrowDown":return r.key==="ArrowDown"?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Escape":return this.callbacks.close(),!1;case" ":const o=this.content.list.querySelector("."+this.classes.highlighted);return o?(o.click(),!1):!0;case"Enter":if(this.callbacks.addable)return n.click(),!1;{const l=this.content.list.querySelector("."+this.classes.highlighted);if(l)return l.click(),!1}return!0}return!0},e.appendChild(s),this.callbacks.addable){n.classList.add(this.classes.addable);const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("viewBox","0 0 100 100"),r.setAttribute("aria-hidden","true"),r.setAttribute("focusable","false");const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.addablePath),r.appendChild(o),n.appendChild(r),n.onclick=l=>{if(l.preventDefault(),l.stopPropagation(),!this.callbacks.addable)return;const a=this.content.search.input.value.trim();if(a===""){this.content.search.input.focus();return}const u=f=>{let p=new ue(f);if(this.callbacks.addOption(p),this.settings.isMultiple){let g=this.store.getSelected();g.push(p.id),this.callbacks.setSelected(g,!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(f=>{typeof f=="string"?u({text:f,value:f}):c instanceof Error?this.renderError(c.message):u(f)}):typeof c=="string"?u({text:c,value:c}):c instanceof Error?this.renderError(c.message):u(c))},e.appendChild(n),i.addable={main:n,svg:r,path:o}}return i}searchFocus(){this.content.search.input.focus()}getOptions(e=!1,s=!1,n=!1){let i="."+this.classes.option;return e&&(i+=":not(."+this.classes.placeholder+")"),s&&(i+=":not(."+this.classes.disabled+")"),n&&(i+=":not(."+this.classes.hide+")"),Array.from(this.content.list.querySelectorAll(i))}highlight(e){const s=this.getOptions(!0,!0,!0);if(s.length===0)return;if(s.length===1&&!s[0].classList.contains(this.classes.highlighted)){s[0].classList.add(this.classes.highlighted);return}let n=!1;for(const r of s)r.classList.contains(this.classes.highlighted)&&(n=!0);if(!n){for(const r of s)if(r.classList.contains(this.classes.selected)){r.classList.add(this.classes.highlighted);break}}for(let r=0;r=0?r-1:s.length-1];a.classList.add(this.classes.highlighted),this.main.main.setAttribute("aria-activedescendant",a.id),this.ensureElementInView(this.content.list,a);const u=a.parentElement;if(u&&u.classList.contains(this.classes.close)){const c=u.querySelector("."+this.classes.optgroupLabel);c&&c.click()}return}const i=s[e==="down"?0:s.length-1];i.classList.add(this.classes.highlighted),this.main.main.setAttribute("aria-activedescendant",i.id),this.ensureElementInView(this.content.list,i)}listDiv(){const e=document.createElement("div");return e.classList.add(this.classes.list),e}renderError(e){this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy");const s=document.createElement("div");s.classList.add(this.classes.error),s.textContent=e,this.content.list.appendChild(s),this._announceAssertive(e)}renderSearching(){this.content.list.innerHTML="",this.content.list.setAttribute("aria-busy","true");const e=document.createElement("div");e.classList.add(this.classes.searching),e.textContent=this.settings.searchingText,this.content.list.appendChild(e),this._announcePolite(this.settings.searchingText)}renderOptions(e){if(this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy"),e.length===0){const l=document.createElement("div");l.classList.add(this.classes.search);const a=this.callbacks.addable?this.settings.addableText.replace("{value}",this.content.search.input.value):this.settings.searchText;this._announcePolite(a),l.innerHTML=a,this.content.list.appendChild(l),this.content.list.setAttribute("aria-setsize","0");return}this.settings.allowDeselect&&!this.settings.isMultiple&&(this.store.filter(a=>a.placeholder,!1).length||this.store.addOption(new ue({text:"",value:"",selected:!1,placeholder:!0}),!0));const s=document.createDocumentFragment();let n=0;const i=e.filter(l=>l instanceof ue&&!l.placeholder&&l.display&&!l.disabled).length,r=l=>{!l.classList.contains(this.classes.placeholder)&&!l.classList.contains(this.classes.disabled)&&!l.classList.contains(this.classes.hide)&&(l.setAttribute("aria-posinset",String(++n)),l.setAttribute("aria-setsize",String(i)))};for(const l of e){if(l instanceof Me){const a=document.createElement("div");a.classList.add(this.classes.optgroup),a.setAttribute("role","group"),a.setAttribute("aria-label",l.label);const u=document.createElement("div");u.classList.add(this.classes.optgroupLabel),a.appendChild(u);const c=document.createElement("div");c.classList.add(this.classes.optgroupLabelText),c.textContent=l.label,u.appendChild(c);const f=document.createElement("div");if(f.classList.add(this.classes.optgroupActions),u.appendChild(f),this.settings.isMultiple&&l.selectAll){const p=document.createElement("div");p.classList.add(this.classes.optgroupSelectAll);let g=!0;for(const m of l.options)if(!m.selected){g=!1;break}g&&p.classList.add(this.classes.selected);const _=document.createElement("span");_.textContent=l.selectAllText,p.appendChild(_);const C=document.createElementNS("http://www.w3.org/2000/svg","svg");C.setAttribute("viewBox","0 0 100 100"),C.setAttribute("aria-hidden","true"),C.setAttribute("focusable","false"),p.appendChild(C);const D=document.createElementNS("http://www.w3.org/2000/svg","path");D.setAttribute("d",this.classes.optgroupSelectAllBox),C.appendChild(D);const T=document.createElementNS("http://www.w3.org/2000/svg","path");T.setAttribute("d",this.classes.optgroupSelectAllCheck),C.appendChild(T),p.addEventListener("click",m=>{m.preventDefault(),m.stopPropagation();const b=this.store.getSelected();if(g){const y=b.filter(S=>{for(const O of l.options)if(S===O.id)return!1;return!0});this.callbacks.setSelected(y,!0);return}else{const y=b.concat(l.options.map(S=>S.id));for(const S of l.options)this.store.getOptionByID(S.id)||this.callbacks.addOption(S);this.callbacks.setSelected(y,!0);return}}),f.appendChild(p)}if(l.closable!=="off"){const p=document.createElement("div");p.classList.add(this.classes.optgroupClosable);const g=document.createElementNS("http://www.w3.org/2000/svg","svg");g.setAttribute("viewBox","0 0 100 100"),g.classList.add(this.classes.arrow),g.setAttribute("aria-hidden","true"),g.setAttribute("focusable","false"),p.appendChild(g);const _=document.createElementNS("http://www.w3.org/2000/svg","path");g.appendChild(_),l.options.some(C=>C.selected)||this.content.search.input.value.trim()!==""?(a.classList.add(this.classes.open),_.setAttribute("d",this.classes.arrowOpen)):l.closable==="open"?(a.classList.add(this.classes.open),_.setAttribute("d",this.classes.arrowOpen)):l.closable==="close"&&(a.classList.add(this.classes.close),_.setAttribute("d",this.classes.arrowClose)),u.addEventListener("click",C=>{C.preventDefault(),C.stopPropagation(),a.classList.contains(this.classes.close)?(a.classList.remove(this.classes.close),a.classList.add(this.classes.open),_.setAttribute("d",this.classes.arrowOpen)):(a.classList.remove(this.classes.open),a.classList.add(this.classes.close),_.setAttribute("d",this.classes.arrowClose))}),f.appendChild(p)}a.appendChild(u);for(const p of l.options){const g=this.option(p);r(g),a.appendChild(g)}s.appendChild(a)}if(l instanceof ue){const a=this.option(l);r(a),s.appendChild(a)}}this.content.list.appendChild(s),this.content.list.removeAttribute("aria-busy");const o=this.getOptions(!0,!0,!0).length;this._announcePolite(`${o} option${o===1?"":"s"} available`)}option(e){if(e.placeholder){const n=document.createElement("div");return n.classList.add(this.classes.option),n.classList.add(this.classes.hide),n}const s=document.createElement("div");return s.dataset.id=e.id,s.id=`${this.settings.id}__opt__${e.id}`,s.classList.add(this.classes.option),s.setAttribute("role","option"),e.class&&e.class.split(" ").forEach(n=>{s.classList.add(n)}),e.style&&(s.style.cssText=e.style),this.settings.searchHighlight&&this.content.search.input.value.trim()!==""?s.innerHTML=this.highlightText(e.html!==""?e.html:e.text,this.content.search.input.value,this.classes.searchHighlighter):e.html!==""?s.innerHTML=e.html:s.textContent=e.text,this.settings.showOptionTooltips&&s.textContent&&s.setAttribute("title",s.textContent),e.display||s.classList.add(this.classes.hide),e.disabled&&(s.classList.add(this.classes.disabled),s.setAttribute("aria-disabled","true")),e.selected&&this.settings.hideSelected&&s.classList.add(this.classes.hide),e.selected?(s.classList.add(this.classes.selected),s.setAttribute("aria-selected","true"),this.main.main.setAttribute("aria-activedescendant",s.id)):(s.classList.remove(this.classes.selected),s.setAttribute("aria-selected","false")),s.addEventListener("click",n=>{n.preventDefault(),n.stopPropagation();const i=this.store.getSelected(),r=n.currentTarget,o=String(r.dataset.id);if(e.disabled||e.selected&&!this.settings.allowDeselect||this.settings.isMultiple&&this.settings.maxSelected<=i.length&&!e.selected||this.settings.isMultiple&&this.settings.minSelected>=i.length&&e.selected)return;let l=!1;const a=this.store.getSelectedOptions();let u=[];if(this.settings.isMultiple){if(e.selected)u=a.filter(c=>c.id!==o);else if(u=a.concat(e),!this.settings.closeOnSelect)if(n.shiftKey&&this.lastSelectedOption){const c=this.store.getDataOptions();let f=c.findIndex(g=>g.id===this.lastSelectedOption.id),p=c.findIndex(g=>g.id===e.id);if(f>=0&&p>=0){const g=Math.min(f,p),_=Math.max(f,p),C=c.slice(g,_+1);C.length>0&&C.length!a.find(T=>T.id===D.id))))}}else e.selected||(this.lastSelectedOption=e)}this.settings.isMultiple||(e.selected?u=[]:u=[e]),this.callbacks.beforeChange||(l=!0),this.callbacks.beforeChange&&(this.callbacks.beforeChange(u,a)===!1?l=!1:l=!0),l&&(this.store.getOptionByID(o)||this.callbacks.addOption(e),this.callbacks.setSelected(u.map(c=>c.id),!1),this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(u))}),s}destroy(){this.main.main.remove(),this.content.main.remove()}highlightText(e,s,n){let i=e;const r=new RegExp("(?![^<]*>)("+s.trim()+")(?![^<]*>[^<>]*${a}`),i}moveContentAbove(){const e=this.main.main.offsetHeight,s=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 n=this.main.main.getBoundingClientRect();this.content.main.style.margin="-"+(e+s-1)+"px 0px 0px 0px",this.content.main.style.top=n.top+n.height+(this.settings.contentPosition==="fixed"?0:window.scrollY)+"px",this.content.main.style.left=n.left+(this.settings.contentPosition==="fixed"?0:window.scrollX)+"px",this.content.main.style.width=n.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",this.settings.contentPosition!=="relative"&&(this.content.main.style.top=e.top+e.height+(this.settings.contentPosition==="fixed"?0:window.scrollY)+"px",this.content.main.style.left=e.left+(this.settings.contentPosition==="fixed"?0:window.scrollX)+"px",this.content.main.style.width=e.width+"px")}ensureElementInView(e,s){const n=e.scrollTop+e.offsetTop,i=n+e.clientHeight,r=s.offsetTop,o=r+s.clientHeight;ri&&(e.scrollTop+=o-i)}putContent(){const e=this.main.main.offsetHeight,s=this.main.main.getBoundingClientRect(),n=this.content.main.offsetHeight;return window.innerHeight-(s.top+e)<=n&&s.top>n?"up":"down"}updateDeselectAll(){if(!this.store||!this.settings)return;const e=this.store.getSelectedOptions(),s=e&&e.length>0,n=this.settings.isMultiple,i=this.settings.allowDeselect,r=this.main.deselect.main,o=this.classes.hide;i&&!(n&&!s)?r.classList.remove(o):r.classList.add(o)}};ke._livePolite=null,ke._liveAssertive=null;let hn=ke;class Ic{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.getSelectedOptions()),!0}observeCall(e){if(!this.listen)return;let s=!1,n=!1,i=!1;for(const r of e){if(r.target===this.select&&(r.attributeName==="disabled"&&(n=!0),r.attributeName==="class"&&(s=!0),r.type==="childList")){for(const o of r.addedNodes)if(o.nodeName==="OPTION"&&o.value===this.select.value){this.select.dispatchEvent(new Event("change"));break}i=!0}(r.target.nodeName==="OPTGROUP"||r.target.nodeName==="OPTION")&&(i=!0)}s&&this.onClassChange&&this.onClassChange(this.select.className.split(" ")),n&&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 s=this.select.childNodes;for(const n of s)n.nodeName==="OPTGROUP"&&e.push(this.getDataFromOptgroup(n)),n.nodeName==="OPTION"&&e.push(this.getDataFromOption(n));return e}getDataFromOptgroup(e){let s={id:e.id,label:e.label,selectAll:e.dataset?e.dataset.selectall==="true":!1,selectAllText:e.dataset?e.dataset.selectalltext:"Select all",closable:e.dataset?e.dataset.closable:"off",options:[]};const n=e.childNodes;for(const i of n)i.nodeName==="OPTION"&&s.options.push(this.getDataFromOption(i));return s}getDataFromOption(e){return{id:e.id,value:e.value,text:e.text,html:e.dataset&&e.dataset.html?e.dataset.html:"",defaultSelected:e.defaultSelected,selected:e.selected,display:e.style.display!=="none",disabled:e.disabled,mandatory:e.dataset?e.dataset.mandatory==="true":!1,placeholder:e.dataset.placeholder==="true",class:e.className,style:e.style.cssText,data:e.dataset}}getSelectedOptions(){let e=[];const s=this.select.childNodes;for(const n of s){if(n.nodeName==="OPTGROUP"){const i=n.childNodes;for(const r of i)if(r.nodeName==="OPTION"){const o=r;o.selected&&e.push(this.getDataFromOption(o))}}if(n.nodeName==="OPTION"){const i=n;i.selected&&e.push(this.getDataFromOption(i))}}return e}getSelectedValues(){return this.getSelectedOptions().map(e=>e.value)}setSelected(e){this.changeListen(!1);const s=this.select.childNodes;for(const n of s){if(n.nodeName==="OPTGROUP"){const r=n.childNodes;for(const o of r)if(o.nodeName==="OPTION"){const l=o;l.selected=e.includes(l.id)}}if(n.nodeName==="OPTION"){const i=n;i.selected=e.includes(i.id)}}this.changeListen(!0)}setSelectedByValue(e){this.changeListen(!1);const s=this.select.childNodes;for(const n of s){if(n.nodeName==="OPTGROUP"){const r=n.childNodes;for(const o of r)if(o.nodeName==="OPTION"){const l=o;l.selected=e.includes(l.value)}}if(n.nodeName==="OPTION"){const i=n;i.selected=e.includes(i.value)}}this.changeListen(!0)}updateSelect(e,s,n){this.changeListen(!1),e&&(this.select.dataset.id=e),s&&(this.select.style.cssText=s),n&&(this.select.className="",n.forEach(i=>{i.trim()!==""&&this.select.classList.add(i.trim())})),this.changeListen(!0)}updateOptions(e){this.changeListen(!1),this.select.innerHTML="";for(const s of e)s instanceof Me&&this.select.appendChild(this.createOptgroup(s)),s instanceof ue&&this.select.appendChild(this.createOption(s));this.select.dispatchEvent(new Event("change",{bubbles:!0})),this.changeListen(!0)}createOptgroup(e){const s=document.createElement("optgroup");if(s.id=e.id,s.label=e.label,e.selectAll&&(s.dataset.selectAll="true"),e.closable!=="off"&&(s.dataset.closable=e.closable),e.options)for(const n of e.options)s.appendChild(this.createOption(n));return s}createOption(e){const s=document.createElement("option");return s.id=e.id,s.value=e.value,s.textContent=e.text,e.html!==""&&s.setAttribute("data-html",e.html),s.defaultSelected=e.defaultSelected,s.selected=e.selected,e.disabled&&(s.disabled=!0),e.display||(s.style.display="none"),e.placeholder&&s.setAttribute("data-placeholder","true"),e.mandatory&&s.setAttribute("data-mandatory","true"),e.class&&e.class.split(" ").forEach(n=>{s.classList.add(n)}),e.data&&typeof e.data=="object"&&Object.keys(e.data).forEach(n=>{s.setAttribute("data-"+kc(n),e.data[n])}),s}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 Mc{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-"+Fn(),this.style=e.style||"",this.class=e.class||[],this.disabled=e.disabled!==void 0?e.disabled:!1,this.alwaysOpen=e.alwaysOpen!==void 0?e.alwaysOpen:!1,this.showSearch=e.showSearch!==void 0?e.showSearch:!0,this.focusSearch=e.focusSearch!==void 0?e.focusSearch:!0,this.ariaLabel=e.ariaLabel||"Combobox",this.searchPlaceholder=e.searchPlaceholder||"Search",this.searchText=e.searchText||"No Results",this.searchingText=e.searchingText||"Searching...",this.searchHighlight=e.searchHighlight!==void 0?e.searchHighlight:!1,this.closeOnSelect=e.closeOnSelect!==void 0?e.closeOnSelect:!0,this.contentLocation=e.contentLocation||document.body,this.contentPosition=e.contentPosition||"absolute",this.openPosition=e.openPosition||"auto",this.contentAriaLabel=e.contentAriaLabel!==void 0?e.contentAriaLabel:"Select an option",this.placeholderText=e.placeholderText!==void 0?e.placeholderText:"Select Value",this.allowDeselect=e.allowDeselect!==void 0?e.allowDeselect:!1,this.hideSelected=e.hideSelected!==void 0?e.hideSelected:!1,this.keepOrder=e.keepOrder!==void 0?e.keepOrder:!1,this.showOptionTooltips=e.showOptionTooltips!==void 0?e.showOptionTooltips:!1,this.minSelected=e.minSelected||0,this.maxSelected=e.maxSelected||1e3,this.timeoutDelay=e.timeoutDelay||200,this.maxValuesShown=e.maxValuesShown||20,this.maxValuesMessage=e.maxValuesMessage||"{number} selected",this.addableText=e.addableText||'Press "Enter" to add {value}',this.ariaLabelledBy=e.ariaLabelledBy||"",this.searchAriaLabel=e.searchAriaLabel||"Search options",this.searchLabelledBy=e.searchLabelledBy||"",this.clearAllAriaLabel=e.clearAllAriaLabel||"Clear selection"}}class Nc{constructor(e){var o;if(this.events={search:void 0,searchFilter:(l,a)=>l.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=Kt(()=>{!this.settings.isOpen&&!this.settings.isFullOpen||this.render.moveContent()}),this.windowScroll=Kt(()=>{!this.settings.isOpen&&!this.settings.isFullOpen||this.render.moveContent()}),this.documentClick=l=>{this.settings.isOpen&&l.target&&!Dc(l.target,this.settings.id)&&this.close(l.type)},this.windowVisibilityChange=()=>{document.hidden&&this.close()},this.selectEl=typeof e.select=="string"?document.querySelector(e.select):e.select,!this.selectEl){e.events&&e.events.error&&e.events.error(new Error("Could not find select element"));return}if(this.selectEl.tagName!=="SELECT"){e.events&&e.events.error&&e.events.error(new Error("Element isnt of type select"));return}this.selectEl.dataset.ssid&&this.destroy(),this.settings=new Mc(e.settings),this.cssClasses=new Rc(e.cssClasses);const s=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const l in e.events)e.events.hasOwnProperty(l)&&(s.indexOf(l)!==-1?this.events[l]=Kt(e.events[l],100):this.events[l]=e.events[l]);this.settings.disabled=(o=e.settings)!=null&&o.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 Ic(this.selectEl),this.select.updateSelect(this.settings.id,this.settings.style,this.settings.class),this.select.hideUI(),this.select.onValueChange=l=>{this.setSelected(l.map(a=>a.id))},this.select.onClassChange=l=>{this.settings.class=l,this.render.updateClassStyles()},this.select.onDisabledChange=l=>{l?this.disable():this.enable()},this.select.onOptionsChange=l=>{this.setData(l)},this.store=new Fc(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 hn(this.settings,this.cssClasses,this.store,n),this.render.renderValues(),this.render.renderOptions(this.store.getData());const i=this.selectEl.getAttribute("aria-label"),r=this.selectEl.getAttribute("aria-labelledby");i?this.render.main.main.setAttribute("aria-label",i):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),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(e){const s=this.store.getSelected(),n=this.store.validateDataArray(e);if(n){this.events.error&&this.events.error(n);return}this.store.setData(e);const i=this.store.getData();this.select.updateOptions(i),this.render.renderValues(),this.render.renderOptions(i),this.events.afterChange&&!qs(s,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let e=this.store.getSelectedOptions();return this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e)),e.map(s=>s.value)}setSelected(e,s=!0){const n=this.store.getSelected(),i=this.store.getDataOptions();e=Array.isArray(e)?e:[e];const r=[];for(const l of e){if(i.find(a=>a.id==l)){r.push(l);continue}for(const a of i.filter(u=>u.value==l))r.push(a.id)}this.store.setSelectedBy("id",r);const o=this.store.getData();this.select.updateOptions(o),this.render.renderValues(),this.render.content.search.input.value!==""?this.search(this.render.content.search.input.value):this.render.renderOptions(o),s&&this.events.afterChange&&!qs(n,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}addOption(e){const s=this.store.getSelected();this.store.getDataOptions().some(i=>i.value===(e.value??e.text))||this.store.addOption(e);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!qs(s,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.settings.focusSearch&&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(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){this.render.renderOptions(e===""?this.store.getData():this.store.search(e,this.events.searchFilter));return}this.render.renderSearching();const s=this.events.search(e,this.store.getSelectedOptions());if(s instanceof Promise){s.then(n=>{this.render.renderOptions(this.store.partialToFullData(n))}).catch(n=>{this.render.renderError(typeof n=="string"?n:n.message)});return}else Array.isArray(s)?this.render.renderOptions(this.store.partialToFullData(s)):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 Bc="CWYDT23U",Hc="slimselectjscom",Vc=Ts({__name:"carbonad",setup(t){const e=ir(null);let s=!1;return mr(()=>{const n=window.location.hostname==="localhost";if(!s&&!n){s=!0;const i=document.createElement("script");i.id="_carbonads_js",i.src=`//cdn.carbonads.com/carbon.js?serve=${Bc}&placement=${Hc}`,i.async=!0,e.value&&e.value.appendChild(i)}}),(n,i)=>wt(s)?(Zt(),Nr("div",{key:0,class:"carbon-container",ref_key:"container",ref:e},null,512)):$o("",!0)}}),Uc=Ts({name:"App",components:{CarbonAd:Vc},data(){return{nav:null,navDebounce:Kt(()=>{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:"Examples",closable:"close",options:[{text:"countries",value:"examples#countries"},{text:"form reset",value:"examples#formReset"}]},{label:"Settings",closable:"close",options:[{text:"select",value:"settings#select"},{text:"cssClasses",value:"settings#cssClasses"},{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"}]}]}},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 t=this.$route.hash;if(t===""&&window.scroll({top:0,behavior:"smooth"}),t){const e=document.querySelector(t);if(e){const s=document.querySelector("header"),n=document.querySelector("nav"),i=s?s.clientHeight+(window.innerWidth<700?n.clientHeight:0)+8:0;window.scroll({top:e.offsetTop-i,behavior:"smooth"})}}},200)}),this.setDemensions(),window.addEventListener("resize",this.navDebounce),window.addEventListener("nav-updated",this.updateNav)},unmounted(){var t;window.removeEventListener("resize",this.navDebounce),window.removeEventListener("nav-updated",this.updateNav),(t=this.nav)==null||t.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 t={searchHighlight:!0,openContent:"below"};this.width>700&&(t.alwaysOpen=!0,t.contentPosition="relative",t.contentLocation=this.$refs.navContent),this.nav=new Nc({select:this.$refs.nav,data:this.navData,settings:t,events:{afterChange:e=>{const n=e[0].value.split("#"),i=n[0],r=n[1]?"#"+n[1]:void 0;this.$router.push({path:i,hash:r})}}})},updateNav(){setTimeout(()=>{this.nav&&this.nav.setSelected(this.$router.currentRoute.value.fullPath.replace("/",""))},0)}}}),$c="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",jc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACAAQMAAAD58POIAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZQTFRFyzg3////IltC9QAAAAFiS0dEAf8CLd4AAAAJcEhZcwAACxMAAAsTAQCanBgAAAAkSURBVEjHY2AYBYMV/IeDUQG4AJgeFRgVGBUYFSBNYBQMPgAARjtdvxo6xaMAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTEtMDUtMzBUMjM6MTA6NDQtMDc6MDCm4GvfAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDEwLTEyLTA2VDEyOjIwOjEyLTA4OjAwpIGEmQAAADJ0RVh0UE5HOmNIUk0AY2h1bmsgd2FzIGZvdW5kIChzZWUgQ2hyb21hdGljaXR5LCBhYm92ZSkH0UjaAAAAKXRFWHRQTkc6Z0FNQQBnYW1tYT0wLjQ1NDU1IChTZWUgR2FtbWEsIGFib3ZlKRISLKcAAAAUdEVYdFBORzpJSERSLmJpdF9kZXB0aAA4KYV+UAAAABV0RVh0UE5HOklIRFIuY29sb3JfdHlwZQA2BkqnKwAAABt0RVh0UE5HOklIRFIuaW50ZXJsYWNlX21ldGhvZAAw+zsHjAAAABx0RVh0UE5HOklIRFIud2lkdGgsaGVpZ2h0ADE2LCAxNjjVBg0AAAAodEVYdFBORzpwSFlzAHhfcmVzPTI4MzUsIHlfcmVzPTI4MzUsIHVuaXRzPTGCKXI+AAAAKHRFWHRQTkc6c1JHQgBpbnRlbnQ9MCAoU2VlIFJlbmRlcmluZyBpbnRlbnQp8hEU9QAAAABJRU5ErkJggg==",zc=(t,e)=>{const s=t.__vccOpts||t;for(const[n,i]of e)s[n]=i;return s},Wc={ref:"nav"},Gc={class:"nav-content",ref:"navContent"};function qc(t,e,s,n,i,r){const o=$n("CarbonAd"),l=$n("router-view");return Zt(),Nr(Re,null,[e[4]||(e[4]=Uo('

Slim Select 2.0

Advanced select dropdown
',1)),Ze("nav",null,[Ze("select",Wc,null,512),Ze("div",Gc,null,512),de(o)]),Ze("main",null,[de(l),Ze("footer",null,[ds(" © "+Vi(t.year)+" ",1),e[0]||(e[0]=Ze("a",{href:"http://webiswhatido.com",style:{color:"#ffffff"},target:"_blank"},"Brian Voelker",-1)),e[1]||(e[1]=ds(". ")),e[2]||(e[2]=Ze("br",null,null,-1)),e[3]||(e[3]=ds(" Slim Select is under the MIT license. "))])])],64)}const Kc=zc(Uc,[["render",qc]]);var Ri=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function sl(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ks={exports:{}},Di;function Yc(){return Di||(Di=1,function(t){var e=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};/** + */const Ct=typeof document<"u";function jr(t){return typeof t=="object"||"displayName"in t||"props"in t||"__vccOpts"in t}function Oa(t){return t.__esModule||t[Symbol.toStringTag]==="Module"||t.default&&jr(t.default)}const J=Object.assign;function zs(t,e){const s={};for(const n in e){const i=e[n];s[n]=He(i)?i.map(t):t(i)}return s}const Gt=()=>{},He=Array.isArray,zr=/#/g,La=/&/g,Ta=/\//g,Pa=/=/g,Ra=/\?/g,Wr=/\+/g,Da=/%5B/g,ka=/%5D/g,Gr=/%5E/g,Fa=/%60/g,qr=/%7B/g,Ia=/%7C/g,Kr=/%7D/g,Ma=/%20/g;function Dn(t){return encodeURI(""+t).replace(Ia,"|").replace(Da,"[").replace(ka,"]")}function Na(t){return Dn(t).replace(qr,"{").replace(Kr,"}").replace(Gr,"^")}function cn(t){return Dn(t).replace(Wr,"%2B").replace(Ma,"+").replace(zr,"%23").replace(La,"%26").replace(Fa,"`").replace(qr,"{").replace(Kr,"}").replace(Gr,"^")}function Ba(t){return cn(t).replace(Pa,"%3D")}function Ha(t){return Dn(t).replace(zr,"%23").replace(Ra,"%3F")}function Va(t){return t==null?"":Ha(t).replace(Ta,"%2F")}function ss(t){try{return decodeURIComponent(""+t)}catch{}return""+t}const Ua=/\/$/,$a=t=>t.replace(Ua,"");function Ws(t,e,s="/"){let n,i={},r="",o="";const l=e.indexOf("#");let a=e.indexOf("?");return l=0&&(a=-1),a>-1&&(n=e.slice(0,a),r=e.slice(a+1,l>-1?l:e.length),i=t(r)),l>-1&&(n=n||e.slice(0,l),o=e.slice(l,e.length)),n=Ga(n??e,s),{fullPath:n+(r&&"?")+r+o,path:n,query:i,hash:ss(o)}}function ja(t,e){const s=e.query?t(e.query):"";return e.path+(s&&"?")+s+(e.hash||"")}function pi(t,e){return!e||!t.toLowerCase().startsWith(e.toLowerCase())?t:t.slice(e.length)||"/"}function za(t,e,s){const n=e.matched.length-1,i=s.matched.length-1;return n>-1&&n===i&&kt(e.matched[n],s.matched[i])&&Yr(e.params,s.params)&&t(e.query)===t(s.query)&&e.hash===s.hash}function kt(t,e){return(t.aliasOf||t)===(e.aliasOf||e)}function Yr(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(!Wa(t[s],e[s]))return!1;return!0}function Wa(t,e){return He(t)?gi(t,e):He(e)?gi(e,t):t===e}function gi(t,e){return He(e)?t.length===e.length&&t.every((s,n)=>s===e[n]):t.length===1&&t[0]===e}function Ga(t,e){if(t.startsWith("/"))return t;if(!t)return e;const s=e.split("/"),n=t.split("/"),i=n[n.length-1];(i===".."||i===".")&&n.push("");let r=s.length-1,o,l;for(o=0;o1&&r--;else break;return s.slice(0,r).join("/")+"/"+n.slice(o).join("/")}const ut={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};var ns;(function(t){t.pop="pop",t.push="push"})(ns||(ns={}));var qt;(function(t){t.back="back",t.forward="forward",t.unknown=""})(qt||(qt={}));function qa(t){if(!t)if(Ct){const e=document.querySelector("base");t=e&&e.getAttribute("href")||"/",t=t.replace(/^\w+:\/\/[^\/]+/,"")}else t="/";return t[0]!=="/"&&t[0]!=="#"&&(t="/"+t),$a(t)}const Ka=/^[^#]+#/;function Ya(t,e){return t.replace(Ka,"#")+e}function Qa(t,e){const s=document.documentElement.getBoundingClientRect(),n=t.getBoundingClientRect();return{behavior:e.behavior,left:n.left-s.left-(e.left||0),top:n.top-s.top-(e.top||0)}}const ks=()=>({left:window.scrollX,top:window.scrollY});function Ja(t){let e;if("el"in t){const s=t.el,n=typeof s=="string"&&s.startsWith("#"),i=typeof s=="string"?n?document.getElementById(s.slice(1)):document.querySelector(s):s;if(!i)return;e=Qa(i,t)}else e=t;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.scrollX,e.top!=null?e.top:window.scrollY)}function mi(t,e){return(history.state?history.state.position-e:-1)+t}const un=new Map;function Za(t,e){un.set(t,e)}function Xa(t){const e=un.get(t);return un.delete(t),e}let ec=()=>location.protocol+"//"+location.host;function Qr(t,e){const{pathname:s,search:n,hash:i}=e,r=t.indexOf("#");if(r>-1){let l=i.includes(t.slice(r))?t.slice(r).length:1,a=i.slice(l);return a[0]!=="/"&&(a="/"+a),pi(a,"")}return pi(s,t)+n+i}function tc(t,e,s,n){let i=[],r=[],o=null;const l=({state:p})=>{const g=Qr(t,location),_=s.value,C=e.value;let D=0;if(p){if(s.value=g,e.value=p,o&&o===_){o=null;return}D=C?p.position-C.position:0}else n(g);i.forEach(T=>{T(s.value,_,{delta:D,type:ns.pop,direction:D?D>0?qt.forward:qt.back:qt.unknown})})};function a(){o=s.value}function u(p){i.push(p);const g=()=>{const _=i.indexOf(p);_>-1&&i.splice(_,1)};return r.push(g),g}function c(){const{history:p}=window;p.state&&p.replaceState(J({},p.state,{scroll:ks()}),"")}function f(){for(const p of r)p();r=[],window.removeEventListener("popstate",l),window.removeEventListener("beforeunload",c)}return window.addEventListener("popstate",l),window.addEventListener("beforeunload",c,{passive:!0}),{pauseListeners:a,listen:u,destroy:f}}function vi(t,e,s,n=!1,i=!1){return{back:t,current:e,forward:s,replaced:n,position:window.history.length,scroll:i?ks():null}}function sc(t){const{history:e,location:s}=window,n={value:Qr(t,s)},i={value:e.state};i.value||r(n.value,{back:null,current:n.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function r(a,u,c){const f=t.indexOf("#"),p=f>-1?(s.host&&document.querySelector("base")?t:t.slice(f))+a:ec()+t+a;try{e[c?"replaceState":"pushState"](u,"",p),i.value=u}catch(g){console.error(g),s[c?"replace":"assign"](p)}}function o(a,u){const c=J({},e.state,vi(i.value.back,a,i.value.forward,!0),u,{position:i.value.position});r(a,c,!0),n.value=a}function l(a,u){const c=J({},i.value,e.state,{forward:a,scroll:ks()});r(c.current,c,!0);const f=J({},vi(n.value,a,null),{position:c.position+1},u);r(a,f,!1),n.value=a}return{location:n,state:i,push:l,replace:o}}function nc(t){t=qa(t);const e=sc(t),s=tc(t,e.state,e.location,e.replace);function n(r,o=!0){o||s.pauseListeners(),history.go(r)}const i=J({location:"",base:t,go:n,createHref:Ya.bind(null,t)},e,s);return Object.defineProperty(i,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(i,"state",{enumerable:!0,get:()=>e.state.value}),i}function ic(t){return typeof t=="string"||t&&typeof t=="object"}function Jr(t){return typeof t=="string"||typeof t=="symbol"}const Zr=Symbol("");var bi;(function(t){t[t.aborted=4]="aborted",t[t.cancelled=8]="cancelled",t[t.duplicated=16]="duplicated"})(bi||(bi={}));function Ft(t,e){return J(new Error,{type:t,[Zr]:!0},e)}function Je(t,e){return t instanceof Error&&Zr in t&&(e==null||!!(t.type&e))}const yi="[^/]+?",rc={sensitive:!1,strict:!1,start:!0,end:!0},lc=/[.+*?^${}()[\]/\\]/g;function oc(t,e){const s=J({},rc,e),n=[];let i=s.start?"^":"";const r=[];for(const u of t){const c=u.length?[]:[90];s.strict&&!u.length&&(i+="/");for(let f=0;fe.length?e.length===1&&e[0]===80?1:-1:0}function Xr(t,e){let s=0;const n=t.score,i=e.score;for(;s0&&e[e.length-1]<0}const cc={type:0,value:""},uc=/[a-zA-Z0-9_]/;function fc(t){if(!t)return[[]];if(t==="/")return[[cc]];if(!t.startsWith("/"))throw new Error(`Invalid path "${t}"`);function e(g){throw new Error(`ERR (${s})/"${u}": ${g}`)}let s=0,n=s;const i=[];let r;function o(){r&&i.push(r),r=[]}let l=0,a,u="",c="";function f(){u&&(s===0?r.push({type:0,value:u}):s===1||s===2||s===3?(r.length>1&&(a==="*"||a==="+")&&e(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),r.push({type:1,value:u,regexp:c,repeatable:a==="*"||a==="+",optional:a==="*"||a==="?"})):e("Invalid state to consume buffer"),u="")}function p(){u+=a}for(;l{o(b)}:Gt}function o(f){if(Jr(f)){const p=n.get(f);p&&(n.delete(f),s.splice(s.indexOf(p),1),p.children.forEach(o),p.alias.forEach(o))}else{const p=s.indexOf(f);p>-1&&(s.splice(p,1),f.record.name&&n.delete(f.record.name),f.children.forEach(o),f.alias.forEach(o))}}function l(){return s}function a(f){const p=mc(f,s);s.splice(p,0,f),f.record.name&&!Si(f)&&n.set(f.record.name,f)}function u(f,p){let g,_={},C,D;if("name"in f&&f.name){if(g=n.get(f.name),!g)throw Ft(1,{location:f});D=g.record.name,_=J(wi(p.params,g.keys.filter(b=>!b.optional).concat(g.parent?g.parent.keys.filter(b=>b.optional):[]).map(b=>b.name)),f.params&&wi(f.params,g.keys.map(b=>b.name))),C=g.stringify(_)}else if(f.path!=null)C=f.path,g=s.find(b=>b.re.test(C)),g&&(_=g.parse(C),D=g.record.name);else{if(g=p.name?n.get(p.name):s.find(b=>b.re.test(p.path)),!g)throw Ft(1,{location:f,currentLocation:p});D=g.record.name,_=J({},p.params,f.params),C=g.stringify(_)}const T=[];let m=g;for(;m;)T.unshift(m.record),m=m.parent;return{name:D,path:C,params:_,matched:T,meta:gc(T)}}t.forEach(f=>r(f));function c(){s.length=0,n.clear()}return{addRoute:r,resolve:u,removeRoute:o,clearRoutes:c,getRoutes:l,getRecordMatcher:i}}function wi(t,e){const s={};for(const n of e)n in t&&(s[n]=t[n]);return s}function xi(t){const e={path:t.path,redirect:t.redirect,name:t.name,meta:t.meta||{},aliasOf:t.aliasOf,beforeEnter:t.beforeEnter,props:pc(t),children:t.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in t?t.components||null:t.component&&{default:t.component}};return Object.defineProperty(e,"mods",{value:{}}),e}function pc(t){const e={},s=t.props||!1;if("component"in t)e.default=s;else for(const n in t.components)e[n]=typeof s=="object"?s[n]:s;return e}function Si(t){for(;t;){if(t.record.aliasOf)return!0;t=t.parent}return!1}function gc(t){return t.reduce((e,s)=>J(e,s.meta),{})}function Ei(t,e){const s={};for(const n in t)s[n]=n in e?e[n]:t[n];return s}function mc(t,e){let s=0,n=e.length;for(;s!==n;){const r=s+n>>1;Xr(t,e[r])<0?n=r:s=r+1}const i=vc(t);return i&&(n=e.lastIndexOf(i,n-1)),n}function vc(t){let e=t;for(;e=e.parent;)if(el(e)&&Xr(t,e)===0)return e}function el({record:t}){return!!(t.name||t.components&&Object.keys(t.components).length||t.redirect)}function bc(t){const e={};if(t===""||t==="?")return e;const n=(t[0]==="?"?t.slice(1):t).split("&");for(let i=0;ir&&cn(r)):[n&&cn(n)]).forEach(r=>{r!==void 0&&(e+=(e.length?"&":"")+s,r!=null&&(e+="="+r))})}return e}function yc(t){const e={};for(const s in t){const n=t[s];n!==void 0&&(e[s]=He(n)?n.map(i=>i==null?null:""+i):n==null?n:""+n)}return e}const Ac=Symbol(""),_i=Symbol(""),kn=Symbol(""),tl=Symbol(""),fn=Symbol("");function Bt(){let t=[];function e(n){return t.push(n),()=>{const i=t.indexOf(n);i>-1&&t.splice(i,1)}}function s(){t=[]}return{add:e,list:()=>t.slice(),reset:s}}function dt(t,e,s,n,i,r=o=>o()){const o=n&&(n.enterCallbacks[i]=n.enterCallbacks[i]||[]);return()=>new Promise((l,a)=>{const u=p=>{p===!1?a(Ft(4,{from:s,to:e})):p instanceof Error?a(p):ic(p)?a(Ft(2,{from:e,to:p})):(o&&n.enterCallbacks[i]===o&&typeof p=="function"&&o.push(p),l())},c=r(()=>t.call(n&&n.instances[i],e,s,u));let f=Promise.resolve(c);t.length<3&&(f=f.then(u)),f.catch(p=>a(p))})}function Gs(t,e,s,n,i=r=>r()){const r=[];for(const o of t)for(const l in o.components){let a=o.components[l];if(!(e!=="beforeRouteEnter"&&!o.instances[l]))if(jr(a)){const c=(a.__vccOpts||a)[e];c&&r.push(dt(c,s,n,o,l,i))}else{let u=a();r.push(()=>u.then(c=>{if(!c)throw new Error(`Couldn't resolve component "${l}" at "${o.path}"`);const f=Oa(c)?c.default:c;o.mods[l]=c,o.components[l]=f;const g=(f.__vccOpts||f)[e];return g&&dt(g,s,n,o,l,i)()}))}}return r}function Oi(t){const e=tt(kn),s=tt(tl),n=Ne(()=>{const a=wt(t.to);return e.resolve(a)}),i=Ne(()=>{const{matched:a}=n.value,{length:u}=a,c=a[u-1],f=s.matched;if(!c||!f.length)return-1;const p=f.findIndex(kt.bind(null,c));if(p>-1)return p;const g=Li(a[u-2]);return u>1&&Li(c)===g&&f[f.length-1].path!==g?f.findIndex(kt.bind(null,a[u-2])):p}),r=Ne(()=>i.value>-1&&Cc(s.params,n.value.params)),o=Ne(()=>i.value>-1&&i.value===s.matched.length-1&&Yr(s.params,n.value.params));function l(a={}){if(Ec(a)){const u=e[wt(t.replace)?"replace":"push"](wt(t.to)).catch(Gt);return t.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>u),u}return Promise.resolve()}return{route:n,href:Ne(()=>n.value.href),isActive:r,isExactActive:o,navigate:l}}function wc(t){return t.length===1?t[0]:t}const xc=Ts({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"},viewTransition:Boolean},useLink:Oi,setup(t,{slots:e}){const s=Os(Oi(t)),{options:n}=tt(kn),i=Ne(()=>({[Ti(t.activeClass,n.linkActiveClass,"router-link-active")]:s.isActive,[Ti(t.exactActiveClass,n.linkExactActiveClass,"router-link-exact-active")]:s.isExactActive}));return()=>{const r=e.default&&wc(e.default(s));return t.custom?r:Ur("a",{"aria-current":s.isExactActive?t.ariaCurrentValue:null,href:s.href,onClick:s.navigate,class:i.value},r)}}}),Sc=xc;function Ec(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&!(t.button!==void 0&&t.button!==0)){if(t.currentTarget&&t.currentTarget.getAttribute){const e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function Cc(t,e){for(const s in e){const n=e[s],i=t[s];if(typeof n=="string"){if(n!==i)return!1}else if(!He(i)||i.length!==n.length||n.some((r,o)=>r!==i[o]))return!1}return!0}function Li(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const Ti=(t,e,s)=>t??e??s,_c=Ts({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(t,{attrs:e,slots:s}){const n=tt(fn),i=Ne(()=>t.route||n.value),r=tt(_i,0),o=Ne(()=>{let u=wt(r);const{matched:c}=i.value;let f;for(;(f=c[u])&&!f.components;)u++;return u}),l=Ne(()=>i.value.matched[o.value]);cs(_i,Ne(()=>o.value+1)),cs(Ac,l),cs(fn,i);const a=ir();return us(()=>[a.value,l.value,t.name],([u,c,f],[p,g,_])=>{c&&(c.instances[f]=u,g&&g!==c&&u&&u===p&&(c.leaveGuards.size||(c.leaveGuards=g.leaveGuards),c.updateGuards.size||(c.updateGuards=g.updateGuards))),u&&c&&(!g||!kt(c,g)||!p)&&(c.enterCallbacks[f]||[]).forEach(C=>C(u))},{flush:"post"}),()=>{const u=i.value,c=t.name,f=l.value,p=f&&f.components[c];if(!p)return Pi(s.default,{Component:p,route:u});const g=f.props[c],_=g?g===!0?u.params:typeof g=="function"?g(u):g:null,D=Ur(p,J({},_,e,{onVnodeUnmounted:T=>{T.component.isUnmounted&&(f.instances[c]=null)},ref:a}));return Pi(s.default,{Component:D,route:u})||D}}});function Pi(t,e){if(!t)return null;const s=t(e);return s.length===1?s[0]:s}const Oc=_c;function Lc(t){const e=dc(t.routes,t),s=t.parseQuery||bc,n=t.stringifyQuery||Ci,i=t.history,r=Bt(),o=Bt(),l=Bt(),a=Ml(ut);let u=ut;Ct&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=zs.bind(null,A=>""+A),f=zs.bind(null,Va),p=zs.bind(null,ss);function g(A,N){let k,B;return Jr(A)?(k=e.getRecordMatcher(A),B=N):B=A,e.addRoute(B,k)}function _(A){const N=e.getRecordMatcher(A);N&&e.removeRoute(N)}function C(){return e.getRoutes().map(A=>A.record)}function D(A){return!!e.getRecordMatcher(A)}function T(A,N){if(N=J({},N||a.value),typeof A=="string"){const v=Ws(s,A,N.path),w=e.resolve({path:v.path},N),E=i.createHref(v.fullPath);return J(v,w,{params:p(w.params),hash:ss(v.hash),redirectedFrom:void 0,href:E})}let k;if(A.path!=null)k=J({},A,{path:Ws(s,A.path,N.path).path});else{const v=J({},A.params);for(const w in v)v[w]==null&&delete v[w];k=J({},A,{params:f(v)}),N.params=f(N.params)}const B=e.resolve(k,N),Y=A.hash||"";B.params=c(p(B.params));const h=ja(n,J({},A,{hash:Na(Y),path:B.path})),d=i.createHref(h);return J({fullPath:h,hash:Y,query:n===Ci?yc(A.query):A.query||{}},B,{redirectedFrom:void 0,href:d})}function m(A){return typeof A=="string"?Ws(s,A,a.value.path):J({},A)}function b(A,N){if(u!==A)return Ft(8,{from:N,to:A})}function y(A){return F(A)}function S(A){return y(J(m(A),{replace:!0}))}function O(A){const N=A.matched[A.matched.length-1];if(N&&N.redirect){const{redirect:k}=N;let B=typeof k=="function"?k(A):k;return typeof B=="string"&&(B=B.includes("?")||B.includes("#")?B=m(B):{path:B},B.params={}),J({query:A.query,hash:A.hash,params:B.path!=null?{}:A.params},B)}}function F(A,N){const k=u=T(A),B=a.value,Y=A.state,h=A.force,d=A.replace===!0,v=O(k);if(v)return F(J(m(v),{state:typeof v=="object"?J({},Y,v.state):Y,force:h,replace:d}),N||k);const w=k;w.redirectedFrom=N;let E;return!h&&za(n,B,k)&&(E=Ft(16,{to:w,from:B}),Ae(B,B,!0,!1)),(E?Promise.resolve(E):K(w,B)).catch(x=>Je(x)?Je(x,2)?x:ye(x):$(x,w,B)).then(x=>{if(x){if(Je(x,2))return F(J({replace:d},m(x.to),{state:typeof x.to=="object"?J({},Y,x.to.state):Y,force:h}),N||w)}else x=pe(w,B,!0,d,Y);return re(w,B,x),x})}function W(A,N){const k=b(A,N);return k?Promise.reject(k):Promise.resolve()}function H(A){const N=we.values().next().value;return N&&typeof N.runWithContext=="function"?N.runWithContext(A):A()}function K(A,N){let k;const[B,Y,h]=Tc(A,N);k=Gs(B.reverse(),"beforeRouteLeave",A,N);for(const v of B)v.leaveGuards.forEach(w=>{k.push(dt(w,A,N))});const d=W.bind(null,A,N);return k.push(d),fe(k).then(()=>{k=[];for(const v of r.list())k.push(dt(v,A,N));return k.push(d),fe(k)}).then(()=>{k=Gs(Y,"beforeRouteUpdate",A,N);for(const v of Y)v.updateGuards.forEach(w=>{k.push(dt(w,A,N))});return k.push(d),fe(k)}).then(()=>{k=[];for(const v of h)if(v.beforeEnter)if(He(v.beforeEnter))for(const w of v.beforeEnter)k.push(dt(w,A,N));else k.push(dt(v.beforeEnter,A,N));return k.push(d),fe(k)}).then(()=>(A.matched.forEach(v=>v.enterCallbacks={}),k=Gs(h,"beforeRouteEnter",A,N,H),k.push(d),fe(k))).then(()=>{k=[];for(const v of o.list())k.push(dt(v,A,N));return k.push(d),fe(k)}).catch(v=>Je(v,8)?v:Promise.reject(v))}function re(A,N,k){l.list().forEach(B=>H(()=>B(A,N,k)))}function pe(A,N,k,B,Y){const h=b(A,N);if(h)return h;const d=N===ut,v=Ct?history.state:{};k&&(B||d?i.replace(A.fullPath,J({scroll:d&&v&&v.scroll},Y)):i.push(A.fullPath,Y)),a.value=A,Ae(A,N,k,d),ye()}let Le;function ot(){Le||(Le=i.listen((A,N,k)=>{if(!Ve.listening)return;const B=T(A),Y=O(B);if(Y){F(J(Y,{replace:!0,force:!0}),B).catch(Gt);return}u=B;const h=a.value;Ct&&Za(mi(h.fullPath,k.delta),ks()),K(B,h).catch(d=>Je(d,12)?d:Je(d,2)?(F(J(m(d.to),{force:!0}),B).then(v=>{Je(v,20)&&!k.delta&&k.type===ns.pop&&i.go(-1,!1)}).catch(Gt),Promise.reject()):(k.delta&&i.go(-k.delta,!1),$(d,B,h))).then(d=>{d=d||pe(B,h,!1),d&&(k.delta&&!Je(d,8)?i.go(-k.delta,!1):k.type===ns.pop&&Je(d,20)&&i.go(-1,!1)),re(B,h,d)}).catch(Gt)}))}let at=Bt(),oe=Bt(),Q;function $(A,N,k){ye(A);const B=oe.list();return B.length?B.forEach(Y=>Y(A,N,k)):console.error(A),Promise.reject(A)}function ae(){return Q&&a.value!==ut?Promise.resolve():new Promise((A,N)=>{at.add([A,N])})}function ye(A){return Q||(Q=!A,ot(),at.list().forEach(([N,k])=>A?k(A):N()),at.reset()),A}function Ae(A,N,k,B){const{scrollBehavior:Y}=t;if(!Ct||!Y)return Promise.resolve();const h=!k&&Xa(mi(A.fullPath,0))||(B||!k)&&history.state&&history.state.scroll||null;return ar().then(()=>Y(A,N,h)).then(d=>d&&Ja(d)).catch(d=>$(d,A,N))}const te=A=>i.go(A);let ct;const we=new Set,Ve={currentRoute:a,listening:!0,addRoute:g,removeRoute:_,clearRoutes:e.clearRoutes,hasRoute:D,getRoutes:C,resolve:T,options:t,push:y,replace:S,go:te,back:()=>te(-1),forward:()=>te(1),beforeEach:r.add,beforeResolve:o.add,afterEach:l.add,onError:oe.add,isReady:ae,install(A){const N=this;A.component("RouterLink",Sc),A.component("RouterView",Oc),A.config.globalProperties.$router=N,Object.defineProperty(A.config.globalProperties,"$route",{enumerable:!0,get:()=>wt(a)}),Ct&&!ct&&a.value===ut&&(ct=!0,y(i.location).catch(Y=>{}));const k={};for(const Y in ut)Object.defineProperty(k,Y,{get:()=>a.value[Y],enumerable:!0});A.provide(kn,N),A.provide(tl,sr(k)),A.provide(fn,a);const B=A.unmount;we.add(A),A.unmount=function(){we.delete(A),we.size<1&&(u=ut,Le&&Le(),Le=null,a.value=ut,ct=!1,Q=!1),B()}}};function fe(A){return A.reduce((N,k)=>N.then(()=>H(k)),Promise.resolve())}return Ve}function Tc(t,e){const s=[],n=[],i=[],r=Math.max(e.matched.length,t.matched.length);for(let o=0;okt(u,l))?n.push(l):s.push(l));const a=t.matched[o];a&&(e.matched.find(u=>kt(u,a))||i.push(a))}return[s,n,i]}const Pc=Lc({history:nc(),linkActiveClass:"active",routes:[{path:"/",name:"Home",component:()=>Qe(()=>import("./home.js"),__vite__mapDeps([0,1]))},{path:"/install",name:"Install",component:()=>Qe(()=>import("./install.js"),[])},{path:"/selects",name:"Selects",component:()=>Qe(()=>import("./selects.js"),[])},{path:"/data",name:"Data",component:()=>Qe(()=>import("./data.js"),[])},{path:"/examples",name:"Examples",component:()=>Qe(()=>import("./index2.js"),__vite__mapDeps([2,3]))},{path:"/settings",name:"Settings",component:()=>Qe(()=>import("./index3.js"),__vite__mapDeps([4,5]))},{path:"/events",name:"Events",component:()=>Qe(()=>import("./index4.js"),[])},{path:"/methods",name:"Methods",component:()=>Qe(()=>import("./index5.js"),[])},{path:"/vue",name:"Vue",component:()=>Qe(()=>import("./vue.js"),[])}]});class Rc{constructor(e){e||(e={}),this.main=e.main||"ss-main",this.placeholder=e.placeholder||"ss-placeholder",this.values=e.values||"ss-values",this.single=e.single||"ss-single",this.max=e.max||"ss-max",this.value=e.value||"ss-value",this.valueText=e.valueText||"ss-value-text",this.valueDelete=e.valueDelete||"ss-value-delete",this.valueOut=e.valueOut||"ss-value-out",this.deselect=e.deselect||"ss-deselect",this.deselectPath=e.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=e.arrow||"ss-arrow",this.arrowClose=e.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=e.arrowOpen||"M10,70 L50,30 L90,70",this.content=e.content||"ss-content",this.openAbove=e.openAbove||"ss-open-above",this.openBelow=e.openBelow||"ss-open-below",this.search=e.search||"ss-search",this.searchHighlighter=e.searchHighlighter||"ss-search-highlight",this.searching=e.searching||"ss-searching",this.addable=e.addable||"ss-addable",this.addablePath=e.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=e.list||"ss-list",this.optgroup=e.optgroup||"ss-optgroup",this.optgroupLabel=e.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=e.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=e.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=e.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=e.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=e.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=e.optgroupClosable||"ss-closable",this.option=e.option||"ss-option",this.optionDelete=e.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=e.highlighted||"ss-highlighted",this.open=e.open||"ss-open",this.close=e.close||"ss-close",this.selected=e.selected||"ss-selected",this.error=e.error||"ss-error",this.disabled=e.disabled||"ss-disabled",this.hide=e.hide||"ss-hide"}}function Fn(){return Math.random().toString(36).substring(2,10)}function Dc(t,e){function s(i,r){return r&&i&&i.classList&&i.classList.contains(r)||r&&i&&i.dataset&&i.dataset.id&&i.dataset.id===e?i:null}function n(i,r){return!i||i===document?null:s(i,r)?i:n(i.parentNode,r)}return s(t,e)||n(t,e)}function Kt(t,e=50,s=!1){let n;return function(...i){const r=self,o=()=>{n=null,s||t.apply(r,i)},l=s&&!n;clearTimeout(n),n=setTimeout(o,e),l&&t.apply(r,i)}}function qs(t,e){return JSON.stringify(t)===JSON.stringify(e)}function kc(t){const e=t.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,s=>"-"+s.toLowerCase());return t[0]===t[0].toUpperCase()?e.substring(1):e}class Me{constructor(e){if(this.id=!e.id||e.id===""?Fn():e.id,this.label=e.label||"",this.selectAll=e.selectAll===void 0?!1:e.selectAll,this.selectAllText=e.selectAllText||"Select All",this.closable=e.closable||"off",this.options=[],e.options)for(const s of e.options)this.options.push(new ue(s))}}class ue{constructor(e){this.id=!e.id||e.id===""?Fn():e.id,this.value=e.value===void 0?e.text:e.value,this.text=e.text||"",this.html=e.html||"",this.defaultSelected=e.defaultSelected!==void 0?e.defaultSelected:!1,this.selected=e.selected!==void 0?e.selected:!1,this.display=e.display!==void 0?e.display:!0,this.disabled=e.disabled!==void 0?e.disabled:!1,this.mandatory=e.mandatory!==void 0?e.mandatory:!1,this.placeholder=e.placeholder!==void 0?e.placeholder:!1,this.class=e.class||"",this.style=e.style||"",this.data=e.data||{}}}class Fc{constructor(e,s){this.selectType="single",this.data=[],this.selectedOrder=[],this.selectType=e,this.setData(s)}validateDataArray(e){if(!Array.isArray(e))return new Error("Data must be an array");for(let s of e)if(s instanceof Me||"label"in s){if(!("label"in s))return new Error("Optgroup must have a label");if("options"in s&&s.options)for(let n of s.options){const i=this.validateOption(n);if(i)return i}}else if(s instanceof ue||"text"in s){const n=this.validateOption(s);if(n)return n}else return new Error("Data object must be a valid optgroup or option");return null}validateOption(e){return"text"in e?null:new Error("Option must have a text")}partialToFullData(e){let s=[];return e.forEach(n=>{if(n instanceof Me||"label"in n){let i=[];"options"in n&&n.options&&n.options.forEach(r=>{i.push(new ue(r))}),i.length>0&&s.push(new Me(n))}(n instanceof ue||"text"in n)&&s.push(new ue(n))}),s}setData(e){this.data=this.partialToFullData(e),this.selectType==="single"&&this.setSelectedBy("id",this.getSelected())}getData(){return this.filter(null,!0)}getDataOptions(){return this.filter(null,!1)}addOption(e,s=!1){if(s){let n=[new ue(e)];this.setData(n.concat(this.getData()))}else this.setData(this.getData().concat(new ue(e)))}setSelectedBy(e,s){let n=null,i=!1;const r=[];for(let l of this.data){if(l instanceof Me)for(let a of l.options)n||(n=a),a.selected=i?!1:s.includes(a[e]),a.selected&&(r.push(a),this.selectType==="single"&&(i=!0));l instanceof ue&&(n||(n=l),l.selected=i?!1:s.includes(l[e]),l.selected&&(r.push(l),this.selectType==="single"&&(i=!0)))}this.selectType==="single"&&n&&!i&&(n.selected=!0,r.push(n));const o=s.map(l=>{var a;return((a=r.find(u=>u[e]===l))==null?void 0:a.id)||""});this.selectedOrder=o}getSelected(){return this.getSelectedOptions().map(e=>e.id)}getSelectedValues(){return this.getSelectedOptions().map(e=>e.value)}getSelectedOptions(){return this.filter(e=>e.selected,!1)}getOptgroupByID(e){for(let s of this.data)if(s instanceof Me&&s.id===e)return s;return null}getOptionByID(e){let s=this.filter(n=>n.id===e,!1);return s.length?s[0]:null}getSelectType(){return this.selectType}getFirstOption(){let e=null;for(let s of this.data)if(s instanceof Me?e=s.options[0]:s instanceof ue&&(e=s),e)break;return e}search(e,s){return e=e.trim(),e===""?this.getData():this.filter(n=>s(n,e),!0)}filter(e,s){const n=[];return this.data.forEach(i=>{if(i instanceof Me){let r=[];if(i.options.forEach(o=>{(!e||e(o))&&(s?r.push(new ue(o)):n.push(new ue(o)))}),r.length>0){let o=new Me(i);o.options=r,n.push(o)}}i instanceof ue&&(!e||e(i))&&n.push(new ue(i))}),n}selectedOrderOptions(e){const s=[];return this.selectedOrder.forEach(n=>{const i=e.find(r=>r.id===n);i&&s.push(i)}),e.forEach(n=>{let i=!1;s.forEach(r=>{if(n.id===r.id){i=!0;return}}),i||s.push(n)}),s}}const ke=class ke{static getLiveAssertive(){let e=document.getElementById("ss-live-assertive");return e||(e=document.createElement("div"),e.id="ss-live-assertive",e.setAttribute("role","status"),e.setAttribute("aria-live","assertive"),e.setAttribute("aria-atomic","true"),e.className="ss-sr-only",document.body.appendChild(e)),e}_announceAssertive(e){const s=ke._liveAssertive||(ke._liveAssertive=ke.getLiveAssertive());s.textContent="",requestAnimationFrame(()=>{s.textContent=e})}constructor(e,s,n,i){var o;this.store=n,this.settings=e,this.classes=s,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes();const r=(o=document.querySelector(`[data-id="${this.settings.id}"]`))==null?void 0:o.closest(".offcanvas-body");r?r.appendChild(this.content.main):this.settings.contentLocation&&this.settings.contentLocation.appendChild(this.content.main)}static getLivePolite(){let e=document.getElementById("ss-live-polite");return e||(e=document.createElement("div"),e.id="ss-live-polite",e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),e.className="ss-sr-only",document.body.appendChild(e)),e}_announcePolite(e){const s=ke._livePolite||(ke._livePolite=ke.getLivePolite());s.textContent="",requestAnimationFrame(()=>{s.textContent=e})}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 e=this.store.getSelectedOptions();if(e.length){const s=e[e.length-1].id,n=this.content.list.querySelector('[data-id="'+s+'"]');n&&this.ensureElementInView(this.content.list,n)}this.settings.contentPosition==="fixed"&&(this.moveContent(),this.scrollHandler=()=>this.moveContent(),this.resizeHandler=()=>this.moveContent(),window.addEventListener("scroll",this.scrollHandler,!0),window.addEventListener("resize",this.resizeHandler)),this.searchFocus()}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),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=void 0),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=void 0),this.main.main.focus({preventScroll:!0}),this.main.main.removeAttribute("aria-activedescendant")}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.main.main.classList.add("ss-2"),this.content.main.classList.add(this.classes.content),this.content.main.classList.add("ss-content-2"),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()));(this.settings.contentPosition==="relative"||this.settings.contentPosition==="fixed")&&this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){this.content.list.setAttribute("role","listbox"),this.content.list.setAttribute("id",this.content.main.id+"-list"),this.content.list.setAttribute("aria-label",this.settings.contentAriaLabel),this.settings.isMultiple?this.content.list.setAttribute("aria-multiselectable","true"):this.content.list.removeAttribute("aria-multiselectable"),this.main.main.setAttribute("role","combobox"),this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.list.id),this.main.main.setAttribute("aria-expanded","false"),this.main.main.setAttribute("aria-autocomplete","list"),this.settings.ariaLabelledBy&&this.settings.ariaLabelledBy.trim()?(this.main.main.setAttribute("aria-labelledby",this.settings.ariaLabelledBy),this.main.main.removeAttribute("aria-label")):this.settings.ariaLabel&&this.settings.ariaLabel.trim()&&this.main.main.setAttribute("aria-label",this.settings.ariaLabel),this.main.main.setAttribute("aria-owns",this.content.list.id),this.content.search.input.setAttribute("aria-controls",this.content.list.id),this.content.search.input.setAttribute("aria-autocomplete","list")}mainDiv(){var u;const e=document.createElement("div");e.id=this.settings.id+"-main",e.tabIndex=0,e.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 f=this.content.list.querySelector("."+this.classes.highlighted);return f&&f.click(),!1;case"Escape":return this.callbacks.close(),!1}return c.key.length===1&&this.callbacks.open(),!0},e.onclick=c=>{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 n=document.createElement("div");n.classList.add(this.classes.deselect),n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label",this.settings.clearAllAriaLabel),n.addEventListener("keydown",c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),n.click())});const i=(u=this.store)==null?void 0:u.getSelectedOptions();!this.settings.allowDeselect||this.settings.isMultiple&&i&&i.length<=0?n.classList.add(this.classes.hide):n.classList.remove(this.classes.hide),n.onclick=c=>{if(c.stopPropagation(),this.settings.disabled)return;let f=!0;const p=this.store.getSelectedOptions(),g=[];if(this.callbacks.beforeChange&&(f=this.callbacks.beforeChange(g,p)===!0),f){if(this.settings.isMultiple)this.callbacks.setSelected([],!1),this.updateDeselectAll();else{const _=this.store.getFirstOption(),C=_?_.id:"";this.callbacks.setSelected(C,!1)}this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(this.store.getSelectedOptions())}};const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("viewBox","0 0 100 100"),r.setAttribute("aria-hidden","true"),r.setAttribute("focusable","false");const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.deselectPath),r.appendChild(o),n.appendChild(r),e.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.classList.add(this.classes.arrow),l.setAttribute("viewBox","0 0 100 100"),l.setAttribute("aria-hidden","true"),l.setAttribute("focusable","false");const a=document.createElementNS("http://www.w3.org/2000/svg","path");return a.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&l.classList.add(this.classes.hide),l.appendChild(a),e.appendChild(l),{main:e,values:s,deselect:{main:n,svg:r,path:o},arrow:{main:l,path:a}}}mainFocus(e){e!=="click"&&this.main.main.focus({preventScroll:!0})}placeholder(){const e=this.store.filter(i=>i.placeholder,!1);let s=this.settings.placeholderText;e.length&&(e[0].html!==""?s=e[0].html:e[0].text!==""&&(s=e[0].text));const n=document.createElement("div");return n.classList.add(this.classes.placeholder),n.innerHTML=s,n}renderValues(){if(!this.settings.isMultiple){this.renderSingleValue();return}this.renderMultipleValues(),this.updateDeselectAll()}renderSingleValue(){const e=this.store.filter(n=>n.selected&&!n.placeholder,!1),s=e.length>0?e[0]:null;if(!s)this.main.values.innerHTML=this.placeholder().outerHTML;else{const n=document.createElement("div");n.classList.add(this.classes.single),s.html?n.innerHTML=s.html:n.innerText=s.text,this.main.values.innerHTML=n.outerHTML}!this.settings.allowDeselect||!e.length?this.main.deselect.main.classList.add(this.classes.hide):this.main.deselect.main.classList.remove(this.classes.hide)}renderMultipleValues(){let e=this.main.values.childNodes,s=this.store.filter(i=>i.selected&&i.display,!1);if(s.length===0){this.main.values.innerHTML=this.placeholder().outerHTML;return}else{const i=this.main.values.querySelector("."+this.classes.placeholder);i&&i.remove()}if(s.length>this.settings.maxValuesShown){const i=document.createElement("div");i.classList.add(this.classes.max),i.textContent=this.settings.maxValuesMessage.replace("{number}",s.length.toString()),this.main.values.innerHTML=i.outerHTML;return}else{const i=this.main.values.querySelector("."+this.classes.max);i&&i.remove()}this.settings.keepOrder&&(s=this.store.selectedOrderOptions(s));let n=[];for(let i=0;ia.id===o,!1).length||n.push(r))}for(const i of n)i.classList.add(this.classes.valueOut),setTimeout(()=>{this.main.values.hasChildNodes()&&this.main.values.contains(i)&&this.main.values.removeChild(i)},100);e=this.main.values.childNodes;for(let i=0;i{if(l.preventDefault(),l.stopPropagation(),this.settings.disabled)return;let a=!0;const u=this.store.getSelectedOptions(),c=u.filter(f=>f.selected&&f.id!==e.id,!0);if(!(this.settings.minSelected&&c.length{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),i.click())}}return s}contentDiv(){const e=document.createElement("div");e.id=this.settings.id+"-content";const s=this.searchDiv();e.appendChild(s.main);const n=this.listDiv();return e.appendChild(n),{main:e,search:s,list:n}}moveContent(){if(this.settings.contentPosition==="relative"){this.moveContentBelow();return}if(this.settings.openPosition==="down"){this.moveContentBelow();return}else if(this.settings.openPosition==="up"){this.moveContentAbove();return}this.putContent()==="up"?this.moveContentAbove():this.moveContentBelow()}searchDiv(){const e=document.createElement("div"),s=document.createElement("input"),n=document.createElement("div");e.classList.add(this.classes.search);const i={main:e,input:s};if(this.settings.showSearch||(e.classList.add(this.classes.hide),s.readOnly=!0),s.type="search",s.placeholder=this.settings.searchPlaceholder,s.tabIndex=-1,this.settings.searchLabelledBy&&this.settings.searchLabelledBy.trim()?s.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel&&this.settings.searchAriaLabel.trim()?s.setAttribute("aria-label",this.settings.searchAriaLabel):s.setAttribute("aria-label","Search options"),s.setAttribute("autocapitalize","off"),s.setAttribute("autocomplete","off"),s.setAttribute("autocorrect","off"),s.oninput=Kt(r=>{this.callbacks.search(r.target.value)},100),s.onkeydown=r=>{switch(r.key){case"ArrowUp":case"ArrowDown":return r.key==="ArrowDown"?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Escape":return this.callbacks.close(),!1;case" ":const o=this.content.list.querySelector("."+this.classes.highlighted);return o?(o.click(),!1):!0;case"Enter":if(this.callbacks.addable)return n.click(),!1;{const l=this.content.list.querySelector("."+this.classes.highlighted);if(l)return l.click(),!1}return!0}return!0},e.appendChild(s),this.callbacks.addable){n.classList.add(this.classes.addable);const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("viewBox","0 0 100 100"),r.setAttribute("aria-hidden","true"),r.setAttribute("focusable","false");const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.addablePath),r.appendChild(o),n.appendChild(r),n.onclick=l=>{if(l.preventDefault(),l.stopPropagation(),!this.callbacks.addable)return;const a=this.content.search.input.value.trim();if(a===""){this.content.search.input.focus();return}const u=f=>{let p=new ue(f);if(this.callbacks.addOption(p),this.settings.isMultiple){let g=this.store.getSelected();g.push(p.id),this.callbacks.setSelected(g,!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(f=>{typeof f=="string"?u({text:f,value:f}):c instanceof Error?this.renderError(c.message):u(f)}):typeof c=="string"?u({text:c,value:c}):c instanceof Error?this.renderError(c.message):u(c))},e.appendChild(n),i.addable={main:n,svg:r,path:o}}return i}searchFocus(){this.content.search.input.focus()}getOptions(e=!1,s=!1,n=!1){let i="."+this.classes.option;return e&&(i+=":not(."+this.classes.placeholder+")"),s&&(i+=":not(."+this.classes.disabled+")"),n&&(i+=":not(."+this.classes.hide+")"),Array.from(this.content.list.querySelectorAll(i))}highlight(e){const s=this.getOptions(!0,!0,!0);if(s.length===0)return;if(s.length===1&&!s[0].classList.contains(this.classes.highlighted)){s[0].classList.add(this.classes.highlighted);return}let n=!1;for(const r of s)r.classList.contains(this.classes.highlighted)&&(n=!0);if(!n){for(const r of s)if(r.classList.contains(this.classes.selected)){r.classList.add(this.classes.highlighted);break}}for(let r=0;r=0?r-1:s.length-1];a.classList.add(this.classes.highlighted),this.main.main.setAttribute("aria-activedescendant",a.id),this.ensureElementInView(this.content.list,a);const u=a.parentElement;if(u&&u.classList.contains(this.classes.close)){const c=u.querySelector("."+this.classes.optgroupLabel);c&&c.click()}return}const i=s[e==="down"?0:s.length-1];i.classList.add(this.classes.highlighted),this.main.main.setAttribute("aria-activedescendant",i.id),this.ensureElementInView(this.content.list,i)}listDiv(){const e=document.createElement("div");return e.classList.add(this.classes.list),e}renderError(e){this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy");const s=document.createElement("div");s.classList.add(this.classes.error),s.textContent=e,this.content.list.appendChild(s),this._announceAssertive(e)}renderSearching(){this.content.list.innerHTML="",this.content.list.setAttribute("aria-busy","true");const e=document.createElement("div");e.classList.add(this.classes.searching),e.textContent=this.settings.searchingText,this.content.list.appendChild(e),this._announcePolite(this.settings.searchingText)}renderOptions(e){if(this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy"),e.length===0){const l=document.createElement("div");l.classList.add(this.classes.search);const a=this.callbacks.addable?this.settings.addableText.replace("{value}",this.content.search.input.value):this.settings.searchText;this._announcePolite(a),l.innerHTML=a,this.content.list.appendChild(l),this.content.list.setAttribute("aria-setsize","0");return}this.settings.allowDeselect&&!this.settings.isMultiple&&(this.store.filter(a=>a.placeholder,!1).length||this.store.addOption(new ue({text:"",value:"",selected:!1,placeholder:!0}),!0));const s=document.createDocumentFragment();let n=0;const i=e.filter(l=>l instanceof ue&&!l.placeholder&&l.display&&!l.disabled).length,r=l=>{!l.classList.contains(this.classes.placeholder)&&!l.classList.contains(this.classes.disabled)&&!l.classList.contains(this.classes.hide)&&(l.setAttribute("aria-posinset",String(++n)),l.setAttribute("aria-setsize",String(i)))};for(const l of e){if(l instanceof Me){const a=document.createElement("div");a.classList.add(this.classes.optgroup),a.setAttribute("role","group"),a.setAttribute("aria-label",l.label);const u=document.createElement("div");u.classList.add(this.classes.optgroupLabel),a.appendChild(u);const c=document.createElement("div");c.classList.add(this.classes.optgroupLabelText),c.textContent=l.label,u.appendChild(c);const f=document.createElement("div");if(f.classList.add(this.classes.optgroupActions),u.appendChild(f),this.settings.isMultiple&&l.selectAll){const p=document.createElement("div");p.classList.add(this.classes.optgroupSelectAll);let g=!0;for(const m of l.options)if(!m.selected){g=!1;break}g&&p.classList.add(this.classes.selected);const _=document.createElement("span");_.textContent=l.selectAllText,p.appendChild(_);const C=document.createElementNS("http://www.w3.org/2000/svg","svg");C.setAttribute("viewBox","0 0 100 100"),C.setAttribute("aria-hidden","true"),C.setAttribute("focusable","false"),p.appendChild(C);const D=document.createElementNS("http://www.w3.org/2000/svg","path");D.setAttribute("d",this.classes.optgroupSelectAllBox),C.appendChild(D);const T=document.createElementNS("http://www.w3.org/2000/svg","path");T.setAttribute("d",this.classes.optgroupSelectAllCheck),C.appendChild(T),p.addEventListener("click",m=>{m.preventDefault(),m.stopPropagation();const b=this.store.getSelected();if(g){const y=b.filter(S=>{for(const O of l.options)if(S===O.id)return!1;return!0});this.callbacks.setSelected(y,!0);return}else{const y=b.concat(l.options.map(S=>S.id));for(const S of l.options)this.store.getOptionByID(S.id)||this.callbacks.addOption(S);this.callbacks.setSelected(y,!0);return}}),f.appendChild(p)}if(l.closable!=="off"){const p=document.createElement("div");p.classList.add(this.classes.optgroupClosable);const g=document.createElementNS("http://www.w3.org/2000/svg","svg");g.setAttribute("viewBox","0 0 100 100"),g.classList.add(this.classes.arrow),g.setAttribute("aria-hidden","true"),g.setAttribute("focusable","false"),p.appendChild(g);const _=document.createElementNS("http://www.w3.org/2000/svg","path");g.appendChild(_),l.options.some(C=>C.selected)||this.content.search.input.value.trim()!==""?(a.classList.add(this.classes.open),_.setAttribute("d",this.classes.arrowOpen)):l.closable==="open"?(a.classList.add(this.classes.open),_.setAttribute("d",this.classes.arrowOpen)):l.closable==="close"&&(a.classList.add(this.classes.close),_.setAttribute("d",this.classes.arrowClose)),u.addEventListener("click",C=>{C.preventDefault(),C.stopPropagation(),a.classList.contains(this.classes.close)?(a.classList.remove(this.classes.close),a.classList.add(this.classes.open),_.setAttribute("d",this.classes.arrowOpen)):(a.classList.remove(this.classes.open),a.classList.add(this.classes.close),_.setAttribute("d",this.classes.arrowClose))}),f.appendChild(p)}a.appendChild(u);for(const p of l.options){const g=this.option(p);r(g),a.appendChild(g)}s.appendChild(a)}if(l instanceof ue){const a=this.option(l);r(a),s.appendChild(a)}}this.content.list.appendChild(s),this.content.list.removeAttribute("aria-busy");const o=this.getOptions(!0,!0,!0).length;this._announcePolite(`${o} option${o===1?"":"s"} available`)}option(e){if(e.placeholder){const n=document.createElement("div");return n.classList.add(this.classes.option),n.classList.add(this.classes.hide),n}const s=document.createElement("div");return s.id=`${this.settings.id}__opt__${e.id}`,s.classList.add(this.classes.option),s.setAttribute("role","option"),e.class&&e.class.split(" ").forEach(n=>{s.classList.add(n)}),e.style&&(s.style.cssText=e.style),this.settings.searchHighlight&&this.content.search.input.value.trim()!==""?s.innerHTML=this.highlightText(e.html!==""?e.html:e.text,this.content.search.input.value,this.classes.searchHighlighter):e.html!==""?s.innerHTML=e.html:s.textContent=e.text,this.settings.showOptionTooltips&&s.textContent&&s.setAttribute("title",s.textContent),e.display||s.classList.add(this.classes.hide),e.disabled&&(s.classList.add(this.classes.disabled),s.setAttribute("aria-disabled","true")),e.selected&&this.settings.hideSelected&&s.classList.add(this.classes.hide),e.selected?(s.classList.add(this.classes.selected),s.setAttribute("aria-selected","true"),this.main.main.setAttribute("aria-activedescendant",s.id)):(s.classList.remove(this.classes.selected),s.setAttribute("aria-selected","false")),s.addEventListener("click",n=>{n.preventDefault(),n.stopPropagation();const i=this.store.getSelected(),r=n.currentTarget,o=String(r.dataset.id);if(e.disabled||e.selected&&!this.settings.allowDeselect||this.settings.isMultiple&&this.settings.maxSelected<=i.length&&!e.selected||this.settings.isMultiple&&this.settings.minSelected>=i.length&&e.selected)return;let l=!1;const a=this.store.getSelectedOptions();let u=[];if(this.settings.isMultiple){if(e.selected)u=a.filter(c=>c.id!==o);else if(u=a.concat(e),!this.settings.closeOnSelect)if(n.shiftKey&&this.lastSelectedOption){const c=this.store.getDataOptions();let f=c.findIndex(g=>g.id===this.lastSelectedOption.id),p=c.findIndex(g=>g.id===e.id);if(f>=0&&p>=0){const g=Math.min(f,p),_=Math.max(f,p),C=c.slice(g,_+1);C.length>0&&C.length!a.find(T=>T.id===D.id))))}}else e.selected||(this.lastSelectedOption=e)}this.settings.isMultiple||(e.selected?u=[]:u=[e]),this.callbacks.beforeChange||(l=!0),this.callbacks.beforeChange&&(this.callbacks.beforeChange(u,a)===!1?l=!1:l=!0),l&&(this.store.getOptionByID(o)||this.callbacks.addOption(e),this.callbacks.setSelected(u.map(c=>c.id),!1),this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(u))}),s}destroy(){this.main.main.remove(),this.content.main.remove()}highlightText(e,s,n){let i=e;const r=new RegExp("(?![^<]*>)("+s.trim()+")(?![^<]*>[^<>]*${a}`),i}moveContentAbove(){const e=this.main.main.offsetHeight,s=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 n=this.main.main.getBoundingClientRect();this.content.main.style.margin="-"+(e+s-1)+"px 0px 0px 0px",this.content.main.style.top=n.top+n.height+(this.settings.contentPosition==="fixed"?0:window.scrollY)+"px",this.content.main.style.left=n.left+(this.settings.contentPosition==="fixed"?0:window.scrollX)+"px",this.content.main.style.width=n.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",this.settings.contentPosition!=="relative"&&(this.content.main.style.top=e.top+e.height+(this.settings.contentPosition==="fixed"?0:window.scrollY)+"px",this.content.main.style.left=e.left+(this.settings.contentPosition==="fixed"?0:window.scrollX)+"px",this.content.main.style.width=e.width+"px")}ensureElementInView(e,s){const n=e.scrollTop+e.offsetTop,i=n+e.clientHeight,r=s.offsetTop,o=r+s.clientHeight;ri&&(e.scrollTop+=o-i)}putContent(){const e=this.main.main.offsetHeight,s=this.main.main.getBoundingClientRect(),n=this.content.main.offsetHeight;return window.innerHeight-(s.top+e)<=n&&s.top>n?"up":"down"}updateDeselectAll(){if(!this.store||!this.settings)return;const e=this.store.getSelectedOptions(),s=e&&e.length>0,n=this.settings.isMultiple,i=this.settings.allowDeselect,r=this.main.deselect.main,o=this.classes.hide;i&&!(n&&!s)?r.classList.remove(o):r.classList.add(o)}};ke._livePolite=null,ke._liveAssertive=null;let hn=ke;class Ic{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.getSelectedOptions()),!0}observeCall(e){if(!this.listen)return;let s=!1,n=!1,i=!1;for(const r of e){if(r.target===this.select&&(r.attributeName==="disabled"&&(n=!0),r.attributeName==="class"&&(s=!0),r.type==="childList")){for(const o of r.addedNodes)if(o.nodeName==="OPTION"&&o.value===this.select.value){this.select.dispatchEvent(new Event("change"));break}i=!0}(r.target.nodeName==="OPTGROUP"||r.target.nodeName==="OPTION")&&(i=!0)}s&&this.onClassChange&&this.onClassChange(this.select.className.split(" ")),n&&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 s=this.select.childNodes;for(const n of s)n.nodeName==="OPTGROUP"&&e.push(this.getDataFromOptgroup(n)),n.nodeName==="OPTION"&&e.push(this.getDataFromOption(n));return e}getDataFromOptgroup(e){let s={id:e.id,label:e.label,selectAll:e.dataset?e.dataset.selectall==="true":!1,selectAllText:e.dataset?e.dataset.selectalltext:"Select all",closable:e.dataset?e.dataset.closable:"off",options:[]};const n=e.childNodes;for(const i of n)i.nodeName==="OPTION"&&s.options.push(this.getDataFromOption(i));return s}getDataFromOption(e){return{id:e.id,value:e.value,text:e.text,html:e.dataset&&e.dataset.html?e.dataset.html:"",defaultSelected:e.defaultSelected,selected:e.selected,display:e.style.display!=="none",disabled:e.disabled,mandatory:e.dataset?e.dataset.mandatory==="true":!1,placeholder:e.dataset.placeholder==="true",class:e.className,style:e.style.cssText,data:e.dataset}}getSelectedOptions(){let e=[];const s=this.select.childNodes;for(const n of s){if(n.nodeName==="OPTGROUP"){const i=n.childNodes;for(const r of i)if(r.nodeName==="OPTION"){const o=r;o.selected&&e.push(this.getDataFromOption(o))}}if(n.nodeName==="OPTION"){const i=n;i.selected&&e.push(this.getDataFromOption(i))}}return e}getSelectedValues(){return this.getSelectedOptions().map(e=>e.value)}setSelected(e){this.changeListen(!1);const s=this.select.childNodes;for(const n of s){if(n.nodeName==="OPTGROUP"){const r=n.childNodes;for(const o of r)if(o.nodeName==="OPTION"){const l=o;l.selected=e.includes(l.id)}}if(n.nodeName==="OPTION"){const i=n;i.selected=e.includes(i.id)}}this.changeListen(!0)}setSelectedByValue(e){this.changeListen(!1);const s=this.select.childNodes;for(const n of s){if(n.nodeName==="OPTGROUP"){const r=n.childNodes;for(const o of r)if(o.nodeName==="OPTION"){const l=o;l.selected=e.includes(l.value)}}if(n.nodeName==="OPTION"){const i=n;i.selected=e.includes(i.value)}}this.changeListen(!0)}updateSelect(e,s,n){this.changeListen(!1),e&&(this.select.dataset.id=e),s&&(this.select.style.cssText=s),n&&(this.select.className="",n.forEach(i=>{i.trim()!==""&&this.select.classList.add(i.trim())})),this.changeListen(!0)}updateOptions(e){this.changeListen(!1),this.select.innerHTML="";for(const s of e)s instanceof Me&&this.select.appendChild(this.createOptgroup(s)),s instanceof ue&&this.select.appendChild(this.createOption(s));this.select.dispatchEvent(new Event("change",{bubbles:!0})),this.changeListen(!0)}createOptgroup(e){const s=document.createElement("optgroup");if(s.id=e.id,s.label=e.label,e.selectAll&&(s.dataset.selectAll="true"),e.closable!=="off"&&(s.dataset.closable=e.closable),e.options)for(const n of e.options)s.appendChild(this.createOption(n));return s}createOption(e){const s=document.createElement("option");return s.id=e.id,s.value=e.value,s.textContent=e.text,e.html!==""&&s.setAttribute("data-html",e.html),s.defaultSelected=e.defaultSelected,s.selected=e.selected,e.disabled&&(s.disabled=!0),e.display||(s.style.display="none"),e.placeholder&&s.setAttribute("data-placeholder","true"),e.mandatory&&s.setAttribute("data-mandatory","true"),e.class&&e.class.split(" ").forEach(n=>{s.classList.add(n)}),e.data&&typeof e.data=="object"&&Object.keys(e.data).forEach(n=>{s.setAttribute("data-"+kc(n),e.data[n])}),s}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 Mc{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-"+Fn(),this.style=e.style||"",this.class=e.class||[],this.disabled=e.disabled!==void 0?e.disabled:!1,this.alwaysOpen=e.alwaysOpen!==void 0?e.alwaysOpen:!1,this.showSearch=e.showSearch!==void 0?e.showSearch:!0,this.focusSearch=e.focusSearch!==void 0?e.focusSearch:!0,this.ariaLabel=e.ariaLabel||"Combobox",this.searchPlaceholder=e.searchPlaceholder||"Search",this.searchText=e.searchText||"No Results",this.searchingText=e.searchingText||"Searching...",this.searchHighlight=e.searchHighlight!==void 0?e.searchHighlight:!1,this.closeOnSelect=e.closeOnSelect!==void 0?e.closeOnSelect:!0,this.contentLocation=e.contentLocation||document.body,this.contentPosition=e.contentPosition||"absolute",this.openPosition=e.openPosition||"auto",this.contentAriaLabel=e.contentAriaLabel!==void 0?e.contentAriaLabel:"Select an option",this.placeholderText=e.placeholderText!==void 0?e.placeholderText:"Select Value",this.allowDeselect=e.allowDeselect!==void 0?e.allowDeselect:!1,this.hideSelected=e.hideSelected!==void 0?e.hideSelected:!1,this.keepOrder=e.keepOrder!==void 0?e.keepOrder:!1,this.showOptionTooltips=e.showOptionTooltips!==void 0?e.showOptionTooltips:!1,this.minSelected=e.minSelected||0,this.maxSelected=e.maxSelected||1e3,this.timeoutDelay=e.timeoutDelay||200,this.maxValuesShown=e.maxValuesShown||20,this.maxValuesMessage=e.maxValuesMessage||"{number} selected",this.addableText=e.addableText||'Press "Enter" to add {value}',this.ariaLabelledBy=e.ariaLabelledBy||"",this.searchAriaLabel=e.searchAriaLabel||"Search options",this.searchLabelledBy=e.searchLabelledBy||"",this.clearAllAriaLabel=e.clearAllAriaLabel||"Clear selection"}}class Nc{constructor(e){var o;if(this.events={search:void 0,searchFilter:(l,a)=>l.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=Kt(()=>{!this.settings.isOpen&&!this.settings.isFullOpen||this.render.moveContent()}),this.windowScroll=Kt(()=>{!this.settings.isOpen&&!this.settings.isFullOpen||this.render.moveContent()}),this.documentClick=l=>{this.settings.isOpen&&l.target&&!Dc(l.target,this.settings.id)&&this.close(l.type)},this.windowVisibilityChange=()=>{document.hidden&&this.close()},this.selectEl=typeof e.select=="string"?document.querySelector(e.select):e.select,!this.selectEl){e.events&&e.events.error&&e.events.error(new Error("Could not find select element"));return}if(this.selectEl.tagName!=="SELECT"){e.events&&e.events.error&&e.events.error(new Error("Element isnt of type select"));return}this.selectEl.dataset.ssid&&this.destroy(),this.settings=new Mc(e.settings),this.cssClasses=new Rc(e.cssClasses);const s=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const l in e.events)e.events.hasOwnProperty(l)&&(s.indexOf(l)!==-1?this.events[l]=Kt(e.events[l],100):this.events[l]=e.events[l]);this.settings.disabled=(o=e.settings)!=null&&o.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 Ic(this.selectEl),this.select.updateSelect(this.settings.id,this.settings.style,this.settings.class),this.select.hideUI(),this.select.onValueChange=l=>{this.setSelected(l.map(a=>a.id))},this.select.onClassChange=l=>{this.settings.class=l,this.render.updateClassStyles()},this.select.onDisabledChange=l=>{l?this.disable():this.enable()},this.select.onOptionsChange=l=>{this.setData(l)},this.store=new Fc(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 hn(this.settings,this.cssClasses,this.store,n),this.render.renderValues(),this.render.renderOptions(this.store.getData());const i=this.selectEl.getAttribute("aria-label"),r=this.selectEl.getAttribute("aria-labelledby");i?this.render.main.main.setAttribute("aria-label",i):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),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(e){const s=this.store.getSelected(),n=this.store.validateDataArray(e);if(n){this.events.error&&this.events.error(n);return}this.store.setData(e);const i=this.store.getData();this.select.updateOptions(i),this.render.renderValues(),this.render.renderOptions(i),this.events.afterChange&&!qs(s,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let e=this.store.getSelectedOptions();return this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e)),e.map(s=>s.value)}setSelected(e,s=!0){const n=this.store.getSelected(),i=this.store.getDataOptions();e=Array.isArray(e)?e:[e];const r=[];for(const l of e){if(i.find(a=>a.id==l)){r.push(l);continue}for(const a of i.filter(u=>u.value==l))r.push(a.id)}this.store.setSelectedBy("id",r);const o=this.store.getData();this.select.updateOptions(o),this.render.renderValues(),this.render.content.search.input.value!==""?this.search(this.render.content.search.input.value):this.render.renderOptions(o),s&&this.events.afterChange&&!qs(n,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}addOption(e){const s=this.store.getSelected();this.store.getDataOptions().some(i=>i.value===(e.value??e.text))||this.store.addOption(e);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!qs(s,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.settings.focusSearch&&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(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){this.render.renderOptions(e===""?this.store.getData():this.store.search(e,this.events.searchFilter));return}this.render.renderSearching();const s=this.events.search(e,this.store.getSelectedOptions());if(s instanceof Promise){s.then(n=>{this.render.renderOptions(this.store.partialToFullData(n))}).catch(n=>{this.render.renderError(typeof n=="string"?n:n.message)});return}else Array.isArray(s)?this.render.renderOptions(this.store.partialToFullData(s)):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 Bc="CWYDT23U",Hc="slimselectjscom",Vc=Ts({__name:"carbonad",setup(t){const e=ir(null);let s=!1;return mr(()=>{const n=window.location.hostname==="localhost";if(!s&&!n){s=!0;const i=document.createElement("script");i.id="_carbonads_js",i.src=`//cdn.carbonads.com/carbon.js?serve=${Bc}&placement=${Hc}`,i.async=!0,e.value&&e.value.appendChild(i)}}),(n,i)=>wt(s)?(Zt(),Nr("div",{key:0,class:"carbon-container",ref_key:"container",ref:e},null,512)):$o("",!0)}}),Uc=Ts({name:"App",components:{CarbonAd:Vc},data(){return{nav:null,navDebounce:Kt(()=>{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:"Examples",closable:"close",options:[{text:"countries",value:"examples#countries"},{text:"form reset",value:"examples#formReset"}]},{label:"Settings",closable:"close",options:[{text:"select",value:"settings#select"},{text:"cssClasses",value:"settings#cssClasses"},{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"}]}]}},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 t=this.$route.hash;if(t===""&&window.scroll({top:0,behavior:"smooth"}),t){const e=document.querySelector(t);if(e){const s=document.querySelector("header"),n=document.querySelector("nav"),i=s?s.clientHeight+(window.innerWidth<700?n.clientHeight:0)+8:0;window.scroll({top:e.offsetTop-i,behavior:"smooth"})}}},200)}),this.setDemensions(),window.addEventListener("resize",this.navDebounce),window.addEventListener("nav-updated",this.updateNav)},unmounted(){var t;window.removeEventListener("resize",this.navDebounce),window.removeEventListener("nav-updated",this.updateNav),(t=this.nav)==null||t.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 t={searchHighlight:!0,openContent:"below"};this.width>700&&(t.alwaysOpen=!0,t.contentPosition="relative",t.contentLocation=this.$refs.navContent),this.nav=new Nc({select:this.$refs.nav,data:this.navData,settings:t,events:{afterChange:e=>{const n=e[0].value.split("#"),i=n[0],r=n[1]?"#"+n[1]:void 0;this.$router.push({path:i,hash:r})}}})},updateNav(){setTimeout(()=>{this.nav&&this.nav.setSelected(this.$router.currentRoute.value.fullPath.replace("/",""))},0)}}}),$c="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",jc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACAAQMAAAD58POIAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZQTFRFyzg3////IltC9QAAAAFiS0dEAf8CLd4AAAAJcEhZcwAACxMAAAsTAQCanBgAAAAkSURBVEjHY2AYBYMV/IeDUQG4AJgeFRgVGBUYFSBNYBQMPgAARjtdvxo6xaMAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTEtMDUtMzBUMjM6MTA6NDQtMDc6MDCm4GvfAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDEwLTEyLTA2VDEyOjIwOjEyLTA4OjAwpIGEmQAAADJ0RVh0UE5HOmNIUk0AY2h1bmsgd2FzIGZvdW5kIChzZWUgQ2hyb21hdGljaXR5LCBhYm92ZSkH0UjaAAAAKXRFWHRQTkc6Z0FNQQBnYW1tYT0wLjQ1NDU1IChTZWUgR2FtbWEsIGFib3ZlKRISLKcAAAAUdEVYdFBORzpJSERSLmJpdF9kZXB0aAA4KYV+UAAAABV0RVh0UE5HOklIRFIuY29sb3JfdHlwZQA2BkqnKwAAABt0RVh0UE5HOklIRFIuaW50ZXJsYWNlX21ldGhvZAAw+zsHjAAAABx0RVh0UE5HOklIRFIud2lkdGgsaGVpZ2h0ADE2LCAxNjjVBg0AAAAodEVYdFBORzpwSFlzAHhfcmVzPTI4MzUsIHlfcmVzPTI4MzUsIHVuaXRzPTGCKXI+AAAAKHRFWHRQTkc6c1JHQgBpbnRlbnQ9MCAoU2VlIFJlbmRlcmluZyBpbnRlbnQp8hEU9QAAAABJRU5ErkJggg==",zc=(t,e)=>{const s=t.__vccOpts||t;for(const[n,i]of e)s[n]=i;return s},Wc={ref:"nav"},Gc={class:"nav-content",ref:"navContent"};function qc(t,e,s,n,i,r){const o=$n("CarbonAd"),l=$n("router-view");return Zt(),Nr(Re,null,[e[4]||(e[4]=Uo('

Slim Select 2.0

Advanced select dropdown
',1)),Ze("nav",null,[Ze("select",Wc,null,512),Ze("div",Gc,null,512),de(o)]),Ze("main",null,[de(l),Ze("footer",null,[ds(" © "+Vi(t.year)+" ",1),e[0]||(e[0]=Ze("a",{href:"http://webiswhatido.com",style:{color:"#ffffff"},target:"_blank"},"Brian Voelker",-1)),e[1]||(e[1]=ds(". ")),e[2]||(e[2]=Ze("br",null,null,-1)),e[3]||(e[3]=ds(" Slim Select is under the MIT license. "))])])],64)}const Kc=zc(Uc,[["render",qc]]);var Ri=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function sl(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ks={exports:{}},Di;function Yc(){return Di||(Di=1,function(t){var e=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/render.ts b/src/slim-select/render.ts index 75d246c2..33cdff1f 100644 --- a/src/slim-select/render.ts +++ b/src/slim-select/render.ts @@ -248,14 +248,12 @@ export default class Render { this.content.list.removeAttribute('aria-multiselectable'); } - // Combobox AFTER list has an id this.main.main.setAttribute('role', 'combobox') this.main.main.setAttribute('aria-haspopup', 'listbox'); this.main.main.setAttribute('aria-controls', this.content.list.id); this.main.main.setAttribute('aria-expanded', 'false'); this.main.main.setAttribute('aria-autocomplete', 'list'); - // Label logic if (this.settings.ariaLabelledBy && this.settings.ariaLabelledBy.trim()) { this.main.main.setAttribute('aria-labelledby', this.settings.ariaLabelledBy); this.main.main.removeAttribute('aria-label'); @@ -263,10 +261,8 @@ export default class Render { this.main.main.setAttribute('aria-label', this.settings.ariaLabel); } - // Relations this.main.main.setAttribute('aria-owns', this.content.list.id); - // Search input this.content.search.input.setAttribute('aria-controls', this.content.list.id); this.content.search.input.setAttribute('aria-autocomplete', 'list'); } @@ -1048,7 +1044,6 @@ export default class Render { const newly = options[dir === 'down' ? 0 : options.length - 1]; newly.classList.add(this.classes.highlighted); - // ADD: set aria-activedescendant to the highlighted option's ID this.main.main.setAttribute('aria-activedescendant', newly.id); // Scroll to highlighted one @@ -1105,7 +1100,6 @@ export default class Render { noResults.innerHTML = msg this.content.list.appendChild(noResults) - // Keep setsize accurate on empty state this.content.list.setAttribute('aria-setsize', '0') return } @@ -1139,7 +1133,6 @@ export default class Render { ).length; const tagPos = (el: HTMLDivElement) => { - // mirror the same visibility you use for aria-setsize (not placeholder, not disabled, not hidden) if ( !el.classList.contains(this.classes.placeholder) && !el.classList.contains(this.classes.disabled) && @@ -1357,7 +1350,7 @@ export default class Render { // Create option const optionEl = document.createElement('div') - optionEl.dataset.id = option.id // Dataset id for identifying an option + // optionEl.dataset.id = option.id // Dataset id for identifying an option optionEl.id = `${this.settings.id}__opt__${option.id}`; optionEl.classList.add(this.classes.option) optionEl.setAttribute('role', 'option') // WCAG attribute From 715dc1f626342f288258db1491bc3a5cf1e5a585 Mon Sep 17 00:00:00 2001 From: Tiberiu Dumitru Date: Tue, 2 Sep 2025 10:03:09 +0300 Subject: [PATCH 5/8] Improvement to get label as aria and feedback. --- src/slim-select/render.test.ts | 5 +++- src/slim-select/render.ts | 51 +++++++++++++++++++++++++++----- src/slim-select/settings.test.ts | 2 +- src/slim-select/settings.ts | 2 +- 4 files changed, 49 insertions(+), 11 deletions(-) diff --git a/src/slim-select/render.test.ts b/src/slim-select/render.test.ts index 8a5a30d5..c6f531ef 100644 --- a/src/slim-select/render.test.ts +++ b/src/slim-select/render.test.ts @@ -204,6 +204,7 @@ describe('render module', () => { expect(render.main.main.getAttribute('aria-expanded')).toBe('false') expect(render.content.list.getAttribute('role')).toBe('listbox') expect(render.content.list.getAttribute('aria-label')).toBe(render.settings.contentAriaLabel) + expect(render.main.main.hasAttribute('aria-label')).toBe(false) }) }) @@ -212,7 +213,7 @@ describe('render module', () => { const main = render.main.main expect(main.id).toBe(render.settings.id + '-main') - expect(main.getAttribute('aria-label')).toBe(render.settings.ariaLabel) + expect(main.hasAttribute('aria-label')).toBe(false) expect(main.tabIndex).toBe(0) expect(main.children).toHaveLength(3) expect(main.children.item(0)?.className).toBe(render.classes.values) @@ -1337,6 +1338,7 @@ describe('render module', () => { expect(live).toBeTruthy() expect(live.getAttribute('role')).toBe('status') expect(live.getAttribute('aria-live')).toBe('polite') + expect(live.getAttribute('aria-atomic')).toBe('true') expect(live.textContent).toBe('Searching…') ;(global as any).requestAnimationFrame = rafOrig @@ -1356,6 +1358,7 @@ describe('render module', () => { expect(live).toBeTruthy() expect(live.getAttribute('role')).toBe('status') expect(live.getAttribute('aria-live')).toBe('assertive') + expect(live.getAttribute('aria-atomic')).toBe('true') expect(live.textContent).toBe('Something went wrong') ;(global as any).requestAnimationFrame = rafOrig diff --git a/src/slim-select/render.ts b/src/slim-select/render.ts index 33cdff1f..9df7c9ed 100644 --- a/src/slim-select/render.ts +++ b/src/slim-select/render.ts @@ -244,27 +244,62 @@ export default class Render { this.content.list.setAttribute('aria-label', this.settings.contentAriaLabel); if (this.settings.isMultiple) { this.content.list.setAttribute('aria-multiselectable', 'true'); - } else { - this.content.list.removeAttribute('aria-multiselectable'); } - this.main.main.setAttribute('role', 'combobox') + this.main.main.setAttribute('role', 'combobox'); this.main.main.setAttribute('aria-haspopup', 'listbox'); this.main.main.setAttribute('aria-controls', this.content.list.id); this.main.main.setAttribute('aria-expanded', 'false'); this.main.main.setAttribute('aria-autocomplete', 'list'); + this.main.main.removeAttribute('aria-labelledby'); + this.main.main.removeAttribute('aria-label'); + + let labelledById = (this.settings.ariaLabelledBy || '').trim(); + let labelEl: HTMLLabelElement | null = null; + + if (!labelledById) { + const selectEl = document.querySelector( + `select[data-id="${this.settings.id}"]` + ) as HTMLSelectElement | null; + + if (selectEl) { + if (selectEl.id) { + labelEl = document.querySelector(`label[for="${selectEl.id}"]`) as HTMLLabelElement | null; + } + if (!labelEl && selectEl.previousElementSibling?.tagName === 'LABEL') { + labelEl = selectEl.previousElementSibling as HTMLLabelElement; + } + if (labelEl) { + if (!labelEl.id) { + labelEl.id = (selectEl.id || this.settings.id) + '-label'; + } + labelledById = labelEl.id; + } + } + } else { + labelEl = document.getElementById(labelledById) as HTMLLabelElement | null; + } - if (this.settings.ariaLabelledBy && this.settings.ariaLabelledBy.trim()) { - this.main.main.setAttribute('aria-labelledby', this.settings.ariaLabelledBy); - this.main.main.removeAttribute('aria-label'); + if (labelledById && document.getElementById(labelledById)) { + this.main.main.setAttribute('aria-labelledby', labelledById); } else if (this.settings.ariaLabel && this.settings.ariaLabel.trim()) { - this.main.main.setAttribute('aria-label', this.settings.ariaLabel); + this.main.main.setAttribute('aria-label', this.settings.ariaLabel.trim()); } this.main.main.setAttribute('aria-owns', this.content.list.id); this.content.search.input.setAttribute('aria-controls', this.content.list.id); this.content.search.input.setAttribute('aria-autocomplete', 'list'); + + if (labelledById && document.getElementById(labelledById)) { + this.content.search.input.setAttribute('aria-labelledby', labelledById); + } else if (this.settings.searchLabelledBy && document.getElementById(this.settings.searchLabelledBy)) { + this.content.search.input.setAttribute('aria-labelledby', this.settings.searchLabelledBy); + } else if (this.settings.searchAriaLabel) { + this.content.search.input.setAttribute('aria-label', this.settings.searchAriaLabel); + } else { + this.content.search.input.setAttribute('aria-label', 'Search options'); + } } public mainDiv(): Main { @@ -1350,7 +1385,7 @@ export default class Render { // Create option const optionEl = document.createElement('div') - // optionEl.dataset.id = option.id // Dataset id for identifying an option + optionEl.dataset.id = option.id // Dataset id for identifying an option optionEl.id = `${this.settings.id}__opt__${option.id}`; optionEl.classList.add(this.classes.option) optionEl.setAttribute('role', 'option') // WCAG attribute diff --git a/src/slim-select/settings.test.ts b/src/slim-select/settings.test.ts index bd33eabf..0ded3f57 100644 --- a/src/slim-select/settings.test.ts +++ b/src/slim-select/settings.test.ts @@ -17,7 +17,7 @@ const defaultSettings: { [key: string]: any } = { alwaysOpen: false, showSearch: true, focusSearch: true, - ariaLabel: 'Combobox', + ariaLabel: '', searchPlaceholder: 'Search', searchText: 'No Results', searchingText: 'Searching...', diff --git a/src/slim-select/settings.ts b/src/slim-select/settings.ts index ba387e8c..728e86dc 100644 --- a/src/slim-select/settings.ts +++ b/src/slim-select/settings.ts @@ -57,7 +57,7 @@ export default class Settings { this.alwaysOpen = settings.alwaysOpen !== undefined ? settings.alwaysOpen : false this.showSearch = settings.showSearch !== undefined ? settings.showSearch : true this.focusSearch = settings.focusSearch !== undefined ? settings.focusSearch : true - this.ariaLabel = settings.ariaLabel || 'Combobox' + this.ariaLabel = settings.ariaLabel || '' this.searchPlaceholder = settings.searchPlaceholder || 'Search' this.searchText = settings.searchText || 'No Results' this.searchingText = settings.searchingText || 'Searching...' From 5f40708f46b54d0a06a37a1610c6500a3dd94eef Mon Sep 17 00:00:00 2001 From: Tiberiu Dumitru Date: Tue, 2 Sep 2025 10:47:54 +0300 Subject: [PATCH 6/8] Build --- dist/slimselect.cjs.js | 50 ++++++++++++++++++++++++++++++++------ dist/slimselect.es.js | 50 ++++++++++++++++++++++++++++++++------ dist/slimselect.global.js | 50 ++++++++++++++++++++++++++++++++------ dist/slimselect.js | 50 ++++++++++++++++++++++++++++++++------ dist/slimselect.min.js | 2 +- dist/slimselect.umd.js | 50 ++++++++++++++++++++++++++++++++------ dist/slimselect.umd.min.js | 2 +- docs/assets/index.js | 14 +++++------ 8 files changed, 219 insertions(+), 49 deletions(-) diff --git a/dist/slimselect.cjs.js b/dist/slimselect.cjs.js index c6ae4b3f..76d4dc09 100644 --- a/dist/slimselect.cjs.js +++ b/dist/slimselect.cjs.js @@ -495,30 +495,63 @@ class Render { } } updateAriaAttributes() { + var _a; this.content.list.setAttribute('role', 'listbox'); this.content.list.setAttribute('id', this.content.main.id + '-list'); this.content.list.setAttribute('aria-label', this.settings.contentAriaLabel); if (this.settings.isMultiple) { this.content.list.setAttribute('aria-multiselectable', 'true'); } - else { - this.content.list.removeAttribute('aria-multiselectable'); - } this.main.main.setAttribute('role', 'combobox'); this.main.main.setAttribute('aria-haspopup', 'listbox'); this.main.main.setAttribute('aria-controls', this.content.list.id); this.main.main.setAttribute('aria-expanded', 'false'); this.main.main.setAttribute('aria-autocomplete', 'list'); - if (this.settings.ariaLabelledBy && this.settings.ariaLabelledBy.trim()) { - this.main.main.setAttribute('aria-labelledby', this.settings.ariaLabelledBy); - this.main.main.removeAttribute('aria-label'); + this.main.main.removeAttribute('aria-labelledby'); + this.main.main.removeAttribute('aria-label'); + let labelledById = (this.settings.ariaLabelledBy || '').trim(); + let labelEl = null; + if (!labelledById) { + const selectEl = document.querySelector(`select[data-id="${this.settings.id}"]`); + if (selectEl) { + if (selectEl.id) { + labelEl = document.querySelector(`label[for="${selectEl.id}"]`); + } + if (!labelEl && ((_a = selectEl.previousElementSibling) === null || _a === void 0 ? void 0 : _a.tagName) === 'LABEL') { + labelEl = selectEl.previousElementSibling; + } + if (labelEl) { + if (!labelEl.id) { + labelEl.id = (selectEl.id || this.settings.id) + '-label'; + } + labelledById = labelEl.id; + } + } + } + else { + labelEl = document.getElementById(labelledById); + } + if (labelledById && document.getElementById(labelledById)) { + this.main.main.setAttribute('aria-labelledby', labelledById); } else if (this.settings.ariaLabel && this.settings.ariaLabel.trim()) { - this.main.main.setAttribute('aria-label', this.settings.ariaLabel); + this.main.main.setAttribute('aria-label', this.settings.ariaLabel.trim()); } this.main.main.setAttribute('aria-owns', this.content.list.id); this.content.search.input.setAttribute('aria-controls', this.content.list.id); this.content.search.input.setAttribute('aria-autocomplete', 'list'); + if (labelledById && document.getElementById(labelledById)) { + this.content.search.input.setAttribute('aria-labelledby', labelledById); + } + else if (this.settings.searchLabelledBy && document.getElementById(this.settings.searchLabelledBy)) { + this.content.search.input.setAttribute('aria-labelledby', this.settings.searchLabelledBy); + } + else if (this.settings.searchAriaLabel) { + this.content.search.input.setAttribute('aria-label', this.settings.searchAriaLabel); + } + else { + this.content.search.input.setAttribute('aria-label', 'Search options'); + } } mainDiv() { var _a; @@ -1302,6 +1335,7 @@ class Render { return placeholder; } const optionEl = document.createElement('div'); + optionEl.dataset.id = option.id; optionEl.id = `${this.settings.id}__opt__${option.id}`; optionEl.classList.add(this.classes.option); optionEl.setAttribute('role', 'option'); @@ -1841,7 +1875,7 @@ class Settings { this.alwaysOpen = settings.alwaysOpen !== undefined ? settings.alwaysOpen : false; this.showSearch = settings.showSearch !== undefined ? settings.showSearch : true; this.focusSearch = settings.focusSearch !== undefined ? settings.focusSearch : true; - this.ariaLabel = settings.ariaLabel || 'Combobox'; + this.ariaLabel = settings.ariaLabel || ''; this.searchPlaceholder = settings.searchPlaceholder || 'Search'; this.searchText = settings.searchText || 'No Results'; this.searchingText = settings.searchingText || 'Searching...'; diff --git a/dist/slimselect.es.js b/dist/slimselect.es.js index 6d1b8e53..96681fc4 100644 --- a/dist/slimselect.es.js +++ b/dist/slimselect.es.js @@ -493,30 +493,63 @@ class Render { } } updateAriaAttributes() { + var _a; this.content.list.setAttribute('role', 'listbox'); this.content.list.setAttribute('id', this.content.main.id + '-list'); this.content.list.setAttribute('aria-label', this.settings.contentAriaLabel); if (this.settings.isMultiple) { this.content.list.setAttribute('aria-multiselectable', 'true'); } - else { - this.content.list.removeAttribute('aria-multiselectable'); - } this.main.main.setAttribute('role', 'combobox'); this.main.main.setAttribute('aria-haspopup', 'listbox'); this.main.main.setAttribute('aria-controls', this.content.list.id); this.main.main.setAttribute('aria-expanded', 'false'); this.main.main.setAttribute('aria-autocomplete', 'list'); - if (this.settings.ariaLabelledBy && this.settings.ariaLabelledBy.trim()) { - this.main.main.setAttribute('aria-labelledby', this.settings.ariaLabelledBy); - this.main.main.removeAttribute('aria-label'); + this.main.main.removeAttribute('aria-labelledby'); + this.main.main.removeAttribute('aria-label'); + let labelledById = (this.settings.ariaLabelledBy || '').trim(); + let labelEl = null; + if (!labelledById) { + const selectEl = document.querySelector(`select[data-id="${this.settings.id}"]`); + if (selectEl) { + if (selectEl.id) { + labelEl = document.querySelector(`label[for="${selectEl.id}"]`); + } + if (!labelEl && ((_a = selectEl.previousElementSibling) === null || _a === void 0 ? void 0 : _a.tagName) === 'LABEL') { + labelEl = selectEl.previousElementSibling; + } + if (labelEl) { + if (!labelEl.id) { + labelEl.id = (selectEl.id || this.settings.id) + '-label'; + } + labelledById = labelEl.id; + } + } + } + else { + labelEl = document.getElementById(labelledById); + } + if (labelledById && document.getElementById(labelledById)) { + this.main.main.setAttribute('aria-labelledby', labelledById); } else if (this.settings.ariaLabel && this.settings.ariaLabel.trim()) { - this.main.main.setAttribute('aria-label', this.settings.ariaLabel); + this.main.main.setAttribute('aria-label', this.settings.ariaLabel.trim()); } this.main.main.setAttribute('aria-owns', this.content.list.id); this.content.search.input.setAttribute('aria-controls', this.content.list.id); this.content.search.input.setAttribute('aria-autocomplete', 'list'); + if (labelledById && document.getElementById(labelledById)) { + this.content.search.input.setAttribute('aria-labelledby', labelledById); + } + else if (this.settings.searchLabelledBy && document.getElementById(this.settings.searchLabelledBy)) { + this.content.search.input.setAttribute('aria-labelledby', this.settings.searchLabelledBy); + } + else if (this.settings.searchAriaLabel) { + this.content.search.input.setAttribute('aria-label', this.settings.searchAriaLabel); + } + else { + this.content.search.input.setAttribute('aria-label', 'Search options'); + } } mainDiv() { var _a; @@ -1300,6 +1333,7 @@ class Render { return placeholder; } const optionEl = document.createElement('div'); + optionEl.dataset.id = option.id; optionEl.id = `${this.settings.id}__opt__${option.id}`; optionEl.classList.add(this.classes.option); optionEl.setAttribute('role', 'option'); @@ -1839,7 +1873,7 @@ class Settings { this.alwaysOpen = settings.alwaysOpen !== undefined ? settings.alwaysOpen : false; this.showSearch = settings.showSearch !== undefined ? settings.showSearch : true; this.focusSearch = settings.focusSearch !== undefined ? settings.focusSearch : true; - this.ariaLabel = settings.ariaLabel || 'Combobox'; + this.ariaLabel = settings.ariaLabel || ''; this.searchPlaceholder = settings.searchPlaceholder || 'Search'; this.searchText = settings.searchText || 'No Results'; this.searchingText = settings.searchingText || 'Searching...'; diff --git a/dist/slimselect.global.js b/dist/slimselect.global.js index b0db4a2f..9ff98bd9 100644 --- a/dist/slimselect.global.js +++ b/dist/slimselect.global.js @@ -496,30 +496,63 @@ var SlimSelect = (function () { } } updateAriaAttributes() { + var _a; this.content.list.setAttribute('role', 'listbox'); this.content.list.setAttribute('id', this.content.main.id + '-list'); this.content.list.setAttribute('aria-label', this.settings.contentAriaLabel); if (this.settings.isMultiple) { this.content.list.setAttribute('aria-multiselectable', 'true'); } - else { - this.content.list.removeAttribute('aria-multiselectable'); - } this.main.main.setAttribute('role', 'combobox'); this.main.main.setAttribute('aria-haspopup', 'listbox'); this.main.main.setAttribute('aria-controls', this.content.list.id); this.main.main.setAttribute('aria-expanded', 'false'); this.main.main.setAttribute('aria-autocomplete', 'list'); - if (this.settings.ariaLabelledBy && this.settings.ariaLabelledBy.trim()) { - this.main.main.setAttribute('aria-labelledby', this.settings.ariaLabelledBy); - this.main.main.removeAttribute('aria-label'); + this.main.main.removeAttribute('aria-labelledby'); + this.main.main.removeAttribute('aria-label'); + let labelledById = (this.settings.ariaLabelledBy || '').trim(); + let labelEl = null; + if (!labelledById) { + const selectEl = document.querySelector(`select[data-id="${this.settings.id}"]`); + if (selectEl) { + if (selectEl.id) { + labelEl = document.querySelector(`label[for="${selectEl.id}"]`); + } + if (!labelEl && ((_a = selectEl.previousElementSibling) === null || _a === void 0 ? void 0 : _a.tagName) === 'LABEL') { + labelEl = selectEl.previousElementSibling; + } + if (labelEl) { + if (!labelEl.id) { + labelEl.id = (selectEl.id || this.settings.id) + '-label'; + } + labelledById = labelEl.id; + } + } + } + else { + labelEl = document.getElementById(labelledById); + } + if (labelledById && document.getElementById(labelledById)) { + this.main.main.setAttribute('aria-labelledby', labelledById); } else if (this.settings.ariaLabel && this.settings.ariaLabel.trim()) { - this.main.main.setAttribute('aria-label', this.settings.ariaLabel); + this.main.main.setAttribute('aria-label', this.settings.ariaLabel.trim()); } this.main.main.setAttribute('aria-owns', this.content.list.id); this.content.search.input.setAttribute('aria-controls', this.content.list.id); this.content.search.input.setAttribute('aria-autocomplete', 'list'); + if (labelledById && document.getElementById(labelledById)) { + this.content.search.input.setAttribute('aria-labelledby', labelledById); + } + else if (this.settings.searchLabelledBy && document.getElementById(this.settings.searchLabelledBy)) { + this.content.search.input.setAttribute('aria-labelledby', this.settings.searchLabelledBy); + } + else if (this.settings.searchAriaLabel) { + this.content.search.input.setAttribute('aria-label', this.settings.searchAriaLabel); + } + else { + this.content.search.input.setAttribute('aria-label', 'Search options'); + } } mainDiv() { var _a; @@ -1303,6 +1336,7 @@ var SlimSelect = (function () { return placeholder; } const optionEl = document.createElement('div'); + optionEl.dataset.id = option.id; optionEl.id = `${this.settings.id}__opt__${option.id}`; optionEl.classList.add(this.classes.option); optionEl.setAttribute('role', 'option'); @@ -1842,7 +1876,7 @@ var SlimSelect = (function () { this.alwaysOpen = settings.alwaysOpen !== undefined ? settings.alwaysOpen : false; this.showSearch = settings.showSearch !== undefined ? settings.showSearch : true; this.focusSearch = settings.focusSearch !== undefined ? settings.focusSearch : true; - this.ariaLabel = settings.ariaLabel || 'Combobox'; + this.ariaLabel = settings.ariaLabel || ''; this.searchPlaceholder = settings.searchPlaceholder || 'Search'; this.searchText = settings.searchText || 'No Results'; this.searchingText = settings.searchingText || 'Searching...'; diff --git a/dist/slimselect.js b/dist/slimselect.js index 9b080e72..48a991c5 100644 --- a/dist/slimselect.js +++ b/dist/slimselect.js @@ -499,30 +499,63 @@ } } updateAriaAttributes() { + var _a; this.content.list.setAttribute('role', 'listbox'); this.content.list.setAttribute('id', this.content.main.id + '-list'); this.content.list.setAttribute('aria-label', this.settings.contentAriaLabel); if (this.settings.isMultiple) { this.content.list.setAttribute('aria-multiselectable', 'true'); } - else { - this.content.list.removeAttribute('aria-multiselectable'); - } this.main.main.setAttribute('role', 'combobox'); this.main.main.setAttribute('aria-haspopup', 'listbox'); this.main.main.setAttribute('aria-controls', this.content.list.id); this.main.main.setAttribute('aria-expanded', 'false'); this.main.main.setAttribute('aria-autocomplete', 'list'); - if (this.settings.ariaLabelledBy && this.settings.ariaLabelledBy.trim()) { - this.main.main.setAttribute('aria-labelledby', this.settings.ariaLabelledBy); - this.main.main.removeAttribute('aria-label'); + this.main.main.removeAttribute('aria-labelledby'); + this.main.main.removeAttribute('aria-label'); + let labelledById = (this.settings.ariaLabelledBy || '').trim(); + let labelEl = null; + if (!labelledById) { + const selectEl = document.querySelector(`select[data-id="${this.settings.id}"]`); + if (selectEl) { + if (selectEl.id) { + labelEl = document.querySelector(`label[for="${selectEl.id}"]`); + } + if (!labelEl && ((_a = selectEl.previousElementSibling) === null || _a === void 0 ? void 0 : _a.tagName) === 'LABEL') { + labelEl = selectEl.previousElementSibling; + } + if (labelEl) { + if (!labelEl.id) { + labelEl.id = (selectEl.id || this.settings.id) + '-label'; + } + labelledById = labelEl.id; + } + } + } + else { + labelEl = document.getElementById(labelledById); + } + if (labelledById && document.getElementById(labelledById)) { + this.main.main.setAttribute('aria-labelledby', labelledById); } else if (this.settings.ariaLabel && this.settings.ariaLabel.trim()) { - this.main.main.setAttribute('aria-label', this.settings.ariaLabel); + this.main.main.setAttribute('aria-label', this.settings.ariaLabel.trim()); } this.main.main.setAttribute('aria-owns', this.content.list.id); this.content.search.input.setAttribute('aria-controls', this.content.list.id); this.content.search.input.setAttribute('aria-autocomplete', 'list'); + if (labelledById && document.getElementById(labelledById)) { + this.content.search.input.setAttribute('aria-labelledby', labelledById); + } + else if (this.settings.searchLabelledBy && document.getElementById(this.settings.searchLabelledBy)) { + this.content.search.input.setAttribute('aria-labelledby', this.settings.searchLabelledBy); + } + else if (this.settings.searchAriaLabel) { + this.content.search.input.setAttribute('aria-label', this.settings.searchAriaLabel); + } + else { + this.content.search.input.setAttribute('aria-label', 'Search options'); + } } mainDiv() { var _a; @@ -1306,6 +1339,7 @@ return placeholder; } const optionEl = document.createElement('div'); + optionEl.dataset.id = option.id; optionEl.id = `${this.settings.id}__opt__${option.id}`; optionEl.classList.add(this.classes.option); optionEl.setAttribute('role', 'option'); @@ -1845,7 +1879,7 @@ this.alwaysOpen = settings.alwaysOpen !== undefined ? settings.alwaysOpen : false; this.showSearch = settings.showSearch !== undefined ? settings.showSearch : true; this.focusSearch = settings.focusSearch !== undefined ? settings.focusSearch : true; - this.ariaLabel = settings.ariaLabel || 'Combobox'; + this.ariaLabel = settings.ariaLabel || ''; this.searchPlaceholder = settings.searchPlaceholder || 'Search'; this.searchText = settings.searchText || 'No Results'; this.searchingText = settings.searchingText || 'Searching...'; diff --git a/dist/slimselect.min.js b/dist/slimselect.min.js index 207096b1..0a14acea 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";class t{constructor(t){t||(t={}),this.main=t.main||"ss-main",this.placeholder=t.placeholder||"ss-placeholder",this.values=t.values||"ss-values",this.single=t.single||"ss-single",this.max=t.max||"ss-max",this.value=t.value||"ss-value",this.valueText=t.valueText||"ss-value-text",this.valueDelete=t.valueDelete||"ss-value-delete",this.valueOut=t.valueOut||"ss-value-out",this.deselect=t.deselect||"ss-deselect",this.deselectPath=t.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=t.arrow||"ss-arrow",this.arrowClose=t.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=t.arrowOpen||"M10,70 L50,30 L90,70",this.content=t.content||"ss-content",this.openAbove=t.openAbove||"ss-open-above",this.openBelow=t.openBelow||"ss-open-below",this.search=t.search||"ss-search",this.searchHighlighter=t.searchHighlighter||"ss-search-highlight",this.searching=t.searching||"ss-searching",this.addable=t.addable||"ss-addable",this.addablePath=t.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=t.list||"ss-list",this.optgroup=t.optgroup||"ss-optgroup",this.optgroupLabel=t.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=t.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=t.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=t.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=t.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=t.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=t.optgroupClosable||"ss-closable",this.option=t.option||"ss-option",this.optionDelete=t.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=t.highlighted||"ss-highlighted",this.open=t.open||"ss-open",this.close=t.close||"ss-close",this.selected=t.selected||"ss-selected",this.error=t.error||"ss-error",this.disabled=t.disabled||"ss-disabled",this.hide=t.hide||"ss-hide"}}function e(){return Math.random().toString(36).substring(2,10)}function s(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 i(t,e){return JSON.stringify(t)===JSON.stringify(e)}class n{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 a(e))}}class a{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.defaultSelected=void 0!==t.defaultSelected&&t.defaultSelected,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 l{constructor(t,e){this.selectType="single",this.data=[],this.selectedOrder=[],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 n||"label"in e){if(!("label"in e))return new Error("Optgroup must have a label");if("options"in e&&e.options)for(let t of e.options){const e=this.validateOption(t);if(e)return e}}else{if(!(e instanceof a||"text"in e))return new Error("Data object must be a valid optgroup or option");{const t=this.validateOption(e);if(t)return 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 n||"label"in t){let s=[];"options"in t&&t.options&&t.options.forEach((t=>{s.push(new a(t))})),s.length>0&&e.push(new n(t))}(t instanceof a||"text"in t)&&e.push(new a(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,e=!1){if(e){let e=[new a(t)];this.setData(e.concat(this.getData()))}else this.setData(this.getData().concat(new a(t)))}setSelectedBy(t,e){let s=null,i=!1;const l=[];for(let o of this.data){if(o instanceof n)for(let n of o.options)s||(s=n),n.selected=!i&&e.includes(n[t]),n.selected&&(l.push(n),"single"===this.selectType&&(i=!0));o instanceof a&&(s||(s=o),o.selected=!i&&e.includes(o[t]),o.selected&&(l.push(o),"single"===this.selectType&&(i=!0)))}"single"===this.selectType&&s&&!i&&(s.selected=!0,l.push(s));const o=e.map((e=>{var s;return(null===(s=l.find((s=>s[t]===e)))||void 0===s?void 0:s.id)||""}));this.selectedOrder=o}getSelected(){return this.getSelectedOptions().map((t=>t.id))}getSelectedValues(){return this.getSelectedOptions().map((t=>t.value))}getSelectedOptions(){return this.filter((t=>t.selected),!1)}getOptgroupByID(t){for(let e of this.data)if(e instanceof n&&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 n?t=e.options[0]:e instanceof a&&(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((i=>{if(i instanceof n){let l=[];if(i.options.forEach((i=>{t&&!t(i)||(e?l.push(new a(i)):s.push(new a(i)))})),l.length>0){let t=new n(i);t.options=l,s.push(t)}}i instanceof a&&(t&&!t(i)||s.push(new a(i)))})),s}selectedOrderOptions(t){const e=[];return this.selectedOrder.forEach((s=>{const i=t.find((t=>t.id===s));i&&e.push(i)})),t.forEach((t=>{let s=!1;e.forEach((e=>{t.id!==e.id||(s=!0)})),s||e.push(t)})),e}}class o{static getLiveAssertive(){let t=document.getElementById("ss-live-assertive");return t||(t=document.createElement("div"),t.id="ss-live-assertive",t.setAttribute("role","status"),t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true"),t.className="ss-sr-only",document.body.appendChild(t)),t}_announceAssertive(t){const e=o._liveAssertive||(o._liveAssertive=o.getLiveAssertive());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}constructor(t,e,s,i){var n;this.store=s,this.settings=t,this.classes=e,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes();const a=null===(n=document.querySelector(`[data-id="${this.settings.id}"]`))||void 0===n?void 0:n.closest(".offcanvas-body");a?a.appendChild(this.content.main):this.settings.contentLocation&&this.settings.contentLocation.appendChild(this.content.main)}static getLivePolite(){let t=document.getElementById("ss-live-polite");return t||(t=document.createElement("div"),t.id="ss-live-polite",t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.className="ss-sr-only",document.body.appendChild(t)),t}_announcePolite(t){const e=o._livePolite||(o._livePolite=o.getLivePolite());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}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)}"fixed"===this.settings.contentPosition&&(this.moveContent(),this.scrollHandler=()=>this.moveContent(),this.resizeHandler=()=>this.moveContent(),window.addEventListener("scroll",this.scrollHandler,!0),window.addEventListener("resize",this.resizeHandler)),this.searchFocus()}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),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=void 0),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=void 0),this.main.main.focus({preventScroll:!0}),this.main.main.removeAttribute("aria-activedescendant")}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.main.main.classList.add("ss-2"),this.content.main.classList.add(this.classes.content),this.content.main.classList.add("ss-content-2"),""!==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&&"fixed"!==this.settings.contentPosition||this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){this.content.list.setAttribute("role","listbox"),this.content.list.setAttribute("id",this.content.main.id+"-list"),this.content.list.setAttribute("aria-label",this.settings.contentAriaLabel),this.settings.isMultiple?this.content.list.setAttribute("aria-multiselectable","true"):this.content.list.removeAttribute("aria-multiselectable"),this.main.main.setAttribute("role","combobox"),this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.list.id),this.main.main.setAttribute("aria-expanded","false"),this.main.main.setAttribute("aria-autocomplete","list"),this.settings.ariaLabelledBy&&this.settings.ariaLabelledBy.trim()?(this.main.main.setAttribute("aria-labelledby",this.settings.ariaLabelledBy),this.main.main.removeAttribute("aria-label")):this.settings.ariaLabel&&this.settings.ariaLabel.trim()&&this.main.main.setAttribute("aria-label",this.settings.ariaLabel),this.main.main.setAttribute("aria-owns",this.content.list.id),this.content.search.input.setAttribute("aria-controls",this.content.list.id),this.content.search.input.setAttribute("aria-autocomplete","list")}mainDiv(){var t;const e=document.createElement("div");e.id=this.settings.id+"-main",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===t.key.length&&this.callbacks.open(),!0},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),i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("aria-label",this.settings.clearAllAriaLabel),i.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i.click())}));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"),a.setAttribute("aria-hidden","true"),a.setAttribute("focusable","false");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"),o.setAttribute("aria-hidden","true"),o.setAttribute("focusable","false");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()}this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e));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 i=this.store.getSelectedOptions(),l=i.filter((e=>e.selected&&e.id!==t.id),!0);if(!(this.settings.minSelected&&l.length{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),s.click())}}return e}contentDiv(){const t=document.createElement("div");t.id=this.settings.id+"-content";const e=this.searchDiv();t.appendChild(e.main);const s=this.listDiv();return t.appendChild(s),{main:t,search:e,list:s}}moveContent(){"relative"!==this.settings.contentPosition&&"down"!==this.settings.openPosition?"up"!==this.settings.openPosition?"up"===this.putContent()?this.moveContentAbove():this.moveContentBelow():this.moveContentAbove():this.moveContentBelow()}searchDiv(){const t=document.createElement("div"),e=document.createElement("input"),i=document.createElement("div");t.classList.add(this.classes.search);const n={main:t,input:e};if(this.settings.showSearch||(t.classList.add(this.classes.hide),e.readOnly=!0),e.type="search",e.placeholder=this.settings.searchPlaceholder,e.tabIndex=-1,this.settings.searchLabelledBy&&this.settings.searchLabelledBy.trim()?e.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel&&this.settings.searchAriaLabel.trim()?e.setAttribute("aria-label",this.settings.searchAriaLabel):e.setAttribute("aria-label","Search options"),e.setAttribute("autocapitalize","off"),e.setAttribute("autocomplete","off"),e.setAttribute("autocorrect","off"),e.oninput=s((t=>{this.callbacks.search(t.target.value)}),100),e.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" ":const e=this.content.list.querySelector("."+this.classes.highlighted);return!e||(e.click(),!1);case"Enter":if(this.callbacks.addable)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(e),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"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false");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 a(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=>{"string"==typeof t?s({text:t,value:t}):i instanceof Error?this.renderError(i.message):s(t)})):"string"==typeof i?s({text:i,value:i}):i instanceof Error?this.renderError(i.message):s(i))},t.appendChild(i),n.addable={main:i,svg:e,path:s}}return n}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.main.main.setAttribute("aria-activedescendant",a.id),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}const i=e["down"===t?0:e.length-1];i.classList.add(this.classes.highlighted),this.main.main.setAttribute("aria-activedescendant",i.id),this.ensureElementInView(this.content.list,i)}listDiv(){const t=document.createElement("div");return t.classList.add(this.classes.list),t}renderError(t){this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy");const e=document.createElement("div");e.classList.add(this.classes.error),e.textContent=t,this.content.list.appendChild(e),this._announceAssertive(t)}renderSearching(){this.content.list.innerHTML="",this.content.list.setAttribute("aria-busy","true");const t=document.createElement("div");t.classList.add(this.classes.searching),t.textContent=this.settings.searchingText,this.content.list.appendChild(t),this._announcePolite(this.settings.searchingText)}renderOptions(t){if(this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy"),0===t.length){const t=document.createElement("div");t.classList.add(this.classes.search);const e=this.callbacks.addable?this.settings.addableText.replace("{value}",this.content.search.input.value):this.settings.searchText;return this._announcePolite(e),t.innerHTML=e,this.content.list.appendChild(t),void this.content.list.setAttribute("aria-setsize","0")}if(this.settings.allowDeselect&&!this.settings.isMultiple){this.store.filter((t=>t.placeholder),!1).length||this.store.addOption(new a({text:"",value:"",selected:!1,placeholder:!0}),!0)}const e=document.createDocumentFragment();let s=0;const i=t.filter((t=>t instanceof a&&!t.placeholder&&t.display&&!t.disabled)).length,l=t=>{t.classList.contains(this.classes.placeholder)||t.classList.contains(this.classes.disabled)||t.classList.contains(this.classes.hide)||(t.setAttribute("aria-posinset",String(++s)),t.setAttribute("aria-setsize",String(i)))};for(const s of t){if(s instanceof n){const t=document.createElement("div");t.classList.add(this.classes.optgroup),t.setAttribute("role","group"),t.setAttribute("aria-label",s.label);const i=document.createElement("div");i.classList.add(this.classes.optgroupLabel),t.appendChild(i);const n=document.createElement("div");n.classList.add(this.classes.optgroupLabelText),n.textContent=s.label,i.appendChild(n);const a=document.createElement("div");if(a.classList.add(this.classes.optgroupActions),i.appendChild(a),this.settings.isMultiple&&s.selectAll){const t=document.createElement("div");t.classList.add(this.classes.optgroupSelectAll);let e=!0;for(const t of s.options)if(!t.selected){e=!1;break}e&&t.classList.add(this.classes.selected);const i=document.createElement("span");i.textContent=s.selectAllText,t.appendChild(i);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),t.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.optgroupSelectAllBox),n.appendChild(l);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.optgroupSelectAllCheck),n.appendChild(o),t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const i=this.store.getSelected();if(e){const t=i.filter((t=>{for(const e of s.options)if(t===e.id)return!1;return!0}));this.callbacks.setSelected(t,!0)}else{const t=i.concat(s.options.map((t=>t.id)));for(const t of s.options)this.store.getOptionByID(t.id)||this.callbacks.addOption(t);this.callbacks.setSelected(t,!0)}})),a.appendChild(t)}if("off"!==s.closable){const e=document.createElement("div");e.classList.add(this.classes.optgroupClosable);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.classList.add(this.classes.arrow),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),e.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","path");n.appendChild(l),s.options.some((t=>t.selected))||""!==this.content.search.input.value.trim()||"open"===s.closable?(t.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"close"===s.closable&&(t.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose)),i.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))})),a.appendChild(e)}t.appendChild(i);for(const e of s.options){const s=this.option(e);l(s),t.appendChild(s)}e.appendChild(t)}if(s instanceof a){const t=this.option(s);l(t),e.appendChild(t)}}this.content.list.appendChild(e),this.content.list.removeAttribute("aria-busy");const o=this.getOptions(!0,!0,!0).length;this._announcePolite(`${o} option${1===o?"":"s"} available`)}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.id=`${this.settings.id}__opt__${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),e.setAttribute("aria-disabled","true")),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=[];if(this.settings.isMultiple)if(t.selected)o=l.filter((t=>t.id!==n));else if(o=l.concat(t),!this.settings.closeOnSelect)if(e.shiftKey&&this.lastSelectedOption){const e=this.store.getDataOptions();let s=e.findIndex((t=>t.id===this.lastSelectedOption.id)),i=e.findIndex((e=>e.id===t.id));if(s>=0&&i>=0){const t=Math.min(s,i),n=Math.max(s,i),a=e.slice(t,n+1);a.length>0&&a.length!l.find((e=>e.id===t.id))))))}}else t.selected||(this.lastSelectedOption=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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=s.left+("fixed"===this.settings.contentPosition?0: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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=t.left+("fixed"===this.settings.contentPosition?0: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)}}o._livePolite=null,o._liveAssertive=null;class c{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){if(n.target===this.select&&("disabled"===n.attributeName&&(s=!0),"class"===n.attributeName&&(e=!0),"childList"===n.type)){for(const t of n.addedNodes)if("OPTION"===t.nodeName&&t.value===this.select.value){this.select.dispatchEvent(new Event("change"));break}i=!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:"",defaultSelected:t.defaultSelected,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)}setSelectedByValue(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.value)}}if("OPTION"===s.nodeName){const e=s;e.selected=t.includes(e.value)}}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 n&&this.select.appendChild(this.createOptgroup(e)),e instanceof a&&this.select.appendChild(this.createOption(e));this.select.dispatchEvent(new Event("change",{bubbles:!0})),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.textContent=t.text,""!==t.html&&e.setAttribute("data-html",t.html),e.defaultSelected=t.defaultSelected,e.selected=t.selected,t.disabled&&(e.disabled=!0),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 r{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.focusSearch=void 0===t.focusSearch||t.focusSearch,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.contentAriaLabel=void 0!==t.contentAriaLabel?t.contentAriaLabel:"Select an option",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",this.addableText=t.addableText||'Press "Enter" to add {value}',this.ariaLabelledBy=t.ariaLabelledBy||"",this.searchAriaLabel=t.searchAriaLabel||"Search options",this.searchLabelledBy=t.searchLabelledBy||"",this.clearAllAriaLabel=t.clearAllAriaLabel||"Clear selection"}}return class{constructor(e){var i;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=s((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.windowScroll=s((()=>{(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 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 r(e.settings),this.cssClasses=new t(e.cssClasses);const n=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const t in e.events)e.events.hasOwnProperty(t)&&(-1!==n.indexOf(t)?this.events[t]=s(e.events[t],100):this.events[t]=e.events[t]);this.settings.disabled=(null===(i=e.settings)||void 0===i?void 0:i.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 c(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 l(this.settings.isMultiple?"multiple":"single",e.data?e.data:this.select.getData()),e.data&&this.select.updateOptions(this.store.getData());const a={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 o(this.settings,this.cssClasses,this.store,a),this.render.renderValues(),this.render.renderOptions(this.store.getData());const h=this.selectEl.getAttribute("aria-label"),d=this.selectEl.getAttribute("aria-labelledby");h?this.render.main.main.setAttribute("aria-label",h):d&&this.render.main.main.setAttribute("aria-labelledby",d),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(),s=this.store.validateDataArray(t);if(s)return void(this.events.error&&this.events.error(s));this.store.setData(t);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!i(e,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let t=this.store.getSelectedOptions();return this.settings.keepOrder&&(t=this.store.selectedOrderOptions(t)),t.map((t=>t.value))}setSelected(t,e=!0){const s=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&&!i(s,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 s=this.store.getData();this.select.updateOptions(s),this.render.renderValues(),this.render.renderOptions(s),this.events.afterChange&&!i(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.settings.focusSearch&&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";class t{constructor(t){t||(t={}),this.main=t.main||"ss-main",this.placeholder=t.placeholder||"ss-placeholder",this.values=t.values||"ss-values",this.single=t.single||"ss-single",this.max=t.max||"ss-max",this.value=t.value||"ss-value",this.valueText=t.valueText||"ss-value-text",this.valueDelete=t.valueDelete||"ss-value-delete",this.valueOut=t.valueOut||"ss-value-out",this.deselect=t.deselect||"ss-deselect",this.deselectPath=t.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=t.arrow||"ss-arrow",this.arrowClose=t.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=t.arrowOpen||"M10,70 L50,30 L90,70",this.content=t.content||"ss-content",this.openAbove=t.openAbove||"ss-open-above",this.openBelow=t.openBelow||"ss-open-below",this.search=t.search||"ss-search",this.searchHighlighter=t.searchHighlighter||"ss-search-highlight",this.searching=t.searching||"ss-searching",this.addable=t.addable||"ss-addable",this.addablePath=t.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=t.list||"ss-list",this.optgroup=t.optgroup||"ss-optgroup",this.optgroupLabel=t.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=t.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=t.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=t.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=t.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=t.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=t.optgroupClosable||"ss-closable",this.option=t.option||"ss-option",this.optionDelete=t.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=t.highlighted||"ss-highlighted",this.open=t.open||"ss-open",this.close=t.close||"ss-close",this.selected=t.selected||"ss-selected",this.error=t.error||"ss-error",this.disabled=t.disabled||"ss-disabled",this.hide=t.hide||"ss-hide"}}function e(){return Math.random().toString(36).substring(2,10)}function s(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 i(t,e){return JSON.stringify(t)===JSON.stringify(e)}class n{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 a(e))}}class a{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.defaultSelected=void 0!==t.defaultSelected&&t.defaultSelected,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 l{constructor(t,e){this.selectType="single",this.data=[],this.selectedOrder=[],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 n||"label"in e){if(!("label"in e))return new Error("Optgroup must have a label");if("options"in e&&e.options)for(let t of e.options){const e=this.validateOption(t);if(e)return e}}else{if(!(e instanceof a||"text"in e))return new Error("Data object must be a valid optgroup or option");{const t=this.validateOption(e);if(t)return 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 n||"label"in t){let s=[];"options"in t&&t.options&&t.options.forEach((t=>{s.push(new a(t))})),s.length>0&&e.push(new n(t))}(t instanceof a||"text"in t)&&e.push(new a(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,e=!1){if(e){let e=[new a(t)];this.setData(e.concat(this.getData()))}else this.setData(this.getData().concat(new a(t)))}setSelectedBy(t,e){let s=null,i=!1;const l=[];for(let o of this.data){if(o instanceof n)for(let n of o.options)s||(s=n),n.selected=!i&&e.includes(n[t]),n.selected&&(l.push(n),"single"===this.selectType&&(i=!0));o instanceof a&&(s||(s=o),o.selected=!i&&e.includes(o[t]),o.selected&&(l.push(o),"single"===this.selectType&&(i=!0)))}"single"===this.selectType&&s&&!i&&(s.selected=!0,l.push(s));const o=e.map((e=>{var s;return(null===(s=l.find((s=>s[t]===e)))||void 0===s?void 0:s.id)||""}));this.selectedOrder=o}getSelected(){return this.getSelectedOptions().map((t=>t.id))}getSelectedValues(){return this.getSelectedOptions().map((t=>t.value))}getSelectedOptions(){return this.filter((t=>t.selected),!1)}getOptgroupByID(t){for(let e of this.data)if(e instanceof n&&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 n?t=e.options[0]:e instanceof a&&(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((i=>{if(i instanceof n){let l=[];if(i.options.forEach((i=>{t&&!t(i)||(e?l.push(new a(i)):s.push(new a(i)))})),l.length>0){let t=new n(i);t.options=l,s.push(t)}}i instanceof a&&(t&&!t(i)||s.push(new a(i)))})),s}selectedOrderOptions(t){const e=[];return this.selectedOrder.forEach((s=>{const i=t.find((t=>t.id===s));i&&e.push(i)})),t.forEach((t=>{let s=!1;e.forEach((e=>{t.id!==e.id||(s=!0)})),s||e.push(t)})),e}}class o{static getLiveAssertive(){let t=document.getElementById("ss-live-assertive");return t||(t=document.createElement("div"),t.id="ss-live-assertive",t.setAttribute("role","status"),t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true"),t.className="ss-sr-only",document.body.appendChild(t)),t}_announceAssertive(t){const e=o._liveAssertive||(o._liveAssertive=o.getLiveAssertive());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}constructor(t,e,s,i){var n;this.store=s,this.settings=t,this.classes=e,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes();const a=null===(n=document.querySelector(`[data-id="${this.settings.id}"]`))||void 0===n?void 0:n.closest(".offcanvas-body");a?a.appendChild(this.content.main):this.settings.contentLocation&&this.settings.contentLocation.appendChild(this.content.main)}static getLivePolite(){let t=document.getElementById("ss-live-polite");return t||(t=document.createElement("div"),t.id="ss-live-polite",t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.className="ss-sr-only",document.body.appendChild(t)),t}_announcePolite(t){const e=o._livePolite||(o._livePolite=o.getLivePolite());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}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)}"fixed"===this.settings.contentPosition&&(this.moveContent(),this.scrollHandler=()=>this.moveContent(),this.resizeHandler=()=>this.moveContent(),window.addEventListener("scroll",this.scrollHandler,!0),window.addEventListener("resize",this.resizeHandler)),this.searchFocus()}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),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=void 0),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=void 0),this.main.main.focus({preventScroll:!0}),this.main.main.removeAttribute("aria-activedescendant")}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.main.main.classList.add("ss-2"),this.content.main.classList.add(this.classes.content),this.content.main.classList.add("ss-content-2"),""!==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&&"fixed"!==this.settings.contentPosition||this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){var t;this.content.list.setAttribute("role","listbox"),this.content.list.setAttribute("id",this.content.main.id+"-list"),this.content.list.setAttribute("aria-label",this.settings.contentAriaLabel),this.settings.isMultiple&&this.content.list.setAttribute("aria-multiselectable","true"),this.main.main.setAttribute("role","combobox"),this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.list.id),this.main.main.setAttribute("aria-expanded","false"),this.main.main.setAttribute("aria-autocomplete","list"),this.main.main.removeAttribute("aria-labelledby"),this.main.main.removeAttribute("aria-label");let e=(this.settings.ariaLabelledBy||"").trim(),s=null;if(e)s=document.getElementById(e);else{const i=document.querySelector(`select[data-id="${this.settings.id}"]`);i&&(i.id&&(s=document.querySelector(`label[for="${i.id}"]`)),s||"LABEL"!==(null===(t=i.previousElementSibling)||void 0===t?void 0:t.tagName)||(s=i.previousElementSibling),s&&(s.id||(s.id=(i.id||this.settings.id)+"-label"),e=s.id))}e&&document.getElementById(e)?this.main.main.setAttribute("aria-labelledby",e):this.settings.ariaLabel&&this.settings.ariaLabel.trim()&&this.main.main.setAttribute("aria-label",this.settings.ariaLabel.trim()),this.main.main.setAttribute("aria-owns",this.content.list.id),this.content.search.input.setAttribute("aria-controls",this.content.list.id),this.content.search.input.setAttribute("aria-autocomplete","list"),e&&document.getElementById(e)?this.content.search.input.setAttribute("aria-labelledby",e):this.settings.searchLabelledBy&&document.getElementById(this.settings.searchLabelledBy)?this.content.search.input.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel?this.content.search.input.setAttribute("aria-label",this.settings.searchAriaLabel):this.content.search.input.setAttribute("aria-label","Search options")}mainDiv(){var t;const e=document.createElement("div");e.id=this.settings.id+"-main",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===t.key.length&&this.callbacks.open(),!0},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),i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("aria-label",this.settings.clearAllAriaLabel),i.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i.click())}));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"),a.setAttribute("aria-hidden","true"),a.setAttribute("focusable","false");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"),o.setAttribute("aria-hidden","true"),o.setAttribute("focusable","false");const r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&o.classList.add(this.classes.hide),o.appendChild(r),e.appendChild(o),{main:e,values:s,deselect:{main:i,svg:a,path:l},arrow:{main:o,path:r}}}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()}this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e));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 i=this.store.getSelectedOptions(),l=i.filter((e=>e.selected&&e.id!==t.id),!0);if(!(this.settings.minSelected&&l.length{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),s.click())}}return e}contentDiv(){const t=document.createElement("div");t.id=this.settings.id+"-content";const e=this.searchDiv();t.appendChild(e.main);const s=this.listDiv();return t.appendChild(s),{main:t,search:e,list:s}}moveContent(){"relative"!==this.settings.contentPosition&&"down"!==this.settings.openPosition?"up"!==this.settings.openPosition?"up"===this.putContent()?this.moveContentAbove():this.moveContentBelow():this.moveContentAbove():this.moveContentBelow()}searchDiv(){const t=document.createElement("div"),e=document.createElement("input"),i=document.createElement("div");t.classList.add(this.classes.search);const n={main:t,input:e};if(this.settings.showSearch||(t.classList.add(this.classes.hide),e.readOnly=!0),e.type="search",e.placeholder=this.settings.searchPlaceholder,e.tabIndex=-1,this.settings.searchLabelledBy&&this.settings.searchLabelledBy.trim()?e.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel&&this.settings.searchAriaLabel.trim()?e.setAttribute("aria-label",this.settings.searchAriaLabel):e.setAttribute("aria-label","Search options"),e.setAttribute("autocapitalize","off"),e.setAttribute("autocomplete","off"),e.setAttribute("autocorrect","off"),e.oninput=s((t=>{this.callbacks.search(t.target.value)}),100),e.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" ":const e=this.content.list.querySelector("."+this.classes.highlighted);return!e||(e.click(),!1);case"Enter":if(this.callbacks.addable)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(e),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"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false");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 a(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=>{"string"==typeof t?s({text:t,value:t}):i instanceof Error?this.renderError(i.message):s(t)})):"string"==typeof i?s({text:i,value:i}):i instanceof Error?this.renderError(i.message):s(i))},t.appendChild(i),n.addable={main:i,svg:e,path:s}}return n}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.main.main.setAttribute("aria-activedescendant",a.id),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}const i=e["down"===t?0:e.length-1];i.classList.add(this.classes.highlighted),this.main.main.setAttribute("aria-activedescendant",i.id),this.ensureElementInView(this.content.list,i)}listDiv(){const t=document.createElement("div");return t.classList.add(this.classes.list),t}renderError(t){this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy");const e=document.createElement("div");e.classList.add(this.classes.error),e.textContent=t,this.content.list.appendChild(e),this._announceAssertive(t)}renderSearching(){this.content.list.innerHTML="",this.content.list.setAttribute("aria-busy","true");const t=document.createElement("div");t.classList.add(this.classes.searching),t.textContent=this.settings.searchingText,this.content.list.appendChild(t),this._announcePolite(this.settings.searchingText)}renderOptions(t){if(this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy"),0===t.length){const t=document.createElement("div");t.classList.add(this.classes.search);const e=this.callbacks.addable?this.settings.addableText.replace("{value}",this.content.search.input.value):this.settings.searchText;return this._announcePolite(e),t.innerHTML=e,this.content.list.appendChild(t),void this.content.list.setAttribute("aria-setsize","0")}if(this.settings.allowDeselect&&!this.settings.isMultiple){this.store.filter((t=>t.placeholder),!1).length||this.store.addOption(new a({text:"",value:"",selected:!1,placeholder:!0}),!0)}const e=document.createDocumentFragment();let s=0;const i=t.filter((t=>t instanceof a&&!t.placeholder&&t.display&&!t.disabled)).length,l=t=>{t.classList.contains(this.classes.placeholder)||t.classList.contains(this.classes.disabled)||t.classList.contains(this.classes.hide)||(t.setAttribute("aria-posinset",String(++s)),t.setAttribute("aria-setsize",String(i)))};for(const s of t){if(s instanceof n){const t=document.createElement("div");t.classList.add(this.classes.optgroup),t.setAttribute("role","group"),t.setAttribute("aria-label",s.label);const i=document.createElement("div");i.classList.add(this.classes.optgroupLabel),t.appendChild(i);const n=document.createElement("div");n.classList.add(this.classes.optgroupLabelText),n.textContent=s.label,i.appendChild(n);const a=document.createElement("div");if(a.classList.add(this.classes.optgroupActions),i.appendChild(a),this.settings.isMultiple&&s.selectAll){const t=document.createElement("div");t.classList.add(this.classes.optgroupSelectAll);let e=!0;for(const t of s.options)if(!t.selected){e=!1;break}e&&t.classList.add(this.classes.selected);const i=document.createElement("span");i.textContent=s.selectAllText,t.appendChild(i);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),t.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.optgroupSelectAllBox),n.appendChild(l);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.optgroupSelectAllCheck),n.appendChild(o),t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const i=this.store.getSelected();if(e){const t=i.filter((t=>{for(const e of s.options)if(t===e.id)return!1;return!0}));this.callbacks.setSelected(t,!0)}else{const t=i.concat(s.options.map((t=>t.id)));for(const t of s.options)this.store.getOptionByID(t.id)||this.callbacks.addOption(t);this.callbacks.setSelected(t,!0)}})),a.appendChild(t)}if("off"!==s.closable){const e=document.createElement("div");e.classList.add(this.classes.optgroupClosable);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.classList.add(this.classes.arrow),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),e.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","path");n.appendChild(l),s.options.some((t=>t.selected))||""!==this.content.search.input.value.trim()||"open"===s.closable?(t.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"close"===s.closable&&(t.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose)),i.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))})),a.appendChild(e)}t.appendChild(i);for(const e of s.options){const s=this.option(e);l(s),t.appendChild(s)}e.appendChild(t)}if(s instanceof a){const t=this.option(s);l(t),e.appendChild(t)}}this.content.list.appendChild(e),this.content.list.removeAttribute("aria-busy");const o=this.getOptions(!0,!0,!0).length;this._announcePolite(`${o} option${1===o?"":"s"} available`)}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=`${this.settings.id}__opt__${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),e.setAttribute("aria-disabled","true")),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=[];if(this.settings.isMultiple)if(t.selected)o=l.filter((t=>t.id!==n));else if(o=l.concat(t),!this.settings.closeOnSelect)if(e.shiftKey&&this.lastSelectedOption){const e=this.store.getDataOptions();let s=e.findIndex((t=>t.id===this.lastSelectedOption.id)),i=e.findIndex((e=>e.id===t.id));if(s>=0&&i>=0){const t=Math.min(s,i),n=Math.max(s,i),a=e.slice(t,n+1);a.length>0&&a.length!l.find((e=>e.id===t.id))))))}}else t.selected||(this.lastSelectedOption=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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=s.left+("fixed"===this.settings.contentPosition?0: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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=t.left+("fixed"===this.settings.contentPosition?0: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)}}o._livePolite=null,o._liveAssertive=null;class r{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){if(n.target===this.select&&("disabled"===n.attributeName&&(s=!0),"class"===n.attributeName&&(e=!0),"childList"===n.type)){for(const t of n.addedNodes)if("OPTION"===t.nodeName&&t.value===this.select.value){this.select.dispatchEvent(new Event("change"));break}i=!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:"",defaultSelected:t.defaultSelected,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)}setSelectedByValue(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.value)}}if("OPTION"===s.nodeName){const e=s;e.selected=t.includes(e.value)}}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 n&&this.select.appendChild(this.createOptgroup(e)),e instanceof a&&this.select.appendChild(this.createOption(e));this.select.dispatchEvent(new Event("change",{bubbles:!0})),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.textContent=t.text,""!==t.html&&e.setAttribute("data-html",t.html),e.defaultSelected=t.defaultSelected,e.selected=t.selected,t.disabled&&(e.disabled=!0),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(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.focusSearch=void 0===t.focusSearch||t.focusSearch,this.ariaLabel=t.ariaLabel||"",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.contentAriaLabel=void 0!==t.contentAriaLabel?t.contentAriaLabel:"Select an option",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",this.addableText=t.addableText||'Press "Enter" to add {value}',this.ariaLabelledBy=t.ariaLabelledBy||"",this.searchAriaLabel=t.searchAriaLabel||"Search options",this.searchLabelledBy=t.searchLabelledBy||"",this.clearAllAriaLabel=t.clearAllAriaLabel||"Clear selection"}}return class{constructor(e){var i;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=s((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.windowScroll=s((()=>{(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 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),this.cssClasses=new t(e.cssClasses);const n=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const t in e.events)e.events.hasOwnProperty(t)&&(-1!==n.indexOf(t)?this.events[t]=s(e.events[t],100):this.events[t]=e.events[t]);this.settings.disabled=(null===(i=e.settings)||void 0===i?void 0:i.disabled)?e.settings.disabled:this.selectEl.disabled,this.settings.isMultiple=this.selectEl.multiple,this.settings.style=this.selectEl.style.cssText,this.settings.class=this.selectEl.className.split(" "),this.select=new r(this.selectEl),this.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 l(this.settings.isMultiple?"multiple":"single",e.data?e.data:this.select.getData()),e.data&&this.select.updateOptions(this.store.getData());const a={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 o(this.settings,this.cssClasses,this.store,a),this.render.renderValues(),this.render.renderOptions(this.store.getData());const h=this.selectEl.getAttribute("aria-label"),d=this.selectEl.getAttribute("aria-labelledby");h?this.render.main.main.setAttribute("aria-label",h):d&&this.render.main.main.setAttribute("aria-labelledby",d),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(),s=this.store.validateDataArray(t);if(s)return void(this.events.error&&this.events.error(s));this.store.setData(t);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!i(e,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let t=this.store.getSelectedOptions();return this.settings.keepOrder&&(t=this.store.selectedOrderOptions(t)),t.map((t=>t.value))}setSelected(t,e=!0){const s=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&&!i(s,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 s=this.store.getData();this.select.updateOptions(s),this.render.renderValues(),this.render.renderOptions(s),this.events.afterChange&&!i(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.settings.focusSearch&&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 9b080e72..48a991c5 100644 --- a/dist/slimselect.umd.js +++ b/dist/slimselect.umd.js @@ -499,30 +499,63 @@ } } updateAriaAttributes() { + var _a; this.content.list.setAttribute('role', 'listbox'); this.content.list.setAttribute('id', this.content.main.id + '-list'); this.content.list.setAttribute('aria-label', this.settings.contentAriaLabel); if (this.settings.isMultiple) { this.content.list.setAttribute('aria-multiselectable', 'true'); } - else { - this.content.list.removeAttribute('aria-multiselectable'); - } this.main.main.setAttribute('role', 'combobox'); this.main.main.setAttribute('aria-haspopup', 'listbox'); this.main.main.setAttribute('aria-controls', this.content.list.id); this.main.main.setAttribute('aria-expanded', 'false'); this.main.main.setAttribute('aria-autocomplete', 'list'); - if (this.settings.ariaLabelledBy && this.settings.ariaLabelledBy.trim()) { - this.main.main.setAttribute('aria-labelledby', this.settings.ariaLabelledBy); - this.main.main.removeAttribute('aria-label'); + this.main.main.removeAttribute('aria-labelledby'); + this.main.main.removeAttribute('aria-label'); + let labelledById = (this.settings.ariaLabelledBy || '').trim(); + let labelEl = null; + if (!labelledById) { + const selectEl = document.querySelector(`select[data-id="${this.settings.id}"]`); + if (selectEl) { + if (selectEl.id) { + labelEl = document.querySelector(`label[for="${selectEl.id}"]`); + } + if (!labelEl && ((_a = selectEl.previousElementSibling) === null || _a === void 0 ? void 0 : _a.tagName) === 'LABEL') { + labelEl = selectEl.previousElementSibling; + } + if (labelEl) { + if (!labelEl.id) { + labelEl.id = (selectEl.id || this.settings.id) + '-label'; + } + labelledById = labelEl.id; + } + } + } + else { + labelEl = document.getElementById(labelledById); + } + if (labelledById && document.getElementById(labelledById)) { + this.main.main.setAttribute('aria-labelledby', labelledById); } else if (this.settings.ariaLabel && this.settings.ariaLabel.trim()) { - this.main.main.setAttribute('aria-label', this.settings.ariaLabel); + this.main.main.setAttribute('aria-label', this.settings.ariaLabel.trim()); } this.main.main.setAttribute('aria-owns', this.content.list.id); this.content.search.input.setAttribute('aria-controls', this.content.list.id); this.content.search.input.setAttribute('aria-autocomplete', 'list'); + if (labelledById && document.getElementById(labelledById)) { + this.content.search.input.setAttribute('aria-labelledby', labelledById); + } + else if (this.settings.searchLabelledBy && document.getElementById(this.settings.searchLabelledBy)) { + this.content.search.input.setAttribute('aria-labelledby', this.settings.searchLabelledBy); + } + else if (this.settings.searchAriaLabel) { + this.content.search.input.setAttribute('aria-label', this.settings.searchAriaLabel); + } + else { + this.content.search.input.setAttribute('aria-label', 'Search options'); + } } mainDiv() { var _a; @@ -1306,6 +1339,7 @@ return placeholder; } const optionEl = document.createElement('div'); + optionEl.dataset.id = option.id; optionEl.id = `${this.settings.id}__opt__${option.id}`; optionEl.classList.add(this.classes.option); optionEl.setAttribute('role', 'option'); @@ -1845,7 +1879,7 @@ this.alwaysOpen = settings.alwaysOpen !== undefined ? settings.alwaysOpen : false; this.showSearch = settings.showSearch !== undefined ? settings.showSearch : true; this.focusSearch = settings.focusSearch !== undefined ? settings.focusSearch : true; - this.ariaLabel = settings.ariaLabel || 'Combobox'; + this.ariaLabel = settings.ariaLabel || ''; this.searchPlaceholder = settings.searchPlaceholder || 'Search'; this.searchText = settings.searchText || 'No Results'; this.searchingText = settings.searchingText || 'Searching...'; diff --git a/dist/slimselect.umd.min.js b/dist/slimselect.umd.min.js index 207096b1..0a14acea 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";class t{constructor(t){t||(t={}),this.main=t.main||"ss-main",this.placeholder=t.placeholder||"ss-placeholder",this.values=t.values||"ss-values",this.single=t.single||"ss-single",this.max=t.max||"ss-max",this.value=t.value||"ss-value",this.valueText=t.valueText||"ss-value-text",this.valueDelete=t.valueDelete||"ss-value-delete",this.valueOut=t.valueOut||"ss-value-out",this.deselect=t.deselect||"ss-deselect",this.deselectPath=t.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=t.arrow||"ss-arrow",this.arrowClose=t.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=t.arrowOpen||"M10,70 L50,30 L90,70",this.content=t.content||"ss-content",this.openAbove=t.openAbove||"ss-open-above",this.openBelow=t.openBelow||"ss-open-below",this.search=t.search||"ss-search",this.searchHighlighter=t.searchHighlighter||"ss-search-highlight",this.searching=t.searching||"ss-searching",this.addable=t.addable||"ss-addable",this.addablePath=t.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=t.list||"ss-list",this.optgroup=t.optgroup||"ss-optgroup",this.optgroupLabel=t.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=t.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=t.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=t.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=t.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=t.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=t.optgroupClosable||"ss-closable",this.option=t.option||"ss-option",this.optionDelete=t.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=t.highlighted||"ss-highlighted",this.open=t.open||"ss-open",this.close=t.close||"ss-close",this.selected=t.selected||"ss-selected",this.error=t.error||"ss-error",this.disabled=t.disabled||"ss-disabled",this.hide=t.hide||"ss-hide"}}function e(){return Math.random().toString(36).substring(2,10)}function s(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 i(t,e){return JSON.stringify(t)===JSON.stringify(e)}class n{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 a(e))}}class a{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.defaultSelected=void 0!==t.defaultSelected&&t.defaultSelected,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 l{constructor(t,e){this.selectType="single",this.data=[],this.selectedOrder=[],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 n||"label"in e){if(!("label"in e))return new Error("Optgroup must have a label");if("options"in e&&e.options)for(let t of e.options){const e=this.validateOption(t);if(e)return e}}else{if(!(e instanceof a||"text"in e))return new Error("Data object must be a valid optgroup or option");{const t=this.validateOption(e);if(t)return 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 n||"label"in t){let s=[];"options"in t&&t.options&&t.options.forEach((t=>{s.push(new a(t))})),s.length>0&&e.push(new n(t))}(t instanceof a||"text"in t)&&e.push(new a(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,e=!1){if(e){let e=[new a(t)];this.setData(e.concat(this.getData()))}else this.setData(this.getData().concat(new a(t)))}setSelectedBy(t,e){let s=null,i=!1;const l=[];for(let o of this.data){if(o instanceof n)for(let n of o.options)s||(s=n),n.selected=!i&&e.includes(n[t]),n.selected&&(l.push(n),"single"===this.selectType&&(i=!0));o instanceof a&&(s||(s=o),o.selected=!i&&e.includes(o[t]),o.selected&&(l.push(o),"single"===this.selectType&&(i=!0)))}"single"===this.selectType&&s&&!i&&(s.selected=!0,l.push(s));const o=e.map((e=>{var s;return(null===(s=l.find((s=>s[t]===e)))||void 0===s?void 0:s.id)||""}));this.selectedOrder=o}getSelected(){return this.getSelectedOptions().map((t=>t.id))}getSelectedValues(){return this.getSelectedOptions().map((t=>t.value))}getSelectedOptions(){return this.filter((t=>t.selected),!1)}getOptgroupByID(t){for(let e of this.data)if(e instanceof n&&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 n?t=e.options[0]:e instanceof a&&(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((i=>{if(i instanceof n){let l=[];if(i.options.forEach((i=>{t&&!t(i)||(e?l.push(new a(i)):s.push(new a(i)))})),l.length>0){let t=new n(i);t.options=l,s.push(t)}}i instanceof a&&(t&&!t(i)||s.push(new a(i)))})),s}selectedOrderOptions(t){const e=[];return this.selectedOrder.forEach((s=>{const i=t.find((t=>t.id===s));i&&e.push(i)})),t.forEach((t=>{let s=!1;e.forEach((e=>{t.id!==e.id||(s=!0)})),s||e.push(t)})),e}}class o{static getLiveAssertive(){let t=document.getElementById("ss-live-assertive");return t||(t=document.createElement("div"),t.id="ss-live-assertive",t.setAttribute("role","status"),t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true"),t.className="ss-sr-only",document.body.appendChild(t)),t}_announceAssertive(t){const e=o._liveAssertive||(o._liveAssertive=o.getLiveAssertive());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}constructor(t,e,s,i){var n;this.store=s,this.settings=t,this.classes=e,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes();const a=null===(n=document.querySelector(`[data-id="${this.settings.id}"]`))||void 0===n?void 0:n.closest(".offcanvas-body");a?a.appendChild(this.content.main):this.settings.contentLocation&&this.settings.contentLocation.appendChild(this.content.main)}static getLivePolite(){let t=document.getElementById("ss-live-polite");return t||(t=document.createElement("div"),t.id="ss-live-polite",t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.className="ss-sr-only",document.body.appendChild(t)),t}_announcePolite(t){const e=o._livePolite||(o._livePolite=o.getLivePolite());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}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)}"fixed"===this.settings.contentPosition&&(this.moveContent(),this.scrollHandler=()=>this.moveContent(),this.resizeHandler=()=>this.moveContent(),window.addEventListener("scroll",this.scrollHandler,!0),window.addEventListener("resize",this.resizeHandler)),this.searchFocus()}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),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=void 0),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=void 0),this.main.main.focus({preventScroll:!0}),this.main.main.removeAttribute("aria-activedescendant")}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.main.main.classList.add("ss-2"),this.content.main.classList.add(this.classes.content),this.content.main.classList.add("ss-content-2"),""!==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&&"fixed"!==this.settings.contentPosition||this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){this.content.list.setAttribute("role","listbox"),this.content.list.setAttribute("id",this.content.main.id+"-list"),this.content.list.setAttribute("aria-label",this.settings.contentAriaLabel),this.settings.isMultiple?this.content.list.setAttribute("aria-multiselectable","true"):this.content.list.removeAttribute("aria-multiselectable"),this.main.main.setAttribute("role","combobox"),this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.list.id),this.main.main.setAttribute("aria-expanded","false"),this.main.main.setAttribute("aria-autocomplete","list"),this.settings.ariaLabelledBy&&this.settings.ariaLabelledBy.trim()?(this.main.main.setAttribute("aria-labelledby",this.settings.ariaLabelledBy),this.main.main.removeAttribute("aria-label")):this.settings.ariaLabel&&this.settings.ariaLabel.trim()&&this.main.main.setAttribute("aria-label",this.settings.ariaLabel),this.main.main.setAttribute("aria-owns",this.content.list.id),this.content.search.input.setAttribute("aria-controls",this.content.list.id),this.content.search.input.setAttribute("aria-autocomplete","list")}mainDiv(){var t;const e=document.createElement("div");e.id=this.settings.id+"-main",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===t.key.length&&this.callbacks.open(),!0},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),i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("aria-label",this.settings.clearAllAriaLabel),i.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i.click())}));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"),a.setAttribute("aria-hidden","true"),a.setAttribute("focusable","false");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"),o.setAttribute("aria-hidden","true"),o.setAttribute("focusable","false");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()}this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e));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 i=this.store.getSelectedOptions(),l=i.filter((e=>e.selected&&e.id!==t.id),!0);if(!(this.settings.minSelected&&l.length{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),s.click())}}return e}contentDiv(){const t=document.createElement("div");t.id=this.settings.id+"-content";const e=this.searchDiv();t.appendChild(e.main);const s=this.listDiv();return t.appendChild(s),{main:t,search:e,list:s}}moveContent(){"relative"!==this.settings.contentPosition&&"down"!==this.settings.openPosition?"up"!==this.settings.openPosition?"up"===this.putContent()?this.moveContentAbove():this.moveContentBelow():this.moveContentAbove():this.moveContentBelow()}searchDiv(){const t=document.createElement("div"),e=document.createElement("input"),i=document.createElement("div");t.classList.add(this.classes.search);const n={main:t,input:e};if(this.settings.showSearch||(t.classList.add(this.classes.hide),e.readOnly=!0),e.type="search",e.placeholder=this.settings.searchPlaceholder,e.tabIndex=-1,this.settings.searchLabelledBy&&this.settings.searchLabelledBy.trim()?e.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel&&this.settings.searchAriaLabel.trim()?e.setAttribute("aria-label",this.settings.searchAriaLabel):e.setAttribute("aria-label","Search options"),e.setAttribute("autocapitalize","off"),e.setAttribute("autocomplete","off"),e.setAttribute("autocorrect","off"),e.oninput=s((t=>{this.callbacks.search(t.target.value)}),100),e.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" ":const e=this.content.list.querySelector("."+this.classes.highlighted);return!e||(e.click(),!1);case"Enter":if(this.callbacks.addable)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(e),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"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false");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 a(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=>{"string"==typeof t?s({text:t,value:t}):i instanceof Error?this.renderError(i.message):s(t)})):"string"==typeof i?s({text:i,value:i}):i instanceof Error?this.renderError(i.message):s(i))},t.appendChild(i),n.addable={main:i,svg:e,path:s}}return n}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.main.main.setAttribute("aria-activedescendant",a.id),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}const i=e["down"===t?0:e.length-1];i.classList.add(this.classes.highlighted),this.main.main.setAttribute("aria-activedescendant",i.id),this.ensureElementInView(this.content.list,i)}listDiv(){const t=document.createElement("div");return t.classList.add(this.classes.list),t}renderError(t){this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy");const e=document.createElement("div");e.classList.add(this.classes.error),e.textContent=t,this.content.list.appendChild(e),this._announceAssertive(t)}renderSearching(){this.content.list.innerHTML="",this.content.list.setAttribute("aria-busy","true");const t=document.createElement("div");t.classList.add(this.classes.searching),t.textContent=this.settings.searchingText,this.content.list.appendChild(t),this._announcePolite(this.settings.searchingText)}renderOptions(t){if(this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy"),0===t.length){const t=document.createElement("div");t.classList.add(this.classes.search);const e=this.callbacks.addable?this.settings.addableText.replace("{value}",this.content.search.input.value):this.settings.searchText;return this._announcePolite(e),t.innerHTML=e,this.content.list.appendChild(t),void this.content.list.setAttribute("aria-setsize","0")}if(this.settings.allowDeselect&&!this.settings.isMultiple){this.store.filter((t=>t.placeholder),!1).length||this.store.addOption(new a({text:"",value:"",selected:!1,placeholder:!0}),!0)}const e=document.createDocumentFragment();let s=0;const i=t.filter((t=>t instanceof a&&!t.placeholder&&t.display&&!t.disabled)).length,l=t=>{t.classList.contains(this.classes.placeholder)||t.classList.contains(this.classes.disabled)||t.classList.contains(this.classes.hide)||(t.setAttribute("aria-posinset",String(++s)),t.setAttribute("aria-setsize",String(i)))};for(const s of t){if(s instanceof n){const t=document.createElement("div");t.classList.add(this.classes.optgroup),t.setAttribute("role","group"),t.setAttribute("aria-label",s.label);const i=document.createElement("div");i.classList.add(this.classes.optgroupLabel),t.appendChild(i);const n=document.createElement("div");n.classList.add(this.classes.optgroupLabelText),n.textContent=s.label,i.appendChild(n);const a=document.createElement("div");if(a.classList.add(this.classes.optgroupActions),i.appendChild(a),this.settings.isMultiple&&s.selectAll){const t=document.createElement("div");t.classList.add(this.classes.optgroupSelectAll);let e=!0;for(const t of s.options)if(!t.selected){e=!1;break}e&&t.classList.add(this.classes.selected);const i=document.createElement("span");i.textContent=s.selectAllText,t.appendChild(i);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),t.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.optgroupSelectAllBox),n.appendChild(l);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.optgroupSelectAllCheck),n.appendChild(o),t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const i=this.store.getSelected();if(e){const t=i.filter((t=>{for(const e of s.options)if(t===e.id)return!1;return!0}));this.callbacks.setSelected(t,!0)}else{const t=i.concat(s.options.map((t=>t.id)));for(const t of s.options)this.store.getOptionByID(t.id)||this.callbacks.addOption(t);this.callbacks.setSelected(t,!0)}})),a.appendChild(t)}if("off"!==s.closable){const e=document.createElement("div");e.classList.add(this.classes.optgroupClosable);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.classList.add(this.classes.arrow),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),e.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","path");n.appendChild(l),s.options.some((t=>t.selected))||""!==this.content.search.input.value.trim()||"open"===s.closable?(t.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"close"===s.closable&&(t.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose)),i.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))})),a.appendChild(e)}t.appendChild(i);for(const e of s.options){const s=this.option(e);l(s),t.appendChild(s)}e.appendChild(t)}if(s instanceof a){const t=this.option(s);l(t),e.appendChild(t)}}this.content.list.appendChild(e),this.content.list.removeAttribute("aria-busy");const o=this.getOptions(!0,!0,!0).length;this._announcePolite(`${o} option${1===o?"":"s"} available`)}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.id=`${this.settings.id}__opt__${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),e.setAttribute("aria-disabled","true")),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=[];if(this.settings.isMultiple)if(t.selected)o=l.filter((t=>t.id!==n));else if(o=l.concat(t),!this.settings.closeOnSelect)if(e.shiftKey&&this.lastSelectedOption){const e=this.store.getDataOptions();let s=e.findIndex((t=>t.id===this.lastSelectedOption.id)),i=e.findIndex((e=>e.id===t.id));if(s>=0&&i>=0){const t=Math.min(s,i),n=Math.max(s,i),a=e.slice(t,n+1);a.length>0&&a.length!l.find((e=>e.id===t.id))))))}}else t.selected||(this.lastSelectedOption=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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=s.left+("fixed"===this.settings.contentPosition?0: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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=t.left+("fixed"===this.settings.contentPosition?0: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)}}o._livePolite=null,o._liveAssertive=null;class c{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){if(n.target===this.select&&("disabled"===n.attributeName&&(s=!0),"class"===n.attributeName&&(e=!0),"childList"===n.type)){for(const t of n.addedNodes)if("OPTION"===t.nodeName&&t.value===this.select.value){this.select.dispatchEvent(new Event("change"));break}i=!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:"",defaultSelected:t.defaultSelected,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)}setSelectedByValue(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.value)}}if("OPTION"===s.nodeName){const e=s;e.selected=t.includes(e.value)}}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 n&&this.select.appendChild(this.createOptgroup(e)),e instanceof a&&this.select.appendChild(this.createOption(e));this.select.dispatchEvent(new Event("change",{bubbles:!0})),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.textContent=t.text,""!==t.html&&e.setAttribute("data-html",t.html),e.defaultSelected=t.defaultSelected,e.selected=t.selected,t.disabled&&(e.disabled=!0),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 r{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.focusSearch=void 0===t.focusSearch||t.focusSearch,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.contentAriaLabel=void 0!==t.contentAriaLabel?t.contentAriaLabel:"Select an option",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",this.addableText=t.addableText||'Press "Enter" to add {value}',this.ariaLabelledBy=t.ariaLabelledBy||"",this.searchAriaLabel=t.searchAriaLabel||"Search options",this.searchLabelledBy=t.searchLabelledBy||"",this.clearAllAriaLabel=t.clearAllAriaLabel||"Clear selection"}}return class{constructor(e){var i;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=s((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.windowScroll=s((()=>{(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 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 r(e.settings),this.cssClasses=new t(e.cssClasses);const n=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const t in e.events)e.events.hasOwnProperty(t)&&(-1!==n.indexOf(t)?this.events[t]=s(e.events[t],100):this.events[t]=e.events[t]);this.settings.disabled=(null===(i=e.settings)||void 0===i?void 0:i.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 c(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 l(this.settings.isMultiple?"multiple":"single",e.data?e.data:this.select.getData()),e.data&&this.select.updateOptions(this.store.getData());const a={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 o(this.settings,this.cssClasses,this.store,a),this.render.renderValues(),this.render.renderOptions(this.store.getData());const h=this.selectEl.getAttribute("aria-label"),d=this.selectEl.getAttribute("aria-labelledby");h?this.render.main.main.setAttribute("aria-label",h):d&&this.render.main.main.setAttribute("aria-labelledby",d),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(),s=this.store.validateDataArray(t);if(s)return void(this.events.error&&this.events.error(s));this.store.setData(t);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!i(e,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let t=this.store.getSelectedOptions();return this.settings.keepOrder&&(t=this.store.selectedOrderOptions(t)),t.map((t=>t.value))}setSelected(t,e=!0){const s=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&&!i(s,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 s=this.store.getData();this.select.updateOptions(s),this.render.renderValues(),this.render.renderOptions(s),this.events.afterChange&&!i(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.settings.focusSearch&&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";class t{constructor(t){t||(t={}),this.main=t.main||"ss-main",this.placeholder=t.placeholder||"ss-placeholder",this.values=t.values||"ss-values",this.single=t.single||"ss-single",this.max=t.max||"ss-max",this.value=t.value||"ss-value",this.valueText=t.valueText||"ss-value-text",this.valueDelete=t.valueDelete||"ss-value-delete",this.valueOut=t.valueOut||"ss-value-out",this.deselect=t.deselect||"ss-deselect",this.deselectPath=t.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=t.arrow||"ss-arrow",this.arrowClose=t.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=t.arrowOpen||"M10,70 L50,30 L90,70",this.content=t.content||"ss-content",this.openAbove=t.openAbove||"ss-open-above",this.openBelow=t.openBelow||"ss-open-below",this.search=t.search||"ss-search",this.searchHighlighter=t.searchHighlighter||"ss-search-highlight",this.searching=t.searching||"ss-searching",this.addable=t.addable||"ss-addable",this.addablePath=t.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=t.list||"ss-list",this.optgroup=t.optgroup||"ss-optgroup",this.optgroupLabel=t.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=t.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=t.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=t.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=t.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=t.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=t.optgroupClosable||"ss-closable",this.option=t.option||"ss-option",this.optionDelete=t.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=t.highlighted||"ss-highlighted",this.open=t.open||"ss-open",this.close=t.close||"ss-close",this.selected=t.selected||"ss-selected",this.error=t.error||"ss-error",this.disabled=t.disabled||"ss-disabled",this.hide=t.hide||"ss-hide"}}function e(){return Math.random().toString(36).substring(2,10)}function s(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 i(t,e){return JSON.stringify(t)===JSON.stringify(e)}class n{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 a(e))}}class a{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.defaultSelected=void 0!==t.defaultSelected&&t.defaultSelected,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 l{constructor(t,e){this.selectType="single",this.data=[],this.selectedOrder=[],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 n||"label"in e){if(!("label"in e))return new Error("Optgroup must have a label");if("options"in e&&e.options)for(let t of e.options){const e=this.validateOption(t);if(e)return e}}else{if(!(e instanceof a||"text"in e))return new Error("Data object must be a valid optgroup or option");{const t=this.validateOption(e);if(t)return 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 n||"label"in t){let s=[];"options"in t&&t.options&&t.options.forEach((t=>{s.push(new a(t))})),s.length>0&&e.push(new n(t))}(t instanceof a||"text"in t)&&e.push(new a(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,e=!1){if(e){let e=[new a(t)];this.setData(e.concat(this.getData()))}else this.setData(this.getData().concat(new a(t)))}setSelectedBy(t,e){let s=null,i=!1;const l=[];for(let o of this.data){if(o instanceof n)for(let n of o.options)s||(s=n),n.selected=!i&&e.includes(n[t]),n.selected&&(l.push(n),"single"===this.selectType&&(i=!0));o instanceof a&&(s||(s=o),o.selected=!i&&e.includes(o[t]),o.selected&&(l.push(o),"single"===this.selectType&&(i=!0)))}"single"===this.selectType&&s&&!i&&(s.selected=!0,l.push(s));const o=e.map((e=>{var s;return(null===(s=l.find((s=>s[t]===e)))||void 0===s?void 0:s.id)||""}));this.selectedOrder=o}getSelected(){return this.getSelectedOptions().map((t=>t.id))}getSelectedValues(){return this.getSelectedOptions().map((t=>t.value))}getSelectedOptions(){return this.filter((t=>t.selected),!1)}getOptgroupByID(t){for(let e of this.data)if(e instanceof n&&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 n?t=e.options[0]:e instanceof a&&(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((i=>{if(i instanceof n){let l=[];if(i.options.forEach((i=>{t&&!t(i)||(e?l.push(new a(i)):s.push(new a(i)))})),l.length>0){let t=new n(i);t.options=l,s.push(t)}}i instanceof a&&(t&&!t(i)||s.push(new a(i)))})),s}selectedOrderOptions(t){const e=[];return this.selectedOrder.forEach((s=>{const i=t.find((t=>t.id===s));i&&e.push(i)})),t.forEach((t=>{let s=!1;e.forEach((e=>{t.id!==e.id||(s=!0)})),s||e.push(t)})),e}}class o{static getLiveAssertive(){let t=document.getElementById("ss-live-assertive");return t||(t=document.createElement("div"),t.id="ss-live-assertive",t.setAttribute("role","status"),t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true"),t.className="ss-sr-only",document.body.appendChild(t)),t}_announceAssertive(t){const e=o._liveAssertive||(o._liveAssertive=o.getLiveAssertive());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}constructor(t,e,s,i){var n;this.store=s,this.settings=t,this.classes=e,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes();const a=null===(n=document.querySelector(`[data-id="${this.settings.id}"]`))||void 0===n?void 0:n.closest(".offcanvas-body");a?a.appendChild(this.content.main):this.settings.contentLocation&&this.settings.contentLocation.appendChild(this.content.main)}static getLivePolite(){let t=document.getElementById("ss-live-polite");return t||(t=document.createElement("div"),t.id="ss-live-polite",t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.className="ss-sr-only",document.body.appendChild(t)),t}_announcePolite(t){const e=o._livePolite||(o._livePolite=o.getLivePolite());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}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)}"fixed"===this.settings.contentPosition&&(this.moveContent(),this.scrollHandler=()=>this.moveContent(),this.resizeHandler=()=>this.moveContent(),window.addEventListener("scroll",this.scrollHandler,!0),window.addEventListener("resize",this.resizeHandler)),this.searchFocus()}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),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=void 0),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=void 0),this.main.main.focus({preventScroll:!0}),this.main.main.removeAttribute("aria-activedescendant")}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.main.main.classList.add("ss-2"),this.content.main.classList.add(this.classes.content),this.content.main.classList.add("ss-content-2"),""!==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&&"fixed"!==this.settings.contentPosition||this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){var t;this.content.list.setAttribute("role","listbox"),this.content.list.setAttribute("id",this.content.main.id+"-list"),this.content.list.setAttribute("aria-label",this.settings.contentAriaLabel),this.settings.isMultiple&&this.content.list.setAttribute("aria-multiselectable","true"),this.main.main.setAttribute("role","combobox"),this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.list.id),this.main.main.setAttribute("aria-expanded","false"),this.main.main.setAttribute("aria-autocomplete","list"),this.main.main.removeAttribute("aria-labelledby"),this.main.main.removeAttribute("aria-label");let e=(this.settings.ariaLabelledBy||"").trim(),s=null;if(e)s=document.getElementById(e);else{const i=document.querySelector(`select[data-id="${this.settings.id}"]`);i&&(i.id&&(s=document.querySelector(`label[for="${i.id}"]`)),s||"LABEL"!==(null===(t=i.previousElementSibling)||void 0===t?void 0:t.tagName)||(s=i.previousElementSibling),s&&(s.id||(s.id=(i.id||this.settings.id)+"-label"),e=s.id))}e&&document.getElementById(e)?this.main.main.setAttribute("aria-labelledby",e):this.settings.ariaLabel&&this.settings.ariaLabel.trim()&&this.main.main.setAttribute("aria-label",this.settings.ariaLabel.trim()),this.main.main.setAttribute("aria-owns",this.content.list.id),this.content.search.input.setAttribute("aria-controls",this.content.list.id),this.content.search.input.setAttribute("aria-autocomplete","list"),e&&document.getElementById(e)?this.content.search.input.setAttribute("aria-labelledby",e):this.settings.searchLabelledBy&&document.getElementById(this.settings.searchLabelledBy)?this.content.search.input.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel?this.content.search.input.setAttribute("aria-label",this.settings.searchAriaLabel):this.content.search.input.setAttribute("aria-label","Search options")}mainDiv(){var t;const e=document.createElement("div");e.id=this.settings.id+"-main",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===t.key.length&&this.callbacks.open(),!0},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),i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("aria-label",this.settings.clearAllAriaLabel),i.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i.click())}));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"),a.setAttribute("aria-hidden","true"),a.setAttribute("focusable","false");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"),o.setAttribute("aria-hidden","true"),o.setAttribute("focusable","false");const r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&o.classList.add(this.classes.hide),o.appendChild(r),e.appendChild(o),{main:e,values:s,deselect:{main:i,svg:a,path:l},arrow:{main:o,path:r}}}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()}this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e));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 i=this.store.getSelectedOptions(),l=i.filter((e=>e.selected&&e.id!==t.id),!0);if(!(this.settings.minSelected&&l.length{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),s.click())}}return e}contentDiv(){const t=document.createElement("div");t.id=this.settings.id+"-content";const e=this.searchDiv();t.appendChild(e.main);const s=this.listDiv();return t.appendChild(s),{main:t,search:e,list:s}}moveContent(){"relative"!==this.settings.contentPosition&&"down"!==this.settings.openPosition?"up"!==this.settings.openPosition?"up"===this.putContent()?this.moveContentAbove():this.moveContentBelow():this.moveContentAbove():this.moveContentBelow()}searchDiv(){const t=document.createElement("div"),e=document.createElement("input"),i=document.createElement("div");t.classList.add(this.classes.search);const n={main:t,input:e};if(this.settings.showSearch||(t.classList.add(this.classes.hide),e.readOnly=!0),e.type="search",e.placeholder=this.settings.searchPlaceholder,e.tabIndex=-1,this.settings.searchLabelledBy&&this.settings.searchLabelledBy.trim()?e.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel&&this.settings.searchAriaLabel.trim()?e.setAttribute("aria-label",this.settings.searchAriaLabel):e.setAttribute("aria-label","Search options"),e.setAttribute("autocapitalize","off"),e.setAttribute("autocomplete","off"),e.setAttribute("autocorrect","off"),e.oninput=s((t=>{this.callbacks.search(t.target.value)}),100),e.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" ":const e=this.content.list.querySelector("."+this.classes.highlighted);return!e||(e.click(),!1);case"Enter":if(this.callbacks.addable)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(e),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"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false");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 a(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=>{"string"==typeof t?s({text:t,value:t}):i instanceof Error?this.renderError(i.message):s(t)})):"string"==typeof i?s({text:i,value:i}):i instanceof Error?this.renderError(i.message):s(i))},t.appendChild(i),n.addable={main:i,svg:e,path:s}}return n}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.main.main.setAttribute("aria-activedescendant",a.id),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}const i=e["down"===t?0:e.length-1];i.classList.add(this.classes.highlighted),this.main.main.setAttribute("aria-activedescendant",i.id),this.ensureElementInView(this.content.list,i)}listDiv(){const t=document.createElement("div");return t.classList.add(this.classes.list),t}renderError(t){this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy");const e=document.createElement("div");e.classList.add(this.classes.error),e.textContent=t,this.content.list.appendChild(e),this._announceAssertive(t)}renderSearching(){this.content.list.innerHTML="",this.content.list.setAttribute("aria-busy","true");const t=document.createElement("div");t.classList.add(this.classes.searching),t.textContent=this.settings.searchingText,this.content.list.appendChild(t),this._announcePolite(this.settings.searchingText)}renderOptions(t){if(this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy"),0===t.length){const t=document.createElement("div");t.classList.add(this.classes.search);const e=this.callbacks.addable?this.settings.addableText.replace("{value}",this.content.search.input.value):this.settings.searchText;return this._announcePolite(e),t.innerHTML=e,this.content.list.appendChild(t),void this.content.list.setAttribute("aria-setsize","0")}if(this.settings.allowDeselect&&!this.settings.isMultiple){this.store.filter((t=>t.placeholder),!1).length||this.store.addOption(new a({text:"",value:"",selected:!1,placeholder:!0}),!0)}const e=document.createDocumentFragment();let s=0;const i=t.filter((t=>t instanceof a&&!t.placeholder&&t.display&&!t.disabled)).length,l=t=>{t.classList.contains(this.classes.placeholder)||t.classList.contains(this.classes.disabled)||t.classList.contains(this.classes.hide)||(t.setAttribute("aria-posinset",String(++s)),t.setAttribute("aria-setsize",String(i)))};for(const s of t){if(s instanceof n){const t=document.createElement("div");t.classList.add(this.classes.optgroup),t.setAttribute("role","group"),t.setAttribute("aria-label",s.label);const i=document.createElement("div");i.classList.add(this.classes.optgroupLabel),t.appendChild(i);const n=document.createElement("div");n.classList.add(this.classes.optgroupLabelText),n.textContent=s.label,i.appendChild(n);const a=document.createElement("div");if(a.classList.add(this.classes.optgroupActions),i.appendChild(a),this.settings.isMultiple&&s.selectAll){const t=document.createElement("div");t.classList.add(this.classes.optgroupSelectAll);let e=!0;for(const t of s.options)if(!t.selected){e=!1;break}e&&t.classList.add(this.classes.selected);const i=document.createElement("span");i.textContent=s.selectAllText,t.appendChild(i);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),t.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.optgroupSelectAllBox),n.appendChild(l);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.optgroupSelectAllCheck),n.appendChild(o),t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const i=this.store.getSelected();if(e){const t=i.filter((t=>{for(const e of s.options)if(t===e.id)return!1;return!0}));this.callbacks.setSelected(t,!0)}else{const t=i.concat(s.options.map((t=>t.id)));for(const t of s.options)this.store.getOptionByID(t.id)||this.callbacks.addOption(t);this.callbacks.setSelected(t,!0)}})),a.appendChild(t)}if("off"!==s.closable){const e=document.createElement("div");e.classList.add(this.classes.optgroupClosable);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.classList.add(this.classes.arrow),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),e.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","path");n.appendChild(l),s.options.some((t=>t.selected))||""!==this.content.search.input.value.trim()||"open"===s.closable?(t.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"close"===s.closable&&(t.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose)),i.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))})),a.appendChild(e)}t.appendChild(i);for(const e of s.options){const s=this.option(e);l(s),t.appendChild(s)}e.appendChild(t)}if(s instanceof a){const t=this.option(s);l(t),e.appendChild(t)}}this.content.list.appendChild(e),this.content.list.removeAttribute("aria-busy");const o=this.getOptions(!0,!0,!0).length;this._announcePolite(`${o} option${1===o?"":"s"} available`)}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=`${this.settings.id}__opt__${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),e.setAttribute("aria-disabled","true")),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=[];if(this.settings.isMultiple)if(t.selected)o=l.filter((t=>t.id!==n));else if(o=l.concat(t),!this.settings.closeOnSelect)if(e.shiftKey&&this.lastSelectedOption){const e=this.store.getDataOptions();let s=e.findIndex((t=>t.id===this.lastSelectedOption.id)),i=e.findIndex((e=>e.id===t.id));if(s>=0&&i>=0){const t=Math.min(s,i),n=Math.max(s,i),a=e.slice(t,n+1);a.length>0&&a.length!l.find((e=>e.id===t.id))))))}}else t.selected||(this.lastSelectedOption=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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=s.left+("fixed"===this.settings.contentPosition?0: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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=t.left+("fixed"===this.settings.contentPosition?0: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)}}o._livePolite=null,o._liveAssertive=null;class r{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){if(n.target===this.select&&("disabled"===n.attributeName&&(s=!0),"class"===n.attributeName&&(e=!0),"childList"===n.type)){for(const t of n.addedNodes)if("OPTION"===t.nodeName&&t.value===this.select.value){this.select.dispatchEvent(new Event("change"));break}i=!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:"",defaultSelected:t.defaultSelected,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)}setSelectedByValue(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.value)}}if("OPTION"===s.nodeName){const e=s;e.selected=t.includes(e.value)}}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 n&&this.select.appendChild(this.createOptgroup(e)),e instanceof a&&this.select.appendChild(this.createOption(e));this.select.dispatchEvent(new Event("change",{bubbles:!0})),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.textContent=t.text,""!==t.html&&e.setAttribute("data-html",t.html),e.defaultSelected=t.defaultSelected,e.selected=t.selected,t.disabled&&(e.disabled=!0),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(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.focusSearch=void 0===t.focusSearch||t.focusSearch,this.ariaLabel=t.ariaLabel||"",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.contentAriaLabel=void 0!==t.contentAriaLabel?t.contentAriaLabel:"Select an option",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",this.addableText=t.addableText||'Press "Enter" to add {value}',this.ariaLabelledBy=t.ariaLabelledBy||"",this.searchAriaLabel=t.searchAriaLabel||"Search options",this.searchLabelledBy=t.searchLabelledBy||"",this.clearAllAriaLabel=t.clearAllAriaLabel||"Clear selection"}}return class{constructor(e){var i;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=s((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.windowScroll=s((()=>{(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 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),this.cssClasses=new t(e.cssClasses);const n=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const t in e.events)e.events.hasOwnProperty(t)&&(-1!==n.indexOf(t)?this.events[t]=s(e.events[t],100):this.events[t]=e.events[t]);this.settings.disabled=(null===(i=e.settings)||void 0===i?void 0:i.disabled)?e.settings.disabled:this.selectEl.disabled,this.settings.isMultiple=this.selectEl.multiple,this.settings.style=this.selectEl.style.cssText,this.settings.class=this.selectEl.className.split(" "),this.select=new r(this.selectEl),this.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 l(this.settings.isMultiple?"multiple":"single",e.data?e.data:this.select.getData()),e.data&&this.select.updateOptions(this.store.getData());const a={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 o(this.settings,this.cssClasses,this.store,a),this.render.renderValues(),this.render.renderOptions(this.store.getData());const h=this.selectEl.getAttribute("aria-label"),d=this.selectEl.getAttribute("aria-labelledby");h?this.render.main.main.setAttribute("aria-label",h):d&&this.render.main.main.setAttribute("aria-labelledby",d),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(),s=this.store.validateDataArray(t);if(s)return void(this.events.error&&this.events.error(s));this.store.setData(t);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!i(e,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let t=this.store.getSelectedOptions();return this.settings.keepOrder&&(t=this.store.selectedOrderOptions(t)),t.map((t=>t.value))}setSelected(t,e=!0){const s=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&&!i(s,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 s=this.store.getData();this.select.updateOptions(s),this.render.renderValues(),this.render.renderOptions(s),this.events.afterChange&&!i(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.settings.focusSearch&&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 65081a6f..c3e3df28 100644 --- a/docs/assets/index.js +++ b/docs/assets/index.js @@ -3,31 +3,31 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/home.js","asset * @vue/shared v3.5.17 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT -**//*! #__NO_SIDE_EFFECTS__ */function dn(t){const e=Object.create(null);for(const s of t.split(","))e[s]=1;return s=>s in e}const ie={},_t=[],qe=()=>{},nl=()=>!1,ws=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),pn=t=>t.startsWith("onUpdate:"),be=Object.assign,gn=(t,e)=>{const s=t.indexOf(e);s>-1&&t.splice(s,1)},il=Object.prototype.hasOwnProperty,X=(t,e)=>il.call(t,e),z=Array.isArray,Ot=t=>xs(t)==="[object Map]",Fi=t=>xs(t)==="[object Set]",G=t=>typeof t=="function",ce=t=>typeof t=="string",rt=t=>typeof t=="symbol",le=t=>t!==null&&typeof t=="object",Ii=t=>(le(t)||G(t))&&G(t.then)&&G(t.catch),Mi=Object.prototype.toString,xs=t=>Mi.call(t),rl=t=>xs(t).slice(8,-1),Ni=t=>xs(t)==="[object Object]",mn=t=>ce(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,Vt=dn(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Ss=t=>{const e=Object.create(null);return s=>e[s]||(e[s]=t(s))},ll=/-(\w)/g,Ie=Ss(t=>t.replace(ll,(e,s)=>s?s.toUpperCase():"")),ol=/\B([A-Z])/g,xt=Ss(t=>t.replace(ol,"-$1").toLowerCase()),Es=Ss(t=>t.charAt(0).toUpperCase()+t.slice(1)),Fs=Ss(t=>t?`on${Es(t)}`:""),gt=(t,e)=>!Object.is(t,e),Is=(t,...e)=>{for(let s=0;s{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:n,value:s})},al=t=>{const e=parseFloat(t);return isNaN(e)?t:e};let Bn;const Cs=()=>Bn||(Bn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function vn(t){if(z(t)){const e={};for(let s=0;s{if(s){const n=s.split(ul);n.length>1&&(e[n[0].trim()]=n[1].trim())}}),e}function bn(t){let e="";if(ce(t))e=t;else if(z(t))for(let s=0;s!!(t&&t.__v_isRef===!0),Vi=t=>ce(t)?t:t==null?"":z(t)||le(t)&&(t.toString===Mi||!G(t.toString))?Hi(t)?Vi(t.value):JSON.stringify(t,Ui,2):String(t),Ui=(t,e)=>Hi(e)?Ui(t,e.value):Ot(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((s,[n,i],r)=>(s[Ms(n,r)+" =>"]=i,s),{})}:Fi(e)?{[`Set(${e.size})`]:[...e.values()].map(s=>Ms(s))}:rt(e)?Ms(e):le(e)&&!z(e)&&!Ni(e)?String(e):e,Ms=(t,e="")=>{var s;return rt(t)?`Symbol(${(s=t.description)!=null?s:e})`:t};/** +**//*! #__NO_SIDE_EFFECTS__ */function dn(t){const e=Object.create(null);for(const s of t.split(","))e[s]=1;return s=>s in e}const ie={},_t=[],qe=()=>{},nl=()=>!1,ws=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),pn=t=>t.startsWith("onUpdate:"),be=Object.assign,gn=(t,e)=>{const s=t.indexOf(e);s>-1&&t.splice(s,1)},il=Object.prototype.hasOwnProperty,X=(t,e)=>il.call(t,e),z=Array.isArray,Ot=t=>xs(t)==="[object Map]",Ii=t=>xs(t)==="[object Set]",G=t=>typeof t=="function",ce=t=>typeof t=="string",rt=t=>typeof t=="symbol",le=t=>t!==null&&typeof t=="object",Fi=t=>(le(t)||G(t))&&G(t.then)&&G(t.catch),Mi=Object.prototype.toString,xs=t=>Mi.call(t),rl=t=>xs(t).slice(8,-1),Ni=t=>xs(t)==="[object Object]",mn=t=>ce(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,Vt=dn(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Ss=t=>{const e=Object.create(null);return s=>e[s]||(e[s]=t(s))},ll=/-(\w)/g,Fe=Ss(t=>t.replace(ll,(e,s)=>s?s.toUpperCase():"")),ol=/\B([A-Z])/g,xt=Ss(t=>t.replace(ol,"-$1").toLowerCase()),Es=Ss(t=>t.charAt(0).toUpperCase()+t.slice(1)),Is=Ss(t=>t?`on${Es(t)}`:""),gt=(t,e)=>!Object.is(t,e),Fs=(t,...e)=>{for(let s=0;s{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:n,value:s})},al=t=>{const e=parseFloat(t);return isNaN(e)?t:e};let Bn;const Cs=()=>Bn||(Bn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function vn(t){if(z(t)){const e={};for(let s=0;s{if(s){const n=s.split(ul);n.length>1&&(e[n[0].trim()]=n[1].trim())}}),e}function bn(t){let e="";if(ce(t))e=t;else if(z(t))for(let s=0;s!!(t&&t.__v_isRef===!0),Vi=t=>ce(t)?t:t==null?"":z(t)||le(t)&&(t.toString===Mi||!G(t.toString))?Hi(t)?Vi(t.value):JSON.stringify(t,Ui,2):String(t),Ui=(t,e)=>Hi(e)?Ui(t,e.value):Ot(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((s,[n,i],r)=>(s[Ms(n,r)+" =>"]=i,s),{})}:Ii(e)?{[`Set(${e.size})`]:[...e.values()].map(s=>Ms(s))}:rt(e)?Ms(e):le(e)&&!z(e)&&!Ni(e)?String(e):e,Ms=(t,e="")=>{var s;return rt(t)?`Symbol(${(s=t.description)!=null?s:e})`:t};/** * @vue/reactivity v3.5.17 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT -**/let Oe;class gl{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=Oe,!e&&Oe&&(this.index=(Oe.scopes||(Oe.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,s;if(this.scopes)for(e=0,s=this.scopes.length;e0&&--this._on===0&&(Oe=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){this._active=!1;let s,n;for(s=0,n=this.effects.length;s0)return;if($t){let e=$t;for($t=void 0;e;){const s=e.next;e.next=void 0,e.flags&=-9,e=s}}let t;for(;Ut;){let e=Ut;for(Ut=void 0;e;){const s=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(n){t||(t=n)}e=s}}if(t)throw t}function Wi(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function Gi(t){let e,s=t.depsTail,n=s;for(;n;){const i=n.prevDep;n.version===-1?(n===s&&(s=i),wn(n),vl(n)):e=n,n.dep.activeLink=n.prevActiveLink,n.prevActiveLink=void 0,n=i}t.deps=e,t.depsTail=s}function Js(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(qi(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function qi(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===Yt)||(t.globalVersion=Yt,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!Js(t))))return;t.flags|=2;const e=t.dep,s=ne,n=Be;ne=t,Be=!0;try{Wi(t);const i=t.fn(t._value);(e.version===0||gt(i,t._value))&&(t.flags|=128,t._value=i,e.version++)}catch(i){throw e.version++,i}finally{ne=s,Be=n,Gi(t),t.flags&=-3}}function wn(t,e=!1){const{dep:s,prevSub:n,nextSub:i}=t;if(n&&(n.nextSub=i,t.prevSub=void 0),i&&(i.prevSub=n,t.nextSub=void 0),s.subs===t&&(s.subs=n,!n&&s.computed)){s.computed.flags&=-5;for(let r=s.computed.deps;r;r=r.nextDep)wn(r,!0)}!e&&!--s.sc&&s.map&&s.map.delete(s.key)}function vl(t){const{prevDep:e,nextDep:s}=t;e&&(e.nextDep=s,t.prevDep=void 0),s&&(s.prevDep=e,t.nextDep=void 0)}let Be=!0;const Ki=[];function st(){Ki.push(Be),Be=!1}function nt(){const t=Ki.pop();Be=t===void 0?!0:t}function Hn(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const s=ne;ne=void 0;try{e()}finally{ne=s}}}let Yt=0;class bl{constructor(e,s){this.sub=e,this.dep=s,this.version=s.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class xn{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!ne||!Be||ne===this.computed)return;let s=this.activeLink;if(s===void 0||s.sub!==ne)s=this.activeLink=new bl(ne,this),ne.deps?(s.prevDep=ne.depsTail,ne.depsTail.nextDep=s,ne.depsTail=s):ne.deps=ne.depsTail=s,Yi(s);else if(s.version===-1&&(s.version=this.version,s.nextDep)){const n=s.nextDep;n.prevDep=s.prevDep,s.prevDep&&(s.prevDep.nextDep=n),s.prevDep=ne.depsTail,s.nextDep=void 0,ne.depsTail.nextDep=s,ne.depsTail=s,ne.deps===s&&(ne.deps=n)}return s}trigger(e){this.version++,Yt++,this.notify(e)}notify(e){yn();try{for(let s=this.subs;s;s=s.prevSub)s.sub.notify()&&s.sub.dep.notify()}finally{An()}}}function Yi(t){if(t.dep.sc++,t.sub.flags&4){const e=t.dep.computed;if(e&&!t.dep.subs){e.flags|=20;for(let n=e.deps;n;n=n.nextDep)Yi(n)}const s=t.dep.subs;s!==t&&(t.prevSub=s,s&&(s.nextSub=t)),t.dep.subs=t}}const Zs=new WeakMap,At=Symbol(""),Xs=Symbol(""),Qt=Symbol("");function ge(t,e,s){if(Be&&ne){let n=Zs.get(t);n||Zs.set(t,n=new Map);let i=n.get(s);i||(n.set(s,i=new xn),i.map=n,i.key=s),i.track()}}function et(t,e,s,n,i,r){const o=Zs.get(t);if(!o){Yt++;return}const l=a=>{a&&a.trigger()};if(yn(),e==="clear")o.forEach(l);else{const a=z(t),u=a&&mn(s);if(a&&s==="length"){const c=Number(n);o.forEach((f,p)=>{(p==="length"||p===Qt||!rt(p)&&p>=c)&&l(f)})}else switch((s!==void 0||o.has(void 0))&&l(o.get(s)),u&&l(o.get(Qt)),e){case"add":a?u&&l(o.get("length")):(l(o.get(At)),Ot(t)&&l(o.get(Xs)));break;case"delete":a||(l(o.get(At)),Ot(t)&&l(o.get(Xs)));break;case"set":Ot(t)&&l(o.get(At));break}}An()}function St(t){const e=Z(t);return e===t?e:(ge(e,"iterate",Qt),Fe(t)?e:e.map(he))}function _s(t){return ge(t=Z(t),"iterate",Qt),t}const yl={__proto__:null,[Symbol.iterator](){return Bs(this,Symbol.iterator,he)},concat(...t){return St(this).concat(...t.map(e=>z(e)?St(e):e))},entries(){return Bs(this,"entries",t=>(t[1]=he(t[1]),t))},every(t,e){return Ye(this,"every",t,e,void 0,arguments)},filter(t,e){return Ye(this,"filter",t,e,s=>s.map(he),arguments)},find(t,e){return Ye(this,"find",t,e,he,arguments)},findIndex(t,e){return Ye(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return Ye(this,"findLast",t,e,he,arguments)},findLastIndex(t,e){return Ye(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return Ye(this,"forEach",t,e,void 0,arguments)},includes(...t){return Hs(this,"includes",t)},indexOf(...t){return Hs(this,"indexOf",t)},join(t){return St(this).join(t)},lastIndexOf(...t){return Hs(this,"lastIndexOf",t)},map(t,e){return Ye(this,"map",t,e,void 0,arguments)},pop(){return Mt(this,"pop")},push(...t){return Mt(this,"push",t)},reduce(t,...e){return Vn(this,"reduce",t,e)},reduceRight(t,...e){return Vn(this,"reduceRight",t,e)},shift(){return Mt(this,"shift")},some(t,e){return Ye(this,"some",t,e,void 0,arguments)},splice(...t){return Mt(this,"splice",t)},toReversed(){return St(this).toReversed()},toSorted(t){return St(this).toSorted(t)},toSpliced(...t){return St(this).toSpliced(...t)},unshift(...t){return Mt(this,"unshift",t)},values(){return Bs(this,"values",he)}};function Bs(t,e,s){const n=_s(t),i=n[e]();return n!==t&&!Fe(t)&&(i._next=i.next,i.next=()=>{const r=i._next();return r.value&&(r.value=s(r.value)),r}),i}const Al=Array.prototype;function Ye(t,e,s,n,i,r){const o=_s(t),l=o!==t&&!Fe(t),a=o[e];if(a!==Al[e]){const f=a.apply(t,r);return l?he(f):f}let u=s;o!==t&&(l?u=function(f,p){return s.call(this,he(f),p,t)}:s.length>2&&(u=function(f,p){return s.call(this,f,p,t)}));const c=a.call(o,u,n);return l&&i?i(c):c}function Vn(t,e,s,n){const i=_s(t);let r=s;return i!==t&&(Fe(t)?s.length>3&&(r=function(o,l,a){return s.call(this,o,l,a,t)}):r=function(o,l,a){return s.call(this,o,he(l),a,t)}),i[e](r,...n)}function Hs(t,e,s){const n=Z(t);ge(n,"iterate",Qt);const i=n[e](...s);return(i===-1||i===!1)&&Cn(s[0])?(s[0]=Z(s[0]),n[e](...s)):i}function Mt(t,e,s=[]){st(),yn();const n=Z(t)[e].apply(t,s);return An(),nt(),n}const wl=dn("__proto__,__v_isRef,__isVue"),Qi=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(rt));function xl(t){rt(t)||(t=String(t));const e=Z(this);return ge(e,"has",t),e.hasOwnProperty(t)}class Ji{constructor(e=!1,s=!1){this._isReadonly=e,this._isShallow=s}get(e,s,n){if(s==="__v_skip")return e.__v_skip;const i=this._isReadonly,r=this._isShallow;if(s==="__v_isReactive")return!i;if(s==="__v_isReadonly")return i;if(s==="__v_isShallow")return r;if(s==="__v_raw")return n===(i?r?Dl:tr:r?er:Xi).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const o=z(e);if(!i){let a;if(o&&(a=yl[s]))return a;if(s==="hasOwnProperty")return xl}const l=Reflect.get(e,s,ve(e)?e:n);return(rt(s)?Qi.has(s):wl(s))||(i||ge(e,"get",s),r)?l:ve(l)?o&&mn(s)?l:l.value:le(l)?i?nr(l):Os(l):l}}class Zi extends Ji{constructor(e=!1){super(!1,e)}set(e,s,n,i){let r=e[s];if(!this._isShallow){const a=mt(r);if(!Fe(n)&&!mt(n)&&(r=Z(r),n=Z(n)),!z(e)&&ve(r)&&!ve(n))return a?!1:(r.value=n,!0)}const o=z(e)&&mn(s)?Number(s)t,ls=t=>Reflect.getPrototypeOf(t);function Ol(t,e,s){return function(...n){const i=this.__v_raw,r=Z(i),o=Ot(r),l=t==="entries"||t===Symbol.iterator&&o,a=t==="keys"&&o,u=i[t](...n),c=s?en:e?gs:he;return!e&&ge(r,"iterate",a?Xs:At),{next(){const{value:f,done:p}=u.next();return p?{value:f,done:p}:{value:l?[c(f[0]),c(f[1])]:c(f),done:p}},[Symbol.iterator](){return this}}}}function os(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function Ll(t,e){const s={get(i){const r=this.__v_raw,o=Z(r),l=Z(i);t||(gt(i,l)&&ge(o,"get",i),ge(o,"get",l));const{has:a}=ls(o),u=e?en:t?gs:he;if(a.call(o,i))return u(r.get(i));if(a.call(o,l))return u(r.get(l));r!==o&&r.get(i)},get size(){const i=this.__v_raw;return!t&&ge(Z(i),"iterate",At),Reflect.get(i,"size",i)},has(i){const r=this.__v_raw,o=Z(r),l=Z(i);return t||(gt(i,l)&&ge(o,"has",i),ge(o,"has",l)),i===l?r.has(i):r.has(i)||r.has(l)},forEach(i,r){const o=this,l=o.__v_raw,a=Z(l),u=e?en:t?gs:he;return!t&&ge(a,"iterate",At),l.forEach((c,f)=>i.call(r,u(c),u(f),o))}};return be(s,t?{add:os("add"),set:os("set"),delete:os("delete"),clear:os("clear")}:{add(i){!e&&!Fe(i)&&!mt(i)&&(i=Z(i));const r=Z(this);return ls(r).has.call(r,i)||(r.add(i),et(r,"add",i,i)),this},set(i,r){!e&&!Fe(r)&&!mt(r)&&(r=Z(r));const o=Z(this),{has:l,get:a}=ls(o);let u=l.call(o,i);u||(i=Z(i),u=l.call(o,i));const c=a.call(o,i);return o.set(i,r),u?gt(r,c)&&et(o,"set",i,r):et(o,"add",i,r),this},delete(i){const r=Z(this),{has:o,get:l}=ls(r);let a=o.call(r,i);a||(i=Z(i),a=o.call(r,i)),l&&l.call(r,i);const u=r.delete(i);return a&&et(r,"delete",i,void 0),u},clear(){const i=Z(this),r=i.size!==0,o=i.clear();return r&&et(i,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(i=>{s[i]=Ol(i,t,e)}),s}function Sn(t,e){const s=Ll(t,e);return(n,i,r)=>i==="__v_isReactive"?!t:i==="__v_isReadonly"?t:i==="__v_raw"?n:Reflect.get(X(s,i)&&i in n?s:n,i,r)}const Tl={get:Sn(!1,!1)},Pl={get:Sn(!1,!0)},Rl={get:Sn(!0,!1)};const Xi=new WeakMap,er=new WeakMap,tr=new WeakMap,Dl=new WeakMap;function kl(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Fl(t){return t.__v_skip||!Object.isExtensible(t)?0:kl(rl(t))}function Os(t){return mt(t)?t:En(t,!1,El,Tl,Xi)}function sr(t){return En(t,!1,_l,Pl,er)}function nr(t){return En(t,!0,Cl,Rl,tr)}function En(t,e,s,n,i){if(!le(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const r=Fl(t);if(r===0)return t;const o=i.get(t);if(o)return o;const l=new Proxy(t,r===2?n:s);return i.set(t,l),l}function Lt(t){return mt(t)?Lt(t.__v_raw):!!(t&&t.__v_isReactive)}function mt(t){return!!(t&&t.__v_isReadonly)}function Fe(t){return!!(t&&t.__v_isShallow)}function Cn(t){return t?!!t.__v_raw:!1}function Z(t){const e=t&&t.__v_raw;return e?Z(e):t}function Il(t){return!X(t,"__v_skip")&&Object.isExtensible(t)&&Qs(t,"__v_skip",!0),t}const he=t=>le(t)?Os(t):t,gs=t=>le(t)?nr(t):t;function ve(t){return t?t.__v_isRef===!0:!1}function ir(t){return rr(t,!1)}function Ml(t){return rr(t,!0)}function rr(t,e){return ve(t)?t:new Nl(t,e)}class Nl{constructor(e,s){this.dep=new xn,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=s?e:Z(e),this._value=s?e:he(e),this.__v_isShallow=s}get value(){return this.dep.track(),this._value}set value(e){const s=this._rawValue,n=this.__v_isShallow||Fe(e)||mt(e);e=n?e:Z(e),gt(e,s)&&(this._rawValue=e,this._value=n?e:he(e),this.dep.trigger())}}function wt(t){return ve(t)?t.value:t}const Bl={get:(t,e,s)=>e==="__v_raw"?t:wt(Reflect.get(t,e,s)),set:(t,e,s,n)=>{const i=t[e];return ve(i)&&!ve(s)?(i.value=s,!0):Reflect.set(t,e,s,n)}};function lr(t){return Lt(t)?t:new Proxy(t,Bl)}class Hl{constructor(e,s,n){this.fn=e,this.setter=s,this._value=void 0,this.dep=new xn(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Yt-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!s,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&ne!==this)return zi(this,!0),!0}get value(){const e=this.dep.track();return qi(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function Vl(t,e,s=!1){let n,i;return G(t)?n=t:(n=t.get,i=t.set),new Hl(n,i,s)}const as={},ms=new WeakMap;let yt;function Ul(t,e=!1,s=yt){if(s){let n=ms.get(s);n||ms.set(s,n=[]),n.push(t)}}function $l(t,e,s=ie){const{immediate:n,deep:i,once:r,scheduler:o,augmentJob:l,call:a}=s,u=y=>i?y:Fe(y)||i===!1||i===0?pt(y,1):pt(y);let c,f,p,g,_=!1,C=!1;if(ve(t)?(f=()=>t.value,_=Fe(t)):Lt(t)?(f=()=>u(t),_=!0):z(t)?(C=!0,_=t.some(y=>Lt(y)||Fe(y)),f=()=>t.map(y=>{if(ve(y))return y.value;if(Lt(y))return u(y);if(G(y))return a?a(y,2):y()})):G(t)?e?f=a?()=>a(t,2):t:f=()=>{if(p){st();try{p()}finally{nt()}}const y=yt;yt=c;try{return a?a(t,3,[g]):t(g)}finally{yt=y}}:f=qe,e&&i){const y=f,S=i===!0?1/0:i;f=()=>pt(y(),S)}const D=ml(),T=()=>{c.stop(),D&&D.active&&gn(D.effects,c)};if(r&&e){const y=e;e=(...S)=>{y(...S),T()}}let m=C?new Array(t.length).fill(as):as;const b=y=>{if(!(!(c.flags&1)||!c.dirty&&!y))if(e){const S=c.run();if(i||_||(C?S.some((O,F)=>gt(O,m[F])):gt(S,m))){p&&p();const O=yt;yt=c;try{const F=[S,m===as?void 0:C&&m[0]===as?[]:m,g];m=S,a?a(e,3,F):e(...F)}finally{yt=O}}}else c.run()};return l&&l(b),c=new $i(f),c.scheduler=o?()=>o(b,!1):b,g=y=>Ul(y,!1,c),p=c.onStop=()=>{const y=ms.get(c);if(y){if(a)a(y,4);else for(const S of y)S();ms.delete(c)}},e?n?b(!0):m=c.run():o?o(b.bind(null,!0),!0):c.run(),T.pause=c.pause.bind(c),T.resume=c.resume.bind(c),T.stop=T,T}function pt(t,e=1/0,s){if(e<=0||!le(t)||t.__v_skip||(s=s||new Set,s.has(t)))return t;if(s.add(t),e--,ve(t))pt(t.value,e,s);else if(z(t))for(let n=0;n{pt(n,e,s)});else if(Ni(t)){for(const n in t)pt(t[n],e,s);for(const n of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,n)&&pt(t[n],e,s)}return t}/** +**/let Oe;class gl{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=Oe,!e&&Oe&&(this.index=(Oe.scopes||(Oe.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,s;if(this.scopes)for(e=0,s=this.scopes.length;e0&&--this._on===0&&(Oe=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){this._active=!1;let s,n;for(s=0,n=this.effects.length;s0)return;if($t){let e=$t;for($t=void 0;e;){const s=e.next;e.next=void 0,e.flags&=-9,e=s}}let t;for(;Ut;){let e=Ut;for(Ut=void 0;e;){const s=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(n){t||(t=n)}e=s}}if(t)throw t}function Wi(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function Gi(t){let e,s=t.depsTail,n=s;for(;n;){const i=n.prevDep;n.version===-1?(n===s&&(s=i),wn(n),vl(n)):e=n,n.dep.activeLink=n.prevActiveLink,n.prevActiveLink=void 0,n=i}t.deps=e,t.depsTail=s}function Js(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(qi(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function qi(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===Yt)||(t.globalVersion=Yt,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!Js(t))))return;t.flags|=2;const e=t.dep,s=ne,n=Be;ne=t,Be=!0;try{Wi(t);const i=t.fn(t._value);(e.version===0||gt(i,t._value))&&(t.flags|=128,t._value=i,e.version++)}catch(i){throw e.version++,i}finally{ne=s,Be=n,Gi(t),t.flags&=-3}}function wn(t,e=!1){const{dep:s,prevSub:n,nextSub:i}=t;if(n&&(n.nextSub=i,t.prevSub=void 0),i&&(i.prevSub=n,t.nextSub=void 0),s.subs===t&&(s.subs=n,!n&&s.computed)){s.computed.flags&=-5;for(let r=s.computed.deps;r;r=r.nextDep)wn(r,!0)}!e&&!--s.sc&&s.map&&s.map.delete(s.key)}function vl(t){const{prevDep:e,nextDep:s}=t;e&&(e.nextDep=s,t.prevDep=void 0),s&&(s.prevDep=e,t.nextDep=void 0)}let Be=!0;const Ki=[];function st(){Ki.push(Be),Be=!1}function nt(){const t=Ki.pop();Be=t===void 0?!0:t}function Hn(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const s=ne;ne=void 0;try{e()}finally{ne=s}}}let Yt=0;class bl{constructor(e,s){this.sub=e,this.dep=s,this.version=s.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class xn{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!ne||!Be||ne===this.computed)return;let s=this.activeLink;if(s===void 0||s.sub!==ne)s=this.activeLink=new bl(ne,this),ne.deps?(s.prevDep=ne.depsTail,ne.depsTail.nextDep=s,ne.depsTail=s):ne.deps=ne.depsTail=s,Yi(s);else if(s.version===-1&&(s.version=this.version,s.nextDep)){const n=s.nextDep;n.prevDep=s.prevDep,s.prevDep&&(s.prevDep.nextDep=n),s.prevDep=ne.depsTail,s.nextDep=void 0,ne.depsTail.nextDep=s,ne.depsTail=s,ne.deps===s&&(ne.deps=n)}return s}trigger(e){this.version++,Yt++,this.notify(e)}notify(e){yn();try{for(let s=this.subs;s;s=s.prevSub)s.sub.notify()&&s.sub.dep.notify()}finally{An()}}}function Yi(t){if(t.dep.sc++,t.sub.flags&4){const e=t.dep.computed;if(e&&!t.dep.subs){e.flags|=20;for(let n=e.deps;n;n=n.nextDep)Yi(n)}const s=t.dep.subs;s!==t&&(t.prevSub=s,s&&(s.nextSub=t)),t.dep.subs=t}}const Zs=new WeakMap,At=Symbol(""),Xs=Symbol(""),Qt=Symbol("");function ge(t,e,s){if(Be&&ne){let n=Zs.get(t);n||Zs.set(t,n=new Map);let i=n.get(s);i||(n.set(s,i=new xn),i.map=n,i.key=s),i.track()}}function et(t,e,s,n,i,r){const o=Zs.get(t);if(!o){Yt++;return}const l=a=>{a&&a.trigger()};if(yn(),e==="clear")o.forEach(l);else{const a=z(t),u=a&&mn(s);if(a&&s==="length"){const c=Number(n);o.forEach((f,p)=>{(p==="length"||p===Qt||!rt(p)&&p>=c)&&l(f)})}else switch((s!==void 0||o.has(void 0))&&l(o.get(s)),u&&l(o.get(Qt)),e){case"add":a?u&&l(o.get("length")):(l(o.get(At)),Ot(t)&&l(o.get(Xs)));break;case"delete":a||(l(o.get(At)),Ot(t)&&l(o.get(Xs)));break;case"set":Ot(t)&&l(o.get(At));break}}An()}function St(t){const e=Z(t);return e===t?e:(ge(e,"iterate",Qt),Ie(t)?e:e.map(he))}function _s(t){return ge(t=Z(t),"iterate",Qt),t}const yl={__proto__:null,[Symbol.iterator](){return Bs(this,Symbol.iterator,he)},concat(...t){return St(this).concat(...t.map(e=>z(e)?St(e):e))},entries(){return Bs(this,"entries",t=>(t[1]=he(t[1]),t))},every(t,e){return Ye(this,"every",t,e,void 0,arguments)},filter(t,e){return Ye(this,"filter",t,e,s=>s.map(he),arguments)},find(t,e){return Ye(this,"find",t,e,he,arguments)},findIndex(t,e){return Ye(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return Ye(this,"findLast",t,e,he,arguments)},findLastIndex(t,e){return Ye(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return Ye(this,"forEach",t,e,void 0,arguments)},includes(...t){return Hs(this,"includes",t)},indexOf(...t){return Hs(this,"indexOf",t)},join(t){return St(this).join(t)},lastIndexOf(...t){return Hs(this,"lastIndexOf",t)},map(t,e){return Ye(this,"map",t,e,void 0,arguments)},pop(){return Mt(this,"pop")},push(...t){return Mt(this,"push",t)},reduce(t,...e){return Vn(this,"reduce",t,e)},reduceRight(t,...e){return Vn(this,"reduceRight",t,e)},shift(){return Mt(this,"shift")},some(t,e){return Ye(this,"some",t,e,void 0,arguments)},splice(...t){return Mt(this,"splice",t)},toReversed(){return St(this).toReversed()},toSorted(t){return St(this).toSorted(t)},toSpliced(...t){return St(this).toSpliced(...t)},unshift(...t){return Mt(this,"unshift",t)},values(){return Bs(this,"values",he)}};function Bs(t,e,s){const n=_s(t),i=n[e]();return n!==t&&!Ie(t)&&(i._next=i.next,i.next=()=>{const r=i._next();return r.value&&(r.value=s(r.value)),r}),i}const Al=Array.prototype;function Ye(t,e,s,n,i,r){const o=_s(t),l=o!==t&&!Ie(t),a=o[e];if(a!==Al[e]){const f=a.apply(t,r);return l?he(f):f}let u=s;o!==t&&(l?u=function(f,p){return s.call(this,he(f),p,t)}:s.length>2&&(u=function(f,p){return s.call(this,f,p,t)}));const c=a.call(o,u,n);return l&&i?i(c):c}function Vn(t,e,s,n){const i=_s(t);let r=s;return i!==t&&(Ie(t)?s.length>3&&(r=function(o,l,a){return s.call(this,o,l,a,t)}):r=function(o,l,a){return s.call(this,o,he(l),a,t)}),i[e](r,...n)}function Hs(t,e,s){const n=Z(t);ge(n,"iterate",Qt);const i=n[e](...s);return(i===-1||i===!1)&&Cn(s[0])?(s[0]=Z(s[0]),n[e](...s)):i}function Mt(t,e,s=[]){st(),yn();const n=Z(t)[e].apply(t,s);return An(),nt(),n}const wl=dn("__proto__,__v_isRef,__isVue"),Qi=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(rt));function xl(t){rt(t)||(t=String(t));const e=Z(this);return ge(e,"has",t),e.hasOwnProperty(t)}class Ji{constructor(e=!1,s=!1){this._isReadonly=e,this._isShallow=s}get(e,s,n){if(s==="__v_skip")return e.__v_skip;const i=this._isReadonly,r=this._isShallow;if(s==="__v_isReactive")return!i;if(s==="__v_isReadonly")return i;if(s==="__v_isShallow")return r;if(s==="__v_raw")return n===(i?r?Dl:tr:r?er:Xi).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const o=z(e);if(!i){let a;if(o&&(a=yl[s]))return a;if(s==="hasOwnProperty")return xl}const l=Reflect.get(e,s,ve(e)?e:n);return(rt(s)?Qi.has(s):wl(s))||(i||ge(e,"get",s),r)?l:ve(l)?o&&mn(s)?l:l.value:le(l)?i?nr(l):Os(l):l}}class Zi extends Ji{constructor(e=!1){super(!1,e)}set(e,s,n,i){let r=e[s];if(!this._isShallow){const a=mt(r);if(!Ie(n)&&!mt(n)&&(r=Z(r),n=Z(n)),!z(e)&&ve(r)&&!ve(n))return a?!1:(r.value=n,!0)}const o=z(e)&&mn(s)?Number(s)t,ls=t=>Reflect.getPrototypeOf(t);function Ol(t,e,s){return function(...n){const i=this.__v_raw,r=Z(i),o=Ot(r),l=t==="entries"||t===Symbol.iterator&&o,a=t==="keys"&&o,u=i[t](...n),c=s?en:e?gs:he;return!e&&ge(r,"iterate",a?Xs:At),{next(){const{value:f,done:p}=u.next();return p?{value:f,done:p}:{value:l?[c(f[0]),c(f[1])]:c(f),done:p}},[Symbol.iterator](){return this}}}}function os(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function Ll(t,e){const s={get(i){const r=this.__v_raw,o=Z(r),l=Z(i);t||(gt(i,l)&&ge(o,"get",i),ge(o,"get",l));const{has:a}=ls(o),u=e?en:t?gs:he;if(a.call(o,i))return u(r.get(i));if(a.call(o,l))return u(r.get(l));r!==o&&r.get(i)},get size(){const i=this.__v_raw;return!t&&ge(Z(i),"iterate",At),Reflect.get(i,"size",i)},has(i){const r=this.__v_raw,o=Z(r),l=Z(i);return t||(gt(i,l)&&ge(o,"has",i),ge(o,"has",l)),i===l?r.has(i):r.has(i)||r.has(l)},forEach(i,r){const o=this,l=o.__v_raw,a=Z(l),u=e?en:t?gs:he;return!t&&ge(a,"iterate",At),l.forEach((c,f)=>i.call(r,u(c),u(f),o))}};return be(s,t?{add:os("add"),set:os("set"),delete:os("delete"),clear:os("clear")}:{add(i){!e&&!Ie(i)&&!mt(i)&&(i=Z(i));const r=Z(this);return ls(r).has.call(r,i)||(r.add(i),et(r,"add",i,i)),this},set(i,r){!e&&!Ie(r)&&!mt(r)&&(r=Z(r));const o=Z(this),{has:l,get:a}=ls(o);let u=l.call(o,i);u||(i=Z(i),u=l.call(o,i));const c=a.call(o,i);return o.set(i,r),u?gt(r,c)&&et(o,"set",i,r):et(o,"add",i,r),this},delete(i){const r=Z(this),{has:o,get:l}=ls(r);let a=o.call(r,i);a||(i=Z(i),a=o.call(r,i)),l&&l.call(r,i);const u=r.delete(i);return a&&et(r,"delete",i,void 0),u},clear(){const i=Z(this),r=i.size!==0,o=i.clear();return r&&et(i,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(i=>{s[i]=Ol(i,t,e)}),s}function Sn(t,e){const s=Ll(t,e);return(n,i,r)=>i==="__v_isReactive"?!t:i==="__v_isReadonly"?t:i==="__v_raw"?n:Reflect.get(X(s,i)&&i in n?s:n,i,r)}const Tl={get:Sn(!1,!1)},Pl={get:Sn(!1,!0)},Rl={get:Sn(!0,!1)};const Xi=new WeakMap,er=new WeakMap,tr=new WeakMap,Dl=new WeakMap;function kl(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Il(t){return t.__v_skip||!Object.isExtensible(t)?0:kl(rl(t))}function Os(t){return mt(t)?t:En(t,!1,El,Tl,Xi)}function sr(t){return En(t,!1,_l,Pl,er)}function nr(t){return En(t,!0,Cl,Rl,tr)}function En(t,e,s,n,i){if(!le(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const r=Il(t);if(r===0)return t;const o=i.get(t);if(o)return o;const l=new Proxy(t,r===2?n:s);return i.set(t,l),l}function Lt(t){return mt(t)?Lt(t.__v_raw):!!(t&&t.__v_isReactive)}function mt(t){return!!(t&&t.__v_isReadonly)}function Ie(t){return!!(t&&t.__v_isShallow)}function Cn(t){return t?!!t.__v_raw:!1}function Z(t){const e=t&&t.__v_raw;return e?Z(e):t}function Fl(t){return!X(t,"__v_skip")&&Object.isExtensible(t)&&Qs(t,"__v_skip",!0),t}const he=t=>le(t)?Os(t):t,gs=t=>le(t)?nr(t):t;function ve(t){return t?t.__v_isRef===!0:!1}function ir(t){return rr(t,!1)}function Ml(t){return rr(t,!0)}function rr(t,e){return ve(t)?t:new Nl(t,e)}class Nl{constructor(e,s){this.dep=new xn,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=s?e:Z(e),this._value=s?e:he(e),this.__v_isShallow=s}get value(){return this.dep.track(),this._value}set value(e){const s=this._rawValue,n=this.__v_isShallow||Ie(e)||mt(e);e=n?e:Z(e),gt(e,s)&&(this._rawValue=e,this._value=n?e:he(e),this.dep.trigger())}}function wt(t){return ve(t)?t.value:t}const Bl={get:(t,e,s)=>e==="__v_raw"?t:wt(Reflect.get(t,e,s)),set:(t,e,s,n)=>{const i=t[e];return ve(i)&&!ve(s)?(i.value=s,!0):Reflect.set(t,e,s,n)}};function lr(t){return Lt(t)?t:new Proxy(t,Bl)}class Hl{constructor(e,s,n){this.fn=e,this.setter=s,this._value=void 0,this.dep=new xn(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Yt-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!s,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&ne!==this)return zi(this,!0),!0}get value(){const e=this.dep.track();return qi(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function Vl(t,e,s=!1){let n,i;return G(t)?n=t:(n=t.get,i=t.set),new Hl(n,i,s)}const as={},ms=new WeakMap;let yt;function Ul(t,e=!1,s=yt){if(s){let n=ms.get(s);n||ms.set(s,n=[]),n.push(t)}}function $l(t,e,s=ie){const{immediate:n,deep:i,once:r,scheduler:o,augmentJob:l,call:a}=s,u=y=>i?y:Ie(y)||i===!1||i===0?pt(y,1):pt(y);let c,f,p,g,_=!1,C=!1;if(ve(t)?(f=()=>t.value,_=Ie(t)):Lt(t)?(f=()=>u(t),_=!0):z(t)?(C=!0,_=t.some(y=>Lt(y)||Ie(y)),f=()=>t.map(y=>{if(ve(y))return y.value;if(Lt(y))return u(y);if(G(y))return a?a(y,2):y()})):G(t)?e?f=a?()=>a(t,2):t:f=()=>{if(p){st();try{p()}finally{nt()}}const y=yt;yt=c;try{return a?a(t,3,[g]):t(g)}finally{yt=y}}:f=qe,e&&i){const y=f,S=i===!0?1/0:i;f=()=>pt(y(),S)}const D=ml(),T=()=>{c.stop(),D&&D.active&&gn(D.effects,c)};if(r&&e){const y=e;e=(...S)=>{y(...S),T()}}let m=C?new Array(t.length).fill(as):as;const b=y=>{if(!(!(c.flags&1)||!c.dirty&&!y))if(e){const S=c.run();if(i||_||(C?S.some((O,I)=>gt(O,m[I])):gt(S,m))){p&&p();const O=yt;yt=c;try{const I=[S,m===as?void 0:C&&m[0]===as?[]:m,g];m=S,a?a(e,3,I):e(...I)}finally{yt=O}}}else c.run()};return l&&l(b),c=new $i(f),c.scheduler=o?()=>o(b,!1):b,g=y=>Ul(y,!1,c),p=c.onStop=()=>{const y=ms.get(c);if(y){if(a)a(y,4);else for(const S of y)S();ms.delete(c)}},e?n?b(!0):m=c.run():o?o(b.bind(null,!0),!0):c.run(),T.pause=c.pause.bind(c),T.resume=c.resume.bind(c),T.stop=T,T}function pt(t,e=1/0,s){if(e<=0||!le(t)||t.__v_skip||(s=s||new Set,s.has(t)))return t;if(s.add(t),e--,ve(t))pt(t.value,e,s);else if(z(t))for(let n=0;n{pt(n,e,s)});else if(Ni(t)){for(const n in t)pt(t[n],e,s);for(const n of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,n)&&pt(t[n],e,s)}return t}/** * @vue/runtime-core v3.5.17 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT -**/function is(t,e,s,n){try{return n?t(...n):t()}catch(i){Ls(i,e,s)}}function Ke(t,e,s,n){if(G(t)){const i=is(t,e,s,n);return i&&Ii(i)&&i.catch(r=>{Ls(r,e,s)}),i}if(z(t)){const i=[];for(let r=0;r>>1,i=Se[n],r=Jt(i);r=Jt(s)?Se.push(t):Se.splice(zl(e),0,t),t.flags|=1,cr()}}function cr(){vs||(vs=or.then(fr))}function Wl(t){z(t)?Tt.push(...t):ft&&t.id===-1?ft.splice(Et+1,0,t):t.flags&1||(Tt.push(t),t.flags|=1),cr()}function Un(t,e,s=We+1){for(;sJt(s)-Jt(n));if(Tt.length=0,ft){ft.push(...e);return}for(ft=e,Et=0;Ett.id==null?t.flags&2?-1:1/0:t.id;function fr(t){try{for(We=0;We{n._d&&Zn(-1);const r=bs(e);let o;try{o=t(...i)}finally{bs(r),n._d&&Zn(1)}return o};return n._n=!0,n._c=!0,n._d=!0,n}function vt(t,e,s,n){const i=t.dirs,r=e&&e.dirs;for(let o=0;ot.__isTeleport;function On(t,e){t.shapeFlag&6&&t.component?(t.transition=e,On(t.component.subTree,e)):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}/*! #__NO_SIDE_EFFECTS__ */function Ts(t,e){return G(t)?be({name:t.name},e,{setup:t}):t}function dr(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function jt(t,e,s,n,i=!1){if(z(t)){t.forEach((_,C)=>jt(_,e&&(z(e)?e[C]:e),s,n,i));return}if(Pt(n)&&!i){n.shapeFlag&512&&n.type.__asyncResolved&&n.component.subTree.component&&jt(t,e,s,n.component.subTree);return}const r=n.shapeFlag&4?Rn(n.component):n.el,o=i?null:r,{i:l,r:a}=t,u=e&&e.r,c=l.refs===ie?l.refs={}:l.refs,f=l.setupState,p=Z(f),g=f===ie?()=>!1:_=>X(p,_);if(u!=null&&u!==a&&(ce(u)?(c[u]=null,g(u)&&(f[u]=null)):ve(u)&&(u.value=null)),G(a))is(a,l,12,[o,c]);else{const _=ce(a),C=ve(a);if(_||C){const D=()=>{if(t.f){const T=_?g(a)?f[a]:c[a]:a.value;i?z(T)&&gn(T,r):z(T)?T.includes(r)||T.push(r):_?(c[a]=[r],g(a)&&(f[a]=c[a])):(a.value=[r],t.k&&(c[t.k]=a.value))}else _?(c[a]=o,g(a)&&(f[a]=o)):C&&(a.value=o,t.k&&(c[t.k]=o))};o?(D.id=-1,Pe(D,s)):D()}}}Cs().requestIdleCallback;Cs().cancelIdleCallback;const Pt=t=>!!t.type.__asyncLoader,pr=t=>t.type.__isKeepAlive;function Yl(t,e){gr(t,"a",e)}function Ql(t,e){gr(t,"da",e)}function gr(t,e,s=me){const n=t.__wdc||(t.__wdc=()=>{let i=s;for(;i;){if(i.isDeactivated)return;i=i.parent}return t()});if(Ps(e,n,s),s){let i=s.parent;for(;i&&i.parent;)pr(i.parent.vnode)&&Jl(n,e,s,i),i=i.parent}}function Jl(t,e,s,n){const i=Ps(e,t,n,!0);vr(()=>{gn(n[e],i)},s)}function Ps(t,e,s=me,n=!1){if(s){const i=s[t]||(s[t]=[]),r=e.__weh||(e.__weh=(...o)=>{st();const l=rs(s),a=Ke(e,s,t,o);return l(),nt(),a});return n?i.unshift(r):i.push(r),r}}const lt=t=>(e,s=me)=>{(!ts||t==="sp")&&Ps(t,(...n)=>e(...n),s)},Zl=lt("bm"),mr=lt("m"),Xl=lt("bu"),eo=lt("u"),to=lt("bum"),vr=lt("um"),so=lt("sp"),no=lt("rtg"),io=lt("rtc");function ro(t,e=me){Ps("ec",t,e)}const lo="components";function $n(t,e){return ao(lo,t,!0,e)||t}const oo=Symbol.for("v-ndc");function ao(t,e,s=!0,n=!1){const i=Ee||me;if(i){const r=i.type;{const l=Jo(r,!1);if(l&&(l===e||l===Ie(e)||l===Es(Ie(e))))return r}const o=jn(i[t]||r[t],e)||jn(i.appContext[t],e);return!o&&n?r:o}}function jn(t,e){return t&&(t[e]||t[Ie(e)]||t[Es(Ie(e))])}function tu(t,e,s,n){let i;const r=s,o=z(t);if(o||ce(t)){const l=o&&Lt(t);let a=!1,u=!1;l&&(a=!Fe(t),u=mt(t),t=_s(t)),i=new Array(t.length);for(let c=0,f=t.length;ce(l,a,void 0,r));else{const l=Object.keys(t);i=new Array(l.length);for(let a=0,u=l.length;aes(e)?!(e.type===it||e.type===Re&&!br(e.children)):!0)?t:null}const tn=t=>t?Hr(t)?Rn(t):tn(t.parent):null,zt=be(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>tn(t.parent),$root:t=>tn(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>Ar(t),$forceUpdate:t=>t.f||(t.f=()=>{_n(t.update)}),$nextTick:t=>t.n||(t.n=ar.bind(t.proxy)),$watch:t=>Po.bind(t)}),Vs=(t,e)=>t!==ie&&!t.__isScriptSetup&&X(t,e),co={get({_:t},e){if(e==="__v_skip")return!0;const{ctx:s,setupState:n,data:i,props:r,accessCache:o,type:l,appContext:a}=t;let u;if(e[0]!=="$"){const g=o[e];if(g!==void 0)switch(g){case 1:return n[e];case 2:return i[e];case 4:return s[e];case 3:return r[e]}else{if(Vs(n,e))return o[e]=1,n[e];if(i!==ie&&X(i,e))return o[e]=2,i[e];if((u=t.propsOptions[0])&&X(u,e))return o[e]=3,r[e];if(s!==ie&&X(s,e))return o[e]=4,s[e];sn&&(o[e]=0)}}const c=zt[e];let f,p;if(c)return e==="$attrs"&&ge(t.attrs,"get",""),c(t);if((f=l.__cssModules)&&(f=f[e]))return f;if(s!==ie&&X(s,e))return o[e]=4,s[e];if(p=a.config.globalProperties,X(p,e))return p[e]},set({_:t},e,s){const{data:n,setupState:i,ctx:r}=t;return Vs(i,e)?(i[e]=s,!0):n!==ie&&X(n,e)?(n[e]=s,!0):X(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(r[e]=s,!0)},has({_:{data:t,setupState:e,accessCache:s,ctx:n,appContext:i,propsOptions:r}},o){let l;return!!s[o]||t!==ie&&X(t,o)||Vs(e,o)||(l=r[0])&&X(l,o)||X(n,o)||X(zt,o)||X(i.config.globalProperties,o)},defineProperty(t,e,s){return s.get!=null?t._.accessCache[e]=0:X(s,"value")&&this.set(t,e,s.value,null),Reflect.defineProperty(t,e,s)}};function zn(t){return z(t)?t.reduce((e,s)=>(e[s]=null,e),{}):t}let sn=!0;function uo(t){const e=Ar(t),s=t.proxy,n=t.ctx;sn=!1,e.beforeCreate&&Wn(e.beforeCreate,t,"bc");const{data:i,computed:r,methods:o,watch:l,provide:a,inject:u,created:c,beforeMount:f,mounted:p,beforeUpdate:g,updated:_,activated:C,deactivated:D,beforeDestroy:T,beforeUnmount:m,destroyed:b,unmounted:y,render:S,renderTracked:O,renderTriggered:F,errorCaptured:W,serverPrefetch:H,expose:K,inheritAttrs:re,components:pe,directives:Le,filters:ot}=e;if(u&&fo(u,n,null),o)for(const Q in o){const $=o[Q];G($)&&(n[Q]=$.bind(s))}if(i){const Q=i.call(s,s);le(Q)&&(t.data=Os(Q))}if(sn=!0,r)for(const Q in r){const $=r[Q],ae=G($)?$.bind(s,s):G($.get)?$.get.bind(s,s):qe,ye=!G($)&&G($.set)?$.set.bind(s):qe,Ae=Ne({get:ae,set:ye});Object.defineProperty(n,Q,{enumerable:!0,configurable:!0,get:()=>Ae.value,set:te=>Ae.value=te})}if(l)for(const Q in l)yr(l[Q],n,s,Q);if(a){const Q=G(a)?a.call(s):a;Reflect.ownKeys(Q).forEach($=>{cs($,Q[$])})}c&&Wn(c,t,"c");function oe(Q,$){z($)?$.forEach(ae=>Q(ae.bind(s))):$&&Q($.bind(s))}if(oe(Zl,f),oe(mr,p),oe(Xl,g),oe(eo,_),oe(Yl,C),oe(Ql,D),oe(ro,W),oe(io,O),oe(no,F),oe(to,m),oe(vr,y),oe(so,H),z(K))if(K.length){const Q=t.exposed||(t.exposed={});K.forEach($=>{Object.defineProperty(Q,$,{get:()=>s[$],set:ae=>s[$]=ae})})}else t.exposed||(t.exposed={});S&&t.render===qe&&(t.render=S),re!=null&&(t.inheritAttrs=re),pe&&(t.components=pe),Le&&(t.directives=Le),H&&dr(t)}function fo(t,e,s=qe){z(t)&&(t=nn(t));for(const n in t){const i=t[n];let r;le(i)?"default"in i?r=tt(i.from||n,i.default,!0):r=tt(i.from||n):r=tt(i),ve(r)?Object.defineProperty(e,n,{enumerable:!0,configurable:!0,get:()=>r.value,set:o=>r.value=o}):e[n]=r}}function Wn(t,e,s){Ke(z(t)?t.map(n=>n.bind(e.proxy)):t.bind(e.proxy),e,s)}function yr(t,e,s,n){let i=n.includes(".")?kr(s,n):()=>s[n];if(ce(t)){const r=e[t];G(r)&&us(i,r)}else if(G(t))us(i,t.bind(s));else if(le(t))if(z(t))t.forEach(r=>yr(r,e,s,n));else{const r=G(t.handler)?t.handler.bind(s):e[t.handler];G(r)&&us(i,r,t)}}function Ar(t){const e=t.type,{mixins:s,extends:n}=e,{mixins:i,optionsCache:r,config:{optionMergeStrategies:o}}=t.appContext,l=r.get(e);let a;return l?a=l:!i.length&&!s&&!n?a=e:(a={},i.length&&i.forEach(u=>ys(a,u,o,!0)),ys(a,e,o)),le(e)&&r.set(e,a),a}function ys(t,e,s,n=!1){const{mixins:i,extends:r}=e;r&&ys(t,r,s,!0),i&&i.forEach(o=>ys(t,o,s,!0));for(const o in e)if(!(n&&o==="expose")){const l=ho[o]||s&&s[o];t[o]=l?l(t[o],e[o]):e[o]}return t}const ho={data:Gn,props:qn,emits:qn,methods:Ht,computed:Ht,beforeCreate:xe,created:xe,beforeMount:xe,mounted:xe,beforeUpdate:xe,updated:xe,beforeDestroy:xe,beforeUnmount:xe,destroyed:xe,unmounted:xe,activated:xe,deactivated:xe,errorCaptured:xe,serverPrefetch:xe,components:Ht,directives:Ht,watch:go,provide:Gn,inject:po};function Gn(t,e){return e?t?function(){return be(G(t)?t.call(this,this):t,G(e)?e.call(this,this):e)}:e:t}function po(t,e){return Ht(nn(t),nn(e))}function nn(t){if(z(t)){const e={};for(let s=0;s1)return s&&G(e)?e.call(n&&n.proxy):e}}const xr={},Sr=()=>Object.create(xr),Er=t=>Object.getPrototypeOf(t)===xr;function bo(t,e,s,n=!1){const i={},r=Sr();t.propsDefaults=Object.create(null),Cr(t,e,i,r);for(const o in t.propsOptions[0])o in i||(i[o]=void 0);s?t.props=n?i:sr(i):t.type.props?t.props=i:t.props=r,t.attrs=r}function yo(t,e,s,n){const{props:i,attrs:r,vnode:{patchFlag:o}}=t,l=Z(i),[a]=t.propsOptions;let u=!1;if((n||o>0)&&!(o&16)){if(o&8){const c=t.vnode.dynamicProps;for(let f=0;f{a=!0;const[p,g]=_r(f,e,!0);be(o,p),g&&l.push(...g)};!s&&e.mixins.length&&e.mixins.forEach(c),t.extends&&c(t.extends),t.mixins&&t.mixins.forEach(c)}if(!r&&!a)return le(t)&&n.set(t,_t),_t;if(z(r))for(let c=0;ct[0]==="_"||t==="$stable",Tn=t=>z(t)?t.map(Ge):[Ge(t)],wo=(t,e,s)=>{if(e._n)return e;const n=Gl((...i)=>Tn(e(...i)),s);return n._c=!1,n},Or=(t,e,s)=>{const n=t._ctx;for(const i in t){if(Ln(i))continue;const r=t[i];if(G(r))e[i]=wo(i,r,n);else if(r!=null){const o=Tn(r);e[i]=()=>o}}},Lr=(t,e)=>{const s=Tn(e);t.slots.default=()=>s},Tr=(t,e,s)=>{for(const n in e)(s||!Ln(n))&&(t[n]=e[n])},xo=(t,e,s)=>{const n=t.slots=Sr();if(t.vnode.shapeFlag&32){const i=e.__;i&&Qs(n,"__",i,!0);const r=e._;r?(Tr(n,e,s),s&&Qs(n,"_",r,!0)):Or(e,n)}else e&&Lr(t,e)},So=(t,e,s)=>{const{vnode:n,slots:i}=t;let r=!0,o=ie;if(n.shapeFlag&32){const l=e._;l?s&&l===1?r=!1:Tr(i,e,s):(r=!e.$stable,Or(e,i)),o=e}else e&&(Lr(t,e),o={default:1});if(r)for(const l in i)!Ln(l)&&o[l]==null&&delete i[l]},Pe=No;function Eo(t){return Co(t)}function Co(t,e){const s=Cs();s.__VUE__=!0;const{insert:n,remove:i,patchProp:r,createElement:o,createText:l,createComment:a,setText:u,setElementText:c,parentNode:f,nextSibling:p,setScopeId:g=qe,insertStaticContent:_}=t,C=(h,d,v,w=null,E=null,x=null,I=void 0,R=null,P=!!d.dynamicChildren)=>{if(h===d)return;h&&!Nt(h,d)&&(w=A(h),te(h,E,x,!0),h=null),d.patchFlag===-2&&(P=!1,d.dynamicChildren=null);const{type:L,ref:U,shapeFlag:M}=d;switch(L){case Ds:D(h,d,v,w);break;case it:T(h,d,v,w);break;case fs:h==null&&m(d,v,w,I);break;case Re:pe(h,d,v,w,E,x,I,R,P);break;default:M&1?S(h,d,v,w,E,x,I,R,P):M&6?Le(h,d,v,w,E,x,I,R,P):(M&64||M&128)&&L.process(h,d,v,w,E,x,I,R,P,B)}U!=null&&E?jt(U,h&&h.ref,x,d||h,!d):U==null&&h&&h.ref!=null&&jt(h.ref,null,x,h,!0)},D=(h,d,v,w)=>{if(h==null)n(d.el=l(d.children),v,w);else{const E=d.el=h.el;d.children!==h.children&&u(E,d.children)}},T=(h,d,v,w)=>{h==null?n(d.el=a(d.children||""),v,w):d.el=h.el},m=(h,d,v,w)=>{[h.el,h.anchor]=_(h.children,d,v,w,h.el,h.anchor)},b=({el:h,anchor:d},v,w)=>{let E;for(;h&&h!==d;)E=p(h),n(h,v,w),h=E;n(d,v,w)},y=({el:h,anchor:d})=>{let v;for(;h&&h!==d;)v=p(h),i(h),h=v;i(d)},S=(h,d,v,w,E,x,I,R,P)=>{d.type==="svg"?I="svg":d.type==="math"&&(I="mathml"),h==null?O(d,v,w,E,x,I,R,P):H(h,d,E,x,I,R,P)},O=(h,d,v,w,E,x,I,R)=>{let P,L;const{props:U,shapeFlag:M,transition:V,dirs:j}=h;if(P=h.el=o(h.type,x,U&&U.is,U),M&8?c(P,h.children):M&16&&W(h.children,P,null,w,E,Us(h,x),I,R),j&&vt(h,null,w,"created"),F(P,h,h.scopeId,I,w),U){for(const se in U)se!=="value"&&!Vt(se)&&r(P,se,null,U[se],x,w);"value"in U&&r(P,"value",null,U.value,x),(L=U.onVnodeBeforeMount)&&ze(L,w,h)}j&&vt(h,null,w,"beforeMount");const q=_o(E,V);q&&V.beforeEnter(P),n(P,d,v),((L=U&&U.onVnodeMounted)||q||j)&&Pe(()=>{L&&ze(L,w,h),q&&V.enter(P),j&&vt(h,null,w,"mounted")},E)},F=(h,d,v,w,E)=>{if(v&&g(h,v),w)for(let x=0;x{for(let L=P;L{const R=d.el=h.el;let{patchFlag:P,dynamicChildren:L,dirs:U}=d;P|=h.patchFlag&16;const M=h.props||ie,V=d.props||ie;let j;if(v&&bt(v,!1),(j=V.onVnodeBeforeUpdate)&&ze(j,v,d,h),U&&vt(d,h,v,"beforeUpdate"),v&&bt(v,!0),(M.innerHTML&&V.innerHTML==null||M.textContent&&V.textContent==null)&&c(R,""),L?K(h.dynamicChildren,L,R,v,w,Us(d,E),x):I||$(h,d,R,null,v,w,Us(d,E),x,!1),P>0){if(P&16)re(R,M,V,v,E);else if(P&2&&M.class!==V.class&&r(R,"class",null,V.class,E),P&4&&r(R,"style",M.style,V.style,E),P&8){const q=d.dynamicProps;for(let se=0;se{j&&ze(j,v,d,h),U&&vt(d,h,v,"updated")},w)},K=(h,d,v,w,E,x,I)=>{for(let R=0;R{if(d!==v){if(d!==ie)for(const x in d)!Vt(x)&&!(x in v)&&r(h,x,d[x],null,E,w);for(const x in v){if(Vt(x))continue;const I=v[x],R=d[x];I!==R&&x!=="value"&&r(h,x,R,I,E,w)}"value"in v&&r(h,"value",d.value,v.value,E)}},pe=(h,d,v,w,E,x,I,R,P)=>{const L=d.el=h?h.el:l(""),U=d.anchor=h?h.anchor:l("");let{patchFlag:M,dynamicChildren:V,slotScopeIds:j}=d;j&&(R=R?R.concat(j):j),h==null?(n(L,v,w),n(U,v,w),W(d.children||[],v,U,E,x,I,R,P)):M>0&&M&64&&V&&h.dynamicChildren?(K(h.dynamicChildren,V,v,E,x,I,R),(d.key!=null||E&&d===E.subTree)&&Pr(h,d,!0)):$(h,d,v,U,E,x,I,R,P)},Le=(h,d,v,w,E,x,I,R,P)=>{d.slotScopeIds=R,h==null?d.shapeFlag&512?E.ctx.activate(d,v,w,I,P):ot(d,v,w,E,x,I,P):at(h,d,P)},ot=(h,d,v,w,E,x,I)=>{const R=h.component=Go(h,w,E);if(pr(h)&&(R.ctx.renderer=B),qo(R,!1,I),R.asyncDep){if(E&&E.registerDep(R,oe,I),!h.el){const P=R.subTree=de(it);T(null,P,d,v)}}else oe(R,h,d,v,E,x,I)},at=(h,d,v)=>{const w=d.component=h.component;if(Io(h,d,v))if(w.asyncDep&&!w.asyncResolved){Q(w,d,v);return}else w.next=d,w.update();else d.el=h.el,w.vnode=d},oe=(h,d,v,w,E,x,I)=>{const R=()=>{if(h.isMounted){let{next:M,bu:V,u:j,parent:q,vnode:se}=h;{const $e=Rr(h);if($e){M&&(M.el=se.el,Q(h,M,I)),$e.asyncDep.then(()=>{h.isUnmounted||R()});return}}let ee=M,Ce;bt(h,!1),M?(M.el=se.el,Q(h,M,I)):M=se,V&&Is(V),(Ce=M.props&&M.props.onVnodeBeforeUpdate)&&ze(Ce,q,M,se),bt(h,!0);const _e=Qn(h),Ue=h.subTree;h.subTree=_e,C(Ue,_e,f(Ue.el),A(Ue),h,E,x),M.el=_e.el,ee===null&&Mo(h,_e.el),j&&Pe(j,E),(Ce=M.props&&M.props.onVnodeUpdated)&&Pe(()=>ze(Ce,q,M,se),E)}else{let M;const{el:V,props:j}=d,{bm:q,m:se,parent:ee,root:Ce,type:_e}=h,Ue=Pt(d);bt(h,!1),q&&Is(q),!Ue&&(M=j&&j.onVnodeBeforeMount)&&ze(M,ee,d),bt(h,!0);{Ce.ce&&Ce.ce._def.shadowRoot!==!1&&Ce.ce._injectChildStyle(_e);const $e=h.subTree=Qn(h);C(null,$e,v,w,h,E,x),d.el=$e.el}if(se&&Pe(se,E),!Ue&&(M=j&&j.onVnodeMounted)){const $e=d;Pe(()=>ze(M,ee,$e),E)}(d.shapeFlag&256||ee&&Pt(ee.vnode)&&ee.vnode.shapeFlag&256)&&h.a&&Pe(h.a,E),h.isMounted=!0,d=v=w=null}};h.scope.on();const P=h.effect=new $i(R);h.scope.off();const L=h.update=P.run.bind(P),U=h.job=P.runIfDirty.bind(P);U.i=h,U.id=h.uid,P.scheduler=()=>_n(U),bt(h,!0),L()},Q=(h,d,v)=>{d.component=h;const w=h.vnode.props;h.vnode=d,h.next=null,yo(h,d.props,w,v),So(h,d.children,v),st(),Un(h),nt()},$=(h,d,v,w,E,x,I,R,P=!1)=>{const L=h&&h.children,U=h?h.shapeFlag:0,M=d.children,{patchFlag:V,shapeFlag:j}=d;if(V>0){if(V&128){ye(L,M,v,w,E,x,I,R,P);return}else if(V&256){ae(L,M,v,w,E,x,I,R,P);return}}j&8?(U&16&&fe(L,E,x),M!==L&&c(v,M)):U&16?j&16?ye(L,M,v,w,E,x,I,R,P):fe(L,E,x,!0):(U&8&&c(v,""),j&16&&W(M,v,w,E,x,I,R,P))},ae=(h,d,v,w,E,x,I,R,P)=>{h=h||_t,d=d||_t;const L=h.length,U=d.length,M=Math.min(L,U);let V;for(V=0;VU?fe(h,E,x,!0,!1,M):W(d,v,w,E,x,I,R,P,M)},ye=(h,d,v,w,E,x,I,R,P)=>{let L=0;const U=d.length;let M=h.length-1,V=U-1;for(;L<=M&&L<=V;){const j=h[L],q=d[L]=P?ht(d[L]):Ge(d[L]);if(Nt(j,q))C(j,q,v,null,E,x,I,R,P);else break;L++}for(;L<=M&&L<=V;){const j=h[M],q=d[V]=P?ht(d[V]):Ge(d[V]);if(Nt(j,q))C(j,q,v,null,E,x,I,R,P);else break;M--,V--}if(L>M){if(L<=V){const j=V+1,q=jV)for(;L<=M;)te(h[L],E,x,!0),L++;else{const j=L,q=L,se=new Map;for(L=q;L<=V;L++){const Te=d[L]=P?ht(d[L]):Ge(d[L]);Te.key!=null&&se.set(Te.key,L)}let ee,Ce=0;const _e=V-q+1;let Ue=!1,$e=0;const It=new Array(_e);for(L=0;L<_e;L++)It[L]=0;for(L=j;L<=M;L++){const Te=h[L];if(Ce>=_e){te(Te,E,x,!0);continue}let je;if(Te.key!=null)je=se.get(Te.key);else for(ee=q;ee<=V;ee++)if(It[ee-q]===0&&Nt(Te,d[ee])){je=ee;break}je===void 0?te(Te,E,x,!0):(It[je-q]=L+1,je>=$e?$e=je:Ue=!0,C(Te,d[je],v,null,E,x,I,R,P),Ce++)}const Mn=Ue?Oo(It):_t;for(ee=Mn.length-1,L=_e-1;L>=0;L--){const Te=q+L,je=d[Te],Nn=Te+1{const{el:x,type:I,transition:R,children:P,shapeFlag:L}=h;if(L&6){Ae(h.component.subTree,d,v,w);return}if(L&128){h.suspense.move(d,v,w);return}if(L&64){I.move(h,d,v,B);return}if(I===Re){n(x,d,v);for(let M=0;MR.enter(x),E);else{const{leave:M,delayLeave:V,afterLeave:j}=R,q=()=>{h.ctx.isUnmounted?i(x):n(x,d,v)},se=()=>{M(x,()=>{q(),j&&j()})};V?V(x,q,se):se()}else n(x,d,v)},te=(h,d,v,w=!1,E=!1)=>{const{type:x,props:I,ref:R,children:P,dynamicChildren:L,shapeFlag:U,patchFlag:M,dirs:V,cacheIndex:j}=h;if(M===-2&&(E=!1),R!=null&&(st(),jt(R,null,v,h,!0),nt()),j!=null&&(d.renderCache[j]=void 0),U&256){d.ctx.deactivate(h);return}const q=U&1&&V,se=!Pt(h);let ee;if(se&&(ee=I&&I.onVnodeBeforeUnmount)&&ze(ee,d,h),U&6)Ve(h.component,v,w);else{if(U&128){h.suspense.unmount(v,w);return}q&&vt(h,null,d,"beforeUnmount"),U&64?h.type.remove(h,d,v,B,w):L&&!L.hasOnce&&(x!==Re||M>0&&M&64)?fe(L,d,v,!1,!0):(x===Re&&M&384||!E&&U&16)&&fe(P,d,v),w&&ct(h)}(se&&(ee=I&&I.onVnodeUnmounted)||q)&&Pe(()=>{ee&&ze(ee,d,h),q&&vt(h,null,d,"unmounted")},v)},ct=h=>{const{type:d,el:v,anchor:w,transition:E}=h;if(d===Re){we(v,w);return}if(d===fs){y(h);return}const x=()=>{i(v),E&&!E.persisted&&E.afterLeave&&E.afterLeave()};if(h.shapeFlag&1&&E&&!E.persisted){const{leave:I,delayLeave:R}=E,P=()=>I(v,x);R?R(h.el,x,P):P()}else x()},we=(h,d)=>{let v;for(;h!==d;)v=p(h),i(h),h=v;i(d)},Ve=(h,d,v)=>{const{bum:w,scope:E,job:x,subTree:I,um:R,m:P,a:L,parent:U,slots:{__:M}}=h;Yn(P),Yn(L),w&&Is(w),U&&z(M)&&M.forEach(V=>{U.renderCache[V]=void 0}),E.stop(),x&&(x.flags|=8,te(I,h,d,v)),R&&Pe(R,d),Pe(()=>{h.isUnmounted=!0},d),d&&d.pendingBranch&&!d.isUnmounted&&h.asyncDep&&!h.asyncResolved&&h.suspenseId===d.pendingId&&(d.deps--,d.deps===0&&d.resolve())},fe=(h,d,v,w=!1,E=!1,x=0)=>{for(let I=x;I{if(h.shapeFlag&6)return A(h.component.subTree);if(h.shapeFlag&128)return h.suspense.next();const d=p(h.anchor||h.el),v=d&&d[ql];return v?p(v):d};let N=!1;const k=(h,d,v)=>{h==null?d._vnode&&te(d._vnode,null,null,!0):C(d._vnode||null,h,d,null,null,null,v),d._vnode=h,N||(N=!0,Un(),ur(),N=!1)},B={p:C,um:te,m:Ae,r:ct,mt:ot,mc:W,pc:$,pbc:K,n:A,o:t};return{render:k,hydrate:void 0,createApp:vo(k)}}function Us({type:t,props:e},s){return s==="svg"&&t==="foreignObject"||s==="mathml"&&t==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:s}function bt({effect:t,job:e},s){s?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function _o(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function Pr(t,e,s=!1){const n=t.children,i=e.children;if(z(n)&&z(i))for(let r=0;r>1,t[s[l]]0&&(e[n]=s[r-1]),s[r]=n)}}for(r=s.length,o=s[r-1];r-- >0;)s[r]=o,o=e[o];return s}function Rr(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:Rr(e)}function Yn(t){if(t)for(let e=0;ett(Lo);function us(t,e,s){return Dr(t,e,s)}function Dr(t,e,s=ie){const{immediate:n,deep:i,flush:r,once:o}=s,l=be({},s),a=e&&n||!e&&r!=="post";let u;if(ts){if(r==="sync"){const g=To();u=g.__watcherHandles||(g.__watcherHandles=[])}else if(!a){const g=()=>{};return g.stop=qe,g.resume=qe,g.pause=qe,g}}const c=me;l.call=(g,_,C)=>Ke(g,c,_,C);let f=!1;r==="post"?l.scheduler=g=>{Pe(g,c&&c.suspense)}:r!=="sync"&&(f=!0,l.scheduler=(g,_)=>{_?g():_n(g)}),l.augmentJob=g=>{e&&(g.flags|=4),f&&(g.flags|=2,c&&(g.id=c.uid,g.i=c))};const p=$l(t,e,l);return ts&&(u?u.push(p):a&&p()),p}function Po(t,e,s){const n=this.proxy,i=ce(t)?t.includes(".")?kr(n,t):()=>n[t]:t.bind(n,n);let r;G(e)?r=e:(r=e.handler,s=e);const o=rs(this),l=Dr(i,r.bind(n),s);return o(),l}function kr(t,e){const s=e.split(".");return()=>{let n=t;for(let i=0;ie==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${Ie(e)}Modifiers`]||t[`${xt(e)}Modifiers`];function Do(t,e,...s){if(t.isUnmounted)return;const n=t.vnode.props||ie;let i=s;const r=e.startsWith("update:"),o=r&&Ro(n,e.slice(7));o&&(o.trim&&(i=s.map(c=>ce(c)?c.trim():c)),o.number&&(i=s.map(al)));let l,a=n[l=Fs(e)]||n[l=Fs(Ie(e))];!a&&r&&(a=n[l=Fs(xt(e))]),a&&Ke(a,t,6,i);const u=n[l+"Once"];if(u){if(!t.emitted)t.emitted={};else if(t.emitted[l])return;t.emitted[l]=!0,Ke(u,t,6,i)}}function Fr(t,e,s=!1){const n=e.emitsCache,i=n.get(t);if(i!==void 0)return i;const r=t.emits;let o={},l=!1;if(!G(t)){const a=u=>{const c=Fr(u,e,!0);c&&(l=!0,be(o,c))};!s&&e.mixins.length&&e.mixins.forEach(a),t.extends&&a(t.extends),t.mixins&&t.mixins.forEach(a)}return!r&&!l?(le(t)&&n.set(t,null),null):(z(r)?r.forEach(a=>o[a]=null):be(o,r),le(t)&&n.set(t,o),o)}function Rs(t,e){return!t||!ws(e)?!1:(e=e.slice(2).replace(/Once$/,""),X(t,e[0].toLowerCase()+e.slice(1))||X(t,xt(e))||X(t,e))}function Qn(t){const{type:e,vnode:s,proxy:n,withProxy:i,propsOptions:[r],slots:o,attrs:l,emit:a,render:u,renderCache:c,props:f,data:p,setupState:g,ctx:_,inheritAttrs:C}=t,D=bs(t);let T,m;try{if(s.shapeFlag&4){const y=i||n,S=y;T=Ge(u.call(S,y,c,f,g,p,_)),m=l}else{const y=e;T=Ge(y.length>1?y(f,{attrs:l,slots:o,emit:a}):y(f,null)),m=e.props?l:ko(l)}}catch(y){Wt.length=0,Ls(y,t,1),T=de(it)}let b=T;if(m&&C!==!1){const y=Object.keys(m),{shapeFlag:S}=b;y.length&&S&7&&(r&&y.some(pn)&&(m=Fo(m,r)),b=Dt(b,m,!1,!0))}return s.dirs&&(b=Dt(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(s.dirs):s.dirs),s.transition&&On(b,s.transition),T=b,bs(D),T}const ko=t=>{let e;for(const s in t)(s==="class"||s==="style"||ws(s))&&((e||(e={}))[s]=t[s]);return e},Fo=(t,e)=>{const s={};for(const n in t)(!pn(n)||!(n.slice(9)in e))&&(s[n]=t[n]);return s};function Io(t,e,s){const{props:n,children:i,component:r}=t,{props:o,children:l,patchFlag:a}=e,u=r.emitsOptions;if(e.dirs||e.transition)return!0;if(s&&a>=0){if(a&1024)return!0;if(a&16)return n?Jn(n,o,u):!!o;if(a&8){const c=e.dynamicProps;for(let f=0;ft.__isSuspense;function No(t,e){e&&e.pendingBranch?z(t)?e.effects.push(...t):e.effects.push(t):Wl(t)}const Re=Symbol.for("v-fgt"),Ds=Symbol.for("v-txt"),it=Symbol.for("v-cmt"),fs=Symbol.for("v-stc"),Wt=[];let De=null;function Zt(t=!1){Wt.push(De=t?null:[])}function Bo(){Wt.pop(),De=Wt[Wt.length-1]||null}let Xt=1;function Zn(t,e=!1){Xt+=t,t<0&&De&&e&&(De.hasOnce=!0)}function Mr(t){return t.dynamicChildren=Xt>0?De||_t:null,Bo(),Xt>0&&De&&De.push(t),t}function Nr(t,e,s,n,i,r){return Mr(Ze(t,e,s,n,i,r,!0))}function ln(t,e,s,n,i){return Mr(de(t,e,s,n,i,!0))}function es(t){return t?t.__v_isVNode===!0:!1}function Nt(t,e){return t.type===e.type&&t.key===e.key}const Br=({key:t})=>t??null,hs=({ref:t,ref_key:e,ref_for:s})=>(typeof t=="number"&&(t=""+t),t!=null?ce(t)||ve(t)||G(t)?{i:Ee,r:t,k:e,f:!!s}:t:null);function Ze(t,e=null,s=null,n=0,i=null,r=t===Re?0:1,o=!1,l=!1){const a={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&Br(e),ref:e&&hs(e),scopeId:hr,slotScopeIds:null,children:s,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:r,patchFlag:n,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:Ee};return l?(Pn(a,s),r&128&&t.normalize(a)):s&&(a.shapeFlag|=ce(s)?8:16),Xt>0&&!o&&De&&(a.patchFlag>0||r&6)&&a.patchFlag!==32&&De.push(a),a}const de=Ho;function Ho(t,e=null,s=null,n=0,i=null,r=!1){if((!t||t===oo)&&(t=it),es(t)){const l=Dt(t,e,!0);return s&&Pn(l,s),Xt>0&&!r&&De&&(l.shapeFlag&6?De[De.indexOf(t)]=l:De.push(l)),l.patchFlag=-2,l}if(Zo(t)&&(t=t.__vccOpts),e){e=Vo(e);let{class:l,style:a}=e;l&&!ce(l)&&(e.class=bn(l)),le(a)&&(Cn(a)&&!z(a)&&(a=be({},a)),e.style=vn(a))}const o=ce(t)?1:Ir(t)?128:Kl(t)?64:le(t)?4:G(t)?2:0;return Ze(t,e,s,n,i,o,r,!0)}function Vo(t){return t?Cn(t)||Er(t)?be({},t):t:null}function Dt(t,e,s=!1,n=!1){const{props:i,ref:r,patchFlag:o,children:l,transition:a}=t,u=e?jo(i||{},e):i,c={__v_isVNode:!0,__v_skip:!0,type:t.type,props:u,key:u&&Br(u),ref:e&&e.ref?s&&r?z(r)?r.concat(hs(e)):[r,hs(e)]:hs(e):r,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:l,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==Re?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:a,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&Dt(t.ssContent),ssFallback:t.ssFallback&&Dt(t.ssFallback),el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return a&&n&&On(c,a.clone(c)),c}function ds(t=" ",e=0){return de(Ds,null,t,e)}function Uo(t,e){const s=de(fs,null,t);return s.staticCount=e,s}function $o(t="",e=!1){return e?(Zt(),ln(it,null,t)):de(it,null,t)}function Ge(t){return t==null||typeof t=="boolean"?de(it):z(t)?de(Re,null,t.slice()):es(t)?ht(t):de(Ds,null,String(t))}function ht(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:Dt(t)}function Pn(t,e){let s=0;const{shapeFlag:n}=t;if(e==null)e=null;else if(z(e))s=16;else if(typeof e=="object")if(n&65){const i=e.default;i&&(i._c&&(i._d=!1),Pn(t,i()),i._c&&(i._d=!0));return}else{s=32;const i=e._;!i&&!Er(e)?e._ctx=Ee:i===3&&Ee&&(Ee.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else G(e)?(e={default:e,_ctx:Ee},s=32):(e=String(e),n&64?(s=16,e=[ds(e)]):s=8);t.children=e,t.shapeFlag|=s}function jo(...t){const e={};for(let s=0;s{let i;return(i=t[s])||(i=t[s]=[]),i.push(n),r=>{i.length>1?i.forEach(o=>o(r)):i[0](r)}};As=e("__VUE_INSTANCE_SETTERS__",s=>me=s),on=e("__VUE_SSR_SETTERS__",s=>ts=s)}const rs=t=>{const e=me;return As(t),t.scope.on(),()=>{t.scope.off(),As(e)}},Xn=()=>{me&&me.scope.off(),As(null)};function Hr(t){return t.vnode.shapeFlag&4}let ts=!1;function qo(t,e=!1,s=!1){e&&on(e);const{props:n,children:i}=t.vnode,r=Hr(t);bo(t,n,r,e),xo(t,i,s||e);const o=r?Ko(t,e):void 0;return e&&on(!1),o}function Ko(t,e){const s=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,co);const{setup:n}=s;if(n){st();const i=t.setupContext=n.length>1?Qo(t):null,r=rs(t),o=is(n,t,0,[t.props,i]),l=Ii(o);if(nt(),r(),(l||t.sp)&&!Pt(t)&&dr(t),l){if(o.then(Xn,Xn),e)return o.then(a=>{ei(t,a)}).catch(a=>{Ls(a,t,0)});t.asyncDep=o}else ei(t,o)}else Vr(t)}function ei(t,e,s){G(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:le(e)&&(t.setupState=lr(e)),Vr(t)}function Vr(t,e,s){const n=t.type;t.render||(t.render=n.render||qe);{const i=rs(t);st();try{uo(t)}finally{nt(),i()}}}const Yo={get(t,e){return ge(t,"get",""),t[e]}};function Qo(t){const e=s=>{t.exposed=s||{}};return{attrs:new Proxy(t.attrs,Yo),slots:t.slots,emit:t.emit,expose:e}}function Rn(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(lr(Il(t.exposed)),{get(e,s){if(s in e)return e[s];if(s in zt)return zt[s](t)},has(e,s){return s in e||s in zt}})):t.proxy}function Jo(t,e=!0){return G(t)?t.displayName||t.name:t.name||e&&t.__name}function Zo(t){return G(t)&&"__vccOpts"in t}const Ne=(t,e)=>Vl(t,e,ts);function Ur(t,e,s){const n=arguments.length;return n===2?le(e)&&!z(e)?es(e)?de(t,null,[e]):de(t,e):de(t,null,e):(n>3?s=Array.prototype.slice.call(arguments,2):n===3&&es(s)&&(s=[s]),de(t,e,s))}const Xo="3.5.17";/** +**/function is(t,e,s,n){try{return n?t(...n):t()}catch(i){Ls(i,e,s)}}function Ke(t,e,s,n){if(G(t)){const i=is(t,e,s,n);return i&&Fi(i)&&i.catch(r=>{Ls(r,e,s)}),i}if(z(t)){const i=[];for(let r=0;r>>1,i=Se[n],r=Jt(i);r=Jt(s)?Se.push(t):Se.splice(zl(e),0,t),t.flags|=1,cr()}}function cr(){vs||(vs=or.then(fr))}function Wl(t){z(t)?Tt.push(...t):ft&&t.id===-1?ft.splice(Et+1,0,t):t.flags&1||(Tt.push(t),t.flags|=1),cr()}function Un(t,e,s=We+1){for(;sJt(s)-Jt(n));if(Tt.length=0,ft){ft.push(...e);return}for(ft=e,Et=0;Ett.id==null?t.flags&2?-1:1/0:t.id;function fr(t){try{for(We=0;We{n._d&&Zn(-1);const r=bs(e);let o;try{o=t(...i)}finally{bs(r),n._d&&Zn(1)}return o};return n._n=!0,n._c=!0,n._d=!0,n}function vt(t,e,s,n){const i=t.dirs,r=e&&e.dirs;for(let o=0;ot.__isTeleport;function On(t,e){t.shapeFlag&6&&t.component?(t.transition=e,On(t.component.subTree,e)):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}/*! #__NO_SIDE_EFFECTS__ */function Ts(t,e){return G(t)?be({name:t.name},e,{setup:t}):t}function dr(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function jt(t,e,s,n,i=!1){if(z(t)){t.forEach((_,C)=>jt(_,e&&(z(e)?e[C]:e),s,n,i));return}if(Pt(n)&&!i){n.shapeFlag&512&&n.type.__asyncResolved&&n.component.subTree.component&&jt(t,e,s,n.component.subTree);return}const r=n.shapeFlag&4?Rn(n.component):n.el,o=i?null:r,{i:l,r:a}=t,u=e&&e.r,c=l.refs===ie?l.refs={}:l.refs,f=l.setupState,p=Z(f),g=f===ie?()=>!1:_=>X(p,_);if(u!=null&&u!==a&&(ce(u)?(c[u]=null,g(u)&&(f[u]=null)):ve(u)&&(u.value=null)),G(a))is(a,l,12,[o,c]);else{const _=ce(a),C=ve(a);if(_||C){const D=()=>{if(t.f){const T=_?g(a)?f[a]:c[a]:a.value;i?z(T)&&gn(T,r):z(T)?T.includes(r)||T.push(r):_?(c[a]=[r],g(a)&&(f[a]=c[a])):(a.value=[r],t.k&&(c[t.k]=a.value))}else _?(c[a]=o,g(a)&&(f[a]=o)):C&&(a.value=o,t.k&&(c[t.k]=o))};o?(D.id=-1,Pe(D,s)):D()}}}Cs().requestIdleCallback;Cs().cancelIdleCallback;const Pt=t=>!!t.type.__asyncLoader,pr=t=>t.type.__isKeepAlive;function Yl(t,e){gr(t,"a",e)}function Ql(t,e){gr(t,"da",e)}function gr(t,e,s=me){const n=t.__wdc||(t.__wdc=()=>{let i=s;for(;i;){if(i.isDeactivated)return;i=i.parent}return t()});if(Ps(e,n,s),s){let i=s.parent;for(;i&&i.parent;)pr(i.parent.vnode)&&Jl(n,e,s,i),i=i.parent}}function Jl(t,e,s,n){const i=Ps(e,t,n,!0);vr(()=>{gn(n[e],i)},s)}function Ps(t,e,s=me,n=!1){if(s){const i=s[t]||(s[t]=[]),r=e.__weh||(e.__weh=(...o)=>{st();const l=rs(s),a=Ke(e,s,t,o);return l(),nt(),a});return n?i.unshift(r):i.push(r),r}}const lt=t=>(e,s=me)=>{(!ts||t==="sp")&&Ps(t,(...n)=>e(...n),s)},Zl=lt("bm"),mr=lt("m"),Xl=lt("bu"),eo=lt("u"),to=lt("bum"),vr=lt("um"),so=lt("sp"),no=lt("rtg"),io=lt("rtc");function ro(t,e=me){Ps("ec",t,e)}const lo="components";function $n(t,e){return ao(lo,t,!0,e)||t}const oo=Symbol.for("v-ndc");function ao(t,e,s=!0,n=!1){const i=Ee||me;if(i){const r=i.type;{const l=Jo(r,!1);if(l&&(l===e||l===Fe(e)||l===Es(Fe(e))))return r}const o=jn(i[t]||r[t],e)||jn(i.appContext[t],e);return!o&&n?r:o}}function jn(t,e){return t&&(t[e]||t[Fe(e)]||t[Es(Fe(e))])}function tu(t,e,s,n){let i;const r=s,o=z(t);if(o||ce(t)){const l=o&&Lt(t);let a=!1,u=!1;l&&(a=!Ie(t),u=mt(t),t=_s(t)),i=new Array(t.length);for(let c=0,f=t.length;ce(l,a,void 0,r));else{const l=Object.keys(t);i=new Array(l.length);for(let a=0,u=l.length;aes(e)?!(e.type===it||e.type===Re&&!br(e.children)):!0)?t:null}const tn=t=>t?Hr(t)?Rn(t):tn(t.parent):null,zt=be(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>tn(t.parent),$root:t=>tn(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>Ar(t),$forceUpdate:t=>t.f||(t.f=()=>{_n(t.update)}),$nextTick:t=>t.n||(t.n=ar.bind(t.proxy)),$watch:t=>Po.bind(t)}),Vs=(t,e)=>t!==ie&&!t.__isScriptSetup&&X(t,e),co={get({_:t},e){if(e==="__v_skip")return!0;const{ctx:s,setupState:n,data:i,props:r,accessCache:o,type:l,appContext:a}=t;let u;if(e[0]!=="$"){const g=o[e];if(g!==void 0)switch(g){case 1:return n[e];case 2:return i[e];case 4:return s[e];case 3:return r[e]}else{if(Vs(n,e))return o[e]=1,n[e];if(i!==ie&&X(i,e))return o[e]=2,i[e];if((u=t.propsOptions[0])&&X(u,e))return o[e]=3,r[e];if(s!==ie&&X(s,e))return o[e]=4,s[e];sn&&(o[e]=0)}}const c=zt[e];let f,p;if(c)return e==="$attrs"&&ge(t.attrs,"get",""),c(t);if((f=l.__cssModules)&&(f=f[e]))return f;if(s!==ie&&X(s,e))return o[e]=4,s[e];if(p=a.config.globalProperties,X(p,e))return p[e]},set({_:t},e,s){const{data:n,setupState:i,ctx:r}=t;return Vs(i,e)?(i[e]=s,!0):n!==ie&&X(n,e)?(n[e]=s,!0):X(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(r[e]=s,!0)},has({_:{data:t,setupState:e,accessCache:s,ctx:n,appContext:i,propsOptions:r}},o){let l;return!!s[o]||t!==ie&&X(t,o)||Vs(e,o)||(l=r[0])&&X(l,o)||X(n,o)||X(zt,o)||X(i.config.globalProperties,o)},defineProperty(t,e,s){return s.get!=null?t._.accessCache[e]=0:X(s,"value")&&this.set(t,e,s.value,null),Reflect.defineProperty(t,e,s)}};function zn(t){return z(t)?t.reduce((e,s)=>(e[s]=null,e),{}):t}let sn=!0;function uo(t){const e=Ar(t),s=t.proxy,n=t.ctx;sn=!1,e.beforeCreate&&Wn(e.beforeCreate,t,"bc");const{data:i,computed:r,methods:o,watch:l,provide:a,inject:u,created:c,beforeMount:f,mounted:p,beforeUpdate:g,updated:_,activated:C,deactivated:D,beforeDestroy:T,beforeUnmount:m,destroyed:b,unmounted:y,render:S,renderTracked:O,renderTriggered:I,errorCaptured:W,serverPrefetch:H,expose:K,inheritAttrs:re,components:pe,directives:Le,filters:ot}=e;if(u&&fo(u,n,null),o)for(const Q in o){const $=o[Q];G($)&&(n[Q]=$.bind(s))}if(i){const Q=i.call(s,s);le(Q)&&(t.data=Os(Q))}if(sn=!0,r)for(const Q in r){const $=r[Q],ae=G($)?$.bind(s,s):G($.get)?$.get.bind(s,s):qe,ye=!G($)&&G($.set)?$.set.bind(s):qe,Ae=Ne({get:ae,set:ye});Object.defineProperty(n,Q,{enumerable:!0,configurable:!0,get:()=>Ae.value,set:te=>Ae.value=te})}if(l)for(const Q in l)yr(l[Q],n,s,Q);if(a){const Q=G(a)?a.call(s):a;Reflect.ownKeys(Q).forEach($=>{cs($,Q[$])})}c&&Wn(c,t,"c");function oe(Q,$){z($)?$.forEach(ae=>Q(ae.bind(s))):$&&Q($.bind(s))}if(oe(Zl,f),oe(mr,p),oe(Xl,g),oe(eo,_),oe(Yl,C),oe(Ql,D),oe(ro,W),oe(io,O),oe(no,I),oe(to,m),oe(vr,y),oe(so,H),z(K))if(K.length){const Q=t.exposed||(t.exposed={});K.forEach($=>{Object.defineProperty(Q,$,{get:()=>s[$],set:ae=>s[$]=ae})})}else t.exposed||(t.exposed={});S&&t.render===qe&&(t.render=S),re!=null&&(t.inheritAttrs=re),pe&&(t.components=pe),Le&&(t.directives=Le),H&&dr(t)}function fo(t,e,s=qe){z(t)&&(t=nn(t));for(const n in t){const i=t[n];let r;le(i)?"default"in i?r=tt(i.from||n,i.default,!0):r=tt(i.from||n):r=tt(i),ve(r)?Object.defineProperty(e,n,{enumerable:!0,configurable:!0,get:()=>r.value,set:o=>r.value=o}):e[n]=r}}function Wn(t,e,s){Ke(z(t)?t.map(n=>n.bind(e.proxy)):t.bind(e.proxy),e,s)}function yr(t,e,s,n){let i=n.includes(".")?kr(s,n):()=>s[n];if(ce(t)){const r=e[t];G(r)&&us(i,r)}else if(G(t))us(i,t.bind(s));else if(le(t))if(z(t))t.forEach(r=>yr(r,e,s,n));else{const r=G(t.handler)?t.handler.bind(s):e[t.handler];G(r)&&us(i,r,t)}}function Ar(t){const e=t.type,{mixins:s,extends:n}=e,{mixins:i,optionsCache:r,config:{optionMergeStrategies:o}}=t.appContext,l=r.get(e);let a;return l?a=l:!i.length&&!s&&!n?a=e:(a={},i.length&&i.forEach(u=>ys(a,u,o,!0)),ys(a,e,o)),le(e)&&r.set(e,a),a}function ys(t,e,s,n=!1){const{mixins:i,extends:r}=e;r&&ys(t,r,s,!0),i&&i.forEach(o=>ys(t,o,s,!0));for(const o in e)if(!(n&&o==="expose")){const l=ho[o]||s&&s[o];t[o]=l?l(t[o],e[o]):e[o]}return t}const ho={data:Gn,props:qn,emits:qn,methods:Ht,computed:Ht,beforeCreate:xe,created:xe,beforeMount:xe,mounted:xe,beforeUpdate:xe,updated:xe,beforeDestroy:xe,beforeUnmount:xe,destroyed:xe,unmounted:xe,activated:xe,deactivated:xe,errorCaptured:xe,serverPrefetch:xe,components:Ht,directives:Ht,watch:go,provide:Gn,inject:po};function Gn(t,e){return e?t?function(){return be(G(t)?t.call(this,this):t,G(e)?e.call(this,this):e)}:e:t}function po(t,e){return Ht(nn(t),nn(e))}function nn(t){if(z(t)){const e={};for(let s=0;s1)return s&&G(e)?e.call(n&&n.proxy):e}}const xr={},Sr=()=>Object.create(xr),Er=t=>Object.getPrototypeOf(t)===xr;function bo(t,e,s,n=!1){const i={},r=Sr();t.propsDefaults=Object.create(null),Cr(t,e,i,r);for(const o in t.propsOptions[0])o in i||(i[o]=void 0);s?t.props=n?i:sr(i):t.type.props?t.props=i:t.props=r,t.attrs=r}function yo(t,e,s,n){const{props:i,attrs:r,vnode:{patchFlag:o}}=t,l=Z(i),[a]=t.propsOptions;let u=!1;if((n||o>0)&&!(o&16)){if(o&8){const c=t.vnode.dynamicProps;for(let f=0;f{a=!0;const[p,g]=_r(f,e,!0);be(o,p),g&&l.push(...g)};!s&&e.mixins.length&&e.mixins.forEach(c),t.extends&&c(t.extends),t.mixins&&t.mixins.forEach(c)}if(!r&&!a)return le(t)&&n.set(t,_t),_t;if(z(r))for(let c=0;ct[0]==="_"||t==="$stable",Tn=t=>z(t)?t.map(Ge):[Ge(t)],wo=(t,e,s)=>{if(e._n)return e;const n=Gl((...i)=>Tn(e(...i)),s);return n._c=!1,n},Or=(t,e,s)=>{const n=t._ctx;for(const i in t){if(Ln(i))continue;const r=t[i];if(G(r))e[i]=wo(i,r,n);else if(r!=null){const o=Tn(r);e[i]=()=>o}}},Lr=(t,e)=>{const s=Tn(e);t.slots.default=()=>s},Tr=(t,e,s)=>{for(const n in e)(s||!Ln(n))&&(t[n]=e[n])},xo=(t,e,s)=>{const n=t.slots=Sr();if(t.vnode.shapeFlag&32){const i=e.__;i&&Qs(n,"__",i,!0);const r=e._;r?(Tr(n,e,s),s&&Qs(n,"_",r,!0)):Or(e,n)}else e&&Lr(t,e)},So=(t,e,s)=>{const{vnode:n,slots:i}=t;let r=!0,o=ie;if(n.shapeFlag&32){const l=e._;l?s&&l===1?r=!1:Tr(i,e,s):(r=!e.$stable,Or(e,i)),o=e}else e&&(Lr(t,e),o={default:1});if(r)for(const l in i)!Ln(l)&&o[l]==null&&delete i[l]},Pe=No;function Eo(t){return Co(t)}function Co(t,e){const s=Cs();s.__VUE__=!0;const{insert:n,remove:i,patchProp:r,createElement:o,createText:l,createComment:a,setText:u,setElementText:c,parentNode:f,nextSibling:p,setScopeId:g=qe,insertStaticContent:_}=t,C=(h,d,v,w=null,E=null,x=null,F=void 0,R=null,P=!!d.dynamicChildren)=>{if(h===d)return;h&&!Nt(h,d)&&(w=A(h),te(h,E,x,!0),h=null),d.patchFlag===-2&&(P=!1,d.dynamicChildren=null);const{type:L,ref:U,shapeFlag:M}=d;switch(L){case Ds:D(h,d,v,w);break;case it:T(h,d,v,w);break;case fs:h==null&&m(d,v,w,F);break;case Re:pe(h,d,v,w,E,x,F,R,P);break;default:M&1?S(h,d,v,w,E,x,F,R,P):M&6?Le(h,d,v,w,E,x,F,R,P):(M&64||M&128)&&L.process(h,d,v,w,E,x,F,R,P,B)}U!=null&&E?jt(U,h&&h.ref,x,d||h,!d):U==null&&h&&h.ref!=null&&jt(h.ref,null,x,h,!0)},D=(h,d,v,w)=>{if(h==null)n(d.el=l(d.children),v,w);else{const E=d.el=h.el;d.children!==h.children&&u(E,d.children)}},T=(h,d,v,w)=>{h==null?n(d.el=a(d.children||""),v,w):d.el=h.el},m=(h,d,v,w)=>{[h.el,h.anchor]=_(h.children,d,v,w,h.el,h.anchor)},b=({el:h,anchor:d},v,w)=>{let E;for(;h&&h!==d;)E=p(h),n(h,v,w),h=E;n(d,v,w)},y=({el:h,anchor:d})=>{let v;for(;h&&h!==d;)v=p(h),i(h),h=v;i(d)},S=(h,d,v,w,E,x,F,R,P)=>{d.type==="svg"?F="svg":d.type==="math"&&(F="mathml"),h==null?O(d,v,w,E,x,F,R,P):H(h,d,E,x,F,R,P)},O=(h,d,v,w,E,x,F,R)=>{let P,L;const{props:U,shapeFlag:M,transition:V,dirs:j}=h;if(P=h.el=o(h.type,x,U&&U.is,U),M&8?c(P,h.children):M&16&&W(h.children,P,null,w,E,Us(h,x),F,R),j&&vt(h,null,w,"created"),I(P,h,h.scopeId,F,w),U){for(const se in U)se!=="value"&&!Vt(se)&&r(P,se,null,U[se],x,w);"value"in U&&r(P,"value",null,U.value,x),(L=U.onVnodeBeforeMount)&&ze(L,w,h)}j&&vt(h,null,w,"beforeMount");const q=_o(E,V);q&&V.beforeEnter(P),n(P,d,v),((L=U&&U.onVnodeMounted)||q||j)&&Pe(()=>{L&&ze(L,w,h),q&&V.enter(P),j&&vt(h,null,w,"mounted")},E)},I=(h,d,v,w,E)=>{if(v&&g(h,v),w)for(let x=0;x{for(let L=P;L{const R=d.el=h.el;let{patchFlag:P,dynamicChildren:L,dirs:U}=d;P|=h.patchFlag&16;const M=h.props||ie,V=d.props||ie;let j;if(v&&bt(v,!1),(j=V.onVnodeBeforeUpdate)&&ze(j,v,d,h),U&&vt(d,h,v,"beforeUpdate"),v&&bt(v,!0),(M.innerHTML&&V.innerHTML==null||M.textContent&&V.textContent==null)&&c(R,""),L?K(h.dynamicChildren,L,R,v,w,Us(d,E),x):F||$(h,d,R,null,v,w,Us(d,E),x,!1),P>0){if(P&16)re(R,M,V,v,E);else if(P&2&&M.class!==V.class&&r(R,"class",null,V.class,E),P&4&&r(R,"style",M.style,V.style,E),P&8){const q=d.dynamicProps;for(let se=0;se{j&&ze(j,v,d,h),U&&vt(d,h,v,"updated")},w)},K=(h,d,v,w,E,x,F)=>{for(let R=0;R{if(d!==v){if(d!==ie)for(const x in d)!Vt(x)&&!(x in v)&&r(h,x,d[x],null,E,w);for(const x in v){if(Vt(x))continue;const F=v[x],R=d[x];F!==R&&x!=="value"&&r(h,x,R,F,E,w)}"value"in v&&r(h,"value",d.value,v.value,E)}},pe=(h,d,v,w,E,x,F,R,P)=>{const L=d.el=h?h.el:l(""),U=d.anchor=h?h.anchor:l("");let{patchFlag:M,dynamicChildren:V,slotScopeIds:j}=d;j&&(R=R?R.concat(j):j),h==null?(n(L,v,w),n(U,v,w),W(d.children||[],v,U,E,x,F,R,P)):M>0&&M&64&&V&&h.dynamicChildren?(K(h.dynamicChildren,V,v,E,x,F,R),(d.key!=null||E&&d===E.subTree)&&Pr(h,d,!0)):$(h,d,v,U,E,x,F,R,P)},Le=(h,d,v,w,E,x,F,R,P)=>{d.slotScopeIds=R,h==null?d.shapeFlag&512?E.ctx.activate(d,v,w,F,P):ot(d,v,w,E,x,F,P):at(h,d,P)},ot=(h,d,v,w,E,x,F)=>{const R=h.component=Go(h,w,E);if(pr(h)&&(R.ctx.renderer=B),qo(R,!1,F),R.asyncDep){if(E&&E.registerDep(R,oe,F),!h.el){const P=R.subTree=de(it);T(null,P,d,v)}}else oe(R,h,d,v,E,x,F)},at=(h,d,v)=>{const w=d.component=h.component;if(Fo(h,d,v))if(w.asyncDep&&!w.asyncResolved){Q(w,d,v);return}else w.next=d,w.update();else d.el=h.el,w.vnode=d},oe=(h,d,v,w,E,x,F)=>{const R=()=>{if(h.isMounted){let{next:M,bu:V,u:j,parent:q,vnode:se}=h;{const $e=Rr(h);if($e){M&&(M.el=se.el,Q(h,M,F)),$e.asyncDep.then(()=>{h.isUnmounted||R()});return}}let ee=M,Ce;bt(h,!1),M?(M.el=se.el,Q(h,M,F)):M=se,V&&Fs(V),(Ce=M.props&&M.props.onVnodeBeforeUpdate)&&ze(Ce,q,M,se),bt(h,!0);const _e=Qn(h),Ue=h.subTree;h.subTree=_e,C(Ue,_e,f(Ue.el),A(Ue),h,E,x),M.el=_e.el,ee===null&&Mo(h,_e.el),j&&Pe(j,E),(Ce=M.props&&M.props.onVnodeUpdated)&&Pe(()=>ze(Ce,q,M,se),E)}else{let M;const{el:V,props:j}=d,{bm:q,m:se,parent:ee,root:Ce,type:_e}=h,Ue=Pt(d);bt(h,!1),q&&Fs(q),!Ue&&(M=j&&j.onVnodeBeforeMount)&&ze(M,ee,d),bt(h,!0);{Ce.ce&&Ce.ce._def.shadowRoot!==!1&&Ce.ce._injectChildStyle(_e);const $e=h.subTree=Qn(h);C(null,$e,v,w,h,E,x),d.el=$e.el}if(se&&Pe(se,E),!Ue&&(M=j&&j.onVnodeMounted)){const $e=d;Pe(()=>ze(M,ee,$e),E)}(d.shapeFlag&256||ee&&Pt(ee.vnode)&&ee.vnode.shapeFlag&256)&&h.a&&Pe(h.a,E),h.isMounted=!0,d=v=w=null}};h.scope.on();const P=h.effect=new $i(R);h.scope.off();const L=h.update=P.run.bind(P),U=h.job=P.runIfDirty.bind(P);U.i=h,U.id=h.uid,P.scheduler=()=>_n(U),bt(h,!0),L()},Q=(h,d,v)=>{d.component=h;const w=h.vnode.props;h.vnode=d,h.next=null,yo(h,d.props,w,v),So(h,d.children,v),st(),Un(h),nt()},$=(h,d,v,w,E,x,F,R,P=!1)=>{const L=h&&h.children,U=h?h.shapeFlag:0,M=d.children,{patchFlag:V,shapeFlag:j}=d;if(V>0){if(V&128){ye(L,M,v,w,E,x,F,R,P);return}else if(V&256){ae(L,M,v,w,E,x,F,R,P);return}}j&8?(U&16&&fe(L,E,x),M!==L&&c(v,M)):U&16?j&16?ye(L,M,v,w,E,x,F,R,P):fe(L,E,x,!0):(U&8&&c(v,""),j&16&&W(M,v,w,E,x,F,R,P))},ae=(h,d,v,w,E,x,F,R,P)=>{h=h||_t,d=d||_t;const L=h.length,U=d.length,M=Math.min(L,U);let V;for(V=0;VU?fe(h,E,x,!0,!1,M):W(d,v,w,E,x,F,R,P,M)},ye=(h,d,v,w,E,x,F,R,P)=>{let L=0;const U=d.length;let M=h.length-1,V=U-1;for(;L<=M&&L<=V;){const j=h[L],q=d[L]=P?ht(d[L]):Ge(d[L]);if(Nt(j,q))C(j,q,v,null,E,x,F,R,P);else break;L++}for(;L<=M&&L<=V;){const j=h[M],q=d[V]=P?ht(d[V]):Ge(d[V]);if(Nt(j,q))C(j,q,v,null,E,x,F,R,P);else break;M--,V--}if(L>M){if(L<=V){const j=V+1,q=jV)for(;L<=M;)te(h[L],E,x,!0),L++;else{const j=L,q=L,se=new Map;for(L=q;L<=V;L++){const Te=d[L]=P?ht(d[L]):Ge(d[L]);Te.key!=null&&se.set(Te.key,L)}let ee,Ce=0;const _e=V-q+1;let Ue=!1,$e=0;const Ft=new Array(_e);for(L=0;L<_e;L++)Ft[L]=0;for(L=j;L<=M;L++){const Te=h[L];if(Ce>=_e){te(Te,E,x,!0);continue}let je;if(Te.key!=null)je=se.get(Te.key);else for(ee=q;ee<=V;ee++)if(Ft[ee-q]===0&&Nt(Te,d[ee])){je=ee;break}je===void 0?te(Te,E,x,!0):(Ft[je-q]=L+1,je>=$e?$e=je:Ue=!0,C(Te,d[je],v,null,E,x,F,R,P),Ce++)}const Mn=Ue?Oo(Ft):_t;for(ee=Mn.length-1,L=_e-1;L>=0;L--){const Te=q+L,je=d[Te],Nn=Te+1{const{el:x,type:F,transition:R,children:P,shapeFlag:L}=h;if(L&6){Ae(h.component.subTree,d,v,w);return}if(L&128){h.suspense.move(d,v,w);return}if(L&64){F.move(h,d,v,B);return}if(F===Re){n(x,d,v);for(let M=0;MR.enter(x),E);else{const{leave:M,delayLeave:V,afterLeave:j}=R,q=()=>{h.ctx.isUnmounted?i(x):n(x,d,v)},se=()=>{M(x,()=>{q(),j&&j()})};V?V(x,q,se):se()}else n(x,d,v)},te=(h,d,v,w=!1,E=!1)=>{const{type:x,props:F,ref:R,children:P,dynamicChildren:L,shapeFlag:U,patchFlag:M,dirs:V,cacheIndex:j}=h;if(M===-2&&(E=!1),R!=null&&(st(),jt(R,null,v,h,!0),nt()),j!=null&&(d.renderCache[j]=void 0),U&256){d.ctx.deactivate(h);return}const q=U&1&&V,se=!Pt(h);let ee;if(se&&(ee=F&&F.onVnodeBeforeUnmount)&&ze(ee,d,h),U&6)Ve(h.component,v,w);else{if(U&128){h.suspense.unmount(v,w);return}q&&vt(h,null,d,"beforeUnmount"),U&64?h.type.remove(h,d,v,B,w):L&&!L.hasOnce&&(x!==Re||M>0&&M&64)?fe(L,d,v,!1,!0):(x===Re&&M&384||!E&&U&16)&&fe(P,d,v),w&&ct(h)}(se&&(ee=F&&F.onVnodeUnmounted)||q)&&Pe(()=>{ee&&ze(ee,d,h),q&&vt(h,null,d,"unmounted")},v)},ct=h=>{const{type:d,el:v,anchor:w,transition:E}=h;if(d===Re){we(v,w);return}if(d===fs){y(h);return}const x=()=>{i(v),E&&!E.persisted&&E.afterLeave&&E.afterLeave()};if(h.shapeFlag&1&&E&&!E.persisted){const{leave:F,delayLeave:R}=E,P=()=>F(v,x);R?R(h.el,x,P):P()}else x()},we=(h,d)=>{let v;for(;h!==d;)v=p(h),i(h),h=v;i(d)},Ve=(h,d,v)=>{const{bum:w,scope:E,job:x,subTree:F,um:R,m:P,a:L,parent:U,slots:{__:M}}=h;Yn(P),Yn(L),w&&Fs(w),U&&z(M)&&M.forEach(V=>{U.renderCache[V]=void 0}),E.stop(),x&&(x.flags|=8,te(F,h,d,v)),R&&Pe(R,d),Pe(()=>{h.isUnmounted=!0},d),d&&d.pendingBranch&&!d.isUnmounted&&h.asyncDep&&!h.asyncResolved&&h.suspenseId===d.pendingId&&(d.deps--,d.deps===0&&d.resolve())},fe=(h,d,v,w=!1,E=!1,x=0)=>{for(let F=x;F{if(h.shapeFlag&6)return A(h.component.subTree);if(h.shapeFlag&128)return h.suspense.next();const d=p(h.anchor||h.el),v=d&&d[ql];return v?p(v):d};let N=!1;const k=(h,d,v)=>{h==null?d._vnode&&te(d._vnode,null,null,!0):C(d._vnode||null,h,d,null,null,null,v),d._vnode=h,N||(N=!0,Un(),ur(),N=!1)},B={p:C,um:te,m:Ae,r:ct,mt:ot,mc:W,pc:$,pbc:K,n:A,o:t};return{render:k,hydrate:void 0,createApp:vo(k)}}function Us({type:t,props:e},s){return s==="svg"&&t==="foreignObject"||s==="mathml"&&t==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:s}function bt({effect:t,job:e},s){s?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function _o(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function Pr(t,e,s=!1){const n=t.children,i=e.children;if(z(n)&&z(i))for(let r=0;r>1,t[s[l]]0&&(e[n]=s[r-1]),s[r]=n)}}for(r=s.length,o=s[r-1];r-- >0;)s[r]=o,o=e[o];return s}function Rr(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:Rr(e)}function Yn(t){if(t)for(let e=0;ett(Lo);function us(t,e,s){return Dr(t,e,s)}function Dr(t,e,s=ie){const{immediate:n,deep:i,flush:r,once:o}=s,l=be({},s),a=e&&n||!e&&r!=="post";let u;if(ts){if(r==="sync"){const g=To();u=g.__watcherHandles||(g.__watcherHandles=[])}else if(!a){const g=()=>{};return g.stop=qe,g.resume=qe,g.pause=qe,g}}const c=me;l.call=(g,_,C)=>Ke(g,c,_,C);let f=!1;r==="post"?l.scheduler=g=>{Pe(g,c&&c.suspense)}:r!=="sync"&&(f=!0,l.scheduler=(g,_)=>{_?g():_n(g)}),l.augmentJob=g=>{e&&(g.flags|=4),f&&(g.flags|=2,c&&(g.id=c.uid,g.i=c))};const p=$l(t,e,l);return ts&&(u?u.push(p):a&&p()),p}function Po(t,e,s){const n=this.proxy,i=ce(t)?t.includes(".")?kr(n,t):()=>n[t]:t.bind(n,n);let r;G(e)?r=e:(r=e.handler,s=e);const o=rs(this),l=Dr(i,r.bind(n),s);return o(),l}function kr(t,e){const s=e.split(".");return()=>{let n=t;for(let i=0;ie==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${Fe(e)}Modifiers`]||t[`${xt(e)}Modifiers`];function Do(t,e,...s){if(t.isUnmounted)return;const n=t.vnode.props||ie;let i=s;const r=e.startsWith("update:"),o=r&&Ro(n,e.slice(7));o&&(o.trim&&(i=s.map(c=>ce(c)?c.trim():c)),o.number&&(i=s.map(al)));let l,a=n[l=Is(e)]||n[l=Is(Fe(e))];!a&&r&&(a=n[l=Is(xt(e))]),a&&Ke(a,t,6,i);const u=n[l+"Once"];if(u){if(!t.emitted)t.emitted={};else if(t.emitted[l])return;t.emitted[l]=!0,Ke(u,t,6,i)}}function Ir(t,e,s=!1){const n=e.emitsCache,i=n.get(t);if(i!==void 0)return i;const r=t.emits;let o={},l=!1;if(!G(t)){const a=u=>{const c=Ir(u,e,!0);c&&(l=!0,be(o,c))};!s&&e.mixins.length&&e.mixins.forEach(a),t.extends&&a(t.extends),t.mixins&&t.mixins.forEach(a)}return!r&&!l?(le(t)&&n.set(t,null),null):(z(r)?r.forEach(a=>o[a]=null):be(o,r),le(t)&&n.set(t,o),o)}function Rs(t,e){return!t||!ws(e)?!1:(e=e.slice(2).replace(/Once$/,""),X(t,e[0].toLowerCase()+e.slice(1))||X(t,xt(e))||X(t,e))}function Qn(t){const{type:e,vnode:s,proxy:n,withProxy:i,propsOptions:[r],slots:o,attrs:l,emit:a,render:u,renderCache:c,props:f,data:p,setupState:g,ctx:_,inheritAttrs:C}=t,D=bs(t);let T,m;try{if(s.shapeFlag&4){const y=i||n,S=y;T=Ge(u.call(S,y,c,f,g,p,_)),m=l}else{const y=e;T=Ge(y.length>1?y(f,{attrs:l,slots:o,emit:a}):y(f,null)),m=e.props?l:ko(l)}}catch(y){Wt.length=0,Ls(y,t,1),T=de(it)}let b=T;if(m&&C!==!1){const y=Object.keys(m),{shapeFlag:S}=b;y.length&&S&7&&(r&&y.some(pn)&&(m=Io(m,r)),b=Dt(b,m,!1,!0))}return s.dirs&&(b=Dt(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(s.dirs):s.dirs),s.transition&&On(b,s.transition),T=b,bs(D),T}const ko=t=>{let e;for(const s in t)(s==="class"||s==="style"||ws(s))&&((e||(e={}))[s]=t[s]);return e},Io=(t,e)=>{const s={};for(const n in t)(!pn(n)||!(n.slice(9)in e))&&(s[n]=t[n]);return s};function Fo(t,e,s){const{props:n,children:i,component:r}=t,{props:o,children:l,patchFlag:a}=e,u=r.emitsOptions;if(e.dirs||e.transition)return!0;if(s&&a>=0){if(a&1024)return!0;if(a&16)return n?Jn(n,o,u):!!o;if(a&8){const c=e.dynamicProps;for(let f=0;ft.__isSuspense;function No(t,e){e&&e.pendingBranch?z(t)?e.effects.push(...t):e.effects.push(t):Wl(t)}const Re=Symbol.for("v-fgt"),Ds=Symbol.for("v-txt"),it=Symbol.for("v-cmt"),fs=Symbol.for("v-stc"),Wt=[];let De=null;function Zt(t=!1){Wt.push(De=t?null:[])}function Bo(){Wt.pop(),De=Wt[Wt.length-1]||null}let Xt=1;function Zn(t,e=!1){Xt+=t,t<0&&De&&e&&(De.hasOnce=!0)}function Mr(t){return t.dynamicChildren=Xt>0?De||_t:null,Bo(),Xt>0&&De&&De.push(t),t}function Nr(t,e,s,n,i,r){return Mr(Ze(t,e,s,n,i,r,!0))}function ln(t,e,s,n,i){return Mr(de(t,e,s,n,i,!0))}function es(t){return t?t.__v_isVNode===!0:!1}function Nt(t,e){return t.type===e.type&&t.key===e.key}const Br=({key:t})=>t??null,hs=({ref:t,ref_key:e,ref_for:s})=>(typeof t=="number"&&(t=""+t),t!=null?ce(t)||ve(t)||G(t)?{i:Ee,r:t,k:e,f:!!s}:t:null);function Ze(t,e=null,s=null,n=0,i=null,r=t===Re?0:1,o=!1,l=!1){const a={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&Br(e),ref:e&&hs(e),scopeId:hr,slotScopeIds:null,children:s,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:r,patchFlag:n,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:Ee};return l?(Pn(a,s),r&128&&t.normalize(a)):s&&(a.shapeFlag|=ce(s)?8:16),Xt>0&&!o&&De&&(a.patchFlag>0||r&6)&&a.patchFlag!==32&&De.push(a),a}const de=Ho;function Ho(t,e=null,s=null,n=0,i=null,r=!1){if((!t||t===oo)&&(t=it),es(t)){const l=Dt(t,e,!0);return s&&Pn(l,s),Xt>0&&!r&&De&&(l.shapeFlag&6?De[De.indexOf(t)]=l:De.push(l)),l.patchFlag=-2,l}if(Zo(t)&&(t=t.__vccOpts),e){e=Vo(e);let{class:l,style:a}=e;l&&!ce(l)&&(e.class=bn(l)),le(a)&&(Cn(a)&&!z(a)&&(a=be({},a)),e.style=vn(a))}const o=ce(t)?1:Fr(t)?128:Kl(t)?64:le(t)?4:G(t)?2:0;return Ze(t,e,s,n,i,o,r,!0)}function Vo(t){return t?Cn(t)||Er(t)?be({},t):t:null}function Dt(t,e,s=!1,n=!1){const{props:i,ref:r,patchFlag:o,children:l,transition:a}=t,u=e?jo(i||{},e):i,c={__v_isVNode:!0,__v_skip:!0,type:t.type,props:u,key:u&&Br(u),ref:e&&e.ref?s&&r?z(r)?r.concat(hs(e)):[r,hs(e)]:hs(e):r,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:l,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==Re?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:a,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&Dt(t.ssContent),ssFallback:t.ssFallback&&Dt(t.ssFallback),el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return a&&n&&On(c,a.clone(c)),c}function ds(t=" ",e=0){return de(Ds,null,t,e)}function Uo(t,e){const s=de(fs,null,t);return s.staticCount=e,s}function $o(t="",e=!1){return e?(Zt(),ln(it,null,t)):de(it,null,t)}function Ge(t){return t==null||typeof t=="boolean"?de(it):z(t)?de(Re,null,t.slice()):es(t)?ht(t):de(Ds,null,String(t))}function ht(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:Dt(t)}function Pn(t,e){let s=0;const{shapeFlag:n}=t;if(e==null)e=null;else if(z(e))s=16;else if(typeof e=="object")if(n&65){const i=e.default;i&&(i._c&&(i._d=!1),Pn(t,i()),i._c&&(i._d=!0));return}else{s=32;const i=e._;!i&&!Er(e)?e._ctx=Ee:i===3&&Ee&&(Ee.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else G(e)?(e={default:e,_ctx:Ee},s=32):(e=String(e),n&64?(s=16,e=[ds(e)]):s=8);t.children=e,t.shapeFlag|=s}function jo(...t){const e={};for(let s=0;s{let i;return(i=t[s])||(i=t[s]=[]),i.push(n),r=>{i.length>1?i.forEach(o=>o(r)):i[0](r)}};As=e("__VUE_INSTANCE_SETTERS__",s=>me=s),on=e("__VUE_SSR_SETTERS__",s=>ts=s)}const rs=t=>{const e=me;return As(t),t.scope.on(),()=>{t.scope.off(),As(e)}},Xn=()=>{me&&me.scope.off(),As(null)};function Hr(t){return t.vnode.shapeFlag&4}let ts=!1;function qo(t,e=!1,s=!1){e&&on(e);const{props:n,children:i}=t.vnode,r=Hr(t);bo(t,n,r,e),xo(t,i,s||e);const o=r?Ko(t,e):void 0;return e&&on(!1),o}function Ko(t,e){const s=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,co);const{setup:n}=s;if(n){st();const i=t.setupContext=n.length>1?Qo(t):null,r=rs(t),o=is(n,t,0,[t.props,i]),l=Fi(o);if(nt(),r(),(l||t.sp)&&!Pt(t)&&dr(t),l){if(o.then(Xn,Xn),e)return o.then(a=>{ei(t,a)}).catch(a=>{Ls(a,t,0)});t.asyncDep=o}else ei(t,o)}else Vr(t)}function ei(t,e,s){G(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:le(e)&&(t.setupState=lr(e)),Vr(t)}function Vr(t,e,s){const n=t.type;t.render||(t.render=n.render||qe);{const i=rs(t);st();try{uo(t)}finally{nt(),i()}}}const Yo={get(t,e){return ge(t,"get",""),t[e]}};function Qo(t){const e=s=>{t.exposed=s||{}};return{attrs:new Proxy(t.attrs,Yo),slots:t.slots,emit:t.emit,expose:e}}function Rn(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(lr(Fl(t.exposed)),{get(e,s){if(s in e)return e[s];if(s in zt)return zt[s](t)},has(e,s){return s in e||s in zt}})):t.proxy}function Jo(t,e=!0){return G(t)?t.displayName||t.name:t.name||e&&t.__name}function Zo(t){return G(t)&&"__vccOpts"in t}const Ne=(t,e)=>Vl(t,e,ts);function Ur(t,e,s){const n=arguments.length;return n===2?le(e)&&!z(e)?es(e)?de(t,null,[e]):de(t,e):de(t,null,e):(n>3?s=Array.prototype.slice.call(arguments,2):n===3&&es(s)&&(s=[s]),de(t,e,s))}const Xo="3.5.17";/** * @vue/runtime-dom v3.5.17 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT -**/let an;const ti=typeof window<"u"&&window.trustedTypes;if(ti)try{an=ti.createPolicy("vue",{createHTML:t=>t})}catch{}const $r=an?t=>an.createHTML(t):t=>t,ea="http://www.w3.org/2000/svg",ta="http://www.w3.org/1998/Math/MathML",Xe=typeof document<"u"?document:null,si=Xe&&Xe.createElement("template"),sa={insert:(t,e,s)=>{e.insertBefore(t,s||null)},remove:t=>{const e=t.parentNode;e&&e.removeChild(t)},createElement:(t,e,s,n)=>{const i=e==="svg"?Xe.createElementNS(ea,t):e==="mathml"?Xe.createElementNS(ta,t):s?Xe.createElement(t,{is:s}):Xe.createElement(t);return t==="select"&&n&&n.multiple!=null&&i.setAttribute("multiple",n.multiple),i},createText:t=>Xe.createTextNode(t),createComment:t=>Xe.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>Xe.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},insertStaticContent(t,e,s,n,i,r){const o=s?s.previousSibling:e.lastChild;if(i&&(i===r||i.nextSibling))for(;e.insertBefore(i.cloneNode(!0),s),!(i===r||!(i=i.nextSibling)););else{si.innerHTML=$r(n==="svg"?`${t}`:n==="mathml"?`${t}`:t);const l=si.content;if(n==="svg"||n==="mathml"){const a=l.firstChild;for(;a.firstChild;)l.appendChild(a.firstChild);l.removeChild(a)}e.insertBefore(l,s)}return[o?o.nextSibling:e.firstChild,s?s.previousSibling:e.lastChild]}},na=Symbol("_vtc");function ia(t,e,s){const n=t[na];n&&(e=(e?[e,...n]:[...n]).join(" ")),e==null?t.removeAttribute("class"):s?t.setAttribute("class",e):t.className=e}const ni=Symbol("_vod"),ra=Symbol("_vsh"),la=Symbol(""),oa=/(^|;)\s*display\s*:/;function aa(t,e,s){const n=t.style,i=ce(s);let r=!1;if(s&&!i){if(e)if(ce(e))for(const o of e.split(";")){const l=o.slice(0,o.indexOf(":")).trim();s[l]==null&&ps(n,l,"")}else for(const o in e)s[o]==null&&ps(n,o,"");for(const o in s)o==="display"&&(r=!0),ps(n,o,s[o])}else if(i){if(e!==s){const o=n[la];o&&(s+=";"+o),n.cssText=s,r=oa.test(s)}}else e&&t.removeAttribute("style");ni in t&&(t[ni]=r?n.display:"",t[ra]&&(n.display="none"))}const ii=/\s*!important$/;function ps(t,e,s){if(z(s))s.forEach(n=>ps(t,e,n));else if(s==null&&(s=""),e.startsWith("--"))t.setProperty(e,s);else{const n=ca(t,e);ii.test(s)?t.setProperty(xt(n),s.replace(ii,""),"important"):t[n]=s}}const ri=["Webkit","Moz","ms"],$s={};function ca(t,e){const s=$s[e];if(s)return s;let n=Ie(e);if(n!=="filter"&&n in t)return $s[e]=n;n=Es(n);for(let i=0;ijs||(pa.then(()=>js=0),js=Date.now());function ma(t,e){const s=n=>{if(!n._vts)n._vts=Date.now();else if(n._vts<=s.attached)return;Ke(va(n,s.value),e,5,[n])};return s.value=t,s.attached=ga(),s}function va(t,e){if(z(e)){const s=t.stopImmediatePropagation;return t.stopImmediatePropagation=()=>{s.call(t),t._stopped=!0},e.map(n=>i=>!i._stopped&&n&&n(i))}else return e}const fi=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,ba=(t,e,s,n,i,r)=>{const o=i==="svg";e==="class"?ia(t,n,o):e==="style"?aa(t,s,n):ws(e)?pn(e)||ha(t,e,s,n,r):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):ya(t,e,n,o))?(ai(t,e,n),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&oi(t,e,n,o,r,e!=="value")):t._isVueCE&&(/[A-Z]/.test(e)||!ce(n))?ai(t,Ie(e),n,r,e):(e==="true-value"?t._trueValue=n:e==="false-value"&&(t._falseValue=n),oi(t,e,n,o))};function ya(t,e,s,n){if(n)return!!(e==="innerHTML"||e==="textContent"||e in t&&fi(e)&&G(s));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="form"||e==="list"&&t.tagName==="INPUT"||e==="type"&&t.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const i=t.tagName;if(i==="IMG"||i==="VIDEO"||i==="CANVAS"||i==="SOURCE")return!1}return fi(e)&&ce(s)?!1:e in t}const Aa=be({patchProp:ba},sa);let hi;function wa(){return hi||(hi=Eo(Aa))}const xa=(...t)=>{const e=wa().createApp(...t),{mount:s}=e;return e.mount=n=>{const i=Ea(n);if(!i)return;const r=e._component;!G(r)&&!r.render&&!r.template&&(r.template=i.innerHTML),i.nodeType===1&&(i.textContent="");const o=s(i,!1,Sa(i));return i instanceof Element&&(i.removeAttribute("v-cloak"),i.setAttribute("data-v-app","")),o},e};function Sa(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function Ea(t){return ce(t)?document.querySelector(t):t}const Ca="modulepreload",_a=function(t){return"/"+t},di={},Qe=function(e,s,n){let i=Promise.resolve();if(s&&s.length>0){let o=function(u){return Promise.all(u.map(c=>Promise.resolve(c).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),a=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));i=o(s.map(u=>{if(u=_a(u),u in di)return;di[u]=!0;const c=u.endsWith(".css"),f=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${f}`))return;const p=document.createElement("link");if(p.rel=c?"stylesheet":Ca,c||(p.as="script"),p.crossOrigin="",p.href=u,a&&p.setAttribute("nonce",a),document.head.appendChild(p),c)return new Promise((g,_)=>{p.addEventListener("load",g),p.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${u}`)))})}))}function r(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return i.then(o=>{for(const l of o||[])l.status==="rejected"&&r(l.reason);return e().catch(r)})};/*! +**/let an;const ti=typeof window<"u"&&window.trustedTypes;if(ti)try{an=ti.createPolicy("vue",{createHTML:t=>t})}catch{}const $r=an?t=>an.createHTML(t):t=>t,ea="http://www.w3.org/2000/svg",ta="http://www.w3.org/1998/Math/MathML",Xe=typeof document<"u"?document:null,si=Xe&&Xe.createElement("template"),sa={insert:(t,e,s)=>{e.insertBefore(t,s||null)},remove:t=>{const e=t.parentNode;e&&e.removeChild(t)},createElement:(t,e,s,n)=>{const i=e==="svg"?Xe.createElementNS(ea,t):e==="mathml"?Xe.createElementNS(ta,t):s?Xe.createElement(t,{is:s}):Xe.createElement(t);return t==="select"&&n&&n.multiple!=null&&i.setAttribute("multiple",n.multiple),i},createText:t=>Xe.createTextNode(t),createComment:t=>Xe.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>Xe.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},insertStaticContent(t,e,s,n,i,r){const o=s?s.previousSibling:e.lastChild;if(i&&(i===r||i.nextSibling))for(;e.insertBefore(i.cloneNode(!0),s),!(i===r||!(i=i.nextSibling)););else{si.innerHTML=$r(n==="svg"?`${t}`:n==="mathml"?`${t}`:t);const l=si.content;if(n==="svg"||n==="mathml"){const a=l.firstChild;for(;a.firstChild;)l.appendChild(a.firstChild);l.removeChild(a)}e.insertBefore(l,s)}return[o?o.nextSibling:e.firstChild,s?s.previousSibling:e.lastChild]}},na=Symbol("_vtc");function ia(t,e,s){const n=t[na];n&&(e=(e?[e,...n]:[...n]).join(" ")),e==null?t.removeAttribute("class"):s?t.setAttribute("class",e):t.className=e}const ni=Symbol("_vod"),ra=Symbol("_vsh"),la=Symbol(""),oa=/(^|;)\s*display\s*:/;function aa(t,e,s){const n=t.style,i=ce(s);let r=!1;if(s&&!i){if(e)if(ce(e))for(const o of e.split(";")){const l=o.slice(0,o.indexOf(":")).trim();s[l]==null&&ps(n,l,"")}else for(const o in e)s[o]==null&&ps(n,o,"");for(const o in s)o==="display"&&(r=!0),ps(n,o,s[o])}else if(i){if(e!==s){const o=n[la];o&&(s+=";"+o),n.cssText=s,r=oa.test(s)}}else e&&t.removeAttribute("style");ni in t&&(t[ni]=r?n.display:"",t[ra]&&(n.display="none"))}const ii=/\s*!important$/;function ps(t,e,s){if(z(s))s.forEach(n=>ps(t,e,n));else if(s==null&&(s=""),e.startsWith("--"))t.setProperty(e,s);else{const n=ca(t,e);ii.test(s)?t.setProperty(xt(n),s.replace(ii,""),"important"):t[n]=s}}const ri=["Webkit","Moz","ms"],$s={};function ca(t,e){const s=$s[e];if(s)return s;let n=Fe(e);if(n!=="filter"&&n in t)return $s[e]=n;n=Es(n);for(let i=0;ijs||(pa.then(()=>js=0),js=Date.now());function ma(t,e){const s=n=>{if(!n._vts)n._vts=Date.now();else if(n._vts<=s.attached)return;Ke(va(n,s.value),e,5,[n])};return s.value=t,s.attached=ga(),s}function va(t,e){if(z(e)){const s=t.stopImmediatePropagation;return t.stopImmediatePropagation=()=>{s.call(t),t._stopped=!0},e.map(n=>i=>!i._stopped&&n&&n(i))}else return e}const fi=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,ba=(t,e,s,n,i,r)=>{const o=i==="svg";e==="class"?ia(t,n,o):e==="style"?aa(t,s,n):ws(e)?pn(e)||ha(t,e,s,n,r):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):ya(t,e,n,o))?(ai(t,e,n),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&oi(t,e,n,o,r,e!=="value")):t._isVueCE&&(/[A-Z]/.test(e)||!ce(n))?ai(t,Fe(e),n,r,e):(e==="true-value"?t._trueValue=n:e==="false-value"&&(t._falseValue=n),oi(t,e,n,o))};function ya(t,e,s,n){if(n)return!!(e==="innerHTML"||e==="textContent"||e in t&&fi(e)&&G(s));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="form"||e==="list"&&t.tagName==="INPUT"||e==="type"&&t.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const i=t.tagName;if(i==="IMG"||i==="VIDEO"||i==="CANVAS"||i==="SOURCE")return!1}return fi(e)&&ce(s)?!1:e in t}const Aa=be({patchProp:ba},sa);let hi;function wa(){return hi||(hi=Eo(Aa))}const xa=(...t)=>{const e=wa().createApp(...t),{mount:s}=e;return e.mount=n=>{const i=Ea(n);if(!i)return;const r=e._component;!G(r)&&!r.render&&!r.template&&(r.template=i.innerHTML),i.nodeType===1&&(i.textContent="");const o=s(i,!1,Sa(i));return i instanceof Element&&(i.removeAttribute("v-cloak"),i.setAttribute("data-v-app","")),o},e};function Sa(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function Ea(t){return ce(t)?document.querySelector(t):t}const Ca="modulepreload",_a=function(t){return"/"+t},di={},Qe=function(e,s,n){let i=Promise.resolve();if(s&&s.length>0){let o=function(u){return Promise.all(u.map(c=>Promise.resolve(c).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),a=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));i=o(s.map(u=>{if(u=_a(u),u in di)return;di[u]=!0;const c=u.endsWith(".css"),f=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${f}`))return;const p=document.createElement("link");if(p.rel=c?"stylesheet":Ca,c||(p.as="script"),p.crossOrigin="",p.href=u,a&&p.setAttribute("nonce",a),document.head.appendChild(p),c)return new Promise((g,_)=>{p.addEventListener("load",g),p.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${u}`)))})}))}function r(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return i.then(o=>{for(const l of o||[])l.status==="rejected"&&r(l.reason);return e().catch(r)})};/*! * vue-router v4.5.1 * (c) 2025 Eduardo San Martin Morote * @license MIT - */const Ct=typeof document<"u";function jr(t){return typeof t=="object"||"displayName"in t||"props"in t||"__vccOpts"in t}function Oa(t){return t.__esModule||t[Symbol.toStringTag]==="Module"||t.default&&jr(t.default)}const J=Object.assign;function zs(t,e){const s={};for(const n in e){const i=e[n];s[n]=He(i)?i.map(t):t(i)}return s}const Gt=()=>{},He=Array.isArray,zr=/#/g,La=/&/g,Ta=/\//g,Pa=/=/g,Ra=/\?/g,Wr=/\+/g,Da=/%5B/g,ka=/%5D/g,Gr=/%5E/g,Fa=/%60/g,qr=/%7B/g,Ia=/%7C/g,Kr=/%7D/g,Ma=/%20/g;function Dn(t){return encodeURI(""+t).replace(Ia,"|").replace(Da,"[").replace(ka,"]")}function Na(t){return Dn(t).replace(qr,"{").replace(Kr,"}").replace(Gr,"^")}function cn(t){return Dn(t).replace(Wr,"%2B").replace(Ma,"+").replace(zr,"%23").replace(La,"%26").replace(Fa,"`").replace(qr,"{").replace(Kr,"}").replace(Gr,"^")}function Ba(t){return cn(t).replace(Pa,"%3D")}function Ha(t){return Dn(t).replace(zr,"%23").replace(Ra,"%3F")}function Va(t){return t==null?"":Ha(t).replace(Ta,"%2F")}function ss(t){try{return decodeURIComponent(""+t)}catch{}return""+t}const Ua=/\/$/,$a=t=>t.replace(Ua,"");function Ws(t,e,s="/"){let n,i={},r="",o="";const l=e.indexOf("#");let a=e.indexOf("?");return l=0&&(a=-1),a>-1&&(n=e.slice(0,a),r=e.slice(a+1,l>-1?l:e.length),i=t(r)),l>-1&&(n=n||e.slice(0,l),o=e.slice(l,e.length)),n=Ga(n??e,s),{fullPath:n+(r&&"?")+r+o,path:n,query:i,hash:ss(o)}}function ja(t,e){const s=e.query?t(e.query):"";return e.path+(s&&"?")+s+(e.hash||"")}function pi(t,e){return!e||!t.toLowerCase().startsWith(e.toLowerCase())?t:t.slice(e.length)||"/"}function za(t,e,s){const n=e.matched.length-1,i=s.matched.length-1;return n>-1&&n===i&&kt(e.matched[n],s.matched[i])&&Yr(e.params,s.params)&&t(e.query)===t(s.query)&&e.hash===s.hash}function kt(t,e){return(t.aliasOf||t)===(e.aliasOf||e)}function Yr(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(!Wa(t[s],e[s]))return!1;return!0}function Wa(t,e){return He(t)?gi(t,e):He(e)?gi(e,t):t===e}function gi(t,e){return He(e)?t.length===e.length&&t.every((s,n)=>s===e[n]):t.length===1&&t[0]===e}function Ga(t,e){if(t.startsWith("/"))return t;if(!t)return e;const s=e.split("/"),n=t.split("/"),i=n[n.length-1];(i===".."||i===".")&&n.push("");let r=s.length-1,o,l;for(o=0;o1&&r--;else break;return s.slice(0,r).join("/")+"/"+n.slice(o).join("/")}const ut={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};var ns;(function(t){t.pop="pop",t.push="push"})(ns||(ns={}));var qt;(function(t){t.back="back",t.forward="forward",t.unknown=""})(qt||(qt={}));function qa(t){if(!t)if(Ct){const e=document.querySelector("base");t=e&&e.getAttribute("href")||"/",t=t.replace(/^\w+:\/\/[^\/]+/,"")}else t="/";return t[0]!=="/"&&t[0]!=="#"&&(t="/"+t),$a(t)}const Ka=/^[^#]+#/;function Ya(t,e){return t.replace(Ka,"#")+e}function Qa(t,e){const s=document.documentElement.getBoundingClientRect(),n=t.getBoundingClientRect();return{behavior:e.behavior,left:n.left-s.left-(e.left||0),top:n.top-s.top-(e.top||0)}}const ks=()=>({left:window.scrollX,top:window.scrollY});function Ja(t){let e;if("el"in t){const s=t.el,n=typeof s=="string"&&s.startsWith("#"),i=typeof s=="string"?n?document.getElementById(s.slice(1)):document.querySelector(s):s;if(!i)return;e=Qa(i,t)}else e=t;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.scrollX,e.top!=null?e.top:window.scrollY)}function mi(t,e){return(history.state?history.state.position-e:-1)+t}const un=new Map;function Za(t,e){un.set(t,e)}function Xa(t){const e=un.get(t);return un.delete(t),e}let ec=()=>location.protocol+"//"+location.host;function Qr(t,e){const{pathname:s,search:n,hash:i}=e,r=t.indexOf("#");if(r>-1){let l=i.includes(t.slice(r))?t.slice(r).length:1,a=i.slice(l);return a[0]!=="/"&&(a="/"+a),pi(a,"")}return pi(s,t)+n+i}function tc(t,e,s,n){let i=[],r=[],o=null;const l=({state:p})=>{const g=Qr(t,location),_=s.value,C=e.value;let D=0;if(p){if(s.value=g,e.value=p,o&&o===_){o=null;return}D=C?p.position-C.position:0}else n(g);i.forEach(T=>{T(s.value,_,{delta:D,type:ns.pop,direction:D?D>0?qt.forward:qt.back:qt.unknown})})};function a(){o=s.value}function u(p){i.push(p);const g=()=>{const _=i.indexOf(p);_>-1&&i.splice(_,1)};return r.push(g),g}function c(){const{history:p}=window;p.state&&p.replaceState(J({},p.state,{scroll:ks()}),"")}function f(){for(const p of r)p();r=[],window.removeEventListener("popstate",l),window.removeEventListener("beforeunload",c)}return window.addEventListener("popstate",l),window.addEventListener("beforeunload",c,{passive:!0}),{pauseListeners:a,listen:u,destroy:f}}function vi(t,e,s,n=!1,i=!1){return{back:t,current:e,forward:s,replaced:n,position:window.history.length,scroll:i?ks():null}}function sc(t){const{history:e,location:s}=window,n={value:Qr(t,s)},i={value:e.state};i.value||r(n.value,{back:null,current:n.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function r(a,u,c){const f=t.indexOf("#"),p=f>-1?(s.host&&document.querySelector("base")?t:t.slice(f))+a:ec()+t+a;try{e[c?"replaceState":"pushState"](u,"",p),i.value=u}catch(g){console.error(g),s[c?"replace":"assign"](p)}}function o(a,u){const c=J({},e.state,vi(i.value.back,a,i.value.forward,!0),u,{position:i.value.position});r(a,c,!0),n.value=a}function l(a,u){const c=J({},i.value,e.state,{forward:a,scroll:ks()});r(c.current,c,!0);const f=J({},vi(n.value,a,null),{position:c.position+1},u);r(a,f,!1),n.value=a}return{location:n,state:i,push:l,replace:o}}function nc(t){t=qa(t);const e=sc(t),s=tc(t,e.state,e.location,e.replace);function n(r,o=!0){o||s.pauseListeners(),history.go(r)}const i=J({location:"",base:t,go:n,createHref:Ya.bind(null,t)},e,s);return Object.defineProperty(i,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(i,"state",{enumerable:!0,get:()=>e.state.value}),i}function ic(t){return typeof t=="string"||t&&typeof t=="object"}function Jr(t){return typeof t=="string"||typeof t=="symbol"}const Zr=Symbol("");var bi;(function(t){t[t.aborted=4]="aborted",t[t.cancelled=8]="cancelled",t[t.duplicated=16]="duplicated"})(bi||(bi={}));function Ft(t,e){return J(new Error,{type:t,[Zr]:!0},e)}function Je(t,e){return t instanceof Error&&Zr in t&&(e==null||!!(t.type&e))}const yi="[^/]+?",rc={sensitive:!1,strict:!1,start:!0,end:!0},lc=/[.+*?^${}()[\]/\\]/g;function oc(t,e){const s=J({},rc,e),n=[];let i=s.start?"^":"";const r=[];for(const u of t){const c=u.length?[]:[90];s.strict&&!u.length&&(i+="/");for(let f=0;fe.length?e.length===1&&e[0]===80?1:-1:0}function Xr(t,e){let s=0;const n=t.score,i=e.score;for(;s0&&e[e.length-1]<0}const cc={type:0,value:""},uc=/[a-zA-Z0-9_]/;function fc(t){if(!t)return[[]];if(t==="/")return[[cc]];if(!t.startsWith("/"))throw new Error(`Invalid path "${t}"`);function e(g){throw new Error(`ERR (${s})/"${u}": ${g}`)}let s=0,n=s;const i=[];let r;function o(){r&&i.push(r),r=[]}let l=0,a,u="",c="";function f(){u&&(s===0?r.push({type:0,value:u}):s===1||s===2||s===3?(r.length>1&&(a==="*"||a==="+")&&e(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),r.push({type:1,value:u,regexp:c,repeatable:a==="*"||a==="+",optional:a==="*"||a==="?"})):e("Invalid state to consume buffer"),u="")}function p(){u+=a}for(;l{o(b)}:Gt}function o(f){if(Jr(f)){const p=n.get(f);p&&(n.delete(f),s.splice(s.indexOf(p),1),p.children.forEach(o),p.alias.forEach(o))}else{const p=s.indexOf(f);p>-1&&(s.splice(p,1),f.record.name&&n.delete(f.record.name),f.children.forEach(o),f.alias.forEach(o))}}function l(){return s}function a(f){const p=mc(f,s);s.splice(p,0,f),f.record.name&&!Si(f)&&n.set(f.record.name,f)}function u(f,p){let g,_={},C,D;if("name"in f&&f.name){if(g=n.get(f.name),!g)throw Ft(1,{location:f});D=g.record.name,_=J(wi(p.params,g.keys.filter(b=>!b.optional).concat(g.parent?g.parent.keys.filter(b=>b.optional):[]).map(b=>b.name)),f.params&&wi(f.params,g.keys.map(b=>b.name))),C=g.stringify(_)}else if(f.path!=null)C=f.path,g=s.find(b=>b.re.test(C)),g&&(_=g.parse(C),D=g.record.name);else{if(g=p.name?n.get(p.name):s.find(b=>b.re.test(p.path)),!g)throw Ft(1,{location:f,currentLocation:p});D=g.record.name,_=J({},p.params,f.params),C=g.stringify(_)}const T=[];let m=g;for(;m;)T.unshift(m.record),m=m.parent;return{name:D,path:C,params:_,matched:T,meta:gc(T)}}t.forEach(f=>r(f));function c(){s.length=0,n.clear()}return{addRoute:r,resolve:u,removeRoute:o,clearRoutes:c,getRoutes:l,getRecordMatcher:i}}function wi(t,e){const s={};for(const n of e)n in t&&(s[n]=t[n]);return s}function xi(t){const e={path:t.path,redirect:t.redirect,name:t.name,meta:t.meta||{},aliasOf:t.aliasOf,beforeEnter:t.beforeEnter,props:pc(t),children:t.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in t?t.components||null:t.component&&{default:t.component}};return Object.defineProperty(e,"mods",{value:{}}),e}function pc(t){const e={},s=t.props||!1;if("component"in t)e.default=s;else for(const n in t.components)e[n]=typeof s=="object"?s[n]:s;return e}function Si(t){for(;t;){if(t.record.aliasOf)return!0;t=t.parent}return!1}function gc(t){return t.reduce((e,s)=>J(e,s.meta),{})}function Ei(t,e){const s={};for(const n in t)s[n]=n in e?e[n]:t[n];return s}function mc(t,e){let s=0,n=e.length;for(;s!==n;){const r=s+n>>1;Xr(t,e[r])<0?n=r:s=r+1}const i=vc(t);return i&&(n=e.lastIndexOf(i,n-1)),n}function vc(t){let e=t;for(;e=e.parent;)if(el(e)&&Xr(t,e)===0)return e}function el({record:t}){return!!(t.name||t.components&&Object.keys(t.components).length||t.redirect)}function bc(t){const e={};if(t===""||t==="?")return e;const n=(t[0]==="?"?t.slice(1):t).split("&");for(let i=0;ir&&cn(r)):[n&&cn(n)]).forEach(r=>{r!==void 0&&(e+=(e.length?"&":"")+s,r!=null&&(e+="="+r))})}return e}function yc(t){const e={};for(const s in t){const n=t[s];n!==void 0&&(e[s]=He(n)?n.map(i=>i==null?null:""+i):n==null?n:""+n)}return e}const Ac=Symbol(""),_i=Symbol(""),kn=Symbol(""),tl=Symbol(""),fn=Symbol("");function Bt(){let t=[];function e(n){return t.push(n),()=>{const i=t.indexOf(n);i>-1&&t.splice(i,1)}}function s(){t=[]}return{add:e,list:()=>t.slice(),reset:s}}function dt(t,e,s,n,i,r=o=>o()){const o=n&&(n.enterCallbacks[i]=n.enterCallbacks[i]||[]);return()=>new Promise((l,a)=>{const u=p=>{p===!1?a(Ft(4,{from:s,to:e})):p instanceof Error?a(p):ic(p)?a(Ft(2,{from:e,to:p})):(o&&n.enterCallbacks[i]===o&&typeof p=="function"&&o.push(p),l())},c=r(()=>t.call(n&&n.instances[i],e,s,u));let f=Promise.resolve(c);t.length<3&&(f=f.then(u)),f.catch(p=>a(p))})}function Gs(t,e,s,n,i=r=>r()){const r=[];for(const o of t)for(const l in o.components){let a=o.components[l];if(!(e!=="beforeRouteEnter"&&!o.instances[l]))if(jr(a)){const c=(a.__vccOpts||a)[e];c&&r.push(dt(c,s,n,o,l,i))}else{let u=a();r.push(()=>u.then(c=>{if(!c)throw new Error(`Couldn't resolve component "${l}" at "${o.path}"`);const f=Oa(c)?c.default:c;o.mods[l]=c,o.components[l]=f;const g=(f.__vccOpts||f)[e];return g&&dt(g,s,n,o,l,i)()}))}}return r}function Oi(t){const e=tt(kn),s=tt(tl),n=Ne(()=>{const a=wt(t.to);return e.resolve(a)}),i=Ne(()=>{const{matched:a}=n.value,{length:u}=a,c=a[u-1],f=s.matched;if(!c||!f.length)return-1;const p=f.findIndex(kt.bind(null,c));if(p>-1)return p;const g=Li(a[u-2]);return u>1&&Li(c)===g&&f[f.length-1].path!==g?f.findIndex(kt.bind(null,a[u-2])):p}),r=Ne(()=>i.value>-1&&Cc(s.params,n.value.params)),o=Ne(()=>i.value>-1&&i.value===s.matched.length-1&&Yr(s.params,n.value.params));function l(a={}){if(Ec(a)){const u=e[wt(t.replace)?"replace":"push"](wt(t.to)).catch(Gt);return t.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>u),u}return Promise.resolve()}return{route:n,href:Ne(()=>n.value.href),isActive:r,isExactActive:o,navigate:l}}function wc(t){return t.length===1?t[0]:t}const xc=Ts({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"},viewTransition:Boolean},useLink:Oi,setup(t,{slots:e}){const s=Os(Oi(t)),{options:n}=tt(kn),i=Ne(()=>({[Ti(t.activeClass,n.linkActiveClass,"router-link-active")]:s.isActive,[Ti(t.exactActiveClass,n.linkExactActiveClass,"router-link-exact-active")]:s.isExactActive}));return()=>{const r=e.default&&wc(e.default(s));return t.custom?r:Ur("a",{"aria-current":s.isExactActive?t.ariaCurrentValue:null,href:s.href,onClick:s.navigate,class:i.value},r)}}}),Sc=xc;function Ec(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&!(t.button!==void 0&&t.button!==0)){if(t.currentTarget&&t.currentTarget.getAttribute){const e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function Cc(t,e){for(const s in e){const n=e[s],i=t[s];if(typeof n=="string"){if(n!==i)return!1}else if(!He(i)||i.length!==n.length||n.some((r,o)=>r!==i[o]))return!1}return!0}function Li(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const Ti=(t,e,s)=>t??e??s,_c=Ts({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(t,{attrs:e,slots:s}){const n=tt(fn),i=Ne(()=>t.route||n.value),r=tt(_i,0),o=Ne(()=>{let u=wt(r);const{matched:c}=i.value;let f;for(;(f=c[u])&&!f.components;)u++;return u}),l=Ne(()=>i.value.matched[o.value]);cs(_i,Ne(()=>o.value+1)),cs(Ac,l),cs(fn,i);const a=ir();return us(()=>[a.value,l.value,t.name],([u,c,f],[p,g,_])=>{c&&(c.instances[f]=u,g&&g!==c&&u&&u===p&&(c.leaveGuards.size||(c.leaveGuards=g.leaveGuards),c.updateGuards.size||(c.updateGuards=g.updateGuards))),u&&c&&(!g||!kt(c,g)||!p)&&(c.enterCallbacks[f]||[]).forEach(C=>C(u))},{flush:"post"}),()=>{const u=i.value,c=t.name,f=l.value,p=f&&f.components[c];if(!p)return Pi(s.default,{Component:p,route:u});const g=f.props[c],_=g?g===!0?u.params:typeof g=="function"?g(u):g:null,D=Ur(p,J({},_,e,{onVnodeUnmounted:T=>{T.component.isUnmounted&&(f.instances[c]=null)},ref:a}));return Pi(s.default,{Component:D,route:u})||D}}});function Pi(t,e){if(!t)return null;const s=t(e);return s.length===1?s[0]:s}const Oc=_c;function Lc(t){const e=dc(t.routes,t),s=t.parseQuery||bc,n=t.stringifyQuery||Ci,i=t.history,r=Bt(),o=Bt(),l=Bt(),a=Ml(ut);let u=ut;Ct&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=zs.bind(null,A=>""+A),f=zs.bind(null,Va),p=zs.bind(null,ss);function g(A,N){let k,B;return Jr(A)?(k=e.getRecordMatcher(A),B=N):B=A,e.addRoute(B,k)}function _(A){const N=e.getRecordMatcher(A);N&&e.removeRoute(N)}function C(){return e.getRoutes().map(A=>A.record)}function D(A){return!!e.getRecordMatcher(A)}function T(A,N){if(N=J({},N||a.value),typeof A=="string"){const v=Ws(s,A,N.path),w=e.resolve({path:v.path},N),E=i.createHref(v.fullPath);return J(v,w,{params:p(w.params),hash:ss(v.hash),redirectedFrom:void 0,href:E})}let k;if(A.path!=null)k=J({},A,{path:Ws(s,A.path,N.path).path});else{const v=J({},A.params);for(const w in v)v[w]==null&&delete v[w];k=J({},A,{params:f(v)}),N.params=f(N.params)}const B=e.resolve(k,N),Y=A.hash||"";B.params=c(p(B.params));const h=ja(n,J({},A,{hash:Na(Y),path:B.path})),d=i.createHref(h);return J({fullPath:h,hash:Y,query:n===Ci?yc(A.query):A.query||{}},B,{redirectedFrom:void 0,href:d})}function m(A){return typeof A=="string"?Ws(s,A,a.value.path):J({},A)}function b(A,N){if(u!==A)return Ft(8,{from:N,to:A})}function y(A){return F(A)}function S(A){return y(J(m(A),{replace:!0}))}function O(A){const N=A.matched[A.matched.length-1];if(N&&N.redirect){const{redirect:k}=N;let B=typeof k=="function"?k(A):k;return typeof B=="string"&&(B=B.includes("?")||B.includes("#")?B=m(B):{path:B},B.params={}),J({query:A.query,hash:A.hash,params:B.path!=null?{}:A.params},B)}}function F(A,N){const k=u=T(A),B=a.value,Y=A.state,h=A.force,d=A.replace===!0,v=O(k);if(v)return F(J(m(v),{state:typeof v=="object"?J({},Y,v.state):Y,force:h,replace:d}),N||k);const w=k;w.redirectedFrom=N;let E;return!h&&za(n,B,k)&&(E=Ft(16,{to:w,from:B}),Ae(B,B,!0,!1)),(E?Promise.resolve(E):K(w,B)).catch(x=>Je(x)?Je(x,2)?x:ye(x):$(x,w,B)).then(x=>{if(x){if(Je(x,2))return F(J({replace:d},m(x.to),{state:typeof x.to=="object"?J({},Y,x.to.state):Y,force:h}),N||w)}else x=pe(w,B,!0,d,Y);return re(w,B,x),x})}function W(A,N){const k=b(A,N);return k?Promise.reject(k):Promise.resolve()}function H(A){const N=we.values().next().value;return N&&typeof N.runWithContext=="function"?N.runWithContext(A):A()}function K(A,N){let k;const[B,Y,h]=Tc(A,N);k=Gs(B.reverse(),"beforeRouteLeave",A,N);for(const v of B)v.leaveGuards.forEach(w=>{k.push(dt(w,A,N))});const d=W.bind(null,A,N);return k.push(d),fe(k).then(()=>{k=[];for(const v of r.list())k.push(dt(v,A,N));return k.push(d),fe(k)}).then(()=>{k=Gs(Y,"beforeRouteUpdate",A,N);for(const v of Y)v.updateGuards.forEach(w=>{k.push(dt(w,A,N))});return k.push(d),fe(k)}).then(()=>{k=[];for(const v of h)if(v.beforeEnter)if(He(v.beforeEnter))for(const w of v.beforeEnter)k.push(dt(w,A,N));else k.push(dt(v.beforeEnter,A,N));return k.push(d),fe(k)}).then(()=>(A.matched.forEach(v=>v.enterCallbacks={}),k=Gs(h,"beforeRouteEnter",A,N,H),k.push(d),fe(k))).then(()=>{k=[];for(const v of o.list())k.push(dt(v,A,N));return k.push(d),fe(k)}).catch(v=>Je(v,8)?v:Promise.reject(v))}function re(A,N,k){l.list().forEach(B=>H(()=>B(A,N,k)))}function pe(A,N,k,B,Y){const h=b(A,N);if(h)return h;const d=N===ut,v=Ct?history.state:{};k&&(B||d?i.replace(A.fullPath,J({scroll:d&&v&&v.scroll},Y)):i.push(A.fullPath,Y)),a.value=A,Ae(A,N,k,d),ye()}let Le;function ot(){Le||(Le=i.listen((A,N,k)=>{if(!Ve.listening)return;const B=T(A),Y=O(B);if(Y){F(J(Y,{replace:!0,force:!0}),B).catch(Gt);return}u=B;const h=a.value;Ct&&Za(mi(h.fullPath,k.delta),ks()),K(B,h).catch(d=>Je(d,12)?d:Je(d,2)?(F(J(m(d.to),{force:!0}),B).then(v=>{Je(v,20)&&!k.delta&&k.type===ns.pop&&i.go(-1,!1)}).catch(Gt),Promise.reject()):(k.delta&&i.go(-k.delta,!1),$(d,B,h))).then(d=>{d=d||pe(B,h,!1),d&&(k.delta&&!Je(d,8)?i.go(-k.delta,!1):k.type===ns.pop&&Je(d,20)&&i.go(-1,!1)),re(B,h,d)}).catch(Gt)}))}let at=Bt(),oe=Bt(),Q;function $(A,N,k){ye(A);const B=oe.list();return B.length?B.forEach(Y=>Y(A,N,k)):console.error(A),Promise.reject(A)}function ae(){return Q&&a.value!==ut?Promise.resolve():new Promise((A,N)=>{at.add([A,N])})}function ye(A){return Q||(Q=!A,ot(),at.list().forEach(([N,k])=>A?k(A):N()),at.reset()),A}function Ae(A,N,k,B){const{scrollBehavior:Y}=t;if(!Ct||!Y)return Promise.resolve();const h=!k&&Xa(mi(A.fullPath,0))||(B||!k)&&history.state&&history.state.scroll||null;return ar().then(()=>Y(A,N,h)).then(d=>d&&Ja(d)).catch(d=>$(d,A,N))}const te=A=>i.go(A);let ct;const we=new Set,Ve={currentRoute:a,listening:!0,addRoute:g,removeRoute:_,clearRoutes:e.clearRoutes,hasRoute:D,getRoutes:C,resolve:T,options:t,push:y,replace:S,go:te,back:()=>te(-1),forward:()=>te(1),beforeEach:r.add,beforeResolve:o.add,afterEach:l.add,onError:oe.add,isReady:ae,install(A){const N=this;A.component("RouterLink",Sc),A.component("RouterView",Oc),A.config.globalProperties.$router=N,Object.defineProperty(A.config.globalProperties,"$route",{enumerable:!0,get:()=>wt(a)}),Ct&&!ct&&a.value===ut&&(ct=!0,y(i.location).catch(Y=>{}));const k={};for(const Y in ut)Object.defineProperty(k,Y,{get:()=>a.value[Y],enumerable:!0});A.provide(kn,N),A.provide(tl,sr(k)),A.provide(fn,a);const B=A.unmount;we.add(A),A.unmount=function(){we.delete(A),we.size<1&&(u=ut,Le&&Le(),Le=null,a.value=ut,ct=!1,Q=!1),B()}}};function fe(A){return A.reduce((N,k)=>N.then(()=>H(k)),Promise.resolve())}return Ve}function Tc(t,e){const s=[],n=[],i=[],r=Math.max(e.matched.length,t.matched.length);for(let o=0;okt(u,l))?n.push(l):s.push(l));const a=t.matched[o];a&&(e.matched.find(u=>kt(u,a))||i.push(a))}return[s,n,i]}const Pc=Lc({history:nc(),linkActiveClass:"active",routes:[{path:"/",name:"Home",component:()=>Qe(()=>import("./home.js"),__vite__mapDeps([0,1]))},{path:"/install",name:"Install",component:()=>Qe(()=>import("./install.js"),[])},{path:"/selects",name:"Selects",component:()=>Qe(()=>import("./selects.js"),[])},{path:"/data",name:"Data",component:()=>Qe(()=>import("./data.js"),[])},{path:"/examples",name:"Examples",component:()=>Qe(()=>import("./index2.js"),__vite__mapDeps([2,3]))},{path:"/settings",name:"Settings",component:()=>Qe(()=>import("./index3.js"),__vite__mapDeps([4,5]))},{path:"/events",name:"Events",component:()=>Qe(()=>import("./index4.js"),[])},{path:"/methods",name:"Methods",component:()=>Qe(()=>import("./index5.js"),[])},{path:"/vue",name:"Vue",component:()=>Qe(()=>import("./vue.js"),[])}]});class Rc{constructor(e){e||(e={}),this.main=e.main||"ss-main",this.placeholder=e.placeholder||"ss-placeholder",this.values=e.values||"ss-values",this.single=e.single||"ss-single",this.max=e.max||"ss-max",this.value=e.value||"ss-value",this.valueText=e.valueText||"ss-value-text",this.valueDelete=e.valueDelete||"ss-value-delete",this.valueOut=e.valueOut||"ss-value-out",this.deselect=e.deselect||"ss-deselect",this.deselectPath=e.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=e.arrow||"ss-arrow",this.arrowClose=e.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=e.arrowOpen||"M10,70 L50,30 L90,70",this.content=e.content||"ss-content",this.openAbove=e.openAbove||"ss-open-above",this.openBelow=e.openBelow||"ss-open-below",this.search=e.search||"ss-search",this.searchHighlighter=e.searchHighlighter||"ss-search-highlight",this.searching=e.searching||"ss-searching",this.addable=e.addable||"ss-addable",this.addablePath=e.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=e.list||"ss-list",this.optgroup=e.optgroup||"ss-optgroup",this.optgroupLabel=e.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=e.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=e.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=e.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=e.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=e.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=e.optgroupClosable||"ss-closable",this.option=e.option||"ss-option",this.optionDelete=e.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=e.highlighted||"ss-highlighted",this.open=e.open||"ss-open",this.close=e.close||"ss-close",this.selected=e.selected||"ss-selected",this.error=e.error||"ss-error",this.disabled=e.disabled||"ss-disabled",this.hide=e.hide||"ss-hide"}}function Fn(){return Math.random().toString(36).substring(2,10)}function Dc(t,e){function s(i,r){return r&&i&&i.classList&&i.classList.contains(r)||r&&i&&i.dataset&&i.dataset.id&&i.dataset.id===e?i:null}function n(i,r){return!i||i===document?null:s(i,r)?i:n(i.parentNode,r)}return s(t,e)||n(t,e)}function Kt(t,e=50,s=!1){let n;return function(...i){const r=self,o=()=>{n=null,s||t.apply(r,i)},l=s&&!n;clearTimeout(n),n=setTimeout(o,e),l&&t.apply(r,i)}}function qs(t,e){return JSON.stringify(t)===JSON.stringify(e)}function kc(t){const e=t.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,s=>"-"+s.toLowerCase());return t[0]===t[0].toUpperCase()?e.substring(1):e}class Me{constructor(e){if(this.id=!e.id||e.id===""?Fn():e.id,this.label=e.label||"",this.selectAll=e.selectAll===void 0?!1:e.selectAll,this.selectAllText=e.selectAllText||"Select All",this.closable=e.closable||"off",this.options=[],e.options)for(const s of e.options)this.options.push(new ue(s))}}class ue{constructor(e){this.id=!e.id||e.id===""?Fn():e.id,this.value=e.value===void 0?e.text:e.value,this.text=e.text||"",this.html=e.html||"",this.defaultSelected=e.defaultSelected!==void 0?e.defaultSelected:!1,this.selected=e.selected!==void 0?e.selected:!1,this.display=e.display!==void 0?e.display:!0,this.disabled=e.disabled!==void 0?e.disabled:!1,this.mandatory=e.mandatory!==void 0?e.mandatory:!1,this.placeholder=e.placeholder!==void 0?e.placeholder:!1,this.class=e.class||"",this.style=e.style||"",this.data=e.data||{}}}class Fc{constructor(e,s){this.selectType="single",this.data=[],this.selectedOrder=[],this.selectType=e,this.setData(s)}validateDataArray(e){if(!Array.isArray(e))return new Error("Data must be an array");for(let s of e)if(s instanceof Me||"label"in s){if(!("label"in s))return new Error("Optgroup must have a label");if("options"in s&&s.options)for(let n of s.options){const i=this.validateOption(n);if(i)return i}}else if(s instanceof ue||"text"in s){const n=this.validateOption(s);if(n)return n}else return new Error("Data object must be a valid optgroup or option");return null}validateOption(e){return"text"in e?null:new Error("Option must have a text")}partialToFullData(e){let s=[];return e.forEach(n=>{if(n instanceof Me||"label"in n){let i=[];"options"in n&&n.options&&n.options.forEach(r=>{i.push(new ue(r))}),i.length>0&&s.push(new Me(n))}(n instanceof ue||"text"in n)&&s.push(new ue(n))}),s}setData(e){this.data=this.partialToFullData(e),this.selectType==="single"&&this.setSelectedBy("id",this.getSelected())}getData(){return this.filter(null,!0)}getDataOptions(){return this.filter(null,!1)}addOption(e,s=!1){if(s){let n=[new ue(e)];this.setData(n.concat(this.getData()))}else this.setData(this.getData().concat(new ue(e)))}setSelectedBy(e,s){let n=null,i=!1;const r=[];for(let l of this.data){if(l instanceof Me)for(let a of l.options)n||(n=a),a.selected=i?!1:s.includes(a[e]),a.selected&&(r.push(a),this.selectType==="single"&&(i=!0));l instanceof ue&&(n||(n=l),l.selected=i?!1:s.includes(l[e]),l.selected&&(r.push(l),this.selectType==="single"&&(i=!0)))}this.selectType==="single"&&n&&!i&&(n.selected=!0,r.push(n));const o=s.map(l=>{var a;return((a=r.find(u=>u[e]===l))==null?void 0:a.id)||""});this.selectedOrder=o}getSelected(){return this.getSelectedOptions().map(e=>e.id)}getSelectedValues(){return this.getSelectedOptions().map(e=>e.value)}getSelectedOptions(){return this.filter(e=>e.selected,!1)}getOptgroupByID(e){for(let s of this.data)if(s instanceof Me&&s.id===e)return s;return null}getOptionByID(e){let s=this.filter(n=>n.id===e,!1);return s.length?s[0]:null}getSelectType(){return this.selectType}getFirstOption(){let e=null;for(let s of this.data)if(s instanceof Me?e=s.options[0]:s instanceof ue&&(e=s),e)break;return e}search(e,s){return e=e.trim(),e===""?this.getData():this.filter(n=>s(n,e),!0)}filter(e,s){const n=[];return this.data.forEach(i=>{if(i instanceof Me){let r=[];if(i.options.forEach(o=>{(!e||e(o))&&(s?r.push(new ue(o)):n.push(new ue(o)))}),r.length>0){let o=new Me(i);o.options=r,n.push(o)}}i instanceof ue&&(!e||e(i))&&n.push(new ue(i))}),n}selectedOrderOptions(e){const s=[];return this.selectedOrder.forEach(n=>{const i=e.find(r=>r.id===n);i&&s.push(i)}),e.forEach(n=>{let i=!1;s.forEach(r=>{if(n.id===r.id){i=!0;return}}),i||s.push(n)}),s}}const ke=class ke{static getLiveAssertive(){let e=document.getElementById("ss-live-assertive");return e||(e=document.createElement("div"),e.id="ss-live-assertive",e.setAttribute("role","status"),e.setAttribute("aria-live","assertive"),e.setAttribute("aria-atomic","true"),e.className="ss-sr-only",document.body.appendChild(e)),e}_announceAssertive(e){const s=ke._liveAssertive||(ke._liveAssertive=ke.getLiveAssertive());s.textContent="",requestAnimationFrame(()=>{s.textContent=e})}constructor(e,s,n,i){var o;this.store=n,this.settings=e,this.classes=s,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes();const r=(o=document.querySelector(`[data-id="${this.settings.id}"]`))==null?void 0:o.closest(".offcanvas-body");r?r.appendChild(this.content.main):this.settings.contentLocation&&this.settings.contentLocation.appendChild(this.content.main)}static getLivePolite(){let e=document.getElementById("ss-live-polite");return e||(e=document.createElement("div"),e.id="ss-live-polite",e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),e.className="ss-sr-only",document.body.appendChild(e)),e}_announcePolite(e){const s=ke._livePolite||(ke._livePolite=ke.getLivePolite());s.textContent="",requestAnimationFrame(()=>{s.textContent=e})}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 e=this.store.getSelectedOptions();if(e.length){const s=e[e.length-1].id,n=this.content.list.querySelector('[data-id="'+s+'"]');n&&this.ensureElementInView(this.content.list,n)}this.settings.contentPosition==="fixed"&&(this.moveContent(),this.scrollHandler=()=>this.moveContent(),this.resizeHandler=()=>this.moveContent(),window.addEventListener("scroll",this.scrollHandler,!0),window.addEventListener("resize",this.resizeHandler)),this.searchFocus()}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),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=void 0),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=void 0),this.main.main.focus({preventScroll:!0}),this.main.main.removeAttribute("aria-activedescendant")}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.main.main.classList.add("ss-2"),this.content.main.classList.add(this.classes.content),this.content.main.classList.add("ss-content-2"),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()));(this.settings.contentPosition==="relative"||this.settings.contentPosition==="fixed")&&this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){this.content.list.setAttribute("role","listbox"),this.content.list.setAttribute("id",this.content.main.id+"-list"),this.content.list.setAttribute("aria-label",this.settings.contentAriaLabel),this.settings.isMultiple?this.content.list.setAttribute("aria-multiselectable","true"):this.content.list.removeAttribute("aria-multiselectable"),this.main.main.setAttribute("role","combobox"),this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.list.id),this.main.main.setAttribute("aria-expanded","false"),this.main.main.setAttribute("aria-autocomplete","list"),this.settings.ariaLabelledBy&&this.settings.ariaLabelledBy.trim()?(this.main.main.setAttribute("aria-labelledby",this.settings.ariaLabelledBy),this.main.main.removeAttribute("aria-label")):this.settings.ariaLabel&&this.settings.ariaLabel.trim()&&this.main.main.setAttribute("aria-label",this.settings.ariaLabel),this.main.main.setAttribute("aria-owns",this.content.list.id),this.content.search.input.setAttribute("aria-controls",this.content.list.id),this.content.search.input.setAttribute("aria-autocomplete","list")}mainDiv(){var u;const e=document.createElement("div");e.id=this.settings.id+"-main",e.tabIndex=0,e.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 f=this.content.list.querySelector("."+this.classes.highlighted);return f&&f.click(),!1;case"Escape":return this.callbacks.close(),!1}return c.key.length===1&&this.callbacks.open(),!0},e.onclick=c=>{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 n=document.createElement("div");n.classList.add(this.classes.deselect),n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label",this.settings.clearAllAriaLabel),n.addEventListener("keydown",c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),n.click())});const i=(u=this.store)==null?void 0:u.getSelectedOptions();!this.settings.allowDeselect||this.settings.isMultiple&&i&&i.length<=0?n.classList.add(this.classes.hide):n.classList.remove(this.classes.hide),n.onclick=c=>{if(c.stopPropagation(),this.settings.disabled)return;let f=!0;const p=this.store.getSelectedOptions(),g=[];if(this.callbacks.beforeChange&&(f=this.callbacks.beforeChange(g,p)===!0),f){if(this.settings.isMultiple)this.callbacks.setSelected([],!1),this.updateDeselectAll();else{const _=this.store.getFirstOption(),C=_?_.id:"";this.callbacks.setSelected(C,!1)}this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(this.store.getSelectedOptions())}};const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("viewBox","0 0 100 100"),r.setAttribute("aria-hidden","true"),r.setAttribute("focusable","false");const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.deselectPath),r.appendChild(o),n.appendChild(r),e.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.classList.add(this.classes.arrow),l.setAttribute("viewBox","0 0 100 100"),l.setAttribute("aria-hidden","true"),l.setAttribute("focusable","false");const a=document.createElementNS("http://www.w3.org/2000/svg","path");return a.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&l.classList.add(this.classes.hide),l.appendChild(a),e.appendChild(l),{main:e,values:s,deselect:{main:n,svg:r,path:o},arrow:{main:l,path:a}}}mainFocus(e){e!=="click"&&this.main.main.focus({preventScroll:!0})}placeholder(){const e=this.store.filter(i=>i.placeholder,!1);let s=this.settings.placeholderText;e.length&&(e[0].html!==""?s=e[0].html:e[0].text!==""&&(s=e[0].text));const n=document.createElement("div");return n.classList.add(this.classes.placeholder),n.innerHTML=s,n}renderValues(){if(!this.settings.isMultiple){this.renderSingleValue();return}this.renderMultipleValues(),this.updateDeselectAll()}renderSingleValue(){const e=this.store.filter(n=>n.selected&&!n.placeholder,!1),s=e.length>0?e[0]:null;if(!s)this.main.values.innerHTML=this.placeholder().outerHTML;else{const n=document.createElement("div");n.classList.add(this.classes.single),s.html?n.innerHTML=s.html:n.innerText=s.text,this.main.values.innerHTML=n.outerHTML}!this.settings.allowDeselect||!e.length?this.main.deselect.main.classList.add(this.classes.hide):this.main.deselect.main.classList.remove(this.classes.hide)}renderMultipleValues(){let e=this.main.values.childNodes,s=this.store.filter(i=>i.selected&&i.display,!1);if(s.length===0){this.main.values.innerHTML=this.placeholder().outerHTML;return}else{const i=this.main.values.querySelector("."+this.classes.placeholder);i&&i.remove()}if(s.length>this.settings.maxValuesShown){const i=document.createElement("div");i.classList.add(this.classes.max),i.textContent=this.settings.maxValuesMessage.replace("{number}",s.length.toString()),this.main.values.innerHTML=i.outerHTML;return}else{const i=this.main.values.querySelector("."+this.classes.max);i&&i.remove()}this.settings.keepOrder&&(s=this.store.selectedOrderOptions(s));let n=[];for(let i=0;ia.id===o,!1).length||n.push(r))}for(const i of n)i.classList.add(this.classes.valueOut),setTimeout(()=>{this.main.values.hasChildNodes()&&this.main.values.contains(i)&&this.main.values.removeChild(i)},100);e=this.main.values.childNodes;for(let i=0;i{if(l.preventDefault(),l.stopPropagation(),this.settings.disabled)return;let a=!0;const u=this.store.getSelectedOptions(),c=u.filter(f=>f.selected&&f.id!==e.id,!0);if(!(this.settings.minSelected&&c.length{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),i.click())}}return s}contentDiv(){const e=document.createElement("div");e.id=this.settings.id+"-content";const s=this.searchDiv();e.appendChild(s.main);const n=this.listDiv();return e.appendChild(n),{main:e,search:s,list:n}}moveContent(){if(this.settings.contentPosition==="relative"){this.moveContentBelow();return}if(this.settings.openPosition==="down"){this.moveContentBelow();return}else if(this.settings.openPosition==="up"){this.moveContentAbove();return}this.putContent()==="up"?this.moveContentAbove():this.moveContentBelow()}searchDiv(){const e=document.createElement("div"),s=document.createElement("input"),n=document.createElement("div");e.classList.add(this.classes.search);const i={main:e,input:s};if(this.settings.showSearch||(e.classList.add(this.classes.hide),s.readOnly=!0),s.type="search",s.placeholder=this.settings.searchPlaceholder,s.tabIndex=-1,this.settings.searchLabelledBy&&this.settings.searchLabelledBy.trim()?s.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel&&this.settings.searchAriaLabel.trim()?s.setAttribute("aria-label",this.settings.searchAriaLabel):s.setAttribute("aria-label","Search options"),s.setAttribute("autocapitalize","off"),s.setAttribute("autocomplete","off"),s.setAttribute("autocorrect","off"),s.oninput=Kt(r=>{this.callbacks.search(r.target.value)},100),s.onkeydown=r=>{switch(r.key){case"ArrowUp":case"ArrowDown":return r.key==="ArrowDown"?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Escape":return this.callbacks.close(),!1;case" ":const o=this.content.list.querySelector("."+this.classes.highlighted);return o?(o.click(),!1):!0;case"Enter":if(this.callbacks.addable)return n.click(),!1;{const l=this.content.list.querySelector("."+this.classes.highlighted);if(l)return l.click(),!1}return!0}return!0},e.appendChild(s),this.callbacks.addable){n.classList.add(this.classes.addable);const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("viewBox","0 0 100 100"),r.setAttribute("aria-hidden","true"),r.setAttribute("focusable","false");const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.addablePath),r.appendChild(o),n.appendChild(r),n.onclick=l=>{if(l.preventDefault(),l.stopPropagation(),!this.callbacks.addable)return;const a=this.content.search.input.value.trim();if(a===""){this.content.search.input.focus();return}const u=f=>{let p=new ue(f);if(this.callbacks.addOption(p),this.settings.isMultiple){let g=this.store.getSelected();g.push(p.id),this.callbacks.setSelected(g,!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(f=>{typeof f=="string"?u({text:f,value:f}):c instanceof Error?this.renderError(c.message):u(f)}):typeof c=="string"?u({text:c,value:c}):c instanceof Error?this.renderError(c.message):u(c))},e.appendChild(n),i.addable={main:n,svg:r,path:o}}return i}searchFocus(){this.content.search.input.focus()}getOptions(e=!1,s=!1,n=!1){let i="."+this.classes.option;return e&&(i+=":not(."+this.classes.placeholder+")"),s&&(i+=":not(."+this.classes.disabled+")"),n&&(i+=":not(."+this.classes.hide+")"),Array.from(this.content.list.querySelectorAll(i))}highlight(e){const s=this.getOptions(!0,!0,!0);if(s.length===0)return;if(s.length===1&&!s[0].classList.contains(this.classes.highlighted)){s[0].classList.add(this.classes.highlighted);return}let n=!1;for(const r of s)r.classList.contains(this.classes.highlighted)&&(n=!0);if(!n){for(const r of s)if(r.classList.contains(this.classes.selected)){r.classList.add(this.classes.highlighted);break}}for(let r=0;r=0?r-1:s.length-1];a.classList.add(this.classes.highlighted),this.main.main.setAttribute("aria-activedescendant",a.id),this.ensureElementInView(this.content.list,a);const u=a.parentElement;if(u&&u.classList.contains(this.classes.close)){const c=u.querySelector("."+this.classes.optgroupLabel);c&&c.click()}return}const i=s[e==="down"?0:s.length-1];i.classList.add(this.classes.highlighted),this.main.main.setAttribute("aria-activedescendant",i.id),this.ensureElementInView(this.content.list,i)}listDiv(){const e=document.createElement("div");return e.classList.add(this.classes.list),e}renderError(e){this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy");const s=document.createElement("div");s.classList.add(this.classes.error),s.textContent=e,this.content.list.appendChild(s),this._announceAssertive(e)}renderSearching(){this.content.list.innerHTML="",this.content.list.setAttribute("aria-busy","true");const e=document.createElement("div");e.classList.add(this.classes.searching),e.textContent=this.settings.searchingText,this.content.list.appendChild(e),this._announcePolite(this.settings.searchingText)}renderOptions(e){if(this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy"),e.length===0){const l=document.createElement("div");l.classList.add(this.classes.search);const a=this.callbacks.addable?this.settings.addableText.replace("{value}",this.content.search.input.value):this.settings.searchText;this._announcePolite(a),l.innerHTML=a,this.content.list.appendChild(l),this.content.list.setAttribute("aria-setsize","0");return}this.settings.allowDeselect&&!this.settings.isMultiple&&(this.store.filter(a=>a.placeholder,!1).length||this.store.addOption(new ue({text:"",value:"",selected:!1,placeholder:!0}),!0));const s=document.createDocumentFragment();let n=0;const i=e.filter(l=>l instanceof ue&&!l.placeholder&&l.display&&!l.disabled).length,r=l=>{!l.classList.contains(this.classes.placeholder)&&!l.classList.contains(this.classes.disabled)&&!l.classList.contains(this.classes.hide)&&(l.setAttribute("aria-posinset",String(++n)),l.setAttribute("aria-setsize",String(i)))};for(const l of e){if(l instanceof Me){const a=document.createElement("div");a.classList.add(this.classes.optgroup),a.setAttribute("role","group"),a.setAttribute("aria-label",l.label);const u=document.createElement("div");u.classList.add(this.classes.optgroupLabel),a.appendChild(u);const c=document.createElement("div");c.classList.add(this.classes.optgroupLabelText),c.textContent=l.label,u.appendChild(c);const f=document.createElement("div");if(f.classList.add(this.classes.optgroupActions),u.appendChild(f),this.settings.isMultiple&&l.selectAll){const p=document.createElement("div");p.classList.add(this.classes.optgroupSelectAll);let g=!0;for(const m of l.options)if(!m.selected){g=!1;break}g&&p.classList.add(this.classes.selected);const _=document.createElement("span");_.textContent=l.selectAllText,p.appendChild(_);const C=document.createElementNS("http://www.w3.org/2000/svg","svg");C.setAttribute("viewBox","0 0 100 100"),C.setAttribute("aria-hidden","true"),C.setAttribute("focusable","false"),p.appendChild(C);const D=document.createElementNS("http://www.w3.org/2000/svg","path");D.setAttribute("d",this.classes.optgroupSelectAllBox),C.appendChild(D);const T=document.createElementNS("http://www.w3.org/2000/svg","path");T.setAttribute("d",this.classes.optgroupSelectAllCheck),C.appendChild(T),p.addEventListener("click",m=>{m.preventDefault(),m.stopPropagation();const b=this.store.getSelected();if(g){const y=b.filter(S=>{for(const O of l.options)if(S===O.id)return!1;return!0});this.callbacks.setSelected(y,!0);return}else{const y=b.concat(l.options.map(S=>S.id));for(const S of l.options)this.store.getOptionByID(S.id)||this.callbacks.addOption(S);this.callbacks.setSelected(y,!0);return}}),f.appendChild(p)}if(l.closable!=="off"){const p=document.createElement("div");p.classList.add(this.classes.optgroupClosable);const g=document.createElementNS("http://www.w3.org/2000/svg","svg");g.setAttribute("viewBox","0 0 100 100"),g.classList.add(this.classes.arrow),g.setAttribute("aria-hidden","true"),g.setAttribute("focusable","false"),p.appendChild(g);const _=document.createElementNS("http://www.w3.org/2000/svg","path");g.appendChild(_),l.options.some(C=>C.selected)||this.content.search.input.value.trim()!==""?(a.classList.add(this.classes.open),_.setAttribute("d",this.classes.arrowOpen)):l.closable==="open"?(a.classList.add(this.classes.open),_.setAttribute("d",this.classes.arrowOpen)):l.closable==="close"&&(a.classList.add(this.classes.close),_.setAttribute("d",this.classes.arrowClose)),u.addEventListener("click",C=>{C.preventDefault(),C.stopPropagation(),a.classList.contains(this.classes.close)?(a.classList.remove(this.classes.close),a.classList.add(this.classes.open),_.setAttribute("d",this.classes.arrowOpen)):(a.classList.remove(this.classes.open),a.classList.add(this.classes.close),_.setAttribute("d",this.classes.arrowClose))}),f.appendChild(p)}a.appendChild(u);for(const p of l.options){const g=this.option(p);r(g),a.appendChild(g)}s.appendChild(a)}if(l instanceof ue){const a=this.option(l);r(a),s.appendChild(a)}}this.content.list.appendChild(s),this.content.list.removeAttribute("aria-busy");const o=this.getOptions(!0,!0,!0).length;this._announcePolite(`${o} option${o===1?"":"s"} available`)}option(e){if(e.placeholder){const n=document.createElement("div");return n.classList.add(this.classes.option),n.classList.add(this.classes.hide),n}const s=document.createElement("div");return s.id=`${this.settings.id}__opt__${e.id}`,s.classList.add(this.classes.option),s.setAttribute("role","option"),e.class&&e.class.split(" ").forEach(n=>{s.classList.add(n)}),e.style&&(s.style.cssText=e.style),this.settings.searchHighlight&&this.content.search.input.value.trim()!==""?s.innerHTML=this.highlightText(e.html!==""?e.html:e.text,this.content.search.input.value,this.classes.searchHighlighter):e.html!==""?s.innerHTML=e.html:s.textContent=e.text,this.settings.showOptionTooltips&&s.textContent&&s.setAttribute("title",s.textContent),e.display||s.classList.add(this.classes.hide),e.disabled&&(s.classList.add(this.classes.disabled),s.setAttribute("aria-disabled","true")),e.selected&&this.settings.hideSelected&&s.classList.add(this.classes.hide),e.selected?(s.classList.add(this.classes.selected),s.setAttribute("aria-selected","true"),this.main.main.setAttribute("aria-activedescendant",s.id)):(s.classList.remove(this.classes.selected),s.setAttribute("aria-selected","false")),s.addEventListener("click",n=>{n.preventDefault(),n.stopPropagation();const i=this.store.getSelected(),r=n.currentTarget,o=String(r.dataset.id);if(e.disabled||e.selected&&!this.settings.allowDeselect||this.settings.isMultiple&&this.settings.maxSelected<=i.length&&!e.selected||this.settings.isMultiple&&this.settings.minSelected>=i.length&&e.selected)return;let l=!1;const a=this.store.getSelectedOptions();let u=[];if(this.settings.isMultiple){if(e.selected)u=a.filter(c=>c.id!==o);else if(u=a.concat(e),!this.settings.closeOnSelect)if(n.shiftKey&&this.lastSelectedOption){const c=this.store.getDataOptions();let f=c.findIndex(g=>g.id===this.lastSelectedOption.id),p=c.findIndex(g=>g.id===e.id);if(f>=0&&p>=0){const g=Math.min(f,p),_=Math.max(f,p),C=c.slice(g,_+1);C.length>0&&C.length!a.find(T=>T.id===D.id))))}}else e.selected||(this.lastSelectedOption=e)}this.settings.isMultiple||(e.selected?u=[]:u=[e]),this.callbacks.beforeChange||(l=!0),this.callbacks.beforeChange&&(this.callbacks.beforeChange(u,a)===!1?l=!1:l=!0),l&&(this.store.getOptionByID(o)||this.callbacks.addOption(e),this.callbacks.setSelected(u.map(c=>c.id),!1),this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(u))}),s}destroy(){this.main.main.remove(),this.content.main.remove()}highlightText(e,s,n){let i=e;const r=new RegExp("(?![^<]*>)("+s.trim()+")(?![^<]*>[^<>]*${a}`),i}moveContentAbove(){const e=this.main.main.offsetHeight,s=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 n=this.main.main.getBoundingClientRect();this.content.main.style.margin="-"+(e+s-1)+"px 0px 0px 0px",this.content.main.style.top=n.top+n.height+(this.settings.contentPosition==="fixed"?0:window.scrollY)+"px",this.content.main.style.left=n.left+(this.settings.contentPosition==="fixed"?0:window.scrollX)+"px",this.content.main.style.width=n.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",this.settings.contentPosition!=="relative"&&(this.content.main.style.top=e.top+e.height+(this.settings.contentPosition==="fixed"?0:window.scrollY)+"px",this.content.main.style.left=e.left+(this.settings.contentPosition==="fixed"?0:window.scrollX)+"px",this.content.main.style.width=e.width+"px")}ensureElementInView(e,s){const n=e.scrollTop+e.offsetTop,i=n+e.clientHeight,r=s.offsetTop,o=r+s.clientHeight;ri&&(e.scrollTop+=o-i)}putContent(){const e=this.main.main.offsetHeight,s=this.main.main.getBoundingClientRect(),n=this.content.main.offsetHeight;return window.innerHeight-(s.top+e)<=n&&s.top>n?"up":"down"}updateDeselectAll(){if(!this.store||!this.settings)return;const e=this.store.getSelectedOptions(),s=e&&e.length>0,n=this.settings.isMultiple,i=this.settings.allowDeselect,r=this.main.deselect.main,o=this.classes.hide;i&&!(n&&!s)?r.classList.remove(o):r.classList.add(o)}};ke._livePolite=null,ke._liveAssertive=null;let hn=ke;class Ic{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.getSelectedOptions()),!0}observeCall(e){if(!this.listen)return;let s=!1,n=!1,i=!1;for(const r of e){if(r.target===this.select&&(r.attributeName==="disabled"&&(n=!0),r.attributeName==="class"&&(s=!0),r.type==="childList")){for(const o of r.addedNodes)if(o.nodeName==="OPTION"&&o.value===this.select.value){this.select.dispatchEvent(new Event("change"));break}i=!0}(r.target.nodeName==="OPTGROUP"||r.target.nodeName==="OPTION")&&(i=!0)}s&&this.onClassChange&&this.onClassChange(this.select.className.split(" ")),n&&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 s=this.select.childNodes;for(const n of s)n.nodeName==="OPTGROUP"&&e.push(this.getDataFromOptgroup(n)),n.nodeName==="OPTION"&&e.push(this.getDataFromOption(n));return e}getDataFromOptgroup(e){let s={id:e.id,label:e.label,selectAll:e.dataset?e.dataset.selectall==="true":!1,selectAllText:e.dataset?e.dataset.selectalltext:"Select all",closable:e.dataset?e.dataset.closable:"off",options:[]};const n=e.childNodes;for(const i of n)i.nodeName==="OPTION"&&s.options.push(this.getDataFromOption(i));return s}getDataFromOption(e){return{id:e.id,value:e.value,text:e.text,html:e.dataset&&e.dataset.html?e.dataset.html:"",defaultSelected:e.defaultSelected,selected:e.selected,display:e.style.display!=="none",disabled:e.disabled,mandatory:e.dataset?e.dataset.mandatory==="true":!1,placeholder:e.dataset.placeholder==="true",class:e.className,style:e.style.cssText,data:e.dataset}}getSelectedOptions(){let e=[];const s=this.select.childNodes;for(const n of s){if(n.nodeName==="OPTGROUP"){const i=n.childNodes;for(const r of i)if(r.nodeName==="OPTION"){const o=r;o.selected&&e.push(this.getDataFromOption(o))}}if(n.nodeName==="OPTION"){const i=n;i.selected&&e.push(this.getDataFromOption(i))}}return e}getSelectedValues(){return this.getSelectedOptions().map(e=>e.value)}setSelected(e){this.changeListen(!1);const s=this.select.childNodes;for(const n of s){if(n.nodeName==="OPTGROUP"){const r=n.childNodes;for(const o of r)if(o.nodeName==="OPTION"){const l=o;l.selected=e.includes(l.id)}}if(n.nodeName==="OPTION"){const i=n;i.selected=e.includes(i.id)}}this.changeListen(!0)}setSelectedByValue(e){this.changeListen(!1);const s=this.select.childNodes;for(const n of s){if(n.nodeName==="OPTGROUP"){const r=n.childNodes;for(const o of r)if(o.nodeName==="OPTION"){const l=o;l.selected=e.includes(l.value)}}if(n.nodeName==="OPTION"){const i=n;i.selected=e.includes(i.value)}}this.changeListen(!0)}updateSelect(e,s,n){this.changeListen(!1),e&&(this.select.dataset.id=e),s&&(this.select.style.cssText=s),n&&(this.select.className="",n.forEach(i=>{i.trim()!==""&&this.select.classList.add(i.trim())})),this.changeListen(!0)}updateOptions(e){this.changeListen(!1),this.select.innerHTML="";for(const s of e)s instanceof Me&&this.select.appendChild(this.createOptgroup(s)),s instanceof ue&&this.select.appendChild(this.createOption(s));this.select.dispatchEvent(new Event("change",{bubbles:!0})),this.changeListen(!0)}createOptgroup(e){const s=document.createElement("optgroup");if(s.id=e.id,s.label=e.label,e.selectAll&&(s.dataset.selectAll="true"),e.closable!=="off"&&(s.dataset.closable=e.closable),e.options)for(const n of e.options)s.appendChild(this.createOption(n));return s}createOption(e){const s=document.createElement("option");return s.id=e.id,s.value=e.value,s.textContent=e.text,e.html!==""&&s.setAttribute("data-html",e.html),s.defaultSelected=e.defaultSelected,s.selected=e.selected,e.disabled&&(s.disabled=!0),e.display||(s.style.display="none"),e.placeholder&&s.setAttribute("data-placeholder","true"),e.mandatory&&s.setAttribute("data-mandatory","true"),e.class&&e.class.split(" ").forEach(n=>{s.classList.add(n)}),e.data&&typeof e.data=="object"&&Object.keys(e.data).forEach(n=>{s.setAttribute("data-"+kc(n),e.data[n])}),s}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 Mc{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-"+Fn(),this.style=e.style||"",this.class=e.class||[],this.disabled=e.disabled!==void 0?e.disabled:!1,this.alwaysOpen=e.alwaysOpen!==void 0?e.alwaysOpen:!1,this.showSearch=e.showSearch!==void 0?e.showSearch:!0,this.focusSearch=e.focusSearch!==void 0?e.focusSearch:!0,this.ariaLabel=e.ariaLabel||"Combobox",this.searchPlaceholder=e.searchPlaceholder||"Search",this.searchText=e.searchText||"No Results",this.searchingText=e.searchingText||"Searching...",this.searchHighlight=e.searchHighlight!==void 0?e.searchHighlight:!1,this.closeOnSelect=e.closeOnSelect!==void 0?e.closeOnSelect:!0,this.contentLocation=e.contentLocation||document.body,this.contentPosition=e.contentPosition||"absolute",this.openPosition=e.openPosition||"auto",this.contentAriaLabel=e.contentAriaLabel!==void 0?e.contentAriaLabel:"Select an option",this.placeholderText=e.placeholderText!==void 0?e.placeholderText:"Select Value",this.allowDeselect=e.allowDeselect!==void 0?e.allowDeselect:!1,this.hideSelected=e.hideSelected!==void 0?e.hideSelected:!1,this.keepOrder=e.keepOrder!==void 0?e.keepOrder:!1,this.showOptionTooltips=e.showOptionTooltips!==void 0?e.showOptionTooltips:!1,this.minSelected=e.minSelected||0,this.maxSelected=e.maxSelected||1e3,this.timeoutDelay=e.timeoutDelay||200,this.maxValuesShown=e.maxValuesShown||20,this.maxValuesMessage=e.maxValuesMessage||"{number} selected",this.addableText=e.addableText||'Press "Enter" to add {value}',this.ariaLabelledBy=e.ariaLabelledBy||"",this.searchAriaLabel=e.searchAriaLabel||"Search options",this.searchLabelledBy=e.searchLabelledBy||"",this.clearAllAriaLabel=e.clearAllAriaLabel||"Clear selection"}}class Nc{constructor(e){var o;if(this.events={search:void 0,searchFilter:(l,a)=>l.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=Kt(()=>{!this.settings.isOpen&&!this.settings.isFullOpen||this.render.moveContent()}),this.windowScroll=Kt(()=>{!this.settings.isOpen&&!this.settings.isFullOpen||this.render.moveContent()}),this.documentClick=l=>{this.settings.isOpen&&l.target&&!Dc(l.target,this.settings.id)&&this.close(l.type)},this.windowVisibilityChange=()=>{document.hidden&&this.close()},this.selectEl=typeof e.select=="string"?document.querySelector(e.select):e.select,!this.selectEl){e.events&&e.events.error&&e.events.error(new Error("Could not find select element"));return}if(this.selectEl.tagName!=="SELECT"){e.events&&e.events.error&&e.events.error(new Error("Element isnt of type select"));return}this.selectEl.dataset.ssid&&this.destroy(),this.settings=new Mc(e.settings),this.cssClasses=new Rc(e.cssClasses);const s=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const l in e.events)e.events.hasOwnProperty(l)&&(s.indexOf(l)!==-1?this.events[l]=Kt(e.events[l],100):this.events[l]=e.events[l]);this.settings.disabled=(o=e.settings)!=null&&o.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 Ic(this.selectEl),this.select.updateSelect(this.settings.id,this.settings.style,this.settings.class),this.select.hideUI(),this.select.onValueChange=l=>{this.setSelected(l.map(a=>a.id))},this.select.onClassChange=l=>{this.settings.class=l,this.render.updateClassStyles()},this.select.onDisabledChange=l=>{l?this.disable():this.enable()},this.select.onOptionsChange=l=>{this.setData(l)},this.store=new Fc(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 hn(this.settings,this.cssClasses,this.store,n),this.render.renderValues(),this.render.renderOptions(this.store.getData());const i=this.selectEl.getAttribute("aria-label"),r=this.selectEl.getAttribute("aria-labelledby");i?this.render.main.main.setAttribute("aria-label",i):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),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(e){const s=this.store.getSelected(),n=this.store.validateDataArray(e);if(n){this.events.error&&this.events.error(n);return}this.store.setData(e);const i=this.store.getData();this.select.updateOptions(i),this.render.renderValues(),this.render.renderOptions(i),this.events.afterChange&&!qs(s,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let e=this.store.getSelectedOptions();return this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e)),e.map(s=>s.value)}setSelected(e,s=!0){const n=this.store.getSelected(),i=this.store.getDataOptions();e=Array.isArray(e)?e:[e];const r=[];for(const l of e){if(i.find(a=>a.id==l)){r.push(l);continue}for(const a of i.filter(u=>u.value==l))r.push(a.id)}this.store.setSelectedBy("id",r);const o=this.store.getData();this.select.updateOptions(o),this.render.renderValues(),this.render.content.search.input.value!==""?this.search(this.render.content.search.input.value):this.render.renderOptions(o),s&&this.events.afterChange&&!qs(n,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}addOption(e){const s=this.store.getSelected();this.store.getDataOptions().some(i=>i.value===(e.value??e.text))||this.store.addOption(e);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!qs(s,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.settings.focusSearch&&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(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){this.render.renderOptions(e===""?this.store.getData():this.store.search(e,this.events.searchFilter));return}this.render.renderSearching();const s=this.events.search(e,this.store.getSelectedOptions());if(s instanceof Promise){s.then(n=>{this.render.renderOptions(this.store.partialToFullData(n))}).catch(n=>{this.render.renderError(typeof n=="string"?n:n.message)});return}else Array.isArray(s)?this.render.renderOptions(this.store.partialToFullData(s)):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 Bc="CWYDT23U",Hc="slimselectjscom",Vc=Ts({__name:"carbonad",setup(t){const e=ir(null);let s=!1;return mr(()=>{const n=window.location.hostname==="localhost";if(!s&&!n){s=!0;const i=document.createElement("script");i.id="_carbonads_js",i.src=`//cdn.carbonads.com/carbon.js?serve=${Bc}&placement=${Hc}`,i.async=!0,e.value&&e.value.appendChild(i)}}),(n,i)=>wt(s)?(Zt(),Nr("div",{key:0,class:"carbon-container",ref_key:"container",ref:e},null,512)):$o("",!0)}}),Uc=Ts({name:"App",components:{CarbonAd:Vc},data(){return{nav:null,navDebounce:Kt(()=>{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:"Examples",closable:"close",options:[{text:"countries",value:"examples#countries"},{text:"form reset",value:"examples#formReset"}]},{label:"Settings",closable:"close",options:[{text:"select",value:"settings#select"},{text:"cssClasses",value:"settings#cssClasses"},{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"}]}]}},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 t=this.$route.hash;if(t===""&&window.scroll({top:0,behavior:"smooth"}),t){const e=document.querySelector(t);if(e){const s=document.querySelector("header"),n=document.querySelector("nav"),i=s?s.clientHeight+(window.innerWidth<700?n.clientHeight:0)+8:0;window.scroll({top:e.offsetTop-i,behavior:"smooth"})}}},200)}),this.setDemensions(),window.addEventListener("resize",this.navDebounce),window.addEventListener("nav-updated",this.updateNav)},unmounted(){var t;window.removeEventListener("resize",this.navDebounce),window.removeEventListener("nav-updated",this.updateNav),(t=this.nav)==null||t.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 t={searchHighlight:!0,openContent:"below"};this.width>700&&(t.alwaysOpen=!0,t.contentPosition="relative",t.contentLocation=this.$refs.navContent),this.nav=new Nc({select:this.$refs.nav,data:this.navData,settings:t,events:{afterChange:e=>{const n=e[0].value.split("#"),i=n[0],r=n[1]?"#"+n[1]:void 0;this.$router.push({path:i,hash:r})}}})},updateNav(){setTimeout(()=>{this.nav&&this.nav.setSelected(this.$router.currentRoute.value.fullPath.replace("/",""))},0)}}}),$c="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",jc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACAAQMAAAD58POIAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZQTFRFyzg3////IltC9QAAAAFiS0dEAf8CLd4AAAAJcEhZcwAACxMAAAsTAQCanBgAAAAkSURBVEjHY2AYBYMV/IeDUQG4AJgeFRgVGBUYFSBNYBQMPgAARjtdvxo6xaMAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTEtMDUtMzBUMjM6MTA6NDQtMDc6MDCm4GvfAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDEwLTEyLTA2VDEyOjIwOjEyLTA4OjAwpIGEmQAAADJ0RVh0UE5HOmNIUk0AY2h1bmsgd2FzIGZvdW5kIChzZWUgQ2hyb21hdGljaXR5LCBhYm92ZSkH0UjaAAAAKXRFWHRQTkc6Z0FNQQBnYW1tYT0wLjQ1NDU1IChTZWUgR2FtbWEsIGFib3ZlKRISLKcAAAAUdEVYdFBORzpJSERSLmJpdF9kZXB0aAA4KYV+UAAAABV0RVh0UE5HOklIRFIuY29sb3JfdHlwZQA2BkqnKwAAABt0RVh0UE5HOklIRFIuaW50ZXJsYWNlX21ldGhvZAAw+zsHjAAAABx0RVh0UE5HOklIRFIud2lkdGgsaGVpZ2h0ADE2LCAxNjjVBg0AAAAodEVYdFBORzpwSFlzAHhfcmVzPTI4MzUsIHlfcmVzPTI4MzUsIHVuaXRzPTGCKXI+AAAAKHRFWHRQTkc6c1JHQgBpbnRlbnQ9MCAoU2VlIFJlbmRlcmluZyBpbnRlbnQp8hEU9QAAAABJRU5ErkJggg==",zc=(t,e)=>{const s=t.__vccOpts||t;for(const[n,i]of e)s[n]=i;return s},Wc={ref:"nav"},Gc={class:"nav-content",ref:"navContent"};function qc(t,e,s,n,i,r){const o=$n("CarbonAd"),l=$n("router-view");return Zt(),Nr(Re,null,[e[4]||(e[4]=Uo('

Slim Select 2.0

Advanced select dropdown
',1)),Ze("nav",null,[Ze("select",Wc,null,512),Ze("div",Gc,null,512),de(o)]),Ze("main",null,[de(l),Ze("footer",null,[ds(" © "+Vi(t.year)+" ",1),e[0]||(e[0]=Ze("a",{href:"http://webiswhatido.com",style:{color:"#ffffff"},target:"_blank"},"Brian Voelker",-1)),e[1]||(e[1]=ds(". ")),e[2]||(e[2]=Ze("br",null,null,-1)),e[3]||(e[3]=ds(" Slim Select is under the MIT license. "))])])],64)}const Kc=zc(Uc,[["render",qc]]);var Ri=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function sl(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ks={exports:{}},Di;function Yc(){return Di||(Di=1,function(t){var e=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};/** + */const Ct=typeof document<"u";function jr(t){return typeof t=="object"||"displayName"in t||"props"in t||"__vccOpts"in t}function Oa(t){return t.__esModule||t[Symbol.toStringTag]==="Module"||t.default&&jr(t.default)}const J=Object.assign;function zs(t,e){const s={};for(const n in e){const i=e[n];s[n]=He(i)?i.map(t):t(i)}return s}const Gt=()=>{},He=Array.isArray,zr=/#/g,La=/&/g,Ta=/\//g,Pa=/=/g,Ra=/\?/g,Wr=/\+/g,Da=/%5B/g,ka=/%5D/g,Gr=/%5E/g,Ia=/%60/g,qr=/%7B/g,Fa=/%7C/g,Kr=/%7D/g,Ma=/%20/g;function Dn(t){return encodeURI(""+t).replace(Fa,"|").replace(Da,"[").replace(ka,"]")}function Na(t){return Dn(t).replace(qr,"{").replace(Kr,"}").replace(Gr,"^")}function cn(t){return Dn(t).replace(Wr,"%2B").replace(Ma,"+").replace(zr,"%23").replace(La,"%26").replace(Ia,"`").replace(qr,"{").replace(Kr,"}").replace(Gr,"^")}function Ba(t){return cn(t).replace(Pa,"%3D")}function Ha(t){return Dn(t).replace(zr,"%23").replace(Ra,"%3F")}function Va(t){return t==null?"":Ha(t).replace(Ta,"%2F")}function ss(t){try{return decodeURIComponent(""+t)}catch{}return""+t}const Ua=/\/$/,$a=t=>t.replace(Ua,"");function Ws(t,e,s="/"){let n,i={},r="",o="";const l=e.indexOf("#");let a=e.indexOf("?");return l=0&&(a=-1),a>-1&&(n=e.slice(0,a),r=e.slice(a+1,l>-1?l:e.length),i=t(r)),l>-1&&(n=n||e.slice(0,l),o=e.slice(l,e.length)),n=Ga(n??e,s),{fullPath:n+(r&&"?")+r+o,path:n,query:i,hash:ss(o)}}function ja(t,e){const s=e.query?t(e.query):"";return e.path+(s&&"?")+s+(e.hash||"")}function pi(t,e){return!e||!t.toLowerCase().startsWith(e.toLowerCase())?t:t.slice(e.length)||"/"}function za(t,e,s){const n=e.matched.length-1,i=s.matched.length-1;return n>-1&&n===i&&kt(e.matched[n],s.matched[i])&&Yr(e.params,s.params)&&t(e.query)===t(s.query)&&e.hash===s.hash}function kt(t,e){return(t.aliasOf||t)===(e.aliasOf||e)}function Yr(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(!Wa(t[s],e[s]))return!1;return!0}function Wa(t,e){return He(t)?gi(t,e):He(e)?gi(e,t):t===e}function gi(t,e){return He(e)?t.length===e.length&&t.every((s,n)=>s===e[n]):t.length===1&&t[0]===e}function Ga(t,e){if(t.startsWith("/"))return t;if(!t)return e;const s=e.split("/"),n=t.split("/"),i=n[n.length-1];(i===".."||i===".")&&n.push("");let r=s.length-1,o,l;for(o=0;o1&&r--;else break;return s.slice(0,r).join("/")+"/"+n.slice(o).join("/")}const ut={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};var ns;(function(t){t.pop="pop",t.push="push"})(ns||(ns={}));var qt;(function(t){t.back="back",t.forward="forward",t.unknown=""})(qt||(qt={}));function qa(t){if(!t)if(Ct){const e=document.querySelector("base");t=e&&e.getAttribute("href")||"/",t=t.replace(/^\w+:\/\/[^\/]+/,"")}else t="/";return t[0]!=="/"&&t[0]!=="#"&&(t="/"+t),$a(t)}const Ka=/^[^#]+#/;function Ya(t,e){return t.replace(Ka,"#")+e}function Qa(t,e){const s=document.documentElement.getBoundingClientRect(),n=t.getBoundingClientRect();return{behavior:e.behavior,left:n.left-s.left-(e.left||0),top:n.top-s.top-(e.top||0)}}const ks=()=>({left:window.scrollX,top:window.scrollY});function Ja(t){let e;if("el"in t){const s=t.el,n=typeof s=="string"&&s.startsWith("#"),i=typeof s=="string"?n?document.getElementById(s.slice(1)):document.querySelector(s):s;if(!i)return;e=Qa(i,t)}else e=t;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.scrollX,e.top!=null?e.top:window.scrollY)}function mi(t,e){return(history.state?history.state.position-e:-1)+t}const un=new Map;function Za(t,e){un.set(t,e)}function Xa(t){const e=un.get(t);return un.delete(t),e}let ec=()=>location.protocol+"//"+location.host;function Qr(t,e){const{pathname:s,search:n,hash:i}=e,r=t.indexOf("#");if(r>-1){let l=i.includes(t.slice(r))?t.slice(r).length:1,a=i.slice(l);return a[0]!=="/"&&(a="/"+a),pi(a,"")}return pi(s,t)+n+i}function tc(t,e,s,n){let i=[],r=[],o=null;const l=({state:p})=>{const g=Qr(t,location),_=s.value,C=e.value;let D=0;if(p){if(s.value=g,e.value=p,o&&o===_){o=null;return}D=C?p.position-C.position:0}else n(g);i.forEach(T=>{T(s.value,_,{delta:D,type:ns.pop,direction:D?D>0?qt.forward:qt.back:qt.unknown})})};function a(){o=s.value}function u(p){i.push(p);const g=()=>{const _=i.indexOf(p);_>-1&&i.splice(_,1)};return r.push(g),g}function c(){const{history:p}=window;p.state&&p.replaceState(J({},p.state,{scroll:ks()}),"")}function f(){for(const p of r)p();r=[],window.removeEventListener("popstate",l),window.removeEventListener("beforeunload",c)}return window.addEventListener("popstate",l),window.addEventListener("beforeunload",c,{passive:!0}),{pauseListeners:a,listen:u,destroy:f}}function vi(t,e,s,n=!1,i=!1){return{back:t,current:e,forward:s,replaced:n,position:window.history.length,scroll:i?ks():null}}function sc(t){const{history:e,location:s}=window,n={value:Qr(t,s)},i={value:e.state};i.value||r(n.value,{back:null,current:n.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function r(a,u,c){const f=t.indexOf("#"),p=f>-1?(s.host&&document.querySelector("base")?t:t.slice(f))+a:ec()+t+a;try{e[c?"replaceState":"pushState"](u,"",p),i.value=u}catch(g){console.error(g),s[c?"replace":"assign"](p)}}function o(a,u){const c=J({},e.state,vi(i.value.back,a,i.value.forward,!0),u,{position:i.value.position});r(a,c,!0),n.value=a}function l(a,u){const c=J({},i.value,e.state,{forward:a,scroll:ks()});r(c.current,c,!0);const f=J({},vi(n.value,a,null),{position:c.position+1},u);r(a,f,!1),n.value=a}return{location:n,state:i,push:l,replace:o}}function nc(t){t=qa(t);const e=sc(t),s=tc(t,e.state,e.location,e.replace);function n(r,o=!0){o||s.pauseListeners(),history.go(r)}const i=J({location:"",base:t,go:n,createHref:Ya.bind(null,t)},e,s);return Object.defineProperty(i,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(i,"state",{enumerable:!0,get:()=>e.state.value}),i}function ic(t){return typeof t=="string"||t&&typeof t=="object"}function Jr(t){return typeof t=="string"||typeof t=="symbol"}const Zr=Symbol("");var bi;(function(t){t[t.aborted=4]="aborted",t[t.cancelled=8]="cancelled",t[t.duplicated=16]="duplicated"})(bi||(bi={}));function It(t,e){return J(new Error,{type:t,[Zr]:!0},e)}function Je(t,e){return t instanceof Error&&Zr in t&&(e==null||!!(t.type&e))}const yi="[^/]+?",rc={sensitive:!1,strict:!1,start:!0,end:!0},lc=/[.+*?^${}()[\]/\\]/g;function oc(t,e){const s=J({},rc,e),n=[];let i=s.start?"^":"";const r=[];for(const u of t){const c=u.length?[]:[90];s.strict&&!u.length&&(i+="/");for(let f=0;fe.length?e.length===1&&e[0]===80?1:-1:0}function Xr(t,e){let s=0;const n=t.score,i=e.score;for(;s0&&e[e.length-1]<0}const cc={type:0,value:""},uc=/[a-zA-Z0-9_]/;function fc(t){if(!t)return[[]];if(t==="/")return[[cc]];if(!t.startsWith("/"))throw new Error(`Invalid path "${t}"`);function e(g){throw new Error(`ERR (${s})/"${u}": ${g}`)}let s=0,n=s;const i=[];let r;function o(){r&&i.push(r),r=[]}let l=0,a,u="",c="";function f(){u&&(s===0?r.push({type:0,value:u}):s===1||s===2||s===3?(r.length>1&&(a==="*"||a==="+")&&e(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),r.push({type:1,value:u,regexp:c,repeatable:a==="*"||a==="+",optional:a==="*"||a==="?"})):e("Invalid state to consume buffer"),u="")}function p(){u+=a}for(;l{o(b)}:Gt}function o(f){if(Jr(f)){const p=n.get(f);p&&(n.delete(f),s.splice(s.indexOf(p),1),p.children.forEach(o),p.alias.forEach(o))}else{const p=s.indexOf(f);p>-1&&(s.splice(p,1),f.record.name&&n.delete(f.record.name),f.children.forEach(o),f.alias.forEach(o))}}function l(){return s}function a(f){const p=mc(f,s);s.splice(p,0,f),f.record.name&&!Si(f)&&n.set(f.record.name,f)}function u(f,p){let g,_={},C,D;if("name"in f&&f.name){if(g=n.get(f.name),!g)throw It(1,{location:f});D=g.record.name,_=J(wi(p.params,g.keys.filter(b=>!b.optional).concat(g.parent?g.parent.keys.filter(b=>b.optional):[]).map(b=>b.name)),f.params&&wi(f.params,g.keys.map(b=>b.name))),C=g.stringify(_)}else if(f.path!=null)C=f.path,g=s.find(b=>b.re.test(C)),g&&(_=g.parse(C),D=g.record.name);else{if(g=p.name?n.get(p.name):s.find(b=>b.re.test(p.path)),!g)throw It(1,{location:f,currentLocation:p});D=g.record.name,_=J({},p.params,f.params),C=g.stringify(_)}const T=[];let m=g;for(;m;)T.unshift(m.record),m=m.parent;return{name:D,path:C,params:_,matched:T,meta:gc(T)}}t.forEach(f=>r(f));function c(){s.length=0,n.clear()}return{addRoute:r,resolve:u,removeRoute:o,clearRoutes:c,getRoutes:l,getRecordMatcher:i}}function wi(t,e){const s={};for(const n of e)n in t&&(s[n]=t[n]);return s}function xi(t){const e={path:t.path,redirect:t.redirect,name:t.name,meta:t.meta||{},aliasOf:t.aliasOf,beforeEnter:t.beforeEnter,props:pc(t),children:t.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in t?t.components||null:t.component&&{default:t.component}};return Object.defineProperty(e,"mods",{value:{}}),e}function pc(t){const e={},s=t.props||!1;if("component"in t)e.default=s;else for(const n in t.components)e[n]=typeof s=="object"?s[n]:s;return e}function Si(t){for(;t;){if(t.record.aliasOf)return!0;t=t.parent}return!1}function gc(t){return t.reduce((e,s)=>J(e,s.meta),{})}function Ei(t,e){const s={};for(const n in t)s[n]=n in e?e[n]:t[n];return s}function mc(t,e){let s=0,n=e.length;for(;s!==n;){const r=s+n>>1;Xr(t,e[r])<0?n=r:s=r+1}const i=vc(t);return i&&(n=e.lastIndexOf(i,n-1)),n}function vc(t){let e=t;for(;e=e.parent;)if(el(e)&&Xr(t,e)===0)return e}function el({record:t}){return!!(t.name||t.components&&Object.keys(t.components).length||t.redirect)}function bc(t){const e={};if(t===""||t==="?")return e;const n=(t[0]==="?"?t.slice(1):t).split("&");for(let i=0;ir&&cn(r)):[n&&cn(n)]).forEach(r=>{r!==void 0&&(e+=(e.length?"&":"")+s,r!=null&&(e+="="+r))})}return e}function yc(t){const e={};for(const s in t){const n=t[s];n!==void 0&&(e[s]=He(n)?n.map(i=>i==null?null:""+i):n==null?n:""+n)}return e}const Ac=Symbol(""),_i=Symbol(""),kn=Symbol(""),tl=Symbol(""),fn=Symbol("");function Bt(){let t=[];function e(n){return t.push(n),()=>{const i=t.indexOf(n);i>-1&&t.splice(i,1)}}function s(){t=[]}return{add:e,list:()=>t.slice(),reset:s}}function dt(t,e,s,n,i,r=o=>o()){const o=n&&(n.enterCallbacks[i]=n.enterCallbacks[i]||[]);return()=>new Promise((l,a)=>{const u=p=>{p===!1?a(It(4,{from:s,to:e})):p instanceof Error?a(p):ic(p)?a(It(2,{from:e,to:p})):(o&&n.enterCallbacks[i]===o&&typeof p=="function"&&o.push(p),l())},c=r(()=>t.call(n&&n.instances[i],e,s,u));let f=Promise.resolve(c);t.length<3&&(f=f.then(u)),f.catch(p=>a(p))})}function Gs(t,e,s,n,i=r=>r()){const r=[];for(const o of t)for(const l in o.components){let a=o.components[l];if(!(e!=="beforeRouteEnter"&&!o.instances[l]))if(jr(a)){const c=(a.__vccOpts||a)[e];c&&r.push(dt(c,s,n,o,l,i))}else{let u=a();r.push(()=>u.then(c=>{if(!c)throw new Error(`Couldn't resolve component "${l}" at "${o.path}"`);const f=Oa(c)?c.default:c;o.mods[l]=c,o.components[l]=f;const g=(f.__vccOpts||f)[e];return g&&dt(g,s,n,o,l,i)()}))}}return r}function Oi(t){const e=tt(kn),s=tt(tl),n=Ne(()=>{const a=wt(t.to);return e.resolve(a)}),i=Ne(()=>{const{matched:a}=n.value,{length:u}=a,c=a[u-1],f=s.matched;if(!c||!f.length)return-1;const p=f.findIndex(kt.bind(null,c));if(p>-1)return p;const g=Li(a[u-2]);return u>1&&Li(c)===g&&f[f.length-1].path!==g?f.findIndex(kt.bind(null,a[u-2])):p}),r=Ne(()=>i.value>-1&&Cc(s.params,n.value.params)),o=Ne(()=>i.value>-1&&i.value===s.matched.length-1&&Yr(s.params,n.value.params));function l(a={}){if(Ec(a)){const u=e[wt(t.replace)?"replace":"push"](wt(t.to)).catch(Gt);return t.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>u),u}return Promise.resolve()}return{route:n,href:Ne(()=>n.value.href),isActive:r,isExactActive:o,navigate:l}}function wc(t){return t.length===1?t[0]:t}const xc=Ts({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"},viewTransition:Boolean},useLink:Oi,setup(t,{slots:e}){const s=Os(Oi(t)),{options:n}=tt(kn),i=Ne(()=>({[Ti(t.activeClass,n.linkActiveClass,"router-link-active")]:s.isActive,[Ti(t.exactActiveClass,n.linkExactActiveClass,"router-link-exact-active")]:s.isExactActive}));return()=>{const r=e.default&&wc(e.default(s));return t.custom?r:Ur("a",{"aria-current":s.isExactActive?t.ariaCurrentValue:null,href:s.href,onClick:s.navigate,class:i.value},r)}}}),Sc=xc;function Ec(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&!(t.button!==void 0&&t.button!==0)){if(t.currentTarget&&t.currentTarget.getAttribute){const e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function Cc(t,e){for(const s in e){const n=e[s],i=t[s];if(typeof n=="string"){if(n!==i)return!1}else if(!He(i)||i.length!==n.length||n.some((r,o)=>r!==i[o]))return!1}return!0}function Li(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const Ti=(t,e,s)=>t??e??s,_c=Ts({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(t,{attrs:e,slots:s}){const n=tt(fn),i=Ne(()=>t.route||n.value),r=tt(_i,0),o=Ne(()=>{let u=wt(r);const{matched:c}=i.value;let f;for(;(f=c[u])&&!f.components;)u++;return u}),l=Ne(()=>i.value.matched[o.value]);cs(_i,Ne(()=>o.value+1)),cs(Ac,l),cs(fn,i);const a=ir();return us(()=>[a.value,l.value,t.name],([u,c,f],[p,g,_])=>{c&&(c.instances[f]=u,g&&g!==c&&u&&u===p&&(c.leaveGuards.size||(c.leaveGuards=g.leaveGuards),c.updateGuards.size||(c.updateGuards=g.updateGuards))),u&&c&&(!g||!kt(c,g)||!p)&&(c.enterCallbacks[f]||[]).forEach(C=>C(u))},{flush:"post"}),()=>{const u=i.value,c=t.name,f=l.value,p=f&&f.components[c];if(!p)return Pi(s.default,{Component:p,route:u});const g=f.props[c],_=g?g===!0?u.params:typeof g=="function"?g(u):g:null,D=Ur(p,J({},_,e,{onVnodeUnmounted:T=>{T.component.isUnmounted&&(f.instances[c]=null)},ref:a}));return Pi(s.default,{Component:D,route:u})||D}}});function Pi(t,e){if(!t)return null;const s=t(e);return s.length===1?s[0]:s}const Oc=_c;function Lc(t){const e=dc(t.routes,t),s=t.parseQuery||bc,n=t.stringifyQuery||Ci,i=t.history,r=Bt(),o=Bt(),l=Bt(),a=Ml(ut);let u=ut;Ct&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=zs.bind(null,A=>""+A),f=zs.bind(null,Va),p=zs.bind(null,ss);function g(A,N){let k,B;return Jr(A)?(k=e.getRecordMatcher(A),B=N):B=A,e.addRoute(B,k)}function _(A){const N=e.getRecordMatcher(A);N&&e.removeRoute(N)}function C(){return e.getRoutes().map(A=>A.record)}function D(A){return!!e.getRecordMatcher(A)}function T(A,N){if(N=J({},N||a.value),typeof A=="string"){const v=Ws(s,A,N.path),w=e.resolve({path:v.path},N),E=i.createHref(v.fullPath);return J(v,w,{params:p(w.params),hash:ss(v.hash),redirectedFrom:void 0,href:E})}let k;if(A.path!=null)k=J({},A,{path:Ws(s,A.path,N.path).path});else{const v=J({},A.params);for(const w in v)v[w]==null&&delete v[w];k=J({},A,{params:f(v)}),N.params=f(N.params)}const B=e.resolve(k,N),Y=A.hash||"";B.params=c(p(B.params));const h=ja(n,J({},A,{hash:Na(Y),path:B.path})),d=i.createHref(h);return J({fullPath:h,hash:Y,query:n===Ci?yc(A.query):A.query||{}},B,{redirectedFrom:void 0,href:d})}function m(A){return typeof A=="string"?Ws(s,A,a.value.path):J({},A)}function b(A,N){if(u!==A)return It(8,{from:N,to:A})}function y(A){return I(A)}function S(A){return y(J(m(A),{replace:!0}))}function O(A){const N=A.matched[A.matched.length-1];if(N&&N.redirect){const{redirect:k}=N;let B=typeof k=="function"?k(A):k;return typeof B=="string"&&(B=B.includes("?")||B.includes("#")?B=m(B):{path:B},B.params={}),J({query:A.query,hash:A.hash,params:B.path!=null?{}:A.params},B)}}function I(A,N){const k=u=T(A),B=a.value,Y=A.state,h=A.force,d=A.replace===!0,v=O(k);if(v)return I(J(m(v),{state:typeof v=="object"?J({},Y,v.state):Y,force:h,replace:d}),N||k);const w=k;w.redirectedFrom=N;let E;return!h&&za(n,B,k)&&(E=It(16,{to:w,from:B}),Ae(B,B,!0,!1)),(E?Promise.resolve(E):K(w,B)).catch(x=>Je(x)?Je(x,2)?x:ye(x):$(x,w,B)).then(x=>{if(x){if(Je(x,2))return I(J({replace:d},m(x.to),{state:typeof x.to=="object"?J({},Y,x.to.state):Y,force:h}),N||w)}else x=pe(w,B,!0,d,Y);return re(w,B,x),x})}function W(A,N){const k=b(A,N);return k?Promise.reject(k):Promise.resolve()}function H(A){const N=we.values().next().value;return N&&typeof N.runWithContext=="function"?N.runWithContext(A):A()}function K(A,N){let k;const[B,Y,h]=Tc(A,N);k=Gs(B.reverse(),"beforeRouteLeave",A,N);for(const v of B)v.leaveGuards.forEach(w=>{k.push(dt(w,A,N))});const d=W.bind(null,A,N);return k.push(d),fe(k).then(()=>{k=[];for(const v of r.list())k.push(dt(v,A,N));return k.push(d),fe(k)}).then(()=>{k=Gs(Y,"beforeRouteUpdate",A,N);for(const v of Y)v.updateGuards.forEach(w=>{k.push(dt(w,A,N))});return k.push(d),fe(k)}).then(()=>{k=[];for(const v of h)if(v.beforeEnter)if(He(v.beforeEnter))for(const w of v.beforeEnter)k.push(dt(w,A,N));else k.push(dt(v.beforeEnter,A,N));return k.push(d),fe(k)}).then(()=>(A.matched.forEach(v=>v.enterCallbacks={}),k=Gs(h,"beforeRouteEnter",A,N,H),k.push(d),fe(k))).then(()=>{k=[];for(const v of o.list())k.push(dt(v,A,N));return k.push(d),fe(k)}).catch(v=>Je(v,8)?v:Promise.reject(v))}function re(A,N,k){l.list().forEach(B=>H(()=>B(A,N,k)))}function pe(A,N,k,B,Y){const h=b(A,N);if(h)return h;const d=N===ut,v=Ct?history.state:{};k&&(B||d?i.replace(A.fullPath,J({scroll:d&&v&&v.scroll},Y)):i.push(A.fullPath,Y)),a.value=A,Ae(A,N,k,d),ye()}let Le;function ot(){Le||(Le=i.listen((A,N,k)=>{if(!Ve.listening)return;const B=T(A),Y=O(B);if(Y){I(J(Y,{replace:!0,force:!0}),B).catch(Gt);return}u=B;const h=a.value;Ct&&Za(mi(h.fullPath,k.delta),ks()),K(B,h).catch(d=>Je(d,12)?d:Je(d,2)?(I(J(m(d.to),{force:!0}),B).then(v=>{Je(v,20)&&!k.delta&&k.type===ns.pop&&i.go(-1,!1)}).catch(Gt),Promise.reject()):(k.delta&&i.go(-k.delta,!1),$(d,B,h))).then(d=>{d=d||pe(B,h,!1),d&&(k.delta&&!Je(d,8)?i.go(-k.delta,!1):k.type===ns.pop&&Je(d,20)&&i.go(-1,!1)),re(B,h,d)}).catch(Gt)}))}let at=Bt(),oe=Bt(),Q;function $(A,N,k){ye(A);const B=oe.list();return B.length?B.forEach(Y=>Y(A,N,k)):console.error(A),Promise.reject(A)}function ae(){return Q&&a.value!==ut?Promise.resolve():new Promise((A,N)=>{at.add([A,N])})}function ye(A){return Q||(Q=!A,ot(),at.list().forEach(([N,k])=>A?k(A):N()),at.reset()),A}function Ae(A,N,k,B){const{scrollBehavior:Y}=t;if(!Ct||!Y)return Promise.resolve();const h=!k&&Xa(mi(A.fullPath,0))||(B||!k)&&history.state&&history.state.scroll||null;return ar().then(()=>Y(A,N,h)).then(d=>d&&Ja(d)).catch(d=>$(d,A,N))}const te=A=>i.go(A);let ct;const we=new Set,Ve={currentRoute:a,listening:!0,addRoute:g,removeRoute:_,clearRoutes:e.clearRoutes,hasRoute:D,getRoutes:C,resolve:T,options:t,push:y,replace:S,go:te,back:()=>te(-1),forward:()=>te(1),beforeEach:r.add,beforeResolve:o.add,afterEach:l.add,onError:oe.add,isReady:ae,install(A){const N=this;A.component("RouterLink",Sc),A.component("RouterView",Oc),A.config.globalProperties.$router=N,Object.defineProperty(A.config.globalProperties,"$route",{enumerable:!0,get:()=>wt(a)}),Ct&&!ct&&a.value===ut&&(ct=!0,y(i.location).catch(Y=>{}));const k={};for(const Y in ut)Object.defineProperty(k,Y,{get:()=>a.value[Y],enumerable:!0});A.provide(kn,N),A.provide(tl,sr(k)),A.provide(fn,a);const B=A.unmount;we.add(A),A.unmount=function(){we.delete(A),we.size<1&&(u=ut,Le&&Le(),Le=null,a.value=ut,ct=!1,Q=!1),B()}}};function fe(A){return A.reduce((N,k)=>N.then(()=>H(k)),Promise.resolve())}return Ve}function Tc(t,e){const s=[],n=[],i=[],r=Math.max(e.matched.length,t.matched.length);for(let o=0;okt(u,l))?n.push(l):s.push(l));const a=t.matched[o];a&&(e.matched.find(u=>kt(u,a))||i.push(a))}return[s,n,i]}const Pc=Lc({history:nc(),linkActiveClass:"active",routes:[{path:"/",name:"Home",component:()=>Qe(()=>import("./home.js"),__vite__mapDeps([0,1]))},{path:"/install",name:"Install",component:()=>Qe(()=>import("./install.js"),[])},{path:"/selects",name:"Selects",component:()=>Qe(()=>import("./selects.js"),[])},{path:"/data",name:"Data",component:()=>Qe(()=>import("./data.js"),[])},{path:"/examples",name:"Examples",component:()=>Qe(()=>import("./index2.js"),__vite__mapDeps([2,3]))},{path:"/settings",name:"Settings",component:()=>Qe(()=>import("./index3.js"),__vite__mapDeps([4,5]))},{path:"/events",name:"Events",component:()=>Qe(()=>import("./index4.js"),[])},{path:"/methods",name:"Methods",component:()=>Qe(()=>import("./index5.js"),[])},{path:"/vue",name:"Vue",component:()=>Qe(()=>import("./vue.js"),[])}]});class Rc{constructor(e){e||(e={}),this.main=e.main||"ss-main",this.placeholder=e.placeholder||"ss-placeholder",this.values=e.values||"ss-values",this.single=e.single||"ss-single",this.max=e.max||"ss-max",this.value=e.value||"ss-value",this.valueText=e.valueText||"ss-value-text",this.valueDelete=e.valueDelete||"ss-value-delete",this.valueOut=e.valueOut||"ss-value-out",this.deselect=e.deselect||"ss-deselect",this.deselectPath=e.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=e.arrow||"ss-arrow",this.arrowClose=e.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=e.arrowOpen||"M10,70 L50,30 L90,70",this.content=e.content||"ss-content",this.openAbove=e.openAbove||"ss-open-above",this.openBelow=e.openBelow||"ss-open-below",this.search=e.search||"ss-search",this.searchHighlighter=e.searchHighlighter||"ss-search-highlight",this.searching=e.searching||"ss-searching",this.addable=e.addable||"ss-addable",this.addablePath=e.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=e.list||"ss-list",this.optgroup=e.optgroup||"ss-optgroup",this.optgroupLabel=e.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=e.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=e.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=e.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=e.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=e.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=e.optgroupClosable||"ss-closable",this.option=e.option||"ss-option",this.optionDelete=e.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=e.highlighted||"ss-highlighted",this.open=e.open||"ss-open",this.close=e.close||"ss-close",this.selected=e.selected||"ss-selected",this.error=e.error||"ss-error",this.disabled=e.disabled||"ss-disabled",this.hide=e.hide||"ss-hide"}}function In(){return Math.random().toString(36).substring(2,10)}function Dc(t,e){function s(i,r){return r&&i&&i.classList&&i.classList.contains(r)||r&&i&&i.dataset&&i.dataset.id&&i.dataset.id===e?i:null}function n(i,r){return!i||i===document?null:s(i,r)?i:n(i.parentNode,r)}return s(t,e)||n(t,e)}function Kt(t,e=50,s=!1){let n;return function(...i){const r=self,o=()=>{n=null,s||t.apply(r,i)},l=s&&!n;clearTimeout(n),n=setTimeout(o,e),l&&t.apply(r,i)}}function qs(t,e){return JSON.stringify(t)===JSON.stringify(e)}function kc(t){const e=t.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,s=>"-"+s.toLowerCase());return t[0]===t[0].toUpperCase()?e.substring(1):e}class Me{constructor(e){if(this.id=!e.id||e.id===""?In():e.id,this.label=e.label||"",this.selectAll=e.selectAll===void 0?!1:e.selectAll,this.selectAllText=e.selectAllText||"Select All",this.closable=e.closable||"off",this.options=[],e.options)for(const s of e.options)this.options.push(new ue(s))}}class ue{constructor(e){this.id=!e.id||e.id===""?In():e.id,this.value=e.value===void 0?e.text:e.value,this.text=e.text||"",this.html=e.html||"",this.defaultSelected=e.defaultSelected!==void 0?e.defaultSelected:!1,this.selected=e.selected!==void 0?e.selected:!1,this.display=e.display!==void 0?e.display:!0,this.disabled=e.disabled!==void 0?e.disabled:!1,this.mandatory=e.mandatory!==void 0?e.mandatory:!1,this.placeholder=e.placeholder!==void 0?e.placeholder:!1,this.class=e.class||"",this.style=e.style||"",this.data=e.data||{}}}class Ic{constructor(e,s){this.selectType="single",this.data=[],this.selectedOrder=[],this.selectType=e,this.setData(s)}validateDataArray(e){if(!Array.isArray(e))return new Error("Data must be an array");for(let s of e)if(s instanceof Me||"label"in s){if(!("label"in s))return new Error("Optgroup must have a label");if("options"in s&&s.options)for(let n of s.options){const i=this.validateOption(n);if(i)return i}}else if(s instanceof ue||"text"in s){const n=this.validateOption(s);if(n)return n}else return new Error("Data object must be a valid optgroup or option");return null}validateOption(e){return"text"in e?null:new Error("Option must have a text")}partialToFullData(e){let s=[];return e.forEach(n=>{if(n instanceof Me||"label"in n){let i=[];"options"in n&&n.options&&n.options.forEach(r=>{i.push(new ue(r))}),i.length>0&&s.push(new Me(n))}(n instanceof ue||"text"in n)&&s.push(new ue(n))}),s}setData(e){this.data=this.partialToFullData(e),this.selectType==="single"&&this.setSelectedBy("id",this.getSelected())}getData(){return this.filter(null,!0)}getDataOptions(){return this.filter(null,!1)}addOption(e,s=!1){if(s){let n=[new ue(e)];this.setData(n.concat(this.getData()))}else this.setData(this.getData().concat(new ue(e)))}setSelectedBy(e,s){let n=null,i=!1;const r=[];for(let l of this.data){if(l instanceof Me)for(let a of l.options)n||(n=a),a.selected=i?!1:s.includes(a[e]),a.selected&&(r.push(a),this.selectType==="single"&&(i=!0));l instanceof ue&&(n||(n=l),l.selected=i?!1:s.includes(l[e]),l.selected&&(r.push(l),this.selectType==="single"&&(i=!0)))}this.selectType==="single"&&n&&!i&&(n.selected=!0,r.push(n));const o=s.map(l=>{var a;return((a=r.find(u=>u[e]===l))==null?void 0:a.id)||""});this.selectedOrder=o}getSelected(){return this.getSelectedOptions().map(e=>e.id)}getSelectedValues(){return this.getSelectedOptions().map(e=>e.value)}getSelectedOptions(){return this.filter(e=>e.selected,!1)}getOptgroupByID(e){for(let s of this.data)if(s instanceof Me&&s.id===e)return s;return null}getOptionByID(e){let s=this.filter(n=>n.id===e,!1);return s.length?s[0]:null}getSelectType(){return this.selectType}getFirstOption(){let e=null;for(let s of this.data)if(s instanceof Me?e=s.options[0]:s instanceof ue&&(e=s),e)break;return e}search(e,s){return e=e.trim(),e===""?this.getData():this.filter(n=>s(n,e),!0)}filter(e,s){const n=[];return this.data.forEach(i=>{if(i instanceof Me){let r=[];if(i.options.forEach(o=>{(!e||e(o))&&(s?r.push(new ue(o)):n.push(new ue(o)))}),r.length>0){let o=new Me(i);o.options=r,n.push(o)}}i instanceof ue&&(!e||e(i))&&n.push(new ue(i))}),n}selectedOrderOptions(e){const s=[];return this.selectedOrder.forEach(n=>{const i=e.find(r=>r.id===n);i&&s.push(i)}),e.forEach(n=>{let i=!1;s.forEach(r=>{if(n.id===r.id){i=!0;return}}),i||s.push(n)}),s}}const ke=class ke{static getLiveAssertive(){let e=document.getElementById("ss-live-assertive");return e||(e=document.createElement("div"),e.id="ss-live-assertive",e.setAttribute("role","status"),e.setAttribute("aria-live","assertive"),e.setAttribute("aria-atomic","true"),e.className="ss-sr-only",document.body.appendChild(e)),e}_announceAssertive(e){const s=ke._liveAssertive||(ke._liveAssertive=ke.getLiveAssertive());s.textContent="",requestAnimationFrame(()=>{s.textContent=e})}constructor(e,s,n,i){var o;this.store=n,this.settings=e,this.classes=s,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes();const r=(o=document.querySelector(`[data-id="${this.settings.id}"]`))==null?void 0:o.closest(".offcanvas-body");r?r.appendChild(this.content.main):this.settings.contentLocation&&this.settings.contentLocation.appendChild(this.content.main)}static getLivePolite(){let e=document.getElementById("ss-live-polite");return e||(e=document.createElement("div"),e.id="ss-live-polite",e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),e.className="ss-sr-only",document.body.appendChild(e)),e}_announcePolite(e){const s=ke._livePolite||(ke._livePolite=ke.getLivePolite());s.textContent="",requestAnimationFrame(()=>{s.textContent=e})}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 e=this.store.getSelectedOptions();if(e.length){const s=e[e.length-1].id,n=this.content.list.querySelector('[data-id="'+s+'"]');n&&this.ensureElementInView(this.content.list,n)}this.settings.contentPosition==="fixed"&&(this.moveContent(),this.scrollHandler=()=>this.moveContent(),this.resizeHandler=()=>this.moveContent(),window.addEventListener("scroll",this.scrollHandler,!0),window.addEventListener("resize",this.resizeHandler)),this.searchFocus()}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),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=void 0),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=void 0),this.main.main.focus({preventScroll:!0}),this.main.main.removeAttribute("aria-activedescendant")}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.main.main.classList.add("ss-2"),this.content.main.classList.add(this.classes.content),this.content.main.classList.add("ss-content-2"),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()));(this.settings.contentPosition==="relative"||this.settings.contentPosition==="fixed")&&this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){var n;this.content.list.setAttribute("role","listbox"),this.content.list.setAttribute("id",this.content.main.id+"-list"),this.content.list.setAttribute("aria-label",this.settings.contentAriaLabel),this.settings.isMultiple&&this.content.list.setAttribute("aria-multiselectable","true"),this.main.main.setAttribute("role","combobox"),this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.list.id),this.main.main.setAttribute("aria-expanded","false"),this.main.main.setAttribute("aria-autocomplete","list"),this.main.main.removeAttribute("aria-labelledby"),this.main.main.removeAttribute("aria-label");let e=(this.settings.ariaLabelledBy||"").trim(),s=null;if(e)s=document.getElementById(e);else{const i=document.querySelector(`select[data-id="${this.settings.id}"]`);i&&(i.id&&(s=document.querySelector(`label[for="${i.id}"]`)),!s&&((n=i.previousElementSibling)==null?void 0:n.tagName)==="LABEL"&&(s=i.previousElementSibling),s&&(s.id||(s.id=(i.id||this.settings.id)+"-label"),e=s.id))}e&&document.getElementById(e)?this.main.main.setAttribute("aria-labelledby",e):this.settings.ariaLabel&&this.settings.ariaLabel.trim()&&this.main.main.setAttribute("aria-label",this.settings.ariaLabel.trim()),this.main.main.setAttribute("aria-owns",this.content.list.id),this.content.search.input.setAttribute("aria-controls",this.content.list.id),this.content.search.input.setAttribute("aria-autocomplete","list"),e&&document.getElementById(e)?this.content.search.input.setAttribute("aria-labelledby",e):this.settings.searchLabelledBy&&document.getElementById(this.settings.searchLabelledBy)?this.content.search.input.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel?this.content.search.input.setAttribute("aria-label",this.settings.searchAriaLabel):this.content.search.input.setAttribute("aria-label","Search options")}mainDiv(){var u;const e=document.createElement("div");e.id=this.settings.id+"-main",e.tabIndex=0,e.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 f=this.content.list.querySelector("."+this.classes.highlighted);return f&&f.click(),!1;case"Escape":return this.callbacks.close(),!1}return c.key.length===1&&this.callbacks.open(),!0},e.onclick=c=>{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 n=document.createElement("div");n.classList.add(this.classes.deselect),n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label",this.settings.clearAllAriaLabel),n.addEventListener("keydown",c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),n.click())});const i=(u=this.store)==null?void 0:u.getSelectedOptions();!this.settings.allowDeselect||this.settings.isMultiple&&i&&i.length<=0?n.classList.add(this.classes.hide):n.classList.remove(this.classes.hide),n.onclick=c=>{if(c.stopPropagation(),this.settings.disabled)return;let f=!0;const p=this.store.getSelectedOptions(),g=[];if(this.callbacks.beforeChange&&(f=this.callbacks.beforeChange(g,p)===!0),f){if(this.settings.isMultiple)this.callbacks.setSelected([],!1),this.updateDeselectAll();else{const _=this.store.getFirstOption(),C=_?_.id:"";this.callbacks.setSelected(C,!1)}this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(this.store.getSelectedOptions())}};const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("viewBox","0 0 100 100"),r.setAttribute("aria-hidden","true"),r.setAttribute("focusable","false");const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.deselectPath),r.appendChild(o),n.appendChild(r),e.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.classList.add(this.classes.arrow),l.setAttribute("viewBox","0 0 100 100"),l.setAttribute("aria-hidden","true"),l.setAttribute("focusable","false");const a=document.createElementNS("http://www.w3.org/2000/svg","path");return a.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&l.classList.add(this.classes.hide),l.appendChild(a),e.appendChild(l),{main:e,values:s,deselect:{main:n,svg:r,path:o},arrow:{main:l,path:a}}}mainFocus(e){e!=="click"&&this.main.main.focus({preventScroll:!0})}placeholder(){const e=this.store.filter(i=>i.placeholder,!1);let s=this.settings.placeholderText;e.length&&(e[0].html!==""?s=e[0].html:e[0].text!==""&&(s=e[0].text));const n=document.createElement("div");return n.classList.add(this.classes.placeholder),n.innerHTML=s,n}renderValues(){if(!this.settings.isMultiple){this.renderSingleValue();return}this.renderMultipleValues(),this.updateDeselectAll()}renderSingleValue(){const e=this.store.filter(n=>n.selected&&!n.placeholder,!1),s=e.length>0?e[0]:null;if(!s)this.main.values.innerHTML=this.placeholder().outerHTML;else{const n=document.createElement("div");n.classList.add(this.classes.single),s.html?n.innerHTML=s.html:n.innerText=s.text,this.main.values.innerHTML=n.outerHTML}!this.settings.allowDeselect||!e.length?this.main.deselect.main.classList.add(this.classes.hide):this.main.deselect.main.classList.remove(this.classes.hide)}renderMultipleValues(){let e=this.main.values.childNodes,s=this.store.filter(i=>i.selected&&i.display,!1);if(s.length===0){this.main.values.innerHTML=this.placeholder().outerHTML;return}else{const i=this.main.values.querySelector("."+this.classes.placeholder);i&&i.remove()}if(s.length>this.settings.maxValuesShown){const i=document.createElement("div");i.classList.add(this.classes.max),i.textContent=this.settings.maxValuesMessage.replace("{number}",s.length.toString()),this.main.values.innerHTML=i.outerHTML;return}else{const i=this.main.values.querySelector("."+this.classes.max);i&&i.remove()}this.settings.keepOrder&&(s=this.store.selectedOrderOptions(s));let n=[];for(let i=0;ia.id===o,!1).length||n.push(r))}for(const i of n)i.classList.add(this.classes.valueOut),setTimeout(()=>{this.main.values.hasChildNodes()&&this.main.values.contains(i)&&this.main.values.removeChild(i)},100);e=this.main.values.childNodes;for(let i=0;i{if(l.preventDefault(),l.stopPropagation(),this.settings.disabled)return;let a=!0;const u=this.store.getSelectedOptions(),c=u.filter(f=>f.selected&&f.id!==e.id,!0);if(!(this.settings.minSelected&&c.length{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),i.click())}}return s}contentDiv(){const e=document.createElement("div");e.id=this.settings.id+"-content";const s=this.searchDiv();e.appendChild(s.main);const n=this.listDiv();return e.appendChild(n),{main:e,search:s,list:n}}moveContent(){if(this.settings.contentPosition==="relative"){this.moveContentBelow();return}if(this.settings.openPosition==="down"){this.moveContentBelow();return}else if(this.settings.openPosition==="up"){this.moveContentAbove();return}this.putContent()==="up"?this.moveContentAbove():this.moveContentBelow()}searchDiv(){const e=document.createElement("div"),s=document.createElement("input"),n=document.createElement("div");e.classList.add(this.classes.search);const i={main:e,input:s};if(this.settings.showSearch||(e.classList.add(this.classes.hide),s.readOnly=!0),s.type="search",s.placeholder=this.settings.searchPlaceholder,s.tabIndex=-1,this.settings.searchLabelledBy&&this.settings.searchLabelledBy.trim()?s.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel&&this.settings.searchAriaLabel.trim()?s.setAttribute("aria-label",this.settings.searchAriaLabel):s.setAttribute("aria-label","Search options"),s.setAttribute("autocapitalize","off"),s.setAttribute("autocomplete","off"),s.setAttribute("autocorrect","off"),s.oninput=Kt(r=>{this.callbacks.search(r.target.value)},100),s.onkeydown=r=>{switch(r.key){case"ArrowUp":case"ArrowDown":return r.key==="ArrowDown"?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Escape":return this.callbacks.close(),!1;case" ":const o=this.content.list.querySelector("."+this.classes.highlighted);return o?(o.click(),!1):!0;case"Enter":if(this.callbacks.addable)return n.click(),!1;{const l=this.content.list.querySelector("."+this.classes.highlighted);if(l)return l.click(),!1}return!0}return!0},e.appendChild(s),this.callbacks.addable){n.classList.add(this.classes.addable);const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("viewBox","0 0 100 100"),r.setAttribute("aria-hidden","true"),r.setAttribute("focusable","false");const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.addablePath),r.appendChild(o),n.appendChild(r),n.onclick=l=>{if(l.preventDefault(),l.stopPropagation(),!this.callbacks.addable)return;const a=this.content.search.input.value.trim();if(a===""){this.content.search.input.focus();return}const u=f=>{let p=new ue(f);if(this.callbacks.addOption(p),this.settings.isMultiple){let g=this.store.getSelected();g.push(p.id),this.callbacks.setSelected(g,!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(f=>{typeof f=="string"?u({text:f,value:f}):c instanceof Error?this.renderError(c.message):u(f)}):typeof c=="string"?u({text:c,value:c}):c instanceof Error?this.renderError(c.message):u(c))},e.appendChild(n),i.addable={main:n,svg:r,path:o}}return i}searchFocus(){this.content.search.input.focus()}getOptions(e=!1,s=!1,n=!1){let i="."+this.classes.option;return e&&(i+=":not(."+this.classes.placeholder+")"),s&&(i+=":not(."+this.classes.disabled+")"),n&&(i+=":not(."+this.classes.hide+")"),Array.from(this.content.list.querySelectorAll(i))}highlight(e){const s=this.getOptions(!0,!0,!0);if(s.length===0)return;if(s.length===1&&!s[0].classList.contains(this.classes.highlighted)){s[0].classList.add(this.classes.highlighted);return}let n=!1;for(const r of s)r.classList.contains(this.classes.highlighted)&&(n=!0);if(!n){for(const r of s)if(r.classList.contains(this.classes.selected)){r.classList.add(this.classes.highlighted);break}}for(let r=0;r=0?r-1:s.length-1];a.classList.add(this.classes.highlighted),this.main.main.setAttribute("aria-activedescendant",a.id),this.ensureElementInView(this.content.list,a);const u=a.parentElement;if(u&&u.classList.contains(this.classes.close)){const c=u.querySelector("."+this.classes.optgroupLabel);c&&c.click()}return}const i=s[e==="down"?0:s.length-1];i.classList.add(this.classes.highlighted),this.main.main.setAttribute("aria-activedescendant",i.id),this.ensureElementInView(this.content.list,i)}listDiv(){const e=document.createElement("div");return e.classList.add(this.classes.list),e}renderError(e){this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy");const s=document.createElement("div");s.classList.add(this.classes.error),s.textContent=e,this.content.list.appendChild(s),this._announceAssertive(e)}renderSearching(){this.content.list.innerHTML="",this.content.list.setAttribute("aria-busy","true");const e=document.createElement("div");e.classList.add(this.classes.searching),e.textContent=this.settings.searchingText,this.content.list.appendChild(e),this._announcePolite(this.settings.searchingText)}renderOptions(e){if(this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy"),e.length===0){const l=document.createElement("div");l.classList.add(this.classes.search);const a=this.callbacks.addable?this.settings.addableText.replace("{value}",this.content.search.input.value):this.settings.searchText;this._announcePolite(a),l.innerHTML=a,this.content.list.appendChild(l),this.content.list.setAttribute("aria-setsize","0");return}this.settings.allowDeselect&&!this.settings.isMultiple&&(this.store.filter(a=>a.placeholder,!1).length||this.store.addOption(new ue({text:"",value:"",selected:!1,placeholder:!0}),!0));const s=document.createDocumentFragment();let n=0;const i=e.filter(l=>l instanceof ue&&!l.placeholder&&l.display&&!l.disabled).length,r=l=>{!l.classList.contains(this.classes.placeholder)&&!l.classList.contains(this.classes.disabled)&&!l.classList.contains(this.classes.hide)&&(l.setAttribute("aria-posinset",String(++n)),l.setAttribute("aria-setsize",String(i)))};for(const l of e){if(l instanceof Me){const a=document.createElement("div");a.classList.add(this.classes.optgroup),a.setAttribute("role","group"),a.setAttribute("aria-label",l.label);const u=document.createElement("div");u.classList.add(this.classes.optgroupLabel),a.appendChild(u);const c=document.createElement("div");c.classList.add(this.classes.optgroupLabelText),c.textContent=l.label,u.appendChild(c);const f=document.createElement("div");if(f.classList.add(this.classes.optgroupActions),u.appendChild(f),this.settings.isMultiple&&l.selectAll){const p=document.createElement("div");p.classList.add(this.classes.optgroupSelectAll);let g=!0;for(const m of l.options)if(!m.selected){g=!1;break}g&&p.classList.add(this.classes.selected);const _=document.createElement("span");_.textContent=l.selectAllText,p.appendChild(_);const C=document.createElementNS("http://www.w3.org/2000/svg","svg");C.setAttribute("viewBox","0 0 100 100"),C.setAttribute("aria-hidden","true"),C.setAttribute("focusable","false"),p.appendChild(C);const D=document.createElementNS("http://www.w3.org/2000/svg","path");D.setAttribute("d",this.classes.optgroupSelectAllBox),C.appendChild(D);const T=document.createElementNS("http://www.w3.org/2000/svg","path");T.setAttribute("d",this.classes.optgroupSelectAllCheck),C.appendChild(T),p.addEventListener("click",m=>{m.preventDefault(),m.stopPropagation();const b=this.store.getSelected();if(g){const y=b.filter(S=>{for(const O of l.options)if(S===O.id)return!1;return!0});this.callbacks.setSelected(y,!0);return}else{const y=b.concat(l.options.map(S=>S.id));for(const S of l.options)this.store.getOptionByID(S.id)||this.callbacks.addOption(S);this.callbacks.setSelected(y,!0);return}}),f.appendChild(p)}if(l.closable!=="off"){const p=document.createElement("div");p.classList.add(this.classes.optgroupClosable);const g=document.createElementNS("http://www.w3.org/2000/svg","svg");g.setAttribute("viewBox","0 0 100 100"),g.classList.add(this.classes.arrow),g.setAttribute("aria-hidden","true"),g.setAttribute("focusable","false"),p.appendChild(g);const _=document.createElementNS("http://www.w3.org/2000/svg","path");g.appendChild(_),l.options.some(C=>C.selected)||this.content.search.input.value.trim()!==""?(a.classList.add(this.classes.open),_.setAttribute("d",this.classes.arrowOpen)):l.closable==="open"?(a.classList.add(this.classes.open),_.setAttribute("d",this.classes.arrowOpen)):l.closable==="close"&&(a.classList.add(this.classes.close),_.setAttribute("d",this.classes.arrowClose)),u.addEventListener("click",C=>{C.preventDefault(),C.stopPropagation(),a.classList.contains(this.classes.close)?(a.classList.remove(this.classes.close),a.classList.add(this.classes.open),_.setAttribute("d",this.classes.arrowOpen)):(a.classList.remove(this.classes.open),a.classList.add(this.classes.close),_.setAttribute("d",this.classes.arrowClose))}),f.appendChild(p)}a.appendChild(u);for(const p of l.options){const g=this.option(p);r(g),a.appendChild(g)}s.appendChild(a)}if(l instanceof ue){const a=this.option(l);r(a),s.appendChild(a)}}this.content.list.appendChild(s),this.content.list.removeAttribute("aria-busy");const o=this.getOptions(!0,!0,!0).length;this._announcePolite(`${o} option${o===1?"":"s"} available`)}option(e){if(e.placeholder){const n=document.createElement("div");return n.classList.add(this.classes.option),n.classList.add(this.classes.hide),n}const s=document.createElement("div");return s.dataset.id=e.id,s.id=`${this.settings.id}__opt__${e.id}`,s.classList.add(this.classes.option),s.setAttribute("role","option"),e.class&&e.class.split(" ").forEach(n=>{s.classList.add(n)}),e.style&&(s.style.cssText=e.style),this.settings.searchHighlight&&this.content.search.input.value.trim()!==""?s.innerHTML=this.highlightText(e.html!==""?e.html:e.text,this.content.search.input.value,this.classes.searchHighlighter):e.html!==""?s.innerHTML=e.html:s.textContent=e.text,this.settings.showOptionTooltips&&s.textContent&&s.setAttribute("title",s.textContent),e.display||s.classList.add(this.classes.hide),e.disabled&&(s.classList.add(this.classes.disabled),s.setAttribute("aria-disabled","true")),e.selected&&this.settings.hideSelected&&s.classList.add(this.classes.hide),e.selected?(s.classList.add(this.classes.selected),s.setAttribute("aria-selected","true"),this.main.main.setAttribute("aria-activedescendant",s.id)):(s.classList.remove(this.classes.selected),s.setAttribute("aria-selected","false")),s.addEventListener("click",n=>{n.preventDefault(),n.stopPropagation();const i=this.store.getSelected(),r=n.currentTarget,o=String(r.dataset.id);if(e.disabled||e.selected&&!this.settings.allowDeselect||this.settings.isMultiple&&this.settings.maxSelected<=i.length&&!e.selected||this.settings.isMultiple&&this.settings.minSelected>=i.length&&e.selected)return;let l=!1;const a=this.store.getSelectedOptions();let u=[];if(this.settings.isMultiple){if(e.selected)u=a.filter(c=>c.id!==o);else if(u=a.concat(e),!this.settings.closeOnSelect)if(n.shiftKey&&this.lastSelectedOption){const c=this.store.getDataOptions();let f=c.findIndex(g=>g.id===this.lastSelectedOption.id),p=c.findIndex(g=>g.id===e.id);if(f>=0&&p>=0){const g=Math.min(f,p),_=Math.max(f,p),C=c.slice(g,_+1);C.length>0&&C.length!a.find(T=>T.id===D.id))))}}else e.selected||(this.lastSelectedOption=e)}this.settings.isMultiple||(e.selected?u=[]:u=[e]),this.callbacks.beforeChange||(l=!0),this.callbacks.beforeChange&&(this.callbacks.beforeChange(u,a)===!1?l=!1:l=!0),l&&(this.store.getOptionByID(o)||this.callbacks.addOption(e),this.callbacks.setSelected(u.map(c=>c.id),!1),this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(u))}),s}destroy(){this.main.main.remove(),this.content.main.remove()}highlightText(e,s,n){let i=e;const r=new RegExp("(?![^<]*>)("+s.trim()+")(?![^<]*>[^<>]*${a}`),i}moveContentAbove(){const e=this.main.main.offsetHeight,s=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 n=this.main.main.getBoundingClientRect();this.content.main.style.margin="-"+(e+s-1)+"px 0px 0px 0px",this.content.main.style.top=n.top+n.height+(this.settings.contentPosition==="fixed"?0:window.scrollY)+"px",this.content.main.style.left=n.left+(this.settings.contentPosition==="fixed"?0:window.scrollX)+"px",this.content.main.style.width=n.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",this.settings.contentPosition!=="relative"&&(this.content.main.style.top=e.top+e.height+(this.settings.contentPosition==="fixed"?0:window.scrollY)+"px",this.content.main.style.left=e.left+(this.settings.contentPosition==="fixed"?0:window.scrollX)+"px",this.content.main.style.width=e.width+"px")}ensureElementInView(e,s){const n=e.scrollTop+e.offsetTop,i=n+e.clientHeight,r=s.offsetTop,o=r+s.clientHeight;ri&&(e.scrollTop+=o-i)}putContent(){const e=this.main.main.offsetHeight,s=this.main.main.getBoundingClientRect(),n=this.content.main.offsetHeight;return window.innerHeight-(s.top+e)<=n&&s.top>n?"up":"down"}updateDeselectAll(){if(!this.store||!this.settings)return;const e=this.store.getSelectedOptions(),s=e&&e.length>0,n=this.settings.isMultiple,i=this.settings.allowDeselect,r=this.main.deselect.main,o=this.classes.hide;i&&!(n&&!s)?r.classList.remove(o):r.classList.add(o)}};ke._livePolite=null,ke._liveAssertive=null;let hn=ke;class Fc{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.getSelectedOptions()),!0}observeCall(e){if(!this.listen)return;let s=!1,n=!1,i=!1;for(const r of e){if(r.target===this.select&&(r.attributeName==="disabled"&&(n=!0),r.attributeName==="class"&&(s=!0),r.type==="childList")){for(const o of r.addedNodes)if(o.nodeName==="OPTION"&&o.value===this.select.value){this.select.dispatchEvent(new Event("change"));break}i=!0}(r.target.nodeName==="OPTGROUP"||r.target.nodeName==="OPTION")&&(i=!0)}s&&this.onClassChange&&this.onClassChange(this.select.className.split(" ")),n&&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 s=this.select.childNodes;for(const n of s)n.nodeName==="OPTGROUP"&&e.push(this.getDataFromOptgroup(n)),n.nodeName==="OPTION"&&e.push(this.getDataFromOption(n));return e}getDataFromOptgroup(e){let s={id:e.id,label:e.label,selectAll:e.dataset?e.dataset.selectall==="true":!1,selectAllText:e.dataset?e.dataset.selectalltext:"Select all",closable:e.dataset?e.dataset.closable:"off",options:[]};const n=e.childNodes;for(const i of n)i.nodeName==="OPTION"&&s.options.push(this.getDataFromOption(i));return s}getDataFromOption(e){return{id:e.id,value:e.value,text:e.text,html:e.dataset&&e.dataset.html?e.dataset.html:"",defaultSelected:e.defaultSelected,selected:e.selected,display:e.style.display!=="none",disabled:e.disabled,mandatory:e.dataset?e.dataset.mandatory==="true":!1,placeholder:e.dataset.placeholder==="true",class:e.className,style:e.style.cssText,data:e.dataset}}getSelectedOptions(){let e=[];const s=this.select.childNodes;for(const n of s){if(n.nodeName==="OPTGROUP"){const i=n.childNodes;for(const r of i)if(r.nodeName==="OPTION"){const o=r;o.selected&&e.push(this.getDataFromOption(o))}}if(n.nodeName==="OPTION"){const i=n;i.selected&&e.push(this.getDataFromOption(i))}}return e}getSelectedValues(){return this.getSelectedOptions().map(e=>e.value)}setSelected(e){this.changeListen(!1);const s=this.select.childNodes;for(const n of s){if(n.nodeName==="OPTGROUP"){const r=n.childNodes;for(const o of r)if(o.nodeName==="OPTION"){const l=o;l.selected=e.includes(l.id)}}if(n.nodeName==="OPTION"){const i=n;i.selected=e.includes(i.id)}}this.changeListen(!0)}setSelectedByValue(e){this.changeListen(!1);const s=this.select.childNodes;for(const n of s){if(n.nodeName==="OPTGROUP"){const r=n.childNodes;for(const o of r)if(o.nodeName==="OPTION"){const l=o;l.selected=e.includes(l.value)}}if(n.nodeName==="OPTION"){const i=n;i.selected=e.includes(i.value)}}this.changeListen(!0)}updateSelect(e,s,n){this.changeListen(!1),e&&(this.select.dataset.id=e),s&&(this.select.style.cssText=s),n&&(this.select.className="",n.forEach(i=>{i.trim()!==""&&this.select.classList.add(i.trim())})),this.changeListen(!0)}updateOptions(e){this.changeListen(!1),this.select.innerHTML="";for(const s of e)s instanceof Me&&this.select.appendChild(this.createOptgroup(s)),s instanceof ue&&this.select.appendChild(this.createOption(s));this.select.dispatchEvent(new Event("change",{bubbles:!0})),this.changeListen(!0)}createOptgroup(e){const s=document.createElement("optgroup");if(s.id=e.id,s.label=e.label,e.selectAll&&(s.dataset.selectAll="true"),e.closable!=="off"&&(s.dataset.closable=e.closable),e.options)for(const n of e.options)s.appendChild(this.createOption(n));return s}createOption(e){const s=document.createElement("option");return s.id=e.id,s.value=e.value,s.textContent=e.text,e.html!==""&&s.setAttribute("data-html",e.html),s.defaultSelected=e.defaultSelected,s.selected=e.selected,e.disabled&&(s.disabled=!0),e.display||(s.style.display="none"),e.placeholder&&s.setAttribute("data-placeholder","true"),e.mandatory&&s.setAttribute("data-mandatory","true"),e.class&&e.class.split(" ").forEach(n=>{s.classList.add(n)}),e.data&&typeof e.data=="object"&&Object.keys(e.data).forEach(n=>{s.setAttribute("data-"+kc(n),e.data[n])}),s}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 Mc{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-"+In(),this.style=e.style||"",this.class=e.class||[],this.disabled=e.disabled!==void 0?e.disabled:!1,this.alwaysOpen=e.alwaysOpen!==void 0?e.alwaysOpen:!1,this.showSearch=e.showSearch!==void 0?e.showSearch:!0,this.focusSearch=e.focusSearch!==void 0?e.focusSearch:!0,this.ariaLabel=e.ariaLabel||"",this.searchPlaceholder=e.searchPlaceholder||"Search",this.searchText=e.searchText||"No Results",this.searchingText=e.searchingText||"Searching...",this.searchHighlight=e.searchHighlight!==void 0?e.searchHighlight:!1,this.closeOnSelect=e.closeOnSelect!==void 0?e.closeOnSelect:!0,this.contentLocation=e.contentLocation||document.body,this.contentPosition=e.contentPosition||"absolute",this.openPosition=e.openPosition||"auto",this.contentAriaLabel=e.contentAriaLabel!==void 0?e.contentAriaLabel:"Select an option",this.placeholderText=e.placeholderText!==void 0?e.placeholderText:"Select Value",this.allowDeselect=e.allowDeselect!==void 0?e.allowDeselect:!1,this.hideSelected=e.hideSelected!==void 0?e.hideSelected:!1,this.keepOrder=e.keepOrder!==void 0?e.keepOrder:!1,this.showOptionTooltips=e.showOptionTooltips!==void 0?e.showOptionTooltips:!1,this.minSelected=e.minSelected||0,this.maxSelected=e.maxSelected||1e3,this.timeoutDelay=e.timeoutDelay||200,this.maxValuesShown=e.maxValuesShown||20,this.maxValuesMessage=e.maxValuesMessage||"{number} selected",this.addableText=e.addableText||'Press "Enter" to add {value}',this.ariaLabelledBy=e.ariaLabelledBy||"",this.searchAriaLabel=e.searchAriaLabel||"Search options",this.searchLabelledBy=e.searchLabelledBy||"",this.clearAllAriaLabel=e.clearAllAriaLabel||"Clear selection"}}class Nc{constructor(e){var o;if(this.events={search:void 0,searchFilter:(l,a)=>l.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=Kt(()=>{!this.settings.isOpen&&!this.settings.isFullOpen||this.render.moveContent()}),this.windowScroll=Kt(()=>{!this.settings.isOpen&&!this.settings.isFullOpen||this.render.moveContent()}),this.documentClick=l=>{this.settings.isOpen&&l.target&&!Dc(l.target,this.settings.id)&&this.close(l.type)},this.windowVisibilityChange=()=>{document.hidden&&this.close()},this.selectEl=typeof e.select=="string"?document.querySelector(e.select):e.select,!this.selectEl){e.events&&e.events.error&&e.events.error(new Error("Could not find select element"));return}if(this.selectEl.tagName!=="SELECT"){e.events&&e.events.error&&e.events.error(new Error("Element isnt of type select"));return}this.selectEl.dataset.ssid&&this.destroy(),this.settings=new Mc(e.settings),this.cssClasses=new Rc(e.cssClasses);const s=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const l in e.events)e.events.hasOwnProperty(l)&&(s.indexOf(l)!==-1?this.events[l]=Kt(e.events[l],100):this.events[l]=e.events[l]);this.settings.disabled=(o=e.settings)!=null&&o.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 Fc(this.selectEl),this.select.updateSelect(this.settings.id,this.settings.style,this.settings.class),this.select.hideUI(),this.select.onValueChange=l=>{this.setSelected(l.map(a=>a.id))},this.select.onClassChange=l=>{this.settings.class=l,this.render.updateClassStyles()},this.select.onDisabledChange=l=>{l?this.disable():this.enable()},this.select.onOptionsChange=l=>{this.setData(l)},this.store=new Ic(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 hn(this.settings,this.cssClasses,this.store,n),this.render.renderValues(),this.render.renderOptions(this.store.getData());const i=this.selectEl.getAttribute("aria-label"),r=this.selectEl.getAttribute("aria-labelledby");i?this.render.main.main.setAttribute("aria-label",i):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),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(e){const s=this.store.getSelected(),n=this.store.validateDataArray(e);if(n){this.events.error&&this.events.error(n);return}this.store.setData(e);const i=this.store.getData();this.select.updateOptions(i),this.render.renderValues(),this.render.renderOptions(i),this.events.afterChange&&!qs(s,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let e=this.store.getSelectedOptions();return this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e)),e.map(s=>s.value)}setSelected(e,s=!0){const n=this.store.getSelected(),i=this.store.getDataOptions();e=Array.isArray(e)?e:[e];const r=[];for(const l of e){if(i.find(a=>a.id==l)){r.push(l);continue}for(const a of i.filter(u=>u.value==l))r.push(a.id)}this.store.setSelectedBy("id",r);const o=this.store.getData();this.select.updateOptions(o),this.render.renderValues(),this.render.content.search.input.value!==""?this.search(this.render.content.search.input.value):this.render.renderOptions(o),s&&this.events.afterChange&&!qs(n,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}addOption(e){const s=this.store.getSelected();this.store.getDataOptions().some(i=>i.value===(e.value??e.text))||this.store.addOption(e);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!qs(s,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.settings.focusSearch&&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(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){this.render.renderOptions(e===""?this.store.getData():this.store.search(e,this.events.searchFilter));return}this.render.renderSearching();const s=this.events.search(e,this.store.getSelectedOptions());if(s instanceof Promise){s.then(n=>{this.render.renderOptions(this.store.partialToFullData(n))}).catch(n=>{this.render.renderError(typeof n=="string"?n:n.message)});return}else Array.isArray(s)?this.render.renderOptions(this.store.partialToFullData(s)):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 Bc="CWYDT23U",Hc="slimselectjscom",Vc=Ts({__name:"carbonad",setup(t){const e=ir(null);let s=!1;return mr(()=>{const n=window.location.hostname==="localhost";if(!s&&!n){s=!0;const i=document.createElement("script");i.id="_carbonads_js",i.src=`//cdn.carbonads.com/carbon.js?serve=${Bc}&placement=${Hc}`,i.async=!0,e.value&&e.value.appendChild(i)}}),(n,i)=>wt(s)?(Zt(),Nr("div",{key:0,class:"carbon-container",ref_key:"container",ref:e},null,512)):$o("",!0)}}),Uc=Ts({name:"App",components:{CarbonAd:Vc},data(){return{nav:null,navDebounce:Kt(()=>{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:"Examples",closable:"close",options:[{text:"countries",value:"examples#countries"},{text:"form reset",value:"examples#formReset"}]},{label:"Settings",closable:"close",options:[{text:"select",value:"settings#select"},{text:"cssClasses",value:"settings#cssClasses"},{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"}]}]}},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 t=this.$route.hash;if(t===""&&window.scroll({top:0,behavior:"smooth"}),t){const e=document.querySelector(t);if(e){const s=document.querySelector("header"),n=document.querySelector("nav"),i=s?s.clientHeight+(window.innerWidth<700?n.clientHeight:0)+8:0;window.scroll({top:e.offsetTop-i,behavior:"smooth"})}}},200)}),this.setDemensions(),window.addEventListener("resize",this.navDebounce),window.addEventListener("nav-updated",this.updateNav)},unmounted(){var t;window.removeEventListener("resize",this.navDebounce),window.removeEventListener("nav-updated",this.updateNav),(t=this.nav)==null||t.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 t={searchHighlight:!0,openContent:"below"};this.width>700&&(t.alwaysOpen=!0,t.contentPosition="relative",t.contentLocation=this.$refs.navContent),this.nav=new Nc({select:this.$refs.nav,data:this.navData,settings:t,events:{afterChange:e=>{const n=e[0].value.split("#"),i=n[0],r=n[1]?"#"+n[1]:void 0;this.$router.push({path:i,hash:r})}}})},updateNav(){setTimeout(()=>{this.nav&&this.nav.setSelected(this.$router.currentRoute.value.fullPath.replace("/",""))},0)}}}),$c="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",jc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACAAQMAAAD58POIAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZQTFRFyzg3////IltC9QAAAAFiS0dEAf8CLd4AAAAJcEhZcwAACxMAAAsTAQCanBgAAAAkSURBVEjHY2AYBYMV/IeDUQG4AJgeFRgVGBUYFSBNYBQMPgAARjtdvxo6xaMAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTEtMDUtMzBUMjM6MTA6NDQtMDc6MDCm4GvfAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDEwLTEyLTA2VDEyOjIwOjEyLTA4OjAwpIGEmQAAADJ0RVh0UE5HOmNIUk0AY2h1bmsgd2FzIGZvdW5kIChzZWUgQ2hyb21hdGljaXR5LCBhYm92ZSkH0UjaAAAAKXRFWHRQTkc6Z0FNQQBnYW1tYT0wLjQ1NDU1IChTZWUgR2FtbWEsIGFib3ZlKRISLKcAAAAUdEVYdFBORzpJSERSLmJpdF9kZXB0aAA4KYV+UAAAABV0RVh0UE5HOklIRFIuY29sb3JfdHlwZQA2BkqnKwAAABt0RVh0UE5HOklIRFIuaW50ZXJsYWNlX21ldGhvZAAw+zsHjAAAABx0RVh0UE5HOklIRFIud2lkdGgsaGVpZ2h0ADE2LCAxNjjVBg0AAAAodEVYdFBORzpwSFlzAHhfcmVzPTI4MzUsIHlfcmVzPTI4MzUsIHVuaXRzPTGCKXI+AAAAKHRFWHRQTkc6c1JHQgBpbnRlbnQ9MCAoU2VlIFJlbmRlcmluZyBpbnRlbnQp8hEU9QAAAABJRU5ErkJggg==",zc=(t,e)=>{const s=t.__vccOpts||t;for(const[n,i]of e)s[n]=i;return s},Wc={ref:"nav"},Gc={class:"nav-content",ref:"navContent"};function qc(t,e,s,n,i,r){const o=$n("CarbonAd"),l=$n("router-view");return Zt(),Nr(Re,null,[e[4]||(e[4]=Uo('

Slim Select 2.0

Advanced select dropdown
',1)),Ze("nav",null,[Ze("select",Wc,null,512),Ze("div",Gc,null,512),de(o)]),Ze("main",null,[de(l),Ze("footer",null,[ds(" © "+Vi(t.year)+" ",1),e[0]||(e[0]=Ze("a",{href:"http://webiswhatido.com",style:{color:"#ffffff"},target:"_blank"},"Brian Voelker",-1)),e[1]||(e[1]=ds(". ")),e[2]||(e[2]=Ze("br",null,null,-1)),e[3]||(e[3]=ds(" Slim Select is under the MIT license. "))])])],64)}const Kc=zc(Uc,[["render",qc]]);var Ri=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function sl(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ks={exports:{}},Di;function Yc(){return Di||(Di=1,function(t){var e=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 s=function(n){var i=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,r=0,o={},l={manual:n.Prism&&n.Prism.manual,disableWorkerMessageHandler:n.Prism&&n.Prism.disableWorkerMessageHandler,util:{encode:function m(b){return b instanceof a?new a(b.type,m(b.content),b.alias):Array.isArray(b)?b.map(m):b.replace(/&/g,"&").replace(/"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(S){var m=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(S.stack)||[])[1];if(m){var b=document.getElementsByTagName("script");for(var y in b)if(b[y].src==m)return b[y]}return null}},isActive:function(m,b,y){for(var S="no-"+b;m;){var O=m.classList;if(O.contains(b))return!0;if(O.contains(S))return!1;m=m.parentElement}return!!y}},languages:{plain:o,plaintext:o,text:o,txt:o,extend:function(m,b){var y=l.util.clone(l.languages[m]);for(var S in b)y[S]=b[S];return y},insertBefore:function(m,b,y,S){S=S||l.languages;var O=S[m],F={};for(var W in O)if(O.hasOwnProperty(W)){if(W==b)for(var H in y)y.hasOwnProperty(H)&&(F[H]=y[H]);y.hasOwnProperty(W)||(F[W]=O[W])}var K=S[m];return S[m]=F,l.languages.DFS(l.languages,function(re,pe){pe===K&&re!=m&&(this[re]=F)}),F},DFS:function m(b,y,S,O){O=O||{};var F=l.util.objId;for(var W in b)if(b.hasOwnProperty(W)){y.call(b,W,b[W],S||W);var H=b[W],K=l.util.type(H);K==="Object"&&!O[F(H)]?(O[F(H)]=!0,m(H,y,null,O)):K==="Array"&&!O[F(H)]&&(O[F(H)]=!0,m(H,y,W,O))}}},plugins:{},highlightAll:function(m,b){l.highlightAllUnder(document,m,b)},highlightAllUnder:function(m,b,y){var S={callback:y,container:m,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};l.hooks.run("before-highlightall",S),S.elements=Array.prototype.slice.apply(S.container.querySelectorAll(S.selector)),l.hooks.run("before-all-elements-highlight",S);for(var O=0,F;F=S.elements[O++];)l.highlightElement(F,b===!0,S.callback)},highlightElement:function(m,b,y){var S=l.util.getLanguage(m),O=l.languages[S];l.util.setLanguage(m,S);var F=m.parentElement;F&&F.nodeName.toLowerCase()==="pre"&&l.util.setLanguage(F,S);var W=m.textContent,H={element:m,language:S,grammar:O,code:W};function K(pe){H.highlightedCode=pe,l.hooks.run("before-insert",H),H.element.innerHTML=H.highlightedCode,l.hooks.run("after-highlight",H),l.hooks.run("complete",H),y&&y.call(H.element)}if(l.hooks.run("before-sanity-check",H),F=H.element.parentElement,F&&F.nodeName.toLowerCase()==="pre"&&!F.hasAttribute("tabindex")&&F.setAttribute("tabindex","0"),!H.code){l.hooks.run("complete",H),y&&y.call(H.element);return}if(l.hooks.run("before-highlight",H),!H.grammar){K(l.util.encode(H.code));return}if(b&&n.Worker){var re=new Worker(l.filename);re.onmessage=function(pe){K(pe.data)},re.postMessage(JSON.stringify({language:H.language,code:H.code,immediateClose:!0}))}else K(l.highlight(H.code,H.grammar,H.language))},highlight:function(m,b,y){var S={code:m,grammar:b,language:y};if(l.hooks.run("before-tokenize",S),!S.grammar)throw new Error('The language "'+S.language+'" has no grammar.');return S.tokens=l.tokenize(S.code,S.grammar),l.hooks.run("after-tokenize",S),a.stringify(l.util.encode(S.tokens),S.language)},tokenize:function(m,b){var y=b.rest;if(y){for(var S in y)b[S]=y[S];delete b.rest}var O=new f;return p(O,O.head,m),c(m,O,b,O.head,0),_(O)},hooks:{all:{},add:function(m,b){var y=l.hooks.all;y[m]=y[m]||[],y[m].push(b)},run:function(m,b){var y=l.hooks.all[m];if(!(!y||!y.length))for(var S=0,O;O=y[S++];)O(b)}},Token:a};n.Prism=l;function a(m,b,y,S){this.type=m,this.content=b,this.alias=y,this.length=(S||"").length|0}a.stringify=function m(b,y){if(typeof b=="string")return b;if(Array.isArray(b)){var S="";return b.forEach(function(K){S+=m(K,y)}),S}var O={type:b.type,content:m(b.content,y),tag:"span",classes:["token",b.type],attributes:{},language:y},F=b.alias;F&&(Array.isArray(F)?Array.prototype.push.apply(O.classes,F):O.classes.push(F)),l.hooks.run("wrap",O);var W="";for(var H in O.attributes)W+=" "+H+'="'+(O.attributes[H]||"").replace(/"/g,""")+'"';return"<"+O.tag+' class="'+O.classes.join(" ")+'"'+W+">"+O.content+""};function u(m,b,y,S){m.lastIndex=b;var O=m.exec(y);if(O&&S&&O[1]){var F=O[1].length;O.index+=F,O[0]=O[0].slice(F)}return O}function c(m,b,y,S,O,F){for(var W in y)if(!(!y.hasOwnProperty(W)||!y[W])){var H=y[W];H=Array.isArray(H)?H:[H];for(var K=0;K=F.reach);ae+=$.value.length,$=$.next){var ye=$.value;if(b.length>m.length)return;if(!(ye instanceof a)){var Ae=1,te;if(ot){if(te=u(Q,ae,m,Le),!te||te.index>=m.length)break;var fe=te.index,ct=te.index+te[0].length,we=ae;for(we+=$.value.length;fe>=we;)$=$.next,we+=$.value.length;if(we-=$.value.length,ae=we,$.value instanceof a)continue;for(var Ve=$;Ve!==b.tail&&(weF.reach&&(F.reach=B);var Y=$.prev;N&&(Y=p(b,Y,N),ae+=N.length),g(b,Y,Ae);var h=new a(W,pe?l.tokenize(A,pe):A,at,A);if($=p(b,Y,h),k&&p(b,$,k),Ae>1){var d={cause:W+","+K,reach:B};c(m,b,y,$.prev,ae,d),F&&d.reach>F.reach&&(F.reach=d.reach)}}}}}}function f(){var m={value:null,prev:null,next:null},b={value:null,prev:m,next:null};m.next=b,this.head=m,this.tail=b,this.length=0}function p(m,b,y){var S=b.next,O={value:y,prev:b,next:S};return b.next=O,S.prev=O,m.length++,O}function g(m,b,y){for(var S=b.next,O=0;O/,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]},s.languages.markup.tag.inside["attr-value"].inside.entity=s.languages.markup.entity,s.languages.markup.doctype.inside["internal-subset"].inside=s.languages.markup,s.hooks.add("wrap",function(n){n.type==="entity"&&(n.attributes.title=n.content.replace(/&/,"&"))}),Object.defineProperty(s.languages.markup.tag,"addInlined",{value:function(i,r){var o={};o["language-"+r]={pattern:/(^$)/i,lookbehind:!0,inside:s.languages[r]},o.cdata=/^$/i;var l={"included-cdata":{pattern://i,inside:o}};l["language-"+r]={pattern:/[\s\S]+/,inside:s.languages[r]};var a={};a[i]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return i}),"i"),lookbehind:!0,greedy:!0,inside:l},s.languages.insertBefore("markup","cdata",a)}}),Object.defineProperty(s.languages.markup.tag,"addAttribute",{value:function(n,i){s.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+n+")"+/\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:[i,"language-"+i],inside:s.languages[i]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),s.languages.html=s.languages.markup,s.languages.mathml=s.languages.markup,s.languages.svg=s.languages.markup,s.languages.xml=s.languages.extend("markup",{}),s.languages.ssml=s.languages.xml,s.languages.atom=s.languages.xml,s.languages.rss=s.languages.xml,function(n){var i=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;n.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+i.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\\((?:"+i.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+i.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+i.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:i,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:/[(){};:,]/},n.languages.css.atrule.inside.rest=n.languages.css;var r=n.languages.markup;r&&(r.tag.addInlined("style","css"),r.tag.addAttribute("style","css"))}(s),s.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:/[{}[\];(),.:]/},s.languages.javascript=s.languages.extend("clike",{"class-name":[s.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}|\?\?=?|\?\.?|[~:]/}),s.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,s.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:s.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:s.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:s.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:s.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:s.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),s.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:s.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"}}),s.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),s.languages.markup&&(s.languages.markup.tag.addInlined("script","javascript"),s.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")),s.languages.js=s.languages.javascript,function(){if(typeof s>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var n="Loading…",i=function(C,D){return"✖ Error "+C+" while fetching file: "+D},r="✖ Error: File does not exist or is empty",o={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},l="data-src-status",a="loading",u="loaded",c="failed",f="pre[data-src]:not(["+l+'="'+u+'"]):not(['+l+'="'+a+'"])';function p(C,D,T){var m=new XMLHttpRequest;m.open("GET",C,!0),m.onreadystatechange=function(){m.readyState==4&&(m.status<400&&m.responseText?D(m.responseText):m.status>=400?T(i(m.status,m.statusText)):T(r))},m.send(null)}function g(C){var D=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(C||"");if(D){var T=Number(D[1]),m=D[2],b=D[3];return m?b?[T,Number(b)]:[T,void 0]:[T,T]}}s.hooks.add("before-highlightall",function(C){C.selector+=", "+f}),s.hooks.add("before-sanity-check",function(C){var D=C.element;if(D.matches(f)){C.code="",D.setAttribute(l,a);var T=D.appendChild(document.createElement("CODE"));T.textContent=n;var m=D.getAttribute("data-src"),b=C.language;if(b==="none"){var y=(/\.(\w+)$/.exec(m)||[,"none"])[1];b=o[y]||y}s.util.setLanguage(T,b),s.util.setLanguage(D,b);var S=s.plugins.autoloader;S&&S.loadLanguages(b),p(m,function(O){D.setAttribute(l,u);var F=g(D.getAttribute("data-range"));if(F){var W=O.split(/\r\n?|\n/g),H=F[0],K=F[1]==null?W.length:F[1];H<0&&(H+=W.length),H=Math.max(0,Math.min(H-1,W.length)),K<0&&(K+=W.length),K=Math.max(0,Math.min(K,W.length)),O=W.slice(H,K).join(` + */var s=function(n){var i=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,r=0,o={},l={manual:n.Prism&&n.Prism.manual,disableWorkerMessageHandler:n.Prism&&n.Prism.disableWorkerMessageHandler,util:{encode:function m(b){return b instanceof a?new a(b.type,m(b.content),b.alias):Array.isArray(b)?b.map(m):b.replace(/&/g,"&").replace(/"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(S){var m=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(S.stack)||[])[1];if(m){var b=document.getElementsByTagName("script");for(var y in b)if(b[y].src==m)return b[y]}return null}},isActive:function(m,b,y){for(var S="no-"+b;m;){var O=m.classList;if(O.contains(b))return!0;if(O.contains(S))return!1;m=m.parentElement}return!!y}},languages:{plain:o,plaintext:o,text:o,txt:o,extend:function(m,b){var y=l.util.clone(l.languages[m]);for(var S in b)y[S]=b[S];return y},insertBefore:function(m,b,y,S){S=S||l.languages;var O=S[m],I={};for(var W in O)if(O.hasOwnProperty(W)){if(W==b)for(var H in y)y.hasOwnProperty(H)&&(I[H]=y[H]);y.hasOwnProperty(W)||(I[W]=O[W])}var K=S[m];return S[m]=I,l.languages.DFS(l.languages,function(re,pe){pe===K&&re!=m&&(this[re]=I)}),I},DFS:function m(b,y,S,O){O=O||{};var I=l.util.objId;for(var W in b)if(b.hasOwnProperty(W)){y.call(b,W,b[W],S||W);var H=b[W],K=l.util.type(H);K==="Object"&&!O[I(H)]?(O[I(H)]=!0,m(H,y,null,O)):K==="Array"&&!O[I(H)]&&(O[I(H)]=!0,m(H,y,W,O))}}},plugins:{},highlightAll:function(m,b){l.highlightAllUnder(document,m,b)},highlightAllUnder:function(m,b,y){var S={callback:y,container:m,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};l.hooks.run("before-highlightall",S),S.elements=Array.prototype.slice.apply(S.container.querySelectorAll(S.selector)),l.hooks.run("before-all-elements-highlight",S);for(var O=0,I;I=S.elements[O++];)l.highlightElement(I,b===!0,S.callback)},highlightElement:function(m,b,y){var S=l.util.getLanguage(m),O=l.languages[S];l.util.setLanguage(m,S);var I=m.parentElement;I&&I.nodeName.toLowerCase()==="pre"&&l.util.setLanguage(I,S);var W=m.textContent,H={element:m,language:S,grammar:O,code:W};function K(pe){H.highlightedCode=pe,l.hooks.run("before-insert",H),H.element.innerHTML=H.highlightedCode,l.hooks.run("after-highlight",H),l.hooks.run("complete",H),y&&y.call(H.element)}if(l.hooks.run("before-sanity-check",H),I=H.element.parentElement,I&&I.nodeName.toLowerCase()==="pre"&&!I.hasAttribute("tabindex")&&I.setAttribute("tabindex","0"),!H.code){l.hooks.run("complete",H),y&&y.call(H.element);return}if(l.hooks.run("before-highlight",H),!H.grammar){K(l.util.encode(H.code));return}if(b&&n.Worker){var re=new Worker(l.filename);re.onmessage=function(pe){K(pe.data)},re.postMessage(JSON.stringify({language:H.language,code:H.code,immediateClose:!0}))}else K(l.highlight(H.code,H.grammar,H.language))},highlight:function(m,b,y){var S={code:m,grammar:b,language:y};if(l.hooks.run("before-tokenize",S),!S.grammar)throw new Error('The language "'+S.language+'" has no grammar.');return S.tokens=l.tokenize(S.code,S.grammar),l.hooks.run("after-tokenize",S),a.stringify(l.util.encode(S.tokens),S.language)},tokenize:function(m,b){var y=b.rest;if(y){for(var S in y)b[S]=y[S];delete b.rest}var O=new f;return p(O,O.head,m),c(m,O,b,O.head,0),_(O)},hooks:{all:{},add:function(m,b){var y=l.hooks.all;y[m]=y[m]||[],y[m].push(b)},run:function(m,b){var y=l.hooks.all[m];if(!(!y||!y.length))for(var S=0,O;O=y[S++];)O(b)}},Token:a};n.Prism=l;function a(m,b,y,S){this.type=m,this.content=b,this.alias=y,this.length=(S||"").length|0}a.stringify=function m(b,y){if(typeof b=="string")return b;if(Array.isArray(b)){var S="";return b.forEach(function(K){S+=m(K,y)}),S}var O={type:b.type,content:m(b.content,y),tag:"span",classes:["token",b.type],attributes:{},language:y},I=b.alias;I&&(Array.isArray(I)?Array.prototype.push.apply(O.classes,I):O.classes.push(I)),l.hooks.run("wrap",O);var W="";for(var H in O.attributes)W+=" "+H+'="'+(O.attributes[H]||"").replace(/"/g,""")+'"';return"<"+O.tag+' class="'+O.classes.join(" ")+'"'+W+">"+O.content+""};function u(m,b,y,S){m.lastIndex=b;var O=m.exec(y);if(O&&S&&O[1]){var I=O[1].length;O.index+=I,O[0]=O[0].slice(I)}return O}function c(m,b,y,S,O,I){for(var W in y)if(!(!y.hasOwnProperty(W)||!y[W])){var H=y[W];H=Array.isArray(H)?H:[H];for(var K=0;K=I.reach);ae+=$.value.length,$=$.next){var ye=$.value;if(b.length>m.length)return;if(!(ye instanceof a)){var Ae=1,te;if(ot){if(te=u(Q,ae,m,Le),!te||te.index>=m.length)break;var fe=te.index,ct=te.index+te[0].length,we=ae;for(we+=$.value.length;fe>=we;)$=$.next,we+=$.value.length;if(we-=$.value.length,ae=we,$.value instanceof a)continue;for(var Ve=$;Ve!==b.tail&&(weI.reach&&(I.reach=B);var Y=$.prev;N&&(Y=p(b,Y,N),ae+=N.length),g(b,Y,Ae);var h=new a(W,pe?l.tokenize(A,pe):A,at,A);if($=p(b,Y,h),k&&p(b,$,k),Ae>1){var d={cause:W+","+K,reach:B};c(m,b,y,$.prev,ae,d),I&&d.reach>I.reach&&(I.reach=d.reach)}}}}}}function f(){var m={value:null,prev:null,next:null},b={value:null,prev:m,next:null};m.next=b,this.head=m,this.tail=b,this.length=0}function p(m,b,y){var S=b.next,O={value:y,prev:b,next:S};return b.next=O,S.prev=O,m.length++,O}function g(m,b,y){for(var S=b.next,O=0;O/,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]},s.languages.markup.tag.inside["attr-value"].inside.entity=s.languages.markup.entity,s.languages.markup.doctype.inside["internal-subset"].inside=s.languages.markup,s.hooks.add("wrap",function(n){n.type==="entity"&&(n.attributes.title=n.content.replace(/&/,"&"))}),Object.defineProperty(s.languages.markup.tag,"addInlined",{value:function(i,r){var o={};o["language-"+r]={pattern:/(^$)/i,lookbehind:!0,inside:s.languages[r]},o.cdata=/^$/i;var l={"included-cdata":{pattern://i,inside:o}};l["language-"+r]={pattern:/[\s\S]+/,inside:s.languages[r]};var a={};a[i]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return i}),"i"),lookbehind:!0,greedy:!0,inside:l},s.languages.insertBefore("markup","cdata",a)}}),Object.defineProperty(s.languages.markup.tag,"addAttribute",{value:function(n,i){s.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+n+")"+/\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:[i,"language-"+i],inside:s.languages[i]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),s.languages.html=s.languages.markup,s.languages.mathml=s.languages.markup,s.languages.svg=s.languages.markup,s.languages.xml=s.languages.extend("markup",{}),s.languages.ssml=s.languages.xml,s.languages.atom=s.languages.xml,s.languages.rss=s.languages.xml,function(n){var i=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;n.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+i.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\\((?:"+i.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+i.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+i.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:i,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:/[(){};:,]/},n.languages.css.atrule.inside.rest=n.languages.css;var r=n.languages.markup;r&&(r.tag.addInlined("style","css"),r.tag.addAttribute("style","css"))}(s),s.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:/[{}[\];(),.:]/},s.languages.javascript=s.languages.extend("clike",{"class-name":[s.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}|\?\?=?|\?\.?|[~:]/}),s.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,s.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:s.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:s.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:s.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:s.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:s.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),s.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:s.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"}}),s.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),s.languages.markup&&(s.languages.markup.tag.addInlined("script","javascript"),s.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")),s.languages.js=s.languages.javascript,function(){if(typeof s>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var n="Loading…",i=function(C,D){return"✖ Error "+C+" while fetching file: "+D},r="✖ Error: File does not exist or is empty",o={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},l="data-src-status",a="loading",u="loaded",c="failed",f="pre[data-src]:not(["+l+'="'+u+'"]):not(['+l+'="'+a+'"])';function p(C,D,T){var m=new XMLHttpRequest;m.open("GET",C,!0),m.onreadystatechange=function(){m.readyState==4&&(m.status<400&&m.responseText?D(m.responseText):m.status>=400?T(i(m.status,m.statusText)):T(r))},m.send(null)}function g(C){var D=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(C||"");if(D){var T=Number(D[1]),m=D[2],b=D[3];return m?b?[T,Number(b)]:[T,void 0]:[T,T]}}s.hooks.add("before-highlightall",function(C){C.selector+=", "+f}),s.hooks.add("before-sanity-check",function(C){var D=C.element;if(D.matches(f)){C.code="",D.setAttribute(l,a);var T=D.appendChild(document.createElement("CODE"));T.textContent=n;var m=D.getAttribute("data-src"),b=C.language;if(b==="none"){var y=(/\.(\w+)$/.exec(m)||[,"none"])[1];b=o[y]||y}s.util.setLanguage(T,b),s.util.setLanguage(D,b);var S=s.plugins.autoloader;S&&S.loadLanguages(b),p(m,function(O){D.setAttribute(l,u);var I=g(D.getAttribute("data-range"));if(I){var W=O.split(/\r\n?|\n/g),H=I[0],K=I[1]==null?W.length:I[1];H<0&&(H+=W.length),H=Math.max(0,Math.min(H-1,W.length)),K<0&&(K+=W.length),K=Math.max(0,Math.min(K,W.length)),O=W.slice(H,K).join(` `),D.hasAttribute("data-start")||D.setAttribute("data-start",String(H+1))}T.textContent=O,s.highlightElement(T)},function(O){D.setAttribute(l,c),T.textContent=O})}}),s.plugins.fileHighlight={highlight:function(D){for(var T=(D||document).querySelectorAll(f),m=0,b;b=T[m++];)s.highlightElement(b)}};var _=!1;s.fileHighlight=function(){_||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),_=!0),s.plugins.fileHighlight.highlight.apply(this,arguments)}}()}(Ks)),Ks.exports}var Qc=Yc();const Jc=sl(Qc);var Ys={exports:{}},ki;function Zc(){return ki||(ki=1,function(t){(function(){if(typeof Prism>"u")return;var e=Object.assign||function(o,l){for(var a in l)l.hasOwnProperty(a)&&(o[a]=l[a]);return o};function s(o){this.defaults=e({},o)}function n(o){return o.replace(/-(\w)/g,function(l,a){return a.toUpperCase()})}function i(o){for(var l=0,a=0;al&&(c[p]=` `+c[p],f=g)}a[u]=c.join("")}return a.join(` -`)}},t.exports&&(t.exports=s),Prism.plugins.NormalizeWhitespace=new s({"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0}),Prism.hooks.add("before-sanity-check",function(o){var l=Prism.plugins.NormalizeWhitespace;if(!(o.settings&&o.settings["whitespace-normalization"]===!1)&&Prism.util.isActive(o.element,"whitespace-normalization",!0)){if((!o.element||!o.element.parentNode)&&o.code){o.code=l.normalize(o.code,o.settings);return}var a=o.element.parentNode;if(!(!o.code||!a||a.nodeName.toLowerCase()!=="pre")){o.settings==null&&(o.settings={});for(var u in r)if(Object.hasOwnProperty.call(r,u)){var c=r[u];if(a.hasAttribute("data-"+u))try{var f=JSON.parse(a.getAttribute("data-"+u)||"true");typeof f===c&&(o.settings[u]=f)}catch{}}for(var p=a.childNodes,g="",_="",C=!1,D=0;D"u"||typeof document>"u")return;var t=[],e={},s=function(){};Prism.plugins.toolbar={};var n=Prism.plugins.toolbar.registerButton=function(o,l){var a;if(typeof l=="function"?a=l:a=function(u){var c;return typeof l.onClick=="function"?(c=document.createElement("button"),c.type="button",c.addEventListener("click",function(){l.onClick.call(this,u)})):typeof l.url=="string"?(c=document.createElement("a"),c.href=l.url):c=document.createElement("span"),l.className&&c.classList.add(l.className),c.textContent=l.text,c},o in e){console.warn('There is a button with the key "'+o+'" registered already.');return}t.push(e[o]=a)};function i(o){for(;o;){var l=o.getAttribute("data-toolbar-order");if(l!=null)return l=l.trim(),l.length?l.split(/\s*,\s*/g):[];o=o.parentElement}}var r=Prism.plugins.toolbar.hook=function(o){var l=o.element.parentNode;if(!(!l||!/pre/i.test(l.nodeName))&&!l.parentNode.classList.contains("code-toolbar")){var a=document.createElement("div");a.classList.add("code-toolbar"),l.parentNode.insertBefore(a,l),a.appendChild(l);var u=document.createElement("div");u.classList.add("toolbar");var c=t,f=i(o.element);f&&(c=f.map(function(p){return e[p]||s})),c.forEach(function(p){var g=p(o);if(g){var _=document.createElement("div");_.classList.add("toolbar-item"),_.appendChild(g),u.appendChild(_)}}),a.appendChild(u)}};n("label",function(o){var l=o.element.parentNode;if(!(!l||!/pre/i.test(l.nodeName))&&l.hasAttribute("data-label")){var a,u,c=l.getAttribute("data-label");try{u=document.querySelector("template#"+c)}catch{}return u?a=u.content:(l.hasAttribute("data-url")?(a=document.createElement("a"),a.href=l.getAttribute("data-url")):a=document.createElement("span"),a.textContent=c),a}}),Prism.hooks.add("complete",r)})();new eu({"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0});const In=xa(Kc);In.use(Pc);In.mixin({updated(){Jc.highlightAll()}});In.mount("#app");export{Re as F,ue as O,Nc as S,zc as _,Ze as a,Uo as b,Nr as c,Ts as d,ds as e,de as f,sl as g,tu as h,$o as i,ir as j,mr as k,su as l,bn as n,Zt as o,$n as r,Vi as t,Gl as w}; +`)}},t.exports&&(t.exports=s),Prism.plugins.NormalizeWhitespace=new s({"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0}),Prism.hooks.add("before-sanity-check",function(o){var l=Prism.plugins.NormalizeWhitespace;if(!(o.settings&&o.settings["whitespace-normalization"]===!1)&&Prism.util.isActive(o.element,"whitespace-normalization",!0)){if((!o.element||!o.element.parentNode)&&o.code){o.code=l.normalize(o.code,o.settings);return}var a=o.element.parentNode;if(!(!o.code||!a||a.nodeName.toLowerCase()!=="pre")){o.settings==null&&(o.settings={});for(var u in r)if(Object.hasOwnProperty.call(r,u)){var c=r[u];if(a.hasAttribute("data-"+u))try{var f=JSON.parse(a.getAttribute("data-"+u)||"true");typeof f===c&&(o.settings[u]=f)}catch{}}for(var p=a.childNodes,g="",_="",C=!1,D=0;D"u"||typeof document>"u")return;var t=[],e={},s=function(){};Prism.plugins.toolbar={};var n=Prism.plugins.toolbar.registerButton=function(o,l){var a;if(typeof l=="function"?a=l:a=function(u){var c;return typeof l.onClick=="function"?(c=document.createElement("button"),c.type="button",c.addEventListener("click",function(){l.onClick.call(this,u)})):typeof l.url=="string"?(c=document.createElement("a"),c.href=l.url):c=document.createElement("span"),l.className&&c.classList.add(l.className),c.textContent=l.text,c},o in e){console.warn('There is a button with the key "'+o+'" registered already.');return}t.push(e[o]=a)};function i(o){for(;o;){var l=o.getAttribute("data-toolbar-order");if(l!=null)return l=l.trim(),l.length?l.split(/\s*,\s*/g):[];o=o.parentElement}}var r=Prism.plugins.toolbar.hook=function(o){var l=o.element.parentNode;if(!(!l||!/pre/i.test(l.nodeName))&&!l.parentNode.classList.contains("code-toolbar")){var a=document.createElement("div");a.classList.add("code-toolbar"),l.parentNode.insertBefore(a,l),a.appendChild(l);var u=document.createElement("div");u.classList.add("toolbar");var c=t,f=i(o.element);f&&(c=f.map(function(p){return e[p]||s})),c.forEach(function(p){var g=p(o);if(g){var _=document.createElement("div");_.classList.add("toolbar-item"),_.appendChild(g),u.appendChild(_)}}),a.appendChild(u)}};n("label",function(o){var l=o.element.parentNode;if(!(!l||!/pre/i.test(l.nodeName))&&l.hasAttribute("data-label")){var a,u,c=l.getAttribute("data-label");try{u=document.querySelector("template#"+c)}catch{}return u?a=u.content:(l.hasAttribute("data-url")?(a=document.createElement("a"),a.href=l.getAttribute("data-url")):a=document.createElement("span"),a.textContent=c),a}}),Prism.hooks.add("complete",r)})();new eu({"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0});const Fn=xa(Kc);Fn.use(Pc);Fn.mixin({updated(){Jc.highlightAll()}});Fn.mount("#app");export{Re as F,ue as O,Nc as S,zc as _,Ze as a,Uo as b,Nr as c,Ts as d,ds as e,de as f,sl as g,tu as h,$o as i,ir as j,mr as k,su as l,bn as n,Zt as o,$n as r,Vi as t,Gl as w}; From 6d4a7c8c0be18684bc46b4c0fcb12c1eaa4aed18 Mon Sep 17 00:00:00 2001 From: Tiberiu Dumitru Date: Thu, 11 Sep 2025 16:39:52 +0300 Subject: [PATCH 7/8] Accessibility refactor. --- dist/render.d.ts | 1 + dist/slimselect.cjs.js | 100 +++++++--- dist/slimselect.es.js | 100 +++++++--- dist/slimselect.global.js | 100 +++++++--- dist/slimselect.js | 100 +++++++--- dist/slimselect.min.js | 2 +- dist/slimselect.umd.js | 100 +++++++--- dist/slimselect.umd.min.js | 2 +- docs/assets/index.js | 14 +- src/slim-select/render.test.ts | 218 +++++++++----------- src/slim-select/render.ts | 353 +++++++++++++++++---------------- 11 files changed, 635 insertions(+), 455 deletions(-) diff --git a/dist/render.d.ts b/dist/render.d.ts index 2f485532..ee440fbd 100644 --- a/dist/render.d.ts +++ b/dist/render.d.ts @@ -47,6 +47,7 @@ export default class Render { private static _liveAssertive; private static getLiveAssertive; private _announceAssertive; + private clearHighlights; main: Main; content: Content; private scrollHandler; diff --git a/dist/slimselect.cjs.js b/dist/slimselect.cjs.js index 76d4dc09..e86b63a9 100644 --- a/dist/slimselect.cjs.js +++ b/dist/slimselect.cjs.js @@ -383,6 +383,11 @@ class Render { el.textContent = ''; requestAnimationFrame(() => { el.textContent = msg; }); } + clearHighlights() { + const highlighted = this.content.list.querySelectorAll('.' + this.classes.highlighted); + highlighted.forEach(el => el.classList.remove(this.classes.highlighted)); + this.content.search.input.removeAttribute('aria-activedescendant'); + } constructor(settings, classes, store, callbacks) { var _a; this.store = store; @@ -393,6 +398,7 @@ class Render { this.main = this.mainDiv(); this.content = this.contentDiv(); this.updateClassStyles(); + this.main.values.setAttribute('role', 'list'); this.updateAriaAttributes(); const contentContainer = (_a = document .querySelector(`[data-id="${this.settings.id}"]`)) === null || _a === void 0 ? void 0 : _a.closest('.offcanvas-body'); @@ -432,7 +438,7 @@ class Render { 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.content.search.input.setAttribute('aria-expanded', 'true'); this.moveContent(); const selectedOptions = this.store.getSelectedOptions(); if (selectedOptions.length) { @@ -452,11 +458,9 @@ class Render { this.searchFocus(); } 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.main.classList.remove(this.classes.openAbove, this.classes.openBelow); + this.content.search.input.setAttribute('aria-expanded', 'false'); + this.content.main.classList.remove(this.classes.openAbove, this.classes.openBelow); this.main.arrow.path.setAttribute('d', this.classes.arrowClose); if (this.scrollHandler) { window.removeEventListener('scroll', this.scrollHandler, true); @@ -466,8 +470,8 @@ class Render { window.removeEventListener('resize', this.resizeHandler); this.resizeHandler = undefined; } + this.clearHighlights(); this.main.main.focus({ preventScroll: true }); - this.main.main.removeAttribute('aria-activedescendant'); } updateClassStyles() { this.main.main.className = ''; @@ -502,13 +506,15 @@ class Render { if (this.settings.isMultiple) { this.content.list.setAttribute('aria-multiselectable', 'true'); } - this.main.main.setAttribute('role', 'combobox'); - this.main.main.setAttribute('aria-haspopup', 'listbox'); - this.main.main.setAttribute('aria-controls', this.content.list.id); - this.main.main.setAttribute('aria-expanded', 'false'); - this.main.main.setAttribute('aria-autocomplete', 'list'); this.main.main.removeAttribute('aria-labelledby'); this.main.main.removeAttribute('aria-label'); + const input = this.content.search.input; + input.setAttribute('role', 'combobox'); + input.setAttribute('aria-haspopup', 'listbox'); + input.setAttribute('aria-controls', this.content.list.id); + input.setAttribute('aria-owns', this.content.list.id); + input.setAttribute('aria-expanded', 'false'); + input.setAttribute('aria-autocomplete', 'list'); let labelledById = (this.settings.ariaLabelledBy || '').trim(); let labelEl = null; if (!labelledById) { @@ -537,7 +543,6 @@ class Render { else if (this.settings.ariaLabel && this.settings.ariaLabel.trim()) { this.main.main.setAttribute('aria-label', this.settings.ariaLabel.trim()); } - this.main.main.setAttribute('aria-owns', this.content.list.id); this.content.search.input.setAttribute('aria-controls', this.content.list.id); this.content.search.input.setAttribute('aria-autocomplete', 'list'); if (labelledById && document.getElementById(labelledById)) { @@ -559,6 +564,8 @@ class Render { main.id = this.settings.id + '-main'; main.tabIndex = 0; main.onkeydown = (e) => { + if (e.target !== main) + return true; switch (e.key) { case 'ArrowUp': case 'ArrowDown': @@ -572,9 +579,8 @@ class Render { case ' ': this.callbacks.open(); const highlighted = this.content.list.querySelector('.' + this.classes.highlighted); - if (highlighted) { + if (highlighted) highlighted.click(); - } return false; case 'Escape': this.callbacks.close(); @@ -602,6 +608,7 @@ class Render { deselect.addEventListener('keydown', (e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); + e.stopPropagation(); deselect.click(); } }); @@ -813,28 +820,35 @@ class Render { const value = document.createElement('div'); value.classList.add(this.classes.value); value.dataset.id = option.id; + value.setAttribute('role', 'listitem'); + value.tabIndex = 0; + value.setAttribute('aria-label', option.text); const text = document.createElement('div'); text.classList.add(this.classes.valueText); text.textContent = option.text; value.appendChild(text); + let deleteDiv = null; if (!option.mandatory) { - const deleteDiv = document.createElement('div'); + const hintId = `${this.settings.id}__chip__${option.id}__hint`; + const hint = document.createElement('span'); + hint.id = hintId; + hint.className = 'ss-sr-only'; + hint.textContent = 'Press Delete or Backspace to remove.'; + value.appendChild(hint); + deleteDiv = document.createElement('div'); deleteDiv.classList.add(this.classes.valueDelete); deleteDiv.setAttribute('role', 'button'); - deleteDiv.setAttribute('aria-label', 'Remove selection'); - deleteDiv.setAttribute('title', 'Remove selection'); - deleteDiv.setAttribute('tabindex', '0'); + deleteDiv.setAttribute('aria-label', `Remove ${option.text}`); + deleteDiv.setAttribute('aria-hidden', 'true'); + deleteDiv.tabIndex = -1; deleteDiv.onclick = (e) => { e.preventDefault(); e.stopPropagation(); - if (this.settings.disabled) { + if (this.settings.disabled) return; - } let shouldDelete = true; const before = this.store.getSelectedOptions(); - const after = before.filter((o) => { - return o.selected && o.id !== option.id; - }, true); + const after = before.filter((o) => o.selected && o.id !== option.id, true); if (this.settings.minSelected && after.length < this.settings.minSelected) { return; } @@ -842,12 +856,11 @@ class Render { shouldDelete = this.callbacks.beforeChange(after, before) === true; } if (shouldDelete) { - let selectedIds = []; + const selectedIds = []; for (const o of after) { if (o instanceof Optgroup) { - for (const c of o.options) { + for (const c of o.options) selectedIds.push(c.id); - } } if (o instanceof Option) { selectedIds.push(o.id); @@ -861,6 +874,9 @@ class Render { this.callbacks.afterChange(after); } this.updateDeselectAll(); + requestAnimationFrame(() => { + this.main.main.focus({ preventScroll: true }); + }); } }; const deleteSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); @@ -875,9 +891,31 @@ class Render { deleteDiv.onkeydown = (e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); + e.stopPropagation(); deleteDiv.click(); } }; + value.addEventListener('keydown', (e) => { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault(); + e.stopPropagation(); + } + else if (e.key === 'Delete' || e.key === 'Backspace') { + e.preventDefault(); + e.stopPropagation(); + deleteDiv === null || deleteDiv === void 0 ? void 0 : deleteDiv.click(); + } + }); + value.addEventListener('focusin', () => { + value.setAttribute('aria-describedby', hintId); + deleteDiv.removeAttribute('aria-hidden'); + deleteDiv.tabIndex = 0; + }); + value.addEventListener('focusout', () => { + value.removeAttribute('aria-describedby'); + deleteDiv.setAttribute('aria-hidden', 'true'); + deleteDiv.tabIndex = -1; + }); } return value; } @@ -927,7 +965,7 @@ class Render { main.classList.add(this.classes.hide); input.readOnly = true; } - input.type = 'search'; + input.type = 'text'; input.placeholder = this.settings.searchPlaceholder; input.tabIndex = -1; if (this.settings.searchLabelledBy && this.settings.searchLabelledBy.trim()) { @@ -1117,7 +1155,7 @@ class Render { } let selectOption = options[dir === 'down' ? (i + 1 < options.length ? i + 1 : 0) : i - 1 >= 0 ? i - 1 : options.length - 1]; selectOption.classList.add(this.classes.highlighted); - this.main.main.setAttribute('aria-activedescendant', selectOption.id); + this.content.search.input.setAttribute('aria-activedescendant', selectOption.id); this.ensureElementInView(this.content.list, selectOption); const selectParent = selectOption.parentElement; if (selectParent && selectParent.classList.contains(this.classes.close)) { @@ -1131,7 +1169,7 @@ class Render { } const newly = options[dir === 'down' ? 0 : options.length - 1]; newly.classList.add(this.classes.highlighted); - this.main.main.setAttribute('aria-activedescendant', newly.id); + this.content.search.input.setAttribute('aria-activedescendant', newly.id); this.ensureElementInView(this.content.list, newly); } listDiv() { @@ -1372,7 +1410,7 @@ class Render { if (option.selected) { optionEl.classList.add(this.classes.selected); optionEl.setAttribute('aria-selected', 'true'); - this.main.main.setAttribute('aria-activedescendant', optionEl.id); + this.content.search.input.setAttribute('aria-activedescendant', optionEl.id); } else { optionEl.classList.remove(this.classes.selected); diff --git a/dist/slimselect.es.js b/dist/slimselect.es.js index 96681fc4..eec7cc39 100644 --- a/dist/slimselect.es.js +++ b/dist/slimselect.es.js @@ -381,6 +381,11 @@ class Render { el.textContent = ''; requestAnimationFrame(() => { el.textContent = msg; }); } + clearHighlights() { + const highlighted = this.content.list.querySelectorAll('.' + this.classes.highlighted); + highlighted.forEach(el => el.classList.remove(this.classes.highlighted)); + this.content.search.input.removeAttribute('aria-activedescendant'); + } constructor(settings, classes, store, callbacks) { var _a; this.store = store; @@ -391,6 +396,7 @@ class Render { this.main = this.mainDiv(); this.content = this.contentDiv(); this.updateClassStyles(); + this.main.values.setAttribute('role', 'list'); this.updateAriaAttributes(); const contentContainer = (_a = document .querySelector(`[data-id="${this.settings.id}"]`)) === null || _a === void 0 ? void 0 : _a.closest('.offcanvas-body'); @@ -430,7 +436,7 @@ class Render { 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.content.search.input.setAttribute('aria-expanded', 'true'); this.moveContent(); const selectedOptions = this.store.getSelectedOptions(); if (selectedOptions.length) { @@ -450,11 +456,9 @@ class Render { this.searchFocus(); } 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.main.classList.remove(this.classes.openAbove, this.classes.openBelow); + this.content.search.input.setAttribute('aria-expanded', 'false'); + this.content.main.classList.remove(this.classes.openAbove, this.classes.openBelow); this.main.arrow.path.setAttribute('d', this.classes.arrowClose); if (this.scrollHandler) { window.removeEventListener('scroll', this.scrollHandler, true); @@ -464,8 +468,8 @@ class Render { window.removeEventListener('resize', this.resizeHandler); this.resizeHandler = undefined; } + this.clearHighlights(); this.main.main.focus({ preventScroll: true }); - this.main.main.removeAttribute('aria-activedescendant'); } updateClassStyles() { this.main.main.className = ''; @@ -500,13 +504,15 @@ class Render { if (this.settings.isMultiple) { this.content.list.setAttribute('aria-multiselectable', 'true'); } - this.main.main.setAttribute('role', 'combobox'); - this.main.main.setAttribute('aria-haspopup', 'listbox'); - this.main.main.setAttribute('aria-controls', this.content.list.id); - this.main.main.setAttribute('aria-expanded', 'false'); - this.main.main.setAttribute('aria-autocomplete', 'list'); this.main.main.removeAttribute('aria-labelledby'); this.main.main.removeAttribute('aria-label'); + const input = this.content.search.input; + input.setAttribute('role', 'combobox'); + input.setAttribute('aria-haspopup', 'listbox'); + input.setAttribute('aria-controls', this.content.list.id); + input.setAttribute('aria-owns', this.content.list.id); + input.setAttribute('aria-expanded', 'false'); + input.setAttribute('aria-autocomplete', 'list'); let labelledById = (this.settings.ariaLabelledBy || '').trim(); let labelEl = null; if (!labelledById) { @@ -535,7 +541,6 @@ class Render { else if (this.settings.ariaLabel && this.settings.ariaLabel.trim()) { this.main.main.setAttribute('aria-label', this.settings.ariaLabel.trim()); } - this.main.main.setAttribute('aria-owns', this.content.list.id); this.content.search.input.setAttribute('aria-controls', this.content.list.id); this.content.search.input.setAttribute('aria-autocomplete', 'list'); if (labelledById && document.getElementById(labelledById)) { @@ -557,6 +562,8 @@ class Render { main.id = this.settings.id + '-main'; main.tabIndex = 0; main.onkeydown = (e) => { + if (e.target !== main) + return true; switch (e.key) { case 'ArrowUp': case 'ArrowDown': @@ -570,9 +577,8 @@ class Render { case ' ': this.callbacks.open(); const highlighted = this.content.list.querySelector('.' + this.classes.highlighted); - if (highlighted) { + if (highlighted) highlighted.click(); - } return false; case 'Escape': this.callbacks.close(); @@ -600,6 +606,7 @@ class Render { deselect.addEventListener('keydown', (e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); + e.stopPropagation(); deselect.click(); } }); @@ -811,28 +818,35 @@ class Render { const value = document.createElement('div'); value.classList.add(this.classes.value); value.dataset.id = option.id; + value.setAttribute('role', 'listitem'); + value.tabIndex = 0; + value.setAttribute('aria-label', option.text); const text = document.createElement('div'); text.classList.add(this.classes.valueText); text.textContent = option.text; value.appendChild(text); + let deleteDiv = null; if (!option.mandatory) { - const deleteDiv = document.createElement('div'); + const hintId = `${this.settings.id}__chip__${option.id}__hint`; + const hint = document.createElement('span'); + hint.id = hintId; + hint.className = 'ss-sr-only'; + hint.textContent = 'Press Delete or Backspace to remove.'; + value.appendChild(hint); + deleteDiv = document.createElement('div'); deleteDiv.classList.add(this.classes.valueDelete); deleteDiv.setAttribute('role', 'button'); - deleteDiv.setAttribute('aria-label', 'Remove selection'); - deleteDiv.setAttribute('title', 'Remove selection'); - deleteDiv.setAttribute('tabindex', '0'); + deleteDiv.setAttribute('aria-label', `Remove ${option.text}`); + deleteDiv.setAttribute('aria-hidden', 'true'); + deleteDiv.tabIndex = -1; deleteDiv.onclick = (e) => { e.preventDefault(); e.stopPropagation(); - if (this.settings.disabled) { + if (this.settings.disabled) return; - } let shouldDelete = true; const before = this.store.getSelectedOptions(); - const after = before.filter((o) => { - return o.selected && o.id !== option.id; - }, true); + const after = before.filter((o) => o.selected && o.id !== option.id, true); if (this.settings.minSelected && after.length < this.settings.minSelected) { return; } @@ -840,12 +854,11 @@ class Render { shouldDelete = this.callbacks.beforeChange(after, before) === true; } if (shouldDelete) { - let selectedIds = []; + const selectedIds = []; for (const o of after) { if (o instanceof Optgroup) { - for (const c of o.options) { + for (const c of o.options) selectedIds.push(c.id); - } } if (o instanceof Option) { selectedIds.push(o.id); @@ -859,6 +872,9 @@ class Render { this.callbacks.afterChange(after); } this.updateDeselectAll(); + requestAnimationFrame(() => { + this.main.main.focus({ preventScroll: true }); + }); } }; const deleteSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); @@ -873,9 +889,31 @@ class Render { deleteDiv.onkeydown = (e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); + e.stopPropagation(); deleteDiv.click(); } }; + value.addEventListener('keydown', (e) => { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault(); + e.stopPropagation(); + } + else if (e.key === 'Delete' || e.key === 'Backspace') { + e.preventDefault(); + e.stopPropagation(); + deleteDiv === null || deleteDiv === void 0 ? void 0 : deleteDiv.click(); + } + }); + value.addEventListener('focusin', () => { + value.setAttribute('aria-describedby', hintId); + deleteDiv.removeAttribute('aria-hidden'); + deleteDiv.tabIndex = 0; + }); + value.addEventListener('focusout', () => { + value.removeAttribute('aria-describedby'); + deleteDiv.setAttribute('aria-hidden', 'true'); + deleteDiv.tabIndex = -1; + }); } return value; } @@ -925,7 +963,7 @@ class Render { main.classList.add(this.classes.hide); input.readOnly = true; } - input.type = 'search'; + input.type = 'text'; input.placeholder = this.settings.searchPlaceholder; input.tabIndex = -1; if (this.settings.searchLabelledBy && this.settings.searchLabelledBy.trim()) { @@ -1115,7 +1153,7 @@ class Render { } let selectOption = options[dir === 'down' ? (i + 1 < options.length ? i + 1 : 0) : i - 1 >= 0 ? i - 1 : options.length - 1]; selectOption.classList.add(this.classes.highlighted); - this.main.main.setAttribute('aria-activedescendant', selectOption.id); + this.content.search.input.setAttribute('aria-activedescendant', selectOption.id); this.ensureElementInView(this.content.list, selectOption); const selectParent = selectOption.parentElement; if (selectParent && selectParent.classList.contains(this.classes.close)) { @@ -1129,7 +1167,7 @@ class Render { } const newly = options[dir === 'down' ? 0 : options.length - 1]; newly.classList.add(this.classes.highlighted); - this.main.main.setAttribute('aria-activedescendant', newly.id); + this.content.search.input.setAttribute('aria-activedescendant', newly.id); this.ensureElementInView(this.content.list, newly); } listDiv() { @@ -1370,7 +1408,7 @@ class Render { if (option.selected) { optionEl.classList.add(this.classes.selected); optionEl.setAttribute('aria-selected', 'true'); - this.main.main.setAttribute('aria-activedescendant', optionEl.id); + this.content.search.input.setAttribute('aria-activedescendant', optionEl.id); } else { optionEl.classList.remove(this.classes.selected); diff --git a/dist/slimselect.global.js b/dist/slimselect.global.js index 9ff98bd9..75018734 100644 --- a/dist/slimselect.global.js +++ b/dist/slimselect.global.js @@ -384,6 +384,11 @@ var SlimSelect = (function () { el.textContent = ''; requestAnimationFrame(() => { el.textContent = msg; }); } + clearHighlights() { + const highlighted = this.content.list.querySelectorAll('.' + this.classes.highlighted); + highlighted.forEach(el => el.classList.remove(this.classes.highlighted)); + this.content.search.input.removeAttribute('aria-activedescendant'); + } constructor(settings, classes, store, callbacks) { var _a; this.store = store; @@ -394,6 +399,7 @@ var SlimSelect = (function () { this.main = this.mainDiv(); this.content = this.contentDiv(); this.updateClassStyles(); + this.main.values.setAttribute('role', 'list'); this.updateAriaAttributes(); const contentContainer = (_a = document .querySelector(`[data-id="${this.settings.id}"]`)) === null || _a === void 0 ? void 0 : _a.closest('.offcanvas-body'); @@ -433,7 +439,7 @@ var SlimSelect = (function () { 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.content.search.input.setAttribute('aria-expanded', 'true'); this.moveContent(); const selectedOptions = this.store.getSelectedOptions(); if (selectedOptions.length) { @@ -453,11 +459,9 @@ var SlimSelect = (function () { this.searchFocus(); } 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.main.classList.remove(this.classes.openAbove, this.classes.openBelow); + this.content.search.input.setAttribute('aria-expanded', 'false'); + this.content.main.classList.remove(this.classes.openAbove, this.classes.openBelow); this.main.arrow.path.setAttribute('d', this.classes.arrowClose); if (this.scrollHandler) { window.removeEventListener('scroll', this.scrollHandler, true); @@ -467,8 +471,8 @@ var SlimSelect = (function () { window.removeEventListener('resize', this.resizeHandler); this.resizeHandler = undefined; } + this.clearHighlights(); this.main.main.focus({ preventScroll: true }); - this.main.main.removeAttribute('aria-activedescendant'); } updateClassStyles() { this.main.main.className = ''; @@ -503,13 +507,15 @@ var SlimSelect = (function () { if (this.settings.isMultiple) { this.content.list.setAttribute('aria-multiselectable', 'true'); } - this.main.main.setAttribute('role', 'combobox'); - this.main.main.setAttribute('aria-haspopup', 'listbox'); - this.main.main.setAttribute('aria-controls', this.content.list.id); - this.main.main.setAttribute('aria-expanded', 'false'); - this.main.main.setAttribute('aria-autocomplete', 'list'); this.main.main.removeAttribute('aria-labelledby'); this.main.main.removeAttribute('aria-label'); + const input = this.content.search.input; + input.setAttribute('role', 'combobox'); + input.setAttribute('aria-haspopup', 'listbox'); + input.setAttribute('aria-controls', this.content.list.id); + input.setAttribute('aria-owns', this.content.list.id); + input.setAttribute('aria-expanded', 'false'); + input.setAttribute('aria-autocomplete', 'list'); let labelledById = (this.settings.ariaLabelledBy || '').trim(); let labelEl = null; if (!labelledById) { @@ -538,7 +544,6 @@ var SlimSelect = (function () { else if (this.settings.ariaLabel && this.settings.ariaLabel.trim()) { this.main.main.setAttribute('aria-label', this.settings.ariaLabel.trim()); } - this.main.main.setAttribute('aria-owns', this.content.list.id); this.content.search.input.setAttribute('aria-controls', this.content.list.id); this.content.search.input.setAttribute('aria-autocomplete', 'list'); if (labelledById && document.getElementById(labelledById)) { @@ -560,6 +565,8 @@ var SlimSelect = (function () { main.id = this.settings.id + '-main'; main.tabIndex = 0; main.onkeydown = (e) => { + if (e.target !== main) + return true; switch (e.key) { case 'ArrowUp': case 'ArrowDown': @@ -573,9 +580,8 @@ var SlimSelect = (function () { case ' ': this.callbacks.open(); const highlighted = this.content.list.querySelector('.' + this.classes.highlighted); - if (highlighted) { + if (highlighted) highlighted.click(); - } return false; case 'Escape': this.callbacks.close(); @@ -603,6 +609,7 @@ var SlimSelect = (function () { deselect.addEventListener('keydown', (e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); + e.stopPropagation(); deselect.click(); } }); @@ -814,28 +821,35 @@ var SlimSelect = (function () { const value = document.createElement('div'); value.classList.add(this.classes.value); value.dataset.id = option.id; + value.setAttribute('role', 'listitem'); + value.tabIndex = 0; + value.setAttribute('aria-label', option.text); const text = document.createElement('div'); text.classList.add(this.classes.valueText); text.textContent = option.text; value.appendChild(text); + let deleteDiv = null; if (!option.mandatory) { - const deleteDiv = document.createElement('div'); + const hintId = `${this.settings.id}__chip__${option.id}__hint`; + const hint = document.createElement('span'); + hint.id = hintId; + hint.className = 'ss-sr-only'; + hint.textContent = 'Press Delete or Backspace to remove.'; + value.appendChild(hint); + deleteDiv = document.createElement('div'); deleteDiv.classList.add(this.classes.valueDelete); deleteDiv.setAttribute('role', 'button'); - deleteDiv.setAttribute('aria-label', 'Remove selection'); - deleteDiv.setAttribute('title', 'Remove selection'); - deleteDiv.setAttribute('tabindex', '0'); + deleteDiv.setAttribute('aria-label', `Remove ${option.text}`); + deleteDiv.setAttribute('aria-hidden', 'true'); + deleteDiv.tabIndex = -1; deleteDiv.onclick = (e) => { e.preventDefault(); e.stopPropagation(); - if (this.settings.disabled) { + if (this.settings.disabled) return; - } let shouldDelete = true; const before = this.store.getSelectedOptions(); - const after = before.filter((o) => { - return o.selected && o.id !== option.id; - }, true); + const after = before.filter((o) => o.selected && o.id !== option.id, true); if (this.settings.minSelected && after.length < this.settings.minSelected) { return; } @@ -843,12 +857,11 @@ var SlimSelect = (function () { shouldDelete = this.callbacks.beforeChange(after, before) === true; } if (shouldDelete) { - let selectedIds = []; + const selectedIds = []; for (const o of after) { if (o instanceof Optgroup) { - for (const c of o.options) { + for (const c of o.options) selectedIds.push(c.id); - } } if (o instanceof Option) { selectedIds.push(o.id); @@ -862,6 +875,9 @@ var SlimSelect = (function () { this.callbacks.afterChange(after); } this.updateDeselectAll(); + requestAnimationFrame(() => { + this.main.main.focus({ preventScroll: true }); + }); } }; const deleteSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); @@ -876,9 +892,31 @@ var SlimSelect = (function () { deleteDiv.onkeydown = (e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); + e.stopPropagation(); deleteDiv.click(); } }; + value.addEventListener('keydown', (e) => { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault(); + e.stopPropagation(); + } + else if (e.key === 'Delete' || e.key === 'Backspace') { + e.preventDefault(); + e.stopPropagation(); + deleteDiv === null || deleteDiv === void 0 ? void 0 : deleteDiv.click(); + } + }); + value.addEventListener('focusin', () => { + value.setAttribute('aria-describedby', hintId); + deleteDiv.removeAttribute('aria-hidden'); + deleteDiv.tabIndex = 0; + }); + value.addEventListener('focusout', () => { + value.removeAttribute('aria-describedby'); + deleteDiv.setAttribute('aria-hidden', 'true'); + deleteDiv.tabIndex = -1; + }); } return value; } @@ -928,7 +966,7 @@ var SlimSelect = (function () { main.classList.add(this.classes.hide); input.readOnly = true; } - input.type = 'search'; + input.type = 'text'; input.placeholder = this.settings.searchPlaceholder; input.tabIndex = -1; if (this.settings.searchLabelledBy && this.settings.searchLabelledBy.trim()) { @@ -1118,7 +1156,7 @@ var SlimSelect = (function () { } let selectOption = options[dir === 'down' ? (i + 1 < options.length ? i + 1 : 0) : i - 1 >= 0 ? i - 1 : options.length - 1]; selectOption.classList.add(this.classes.highlighted); - this.main.main.setAttribute('aria-activedescendant', selectOption.id); + this.content.search.input.setAttribute('aria-activedescendant', selectOption.id); this.ensureElementInView(this.content.list, selectOption); const selectParent = selectOption.parentElement; if (selectParent && selectParent.classList.contains(this.classes.close)) { @@ -1132,7 +1170,7 @@ var SlimSelect = (function () { } const newly = options[dir === 'down' ? 0 : options.length - 1]; newly.classList.add(this.classes.highlighted); - this.main.main.setAttribute('aria-activedescendant', newly.id); + this.content.search.input.setAttribute('aria-activedescendant', newly.id); this.ensureElementInView(this.content.list, newly); } listDiv() { @@ -1373,7 +1411,7 @@ var SlimSelect = (function () { if (option.selected) { optionEl.classList.add(this.classes.selected); optionEl.setAttribute('aria-selected', 'true'); - this.main.main.setAttribute('aria-activedescendant', optionEl.id); + this.content.search.input.setAttribute('aria-activedescendant', optionEl.id); } else { optionEl.classList.remove(this.classes.selected); diff --git a/dist/slimselect.js b/dist/slimselect.js index 48a991c5..0221932a 100644 --- a/dist/slimselect.js +++ b/dist/slimselect.js @@ -387,6 +387,11 @@ el.textContent = ''; requestAnimationFrame(() => { el.textContent = msg; }); } + clearHighlights() { + const highlighted = this.content.list.querySelectorAll('.' + this.classes.highlighted); + highlighted.forEach(el => el.classList.remove(this.classes.highlighted)); + this.content.search.input.removeAttribute('aria-activedescendant'); + } constructor(settings, classes, store, callbacks) { var _a; this.store = store; @@ -397,6 +402,7 @@ this.main = this.mainDiv(); this.content = this.contentDiv(); this.updateClassStyles(); + this.main.values.setAttribute('role', 'list'); this.updateAriaAttributes(); const contentContainer = (_a = document .querySelector(`[data-id="${this.settings.id}"]`)) === null || _a === void 0 ? void 0 : _a.closest('.offcanvas-body'); @@ -436,7 +442,7 @@ 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.content.search.input.setAttribute('aria-expanded', 'true'); this.moveContent(); const selectedOptions = this.store.getSelectedOptions(); if (selectedOptions.length) { @@ -456,11 +462,9 @@ this.searchFocus(); } 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.main.classList.remove(this.classes.openAbove, this.classes.openBelow); + this.content.search.input.setAttribute('aria-expanded', 'false'); + this.content.main.classList.remove(this.classes.openAbove, this.classes.openBelow); this.main.arrow.path.setAttribute('d', this.classes.arrowClose); if (this.scrollHandler) { window.removeEventListener('scroll', this.scrollHandler, true); @@ -470,8 +474,8 @@ window.removeEventListener('resize', this.resizeHandler); this.resizeHandler = undefined; } + this.clearHighlights(); this.main.main.focus({ preventScroll: true }); - this.main.main.removeAttribute('aria-activedescendant'); } updateClassStyles() { this.main.main.className = ''; @@ -506,13 +510,15 @@ if (this.settings.isMultiple) { this.content.list.setAttribute('aria-multiselectable', 'true'); } - this.main.main.setAttribute('role', 'combobox'); - this.main.main.setAttribute('aria-haspopup', 'listbox'); - this.main.main.setAttribute('aria-controls', this.content.list.id); - this.main.main.setAttribute('aria-expanded', 'false'); - this.main.main.setAttribute('aria-autocomplete', 'list'); this.main.main.removeAttribute('aria-labelledby'); this.main.main.removeAttribute('aria-label'); + const input = this.content.search.input; + input.setAttribute('role', 'combobox'); + input.setAttribute('aria-haspopup', 'listbox'); + input.setAttribute('aria-controls', this.content.list.id); + input.setAttribute('aria-owns', this.content.list.id); + input.setAttribute('aria-expanded', 'false'); + input.setAttribute('aria-autocomplete', 'list'); let labelledById = (this.settings.ariaLabelledBy || '').trim(); let labelEl = null; if (!labelledById) { @@ -541,7 +547,6 @@ else if (this.settings.ariaLabel && this.settings.ariaLabel.trim()) { this.main.main.setAttribute('aria-label', this.settings.ariaLabel.trim()); } - this.main.main.setAttribute('aria-owns', this.content.list.id); this.content.search.input.setAttribute('aria-controls', this.content.list.id); this.content.search.input.setAttribute('aria-autocomplete', 'list'); if (labelledById && document.getElementById(labelledById)) { @@ -563,6 +568,8 @@ main.id = this.settings.id + '-main'; main.tabIndex = 0; main.onkeydown = (e) => { + if (e.target !== main) + return true; switch (e.key) { case 'ArrowUp': case 'ArrowDown': @@ -576,9 +583,8 @@ case ' ': this.callbacks.open(); const highlighted = this.content.list.querySelector('.' + this.classes.highlighted); - if (highlighted) { + if (highlighted) highlighted.click(); - } return false; case 'Escape': this.callbacks.close(); @@ -606,6 +612,7 @@ deselect.addEventListener('keydown', (e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); + e.stopPropagation(); deselect.click(); } }); @@ -817,28 +824,35 @@ const value = document.createElement('div'); value.classList.add(this.classes.value); value.dataset.id = option.id; + value.setAttribute('role', 'listitem'); + value.tabIndex = 0; + value.setAttribute('aria-label', option.text); const text = document.createElement('div'); text.classList.add(this.classes.valueText); text.textContent = option.text; value.appendChild(text); + let deleteDiv = null; if (!option.mandatory) { - const deleteDiv = document.createElement('div'); + const hintId = `${this.settings.id}__chip__${option.id}__hint`; + const hint = document.createElement('span'); + hint.id = hintId; + hint.className = 'ss-sr-only'; + hint.textContent = 'Press Delete or Backspace to remove.'; + value.appendChild(hint); + deleteDiv = document.createElement('div'); deleteDiv.classList.add(this.classes.valueDelete); deleteDiv.setAttribute('role', 'button'); - deleteDiv.setAttribute('aria-label', 'Remove selection'); - deleteDiv.setAttribute('title', 'Remove selection'); - deleteDiv.setAttribute('tabindex', '0'); + deleteDiv.setAttribute('aria-label', `Remove ${option.text}`); + deleteDiv.setAttribute('aria-hidden', 'true'); + deleteDiv.tabIndex = -1; deleteDiv.onclick = (e) => { e.preventDefault(); e.stopPropagation(); - if (this.settings.disabled) { + if (this.settings.disabled) return; - } let shouldDelete = true; const before = this.store.getSelectedOptions(); - const after = before.filter((o) => { - return o.selected && o.id !== option.id; - }, true); + const after = before.filter((o) => o.selected && o.id !== option.id, true); if (this.settings.minSelected && after.length < this.settings.minSelected) { return; } @@ -846,12 +860,11 @@ shouldDelete = this.callbacks.beforeChange(after, before) === true; } if (shouldDelete) { - let selectedIds = []; + const selectedIds = []; for (const o of after) { if (o instanceof Optgroup) { - for (const c of o.options) { + for (const c of o.options) selectedIds.push(c.id); - } } if (o instanceof Option) { selectedIds.push(o.id); @@ -865,6 +878,9 @@ this.callbacks.afterChange(after); } this.updateDeselectAll(); + requestAnimationFrame(() => { + this.main.main.focus({ preventScroll: true }); + }); } }; const deleteSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); @@ -879,9 +895,31 @@ deleteDiv.onkeydown = (e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); + e.stopPropagation(); deleteDiv.click(); } }; + value.addEventListener('keydown', (e) => { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault(); + e.stopPropagation(); + } + else if (e.key === 'Delete' || e.key === 'Backspace') { + e.preventDefault(); + e.stopPropagation(); + deleteDiv === null || deleteDiv === void 0 ? void 0 : deleteDiv.click(); + } + }); + value.addEventListener('focusin', () => { + value.setAttribute('aria-describedby', hintId); + deleteDiv.removeAttribute('aria-hidden'); + deleteDiv.tabIndex = 0; + }); + value.addEventListener('focusout', () => { + value.removeAttribute('aria-describedby'); + deleteDiv.setAttribute('aria-hidden', 'true'); + deleteDiv.tabIndex = -1; + }); } return value; } @@ -931,7 +969,7 @@ main.classList.add(this.classes.hide); input.readOnly = true; } - input.type = 'search'; + input.type = 'text'; input.placeholder = this.settings.searchPlaceholder; input.tabIndex = -1; if (this.settings.searchLabelledBy && this.settings.searchLabelledBy.trim()) { @@ -1121,7 +1159,7 @@ } let selectOption = options[dir === 'down' ? (i + 1 < options.length ? i + 1 : 0) : i - 1 >= 0 ? i - 1 : options.length - 1]; selectOption.classList.add(this.classes.highlighted); - this.main.main.setAttribute('aria-activedescendant', selectOption.id); + this.content.search.input.setAttribute('aria-activedescendant', selectOption.id); this.ensureElementInView(this.content.list, selectOption); const selectParent = selectOption.parentElement; if (selectParent && selectParent.classList.contains(this.classes.close)) { @@ -1135,7 +1173,7 @@ } const newly = options[dir === 'down' ? 0 : options.length - 1]; newly.classList.add(this.classes.highlighted); - this.main.main.setAttribute('aria-activedescendant', newly.id); + this.content.search.input.setAttribute('aria-activedescendant', newly.id); this.ensureElementInView(this.content.list, newly); } listDiv() { @@ -1376,7 +1414,7 @@ if (option.selected) { optionEl.classList.add(this.classes.selected); optionEl.setAttribute('aria-selected', 'true'); - this.main.main.setAttribute('aria-activedescendant', optionEl.id); + this.content.search.input.setAttribute('aria-activedescendant', optionEl.id); } else { optionEl.classList.remove(this.classes.selected); diff --git a/dist/slimselect.min.js b/dist/slimselect.min.js index 0a14acea..0c71a7dd 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";class t{constructor(t){t||(t={}),this.main=t.main||"ss-main",this.placeholder=t.placeholder||"ss-placeholder",this.values=t.values||"ss-values",this.single=t.single||"ss-single",this.max=t.max||"ss-max",this.value=t.value||"ss-value",this.valueText=t.valueText||"ss-value-text",this.valueDelete=t.valueDelete||"ss-value-delete",this.valueOut=t.valueOut||"ss-value-out",this.deselect=t.deselect||"ss-deselect",this.deselectPath=t.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=t.arrow||"ss-arrow",this.arrowClose=t.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=t.arrowOpen||"M10,70 L50,30 L90,70",this.content=t.content||"ss-content",this.openAbove=t.openAbove||"ss-open-above",this.openBelow=t.openBelow||"ss-open-below",this.search=t.search||"ss-search",this.searchHighlighter=t.searchHighlighter||"ss-search-highlight",this.searching=t.searching||"ss-searching",this.addable=t.addable||"ss-addable",this.addablePath=t.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=t.list||"ss-list",this.optgroup=t.optgroup||"ss-optgroup",this.optgroupLabel=t.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=t.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=t.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=t.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=t.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=t.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=t.optgroupClosable||"ss-closable",this.option=t.option||"ss-option",this.optionDelete=t.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=t.highlighted||"ss-highlighted",this.open=t.open||"ss-open",this.close=t.close||"ss-close",this.selected=t.selected||"ss-selected",this.error=t.error||"ss-error",this.disabled=t.disabled||"ss-disabled",this.hide=t.hide||"ss-hide"}}function e(){return Math.random().toString(36).substring(2,10)}function s(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 i(t,e){return JSON.stringify(t)===JSON.stringify(e)}class n{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 a(e))}}class a{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.defaultSelected=void 0!==t.defaultSelected&&t.defaultSelected,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 l{constructor(t,e){this.selectType="single",this.data=[],this.selectedOrder=[],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 n||"label"in e){if(!("label"in e))return new Error("Optgroup must have a label");if("options"in e&&e.options)for(let t of e.options){const e=this.validateOption(t);if(e)return e}}else{if(!(e instanceof a||"text"in e))return new Error("Data object must be a valid optgroup or option");{const t=this.validateOption(e);if(t)return 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 n||"label"in t){let s=[];"options"in t&&t.options&&t.options.forEach((t=>{s.push(new a(t))})),s.length>0&&e.push(new n(t))}(t instanceof a||"text"in t)&&e.push(new a(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,e=!1){if(e){let e=[new a(t)];this.setData(e.concat(this.getData()))}else this.setData(this.getData().concat(new a(t)))}setSelectedBy(t,e){let s=null,i=!1;const l=[];for(let o of this.data){if(o instanceof n)for(let n of o.options)s||(s=n),n.selected=!i&&e.includes(n[t]),n.selected&&(l.push(n),"single"===this.selectType&&(i=!0));o instanceof a&&(s||(s=o),o.selected=!i&&e.includes(o[t]),o.selected&&(l.push(o),"single"===this.selectType&&(i=!0)))}"single"===this.selectType&&s&&!i&&(s.selected=!0,l.push(s));const o=e.map((e=>{var s;return(null===(s=l.find((s=>s[t]===e)))||void 0===s?void 0:s.id)||""}));this.selectedOrder=o}getSelected(){return this.getSelectedOptions().map((t=>t.id))}getSelectedValues(){return this.getSelectedOptions().map((t=>t.value))}getSelectedOptions(){return this.filter((t=>t.selected),!1)}getOptgroupByID(t){for(let e of this.data)if(e instanceof n&&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 n?t=e.options[0]:e instanceof a&&(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((i=>{if(i instanceof n){let l=[];if(i.options.forEach((i=>{t&&!t(i)||(e?l.push(new a(i)):s.push(new a(i)))})),l.length>0){let t=new n(i);t.options=l,s.push(t)}}i instanceof a&&(t&&!t(i)||s.push(new a(i)))})),s}selectedOrderOptions(t){const e=[];return this.selectedOrder.forEach((s=>{const i=t.find((t=>t.id===s));i&&e.push(i)})),t.forEach((t=>{let s=!1;e.forEach((e=>{t.id!==e.id||(s=!0)})),s||e.push(t)})),e}}class o{static getLiveAssertive(){let t=document.getElementById("ss-live-assertive");return t||(t=document.createElement("div"),t.id="ss-live-assertive",t.setAttribute("role","status"),t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true"),t.className="ss-sr-only",document.body.appendChild(t)),t}_announceAssertive(t){const e=o._liveAssertive||(o._liveAssertive=o.getLiveAssertive());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}constructor(t,e,s,i){var n;this.store=s,this.settings=t,this.classes=e,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes();const a=null===(n=document.querySelector(`[data-id="${this.settings.id}"]`))||void 0===n?void 0:n.closest(".offcanvas-body");a?a.appendChild(this.content.main):this.settings.contentLocation&&this.settings.contentLocation.appendChild(this.content.main)}static getLivePolite(){let t=document.getElementById("ss-live-polite");return t||(t=document.createElement("div"),t.id="ss-live-polite",t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.className="ss-sr-only",document.body.appendChild(t)),t}_announcePolite(t){const e=o._livePolite||(o._livePolite=o.getLivePolite());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}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)}"fixed"===this.settings.contentPosition&&(this.moveContent(),this.scrollHandler=()=>this.moveContent(),this.resizeHandler=()=>this.moveContent(),window.addEventListener("scroll",this.scrollHandler,!0),window.addEventListener("resize",this.resizeHandler)),this.searchFocus()}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),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=void 0),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=void 0),this.main.main.focus({preventScroll:!0}),this.main.main.removeAttribute("aria-activedescendant")}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.main.main.classList.add("ss-2"),this.content.main.classList.add(this.classes.content),this.content.main.classList.add("ss-content-2"),""!==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&&"fixed"!==this.settings.contentPosition||this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){var t;this.content.list.setAttribute("role","listbox"),this.content.list.setAttribute("id",this.content.main.id+"-list"),this.content.list.setAttribute("aria-label",this.settings.contentAriaLabel),this.settings.isMultiple&&this.content.list.setAttribute("aria-multiselectable","true"),this.main.main.setAttribute("role","combobox"),this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.list.id),this.main.main.setAttribute("aria-expanded","false"),this.main.main.setAttribute("aria-autocomplete","list"),this.main.main.removeAttribute("aria-labelledby"),this.main.main.removeAttribute("aria-label");let e=(this.settings.ariaLabelledBy||"").trim(),s=null;if(e)s=document.getElementById(e);else{const i=document.querySelector(`select[data-id="${this.settings.id}"]`);i&&(i.id&&(s=document.querySelector(`label[for="${i.id}"]`)),s||"LABEL"!==(null===(t=i.previousElementSibling)||void 0===t?void 0:t.tagName)||(s=i.previousElementSibling),s&&(s.id||(s.id=(i.id||this.settings.id)+"-label"),e=s.id))}e&&document.getElementById(e)?this.main.main.setAttribute("aria-labelledby",e):this.settings.ariaLabel&&this.settings.ariaLabel.trim()&&this.main.main.setAttribute("aria-label",this.settings.ariaLabel.trim()),this.main.main.setAttribute("aria-owns",this.content.list.id),this.content.search.input.setAttribute("aria-controls",this.content.list.id),this.content.search.input.setAttribute("aria-autocomplete","list"),e&&document.getElementById(e)?this.content.search.input.setAttribute("aria-labelledby",e):this.settings.searchLabelledBy&&document.getElementById(this.settings.searchLabelledBy)?this.content.search.input.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel?this.content.search.input.setAttribute("aria-label",this.settings.searchAriaLabel):this.content.search.input.setAttribute("aria-label","Search options")}mainDiv(){var t;const e=document.createElement("div");e.id=this.settings.id+"-main",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===t.key.length&&this.callbacks.open(),!0},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),i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("aria-label",this.settings.clearAllAriaLabel),i.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i.click())}));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"),a.setAttribute("aria-hidden","true"),a.setAttribute("focusable","false");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"),o.setAttribute("aria-hidden","true"),o.setAttribute("focusable","false");const r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&o.classList.add(this.classes.hide),o.appendChild(r),e.appendChild(o),{main:e,values:s,deselect:{main:i,svg:a,path:l},arrow:{main:o,path:r}}}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()}this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e));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 i=this.store.getSelectedOptions(),l=i.filter((e=>e.selected&&e.id!==t.id),!0);if(!(this.settings.minSelected&&l.length{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),s.click())}}return e}contentDiv(){const t=document.createElement("div");t.id=this.settings.id+"-content";const e=this.searchDiv();t.appendChild(e.main);const s=this.listDiv();return t.appendChild(s),{main:t,search:e,list:s}}moveContent(){"relative"!==this.settings.contentPosition&&"down"!==this.settings.openPosition?"up"!==this.settings.openPosition?"up"===this.putContent()?this.moveContentAbove():this.moveContentBelow():this.moveContentAbove():this.moveContentBelow()}searchDiv(){const t=document.createElement("div"),e=document.createElement("input"),i=document.createElement("div");t.classList.add(this.classes.search);const n={main:t,input:e};if(this.settings.showSearch||(t.classList.add(this.classes.hide),e.readOnly=!0),e.type="search",e.placeholder=this.settings.searchPlaceholder,e.tabIndex=-1,this.settings.searchLabelledBy&&this.settings.searchLabelledBy.trim()?e.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel&&this.settings.searchAriaLabel.trim()?e.setAttribute("aria-label",this.settings.searchAriaLabel):e.setAttribute("aria-label","Search options"),e.setAttribute("autocapitalize","off"),e.setAttribute("autocomplete","off"),e.setAttribute("autocorrect","off"),e.oninput=s((t=>{this.callbacks.search(t.target.value)}),100),e.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" ":const e=this.content.list.querySelector("."+this.classes.highlighted);return!e||(e.click(),!1);case"Enter":if(this.callbacks.addable)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(e),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"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false");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 a(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=>{"string"==typeof t?s({text:t,value:t}):i instanceof Error?this.renderError(i.message):s(t)})):"string"==typeof i?s({text:i,value:i}):i instanceof Error?this.renderError(i.message):s(i))},t.appendChild(i),n.addable={main:i,svg:e,path:s}}return n}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.main.main.setAttribute("aria-activedescendant",a.id),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}const i=e["down"===t?0:e.length-1];i.classList.add(this.classes.highlighted),this.main.main.setAttribute("aria-activedescendant",i.id),this.ensureElementInView(this.content.list,i)}listDiv(){const t=document.createElement("div");return t.classList.add(this.classes.list),t}renderError(t){this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy");const e=document.createElement("div");e.classList.add(this.classes.error),e.textContent=t,this.content.list.appendChild(e),this._announceAssertive(t)}renderSearching(){this.content.list.innerHTML="",this.content.list.setAttribute("aria-busy","true");const t=document.createElement("div");t.classList.add(this.classes.searching),t.textContent=this.settings.searchingText,this.content.list.appendChild(t),this._announcePolite(this.settings.searchingText)}renderOptions(t){if(this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy"),0===t.length){const t=document.createElement("div");t.classList.add(this.classes.search);const e=this.callbacks.addable?this.settings.addableText.replace("{value}",this.content.search.input.value):this.settings.searchText;return this._announcePolite(e),t.innerHTML=e,this.content.list.appendChild(t),void this.content.list.setAttribute("aria-setsize","0")}if(this.settings.allowDeselect&&!this.settings.isMultiple){this.store.filter((t=>t.placeholder),!1).length||this.store.addOption(new a({text:"",value:"",selected:!1,placeholder:!0}),!0)}const e=document.createDocumentFragment();let s=0;const i=t.filter((t=>t instanceof a&&!t.placeholder&&t.display&&!t.disabled)).length,l=t=>{t.classList.contains(this.classes.placeholder)||t.classList.contains(this.classes.disabled)||t.classList.contains(this.classes.hide)||(t.setAttribute("aria-posinset",String(++s)),t.setAttribute("aria-setsize",String(i)))};for(const s of t){if(s instanceof n){const t=document.createElement("div");t.classList.add(this.classes.optgroup),t.setAttribute("role","group"),t.setAttribute("aria-label",s.label);const i=document.createElement("div");i.classList.add(this.classes.optgroupLabel),t.appendChild(i);const n=document.createElement("div");n.classList.add(this.classes.optgroupLabelText),n.textContent=s.label,i.appendChild(n);const a=document.createElement("div");if(a.classList.add(this.classes.optgroupActions),i.appendChild(a),this.settings.isMultiple&&s.selectAll){const t=document.createElement("div");t.classList.add(this.classes.optgroupSelectAll);let e=!0;for(const t of s.options)if(!t.selected){e=!1;break}e&&t.classList.add(this.classes.selected);const i=document.createElement("span");i.textContent=s.selectAllText,t.appendChild(i);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),t.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.optgroupSelectAllBox),n.appendChild(l);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.optgroupSelectAllCheck),n.appendChild(o),t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const i=this.store.getSelected();if(e){const t=i.filter((t=>{for(const e of s.options)if(t===e.id)return!1;return!0}));this.callbacks.setSelected(t,!0)}else{const t=i.concat(s.options.map((t=>t.id)));for(const t of s.options)this.store.getOptionByID(t.id)||this.callbacks.addOption(t);this.callbacks.setSelected(t,!0)}})),a.appendChild(t)}if("off"!==s.closable){const e=document.createElement("div");e.classList.add(this.classes.optgroupClosable);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.classList.add(this.classes.arrow),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),e.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","path");n.appendChild(l),s.options.some((t=>t.selected))||""!==this.content.search.input.value.trim()||"open"===s.closable?(t.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"close"===s.closable&&(t.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose)),i.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))})),a.appendChild(e)}t.appendChild(i);for(const e of s.options){const s=this.option(e);l(s),t.appendChild(s)}e.appendChild(t)}if(s instanceof a){const t=this.option(s);l(t),e.appendChild(t)}}this.content.list.appendChild(e),this.content.list.removeAttribute("aria-busy");const o=this.getOptions(!0,!0,!0).length;this._announcePolite(`${o} option${1===o?"":"s"} available`)}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=`${this.settings.id}__opt__${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),e.setAttribute("aria-disabled","true")),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=[];if(this.settings.isMultiple)if(t.selected)o=l.filter((t=>t.id!==n));else if(o=l.concat(t),!this.settings.closeOnSelect)if(e.shiftKey&&this.lastSelectedOption){const e=this.store.getDataOptions();let s=e.findIndex((t=>t.id===this.lastSelectedOption.id)),i=e.findIndex((e=>e.id===t.id));if(s>=0&&i>=0){const t=Math.min(s,i),n=Math.max(s,i),a=e.slice(t,n+1);a.length>0&&a.length!l.find((e=>e.id===t.id))))))}}else t.selected||(this.lastSelectedOption=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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=s.left+("fixed"===this.settings.contentPosition?0: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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=t.left+("fixed"===this.settings.contentPosition?0: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)}}o._livePolite=null,o._liveAssertive=null;class r{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){if(n.target===this.select&&("disabled"===n.attributeName&&(s=!0),"class"===n.attributeName&&(e=!0),"childList"===n.type)){for(const t of n.addedNodes)if("OPTION"===t.nodeName&&t.value===this.select.value){this.select.dispatchEvent(new Event("change"));break}i=!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:"",defaultSelected:t.defaultSelected,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)}setSelectedByValue(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.value)}}if("OPTION"===s.nodeName){const e=s;e.selected=t.includes(e.value)}}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 n&&this.select.appendChild(this.createOptgroup(e)),e instanceof a&&this.select.appendChild(this.createOption(e));this.select.dispatchEvent(new Event("change",{bubbles:!0})),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.textContent=t.text,""!==t.html&&e.setAttribute("data-html",t.html),e.defaultSelected=t.defaultSelected,e.selected=t.selected,t.disabled&&(e.disabled=!0),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(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.focusSearch=void 0===t.focusSearch||t.focusSearch,this.ariaLabel=t.ariaLabel||"",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.contentAriaLabel=void 0!==t.contentAriaLabel?t.contentAriaLabel:"Select an option",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",this.addableText=t.addableText||'Press "Enter" to add {value}',this.ariaLabelledBy=t.ariaLabelledBy||"",this.searchAriaLabel=t.searchAriaLabel||"Search options",this.searchLabelledBy=t.searchLabelledBy||"",this.clearAllAriaLabel=t.clearAllAriaLabel||"Clear selection"}}return class{constructor(e){var i;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=s((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.windowScroll=s((()=>{(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 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),this.cssClasses=new t(e.cssClasses);const n=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const t in e.events)e.events.hasOwnProperty(t)&&(-1!==n.indexOf(t)?this.events[t]=s(e.events[t],100):this.events[t]=e.events[t]);this.settings.disabled=(null===(i=e.settings)||void 0===i?void 0:i.disabled)?e.settings.disabled:this.selectEl.disabled,this.settings.isMultiple=this.selectEl.multiple,this.settings.style=this.selectEl.style.cssText,this.settings.class=this.selectEl.className.split(" "),this.select=new r(this.selectEl),this.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 l(this.settings.isMultiple?"multiple":"single",e.data?e.data:this.select.getData()),e.data&&this.select.updateOptions(this.store.getData());const a={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 o(this.settings,this.cssClasses,this.store,a),this.render.renderValues(),this.render.renderOptions(this.store.getData());const h=this.selectEl.getAttribute("aria-label"),d=this.selectEl.getAttribute("aria-labelledby");h?this.render.main.main.setAttribute("aria-label",h):d&&this.render.main.main.setAttribute("aria-labelledby",d),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(),s=this.store.validateDataArray(t);if(s)return void(this.events.error&&this.events.error(s));this.store.setData(t);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!i(e,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let t=this.store.getSelectedOptions();return this.settings.keepOrder&&(t=this.store.selectedOrderOptions(t)),t.map((t=>t.value))}setSelected(t,e=!0){const s=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&&!i(s,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 s=this.store.getData();this.select.updateOptions(s),this.render.renderValues(),this.render.renderOptions(s),this.events.afterChange&&!i(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.settings.focusSearch&&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";class t{constructor(t){t||(t={}),this.main=t.main||"ss-main",this.placeholder=t.placeholder||"ss-placeholder",this.values=t.values||"ss-values",this.single=t.single||"ss-single",this.max=t.max||"ss-max",this.value=t.value||"ss-value",this.valueText=t.valueText||"ss-value-text",this.valueDelete=t.valueDelete||"ss-value-delete",this.valueOut=t.valueOut||"ss-value-out",this.deselect=t.deselect||"ss-deselect",this.deselectPath=t.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=t.arrow||"ss-arrow",this.arrowClose=t.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=t.arrowOpen||"M10,70 L50,30 L90,70",this.content=t.content||"ss-content",this.openAbove=t.openAbove||"ss-open-above",this.openBelow=t.openBelow||"ss-open-below",this.search=t.search||"ss-search",this.searchHighlighter=t.searchHighlighter||"ss-search-highlight",this.searching=t.searching||"ss-searching",this.addable=t.addable||"ss-addable",this.addablePath=t.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=t.list||"ss-list",this.optgroup=t.optgroup||"ss-optgroup",this.optgroupLabel=t.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=t.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=t.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=t.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=t.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=t.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=t.optgroupClosable||"ss-closable",this.option=t.option||"ss-option",this.optionDelete=t.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=t.highlighted||"ss-highlighted",this.open=t.open||"ss-open",this.close=t.close||"ss-close",this.selected=t.selected||"ss-selected",this.error=t.error||"ss-error",this.disabled=t.disabled||"ss-disabled",this.hide=t.hide||"ss-hide"}}function e(){return Math.random().toString(36).substring(2,10)}function s(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 i(t,e){return JSON.stringify(t)===JSON.stringify(e)}class n{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 a(e))}}class a{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.defaultSelected=void 0!==t.defaultSelected&&t.defaultSelected,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 l{constructor(t,e){this.selectType="single",this.data=[],this.selectedOrder=[],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 n||"label"in e){if(!("label"in e))return new Error("Optgroup must have a label");if("options"in e&&e.options)for(let t of e.options){const e=this.validateOption(t);if(e)return e}}else{if(!(e instanceof a||"text"in e))return new Error("Data object must be a valid optgroup or option");{const t=this.validateOption(e);if(t)return 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 n||"label"in t){let s=[];"options"in t&&t.options&&t.options.forEach((t=>{s.push(new a(t))})),s.length>0&&e.push(new n(t))}(t instanceof a||"text"in t)&&e.push(new a(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,e=!1){if(e){let e=[new a(t)];this.setData(e.concat(this.getData()))}else this.setData(this.getData().concat(new a(t)))}setSelectedBy(t,e){let s=null,i=!1;const l=[];for(let o of this.data){if(o instanceof n)for(let n of o.options)s||(s=n),n.selected=!i&&e.includes(n[t]),n.selected&&(l.push(n),"single"===this.selectType&&(i=!0));o instanceof a&&(s||(s=o),o.selected=!i&&e.includes(o[t]),o.selected&&(l.push(o),"single"===this.selectType&&(i=!0)))}"single"===this.selectType&&s&&!i&&(s.selected=!0,l.push(s));const o=e.map((e=>{var s;return(null===(s=l.find((s=>s[t]===e)))||void 0===s?void 0:s.id)||""}));this.selectedOrder=o}getSelected(){return this.getSelectedOptions().map((t=>t.id))}getSelectedValues(){return this.getSelectedOptions().map((t=>t.value))}getSelectedOptions(){return this.filter((t=>t.selected),!1)}getOptgroupByID(t){for(let e of this.data)if(e instanceof n&&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 n?t=e.options[0]:e instanceof a&&(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((i=>{if(i instanceof n){let l=[];if(i.options.forEach((i=>{t&&!t(i)||(e?l.push(new a(i)):s.push(new a(i)))})),l.length>0){let t=new n(i);t.options=l,s.push(t)}}i instanceof a&&(t&&!t(i)||s.push(new a(i)))})),s}selectedOrderOptions(t){const e=[];return this.selectedOrder.forEach((s=>{const i=t.find((t=>t.id===s));i&&e.push(i)})),t.forEach((t=>{let s=!1;e.forEach((e=>{t.id!==e.id||(s=!0)})),s||e.push(t)})),e}}class o{static getLiveAssertive(){let t=document.getElementById("ss-live-assertive");return t||(t=document.createElement("div"),t.id="ss-live-assertive",t.setAttribute("role","status"),t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true"),t.className="ss-sr-only",document.body.appendChild(t)),t}_announceAssertive(t){const e=o._liveAssertive||(o._liveAssertive=o.getLiveAssertive());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}clearHighlights(){this.content.list.querySelectorAll("."+this.classes.highlighted).forEach((t=>t.classList.remove(this.classes.highlighted))),this.content.search.input.removeAttribute("aria-activedescendant")}constructor(t,e,s,i){var n;this.store=s,this.settings=t,this.classes=e,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.main.values.setAttribute("role","list"),this.updateAriaAttributes();const a=null===(n=document.querySelector(`[data-id="${this.settings.id}"]`))||void 0===n?void 0:n.closest(".offcanvas-body");a?a.appendChild(this.content.main):this.settings.contentLocation&&this.settings.contentLocation.appendChild(this.content.main)}static getLivePolite(){let t=document.getElementById("ss-live-polite");return t||(t=document.createElement("div"),t.id="ss-live-polite",t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.className="ss-sr-only",document.body.appendChild(t)),t}_announcePolite(t){const e=o._livePolite||(o._livePolite=o.getLivePolite());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}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.content.search.input.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)}"fixed"===this.settings.contentPosition&&(this.moveContent(),this.scrollHandler=()=>this.moveContent(),this.resizeHandler=()=>this.moveContent(),window.addEventListener("scroll",this.scrollHandler,!0),window.addEventListener("resize",this.resizeHandler)),this.searchFocus()}close(){this.main.main.classList.remove(this.classes.openAbove,this.classes.openBelow),this.content.search.input.setAttribute("aria-expanded","false"),this.content.main.classList.remove(this.classes.openAbove,this.classes.openBelow),this.main.arrow.path.setAttribute("d",this.classes.arrowClose),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=void 0),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=void 0),this.clearHighlights(),this.main.main.focus({preventScroll:!0})}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.main.main.classList.add("ss-2"),this.content.main.classList.add(this.classes.content),this.content.main.classList.add("ss-content-2"),""!==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&&"fixed"!==this.settings.contentPosition||this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){var t;this.content.list.setAttribute("role","listbox"),this.content.list.setAttribute("id",this.content.main.id+"-list"),this.content.list.setAttribute("aria-label",this.settings.contentAriaLabel),this.settings.isMultiple&&this.content.list.setAttribute("aria-multiselectable","true"),this.main.main.removeAttribute("aria-labelledby"),this.main.main.removeAttribute("aria-label");const e=this.content.search.input;e.setAttribute("role","combobox"),e.setAttribute("aria-haspopup","listbox"),e.setAttribute("aria-controls",this.content.list.id),e.setAttribute("aria-owns",this.content.list.id),e.setAttribute("aria-expanded","false"),e.setAttribute("aria-autocomplete","list");let s=(this.settings.ariaLabelledBy||"").trim(),i=null;if(s)i=document.getElementById(s);else{const e=document.querySelector(`select[data-id="${this.settings.id}"]`);e&&(e.id&&(i=document.querySelector(`label[for="${e.id}"]`)),i||"LABEL"!==(null===(t=e.previousElementSibling)||void 0===t?void 0:t.tagName)||(i=e.previousElementSibling),i&&(i.id||(i.id=(e.id||this.settings.id)+"-label"),s=i.id))}s&&document.getElementById(s)?this.main.main.setAttribute("aria-labelledby",s):this.settings.ariaLabel&&this.settings.ariaLabel.trim()&&this.main.main.setAttribute("aria-label",this.settings.ariaLabel.trim()),this.content.search.input.setAttribute("aria-controls",this.content.list.id),this.content.search.input.setAttribute("aria-autocomplete","list"),s&&document.getElementById(s)?this.content.search.input.setAttribute("aria-labelledby",s):this.settings.searchLabelledBy&&document.getElementById(this.settings.searchLabelledBy)?this.content.search.input.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel?this.content.search.input.setAttribute("aria-label",this.settings.searchAriaLabel):this.content.search.input.setAttribute("aria-label","Search options")}mainDiv(){var t;const e=document.createElement("div");e.id=this.settings.id+"-main",e.tabIndex=0,e.onkeydown=t=>{if(t.target!==e)return!0;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===t.key.length&&this.callbacks.open(),!0},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),i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("aria-label",this.settings.clearAllAriaLabel),i.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),i.click())}));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"),a.setAttribute("aria-hidden","true"),a.setAttribute("focusable","false");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"),o.setAttribute("aria-hidden","true"),o.setAttribute("focusable","false");const r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&o.classList.add(this.classes.hide),o.appendChild(r),e.appendChild(o),{main:e,values:s,deselect:{main:i,svg:a,path:l},arrow:{main:o,path:r}}}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()}this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e));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 i=this.store.getSelectedOptions(),l=i.filter((e=>e.selected&&e.id!==t.id),!0);if(!(this.settings.minSelected&&l.length{this.main.main.focus({preventScroll:!0})}))}};const o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("viewBox","0 0 100 100"),o.setAttribute("aria-hidden","true"),o.setAttribute("focusable","false");const r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttribute("d",this.classes.optionDelete),o.appendChild(r),i.appendChild(o),e.appendChild(i),i.onkeydown=t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),i.click())},e.addEventListener("keydown",(t=>{"Enter"===t.key||" "===t.key?(t.preventDefault(),t.stopPropagation()):"Delete"!==t.key&&"Backspace"!==t.key||(t.preventDefault(),t.stopPropagation(),null==i||i.click())})),e.addEventListener("focusin",(()=>{e.setAttribute("aria-describedby",s),i.removeAttribute("aria-hidden"),i.tabIndex=0})),e.addEventListener("focusout",(()=>{e.removeAttribute("aria-describedby"),i.setAttribute("aria-hidden","true"),i.tabIndex=-1}))}return e}contentDiv(){const t=document.createElement("div");t.id=this.settings.id+"-content";const e=this.searchDiv();t.appendChild(e.main);const s=this.listDiv();return t.appendChild(s),{main:t,search:e,list:s}}moveContent(){"relative"!==this.settings.contentPosition&&"down"!==this.settings.openPosition?"up"!==this.settings.openPosition?"up"===this.putContent()?this.moveContentAbove():this.moveContentBelow():this.moveContentAbove():this.moveContentBelow()}searchDiv(){const t=document.createElement("div"),e=document.createElement("input"),i=document.createElement("div");t.classList.add(this.classes.search);const n={main:t,input:e};if(this.settings.showSearch||(t.classList.add(this.classes.hide),e.readOnly=!0),e.type="text",e.placeholder=this.settings.searchPlaceholder,e.tabIndex=-1,this.settings.searchLabelledBy&&this.settings.searchLabelledBy.trim()?e.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel&&this.settings.searchAriaLabel.trim()?e.setAttribute("aria-label",this.settings.searchAriaLabel):e.setAttribute("aria-label","Search options"),e.setAttribute("autocapitalize","off"),e.setAttribute("autocomplete","off"),e.setAttribute("autocorrect","off"),e.oninput=s((t=>{this.callbacks.search(t.target.value)}),100),e.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" ":const e=this.content.list.querySelector("."+this.classes.highlighted);return!e||(e.click(),!1);case"Enter":if(this.callbacks.addable)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(e),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"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false");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 a(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=>{"string"==typeof t?s({text:t,value:t}):i instanceof Error?this.renderError(i.message):s(t)})):"string"==typeof i?s({text:i,value:i}):i instanceof Error?this.renderError(i.message):s(i))},t.appendChild(i),n.addable={main:i,svg:e,path:s}}return n}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.content.search.input.setAttribute("aria-activedescendant",a.id),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}const i=e["down"===t?0:e.length-1];i.classList.add(this.classes.highlighted),this.content.search.input.setAttribute("aria-activedescendant",i.id),this.ensureElementInView(this.content.list,i)}listDiv(){const t=document.createElement("div");return t.classList.add(this.classes.list),t}renderError(t){this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy");const e=document.createElement("div");e.classList.add(this.classes.error),e.textContent=t,this.content.list.appendChild(e),this._announceAssertive(t)}renderSearching(){this.content.list.innerHTML="",this.content.list.setAttribute("aria-busy","true");const t=document.createElement("div");t.classList.add(this.classes.searching),t.textContent=this.settings.searchingText,this.content.list.appendChild(t),this._announcePolite(this.settings.searchingText)}renderOptions(t){if(this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy"),0===t.length){const t=document.createElement("div");t.classList.add(this.classes.search);const e=this.callbacks.addable?this.settings.addableText.replace("{value}",this.content.search.input.value):this.settings.searchText;return this._announcePolite(e),t.innerHTML=e,this.content.list.appendChild(t),void this.content.list.setAttribute("aria-setsize","0")}if(this.settings.allowDeselect&&!this.settings.isMultiple){this.store.filter((t=>t.placeholder),!1).length||this.store.addOption(new a({text:"",value:"",selected:!1,placeholder:!0}),!0)}const e=document.createDocumentFragment();let s=0;const i=t.filter((t=>t instanceof a&&!t.placeholder&&t.display&&!t.disabled)).length,l=t=>{t.classList.contains(this.classes.placeholder)||t.classList.contains(this.classes.disabled)||t.classList.contains(this.classes.hide)||(t.setAttribute("aria-posinset",String(++s)),t.setAttribute("aria-setsize",String(i)))};for(const s of t){if(s instanceof n){const t=document.createElement("div");t.classList.add(this.classes.optgroup),t.setAttribute("role","group"),t.setAttribute("aria-label",s.label);const i=document.createElement("div");i.classList.add(this.classes.optgroupLabel),t.appendChild(i);const n=document.createElement("div");n.classList.add(this.classes.optgroupLabelText),n.textContent=s.label,i.appendChild(n);const a=document.createElement("div");if(a.classList.add(this.classes.optgroupActions),i.appendChild(a),this.settings.isMultiple&&s.selectAll){const t=document.createElement("div");t.classList.add(this.classes.optgroupSelectAll);let e=!0;for(const t of s.options)if(!t.selected){e=!1;break}e&&t.classList.add(this.classes.selected);const i=document.createElement("span");i.textContent=s.selectAllText,t.appendChild(i);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),t.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.optgroupSelectAllBox),n.appendChild(l);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.optgroupSelectAllCheck),n.appendChild(o),t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const i=this.store.getSelected();if(e){const t=i.filter((t=>{for(const e of s.options)if(t===e.id)return!1;return!0}));this.callbacks.setSelected(t,!0)}else{const t=i.concat(s.options.map((t=>t.id)));for(const t of s.options)this.store.getOptionByID(t.id)||this.callbacks.addOption(t);this.callbacks.setSelected(t,!0)}})),a.appendChild(t)}if("off"!==s.closable){const e=document.createElement("div");e.classList.add(this.classes.optgroupClosable);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.classList.add(this.classes.arrow),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),e.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","path");n.appendChild(l),s.options.some((t=>t.selected))||""!==this.content.search.input.value.trim()||"open"===s.closable?(t.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"close"===s.closable&&(t.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose)),i.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))})),a.appendChild(e)}t.appendChild(i);for(const e of s.options){const s=this.option(e);l(s),t.appendChild(s)}e.appendChild(t)}if(s instanceof a){const t=this.option(s);l(t),e.appendChild(t)}}this.content.list.appendChild(e),this.content.list.removeAttribute("aria-busy");const o=this.getOptions(!0,!0,!0).length;this._announcePolite(`${o} option${1===o?"":"s"} available`)}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=`${this.settings.id}__opt__${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),e.setAttribute("aria-disabled","true")),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.content.search.input.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=[];if(this.settings.isMultiple)if(t.selected)o=l.filter((t=>t.id!==n));else if(o=l.concat(t),!this.settings.closeOnSelect)if(e.shiftKey&&this.lastSelectedOption){const e=this.store.getDataOptions();let s=e.findIndex((t=>t.id===this.lastSelectedOption.id)),i=e.findIndex((e=>e.id===t.id));if(s>=0&&i>=0){const t=Math.min(s,i),n=Math.max(s,i),a=e.slice(t,n+1);a.length>0&&a.length!l.find((e=>e.id===t.id))))))}}else t.selected||(this.lastSelectedOption=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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=s.left+("fixed"===this.settings.contentPosition?0: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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=t.left+("fixed"===this.settings.contentPosition?0: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)}}o._livePolite=null,o._liveAssertive=null;class r{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){if(n.target===this.select&&("disabled"===n.attributeName&&(s=!0),"class"===n.attributeName&&(e=!0),"childList"===n.type)){for(const t of n.addedNodes)if("OPTION"===t.nodeName&&t.value===this.select.value){this.select.dispatchEvent(new Event("change"));break}i=!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:"",defaultSelected:t.defaultSelected,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)}setSelectedByValue(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.value)}}if("OPTION"===s.nodeName){const e=s;e.selected=t.includes(e.value)}}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 n&&this.select.appendChild(this.createOptgroup(e)),e instanceof a&&this.select.appendChild(this.createOption(e));this.select.dispatchEvent(new Event("change",{bubbles:!0})),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.textContent=t.text,""!==t.html&&e.setAttribute("data-html",t.html),e.defaultSelected=t.defaultSelected,e.selected=t.selected,t.disabled&&(e.disabled=!0),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(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.focusSearch=void 0===t.focusSearch||t.focusSearch,this.ariaLabel=t.ariaLabel||"",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.contentAriaLabel=void 0!==t.contentAriaLabel?t.contentAriaLabel:"Select an option",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",this.addableText=t.addableText||'Press "Enter" to add {value}',this.ariaLabelledBy=t.ariaLabelledBy||"",this.searchAriaLabel=t.searchAriaLabel||"Search options",this.searchLabelledBy=t.searchLabelledBy||"",this.clearAllAriaLabel=t.clearAllAriaLabel||"Clear selection"}}return class{constructor(e){var i;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=s((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.windowScroll=s((()=>{(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 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),this.cssClasses=new t(e.cssClasses);const n=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const t in e.events)e.events.hasOwnProperty(t)&&(-1!==n.indexOf(t)?this.events[t]=s(e.events[t],100):this.events[t]=e.events[t]);this.settings.disabled=(null===(i=e.settings)||void 0===i?void 0:i.disabled)?e.settings.disabled:this.selectEl.disabled,this.settings.isMultiple=this.selectEl.multiple,this.settings.style=this.selectEl.style.cssText,this.settings.class=this.selectEl.className.split(" "),this.select=new r(this.selectEl),this.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 l(this.settings.isMultiple?"multiple":"single",e.data?e.data:this.select.getData()),e.data&&this.select.updateOptions(this.store.getData());const a={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 o(this.settings,this.cssClasses,this.store,a),this.render.renderValues(),this.render.renderOptions(this.store.getData());const h=this.selectEl.getAttribute("aria-label"),d=this.selectEl.getAttribute("aria-labelledby");h?this.render.main.main.setAttribute("aria-label",h):d&&this.render.main.main.setAttribute("aria-labelledby",d),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(),s=this.store.validateDataArray(t);if(s)return void(this.events.error&&this.events.error(s));this.store.setData(t);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!i(e,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let t=this.store.getSelectedOptions();return this.settings.keepOrder&&(t=this.store.selectedOrderOptions(t)),t.map((t=>t.value))}setSelected(t,e=!0){const s=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&&!i(s,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 s=this.store.getData();this.select.updateOptions(s),this.render.renderValues(),this.render.renderOptions(s),this.events.afterChange&&!i(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.settings.focusSearch&&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 48a991c5..0221932a 100644 --- a/dist/slimselect.umd.js +++ b/dist/slimselect.umd.js @@ -387,6 +387,11 @@ el.textContent = ''; requestAnimationFrame(() => { el.textContent = msg; }); } + clearHighlights() { + const highlighted = this.content.list.querySelectorAll('.' + this.classes.highlighted); + highlighted.forEach(el => el.classList.remove(this.classes.highlighted)); + this.content.search.input.removeAttribute('aria-activedescendant'); + } constructor(settings, classes, store, callbacks) { var _a; this.store = store; @@ -397,6 +402,7 @@ this.main = this.mainDiv(); this.content = this.contentDiv(); this.updateClassStyles(); + this.main.values.setAttribute('role', 'list'); this.updateAriaAttributes(); const contentContainer = (_a = document .querySelector(`[data-id="${this.settings.id}"]`)) === null || _a === void 0 ? void 0 : _a.closest('.offcanvas-body'); @@ -436,7 +442,7 @@ 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.content.search.input.setAttribute('aria-expanded', 'true'); this.moveContent(); const selectedOptions = this.store.getSelectedOptions(); if (selectedOptions.length) { @@ -456,11 +462,9 @@ this.searchFocus(); } 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.main.classList.remove(this.classes.openAbove, this.classes.openBelow); + this.content.search.input.setAttribute('aria-expanded', 'false'); + this.content.main.classList.remove(this.classes.openAbove, this.classes.openBelow); this.main.arrow.path.setAttribute('d', this.classes.arrowClose); if (this.scrollHandler) { window.removeEventListener('scroll', this.scrollHandler, true); @@ -470,8 +474,8 @@ window.removeEventListener('resize', this.resizeHandler); this.resizeHandler = undefined; } + this.clearHighlights(); this.main.main.focus({ preventScroll: true }); - this.main.main.removeAttribute('aria-activedescendant'); } updateClassStyles() { this.main.main.className = ''; @@ -506,13 +510,15 @@ if (this.settings.isMultiple) { this.content.list.setAttribute('aria-multiselectable', 'true'); } - this.main.main.setAttribute('role', 'combobox'); - this.main.main.setAttribute('aria-haspopup', 'listbox'); - this.main.main.setAttribute('aria-controls', this.content.list.id); - this.main.main.setAttribute('aria-expanded', 'false'); - this.main.main.setAttribute('aria-autocomplete', 'list'); this.main.main.removeAttribute('aria-labelledby'); this.main.main.removeAttribute('aria-label'); + const input = this.content.search.input; + input.setAttribute('role', 'combobox'); + input.setAttribute('aria-haspopup', 'listbox'); + input.setAttribute('aria-controls', this.content.list.id); + input.setAttribute('aria-owns', this.content.list.id); + input.setAttribute('aria-expanded', 'false'); + input.setAttribute('aria-autocomplete', 'list'); let labelledById = (this.settings.ariaLabelledBy || '').trim(); let labelEl = null; if (!labelledById) { @@ -541,7 +547,6 @@ else if (this.settings.ariaLabel && this.settings.ariaLabel.trim()) { this.main.main.setAttribute('aria-label', this.settings.ariaLabel.trim()); } - this.main.main.setAttribute('aria-owns', this.content.list.id); this.content.search.input.setAttribute('aria-controls', this.content.list.id); this.content.search.input.setAttribute('aria-autocomplete', 'list'); if (labelledById && document.getElementById(labelledById)) { @@ -563,6 +568,8 @@ main.id = this.settings.id + '-main'; main.tabIndex = 0; main.onkeydown = (e) => { + if (e.target !== main) + return true; switch (e.key) { case 'ArrowUp': case 'ArrowDown': @@ -576,9 +583,8 @@ case ' ': this.callbacks.open(); const highlighted = this.content.list.querySelector('.' + this.classes.highlighted); - if (highlighted) { + if (highlighted) highlighted.click(); - } return false; case 'Escape': this.callbacks.close(); @@ -606,6 +612,7 @@ deselect.addEventListener('keydown', (e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); + e.stopPropagation(); deselect.click(); } }); @@ -817,28 +824,35 @@ const value = document.createElement('div'); value.classList.add(this.classes.value); value.dataset.id = option.id; + value.setAttribute('role', 'listitem'); + value.tabIndex = 0; + value.setAttribute('aria-label', option.text); const text = document.createElement('div'); text.classList.add(this.classes.valueText); text.textContent = option.text; value.appendChild(text); + let deleteDiv = null; if (!option.mandatory) { - const deleteDiv = document.createElement('div'); + const hintId = `${this.settings.id}__chip__${option.id}__hint`; + const hint = document.createElement('span'); + hint.id = hintId; + hint.className = 'ss-sr-only'; + hint.textContent = 'Press Delete or Backspace to remove.'; + value.appendChild(hint); + deleteDiv = document.createElement('div'); deleteDiv.classList.add(this.classes.valueDelete); deleteDiv.setAttribute('role', 'button'); - deleteDiv.setAttribute('aria-label', 'Remove selection'); - deleteDiv.setAttribute('title', 'Remove selection'); - deleteDiv.setAttribute('tabindex', '0'); + deleteDiv.setAttribute('aria-label', `Remove ${option.text}`); + deleteDiv.setAttribute('aria-hidden', 'true'); + deleteDiv.tabIndex = -1; deleteDiv.onclick = (e) => { e.preventDefault(); e.stopPropagation(); - if (this.settings.disabled) { + if (this.settings.disabled) return; - } let shouldDelete = true; const before = this.store.getSelectedOptions(); - const after = before.filter((o) => { - return o.selected && o.id !== option.id; - }, true); + const after = before.filter((o) => o.selected && o.id !== option.id, true); if (this.settings.minSelected && after.length < this.settings.minSelected) { return; } @@ -846,12 +860,11 @@ shouldDelete = this.callbacks.beforeChange(after, before) === true; } if (shouldDelete) { - let selectedIds = []; + const selectedIds = []; for (const o of after) { if (o instanceof Optgroup) { - for (const c of o.options) { + for (const c of o.options) selectedIds.push(c.id); - } } if (o instanceof Option) { selectedIds.push(o.id); @@ -865,6 +878,9 @@ this.callbacks.afterChange(after); } this.updateDeselectAll(); + requestAnimationFrame(() => { + this.main.main.focus({ preventScroll: true }); + }); } }; const deleteSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); @@ -879,9 +895,31 @@ deleteDiv.onkeydown = (e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); + e.stopPropagation(); deleteDiv.click(); } }; + value.addEventListener('keydown', (e) => { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault(); + e.stopPropagation(); + } + else if (e.key === 'Delete' || e.key === 'Backspace') { + e.preventDefault(); + e.stopPropagation(); + deleteDiv === null || deleteDiv === void 0 ? void 0 : deleteDiv.click(); + } + }); + value.addEventListener('focusin', () => { + value.setAttribute('aria-describedby', hintId); + deleteDiv.removeAttribute('aria-hidden'); + deleteDiv.tabIndex = 0; + }); + value.addEventListener('focusout', () => { + value.removeAttribute('aria-describedby'); + deleteDiv.setAttribute('aria-hidden', 'true'); + deleteDiv.tabIndex = -1; + }); } return value; } @@ -931,7 +969,7 @@ main.classList.add(this.classes.hide); input.readOnly = true; } - input.type = 'search'; + input.type = 'text'; input.placeholder = this.settings.searchPlaceholder; input.tabIndex = -1; if (this.settings.searchLabelledBy && this.settings.searchLabelledBy.trim()) { @@ -1121,7 +1159,7 @@ } let selectOption = options[dir === 'down' ? (i + 1 < options.length ? i + 1 : 0) : i - 1 >= 0 ? i - 1 : options.length - 1]; selectOption.classList.add(this.classes.highlighted); - this.main.main.setAttribute('aria-activedescendant', selectOption.id); + this.content.search.input.setAttribute('aria-activedescendant', selectOption.id); this.ensureElementInView(this.content.list, selectOption); const selectParent = selectOption.parentElement; if (selectParent && selectParent.classList.contains(this.classes.close)) { @@ -1135,7 +1173,7 @@ } const newly = options[dir === 'down' ? 0 : options.length - 1]; newly.classList.add(this.classes.highlighted); - this.main.main.setAttribute('aria-activedescendant', newly.id); + this.content.search.input.setAttribute('aria-activedescendant', newly.id); this.ensureElementInView(this.content.list, newly); } listDiv() { @@ -1376,7 +1414,7 @@ if (option.selected) { optionEl.classList.add(this.classes.selected); optionEl.setAttribute('aria-selected', 'true'); - this.main.main.setAttribute('aria-activedescendant', optionEl.id); + this.content.search.input.setAttribute('aria-activedescendant', optionEl.id); } else { optionEl.classList.remove(this.classes.selected); diff --git a/dist/slimselect.umd.min.js b/dist/slimselect.umd.min.js index 0a14acea..0c71a7dd 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";class t{constructor(t){t||(t={}),this.main=t.main||"ss-main",this.placeholder=t.placeholder||"ss-placeholder",this.values=t.values||"ss-values",this.single=t.single||"ss-single",this.max=t.max||"ss-max",this.value=t.value||"ss-value",this.valueText=t.valueText||"ss-value-text",this.valueDelete=t.valueDelete||"ss-value-delete",this.valueOut=t.valueOut||"ss-value-out",this.deselect=t.deselect||"ss-deselect",this.deselectPath=t.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=t.arrow||"ss-arrow",this.arrowClose=t.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=t.arrowOpen||"M10,70 L50,30 L90,70",this.content=t.content||"ss-content",this.openAbove=t.openAbove||"ss-open-above",this.openBelow=t.openBelow||"ss-open-below",this.search=t.search||"ss-search",this.searchHighlighter=t.searchHighlighter||"ss-search-highlight",this.searching=t.searching||"ss-searching",this.addable=t.addable||"ss-addable",this.addablePath=t.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=t.list||"ss-list",this.optgroup=t.optgroup||"ss-optgroup",this.optgroupLabel=t.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=t.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=t.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=t.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=t.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=t.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=t.optgroupClosable||"ss-closable",this.option=t.option||"ss-option",this.optionDelete=t.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=t.highlighted||"ss-highlighted",this.open=t.open||"ss-open",this.close=t.close||"ss-close",this.selected=t.selected||"ss-selected",this.error=t.error||"ss-error",this.disabled=t.disabled||"ss-disabled",this.hide=t.hide||"ss-hide"}}function e(){return Math.random().toString(36).substring(2,10)}function s(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 i(t,e){return JSON.stringify(t)===JSON.stringify(e)}class n{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 a(e))}}class a{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.defaultSelected=void 0!==t.defaultSelected&&t.defaultSelected,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 l{constructor(t,e){this.selectType="single",this.data=[],this.selectedOrder=[],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 n||"label"in e){if(!("label"in e))return new Error("Optgroup must have a label");if("options"in e&&e.options)for(let t of e.options){const e=this.validateOption(t);if(e)return e}}else{if(!(e instanceof a||"text"in e))return new Error("Data object must be a valid optgroup or option");{const t=this.validateOption(e);if(t)return 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 n||"label"in t){let s=[];"options"in t&&t.options&&t.options.forEach((t=>{s.push(new a(t))})),s.length>0&&e.push(new n(t))}(t instanceof a||"text"in t)&&e.push(new a(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,e=!1){if(e){let e=[new a(t)];this.setData(e.concat(this.getData()))}else this.setData(this.getData().concat(new a(t)))}setSelectedBy(t,e){let s=null,i=!1;const l=[];for(let o of this.data){if(o instanceof n)for(let n of o.options)s||(s=n),n.selected=!i&&e.includes(n[t]),n.selected&&(l.push(n),"single"===this.selectType&&(i=!0));o instanceof a&&(s||(s=o),o.selected=!i&&e.includes(o[t]),o.selected&&(l.push(o),"single"===this.selectType&&(i=!0)))}"single"===this.selectType&&s&&!i&&(s.selected=!0,l.push(s));const o=e.map((e=>{var s;return(null===(s=l.find((s=>s[t]===e)))||void 0===s?void 0:s.id)||""}));this.selectedOrder=o}getSelected(){return this.getSelectedOptions().map((t=>t.id))}getSelectedValues(){return this.getSelectedOptions().map((t=>t.value))}getSelectedOptions(){return this.filter((t=>t.selected),!1)}getOptgroupByID(t){for(let e of this.data)if(e instanceof n&&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 n?t=e.options[0]:e instanceof a&&(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((i=>{if(i instanceof n){let l=[];if(i.options.forEach((i=>{t&&!t(i)||(e?l.push(new a(i)):s.push(new a(i)))})),l.length>0){let t=new n(i);t.options=l,s.push(t)}}i instanceof a&&(t&&!t(i)||s.push(new a(i)))})),s}selectedOrderOptions(t){const e=[];return this.selectedOrder.forEach((s=>{const i=t.find((t=>t.id===s));i&&e.push(i)})),t.forEach((t=>{let s=!1;e.forEach((e=>{t.id!==e.id||(s=!0)})),s||e.push(t)})),e}}class o{static getLiveAssertive(){let t=document.getElementById("ss-live-assertive");return t||(t=document.createElement("div"),t.id="ss-live-assertive",t.setAttribute("role","status"),t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true"),t.className="ss-sr-only",document.body.appendChild(t)),t}_announceAssertive(t){const e=o._liveAssertive||(o._liveAssertive=o.getLiveAssertive());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}constructor(t,e,s,i){var n;this.store=s,this.settings=t,this.classes=e,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes();const a=null===(n=document.querySelector(`[data-id="${this.settings.id}"]`))||void 0===n?void 0:n.closest(".offcanvas-body");a?a.appendChild(this.content.main):this.settings.contentLocation&&this.settings.contentLocation.appendChild(this.content.main)}static getLivePolite(){let t=document.getElementById("ss-live-polite");return t||(t=document.createElement("div"),t.id="ss-live-polite",t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.className="ss-sr-only",document.body.appendChild(t)),t}_announcePolite(t){const e=o._livePolite||(o._livePolite=o.getLivePolite());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}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)}"fixed"===this.settings.contentPosition&&(this.moveContent(),this.scrollHandler=()=>this.moveContent(),this.resizeHandler=()=>this.moveContent(),window.addEventListener("scroll",this.scrollHandler,!0),window.addEventListener("resize",this.resizeHandler)),this.searchFocus()}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),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=void 0),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=void 0),this.main.main.focus({preventScroll:!0}),this.main.main.removeAttribute("aria-activedescendant")}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.main.main.classList.add("ss-2"),this.content.main.classList.add(this.classes.content),this.content.main.classList.add("ss-content-2"),""!==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&&"fixed"!==this.settings.contentPosition||this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){var t;this.content.list.setAttribute("role","listbox"),this.content.list.setAttribute("id",this.content.main.id+"-list"),this.content.list.setAttribute("aria-label",this.settings.contentAriaLabel),this.settings.isMultiple&&this.content.list.setAttribute("aria-multiselectable","true"),this.main.main.setAttribute("role","combobox"),this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.list.id),this.main.main.setAttribute("aria-expanded","false"),this.main.main.setAttribute("aria-autocomplete","list"),this.main.main.removeAttribute("aria-labelledby"),this.main.main.removeAttribute("aria-label");let e=(this.settings.ariaLabelledBy||"").trim(),s=null;if(e)s=document.getElementById(e);else{const i=document.querySelector(`select[data-id="${this.settings.id}"]`);i&&(i.id&&(s=document.querySelector(`label[for="${i.id}"]`)),s||"LABEL"!==(null===(t=i.previousElementSibling)||void 0===t?void 0:t.tagName)||(s=i.previousElementSibling),s&&(s.id||(s.id=(i.id||this.settings.id)+"-label"),e=s.id))}e&&document.getElementById(e)?this.main.main.setAttribute("aria-labelledby",e):this.settings.ariaLabel&&this.settings.ariaLabel.trim()&&this.main.main.setAttribute("aria-label",this.settings.ariaLabel.trim()),this.main.main.setAttribute("aria-owns",this.content.list.id),this.content.search.input.setAttribute("aria-controls",this.content.list.id),this.content.search.input.setAttribute("aria-autocomplete","list"),e&&document.getElementById(e)?this.content.search.input.setAttribute("aria-labelledby",e):this.settings.searchLabelledBy&&document.getElementById(this.settings.searchLabelledBy)?this.content.search.input.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel?this.content.search.input.setAttribute("aria-label",this.settings.searchAriaLabel):this.content.search.input.setAttribute("aria-label","Search options")}mainDiv(){var t;const e=document.createElement("div");e.id=this.settings.id+"-main",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===t.key.length&&this.callbacks.open(),!0},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),i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("aria-label",this.settings.clearAllAriaLabel),i.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i.click())}));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"),a.setAttribute("aria-hidden","true"),a.setAttribute("focusable","false");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"),o.setAttribute("aria-hidden","true"),o.setAttribute("focusable","false");const r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&o.classList.add(this.classes.hide),o.appendChild(r),e.appendChild(o),{main:e,values:s,deselect:{main:i,svg:a,path:l},arrow:{main:o,path:r}}}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()}this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e));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 i=this.store.getSelectedOptions(),l=i.filter((e=>e.selected&&e.id!==t.id),!0);if(!(this.settings.minSelected&&l.length{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),s.click())}}return e}contentDiv(){const t=document.createElement("div");t.id=this.settings.id+"-content";const e=this.searchDiv();t.appendChild(e.main);const s=this.listDiv();return t.appendChild(s),{main:t,search:e,list:s}}moveContent(){"relative"!==this.settings.contentPosition&&"down"!==this.settings.openPosition?"up"!==this.settings.openPosition?"up"===this.putContent()?this.moveContentAbove():this.moveContentBelow():this.moveContentAbove():this.moveContentBelow()}searchDiv(){const t=document.createElement("div"),e=document.createElement("input"),i=document.createElement("div");t.classList.add(this.classes.search);const n={main:t,input:e};if(this.settings.showSearch||(t.classList.add(this.classes.hide),e.readOnly=!0),e.type="search",e.placeholder=this.settings.searchPlaceholder,e.tabIndex=-1,this.settings.searchLabelledBy&&this.settings.searchLabelledBy.trim()?e.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel&&this.settings.searchAriaLabel.trim()?e.setAttribute("aria-label",this.settings.searchAriaLabel):e.setAttribute("aria-label","Search options"),e.setAttribute("autocapitalize","off"),e.setAttribute("autocomplete","off"),e.setAttribute("autocorrect","off"),e.oninput=s((t=>{this.callbacks.search(t.target.value)}),100),e.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" ":const e=this.content.list.querySelector("."+this.classes.highlighted);return!e||(e.click(),!1);case"Enter":if(this.callbacks.addable)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(e),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"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false");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 a(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=>{"string"==typeof t?s({text:t,value:t}):i instanceof Error?this.renderError(i.message):s(t)})):"string"==typeof i?s({text:i,value:i}):i instanceof Error?this.renderError(i.message):s(i))},t.appendChild(i),n.addable={main:i,svg:e,path:s}}return n}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.main.main.setAttribute("aria-activedescendant",a.id),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}const i=e["down"===t?0:e.length-1];i.classList.add(this.classes.highlighted),this.main.main.setAttribute("aria-activedescendant",i.id),this.ensureElementInView(this.content.list,i)}listDiv(){const t=document.createElement("div");return t.classList.add(this.classes.list),t}renderError(t){this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy");const e=document.createElement("div");e.classList.add(this.classes.error),e.textContent=t,this.content.list.appendChild(e),this._announceAssertive(t)}renderSearching(){this.content.list.innerHTML="",this.content.list.setAttribute("aria-busy","true");const t=document.createElement("div");t.classList.add(this.classes.searching),t.textContent=this.settings.searchingText,this.content.list.appendChild(t),this._announcePolite(this.settings.searchingText)}renderOptions(t){if(this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy"),0===t.length){const t=document.createElement("div");t.classList.add(this.classes.search);const e=this.callbacks.addable?this.settings.addableText.replace("{value}",this.content.search.input.value):this.settings.searchText;return this._announcePolite(e),t.innerHTML=e,this.content.list.appendChild(t),void this.content.list.setAttribute("aria-setsize","0")}if(this.settings.allowDeselect&&!this.settings.isMultiple){this.store.filter((t=>t.placeholder),!1).length||this.store.addOption(new a({text:"",value:"",selected:!1,placeholder:!0}),!0)}const e=document.createDocumentFragment();let s=0;const i=t.filter((t=>t instanceof a&&!t.placeholder&&t.display&&!t.disabled)).length,l=t=>{t.classList.contains(this.classes.placeholder)||t.classList.contains(this.classes.disabled)||t.classList.contains(this.classes.hide)||(t.setAttribute("aria-posinset",String(++s)),t.setAttribute("aria-setsize",String(i)))};for(const s of t){if(s instanceof n){const t=document.createElement("div");t.classList.add(this.classes.optgroup),t.setAttribute("role","group"),t.setAttribute("aria-label",s.label);const i=document.createElement("div");i.classList.add(this.classes.optgroupLabel),t.appendChild(i);const n=document.createElement("div");n.classList.add(this.classes.optgroupLabelText),n.textContent=s.label,i.appendChild(n);const a=document.createElement("div");if(a.classList.add(this.classes.optgroupActions),i.appendChild(a),this.settings.isMultiple&&s.selectAll){const t=document.createElement("div");t.classList.add(this.classes.optgroupSelectAll);let e=!0;for(const t of s.options)if(!t.selected){e=!1;break}e&&t.classList.add(this.classes.selected);const i=document.createElement("span");i.textContent=s.selectAllText,t.appendChild(i);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),t.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.optgroupSelectAllBox),n.appendChild(l);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.optgroupSelectAllCheck),n.appendChild(o),t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const i=this.store.getSelected();if(e){const t=i.filter((t=>{for(const e of s.options)if(t===e.id)return!1;return!0}));this.callbacks.setSelected(t,!0)}else{const t=i.concat(s.options.map((t=>t.id)));for(const t of s.options)this.store.getOptionByID(t.id)||this.callbacks.addOption(t);this.callbacks.setSelected(t,!0)}})),a.appendChild(t)}if("off"!==s.closable){const e=document.createElement("div");e.classList.add(this.classes.optgroupClosable);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.classList.add(this.classes.arrow),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),e.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","path");n.appendChild(l),s.options.some((t=>t.selected))||""!==this.content.search.input.value.trim()||"open"===s.closable?(t.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"close"===s.closable&&(t.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose)),i.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))})),a.appendChild(e)}t.appendChild(i);for(const e of s.options){const s=this.option(e);l(s),t.appendChild(s)}e.appendChild(t)}if(s instanceof a){const t=this.option(s);l(t),e.appendChild(t)}}this.content.list.appendChild(e),this.content.list.removeAttribute("aria-busy");const o=this.getOptions(!0,!0,!0).length;this._announcePolite(`${o} option${1===o?"":"s"} available`)}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=`${this.settings.id}__opt__${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),e.setAttribute("aria-disabled","true")),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=[];if(this.settings.isMultiple)if(t.selected)o=l.filter((t=>t.id!==n));else if(o=l.concat(t),!this.settings.closeOnSelect)if(e.shiftKey&&this.lastSelectedOption){const e=this.store.getDataOptions();let s=e.findIndex((t=>t.id===this.lastSelectedOption.id)),i=e.findIndex((e=>e.id===t.id));if(s>=0&&i>=0){const t=Math.min(s,i),n=Math.max(s,i),a=e.slice(t,n+1);a.length>0&&a.length!l.find((e=>e.id===t.id))))))}}else t.selected||(this.lastSelectedOption=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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=s.left+("fixed"===this.settings.contentPosition?0: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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=t.left+("fixed"===this.settings.contentPosition?0: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)}}o._livePolite=null,o._liveAssertive=null;class r{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){if(n.target===this.select&&("disabled"===n.attributeName&&(s=!0),"class"===n.attributeName&&(e=!0),"childList"===n.type)){for(const t of n.addedNodes)if("OPTION"===t.nodeName&&t.value===this.select.value){this.select.dispatchEvent(new Event("change"));break}i=!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:"",defaultSelected:t.defaultSelected,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)}setSelectedByValue(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.value)}}if("OPTION"===s.nodeName){const e=s;e.selected=t.includes(e.value)}}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 n&&this.select.appendChild(this.createOptgroup(e)),e instanceof a&&this.select.appendChild(this.createOption(e));this.select.dispatchEvent(new Event("change",{bubbles:!0})),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.textContent=t.text,""!==t.html&&e.setAttribute("data-html",t.html),e.defaultSelected=t.defaultSelected,e.selected=t.selected,t.disabled&&(e.disabled=!0),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(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.focusSearch=void 0===t.focusSearch||t.focusSearch,this.ariaLabel=t.ariaLabel||"",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.contentAriaLabel=void 0!==t.contentAriaLabel?t.contentAriaLabel:"Select an option",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",this.addableText=t.addableText||'Press "Enter" to add {value}',this.ariaLabelledBy=t.ariaLabelledBy||"",this.searchAriaLabel=t.searchAriaLabel||"Search options",this.searchLabelledBy=t.searchLabelledBy||"",this.clearAllAriaLabel=t.clearAllAriaLabel||"Clear selection"}}return class{constructor(e){var i;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=s((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.windowScroll=s((()=>{(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 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),this.cssClasses=new t(e.cssClasses);const n=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const t in e.events)e.events.hasOwnProperty(t)&&(-1!==n.indexOf(t)?this.events[t]=s(e.events[t],100):this.events[t]=e.events[t]);this.settings.disabled=(null===(i=e.settings)||void 0===i?void 0:i.disabled)?e.settings.disabled:this.selectEl.disabled,this.settings.isMultiple=this.selectEl.multiple,this.settings.style=this.selectEl.style.cssText,this.settings.class=this.selectEl.className.split(" "),this.select=new r(this.selectEl),this.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 l(this.settings.isMultiple?"multiple":"single",e.data?e.data:this.select.getData()),e.data&&this.select.updateOptions(this.store.getData());const a={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 o(this.settings,this.cssClasses,this.store,a),this.render.renderValues(),this.render.renderOptions(this.store.getData());const h=this.selectEl.getAttribute("aria-label"),d=this.selectEl.getAttribute("aria-labelledby");h?this.render.main.main.setAttribute("aria-label",h):d&&this.render.main.main.setAttribute("aria-labelledby",d),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(),s=this.store.validateDataArray(t);if(s)return void(this.events.error&&this.events.error(s));this.store.setData(t);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!i(e,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let t=this.store.getSelectedOptions();return this.settings.keepOrder&&(t=this.store.selectedOrderOptions(t)),t.map((t=>t.value))}setSelected(t,e=!0){const s=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&&!i(s,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 s=this.store.getData();this.select.updateOptions(s),this.render.renderValues(),this.render.renderOptions(s),this.events.afterChange&&!i(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.settings.focusSearch&&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";class t{constructor(t){t||(t={}),this.main=t.main||"ss-main",this.placeholder=t.placeholder||"ss-placeholder",this.values=t.values||"ss-values",this.single=t.single||"ss-single",this.max=t.max||"ss-max",this.value=t.value||"ss-value",this.valueText=t.valueText||"ss-value-text",this.valueDelete=t.valueDelete||"ss-value-delete",this.valueOut=t.valueOut||"ss-value-out",this.deselect=t.deselect||"ss-deselect",this.deselectPath=t.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=t.arrow||"ss-arrow",this.arrowClose=t.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=t.arrowOpen||"M10,70 L50,30 L90,70",this.content=t.content||"ss-content",this.openAbove=t.openAbove||"ss-open-above",this.openBelow=t.openBelow||"ss-open-below",this.search=t.search||"ss-search",this.searchHighlighter=t.searchHighlighter||"ss-search-highlight",this.searching=t.searching||"ss-searching",this.addable=t.addable||"ss-addable",this.addablePath=t.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=t.list||"ss-list",this.optgroup=t.optgroup||"ss-optgroup",this.optgroupLabel=t.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=t.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=t.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=t.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=t.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=t.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=t.optgroupClosable||"ss-closable",this.option=t.option||"ss-option",this.optionDelete=t.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=t.highlighted||"ss-highlighted",this.open=t.open||"ss-open",this.close=t.close||"ss-close",this.selected=t.selected||"ss-selected",this.error=t.error||"ss-error",this.disabled=t.disabled||"ss-disabled",this.hide=t.hide||"ss-hide"}}function e(){return Math.random().toString(36).substring(2,10)}function s(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 i(t,e){return JSON.stringify(t)===JSON.stringify(e)}class n{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 a(e))}}class a{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.defaultSelected=void 0!==t.defaultSelected&&t.defaultSelected,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 l{constructor(t,e){this.selectType="single",this.data=[],this.selectedOrder=[],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 n||"label"in e){if(!("label"in e))return new Error("Optgroup must have a label");if("options"in e&&e.options)for(let t of e.options){const e=this.validateOption(t);if(e)return e}}else{if(!(e instanceof a||"text"in e))return new Error("Data object must be a valid optgroup or option");{const t=this.validateOption(e);if(t)return 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 n||"label"in t){let s=[];"options"in t&&t.options&&t.options.forEach((t=>{s.push(new a(t))})),s.length>0&&e.push(new n(t))}(t instanceof a||"text"in t)&&e.push(new a(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,e=!1){if(e){let e=[new a(t)];this.setData(e.concat(this.getData()))}else this.setData(this.getData().concat(new a(t)))}setSelectedBy(t,e){let s=null,i=!1;const l=[];for(let o of this.data){if(o instanceof n)for(let n of o.options)s||(s=n),n.selected=!i&&e.includes(n[t]),n.selected&&(l.push(n),"single"===this.selectType&&(i=!0));o instanceof a&&(s||(s=o),o.selected=!i&&e.includes(o[t]),o.selected&&(l.push(o),"single"===this.selectType&&(i=!0)))}"single"===this.selectType&&s&&!i&&(s.selected=!0,l.push(s));const o=e.map((e=>{var s;return(null===(s=l.find((s=>s[t]===e)))||void 0===s?void 0:s.id)||""}));this.selectedOrder=o}getSelected(){return this.getSelectedOptions().map((t=>t.id))}getSelectedValues(){return this.getSelectedOptions().map((t=>t.value))}getSelectedOptions(){return this.filter((t=>t.selected),!1)}getOptgroupByID(t){for(let e of this.data)if(e instanceof n&&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 n?t=e.options[0]:e instanceof a&&(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((i=>{if(i instanceof n){let l=[];if(i.options.forEach((i=>{t&&!t(i)||(e?l.push(new a(i)):s.push(new a(i)))})),l.length>0){let t=new n(i);t.options=l,s.push(t)}}i instanceof a&&(t&&!t(i)||s.push(new a(i)))})),s}selectedOrderOptions(t){const e=[];return this.selectedOrder.forEach((s=>{const i=t.find((t=>t.id===s));i&&e.push(i)})),t.forEach((t=>{let s=!1;e.forEach((e=>{t.id!==e.id||(s=!0)})),s||e.push(t)})),e}}class o{static getLiveAssertive(){let t=document.getElementById("ss-live-assertive");return t||(t=document.createElement("div"),t.id="ss-live-assertive",t.setAttribute("role","status"),t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true"),t.className="ss-sr-only",document.body.appendChild(t)),t}_announceAssertive(t){const e=o._liveAssertive||(o._liveAssertive=o.getLiveAssertive());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}clearHighlights(){this.content.list.querySelectorAll("."+this.classes.highlighted).forEach((t=>t.classList.remove(this.classes.highlighted))),this.content.search.input.removeAttribute("aria-activedescendant")}constructor(t,e,s,i){var n;this.store=s,this.settings=t,this.classes=e,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.main.values.setAttribute("role","list"),this.updateAriaAttributes();const a=null===(n=document.querySelector(`[data-id="${this.settings.id}"]`))||void 0===n?void 0:n.closest(".offcanvas-body");a?a.appendChild(this.content.main):this.settings.contentLocation&&this.settings.contentLocation.appendChild(this.content.main)}static getLivePolite(){let t=document.getElementById("ss-live-polite");return t||(t=document.createElement("div"),t.id="ss-live-polite",t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.className="ss-sr-only",document.body.appendChild(t)),t}_announcePolite(t){const e=o._livePolite||(o._livePolite=o.getLivePolite());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}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.content.search.input.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)}"fixed"===this.settings.contentPosition&&(this.moveContent(),this.scrollHandler=()=>this.moveContent(),this.resizeHandler=()=>this.moveContent(),window.addEventListener("scroll",this.scrollHandler,!0),window.addEventListener("resize",this.resizeHandler)),this.searchFocus()}close(){this.main.main.classList.remove(this.classes.openAbove,this.classes.openBelow),this.content.search.input.setAttribute("aria-expanded","false"),this.content.main.classList.remove(this.classes.openAbove,this.classes.openBelow),this.main.arrow.path.setAttribute("d",this.classes.arrowClose),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=void 0),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=void 0),this.clearHighlights(),this.main.main.focus({preventScroll:!0})}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.main.main.classList.add("ss-2"),this.content.main.classList.add(this.classes.content),this.content.main.classList.add("ss-content-2"),""!==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&&"fixed"!==this.settings.contentPosition||this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){var t;this.content.list.setAttribute("role","listbox"),this.content.list.setAttribute("id",this.content.main.id+"-list"),this.content.list.setAttribute("aria-label",this.settings.contentAriaLabel),this.settings.isMultiple&&this.content.list.setAttribute("aria-multiselectable","true"),this.main.main.removeAttribute("aria-labelledby"),this.main.main.removeAttribute("aria-label");const e=this.content.search.input;e.setAttribute("role","combobox"),e.setAttribute("aria-haspopup","listbox"),e.setAttribute("aria-controls",this.content.list.id),e.setAttribute("aria-owns",this.content.list.id),e.setAttribute("aria-expanded","false"),e.setAttribute("aria-autocomplete","list");let s=(this.settings.ariaLabelledBy||"").trim(),i=null;if(s)i=document.getElementById(s);else{const e=document.querySelector(`select[data-id="${this.settings.id}"]`);e&&(e.id&&(i=document.querySelector(`label[for="${e.id}"]`)),i||"LABEL"!==(null===(t=e.previousElementSibling)||void 0===t?void 0:t.tagName)||(i=e.previousElementSibling),i&&(i.id||(i.id=(e.id||this.settings.id)+"-label"),s=i.id))}s&&document.getElementById(s)?this.main.main.setAttribute("aria-labelledby",s):this.settings.ariaLabel&&this.settings.ariaLabel.trim()&&this.main.main.setAttribute("aria-label",this.settings.ariaLabel.trim()),this.content.search.input.setAttribute("aria-controls",this.content.list.id),this.content.search.input.setAttribute("aria-autocomplete","list"),s&&document.getElementById(s)?this.content.search.input.setAttribute("aria-labelledby",s):this.settings.searchLabelledBy&&document.getElementById(this.settings.searchLabelledBy)?this.content.search.input.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel?this.content.search.input.setAttribute("aria-label",this.settings.searchAriaLabel):this.content.search.input.setAttribute("aria-label","Search options")}mainDiv(){var t;const e=document.createElement("div");e.id=this.settings.id+"-main",e.tabIndex=0,e.onkeydown=t=>{if(t.target!==e)return!0;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===t.key.length&&this.callbacks.open(),!0},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),i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("aria-label",this.settings.clearAllAriaLabel),i.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),i.click())}));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"),a.setAttribute("aria-hidden","true"),a.setAttribute("focusable","false");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"),o.setAttribute("aria-hidden","true"),o.setAttribute("focusable","false");const r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&o.classList.add(this.classes.hide),o.appendChild(r),e.appendChild(o),{main:e,values:s,deselect:{main:i,svg:a,path:l},arrow:{main:o,path:r}}}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()}this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e));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 i=this.store.getSelectedOptions(),l=i.filter((e=>e.selected&&e.id!==t.id),!0);if(!(this.settings.minSelected&&l.length{this.main.main.focus({preventScroll:!0})}))}};const o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("viewBox","0 0 100 100"),o.setAttribute("aria-hidden","true"),o.setAttribute("focusable","false");const r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttribute("d",this.classes.optionDelete),o.appendChild(r),i.appendChild(o),e.appendChild(i),i.onkeydown=t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),i.click())},e.addEventListener("keydown",(t=>{"Enter"===t.key||" "===t.key?(t.preventDefault(),t.stopPropagation()):"Delete"!==t.key&&"Backspace"!==t.key||(t.preventDefault(),t.stopPropagation(),null==i||i.click())})),e.addEventListener("focusin",(()=>{e.setAttribute("aria-describedby",s),i.removeAttribute("aria-hidden"),i.tabIndex=0})),e.addEventListener("focusout",(()=>{e.removeAttribute("aria-describedby"),i.setAttribute("aria-hidden","true"),i.tabIndex=-1}))}return e}contentDiv(){const t=document.createElement("div");t.id=this.settings.id+"-content";const e=this.searchDiv();t.appendChild(e.main);const s=this.listDiv();return t.appendChild(s),{main:t,search:e,list:s}}moveContent(){"relative"!==this.settings.contentPosition&&"down"!==this.settings.openPosition?"up"!==this.settings.openPosition?"up"===this.putContent()?this.moveContentAbove():this.moveContentBelow():this.moveContentAbove():this.moveContentBelow()}searchDiv(){const t=document.createElement("div"),e=document.createElement("input"),i=document.createElement("div");t.classList.add(this.classes.search);const n={main:t,input:e};if(this.settings.showSearch||(t.classList.add(this.classes.hide),e.readOnly=!0),e.type="text",e.placeholder=this.settings.searchPlaceholder,e.tabIndex=-1,this.settings.searchLabelledBy&&this.settings.searchLabelledBy.trim()?e.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel&&this.settings.searchAriaLabel.trim()?e.setAttribute("aria-label",this.settings.searchAriaLabel):e.setAttribute("aria-label","Search options"),e.setAttribute("autocapitalize","off"),e.setAttribute("autocomplete","off"),e.setAttribute("autocorrect","off"),e.oninput=s((t=>{this.callbacks.search(t.target.value)}),100),e.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" ":const e=this.content.list.querySelector("."+this.classes.highlighted);return!e||(e.click(),!1);case"Enter":if(this.callbacks.addable)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(e),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"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false");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 a(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=>{"string"==typeof t?s({text:t,value:t}):i instanceof Error?this.renderError(i.message):s(t)})):"string"==typeof i?s({text:i,value:i}):i instanceof Error?this.renderError(i.message):s(i))},t.appendChild(i),n.addable={main:i,svg:e,path:s}}return n}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.content.search.input.setAttribute("aria-activedescendant",a.id),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}const i=e["down"===t?0:e.length-1];i.classList.add(this.classes.highlighted),this.content.search.input.setAttribute("aria-activedescendant",i.id),this.ensureElementInView(this.content.list,i)}listDiv(){const t=document.createElement("div");return t.classList.add(this.classes.list),t}renderError(t){this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy");const e=document.createElement("div");e.classList.add(this.classes.error),e.textContent=t,this.content.list.appendChild(e),this._announceAssertive(t)}renderSearching(){this.content.list.innerHTML="",this.content.list.setAttribute("aria-busy","true");const t=document.createElement("div");t.classList.add(this.classes.searching),t.textContent=this.settings.searchingText,this.content.list.appendChild(t),this._announcePolite(this.settings.searchingText)}renderOptions(t){if(this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy"),0===t.length){const t=document.createElement("div");t.classList.add(this.classes.search);const e=this.callbacks.addable?this.settings.addableText.replace("{value}",this.content.search.input.value):this.settings.searchText;return this._announcePolite(e),t.innerHTML=e,this.content.list.appendChild(t),void this.content.list.setAttribute("aria-setsize","0")}if(this.settings.allowDeselect&&!this.settings.isMultiple){this.store.filter((t=>t.placeholder),!1).length||this.store.addOption(new a({text:"",value:"",selected:!1,placeholder:!0}),!0)}const e=document.createDocumentFragment();let s=0;const i=t.filter((t=>t instanceof a&&!t.placeholder&&t.display&&!t.disabled)).length,l=t=>{t.classList.contains(this.classes.placeholder)||t.classList.contains(this.classes.disabled)||t.classList.contains(this.classes.hide)||(t.setAttribute("aria-posinset",String(++s)),t.setAttribute("aria-setsize",String(i)))};for(const s of t){if(s instanceof n){const t=document.createElement("div");t.classList.add(this.classes.optgroup),t.setAttribute("role","group"),t.setAttribute("aria-label",s.label);const i=document.createElement("div");i.classList.add(this.classes.optgroupLabel),t.appendChild(i);const n=document.createElement("div");n.classList.add(this.classes.optgroupLabelText),n.textContent=s.label,i.appendChild(n);const a=document.createElement("div");if(a.classList.add(this.classes.optgroupActions),i.appendChild(a),this.settings.isMultiple&&s.selectAll){const t=document.createElement("div");t.classList.add(this.classes.optgroupSelectAll);let e=!0;for(const t of s.options)if(!t.selected){e=!1;break}e&&t.classList.add(this.classes.selected);const i=document.createElement("span");i.textContent=s.selectAllText,t.appendChild(i);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),t.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.optgroupSelectAllBox),n.appendChild(l);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.optgroupSelectAllCheck),n.appendChild(o),t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const i=this.store.getSelected();if(e){const t=i.filter((t=>{for(const e of s.options)if(t===e.id)return!1;return!0}));this.callbacks.setSelected(t,!0)}else{const t=i.concat(s.options.map((t=>t.id)));for(const t of s.options)this.store.getOptionByID(t.id)||this.callbacks.addOption(t);this.callbacks.setSelected(t,!0)}})),a.appendChild(t)}if("off"!==s.closable){const e=document.createElement("div");e.classList.add(this.classes.optgroupClosable);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.classList.add(this.classes.arrow),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),e.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","path");n.appendChild(l),s.options.some((t=>t.selected))||""!==this.content.search.input.value.trim()||"open"===s.closable?(t.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"close"===s.closable&&(t.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose)),i.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))})),a.appendChild(e)}t.appendChild(i);for(const e of s.options){const s=this.option(e);l(s),t.appendChild(s)}e.appendChild(t)}if(s instanceof a){const t=this.option(s);l(t),e.appendChild(t)}}this.content.list.appendChild(e),this.content.list.removeAttribute("aria-busy");const o=this.getOptions(!0,!0,!0).length;this._announcePolite(`${o} option${1===o?"":"s"} available`)}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=`${this.settings.id}__opt__${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),e.setAttribute("aria-disabled","true")),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.content.search.input.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=[];if(this.settings.isMultiple)if(t.selected)o=l.filter((t=>t.id!==n));else if(o=l.concat(t),!this.settings.closeOnSelect)if(e.shiftKey&&this.lastSelectedOption){const e=this.store.getDataOptions();let s=e.findIndex((t=>t.id===this.lastSelectedOption.id)),i=e.findIndex((e=>e.id===t.id));if(s>=0&&i>=0){const t=Math.min(s,i),n=Math.max(s,i),a=e.slice(t,n+1);a.length>0&&a.length!l.find((e=>e.id===t.id))))))}}else t.selected||(this.lastSelectedOption=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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=s.left+("fixed"===this.settings.contentPosition?0: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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=t.left+("fixed"===this.settings.contentPosition?0: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)}}o._livePolite=null,o._liveAssertive=null;class r{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){if(n.target===this.select&&("disabled"===n.attributeName&&(s=!0),"class"===n.attributeName&&(e=!0),"childList"===n.type)){for(const t of n.addedNodes)if("OPTION"===t.nodeName&&t.value===this.select.value){this.select.dispatchEvent(new Event("change"));break}i=!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:"",defaultSelected:t.defaultSelected,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)}setSelectedByValue(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.value)}}if("OPTION"===s.nodeName){const e=s;e.selected=t.includes(e.value)}}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 n&&this.select.appendChild(this.createOptgroup(e)),e instanceof a&&this.select.appendChild(this.createOption(e));this.select.dispatchEvent(new Event("change",{bubbles:!0})),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.textContent=t.text,""!==t.html&&e.setAttribute("data-html",t.html),e.defaultSelected=t.defaultSelected,e.selected=t.selected,t.disabled&&(e.disabled=!0),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(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.focusSearch=void 0===t.focusSearch||t.focusSearch,this.ariaLabel=t.ariaLabel||"",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.contentAriaLabel=void 0!==t.contentAriaLabel?t.contentAriaLabel:"Select an option",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",this.addableText=t.addableText||'Press "Enter" to add {value}',this.ariaLabelledBy=t.ariaLabelledBy||"",this.searchAriaLabel=t.searchAriaLabel||"Search options",this.searchLabelledBy=t.searchLabelledBy||"",this.clearAllAriaLabel=t.clearAllAriaLabel||"Clear selection"}}return class{constructor(e){var i;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=s((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.windowScroll=s((()=>{(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 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),this.cssClasses=new t(e.cssClasses);const n=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const t in e.events)e.events.hasOwnProperty(t)&&(-1!==n.indexOf(t)?this.events[t]=s(e.events[t],100):this.events[t]=e.events[t]);this.settings.disabled=(null===(i=e.settings)||void 0===i?void 0:i.disabled)?e.settings.disabled:this.selectEl.disabled,this.settings.isMultiple=this.selectEl.multiple,this.settings.style=this.selectEl.style.cssText,this.settings.class=this.selectEl.className.split(" "),this.select=new r(this.selectEl),this.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 l(this.settings.isMultiple?"multiple":"single",e.data?e.data:this.select.getData()),e.data&&this.select.updateOptions(this.store.getData());const a={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 o(this.settings,this.cssClasses,this.store,a),this.render.renderValues(),this.render.renderOptions(this.store.getData());const h=this.selectEl.getAttribute("aria-label"),d=this.selectEl.getAttribute("aria-labelledby");h?this.render.main.main.setAttribute("aria-label",h):d&&this.render.main.main.setAttribute("aria-labelledby",d),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(),s=this.store.validateDataArray(t);if(s)return void(this.events.error&&this.events.error(s));this.store.setData(t);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!i(e,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let t=this.store.getSelectedOptions();return this.settings.keepOrder&&(t=this.store.selectedOrderOptions(t)),t.map((t=>t.value))}setSelected(t,e=!0){const s=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&&!i(s,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 s=this.store.getData();this.select.updateOptions(s),this.render.renderValues(),this.render.renderOptions(s),this.events.afterChange&&!i(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.settings.focusSearch&&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 c3e3df28..02f7eca1 100644 --- a/docs/assets/index.js +++ b/docs/assets/index.js @@ -3,31 +3,31 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/home.js","asset * @vue/shared v3.5.17 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT -**//*! #__NO_SIDE_EFFECTS__ */function dn(t){const e=Object.create(null);for(const s of t.split(","))e[s]=1;return s=>s in e}const ie={},_t=[],qe=()=>{},nl=()=>!1,ws=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),pn=t=>t.startsWith("onUpdate:"),be=Object.assign,gn=(t,e)=>{const s=t.indexOf(e);s>-1&&t.splice(s,1)},il=Object.prototype.hasOwnProperty,X=(t,e)=>il.call(t,e),z=Array.isArray,Ot=t=>xs(t)==="[object Map]",Ii=t=>xs(t)==="[object Set]",G=t=>typeof t=="function",ce=t=>typeof t=="string",rt=t=>typeof t=="symbol",le=t=>t!==null&&typeof t=="object",Fi=t=>(le(t)||G(t))&&G(t.then)&&G(t.catch),Mi=Object.prototype.toString,xs=t=>Mi.call(t),rl=t=>xs(t).slice(8,-1),Ni=t=>xs(t)==="[object Object]",mn=t=>ce(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,Vt=dn(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Ss=t=>{const e=Object.create(null);return s=>e[s]||(e[s]=t(s))},ll=/-(\w)/g,Fe=Ss(t=>t.replace(ll,(e,s)=>s?s.toUpperCase():"")),ol=/\B([A-Z])/g,xt=Ss(t=>t.replace(ol,"-$1").toLowerCase()),Es=Ss(t=>t.charAt(0).toUpperCase()+t.slice(1)),Is=Ss(t=>t?`on${Es(t)}`:""),gt=(t,e)=>!Object.is(t,e),Fs=(t,...e)=>{for(let s=0;s{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:n,value:s})},al=t=>{const e=parseFloat(t);return isNaN(e)?t:e};let Bn;const Cs=()=>Bn||(Bn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function vn(t){if(z(t)){const e={};for(let s=0;s{if(s){const n=s.split(ul);n.length>1&&(e[n[0].trim()]=n[1].trim())}}),e}function bn(t){let e="";if(ce(t))e=t;else if(z(t))for(let s=0;s!!(t&&t.__v_isRef===!0),Vi=t=>ce(t)?t:t==null?"":z(t)||le(t)&&(t.toString===Mi||!G(t.toString))?Hi(t)?Vi(t.value):JSON.stringify(t,Ui,2):String(t),Ui=(t,e)=>Hi(e)?Ui(t,e.value):Ot(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((s,[n,i],r)=>(s[Ms(n,r)+" =>"]=i,s),{})}:Ii(e)?{[`Set(${e.size})`]:[...e.values()].map(s=>Ms(s))}:rt(e)?Ms(e):le(e)&&!z(e)&&!Ni(e)?String(e):e,Ms=(t,e="")=>{var s;return rt(t)?`Symbol(${(s=t.description)!=null?s:e})`:t};/** +**//*! #__NO_SIDE_EFFECTS__ */function dn(t){const e=Object.create(null);for(const s of t.split(","))e[s]=1;return s=>s in e}const ie={},_t=[],Ge=()=>{},nl=()=>!1,ws=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),pn=t=>t.startsWith("onUpdate:"),be=Object.assign,gn=(t,e)=>{const s=t.indexOf(e);s>-1&&t.splice(s,1)},il=Object.prototype.hasOwnProperty,X=(t,e)=>il.call(t,e),z=Array.isArray,Ot=t=>xs(t)==="[object Map]",Ii=t=>xs(t)==="[object Set]",q=t=>typeof t=="function",ce=t=>typeof t=="string",rt=t=>typeof t=="symbol",le=t=>t!==null&&typeof t=="object",Fi=t=>(le(t)||q(t))&&q(t.then)&&q(t.catch),Mi=Object.prototype.toString,xs=t=>Mi.call(t),rl=t=>xs(t).slice(8,-1),Ni=t=>xs(t)==="[object Object]",mn=t=>ce(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,Vt=dn(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Ss=t=>{const e=Object.create(null);return s=>e[s]||(e[s]=t(s))},ll=/-(\w)/g,Fe=Ss(t=>t.replace(ll,(e,s)=>s?s.toUpperCase():"")),ol=/\B([A-Z])/g,xt=Ss(t=>t.replace(ol,"-$1").toLowerCase()),Es=Ss(t=>t.charAt(0).toUpperCase()+t.slice(1)),Is=Ss(t=>t?`on${Es(t)}`:""),gt=(t,e)=>!Object.is(t,e),Fs=(t,...e)=>{for(let s=0;s{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:n,value:s})},al=t=>{const e=parseFloat(t);return isNaN(e)?t:e};let Bn;const Cs=()=>Bn||(Bn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function vn(t){if(z(t)){const e={};for(let s=0;s{if(s){const n=s.split(ul);n.length>1&&(e[n[0].trim()]=n[1].trim())}}),e}function bn(t){let e="";if(ce(t))e=t;else if(z(t))for(let s=0;s!!(t&&t.__v_isRef===!0),Vi=t=>ce(t)?t:t==null?"":z(t)||le(t)&&(t.toString===Mi||!q(t.toString))?Hi(t)?Vi(t.value):JSON.stringify(t,$i,2):String(t),$i=(t,e)=>Hi(e)?$i(t,e.value):Ot(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((s,[n,i],r)=>(s[Ms(n,r)+" =>"]=i,s),{})}:Ii(e)?{[`Set(${e.size})`]:[...e.values()].map(s=>Ms(s))}:rt(e)?Ms(e):le(e)&&!z(e)&&!Ni(e)?String(e):e,Ms=(t,e="")=>{var s;return rt(t)?`Symbol(${(s=t.description)!=null?s:e})`:t};/** * @vue/reactivity v3.5.17 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT -**/let Oe;class gl{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=Oe,!e&&Oe&&(this.index=(Oe.scopes||(Oe.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,s;if(this.scopes)for(e=0,s=this.scopes.length;e0&&--this._on===0&&(Oe=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){this._active=!1;let s,n;for(s=0,n=this.effects.length;s0)return;if($t){let e=$t;for($t=void 0;e;){const s=e.next;e.next=void 0,e.flags&=-9,e=s}}let t;for(;Ut;){let e=Ut;for(Ut=void 0;e;){const s=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(n){t||(t=n)}e=s}}if(t)throw t}function Wi(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function Gi(t){let e,s=t.depsTail,n=s;for(;n;){const i=n.prevDep;n.version===-1?(n===s&&(s=i),wn(n),vl(n)):e=n,n.dep.activeLink=n.prevActiveLink,n.prevActiveLink=void 0,n=i}t.deps=e,t.depsTail=s}function Js(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(qi(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function qi(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===Yt)||(t.globalVersion=Yt,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!Js(t))))return;t.flags|=2;const e=t.dep,s=ne,n=Be;ne=t,Be=!0;try{Wi(t);const i=t.fn(t._value);(e.version===0||gt(i,t._value))&&(t.flags|=128,t._value=i,e.version++)}catch(i){throw e.version++,i}finally{ne=s,Be=n,Gi(t),t.flags&=-3}}function wn(t,e=!1){const{dep:s,prevSub:n,nextSub:i}=t;if(n&&(n.nextSub=i,t.prevSub=void 0),i&&(i.prevSub=n,t.nextSub=void 0),s.subs===t&&(s.subs=n,!n&&s.computed)){s.computed.flags&=-5;for(let r=s.computed.deps;r;r=r.nextDep)wn(r,!0)}!e&&!--s.sc&&s.map&&s.map.delete(s.key)}function vl(t){const{prevDep:e,nextDep:s}=t;e&&(e.nextDep=s,t.prevDep=void 0),s&&(s.prevDep=e,t.nextDep=void 0)}let Be=!0;const Ki=[];function st(){Ki.push(Be),Be=!1}function nt(){const t=Ki.pop();Be=t===void 0?!0:t}function Hn(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const s=ne;ne=void 0;try{e()}finally{ne=s}}}let Yt=0;class bl{constructor(e,s){this.sub=e,this.dep=s,this.version=s.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class xn{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!ne||!Be||ne===this.computed)return;let s=this.activeLink;if(s===void 0||s.sub!==ne)s=this.activeLink=new bl(ne,this),ne.deps?(s.prevDep=ne.depsTail,ne.depsTail.nextDep=s,ne.depsTail=s):ne.deps=ne.depsTail=s,Yi(s);else if(s.version===-1&&(s.version=this.version,s.nextDep)){const n=s.nextDep;n.prevDep=s.prevDep,s.prevDep&&(s.prevDep.nextDep=n),s.prevDep=ne.depsTail,s.nextDep=void 0,ne.depsTail.nextDep=s,ne.depsTail=s,ne.deps===s&&(ne.deps=n)}return s}trigger(e){this.version++,Yt++,this.notify(e)}notify(e){yn();try{for(let s=this.subs;s;s=s.prevSub)s.sub.notify()&&s.sub.dep.notify()}finally{An()}}}function Yi(t){if(t.dep.sc++,t.sub.flags&4){const e=t.dep.computed;if(e&&!t.dep.subs){e.flags|=20;for(let n=e.deps;n;n=n.nextDep)Yi(n)}const s=t.dep.subs;s!==t&&(t.prevSub=s,s&&(s.nextSub=t)),t.dep.subs=t}}const Zs=new WeakMap,At=Symbol(""),Xs=Symbol(""),Qt=Symbol("");function ge(t,e,s){if(Be&&ne){let n=Zs.get(t);n||Zs.set(t,n=new Map);let i=n.get(s);i||(n.set(s,i=new xn),i.map=n,i.key=s),i.track()}}function et(t,e,s,n,i,r){const o=Zs.get(t);if(!o){Yt++;return}const l=a=>{a&&a.trigger()};if(yn(),e==="clear")o.forEach(l);else{const a=z(t),u=a&&mn(s);if(a&&s==="length"){const c=Number(n);o.forEach((f,p)=>{(p==="length"||p===Qt||!rt(p)&&p>=c)&&l(f)})}else switch((s!==void 0||o.has(void 0))&&l(o.get(s)),u&&l(o.get(Qt)),e){case"add":a?u&&l(o.get("length")):(l(o.get(At)),Ot(t)&&l(o.get(Xs)));break;case"delete":a||(l(o.get(At)),Ot(t)&&l(o.get(Xs)));break;case"set":Ot(t)&&l(o.get(At));break}}An()}function St(t){const e=Z(t);return e===t?e:(ge(e,"iterate",Qt),Ie(t)?e:e.map(he))}function _s(t){return ge(t=Z(t),"iterate",Qt),t}const yl={__proto__:null,[Symbol.iterator](){return Bs(this,Symbol.iterator,he)},concat(...t){return St(this).concat(...t.map(e=>z(e)?St(e):e))},entries(){return Bs(this,"entries",t=>(t[1]=he(t[1]),t))},every(t,e){return Ye(this,"every",t,e,void 0,arguments)},filter(t,e){return Ye(this,"filter",t,e,s=>s.map(he),arguments)},find(t,e){return Ye(this,"find",t,e,he,arguments)},findIndex(t,e){return Ye(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return Ye(this,"findLast",t,e,he,arguments)},findLastIndex(t,e){return Ye(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return Ye(this,"forEach",t,e,void 0,arguments)},includes(...t){return Hs(this,"includes",t)},indexOf(...t){return Hs(this,"indexOf",t)},join(t){return St(this).join(t)},lastIndexOf(...t){return Hs(this,"lastIndexOf",t)},map(t,e){return Ye(this,"map",t,e,void 0,arguments)},pop(){return Mt(this,"pop")},push(...t){return Mt(this,"push",t)},reduce(t,...e){return Vn(this,"reduce",t,e)},reduceRight(t,...e){return Vn(this,"reduceRight",t,e)},shift(){return Mt(this,"shift")},some(t,e){return Ye(this,"some",t,e,void 0,arguments)},splice(...t){return Mt(this,"splice",t)},toReversed(){return St(this).toReversed()},toSorted(t){return St(this).toSorted(t)},toSpliced(...t){return St(this).toSpliced(...t)},unshift(...t){return Mt(this,"unshift",t)},values(){return Bs(this,"values",he)}};function Bs(t,e,s){const n=_s(t),i=n[e]();return n!==t&&!Ie(t)&&(i._next=i.next,i.next=()=>{const r=i._next();return r.value&&(r.value=s(r.value)),r}),i}const Al=Array.prototype;function Ye(t,e,s,n,i,r){const o=_s(t),l=o!==t&&!Ie(t),a=o[e];if(a!==Al[e]){const f=a.apply(t,r);return l?he(f):f}let u=s;o!==t&&(l?u=function(f,p){return s.call(this,he(f),p,t)}:s.length>2&&(u=function(f,p){return s.call(this,f,p,t)}));const c=a.call(o,u,n);return l&&i?i(c):c}function Vn(t,e,s,n){const i=_s(t);let r=s;return i!==t&&(Ie(t)?s.length>3&&(r=function(o,l,a){return s.call(this,o,l,a,t)}):r=function(o,l,a){return s.call(this,o,he(l),a,t)}),i[e](r,...n)}function Hs(t,e,s){const n=Z(t);ge(n,"iterate",Qt);const i=n[e](...s);return(i===-1||i===!1)&&Cn(s[0])?(s[0]=Z(s[0]),n[e](...s)):i}function Mt(t,e,s=[]){st(),yn();const n=Z(t)[e].apply(t,s);return An(),nt(),n}const wl=dn("__proto__,__v_isRef,__isVue"),Qi=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(rt));function xl(t){rt(t)||(t=String(t));const e=Z(this);return ge(e,"has",t),e.hasOwnProperty(t)}class Ji{constructor(e=!1,s=!1){this._isReadonly=e,this._isShallow=s}get(e,s,n){if(s==="__v_skip")return e.__v_skip;const i=this._isReadonly,r=this._isShallow;if(s==="__v_isReactive")return!i;if(s==="__v_isReadonly")return i;if(s==="__v_isShallow")return r;if(s==="__v_raw")return n===(i?r?Dl:tr:r?er:Xi).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const o=z(e);if(!i){let a;if(o&&(a=yl[s]))return a;if(s==="hasOwnProperty")return xl}const l=Reflect.get(e,s,ve(e)?e:n);return(rt(s)?Qi.has(s):wl(s))||(i||ge(e,"get",s),r)?l:ve(l)?o&&mn(s)?l:l.value:le(l)?i?nr(l):Os(l):l}}class Zi extends Ji{constructor(e=!1){super(!1,e)}set(e,s,n,i){let r=e[s];if(!this._isShallow){const a=mt(r);if(!Ie(n)&&!mt(n)&&(r=Z(r),n=Z(n)),!z(e)&&ve(r)&&!ve(n))return a?!1:(r.value=n,!0)}const o=z(e)&&mn(s)?Number(s)t,ls=t=>Reflect.getPrototypeOf(t);function Ol(t,e,s){return function(...n){const i=this.__v_raw,r=Z(i),o=Ot(r),l=t==="entries"||t===Symbol.iterator&&o,a=t==="keys"&&o,u=i[t](...n),c=s?en:e?gs:he;return!e&&ge(r,"iterate",a?Xs:At),{next(){const{value:f,done:p}=u.next();return p?{value:f,done:p}:{value:l?[c(f[0]),c(f[1])]:c(f),done:p}},[Symbol.iterator](){return this}}}}function os(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function Ll(t,e){const s={get(i){const r=this.__v_raw,o=Z(r),l=Z(i);t||(gt(i,l)&&ge(o,"get",i),ge(o,"get",l));const{has:a}=ls(o),u=e?en:t?gs:he;if(a.call(o,i))return u(r.get(i));if(a.call(o,l))return u(r.get(l));r!==o&&r.get(i)},get size(){const i=this.__v_raw;return!t&&ge(Z(i),"iterate",At),Reflect.get(i,"size",i)},has(i){const r=this.__v_raw,o=Z(r),l=Z(i);return t||(gt(i,l)&&ge(o,"has",i),ge(o,"has",l)),i===l?r.has(i):r.has(i)||r.has(l)},forEach(i,r){const o=this,l=o.__v_raw,a=Z(l),u=e?en:t?gs:he;return!t&&ge(a,"iterate",At),l.forEach((c,f)=>i.call(r,u(c),u(f),o))}};return be(s,t?{add:os("add"),set:os("set"),delete:os("delete"),clear:os("clear")}:{add(i){!e&&!Ie(i)&&!mt(i)&&(i=Z(i));const r=Z(this);return ls(r).has.call(r,i)||(r.add(i),et(r,"add",i,i)),this},set(i,r){!e&&!Ie(r)&&!mt(r)&&(r=Z(r));const o=Z(this),{has:l,get:a}=ls(o);let u=l.call(o,i);u||(i=Z(i),u=l.call(o,i));const c=a.call(o,i);return o.set(i,r),u?gt(r,c)&&et(o,"set",i,r):et(o,"add",i,r),this},delete(i){const r=Z(this),{has:o,get:l}=ls(r);let a=o.call(r,i);a||(i=Z(i),a=o.call(r,i)),l&&l.call(r,i);const u=r.delete(i);return a&&et(r,"delete",i,void 0),u},clear(){const i=Z(this),r=i.size!==0,o=i.clear();return r&&et(i,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(i=>{s[i]=Ol(i,t,e)}),s}function Sn(t,e){const s=Ll(t,e);return(n,i,r)=>i==="__v_isReactive"?!t:i==="__v_isReadonly"?t:i==="__v_raw"?n:Reflect.get(X(s,i)&&i in n?s:n,i,r)}const Tl={get:Sn(!1,!1)},Pl={get:Sn(!1,!0)},Rl={get:Sn(!0,!1)};const Xi=new WeakMap,er=new WeakMap,tr=new WeakMap,Dl=new WeakMap;function kl(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Il(t){return t.__v_skip||!Object.isExtensible(t)?0:kl(rl(t))}function Os(t){return mt(t)?t:En(t,!1,El,Tl,Xi)}function sr(t){return En(t,!1,_l,Pl,er)}function nr(t){return En(t,!0,Cl,Rl,tr)}function En(t,e,s,n,i){if(!le(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const r=Il(t);if(r===0)return t;const o=i.get(t);if(o)return o;const l=new Proxy(t,r===2?n:s);return i.set(t,l),l}function Lt(t){return mt(t)?Lt(t.__v_raw):!!(t&&t.__v_isReactive)}function mt(t){return!!(t&&t.__v_isReadonly)}function Ie(t){return!!(t&&t.__v_isShallow)}function Cn(t){return t?!!t.__v_raw:!1}function Z(t){const e=t&&t.__v_raw;return e?Z(e):t}function Fl(t){return!X(t,"__v_skip")&&Object.isExtensible(t)&&Qs(t,"__v_skip",!0),t}const he=t=>le(t)?Os(t):t,gs=t=>le(t)?nr(t):t;function ve(t){return t?t.__v_isRef===!0:!1}function ir(t){return rr(t,!1)}function Ml(t){return rr(t,!0)}function rr(t,e){return ve(t)?t:new Nl(t,e)}class Nl{constructor(e,s){this.dep=new xn,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=s?e:Z(e),this._value=s?e:he(e),this.__v_isShallow=s}get value(){return this.dep.track(),this._value}set value(e){const s=this._rawValue,n=this.__v_isShallow||Ie(e)||mt(e);e=n?e:Z(e),gt(e,s)&&(this._rawValue=e,this._value=n?e:he(e),this.dep.trigger())}}function wt(t){return ve(t)?t.value:t}const Bl={get:(t,e,s)=>e==="__v_raw"?t:wt(Reflect.get(t,e,s)),set:(t,e,s,n)=>{const i=t[e];return ve(i)&&!ve(s)?(i.value=s,!0):Reflect.set(t,e,s,n)}};function lr(t){return Lt(t)?t:new Proxy(t,Bl)}class Hl{constructor(e,s,n){this.fn=e,this.setter=s,this._value=void 0,this.dep=new xn(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Yt-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!s,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&ne!==this)return zi(this,!0),!0}get value(){const e=this.dep.track();return qi(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function Vl(t,e,s=!1){let n,i;return G(t)?n=t:(n=t.get,i=t.set),new Hl(n,i,s)}const as={},ms=new WeakMap;let yt;function Ul(t,e=!1,s=yt){if(s){let n=ms.get(s);n||ms.set(s,n=[]),n.push(t)}}function $l(t,e,s=ie){const{immediate:n,deep:i,once:r,scheduler:o,augmentJob:l,call:a}=s,u=y=>i?y:Ie(y)||i===!1||i===0?pt(y,1):pt(y);let c,f,p,g,_=!1,C=!1;if(ve(t)?(f=()=>t.value,_=Ie(t)):Lt(t)?(f=()=>u(t),_=!0):z(t)?(C=!0,_=t.some(y=>Lt(y)||Ie(y)),f=()=>t.map(y=>{if(ve(y))return y.value;if(Lt(y))return u(y);if(G(y))return a?a(y,2):y()})):G(t)?e?f=a?()=>a(t,2):t:f=()=>{if(p){st();try{p()}finally{nt()}}const y=yt;yt=c;try{return a?a(t,3,[g]):t(g)}finally{yt=y}}:f=qe,e&&i){const y=f,S=i===!0?1/0:i;f=()=>pt(y(),S)}const D=ml(),T=()=>{c.stop(),D&&D.active&&gn(D.effects,c)};if(r&&e){const y=e;e=(...S)=>{y(...S),T()}}let m=C?new Array(t.length).fill(as):as;const b=y=>{if(!(!(c.flags&1)||!c.dirty&&!y))if(e){const S=c.run();if(i||_||(C?S.some((O,I)=>gt(O,m[I])):gt(S,m))){p&&p();const O=yt;yt=c;try{const I=[S,m===as?void 0:C&&m[0]===as?[]:m,g];m=S,a?a(e,3,I):e(...I)}finally{yt=O}}}else c.run()};return l&&l(b),c=new $i(f),c.scheduler=o?()=>o(b,!1):b,g=y=>Ul(y,!1,c),p=c.onStop=()=>{const y=ms.get(c);if(y){if(a)a(y,4);else for(const S of y)S();ms.delete(c)}},e?n?b(!0):m=c.run():o?o(b.bind(null,!0),!0):c.run(),T.pause=c.pause.bind(c),T.resume=c.resume.bind(c),T.stop=T,T}function pt(t,e=1/0,s){if(e<=0||!le(t)||t.__v_skip||(s=s||new Set,s.has(t)))return t;if(s.add(t),e--,ve(t))pt(t.value,e,s);else if(z(t))for(let n=0;n{pt(n,e,s)});else if(Ni(t)){for(const n in t)pt(t[n],e,s);for(const n of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,n)&&pt(t[n],e,s)}return t}/** +**/let Oe;class gl{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=Oe,!e&&Oe&&(this.index=(Oe.scopes||(Oe.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,s;if(this.scopes)for(e=0,s=this.scopes.length;e0&&--this._on===0&&(Oe=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){this._active=!1;let s,n;for(s=0,n=this.effects.length;s0)return;if(Ut){let e=Ut;for(Ut=void 0;e;){const s=e.next;e.next=void 0,e.flags&=-9,e=s}}let t;for(;$t;){let e=$t;for($t=void 0;e;){const s=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(n){t||(t=n)}e=s}}if(t)throw t}function Wi(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function qi(t){let e,s=t.depsTail,n=s;for(;n;){const i=n.prevDep;n.version===-1?(n===s&&(s=i),wn(n),vl(n)):e=n,n.dep.activeLink=n.prevActiveLink,n.prevActiveLink=void 0,n=i}t.deps=e,t.depsTail=s}function Js(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(Gi(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function Gi(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===Yt)||(t.globalVersion=Yt,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!Js(t))))return;t.flags|=2;const e=t.dep,s=ne,n=Be;ne=t,Be=!0;try{Wi(t);const i=t.fn(t._value);(e.version===0||gt(i,t._value))&&(t.flags|=128,t._value=i,e.version++)}catch(i){throw e.version++,i}finally{ne=s,Be=n,qi(t),t.flags&=-3}}function wn(t,e=!1){const{dep:s,prevSub:n,nextSub:i}=t;if(n&&(n.nextSub=i,t.prevSub=void 0),i&&(i.prevSub=n,t.nextSub=void 0),s.subs===t&&(s.subs=n,!n&&s.computed)){s.computed.flags&=-5;for(let r=s.computed.deps;r;r=r.nextDep)wn(r,!0)}!e&&!--s.sc&&s.map&&s.map.delete(s.key)}function vl(t){const{prevDep:e,nextDep:s}=t;e&&(e.nextDep=s,t.prevDep=void 0),s&&(s.prevDep=e,t.nextDep=void 0)}let Be=!0;const Ki=[];function st(){Ki.push(Be),Be=!1}function nt(){const t=Ki.pop();Be=t===void 0?!0:t}function Hn(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const s=ne;ne=void 0;try{e()}finally{ne=s}}}let Yt=0;class bl{constructor(e,s){this.sub=e,this.dep=s,this.version=s.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class xn{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!ne||!Be||ne===this.computed)return;let s=this.activeLink;if(s===void 0||s.sub!==ne)s=this.activeLink=new bl(ne,this),ne.deps?(s.prevDep=ne.depsTail,ne.depsTail.nextDep=s,ne.depsTail=s):ne.deps=ne.depsTail=s,Yi(s);else if(s.version===-1&&(s.version=this.version,s.nextDep)){const n=s.nextDep;n.prevDep=s.prevDep,s.prevDep&&(s.prevDep.nextDep=n),s.prevDep=ne.depsTail,s.nextDep=void 0,ne.depsTail.nextDep=s,ne.depsTail=s,ne.deps===s&&(ne.deps=n)}return s}trigger(e){this.version++,Yt++,this.notify(e)}notify(e){yn();try{for(let s=this.subs;s;s=s.prevSub)s.sub.notify()&&s.sub.dep.notify()}finally{An()}}}function Yi(t){if(t.dep.sc++,t.sub.flags&4){const e=t.dep.computed;if(e&&!t.dep.subs){e.flags|=20;for(let n=e.deps;n;n=n.nextDep)Yi(n)}const s=t.dep.subs;s!==t&&(t.prevSub=s,s&&(s.nextSub=t)),t.dep.subs=t}}const Zs=new WeakMap,At=Symbol(""),Xs=Symbol(""),Qt=Symbol("");function ge(t,e,s){if(Be&&ne){let n=Zs.get(t);n||Zs.set(t,n=new Map);let i=n.get(s);i||(n.set(s,i=new xn),i.map=n,i.key=s),i.track()}}function et(t,e,s,n,i,r){const o=Zs.get(t);if(!o){Yt++;return}const l=a=>{a&&a.trigger()};if(yn(),e==="clear")o.forEach(l);else{const a=z(t),u=a&&mn(s);if(a&&s==="length"){const c=Number(n);o.forEach((f,p)=>{(p==="length"||p===Qt||!rt(p)&&p>=c)&&l(f)})}else switch((s!==void 0||o.has(void 0))&&l(o.get(s)),u&&l(o.get(Qt)),e){case"add":a?u&&l(o.get("length")):(l(o.get(At)),Ot(t)&&l(o.get(Xs)));break;case"delete":a||(l(o.get(At)),Ot(t)&&l(o.get(Xs)));break;case"set":Ot(t)&&l(o.get(At));break}}An()}function St(t){const e=Z(t);return e===t?e:(ge(e,"iterate",Qt),Ie(t)?e:e.map(he))}function _s(t){return ge(t=Z(t),"iterate",Qt),t}const yl={__proto__:null,[Symbol.iterator](){return Bs(this,Symbol.iterator,he)},concat(...t){return St(this).concat(...t.map(e=>z(e)?St(e):e))},entries(){return Bs(this,"entries",t=>(t[1]=he(t[1]),t))},every(t,e){return Ye(this,"every",t,e,void 0,arguments)},filter(t,e){return Ye(this,"filter",t,e,s=>s.map(he),arguments)},find(t,e){return Ye(this,"find",t,e,he,arguments)},findIndex(t,e){return Ye(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return Ye(this,"findLast",t,e,he,arguments)},findLastIndex(t,e){return Ye(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return Ye(this,"forEach",t,e,void 0,arguments)},includes(...t){return Hs(this,"includes",t)},indexOf(...t){return Hs(this,"indexOf",t)},join(t){return St(this).join(t)},lastIndexOf(...t){return Hs(this,"lastIndexOf",t)},map(t,e){return Ye(this,"map",t,e,void 0,arguments)},pop(){return Mt(this,"pop")},push(...t){return Mt(this,"push",t)},reduce(t,...e){return Vn(this,"reduce",t,e)},reduceRight(t,...e){return Vn(this,"reduceRight",t,e)},shift(){return Mt(this,"shift")},some(t,e){return Ye(this,"some",t,e,void 0,arguments)},splice(...t){return Mt(this,"splice",t)},toReversed(){return St(this).toReversed()},toSorted(t){return St(this).toSorted(t)},toSpliced(...t){return St(this).toSpliced(...t)},unshift(...t){return Mt(this,"unshift",t)},values(){return Bs(this,"values",he)}};function Bs(t,e,s){const n=_s(t),i=n[e]();return n!==t&&!Ie(t)&&(i._next=i.next,i.next=()=>{const r=i._next();return r.value&&(r.value=s(r.value)),r}),i}const Al=Array.prototype;function Ye(t,e,s,n,i,r){const o=_s(t),l=o!==t&&!Ie(t),a=o[e];if(a!==Al[e]){const f=a.apply(t,r);return l?he(f):f}let u=s;o!==t&&(l?u=function(f,p){return s.call(this,he(f),p,t)}:s.length>2&&(u=function(f,p){return s.call(this,f,p,t)}));const c=a.call(o,u,n);return l&&i?i(c):c}function Vn(t,e,s,n){const i=_s(t);let r=s;return i!==t&&(Ie(t)?s.length>3&&(r=function(o,l,a){return s.call(this,o,l,a,t)}):r=function(o,l,a){return s.call(this,o,he(l),a,t)}),i[e](r,...n)}function Hs(t,e,s){const n=Z(t);ge(n,"iterate",Qt);const i=n[e](...s);return(i===-1||i===!1)&&Cn(s[0])?(s[0]=Z(s[0]),n[e](...s)):i}function Mt(t,e,s=[]){st(),yn();const n=Z(t)[e].apply(t,s);return An(),nt(),n}const wl=dn("__proto__,__v_isRef,__isVue"),Qi=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(rt));function xl(t){rt(t)||(t=String(t));const e=Z(this);return ge(e,"has",t),e.hasOwnProperty(t)}class Ji{constructor(e=!1,s=!1){this._isReadonly=e,this._isShallow=s}get(e,s,n){if(s==="__v_skip")return e.__v_skip;const i=this._isReadonly,r=this._isShallow;if(s==="__v_isReactive")return!i;if(s==="__v_isReadonly")return i;if(s==="__v_isShallow")return r;if(s==="__v_raw")return n===(i?r?Dl:tr:r?er:Xi).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const o=z(e);if(!i){let a;if(o&&(a=yl[s]))return a;if(s==="hasOwnProperty")return xl}const l=Reflect.get(e,s,ve(e)?e:n);return(rt(s)?Qi.has(s):wl(s))||(i||ge(e,"get",s),r)?l:ve(l)?o&&mn(s)?l:l.value:le(l)?i?nr(l):Os(l):l}}class Zi extends Ji{constructor(e=!1){super(!1,e)}set(e,s,n,i){let r=e[s];if(!this._isShallow){const a=mt(r);if(!Ie(n)&&!mt(n)&&(r=Z(r),n=Z(n)),!z(e)&&ve(r)&&!ve(n))return a?!1:(r.value=n,!0)}const o=z(e)&&mn(s)?Number(s)t,ls=t=>Reflect.getPrototypeOf(t);function Ol(t,e,s){return function(...n){const i=this.__v_raw,r=Z(i),o=Ot(r),l=t==="entries"||t===Symbol.iterator&&o,a=t==="keys"&&o,u=i[t](...n),c=s?en:e?gs:he;return!e&&ge(r,"iterate",a?Xs:At),{next(){const{value:f,done:p}=u.next();return p?{value:f,done:p}:{value:l?[c(f[0]),c(f[1])]:c(f),done:p}},[Symbol.iterator](){return this}}}}function os(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function Ll(t,e){const s={get(i){const r=this.__v_raw,o=Z(r),l=Z(i);t||(gt(i,l)&&ge(o,"get",i),ge(o,"get",l));const{has:a}=ls(o),u=e?en:t?gs:he;if(a.call(o,i))return u(r.get(i));if(a.call(o,l))return u(r.get(l));r!==o&&r.get(i)},get size(){const i=this.__v_raw;return!t&&ge(Z(i),"iterate",At),Reflect.get(i,"size",i)},has(i){const r=this.__v_raw,o=Z(r),l=Z(i);return t||(gt(i,l)&&ge(o,"has",i),ge(o,"has",l)),i===l?r.has(i):r.has(i)||r.has(l)},forEach(i,r){const o=this,l=o.__v_raw,a=Z(l),u=e?en:t?gs:he;return!t&&ge(a,"iterate",At),l.forEach((c,f)=>i.call(r,u(c),u(f),o))}};return be(s,t?{add:os("add"),set:os("set"),delete:os("delete"),clear:os("clear")}:{add(i){!e&&!Ie(i)&&!mt(i)&&(i=Z(i));const r=Z(this);return ls(r).has.call(r,i)||(r.add(i),et(r,"add",i,i)),this},set(i,r){!e&&!Ie(r)&&!mt(r)&&(r=Z(r));const o=Z(this),{has:l,get:a}=ls(o);let u=l.call(o,i);u||(i=Z(i),u=l.call(o,i));const c=a.call(o,i);return o.set(i,r),u?gt(r,c)&&et(o,"set",i,r):et(o,"add",i,r),this},delete(i){const r=Z(this),{has:o,get:l}=ls(r);let a=o.call(r,i);a||(i=Z(i),a=o.call(r,i)),l&&l.call(r,i);const u=r.delete(i);return a&&et(r,"delete",i,void 0),u},clear(){const i=Z(this),r=i.size!==0,o=i.clear();return r&&et(i,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(i=>{s[i]=Ol(i,t,e)}),s}function Sn(t,e){const s=Ll(t,e);return(n,i,r)=>i==="__v_isReactive"?!t:i==="__v_isReadonly"?t:i==="__v_raw"?n:Reflect.get(X(s,i)&&i in n?s:n,i,r)}const Tl={get:Sn(!1,!1)},Pl={get:Sn(!1,!0)},Rl={get:Sn(!0,!1)};const Xi=new WeakMap,er=new WeakMap,tr=new WeakMap,Dl=new WeakMap;function kl(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Il(t){return t.__v_skip||!Object.isExtensible(t)?0:kl(rl(t))}function Os(t){return mt(t)?t:En(t,!1,El,Tl,Xi)}function sr(t){return En(t,!1,_l,Pl,er)}function nr(t){return En(t,!0,Cl,Rl,tr)}function En(t,e,s,n,i){if(!le(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const r=Il(t);if(r===0)return t;const o=i.get(t);if(o)return o;const l=new Proxy(t,r===2?n:s);return i.set(t,l),l}function Lt(t){return mt(t)?Lt(t.__v_raw):!!(t&&t.__v_isReactive)}function mt(t){return!!(t&&t.__v_isReadonly)}function Ie(t){return!!(t&&t.__v_isShallow)}function Cn(t){return t?!!t.__v_raw:!1}function Z(t){const e=t&&t.__v_raw;return e?Z(e):t}function Fl(t){return!X(t,"__v_skip")&&Object.isExtensible(t)&&Qs(t,"__v_skip",!0),t}const he=t=>le(t)?Os(t):t,gs=t=>le(t)?nr(t):t;function ve(t){return t?t.__v_isRef===!0:!1}function ir(t){return rr(t,!1)}function Ml(t){return rr(t,!0)}function rr(t,e){return ve(t)?t:new Nl(t,e)}class Nl{constructor(e,s){this.dep=new xn,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=s?e:Z(e),this._value=s?e:he(e),this.__v_isShallow=s}get value(){return this.dep.track(),this._value}set value(e){const s=this._rawValue,n=this.__v_isShallow||Ie(e)||mt(e);e=n?e:Z(e),gt(e,s)&&(this._rawValue=e,this._value=n?e:he(e),this.dep.trigger())}}function wt(t){return ve(t)?t.value:t}const Bl={get:(t,e,s)=>e==="__v_raw"?t:wt(Reflect.get(t,e,s)),set:(t,e,s,n)=>{const i=t[e];return ve(i)&&!ve(s)?(i.value=s,!0):Reflect.set(t,e,s,n)}};function lr(t){return Lt(t)?t:new Proxy(t,Bl)}class Hl{constructor(e,s,n){this.fn=e,this.setter=s,this._value=void 0,this.dep=new xn(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Yt-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!s,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&ne!==this)return zi(this,!0),!0}get value(){const e=this.dep.track();return Gi(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function Vl(t,e,s=!1){let n,i;return q(t)?n=t:(n=t.get,i=t.set),new Hl(n,i,s)}const as={},ms=new WeakMap;let yt;function $l(t,e=!1,s=yt){if(s){let n=ms.get(s);n||ms.set(s,n=[]),n.push(t)}}function Ul(t,e,s=ie){const{immediate:n,deep:i,once:r,scheduler:o,augmentJob:l,call:a}=s,u=y=>i?y:Ie(y)||i===!1||i===0?pt(y,1):pt(y);let c,f,p,g,_=!1,C=!1;if(ve(t)?(f=()=>t.value,_=Ie(t)):Lt(t)?(f=()=>u(t),_=!0):z(t)?(C=!0,_=t.some(y=>Lt(y)||Ie(y)),f=()=>t.map(y=>{if(ve(y))return y.value;if(Lt(y))return u(y);if(q(y))return a?a(y,2):y()})):q(t)?e?f=a?()=>a(t,2):t:f=()=>{if(p){st();try{p()}finally{nt()}}const y=yt;yt=c;try{return a?a(t,3,[g]):t(g)}finally{yt=y}}:f=Ge,e&&i){const y=f,S=i===!0?1/0:i;f=()=>pt(y(),S)}const D=ml(),T=()=>{c.stop(),D&&D.active&&gn(D.effects,c)};if(r&&e){const y=e;e=(...S)=>{y(...S),T()}}let m=C?new Array(t.length).fill(as):as;const b=y=>{if(!(!(c.flags&1)||!c.dirty&&!y))if(e){const S=c.run();if(i||_||(C?S.some((O,I)=>gt(O,m[I])):gt(S,m))){p&&p();const O=yt;yt=c;try{const I=[S,m===as?void 0:C&&m[0]===as?[]:m,g];m=S,a?a(e,3,I):e(...I)}finally{yt=O}}}else c.run()};return l&&l(b),c=new Ui(f),c.scheduler=o?()=>o(b,!1):b,g=y=>$l(y,!1,c),p=c.onStop=()=>{const y=ms.get(c);if(y){if(a)a(y,4);else for(const S of y)S();ms.delete(c)}},e?n?b(!0):m=c.run():o?o(b.bind(null,!0),!0):c.run(),T.pause=c.pause.bind(c),T.resume=c.resume.bind(c),T.stop=T,T}function pt(t,e=1/0,s){if(e<=0||!le(t)||t.__v_skip||(s=s||new Set,s.has(t)))return t;if(s.add(t),e--,ve(t))pt(t.value,e,s);else if(z(t))for(let n=0;n{pt(n,e,s)});else if(Ni(t)){for(const n in t)pt(t[n],e,s);for(const n of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,n)&&pt(t[n],e,s)}return t}/** * @vue/runtime-core v3.5.17 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT -**/function is(t,e,s,n){try{return n?t(...n):t()}catch(i){Ls(i,e,s)}}function Ke(t,e,s,n){if(G(t)){const i=is(t,e,s,n);return i&&Fi(i)&&i.catch(r=>{Ls(r,e,s)}),i}if(z(t)){const i=[];for(let r=0;r>>1,i=Se[n],r=Jt(i);r=Jt(s)?Se.push(t):Se.splice(zl(e),0,t),t.flags|=1,cr()}}function cr(){vs||(vs=or.then(fr))}function Wl(t){z(t)?Tt.push(...t):ft&&t.id===-1?ft.splice(Et+1,0,t):t.flags&1||(Tt.push(t),t.flags|=1),cr()}function Un(t,e,s=We+1){for(;sJt(s)-Jt(n));if(Tt.length=0,ft){ft.push(...e);return}for(ft=e,Et=0;Ett.id==null?t.flags&2?-1:1/0:t.id;function fr(t){try{for(We=0;We{n._d&&Zn(-1);const r=bs(e);let o;try{o=t(...i)}finally{bs(r),n._d&&Zn(1)}return o};return n._n=!0,n._c=!0,n._d=!0,n}function vt(t,e,s,n){const i=t.dirs,r=e&&e.dirs;for(let o=0;ot.__isTeleport;function On(t,e){t.shapeFlag&6&&t.component?(t.transition=e,On(t.component.subTree,e)):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}/*! #__NO_SIDE_EFFECTS__ */function Ts(t,e){return G(t)?be({name:t.name},e,{setup:t}):t}function dr(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function jt(t,e,s,n,i=!1){if(z(t)){t.forEach((_,C)=>jt(_,e&&(z(e)?e[C]:e),s,n,i));return}if(Pt(n)&&!i){n.shapeFlag&512&&n.type.__asyncResolved&&n.component.subTree.component&&jt(t,e,s,n.component.subTree);return}const r=n.shapeFlag&4?Rn(n.component):n.el,o=i?null:r,{i:l,r:a}=t,u=e&&e.r,c=l.refs===ie?l.refs={}:l.refs,f=l.setupState,p=Z(f),g=f===ie?()=>!1:_=>X(p,_);if(u!=null&&u!==a&&(ce(u)?(c[u]=null,g(u)&&(f[u]=null)):ve(u)&&(u.value=null)),G(a))is(a,l,12,[o,c]);else{const _=ce(a),C=ve(a);if(_||C){const D=()=>{if(t.f){const T=_?g(a)?f[a]:c[a]:a.value;i?z(T)&&gn(T,r):z(T)?T.includes(r)||T.push(r):_?(c[a]=[r],g(a)&&(f[a]=c[a])):(a.value=[r],t.k&&(c[t.k]=a.value))}else _?(c[a]=o,g(a)&&(f[a]=o)):C&&(a.value=o,t.k&&(c[t.k]=o))};o?(D.id=-1,Pe(D,s)):D()}}}Cs().requestIdleCallback;Cs().cancelIdleCallback;const Pt=t=>!!t.type.__asyncLoader,pr=t=>t.type.__isKeepAlive;function Yl(t,e){gr(t,"a",e)}function Ql(t,e){gr(t,"da",e)}function gr(t,e,s=me){const n=t.__wdc||(t.__wdc=()=>{let i=s;for(;i;){if(i.isDeactivated)return;i=i.parent}return t()});if(Ps(e,n,s),s){let i=s.parent;for(;i&&i.parent;)pr(i.parent.vnode)&&Jl(n,e,s,i),i=i.parent}}function Jl(t,e,s,n){const i=Ps(e,t,n,!0);vr(()=>{gn(n[e],i)},s)}function Ps(t,e,s=me,n=!1){if(s){const i=s[t]||(s[t]=[]),r=e.__weh||(e.__weh=(...o)=>{st();const l=rs(s),a=Ke(e,s,t,o);return l(),nt(),a});return n?i.unshift(r):i.push(r),r}}const lt=t=>(e,s=me)=>{(!ts||t==="sp")&&Ps(t,(...n)=>e(...n),s)},Zl=lt("bm"),mr=lt("m"),Xl=lt("bu"),eo=lt("u"),to=lt("bum"),vr=lt("um"),so=lt("sp"),no=lt("rtg"),io=lt("rtc");function ro(t,e=me){Ps("ec",t,e)}const lo="components";function $n(t,e){return ao(lo,t,!0,e)||t}const oo=Symbol.for("v-ndc");function ao(t,e,s=!0,n=!1){const i=Ee||me;if(i){const r=i.type;{const l=Jo(r,!1);if(l&&(l===e||l===Fe(e)||l===Es(Fe(e))))return r}const o=jn(i[t]||r[t],e)||jn(i.appContext[t],e);return!o&&n?r:o}}function jn(t,e){return t&&(t[e]||t[Fe(e)]||t[Es(Fe(e))])}function tu(t,e,s,n){let i;const r=s,o=z(t);if(o||ce(t)){const l=o&&Lt(t);let a=!1,u=!1;l&&(a=!Ie(t),u=mt(t),t=_s(t)),i=new Array(t.length);for(let c=0,f=t.length;ce(l,a,void 0,r));else{const l=Object.keys(t);i=new Array(l.length);for(let a=0,u=l.length;aes(e)?!(e.type===it||e.type===Re&&!br(e.children)):!0)?t:null}const tn=t=>t?Hr(t)?Rn(t):tn(t.parent):null,zt=be(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>tn(t.parent),$root:t=>tn(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>Ar(t),$forceUpdate:t=>t.f||(t.f=()=>{_n(t.update)}),$nextTick:t=>t.n||(t.n=ar.bind(t.proxy)),$watch:t=>Po.bind(t)}),Vs=(t,e)=>t!==ie&&!t.__isScriptSetup&&X(t,e),co={get({_:t},e){if(e==="__v_skip")return!0;const{ctx:s,setupState:n,data:i,props:r,accessCache:o,type:l,appContext:a}=t;let u;if(e[0]!=="$"){const g=o[e];if(g!==void 0)switch(g){case 1:return n[e];case 2:return i[e];case 4:return s[e];case 3:return r[e]}else{if(Vs(n,e))return o[e]=1,n[e];if(i!==ie&&X(i,e))return o[e]=2,i[e];if((u=t.propsOptions[0])&&X(u,e))return o[e]=3,r[e];if(s!==ie&&X(s,e))return o[e]=4,s[e];sn&&(o[e]=0)}}const c=zt[e];let f,p;if(c)return e==="$attrs"&&ge(t.attrs,"get",""),c(t);if((f=l.__cssModules)&&(f=f[e]))return f;if(s!==ie&&X(s,e))return o[e]=4,s[e];if(p=a.config.globalProperties,X(p,e))return p[e]},set({_:t},e,s){const{data:n,setupState:i,ctx:r}=t;return Vs(i,e)?(i[e]=s,!0):n!==ie&&X(n,e)?(n[e]=s,!0):X(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(r[e]=s,!0)},has({_:{data:t,setupState:e,accessCache:s,ctx:n,appContext:i,propsOptions:r}},o){let l;return!!s[o]||t!==ie&&X(t,o)||Vs(e,o)||(l=r[0])&&X(l,o)||X(n,o)||X(zt,o)||X(i.config.globalProperties,o)},defineProperty(t,e,s){return s.get!=null?t._.accessCache[e]=0:X(s,"value")&&this.set(t,e,s.value,null),Reflect.defineProperty(t,e,s)}};function zn(t){return z(t)?t.reduce((e,s)=>(e[s]=null,e),{}):t}let sn=!0;function uo(t){const e=Ar(t),s=t.proxy,n=t.ctx;sn=!1,e.beforeCreate&&Wn(e.beforeCreate,t,"bc");const{data:i,computed:r,methods:o,watch:l,provide:a,inject:u,created:c,beforeMount:f,mounted:p,beforeUpdate:g,updated:_,activated:C,deactivated:D,beforeDestroy:T,beforeUnmount:m,destroyed:b,unmounted:y,render:S,renderTracked:O,renderTriggered:I,errorCaptured:W,serverPrefetch:H,expose:K,inheritAttrs:re,components:pe,directives:Le,filters:ot}=e;if(u&&fo(u,n,null),o)for(const Q in o){const $=o[Q];G($)&&(n[Q]=$.bind(s))}if(i){const Q=i.call(s,s);le(Q)&&(t.data=Os(Q))}if(sn=!0,r)for(const Q in r){const $=r[Q],ae=G($)?$.bind(s,s):G($.get)?$.get.bind(s,s):qe,ye=!G($)&&G($.set)?$.set.bind(s):qe,Ae=Ne({get:ae,set:ye});Object.defineProperty(n,Q,{enumerable:!0,configurable:!0,get:()=>Ae.value,set:te=>Ae.value=te})}if(l)for(const Q in l)yr(l[Q],n,s,Q);if(a){const Q=G(a)?a.call(s):a;Reflect.ownKeys(Q).forEach($=>{cs($,Q[$])})}c&&Wn(c,t,"c");function oe(Q,$){z($)?$.forEach(ae=>Q(ae.bind(s))):$&&Q($.bind(s))}if(oe(Zl,f),oe(mr,p),oe(Xl,g),oe(eo,_),oe(Yl,C),oe(Ql,D),oe(ro,W),oe(io,O),oe(no,I),oe(to,m),oe(vr,y),oe(so,H),z(K))if(K.length){const Q=t.exposed||(t.exposed={});K.forEach($=>{Object.defineProperty(Q,$,{get:()=>s[$],set:ae=>s[$]=ae})})}else t.exposed||(t.exposed={});S&&t.render===qe&&(t.render=S),re!=null&&(t.inheritAttrs=re),pe&&(t.components=pe),Le&&(t.directives=Le),H&&dr(t)}function fo(t,e,s=qe){z(t)&&(t=nn(t));for(const n in t){const i=t[n];let r;le(i)?"default"in i?r=tt(i.from||n,i.default,!0):r=tt(i.from||n):r=tt(i),ve(r)?Object.defineProperty(e,n,{enumerable:!0,configurable:!0,get:()=>r.value,set:o=>r.value=o}):e[n]=r}}function Wn(t,e,s){Ke(z(t)?t.map(n=>n.bind(e.proxy)):t.bind(e.proxy),e,s)}function yr(t,e,s,n){let i=n.includes(".")?kr(s,n):()=>s[n];if(ce(t)){const r=e[t];G(r)&&us(i,r)}else if(G(t))us(i,t.bind(s));else if(le(t))if(z(t))t.forEach(r=>yr(r,e,s,n));else{const r=G(t.handler)?t.handler.bind(s):e[t.handler];G(r)&&us(i,r,t)}}function Ar(t){const e=t.type,{mixins:s,extends:n}=e,{mixins:i,optionsCache:r,config:{optionMergeStrategies:o}}=t.appContext,l=r.get(e);let a;return l?a=l:!i.length&&!s&&!n?a=e:(a={},i.length&&i.forEach(u=>ys(a,u,o,!0)),ys(a,e,o)),le(e)&&r.set(e,a),a}function ys(t,e,s,n=!1){const{mixins:i,extends:r}=e;r&&ys(t,r,s,!0),i&&i.forEach(o=>ys(t,o,s,!0));for(const o in e)if(!(n&&o==="expose")){const l=ho[o]||s&&s[o];t[o]=l?l(t[o],e[o]):e[o]}return t}const ho={data:Gn,props:qn,emits:qn,methods:Ht,computed:Ht,beforeCreate:xe,created:xe,beforeMount:xe,mounted:xe,beforeUpdate:xe,updated:xe,beforeDestroy:xe,beforeUnmount:xe,destroyed:xe,unmounted:xe,activated:xe,deactivated:xe,errorCaptured:xe,serverPrefetch:xe,components:Ht,directives:Ht,watch:go,provide:Gn,inject:po};function Gn(t,e){return e?t?function(){return be(G(t)?t.call(this,this):t,G(e)?e.call(this,this):e)}:e:t}function po(t,e){return Ht(nn(t),nn(e))}function nn(t){if(z(t)){const e={};for(let s=0;s1)return s&&G(e)?e.call(n&&n.proxy):e}}const xr={},Sr=()=>Object.create(xr),Er=t=>Object.getPrototypeOf(t)===xr;function bo(t,e,s,n=!1){const i={},r=Sr();t.propsDefaults=Object.create(null),Cr(t,e,i,r);for(const o in t.propsOptions[0])o in i||(i[o]=void 0);s?t.props=n?i:sr(i):t.type.props?t.props=i:t.props=r,t.attrs=r}function yo(t,e,s,n){const{props:i,attrs:r,vnode:{patchFlag:o}}=t,l=Z(i),[a]=t.propsOptions;let u=!1;if((n||o>0)&&!(o&16)){if(o&8){const c=t.vnode.dynamicProps;for(let f=0;f{a=!0;const[p,g]=_r(f,e,!0);be(o,p),g&&l.push(...g)};!s&&e.mixins.length&&e.mixins.forEach(c),t.extends&&c(t.extends),t.mixins&&t.mixins.forEach(c)}if(!r&&!a)return le(t)&&n.set(t,_t),_t;if(z(r))for(let c=0;ct[0]==="_"||t==="$stable",Tn=t=>z(t)?t.map(Ge):[Ge(t)],wo=(t,e,s)=>{if(e._n)return e;const n=Gl((...i)=>Tn(e(...i)),s);return n._c=!1,n},Or=(t,e,s)=>{const n=t._ctx;for(const i in t){if(Ln(i))continue;const r=t[i];if(G(r))e[i]=wo(i,r,n);else if(r!=null){const o=Tn(r);e[i]=()=>o}}},Lr=(t,e)=>{const s=Tn(e);t.slots.default=()=>s},Tr=(t,e,s)=>{for(const n in e)(s||!Ln(n))&&(t[n]=e[n])},xo=(t,e,s)=>{const n=t.slots=Sr();if(t.vnode.shapeFlag&32){const i=e.__;i&&Qs(n,"__",i,!0);const r=e._;r?(Tr(n,e,s),s&&Qs(n,"_",r,!0)):Or(e,n)}else e&&Lr(t,e)},So=(t,e,s)=>{const{vnode:n,slots:i}=t;let r=!0,o=ie;if(n.shapeFlag&32){const l=e._;l?s&&l===1?r=!1:Tr(i,e,s):(r=!e.$stable,Or(e,i)),o=e}else e&&(Lr(t,e),o={default:1});if(r)for(const l in i)!Ln(l)&&o[l]==null&&delete i[l]},Pe=No;function Eo(t){return Co(t)}function Co(t,e){const s=Cs();s.__VUE__=!0;const{insert:n,remove:i,patchProp:r,createElement:o,createText:l,createComment:a,setText:u,setElementText:c,parentNode:f,nextSibling:p,setScopeId:g=qe,insertStaticContent:_}=t,C=(h,d,v,w=null,E=null,x=null,F=void 0,R=null,P=!!d.dynamicChildren)=>{if(h===d)return;h&&!Nt(h,d)&&(w=A(h),te(h,E,x,!0),h=null),d.patchFlag===-2&&(P=!1,d.dynamicChildren=null);const{type:L,ref:U,shapeFlag:M}=d;switch(L){case Ds:D(h,d,v,w);break;case it:T(h,d,v,w);break;case fs:h==null&&m(d,v,w,F);break;case Re:pe(h,d,v,w,E,x,F,R,P);break;default:M&1?S(h,d,v,w,E,x,F,R,P):M&6?Le(h,d,v,w,E,x,F,R,P):(M&64||M&128)&&L.process(h,d,v,w,E,x,F,R,P,B)}U!=null&&E?jt(U,h&&h.ref,x,d||h,!d):U==null&&h&&h.ref!=null&&jt(h.ref,null,x,h,!0)},D=(h,d,v,w)=>{if(h==null)n(d.el=l(d.children),v,w);else{const E=d.el=h.el;d.children!==h.children&&u(E,d.children)}},T=(h,d,v,w)=>{h==null?n(d.el=a(d.children||""),v,w):d.el=h.el},m=(h,d,v,w)=>{[h.el,h.anchor]=_(h.children,d,v,w,h.el,h.anchor)},b=({el:h,anchor:d},v,w)=>{let E;for(;h&&h!==d;)E=p(h),n(h,v,w),h=E;n(d,v,w)},y=({el:h,anchor:d})=>{let v;for(;h&&h!==d;)v=p(h),i(h),h=v;i(d)},S=(h,d,v,w,E,x,F,R,P)=>{d.type==="svg"?F="svg":d.type==="math"&&(F="mathml"),h==null?O(d,v,w,E,x,F,R,P):H(h,d,E,x,F,R,P)},O=(h,d,v,w,E,x,F,R)=>{let P,L;const{props:U,shapeFlag:M,transition:V,dirs:j}=h;if(P=h.el=o(h.type,x,U&&U.is,U),M&8?c(P,h.children):M&16&&W(h.children,P,null,w,E,Us(h,x),F,R),j&&vt(h,null,w,"created"),I(P,h,h.scopeId,F,w),U){for(const se in U)se!=="value"&&!Vt(se)&&r(P,se,null,U[se],x,w);"value"in U&&r(P,"value",null,U.value,x),(L=U.onVnodeBeforeMount)&&ze(L,w,h)}j&&vt(h,null,w,"beforeMount");const q=_o(E,V);q&&V.beforeEnter(P),n(P,d,v),((L=U&&U.onVnodeMounted)||q||j)&&Pe(()=>{L&&ze(L,w,h),q&&V.enter(P),j&&vt(h,null,w,"mounted")},E)},I=(h,d,v,w,E)=>{if(v&&g(h,v),w)for(let x=0;x{for(let L=P;L{const R=d.el=h.el;let{patchFlag:P,dynamicChildren:L,dirs:U}=d;P|=h.patchFlag&16;const M=h.props||ie,V=d.props||ie;let j;if(v&&bt(v,!1),(j=V.onVnodeBeforeUpdate)&&ze(j,v,d,h),U&&vt(d,h,v,"beforeUpdate"),v&&bt(v,!0),(M.innerHTML&&V.innerHTML==null||M.textContent&&V.textContent==null)&&c(R,""),L?K(h.dynamicChildren,L,R,v,w,Us(d,E),x):F||$(h,d,R,null,v,w,Us(d,E),x,!1),P>0){if(P&16)re(R,M,V,v,E);else if(P&2&&M.class!==V.class&&r(R,"class",null,V.class,E),P&4&&r(R,"style",M.style,V.style,E),P&8){const q=d.dynamicProps;for(let se=0;se{j&&ze(j,v,d,h),U&&vt(d,h,v,"updated")},w)},K=(h,d,v,w,E,x,F)=>{for(let R=0;R{if(d!==v){if(d!==ie)for(const x in d)!Vt(x)&&!(x in v)&&r(h,x,d[x],null,E,w);for(const x in v){if(Vt(x))continue;const F=v[x],R=d[x];F!==R&&x!=="value"&&r(h,x,R,F,E,w)}"value"in v&&r(h,"value",d.value,v.value,E)}},pe=(h,d,v,w,E,x,F,R,P)=>{const L=d.el=h?h.el:l(""),U=d.anchor=h?h.anchor:l("");let{patchFlag:M,dynamicChildren:V,slotScopeIds:j}=d;j&&(R=R?R.concat(j):j),h==null?(n(L,v,w),n(U,v,w),W(d.children||[],v,U,E,x,F,R,P)):M>0&&M&64&&V&&h.dynamicChildren?(K(h.dynamicChildren,V,v,E,x,F,R),(d.key!=null||E&&d===E.subTree)&&Pr(h,d,!0)):$(h,d,v,U,E,x,F,R,P)},Le=(h,d,v,w,E,x,F,R,P)=>{d.slotScopeIds=R,h==null?d.shapeFlag&512?E.ctx.activate(d,v,w,F,P):ot(d,v,w,E,x,F,P):at(h,d,P)},ot=(h,d,v,w,E,x,F)=>{const R=h.component=Go(h,w,E);if(pr(h)&&(R.ctx.renderer=B),qo(R,!1,F),R.asyncDep){if(E&&E.registerDep(R,oe,F),!h.el){const P=R.subTree=de(it);T(null,P,d,v)}}else oe(R,h,d,v,E,x,F)},at=(h,d,v)=>{const w=d.component=h.component;if(Fo(h,d,v))if(w.asyncDep&&!w.asyncResolved){Q(w,d,v);return}else w.next=d,w.update();else d.el=h.el,w.vnode=d},oe=(h,d,v,w,E,x,F)=>{const R=()=>{if(h.isMounted){let{next:M,bu:V,u:j,parent:q,vnode:se}=h;{const $e=Rr(h);if($e){M&&(M.el=se.el,Q(h,M,F)),$e.asyncDep.then(()=>{h.isUnmounted||R()});return}}let ee=M,Ce;bt(h,!1),M?(M.el=se.el,Q(h,M,F)):M=se,V&&Fs(V),(Ce=M.props&&M.props.onVnodeBeforeUpdate)&&ze(Ce,q,M,se),bt(h,!0);const _e=Qn(h),Ue=h.subTree;h.subTree=_e,C(Ue,_e,f(Ue.el),A(Ue),h,E,x),M.el=_e.el,ee===null&&Mo(h,_e.el),j&&Pe(j,E),(Ce=M.props&&M.props.onVnodeUpdated)&&Pe(()=>ze(Ce,q,M,se),E)}else{let M;const{el:V,props:j}=d,{bm:q,m:se,parent:ee,root:Ce,type:_e}=h,Ue=Pt(d);bt(h,!1),q&&Fs(q),!Ue&&(M=j&&j.onVnodeBeforeMount)&&ze(M,ee,d),bt(h,!0);{Ce.ce&&Ce.ce._def.shadowRoot!==!1&&Ce.ce._injectChildStyle(_e);const $e=h.subTree=Qn(h);C(null,$e,v,w,h,E,x),d.el=$e.el}if(se&&Pe(se,E),!Ue&&(M=j&&j.onVnodeMounted)){const $e=d;Pe(()=>ze(M,ee,$e),E)}(d.shapeFlag&256||ee&&Pt(ee.vnode)&&ee.vnode.shapeFlag&256)&&h.a&&Pe(h.a,E),h.isMounted=!0,d=v=w=null}};h.scope.on();const P=h.effect=new $i(R);h.scope.off();const L=h.update=P.run.bind(P),U=h.job=P.runIfDirty.bind(P);U.i=h,U.id=h.uid,P.scheduler=()=>_n(U),bt(h,!0),L()},Q=(h,d,v)=>{d.component=h;const w=h.vnode.props;h.vnode=d,h.next=null,yo(h,d.props,w,v),So(h,d.children,v),st(),Un(h),nt()},$=(h,d,v,w,E,x,F,R,P=!1)=>{const L=h&&h.children,U=h?h.shapeFlag:0,M=d.children,{patchFlag:V,shapeFlag:j}=d;if(V>0){if(V&128){ye(L,M,v,w,E,x,F,R,P);return}else if(V&256){ae(L,M,v,w,E,x,F,R,P);return}}j&8?(U&16&&fe(L,E,x),M!==L&&c(v,M)):U&16?j&16?ye(L,M,v,w,E,x,F,R,P):fe(L,E,x,!0):(U&8&&c(v,""),j&16&&W(M,v,w,E,x,F,R,P))},ae=(h,d,v,w,E,x,F,R,P)=>{h=h||_t,d=d||_t;const L=h.length,U=d.length,M=Math.min(L,U);let V;for(V=0;VU?fe(h,E,x,!0,!1,M):W(d,v,w,E,x,F,R,P,M)},ye=(h,d,v,w,E,x,F,R,P)=>{let L=0;const U=d.length;let M=h.length-1,V=U-1;for(;L<=M&&L<=V;){const j=h[L],q=d[L]=P?ht(d[L]):Ge(d[L]);if(Nt(j,q))C(j,q,v,null,E,x,F,R,P);else break;L++}for(;L<=M&&L<=V;){const j=h[M],q=d[V]=P?ht(d[V]):Ge(d[V]);if(Nt(j,q))C(j,q,v,null,E,x,F,R,P);else break;M--,V--}if(L>M){if(L<=V){const j=V+1,q=jV)for(;L<=M;)te(h[L],E,x,!0),L++;else{const j=L,q=L,se=new Map;for(L=q;L<=V;L++){const Te=d[L]=P?ht(d[L]):Ge(d[L]);Te.key!=null&&se.set(Te.key,L)}let ee,Ce=0;const _e=V-q+1;let Ue=!1,$e=0;const Ft=new Array(_e);for(L=0;L<_e;L++)Ft[L]=0;for(L=j;L<=M;L++){const Te=h[L];if(Ce>=_e){te(Te,E,x,!0);continue}let je;if(Te.key!=null)je=se.get(Te.key);else for(ee=q;ee<=V;ee++)if(Ft[ee-q]===0&&Nt(Te,d[ee])){je=ee;break}je===void 0?te(Te,E,x,!0):(Ft[je-q]=L+1,je>=$e?$e=je:Ue=!0,C(Te,d[je],v,null,E,x,F,R,P),Ce++)}const Mn=Ue?Oo(Ft):_t;for(ee=Mn.length-1,L=_e-1;L>=0;L--){const Te=q+L,je=d[Te],Nn=Te+1{const{el:x,type:F,transition:R,children:P,shapeFlag:L}=h;if(L&6){Ae(h.component.subTree,d,v,w);return}if(L&128){h.suspense.move(d,v,w);return}if(L&64){F.move(h,d,v,B);return}if(F===Re){n(x,d,v);for(let M=0;MR.enter(x),E);else{const{leave:M,delayLeave:V,afterLeave:j}=R,q=()=>{h.ctx.isUnmounted?i(x):n(x,d,v)},se=()=>{M(x,()=>{q(),j&&j()})};V?V(x,q,se):se()}else n(x,d,v)},te=(h,d,v,w=!1,E=!1)=>{const{type:x,props:F,ref:R,children:P,dynamicChildren:L,shapeFlag:U,patchFlag:M,dirs:V,cacheIndex:j}=h;if(M===-2&&(E=!1),R!=null&&(st(),jt(R,null,v,h,!0),nt()),j!=null&&(d.renderCache[j]=void 0),U&256){d.ctx.deactivate(h);return}const q=U&1&&V,se=!Pt(h);let ee;if(se&&(ee=F&&F.onVnodeBeforeUnmount)&&ze(ee,d,h),U&6)Ve(h.component,v,w);else{if(U&128){h.suspense.unmount(v,w);return}q&&vt(h,null,d,"beforeUnmount"),U&64?h.type.remove(h,d,v,B,w):L&&!L.hasOnce&&(x!==Re||M>0&&M&64)?fe(L,d,v,!1,!0):(x===Re&&M&384||!E&&U&16)&&fe(P,d,v),w&&ct(h)}(se&&(ee=F&&F.onVnodeUnmounted)||q)&&Pe(()=>{ee&&ze(ee,d,h),q&&vt(h,null,d,"unmounted")},v)},ct=h=>{const{type:d,el:v,anchor:w,transition:E}=h;if(d===Re){we(v,w);return}if(d===fs){y(h);return}const x=()=>{i(v),E&&!E.persisted&&E.afterLeave&&E.afterLeave()};if(h.shapeFlag&1&&E&&!E.persisted){const{leave:F,delayLeave:R}=E,P=()=>F(v,x);R?R(h.el,x,P):P()}else x()},we=(h,d)=>{let v;for(;h!==d;)v=p(h),i(h),h=v;i(d)},Ve=(h,d,v)=>{const{bum:w,scope:E,job:x,subTree:F,um:R,m:P,a:L,parent:U,slots:{__:M}}=h;Yn(P),Yn(L),w&&Fs(w),U&&z(M)&&M.forEach(V=>{U.renderCache[V]=void 0}),E.stop(),x&&(x.flags|=8,te(F,h,d,v)),R&&Pe(R,d),Pe(()=>{h.isUnmounted=!0},d),d&&d.pendingBranch&&!d.isUnmounted&&h.asyncDep&&!h.asyncResolved&&h.suspenseId===d.pendingId&&(d.deps--,d.deps===0&&d.resolve())},fe=(h,d,v,w=!1,E=!1,x=0)=>{for(let F=x;F{if(h.shapeFlag&6)return A(h.component.subTree);if(h.shapeFlag&128)return h.suspense.next();const d=p(h.anchor||h.el),v=d&&d[ql];return v?p(v):d};let N=!1;const k=(h,d,v)=>{h==null?d._vnode&&te(d._vnode,null,null,!0):C(d._vnode||null,h,d,null,null,null,v),d._vnode=h,N||(N=!0,Un(),ur(),N=!1)},B={p:C,um:te,m:Ae,r:ct,mt:ot,mc:W,pc:$,pbc:K,n:A,o:t};return{render:k,hydrate:void 0,createApp:vo(k)}}function Us({type:t,props:e},s){return s==="svg"&&t==="foreignObject"||s==="mathml"&&t==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:s}function bt({effect:t,job:e},s){s?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function _o(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function Pr(t,e,s=!1){const n=t.children,i=e.children;if(z(n)&&z(i))for(let r=0;r>1,t[s[l]]0&&(e[n]=s[r-1]),s[r]=n)}}for(r=s.length,o=s[r-1];r-- >0;)s[r]=o,o=e[o];return s}function Rr(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:Rr(e)}function Yn(t){if(t)for(let e=0;ett(Lo);function us(t,e,s){return Dr(t,e,s)}function Dr(t,e,s=ie){const{immediate:n,deep:i,flush:r,once:o}=s,l=be({},s),a=e&&n||!e&&r!=="post";let u;if(ts){if(r==="sync"){const g=To();u=g.__watcherHandles||(g.__watcherHandles=[])}else if(!a){const g=()=>{};return g.stop=qe,g.resume=qe,g.pause=qe,g}}const c=me;l.call=(g,_,C)=>Ke(g,c,_,C);let f=!1;r==="post"?l.scheduler=g=>{Pe(g,c&&c.suspense)}:r!=="sync"&&(f=!0,l.scheduler=(g,_)=>{_?g():_n(g)}),l.augmentJob=g=>{e&&(g.flags|=4),f&&(g.flags|=2,c&&(g.id=c.uid,g.i=c))};const p=$l(t,e,l);return ts&&(u?u.push(p):a&&p()),p}function Po(t,e,s){const n=this.proxy,i=ce(t)?t.includes(".")?kr(n,t):()=>n[t]:t.bind(n,n);let r;G(e)?r=e:(r=e.handler,s=e);const o=rs(this),l=Dr(i,r.bind(n),s);return o(),l}function kr(t,e){const s=e.split(".");return()=>{let n=t;for(let i=0;ie==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${Fe(e)}Modifiers`]||t[`${xt(e)}Modifiers`];function Do(t,e,...s){if(t.isUnmounted)return;const n=t.vnode.props||ie;let i=s;const r=e.startsWith("update:"),o=r&&Ro(n,e.slice(7));o&&(o.trim&&(i=s.map(c=>ce(c)?c.trim():c)),o.number&&(i=s.map(al)));let l,a=n[l=Is(e)]||n[l=Is(Fe(e))];!a&&r&&(a=n[l=Is(xt(e))]),a&&Ke(a,t,6,i);const u=n[l+"Once"];if(u){if(!t.emitted)t.emitted={};else if(t.emitted[l])return;t.emitted[l]=!0,Ke(u,t,6,i)}}function Ir(t,e,s=!1){const n=e.emitsCache,i=n.get(t);if(i!==void 0)return i;const r=t.emits;let o={},l=!1;if(!G(t)){const a=u=>{const c=Ir(u,e,!0);c&&(l=!0,be(o,c))};!s&&e.mixins.length&&e.mixins.forEach(a),t.extends&&a(t.extends),t.mixins&&t.mixins.forEach(a)}return!r&&!l?(le(t)&&n.set(t,null),null):(z(r)?r.forEach(a=>o[a]=null):be(o,r),le(t)&&n.set(t,o),o)}function Rs(t,e){return!t||!ws(e)?!1:(e=e.slice(2).replace(/Once$/,""),X(t,e[0].toLowerCase()+e.slice(1))||X(t,xt(e))||X(t,e))}function Qn(t){const{type:e,vnode:s,proxy:n,withProxy:i,propsOptions:[r],slots:o,attrs:l,emit:a,render:u,renderCache:c,props:f,data:p,setupState:g,ctx:_,inheritAttrs:C}=t,D=bs(t);let T,m;try{if(s.shapeFlag&4){const y=i||n,S=y;T=Ge(u.call(S,y,c,f,g,p,_)),m=l}else{const y=e;T=Ge(y.length>1?y(f,{attrs:l,slots:o,emit:a}):y(f,null)),m=e.props?l:ko(l)}}catch(y){Wt.length=0,Ls(y,t,1),T=de(it)}let b=T;if(m&&C!==!1){const y=Object.keys(m),{shapeFlag:S}=b;y.length&&S&7&&(r&&y.some(pn)&&(m=Io(m,r)),b=Dt(b,m,!1,!0))}return s.dirs&&(b=Dt(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(s.dirs):s.dirs),s.transition&&On(b,s.transition),T=b,bs(D),T}const ko=t=>{let e;for(const s in t)(s==="class"||s==="style"||ws(s))&&((e||(e={}))[s]=t[s]);return e},Io=(t,e)=>{const s={};for(const n in t)(!pn(n)||!(n.slice(9)in e))&&(s[n]=t[n]);return s};function Fo(t,e,s){const{props:n,children:i,component:r}=t,{props:o,children:l,patchFlag:a}=e,u=r.emitsOptions;if(e.dirs||e.transition)return!0;if(s&&a>=0){if(a&1024)return!0;if(a&16)return n?Jn(n,o,u):!!o;if(a&8){const c=e.dynamicProps;for(let f=0;ft.__isSuspense;function No(t,e){e&&e.pendingBranch?z(t)?e.effects.push(...t):e.effects.push(t):Wl(t)}const Re=Symbol.for("v-fgt"),Ds=Symbol.for("v-txt"),it=Symbol.for("v-cmt"),fs=Symbol.for("v-stc"),Wt=[];let De=null;function Zt(t=!1){Wt.push(De=t?null:[])}function Bo(){Wt.pop(),De=Wt[Wt.length-1]||null}let Xt=1;function Zn(t,e=!1){Xt+=t,t<0&&De&&e&&(De.hasOnce=!0)}function Mr(t){return t.dynamicChildren=Xt>0?De||_t:null,Bo(),Xt>0&&De&&De.push(t),t}function Nr(t,e,s,n,i,r){return Mr(Ze(t,e,s,n,i,r,!0))}function ln(t,e,s,n,i){return Mr(de(t,e,s,n,i,!0))}function es(t){return t?t.__v_isVNode===!0:!1}function Nt(t,e){return t.type===e.type&&t.key===e.key}const Br=({key:t})=>t??null,hs=({ref:t,ref_key:e,ref_for:s})=>(typeof t=="number"&&(t=""+t),t!=null?ce(t)||ve(t)||G(t)?{i:Ee,r:t,k:e,f:!!s}:t:null);function Ze(t,e=null,s=null,n=0,i=null,r=t===Re?0:1,o=!1,l=!1){const a={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&Br(e),ref:e&&hs(e),scopeId:hr,slotScopeIds:null,children:s,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:r,patchFlag:n,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:Ee};return l?(Pn(a,s),r&128&&t.normalize(a)):s&&(a.shapeFlag|=ce(s)?8:16),Xt>0&&!o&&De&&(a.patchFlag>0||r&6)&&a.patchFlag!==32&&De.push(a),a}const de=Ho;function Ho(t,e=null,s=null,n=0,i=null,r=!1){if((!t||t===oo)&&(t=it),es(t)){const l=Dt(t,e,!0);return s&&Pn(l,s),Xt>0&&!r&&De&&(l.shapeFlag&6?De[De.indexOf(t)]=l:De.push(l)),l.patchFlag=-2,l}if(Zo(t)&&(t=t.__vccOpts),e){e=Vo(e);let{class:l,style:a}=e;l&&!ce(l)&&(e.class=bn(l)),le(a)&&(Cn(a)&&!z(a)&&(a=be({},a)),e.style=vn(a))}const o=ce(t)?1:Fr(t)?128:Kl(t)?64:le(t)?4:G(t)?2:0;return Ze(t,e,s,n,i,o,r,!0)}function Vo(t){return t?Cn(t)||Er(t)?be({},t):t:null}function Dt(t,e,s=!1,n=!1){const{props:i,ref:r,patchFlag:o,children:l,transition:a}=t,u=e?jo(i||{},e):i,c={__v_isVNode:!0,__v_skip:!0,type:t.type,props:u,key:u&&Br(u),ref:e&&e.ref?s&&r?z(r)?r.concat(hs(e)):[r,hs(e)]:hs(e):r,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:l,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==Re?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:a,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&Dt(t.ssContent),ssFallback:t.ssFallback&&Dt(t.ssFallback),el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return a&&n&&On(c,a.clone(c)),c}function ds(t=" ",e=0){return de(Ds,null,t,e)}function Uo(t,e){const s=de(fs,null,t);return s.staticCount=e,s}function $o(t="",e=!1){return e?(Zt(),ln(it,null,t)):de(it,null,t)}function Ge(t){return t==null||typeof t=="boolean"?de(it):z(t)?de(Re,null,t.slice()):es(t)?ht(t):de(Ds,null,String(t))}function ht(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:Dt(t)}function Pn(t,e){let s=0;const{shapeFlag:n}=t;if(e==null)e=null;else if(z(e))s=16;else if(typeof e=="object")if(n&65){const i=e.default;i&&(i._c&&(i._d=!1),Pn(t,i()),i._c&&(i._d=!0));return}else{s=32;const i=e._;!i&&!Er(e)?e._ctx=Ee:i===3&&Ee&&(Ee.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else G(e)?(e={default:e,_ctx:Ee},s=32):(e=String(e),n&64?(s=16,e=[ds(e)]):s=8);t.children=e,t.shapeFlag|=s}function jo(...t){const e={};for(let s=0;s{let i;return(i=t[s])||(i=t[s]=[]),i.push(n),r=>{i.length>1?i.forEach(o=>o(r)):i[0](r)}};As=e("__VUE_INSTANCE_SETTERS__",s=>me=s),on=e("__VUE_SSR_SETTERS__",s=>ts=s)}const rs=t=>{const e=me;return As(t),t.scope.on(),()=>{t.scope.off(),As(e)}},Xn=()=>{me&&me.scope.off(),As(null)};function Hr(t){return t.vnode.shapeFlag&4}let ts=!1;function qo(t,e=!1,s=!1){e&&on(e);const{props:n,children:i}=t.vnode,r=Hr(t);bo(t,n,r,e),xo(t,i,s||e);const o=r?Ko(t,e):void 0;return e&&on(!1),o}function Ko(t,e){const s=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,co);const{setup:n}=s;if(n){st();const i=t.setupContext=n.length>1?Qo(t):null,r=rs(t),o=is(n,t,0,[t.props,i]),l=Fi(o);if(nt(),r(),(l||t.sp)&&!Pt(t)&&dr(t),l){if(o.then(Xn,Xn),e)return o.then(a=>{ei(t,a)}).catch(a=>{Ls(a,t,0)});t.asyncDep=o}else ei(t,o)}else Vr(t)}function ei(t,e,s){G(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:le(e)&&(t.setupState=lr(e)),Vr(t)}function Vr(t,e,s){const n=t.type;t.render||(t.render=n.render||qe);{const i=rs(t);st();try{uo(t)}finally{nt(),i()}}}const Yo={get(t,e){return ge(t,"get",""),t[e]}};function Qo(t){const e=s=>{t.exposed=s||{}};return{attrs:new Proxy(t.attrs,Yo),slots:t.slots,emit:t.emit,expose:e}}function Rn(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(lr(Fl(t.exposed)),{get(e,s){if(s in e)return e[s];if(s in zt)return zt[s](t)},has(e,s){return s in e||s in zt}})):t.proxy}function Jo(t,e=!0){return G(t)?t.displayName||t.name:t.name||e&&t.__name}function Zo(t){return G(t)&&"__vccOpts"in t}const Ne=(t,e)=>Vl(t,e,ts);function Ur(t,e,s){const n=arguments.length;return n===2?le(e)&&!z(e)?es(e)?de(t,null,[e]):de(t,e):de(t,null,e):(n>3?s=Array.prototype.slice.call(arguments,2):n===3&&es(s)&&(s=[s]),de(t,e,s))}const Xo="3.5.17";/** +**/function is(t,e,s,n){try{return n?t(...n):t()}catch(i){Ls(i,e,s)}}function Ke(t,e,s,n){if(q(t)){const i=is(t,e,s,n);return i&&Fi(i)&&i.catch(r=>{Ls(r,e,s)}),i}if(z(t)){const i=[];for(let r=0;r>>1,i=Se[n],r=Jt(i);r=Jt(s)?Se.push(t):Se.splice(zl(e),0,t),t.flags|=1,cr()}}function cr(){vs||(vs=or.then(fr))}function Wl(t){z(t)?Tt.push(...t):ft&&t.id===-1?ft.splice(Et+1,0,t):t.flags&1||(Tt.push(t),t.flags|=1),cr()}function $n(t,e,s=We+1){for(;sJt(s)-Jt(n));if(Tt.length=0,ft){ft.push(...e);return}for(ft=e,Et=0;Ett.id==null?t.flags&2?-1:1/0:t.id;function fr(t){try{for(We=0;We{n._d&&Zn(-1);const r=bs(e);let o;try{o=t(...i)}finally{bs(r),n._d&&Zn(1)}return o};return n._n=!0,n._c=!0,n._d=!0,n}function vt(t,e,s,n){const i=t.dirs,r=e&&e.dirs;for(let o=0;ot.__isTeleport;function On(t,e){t.shapeFlag&6&&t.component?(t.transition=e,On(t.component.subTree,e)):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}/*! #__NO_SIDE_EFFECTS__ */function Ts(t,e){return q(t)?be({name:t.name},e,{setup:t}):t}function dr(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function jt(t,e,s,n,i=!1){if(z(t)){t.forEach((_,C)=>jt(_,e&&(z(e)?e[C]:e),s,n,i));return}if(Pt(n)&&!i){n.shapeFlag&512&&n.type.__asyncResolved&&n.component.subTree.component&&jt(t,e,s,n.component.subTree);return}const r=n.shapeFlag&4?Rn(n.component):n.el,o=i?null:r,{i:l,r:a}=t,u=e&&e.r,c=l.refs===ie?l.refs={}:l.refs,f=l.setupState,p=Z(f),g=f===ie?()=>!1:_=>X(p,_);if(u!=null&&u!==a&&(ce(u)?(c[u]=null,g(u)&&(f[u]=null)):ve(u)&&(u.value=null)),q(a))is(a,l,12,[o,c]);else{const _=ce(a),C=ve(a);if(_||C){const D=()=>{if(t.f){const T=_?g(a)?f[a]:c[a]:a.value;i?z(T)&&gn(T,r):z(T)?T.includes(r)||T.push(r):_?(c[a]=[r],g(a)&&(f[a]=c[a])):(a.value=[r],t.k&&(c[t.k]=a.value))}else _?(c[a]=o,g(a)&&(f[a]=o)):C&&(a.value=o,t.k&&(c[t.k]=o))};o?(D.id=-1,Pe(D,s)):D()}}}Cs().requestIdleCallback;Cs().cancelIdleCallback;const Pt=t=>!!t.type.__asyncLoader,pr=t=>t.type.__isKeepAlive;function Yl(t,e){gr(t,"a",e)}function Ql(t,e){gr(t,"da",e)}function gr(t,e,s=me){const n=t.__wdc||(t.__wdc=()=>{let i=s;for(;i;){if(i.isDeactivated)return;i=i.parent}return t()});if(Ps(e,n,s),s){let i=s.parent;for(;i&&i.parent;)pr(i.parent.vnode)&&Jl(n,e,s,i),i=i.parent}}function Jl(t,e,s,n){const i=Ps(e,t,n,!0);vr(()=>{gn(n[e],i)},s)}function Ps(t,e,s=me,n=!1){if(s){const i=s[t]||(s[t]=[]),r=e.__weh||(e.__weh=(...o)=>{st();const l=rs(s),a=Ke(e,s,t,o);return l(),nt(),a});return n?i.unshift(r):i.push(r),r}}const lt=t=>(e,s=me)=>{(!ts||t==="sp")&&Ps(t,(...n)=>e(...n),s)},Zl=lt("bm"),mr=lt("m"),Xl=lt("bu"),eo=lt("u"),to=lt("bum"),vr=lt("um"),so=lt("sp"),no=lt("rtg"),io=lt("rtc");function ro(t,e=me){Ps("ec",t,e)}const lo="components";function Un(t,e){return ao(lo,t,!0,e)||t}const oo=Symbol.for("v-ndc");function ao(t,e,s=!0,n=!1){const i=Ee||me;if(i){const r=i.type;{const l=Jo(r,!1);if(l&&(l===e||l===Fe(e)||l===Es(Fe(e))))return r}const o=jn(i[t]||r[t],e)||jn(i.appContext[t],e);return!o&&n?r:o}}function jn(t,e){return t&&(t[e]||t[Fe(e)]||t[Es(Fe(e))])}function tu(t,e,s,n){let i;const r=s,o=z(t);if(o||ce(t)){const l=o&&Lt(t);let a=!1,u=!1;l&&(a=!Ie(t),u=mt(t),t=_s(t)),i=new Array(t.length);for(let c=0,f=t.length;ce(l,a,void 0,r));else{const l=Object.keys(t);i=new Array(l.length);for(let a=0,u=l.length;aes(e)?!(e.type===it||e.type===Re&&!br(e.children)):!0)?t:null}const tn=t=>t?Hr(t)?Rn(t):tn(t.parent):null,zt=be(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>tn(t.parent),$root:t=>tn(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>Ar(t),$forceUpdate:t=>t.f||(t.f=()=>{_n(t.update)}),$nextTick:t=>t.n||(t.n=ar.bind(t.proxy)),$watch:t=>Po.bind(t)}),Vs=(t,e)=>t!==ie&&!t.__isScriptSetup&&X(t,e),co={get({_:t},e){if(e==="__v_skip")return!0;const{ctx:s,setupState:n,data:i,props:r,accessCache:o,type:l,appContext:a}=t;let u;if(e[0]!=="$"){const g=o[e];if(g!==void 0)switch(g){case 1:return n[e];case 2:return i[e];case 4:return s[e];case 3:return r[e]}else{if(Vs(n,e))return o[e]=1,n[e];if(i!==ie&&X(i,e))return o[e]=2,i[e];if((u=t.propsOptions[0])&&X(u,e))return o[e]=3,r[e];if(s!==ie&&X(s,e))return o[e]=4,s[e];sn&&(o[e]=0)}}const c=zt[e];let f,p;if(c)return e==="$attrs"&&ge(t.attrs,"get",""),c(t);if((f=l.__cssModules)&&(f=f[e]))return f;if(s!==ie&&X(s,e))return o[e]=4,s[e];if(p=a.config.globalProperties,X(p,e))return p[e]},set({_:t},e,s){const{data:n,setupState:i,ctx:r}=t;return Vs(i,e)?(i[e]=s,!0):n!==ie&&X(n,e)?(n[e]=s,!0):X(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(r[e]=s,!0)},has({_:{data:t,setupState:e,accessCache:s,ctx:n,appContext:i,propsOptions:r}},o){let l;return!!s[o]||t!==ie&&X(t,o)||Vs(e,o)||(l=r[0])&&X(l,o)||X(n,o)||X(zt,o)||X(i.config.globalProperties,o)},defineProperty(t,e,s){return s.get!=null?t._.accessCache[e]=0:X(s,"value")&&this.set(t,e,s.value,null),Reflect.defineProperty(t,e,s)}};function zn(t){return z(t)?t.reduce((e,s)=>(e[s]=null,e),{}):t}let sn=!0;function uo(t){const e=Ar(t),s=t.proxy,n=t.ctx;sn=!1,e.beforeCreate&&Wn(e.beforeCreate,t,"bc");const{data:i,computed:r,methods:o,watch:l,provide:a,inject:u,created:c,beforeMount:f,mounted:p,beforeUpdate:g,updated:_,activated:C,deactivated:D,beforeDestroy:T,beforeUnmount:m,destroyed:b,unmounted:y,render:S,renderTracked:O,renderTriggered:I,errorCaptured:W,serverPrefetch:H,expose:K,inheritAttrs:re,components:pe,directives:Le,filters:ot}=e;if(u&&fo(u,n,null),o)for(const Q in o){const U=o[Q];q(U)&&(n[Q]=U.bind(s))}if(i){const Q=i.call(s,s);le(Q)&&(t.data=Os(Q))}if(sn=!0,r)for(const Q in r){const U=r[Q],ae=q(U)?U.bind(s,s):q(U.get)?U.get.bind(s,s):Ge,ye=!q(U)&&q(U.set)?U.set.bind(s):Ge,Ae=Ne({get:ae,set:ye});Object.defineProperty(n,Q,{enumerable:!0,configurable:!0,get:()=>Ae.value,set:te=>Ae.value=te})}if(l)for(const Q in l)yr(l[Q],n,s,Q);if(a){const Q=q(a)?a.call(s):a;Reflect.ownKeys(Q).forEach(U=>{cs(U,Q[U])})}c&&Wn(c,t,"c");function oe(Q,U){z(U)?U.forEach(ae=>Q(ae.bind(s))):U&&Q(U.bind(s))}if(oe(Zl,f),oe(mr,p),oe(Xl,g),oe(eo,_),oe(Yl,C),oe(Ql,D),oe(ro,W),oe(io,O),oe(no,I),oe(to,m),oe(vr,y),oe(so,H),z(K))if(K.length){const Q=t.exposed||(t.exposed={});K.forEach(U=>{Object.defineProperty(Q,U,{get:()=>s[U],set:ae=>s[U]=ae})})}else t.exposed||(t.exposed={});S&&t.render===Ge&&(t.render=S),re!=null&&(t.inheritAttrs=re),pe&&(t.components=pe),Le&&(t.directives=Le),H&&dr(t)}function fo(t,e,s=Ge){z(t)&&(t=nn(t));for(const n in t){const i=t[n];let r;le(i)?"default"in i?r=tt(i.from||n,i.default,!0):r=tt(i.from||n):r=tt(i),ve(r)?Object.defineProperty(e,n,{enumerable:!0,configurable:!0,get:()=>r.value,set:o=>r.value=o}):e[n]=r}}function Wn(t,e,s){Ke(z(t)?t.map(n=>n.bind(e.proxy)):t.bind(e.proxy),e,s)}function yr(t,e,s,n){let i=n.includes(".")?kr(s,n):()=>s[n];if(ce(t)){const r=e[t];q(r)&&us(i,r)}else if(q(t))us(i,t.bind(s));else if(le(t))if(z(t))t.forEach(r=>yr(r,e,s,n));else{const r=q(t.handler)?t.handler.bind(s):e[t.handler];q(r)&&us(i,r,t)}}function Ar(t){const e=t.type,{mixins:s,extends:n}=e,{mixins:i,optionsCache:r,config:{optionMergeStrategies:o}}=t.appContext,l=r.get(e);let a;return l?a=l:!i.length&&!s&&!n?a=e:(a={},i.length&&i.forEach(u=>ys(a,u,o,!0)),ys(a,e,o)),le(e)&&r.set(e,a),a}function ys(t,e,s,n=!1){const{mixins:i,extends:r}=e;r&&ys(t,r,s,!0),i&&i.forEach(o=>ys(t,o,s,!0));for(const o in e)if(!(n&&o==="expose")){const l=ho[o]||s&&s[o];t[o]=l?l(t[o],e[o]):e[o]}return t}const ho={data:qn,props:Gn,emits:Gn,methods:Ht,computed:Ht,beforeCreate:xe,created:xe,beforeMount:xe,mounted:xe,beforeUpdate:xe,updated:xe,beforeDestroy:xe,beforeUnmount:xe,destroyed:xe,unmounted:xe,activated:xe,deactivated:xe,errorCaptured:xe,serverPrefetch:xe,components:Ht,directives:Ht,watch:go,provide:qn,inject:po};function qn(t,e){return e?t?function(){return be(q(t)?t.call(this,this):t,q(e)?e.call(this,this):e)}:e:t}function po(t,e){return Ht(nn(t),nn(e))}function nn(t){if(z(t)){const e={};for(let s=0;s1)return s&&q(e)?e.call(n&&n.proxy):e}}const xr={},Sr=()=>Object.create(xr),Er=t=>Object.getPrototypeOf(t)===xr;function bo(t,e,s,n=!1){const i={},r=Sr();t.propsDefaults=Object.create(null),Cr(t,e,i,r);for(const o in t.propsOptions[0])o in i||(i[o]=void 0);s?t.props=n?i:sr(i):t.type.props?t.props=i:t.props=r,t.attrs=r}function yo(t,e,s,n){const{props:i,attrs:r,vnode:{patchFlag:o}}=t,l=Z(i),[a]=t.propsOptions;let u=!1;if((n||o>0)&&!(o&16)){if(o&8){const c=t.vnode.dynamicProps;for(let f=0;f{a=!0;const[p,g]=_r(f,e,!0);be(o,p),g&&l.push(...g)};!s&&e.mixins.length&&e.mixins.forEach(c),t.extends&&c(t.extends),t.mixins&&t.mixins.forEach(c)}if(!r&&!a)return le(t)&&n.set(t,_t),_t;if(z(r))for(let c=0;ct[0]==="_"||t==="$stable",Tn=t=>z(t)?t.map(qe):[qe(t)],wo=(t,e,s)=>{if(e._n)return e;const n=ql((...i)=>Tn(e(...i)),s);return n._c=!1,n},Or=(t,e,s)=>{const n=t._ctx;for(const i in t){if(Ln(i))continue;const r=t[i];if(q(r))e[i]=wo(i,r,n);else if(r!=null){const o=Tn(r);e[i]=()=>o}}},Lr=(t,e)=>{const s=Tn(e);t.slots.default=()=>s},Tr=(t,e,s)=>{for(const n in e)(s||!Ln(n))&&(t[n]=e[n])},xo=(t,e,s)=>{const n=t.slots=Sr();if(t.vnode.shapeFlag&32){const i=e.__;i&&Qs(n,"__",i,!0);const r=e._;r?(Tr(n,e,s),s&&Qs(n,"_",r,!0)):Or(e,n)}else e&&Lr(t,e)},So=(t,e,s)=>{const{vnode:n,slots:i}=t;let r=!0,o=ie;if(n.shapeFlag&32){const l=e._;l?s&&l===1?r=!1:Tr(i,e,s):(r=!e.$stable,Or(e,i)),o=e}else e&&(Lr(t,e),o={default:1});if(r)for(const l in i)!Ln(l)&&o[l]==null&&delete i[l]},Pe=No;function Eo(t){return Co(t)}function Co(t,e){const s=Cs();s.__VUE__=!0;const{insert:n,remove:i,patchProp:r,createElement:o,createText:l,createComment:a,setText:u,setElementText:c,parentNode:f,nextSibling:p,setScopeId:g=Ge,insertStaticContent:_}=t,C=(h,d,v,w=null,E=null,x=null,F=void 0,R=null,P=!!d.dynamicChildren)=>{if(h===d)return;h&&!Nt(h,d)&&(w=A(h),te(h,E,x,!0),h=null),d.patchFlag===-2&&(P=!1,d.dynamicChildren=null);const{type:L,ref:$,shapeFlag:M}=d;switch(L){case Ds:D(h,d,v,w);break;case it:T(h,d,v,w);break;case fs:h==null&&m(d,v,w,F);break;case Re:pe(h,d,v,w,E,x,F,R,P);break;default:M&1?S(h,d,v,w,E,x,F,R,P):M&6?Le(h,d,v,w,E,x,F,R,P):(M&64||M&128)&&L.process(h,d,v,w,E,x,F,R,P,B)}$!=null&&E?jt($,h&&h.ref,x,d||h,!d):$==null&&h&&h.ref!=null&&jt(h.ref,null,x,h,!0)},D=(h,d,v,w)=>{if(h==null)n(d.el=l(d.children),v,w);else{const E=d.el=h.el;d.children!==h.children&&u(E,d.children)}},T=(h,d,v,w)=>{h==null?n(d.el=a(d.children||""),v,w):d.el=h.el},m=(h,d,v,w)=>{[h.el,h.anchor]=_(h.children,d,v,w,h.el,h.anchor)},b=({el:h,anchor:d},v,w)=>{let E;for(;h&&h!==d;)E=p(h),n(h,v,w),h=E;n(d,v,w)},y=({el:h,anchor:d})=>{let v;for(;h&&h!==d;)v=p(h),i(h),h=v;i(d)},S=(h,d,v,w,E,x,F,R,P)=>{d.type==="svg"?F="svg":d.type==="math"&&(F="mathml"),h==null?O(d,v,w,E,x,F,R,P):H(h,d,E,x,F,R,P)},O=(h,d,v,w,E,x,F,R)=>{let P,L;const{props:$,shapeFlag:M,transition:V,dirs:j}=h;if(P=h.el=o(h.type,x,$&&$.is,$),M&8?c(P,h.children):M&16&&W(h.children,P,null,w,E,$s(h,x),F,R),j&&vt(h,null,w,"created"),I(P,h,h.scopeId,F,w),$){for(const se in $)se!=="value"&&!Vt(se)&&r(P,se,null,$[se],x,w);"value"in $&&r(P,"value",null,$.value,x),(L=$.onVnodeBeforeMount)&&ze(L,w,h)}j&&vt(h,null,w,"beforeMount");const G=_o(E,V);G&&V.beforeEnter(P),n(P,d,v),((L=$&&$.onVnodeMounted)||G||j)&&Pe(()=>{L&&ze(L,w,h),G&&V.enter(P),j&&vt(h,null,w,"mounted")},E)},I=(h,d,v,w,E)=>{if(v&&g(h,v),w)for(let x=0;x{for(let L=P;L{const R=d.el=h.el;let{patchFlag:P,dynamicChildren:L,dirs:$}=d;P|=h.patchFlag&16;const M=h.props||ie,V=d.props||ie;let j;if(v&&bt(v,!1),(j=V.onVnodeBeforeUpdate)&&ze(j,v,d,h),$&&vt(d,h,v,"beforeUpdate"),v&&bt(v,!0),(M.innerHTML&&V.innerHTML==null||M.textContent&&V.textContent==null)&&c(R,""),L?K(h.dynamicChildren,L,R,v,w,$s(d,E),x):F||U(h,d,R,null,v,w,$s(d,E),x,!1),P>0){if(P&16)re(R,M,V,v,E);else if(P&2&&M.class!==V.class&&r(R,"class",null,V.class,E),P&4&&r(R,"style",M.style,V.style,E),P&8){const G=d.dynamicProps;for(let se=0;se{j&&ze(j,v,d,h),$&&vt(d,h,v,"updated")},w)},K=(h,d,v,w,E,x,F)=>{for(let R=0;R{if(d!==v){if(d!==ie)for(const x in d)!Vt(x)&&!(x in v)&&r(h,x,d[x],null,E,w);for(const x in v){if(Vt(x))continue;const F=v[x],R=d[x];F!==R&&x!=="value"&&r(h,x,R,F,E,w)}"value"in v&&r(h,"value",d.value,v.value,E)}},pe=(h,d,v,w,E,x,F,R,P)=>{const L=d.el=h?h.el:l(""),$=d.anchor=h?h.anchor:l("");let{patchFlag:M,dynamicChildren:V,slotScopeIds:j}=d;j&&(R=R?R.concat(j):j),h==null?(n(L,v,w),n($,v,w),W(d.children||[],v,$,E,x,F,R,P)):M>0&&M&64&&V&&h.dynamicChildren?(K(h.dynamicChildren,V,v,E,x,F,R),(d.key!=null||E&&d===E.subTree)&&Pr(h,d,!0)):U(h,d,v,$,E,x,F,R,P)},Le=(h,d,v,w,E,x,F,R,P)=>{d.slotScopeIds=R,h==null?d.shapeFlag&512?E.ctx.activate(d,v,w,F,P):ot(d,v,w,E,x,F,P):at(h,d,P)},ot=(h,d,v,w,E,x,F)=>{const R=h.component=qo(h,w,E);if(pr(h)&&(R.ctx.renderer=B),Go(R,!1,F),R.asyncDep){if(E&&E.registerDep(R,oe,F),!h.el){const P=R.subTree=de(it);T(null,P,d,v)}}else oe(R,h,d,v,E,x,F)},at=(h,d,v)=>{const w=d.component=h.component;if(Fo(h,d,v))if(w.asyncDep&&!w.asyncResolved){Q(w,d,v);return}else w.next=d,w.update();else d.el=h.el,w.vnode=d},oe=(h,d,v,w,E,x,F)=>{const R=()=>{if(h.isMounted){let{next:M,bu:V,u:j,parent:G,vnode:se}=h;{const Ue=Rr(h);if(Ue){M&&(M.el=se.el,Q(h,M,F)),Ue.asyncDep.then(()=>{h.isUnmounted||R()});return}}let ee=M,Ce;bt(h,!1),M?(M.el=se.el,Q(h,M,F)):M=se,V&&Fs(V),(Ce=M.props&&M.props.onVnodeBeforeUpdate)&&ze(Ce,G,M,se),bt(h,!0);const _e=Qn(h),$e=h.subTree;h.subTree=_e,C($e,_e,f($e.el),A($e),h,E,x),M.el=_e.el,ee===null&&Mo(h,_e.el),j&&Pe(j,E),(Ce=M.props&&M.props.onVnodeUpdated)&&Pe(()=>ze(Ce,G,M,se),E)}else{let M;const{el:V,props:j}=d,{bm:G,m:se,parent:ee,root:Ce,type:_e}=h,$e=Pt(d);bt(h,!1),G&&Fs(G),!$e&&(M=j&&j.onVnodeBeforeMount)&&ze(M,ee,d),bt(h,!0);{Ce.ce&&Ce.ce._def.shadowRoot!==!1&&Ce.ce._injectChildStyle(_e);const Ue=h.subTree=Qn(h);C(null,Ue,v,w,h,E,x),d.el=Ue.el}if(se&&Pe(se,E),!$e&&(M=j&&j.onVnodeMounted)){const Ue=d;Pe(()=>ze(M,ee,Ue),E)}(d.shapeFlag&256||ee&&Pt(ee.vnode)&&ee.vnode.shapeFlag&256)&&h.a&&Pe(h.a,E),h.isMounted=!0,d=v=w=null}};h.scope.on();const P=h.effect=new Ui(R);h.scope.off();const L=h.update=P.run.bind(P),$=h.job=P.runIfDirty.bind(P);$.i=h,$.id=h.uid,P.scheduler=()=>_n($),bt(h,!0),L()},Q=(h,d,v)=>{d.component=h;const w=h.vnode.props;h.vnode=d,h.next=null,yo(h,d.props,w,v),So(h,d.children,v),st(),$n(h),nt()},U=(h,d,v,w,E,x,F,R,P=!1)=>{const L=h&&h.children,$=h?h.shapeFlag:0,M=d.children,{patchFlag:V,shapeFlag:j}=d;if(V>0){if(V&128){ye(L,M,v,w,E,x,F,R,P);return}else if(V&256){ae(L,M,v,w,E,x,F,R,P);return}}j&8?($&16&&fe(L,E,x),M!==L&&c(v,M)):$&16?j&16?ye(L,M,v,w,E,x,F,R,P):fe(L,E,x,!0):($&8&&c(v,""),j&16&&W(M,v,w,E,x,F,R,P))},ae=(h,d,v,w,E,x,F,R,P)=>{h=h||_t,d=d||_t;const L=h.length,$=d.length,M=Math.min(L,$);let V;for(V=0;V$?fe(h,E,x,!0,!1,M):W(d,v,w,E,x,F,R,P,M)},ye=(h,d,v,w,E,x,F,R,P)=>{let L=0;const $=d.length;let M=h.length-1,V=$-1;for(;L<=M&&L<=V;){const j=h[L],G=d[L]=P?ht(d[L]):qe(d[L]);if(Nt(j,G))C(j,G,v,null,E,x,F,R,P);else break;L++}for(;L<=M&&L<=V;){const j=h[M],G=d[V]=P?ht(d[V]):qe(d[V]);if(Nt(j,G))C(j,G,v,null,E,x,F,R,P);else break;M--,V--}if(L>M){if(L<=V){const j=V+1,G=j<$?d[j].el:w;for(;L<=V;)C(null,d[L]=P?ht(d[L]):qe(d[L]),v,G,E,x,F,R,P),L++}}else if(L>V)for(;L<=M;)te(h[L],E,x,!0),L++;else{const j=L,G=L,se=new Map;for(L=G;L<=V;L++){const Te=d[L]=P?ht(d[L]):qe(d[L]);Te.key!=null&&se.set(Te.key,L)}let ee,Ce=0;const _e=V-G+1;let $e=!1,Ue=0;const Ft=new Array(_e);for(L=0;L<_e;L++)Ft[L]=0;for(L=j;L<=M;L++){const Te=h[L];if(Ce>=_e){te(Te,E,x,!0);continue}let je;if(Te.key!=null)je=se.get(Te.key);else for(ee=G;ee<=V;ee++)if(Ft[ee-G]===0&&Nt(Te,d[ee])){je=ee;break}je===void 0?te(Te,E,x,!0):(Ft[je-G]=L+1,je>=Ue?Ue=je:$e=!0,C(Te,d[je],v,null,E,x,F,R,P),Ce++)}const Mn=$e?Oo(Ft):_t;for(ee=Mn.length-1,L=_e-1;L>=0;L--){const Te=G+L,je=d[Te],Nn=Te+1<$?d[Te+1].el:w;Ft[L]===0?C(null,je,v,Nn,E,x,F,R,P):$e&&(ee<0||L!==Mn[ee]?Ae(je,v,Nn,2):ee--)}}},Ae=(h,d,v,w,E=null)=>{const{el:x,type:F,transition:R,children:P,shapeFlag:L}=h;if(L&6){Ae(h.component.subTree,d,v,w);return}if(L&128){h.suspense.move(d,v,w);return}if(L&64){F.move(h,d,v,B);return}if(F===Re){n(x,d,v);for(let M=0;MR.enter(x),E);else{const{leave:M,delayLeave:V,afterLeave:j}=R,G=()=>{h.ctx.isUnmounted?i(x):n(x,d,v)},se=()=>{M(x,()=>{G(),j&&j()})};V?V(x,G,se):se()}else n(x,d,v)},te=(h,d,v,w=!1,E=!1)=>{const{type:x,props:F,ref:R,children:P,dynamicChildren:L,shapeFlag:$,patchFlag:M,dirs:V,cacheIndex:j}=h;if(M===-2&&(E=!1),R!=null&&(st(),jt(R,null,v,h,!0),nt()),j!=null&&(d.renderCache[j]=void 0),$&256){d.ctx.deactivate(h);return}const G=$&1&&V,se=!Pt(h);let ee;if(se&&(ee=F&&F.onVnodeBeforeUnmount)&&ze(ee,d,h),$&6)Ve(h.component,v,w);else{if($&128){h.suspense.unmount(v,w);return}G&&vt(h,null,d,"beforeUnmount"),$&64?h.type.remove(h,d,v,B,w):L&&!L.hasOnce&&(x!==Re||M>0&&M&64)?fe(L,d,v,!1,!0):(x===Re&&M&384||!E&&$&16)&&fe(P,d,v),w&&ct(h)}(se&&(ee=F&&F.onVnodeUnmounted)||G)&&Pe(()=>{ee&&ze(ee,d,h),G&&vt(h,null,d,"unmounted")},v)},ct=h=>{const{type:d,el:v,anchor:w,transition:E}=h;if(d===Re){we(v,w);return}if(d===fs){y(h);return}const x=()=>{i(v),E&&!E.persisted&&E.afterLeave&&E.afterLeave()};if(h.shapeFlag&1&&E&&!E.persisted){const{leave:F,delayLeave:R}=E,P=()=>F(v,x);R?R(h.el,x,P):P()}else x()},we=(h,d)=>{let v;for(;h!==d;)v=p(h),i(h),h=v;i(d)},Ve=(h,d,v)=>{const{bum:w,scope:E,job:x,subTree:F,um:R,m:P,a:L,parent:$,slots:{__:M}}=h;Yn(P),Yn(L),w&&Fs(w),$&&z(M)&&M.forEach(V=>{$.renderCache[V]=void 0}),E.stop(),x&&(x.flags|=8,te(F,h,d,v)),R&&Pe(R,d),Pe(()=>{h.isUnmounted=!0},d),d&&d.pendingBranch&&!d.isUnmounted&&h.asyncDep&&!h.asyncResolved&&h.suspenseId===d.pendingId&&(d.deps--,d.deps===0&&d.resolve())},fe=(h,d,v,w=!1,E=!1,x=0)=>{for(let F=x;F{if(h.shapeFlag&6)return A(h.component.subTree);if(h.shapeFlag&128)return h.suspense.next();const d=p(h.anchor||h.el),v=d&&d[Gl];return v?p(v):d};let N=!1;const k=(h,d,v)=>{h==null?d._vnode&&te(d._vnode,null,null,!0):C(d._vnode||null,h,d,null,null,null,v),d._vnode=h,N||(N=!0,$n(),ur(),N=!1)},B={p:C,um:te,m:Ae,r:ct,mt:ot,mc:W,pc:U,pbc:K,n:A,o:t};return{render:k,hydrate:void 0,createApp:vo(k)}}function $s({type:t,props:e},s){return s==="svg"&&t==="foreignObject"||s==="mathml"&&t==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:s}function bt({effect:t,job:e},s){s?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function _o(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function Pr(t,e,s=!1){const n=t.children,i=e.children;if(z(n)&&z(i))for(let r=0;r>1,t[s[l]]0&&(e[n]=s[r-1]),s[r]=n)}}for(r=s.length,o=s[r-1];r-- >0;)s[r]=o,o=e[o];return s}function Rr(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:Rr(e)}function Yn(t){if(t)for(let e=0;ett(Lo);function us(t,e,s){return Dr(t,e,s)}function Dr(t,e,s=ie){const{immediate:n,deep:i,flush:r,once:o}=s,l=be({},s),a=e&&n||!e&&r!=="post";let u;if(ts){if(r==="sync"){const g=To();u=g.__watcherHandles||(g.__watcherHandles=[])}else if(!a){const g=()=>{};return g.stop=Ge,g.resume=Ge,g.pause=Ge,g}}const c=me;l.call=(g,_,C)=>Ke(g,c,_,C);let f=!1;r==="post"?l.scheduler=g=>{Pe(g,c&&c.suspense)}:r!=="sync"&&(f=!0,l.scheduler=(g,_)=>{_?g():_n(g)}),l.augmentJob=g=>{e&&(g.flags|=4),f&&(g.flags|=2,c&&(g.id=c.uid,g.i=c))};const p=Ul(t,e,l);return ts&&(u?u.push(p):a&&p()),p}function Po(t,e,s){const n=this.proxy,i=ce(t)?t.includes(".")?kr(n,t):()=>n[t]:t.bind(n,n);let r;q(e)?r=e:(r=e.handler,s=e);const o=rs(this),l=Dr(i,r.bind(n),s);return o(),l}function kr(t,e){const s=e.split(".");return()=>{let n=t;for(let i=0;ie==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${Fe(e)}Modifiers`]||t[`${xt(e)}Modifiers`];function Do(t,e,...s){if(t.isUnmounted)return;const n=t.vnode.props||ie;let i=s;const r=e.startsWith("update:"),o=r&&Ro(n,e.slice(7));o&&(o.trim&&(i=s.map(c=>ce(c)?c.trim():c)),o.number&&(i=s.map(al)));let l,a=n[l=Is(e)]||n[l=Is(Fe(e))];!a&&r&&(a=n[l=Is(xt(e))]),a&&Ke(a,t,6,i);const u=n[l+"Once"];if(u){if(!t.emitted)t.emitted={};else if(t.emitted[l])return;t.emitted[l]=!0,Ke(u,t,6,i)}}function Ir(t,e,s=!1){const n=e.emitsCache,i=n.get(t);if(i!==void 0)return i;const r=t.emits;let o={},l=!1;if(!q(t)){const a=u=>{const c=Ir(u,e,!0);c&&(l=!0,be(o,c))};!s&&e.mixins.length&&e.mixins.forEach(a),t.extends&&a(t.extends),t.mixins&&t.mixins.forEach(a)}return!r&&!l?(le(t)&&n.set(t,null),null):(z(r)?r.forEach(a=>o[a]=null):be(o,r),le(t)&&n.set(t,o),o)}function Rs(t,e){return!t||!ws(e)?!1:(e=e.slice(2).replace(/Once$/,""),X(t,e[0].toLowerCase()+e.slice(1))||X(t,xt(e))||X(t,e))}function Qn(t){const{type:e,vnode:s,proxy:n,withProxy:i,propsOptions:[r],slots:o,attrs:l,emit:a,render:u,renderCache:c,props:f,data:p,setupState:g,ctx:_,inheritAttrs:C}=t,D=bs(t);let T,m;try{if(s.shapeFlag&4){const y=i||n,S=y;T=qe(u.call(S,y,c,f,g,p,_)),m=l}else{const y=e;T=qe(y.length>1?y(f,{attrs:l,slots:o,emit:a}):y(f,null)),m=e.props?l:ko(l)}}catch(y){Wt.length=0,Ls(y,t,1),T=de(it)}let b=T;if(m&&C!==!1){const y=Object.keys(m),{shapeFlag:S}=b;y.length&&S&7&&(r&&y.some(pn)&&(m=Io(m,r)),b=Dt(b,m,!1,!0))}return s.dirs&&(b=Dt(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(s.dirs):s.dirs),s.transition&&On(b,s.transition),T=b,bs(D),T}const ko=t=>{let e;for(const s in t)(s==="class"||s==="style"||ws(s))&&((e||(e={}))[s]=t[s]);return e},Io=(t,e)=>{const s={};for(const n in t)(!pn(n)||!(n.slice(9)in e))&&(s[n]=t[n]);return s};function Fo(t,e,s){const{props:n,children:i,component:r}=t,{props:o,children:l,patchFlag:a}=e,u=r.emitsOptions;if(e.dirs||e.transition)return!0;if(s&&a>=0){if(a&1024)return!0;if(a&16)return n?Jn(n,o,u):!!o;if(a&8){const c=e.dynamicProps;for(let f=0;ft.__isSuspense;function No(t,e){e&&e.pendingBranch?z(t)?e.effects.push(...t):e.effects.push(t):Wl(t)}const Re=Symbol.for("v-fgt"),Ds=Symbol.for("v-txt"),it=Symbol.for("v-cmt"),fs=Symbol.for("v-stc"),Wt=[];let De=null;function Zt(t=!1){Wt.push(De=t?null:[])}function Bo(){Wt.pop(),De=Wt[Wt.length-1]||null}let Xt=1;function Zn(t,e=!1){Xt+=t,t<0&&De&&e&&(De.hasOnce=!0)}function Mr(t){return t.dynamicChildren=Xt>0?De||_t:null,Bo(),Xt>0&&De&&De.push(t),t}function Nr(t,e,s,n,i,r){return Mr(Ze(t,e,s,n,i,r,!0))}function ln(t,e,s,n,i){return Mr(de(t,e,s,n,i,!0))}function es(t){return t?t.__v_isVNode===!0:!1}function Nt(t,e){return t.type===e.type&&t.key===e.key}const Br=({key:t})=>t??null,hs=({ref:t,ref_key:e,ref_for:s})=>(typeof t=="number"&&(t=""+t),t!=null?ce(t)||ve(t)||q(t)?{i:Ee,r:t,k:e,f:!!s}:t:null);function Ze(t,e=null,s=null,n=0,i=null,r=t===Re?0:1,o=!1,l=!1){const a={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&Br(e),ref:e&&hs(e),scopeId:hr,slotScopeIds:null,children:s,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:r,patchFlag:n,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:Ee};return l?(Pn(a,s),r&128&&t.normalize(a)):s&&(a.shapeFlag|=ce(s)?8:16),Xt>0&&!o&&De&&(a.patchFlag>0||r&6)&&a.patchFlag!==32&&De.push(a),a}const de=Ho;function Ho(t,e=null,s=null,n=0,i=null,r=!1){if((!t||t===oo)&&(t=it),es(t)){const l=Dt(t,e,!0);return s&&Pn(l,s),Xt>0&&!r&&De&&(l.shapeFlag&6?De[De.indexOf(t)]=l:De.push(l)),l.patchFlag=-2,l}if(Zo(t)&&(t=t.__vccOpts),e){e=Vo(e);let{class:l,style:a}=e;l&&!ce(l)&&(e.class=bn(l)),le(a)&&(Cn(a)&&!z(a)&&(a=be({},a)),e.style=vn(a))}const o=ce(t)?1:Fr(t)?128:Kl(t)?64:le(t)?4:q(t)?2:0;return Ze(t,e,s,n,i,o,r,!0)}function Vo(t){return t?Cn(t)||Er(t)?be({},t):t:null}function Dt(t,e,s=!1,n=!1){const{props:i,ref:r,patchFlag:o,children:l,transition:a}=t,u=e?jo(i||{},e):i,c={__v_isVNode:!0,__v_skip:!0,type:t.type,props:u,key:u&&Br(u),ref:e&&e.ref?s&&r?z(r)?r.concat(hs(e)):[r,hs(e)]:hs(e):r,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:l,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==Re?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:a,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&Dt(t.ssContent),ssFallback:t.ssFallback&&Dt(t.ssFallback),el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return a&&n&&On(c,a.clone(c)),c}function ds(t=" ",e=0){return de(Ds,null,t,e)}function $o(t,e){const s=de(fs,null,t);return s.staticCount=e,s}function Uo(t="",e=!1){return e?(Zt(),ln(it,null,t)):de(it,null,t)}function qe(t){return t==null||typeof t=="boolean"?de(it):z(t)?de(Re,null,t.slice()):es(t)?ht(t):de(Ds,null,String(t))}function ht(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:Dt(t)}function Pn(t,e){let s=0;const{shapeFlag:n}=t;if(e==null)e=null;else if(z(e))s=16;else if(typeof e=="object")if(n&65){const i=e.default;i&&(i._c&&(i._d=!1),Pn(t,i()),i._c&&(i._d=!0));return}else{s=32;const i=e._;!i&&!Er(e)?e._ctx=Ee:i===3&&Ee&&(Ee.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else q(e)?(e={default:e,_ctx:Ee},s=32):(e=String(e),n&64?(s=16,e=[ds(e)]):s=8);t.children=e,t.shapeFlag|=s}function jo(...t){const e={};for(let s=0;s{let i;return(i=t[s])||(i=t[s]=[]),i.push(n),r=>{i.length>1?i.forEach(o=>o(r)):i[0](r)}};As=e("__VUE_INSTANCE_SETTERS__",s=>me=s),on=e("__VUE_SSR_SETTERS__",s=>ts=s)}const rs=t=>{const e=me;return As(t),t.scope.on(),()=>{t.scope.off(),As(e)}},Xn=()=>{me&&me.scope.off(),As(null)};function Hr(t){return t.vnode.shapeFlag&4}let ts=!1;function Go(t,e=!1,s=!1){e&&on(e);const{props:n,children:i}=t.vnode,r=Hr(t);bo(t,n,r,e),xo(t,i,s||e);const o=r?Ko(t,e):void 0;return e&&on(!1),o}function Ko(t,e){const s=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,co);const{setup:n}=s;if(n){st();const i=t.setupContext=n.length>1?Qo(t):null,r=rs(t),o=is(n,t,0,[t.props,i]),l=Fi(o);if(nt(),r(),(l||t.sp)&&!Pt(t)&&dr(t),l){if(o.then(Xn,Xn),e)return o.then(a=>{ei(t,a)}).catch(a=>{Ls(a,t,0)});t.asyncDep=o}else ei(t,o)}else Vr(t)}function ei(t,e,s){q(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:le(e)&&(t.setupState=lr(e)),Vr(t)}function Vr(t,e,s){const n=t.type;t.render||(t.render=n.render||Ge);{const i=rs(t);st();try{uo(t)}finally{nt(),i()}}}const Yo={get(t,e){return ge(t,"get",""),t[e]}};function Qo(t){const e=s=>{t.exposed=s||{}};return{attrs:new Proxy(t.attrs,Yo),slots:t.slots,emit:t.emit,expose:e}}function Rn(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(lr(Fl(t.exposed)),{get(e,s){if(s in e)return e[s];if(s in zt)return zt[s](t)},has(e,s){return s in e||s in zt}})):t.proxy}function Jo(t,e=!0){return q(t)?t.displayName||t.name:t.name||e&&t.__name}function Zo(t){return q(t)&&"__vccOpts"in t}const Ne=(t,e)=>Vl(t,e,ts);function $r(t,e,s){const n=arguments.length;return n===2?le(e)&&!z(e)?es(e)?de(t,null,[e]):de(t,e):de(t,null,e):(n>3?s=Array.prototype.slice.call(arguments,2):n===3&&es(s)&&(s=[s]),de(t,e,s))}const Xo="3.5.17";/** * @vue/runtime-dom v3.5.17 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT -**/let an;const ti=typeof window<"u"&&window.trustedTypes;if(ti)try{an=ti.createPolicy("vue",{createHTML:t=>t})}catch{}const $r=an?t=>an.createHTML(t):t=>t,ea="http://www.w3.org/2000/svg",ta="http://www.w3.org/1998/Math/MathML",Xe=typeof document<"u"?document:null,si=Xe&&Xe.createElement("template"),sa={insert:(t,e,s)=>{e.insertBefore(t,s||null)},remove:t=>{const e=t.parentNode;e&&e.removeChild(t)},createElement:(t,e,s,n)=>{const i=e==="svg"?Xe.createElementNS(ea,t):e==="mathml"?Xe.createElementNS(ta,t):s?Xe.createElement(t,{is:s}):Xe.createElement(t);return t==="select"&&n&&n.multiple!=null&&i.setAttribute("multiple",n.multiple),i},createText:t=>Xe.createTextNode(t),createComment:t=>Xe.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>Xe.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},insertStaticContent(t,e,s,n,i,r){const o=s?s.previousSibling:e.lastChild;if(i&&(i===r||i.nextSibling))for(;e.insertBefore(i.cloneNode(!0),s),!(i===r||!(i=i.nextSibling)););else{si.innerHTML=$r(n==="svg"?`${t}`:n==="mathml"?`${t}`:t);const l=si.content;if(n==="svg"||n==="mathml"){const a=l.firstChild;for(;a.firstChild;)l.appendChild(a.firstChild);l.removeChild(a)}e.insertBefore(l,s)}return[o?o.nextSibling:e.firstChild,s?s.previousSibling:e.lastChild]}},na=Symbol("_vtc");function ia(t,e,s){const n=t[na];n&&(e=(e?[e,...n]:[...n]).join(" ")),e==null?t.removeAttribute("class"):s?t.setAttribute("class",e):t.className=e}const ni=Symbol("_vod"),ra=Symbol("_vsh"),la=Symbol(""),oa=/(^|;)\s*display\s*:/;function aa(t,e,s){const n=t.style,i=ce(s);let r=!1;if(s&&!i){if(e)if(ce(e))for(const o of e.split(";")){const l=o.slice(0,o.indexOf(":")).trim();s[l]==null&&ps(n,l,"")}else for(const o in e)s[o]==null&&ps(n,o,"");for(const o in s)o==="display"&&(r=!0),ps(n,o,s[o])}else if(i){if(e!==s){const o=n[la];o&&(s+=";"+o),n.cssText=s,r=oa.test(s)}}else e&&t.removeAttribute("style");ni in t&&(t[ni]=r?n.display:"",t[ra]&&(n.display="none"))}const ii=/\s*!important$/;function ps(t,e,s){if(z(s))s.forEach(n=>ps(t,e,n));else if(s==null&&(s=""),e.startsWith("--"))t.setProperty(e,s);else{const n=ca(t,e);ii.test(s)?t.setProperty(xt(n),s.replace(ii,""),"important"):t[n]=s}}const ri=["Webkit","Moz","ms"],$s={};function ca(t,e){const s=$s[e];if(s)return s;let n=Fe(e);if(n!=="filter"&&n in t)return $s[e]=n;n=Es(n);for(let i=0;ijs||(pa.then(()=>js=0),js=Date.now());function ma(t,e){const s=n=>{if(!n._vts)n._vts=Date.now();else if(n._vts<=s.attached)return;Ke(va(n,s.value),e,5,[n])};return s.value=t,s.attached=ga(),s}function va(t,e){if(z(e)){const s=t.stopImmediatePropagation;return t.stopImmediatePropagation=()=>{s.call(t),t._stopped=!0},e.map(n=>i=>!i._stopped&&n&&n(i))}else return e}const fi=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,ba=(t,e,s,n,i,r)=>{const o=i==="svg";e==="class"?ia(t,n,o):e==="style"?aa(t,s,n):ws(e)?pn(e)||ha(t,e,s,n,r):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):ya(t,e,n,o))?(ai(t,e,n),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&oi(t,e,n,o,r,e!=="value")):t._isVueCE&&(/[A-Z]/.test(e)||!ce(n))?ai(t,Fe(e),n,r,e):(e==="true-value"?t._trueValue=n:e==="false-value"&&(t._falseValue=n),oi(t,e,n,o))};function ya(t,e,s,n){if(n)return!!(e==="innerHTML"||e==="textContent"||e in t&&fi(e)&&G(s));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="form"||e==="list"&&t.tagName==="INPUT"||e==="type"&&t.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const i=t.tagName;if(i==="IMG"||i==="VIDEO"||i==="CANVAS"||i==="SOURCE")return!1}return fi(e)&&ce(s)?!1:e in t}const Aa=be({patchProp:ba},sa);let hi;function wa(){return hi||(hi=Eo(Aa))}const xa=(...t)=>{const e=wa().createApp(...t),{mount:s}=e;return e.mount=n=>{const i=Ea(n);if(!i)return;const r=e._component;!G(r)&&!r.render&&!r.template&&(r.template=i.innerHTML),i.nodeType===1&&(i.textContent="");const o=s(i,!1,Sa(i));return i instanceof Element&&(i.removeAttribute("v-cloak"),i.setAttribute("data-v-app","")),o},e};function Sa(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function Ea(t){return ce(t)?document.querySelector(t):t}const Ca="modulepreload",_a=function(t){return"/"+t},di={},Qe=function(e,s,n){let i=Promise.resolve();if(s&&s.length>0){let o=function(u){return Promise.all(u.map(c=>Promise.resolve(c).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),a=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));i=o(s.map(u=>{if(u=_a(u),u in di)return;di[u]=!0;const c=u.endsWith(".css"),f=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${f}`))return;const p=document.createElement("link");if(p.rel=c?"stylesheet":Ca,c||(p.as="script"),p.crossOrigin="",p.href=u,a&&p.setAttribute("nonce",a),document.head.appendChild(p),c)return new Promise((g,_)=>{p.addEventListener("load",g),p.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${u}`)))})}))}function r(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return i.then(o=>{for(const l of o||[])l.status==="rejected"&&r(l.reason);return e().catch(r)})};/*! +**/let an;const ti=typeof window<"u"&&window.trustedTypes;if(ti)try{an=ti.createPolicy("vue",{createHTML:t=>t})}catch{}const Ur=an?t=>an.createHTML(t):t=>t,ea="http://www.w3.org/2000/svg",ta="http://www.w3.org/1998/Math/MathML",Xe=typeof document<"u"?document:null,si=Xe&&Xe.createElement("template"),sa={insert:(t,e,s)=>{e.insertBefore(t,s||null)},remove:t=>{const e=t.parentNode;e&&e.removeChild(t)},createElement:(t,e,s,n)=>{const i=e==="svg"?Xe.createElementNS(ea,t):e==="mathml"?Xe.createElementNS(ta,t):s?Xe.createElement(t,{is:s}):Xe.createElement(t);return t==="select"&&n&&n.multiple!=null&&i.setAttribute("multiple",n.multiple),i},createText:t=>Xe.createTextNode(t),createComment:t=>Xe.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>Xe.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},insertStaticContent(t,e,s,n,i,r){const o=s?s.previousSibling:e.lastChild;if(i&&(i===r||i.nextSibling))for(;e.insertBefore(i.cloneNode(!0),s),!(i===r||!(i=i.nextSibling)););else{si.innerHTML=Ur(n==="svg"?`${t}`:n==="mathml"?`${t}`:t);const l=si.content;if(n==="svg"||n==="mathml"){const a=l.firstChild;for(;a.firstChild;)l.appendChild(a.firstChild);l.removeChild(a)}e.insertBefore(l,s)}return[o?o.nextSibling:e.firstChild,s?s.previousSibling:e.lastChild]}},na=Symbol("_vtc");function ia(t,e,s){const n=t[na];n&&(e=(e?[e,...n]:[...n]).join(" ")),e==null?t.removeAttribute("class"):s?t.setAttribute("class",e):t.className=e}const ni=Symbol("_vod"),ra=Symbol("_vsh"),la=Symbol(""),oa=/(^|;)\s*display\s*:/;function aa(t,e,s){const n=t.style,i=ce(s);let r=!1;if(s&&!i){if(e)if(ce(e))for(const o of e.split(";")){const l=o.slice(0,o.indexOf(":")).trim();s[l]==null&&ps(n,l,"")}else for(const o in e)s[o]==null&&ps(n,o,"");for(const o in s)o==="display"&&(r=!0),ps(n,o,s[o])}else if(i){if(e!==s){const o=n[la];o&&(s+=";"+o),n.cssText=s,r=oa.test(s)}}else e&&t.removeAttribute("style");ni in t&&(t[ni]=r?n.display:"",t[ra]&&(n.display="none"))}const ii=/\s*!important$/;function ps(t,e,s){if(z(s))s.forEach(n=>ps(t,e,n));else if(s==null&&(s=""),e.startsWith("--"))t.setProperty(e,s);else{const n=ca(t,e);ii.test(s)?t.setProperty(xt(n),s.replace(ii,""),"important"):t[n]=s}}const ri=["Webkit","Moz","ms"],Us={};function ca(t,e){const s=Us[e];if(s)return s;let n=Fe(e);if(n!=="filter"&&n in t)return Us[e]=n;n=Es(n);for(let i=0;ijs||(pa.then(()=>js=0),js=Date.now());function ma(t,e){const s=n=>{if(!n._vts)n._vts=Date.now();else if(n._vts<=s.attached)return;Ke(va(n,s.value),e,5,[n])};return s.value=t,s.attached=ga(),s}function va(t,e){if(z(e)){const s=t.stopImmediatePropagation;return t.stopImmediatePropagation=()=>{s.call(t),t._stopped=!0},e.map(n=>i=>!i._stopped&&n&&n(i))}else return e}const fi=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,ba=(t,e,s,n,i,r)=>{const o=i==="svg";e==="class"?ia(t,n,o):e==="style"?aa(t,s,n):ws(e)?pn(e)||ha(t,e,s,n,r):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):ya(t,e,n,o))?(ai(t,e,n),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&oi(t,e,n,o,r,e!=="value")):t._isVueCE&&(/[A-Z]/.test(e)||!ce(n))?ai(t,Fe(e),n,r,e):(e==="true-value"?t._trueValue=n:e==="false-value"&&(t._falseValue=n),oi(t,e,n,o))};function ya(t,e,s,n){if(n)return!!(e==="innerHTML"||e==="textContent"||e in t&&fi(e)&&q(s));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="form"||e==="list"&&t.tagName==="INPUT"||e==="type"&&t.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const i=t.tagName;if(i==="IMG"||i==="VIDEO"||i==="CANVAS"||i==="SOURCE")return!1}return fi(e)&&ce(s)?!1:e in t}const Aa=be({patchProp:ba},sa);let hi;function wa(){return hi||(hi=Eo(Aa))}const xa=(...t)=>{const e=wa().createApp(...t),{mount:s}=e;return e.mount=n=>{const i=Ea(n);if(!i)return;const r=e._component;!q(r)&&!r.render&&!r.template&&(r.template=i.innerHTML),i.nodeType===1&&(i.textContent="");const o=s(i,!1,Sa(i));return i instanceof Element&&(i.removeAttribute("v-cloak"),i.setAttribute("data-v-app","")),o},e};function Sa(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function Ea(t){return ce(t)?document.querySelector(t):t}const Ca="modulepreload",_a=function(t){return"/"+t},di={},Qe=function(e,s,n){let i=Promise.resolve();if(s&&s.length>0){let o=function(u){return Promise.all(u.map(c=>Promise.resolve(c).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),a=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));i=o(s.map(u=>{if(u=_a(u),u in di)return;di[u]=!0;const c=u.endsWith(".css"),f=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${f}`))return;const p=document.createElement("link");if(p.rel=c?"stylesheet":Ca,c||(p.as="script"),p.crossOrigin="",p.href=u,a&&p.setAttribute("nonce",a),document.head.appendChild(p),c)return new Promise((g,_)=>{p.addEventListener("load",g),p.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${u}`)))})}))}function r(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return i.then(o=>{for(const l of o||[])l.status==="rejected"&&r(l.reason);return e().catch(r)})};/*! * vue-router v4.5.1 * (c) 2025 Eduardo San Martin Morote * @license MIT - */const Ct=typeof document<"u";function jr(t){return typeof t=="object"||"displayName"in t||"props"in t||"__vccOpts"in t}function Oa(t){return t.__esModule||t[Symbol.toStringTag]==="Module"||t.default&&jr(t.default)}const J=Object.assign;function zs(t,e){const s={};for(const n in e){const i=e[n];s[n]=He(i)?i.map(t):t(i)}return s}const Gt=()=>{},He=Array.isArray,zr=/#/g,La=/&/g,Ta=/\//g,Pa=/=/g,Ra=/\?/g,Wr=/\+/g,Da=/%5B/g,ka=/%5D/g,Gr=/%5E/g,Ia=/%60/g,qr=/%7B/g,Fa=/%7C/g,Kr=/%7D/g,Ma=/%20/g;function Dn(t){return encodeURI(""+t).replace(Fa,"|").replace(Da,"[").replace(ka,"]")}function Na(t){return Dn(t).replace(qr,"{").replace(Kr,"}").replace(Gr,"^")}function cn(t){return Dn(t).replace(Wr,"%2B").replace(Ma,"+").replace(zr,"%23").replace(La,"%26").replace(Ia,"`").replace(qr,"{").replace(Kr,"}").replace(Gr,"^")}function Ba(t){return cn(t).replace(Pa,"%3D")}function Ha(t){return Dn(t).replace(zr,"%23").replace(Ra,"%3F")}function Va(t){return t==null?"":Ha(t).replace(Ta,"%2F")}function ss(t){try{return decodeURIComponent(""+t)}catch{}return""+t}const Ua=/\/$/,$a=t=>t.replace(Ua,"");function Ws(t,e,s="/"){let n,i={},r="",o="";const l=e.indexOf("#");let a=e.indexOf("?");return l=0&&(a=-1),a>-1&&(n=e.slice(0,a),r=e.slice(a+1,l>-1?l:e.length),i=t(r)),l>-1&&(n=n||e.slice(0,l),o=e.slice(l,e.length)),n=Ga(n??e,s),{fullPath:n+(r&&"?")+r+o,path:n,query:i,hash:ss(o)}}function ja(t,e){const s=e.query?t(e.query):"";return e.path+(s&&"?")+s+(e.hash||"")}function pi(t,e){return!e||!t.toLowerCase().startsWith(e.toLowerCase())?t:t.slice(e.length)||"/"}function za(t,e,s){const n=e.matched.length-1,i=s.matched.length-1;return n>-1&&n===i&&kt(e.matched[n],s.matched[i])&&Yr(e.params,s.params)&&t(e.query)===t(s.query)&&e.hash===s.hash}function kt(t,e){return(t.aliasOf||t)===(e.aliasOf||e)}function Yr(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(!Wa(t[s],e[s]))return!1;return!0}function Wa(t,e){return He(t)?gi(t,e):He(e)?gi(e,t):t===e}function gi(t,e){return He(e)?t.length===e.length&&t.every((s,n)=>s===e[n]):t.length===1&&t[0]===e}function Ga(t,e){if(t.startsWith("/"))return t;if(!t)return e;const s=e.split("/"),n=t.split("/"),i=n[n.length-1];(i===".."||i===".")&&n.push("");let r=s.length-1,o,l;for(o=0;o1&&r--;else break;return s.slice(0,r).join("/")+"/"+n.slice(o).join("/")}const ut={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};var ns;(function(t){t.pop="pop",t.push="push"})(ns||(ns={}));var qt;(function(t){t.back="back",t.forward="forward",t.unknown=""})(qt||(qt={}));function qa(t){if(!t)if(Ct){const e=document.querySelector("base");t=e&&e.getAttribute("href")||"/",t=t.replace(/^\w+:\/\/[^\/]+/,"")}else t="/";return t[0]!=="/"&&t[0]!=="#"&&(t="/"+t),$a(t)}const Ka=/^[^#]+#/;function Ya(t,e){return t.replace(Ka,"#")+e}function Qa(t,e){const s=document.documentElement.getBoundingClientRect(),n=t.getBoundingClientRect();return{behavior:e.behavior,left:n.left-s.left-(e.left||0),top:n.top-s.top-(e.top||0)}}const ks=()=>({left:window.scrollX,top:window.scrollY});function Ja(t){let e;if("el"in t){const s=t.el,n=typeof s=="string"&&s.startsWith("#"),i=typeof s=="string"?n?document.getElementById(s.slice(1)):document.querySelector(s):s;if(!i)return;e=Qa(i,t)}else e=t;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.scrollX,e.top!=null?e.top:window.scrollY)}function mi(t,e){return(history.state?history.state.position-e:-1)+t}const un=new Map;function Za(t,e){un.set(t,e)}function Xa(t){const e=un.get(t);return un.delete(t),e}let ec=()=>location.protocol+"//"+location.host;function Qr(t,e){const{pathname:s,search:n,hash:i}=e,r=t.indexOf("#");if(r>-1){let l=i.includes(t.slice(r))?t.slice(r).length:1,a=i.slice(l);return a[0]!=="/"&&(a="/"+a),pi(a,"")}return pi(s,t)+n+i}function tc(t,e,s,n){let i=[],r=[],o=null;const l=({state:p})=>{const g=Qr(t,location),_=s.value,C=e.value;let D=0;if(p){if(s.value=g,e.value=p,o&&o===_){o=null;return}D=C?p.position-C.position:0}else n(g);i.forEach(T=>{T(s.value,_,{delta:D,type:ns.pop,direction:D?D>0?qt.forward:qt.back:qt.unknown})})};function a(){o=s.value}function u(p){i.push(p);const g=()=>{const _=i.indexOf(p);_>-1&&i.splice(_,1)};return r.push(g),g}function c(){const{history:p}=window;p.state&&p.replaceState(J({},p.state,{scroll:ks()}),"")}function f(){for(const p of r)p();r=[],window.removeEventListener("popstate",l),window.removeEventListener("beforeunload",c)}return window.addEventListener("popstate",l),window.addEventListener("beforeunload",c,{passive:!0}),{pauseListeners:a,listen:u,destroy:f}}function vi(t,e,s,n=!1,i=!1){return{back:t,current:e,forward:s,replaced:n,position:window.history.length,scroll:i?ks():null}}function sc(t){const{history:e,location:s}=window,n={value:Qr(t,s)},i={value:e.state};i.value||r(n.value,{back:null,current:n.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function r(a,u,c){const f=t.indexOf("#"),p=f>-1?(s.host&&document.querySelector("base")?t:t.slice(f))+a:ec()+t+a;try{e[c?"replaceState":"pushState"](u,"",p),i.value=u}catch(g){console.error(g),s[c?"replace":"assign"](p)}}function o(a,u){const c=J({},e.state,vi(i.value.back,a,i.value.forward,!0),u,{position:i.value.position});r(a,c,!0),n.value=a}function l(a,u){const c=J({},i.value,e.state,{forward:a,scroll:ks()});r(c.current,c,!0);const f=J({},vi(n.value,a,null),{position:c.position+1},u);r(a,f,!1),n.value=a}return{location:n,state:i,push:l,replace:o}}function nc(t){t=qa(t);const e=sc(t),s=tc(t,e.state,e.location,e.replace);function n(r,o=!0){o||s.pauseListeners(),history.go(r)}const i=J({location:"",base:t,go:n,createHref:Ya.bind(null,t)},e,s);return Object.defineProperty(i,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(i,"state",{enumerable:!0,get:()=>e.state.value}),i}function ic(t){return typeof t=="string"||t&&typeof t=="object"}function Jr(t){return typeof t=="string"||typeof t=="symbol"}const Zr=Symbol("");var bi;(function(t){t[t.aborted=4]="aborted",t[t.cancelled=8]="cancelled",t[t.duplicated=16]="duplicated"})(bi||(bi={}));function It(t,e){return J(new Error,{type:t,[Zr]:!0},e)}function Je(t,e){return t instanceof Error&&Zr in t&&(e==null||!!(t.type&e))}const yi="[^/]+?",rc={sensitive:!1,strict:!1,start:!0,end:!0},lc=/[.+*?^${}()[\]/\\]/g;function oc(t,e){const s=J({},rc,e),n=[];let i=s.start?"^":"";const r=[];for(const u of t){const c=u.length?[]:[90];s.strict&&!u.length&&(i+="/");for(let f=0;fe.length?e.length===1&&e[0]===80?1:-1:0}function Xr(t,e){let s=0;const n=t.score,i=e.score;for(;s0&&e[e.length-1]<0}const cc={type:0,value:""},uc=/[a-zA-Z0-9_]/;function fc(t){if(!t)return[[]];if(t==="/")return[[cc]];if(!t.startsWith("/"))throw new Error(`Invalid path "${t}"`);function e(g){throw new Error(`ERR (${s})/"${u}": ${g}`)}let s=0,n=s;const i=[];let r;function o(){r&&i.push(r),r=[]}let l=0,a,u="",c="";function f(){u&&(s===0?r.push({type:0,value:u}):s===1||s===2||s===3?(r.length>1&&(a==="*"||a==="+")&&e(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),r.push({type:1,value:u,regexp:c,repeatable:a==="*"||a==="+",optional:a==="*"||a==="?"})):e("Invalid state to consume buffer"),u="")}function p(){u+=a}for(;l{o(b)}:Gt}function o(f){if(Jr(f)){const p=n.get(f);p&&(n.delete(f),s.splice(s.indexOf(p),1),p.children.forEach(o),p.alias.forEach(o))}else{const p=s.indexOf(f);p>-1&&(s.splice(p,1),f.record.name&&n.delete(f.record.name),f.children.forEach(o),f.alias.forEach(o))}}function l(){return s}function a(f){const p=mc(f,s);s.splice(p,0,f),f.record.name&&!Si(f)&&n.set(f.record.name,f)}function u(f,p){let g,_={},C,D;if("name"in f&&f.name){if(g=n.get(f.name),!g)throw It(1,{location:f});D=g.record.name,_=J(wi(p.params,g.keys.filter(b=>!b.optional).concat(g.parent?g.parent.keys.filter(b=>b.optional):[]).map(b=>b.name)),f.params&&wi(f.params,g.keys.map(b=>b.name))),C=g.stringify(_)}else if(f.path!=null)C=f.path,g=s.find(b=>b.re.test(C)),g&&(_=g.parse(C),D=g.record.name);else{if(g=p.name?n.get(p.name):s.find(b=>b.re.test(p.path)),!g)throw It(1,{location:f,currentLocation:p});D=g.record.name,_=J({},p.params,f.params),C=g.stringify(_)}const T=[];let m=g;for(;m;)T.unshift(m.record),m=m.parent;return{name:D,path:C,params:_,matched:T,meta:gc(T)}}t.forEach(f=>r(f));function c(){s.length=0,n.clear()}return{addRoute:r,resolve:u,removeRoute:o,clearRoutes:c,getRoutes:l,getRecordMatcher:i}}function wi(t,e){const s={};for(const n of e)n in t&&(s[n]=t[n]);return s}function xi(t){const e={path:t.path,redirect:t.redirect,name:t.name,meta:t.meta||{},aliasOf:t.aliasOf,beforeEnter:t.beforeEnter,props:pc(t),children:t.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in t?t.components||null:t.component&&{default:t.component}};return Object.defineProperty(e,"mods",{value:{}}),e}function pc(t){const e={},s=t.props||!1;if("component"in t)e.default=s;else for(const n in t.components)e[n]=typeof s=="object"?s[n]:s;return e}function Si(t){for(;t;){if(t.record.aliasOf)return!0;t=t.parent}return!1}function gc(t){return t.reduce((e,s)=>J(e,s.meta),{})}function Ei(t,e){const s={};for(const n in t)s[n]=n in e?e[n]:t[n];return s}function mc(t,e){let s=0,n=e.length;for(;s!==n;){const r=s+n>>1;Xr(t,e[r])<0?n=r:s=r+1}const i=vc(t);return i&&(n=e.lastIndexOf(i,n-1)),n}function vc(t){let e=t;for(;e=e.parent;)if(el(e)&&Xr(t,e)===0)return e}function el({record:t}){return!!(t.name||t.components&&Object.keys(t.components).length||t.redirect)}function bc(t){const e={};if(t===""||t==="?")return e;const n=(t[0]==="?"?t.slice(1):t).split("&");for(let i=0;ir&&cn(r)):[n&&cn(n)]).forEach(r=>{r!==void 0&&(e+=(e.length?"&":"")+s,r!=null&&(e+="="+r))})}return e}function yc(t){const e={};for(const s in t){const n=t[s];n!==void 0&&(e[s]=He(n)?n.map(i=>i==null?null:""+i):n==null?n:""+n)}return e}const Ac=Symbol(""),_i=Symbol(""),kn=Symbol(""),tl=Symbol(""),fn=Symbol("");function Bt(){let t=[];function e(n){return t.push(n),()=>{const i=t.indexOf(n);i>-1&&t.splice(i,1)}}function s(){t=[]}return{add:e,list:()=>t.slice(),reset:s}}function dt(t,e,s,n,i,r=o=>o()){const o=n&&(n.enterCallbacks[i]=n.enterCallbacks[i]||[]);return()=>new Promise((l,a)=>{const u=p=>{p===!1?a(It(4,{from:s,to:e})):p instanceof Error?a(p):ic(p)?a(It(2,{from:e,to:p})):(o&&n.enterCallbacks[i]===o&&typeof p=="function"&&o.push(p),l())},c=r(()=>t.call(n&&n.instances[i],e,s,u));let f=Promise.resolve(c);t.length<3&&(f=f.then(u)),f.catch(p=>a(p))})}function Gs(t,e,s,n,i=r=>r()){const r=[];for(const o of t)for(const l in o.components){let a=o.components[l];if(!(e!=="beforeRouteEnter"&&!o.instances[l]))if(jr(a)){const c=(a.__vccOpts||a)[e];c&&r.push(dt(c,s,n,o,l,i))}else{let u=a();r.push(()=>u.then(c=>{if(!c)throw new Error(`Couldn't resolve component "${l}" at "${o.path}"`);const f=Oa(c)?c.default:c;o.mods[l]=c,o.components[l]=f;const g=(f.__vccOpts||f)[e];return g&&dt(g,s,n,o,l,i)()}))}}return r}function Oi(t){const e=tt(kn),s=tt(tl),n=Ne(()=>{const a=wt(t.to);return e.resolve(a)}),i=Ne(()=>{const{matched:a}=n.value,{length:u}=a,c=a[u-1],f=s.matched;if(!c||!f.length)return-1;const p=f.findIndex(kt.bind(null,c));if(p>-1)return p;const g=Li(a[u-2]);return u>1&&Li(c)===g&&f[f.length-1].path!==g?f.findIndex(kt.bind(null,a[u-2])):p}),r=Ne(()=>i.value>-1&&Cc(s.params,n.value.params)),o=Ne(()=>i.value>-1&&i.value===s.matched.length-1&&Yr(s.params,n.value.params));function l(a={}){if(Ec(a)){const u=e[wt(t.replace)?"replace":"push"](wt(t.to)).catch(Gt);return t.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>u),u}return Promise.resolve()}return{route:n,href:Ne(()=>n.value.href),isActive:r,isExactActive:o,navigate:l}}function wc(t){return t.length===1?t[0]:t}const xc=Ts({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"},viewTransition:Boolean},useLink:Oi,setup(t,{slots:e}){const s=Os(Oi(t)),{options:n}=tt(kn),i=Ne(()=>({[Ti(t.activeClass,n.linkActiveClass,"router-link-active")]:s.isActive,[Ti(t.exactActiveClass,n.linkExactActiveClass,"router-link-exact-active")]:s.isExactActive}));return()=>{const r=e.default&&wc(e.default(s));return t.custom?r:Ur("a",{"aria-current":s.isExactActive?t.ariaCurrentValue:null,href:s.href,onClick:s.navigate,class:i.value},r)}}}),Sc=xc;function Ec(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&!(t.button!==void 0&&t.button!==0)){if(t.currentTarget&&t.currentTarget.getAttribute){const e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function Cc(t,e){for(const s in e){const n=e[s],i=t[s];if(typeof n=="string"){if(n!==i)return!1}else if(!He(i)||i.length!==n.length||n.some((r,o)=>r!==i[o]))return!1}return!0}function Li(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const Ti=(t,e,s)=>t??e??s,_c=Ts({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(t,{attrs:e,slots:s}){const n=tt(fn),i=Ne(()=>t.route||n.value),r=tt(_i,0),o=Ne(()=>{let u=wt(r);const{matched:c}=i.value;let f;for(;(f=c[u])&&!f.components;)u++;return u}),l=Ne(()=>i.value.matched[o.value]);cs(_i,Ne(()=>o.value+1)),cs(Ac,l),cs(fn,i);const a=ir();return us(()=>[a.value,l.value,t.name],([u,c,f],[p,g,_])=>{c&&(c.instances[f]=u,g&&g!==c&&u&&u===p&&(c.leaveGuards.size||(c.leaveGuards=g.leaveGuards),c.updateGuards.size||(c.updateGuards=g.updateGuards))),u&&c&&(!g||!kt(c,g)||!p)&&(c.enterCallbacks[f]||[]).forEach(C=>C(u))},{flush:"post"}),()=>{const u=i.value,c=t.name,f=l.value,p=f&&f.components[c];if(!p)return Pi(s.default,{Component:p,route:u});const g=f.props[c],_=g?g===!0?u.params:typeof g=="function"?g(u):g:null,D=Ur(p,J({},_,e,{onVnodeUnmounted:T=>{T.component.isUnmounted&&(f.instances[c]=null)},ref:a}));return Pi(s.default,{Component:D,route:u})||D}}});function Pi(t,e){if(!t)return null;const s=t(e);return s.length===1?s[0]:s}const Oc=_c;function Lc(t){const e=dc(t.routes,t),s=t.parseQuery||bc,n=t.stringifyQuery||Ci,i=t.history,r=Bt(),o=Bt(),l=Bt(),a=Ml(ut);let u=ut;Ct&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=zs.bind(null,A=>""+A),f=zs.bind(null,Va),p=zs.bind(null,ss);function g(A,N){let k,B;return Jr(A)?(k=e.getRecordMatcher(A),B=N):B=A,e.addRoute(B,k)}function _(A){const N=e.getRecordMatcher(A);N&&e.removeRoute(N)}function C(){return e.getRoutes().map(A=>A.record)}function D(A){return!!e.getRecordMatcher(A)}function T(A,N){if(N=J({},N||a.value),typeof A=="string"){const v=Ws(s,A,N.path),w=e.resolve({path:v.path},N),E=i.createHref(v.fullPath);return J(v,w,{params:p(w.params),hash:ss(v.hash),redirectedFrom:void 0,href:E})}let k;if(A.path!=null)k=J({},A,{path:Ws(s,A.path,N.path).path});else{const v=J({},A.params);for(const w in v)v[w]==null&&delete v[w];k=J({},A,{params:f(v)}),N.params=f(N.params)}const B=e.resolve(k,N),Y=A.hash||"";B.params=c(p(B.params));const h=ja(n,J({},A,{hash:Na(Y),path:B.path})),d=i.createHref(h);return J({fullPath:h,hash:Y,query:n===Ci?yc(A.query):A.query||{}},B,{redirectedFrom:void 0,href:d})}function m(A){return typeof A=="string"?Ws(s,A,a.value.path):J({},A)}function b(A,N){if(u!==A)return It(8,{from:N,to:A})}function y(A){return I(A)}function S(A){return y(J(m(A),{replace:!0}))}function O(A){const N=A.matched[A.matched.length-1];if(N&&N.redirect){const{redirect:k}=N;let B=typeof k=="function"?k(A):k;return typeof B=="string"&&(B=B.includes("?")||B.includes("#")?B=m(B):{path:B},B.params={}),J({query:A.query,hash:A.hash,params:B.path!=null?{}:A.params},B)}}function I(A,N){const k=u=T(A),B=a.value,Y=A.state,h=A.force,d=A.replace===!0,v=O(k);if(v)return I(J(m(v),{state:typeof v=="object"?J({},Y,v.state):Y,force:h,replace:d}),N||k);const w=k;w.redirectedFrom=N;let E;return!h&&za(n,B,k)&&(E=It(16,{to:w,from:B}),Ae(B,B,!0,!1)),(E?Promise.resolve(E):K(w,B)).catch(x=>Je(x)?Je(x,2)?x:ye(x):$(x,w,B)).then(x=>{if(x){if(Je(x,2))return I(J({replace:d},m(x.to),{state:typeof x.to=="object"?J({},Y,x.to.state):Y,force:h}),N||w)}else x=pe(w,B,!0,d,Y);return re(w,B,x),x})}function W(A,N){const k=b(A,N);return k?Promise.reject(k):Promise.resolve()}function H(A){const N=we.values().next().value;return N&&typeof N.runWithContext=="function"?N.runWithContext(A):A()}function K(A,N){let k;const[B,Y,h]=Tc(A,N);k=Gs(B.reverse(),"beforeRouteLeave",A,N);for(const v of B)v.leaveGuards.forEach(w=>{k.push(dt(w,A,N))});const d=W.bind(null,A,N);return k.push(d),fe(k).then(()=>{k=[];for(const v of r.list())k.push(dt(v,A,N));return k.push(d),fe(k)}).then(()=>{k=Gs(Y,"beforeRouteUpdate",A,N);for(const v of Y)v.updateGuards.forEach(w=>{k.push(dt(w,A,N))});return k.push(d),fe(k)}).then(()=>{k=[];for(const v of h)if(v.beforeEnter)if(He(v.beforeEnter))for(const w of v.beforeEnter)k.push(dt(w,A,N));else k.push(dt(v.beforeEnter,A,N));return k.push(d),fe(k)}).then(()=>(A.matched.forEach(v=>v.enterCallbacks={}),k=Gs(h,"beforeRouteEnter",A,N,H),k.push(d),fe(k))).then(()=>{k=[];for(const v of o.list())k.push(dt(v,A,N));return k.push(d),fe(k)}).catch(v=>Je(v,8)?v:Promise.reject(v))}function re(A,N,k){l.list().forEach(B=>H(()=>B(A,N,k)))}function pe(A,N,k,B,Y){const h=b(A,N);if(h)return h;const d=N===ut,v=Ct?history.state:{};k&&(B||d?i.replace(A.fullPath,J({scroll:d&&v&&v.scroll},Y)):i.push(A.fullPath,Y)),a.value=A,Ae(A,N,k,d),ye()}let Le;function ot(){Le||(Le=i.listen((A,N,k)=>{if(!Ve.listening)return;const B=T(A),Y=O(B);if(Y){I(J(Y,{replace:!0,force:!0}),B).catch(Gt);return}u=B;const h=a.value;Ct&&Za(mi(h.fullPath,k.delta),ks()),K(B,h).catch(d=>Je(d,12)?d:Je(d,2)?(I(J(m(d.to),{force:!0}),B).then(v=>{Je(v,20)&&!k.delta&&k.type===ns.pop&&i.go(-1,!1)}).catch(Gt),Promise.reject()):(k.delta&&i.go(-k.delta,!1),$(d,B,h))).then(d=>{d=d||pe(B,h,!1),d&&(k.delta&&!Je(d,8)?i.go(-k.delta,!1):k.type===ns.pop&&Je(d,20)&&i.go(-1,!1)),re(B,h,d)}).catch(Gt)}))}let at=Bt(),oe=Bt(),Q;function $(A,N,k){ye(A);const B=oe.list();return B.length?B.forEach(Y=>Y(A,N,k)):console.error(A),Promise.reject(A)}function ae(){return Q&&a.value!==ut?Promise.resolve():new Promise((A,N)=>{at.add([A,N])})}function ye(A){return Q||(Q=!A,ot(),at.list().forEach(([N,k])=>A?k(A):N()),at.reset()),A}function Ae(A,N,k,B){const{scrollBehavior:Y}=t;if(!Ct||!Y)return Promise.resolve();const h=!k&&Xa(mi(A.fullPath,0))||(B||!k)&&history.state&&history.state.scroll||null;return ar().then(()=>Y(A,N,h)).then(d=>d&&Ja(d)).catch(d=>$(d,A,N))}const te=A=>i.go(A);let ct;const we=new Set,Ve={currentRoute:a,listening:!0,addRoute:g,removeRoute:_,clearRoutes:e.clearRoutes,hasRoute:D,getRoutes:C,resolve:T,options:t,push:y,replace:S,go:te,back:()=>te(-1),forward:()=>te(1),beforeEach:r.add,beforeResolve:o.add,afterEach:l.add,onError:oe.add,isReady:ae,install(A){const N=this;A.component("RouterLink",Sc),A.component("RouterView",Oc),A.config.globalProperties.$router=N,Object.defineProperty(A.config.globalProperties,"$route",{enumerable:!0,get:()=>wt(a)}),Ct&&!ct&&a.value===ut&&(ct=!0,y(i.location).catch(Y=>{}));const k={};for(const Y in ut)Object.defineProperty(k,Y,{get:()=>a.value[Y],enumerable:!0});A.provide(kn,N),A.provide(tl,sr(k)),A.provide(fn,a);const B=A.unmount;we.add(A),A.unmount=function(){we.delete(A),we.size<1&&(u=ut,Le&&Le(),Le=null,a.value=ut,ct=!1,Q=!1),B()}}};function fe(A){return A.reduce((N,k)=>N.then(()=>H(k)),Promise.resolve())}return Ve}function Tc(t,e){const s=[],n=[],i=[],r=Math.max(e.matched.length,t.matched.length);for(let o=0;okt(u,l))?n.push(l):s.push(l));const a=t.matched[o];a&&(e.matched.find(u=>kt(u,a))||i.push(a))}return[s,n,i]}const Pc=Lc({history:nc(),linkActiveClass:"active",routes:[{path:"/",name:"Home",component:()=>Qe(()=>import("./home.js"),__vite__mapDeps([0,1]))},{path:"/install",name:"Install",component:()=>Qe(()=>import("./install.js"),[])},{path:"/selects",name:"Selects",component:()=>Qe(()=>import("./selects.js"),[])},{path:"/data",name:"Data",component:()=>Qe(()=>import("./data.js"),[])},{path:"/examples",name:"Examples",component:()=>Qe(()=>import("./index2.js"),__vite__mapDeps([2,3]))},{path:"/settings",name:"Settings",component:()=>Qe(()=>import("./index3.js"),__vite__mapDeps([4,5]))},{path:"/events",name:"Events",component:()=>Qe(()=>import("./index4.js"),[])},{path:"/methods",name:"Methods",component:()=>Qe(()=>import("./index5.js"),[])},{path:"/vue",name:"Vue",component:()=>Qe(()=>import("./vue.js"),[])}]});class Rc{constructor(e){e||(e={}),this.main=e.main||"ss-main",this.placeholder=e.placeholder||"ss-placeholder",this.values=e.values||"ss-values",this.single=e.single||"ss-single",this.max=e.max||"ss-max",this.value=e.value||"ss-value",this.valueText=e.valueText||"ss-value-text",this.valueDelete=e.valueDelete||"ss-value-delete",this.valueOut=e.valueOut||"ss-value-out",this.deselect=e.deselect||"ss-deselect",this.deselectPath=e.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=e.arrow||"ss-arrow",this.arrowClose=e.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=e.arrowOpen||"M10,70 L50,30 L90,70",this.content=e.content||"ss-content",this.openAbove=e.openAbove||"ss-open-above",this.openBelow=e.openBelow||"ss-open-below",this.search=e.search||"ss-search",this.searchHighlighter=e.searchHighlighter||"ss-search-highlight",this.searching=e.searching||"ss-searching",this.addable=e.addable||"ss-addable",this.addablePath=e.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=e.list||"ss-list",this.optgroup=e.optgroup||"ss-optgroup",this.optgroupLabel=e.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=e.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=e.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=e.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=e.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=e.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=e.optgroupClosable||"ss-closable",this.option=e.option||"ss-option",this.optionDelete=e.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=e.highlighted||"ss-highlighted",this.open=e.open||"ss-open",this.close=e.close||"ss-close",this.selected=e.selected||"ss-selected",this.error=e.error||"ss-error",this.disabled=e.disabled||"ss-disabled",this.hide=e.hide||"ss-hide"}}function In(){return Math.random().toString(36).substring(2,10)}function Dc(t,e){function s(i,r){return r&&i&&i.classList&&i.classList.contains(r)||r&&i&&i.dataset&&i.dataset.id&&i.dataset.id===e?i:null}function n(i,r){return!i||i===document?null:s(i,r)?i:n(i.parentNode,r)}return s(t,e)||n(t,e)}function Kt(t,e=50,s=!1){let n;return function(...i){const r=self,o=()=>{n=null,s||t.apply(r,i)},l=s&&!n;clearTimeout(n),n=setTimeout(o,e),l&&t.apply(r,i)}}function qs(t,e){return JSON.stringify(t)===JSON.stringify(e)}function kc(t){const e=t.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,s=>"-"+s.toLowerCase());return t[0]===t[0].toUpperCase()?e.substring(1):e}class Me{constructor(e){if(this.id=!e.id||e.id===""?In():e.id,this.label=e.label||"",this.selectAll=e.selectAll===void 0?!1:e.selectAll,this.selectAllText=e.selectAllText||"Select All",this.closable=e.closable||"off",this.options=[],e.options)for(const s of e.options)this.options.push(new ue(s))}}class ue{constructor(e){this.id=!e.id||e.id===""?In():e.id,this.value=e.value===void 0?e.text:e.value,this.text=e.text||"",this.html=e.html||"",this.defaultSelected=e.defaultSelected!==void 0?e.defaultSelected:!1,this.selected=e.selected!==void 0?e.selected:!1,this.display=e.display!==void 0?e.display:!0,this.disabled=e.disabled!==void 0?e.disabled:!1,this.mandatory=e.mandatory!==void 0?e.mandatory:!1,this.placeholder=e.placeholder!==void 0?e.placeholder:!1,this.class=e.class||"",this.style=e.style||"",this.data=e.data||{}}}class Ic{constructor(e,s){this.selectType="single",this.data=[],this.selectedOrder=[],this.selectType=e,this.setData(s)}validateDataArray(e){if(!Array.isArray(e))return new Error("Data must be an array");for(let s of e)if(s instanceof Me||"label"in s){if(!("label"in s))return new Error("Optgroup must have a label");if("options"in s&&s.options)for(let n of s.options){const i=this.validateOption(n);if(i)return i}}else if(s instanceof ue||"text"in s){const n=this.validateOption(s);if(n)return n}else return new Error("Data object must be a valid optgroup or option");return null}validateOption(e){return"text"in e?null:new Error("Option must have a text")}partialToFullData(e){let s=[];return e.forEach(n=>{if(n instanceof Me||"label"in n){let i=[];"options"in n&&n.options&&n.options.forEach(r=>{i.push(new ue(r))}),i.length>0&&s.push(new Me(n))}(n instanceof ue||"text"in n)&&s.push(new ue(n))}),s}setData(e){this.data=this.partialToFullData(e),this.selectType==="single"&&this.setSelectedBy("id",this.getSelected())}getData(){return this.filter(null,!0)}getDataOptions(){return this.filter(null,!1)}addOption(e,s=!1){if(s){let n=[new ue(e)];this.setData(n.concat(this.getData()))}else this.setData(this.getData().concat(new ue(e)))}setSelectedBy(e,s){let n=null,i=!1;const r=[];for(let l of this.data){if(l instanceof Me)for(let a of l.options)n||(n=a),a.selected=i?!1:s.includes(a[e]),a.selected&&(r.push(a),this.selectType==="single"&&(i=!0));l instanceof ue&&(n||(n=l),l.selected=i?!1:s.includes(l[e]),l.selected&&(r.push(l),this.selectType==="single"&&(i=!0)))}this.selectType==="single"&&n&&!i&&(n.selected=!0,r.push(n));const o=s.map(l=>{var a;return((a=r.find(u=>u[e]===l))==null?void 0:a.id)||""});this.selectedOrder=o}getSelected(){return this.getSelectedOptions().map(e=>e.id)}getSelectedValues(){return this.getSelectedOptions().map(e=>e.value)}getSelectedOptions(){return this.filter(e=>e.selected,!1)}getOptgroupByID(e){for(let s of this.data)if(s instanceof Me&&s.id===e)return s;return null}getOptionByID(e){let s=this.filter(n=>n.id===e,!1);return s.length?s[0]:null}getSelectType(){return this.selectType}getFirstOption(){let e=null;for(let s of this.data)if(s instanceof Me?e=s.options[0]:s instanceof ue&&(e=s),e)break;return e}search(e,s){return e=e.trim(),e===""?this.getData():this.filter(n=>s(n,e),!0)}filter(e,s){const n=[];return this.data.forEach(i=>{if(i instanceof Me){let r=[];if(i.options.forEach(o=>{(!e||e(o))&&(s?r.push(new ue(o)):n.push(new ue(o)))}),r.length>0){let o=new Me(i);o.options=r,n.push(o)}}i instanceof ue&&(!e||e(i))&&n.push(new ue(i))}),n}selectedOrderOptions(e){const s=[];return this.selectedOrder.forEach(n=>{const i=e.find(r=>r.id===n);i&&s.push(i)}),e.forEach(n=>{let i=!1;s.forEach(r=>{if(n.id===r.id){i=!0;return}}),i||s.push(n)}),s}}const ke=class ke{static getLiveAssertive(){let e=document.getElementById("ss-live-assertive");return e||(e=document.createElement("div"),e.id="ss-live-assertive",e.setAttribute("role","status"),e.setAttribute("aria-live","assertive"),e.setAttribute("aria-atomic","true"),e.className="ss-sr-only",document.body.appendChild(e)),e}_announceAssertive(e){const s=ke._liveAssertive||(ke._liveAssertive=ke.getLiveAssertive());s.textContent="",requestAnimationFrame(()=>{s.textContent=e})}constructor(e,s,n,i){var o;this.store=n,this.settings=e,this.classes=s,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes();const r=(o=document.querySelector(`[data-id="${this.settings.id}"]`))==null?void 0:o.closest(".offcanvas-body");r?r.appendChild(this.content.main):this.settings.contentLocation&&this.settings.contentLocation.appendChild(this.content.main)}static getLivePolite(){let e=document.getElementById("ss-live-polite");return e||(e=document.createElement("div"),e.id="ss-live-polite",e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),e.className="ss-sr-only",document.body.appendChild(e)),e}_announcePolite(e){const s=ke._livePolite||(ke._livePolite=ke.getLivePolite());s.textContent="",requestAnimationFrame(()=>{s.textContent=e})}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 e=this.store.getSelectedOptions();if(e.length){const s=e[e.length-1].id,n=this.content.list.querySelector('[data-id="'+s+'"]');n&&this.ensureElementInView(this.content.list,n)}this.settings.contentPosition==="fixed"&&(this.moveContent(),this.scrollHandler=()=>this.moveContent(),this.resizeHandler=()=>this.moveContent(),window.addEventListener("scroll",this.scrollHandler,!0),window.addEventListener("resize",this.resizeHandler)),this.searchFocus()}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),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=void 0),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=void 0),this.main.main.focus({preventScroll:!0}),this.main.main.removeAttribute("aria-activedescendant")}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.main.main.classList.add("ss-2"),this.content.main.classList.add(this.classes.content),this.content.main.classList.add("ss-content-2"),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()));(this.settings.contentPosition==="relative"||this.settings.contentPosition==="fixed")&&this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){var n;this.content.list.setAttribute("role","listbox"),this.content.list.setAttribute("id",this.content.main.id+"-list"),this.content.list.setAttribute("aria-label",this.settings.contentAriaLabel),this.settings.isMultiple&&this.content.list.setAttribute("aria-multiselectable","true"),this.main.main.setAttribute("role","combobox"),this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.list.id),this.main.main.setAttribute("aria-expanded","false"),this.main.main.setAttribute("aria-autocomplete","list"),this.main.main.removeAttribute("aria-labelledby"),this.main.main.removeAttribute("aria-label");let e=(this.settings.ariaLabelledBy||"").trim(),s=null;if(e)s=document.getElementById(e);else{const i=document.querySelector(`select[data-id="${this.settings.id}"]`);i&&(i.id&&(s=document.querySelector(`label[for="${i.id}"]`)),!s&&((n=i.previousElementSibling)==null?void 0:n.tagName)==="LABEL"&&(s=i.previousElementSibling),s&&(s.id||(s.id=(i.id||this.settings.id)+"-label"),e=s.id))}e&&document.getElementById(e)?this.main.main.setAttribute("aria-labelledby",e):this.settings.ariaLabel&&this.settings.ariaLabel.trim()&&this.main.main.setAttribute("aria-label",this.settings.ariaLabel.trim()),this.main.main.setAttribute("aria-owns",this.content.list.id),this.content.search.input.setAttribute("aria-controls",this.content.list.id),this.content.search.input.setAttribute("aria-autocomplete","list"),e&&document.getElementById(e)?this.content.search.input.setAttribute("aria-labelledby",e):this.settings.searchLabelledBy&&document.getElementById(this.settings.searchLabelledBy)?this.content.search.input.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel?this.content.search.input.setAttribute("aria-label",this.settings.searchAriaLabel):this.content.search.input.setAttribute("aria-label","Search options")}mainDiv(){var u;const e=document.createElement("div");e.id=this.settings.id+"-main",e.tabIndex=0,e.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 f=this.content.list.querySelector("."+this.classes.highlighted);return f&&f.click(),!1;case"Escape":return this.callbacks.close(),!1}return c.key.length===1&&this.callbacks.open(),!0},e.onclick=c=>{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 n=document.createElement("div");n.classList.add(this.classes.deselect),n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label",this.settings.clearAllAriaLabel),n.addEventListener("keydown",c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),n.click())});const i=(u=this.store)==null?void 0:u.getSelectedOptions();!this.settings.allowDeselect||this.settings.isMultiple&&i&&i.length<=0?n.classList.add(this.classes.hide):n.classList.remove(this.classes.hide),n.onclick=c=>{if(c.stopPropagation(),this.settings.disabled)return;let f=!0;const p=this.store.getSelectedOptions(),g=[];if(this.callbacks.beforeChange&&(f=this.callbacks.beforeChange(g,p)===!0),f){if(this.settings.isMultiple)this.callbacks.setSelected([],!1),this.updateDeselectAll();else{const _=this.store.getFirstOption(),C=_?_.id:"";this.callbacks.setSelected(C,!1)}this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(this.store.getSelectedOptions())}};const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("viewBox","0 0 100 100"),r.setAttribute("aria-hidden","true"),r.setAttribute("focusable","false");const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.deselectPath),r.appendChild(o),n.appendChild(r),e.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.classList.add(this.classes.arrow),l.setAttribute("viewBox","0 0 100 100"),l.setAttribute("aria-hidden","true"),l.setAttribute("focusable","false");const a=document.createElementNS("http://www.w3.org/2000/svg","path");return a.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&l.classList.add(this.classes.hide),l.appendChild(a),e.appendChild(l),{main:e,values:s,deselect:{main:n,svg:r,path:o},arrow:{main:l,path:a}}}mainFocus(e){e!=="click"&&this.main.main.focus({preventScroll:!0})}placeholder(){const e=this.store.filter(i=>i.placeholder,!1);let s=this.settings.placeholderText;e.length&&(e[0].html!==""?s=e[0].html:e[0].text!==""&&(s=e[0].text));const n=document.createElement("div");return n.classList.add(this.classes.placeholder),n.innerHTML=s,n}renderValues(){if(!this.settings.isMultiple){this.renderSingleValue();return}this.renderMultipleValues(),this.updateDeselectAll()}renderSingleValue(){const e=this.store.filter(n=>n.selected&&!n.placeholder,!1),s=e.length>0?e[0]:null;if(!s)this.main.values.innerHTML=this.placeholder().outerHTML;else{const n=document.createElement("div");n.classList.add(this.classes.single),s.html?n.innerHTML=s.html:n.innerText=s.text,this.main.values.innerHTML=n.outerHTML}!this.settings.allowDeselect||!e.length?this.main.deselect.main.classList.add(this.classes.hide):this.main.deselect.main.classList.remove(this.classes.hide)}renderMultipleValues(){let e=this.main.values.childNodes,s=this.store.filter(i=>i.selected&&i.display,!1);if(s.length===0){this.main.values.innerHTML=this.placeholder().outerHTML;return}else{const i=this.main.values.querySelector("."+this.classes.placeholder);i&&i.remove()}if(s.length>this.settings.maxValuesShown){const i=document.createElement("div");i.classList.add(this.classes.max),i.textContent=this.settings.maxValuesMessage.replace("{number}",s.length.toString()),this.main.values.innerHTML=i.outerHTML;return}else{const i=this.main.values.querySelector("."+this.classes.max);i&&i.remove()}this.settings.keepOrder&&(s=this.store.selectedOrderOptions(s));let n=[];for(let i=0;ia.id===o,!1).length||n.push(r))}for(const i of n)i.classList.add(this.classes.valueOut),setTimeout(()=>{this.main.values.hasChildNodes()&&this.main.values.contains(i)&&this.main.values.removeChild(i)},100);e=this.main.values.childNodes;for(let i=0;i{if(l.preventDefault(),l.stopPropagation(),this.settings.disabled)return;let a=!0;const u=this.store.getSelectedOptions(),c=u.filter(f=>f.selected&&f.id!==e.id,!0);if(!(this.settings.minSelected&&c.length{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),i.click())}}return s}contentDiv(){const e=document.createElement("div");e.id=this.settings.id+"-content";const s=this.searchDiv();e.appendChild(s.main);const n=this.listDiv();return e.appendChild(n),{main:e,search:s,list:n}}moveContent(){if(this.settings.contentPosition==="relative"){this.moveContentBelow();return}if(this.settings.openPosition==="down"){this.moveContentBelow();return}else if(this.settings.openPosition==="up"){this.moveContentAbove();return}this.putContent()==="up"?this.moveContentAbove():this.moveContentBelow()}searchDiv(){const e=document.createElement("div"),s=document.createElement("input"),n=document.createElement("div");e.classList.add(this.classes.search);const i={main:e,input:s};if(this.settings.showSearch||(e.classList.add(this.classes.hide),s.readOnly=!0),s.type="search",s.placeholder=this.settings.searchPlaceholder,s.tabIndex=-1,this.settings.searchLabelledBy&&this.settings.searchLabelledBy.trim()?s.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel&&this.settings.searchAriaLabel.trim()?s.setAttribute("aria-label",this.settings.searchAriaLabel):s.setAttribute("aria-label","Search options"),s.setAttribute("autocapitalize","off"),s.setAttribute("autocomplete","off"),s.setAttribute("autocorrect","off"),s.oninput=Kt(r=>{this.callbacks.search(r.target.value)},100),s.onkeydown=r=>{switch(r.key){case"ArrowUp":case"ArrowDown":return r.key==="ArrowDown"?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Escape":return this.callbacks.close(),!1;case" ":const o=this.content.list.querySelector("."+this.classes.highlighted);return o?(o.click(),!1):!0;case"Enter":if(this.callbacks.addable)return n.click(),!1;{const l=this.content.list.querySelector("."+this.classes.highlighted);if(l)return l.click(),!1}return!0}return!0},e.appendChild(s),this.callbacks.addable){n.classList.add(this.classes.addable);const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("viewBox","0 0 100 100"),r.setAttribute("aria-hidden","true"),r.setAttribute("focusable","false");const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.addablePath),r.appendChild(o),n.appendChild(r),n.onclick=l=>{if(l.preventDefault(),l.stopPropagation(),!this.callbacks.addable)return;const a=this.content.search.input.value.trim();if(a===""){this.content.search.input.focus();return}const u=f=>{let p=new ue(f);if(this.callbacks.addOption(p),this.settings.isMultiple){let g=this.store.getSelected();g.push(p.id),this.callbacks.setSelected(g,!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(f=>{typeof f=="string"?u({text:f,value:f}):c instanceof Error?this.renderError(c.message):u(f)}):typeof c=="string"?u({text:c,value:c}):c instanceof Error?this.renderError(c.message):u(c))},e.appendChild(n),i.addable={main:n,svg:r,path:o}}return i}searchFocus(){this.content.search.input.focus()}getOptions(e=!1,s=!1,n=!1){let i="."+this.classes.option;return e&&(i+=":not(."+this.classes.placeholder+")"),s&&(i+=":not(."+this.classes.disabled+")"),n&&(i+=":not(."+this.classes.hide+")"),Array.from(this.content.list.querySelectorAll(i))}highlight(e){const s=this.getOptions(!0,!0,!0);if(s.length===0)return;if(s.length===1&&!s[0].classList.contains(this.classes.highlighted)){s[0].classList.add(this.classes.highlighted);return}let n=!1;for(const r of s)r.classList.contains(this.classes.highlighted)&&(n=!0);if(!n){for(const r of s)if(r.classList.contains(this.classes.selected)){r.classList.add(this.classes.highlighted);break}}for(let r=0;r=0?r-1:s.length-1];a.classList.add(this.classes.highlighted),this.main.main.setAttribute("aria-activedescendant",a.id),this.ensureElementInView(this.content.list,a);const u=a.parentElement;if(u&&u.classList.contains(this.classes.close)){const c=u.querySelector("."+this.classes.optgroupLabel);c&&c.click()}return}const i=s[e==="down"?0:s.length-1];i.classList.add(this.classes.highlighted),this.main.main.setAttribute("aria-activedescendant",i.id),this.ensureElementInView(this.content.list,i)}listDiv(){const e=document.createElement("div");return e.classList.add(this.classes.list),e}renderError(e){this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy");const s=document.createElement("div");s.classList.add(this.classes.error),s.textContent=e,this.content.list.appendChild(s),this._announceAssertive(e)}renderSearching(){this.content.list.innerHTML="",this.content.list.setAttribute("aria-busy","true");const e=document.createElement("div");e.classList.add(this.classes.searching),e.textContent=this.settings.searchingText,this.content.list.appendChild(e),this._announcePolite(this.settings.searchingText)}renderOptions(e){if(this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy"),e.length===0){const l=document.createElement("div");l.classList.add(this.classes.search);const a=this.callbacks.addable?this.settings.addableText.replace("{value}",this.content.search.input.value):this.settings.searchText;this._announcePolite(a),l.innerHTML=a,this.content.list.appendChild(l),this.content.list.setAttribute("aria-setsize","0");return}this.settings.allowDeselect&&!this.settings.isMultiple&&(this.store.filter(a=>a.placeholder,!1).length||this.store.addOption(new ue({text:"",value:"",selected:!1,placeholder:!0}),!0));const s=document.createDocumentFragment();let n=0;const i=e.filter(l=>l instanceof ue&&!l.placeholder&&l.display&&!l.disabled).length,r=l=>{!l.classList.contains(this.classes.placeholder)&&!l.classList.contains(this.classes.disabled)&&!l.classList.contains(this.classes.hide)&&(l.setAttribute("aria-posinset",String(++n)),l.setAttribute("aria-setsize",String(i)))};for(const l of e){if(l instanceof Me){const a=document.createElement("div");a.classList.add(this.classes.optgroup),a.setAttribute("role","group"),a.setAttribute("aria-label",l.label);const u=document.createElement("div");u.classList.add(this.classes.optgroupLabel),a.appendChild(u);const c=document.createElement("div");c.classList.add(this.classes.optgroupLabelText),c.textContent=l.label,u.appendChild(c);const f=document.createElement("div");if(f.classList.add(this.classes.optgroupActions),u.appendChild(f),this.settings.isMultiple&&l.selectAll){const p=document.createElement("div");p.classList.add(this.classes.optgroupSelectAll);let g=!0;for(const m of l.options)if(!m.selected){g=!1;break}g&&p.classList.add(this.classes.selected);const _=document.createElement("span");_.textContent=l.selectAllText,p.appendChild(_);const C=document.createElementNS("http://www.w3.org/2000/svg","svg");C.setAttribute("viewBox","0 0 100 100"),C.setAttribute("aria-hidden","true"),C.setAttribute("focusable","false"),p.appendChild(C);const D=document.createElementNS("http://www.w3.org/2000/svg","path");D.setAttribute("d",this.classes.optgroupSelectAllBox),C.appendChild(D);const T=document.createElementNS("http://www.w3.org/2000/svg","path");T.setAttribute("d",this.classes.optgroupSelectAllCheck),C.appendChild(T),p.addEventListener("click",m=>{m.preventDefault(),m.stopPropagation();const b=this.store.getSelected();if(g){const y=b.filter(S=>{for(const O of l.options)if(S===O.id)return!1;return!0});this.callbacks.setSelected(y,!0);return}else{const y=b.concat(l.options.map(S=>S.id));for(const S of l.options)this.store.getOptionByID(S.id)||this.callbacks.addOption(S);this.callbacks.setSelected(y,!0);return}}),f.appendChild(p)}if(l.closable!=="off"){const p=document.createElement("div");p.classList.add(this.classes.optgroupClosable);const g=document.createElementNS("http://www.w3.org/2000/svg","svg");g.setAttribute("viewBox","0 0 100 100"),g.classList.add(this.classes.arrow),g.setAttribute("aria-hidden","true"),g.setAttribute("focusable","false"),p.appendChild(g);const _=document.createElementNS("http://www.w3.org/2000/svg","path");g.appendChild(_),l.options.some(C=>C.selected)||this.content.search.input.value.trim()!==""?(a.classList.add(this.classes.open),_.setAttribute("d",this.classes.arrowOpen)):l.closable==="open"?(a.classList.add(this.classes.open),_.setAttribute("d",this.classes.arrowOpen)):l.closable==="close"&&(a.classList.add(this.classes.close),_.setAttribute("d",this.classes.arrowClose)),u.addEventListener("click",C=>{C.preventDefault(),C.stopPropagation(),a.classList.contains(this.classes.close)?(a.classList.remove(this.classes.close),a.classList.add(this.classes.open),_.setAttribute("d",this.classes.arrowOpen)):(a.classList.remove(this.classes.open),a.classList.add(this.classes.close),_.setAttribute("d",this.classes.arrowClose))}),f.appendChild(p)}a.appendChild(u);for(const p of l.options){const g=this.option(p);r(g),a.appendChild(g)}s.appendChild(a)}if(l instanceof ue){const a=this.option(l);r(a),s.appendChild(a)}}this.content.list.appendChild(s),this.content.list.removeAttribute("aria-busy");const o=this.getOptions(!0,!0,!0).length;this._announcePolite(`${o} option${o===1?"":"s"} available`)}option(e){if(e.placeholder){const n=document.createElement("div");return n.classList.add(this.classes.option),n.classList.add(this.classes.hide),n}const s=document.createElement("div");return s.dataset.id=e.id,s.id=`${this.settings.id}__opt__${e.id}`,s.classList.add(this.classes.option),s.setAttribute("role","option"),e.class&&e.class.split(" ").forEach(n=>{s.classList.add(n)}),e.style&&(s.style.cssText=e.style),this.settings.searchHighlight&&this.content.search.input.value.trim()!==""?s.innerHTML=this.highlightText(e.html!==""?e.html:e.text,this.content.search.input.value,this.classes.searchHighlighter):e.html!==""?s.innerHTML=e.html:s.textContent=e.text,this.settings.showOptionTooltips&&s.textContent&&s.setAttribute("title",s.textContent),e.display||s.classList.add(this.classes.hide),e.disabled&&(s.classList.add(this.classes.disabled),s.setAttribute("aria-disabled","true")),e.selected&&this.settings.hideSelected&&s.classList.add(this.classes.hide),e.selected?(s.classList.add(this.classes.selected),s.setAttribute("aria-selected","true"),this.main.main.setAttribute("aria-activedescendant",s.id)):(s.classList.remove(this.classes.selected),s.setAttribute("aria-selected","false")),s.addEventListener("click",n=>{n.preventDefault(),n.stopPropagation();const i=this.store.getSelected(),r=n.currentTarget,o=String(r.dataset.id);if(e.disabled||e.selected&&!this.settings.allowDeselect||this.settings.isMultiple&&this.settings.maxSelected<=i.length&&!e.selected||this.settings.isMultiple&&this.settings.minSelected>=i.length&&e.selected)return;let l=!1;const a=this.store.getSelectedOptions();let u=[];if(this.settings.isMultiple){if(e.selected)u=a.filter(c=>c.id!==o);else if(u=a.concat(e),!this.settings.closeOnSelect)if(n.shiftKey&&this.lastSelectedOption){const c=this.store.getDataOptions();let f=c.findIndex(g=>g.id===this.lastSelectedOption.id),p=c.findIndex(g=>g.id===e.id);if(f>=0&&p>=0){const g=Math.min(f,p),_=Math.max(f,p),C=c.slice(g,_+1);C.length>0&&C.length!a.find(T=>T.id===D.id))))}}else e.selected||(this.lastSelectedOption=e)}this.settings.isMultiple||(e.selected?u=[]:u=[e]),this.callbacks.beforeChange||(l=!0),this.callbacks.beforeChange&&(this.callbacks.beforeChange(u,a)===!1?l=!1:l=!0),l&&(this.store.getOptionByID(o)||this.callbacks.addOption(e),this.callbacks.setSelected(u.map(c=>c.id),!1),this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(u))}),s}destroy(){this.main.main.remove(),this.content.main.remove()}highlightText(e,s,n){let i=e;const r=new RegExp("(?![^<]*>)("+s.trim()+")(?![^<]*>[^<>]*${a}`),i}moveContentAbove(){const e=this.main.main.offsetHeight,s=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 n=this.main.main.getBoundingClientRect();this.content.main.style.margin="-"+(e+s-1)+"px 0px 0px 0px",this.content.main.style.top=n.top+n.height+(this.settings.contentPosition==="fixed"?0:window.scrollY)+"px",this.content.main.style.left=n.left+(this.settings.contentPosition==="fixed"?0:window.scrollX)+"px",this.content.main.style.width=n.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",this.settings.contentPosition!=="relative"&&(this.content.main.style.top=e.top+e.height+(this.settings.contentPosition==="fixed"?0:window.scrollY)+"px",this.content.main.style.left=e.left+(this.settings.contentPosition==="fixed"?0:window.scrollX)+"px",this.content.main.style.width=e.width+"px")}ensureElementInView(e,s){const n=e.scrollTop+e.offsetTop,i=n+e.clientHeight,r=s.offsetTop,o=r+s.clientHeight;ri&&(e.scrollTop+=o-i)}putContent(){const e=this.main.main.offsetHeight,s=this.main.main.getBoundingClientRect(),n=this.content.main.offsetHeight;return window.innerHeight-(s.top+e)<=n&&s.top>n?"up":"down"}updateDeselectAll(){if(!this.store||!this.settings)return;const e=this.store.getSelectedOptions(),s=e&&e.length>0,n=this.settings.isMultiple,i=this.settings.allowDeselect,r=this.main.deselect.main,o=this.classes.hide;i&&!(n&&!s)?r.classList.remove(o):r.classList.add(o)}};ke._livePolite=null,ke._liveAssertive=null;let hn=ke;class Fc{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.getSelectedOptions()),!0}observeCall(e){if(!this.listen)return;let s=!1,n=!1,i=!1;for(const r of e){if(r.target===this.select&&(r.attributeName==="disabled"&&(n=!0),r.attributeName==="class"&&(s=!0),r.type==="childList")){for(const o of r.addedNodes)if(o.nodeName==="OPTION"&&o.value===this.select.value){this.select.dispatchEvent(new Event("change"));break}i=!0}(r.target.nodeName==="OPTGROUP"||r.target.nodeName==="OPTION")&&(i=!0)}s&&this.onClassChange&&this.onClassChange(this.select.className.split(" ")),n&&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 s=this.select.childNodes;for(const n of s)n.nodeName==="OPTGROUP"&&e.push(this.getDataFromOptgroup(n)),n.nodeName==="OPTION"&&e.push(this.getDataFromOption(n));return e}getDataFromOptgroup(e){let s={id:e.id,label:e.label,selectAll:e.dataset?e.dataset.selectall==="true":!1,selectAllText:e.dataset?e.dataset.selectalltext:"Select all",closable:e.dataset?e.dataset.closable:"off",options:[]};const n=e.childNodes;for(const i of n)i.nodeName==="OPTION"&&s.options.push(this.getDataFromOption(i));return s}getDataFromOption(e){return{id:e.id,value:e.value,text:e.text,html:e.dataset&&e.dataset.html?e.dataset.html:"",defaultSelected:e.defaultSelected,selected:e.selected,display:e.style.display!=="none",disabled:e.disabled,mandatory:e.dataset?e.dataset.mandatory==="true":!1,placeholder:e.dataset.placeholder==="true",class:e.className,style:e.style.cssText,data:e.dataset}}getSelectedOptions(){let e=[];const s=this.select.childNodes;for(const n of s){if(n.nodeName==="OPTGROUP"){const i=n.childNodes;for(const r of i)if(r.nodeName==="OPTION"){const o=r;o.selected&&e.push(this.getDataFromOption(o))}}if(n.nodeName==="OPTION"){const i=n;i.selected&&e.push(this.getDataFromOption(i))}}return e}getSelectedValues(){return this.getSelectedOptions().map(e=>e.value)}setSelected(e){this.changeListen(!1);const s=this.select.childNodes;for(const n of s){if(n.nodeName==="OPTGROUP"){const r=n.childNodes;for(const o of r)if(o.nodeName==="OPTION"){const l=o;l.selected=e.includes(l.id)}}if(n.nodeName==="OPTION"){const i=n;i.selected=e.includes(i.id)}}this.changeListen(!0)}setSelectedByValue(e){this.changeListen(!1);const s=this.select.childNodes;for(const n of s){if(n.nodeName==="OPTGROUP"){const r=n.childNodes;for(const o of r)if(o.nodeName==="OPTION"){const l=o;l.selected=e.includes(l.value)}}if(n.nodeName==="OPTION"){const i=n;i.selected=e.includes(i.value)}}this.changeListen(!0)}updateSelect(e,s,n){this.changeListen(!1),e&&(this.select.dataset.id=e),s&&(this.select.style.cssText=s),n&&(this.select.className="",n.forEach(i=>{i.trim()!==""&&this.select.classList.add(i.trim())})),this.changeListen(!0)}updateOptions(e){this.changeListen(!1),this.select.innerHTML="";for(const s of e)s instanceof Me&&this.select.appendChild(this.createOptgroup(s)),s instanceof ue&&this.select.appendChild(this.createOption(s));this.select.dispatchEvent(new Event("change",{bubbles:!0})),this.changeListen(!0)}createOptgroup(e){const s=document.createElement("optgroup");if(s.id=e.id,s.label=e.label,e.selectAll&&(s.dataset.selectAll="true"),e.closable!=="off"&&(s.dataset.closable=e.closable),e.options)for(const n of e.options)s.appendChild(this.createOption(n));return s}createOption(e){const s=document.createElement("option");return s.id=e.id,s.value=e.value,s.textContent=e.text,e.html!==""&&s.setAttribute("data-html",e.html),s.defaultSelected=e.defaultSelected,s.selected=e.selected,e.disabled&&(s.disabled=!0),e.display||(s.style.display="none"),e.placeholder&&s.setAttribute("data-placeholder","true"),e.mandatory&&s.setAttribute("data-mandatory","true"),e.class&&e.class.split(" ").forEach(n=>{s.classList.add(n)}),e.data&&typeof e.data=="object"&&Object.keys(e.data).forEach(n=>{s.setAttribute("data-"+kc(n),e.data[n])}),s}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 Mc{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-"+In(),this.style=e.style||"",this.class=e.class||[],this.disabled=e.disabled!==void 0?e.disabled:!1,this.alwaysOpen=e.alwaysOpen!==void 0?e.alwaysOpen:!1,this.showSearch=e.showSearch!==void 0?e.showSearch:!0,this.focusSearch=e.focusSearch!==void 0?e.focusSearch:!0,this.ariaLabel=e.ariaLabel||"",this.searchPlaceholder=e.searchPlaceholder||"Search",this.searchText=e.searchText||"No Results",this.searchingText=e.searchingText||"Searching...",this.searchHighlight=e.searchHighlight!==void 0?e.searchHighlight:!1,this.closeOnSelect=e.closeOnSelect!==void 0?e.closeOnSelect:!0,this.contentLocation=e.contentLocation||document.body,this.contentPosition=e.contentPosition||"absolute",this.openPosition=e.openPosition||"auto",this.contentAriaLabel=e.contentAriaLabel!==void 0?e.contentAriaLabel:"Select an option",this.placeholderText=e.placeholderText!==void 0?e.placeholderText:"Select Value",this.allowDeselect=e.allowDeselect!==void 0?e.allowDeselect:!1,this.hideSelected=e.hideSelected!==void 0?e.hideSelected:!1,this.keepOrder=e.keepOrder!==void 0?e.keepOrder:!1,this.showOptionTooltips=e.showOptionTooltips!==void 0?e.showOptionTooltips:!1,this.minSelected=e.minSelected||0,this.maxSelected=e.maxSelected||1e3,this.timeoutDelay=e.timeoutDelay||200,this.maxValuesShown=e.maxValuesShown||20,this.maxValuesMessage=e.maxValuesMessage||"{number} selected",this.addableText=e.addableText||'Press "Enter" to add {value}',this.ariaLabelledBy=e.ariaLabelledBy||"",this.searchAriaLabel=e.searchAriaLabel||"Search options",this.searchLabelledBy=e.searchLabelledBy||"",this.clearAllAriaLabel=e.clearAllAriaLabel||"Clear selection"}}class Nc{constructor(e){var o;if(this.events={search:void 0,searchFilter:(l,a)=>l.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=Kt(()=>{!this.settings.isOpen&&!this.settings.isFullOpen||this.render.moveContent()}),this.windowScroll=Kt(()=>{!this.settings.isOpen&&!this.settings.isFullOpen||this.render.moveContent()}),this.documentClick=l=>{this.settings.isOpen&&l.target&&!Dc(l.target,this.settings.id)&&this.close(l.type)},this.windowVisibilityChange=()=>{document.hidden&&this.close()},this.selectEl=typeof e.select=="string"?document.querySelector(e.select):e.select,!this.selectEl){e.events&&e.events.error&&e.events.error(new Error("Could not find select element"));return}if(this.selectEl.tagName!=="SELECT"){e.events&&e.events.error&&e.events.error(new Error("Element isnt of type select"));return}this.selectEl.dataset.ssid&&this.destroy(),this.settings=new Mc(e.settings),this.cssClasses=new Rc(e.cssClasses);const s=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const l in e.events)e.events.hasOwnProperty(l)&&(s.indexOf(l)!==-1?this.events[l]=Kt(e.events[l],100):this.events[l]=e.events[l]);this.settings.disabled=(o=e.settings)!=null&&o.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 Fc(this.selectEl),this.select.updateSelect(this.settings.id,this.settings.style,this.settings.class),this.select.hideUI(),this.select.onValueChange=l=>{this.setSelected(l.map(a=>a.id))},this.select.onClassChange=l=>{this.settings.class=l,this.render.updateClassStyles()},this.select.onDisabledChange=l=>{l?this.disable():this.enable()},this.select.onOptionsChange=l=>{this.setData(l)},this.store=new Ic(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 hn(this.settings,this.cssClasses,this.store,n),this.render.renderValues(),this.render.renderOptions(this.store.getData());const i=this.selectEl.getAttribute("aria-label"),r=this.selectEl.getAttribute("aria-labelledby");i?this.render.main.main.setAttribute("aria-label",i):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),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(e){const s=this.store.getSelected(),n=this.store.validateDataArray(e);if(n){this.events.error&&this.events.error(n);return}this.store.setData(e);const i=this.store.getData();this.select.updateOptions(i),this.render.renderValues(),this.render.renderOptions(i),this.events.afterChange&&!qs(s,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let e=this.store.getSelectedOptions();return this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e)),e.map(s=>s.value)}setSelected(e,s=!0){const n=this.store.getSelected(),i=this.store.getDataOptions();e=Array.isArray(e)?e:[e];const r=[];for(const l of e){if(i.find(a=>a.id==l)){r.push(l);continue}for(const a of i.filter(u=>u.value==l))r.push(a.id)}this.store.setSelectedBy("id",r);const o=this.store.getData();this.select.updateOptions(o),this.render.renderValues(),this.render.content.search.input.value!==""?this.search(this.render.content.search.input.value):this.render.renderOptions(o),s&&this.events.afterChange&&!qs(n,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}addOption(e){const s=this.store.getSelected();this.store.getDataOptions().some(i=>i.value===(e.value??e.text))||this.store.addOption(e);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!qs(s,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.settings.focusSearch&&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(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){this.render.renderOptions(e===""?this.store.getData():this.store.search(e,this.events.searchFilter));return}this.render.renderSearching();const s=this.events.search(e,this.store.getSelectedOptions());if(s instanceof Promise){s.then(n=>{this.render.renderOptions(this.store.partialToFullData(n))}).catch(n=>{this.render.renderError(typeof n=="string"?n:n.message)});return}else Array.isArray(s)?this.render.renderOptions(this.store.partialToFullData(s)):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 Bc="CWYDT23U",Hc="slimselectjscom",Vc=Ts({__name:"carbonad",setup(t){const e=ir(null);let s=!1;return mr(()=>{const n=window.location.hostname==="localhost";if(!s&&!n){s=!0;const i=document.createElement("script");i.id="_carbonads_js",i.src=`//cdn.carbonads.com/carbon.js?serve=${Bc}&placement=${Hc}`,i.async=!0,e.value&&e.value.appendChild(i)}}),(n,i)=>wt(s)?(Zt(),Nr("div",{key:0,class:"carbon-container",ref_key:"container",ref:e},null,512)):$o("",!0)}}),Uc=Ts({name:"App",components:{CarbonAd:Vc},data(){return{nav:null,navDebounce:Kt(()=>{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:"Examples",closable:"close",options:[{text:"countries",value:"examples#countries"},{text:"form reset",value:"examples#formReset"}]},{label:"Settings",closable:"close",options:[{text:"select",value:"settings#select"},{text:"cssClasses",value:"settings#cssClasses"},{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"}]}]}},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 t=this.$route.hash;if(t===""&&window.scroll({top:0,behavior:"smooth"}),t){const e=document.querySelector(t);if(e){const s=document.querySelector("header"),n=document.querySelector("nav"),i=s?s.clientHeight+(window.innerWidth<700?n.clientHeight:0)+8:0;window.scroll({top:e.offsetTop-i,behavior:"smooth"})}}},200)}),this.setDemensions(),window.addEventListener("resize",this.navDebounce),window.addEventListener("nav-updated",this.updateNav)},unmounted(){var t;window.removeEventListener("resize",this.navDebounce),window.removeEventListener("nav-updated",this.updateNav),(t=this.nav)==null||t.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 t={searchHighlight:!0,openContent:"below"};this.width>700&&(t.alwaysOpen=!0,t.contentPosition="relative",t.contentLocation=this.$refs.navContent),this.nav=new Nc({select:this.$refs.nav,data:this.navData,settings:t,events:{afterChange:e=>{const n=e[0].value.split("#"),i=n[0],r=n[1]?"#"+n[1]:void 0;this.$router.push({path:i,hash:r})}}})},updateNav(){setTimeout(()=>{this.nav&&this.nav.setSelected(this.$router.currentRoute.value.fullPath.replace("/",""))},0)}}}),$c="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",jc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACAAQMAAAD58POIAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZQTFRFyzg3////IltC9QAAAAFiS0dEAf8CLd4AAAAJcEhZcwAACxMAAAsTAQCanBgAAAAkSURBVEjHY2AYBYMV/IeDUQG4AJgeFRgVGBUYFSBNYBQMPgAARjtdvxo6xaMAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTEtMDUtMzBUMjM6MTA6NDQtMDc6MDCm4GvfAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDEwLTEyLTA2VDEyOjIwOjEyLTA4OjAwpIGEmQAAADJ0RVh0UE5HOmNIUk0AY2h1bmsgd2FzIGZvdW5kIChzZWUgQ2hyb21hdGljaXR5LCBhYm92ZSkH0UjaAAAAKXRFWHRQTkc6Z0FNQQBnYW1tYT0wLjQ1NDU1IChTZWUgR2FtbWEsIGFib3ZlKRISLKcAAAAUdEVYdFBORzpJSERSLmJpdF9kZXB0aAA4KYV+UAAAABV0RVh0UE5HOklIRFIuY29sb3JfdHlwZQA2BkqnKwAAABt0RVh0UE5HOklIRFIuaW50ZXJsYWNlX21ldGhvZAAw+zsHjAAAABx0RVh0UE5HOklIRFIud2lkdGgsaGVpZ2h0ADE2LCAxNjjVBg0AAAAodEVYdFBORzpwSFlzAHhfcmVzPTI4MzUsIHlfcmVzPTI4MzUsIHVuaXRzPTGCKXI+AAAAKHRFWHRQTkc6c1JHQgBpbnRlbnQ9MCAoU2VlIFJlbmRlcmluZyBpbnRlbnQp8hEU9QAAAABJRU5ErkJggg==",zc=(t,e)=>{const s=t.__vccOpts||t;for(const[n,i]of e)s[n]=i;return s},Wc={ref:"nav"},Gc={class:"nav-content",ref:"navContent"};function qc(t,e,s,n,i,r){const o=$n("CarbonAd"),l=$n("router-view");return Zt(),Nr(Re,null,[e[4]||(e[4]=Uo('

Slim Select 2.0

Advanced select dropdown
',1)),Ze("nav",null,[Ze("select",Wc,null,512),Ze("div",Gc,null,512),de(o)]),Ze("main",null,[de(l),Ze("footer",null,[ds(" © "+Vi(t.year)+" ",1),e[0]||(e[0]=Ze("a",{href:"http://webiswhatido.com",style:{color:"#ffffff"},target:"_blank"},"Brian Voelker",-1)),e[1]||(e[1]=ds(". ")),e[2]||(e[2]=Ze("br",null,null,-1)),e[3]||(e[3]=ds(" Slim Select is under the MIT license. "))])])],64)}const Kc=zc(Uc,[["render",qc]]);var Ri=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function sl(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ks={exports:{}},Di;function Yc(){return Di||(Di=1,function(t){var e=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};/** + */const Ct=typeof document<"u";function jr(t){return typeof t=="object"||"displayName"in t||"props"in t||"__vccOpts"in t}function Oa(t){return t.__esModule||t[Symbol.toStringTag]==="Module"||t.default&&jr(t.default)}const J=Object.assign;function zs(t,e){const s={};for(const n in e){const i=e[n];s[n]=He(i)?i.map(t):t(i)}return s}const qt=()=>{},He=Array.isArray,zr=/#/g,La=/&/g,Ta=/\//g,Pa=/=/g,Ra=/\?/g,Wr=/\+/g,Da=/%5B/g,ka=/%5D/g,qr=/%5E/g,Ia=/%60/g,Gr=/%7B/g,Fa=/%7C/g,Kr=/%7D/g,Ma=/%20/g;function Dn(t){return encodeURI(""+t).replace(Fa,"|").replace(Da,"[").replace(ka,"]")}function Na(t){return Dn(t).replace(Gr,"{").replace(Kr,"}").replace(qr,"^")}function cn(t){return Dn(t).replace(Wr,"%2B").replace(Ma,"+").replace(zr,"%23").replace(La,"%26").replace(Ia,"`").replace(Gr,"{").replace(Kr,"}").replace(qr,"^")}function Ba(t){return cn(t).replace(Pa,"%3D")}function Ha(t){return Dn(t).replace(zr,"%23").replace(Ra,"%3F")}function Va(t){return t==null?"":Ha(t).replace(Ta,"%2F")}function ss(t){try{return decodeURIComponent(""+t)}catch{}return""+t}const $a=/\/$/,Ua=t=>t.replace($a,"");function Ws(t,e,s="/"){let n,i={},r="",o="";const l=e.indexOf("#");let a=e.indexOf("?");return l=0&&(a=-1),a>-1&&(n=e.slice(0,a),r=e.slice(a+1,l>-1?l:e.length),i=t(r)),l>-1&&(n=n||e.slice(0,l),o=e.slice(l,e.length)),n=qa(n??e,s),{fullPath:n+(r&&"?")+r+o,path:n,query:i,hash:ss(o)}}function ja(t,e){const s=e.query?t(e.query):"";return e.path+(s&&"?")+s+(e.hash||"")}function pi(t,e){return!e||!t.toLowerCase().startsWith(e.toLowerCase())?t:t.slice(e.length)||"/"}function za(t,e,s){const n=e.matched.length-1,i=s.matched.length-1;return n>-1&&n===i&&kt(e.matched[n],s.matched[i])&&Yr(e.params,s.params)&&t(e.query)===t(s.query)&&e.hash===s.hash}function kt(t,e){return(t.aliasOf||t)===(e.aliasOf||e)}function Yr(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(!Wa(t[s],e[s]))return!1;return!0}function Wa(t,e){return He(t)?gi(t,e):He(e)?gi(e,t):t===e}function gi(t,e){return He(e)?t.length===e.length&&t.every((s,n)=>s===e[n]):t.length===1&&t[0]===e}function qa(t,e){if(t.startsWith("/"))return t;if(!t)return e;const s=e.split("/"),n=t.split("/"),i=n[n.length-1];(i===".."||i===".")&&n.push("");let r=s.length-1,o,l;for(o=0;o1&&r--;else break;return s.slice(0,r).join("/")+"/"+n.slice(o).join("/")}const ut={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};var ns;(function(t){t.pop="pop",t.push="push"})(ns||(ns={}));var Gt;(function(t){t.back="back",t.forward="forward",t.unknown=""})(Gt||(Gt={}));function Ga(t){if(!t)if(Ct){const e=document.querySelector("base");t=e&&e.getAttribute("href")||"/",t=t.replace(/^\w+:\/\/[^\/]+/,"")}else t="/";return t[0]!=="/"&&t[0]!=="#"&&(t="/"+t),Ua(t)}const Ka=/^[^#]+#/;function Ya(t,e){return t.replace(Ka,"#")+e}function Qa(t,e){const s=document.documentElement.getBoundingClientRect(),n=t.getBoundingClientRect();return{behavior:e.behavior,left:n.left-s.left-(e.left||0),top:n.top-s.top-(e.top||0)}}const ks=()=>({left:window.scrollX,top:window.scrollY});function Ja(t){let e;if("el"in t){const s=t.el,n=typeof s=="string"&&s.startsWith("#"),i=typeof s=="string"?n?document.getElementById(s.slice(1)):document.querySelector(s):s;if(!i)return;e=Qa(i,t)}else e=t;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.scrollX,e.top!=null?e.top:window.scrollY)}function mi(t,e){return(history.state?history.state.position-e:-1)+t}const un=new Map;function Za(t,e){un.set(t,e)}function Xa(t){const e=un.get(t);return un.delete(t),e}let ec=()=>location.protocol+"//"+location.host;function Qr(t,e){const{pathname:s,search:n,hash:i}=e,r=t.indexOf("#");if(r>-1){let l=i.includes(t.slice(r))?t.slice(r).length:1,a=i.slice(l);return a[0]!=="/"&&(a="/"+a),pi(a,"")}return pi(s,t)+n+i}function tc(t,e,s,n){let i=[],r=[],o=null;const l=({state:p})=>{const g=Qr(t,location),_=s.value,C=e.value;let D=0;if(p){if(s.value=g,e.value=p,o&&o===_){o=null;return}D=C?p.position-C.position:0}else n(g);i.forEach(T=>{T(s.value,_,{delta:D,type:ns.pop,direction:D?D>0?Gt.forward:Gt.back:Gt.unknown})})};function a(){o=s.value}function u(p){i.push(p);const g=()=>{const _=i.indexOf(p);_>-1&&i.splice(_,1)};return r.push(g),g}function c(){const{history:p}=window;p.state&&p.replaceState(J({},p.state,{scroll:ks()}),"")}function f(){for(const p of r)p();r=[],window.removeEventListener("popstate",l),window.removeEventListener("beforeunload",c)}return window.addEventListener("popstate",l),window.addEventListener("beforeunload",c,{passive:!0}),{pauseListeners:a,listen:u,destroy:f}}function vi(t,e,s,n=!1,i=!1){return{back:t,current:e,forward:s,replaced:n,position:window.history.length,scroll:i?ks():null}}function sc(t){const{history:e,location:s}=window,n={value:Qr(t,s)},i={value:e.state};i.value||r(n.value,{back:null,current:n.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function r(a,u,c){const f=t.indexOf("#"),p=f>-1?(s.host&&document.querySelector("base")?t:t.slice(f))+a:ec()+t+a;try{e[c?"replaceState":"pushState"](u,"",p),i.value=u}catch(g){console.error(g),s[c?"replace":"assign"](p)}}function o(a,u){const c=J({},e.state,vi(i.value.back,a,i.value.forward,!0),u,{position:i.value.position});r(a,c,!0),n.value=a}function l(a,u){const c=J({},i.value,e.state,{forward:a,scroll:ks()});r(c.current,c,!0);const f=J({},vi(n.value,a,null),{position:c.position+1},u);r(a,f,!1),n.value=a}return{location:n,state:i,push:l,replace:o}}function nc(t){t=Ga(t);const e=sc(t),s=tc(t,e.state,e.location,e.replace);function n(r,o=!0){o||s.pauseListeners(),history.go(r)}const i=J({location:"",base:t,go:n,createHref:Ya.bind(null,t)},e,s);return Object.defineProperty(i,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(i,"state",{enumerable:!0,get:()=>e.state.value}),i}function ic(t){return typeof t=="string"||t&&typeof t=="object"}function Jr(t){return typeof t=="string"||typeof t=="symbol"}const Zr=Symbol("");var bi;(function(t){t[t.aborted=4]="aborted",t[t.cancelled=8]="cancelled",t[t.duplicated=16]="duplicated"})(bi||(bi={}));function It(t,e){return J(new Error,{type:t,[Zr]:!0},e)}function Je(t,e){return t instanceof Error&&Zr in t&&(e==null||!!(t.type&e))}const yi="[^/]+?",rc={sensitive:!1,strict:!1,start:!0,end:!0},lc=/[.+*?^${}()[\]/\\]/g;function oc(t,e){const s=J({},rc,e),n=[];let i=s.start?"^":"";const r=[];for(const u of t){const c=u.length?[]:[90];s.strict&&!u.length&&(i+="/");for(let f=0;fe.length?e.length===1&&e[0]===80?1:-1:0}function Xr(t,e){let s=0;const n=t.score,i=e.score;for(;s0&&e[e.length-1]<0}const cc={type:0,value:""},uc=/[a-zA-Z0-9_]/;function fc(t){if(!t)return[[]];if(t==="/")return[[cc]];if(!t.startsWith("/"))throw new Error(`Invalid path "${t}"`);function e(g){throw new Error(`ERR (${s})/"${u}": ${g}`)}let s=0,n=s;const i=[];let r;function o(){r&&i.push(r),r=[]}let l=0,a,u="",c="";function f(){u&&(s===0?r.push({type:0,value:u}):s===1||s===2||s===3?(r.length>1&&(a==="*"||a==="+")&&e(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),r.push({type:1,value:u,regexp:c,repeatable:a==="*"||a==="+",optional:a==="*"||a==="?"})):e("Invalid state to consume buffer"),u="")}function p(){u+=a}for(;l{o(b)}:qt}function o(f){if(Jr(f)){const p=n.get(f);p&&(n.delete(f),s.splice(s.indexOf(p),1),p.children.forEach(o),p.alias.forEach(o))}else{const p=s.indexOf(f);p>-1&&(s.splice(p,1),f.record.name&&n.delete(f.record.name),f.children.forEach(o),f.alias.forEach(o))}}function l(){return s}function a(f){const p=mc(f,s);s.splice(p,0,f),f.record.name&&!Si(f)&&n.set(f.record.name,f)}function u(f,p){let g,_={},C,D;if("name"in f&&f.name){if(g=n.get(f.name),!g)throw It(1,{location:f});D=g.record.name,_=J(wi(p.params,g.keys.filter(b=>!b.optional).concat(g.parent?g.parent.keys.filter(b=>b.optional):[]).map(b=>b.name)),f.params&&wi(f.params,g.keys.map(b=>b.name))),C=g.stringify(_)}else if(f.path!=null)C=f.path,g=s.find(b=>b.re.test(C)),g&&(_=g.parse(C),D=g.record.name);else{if(g=p.name?n.get(p.name):s.find(b=>b.re.test(p.path)),!g)throw It(1,{location:f,currentLocation:p});D=g.record.name,_=J({},p.params,f.params),C=g.stringify(_)}const T=[];let m=g;for(;m;)T.unshift(m.record),m=m.parent;return{name:D,path:C,params:_,matched:T,meta:gc(T)}}t.forEach(f=>r(f));function c(){s.length=0,n.clear()}return{addRoute:r,resolve:u,removeRoute:o,clearRoutes:c,getRoutes:l,getRecordMatcher:i}}function wi(t,e){const s={};for(const n of e)n in t&&(s[n]=t[n]);return s}function xi(t){const e={path:t.path,redirect:t.redirect,name:t.name,meta:t.meta||{},aliasOf:t.aliasOf,beforeEnter:t.beforeEnter,props:pc(t),children:t.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in t?t.components||null:t.component&&{default:t.component}};return Object.defineProperty(e,"mods",{value:{}}),e}function pc(t){const e={},s=t.props||!1;if("component"in t)e.default=s;else for(const n in t.components)e[n]=typeof s=="object"?s[n]:s;return e}function Si(t){for(;t;){if(t.record.aliasOf)return!0;t=t.parent}return!1}function gc(t){return t.reduce((e,s)=>J(e,s.meta),{})}function Ei(t,e){const s={};for(const n in t)s[n]=n in e?e[n]:t[n];return s}function mc(t,e){let s=0,n=e.length;for(;s!==n;){const r=s+n>>1;Xr(t,e[r])<0?n=r:s=r+1}const i=vc(t);return i&&(n=e.lastIndexOf(i,n-1)),n}function vc(t){let e=t;for(;e=e.parent;)if(el(e)&&Xr(t,e)===0)return e}function el({record:t}){return!!(t.name||t.components&&Object.keys(t.components).length||t.redirect)}function bc(t){const e={};if(t===""||t==="?")return e;const n=(t[0]==="?"?t.slice(1):t).split("&");for(let i=0;ir&&cn(r)):[n&&cn(n)]).forEach(r=>{r!==void 0&&(e+=(e.length?"&":"")+s,r!=null&&(e+="="+r))})}return e}function yc(t){const e={};for(const s in t){const n=t[s];n!==void 0&&(e[s]=He(n)?n.map(i=>i==null?null:""+i):n==null?n:""+n)}return e}const Ac=Symbol(""),_i=Symbol(""),kn=Symbol(""),tl=Symbol(""),fn=Symbol("");function Bt(){let t=[];function e(n){return t.push(n),()=>{const i=t.indexOf(n);i>-1&&t.splice(i,1)}}function s(){t=[]}return{add:e,list:()=>t.slice(),reset:s}}function dt(t,e,s,n,i,r=o=>o()){const o=n&&(n.enterCallbacks[i]=n.enterCallbacks[i]||[]);return()=>new Promise((l,a)=>{const u=p=>{p===!1?a(It(4,{from:s,to:e})):p instanceof Error?a(p):ic(p)?a(It(2,{from:e,to:p})):(o&&n.enterCallbacks[i]===o&&typeof p=="function"&&o.push(p),l())},c=r(()=>t.call(n&&n.instances[i],e,s,u));let f=Promise.resolve(c);t.length<3&&(f=f.then(u)),f.catch(p=>a(p))})}function qs(t,e,s,n,i=r=>r()){const r=[];for(const o of t)for(const l in o.components){let a=o.components[l];if(!(e!=="beforeRouteEnter"&&!o.instances[l]))if(jr(a)){const c=(a.__vccOpts||a)[e];c&&r.push(dt(c,s,n,o,l,i))}else{let u=a();r.push(()=>u.then(c=>{if(!c)throw new Error(`Couldn't resolve component "${l}" at "${o.path}"`);const f=Oa(c)?c.default:c;o.mods[l]=c,o.components[l]=f;const g=(f.__vccOpts||f)[e];return g&&dt(g,s,n,o,l,i)()}))}}return r}function Oi(t){const e=tt(kn),s=tt(tl),n=Ne(()=>{const a=wt(t.to);return e.resolve(a)}),i=Ne(()=>{const{matched:a}=n.value,{length:u}=a,c=a[u-1],f=s.matched;if(!c||!f.length)return-1;const p=f.findIndex(kt.bind(null,c));if(p>-1)return p;const g=Li(a[u-2]);return u>1&&Li(c)===g&&f[f.length-1].path!==g?f.findIndex(kt.bind(null,a[u-2])):p}),r=Ne(()=>i.value>-1&&Cc(s.params,n.value.params)),o=Ne(()=>i.value>-1&&i.value===s.matched.length-1&&Yr(s.params,n.value.params));function l(a={}){if(Ec(a)){const u=e[wt(t.replace)?"replace":"push"](wt(t.to)).catch(qt);return t.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>u),u}return Promise.resolve()}return{route:n,href:Ne(()=>n.value.href),isActive:r,isExactActive:o,navigate:l}}function wc(t){return t.length===1?t[0]:t}const xc=Ts({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"},viewTransition:Boolean},useLink:Oi,setup(t,{slots:e}){const s=Os(Oi(t)),{options:n}=tt(kn),i=Ne(()=>({[Ti(t.activeClass,n.linkActiveClass,"router-link-active")]:s.isActive,[Ti(t.exactActiveClass,n.linkExactActiveClass,"router-link-exact-active")]:s.isExactActive}));return()=>{const r=e.default&&wc(e.default(s));return t.custom?r:$r("a",{"aria-current":s.isExactActive?t.ariaCurrentValue:null,href:s.href,onClick:s.navigate,class:i.value},r)}}}),Sc=xc;function Ec(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&!(t.button!==void 0&&t.button!==0)){if(t.currentTarget&&t.currentTarget.getAttribute){const e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function Cc(t,e){for(const s in e){const n=e[s],i=t[s];if(typeof n=="string"){if(n!==i)return!1}else if(!He(i)||i.length!==n.length||n.some((r,o)=>r!==i[o]))return!1}return!0}function Li(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const Ti=(t,e,s)=>t??e??s,_c=Ts({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(t,{attrs:e,slots:s}){const n=tt(fn),i=Ne(()=>t.route||n.value),r=tt(_i,0),o=Ne(()=>{let u=wt(r);const{matched:c}=i.value;let f;for(;(f=c[u])&&!f.components;)u++;return u}),l=Ne(()=>i.value.matched[o.value]);cs(_i,Ne(()=>o.value+1)),cs(Ac,l),cs(fn,i);const a=ir();return us(()=>[a.value,l.value,t.name],([u,c,f],[p,g,_])=>{c&&(c.instances[f]=u,g&&g!==c&&u&&u===p&&(c.leaveGuards.size||(c.leaveGuards=g.leaveGuards),c.updateGuards.size||(c.updateGuards=g.updateGuards))),u&&c&&(!g||!kt(c,g)||!p)&&(c.enterCallbacks[f]||[]).forEach(C=>C(u))},{flush:"post"}),()=>{const u=i.value,c=t.name,f=l.value,p=f&&f.components[c];if(!p)return Pi(s.default,{Component:p,route:u});const g=f.props[c],_=g?g===!0?u.params:typeof g=="function"?g(u):g:null,D=$r(p,J({},_,e,{onVnodeUnmounted:T=>{T.component.isUnmounted&&(f.instances[c]=null)},ref:a}));return Pi(s.default,{Component:D,route:u})||D}}});function Pi(t,e){if(!t)return null;const s=t(e);return s.length===1?s[0]:s}const Oc=_c;function Lc(t){const e=dc(t.routes,t),s=t.parseQuery||bc,n=t.stringifyQuery||Ci,i=t.history,r=Bt(),o=Bt(),l=Bt(),a=Ml(ut);let u=ut;Ct&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=zs.bind(null,A=>""+A),f=zs.bind(null,Va),p=zs.bind(null,ss);function g(A,N){let k,B;return Jr(A)?(k=e.getRecordMatcher(A),B=N):B=A,e.addRoute(B,k)}function _(A){const N=e.getRecordMatcher(A);N&&e.removeRoute(N)}function C(){return e.getRoutes().map(A=>A.record)}function D(A){return!!e.getRecordMatcher(A)}function T(A,N){if(N=J({},N||a.value),typeof A=="string"){const v=Ws(s,A,N.path),w=e.resolve({path:v.path},N),E=i.createHref(v.fullPath);return J(v,w,{params:p(w.params),hash:ss(v.hash),redirectedFrom:void 0,href:E})}let k;if(A.path!=null)k=J({},A,{path:Ws(s,A.path,N.path).path});else{const v=J({},A.params);for(const w in v)v[w]==null&&delete v[w];k=J({},A,{params:f(v)}),N.params=f(N.params)}const B=e.resolve(k,N),Y=A.hash||"";B.params=c(p(B.params));const h=ja(n,J({},A,{hash:Na(Y),path:B.path})),d=i.createHref(h);return J({fullPath:h,hash:Y,query:n===Ci?yc(A.query):A.query||{}},B,{redirectedFrom:void 0,href:d})}function m(A){return typeof A=="string"?Ws(s,A,a.value.path):J({},A)}function b(A,N){if(u!==A)return It(8,{from:N,to:A})}function y(A){return I(A)}function S(A){return y(J(m(A),{replace:!0}))}function O(A){const N=A.matched[A.matched.length-1];if(N&&N.redirect){const{redirect:k}=N;let B=typeof k=="function"?k(A):k;return typeof B=="string"&&(B=B.includes("?")||B.includes("#")?B=m(B):{path:B},B.params={}),J({query:A.query,hash:A.hash,params:B.path!=null?{}:A.params},B)}}function I(A,N){const k=u=T(A),B=a.value,Y=A.state,h=A.force,d=A.replace===!0,v=O(k);if(v)return I(J(m(v),{state:typeof v=="object"?J({},Y,v.state):Y,force:h,replace:d}),N||k);const w=k;w.redirectedFrom=N;let E;return!h&&za(n,B,k)&&(E=It(16,{to:w,from:B}),Ae(B,B,!0,!1)),(E?Promise.resolve(E):K(w,B)).catch(x=>Je(x)?Je(x,2)?x:ye(x):U(x,w,B)).then(x=>{if(x){if(Je(x,2))return I(J({replace:d},m(x.to),{state:typeof x.to=="object"?J({},Y,x.to.state):Y,force:h}),N||w)}else x=pe(w,B,!0,d,Y);return re(w,B,x),x})}function W(A,N){const k=b(A,N);return k?Promise.reject(k):Promise.resolve()}function H(A){const N=we.values().next().value;return N&&typeof N.runWithContext=="function"?N.runWithContext(A):A()}function K(A,N){let k;const[B,Y,h]=Tc(A,N);k=qs(B.reverse(),"beforeRouteLeave",A,N);for(const v of B)v.leaveGuards.forEach(w=>{k.push(dt(w,A,N))});const d=W.bind(null,A,N);return k.push(d),fe(k).then(()=>{k=[];for(const v of r.list())k.push(dt(v,A,N));return k.push(d),fe(k)}).then(()=>{k=qs(Y,"beforeRouteUpdate",A,N);for(const v of Y)v.updateGuards.forEach(w=>{k.push(dt(w,A,N))});return k.push(d),fe(k)}).then(()=>{k=[];for(const v of h)if(v.beforeEnter)if(He(v.beforeEnter))for(const w of v.beforeEnter)k.push(dt(w,A,N));else k.push(dt(v.beforeEnter,A,N));return k.push(d),fe(k)}).then(()=>(A.matched.forEach(v=>v.enterCallbacks={}),k=qs(h,"beforeRouteEnter",A,N,H),k.push(d),fe(k))).then(()=>{k=[];for(const v of o.list())k.push(dt(v,A,N));return k.push(d),fe(k)}).catch(v=>Je(v,8)?v:Promise.reject(v))}function re(A,N,k){l.list().forEach(B=>H(()=>B(A,N,k)))}function pe(A,N,k,B,Y){const h=b(A,N);if(h)return h;const d=N===ut,v=Ct?history.state:{};k&&(B||d?i.replace(A.fullPath,J({scroll:d&&v&&v.scroll},Y)):i.push(A.fullPath,Y)),a.value=A,Ae(A,N,k,d),ye()}let Le;function ot(){Le||(Le=i.listen((A,N,k)=>{if(!Ve.listening)return;const B=T(A),Y=O(B);if(Y){I(J(Y,{replace:!0,force:!0}),B).catch(qt);return}u=B;const h=a.value;Ct&&Za(mi(h.fullPath,k.delta),ks()),K(B,h).catch(d=>Je(d,12)?d:Je(d,2)?(I(J(m(d.to),{force:!0}),B).then(v=>{Je(v,20)&&!k.delta&&k.type===ns.pop&&i.go(-1,!1)}).catch(qt),Promise.reject()):(k.delta&&i.go(-k.delta,!1),U(d,B,h))).then(d=>{d=d||pe(B,h,!1),d&&(k.delta&&!Je(d,8)?i.go(-k.delta,!1):k.type===ns.pop&&Je(d,20)&&i.go(-1,!1)),re(B,h,d)}).catch(qt)}))}let at=Bt(),oe=Bt(),Q;function U(A,N,k){ye(A);const B=oe.list();return B.length?B.forEach(Y=>Y(A,N,k)):console.error(A),Promise.reject(A)}function ae(){return Q&&a.value!==ut?Promise.resolve():new Promise((A,N)=>{at.add([A,N])})}function ye(A){return Q||(Q=!A,ot(),at.list().forEach(([N,k])=>A?k(A):N()),at.reset()),A}function Ae(A,N,k,B){const{scrollBehavior:Y}=t;if(!Ct||!Y)return Promise.resolve();const h=!k&&Xa(mi(A.fullPath,0))||(B||!k)&&history.state&&history.state.scroll||null;return ar().then(()=>Y(A,N,h)).then(d=>d&&Ja(d)).catch(d=>U(d,A,N))}const te=A=>i.go(A);let ct;const we=new Set,Ve={currentRoute:a,listening:!0,addRoute:g,removeRoute:_,clearRoutes:e.clearRoutes,hasRoute:D,getRoutes:C,resolve:T,options:t,push:y,replace:S,go:te,back:()=>te(-1),forward:()=>te(1),beforeEach:r.add,beforeResolve:o.add,afterEach:l.add,onError:oe.add,isReady:ae,install(A){const N=this;A.component("RouterLink",Sc),A.component("RouterView",Oc),A.config.globalProperties.$router=N,Object.defineProperty(A.config.globalProperties,"$route",{enumerable:!0,get:()=>wt(a)}),Ct&&!ct&&a.value===ut&&(ct=!0,y(i.location).catch(Y=>{}));const k={};for(const Y in ut)Object.defineProperty(k,Y,{get:()=>a.value[Y],enumerable:!0});A.provide(kn,N),A.provide(tl,sr(k)),A.provide(fn,a);const B=A.unmount;we.add(A),A.unmount=function(){we.delete(A),we.size<1&&(u=ut,Le&&Le(),Le=null,a.value=ut,ct=!1,Q=!1),B()}}};function fe(A){return A.reduce((N,k)=>N.then(()=>H(k)),Promise.resolve())}return Ve}function Tc(t,e){const s=[],n=[],i=[],r=Math.max(e.matched.length,t.matched.length);for(let o=0;okt(u,l))?n.push(l):s.push(l));const a=t.matched[o];a&&(e.matched.find(u=>kt(u,a))||i.push(a))}return[s,n,i]}const Pc=Lc({history:nc(),linkActiveClass:"active",routes:[{path:"/",name:"Home",component:()=>Qe(()=>import("./home.js"),__vite__mapDeps([0,1]))},{path:"/install",name:"Install",component:()=>Qe(()=>import("./install.js"),[])},{path:"/selects",name:"Selects",component:()=>Qe(()=>import("./selects.js"),[])},{path:"/data",name:"Data",component:()=>Qe(()=>import("./data.js"),[])},{path:"/examples",name:"Examples",component:()=>Qe(()=>import("./index2.js"),__vite__mapDeps([2,3]))},{path:"/settings",name:"Settings",component:()=>Qe(()=>import("./index3.js"),__vite__mapDeps([4,5]))},{path:"/events",name:"Events",component:()=>Qe(()=>import("./index4.js"),[])},{path:"/methods",name:"Methods",component:()=>Qe(()=>import("./index5.js"),[])},{path:"/vue",name:"Vue",component:()=>Qe(()=>import("./vue.js"),[])}]});class Rc{constructor(e){e||(e={}),this.main=e.main||"ss-main",this.placeholder=e.placeholder||"ss-placeholder",this.values=e.values||"ss-values",this.single=e.single||"ss-single",this.max=e.max||"ss-max",this.value=e.value||"ss-value",this.valueText=e.valueText||"ss-value-text",this.valueDelete=e.valueDelete||"ss-value-delete",this.valueOut=e.valueOut||"ss-value-out",this.deselect=e.deselect||"ss-deselect",this.deselectPath=e.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=e.arrow||"ss-arrow",this.arrowClose=e.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=e.arrowOpen||"M10,70 L50,30 L90,70",this.content=e.content||"ss-content",this.openAbove=e.openAbove||"ss-open-above",this.openBelow=e.openBelow||"ss-open-below",this.search=e.search||"ss-search",this.searchHighlighter=e.searchHighlighter||"ss-search-highlight",this.searching=e.searching||"ss-searching",this.addable=e.addable||"ss-addable",this.addablePath=e.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=e.list||"ss-list",this.optgroup=e.optgroup||"ss-optgroup",this.optgroupLabel=e.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=e.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=e.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=e.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=e.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=e.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=e.optgroupClosable||"ss-closable",this.option=e.option||"ss-option",this.optionDelete=e.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=e.highlighted||"ss-highlighted",this.open=e.open||"ss-open",this.close=e.close||"ss-close",this.selected=e.selected||"ss-selected",this.error=e.error||"ss-error",this.disabled=e.disabled||"ss-disabled",this.hide=e.hide||"ss-hide"}}function In(){return Math.random().toString(36).substring(2,10)}function Dc(t,e){function s(i,r){return r&&i&&i.classList&&i.classList.contains(r)||r&&i&&i.dataset&&i.dataset.id&&i.dataset.id===e?i:null}function n(i,r){return!i||i===document?null:s(i,r)?i:n(i.parentNode,r)}return s(t,e)||n(t,e)}function Kt(t,e=50,s=!1){let n;return function(...i){const r=self,o=()=>{n=null,s||t.apply(r,i)},l=s&&!n;clearTimeout(n),n=setTimeout(o,e),l&&t.apply(r,i)}}function Gs(t,e){return JSON.stringify(t)===JSON.stringify(e)}function kc(t){const e=t.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,s=>"-"+s.toLowerCase());return t[0]===t[0].toUpperCase()?e.substring(1):e}class Me{constructor(e){if(this.id=!e.id||e.id===""?In():e.id,this.label=e.label||"",this.selectAll=e.selectAll===void 0?!1:e.selectAll,this.selectAllText=e.selectAllText||"Select All",this.closable=e.closable||"off",this.options=[],e.options)for(const s of e.options)this.options.push(new ue(s))}}class ue{constructor(e){this.id=!e.id||e.id===""?In():e.id,this.value=e.value===void 0?e.text:e.value,this.text=e.text||"",this.html=e.html||"",this.defaultSelected=e.defaultSelected!==void 0?e.defaultSelected:!1,this.selected=e.selected!==void 0?e.selected:!1,this.display=e.display!==void 0?e.display:!0,this.disabled=e.disabled!==void 0?e.disabled:!1,this.mandatory=e.mandatory!==void 0?e.mandatory:!1,this.placeholder=e.placeholder!==void 0?e.placeholder:!1,this.class=e.class||"",this.style=e.style||"",this.data=e.data||{}}}class Ic{constructor(e,s){this.selectType="single",this.data=[],this.selectedOrder=[],this.selectType=e,this.setData(s)}validateDataArray(e){if(!Array.isArray(e))return new Error("Data must be an array");for(let s of e)if(s instanceof Me||"label"in s){if(!("label"in s))return new Error("Optgroup must have a label");if("options"in s&&s.options)for(let n of s.options){const i=this.validateOption(n);if(i)return i}}else if(s instanceof ue||"text"in s){const n=this.validateOption(s);if(n)return n}else return new Error("Data object must be a valid optgroup or option");return null}validateOption(e){return"text"in e?null:new Error("Option must have a text")}partialToFullData(e){let s=[];return e.forEach(n=>{if(n instanceof Me||"label"in n){let i=[];"options"in n&&n.options&&n.options.forEach(r=>{i.push(new ue(r))}),i.length>0&&s.push(new Me(n))}(n instanceof ue||"text"in n)&&s.push(new ue(n))}),s}setData(e){this.data=this.partialToFullData(e),this.selectType==="single"&&this.setSelectedBy("id",this.getSelected())}getData(){return this.filter(null,!0)}getDataOptions(){return this.filter(null,!1)}addOption(e,s=!1){if(s){let n=[new ue(e)];this.setData(n.concat(this.getData()))}else this.setData(this.getData().concat(new ue(e)))}setSelectedBy(e,s){let n=null,i=!1;const r=[];for(let l of this.data){if(l instanceof Me)for(let a of l.options)n||(n=a),a.selected=i?!1:s.includes(a[e]),a.selected&&(r.push(a),this.selectType==="single"&&(i=!0));l instanceof ue&&(n||(n=l),l.selected=i?!1:s.includes(l[e]),l.selected&&(r.push(l),this.selectType==="single"&&(i=!0)))}this.selectType==="single"&&n&&!i&&(n.selected=!0,r.push(n));const o=s.map(l=>{var a;return((a=r.find(u=>u[e]===l))==null?void 0:a.id)||""});this.selectedOrder=o}getSelected(){return this.getSelectedOptions().map(e=>e.id)}getSelectedValues(){return this.getSelectedOptions().map(e=>e.value)}getSelectedOptions(){return this.filter(e=>e.selected,!1)}getOptgroupByID(e){for(let s of this.data)if(s instanceof Me&&s.id===e)return s;return null}getOptionByID(e){let s=this.filter(n=>n.id===e,!1);return s.length?s[0]:null}getSelectType(){return this.selectType}getFirstOption(){let e=null;for(let s of this.data)if(s instanceof Me?e=s.options[0]:s instanceof ue&&(e=s),e)break;return e}search(e,s){return e=e.trim(),e===""?this.getData():this.filter(n=>s(n,e),!0)}filter(e,s){const n=[];return this.data.forEach(i=>{if(i instanceof Me){let r=[];if(i.options.forEach(o=>{(!e||e(o))&&(s?r.push(new ue(o)):n.push(new ue(o)))}),r.length>0){let o=new Me(i);o.options=r,n.push(o)}}i instanceof ue&&(!e||e(i))&&n.push(new ue(i))}),n}selectedOrderOptions(e){const s=[];return this.selectedOrder.forEach(n=>{const i=e.find(r=>r.id===n);i&&s.push(i)}),e.forEach(n=>{let i=!1;s.forEach(r=>{if(n.id===r.id){i=!0;return}}),i||s.push(n)}),s}}const ke=class ke{static getLiveAssertive(){let e=document.getElementById("ss-live-assertive");return e||(e=document.createElement("div"),e.id="ss-live-assertive",e.setAttribute("role","status"),e.setAttribute("aria-live","assertive"),e.setAttribute("aria-atomic","true"),e.className="ss-sr-only",document.body.appendChild(e)),e}_announceAssertive(e){const s=ke._liveAssertive||(ke._liveAssertive=ke.getLiveAssertive());s.textContent="",requestAnimationFrame(()=>{s.textContent=e})}clearHighlights(){this.content.list.querySelectorAll("."+this.classes.highlighted).forEach(s=>s.classList.remove(this.classes.highlighted)),this.content.search.input.removeAttribute("aria-activedescendant")}constructor(e,s,n,i){var o;this.store=n,this.settings=e,this.classes=s,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.main.values.setAttribute("role","list"),this.updateAriaAttributes();const r=(o=document.querySelector(`[data-id="${this.settings.id}"]`))==null?void 0:o.closest(".offcanvas-body");r?r.appendChild(this.content.main):this.settings.contentLocation&&this.settings.contentLocation.appendChild(this.content.main)}static getLivePolite(){let e=document.getElementById("ss-live-polite");return e||(e=document.createElement("div"),e.id="ss-live-polite",e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),e.className="ss-sr-only",document.body.appendChild(e)),e}_announcePolite(e){const s=ke._livePolite||(ke._livePolite=ke.getLivePolite());s.textContent="",requestAnimationFrame(()=>{s.textContent=e})}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.content.search.input.setAttribute("aria-expanded","true"),this.moveContent();const e=this.store.getSelectedOptions();if(e.length){const s=e[e.length-1].id,n=this.content.list.querySelector('[data-id="'+s+'"]');n&&this.ensureElementInView(this.content.list,n)}this.settings.contentPosition==="fixed"&&(this.moveContent(),this.scrollHandler=()=>this.moveContent(),this.resizeHandler=()=>this.moveContent(),window.addEventListener("scroll",this.scrollHandler,!0),window.addEventListener("resize",this.resizeHandler)),this.searchFocus()}close(){this.main.main.classList.remove(this.classes.openAbove,this.classes.openBelow),this.content.search.input.setAttribute("aria-expanded","false"),this.content.main.classList.remove(this.classes.openAbove,this.classes.openBelow),this.main.arrow.path.setAttribute("d",this.classes.arrowClose),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=void 0),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=void 0),this.clearHighlights(),this.main.main.focus({preventScroll:!0})}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.main.main.classList.add("ss-2"),this.content.main.classList.add(this.classes.content),this.content.main.classList.add("ss-content-2"),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()));(this.settings.contentPosition==="relative"||this.settings.contentPosition==="fixed")&&this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){var i;this.content.list.setAttribute("role","listbox"),this.content.list.setAttribute("id",this.content.main.id+"-list"),this.content.list.setAttribute("aria-label",this.settings.contentAriaLabel),this.settings.isMultiple&&this.content.list.setAttribute("aria-multiselectable","true"),this.main.main.removeAttribute("aria-labelledby"),this.main.main.removeAttribute("aria-label");const e=this.content.search.input;e.setAttribute("role","combobox"),e.setAttribute("aria-haspopup","listbox"),e.setAttribute("aria-controls",this.content.list.id),e.setAttribute("aria-owns",this.content.list.id),e.setAttribute("aria-expanded","false"),e.setAttribute("aria-autocomplete","list");let s=(this.settings.ariaLabelledBy||"").trim(),n=null;if(s)n=document.getElementById(s);else{const r=document.querySelector(`select[data-id="${this.settings.id}"]`);r&&(r.id&&(n=document.querySelector(`label[for="${r.id}"]`)),!n&&((i=r.previousElementSibling)==null?void 0:i.tagName)==="LABEL"&&(n=r.previousElementSibling),n&&(n.id||(n.id=(r.id||this.settings.id)+"-label"),s=n.id))}s&&document.getElementById(s)?this.main.main.setAttribute("aria-labelledby",s):this.settings.ariaLabel&&this.settings.ariaLabel.trim()&&this.main.main.setAttribute("aria-label",this.settings.ariaLabel.trim()),this.content.search.input.setAttribute("aria-controls",this.content.list.id),this.content.search.input.setAttribute("aria-autocomplete","list"),s&&document.getElementById(s)?this.content.search.input.setAttribute("aria-labelledby",s):this.settings.searchLabelledBy&&document.getElementById(this.settings.searchLabelledBy)?this.content.search.input.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel?this.content.search.input.setAttribute("aria-label",this.settings.searchAriaLabel):this.content.search.input.setAttribute("aria-label","Search options")}mainDiv(){var u;const e=document.createElement("div");e.id=this.settings.id+"-main",e.tabIndex=0,e.onkeydown=c=>{if(c.target!==e)return!0;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 f=this.content.list.querySelector("."+this.classes.highlighted);return f&&f.click(),!1;case"Escape":return this.callbacks.close(),!1}return c.key.length===1&&this.callbacks.open(),!0},e.onclick=c=>{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 n=document.createElement("div");n.classList.add(this.classes.deselect),n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label",this.settings.clearAllAriaLabel),n.addEventListener("keydown",c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),c.stopPropagation(),n.click())});const i=(u=this.store)==null?void 0:u.getSelectedOptions();!this.settings.allowDeselect||this.settings.isMultiple&&i&&i.length<=0?n.classList.add(this.classes.hide):n.classList.remove(this.classes.hide),n.onclick=c=>{if(c.stopPropagation(),this.settings.disabled)return;let f=!0;const p=this.store.getSelectedOptions(),g=[];if(this.callbacks.beforeChange&&(f=this.callbacks.beforeChange(g,p)===!0),f){if(this.settings.isMultiple)this.callbacks.setSelected([],!1),this.updateDeselectAll();else{const _=this.store.getFirstOption(),C=_?_.id:"";this.callbacks.setSelected(C,!1)}this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(this.store.getSelectedOptions())}};const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("viewBox","0 0 100 100"),r.setAttribute("aria-hidden","true"),r.setAttribute("focusable","false");const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.deselectPath),r.appendChild(o),n.appendChild(r),e.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.classList.add(this.classes.arrow),l.setAttribute("viewBox","0 0 100 100"),l.setAttribute("aria-hidden","true"),l.setAttribute("focusable","false");const a=document.createElementNS("http://www.w3.org/2000/svg","path");return a.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&l.classList.add(this.classes.hide),l.appendChild(a),e.appendChild(l),{main:e,values:s,deselect:{main:n,svg:r,path:o},arrow:{main:l,path:a}}}mainFocus(e){e!=="click"&&this.main.main.focus({preventScroll:!0})}placeholder(){const e=this.store.filter(i=>i.placeholder,!1);let s=this.settings.placeholderText;e.length&&(e[0].html!==""?s=e[0].html:e[0].text!==""&&(s=e[0].text));const n=document.createElement("div");return n.classList.add(this.classes.placeholder),n.innerHTML=s,n}renderValues(){if(!this.settings.isMultiple){this.renderSingleValue();return}this.renderMultipleValues(),this.updateDeselectAll()}renderSingleValue(){const e=this.store.filter(n=>n.selected&&!n.placeholder,!1),s=e.length>0?e[0]:null;if(!s)this.main.values.innerHTML=this.placeholder().outerHTML;else{const n=document.createElement("div");n.classList.add(this.classes.single),s.html?n.innerHTML=s.html:n.innerText=s.text,this.main.values.innerHTML=n.outerHTML}!this.settings.allowDeselect||!e.length?this.main.deselect.main.classList.add(this.classes.hide):this.main.deselect.main.classList.remove(this.classes.hide)}renderMultipleValues(){let e=this.main.values.childNodes,s=this.store.filter(i=>i.selected&&i.display,!1);if(s.length===0){this.main.values.innerHTML=this.placeholder().outerHTML;return}else{const i=this.main.values.querySelector("."+this.classes.placeholder);i&&i.remove()}if(s.length>this.settings.maxValuesShown){const i=document.createElement("div");i.classList.add(this.classes.max),i.textContent=this.settings.maxValuesMessage.replace("{number}",s.length.toString()),this.main.values.innerHTML=i.outerHTML;return}else{const i=this.main.values.querySelector("."+this.classes.max);i&&i.remove()}this.settings.keepOrder&&(s=this.store.selectedOrderOptions(s));let n=[];for(let i=0;ia.id===o,!1).length||n.push(r))}for(const i of n)i.classList.add(this.classes.valueOut),setTimeout(()=>{this.main.values.hasChildNodes()&&this.main.values.contains(i)&&this.main.values.removeChild(i)},100);e=this.main.values.childNodes;for(let i=0;i{if(u.preventDefault(),u.stopPropagation(),this.settings.disabled)return;let c=!0;const f=this.store.getSelectedOptions(),p=f.filter(g=>g.selected&&g.id!==e.id,!0);if(!(this.settings.minSelected&&p.length{this.main.main.focus({preventScroll:!0})})}};const l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.setAttribute("viewBox","0 0 100 100"),l.setAttribute("aria-hidden","true"),l.setAttribute("focusable","false");const a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("d",this.classes.optionDelete),l.appendChild(a),i.appendChild(l),s.appendChild(i),i.onkeydown=u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),u.stopPropagation(),i.click())},s.addEventListener("keydown",u=>{u.key==="Enter"||u.key===" "?(u.preventDefault(),u.stopPropagation()):(u.key==="Delete"||u.key==="Backspace")&&(u.preventDefault(),u.stopPropagation(),i==null||i.click())}),s.addEventListener("focusin",()=>{s.setAttribute("aria-describedby",r),i.removeAttribute("aria-hidden"),i.tabIndex=0}),s.addEventListener("focusout",()=>{s.removeAttribute("aria-describedby"),i.setAttribute("aria-hidden","true"),i.tabIndex=-1})}return s}contentDiv(){const e=document.createElement("div");e.id=this.settings.id+"-content";const s=this.searchDiv();e.appendChild(s.main);const n=this.listDiv();return e.appendChild(n),{main:e,search:s,list:n}}moveContent(){if(this.settings.contentPosition==="relative"){this.moveContentBelow();return}if(this.settings.openPosition==="down"){this.moveContentBelow();return}else if(this.settings.openPosition==="up"){this.moveContentAbove();return}this.putContent()==="up"?this.moveContentAbove():this.moveContentBelow()}searchDiv(){const e=document.createElement("div"),s=document.createElement("input"),n=document.createElement("div");e.classList.add(this.classes.search);const i={main:e,input:s};if(this.settings.showSearch||(e.classList.add(this.classes.hide),s.readOnly=!0),s.type="text",s.placeholder=this.settings.searchPlaceholder,s.tabIndex=-1,this.settings.searchLabelledBy&&this.settings.searchLabelledBy.trim()?s.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel&&this.settings.searchAriaLabel.trim()?s.setAttribute("aria-label",this.settings.searchAriaLabel):s.setAttribute("aria-label","Search options"),s.setAttribute("autocapitalize","off"),s.setAttribute("autocomplete","off"),s.setAttribute("autocorrect","off"),s.oninput=Kt(r=>{this.callbacks.search(r.target.value)},100),s.onkeydown=r=>{switch(r.key){case"ArrowUp":case"ArrowDown":return r.key==="ArrowDown"?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Escape":return this.callbacks.close(),!1;case" ":const o=this.content.list.querySelector("."+this.classes.highlighted);return o?(o.click(),!1):!0;case"Enter":if(this.callbacks.addable)return n.click(),!1;{const l=this.content.list.querySelector("."+this.classes.highlighted);if(l)return l.click(),!1}return!0}return!0},e.appendChild(s),this.callbacks.addable){n.classList.add(this.classes.addable);const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("viewBox","0 0 100 100"),r.setAttribute("aria-hidden","true"),r.setAttribute("focusable","false");const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.addablePath),r.appendChild(o),n.appendChild(r),n.onclick=l=>{if(l.preventDefault(),l.stopPropagation(),!this.callbacks.addable)return;const a=this.content.search.input.value.trim();if(a===""){this.content.search.input.focus();return}const u=f=>{let p=new ue(f);if(this.callbacks.addOption(p),this.settings.isMultiple){let g=this.store.getSelected();g.push(p.id),this.callbacks.setSelected(g,!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(f=>{typeof f=="string"?u({text:f,value:f}):c instanceof Error?this.renderError(c.message):u(f)}):typeof c=="string"?u({text:c,value:c}):c instanceof Error?this.renderError(c.message):u(c))},e.appendChild(n),i.addable={main:n,svg:r,path:o}}return i}searchFocus(){this.content.search.input.focus()}getOptions(e=!1,s=!1,n=!1){let i="."+this.classes.option;return e&&(i+=":not(."+this.classes.placeholder+")"),s&&(i+=":not(."+this.classes.disabled+")"),n&&(i+=":not(."+this.classes.hide+")"),Array.from(this.content.list.querySelectorAll(i))}highlight(e){const s=this.getOptions(!0,!0,!0);if(s.length===0)return;if(s.length===1&&!s[0].classList.contains(this.classes.highlighted)){s[0].classList.add(this.classes.highlighted);return}let n=!1;for(const r of s)r.classList.contains(this.classes.highlighted)&&(n=!0);if(!n){for(const r of s)if(r.classList.contains(this.classes.selected)){r.classList.add(this.classes.highlighted);break}}for(let r=0;r=0?r-1:s.length-1];a.classList.add(this.classes.highlighted),this.content.search.input.setAttribute("aria-activedescendant",a.id),this.ensureElementInView(this.content.list,a);const u=a.parentElement;if(u&&u.classList.contains(this.classes.close)){const c=u.querySelector("."+this.classes.optgroupLabel);c&&c.click()}return}const i=s[e==="down"?0:s.length-1];i.classList.add(this.classes.highlighted),this.content.search.input.setAttribute("aria-activedescendant",i.id),this.ensureElementInView(this.content.list,i)}listDiv(){const e=document.createElement("div");return e.classList.add(this.classes.list),e}renderError(e){this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy");const s=document.createElement("div");s.classList.add(this.classes.error),s.textContent=e,this.content.list.appendChild(s),this._announceAssertive(e)}renderSearching(){this.content.list.innerHTML="",this.content.list.setAttribute("aria-busy","true");const e=document.createElement("div");e.classList.add(this.classes.searching),e.textContent=this.settings.searchingText,this.content.list.appendChild(e),this._announcePolite(this.settings.searchingText)}renderOptions(e){if(this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy"),e.length===0){const l=document.createElement("div");l.classList.add(this.classes.search);const a=this.callbacks.addable?this.settings.addableText.replace("{value}",this.content.search.input.value):this.settings.searchText;this._announcePolite(a),l.innerHTML=a,this.content.list.appendChild(l),this.content.list.setAttribute("aria-setsize","0");return}this.settings.allowDeselect&&!this.settings.isMultiple&&(this.store.filter(a=>a.placeholder,!1).length||this.store.addOption(new ue({text:"",value:"",selected:!1,placeholder:!0}),!0));const s=document.createDocumentFragment();let n=0;const i=e.filter(l=>l instanceof ue&&!l.placeholder&&l.display&&!l.disabled).length,r=l=>{!l.classList.contains(this.classes.placeholder)&&!l.classList.contains(this.classes.disabled)&&!l.classList.contains(this.classes.hide)&&(l.setAttribute("aria-posinset",String(++n)),l.setAttribute("aria-setsize",String(i)))};for(const l of e){if(l instanceof Me){const a=document.createElement("div");a.classList.add(this.classes.optgroup),a.setAttribute("role","group"),a.setAttribute("aria-label",l.label);const u=document.createElement("div");u.classList.add(this.classes.optgroupLabel),a.appendChild(u);const c=document.createElement("div");c.classList.add(this.classes.optgroupLabelText),c.textContent=l.label,u.appendChild(c);const f=document.createElement("div");if(f.classList.add(this.classes.optgroupActions),u.appendChild(f),this.settings.isMultiple&&l.selectAll){const p=document.createElement("div");p.classList.add(this.classes.optgroupSelectAll);let g=!0;for(const m of l.options)if(!m.selected){g=!1;break}g&&p.classList.add(this.classes.selected);const _=document.createElement("span");_.textContent=l.selectAllText,p.appendChild(_);const C=document.createElementNS("http://www.w3.org/2000/svg","svg");C.setAttribute("viewBox","0 0 100 100"),C.setAttribute("aria-hidden","true"),C.setAttribute("focusable","false"),p.appendChild(C);const D=document.createElementNS("http://www.w3.org/2000/svg","path");D.setAttribute("d",this.classes.optgroupSelectAllBox),C.appendChild(D);const T=document.createElementNS("http://www.w3.org/2000/svg","path");T.setAttribute("d",this.classes.optgroupSelectAllCheck),C.appendChild(T),p.addEventListener("click",m=>{m.preventDefault(),m.stopPropagation();const b=this.store.getSelected();if(g){const y=b.filter(S=>{for(const O of l.options)if(S===O.id)return!1;return!0});this.callbacks.setSelected(y,!0);return}else{const y=b.concat(l.options.map(S=>S.id));for(const S of l.options)this.store.getOptionByID(S.id)||this.callbacks.addOption(S);this.callbacks.setSelected(y,!0);return}}),f.appendChild(p)}if(l.closable!=="off"){const p=document.createElement("div");p.classList.add(this.classes.optgroupClosable);const g=document.createElementNS("http://www.w3.org/2000/svg","svg");g.setAttribute("viewBox","0 0 100 100"),g.classList.add(this.classes.arrow),g.setAttribute("aria-hidden","true"),g.setAttribute("focusable","false"),p.appendChild(g);const _=document.createElementNS("http://www.w3.org/2000/svg","path");g.appendChild(_),l.options.some(C=>C.selected)||this.content.search.input.value.trim()!==""?(a.classList.add(this.classes.open),_.setAttribute("d",this.classes.arrowOpen)):l.closable==="open"?(a.classList.add(this.classes.open),_.setAttribute("d",this.classes.arrowOpen)):l.closable==="close"&&(a.classList.add(this.classes.close),_.setAttribute("d",this.classes.arrowClose)),u.addEventListener("click",C=>{C.preventDefault(),C.stopPropagation(),a.classList.contains(this.classes.close)?(a.classList.remove(this.classes.close),a.classList.add(this.classes.open),_.setAttribute("d",this.classes.arrowOpen)):(a.classList.remove(this.classes.open),a.classList.add(this.classes.close),_.setAttribute("d",this.classes.arrowClose))}),f.appendChild(p)}a.appendChild(u);for(const p of l.options){const g=this.option(p);r(g),a.appendChild(g)}s.appendChild(a)}if(l instanceof ue){const a=this.option(l);r(a),s.appendChild(a)}}this.content.list.appendChild(s),this.content.list.removeAttribute("aria-busy");const o=this.getOptions(!0,!0,!0).length;this._announcePolite(`${o} option${o===1?"":"s"} available`)}option(e){if(e.placeholder){const n=document.createElement("div");return n.classList.add(this.classes.option),n.classList.add(this.classes.hide),n}const s=document.createElement("div");return s.dataset.id=e.id,s.id=`${this.settings.id}__opt__${e.id}`,s.classList.add(this.classes.option),s.setAttribute("role","option"),e.class&&e.class.split(" ").forEach(n=>{s.classList.add(n)}),e.style&&(s.style.cssText=e.style),this.settings.searchHighlight&&this.content.search.input.value.trim()!==""?s.innerHTML=this.highlightText(e.html!==""?e.html:e.text,this.content.search.input.value,this.classes.searchHighlighter):e.html!==""?s.innerHTML=e.html:s.textContent=e.text,this.settings.showOptionTooltips&&s.textContent&&s.setAttribute("title",s.textContent),e.display||s.classList.add(this.classes.hide),e.disabled&&(s.classList.add(this.classes.disabled),s.setAttribute("aria-disabled","true")),e.selected&&this.settings.hideSelected&&s.classList.add(this.classes.hide),e.selected?(s.classList.add(this.classes.selected),s.setAttribute("aria-selected","true"),this.content.search.input.setAttribute("aria-activedescendant",s.id)):(s.classList.remove(this.classes.selected),s.setAttribute("aria-selected","false")),s.addEventListener("click",n=>{n.preventDefault(),n.stopPropagation();const i=this.store.getSelected(),r=n.currentTarget,o=String(r.dataset.id);if(e.disabled||e.selected&&!this.settings.allowDeselect||this.settings.isMultiple&&this.settings.maxSelected<=i.length&&!e.selected||this.settings.isMultiple&&this.settings.minSelected>=i.length&&e.selected)return;let l=!1;const a=this.store.getSelectedOptions();let u=[];if(this.settings.isMultiple){if(e.selected)u=a.filter(c=>c.id!==o);else if(u=a.concat(e),!this.settings.closeOnSelect)if(n.shiftKey&&this.lastSelectedOption){const c=this.store.getDataOptions();let f=c.findIndex(g=>g.id===this.lastSelectedOption.id),p=c.findIndex(g=>g.id===e.id);if(f>=0&&p>=0){const g=Math.min(f,p),_=Math.max(f,p),C=c.slice(g,_+1);C.length>0&&C.length!a.find(T=>T.id===D.id))))}}else e.selected||(this.lastSelectedOption=e)}this.settings.isMultiple||(e.selected?u=[]:u=[e]),this.callbacks.beforeChange||(l=!0),this.callbacks.beforeChange&&(this.callbacks.beforeChange(u,a)===!1?l=!1:l=!0),l&&(this.store.getOptionByID(o)||this.callbacks.addOption(e),this.callbacks.setSelected(u.map(c=>c.id),!1),this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(u))}),s}destroy(){this.main.main.remove(),this.content.main.remove()}highlightText(e,s,n){let i=e;const r=new RegExp("(?![^<]*>)("+s.trim()+")(?![^<]*>[^<>]*${a}`),i}moveContentAbove(){const e=this.main.main.offsetHeight,s=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 n=this.main.main.getBoundingClientRect();this.content.main.style.margin="-"+(e+s-1)+"px 0px 0px 0px",this.content.main.style.top=n.top+n.height+(this.settings.contentPosition==="fixed"?0:window.scrollY)+"px",this.content.main.style.left=n.left+(this.settings.contentPosition==="fixed"?0:window.scrollX)+"px",this.content.main.style.width=n.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",this.settings.contentPosition!=="relative"&&(this.content.main.style.top=e.top+e.height+(this.settings.contentPosition==="fixed"?0:window.scrollY)+"px",this.content.main.style.left=e.left+(this.settings.contentPosition==="fixed"?0:window.scrollX)+"px",this.content.main.style.width=e.width+"px")}ensureElementInView(e,s){const n=e.scrollTop+e.offsetTop,i=n+e.clientHeight,r=s.offsetTop,o=r+s.clientHeight;ri&&(e.scrollTop+=o-i)}putContent(){const e=this.main.main.offsetHeight,s=this.main.main.getBoundingClientRect(),n=this.content.main.offsetHeight;return window.innerHeight-(s.top+e)<=n&&s.top>n?"up":"down"}updateDeselectAll(){if(!this.store||!this.settings)return;const e=this.store.getSelectedOptions(),s=e&&e.length>0,n=this.settings.isMultiple,i=this.settings.allowDeselect,r=this.main.deselect.main,o=this.classes.hide;i&&!(n&&!s)?r.classList.remove(o):r.classList.add(o)}};ke._livePolite=null,ke._liveAssertive=null;let hn=ke;class Fc{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.getSelectedOptions()),!0}observeCall(e){if(!this.listen)return;let s=!1,n=!1,i=!1;for(const r of e){if(r.target===this.select&&(r.attributeName==="disabled"&&(n=!0),r.attributeName==="class"&&(s=!0),r.type==="childList")){for(const o of r.addedNodes)if(o.nodeName==="OPTION"&&o.value===this.select.value){this.select.dispatchEvent(new Event("change"));break}i=!0}(r.target.nodeName==="OPTGROUP"||r.target.nodeName==="OPTION")&&(i=!0)}s&&this.onClassChange&&this.onClassChange(this.select.className.split(" ")),n&&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 s=this.select.childNodes;for(const n of s)n.nodeName==="OPTGROUP"&&e.push(this.getDataFromOptgroup(n)),n.nodeName==="OPTION"&&e.push(this.getDataFromOption(n));return e}getDataFromOptgroup(e){let s={id:e.id,label:e.label,selectAll:e.dataset?e.dataset.selectall==="true":!1,selectAllText:e.dataset?e.dataset.selectalltext:"Select all",closable:e.dataset?e.dataset.closable:"off",options:[]};const n=e.childNodes;for(const i of n)i.nodeName==="OPTION"&&s.options.push(this.getDataFromOption(i));return s}getDataFromOption(e){return{id:e.id,value:e.value,text:e.text,html:e.dataset&&e.dataset.html?e.dataset.html:"",defaultSelected:e.defaultSelected,selected:e.selected,display:e.style.display!=="none",disabled:e.disabled,mandatory:e.dataset?e.dataset.mandatory==="true":!1,placeholder:e.dataset.placeholder==="true",class:e.className,style:e.style.cssText,data:e.dataset}}getSelectedOptions(){let e=[];const s=this.select.childNodes;for(const n of s){if(n.nodeName==="OPTGROUP"){const i=n.childNodes;for(const r of i)if(r.nodeName==="OPTION"){const o=r;o.selected&&e.push(this.getDataFromOption(o))}}if(n.nodeName==="OPTION"){const i=n;i.selected&&e.push(this.getDataFromOption(i))}}return e}getSelectedValues(){return this.getSelectedOptions().map(e=>e.value)}setSelected(e){this.changeListen(!1);const s=this.select.childNodes;for(const n of s){if(n.nodeName==="OPTGROUP"){const r=n.childNodes;for(const o of r)if(o.nodeName==="OPTION"){const l=o;l.selected=e.includes(l.id)}}if(n.nodeName==="OPTION"){const i=n;i.selected=e.includes(i.id)}}this.changeListen(!0)}setSelectedByValue(e){this.changeListen(!1);const s=this.select.childNodes;for(const n of s){if(n.nodeName==="OPTGROUP"){const r=n.childNodes;for(const o of r)if(o.nodeName==="OPTION"){const l=o;l.selected=e.includes(l.value)}}if(n.nodeName==="OPTION"){const i=n;i.selected=e.includes(i.value)}}this.changeListen(!0)}updateSelect(e,s,n){this.changeListen(!1),e&&(this.select.dataset.id=e),s&&(this.select.style.cssText=s),n&&(this.select.className="",n.forEach(i=>{i.trim()!==""&&this.select.classList.add(i.trim())})),this.changeListen(!0)}updateOptions(e){this.changeListen(!1),this.select.innerHTML="";for(const s of e)s instanceof Me&&this.select.appendChild(this.createOptgroup(s)),s instanceof ue&&this.select.appendChild(this.createOption(s));this.select.dispatchEvent(new Event("change",{bubbles:!0})),this.changeListen(!0)}createOptgroup(e){const s=document.createElement("optgroup");if(s.id=e.id,s.label=e.label,e.selectAll&&(s.dataset.selectAll="true"),e.closable!=="off"&&(s.dataset.closable=e.closable),e.options)for(const n of e.options)s.appendChild(this.createOption(n));return s}createOption(e){const s=document.createElement("option");return s.id=e.id,s.value=e.value,s.textContent=e.text,e.html!==""&&s.setAttribute("data-html",e.html),s.defaultSelected=e.defaultSelected,s.selected=e.selected,e.disabled&&(s.disabled=!0),e.display||(s.style.display="none"),e.placeholder&&s.setAttribute("data-placeholder","true"),e.mandatory&&s.setAttribute("data-mandatory","true"),e.class&&e.class.split(" ").forEach(n=>{s.classList.add(n)}),e.data&&typeof e.data=="object"&&Object.keys(e.data).forEach(n=>{s.setAttribute("data-"+kc(n),e.data[n])}),s}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 Mc{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-"+In(),this.style=e.style||"",this.class=e.class||[],this.disabled=e.disabled!==void 0?e.disabled:!1,this.alwaysOpen=e.alwaysOpen!==void 0?e.alwaysOpen:!1,this.showSearch=e.showSearch!==void 0?e.showSearch:!0,this.focusSearch=e.focusSearch!==void 0?e.focusSearch:!0,this.ariaLabel=e.ariaLabel||"",this.searchPlaceholder=e.searchPlaceholder||"Search",this.searchText=e.searchText||"No Results",this.searchingText=e.searchingText||"Searching...",this.searchHighlight=e.searchHighlight!==void 0?e.searchHighlight:!1,this.closeOnSelect=e.closeOnSelect!==void 0?e.closeOnSelect:!0,this.contentLocation=e.contentLocation||document.body,this.contentPosition=e.contentPosition||"absolute",this.openPosition=e.openPosition||"auto",this.contentAriaLabel=e.contentAriaLabel!==void 0?e.contentAriaLabel:"Select an option",this.placeholderText=e.placeholderText!==void 0?e.placeholderText:"Select Value",this.allowDeselect=e.allowDeselect!==void 0?e.allowDeselect:!1,this.hideSelected=e.hideSelected!==void 0?e.hideSelected:!1,this.keepOrder=e.keepOrder!==void 0?e.keepOrder:!1,this.showOptionTooltips=e.showOptionTooltips!==void 0?e.showOptionTooltips:!1,this.minSelected=e.minSelected||0,this.maxSelected=e.maxSelected||1e3,this.timeoutDelay=e.timeoutDelay||200,this.maxValuesShown=e.maxValuesShown||20,this.maxValuesMessage=e.maxValuesMessage||"{number} selected",this.addableText=e.addableText||'Press "Enter" to add {value}',this.ariaLabelledBy=e.ariaLabelledBy||"",this.searchAriaLabel=e.searchAriaLabel||"Search options",this.searchLabelledBy=e.searchLabelledBy||"",this.clearAllAriaLabel=e.clearAllAriaLabel||"Clear selection"}}class Nc{constructor(e){var o;if(this.events={search:void 0,searchFilter:(l,a)=>l.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=Kt(()=>{!this.settings.isOpen&&!this.settings.isFullOpen||this.render.moveContent()}),this.windowScroll=Kt(()=>{!this.settings.isOpen&&!this.settings.isFullOpen||this.render.moveContent()}),this.documentClick=l=>{this.settings.isOpen&&l.target&&!Dc(l.target,this.settings.id)&&this.close(l.type)},this.windowVisibilityChange=()=>{document.hidden&&this.close()},this.selectEl=typeof e.select=="string"?document.querySelector(e.select):e.select,!this.selectEl){e.events&&e.events.error&&e.events.error(new Error("Could not find select element"));return}if(this.selectEl.tagName!=="SELECT"){e.events&&e.events.error&&e.events.error(new Error("Element isnt of type select"));return}this.selectEl.dataset.ssid&&this.destroy(),this.settings=new Mc(e.settings),this.cssClasses=new Rc(e.cssClasses);const s=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const l in e.events)e.events.hasOwnProperty(l)&&(s.indexOf(l)!==-1?this.events[l]=Kt(e.events[l],100):this.events[l]=e.events[l]);this.settings.disabled=(o=e.settings)!=null&&o.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 Fc(this.selectEl),this.select.updateSelect(this.settings.id,this.settings.style,this.settings.class),this.select.hideUI(),this.select.onValueChange=l=>{this.setSelected(l.map(a=>a.id))},this.select.onClassChange=l=>{this.settings.class=l,this.render.updateClassStyles()},this.select.onDisabledChange=l=>{l?this.disable():this.enable()},this.select.onOptionsChange=l=>{this.setData(l)},this.store=new Ic(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 hn(this.settings,this.cssClasses,this.store,n),this.render.renderValues(),this.render.renderOptions(this.store.getData());const i=this.selectEl.getAttribute("aria-label"),r=this.selectEl.getAttribute("aria-labelledby");i?this.render.main.main.setAttribute("aria-label",i):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),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(e){const s=this.store.getSelected(),n=this.store.validateDataArray(e);if(n){this.events.error&&this.events.error(n);return}this.store.setData(e);const i=this.store.getData();this.select.updateOptions(i),this.render.renderValues(),this.render.renderOptions(i),this.events.afterChange&&!Gs(s,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let e=this.store.getSelectedOptions();return this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e)),e.map(s=>s.value)}setSelected(e,s=!0){const n=this.store.getSelected(),i=this.store.getDataOptions();e=Array.isArray(e)?e:[e];const r=[];for(const l of e){if(i.find(a=>a.id==l)){r.push(l);continue}for(const a of i.filter(u=>u.value==l))r.push(a.id)}this.store.setSelectedBy("id",r);const o=this.store.getData();this.select.updateOptions(o),this.render.renderValues(),this.render.content.search.input.value!==""?this.search(this.render.content.search.input.value):this.render.renderOptions(o),s&&this.events.afterChange&&!Gs(n,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}addOption(e){const s=this.store.getSelected();this.store.getDataOptions().some(i=>i.value===(e.value??e.text))||this.store.addOption(e);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!Gs(s,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.settings.focusSearch&&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(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){this.render.renderOptions(e===""?this.store.getData():this.store.search(e,this.events.searchFilter));return}this.render.renderSearching();const s=this.events.search(e,this.store.getSelectedOptions());if(s instanceof Promise){s.then(n=>{this.render.renderOptions(this.store.partialToFullData(n))}).catch(n=>{this.render.renderError(typeof n=="string"?n:n.message)});return}else Array.isArray(s)?this.render.renderOptions(this.store.partialToFullData(s)):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 Bc="CWYDT23U",Hc="slimselectjscom",Vc=Ts({__name:"carbonad",setup(t){const e=ir(null);let s=!1;return mr(()=>{const n=window.location.hostname==="localhost";if(!s&&!n){s=!0;const i=document.createElement("script");i.id="_carbonads_js",i.src=`//cdn.carbonads.com/carbon.js?serve=${Bc}&placement=${Hc}`,i.async=!0,e.value&&e.value.appendChild(i)}}),(n,i)=>wt(s)?(Zt(),Nr("div",{key:0,class:"carbon-container",ref_key:"container",ref:e},null,512)):Uo("",!0)}}),$c=Ts({name:"App",components:{CarbonAd:Vc},data(){return{nav:null,navDebounce:Kt(()=>{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:"Examples",closable:"close",options:[{text:"countries",value:"examples#countries"},{text:"form reset",value:"examples#formReset"}]},{label:"Settings",closable:"close",options:[{text:"select",value:"settings#select"},{text:"cssClasses",value:"settings#cssClasses"},{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"}]}]}},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 t=this.$route.hash;if(t===""&&window.scroll({top:0,behavior:"smooth"}),t){const e=document.querySelector(t);if(e){const s=document.querySelector("header"),n=document.querySelector("nav"),i=s?s.clientHeight+(window.innerWidth<700?n.clientHeight:0)+8:0;window.scroll({top:e.offsetTop-i,behavior:"smooth"})}}},200)}),this.setDemensions(),window.addEventListener("resize",this.navDebounce),window.addEventListener("nav-updated",this.updateNav)},unmounted(){var t;window.removeEventListener("resize",this.navDebounce),window.removeEventListener("nav-updated",this.updateNav),(t=this.nav)==null||t.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 t={searchHighlight:!0,openContent:"below"};this.width>700&&(t.alwaysOpen=!0,t.contentPosition="relative",t.contentLocation=this.$refs.navContent),this.nav=new Nc({select:this.$refs.nav,data:this.navData,settings:t,events:{afterChange:e=>{const n=e[0].value.split("#"),i=n[0],r=n[1]?"#"+n[1]:void 0;this.$router.push({path:i,hash:r})}}})},updateNav(){setTimeout(()=>{this.nav&&this.nav.setSelected(this.$router.currentRoute.value.fullPath.replace("/",""))},0)}}}),Uc="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",jc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACAAQMAAAD58POIAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZQTFRFyzg3////IltC9QAAAAFiS0dEAf8CLd4AAAAJcEhZcwAACxMAAAsTAQCanBgAAAAkSURBVEjHY2AYBYMV/IeDUQG4AJgeFRgVGBUYFSBNYBQMPgAARjtdvxo6xaMAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTEtMDUtMzBUMjM6MTA6NDQtMDc6MDCm4GvfAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDEwLTEyLTA2VDEyOjIwOjEyLTA4OjAwpIGEmQAAADJ0RVh0UE5HOmNIUk0AY2h1bmsgd2FzIGZvdW5kIChzZWUgQ2hyb21hdGljaXR5LCBhYm92ZSkH0UjaAAAAKXRFWHRQTkc6Z0FNQQBnYW1tYT0wLjQ1NDU1IChTZWUgR2FtbWEsIGFib3ZlKRISLKcAAAAUdEVYdFBORzpJSERSLmJpdF9kZXB0aAA4KYV+UAAAABV0RVh0UE5HOklIRFIuY29sb3JfdHlwZQA2BkqnKwAAABt0RVh0UE5HOklIRFIuaW50ZXJsYWNlX21ldGhvZAAw+zsHjAAAABx0RVh0UE5HOklIRFIud2lkdGgsaGVpZ2h0ADE2LCAxNjjVBg0AAAAodEVYdFBORzpwSFlzAHhfcmVzPTI4MzUsIHlfcmVzPTI4MzUsIHVuaXRzPTGCKXI+AAAAKHRFWHRQTkc6c1JHQgBpbnRlbnQ9MCAoU2VlIFJlbmRlcmluZyBpbnRlbnQp8hEU9QAAAABJRU5ErkJggg==",zc=(t,e)=>{const s=t.__vccOpts||t;for(const[n,i]of e)s[n]=i;return s},Wc={ref:"nav"},qc={class:"nav-content",ref:"navContent"};function Gc(t,e,s,n,i,r){const o=Un("CarbonAd"),l=Un("router-view");return Zt(),Nr(Re,null,[e[4]||(e[4]=$o('

Slim Select 2.0

Advanced select dropdown
',1)),Ze("nav",null,[Ze("select",Wc,null,512),Ze("div",qc,null,512),de(o)]),Ze("main",null,[de(l),Ze("footer",null,[ds(" © "+Vi(t.year)+" ",1),e[0]||(e[0]=Ze("a",{href:"http://webiswhatido.com",style:{color:"#ffffff"},target:"_blank"},"Brian Voelker",-1)),e[1]||(e[1]=ds(". ")),e[2]||(e[2]=Ze("br",null,null,-1)),e[3]||(e[3]=ds(" Slim Select is under the MIT license. "))])])],64)}const Kc=zc($c,[["render",Gc]]);var Ri=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function sl(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ks={exports:{}},Di;function Yc(){return Di||(Di=1,function(t){var e=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 s=function(n){var i=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,r=0,o={},l={manual:n.Prism&&n.Prism.manual,disableWorkerMessageHandler:n.Prism&&n.Prism.disableWorkerMessageHandler,util:{encode:function m(b){return b instanceof a?new a(b.type,m(b.content),b.alias):Array.isArray(b)?b.map(m):b.replace(/&/g,"&").replace(/"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(S){var m=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(S.stack)||[])[1];if(m){var b=document.getElementsByTagName("script");for(var y in b)if(b[y].src==m)return b[y]}return null}},isActive:function(m,b,y){for(var S="no-"+b;m;){var O=m.classList;if(O.contains(b))return!0;if(O.contains(S))return!1;m=m.parentElement}return!!y}},languages:{plain:o,plaintext:o,text:o,txt:o,extend:function(m,b){var y=l.util.clone(l.languages[m]);for(var S in b)y[S]=b[S];return y},insertBefore:function(m,b,y,S){S=S||l.languages;var O=S[m],I={};for(var W in O)if(O.hasOwnProperty(W)){if(W==b)for(var H in y)y.hasOwnProperty(H)&&(I[H]=y[H]);y.hasOwnProperty(W)||(I[W]=O[W])}var K=S[m];return S[m]=I,l.languages.DFS(l.languages,function(re,pe){pe===K&&re!=m&&(this[re]=I)}),I},DFS:function m(b,y,S,O){O=O||{};var I=l.util.objId;for(var W in b)if(b.hasOwnProperty(W)){y.call(b,W,b[W],S||W);var H=b[W],K=l.util.type(H);K==="Object"&&!O[I(H)]?(O[I(H)]=!0,m(H,y,null,O)):K==="Array"&&!O[I(H)]&&(O[I(H)]=!0,m(H,y,W,O))}}},plugins:{},highlightAll:function(m,b){l.highlightAllUnder(document,m,b)},highlightAllUnder:function(m,b,y){var S={callback:y,container:m,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};l.hooks.run("before-highlightall",S),S.elements=Array.prototype.slice.apply(S.container.querySelectorAll(S.selector)),l.hooks.run("before-all-elements-highlight",S);for(var O=0,I;I=S.elements[O++];)l.highlightElement(I,b===!0,S.callback)},highlightElement:function(m,b,y){var S=l.util.getLanguage(m),O=l.languages[S];l.util.setLanguage(m,S);var I=m.parentElement;I&&I.nodeName.toLowerCase()==="pre"&&l.util.setLanguage(I,S);var W=m.textContent,H={element:m,language:S,grammar:O,code:W};function K(pe){H.highlightedCode=pe,l.hooks.run("before-insert",H),H.element.innerHTML=H.highlightedCode,l.hooks.run("after-highlight",H),l.hooks.run("complete",H),y&&y.call(H.element)}if(l.hooks.run("before-sanity-check",H),I=H.element.parentElement,I&&I.nodeName.toLowerCase()==="pre"&&!I.hasAttribute("tabindex")&&I.setAttribute("tabindex","0"),!H.code){l.hooks.run("complete",H),y&&y.call(H.element);return}if(l.hooks.run("before-highlight",H),!H.grammar){K(l.util.encode(H.code));return}if(b&&n.Worker){var re=new Worker(l.filename);re.onmessage=function(pe){K(pe.data)},re.postMessage(JSON.stringify({language:H.language,code:H.code,immediateClose:!0}))}else K(l.highlight(H.code,H.grammar,H.language))},highlight:function(m,b,y){var S={code:m,grammar:b,language:y};if(l.hooks.run("before-tokenize",S),!S.grammar)throw new Error('The language "'+S.language+'" has no grammar.');return S.tokens=l.tokenize(S.code,S.grammar),l.hooks.run("after-tokenize",S),a.stringify(l.util.encode(S.tokens),S.language)},tokenize:function(m,b){var y=b.rest;if(y){for(var S in y)b[S]=y[S];delete b.rest}var O=new f;return p(O,O.head,m),c(m,O,b,O.head,0),_(O)},hooks:{all:{},add:function(m,b){var y=l.hooks.all;y[m]=y[m]||[],y[m].push(b)},run:function(m,b){var y=l.hooks.all[m];if(!(!y||!y.length))for(var S=0,O;O=y[S++];)O(b)}},Token:a};n.Prism=l;function a(m,b,y,S){this.type=m,this.content=b,this.alias=y,this.length=(S||"").length|0}a.stringify=function m(b,y){if(typeof b=="string")return b;if(Array.isArray(b)){var S="";return b.forEach(function(K){S+=m(K,y)}),S}var O={type:b.type,content:m(b.content,y),tag:"span",classes:["token",b.type],attributes:{},language:y},I=b.alias;I&&(Array.isArray(I)?Array.prototype.push.apply(O.classes,I):O.classes.push(I)),l.hooks.run("wrap",O);var W="";for(var H in O.attributes)W+=" "+H+'="'+(O.attributes[H]||"").replace(/"/g,""")+'"';return"<"+O.tag+' class="'+O.classes.join(" ")+'"'+W+">"+O.content+""};function u(m,b,y,S){m.lastIndex=b;var O=m.exec(y);if(O&&S&&O[1]){var I=O[1].length;O.index+=I,O[0]=O[0].slice(I)}return O}function c(m,b,y,S,O,I){for(var W in y)if(!(!y.hasOwnProperty(W)||!y[W])){var H=y[W];H=Array.isArray(H)?H:[H];for(var K=0;K=I.reach);ae+=$.value.length,$=$.next){var ye=$.value;if(b.length>m.length)return;if(!(ye instanceof a)){var Ae=1,te;if(ot){if(te=u(Q,ae,m,Le),!te||te.index>=m.length)break;var fe=te.index,ct=te.index+te[0].length,we=ae;for(we+=$.value.length;fe>=we;)$=$.next,we+=$.value.length;if(we-=$.value.length,ae=we,$.value instanceof a)continue;for(var Ve=$;Ve!==b.tail&&(weI.reach&&(I.reach=B);var Y=$.prev;N&&(Y=p(b,Y,N),ae+=N.length),g(b,Y,Ae);var h=new a(W,pe?l.tokenize(A,pe):A,at,A);if($=p(b,Y,h),k&&p(b,$,k),Ae>1){var d={cause:W+","+K,reach:B};c(m,b,y,$.prev,ae,d),I&&d.reach>I.reach&&(I.reach=d.reach)}}}}}}function f(){var m={value:null,prev:null,next:null},b={value:null,prev:m,next:null};m.next=b,this.head=m,this.tail=b,this.length=0}function p(m,b,y){var S=b.next,O={value:y,prev:b,next:S};return b.next=O,S.prev=O,m.length++,O}function g(m,b,y){for(var S=b.next,O=0;O/,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]},s.languages.markup.tag.inside["attr-value"].inside.entity=s.languages.markup.entity,s.languages.markup.doctype.inside["internal-subset"].inside=s.languages.markup,s.hooks.add("wrap",function(n){n.type==="entity"&&(n.attributes.title=n.content.replace(/&/,"&"))}),Object.defineProperty(s.languages.markup.tag,"addInlined",{value:function(i,r){var o={};o["language-"+r]={pattern:/(^$)/i,lookbehind:!0,inside:s.languages[r]},o.cdata=/^$/i;var l={"included-cdata":{pattern://i,inside:o}};l["language-"+r]={pattern:/[\s\S]+/,inside:s.languages[r]};var a={};a[i]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return i}),"i"),lookbehind:!0,greedy:!0,inside:l},s.languages.insertBefore("markup","cdata",a)}}),Object.defineProperty(s.languages.markup.tag,"addAttribute",{value:function(n,i){s.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+n+")"+/\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:[i,"language-"+i],inside:s.languages[i]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),s.languages.html=s.languages.markup,s.languages.mathml=s.languages.markup,s.languages.svg=s.languages.markup,s.languages.xml=s.languages.extend("markup",{}),s.languages.ssml=s.languages.xml,s.languages.atom=s.languages.xml,s.languages.rss=s.languages.xml,function(n){var i=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;n.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+i.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\\((?:"+i.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+i.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+i.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:i,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:/[(){};:,]/},n.languages.css.atrule.inside.rest=n.languages.css;var r=n.languages.markup;r&&(r.tag.addInlined("style","css"),r.tag.addAttribute("style","css"))}(s),s.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:/[{}[\];(),.:]/},s.languages.javascript=s.languages.extend("clike",{"class-name":[s.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}|\?\?=?|\?\.?|[~:]/}),s.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,s.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:s.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:s.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:s.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:s.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:s.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),s.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:s.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"}}),s.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),s.languages.markup&&(s.languages.markup.tag.addInlined("script","javascript"),s.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")),s.languages.js=s.languages.javascript,function(){if(typeof s>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var n="Loading…",i=function(C,D){return"✖ Error "+C+" while fetching file: "+D},r="✖ Error: File does not exist or is empty",o={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},l="data-src-status",a="loading",u="loaded",c="failed",f="pre[data-src]:not(["+l+'="'+u+'"]):not(['+l+'="'+a+'"])';function p(C,D,T){var m=new XMLHttpRequest;m.open("GET",C,!0),m.onreadystatechange=function(){m.readyState==4&&(m.status<400&&m.responseText?D(m.responseText):m.status>=400?T(i(m.status,m.statusText)):T(r))},m.send(null)}function g(C){var D=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(C||"");if(D){var T=Number(D[1]),m=D[2],b=D[3];return m?b?[T,Number(b)]:[T,void 0]:[T,T]}}s.hooks.add("before-highlightall",function(C){C.selector+=", "+f}),s.hooks.add("before-sanity-check",function(C){var D=C.element;if(D.matches(f)){C.code="",D.setAttribute(l,a);var T=D.appendChild(document.createElement("CODE"));T.textContent=n;var m=D.getAttribute("data-src"),b=C.language;if(b==="none"){var y=(/\.(\w+)$/.exec(m)||[,"none"])[1];b=o[y]||y}s.util.setLanguage(T,b),s.util.setLanguage(D,b);var S=s.plugins.autoloader;S&&S.loadLanguages(b),p(m,function(O){D.setAttribute(l,u);var I=g(D.getAttribute("data-range"));if(I){var W=O.split(/\r\n?|\n/g),H=I[0],K=I[1]==null?W.length:I[1];H<0&&(H+=W.length),H=Math.max(0,Math.min(H-1,W.length)),K<0&&(K+=W.length),K=Math.max(0,Math.min(K,W.length)),O=W.slice(H,K).join(` + */var s=function(n){var i=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,r=0,o={},l={manual:n.Prism&&n.Prism.manual,disableWorkerMessageHandler:n.Prism&&n.Prism.disableWorkerMessageHandler,util:{encode:function m(b){return b instanceof a?new a(b.type,m(b.content),b.alias):Array.isArray(b)?b.map(m):b.replace(/&/g,"&").replace(/"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(S){var m=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(S.stack)||[])[1];if(m){var b=document.getElementsByTagName("script");for(var y in b)if(b[y].src==m)return b[y]}return null}},isActive:function(m,b,y){for(var S="no-"+b;m;){var O=m.classList;if(O.contains(b))return!0;if(O.contains(S))return!1;m=m.parentElement}return!!y}},languages:{plain:o,plaintext:o,text:o,txt:o,extend:function(m,b){var y=l.util.clone(l.languages[m]);for(var S in b)y[S]=b[S];return y},insertBefore:function(m,b,y,S){S=S||l.languages;var O=S[m],I={};for(var W in O)if(O.hasOwnProperty(W)){if(W==b)for(var H in y)y.hasOwnProperty(H)&&(I[H]=y[H]);y.hasOwnProperty(W)||(I[W]=O[W])}var K=S[m];return S[m]=I,l.languages.DFS(l.languages,function(re,pe){pe===K&&re!=m&&(this[re]=I)}),I},DFS:function m(b,y,S,O){O=O||{};var I=l.util.objId;for(var W in b)if(b.hasOwnProperty(W)){y.call(b,W,b[W],S||W);var H=b[W],K=l.util.type(H);K==="Object"&&!O[I(H)]?(O[I(H)]=!0,m(H,y,null,O)):K==="Array"&&!O[I(H)]&&(O[I(H)]=!0,m(H,y,W,O))}}},plugins:{},highlightAll:function(m,b){l.highlightAllUnder(document,m,b)},highlightAllUnder:function(m,b,y){var S={callback:y,container:m,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};l.hooks.run("before-highlightall",S),S.elements=Array.prototype.slice.apply(S.container.querySelectorAll(S.selector)),l.hooks.run("before-all-elements-highlight",S);for(var O=0,I;I=S.elements[O++];)l.highlightElement(I,b===!0,S.callback)},highlightElement:function(m,b,y){var S=l.util.getLanguage(m),O=l.languages[S];l.util.setLanguage(m,S);var I=m.parentElement;I&&I.nodeName.toLowerCase()==="pre"&&l.util.setLanguage(I,S);var W=m.textContent,H={element:m,language:S,grammar:O,code:W};function K(pe){H.highlightedCode=pe,l.hooks.run("before-insert",H),H.element.innerHTML=H.highlightedCode,l.hooks.run("after-highlight",H),l.hooks.run("complete",H),y&&y.call(H.element)}if(l.hooks.run("before-sanity-check",H),I=H.element.parentElement,I&&I.nodeName.toLowerCase()==="pre"&&!I.hasAttribute("tabindex")&&I.setAttribute("tabindex","0"),!H.code){l.hooks.run("complete",H),y&&y.call(H.element);return}if(l.hooks.run("before-highlight",H),!H.grammar){K(l.util.encode(H.code));return}if(b&&n.Worker){var re=new Worker(l.filename);re.onmessage=function(pe){K(pe.data)},re.postMessage(JSON.stringify({language:H.language,code:H.code,immediateClose:!0}))}else K(l.highlight(H.code,H.grammar,H.language))},highlight:function(m,b,y){var S={code:m,grammar:b,language:y};if(l.hooks.run("before-tokenize",S),!S.grammar)throw new Error('The language "'+S.language+'" has no grammar.');return S.tokens=l.tokenize(S.code,S.grammar),l.hooks.run("after-tokenize",S),a.stringify(l.util.encode(S.tokens),S.language)},tokenize:function(m,b){var y=b.rest;if(y){for(var S in y)b[S]=y[S];delete b.rest}var O=new f;return p(O,O.head,m),c(m,O,b,O.head,0),_(O)},hooks:{all:{},add:function(m,b){var y=l.hooks.all;y[m]=y[m]||[],y[m].push(b)},run:function(m,b){var y=l.hooks.all[m];if(!(!y||!y.length))for(var S=0,O;O=y[S++];)O(b)}},Token:a};n.Prism=l;function a(m,b,y,S){this.type=m,this.content=b,this.alias=y,this.length=(S||"").length|0}a.stringify=function m(b,y){if(typeof b=="string")return b;if(Array.isArray(b)){var S="";return b.forEach(function(K){S+=m(K,y)}),S}var O={type:b.type,content:m(b.content,y),tag:"span",classes:["token",b.type],attributes:{},language:y},I=b.alias;I&&(Array.isArray(I)?Array.prototype.push.apply(O.classes,I):O.classes.push(I)),l.hooks.run("wrap",O);var W="";for(var H in O.attributes)W+=" "+H+'="'+(O.attributes[H]||"").replace(/"/g,""")+'"';return"<"+O.tag+' class="'+O.classes.join(" ")+'"'+W+">"+O.content+""};function u(m,b,y,S){m.lastIndex=b;var O=m.exec(y);if(O&&S&&O[1]){var I=O[1].length;O.index+=I,O[0]=O[0].slice(I)}return O}function c(m,b,y,S,O,I){for(var W in y)if(!(!y.hasOwnProperty(W)||!y[W])){var H=y[W];H=Array.isArray(H)?H:[H];for(var K=0;K=I.reach);ae+=U.value.length,U=U.next){var ye=U.value;if(b.length>m.length)return;if(!(ye instanceof a)){var Ae=1,te;if(ot){if(te=u(Q,ae,m,Le),!te||te.index>=m.length)break;var fe=te.index,ct=te.index+te[0].length,we=ae;for(we+=U.value.length;fe>=we;)U=U.next,we+=U.value.length;if(we-=U.value.length,ae=we,U.value instanceof a)continue;for(var Ve=U;Ve!==b.tail&&(weI.reach&&(I.reach=B);var Y=U.prev;N&&(Y=p(b,Y,N),ae+=N.length),g(b,Y,Ae);var h=new a(W,pe?l.tokenize(A,pe):A,at,A);if(U=p(b,Y,h),k&&p(b,U,k),Ae>1){var d={cause:W+","+K,reach:B};c(m,b,y,U.prev,ae,d),I&&d.reach>I.reach&&(I.reach=d.reach)}}}}}}function f(){var m={value:null,prev:null,next:null},b={value:null,prev:m,next:null};m.next=b,this.head=m,this.tail=b,this.length=0}function p(m,b,y){var S=b.next,O={value:y,prev:b,next:S};return b.next=O,S.prev=O,m.length++,O}function g(m,b,y){for(var S=b.next,O=0;O/,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]},s.languages.markup.tag.inside["attr-value"].inside.entity=s.languages.markup.entity,s.languages.markup.doctype.inside["internal-subset"].inside=s.languages.markup,s.hooks.add("wrap",function(n){n.type==="entity"&&(n.attributes.title=n.content.replace(/&/,"&"))}),Object.defineProperty(s.languages.markup.tag,"addInlined",{value:function(i,r){var o={};o["language-"+r]={pattern:/(^$)/i,lookbehind:!0,inside:s.languages[r]},o.cdata=/^$/i;var l={"included-cdata":{pattern://i,inside:o}};l["language-"+r]={pattern:/[\s\S]+/,inside:s.languages[r]};var a={};a[i]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return i}),"i"),lookbehind:!0,greedy:!0,inside:l},s.languages.insertBefore("markup","cdata",a)}}),Object.defineProperty(s.languages.markup.tag,"addAttribute",{value:function(n,i){s.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+n+")"+/\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:[i,"language-"+i],inside:s.languages[i]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),s.languages.html=s.languages.markup,s.languages.mathml=s.languages.markup,s.languages.svg=s.languages.markup,s.languages.xml=s.languages.extend("markup",{}),s.languages.ssml=s.languages.xml,s.languages.atom=s.languages.xml,s.languages.rss=s.languages.xml,function(n){var i=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;n.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+i.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\\((?:"+i.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+i.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+i.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:i,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:/[(){};:,]/},n.languages.css.atrule.inside.rest=n.languages.css;var r=n.languages.markup;r&&(r.tag.addInlined("style","css"),r.tag.addAttribute("style","css"))}(s),s.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:/[{}[\];(),.:]/},s.languages.javascript=s.languages.extend("clike",{"class-name":[s.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}|\?\?=?|\?\.?|[~:]/}),s.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,s.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:s.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:s.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:s.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:s.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:s.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),s.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:s.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"}}),s.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),s.languages.markup&&(s.languages.markup.tag.addInlined("script","javascript"),s.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")),s.languages.js=s.languages.javascript,function(){if(typeof s>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var n="Loading…",i=function(C,D){return"✖ Error "+C+" while fetching file: "+D},r="✖ Error: File does not exist or is empty",o={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},l="data-src-status",a="loading",u="loaded",c="failed",f="pre[data-src]:not(["+l+'="'+u+'"]):not(['+l+'="'+a+'"])';function p(C,D,T){var m=new XMLHttpRequest;m.open("GET",C,!0),m.onreadystatechange=function(){m.readyState==4&&(m.status<400&&m.responseText?D(m.responseText):m.status>=400?T(i(m.status,m.statusText)):T(r))},m.send(null)}function g(C){var D=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(C||"");if(D){var T=Number(D[1]),m=D[2],b=D[3];return m?b?[T,Number(b)]:[T,void 0]:[T,T]}}s.hooks.add("before-highlightall",function(C){C.selector+=", "+f}),s.hooks.add("before-sanity-check",function(C){var D=C.element;if(D.matches(f)){C.code="",D.setAttribute(l,a);var T=D.appendChild(document.createElement("CODE"));T.textContent=n;var m=D.getAttribute("data-src"),b=C.language;if(b==="none"){var y=(/\.(\w+)$/.exec(m)||[,"none"])[1];b=o[y]||y}s.util.setLanguage(T,b),s.util.setLanguage(D,b);var S=s.plugins.autoloader;S&&S.loadLanguages(b),p(m,function(O){D.setAttribute(l,u);var I=g(D.getAttribute("data-range"));if(I){var W=O.split(/\r\n?|\n/g),H=I[0],K=I[1]==null?W.length:I[1];H<0&&(H+=W.length),H=Math.max(0,Math.min(H-1,W.length)),K<0&&(K+=W.length),K=Math.max(0,Math.min(K,W.length)),O=W.slice(H,K).join(` `),D.hasAttribute("data-start")||D.setAttribute("data-start",String(H+1))}T.textContent=O,s.highlightElement(T)},function(O){D.setAttribute(l,c),T.textContent=O})}}),s.plugins.fileHighlight={highlight:function(D){for(var T=(D||document).querySelectorAll(f),m=0,b;b=T[m++];)s.highlightElement(b)}};var _=!1;s.fileHighlight=function(){_||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),_=!0),s.plugins.fileHighlight.highlight.apply(this,arguments)}}()}(Ks)),Ks.exports}var Qc=Yc();const Jc=sl(Qc);var Ys={exports:{}},ki;function Zc(){return ki||(ki=1,function(t){(function(){if(typeof Prism>"u")return;var e=Object.assign||function(o,l){for(var a in l)l.hasOwnProperty(a)&&(o[a]=l[a]);return o};function s(o){this.defaults=e({},o)}function n(o){return o.replace(/-(\w)/g,function(l,a){return a.toUpperCase()})}function i(o){for(var l=0,a=0;al&&(c[p]=` `+c[p],f=g)}a[u]=c.join("")}return a.join(` -`)}},t.exports&&(t.exports=s),Prism.plugins.NormalizeWhitespace=new s({"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0}),Prism.hooks.add("before-sanity-check",function(o){var l=Prism.plugins.NormalizeWhitespace;if(!(o.settings&&o.settings["whitespace-normalization"]===!1)&&Prism.util.isActive(o.element,"whitespace-normalization",!0)){if((!o.element||!o.element.parentNode)&&o.code){o.code=l.normalize(o.code,o.settings);return}var a=o.element.parentNode;if(!(!o.code||!a||a.nodeName.toLowerCase()!=="pre")){o.settings==null&&(o.settings={});for(var u in r)if(Object.hasOwnProperty.call(r,u)){var c=r[u];if(a.hasAttribute("data-"+u))try{var f=JSON.parse(a.getAttribute("data-"+u)||"true");typeof f===c&&(o.settings[u]=f)}catch{}}for(var p=a.childNodes,g="",_="",C=!1,D=0;D"u"||typeof document>"u")return;var t=[],e={},s=function(){};Prism.plugins.toolbar={};var n=Prism.plugins.toolbar.registerButton=function(o,l){var a;if(typeof l=="function"?a=l:a=function(u){var c;return typeof l.onClick=="function"?(c=document.createElement("button"),c.type="button",c.addEventListener("click",function(){l.onClick.call(this,u)})):typeof l.url=="string"?(c=document.createElement("a"),c.href=l.url):c=document.createElement("span"),l.className&&c.classList.add(l.className),c.textContent=l.text,c},o in e){console.warn('There is a button with the key "'+o+'" registered already.');return}t.push(e[o]=a)};function i(o){for(;o;){var l=o.getAttribute("data-toolbar-order");if(l!=null)return l=l.trim(),l.length?l.split(/\s*,\s*/g):[];o=o.parentElement}}var r=Prism.plugins.toolbar.hook=function(o){var l=o.element.parentNode;if(!(!l||!/pre/i.test(l.nodeName))&&!l.parentNode.classList.contains("code-toolbar")){var a=document.createElement("div");a.classList.add("code-toolbar"),l.parentNode.insertBefore(a,l),a.appendChild(l);var u=document.createElement("div");u.classList.add("toolbar");var c=t,f=i(o.element);f&&(c=f.map(function(p){return e[p]||s})),c.forEach(function(p){var g=p(o);if(g){var _=document.createElement("div");_.classList.add("toolbar-item"),_.appendChild(g),u.appendChild(_)}}),a.appendChild(u)}};n("label",function(o){var l=o.element.parentNode;if(!(!l||!/pre/i.test(l.nodeName))&&l.hasAttribute("data-label")){var a,u,c=l.getAttribute("data-label");try{u=document.querySelector("template#"+c)}catch{}return u?a=u.content:(l.hasAttribute("data-url")?(a=document.createElement("a"),a.href=l.getAttribute("data-url")):a=document.createElement("span"),a.textContent=c),a}}),Prism.hooks.add("complete",r)})();new eu({"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0});const Fn=xa(Kc);Fn.use(Pc);Fn.mixin({updated(){Jc.highlightAll()}});Fn.mount("#app");export{Re as F,ue as O,Nc as S,zc as _,Ze as a,Uo as b,Nr as c,Ts as d,ds as e,de as f,sl as g,tu as h,$o as i,ir as j,mr as k,su as l,bn as n,Zt as o,$n as r,Vi as t,Gl as w}; +`)}},t.exports&&(t.exports=s),Prism.plugins.NormalizeWhitespace=new s({"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0}),Prism.hooks.add("before-sanity-check",function(o){var l=Prism.plugins.NormalizeWhitespace;if(!(o.settings&&o.settings["whitespace-normalization"]===!1)&&Prism.util.isActive(o.element,"whitespace-normalization",!0)){if((!o.element||!o.element.parentNode)&&o.code){o.code=l.normalize(o.code,o.settings);return}var a=o.element.parentNode;if(!(!o.code||!a||a.nodeName.toLowerCase()!=="pre")){o.settings==null&&(o.settings={});for(var u in r)if(Object.hasOwnProperty.call(r,u)){var c=r[u];if(a.hasAttribute("data-"+u))try{var f=JSON.parse(a.getAttribute("data-"+u)||"true");typeof f===c&&(o.settings[u]=f)}catch{}}for(var p=a.childNodes,g="",_="",C=!1,D=0;D"u"||typeof document>"u")return;var t=[],e={},s=function(){};Prism.plugins.toolbar={};var n=Prism.plugins.toolbar.registerButton=function(o,l){var a;if(typeof l=="function"?a=l:a=function(u){var c;return typeof l.onClick=="function"?(c=document.createElement("button"),c.type="button",c.addEventListener("click",function(){l.onClick.call(this,u)})):typeof l.url=="string"?(c=document.createElement("a"),c.href=l.url):c=document.createElement("span"),l.className&&c.classList.add(l.className),c.textContent=l.text,c},o in e){console.warn('There is a button with the key "'+o+'" registered already.');return}t.push(e[o]=a)};function i(o){for(;o;){var l=o.getAttribute("data-toolbar-order");if(l!=null)return l=l.trim(),l.length?l.split(/\s*,\s*/g):[];o=o.parentElement}}var r=Prism.plugins.toolbar.hook=function(o){var l=o.element.parentNode;if(!(!l||!/pre/i.test(l.nodeName))&&!l.parentNode.classList.contains("code-toolbar")){var a=document.createElement("div");a.classList.add("code-toolbar"),l.parentNode.insertBefore(a,l),a.appendChild(l);var u=document.createElement("div");u.classList.add("toolbar");var c=t,f=i(o.element);f&&(c=f.map(function(p){return e[p]||s})),c.forEach(function(p){var g=p(o);if(g){var _=document.createElement("div");_.classList.add("toolbar-item"),_.appendChild(g),u.appendChild(_)}}),a.appendChild(u)}};n("label",function(o){var l=o.element.parentNode;if(!(!l||!/pre/i.test(l.nodeName))&&l.hasAttribute("data-label")){var a,u,c=l.getAttribute("data-label");try{u=document.querySelector("template#"+c)}catch{}return u?a=u.content:(l.hasAttribute("data-url")?(a=document.createElement("a"),a.href=l.getAttribute("data-url")):a=document.createElement("span"),a.textContent=c),a}}),Prism.hooks.add("complete",r)})();new eu({"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0});const Fn=xa(Kc);Fn.use(Pc);Fn.mixin({updated(){Jc.highlightAll()}});Fn.mount("#app");export{Re as F,ue as O,Nc as S,zc as _,Ze as a,$o as b,Nr as c,Ts as d,ds as e,de as f,sl as g,tu as h,Uo as i,ir as j,mr as k,su as l,bn as n,Zt as o,Un as r,Vi as t,ql as w}; diff --git a/src/slim-select/render.test.ts b/src/slim-select/render.test.ts index c6f531ef..69f2b1ba 100644 --- a/src/slim-select/render.test.ts +++ b/src/slim-select/render.test.ts @@ -38,7 +38,6 @@ describe('render module', () => { } ]) - // default settings const settings = new Settings() const classes = new CssClasses() @@ -51,7 +50,6 @@ describe('render module', () => { afterChangeMock = jest.fn(() => {}) beforeChangeMock = jest.fn(() => true) - // default callbacks const callbacks = { open: openMock, close: closeMock, @@ -68,17 +66,14 @@ describe('render module', () => { describe('constructor', () => { test('default constructor works', () => { - // create a new store with 2 options const store = new Store('single', [ { text: 'test1', value: 'test1' }, { text: 'test2', value: 'test2' } ]) - // default settings const settings = new Settings() const classes = new CssClasses() - // default callbacks const callbacks = { open: () => {}, close: () => {}, @@ -91,16 +86,15 @@ describe('render module', () => { } } as Callbacks - const render = new Render(settings, classes, store, callbacks) - expect(render).toBeInstanceOf(Render) - expect(render.main.main).toBeInstanceOf(HTMLDivElement) - expect(render.content.search.input).toBeInstanceOf(HTMLInputElement) + const renderInstance = new Render(settings, classes, store, callbacks) + expect(renderInstance).toBeInstanceOf(Render) + expect(renderInstance.main.main).toBeInstanceOf(HTMLDivElement) + expect(renderInstance.content.search.input).toBeInstanceOf(HTMLInputElement) }) }) describe('enable', () => { test('enable removes disabled class from main and enables search input', () => { - // disable stuff directly render.main.main.classList.add(render.classes.disabled) render.content.search.input.disabled = true @@ -125,7 +119,8 @@ describe('render module', () => { expect(render.main.arrow.path.getAttribute('d')).toBe(render.classes.arrowOpen) expect(render.main.main.classList.contains(render.classes.openBelow)).toBe(true) expect(render.main.main.classList.contains(render.classes.openAbove)).toBe(false) - expect(render.main.main.getAttribute('aria-expanded')).toBe('true') + expect(render.content.search.input.getAttribute('aria-expanded')).toBe('true') + // moveContentBelow will add class to content as well expect(render.content.main.classList.contains(render.classes.openBelow)).toBe(true) expect(render.content.main.classList.contains(render.classes.openAbove)).toBe(false) }) @@ -133,12 +128,13 @@ describe('render module', () => { describe('close', () => { test('close sets the correct attributes and CSS classes', () => { + render.open() // make sure it was open render.close() expect(render.main.arrow.path.getAttribute('d')).toBe(render.classes.arrowClose) expect(render.main.main.classList.contains(render.classes.openBelow)).toBe(false) expect(render.main.main.classList.contains(render.classes.openAbove)).toBe(false) - expect(render.main.main.getAttribute('aria-expanded')).toBe('false') + expect(render.content.search.input.getAttribute('aria-expanded')).toBe('false') expect(render.content.main.classList.contains(render.classes.openBelow)).toBe(false) expect(render.content.main.classList.contains(render.classes.openAbove)).toBe(false) }) @@ -146,12 +142,11 @@ describe('render module', () => { describe('updateClassStyles', () => { test('existing classes and styles are cleared', () => { - // manually set classes and styles for testing render.main.main.className = 'test' - render.main.main.style.color = 'red' + ;(render.main.main.style as any).color = 'red' render.content.main.className = 'test' - render.content.main.style.color = 'red' + ;(render.content.main.style as any).color = 'red' render.updateClassStyles() @@ -195,16 +190,24 @@ describe('render module', () => { }) describe('updateAriaAttributes', () => { - test('sets correct aria attributes', () => { + test('sets correct aria attributes (on input, not main)', () => { render.updateAriaAttributes() - expect(render.main.main.role).toBe('combobox') - expect(render.main.main.getAttribute('aria-haspopup')).toBe('listbox') - expect(render.main.main.getAttribute('aria-controls')).toBe(render.content.main.id + '-list') - expect(render.main.main.getAttribute('aria-expanded')).toBe('false') - expect(render.content.list.getAttribute('role')).toBe('listbox') - expect(render.content.list.getAttribute('aria-label')).toBe(render.settings.contentAriaLabel) + const input = render.content.search.input + const list = render.content.list + + expect(input.getAttribute('role')).toBe('combobox') + expect(input.getAttribute('aria-haspopup')).toBe('listbox') + expect(input.getAttribute('aria-controls')).toBe(list.id) + expect(input.getAttribute('aria-owns')).toBe(list.id) + expect(input.getAttribute('aria-expanded')).toBe('false') + expect(input.getAttribute('aria-autocomplete')).toBe('list') + + expect(list.getAttribute('role')).toBe('listbox') + expect(list.getAttribute('aria-label')).toBe(render.settings.contentAriaLabel) + expect(render.main.main.hasAttribute('aria-label')).toBe(false) + expect(render.main.main.hasAttribute('aria-labelledby')).toBe(false) }) }) @@ -220,7 +223,6 @@ describe('render module', () => { expect(main.children.item(1)?.classList.contains(render.classes.deselect)).toBe(true) expect(main.children.item(1)?.classList.contains(render.classes.hide)).toBe(true) expect(main.children.item(1)?.children).toHaveLength(1) - expect(main.children.item(1)?.children).toHaveLength(1) expect(main.children.item(1)?.children.item(0)).toBeInstanceOf(SVGElement) expect(main.children.item(2)?.classList.contains(render.classes.arrow)).toBe(true) expect(main.children.item(2)?.classList.contains(render.classes.hide)).toBe(false) @@ -238,7 +240,6 @@ describe('render module', () => { test('arrow key events on main element move highlight', () => { const highlightMock = jest.fn(() => {}) - render.highlight = highlightMock render.main.main.dispatchEvent(new KeyboardEvent('keydown', { key: 'ArrowUp' })) @@ -319,7 +320,6 @@ describe('render module', () => { render.settings.isMultiple = true const deselectAllMock = jest.fn() - render.updateDeselectAll = deselectAllMock const deselectElement: HTMLDivElement = render.main.main.querySelector( @@ -394,7 +394,6 @@ describe('render module', () => { describe('renderValues', () => { test('single select renders only one value', () => { render.renderValues() - expect(render.main.values.children).toHaveLength(1) }) @@ -438,9 +437,21 @@ describe('render module', () => { expect(render.main.values.children).toHaveLength(2) expect(render.main.values.children.item(0)).toBeInstanceOf(HTMLDivElement) - expect((render.main.values.children.item(0) as HTMLDivElement).textContent).toBe('opt0') + const chip0 = render.main.values.children.item(0) as HTMLDivElement + + expect(chip0).toBeInstanceOf(HTMLDivElement) + + const chip0Text = chip0.querySelector('.' + render.classes.valueText) as HTMLDivElement + + expect(chip0Text.textContent).toBe('opt0') expect(render.main.values.children.item(1)).toBeInstanceOf(HTMLDivElement) - expect((render.main.values.children.item(1) as HTMLDivElement).textContent).toBe('opt1') + + const chip1 = render.main.values.children.item(1) as HTMLDivElement + const chip1Text = chip1.querySelector('.' + render.classes.valueText) as HTMLDivElement + + expect(chip1).toBeInstanceOf(HTMLDivElement) + expect(chip1Text).toBeTruthy() + expect(chip1Text.textContent).toBe('opt1') }) test('multiple select renders counter element when maxValuesShown is set', () => { @@ -558,7 +569,6 @@ describe('render module', () => { search.input.dispatchEvent(new InputEvent('input', { data: 'asdf' })) - // wait for debounce to trigger await new Promise((r) => setTimeout(r, 101)) expect(searchMock).toHaveBeenCalled() @@ -588,7 +598,6 @@ describe('render module', () => { }) test('escape triggers close callback', () => { - // separate test in case we want to also test the event someday const search = render.searchDiv() search.input.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape' })) @@ -596,7 +605,7 @@ describe('render module', () => { expect(closeMock).toHaveBeenCalled() }) - test("enter and space don't call addable witout ctrl key", () => { + test("enter and space don't call addable with empty value", () => { const search = render.searchDiv() const addableMock = jest.fn((s: string) => ({ text: s, @@ -612,22 +621,7 @@ describe('render module', () => { expect(addableMock).not.toHaveBeenCalled() }) - test('enter and space call event and does nothing without input value', () => { - const addableMock = jest.fn((s: string) => ({ - text: s, - value: s.toLowerCase() - })) - - render.callbacks.addable = addableMock - - // recreate search because we have added the addable callback - render.content.search = render.searchDiv() - - render.content.search.input.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' })) - expect(addableMock).not.toHaveBeenCalled() - }) - - test('enter and space call addable when defined', () => { + test('enter triggers addable when defined and value present', () => { const addableMock = jest.fn((s: string) => ({ text: s, value: s.toLowerCase() @@ -635,9 +629,7 @@ describe('render module', () => { render.callbacks.addable = addableMock - // recreate search because we have added the addable callback render.content.search = render.searchDiv() - render.content.search.input.value = 'Search' render.content.search.input.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' })) @@ -657,7 +649,6 @@ describe('render module', () => { describe('getOptions', () => { test('returns all options when called without parameters', () => { - // render all 3 default options and get them back render.renderOptions(render.store.getDataOptions()) const opts = render.getOptions() @@ -1137,19 +1128,16 @@ describe('render module', () => { option.dispatchEvent(new MouseEvent('click')) expect(addOptionMock).toHaveBeenCalled() - - // check that we add the right option expect(addOptionMock.mock.calls[0][0].text).toBe('new opt 1') expect(setSelectedMock).toHaveBeenCalled() }) }) describe('range selection', () => { - let render: Render - let afterChangeMock: jest.Mock + let renderMultiple: Render + let afterChangeMock2: jest.Mock beforeEach(() => { - // create a new store with 3 options const store = new Store('multiple', [ { text: 'test1', value: 'test1' }, { text: 'test2', value: 'test2' }, @@ -1159,7 +1147,7 @@ describe('render module', () => { const settings = new Settings() const classes = new CssClasses() - afterChangeMock = jest.fn(() => {}) + afterChangeMock2 = jest.fn(() => {}) const callbacks = { open: () => {}, @@ -1170,29 +1158,26 @@ describe('render module', () => { }, addOption: () => {}, search: () => {}, - afterChange: afterChangeMock + afterChange: afterChangeMock2 } as Callbacks - render = new Render(settings, classes, store, callbacks) - render.settings.isMultiple = true - render.settings.closeOnSelect = false + renderMultiple = new Render(settings, classes, store, callbacks) + renderMultiple.settings.isMultiple = true + renderMultiple.settings.closeOnSelect = false }) test('click holding shift key selects range from last clicked to current', () => { - render.renderOptions(render.store.getDataOptions()) + renderMultiple.renderOptions(renderMultiple.store.getDataOptions()) - const opts = render.getOptions(false, false, true) + const opts = renderMultiple.getOptions(false, false, true) expect(opts).toHaveLength(3) - // click on the first option opts[0].dispatchEvent(new MouseEvent('click')) - expect(afterChangeMock).toHaveBeenCalledWith([expect.objectContaining({ value: 'test1' })]) + expect(afterChangeMock2).toHaveBeenCalledWith([expect.objectContaining({ value: 'test1' })]) - // click on the last option holding the shift key opts[2].dispatchEvent(new MouseEvent('click', { shiftKey: true })) - // check that also the middle value is selected - expect(afterChangeMock).toHaveBeenCalledWith([ + expect(afterChangeMock2).toHaveBeenCalledWith([ expect.objectContaining({ value: 'test1' }), expect.objectContaining({ value: 'test2' }), expect.objectContaining({ value: 'test3' }) @@ -1200,20 +1185,17 @@ describe('render module', () => { }) test('click holding shift key selects range from current to last clicked', () => { - render.renderOptions(render.store.getDataOptions()) + renderMultiple.renderOptions(renderMultiple.store.getDataOptions()) - const opts = render.getOptions(false, false, true) + const opts = renderMultiple.getOptions(false, false, true) expect(opts).toHaveLength(3) - // click on the last option opts[2].dispatchEvent(new MouseEvent('click')) - expect(afterChangeMock).toHaveBeenCalledWith([expect.objectContaining({ value: 'test3' })]) + expect(afterChangeMock2).toHaveBeenCalledWith([expect.objectContaining({ value: 'test3' })]) - // click on the first option holding the shift key opts[0].dispatchEvent(new MouseEvent('click', { shiftKey: true })) - // check that also the middle value is selected - expect(afterChangeMock).toHaveBeenCalledWith([ + expect(afterChangeMock2).toHaveBeenCalledWith([ expect.objectContaining({ value: 'test3' }), expect.objectContaining({ value: 'test1' }), expect.objectContaining({ value: 'test2' }) @@ -1221,21 +1203,18 @@ describe('render module', () => { }) test('range selection is ignored if range length is greater than maxSelected', () => { - render.settings.maxSelected = 2 - render.renderOptions(render.store.getDataOptions()) + renderMultiple.settings.maxSelected = 2 + renderMultiple.renderOptions(renderMultiple.store.getDataOptions()) - const opts = render.getOptions(false, false, true) + const opts = renderMultiple.getOptions(false, false, true) expect(opts).toHaveLength(3) - // click on the first option opts[0].dispatchEvent(new MouseEvent('click')) - expect(afterChangeMock).toHaveBeenCalledWith([expect.objectContaining({ value: 'test1' })]) + expect(afterChangeMock2).toHaveBeenCalledWith([expect.objectContaining({ value: 'test1' })]) - // click on the last option holding the shift key opts[2].dispatchEvent(new MouseEvent('click', { shiftKey: true })) - // check that the middle value is NOT selected - expect(afterChangeMock).toHaveBeenCalledWith([ + expect(afterChangeMock2).toHaveBeenCalledWith([ expect.objectContaining({ value: 'test1' }), expect.objectContaining({ value: 'test3' }) ]) @@ -1247,14 +1226,13 @@ describe('render module', () => { expect(render.main.main).toBeInstanceOf(HTMLDivElement) expect(render.content.main).toBeInstanceOf(HTMLDivElement) - // set some simple IDs, so we can search for the elements in the DOM render.main.main.id = 'main-id' render.content.main.id = 'content-id' render.destroy() expect(document.getElementById('main-id')).toBeNull() - expect(document.getElementById('#content-id')).toBeNull() + expect(document.getElementById('content-id')).toBeNull() }) }) @@ -1282,12 +1260,6 @@ describe('render module', () => { }) }) - describe('ensureElementInView', () => {}) - - describe('putContent', () => {}) - - describe('updateDeselectAll', () => {}) - describe('accessibility (a11y)', () => { test('search input gets ARIA wiring (controls + autocomplete + label fallback)', () => { @@ -1298,8 +1270,6 @@ describe('render module', () => { expect(render.content.search.input.getAttribute('aria-label')).toBe('Search options') }) - - test('deselect control has button semantics and label', () => { const deselectEl = render.main.main.querySelector('.' + render.classes.deselect) as HTMLDivElement @@ -1308,22 +1278,30 @@ describe('render module', () => { expect(deselectEl.getAttribute('aria-label')).toBe(render.settings.clearAllAriaLabel) }) - - test('token delete control (multi) has button semantics', () => { - const opt = new Option({ text: 'Alpha', value: 'alpha', selected: true }) - const token = render.multipleValue(opt) + const opt = new Option({ text: 'Alpha', value: 'alpha', selected: true }) + const token = render.multipleValue(opt) - const del = token.querySelector('.' + render.classes.valueDelete) as HTMLDivElement + const del = token.querySelector('.' + render.classes.valueDelete) as HTMLDivElement - expect(del).toBeInstanceOf(HTMLDivElement) - expect(del.getAttribute('role')).toBe('button') - expect(del.getAttribute('tabindex')).toBe('0') - expect(del.getAttribute('aria-label')).toBe('Remove selection') - expect(del.getAttribute('title')).toBe('Remove selection') - }) + expect(del).toBeInstanceOf(HTMLDivElement) + expect(del.getAttribute('role')).toBe('button') + // Initially hidden from tab order and SR + expect(del.getAttribute('tabindex')).toBe('-1') + expect(del.getAttribute('aria-hidden')).toBe('true') + expect(del.getAttribute('aria-label')).toContain('Remove Alpha') + expect(del.hasAttribute('title')).toBe(false) + + // When the chip receives focus, the delete control becomes tabbable and visible to SR + token.dispatchEvent(new FocusEvent('focusin')) + expect(del.getAttribute('tabindex')).toBe('0') + expect(del.hasAttribute('aria-hidden')).toBe(false) + // Chip announces hint for keyboard-remove + const hintId = `${render.settings.id}__chip__${opt.id}__hint` + expect(token.getAttribute('aria-describedby')).toBe(hintId) + }) test('renderSearching sets aria-busy and announces via polite live region', () => { const rafOrig = (global as any).requestAnimationFrame @@ -1344,8 +1322,6 @@ describe('render module', () => { ;(global as any).requestAnimationFrame = rafOrig }) - - test('renderError clears aria-busy and announces via assertive live region', () => { const rafOrig = (global as any).requestAnimationFrame ;(global as any).requestAnimationFrame = (cb: Function) => cb() @@ -1364,8 +1340,6 @@ describe('render module', () => { ;(global as any).requestAnimationFrame = rafOrig }) - - test('renderOptions sets aria-setsize and each option gets aria-posinset', () => { render.renderOptions( render.store.partialToFullData([ @@ -1375,20 +1349,18 @@ describe('render module', () => { ]) ) - const opts = render.getOptions(true, true, true); - expect(opts).toHaveLength(3); - expect(opts[0].getAttribute('aria-posinset')).toBe('1'); - expect(opts[0].getAttribute('aria-setsize')).toBe('3'); + const opts = render.getOptions(true, true, true) + expect(opts).toHaveLength(3) + expect(opts[0].getAttribute('aria-posinset')).toBe('1') + expect(opts[0].getAttribute('aria-setsize')).toBe('3') - expect(opts[1].getAttribute('aria-posinset')).toBe('2'); - expect(opts[1].getAttribute('aria-setsize')).toBe('3'); + expect(opts[1].getAttribute('aria-posinset')).toBe('2') + expect(opts[1].getAttribute('aria-setsize')).toBe('3') - expect(opts[2].getAttribute('aria-posinset')).toBe('3'); - expect(opts[2].getAttribute('aria-setsize')).toBe('3'); + expect(opts[2].getAttribute('aria-posinset')).toBe('3') + expect(opts[2].getAttribute('aria-setsize')).toBe('3') }) - - test('empty results announce and keep aria-setsize = 0', () => { const rafOrig = (global as any).requestAnimationFrame ;(global as any).requestAnimationFrame = (cb: Function) => cb() @@ -1404,9 +1376,7 @@ describe('render module', () => { ;(global as any).requestAnimationFrame = rafOrig }) - - - test('highlight updates aria-activedescendant, close clears it', () => { + test('highlight updates aria-activedescendant on input; close clears it', () => { render.renderOptions( render.store.partialToFullData([ { text: 'A' }, @@ -1418,16 +1388,14 @@ describe('render module', () => { render.highlight('down') const firstVisible = render.getOptions(true, true, true)[0] - const active = render.main.main.getAttribute('aria-activedescendant') + const active = render.content.search.input.getAttribute('aria-activedescendant') expect(active).toBe(firstVisible.id) render.close() - expect(render.main.main.hasAttribute('aria-activedescendant')).toBe(false) + expect(render.content.search.input.hasAttribute('aria-activedescendant')).toBe(false) }) - - test('selected option sets aria-selected and updates activedescendant immediately', () => { const el = render.option( new Option({ @@ -1437,7 +1405,7 @@ describe('render module', () => { ) expect(el.getAttribute('aria-selected')).toBe('true') - expect(render.main.main.getAttribute('aria-activedescendant')).toBe(el.id) + expect(render.content.search.input.getAttribute('aria-activedescendant')).toBe(el.id) }) }) diff --git a/src/slim-select/render.ts b/src/slim-select/render.ts index 9df7c9ed..165b82dd 100644 --- a/src/slim-select/render.ts +++ b/src/slim-select/render.ts @@ -50,39 +50,42 @@ export default class Render { public settings: Settings public store: Store public callbacks: Callbacks - // Used to compute the range selection private lastSelectedOption: Option | null - private static _livePolite: HTMLDivElement | null = null; - private static _liveAssertive: HTMLDivElement | null = null; + private static _livePolite: HTMLDivElement | null = null + private static _liveAssertive: HTMLDivElement | null = null private static getLiveAssertive(): HTMLDivElement { - let el = document.getElementById('ss-live-assertive') as HTMLDivElement | null; + let el = document.getElementById('ss-live-assertive') as HTMLDivElement | null if (!el) { - el = document.createElement('div'); - el.id = 'ss-live-assertive'; - el.setAttribute('role', 'status'); - el.setAttribute('aria-live', 'assertive'); - el.setAttribute('aria-atomic', 'true'); - el.className = 'ss-sr-only'; - document.body.appendChild(el); - } - return el; + el = document.createElement('div') + el.id = 'ss-live-assertive' + el.setAttribute('role', 'status') + el.setAttribute('aria-live', 'assertive') + el.setAttribute('aria-atomic', 'true') + el.className = 'ss-sr-only' + document.body.appendChild(el) + } + return el } private _announceAssertive(msg: string) { - const el = (Render._liveAssertive ||= Render.getLiveAssertive()); - el.textContent = ''; - requestAnimationFrame(() => { el.textContent = msg; }); + const el = (Render._liveAssertive ||= Render.getLiveAssertive()) + el.textContent = '' + requestAnimationFrame(() => { el.textContent = msg }) + } + + private clearHighlights(): void { + const highlighted = this.content.list.querySelectorAll('.' + this.classes.highlighted) + highlighted.forEach(el => el.classList.remove(this.classes.highlighted)) + this.content.search.input.removeAttribute('aria-activedescendant') } - // Elements public main: Main public content: Content - private scrollHandler: (() => void) | undefined; - private resizeHandler: (() => void) | undefined; + private scrollHandler: (() => void) | undefined + private resizeHandler: (() => void) | undefined - // Classes public classes: CssClasses constructor(settings: Required, classes: Required, store: Store, callbacks: Callbacks) { @@ -95,71 +98,57 @@ export default class Render { this.main = this.mainDiv() this.content = this.contentDiv() - // Add classes and styles to main/content this.updateClassStyles() + this.main.values.setAttribute('role', 'list') this.updateAriaAttributes() - // Add content to the content location settings or offcanvas-body if it exists const contentContainer = document .querySelector(`[data-id="${this.settings.id}"]`) - ?.closest('.offcanvas-body'); + ?.closest('.offcanvas-body') if (contentContainer) { - contentContainer.appendChild(this.content.main); + contentContainer.appendChild(this.content.main) } else if (this.settings.contentLocation) { - this.settings.contentLocation.appendChild(this.content.main); + this.settings.contentLocation.appendChild(this.content.main) } } private static getLivePolite(): HTMLDivElement { - let el = document.getElementById('ss-live-polite') as HTMLDivElement | null; + let el = document.getElementById('ss-live-polite') as HTMLDivElement | null if (!el) { - el = document.createElement('div'); - el.id = 'ss-live-polite'; - el.setAttribute('role', 'status'); - el.setAttribute('aria-live', 'polite'); - el.setAttribute('aria-atomic', 'true'); - el.className = 'ss-sr-only'; - document.body.appendChild(el); - } - return el; + el = document.createElement('div') + el.id = 'ss-live-polite' + el.setAttribute('role', 'status') + el.setAttribute('aria-live', 'polite') + el.setAttribute('aria-atomic', 'true') + el.className = 'ss-sr-only' + document.body.appendChild(el) + } + return el } private _announcePolite(msg: string) { - const el = (Render._livePolite ||= Render.getLivePolite()); - el.textContent = ''; - requestAnimationFrame(() => { el.textContent = msg; }); + const el = (Render._livePolite ||= Render.getLivePolite()) + el.textContent = '' + requestAnimationFrame(() => { el.textContent = msg }) } - // Remove disabled classes public enable(): void { - // Remove disabled class this.main.main.classList.remove(this.classes.disabled) - - // Set search input to "enabled" this.content.search.input.disabled = false } - // Set disabled classes public disable(): void { - // Add disabled class this.main.main.classList.add(this.classes.disabled) - - // Set search input to disabled this.content.search.input.disabled = true } public open(): void { this.main.arrow.path.setAttribute('d', this.classes.arrowOpen) - - // Add class to main container this.main.main.classList.add(this.settings.openPosition === 'up' ? this.classes.openAbove : this.classes.openBelow) - this.main.main.setAttribute('aria-expanded', 'true') - - // move the content in to the right location + this.content.search.input.setAttribute('aria-expanded', 'true') this.moveContent() - // Move to last selected option const selectedOptions = this.store.getSelectedOptions() if (selectedOptions.length) { const selectedId = selectedOptions[selectedOptions.length - 1].id @@ -168,38 +157,36 @@ export default class Render { this.ensureElementInView(this.content.list, selectedOption) } } - if (this.settings.contentPosition === 'fixed') { - this.moveContent(); - // Instant (non-debounced) handlers - this.scrollHandler = () => this.moveContent(); - this.resizeHandler = () => this.moveContent(); - - window.addEventListener('scroll', this.scrollHandler, true); // capture phase - window.addEventListener('resize', this.resizeHandler); + if (this.settings.contentPosition === 'fixed') { + this.moveContent() + this.scrollHandler = () => this.moveContent() + this.resizeHandler = () => this.moveContent() + window.addEventListener('scroll', this.scrollHandler, true) + window.addEventListener('resize', this.resizeHandler) } - this.searchFocus(); + + this.searchFocus() } public close(): void { - 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.main.classList.remove(this.classes.openAbove, this.classes.openBelow) + this.content.search.input.setAttribute('aria-expanded', 'false') + this.content.main.classList.remove(this.classes.openAbove, this.classes.openBelow) this.main.arrow.path.setAttribute('d', this.classes.arrowClose) if (this.scrollHandler) { - window.removeEventListener('scroll', this.scrollHandler, true); - this.scrollHandler = undefined; + window.removeEventListener('scroll', this.scrollHandler, true) + this.scrollHandler = undefined } if (this.resizeHandler) { - window.removeEventListener('resize', this.resizeHandler); - this.resizeHandler = undefined; + window.removeEventListener('resize', this.resizeHandler) + this.resizeHandler = undefined } - this.main.main.focus({ preventScroll: true }); - this.main.main.removeAttribute('aria-activedescendant'); + + this.clearHighlights() + this.main.main.focus({ preventScroll: true }) } public updateClassStyles(): void { @@ -246,13 +233,16 @@ export default class Render { this.content.list.setAttribute('aria-multiselectable', 'true'); } - this.main.main.setAttribute('role', 'combobox'); - this.main.main.setAttribute('aria-haspopup', 'listbox'); - this.main.main.setAttribute('aria-controls', this.content.list.id); - this.main.main.setAttribute('aria-expanded', 'false'); - this.main.main.setAttribute('aria-autocomplete', 'list'); this.main.main.removeAttribute('aria-labelledby'); this.main.main.removeAttribute('aria-label'); + + const input = this.content.search.input; + input.setAttribute('role', 'combobox'); + input.setAttribute('aria-haspopup', 'listbox'); + input.setAttribute('aria-controls', this.content.list.id); + input.setAttribute('aria-owns', this.content.list.id); + input.setAttribute('aria-expanded', 'false'); + input.setAttribute('aria-autocomplete', 'list'); let labelledById = (this.settings.ariaLabelledBy || '').trim(); let labelEl: HTMLLabelElement | null = null; @@ -286,8 +276,6 @@ export default class Render { this.main.main.setAttribute('aria-label', this.settings.ariaLabel.trim()); } - this.main.main.setAttribute('aria-owns', this.content.list.id); - this.content.search.input.setAttribute('aria-controls', this.content.list.id); this.content.search.input.setAttribute('aria-autocomplete', 'list'); @@ -315,36 +303,35 @@ export default class Render { // This is to allow for normal selecting // when you may not have a search bar main.onkeydown = (e: KeyboardEvent): boolean => { - // Convert above if else statemets to switch + // Only react when the shell itself has focus, not when a child (chip/delete/etc) has focus + if (e.target !== main) return true; + switch (e.key) { case 'ArrowUp': case 'ArrowDown': - this.callbacks.open() - e.key === 'ArrowDown' ? this.highlight('down') : this.highlight('up') - return false + this.callbacks.open(); + e.key === 'ArrowDown' ? this.highlight('down') : this.highlight('up'); + return false; case 'Tab': - this.callbacks.close() - return true // Continue doing normal tabbing + this.callbacks.close(); + return true; case 'Enter': case ' ': - this.callbacks.open() - const highlighted = this.content.list.querySelector('.' + this.classes.highlighted) as HTMLDivElement - if (highlighted) { - highlighted.click() - } - return false + this.callbacks.open(); + const highlighted = this.content.list.querySelector('.' + this.classes.highlighted) as HTMLDivElement; + if (highlighted) highlighted.click(); + return false; case 'Escape': - this.callbacks.close() - return false + this.callbacks.close(); + return false; } - // Check if they type a-z, A-Z and 0-9 if (e.key.length === 1) { - this.callbacks.open() + this.callbacks.open(); } - return true - } + return true; + }; // Add onclick for main div main.onclick = (e: Event): void => { @@ -371,6 +358,7 @@ export default class Render { deselect.addEventListener('keydown', (e: KeyboardEvent) => { // ADD if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); + e.stopPropagation(); deselect.click(); } }); @@ -646,107 +634,140 @@ export default class Render { } public multipleValue(option: Option): HTMLDivElement { - const value = document.createElement('div') - value.classList.add(this.classes.value) - value.dataset.id = option.id + const value = document.createElement('div'); + value.classList.add(this.classes.value); + value.dataset.id = option.id; + + // Make each chip a focusable list item; keep its spoken name clean (no "remove" text here) + value.setAttribute('role', 'listitem'); + value.tabIndex = 0; + value.setAttribute('aria-label', option.text); + + // Chip visible text + const text = document.createElement('div'); + text.classList.add(this.classes.valueText); + text.textContent = option.text; // For multiple values always use text + value.appendChild(text); - const text = document.createElement('div') - text.classList.add(this.classes.valueText) - text.textContent = option.text // For multiple values always use text - value.appendChild(text) + let deleteDiv: HTMLDivElement | null = null; - // Only add deletion if the option is not mandatory if (!option.mandatory) { - // Create delete div element - const deleteDiv = document.createElement('div') - deleteDiv.classList.add(this.classes.valueDelete) + // SR-only hint announced when the chip gets focus (tells users how to remove) + const hintId = `${this.settings.id}__chip__${option.id}__hint`; + const hint = document.createElement('span'); + hint.id = hintId; + hint.className = 'ss-sr-only'; // ensure this class is NOT display:none + hint.textContent = 'Press Delete or Backspace to remove.'; + value.appendChild(hint); + + // Create delete control (hidden from a11y until chip focus) + deleteDiv = document.createElement('div'); + deleteDiv.classList.add(this.classes.valueDelete); deleteDiv.setAttribute('role', 'button'); - deleteDiv.setAttribute('aria-label', 'Remove selection'); - deleteDiv.setAttribute('title', 'Remove selection'); - deleteDiv.setAttribute('tabindex', '0'); + deleteDiv.setAttribute('aria-label', `Remove ${option.text}`); + deleteDiv.setAttribute('aria-hidden', 'true'); // hidden from SR until chip is focused + deleteDiv.tabIndex = -1; // not tabbable until chip focus - // Add delete onclick event deleteDiv.onclick = (e: Event) => { - e.preventDefault() - e.stopPropagation() + e.preventDefault(); + e.stopPropagation(); - // Dont do anything if disabled - if (this.settings.disabled) { - return - } + if (this.settings.disabled) return; - // By Default we will delete - let shouldDelete = true - const before = this.store.getSelectedOptions() - const after = before.filter((o) => { - return o.selected && o.id !== option.id - }, true) + let shouldDelete = true; + const before = this.store.getSelectedOptions(); + const after = before.filter((o) => o.selected && o.id !== option.id, true); - // Check if minSelected is set and if after length so, return if (this.settings.minSelected && after.length < this.settings.minSelected) { - return + return; } - // If there is a beforeDeselect function run it if (this.callbacks.beforeChange) { - shouldDelete = this.callbacks.beforeChange(after, before) === true + shouldDelete = this.callbacks.beforeChange(after as Option[], before as Option[]) === true; } if (shouldDelete) { - // Loop through after and append ids to a variable called selected - let selectedIds: string[] = [] + const selectedIds: string[] = []; for (const o of after) { if (o instanceof Optgroup) { - for (const c of o.options) { - selectedIds.push(c.id) - } + for (const c of o.options) selectedIds.push(c.id); } - if (o instanceof Option) { - selectedIds.push(o.id) + selectedIds.push(o.id); } } - this.callbacks.setSelected(selectedIds, false) - // Check if we need to close the dropdown + this.callbacks.setSelected(selectedIds, false); + if (this.settings.closeOnSelect) { - this.callbacks.close() + this.callbacks.close(); } - // Run afterChange callback if (this.callbacks.afterChange) { - this.callbacks.afterChange(after) + this.callbacks.afterChange(after as Option[]); } - this.updateDeselectAll() - } - } - - // Add delete svg - const deleteSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg') - deleteSvg.setAttribute('viewBox', '0 0 100 100') - deleteSvg.setAttribute('aria-hidden', 'true') - deleteSvg.setAttribute('focusable', 'false') - const deletePath = document.createElementNS('http://www.w3.org/2000/svg', 'path') - deletePath.setAttribute('d', this.classes.optionDelete) - deleteSvg.appendChild(deletePath) - deleteDiv.appendChild(deleteSvg) - - // Add the deleteDiv to the value container - value.appendChild(deleteDiv) + this.updateDeselectAll(); - // Add keydown event listener for keyboard navigation (Enter key) + // ⬇️ move focus back to the main container after delete + requestAnimationFrame(() => { + this.main.main.focus({ preventScroll: true }); + }); + } + }; + + // Keep icon quiet + const deleteSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); + deleteSvg.setAttribute('viewBox', '0 0 100 100'); + deleteSvg.setAttribute('aria-hidden', 'true'); + deleteSvg.setAttribute('focusable', 'false'); + const deletePath = document.createElementNS('http://www.w3.org/2000/svg', 'path'); + deletePath.setAttribute('d', this.classes.optionDelete); + deleteSvg.appendChild(deletePath); + deleteDiv.appendChild(deleteSvg); + value.appendChild(deleteDiv); + + // Keyboard on delete button deleteDiv.onkeydown = (e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); - deleteDiv.click() // Trigger the click event when Enter is pressed + e.stopPropagation(); + deleteDiv!.click(); } - } + }; + + // Chip-level keyboard remove (Delete/Backspace) + value.addEventListener('keydown', (e) => { + if (e.key === 'Enter' || e.key === ' ') { + // Pressing Enter/Space on the chip should NOT open the listbox + e.preventDefault(); + e.stopPropagation(); + } else if (e.key === 'Delete' || e.key === 'Backspace') { + e.preventDefault(); + e.stopPropagation(); + deleteDiv?.click(); + } + }); + + // When chip receives focus, announce hint and expose delete button to SR/tab order + value.addEventListener('focusin', () => { + value.setAttribute('aria-describedby', hintId); + deleteDiv!.removeAttribute('aria-hidden'); + deleteDiv!.tabIndex = 0; + }); + + // When chip loses focus, hide hint and remove delete from SR/tab order + value.addEventListener('focusout', () => { + value.removeAttribute('aria-describedby'); + deleteDiv!.setAttribute('aria-hidden', 'true'); + deleteDiv!.tabIndex = -1; + }); } - return value + return value; } + public contentDiv(): Content { const main = document.createElement('div') @@ -809,7 +830,7 @@ export default class Render { input.readOnly = true } - input.type = 'search' + input.type = 'text' input.placeholder = this.settings.searchPlaceholder input.tabIndex = -1 if (this.settings.searchLabelledBy && this.settings.searchLabelledBy.trim()) { @@ -1057,9 +1078,9 @@ export default class Render { // Highlight the next one let selectOption = options[dir === 'down' ? (i + 1 < options.length ? i + 1 : 0) : i - 1 >= 0 ? i - 1 : options.length - 1] - selectOption.classList.add(this.classes.highlighted) - this.main.main.setAttribute('aria-activedescendant', selectOption.id); - this.ensureElementInView(this.content.list, selectOption) + selectOption.classList.add(this.classes.highlighted); + this.content.search.input.setAttribute('aria-activedescendant', selectOption.id); + this.ensureElementInView(this.content.list, selectOption); // If selected option has parent classes ss-optgroup with ss-close then click it const selectParent = selectOption.parentElement @@ -1079,7 +1100,7 @@ export default class Render { const newly = options[dir === 'down' ? 0 : options.length - 1]; newly.classList.add(this.classes.highlighted); - this.main.main.setAttribute('aria-activedescendant', newly.id); + this.content.search.input.setAttribute('aria-activedescendant', newly.id); // Scroll to highlighted one this.ensureElementInView(this.content.list, newly); @@ -1436,7 +1457,7 @@ export default class Render { if (option.selected) { optionEl.classList.add(this.classes.selected) optionEl.setAttribute('aria-selected', 'true') - this.main.main.setAttribute('aria-activedescendant', optionEl.id) + this.content.search.input.setAttribute('aria-activedescendant', optionEl.id) } else { optionEl.classList.remove(this.classes.selected) optionEl.setAttribute('aria-selected', 'false') From 3ad8017928cf1365149aa0eaa5c48d782b145b74 Mon Sep 17 00:00:00 2001 From: Tiberiu Dumitru Date: Thu, 11 Sep 2025 19:18:15 +0300 Subject: [PATCH 8/8] Aria improvements. --- dist/render.d.ts | 1 + dist/slimselect.cjs.js | 93 +++-- dist/slimselect.es.js | 93 +++-- dist/slimselect.global.js | 93 +++-- dist/slimselect.js | 93 +++-- dist/slimselect.min.js | 2 +- dist/slimselect.umd.js | 93 +++-- dist/slimselect.umd.min.js | 2 +- docs/assets/index.js | 2 +- src/slim-select/render.test.ts | 646 +++++++-------------------------- src/slim-select/render.ts | 132 ++++--- 11 files changed, 548 insertions(+), 702 deletions(-) diff --git a/dist/render.d.ts b/dist/render.d.ts index ee440fbd..38d7d725 100644 --- a/dist/render.d.ts +++ b/dist/render.d.ts @@ -87,4 +87,5 @@ export default class Render { ensureElementInView(container: HTMLElement, element: HTMLElement): void; putContent(): 'up' | 'down'; updateDeselectAll(): void; + private setActiveDescendant; } diff --git a/dist/slimselect.cjs.js b/dist/slimselect.cjs.js index e86b63a9..ba3b4ef0 100644 --- a/dist/slimselect.cjs.js +++ b/dist/slimselect.cjs.js @@ -387,6 +387,7 @@ class Render { const highlighted = this.content.list.querySelectorAll('.' + this.classes.highlighted); highlighted.forEach(el => el.classList.remove(this.classes.highlighted)); this.content.search.input.removeAttribute('aria-activedescendant'); + this.main.main.removeAttribute('aria-activedescendant'); } constructor(settings, classes, store, callbacks) { var _a; @@ -438,7 +439,7 @@ class Render { 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.content.search.input.setAttribute('aria-expanded', 'true'); + this.main.main.setAttribute('aria-expanded', 'true'); this.moveContent(); const selectedOptions = this.store.getSelectedOptions(); if (selectedOptions.length) { @@ -459,7 +460,8 @@ class Render { } close() { this.main.main.classList.remove(this.classes.openAbove, this.classes.openBelow); - this.content.search.input.setAttribute('aria-expanded', 'false'); + this.content.search.input.removeAttribute('aria-expanded'); + this.main.main.setAttribute('aria-expanded', 'false'); this.content.main.classList.remove(this.classes.openAbove, this.classes.openBelow); this.main.arrow.path.setAttribute('d', this.classes.arrowClose); if (this.scrollHandler) { @@ -503,18 +505,21 @@ class Render { this.content.list.setAttribute('role', 'listbox'); this.content.list.setAttribute('id', this.content.main.id + '-list'); this.content.list.setAttribute('aria-label', this.settings.contentAriaLabel); + this.main.main.setAttribute('role', 'combobox'); + this.main.main.setAttribute('aria-controls', this.content.list.id); + this.main.main.setAttribute('aria-haspopup', 'listbox'); + this.main.main.setAttribute('aria-expanded', 'false'); if (this.settings.isMultiple) { this.content.list.setAttribute('aria-multiselectable', 'true'); } this.main.main.removeAttribute('aria-labelledby'); this.main.main.removeAttribute('aria-label'); const input = this.content.search.input; - input.setAttribute('role', 'combobox'); - input.setAttribute('aria-haspopup', 'listbox'); + input.setAttribute('role', 'searchbox'); input.setAttribute('aria-controls', this.content.list.id); input.setAttribute('aria-owns', this.content.list.id); - input.setAttribute('aria-expanded', 'false'); input.setAttribute('aria-autocomplete', 'list'); + input.removeAttribute('aria-expanded'); let labelledById = (this.settings.ariaLabelledBy || '').trim(); let labelEl = null; if (!labelledById) { @@ -566,28 +571,49 @@ class Render { main.onkeydown = (e) => { if (e.target !== main) return true; + const focusAndThen = (fn) => { + this.callbacks.open(); + requestAnimationFrame(() => { + this.searchFocus(); + fn(); + }); + }; switch (e.key) { - case 'ArrowUp': case 'ArrowDown': - this.callbacks.open(); - e.key === 'ArrowDown' ? this.highlight('down') : this.highlight('up'); + e.preventDefault(); + focusAndThen(() => this.highlight('down')); + return false; + case 'ArrowUp': + e.preventDefault(); + focusAndThen(() => this.highlight('up')); return false; case 'Tab': this.callbacks.close(); return true; case 'Enter': case ' ': - this.callbacks.open(); - const highlighted = this.content.list.querySelector('.' + this.classes.highlighted); - if (highlighted) - highlighted.click(); - return false; - case 'Escape': - this.callbacks.close(); + e.preventDefault(); + focusAndThen(() => { + const highlighted = this.content.list.querySelector('.' + this.classes.highlighted); + if (highlighted) + highlighted.click(); + }); return false; } - if (e.key.length === 1) { + if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) { + e.preventDefault(); this.callbacks.open(); + requestAnimationFrame(() => { + var _a, _b; + this.searchFocus(); + const inp = this.content.search.input; + const selStart = (_a = inp.selectionStart) !== null && _a !== void 0 ? _a : inp.value.length; + const selEnd = (_b = inp.selectionEnd) !== null && _b !== void 0 ? _b : inp.value.length; + inp.value = inp.value.slice(0, selStart) + e.key + inp.value.slice(selEnd); + inp.setSelectionRange(selStart + 1, selStart + 1); + this.callbacks.search(inp.value); + }); + return false; } return true; }; @@ -702,6 +728,7 @@ class Render { const placeholder = document.createElement('div'); placeholder.classList.add(this.classes.placeholder); placeholder.innerHTML = placeholderText; + placeholder.setAttribute('aria-hidden', 'true'); return placeholder; } renderValues() { @@ -717,6 +744,7 @@ class Render { return o.selected && !o.placeholder; }, false); const selectedSingle = selected.length > 0 ? selected[0] : null; + this.main.values.removeAttribute('role'); if (!selectedSingle) { this.main.values.innerHTML = this.placeholder().outerHTML; } @@ -744,10 +772,12 @@ class Render { return opt.selected && opt.display; }, false); if (selectedOptions.length === 0) { + this.main.values.removeAttribute('role'); this.main.values.innerHTML = this.placeholder().outerHTML; return; } else { + this.main.values.setAttribute('role', 'list'); const placeholder = this.main.values.querySelector('.' + this.classes.placeholder); if (placeholder) { placeholder.remove(); @@ -1125,6 +1155,8 @@ class Render { if (options.length === 1) { if (!options[0].classList.contains(this.classes.highlighted)) { options[0].classList.add(this.classes.highlighted); + const id = options[0].id; + this.setActiveDescendant(id); return; } } @@ -1138,6 +1170,7 @@ class Render { for (const o of options) { if (o.classList.contains(this.classes.selected)) { o.classList.add(this.classes.highlighted); + this.setActiveDescendant(o.id); break; } } @@ -1146,16 +1179,9 @@ class Render { if (options[i].classList.contains(this.classes.highlighted)) { const prevOption = options[i]; prevOption.classList.remove(this.classes.highlighted); - const prevParent = prevOption.parentElement; - if (prevParent && prevParent.classList.contains(this.classes.open)) { - const optgroupLabel = prevParent.querySelector('.' + this.classes.optgroupLabel); - if (optgroupLabel) { - optgroupLabel.click(); - } - } - let selectOption = options[dir === 'down' ? (i + 1 < options.length ? i + 1 : 0) : i - 1 >= 0 ? i - 1 : options.length - 1]; + const selectOption = options[dir === 'down' ? (i + 1 < options.length ? i + 1 : 0) : i - 1 >= 0 ? i - 1 : options.length - 1]; selectOption.classList.add(this.classes.highlighted); - this.content.search.input.setAttribute('aria-activedescendant', selectOption.id); + this.setActiveDescendant(selectOption.id); this.ensureElementInView(this.content.list, selectOption); const selectParent = selectOption.parentElement; if (selectParent && selectParent.classList.contains(this.classes.close)) { @@ -1169,7 +1195,7 @@ class Render { } const newly = options[dir === 'down' ? 0 : options.length - 1]; newly.classList.add(this.classes.highlighted); - this.content.search.input.setAttribute('aria-activedescendant', newly.id); + this.setActiveDescendant(newly.id); this.ensureElementInView(this.content.list, newly); } listDiv() { @@ -1410,7 +1436,7 @@ class Render { if (option.selected) { optionEl.classList.add(this.classes.selected); optionEl.setAttribute('aria-selected', 'true'); - this.content.search.input.setAttribute('aria-activedescendant', optionEl.id); + this.setActiveDescendant(optionEl.id); } else { optionEl.classList.remove(this.classes.selected); @@ -1441,8 +1467,8 @@ class Render { if (!this.settings.closeOnSelect) { if (e.shiftKey && this.lastSelectedOption) { const options = this.store.getDataOptions(); - let lastClickedOptionIndex = options.findIndex((o) => o.id === this.lastSelectedOption.id); - let currentOptionIndex = options.findIndex((o) => o.id === option.id); + const lastClickedOptionIndex = options.findIndex((o) => o.id === this.lastSelectedOption.id); + const currentOptionIndex = options.findIndex((o) => o.id === option.id); if (lastClickedOptionIndex >= 0 && currentOptionIndex >= 0) { const startIndex = Math.min(lastClickedOptionIndex, currentOptionIndex); const endIndex = Math.max(lastClickedOptionIndex, currentOptionIndex); @@ -1585,6 +1611,15 @@ class Render { deselectButton.classList.add(hideClass); } } + setActiveDescendant(id) { + if (!id) { + this.main.main.removeAttribute('aria-activedescendant'); + this.content.search.input.removeAttribute('aria-activedescendant'); + return; + } + this.main.main.setAttribute('aria-activedescendant', id); + this.content.search.input.setAttribute('aria-activedescendant', id); + } } Render._livePolite = null; Render._liveAssertive = null; diff --git a/dist/slimselect.es.js b/dist/slimselect.es.js index eec7cc39..4283a4d9 100644 --- a/dist/slimselect.es.js +++ b/dist/slimselect.es.js @@ -385,6 +385,7 @@ class Render { const highlighted = this.content.list.querySelectorAll('.' + this.classes.highlighted); highlighted.forEach(el => el.classList.remove(this.classes.highlighted)); this.content.search.input.removeAttribute('aria-activedescendant'); + this.main.main.removeAttribute('aria-activedescendant'); } constructor(settings, classes, store, callbacks) { var _a; @@ -436,7 +437,7 @@ class Render { 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.content.search.input.setAttribute('aria-expanded', 'true'); + this.main.main.setAttribute('aria-expanded', 'true'); this.moveContent(); const selectedOptions = this.store.getSelectedOptions(); if (selectedOptions.length) { @@ -457,7 +458,8 @@ class Render { } close() { this.main.main.classList.remove(this.classes.openAbove, this.classes.openBelow); - this.content.search.input.setAttribute('aria-expanded', 'false'); + this.content.search.input.removeAttribute('aria-expanded'); + this.main.main.setAttribute('aria-expanded', 'false'); this.content.main.classList.remove(this.classes.openAbove, this.classes.openBelow); this.main.arrow.path.setAttribute('d', this.classes.arrowClose); if (this.scrollHandler) { @@ -501,18 +503,21 @@ class Render { this.content.list.setAttribute('role', 'listbox'); this.content.list.setAttribute('id', this.content.main.id + '-list'); this.content.list.setAttribute('aria-label', this.settings.contentAriaLabel); + this.main.main.setAttribute('role', 'combobox'); + this.main.main.setAttribute('aria-controls', this.content.list.id); + this.main.main.setAttribute('aria-haspopup', 'listbox'); + this.main.main.setAttribute('aria-expanded', 'false'); if (this.settings.isMultiple) { this.content.list.setAttribute('aria-multiselectable', 'true'); } this.main.main.removeAttribute('aria-labelledby'); this.main.main.removeAttribute('aria-label'); const input = this.content.search.input; - input.setAttribute('role', 'combobox'); - input.setAttribute('aria-haspopup', 'listbox'); + input.setAttribute('role', 'searchbox'); input.setAttribute('aria-controls', this.content.list.id); input.setAttribute('aria-owns', this.content.list.id); - input.setAttribute('aria-expanded', 'false'); input.setAttribute('aria-autocomplete', 'list'); + input.removeAttribute('aria-expanded'); let labelledById = (this.settings.ariaLabelledBy || '').trim(); let labelEl = null; if (!labelledById) { @@ -564,28 +569,49 @@ class Render { main.onkeydown = (e) => { if (e.target !== main) return true; + const focusAndThen = (fn) => { + this.callbacks.open(); + requestAnimationFrame(() => { + this.searchFocus(); + fn(); + }); + }; switch (e.key) { - case 'ArrowUp': case 'ArrowDown': - this.callbacks.open(); - e.key === 'ArrowDown' ? this.highlight('down') : this.highlight('up'); + e.preventDefault(); + focusAndThen(() => this.highlight('down')); + return false; + case 'ArrowUp': + e.preventDefault(); + focusAndThen(() => this.highlight('up')); return false; case 'Tab': this.callbacks.close(); return true; case 'Enter': case ' ': - this.callbacks.open(); - const highlighted = this.content.list.querySelector('.' + this.classes.highlighted); - if (highlighted) - highlighted.click(); - return false; - case 'Escape': - this.callbacks.close(); + e.preventDefault(); + focusAndThen(() => { + const highlighted = this.content.list.querySelector('.' + this.classes.highlighted); + if (highlighted) + highlighted.click(); + }); return false; } - if (e.key.length === 1) { + if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) { + e.preventDefault(); this.callbacks.open(); + requestAnimationFrame(() => { + var _a, _b; + this.searchFocus(); + const inp = this.content.search.input; + const selStart = (_a = inp.selectionStart) !== null && _a !== void 0 ? _a : inp.value.length; + const selEnd = (_b = inp.selectionEnd) !== null && _b !== void 0 ? _b : inp.value.length; + inp.value = inp.value.slice(0, selStart) + e.key + inp.value.slice(selEnd); + inp.setSelectionRange(selStart + 1, selStart + 1); + this.callbacks.search(inp.value); + }); + return false; } return true; }; @@ -700,6 +726,7 @@ class Render { const placeholder = document.createElement('div'); placeholder.classList.add(this.classes.placeholder); placeholder.innerHTML = placeholderText; + placeholder.setAttribute('aria-hidden', 'true'); return placeholder; } renderValues() { @@ -715,6 +742,7 @@ class Render { return o.selected && !o.placeholder; }, false); const selectedSingle = selected.length > 0 ? selected[0] : null; + this.main.values.removeAttribute('role'); if (!selectedSingle) { this.main.values.innerHTML = this.placeholder().outerHTML; } @@ -742,10 +770,12 @@ class Render { return opt.selected && opt.display; }, false); if (selectedOptions.length === 0) { + this.main.values.removeAttribute('role'); this.main.values.innerHTML = this.placeholder().outerHTML; return; } else { + this.main.values.setAttribute('role', 'list'); const placeholder = this.main.values.querySelector('.' + this.classes.placeholder); if (placeholder) { placeholder.remove(); @@ -1123,6 +1153,8 @@ class Render { if (options.length === 1) { if (!options[0].classList.contains(this.classes.highlighted)) { options[0].classList.add(this.classes.highlighted); + const id = options[0].id; + this.setActiveDescendant(id); return; } } @@ -1136,6 +1168,7 @@ class Render { for (const o of options) { if (o.classList.contains(this.classes.selected)) { o.classList.add(this.classes.highlighted); + this.setActiveDescendant(o.id); break; } } @@ -1144,16 +1177,9 @@ class Render { if (options[i].classList.contains(this.classes.highlighted)) { const prevOption = options[i]; prevOption.classList.remove(this.classes.highlighted); - const prevParent = prevOption.parentElement; - if (prevParent && prevParent.classList.contains(this.classes.open)) { - const optgroupLabel = prevParent.querySelector('.' + this.classes.optgroupLabel); - if (optgroupLabel) { - optgroupLabel.click(); - } - } - let selectOption = options[dir === 'down' ? (i + 1 < options.length ? i + 1 : 0) : i - 1 >= 0 ? i - 1 : options.length - 1]; + const selectOption = options[dir === 'down' ? (i + 1 < options.length ? i + 1 : 0) : i - 1 >= 0 ? i - 1 : options.length - 1]; selectOption.classList.add(this.classes.highlighted); - this.content.search.input.setAttribute('aria-activedescendant', selectOption.id); + this.setActiveDescendant(selectOption.id); this.ensureElementInView(this.content.list, selectOption); const selectParent = selectOption.parentElement; if (selectParent && selectParent.classList.contains(this.classes.close)) { @@ -1167,7 +1193,7 @@ class Render { } const newly = options[dir === 'down' ? 0 : options.length - 1]; newly.classList.add(this.classes.highlighted); - this.content.search.input.setAttribute('aria-activedescendant', newly.id); + this.setActiveDescendant(newly.id); this.ensureElementInView(this.content.list, newly); } listDiv() { @@ -1408,7 +1434,7 @@ class Render { if (option.selected) { optionEl.classList.add(this.classes.selected); optionEl.setAttribute('aria-selected', 'true'); - this.content.search.input.setAttribute('aria-activedescendant', optionEl.id); + this.setActiveDescendant(optionEl.id); } else { optionEl.classList.remove(this.classes.selected); @@ -1439,8 +1465,8 @@ class Render { if (!this.settings.closeOnSelect) { if (e.shiftKey && this.lastSelectedOption) { const options = this.store.getDataOptions(); - let lastClickedOptionIndex = options.findIndex((o) => o.id === this.lastSelectedOption.id); - let currentOptionIndex = options.findIndex((o) => o.id === option.id); + const lastClickedOptionIndex = options.findIndex((o) => o.id === this.lastSelectedOption.id); + const currentOptionIndex = options.findIndex((o) => o.id === option.id); if (lastClickedOptionIndex >= 0 && currentOptionIndex >= 0) { const startIndex = Math.min(lastClickedOptionIndex, currentOptionIndex); const endIndex = Math.max(lastClickedOptionIndex, currentOptionIndex); @@ -1583,6 +1609,15 @@ class Render { deselectButton.classList.add(hideClass); } } + setActiveDescendant(id) { + if (!id) { + this.main.main.removeAttribute('aria-activedescendant'); + this.content.search.input.removeAttribute('aria-activedescendant'); + return; + } + this.main.main.setAttribute('aria-activedescendant', id); + this.content.search.input.setAttribute('aria-activedescendant', id); + } } Render._livePolite = null; Render._liveAssertive = null; diff --git a/dist/slimselect.global.js b/dist/slimselect.global.js index 75018734..e1c83370 100644 --- a/dist/slimselect.global.js +++ b/dist/slimselect.global.js @@ -388,6 +388,7 @@ var SlimSelect = (function () { const highlighted = this.content.list.querySelectorAll('.' + this.classes.highlighted); highlighted.forEach(el => el.classList.remove(this.classes.highlighted)); this.content.search.input.removeAttribute('aria-activedescendant'); + this.main.main.removeAttribute('aria-activedescendant'); } constructor(settings, classes, store, callbacks) { var _a; @@ -439,7 +440,7 @@ var SlimSelect = (function () { 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.content.search.input.setAttribute('aria-expanded', 'true'); + this.main.main.setAttribute('aria-expanded', 'true'); this.moveContent(); const selectedOptions = this.store.getSelectedOptions(); if (selectedOptions.length) { @@ -460,7 +461,8 @@ var SlimSelect = (function () { } close() { this.main.main.classList.remove(this.classes.openAbove, this.classes.openBelow); - this.content.search.input.setAttribute('aria-expanded', 'false'); + this.content.search.input.removeAttribute('aria-expanded'); + this.main.main.setAttribute('aria-expanded', 'false'); this.content.main.classList.remove(this.classes.openAbove, this.classes.openBelow); this.main.arrow.path.setAttribute('d', this.classes.arrowClose); if (this.scrollHandler) { @@ -504,18 +506,21 @@ var SlimSelect = (function () { this.content.list.setAttribute('role', 'listbox'); this.content.list.setAttribute('id', this.content.main.id + '-list'); this.content.list.setAttribute('aria-label', this.settings.contentAriaLabel); + this.main.main.setAttribute('role', 'combobox'); + this.main.main.setAttribute('aria-controls', this.content.list.id); + this.main.main.setAttribute('aria-haspopup', 'listbox'); + this.main.main.setAttribute('aria-expanded', 'false'); if (this.settings.isMultiple) { this.content.list.setAttribute('aria-multiselectable', 'true'); } this.main.main.removeAttribute('aria-labelledby'); this.main.main.removeAttribute('aria-label'); const input = this.content.search.input; - input.setAttribute('role', 'combobox'); - input.setAttribute('aria-haspopup', 'listbox'); + input.setAttribute('role', 'searchbox'); input.setAttribute('aria-controls', this.content.list.id); input.setAttribute('aria-owns', this.content.list.id); - input.setAttribute('aria-expanded', 'false'); input.setAttribute('aria-autocomplete', 'list'); + input.removeAttribute('aria-expanded'); let labelledById = (this.settings.ariaLabelledBy || '').trim(); let labelEl = null; if (!labelledById) { @@ -567,28 +572,49 @@ var SlimSelect = (function () { main.onkeydown = (e) => { if (e.target !== main) return true; + const focusAndThen = (fn) => { + this.callbacks.open(); + requestAnimationFrame(() => { + this.searchFocus(); + fn(); + }); + }; switch (e.key) { - case 'ArrowUp': case 'ArrowDown': - this.callbacks.open(); - e.key === 'ArrowDown' ? this.highlight('down') : this.highlight('up'); + e.preventDefault(); + focusAndThen(() => this.highlight('down')); + return false; + case 'ArrowUp': + e.preventDefault(); + focusAndThen(() => this.highlight('up')); return false; case 'Tab': this.callbacks.close(); return true; case 'Enter': case ' ': - this.callbacks.open(); - const highlighted = this.content.list.querySelector('.' + this.classes.highlighted); - if (highlighted) - highlighted.click(); - return false; - case 'Escape': - this.callbacks.close(); + e.preventDefault(); + focusAndThen(() => { + const highlighted = this.content.list.querySelector('.' + this.classes.highlighted); + if (highlighted) + highlighted.click(); + }); return false; } - if (e.key.length === 1) { + if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) { + e.preventDefault(); this.callbacks.open(); + requestAnimationFrame(() => { + var _a, _b; + this.searchFocus(); + const inp = this.content.search.input; + const selStart = (_a = inp.selectionStart) !== null && _a !== void 0 ? _a : inp.value.length; + const selEnd = (_b = inp.selectionEnd) !== null && _b !== void 0 ? _b : inp.value.length; + inp.value = inp.value.slice(0, selStart) + e.key + inp.value.slice(selEnd); + inp.setSelectionRange(selStart + 1, selStart + 1); + this.callbacks.search(inp.value); + }); + return false; } return true; }; @@ -703,6 +729,7 @@ var SlimSelect = (function () { const placeholder = document.createElement('div'); placeholder.classList.add(this.classes.placeholder); placeholder.innerHTML = placeholderText; + placeholder.setAttribute('aria-hidden', 'true'); return placeholder; } renderValues() { @@ -718,6 +745,7 @@ var SlimSelect = (function () { return o.selected && !o.placeholder; }, false); const selectedSingle = selected.length > 0 ? selected[0] : null; + this.main.values.removeAttribute('role'); if (!selectedSingle) { this.main.values.innerHTML = this.placeholder().outerHTML; } @@ -745,10 +773,12 @@ var SlimSelect = (function () { return opt.selected && opt.display; }, false); if (selectedOptions.length === 0) { + this.main.values.removeAttribute('role'); this.main.values.innerHTML = this.placeholder().outerHTML; return; } else { + this.main.values.setAttribute('role', 'list'); const placeholder = this.main.values.querySelector('.' + this.classes.placeholder); if (placeholder) { placeholder.remove(); @@ -1126,6 +1156,8 @@ var SlimSelect = (function () { if (options.length === 1) { if (!options[0].classList.contains(this.classes.highlighted)) { options[0].classList.add(this.classes.highlighted); + const id = options[0].id; + this.setActiveDescendant(id); return; } } @@ -1139,6 +1171,7 @@ var SlimSelect = (function () { for (const o of options) { if (o.classList.contains(this.classes.selected)) { o.classList.add(this.classes.highlighted); + this.setActiveDescendant(o.id); break; } } @@ -1147,16 +1180,9 @@ var SlimSelect = (function () { if (options[i].classList.contains(this.classes.highlighted)) { const prevOption = options[i]; prevOption.classList.remove(this.classes.highlighted); - const prevParent = prevOption.parentElement; - if (prevParent && prevParent.classList.contains(this.classes.open)) { - const optgroupLabel = prevParent.querySelector('.' + this.classes.optgroupLabel); - if (optgroupLabel) { - optgroupLabel.click(); - } - } - let selectOption = options[dir === 'down' ? (i + 1 < options.length ? i + 1 : 0) : i - 1 >= 0 ? i - 1 : options.length - 1]; + const selectOption = options[dir === 'down' ? (i + 1 < options.length ? i + 1 : 0) : i - 1 >= 0 ? i - 1 : options.length - 1]; selectOption.classList.add(this.classes.highlighted); - this.content.search.input.setAttribute('aria-activedescendant', selectOption.id); + this.setActiveDescendant(selectOption.id); this.ensureElementInView(this.content.list, selectOption); const selectParent = selectOption.parentElement; if (selectParent && selectParent.classList.contains(this.classes.close)) { @@ -1170,7 +1196,7 @@ var SlimSelect = (function () { } const newly = options[dir === 'down' ? 0 : options.length - 1]; newly.classList.add(this.classes.highlighted); - this.content.search.input.setAttribute('aria-activedescendant', newly.id); + this.setActiveDescendant(newly.id); this.ensureElementInView(this.content.list, newly); } listDiv() { @@ -1411,7 +1437,7 @@ var SlimSelect = (function () { if (option.selected) { optionEl.classList.add(this.classes.selected); optionEl.setAttribute('aria-selected', 'true'); - this.content.search.input.setAttribute('aria-activedescendant', optionEl.id); + this.setActiveDescendant(optionEl.id); } else { optionEl.classList.remove(this.classes.selected); @@ -1442,8 +1468,8 @@ var SlimSelect = (function () { if (!this.settings.closeOnSelect) { if (e.shiftKey && this.lastSelectedOption) { const options = this.store.getDataOptions(); - let lastClickedOptionIndex = options.findIndex((o) => o.id === this.lastSelectedOption.id); - let currentOptionIndex = options.findIndex((o) => o.id === option.id); + const lastClickedOptionIndex = options.findIndex((o) => o.id === this.lastSelectedOption.id); + const currentOptionIndex = options.findIndex((o) => o.id === option.id); if (lastClickedOptionIndex >= 0 && currentOptionIndex >= 0) { const startIndex = Math.min(lastClickedOptionIndex, currentOptionIndex); const endIndex = Math.max(lastClickedOptionIndex, currentOptionIndex); @@ -1586,6 +1612,15 @@ var SlimSelect = (function () { deselectButton.classList.add(hideClass); } } + setActiveDescendant(id) { + if (!id) { + this.main.main.removeAttribute('aria-activedescendant'); + this.content.search.input.removeAttribute('aria-activedescendant'); + return; + } + this.main.main.setAttribute('aria-activedescendant', id); + this.content.search.input.setAttribute('aria-activedescendant', id); + } } Render._livePolite = null; Render._liveAssertive = null; diff --git a/dist/slimselect.js b/dist/slimselect.js index 0221932a..61102aec 100644 --- a/dist/slimselect.js +++ b/dist/slimselect.js @@ -391,6 +391,7 @@ const highlighted = this.content.list.querySelectorAll('.' + this.classes.highlighted); highlighted.forEach(el => el.classList.remove(this.classes.highlighted)); this.content.search.input.removeAttribute('aria-activedescendant'); + this.main.main.removeAttribute('aria-activedescendant'); } constructor(settings, classes, store, callbacks) { var _a; @@ -442,7 +443,7 @@ 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.content.search.input.setAttribute('aria-expanded', 'true'); + this.main.main.setAttribute('aria-expanded', 'true'); this.moveContent(); const selectedOptions = this.store.getSelectedOptions(); if (selectedOptions.length) { @@ -463,7 +464,8 @@ } close() { this.main.main.classList.remove(this.classes.openAbove, this.classes.openBelow); - this.content.search.input.setAttribute('aria-expanded', 'false'); + this.content.search.input.removeAttribute('aria-expanded'); + this.main.main.setAttribute('aria-expanded', 'false'); this.content.main.classList.remove(this.classes.openAbove, this.classes.openBelow); this.main.arrow.path.setAttribute('d', this.classes.arrowClose); if (this.scrollHandler) { @@ -507,18 +509,21 @@ this.content.list.setAttribute('role', 'listbox'); this.content.list.setAttribute('id', this.content.main.id + '-list'); this.content.list.setAttribute('aria-label', this.settings.contentAriaLabel); + this.main.main.setAttribute('role', 'combobox'); + this.main.main.setAttribute('aria-controls', this.content.list.id); + this.main.main.setAttribute('aria-haspopup', 'listbox'); + this.main.main.setAttribute('aria-expanded', 'false'); if (this.settings.isMultiple) { this.content.list.setAttribute('aria-multiselectable', 'true'); } this.main.main.removeAttribute('aria-labelledby'); this.main.main.removeAttribute('aria-label'); const input = this.content.search.input; - input.setAttribute('role', 'combobox'); - input.setAttribute('aria-haspopup', 'listbox'); + input.setAttribute('role', 'searchbox'); input.setAttribute('aria-controls', this.content.list.id); input.setAttribute('aria-owns', this.content.list.id); - input.setAttribute('aria-expanded', 'false'); input.setAttribute('aria-autocomplete', 'list'); + input.removeAttribute('aria-expanded'); let labelledById = (this.settings.ariaLabelledBy || '').trim(); let labelEl = null; if (!labelledById) { @@ -570,28 +575,49 @@ main.onkeydown = (e) => { if (e.target !== main) return true; + const focusAndThen = (fn) => { + this.callbacks.open(); + requestAnimationFrame(() => { + this.searchFocus(); + fn(); + }); + }; switch (e.key) { - case 'ArrowUp': case 'ArrowDown': - this.callbacks.open(); - e.key === 'ArrowDown' ? this.highlight('down') : this.highlight('up'); + e.preventDefault(); + focusAndThen(() => this.highlight('down')); + return false; + case 'ArrowUp': + e.preventDefault(); + focusAndThen(() => this.highlight('up')); return false; case 'Tab': this.callbacks.close(); return true; case 'Enter': case ' ': - this.callbacks.open(); - const highlighted = this.content.list.querySelector('.' + this.classes.highlighted); - if (highlighted) - highlighted.click(); - return false; - case 'Escape': - this.callbacks.close(); + e.preventDefault(); + focusAndThen(() => { + const highlighted = this.content.list.querySelector('.' + this.classes.highlighted); + if (highlighted) + highlighted.click(); + }); return false; } - if (e.key.length === 1) { + if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) { + e.preventDefault(); this.callbacks.open(); + requestAnimationFrame(() => { + var _a, _b; + this.searchFocus(); + const inp = this.content.search.input; + const selStart = (_a = inp.selectionStart) !== null && _a !== void 0 ? _a : inp.value.length; + const selEnd = (_b = inp.selectionEnd) !== null && _b !== void 0 ? _b : inp.value.length; + inp.value = inp.value.slice(0, selStart) + e.key + inp.value.slice(selEnd); + inp.setSelectionRange(selStart + 1, selStart + 1); + this.callbacks.search(inp.value); + }); + return false; } return true; }; @@ -706,6 +732,7 @@ const placeholder = document.createElement('div'); placeholder.classList.add(this.classes.placeholder); placeholder.innerHTML = placeholderText; + placeholder.setAttribute('aria-hidden', 'true'); return placeholder; } renderValues() { @@ -721,6 +748,7 @@ return o.selected && !o.placeholder; }, false); const selectedSingle = selected.length > 0 ? selected[0] : null; + this.main.values.removeAttribute('role'); if (!selectedSingle) { this.main.values.innerHTML = this.placeholder().outerHTML; } @@ -748,10 +776,12 @@ return opt.selected && opt.display; }, false); if (selectedOptions.length === 0) { + this.main.values.removeAttribute('role'); this.main.values.innerHTML = this.placeholder().outerHTML; return; } else { + this.main.values.setAttribute('role', 'list'); const placeholder = this.main.values.querySelector('.' + this.classes.placeholder); if (placeholder) { placeholder.remove(); @@ -1129,6 +1159,8 @@ if (options.length === 1) { if (!options[0].classList.contains(this.classes.highlighted)) { options[0].classList.add(this.classes.highlighted); + const id = options[0].id; + this.setActiveDescendant(id); return; } } @@ -1142,6 +1174,7 @@ for (const o of options) { if (o.classList.contains(this.classes.selected)) { o.classList.add(this.classes.highlighted); + this.setActiveDescendant(o.id); break; } } @@ -1150,16 +1183,9 @@ if (options[i].classList.contains(this.classes.highlighted)) { const prevOption = options[i]; prevOption.classList.remove(this.classes.highlighted); - const prevParent = prevOption.parentElement; - if (prevParent && prevParent.classList.contains(this.classes.open)) { - const optgroupLabel = prevParent.querySelector('.' + this.classes.optgroupLabel); - if (optgroupLabel) { - optgroupLabel.click(); - } - } - let selectOption = options[dir === 'down' ? (i + 1 < options.length ? i + 1 : 0) : i - 1 >= 0 ? i - 1 : options.length - 1]; + const selectOption = options[dir === 'down' ? (i + 1 < options.length ? i + 1 : 0) : i - 1 >= 0 ? i - 1 : options.length - 1]; selectOption.classList.add(this.classes.highlighted); - this.content.search.input.setAttribute('aria-activedescendant', selectOption.id); + this.setActiveDescendant(selectOption.id); this.ensureElementInView(this.content.list, selectOption); const selectParent = selectOption.parentElement; if (selectParent && selectParent.classList.contains(this.classes.close)) { @@ -1173,7 +1199,7 @@ } const newly = options[dir === 'down' ? 0 : options.length - 1]; newly.classList.add(this.classes.highlighted); - this.content.search.input.setAttribute('aria-activedescendant', newly.id); + this.setActiveDescendant(newly.id); this.ensureElementInView(this.content.list, newly); } listDiv() { @@ -1414,7 +1440,7 @@ if (option.selected) { optionEl.classList.add(this.classes.selected); optionEl.setAttribute('aria-selected', 'true'); - this.content.search.input.setAttribute('aria-activedescendant', optionEl.id); + this.setActiveDescendant(optionEl.id); } else { optionEl.classList.remove(this.classes.selected); @@ -1445,8 +1471,8 @@ if (!this.settings.closeOnSelect) { if (e.shiftKey && this.lastSelectedOption) { const options = this.store.getDataOptions(); - let lastClickedOptionIndex = options.findIndex((o) => o.id === this.lastSelectedOption.id); - let currentOptionIndex = options.findIndex((o) => o.id === option.id); + const lastClickedOptionIndex = options.findIndex((o) => o.id === this.lastSelectedOption.id); + const currentOptionIndex = options.findIndex((o) => o.id === option.id); if (lastClickedOptionIndex >= 0 && currentOptionIndex >= 0) { const startIndex = Math.min(lastClickedOptionIndex, currentOptionIndex); const endIndex = Math.max(lastClickedOptionIndex, currentOptionIndex); @@ -1589,6 +1615,15 @@ deselectButton.classList.add(hideClass); } } + setActiveDescendant(id) { + if (!id) { + this.main.main.removeAttribute('aria-activedescendant'); + this.content.search.input.removeAttribute('aria-activedescendant'); + return; + } + this.main.main.setAttribute('aria-activedescendant', id); + this.content.search.input.setAttribute('aria-activedescendant', id); + } } Render._livePolite = null; Render._liveAssertive = null; diff --git a/dist/slimselect.min.js b/dist/slimselect.min.js index 0c71a7dd..da8dea7c 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";class t{constructor(t){t||(t={}),this.main=t.main||"ss-main",this.placeholder=t.placeholder||"ss-placeholder",this.values=t.values||"ss-values",this.single=t.single||"ss-single",this.max=t.max||"ss-max",this.value=t.value||"ss-value",this.valueText=t.valueText||"ss-value-text",this.valueDelete=t.valueDelete||"ss-value-delete",this.valueOut=t.valueOut||"ss-value-out",this.deselect=t.deselect||"ss-deselect",this.deselectPath=t.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=t.arrow||"ss-arrow",this.arrowClose=t.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=t.arrowOpen||"M10,70 L50,30 L90,70",this.content=t.content||"ss-content",this.openAbove=t.openAbove||"ss-open-above",this.openBelow=t.openBelow||"ss-open-below",this.search=t.search||"ss-search",this.searchHighlighter=t.searchHighlighter||"ss-search-highlight",this.searching=t.searching||"ss-searching",this.addable=t.addable||"ss-addable",this.addablePath=t.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=t.list||"ss-list",this.optgroup=t.optgroup||"ss-optgroup",this.optgroupLabel=t.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=t.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=t.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=t.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=t.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=t.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=t.optgroupClosable||"ss-closable",this.option=t.option||"ss-option",this.optionDelete=t.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=t.highlighted||"ss-highlighted",this.open=t.open||"ss-open",this.close=t.close||"ss-close",this.selected=t.selected||"ss-selected",this.error=t.error||"ss-error",this.disabled=t.disabled||"ss-disabled",this.hide=t.hide||"ss-hide"}}function e(){return Math.random().toString(36).substring(2,10)}function s(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 i(t,e){return JSON.stringify(t)===JSON.stringify(e)}class n{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 a(e))}}class a{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.defaultSelected=void 0!==t.defaultSelected&&t.defaultSelected,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 l{constructor(t,e){this.selectType="single",this.data=[],this.selectedOrder=[],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 n||"label"in e){if(!("label"in e))return new Error("Optgroup must have a label");if("options"in e&&e.options)for(let t of e.options){const e=this.validateOption(t);if(e)return e}}else{if(!(e instanceof a||"text"in e))return new Error("Data object must be a valid optgroup or option");{const t=this.validateOption(e);if(t)return 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 n||"label"in t){let s=[];"options"in t&&t.options&&t.options.forEach((t=>{s.push(new a(t))})),s.length>0&&e.push(new n(t))}(t instanceof a||"text"in t)&&e.push(new a(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,e=!1){if(e){let e=[new a(t)];this.setData(e.concat(this.getData()))}else this.setData(this.getData().concat(new a(t)))}setSelectedBy(t,e){let s=null,i=!1;const l=[];for(let o of this.data){if(o instanceof n)for(let n of o.options)s||(s=n),n.selected=!i&&e.includes(n[t]),n.selected&&(l.push(n),"single"===this.selectType&&(i=!0));o instanceof a&&(s||(s=o),o.selected=!i&&e.includes(o[t]),o.selected&&(l.push(o),"single"===this.selectType&&(i=!0)))}"single"===this.selectType&&s&&!i&&(s.selected=!0,l.push(s));const o=e.map((e=>{var s;return(null===(s=l.find((s=>s[t]===e)))||void 0===s?void 0:s.id)||""}));this.selectedOrder=o}getSelected(){return this.getSelectedOptions().map((t=>t.id))}getSelectedValues(){return this.getSelectedOptions().map((t=>t.value))}getSelectedOptions(){return this.filter((t=>t.selected),!1)}getOptgroupByID(t){for(let e of this.data)if(e instanceof n&&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 n?t=e.options[0]:e instanceof a&&(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((i=>{if(i instanceof n){let l=[];if(i.options.forEach((i=>{t&&!t(i)||(e?l.push(new a(i)):s.push(new a(i)))})),l.length>0){let t=new n(i);t.options=l,s.push(t)}}i instanceof a&&(t&&!t(i)||s.push(new a(i)))})),s}selectedOrderOptions(t){const e=[];return this.selectedOrder.forEach((s=>{const i=t.find((t=>t.id===s));i&&e.push(i)})),t.forEach((t=>{let s=!1;e.forEach((e=>{t.id!==e.id||(s=!0)})),s||e.push(t)})),e}}class o{static getLiveAssertive(){let t=document.getElementById("ss-live-assertive");return t||(t=document.createElement("div"),t.id="ss-live-assertive",t.setAttribute("role","status"),t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true"),t.className="ss-sr-only",document.body.appendChild(t)),t}_announceAssertive(t){const e=o._liveAssertive||(o._liveAssertive=o.getLiveAssertive());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}clearHighlights(){this.content.list.querySelectorAll("."+this.classes.highlighted).forEach((t=>t.classList.remove(this.classes.highlighted))),this.content.search.input.removeAttribute("aria-activedescendant")}constructor(t,e,s,i){var n;this.store=s,this.settings=t,this.classes=e,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.main.values.setAttribute("role","list"),this.updateAriaAttributes();const a=null===(n=document.querySelector(`[data-id="${this.settings.id}"]`))||void 0===n?void 0:n.closest(".offcanvas-body");a?a.appendChild(this.content.main):this.settings.contentLocation&&this.settings.contentLocation.appendChild(this.content.main)}static getLivePolite(){let t=document.getElementById("ss-live-polite");return t||(t=document.createElement("div"),t.id="ss-live-polite",t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.className="ss-sr-only",document.body.appendChild(t)),t}_announcePolite(t){const e=o._livePolite||(o._livePolite=o.getLivePolite());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}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.content.search.input.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)}"fixed"===this.settings.contentPosition&&(this.moveContent(),this.scrollHandler=()=>this.moveContent(),this.resizeHandler=()=>this.moveContent(),window.addEventListener("scroll",this.scrollHandler,!0),window.addEventListener("resize",this.resizeHandler)),this.searchFocus()}close(){this.main.main.classList.remove(this.classes.openAbove,this.classes.openBelow),this.content.search.input.setAttribute("aria-expanded","false"),this.content.main.classList.remove(this.classes.openAbove,this.classes.openBelow),this.main.arrow.path.setAttribute("d",this.classes.arrowClose),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=void 0),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=void 0),this.clearHighlights(),this.main.main.focus({preventScroll:!0})}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.main.main.classList.add("ss-2"),this.content.main.classList.add(this.classes.content),this.content.main.classList.add("ss-content-2"),""!==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&&"fixed"!==this.settings.contentPosition||this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){var t;this.content.list.setAttribute("role","listbox"),this.content.list.setAttribute("id",this.content.main.id+"-list"),this.content.list.setAttribute("aria-label",this.settings.contentAriaLabel),this.settings.isMultiple&&this.content.list.setAttribute("aria-multiselectable","true"),this.main.main.removeAttribute("aria-labelledby"),this.main.main.removeAttribute("aria-label");const e=this.content.search.input;e.setAttribute("role","combobox"),e.setAttribute("aria-haspopup","listbox"),e.setAttribute("aria-controls",this.content.list.id),e.setAttribute("aria-owns",this.content.list.id),e.setAttribute("aria-expanded","false"),e.setAttribute("aria-autocomplete","list");let s=(this.settings.ariaLabelledBy||"").trim(),i=null;if(s)i=document.getElementById(s);else{const e=document.querySelector(`select[data-id="${this.settings.id}"]`);e&&(e.id&&(i=document.querySelector(`label[for="${e.id}"]`)),i||"LABEL"!==(null===(t=e.previousElementSibling)||void 0===t?void 0:t.tagName)||(i=e.previousElementSibling),i&&(i.id||(i.id=(e.id||this.settings.id)+"-label"),s=i.id))}s&&document.getElementById(s)?this.main.main.setAttribute("aria-labelledby",s):this.settings.ariaLabel&&this.settings.ariaLabel.trim()&&this.main.main.setAttribute("aria-label",this.settings.ariaLabel.trim()),this.content.search.input.setAttribute("aria-controls",this.content.list.id),this.content.search.input.setAttribute("aria-autocomplete","list"),s&&document.getElementById(s)?this.content.search.input.setAttribute("aria-labelledby",s):this.settings.searchLabelledBy&&document.getElementById(this.settings.searchLabelledBy)?this.content.search.input.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel?this.content.search.input.setAttribute("aria-label",this.settings.searchAriaLabel):this.content.search.input.setAttribute("aria-label","Search options")}mainDiv(){var t;const e=document.createElement("div");e.id=this.settings.id+"-main",e.tabIndex=0,e.onkeydown=t=>{if(t.target!==e)return!0;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===t.key.length&&this.callbacks.open(),!0},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),i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("aria-label",this.settings.clearAllAriaLabel),i.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),i.click())}));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"),a.setAttribute("aria-hidden","true"),a.setAttribute("focusable","false");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"),o.setAttribute("aria-hidden","true"),o.setAttribute("focusable","false");const r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&o.classList.add(this.classes.hide),o.appendChild(r),e.appendChild(o),{main:e,values:s,deselect:{main:i,svg:a,path:l},arrow:{main:o,path:r}}}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()}this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e));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 i=this.store.getSelectedOptions(),l=i.filter((e=>e.selected&&e.id!==t.id),!0);if(!(this.settings.minSelected&&l.length{this.main.main.focus({preventScroll:!0})}))}};const o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("viewBox","0 0 100 100"),o.setAttribute("aria-hidden","true"),o.setAttribute("focusable","false");const r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttribute("d",this.classes.optionDelete),o.appendChild(r),i.appendChild(o),e.appendChild(i),i.onkeydown=t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),i.click())},e.addEventListener("keydown",(t=>{"Enter"===t.key||" "===t.key?(t.preventDefault(),t.stopPropagation()):"Delete"!==t.key&&"Backspace"!==t.key||(t.preventDefault(),t.stopPropagation(),null==i||i.click())})),e.addEventListener("focusin",(()=>{e.setAttribute("aria-describedby",s),i.removeAttribute("aria-hidden"),i.tabIndex=0})),e.addEventListener("focusout",(()=>{e.removeAttribute("aria-describedby"),i.setAttribute("aria-hidden","true"),i.tabIndex=-1}))}return e}contentDiv(){const t=document.createElement("div");t.id=this.settings.id+"-content";const e=this.searchDiv();t.appendChild(e.main);const s=this.listDiv();return t.appendChild(s),{main:t,search:e,list:s}}moveContent(){"relative"!==this.settings.contentPosition&&"down"!==this.settings.openPosition?"up"!==this.settings.openPosition?"up"===this.putContent()?this.moveContentAbove():this.moveContentBelow():this.moveContentAbove():this.moveContentBelow()}searchDiv(){const t=document.createElement("div"),e=document.createElement("input"),i=document.createElement("div");t.classList.add(this.classes.search);const n={main:t,input:e};if(this.settings.showSearch||(t.classList.add(this.classes.hide),e.readOnly=!0),e.type="text",e.placeholder=this.settings.searchPlaceholder,e.tabIndex=-1,this.settings.searchLabelledBy&&this.settings.searchLabelledBy.trim()?e.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel&&this.settings.searchAriaLabel.trim()?e.setAttribute("aria-label",this.settings.searchAriaLabel):e.setAttribute("aria-label","Search options"),e.setAttribute("autocapitalize","off"),e.setAttribute("autocomplete","off"),e.setAttribute("autocorrect","off"),e.oninput=s((t=>{this.callbacks.search(t.target.value)}),100),e.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" ":const e=this.content.list.querySelector("."+this.classes.highlighted);return!e||(e.click(),!1);case"Enter":if(this.callbacks.addable)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(e),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"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false");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 a(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=>{"string"==typeof t?s({text:t,value:t}):i instanceof Error?this.renderError(i.message):s(t)})):"string"==typeof i?s({text:i,value:i}):i instanceof Error?this.renderError(i.message):s(i))},t.appendChild(i),n.addable={main:i,svg:e,path:s}}return n}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.content.search.input.setAttribute("aria-activedescendant",a.id),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}const i=e["down"===t?0:e.length-1];i.classList.add(this.classes.highlighted),this.content.search.input.setAttribute("aria-activedescendant",i.id),this.ensureElementInView(this.content.list,i)}listDiv(){const t=document.createElement("div");return t.classList.add(this.classes.list),t}renderError(t){this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy");const e=document.createElement("div");e.classList.add(this.classes.error),e.textContent=t,this.content.list.appendChild(e),this._announceAssertive(t)}renderSearching(){this.content.list.innerHTML="",this.content.list.setAttribute("aria-busy","true");const t=document.createElement("div");t.classList.add(this.classes.searching),t.textContent=this.settings.searchingText,this.content.list.appendChild(t),this._announcePolite(this.settings.searchingText)}renderOptions(t){if(this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy"),0===t.length){const t=document.createElement("div");t.classList.add(this.classes.search);const e=this.callbacks.addable?this.settings.addableText.replace("{value}",this.content.search.input.value):this.settings.searchText;return this._announcePolite(e),t.innerHTML=e,this.content.list.appendChild(t),void this.content.list.setAttribute("aria-setsize","0")}if(this.settings.allowDeselect&&!this.settings.isMultiple){this.store.filter((t=>t.placeholder),!1).length||this.store.addOption(new a({text:"",value:"",selected:!1,placeholder:!0}),!0)}const e=document.createDocumentFragment();let s=0;const i=t.filter((t=>t instanceof a&&!t.placeholder&&t.display&&!t.disabled)).length,l=t=>{t.classList.contains(this.classes.placeholder)||t.classList.contains(this.classes.disabled)||t.classList.contains(this.classes.hide)||(t.setAttribute("aria-posinset",String(++s)),t.setAttribute("aria-setsize",String(i)))};for(const s of t){if(s instanceof n){const t=document.createElement("div");t.classList.add(this.classes.optgroup),t.setAttribute("role","group"),t.setAttribute("aria-label",s.label);const i=document.createElement("div");i.classList.add(this.classes.optgroupLabel),t.appendChild(i);const n=document.createElement("div");n.classList.add(this.classes.optgroupLabelText),n.textContent=s.label,i.appendChild(n);const a=document.createElement("div");if(a.classList.add(this.classes.optgroupActions),i.appendChild(a),this.settings.isMultiple&&s.selectAll){const t=document.createElement("div");t.classList.add(this.classes.optgroupSelectAll);let e=!0;for(const t of s.options)if(!t.selected){e=!1;break}e&&t.classList.add(this.classes.selected);const i=document.createElement("span");i.textContent=s.selectAllText,t.appendChild(i);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),t.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.optgroupSelectAllBox),n.appendChild(l);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.optgroupSelectAllCheck),n.appendChild(o),t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const i=this.store.getSelected();if(e){const t=i.filter((t=>{for(const e of s.options)if(t===e.id)return!1;return!0}));this.callbacks.setSelected(t,!0)}else{const t=i.concat(s.options.map((t=>t.id)));for(const t of s.options)this.store.getOptionByID(t.id)||this.callbacks.addOption(t);this.callbacks.setSelected(t,!0)}})),a.appendChild(t)}if("off"!==s.closable){const e=document.createElement("div");e.classList.add(this.classes.optgroupClosable);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.classList.add(this.classes.arrow),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),e.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","path");n.appendChild(l),s.options.some((t=>t.selected))||""!==this.content.search.input.value.trim()||"open"===s.closable?(t.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"close"===s.closable&&(t.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose)),i.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))})),a.appendChild(e)}t.appendChild(i);for(const e of s.options){const s=this.option(e);l(s),t.appendChild(s)}e.appendChild(t)}if(s instanceof a){const t=this.option(s);l(t),e.appendChild(t)}}this.content.list.appendChild(e),this.content.list.removeAttribute("aria-busy");const o=this.getOptions(!0,!0,!0).length;this._announcePolite(`${o} option${1===o?"":"s"} available`)}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=`${this.settings.id}__opt__${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),e.setAttribute("aria-disabled","true")),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.content.search.input.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=[];if(this.settings.isMultiple)if(t.selected)o=l.filter((t=>t.id!==n));else if(o=l.concat(t),!this.settings.closeOnSelect)if(e.shiftKey&&this.lastSelectedOption){const e=this.store.getDataOptions();let s=e.findIndex((t=>t.id===this.lastSelectedOption.id)),i=e.findIndex((e=>e.id===t.id));if(s>=0&&i>=0){const t=Math.min(s,i),n=Math.max(s,i),a=e.slice(t,n+1);a.length>0&&a.length!l.find((e=>e.id===t.id))))))}}else t.selected||(this.lastSelectedOption=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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=s.left+("fixed"===this.settings.contentPosition?0: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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=t.left+("fixed"===this.settings.contentPosition?0: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)}}o._livePolite=null,o._liveAssertive=null;class r{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){if(n.target===this.select&&("disabled"===n.attributeName&&(s=!0),"class"===n.attributeName&&(e=!0),"childList"===n.type)){for(const t of n.addedNodes)if("OPTION"===t.nodeName&&t.value===this.select.value){this.select.dispatchEvent(new Event("change"));break}i=!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:"",defaultSelected:t.defaultSelected,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)}setSelectedByValue(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.value)}}if("OPTION"===s.nodeName){const e=s;e.selected=t.includes(e.value)}}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 n&&this.select.appendChild(this.createOptgroup(e)),e instanceof a&&this.select.appendChild(this.createOption(e));this.select.dispatchEvent(new Event("change",{bubbles:!0})),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.textContent=t.text,""!==t.html&&e.setAttribute("data-html",t.html),e.defaultSelected=t.defaultSelected,e.selected=t.selected,t.disabled&&(e.disabled=!0),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(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.focusSearch=void 0===t.focusSearch||t.focusSearch,this.ariaLabel=t.ariaLabel||"",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.contentAriaLabel=void 0!==t.contentAriaLabel?t.contentAriaLabel:"Select an option",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",this.addableText=t.addableText||'Press "Enter" to add {value}',this.ariaLabelledBy=t.ariaLabelledBy||"",this.searchAriaLabel=t.searchAriaLabel||"Search options",this.searchLabelledBy=t.searchLabelledBy||"",this.clearAllAriaLabel=t.clearAllAriaLabel||"Clear selection"}}return class{constructor(e){var i;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=s((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.windowScroll=s((()=>{(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 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),this.cssClasses=new t(e.cssClasses);const n=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const t in e.events)e.events.hasOwnProperty(t)&&(-1!==n.indexOf(t)?this.events[t]=s(e.events[t],100):this.events[t]=e.events[t]);this.settings.disabled=(null===(i=e.settings)||void 0===i?void 0:i.disabled)?e.settings.disabled:this.selectEl.disabled,this.settings.isMultiple=this.selectEl.multiple,this.settings.style=this.selectEl.style.cssText,this.settings.class=this.selectEl.className.split(" "),this.select=new r(this.selectEl),this.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 l(this.settings.isMultiple?"multiple":"single",e.data?e.data:this.select.getData()),e.data&&this.select.updateOptions(this.store.getData());const a={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 o(this.settings,this.cssClasses,this.store,a),this.render.renderValues(),this.render.renderOptions(this.store.getData());const h=this.selectEl.getAttribute("aria-label"),d=this.selectEl.getAttribute("aria-labelledby");h?this.render.main.main.setAttribute("aria-label",h):d&&this.render.main.main.setAttribute("aria-labelledby",d),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(),s=this.store.validateDataArray(t);if(s)return void(this.events.error&&this.events.error(s));this.store.setData(t);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!i(e,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let t=this.store.getSelectedOptions();return this.settings.keepOrder&&(t=this.store.selectedOrderOptions(t)),t.map((t=>t.value))}setSelected(t,e=!0){const s=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&&!i(s,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 s=this.store.getData();this.select.updateOptions(s),this.render.renderValues(),this.render.renderOptions(s),this.events.afterChange&&!i(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.settings.focusSearch&&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";class t{constructor(t){t||(t={}),this.main=t.main||"ss-main",this.placeholder=t.placeholder||"ss-placeholder",this.values=t.values||"ss-values",this.single=t.single||"ss-single",this.max=t.max||"ss-max",this.value=t.value||"ss-value",this.valueText=t.valueText||"ss-value-text",this.valueDelete=t.valueDelete||"ss-value-delete",this.valueOut=t.valueOut||"ss-value-out",this.deselect=t.deselect||"ss-deselect",this.deselectPath=t.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=t.arrow||"ss-arrow",this.arrowClose=t.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=t.arrowOpen||"M10,70 L50,30 L90,70",this.content=t.content||"ss-content",this.openAbove=t.openAbove||"ss-open-above",this.openBelow=t.openBelow||"ss-open-below",this.search=t.search||"ss-search",this.searchHighlighter=t.searchHighlighter||"ss-search-highlight",this.searching=t.searching||"ss-searching",this.addable=t.addable||"ss-addable",this.addablePath=t.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=t.list||"ss-list",this.optgroup=t.optgroup||"ss-optgroup",this.optgroupLabel=t.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=t.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=t.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=t.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=t.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=t.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=t.optgroupClosable||"ss-closable",this.option=t.option||"ss-option",this.optionDelete=t.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=t.highlighted||"ss-highlighted",this.open=t.open||"ss-open",this.close=t.close||"ss-close",this.selected=t.selected||"ss-selected",this.error=t.error||"ss-error",this.disabled=t.disabled||"ss-disabled",this.hide=t.hide||"ss-hide"}}function e(){return Math.random().toString(36).substring(2,10)}function s(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 i(t,e){return JSON.stringify(t)===JSON.stringify(e)}class n{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 a(e))}}class a{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.defaultSelected=void 0!==t.defaultSelected&&t.defaultSelected,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 l{constructor(t,e){this.selectType="single",this.data=[],this.selectedOrder=[],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 n||"label"in e){if(!("label"in e))return new Error("Optgroup must have a label");if("options"in e&&e.options)for(let t of e.options){const e=this.validateOption(t);if(e)return e}}else{if(!(e instanceof a||"text"in e))return new Error("Data object must be a valid optgroup or option");{const t=this.validateOption(e);if(t)return 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 n||"label"in t){let s=[];"options"in t&&t.options&&t.options.forEach((t=>{s.push(new a(t))})),s.length>0&&e.push(new n(t))}(t instanceof a||"text"in t)&&e.push(new a(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,e=!1){if(e){let e=[new a(t)];this.setData(e.concat(this.getData()))}else this.setData(this.getData().concat(new a(t)))}setSelectedBy(t,e){let s=null,i=!1;const l=[];for(let o of this.data){if(o instanceof n)for(let n of o.options)s||(s=n),n.selected=!i&&e.includes(n[t]),n.selected&&(l.push(n),"single"===this.selectType&&(i=!0));o instanceof a&&(s||(s=o),o.selected=!i&&e.includes(o[t]),o.selected&&(l.push(o),"single"===this.selectType&&(i=!0)))}"single"===this.selectType&&s&&!i&&(s.selected=!0,l.push(s));const o=e.map((e=>{var s;return(null===(s=l.find((s=>s[t]===e)))||void 0===s?void 0:s.id)||""}));this.selectedOrder=o}getSelected(){return this.getSelectedOptions().map((t=>t.id))}getSelectedValues(){return this.getSelectedOptions().map((t=>t.value))}getSelectedOptions(){return this.filter((t=>t.selected),!1)}getOptgroupByID(t){for(let e of this.data)if(e instanceof n&&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 n?t=e.options[0]:e instanceof a&&(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((i=>{if(i instanceof n){let l=[];if(i.options.forEach((i=>{t&&!t(i)||(e?l.push(new a(i)):s.push(new a(i)))})),l.length>0){let t=new n(i);t.options=l,s.push(t)}}i instanceof a&&(t&&!t(i)||s.push(new a(i)))})),s}selectedOrderOptions(t){const e=[];return this.selectedOrder.forEach((s=>{const i=t.find((t=>t.id===s));i&&e.push(i)})),t.forEach((t=>{let s=!1;e.forEach((e=>{t.id!==e.id||(s=!0)})),s||e.push(t)})),e}}class o{static getLiveAssertive(){let t=document.getElementById("ss-live-assertive");return t||(t=document.createElement("div"),t.id="ss-live-assertive",t.setAttribute("role","status"),t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true"),t.className="ss-sr-only",document.body.appendChild(t)),t}_announceAssertive(t){const e=o._liveAssertive||(o._liveAssertive=o.getLiveAssertive());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}clearHighlights(){this.content.list.querySelectorAll("."+this.classes.highlighted).forEach((t=>t.classList.remove(this.classes.highlighted))),this.content.search.input.removeAttribute("aria-activedescendant"),this.main.main.removeAttribute("aria-activedescendant")}constructor(t,e,s,i){var n;this.store=s,this.settings=t,this.classes=e,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.main.values.setAttribute("role","list"),this.updateAriaAttributes();const a=null===(n=document.querySelector(`[data-id="${this.settings.id}"]`))||void 0===n?void 0:n.closest(".offcanvas-body");a?a.appendChild(this.content.main):this.settings.contentLocation&&this.settings.contentLocation.appendChild(this.content.main)}static getLivePolite(){let t=document.getElementById("ss-live-polite");return t||(t=document.createElement("div"),t.id="ss-live-polite",t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.className="ss-sr-only",document.body.appendChild(t)),t}_announcePolite(t){const e=o._livePolite||(o._livePolite=o.getLivePolite());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}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)}"fixed"===this.settings.contentPosition&&(this.moveContent(),this.scrollHandler=()=>this.moveContent(),this.resizeHandler=()=>this.moveContent(),window.addEventListener("scroll",this.scrollHandler,!0),window.addEventListener("resize",this.resizeHandler)),this.searchFocus()}close(){this.main.main.classList.remove(this.classes.openAbove,this.classes.openBelow),this.content.search.input.removeAttribute("aria-expanded"),this.main.main.setAttribute("aria-expanded","false"),this.content.main.classList.remove(this.classes.openAbove,this.classes.openBelow),this.main.arrow.path.setAttribute("d",this.classes.arrowClose),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=void 0),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=void 0),this.clearHighlights(),this.main.main.focus({preventScroll:!0})}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.main.main.classList.add("ss-2"),this.content.main.classList.add(this.classes.content),this.content.main.classList.add("ss-content-2"),""!==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&&"fixed"!==this.settings.contentPosition||this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){var t;this.content.list.setAttribute("role","listbox"),this.content.list.setAttribute("id",this.content.main.id+"-list"),this.content.list.setAttribute("aria-label",this.settings.contentAriaLabel),this.main.main.setAttribute("role","combobox"),this.main.main.setAttribute("aria-controls",this.content.list.id),this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-expanded","false"),this.settings.isMultiple&&this.content.list.setAttribute("aria-multiselectable","true"),this.main.main.removeAttribute("aria-labelledby"),this.main.main.removeAttribute("aria-label");const e=this.content.search.input;e.setAttribute("role","searchbox"),e.setAttribute("aria-controls",this.content.list.id),e.setAttribute("aria-owns",this.content.list.id),e.setAttribute("aria-autocomplete","list"),e.removeAttribute("aria-expanded");let s=(this.settings.ariaLabelledBy||"").trim(),i=null;if(s)i=document.getElementById(s);else{const e=document.querySelector(`select[data-id="${this.settings.id}"]`);e&&(e.id&&(i=document.querySelector(`label[for="${e.id}"]`)),i||"LABEL"!==(null===(t=e.previousElementSibling)||void 0===t?void 0:t.tagName)||(i=e.previousElementSibling),i&&(i.id||(i.id=(e.id||this.settings.id)+"-label"),s=i.id))}s&&document.getElementById(s)?this.main.main.setAttribute("aria-labelledby",s):this.settings.ariaLabel&&this.settings.ariaLabel.trim()&&this.main.main.setAttribute("aria-label",this.settings.ariaLabel.trim()),this.content.search.input.setAttribute("aria-controls",this.content.list.id),this.content.search.input.setAttribute("aria-autocomplete","list"),s&&document.getElementById(s)?this.content.search.input.setAttribute("aria-labelledby",s):this.settings.searchLabelledBy&&document.getElementById(this.settings.searchLabelledBy)?this.content.search.input.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel?this.content.search.input.setAttribute("aria-label",this.settings.searchAriaLabel):this.content.search.input.setAttribute("aria-label","Search options")}mainDiv(){var t;const e=document.createElement("div");e.id=this.settings.id+"-main",e.tabIndex=0,e.onkeydown=t=>{if(t.target!==e)return!0;const s=t=>{this.callbacks.open(),requestAnimationFrame((()=>{this.searchFocus(),t()}))};switch(t.key){case"ArrowDown":return t.preventDefault(),s((()=>this.highlight("down"))),!1;case"ArrowUp":return t.preventDefault(),s((()=>this.highlight("up"))),!1;case"Tab":return this.callbacks.close(),!0;case"Enter":case" ":return t.preventDefault(),s((()=>{const t=this.content.list.querySelector("."+this.classes.highlighted);t&&t.click()})),!1}return!!(1!==t.key.length||t.ctrlKey||t.metaKey||t.altKey)||(t.preventDefault(),this.callbacks.open(),requestAnimationFrame((()=>{var e,s;this.searchFocus();const i=this.content.search.input,n=null!==(e=i.selectionStart)&&void 0!==e?e:i.value.length,a=null!==(s=i.selectionEnd)&&void 0!==s?s:i.value.length;i.value=i.value.slice(0,n)+t.key+i.value.slice(a),i.setSelectionRange(n+1,n+1),this.callbacks.search(i.value)})),!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),i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("aria-label",this.settings.clearAllAriaLabel),i.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),i.click())}));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"),a.setAttribute("aria-hidden","true"),a.setAttribute("focusable","false");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"),o.setAttribute("aria-hidden","true"),o.setAttribute("focusable","false");const r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&o.classList.add(this.classes.hide),o.appendChild(r),e.appendChild(o),{main:e,values:s,deselect:{main:i,svg:a,path:l},arrow:{main:o,path:r}}}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.setAttribute("aria-hidden","true"),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(this.main.values.removeAttribute("role"),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 this.main.values.removeAttribute("role"),void(this.main.values.innerHTML=this.placeholder().outerHTML);{this.main.values.setAttribute("role","list");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()}this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e));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 i=this.store.getSelectedOptions(),l=i.filter((e=>e.selected&&e.id!==t.id),!0);if(!(this.settings.minSelected&&l.length{this.main.main.focus({preventScroll:!0})}))}};const o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("viewBox","0 0 100 100"),o.setAttribute("aria-hidden","true"),o.setAttribute("focusable","false");const r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttribute("d",this.classes.optionDelete),o.appendChild(r),i.appendChild(o),e.appendChild(i),i.onkeydown=t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),i.click())},e.addEventListener("keydown",(t=>{"Enter"===t.key||" "===t.key?(t.preventDefault(),t.stopPropagation()):"Delete"!==t.key&&"Backspace"!==t.key||(t.preventDefault(),t.stopPropagation(),null==i||i.click())})),e.addEventListener("focusin",(()=>{e.setAttribute("aria-describedby",s),i.removeAttribute("aria-hidden"),i.tabIndex=0})),e.addEventListener("focusout",(()=>{e.removeAttribute("aria-describedby"),i.setAttribute("aria-hidden","true"),i.tabIndex=-1}))}return e}contentDiv(){const t=document.createElement("div");t.id=this.settings.id+"-content";const e=this.searchDiv();t.appendChild(e.main);const s=this.listDiv();return t.appendChild(s),{main:t,search:e,list:s}}moveContent(){"relative"!==this.settings.contentPosition&&"down"!==this.settings.openPosition?"up"!==this.settings.openPosition?"up"===this.putContent()?this.moveContentAbove():this.moveContentBelow():this.moveContentAbove():this.moveContentBelow()}searchDiv(){const t=document.createElement("div"),e=document.createElement("input"),i=document.createElement("div");t.classList.add(this.classes.search);const n={main:t,input:e};if(this.settings.showSearch||(t.classList.add(this.classes.hide),e.readOnly=!0),e.type="text",e.placeholder=this.settings.searchPlaceholder,e.tabIndex=-1,this.settings.searchLabelledBy&&this.settings.searchLabelledBy.trim()?e.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel&&this.settings.searchAriaLabel.trim()?e.setAttribute("aria-label",this.settings.searchAriaLabel):e.setAttribute("aria-label","Search options"),e.setAttribute("autocapitalize","off"),e.setAttribute("autocomplete","off"),e.setAttribute("autocorrect","off"),e.oninput=s((t=>{this.callbacks.search(t.target.value)}),100),e.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" ":const e=this.content.list.querySelector("."+this.classes.highlighted);return!e||(e.click(),!1);case"Enter":if(this.callbacks.addable)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(e),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"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false");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 a(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=>{"string"==typeof t?s({text:t,value:t}):i instanceof Error?this.renderError(i.message):s(t)})):"string"==typeof i?s({text:i,value:i}):i instanceof Error?this.renderError(i.message):s(i))},t.appendChild(i),n.addable={main:i,svg:e,path:s}}return n}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)){e[0].classList.add(this.classes.highlighted);const t=e[0].id;return void this.setActiveDescendant(t)}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),this.setActiveDescendant(t.id);break}for(let s=0;s=0?s-1:e.length-1];i.classList.add(this.classes.highlighted),this.setActiveDescendant(i.id),this.ensureElementInView(this.content.list,i);const n=i.parentElement;if(n&&n.classList.contains(this.classes.close)){const t=n.querySelector("."+this.classes.optgroupLabel);t&&t.click()}return}const i=e["down"===t?0:e.length-1];i.classList.add(this.classes.highlighted),this.setActiveDescendant(i.id),this.ensureElementInView(this.content.list,i)}listDiv(){const t=document.createElement("div");return t.classList.add(this.classes.list),t}renderError(t){this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy");const e=document.createElement("div");e.classList.add(this.classes.error),e.textContent=t,this.content.list.appendChild(e),this._announceAssertive(t)}renderSearching(){this.content.list.innerHTML="",this.content.list.setAttribute("aria-busy","true");const t=document.createElement("div");t.classList.add(this.classes.searching),t.textContent=this.settings.searchingText,this.content.list.appendChild(t),this._announcePolite(this.settings.searchingText)}renderOptions(t){if(this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy"),0===t.length){const t=document.createElement("div");t.classList.add(this.classes.search);const e=this.callbacks.addable?this.settings.addableText.replace("{value}",this.content.search.input.value):this.settings.searchText;return this._announcePolite(e),t.innerHTML=e,this.content.list.appendChild(t),void this.content.list.setAttribute("aria-setsize","0")}if(this.settings.allowDeselect&&!this.settings.isMultiple){this.store.filter((t=>t.placeholder),!1).length||this.store.addOption(new a({text:"",value:"",selected:!1,placeholder:!0}),!0)}const e=document.createDocumentFragment();let s=0;const i=t.filter((t=>t instanceof a&&!t.placeholder&&t.display&&!t.disabled)).length,l=t=>{t.classList.contains(this.classes.placeholder)||t.classList.contains(this.classes.disabled)||t.classList.contains(this.classes.hide)||(t.setAttribute("aria-posinset",String(++s)),t.setAttribute("aria-setsize",String(i)))};for(const s of t){if(s instanceof n){const t=document.createElement("div");t.classList.add(this.classes.optgroup),t.setAttribute("role","group"),t.setAttribute("aria-label",s.label);const i=document.createElement("div");i.classList.add(this.classes.optgroupLabel),t.appendChild(i);const n=document.createElement("div");n.classList.add(this.classes.optgroupLabelText),n.textContent=s.label,i.appendChild(n);const a=document.createElement("div");if(a.classList.add(this.classes.optgroupActions),i.appendChild(a),this.settings.isMultiple&&s.selectAll){const t=document.createElement("div");t.classList.add(this.classes.optgroupSelectAll);let e=!0;for(const t of s.options)if(!t.selected){e=!1;break}e&&t.classList.add(this.classes.selected);const i=document.createElement("span");i.textContent=s.selectAllText,t.appendChild(i);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),t.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.optgroupSelectAllBox),n.appendChild(l);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.optgroupSelectAllCheck),n.appendChild(o),t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const i=this.store.getSelected();if(e){const t=i.filter((t=>{for(const e of s.options)if(t===e.id)return!1;return!0}));this.callbacks.setSelected(t,!0)}else{const t=i.concat(s.options.map((t=>t.id)));for(const t of s.options)this.store.getOptionByID(t.id)||this.callbacks.addOption(t);this.callbacks.setSelected(t,!0)}})),a.appendChild(t)}if("off"!==s.closable){const e=document.createElement("div");e.classList.add(this.classes.optgroupClosable);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.classList.add(this.classes.arrow),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),e.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","path");n.appendChild(l),s.options.some((t=>t.selected))||""!==this.content.search.input.value.trim()||"open"===s.closable?(t.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"close"===s.closable&&(t.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose)),i.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))})),a.appendChild(e)}t.appendChild(i);for(const e of s.options){const s=this.option(e);l(s),t.appendChild(s)}e.appendChild(t)}if(s instanceof a){const t=this.option(s);l(t),e.appendChild(t)}}this.content.list.appendChild(e),this.content.list.removeAttribute("aria-busy");const o=this.getOptions(!0,!0,!0).length;this._announcePolite(`${o} option${1===o?"":"s"} available`)}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=`${this.settings.id}__opt__${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),e.setAttribute("aria-disabled","true")),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.setActiveDescendant(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=[];if(this.settings.isMultiple)if(t.selected)o=l.filter((t=>t.id!==n));else if(o=l.concat(t),!this.settings.closeOnSelect)if(e.shiftKey&&this.lastSelectedOption){const e=this.store.getDataOptions(),s=e.findIndex((t=>t.id===this.lastSelectedOption.id)),i=e.findIndex((e=>e.id===t.id));if(s>=0&&i>=0){const t=Math.min(s,i),n=Math.max(s,i),a=e.slice(t,n+1);a.length>0&&a.length!l.find((e=>e.id===t.id))))))}}else t.selected||(this.lastSelectedOption=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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=s.left+("fixed"===this.settings.contentPosition?0: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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=t.left+("fixed"===this.settings.contentPosition?0: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)}setActiveDescendant(t){if(!t)return this.main.main.removeAttribute("aria-activedescendant"),void this.content.search.input.removeAttribute("aria-activedescendant");this.main.main.setAttribute("aria-activedescendant",t),this.content.search.input.setAttribute("aria-activedescendant",t)}}o._livePolite=null,o._liveAssertive=null;class r{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){if(n.target===this.select&&("disabled"===n.attributeName&&(s=!0),"class"===n.attributeName&&(e=!0),"childList"===n.type)){for(const t of n.addedNodes)if("OPTION"===t.nodeName&&t.value===this.select.value){this.select.dispatchEvent(new Event("change"));break}i=!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:"",defaultSelected:t.defaultSelected,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)}setSelectedByValue(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.value)}}if("OPTION"===s.nodeName){const e=s;e.selected=t.includes(e.value)}}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 n&&this.select.appendChild(this.createOptgroup(e)),e instanceof a&&this.select.appendChild(this.createOption(e));this.select.dispatchEvent(new Event("change",{bubbles:!0})),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.textContent=t.text,""!==t.html&&e.setAttribute("data-html",t.html),e.defaultSelected=t.defaultSelected,e.selected=t.selected,t.disabled&&(e.disabled=!0),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(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.focusSearch=void 0===t.focusSearch||t.focusSearch,this.ariaLabel=t.ariaLabel||"",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.contentAriaLabel=void 0!==t.contentAriaLabel?t.contentAriaLabel:"Select an option",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",this.addableText=t.addableText||'Press "Enter" to add {value}',this.ariaLabelledBy=t.ariaLabelledBy||"",this.searchAriaLabel=t.searchAriaLabel||"Search options",this.searchLabelledBy=t.searchLabelledBy||"",this.clearAllAriaLabel=t.clearAllAriaLabel||"Clear selection"}}return class{constructor(e){var i;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=s((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.windowScroll=s((()=>{(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 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),this.cssClasses=new t(e.cssClasses);const n=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const t in e.events)e.events.hasOwnProperty(t)&&(-1!==n.indexOf(t)?this.events[t]=s(e.events[t],100):this.events[t]=e.events[t]);this.settings.disabled=(null===(i=e.settings)||void 0===i?void 0:i.disabled)?e.settings.disabled:this.selectEl.disabled,this.settings.isMultiple=this.selectEl.multiple,this.settings.style=this.selectEl.style.cssText,this.settings.class=this.selectEl.className.split(" "),this.select=new r(this.selectEl),this.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 l(this.settings.isMultiple?"multiple":"single",e.data?e.data:this.select.getData()),e.data&&this.select.updateOptions(this.store.getData());const a={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 o(this.settings,this.cssClasses,this.store,a),this.render.renderValues(),this.render.renderOptions(this.store.getData());const h=this.selectEl.getAttribute("aria-label"),d=this.selectEl.getAttribute("aria-labelledby");h?this.render.main.main.setAttribute("aria-label",h):d&&this.render.main.main.setAttribute("aria-labelledby",d),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(),s=this.store.validateDataArray(t);if(s)return void(this.events.error&&this.events.error(s));this.store.setData(t);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!i(e,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let t=this.store.getSelectedOptions();return this.settings.keepOrder&&(t=this.store.selectedOrderOptions(t)),t.map((t=>t.value))}setSelected(t,e=!0){const s=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&&!i(s,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 s=this.store.getData();this.select.updateOptions(s),this.render.renderValues(),this.render.renderOptions(s),this.events.afterChange&&!i(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.settings.focusSearch&&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 0221932a..61102aec 100644 --- a/dist/slimselect.umd.js +++ b/dist/slimselect.umd.js @@ -391,6 +391,7 @@ const highlighted = this.content.list.querySelectorAll('.' + this.classes.highlighted); highlighted.forEach(el => el.classList.remove(this.classes.highlighted)); this.content.search.input.removeAttribute('aria-activedescendant'); + this.main.main.removeAttribute('aria-activedescendant'); } constructor(settings, classes, store, callbacks) { var _a; @@ -442,7 +443,7 @@ 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.content.search.input.setAttribute('aria-expanded', 'true'); + this.main.main.setAttribute('aria-expanded', 'true'); this.moveContent(); const selectedOptions = this.store.getSelectedOptions(); if (selectedOptions.length) { @@ -463,7 +464,8 @@ } close() { this.main.main.classList.remove(this.classes.openAbove, this.classes.openBelow); - this.content.search.input.setAttribute('aria-expanded', 'false'); + this.content.search.input.removeAttribute('aria-expanded'); + this.main.main.setAttribute('aria-expanded', 'false'); this.content.main.classList.remove(this.classes.openAbove, this.classes.openBelow); this.main.arrow.path.setAttribute('d', this.classes.arrowClose); if (this.scrollHandler) { @@ -507,18 +509,21 @@ this.content.list.setAttribute('role', 'listbox'); this.content.list.setAttribute('id', this.content.main.id + '-list'); this.content.list.setAttribute('aria-label', this.settings.contentAriaLabel); + this.main.main.setAttribute('role', 'combobox'); + this.main.main.setAttribute('aria-controls', this.content.list.id); + this.main.main.setAttribute('aria-haspopup', 'listbox'); + this.main.main.setAttribute('aria-expanded', 'false'); if (this.settings.isMultiple) { this.content.list.setAttribute('aria-multiselectable', 'true'); } this.main.main.removeAttribute('aria-labelledby'); this.main.main.removeAttribute('aria-label'); const input = this.content.search.input; - input.setAttribute('role', 'combobox'); - input.setAttribute('aria-haspopup', 'listbox'); + input.setAttribute('role', 'searchbox'); input.setAttribute('aria-controls', this.content.list.id); input.setAttribute('aria-owns', this.content.list.id); - input.setAttribute('aria-expanded', 'false'); input.setAttribute('aria-autocomplete', 'list'); + input.removeAttribute('aria-expanded'); let labelledById = (this.settings.ariaLabelledBy || '').trim(); let labelEl = null; if (!labelledById) { @@ -570,28 +575,49 @@ main.onkeydown = (e) => { if (e.target !== main) return true; + const focusAndThen = (fn) => { + this.callbacks.open(); + requestAnimationFrame(() => { + this.searchFocus(); + fn(); + }); + }; switch (e.key) { - case 'ArrowUp': case 'ArrowDown': - this.callbacks.open(); - e.key === 'ArrowDown' ? this.highlight('down') : this.highlight('up'); + e.preventDefault(); + focusAndThen(() => this.highlight('down')); + return false; + case 'ArrowUp': + e.preventDefault(); + focusAndThen(() => this.highlight('up')); return false; case 'Tab': this.callbacks.close(); return true; case 'Enter': case ' ': - this.callbacks.open(); - const highlighted = this.content.list.querySelector('.' + this.classes.highlighted); - if (highlighted) - highlighted.click(); - return false; - case 'Escape': - this.callbacks.close(); + e.preventDefault(); + focusAndThen(() => { + const highlighted = this.content.list.querySelector('.' + this.classes.highlighted); + if (highlighted) + highlighted.click(); + }); return false; } - if (e.key.length === 1) { + if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) { + e.preventDefault(); this.callbacks.open(); + requestAnimationFrame(() => { + var _a, _b; + this.searchFocus(); + const inp = this.content.search.input; + const selStart = (_a = inp.selectionStart) !== null && _a !== void 0 ? _a : inp.value.length; + const selEnd = (_b = inp.selectionEnd) !== null && _b !== void 0 ? _b : inp.value.length; + inp.value = inp.value.slice(0, selStart) + e.key + inp.value.slice(selEnd); + inp.setSelectionRange(selStart + 1, selStart + 1); + this.callbacks.search(inp.value); + }); + return false; } return true; }; @@ -706,6 +732,7 @@ const placeholder = document.createElement('div'); placeholder.classList.add(this.classes.placeholder); placeholder.innerHTML = placeholderText; + placeholder.setAttribute('aria-hidden', 'true'); return placeholder; } renderValues() { @@ -721,6 +748,7 @@ return o.selected && !o.placeholder; }, false); const selectedSingle = selected.length > 0 ? selected[0] : null; + this.main.values.removeAttribute('role'); if (!selectedSingle) { this.main.values.innerHTML = this.placeholder().outerHTML; } @@ -748,10 +776,12 @@ return opt.selected && opt.display; }, false); if (selectedOptions.length === 0) { + this.main.values.removeAttribute('role'); this.main.values.innerHTML = this.placeholder().outerHTML; return; } else { + this.main.values.setAttribute('role', 'list'); const placeholder = this.main.values.querySelector('.' + this.classes.placeholder); if (placeholder) { placeholder.remove(); @@ -1129,6 +1159,8 @@ if (options.length === 1) { if (!options[0].classList.contains(this.classes.highlighted)) { options[0].classList.add(this.classes.highlighted); + const id = options[0].id; + this.setActiveDescendant(id); return; } } @@ -1142,6 +1174,7 @@ for (const o of options) { if (o.classList.contains(this.classes.selected)) { o.classList.add(this.classes.highlighted); + this.setActiveDescendant(o.id); break; } } @@ -1150,16 +1183,9 @@ if (options[i].classList.contains(this.classes.highlighted)) { const prevOption = options[i]; prevOption.classList.remove(this.classes.highlighted); - const prevParent = prevOption.parentElement; - if (prevParent && prevParent.classList.contains(this.classes.open)) { - const optgroupLabel = prevParent.querySelector('.' + this.classes.optgroupLabel); - if (optgroupLabel) { - optgroupLabel.click(); - } - } - let selectOption = options[dir === 'down' ? (i + 1 < options.length ? i + 1 : 0) : i - 1 >= 0 ? i - 1 : options.length - 1]; + const selectOption = options[dir === 'down' ? (i + 1 < options.length ? i + 1 : 0) : i - 1 >= 0 ? i - 1 : options.length - 1]; selectOption.classList.add(this.classes.highlighted); - this.content.search.input.setAttribute('aria-activedescendant', selectOption.id); + this.setActiveDescendant(selectOption.id); this.ensureElementInView(this.content.list, selectOption); const selectParent = selectOption.parentElement; if (selectParent && selectParent.classList.contains(this.classes.close)) { @@ -1173,7 +1199,7 @@ } const newly = options[dir === 'down' ? 0 : options.length - 1]; newly.classList.add(this.classes.highlighted); - this.content.search.input.setAttribute('aria-activedescendant', newly.id); + this.setActiveDescendant(newly.id); this.ensureElementInView(this.content.list, newly); } listDiv() { @@ -1414,7 +1440,7 @@ if (option.selected) { optionEl.classList.add(this.classes.selected); optionEl.setAttribute('aria-selected', 'true'); - this.content.search.input.setAttribute('aria-activedescendant', optionEl.id); + this.setActiveDescendant(optionEl.id); } else { optionEl.classList.remove(this.classes.selected); @@ -1445,8 +1471,8 @@ if (!this.settings.closeOnSelect) { if (e.shiftKey && this.lastSelectedOption) { const options = this.store.getDataOptions(); - let lastClickedOptionIndex = options.findIndex((o) => o.id === this.lastSelectedOption.id); - let currentOptionIndex = options.findIndex((o) => o.id === option.id); + const lastClickedOptionIndex = options.findIndex((o) => o.id === this.lastSelectedOption.id); + const currentOptionIndex = options.findIndex((o) => o.id === option.id); if (lastClickedOptionIndex >= 0 && currentOptionIndex >= 0) { const startIndex = Math.min(lastClickedOptionIndex, currentOptionIndex); const endIndex = Math.max(lastClickedOptionIndex, currentOptionIndex); @@ -1589,6 +1615,15 @@ deselectButton.classList.add(hideClass); } } + setActiveDescendant(id) { + if (!id) { + this.main.main.removeAttribute('aria-activedescendant'); + this.content.search.input.removeAttribute('aria-activedescendant'); + return; + } + this.main.main.setAttribute('aria-activedescendant', id); + this.content.search.input.setAttribute('aria-activedescendant', id); + } } Render._livePolite = null; Render._liveAssertive = null; diff --git a/dist/slimselect.umd.min.js b/dist/slimselect.umd.min.js index 0c71a7dd..da8dea7c 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";class t{constructor(t){t||(t={}),this.main=t.main||"ss-main",this.placeholder=t.placeholder||"ss-placeholder",this.values=t.values||"ss-values",this.single=t.single||"ss-single",this.max=t.max||"ss-max",this.value=t.value||"ss-value",this.valueText=t.valueText||"ss-value-text",this.valueDelete=t.valueDelete||"ss-value-delete",this.valueOut=t.valueOut||"ss-value-out",this.deselect=t.deselect||"ss-deselect",this.deselectPath=t.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=t.arrow||"ss-arrow",this.arrowClose=t.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=t.arrowOpen||"M10,70 L50,30 L90,70",this.content=t.content||"ss-content",this.openAbove=t.openAbove||"ss-open-above",this.openBelow=t.openBelow||"ss-open-below",this.search=t.search||"ss-search",this.searchHighlighter=t.searchHighlighter||"ss-search-highlight",this.searching=t.searching||"ss-searching",this.addable=t.addable||"ss-addable",this.addablePath=t.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=t.list||"ss-list",this.optgroup=t.optgroup||"ss-optgroup",this.optgroupLabel=t.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=t.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=t.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=t.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=t.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=t.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=t.optgroupClosable||"ss-closable",this.option=t.option||"ss-option",this.optionDelete=t.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=t.highlighted||"ss-highlighted",this.open=t.open||"ss-open",this.close=t.close||"ss-close",this.selected=t.selected||"ss-selected",this.error=t.error||"ss-error",this.disabled=t.disabled||"ss-disabled",this.hide=t.hide||"ss-hide"}}function e(){return Math.random().toString(36).substring(2,10)}function s(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 i(t,e){return JSON.stringify(t)===JSON.stringify(e)}class n{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 a(e))}}class a{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.defaultSelected=void 0!==t.defaultSelected&&t.defaultSelected,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 l{constructor(t,e){this.selectType="single",this.data=[],this.selectedOrder=[],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 n||"label"in e){if(!("label"in e))return new Error("Optgroup must have a label");if("options"in e&&e.options)for(let t of e.options){const e=this.validateOption(t);if(e)return e}}else{if(!(e instanceof a||"text"in e))return new Error("Data object must be a valid optgroup or option");{const t=this.validateOption(e);if(t)return 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 n||"label"in t){let s=[];"options"in t&&t.options&&t.options.forEach((t=>{s.push(new a(t))})),s.length>0&&e.push(new n(t))}(t instanceof a||"text"in t)&&e.push(new a(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,e=!1){if(e){let e=[new a(t)];this.setData(e.concat(this.getData()))}else this.setData(this.getData().concat(new a(t)))}setSelectedBy(t,e){let s=null,i=!1;const l=[];for(let o of this.data){if(o instanceof n)for(let n of o.options)s||(s=n),n.selected=!i&&e.includes(n[t]),n.selected&&(l.push(n),"single"===this.selectType&&(i=!0));o instanceof a&&(s||(s=o),o.selected=!i&&e.includes(o[t]),o.selected&&(l.push(o),"single"===this.selectType&&(i=!0)))}"single"===this.selectType&&s&&!i&&(s.selected=!0,l.push(s));const o=e.map((e=>{var s;return(null===(s=l.find((s=>s[t]===e)))||void 0===s?void 0:s.id)||""}));this.selectedOrder=o}getSelected(){return this.getSelectedOptions().map((t=>t.id))}getSelectedValues(){return this.getSelectedOptions().map((t=>t.value))}getSelectedOptions(){return this.filter((t=>t.selected),!1)}getOptgroupByID(t){for(let e of this.data)if(e instanceof n&&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 n?t=e.options[0]:e instanceof a&&(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((i=>{if(i instanceof n){let l=[];if(i.options.forEach((i=>{t&&!t(i)||(e?l.push(new a(i)):s.push(new a(i)))})),l.length>0){let t=new n(i);t.options=l,s.push(t)}}i instanceof a&&(t&&!t(i)||s.push(new a(i)))})),s}selectedOrderOptions(t){const e=[];return this.selectedOrder.forEach((s=>{const i=t.find((t=>t.id===s));i&&e.push(i)})),t.forEach((t=>{let s=!1;e.forEach((e=>{t.id!==e.id||(s=!0)})),s||e.push(t)})),e}}class o{static getLiveAssertive(){let t=document.getElementById("ss-live-assertive");return t||(t=document.createElement("div"),t.id="ss-live-assertive",t.setAttribute("role","status"),t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true"),t.className="ss-sr-only",document.body.appendChild(t)),t}_announceAssertive(t){const e=o._liveAssertive||(o._liveAssertive=o.getLiveAssertive());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}clearHighlights(){this.content.list.querySelectorAll("."+this.classes.highlighted).forEach((t=>t.classList.remove(this.classes.highlighted))),this.content.search.input.removeAttribute("aria-activedescendant")}constructor(t,e,s,i){var n;this.store=s,this.settings=t,this.classes=e,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.main.values.setAttribute("role","list"),this.updateAriaAttributes();const a=null===(n=document.querySelector(`[data-id="${this.settings.id}"]`))||void 0===n?void 0:n.closest(".offcanvas-body");a?a.appendChild(this.content.main):this.settings.contentLocation&&this.settings.contentLocation.appendChild(this.content.main)}static getLivePolite(){let t=document.getElementById("ss-live-polite");return t||(t=document.createElement("div"),t.id="ss-live-polite",t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.className="ss-sr-only",document.body.appendChild(t)),t}_announcePolite(t){const e=o._livePolite||(o._livePolite=o.getLivePolite());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}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.content.search.input.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)}"fixed"===this.settings.contentPosition&&(this.moveContent(),this.scrollHandler=()=>this.moveContent(),this.resizeHandler=()=>this.moveContent(),window.addEventListener("scroll",this.scrollHandler,!0),window.addEventListener("resize",this.resizeHandler)),this.searchFocus()}close(){this.main.main.classList.remove(this.classes.openAbove,this.classes.openBelow),this.content.search.input.setAttribute("aria-expanded","false"),this.content.main.classList.remove(this.classes.openAbove,this.classes.openBelow),this.main.arrow.path.setAttribute("d",this.classes.arrowClose),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=void 0),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=void 0),this.clearHighlights(),this.main.main.focus({preventScroll:!0})}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.main.main.classList.add("ss-2"),this.content.main.classList.add(this.classes.content),this.content.main.classList.add("ss-content-2"),""!==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&&"fixed"!==this.settings.contentPosition||this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){var t;this.content.list.setAttribute("role","listbox"),this.content.list.setAttribute("id",this.content.main.id+"-list"),this.content.list.setAttribute("aria-label",this.settings.contentAriaLabel),this.settings.isMultiple&&this.content.list.setAttribute("aria-multiselectable","true"),this.main.main.removeAttribute("aria-labelledby"),this.main.main.removeAttribute("aria-label");const e=this.content.search.input;e.setAttribute("role","combobox"),e.setAttribute("aria-haspopup","listbox"),e.setAttribute("aria-controls",this.content.list.id),e.setAttribute("aria-owns",this.content.list.id),e.setAttribute("aria-expanded","false"),e.setAttribute("aria-autocomplete","list");let s=(this.settings.ariaLabelledBy||"").trim(),i=null;if(s)i=document.getElementById(s);else{const e=document.querySelector(`select[data-id="${this.settings.id}"]`);e&&(e.id&&(i=document.querySelector(`label[for="${e.id}"]`)),i||"LABEL"!==(null===(t=e.previousElementSibling)||void 0===t?void 0:t.tagName)||(i=e.previousElementSibling),i&&(i.id||(i.id=(e.id||this.settings.id)+"-label"),s=i.id))}s&&document.getElementById(s)?this.main.main.setAttribute("aria-labelledby",s):this.settings.ariaLabel&&this.settings.ariaLabel.trim()&&this.main.main.setAttribute("aria-label",this.settings.ariaLabel.trim()),this.content.search.input.setAttribute("aria-controls",this.content.list.id),this.content.search.input.setAttribute("aria-autocomplete","list"),s&&document.getElementById(s)?this.content.search.input.setAttribute("aria-labelledby",s):this.settings.searchLabelledBy&&document.getElementById(this.settings.searchLabelledBy)?this.content.search.input.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel?this.content.search.input.setAttribute("aria-label",this.settings.searchAriaLabel):this.content.search.input.setAttribute("aria-label","Search options")}mainDiv(){var t;const e=document.createElement("div");e.id=this.settings.id+"-main",e.tabIndex=0,e.onkeydown=t=>{if(t.target!==e)return!0;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===t.key.length&&this.callbacks.open(),!0},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),i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("aria-label",this.settings.clearAllAriaLabel),i.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),i.click())}));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"),a.setAttribute("aria-hidden","true"),a.setAttribute("focusable","false");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"),o.setAttribute("aria-hidden","true"),o.setAttribute("focusable","false");const r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&o.classList.add(this.classes.hide),o.appendChild(r),e.appendChild(o),{main:e,values:s,deselect:{main:i,svg:a,path:l},arrow:{main:o,path:r}}}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()}this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e));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 i=this.store.getSelectedOptions(),l=i.filter((e=>e.selected&&e.id!==t.id),!0);if(!(this.settings.minSelected&&l.length{this.main.main.focus({preventScroll:!0})}))}};const o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("viewBox","0 0 100 100"),o.setAttribute("aria-hidden","true"),o.setAttribute("focusable","false");const r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttribute("d",this.classes.optionDelete),o.appendChild(r),i.appendChild(o),e.appendChild(i),i.onkeydown=t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),i.click())},e.addEventListener("keydown",(t=>{"Enter"===t.key||" "===t.key?(t.preventDefault(),t.stopPropagation()):"Delete"!==t.key&&"Backspace"!==t.key||(t.preventDefault(),t.stopPropagation(),null==i||i.click())})),e.addEventListener("focusin",(()=>{e.setAttribute("aria-describedby",s),i.removeAttribute("aria-hidden"),i.tabIndex=0})),e.addEventListener("focusout",(()=>{e.removeAttribute("aria-describedby"),i.setAttribute("aria-hidden","true"),i.tabIndex=-1}))}return e}contentDiv(){const t=document.createElement("div");t.id=this.settings.id+"-content";const e=this.searchDiv();t.appendChild(e.main);const s=this.listDiv();return t.appendChild(s),{main:t,search:e,list:s}}moveContent(){"relative"!==this.settings.contentPosition&&"down"!==this.settings.openPosition?"up"!==this.settings.openPosition?"up"===this.putContent()?this.moveContentAbove():this.moveContentBelow():this.moveContentAbove():this.moveContentBelow()}searchDiv(){const t=document.createElement("div"),e=document.createElement("input"),i=document.createElement("div");t.classList.add(this.classes.search);const n={main:t,input:e};if(this.settings.showSearch||(t.classList.add(this.classes.hide),e.readOnly=!0),e.type="text",e.placeholder=this.settings.searchPlaceholder,e.tabIndex=-1,this.settings.searchLabelledBy&&this.settings.searchLabelledBy.trim()?e.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel&&this.settings.searchAriaLabel.trim()?e.setAttribute("aria-label",this.settings.searchAriaLabel):e.setAttribute("aria-label","Search options"),e.setAttribute("autocapitalize","off"),e.setAttribute("autocomplete","off"),e.setAttribute("autocorrect","off"),e.oninput=s((t=>{this.callbacks.search(t.target.value)}),100),e.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" ":const e=this.content.list.querySelector("."+this.classes.highlighted);return!e||(e.click(),!1);case"Enter":if(this.callbacks.addable)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(e),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"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false");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 a(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=>{"string"==typeof t?s({text:t,value:t}):i instanceof Error?this.renderError(i.message):s(t)})):"string"==typeof i?s({text:i,value:i}):i instanceof Error?this.renderError(i.message):s(i))},t.appendChild(i),n.addable={main:i,svg:e,path:s}}return n}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.content.search.input.setAttribute("aria-activedescendant",a.id),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}const i=e["down"===t?0:e.length-1];i.classList.add(this.classes.highlighted),this.content.search.input.setAttribute("aria-activedescendant",i.id),this.ensureElementInView(this.content.list,i)}listDiv(){const t=document.createElement("div");return t.classList.add(this.classes.list),t}renderError(t){this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy");const e=document.createElement("div");e.classList.add(this.classes.error),e.textContent=t,this.content.list.appendChild(e),this._announceAssertive(t)}renderSearching(){this.content.list.innerHTML="",this.content.list.setAttribute("aria-busy","true");const t=document.createElement("div");t.classList.add(this.classes.searching),t.textContent=this.settings.searchingText,this.content.list.appendChild(t),this._announcePolite(this.settings.searchingText)}renderOptions(t){if(this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy"),0===t.length){const t=document.createElement("div");t.classList.add(this.classes.search);const e=this.callbacks.addable?this.settings.addableText.replace("{value}",this.content.search.input.value):this.settings.searchText;return this._announcePolite(e),t.innerHTML=e,this.content.list.appendChild(t),void this.content.list.setAttribute("aria-setsize","0")}if(this.settings.allowDeselect&&!this.settings.isMultiple){this.store.filter((t=>t.placeholder),!1).length||this.store.addOption(new a({text:"",value:"",selected:!1,placeholder:!0}),!0)}const e=document.createDocumentFragment();let s=0;const i=t.filter((t=>t instanceof a&&!t.placeholder&&t.display&&!t.disabled)).length,l=t=>{t.classList.contains(this.classes.placeholder)||t.classList.contains(this.classes.disabled)||t.classList.contains(this.classes.hide)||(t.setAttribute("aria-posinset",String(++s)),t.setAttribute("aria-setsize",String(i)))};for(const s of t){if(s instanceof n){const t=document.createElement("div");t.classList.add(this.classes.optgroup),t.setAttribute("role","group"),t.setAttribute("aria-label",s.label);const i=document.createElement("div");i.classList.add(this.classes.optgroupLabel),t.appendChild(i);const n=document.createElement("div");n.classList.add(this.classes.optgroupLabelText),n.textContent=s.label,i.appendChild(n);const a=document.createElement("div");if(a.classList.add(this.classes.optgroupActions),i.appendChild(a),this.settings.isMultiple&&s.selectAll){const t=document.createElement("div");t.classList.add(this.classes.optgroupSelectAll);let e=!0;for(const t of s.options)if(!t.selected){e=!1;break}e&&t.classList.add(this.classes.selected);const i=document.createElement("span");i.textContent=s.selectAllText,t.appendChild(i);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),t.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.optgroupSelectAllBox),n.appendChild(l);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.optgroupSelectAllCheck),n.appendChild(o),t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const i=this.store.getSelected();if(e){const t=i.filter((t=>{for(const e of s.options)if(t===e.id)return!1;return!0}));this.callbacks.setSelected(t,!0)}else{const t=i.concat(s.options.map((t=>t.id)));for(const t of s.options)this.store.getOptionByID(t.id)||this.callbacks.addOption(t);this.callbacks.setSelected(t,!0)}})),a.appendChild(t)}if("off"!==s.closable){const e=document.createElement("div");e.classList.add(this.classes.optgroupClosable);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.classList.add(this.classes.arrow),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),e.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","path");n.appendChild(l),s.options.some((t=>t.selected))||""!==this.content.search.input.value.trim()||"open"===s.closable?(t.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"close"===s.closable&&(t.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose)),i.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))})),a.appendChild(e)}t.appendChild(i);for(const e of s.options){const s=this.option(e);l(s),t.appendChild(s)}e.appendChild(t)}if(s instanceof a){const t=this.option(s);l(t),e.appendChild(t)}}this.content.list.appendChild(e),this.content.list.removeAttribute("aria-busy");const o=this.getOptions(!0,!0,!0).length;this._announcePolite(`${o} option${1===o?"":"s"} available`)}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=`${this.settings.id}__opt__${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),e.setAttribute("aria-disabled","true")),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.content.search.input.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=[];if(this.settings.isMultiple)if(t.selected)o=l.filter((t=>t.id!==n));else if(o=l.concat(t),!this.settings.closeOnSelect)if(e.shiftKey&&this.lastSelectedOption){const e=this.store.getDataOptions();let s=e.findIndex((t=>t.id===this.lastSelectedOption.id)),i=e.findIndex((e=>e.id===t.id));if(s>=0&&i>=0){const t=Math.min(s,i),n=Math.max(s,i),a=e.slice(t,n+1);a.length>0&&a.length!l.find((e=>e.id===t.id))))))}}else t.selected||(this.lastSelectedOption=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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=s.left+("fixed"===this.settings.contentPosition?0: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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=t.left+("fixed"===this.settings.contentPosition?0: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)}}o._livePolite=null,o._liveAssertive=null;class r{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){if(n.target===this.select&&("disabled"===n.attributeName&&(s=!0),"class"===n.attributeName&&(e=!0),"childList"===n.type)){for(const t of n.addedNodes)if("OPTION"===t.nodeName&&t.value===this.select.value){this.select.dispatchEvent(new Event("change"));break}i=!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:"",defaultSelected:t.defaultSelected,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)}setSelectedByValue(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.value)}}if("OPTION"===s.nodeName){const e=s;e.selected=t.includes(e.value)}}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 n&&this.select.appendChild(this.createOptgroup(e)),e instanceof a&&this.select.appendChild(this.createOption(e));this.select.dispatchEvent(new Event("change",{bubbles:!0})),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.textContent=t.text,""!==t.html&&e.setAttribute("data-html",t.html),e.defaultSelected=t.defaultSelected,e.selected=t.selected,t.disabled&&(e.disabled=!0),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(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.focusSearch=void 0===t.focusSearch||t.focusSearch,this.ariaLabel=t.ariaLabel||"",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.contentAriaLabel=void 0!==t.contentAriaLabel?t.contentAriaLabel:"Select an option",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",this.addableText=t.addableText||'Press "Enter" to add {value}',this.ariaLabelledBy=t.ariaLabelledBy||"",this.searchAriaLabel=t.searchAriaLabel||"Search options",this.searchLabelledBy=t.searchLabelledBy||"",this.clearAllAriaLabel=t.clearAllAriaLabel||"Clear selection"}}return class{constructor(e){var i;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=s((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.windowScroll=s((()=>{(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 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),this.cssClasses=new t(e.cssClasses);const n=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const t in e.events)e.events.hasOwnProperty(t)&&(-1!==n.indexOf(t)?this.events[t]=s(e.events[t],100):this.events[t]=e.events[t]);this.settings.disabled=(null===(i=e.settings)||void 0===i?void 0:i.disabled)?e.settings.disabled:this.selectEl.disabled,this.settings.isMultiple=this.selectEl.multiple,this.settings.style=this.selectEl.style.cssText,this.settings.class=this.selectEl.className.split(" "),this.select=new r(this.selectEl),this.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 l(this.settings.isMultiple?"multiple":"single",e.data?e.data:this.select.getData()),e.data&&this.select.updateOptions(this.store.getData());const a={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 o(this.settings,this.cssClasses,this.store,a),this.render.renderValues(),this.render.renderOptions(this.store.getData());const h=this.selectEl.getAttribute("aria-label"),d=this.selectEl.getAttribute("aria-labelledby");h?this.render.main.main.setAttribute("aria-label",h):d&&this.render.main.main.setAttribute("aria-labelledby",d),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(),s=this.store.validateDataArray(t);if(s)return void(this.events.error&&this.events.error(s));this.store.setData(t);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!i(e,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let t=this.store.getSelectedOptions();return this.settings.keepOrder&&(t=this.store.selectedOrderOptions(t)),t.map((t=>t.value))}setSelected(t,e=!0){const s=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&&!i(s,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 s=this.store.getData();this.select.updateOptions(s),this.render.renderValues(),this.render.renderOptions(s),this.events.afterChange&&!i(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.settings.focusSearch&&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";class t{constructor(t){t||(t={}),this.main=t.main||"ss-main",this.placeholder=t.placeholder||"ss-placeholder",this.values=t.values||"ss-values",this.single=t.single||"ss-single",this.max=t.max||"ss-max",this.value=t.value||"ss-value",this.valueText=t.valueText||"ss-value-text",this.valueDelete=t.valueDelete||"ss-value-delete",this.valueOut=t.valueOut||"ss-value-out",this.deselect=t.deselect||"ss-deselect",this.deselectPath=t.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=t.arrow||"ss-arrow",this.arrowClose=t.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=t.arrowOpen||"M10,70 L50,30 L90,70",this.content=t.content||"ss-content",this.openAbove=t.openAbove||"ss-open-above",this.openBelow=t.openBelow||"ss-open-below",this.search=t.search||"ss-search",this.searchHighlighter=t.searchHighlighter||"ss-search-highlight",this.searching=t.searching||"ss-searching",this.addable=t.addable||"ss-addable",this.addablePath=t.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=t.list||"ss-list",this.optgroup=t.optgroup||"ss-optgroup",this.optgroupLabel=t.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=t.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=t.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=t.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=t.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=t.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=t.optgroupClosable||"ss-closable",this.option=t.option||"ss-option",this.optionDelete=t.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=t.highlighted||"ss-highlighted",this.open=t.open||"ss-open",this.close=t.close||"ss-close",this.selected=t.selected||"ss-selected",this.error=t.error||"ss-error",this.disabled=t.disabled||"ss-disabled",this.hide=t.hide||"ss-hide"}}function e(){return Math.random().toString(36).substring(2,10)}function s(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 i(t,e){return JSON.stringify(t)===JSON.stringify(e)}class n{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 a(e))}}class a{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.defaultSelected=void 0!==t.defaultSelected&&t.defaultSelected,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 l{constructor(t,e){this.selectType="single",this.data=[],this.selectedOrder=[],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 n||"label"in e){if(!("label"in e))return new Error("Optgroup must have a label");if("options"in e&&e.options)for(let t of e.options){const e=this.validateOption(t);if(e)return e}}else{if(!(e instanceof a||"text"in e))return new Error("Data object must be a valid optgroup or option");{const t=this.validateOption(e);if(t)return 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 n||"label"in t){let s=[];"options"in t&&t.options&&t.options.forEach((t=>{s.push(new a(t))})),s.length>0&&e.push(new n(t))}(t instanceof a||"text"in t)&&e.push(new a(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,e=!1){if(e){let e=[new a(t)];this.setData(e.concat(this.getData()))}else this.setData(this.getData().concat(new a(t)))}setSelectedBy(t,e){let s=null,i=!1;const l=[];for(let o of this.data){if(o instanceof n)for(let n of o.options)s||(s=n),n.selected=!i&&e.includes(n[t]),n.selected&&(l.push(n),"single"===this.selectType&&(i=!0));o instanceof a&&(s||(s=o),o.selected=!i&&e.includes(o[t]),o.selected&&(l.push(o),"single"===this.selectType&&(i=!0)))}"single"===this.selectType&&s&&!i&&(s.selected=!0,l.push(s));const o=e.map((e=>{var s;return(null===(s=l.find((s=>s[t]===e)))||void 0===s?void 0:s.id)||""}));this.selectedOrder=o}getSelected(){return this.getSelectedOptions().map((t=>t.id))}getSelectedValues(){return this.getSelectedOptions().map((t=>t.value))}getSelectedOptions(){return this.filter((t=>t.selected),!1)}getOptgroupByID(t){for(let e of this.data)if(e instanceof n&&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 n?t=e.options[0]:e instanceof a&&(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((i=>{if(i instanceof n){let l=[];if(i.options.forEach((i=>{t&&!t(i)||(e?l.push(new a(i)):s.push(new a(i)))})),l.length>0){let t=new n(i);t.options=l,s.push(t)}}i instanceof a&&(t&&!t(i)||s.push(new a(i)))})),s}selectedOrderOptions(t){const e=[];return this.selectedOrder.forEach((s=>{const i=t.find((t=>t.id===s));i&&e.push(i)})),t.forEach((t=>{let s=!1;e.forEach((e=>{t.id!==e.id||(s=!0)})),s||e.push(t)})),e}}class o{static getLiveAssertive(){let t=document.getElementById("ss-live-assertive");return t||(t=document.createElement("div"),t.id="ss-live-assertive",t.setAttribute("role","status"),t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true"),t.className="ss-sr-only",document.body.appendChild(t)),t}_announceAssertive(t){const e=o._liveAssertive||(o._liveAssertive=o.getLiveAssertive());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}clearHighlights(){this.content.list.querySelectorAll("."+this.classes.highlighted).forEach((t=>t.classList.remove(this.classes.highlighted))),this.content.search.input.removeAttribute("aria-activedescendant"),this.main.main.removeAttribute("aria-activedescendant")}constructor(t,e,s,i){var n;this.store=s,this.settings=t,this.classes=e,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.main.values.setAttribute("role","list"),this.updateAriaAttributes();const a=null===(n=document.querySelector(`[data-id="${this.settings.id}"]`))||void 0===n?void 0:n.closest(".offcanvas-body");a?a.appendChild(this.content.main):this.settings.contentLocation&&this.settings.contentLocation.appendChild(this.content.main)}static getLivePolite(){let t=document.getElementById("ss-live-polite");return t||(t=document.createElement("div"),t.id="ss-live-polite",t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.className="ss-sr-only",document.body.appendChild(t)),t}_announcePolite(t){const e=o._livePolite||(o._livePolite=o.getLivePolite());e.textContent="",requestAnimationFrame((()=>{e.textContent=t}))}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)}"fixed"===this.settings.contentPosition&&(this.moveContent(),this.scrollHandler=()=>this.moveContent(),this.resizeHandler=()=>this.moveContent(),window.addEventListener("scroll",this.scrollHandler,!0),window.addEventListener("resize",this.resizeHandler)),this.searchFocus()}close(){this.main.main.classList.remove(this.classes.openAbove,this.classes.openBelow),this.content.search.input.removeAttribute("aria-expanded"),this.main.main.setAttribute("aria-expanded","false"),this.content.main.classList.remove(this.classes.openAbove,this.classes.openBelow),this.main.arrow.path.setAttribute("d",this.classes.arrowClose),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=void 0),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=void 0),this.clearHighlights(),this.main.main.focus({preventScroll:!0})}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.main.main.classList.add("ss-2"),this.content.main.classList.add(this.classes.content),this.content.main.classList.add("ss-content-2"),""!==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&&"fixed"!==this.settings.contentPosition||this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){var t;this.content.list.setAttribute("role","listbox"),this.content.list.setAttribute("id",this.content.main.id+"-list"),this.content.list.setAttribute("aria-label",this.settings.contentAriaLabel),this.main.main.setAttribute("role","combobox"),this.main.main.setAttribute("aria-controls",this.content.list.id),this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-expanded","false"),this.settings.isMultiple&&this.content.list.setAttribute("aria-multiselectable","true"),this.main.main.removeAttribute("aria-labelledby"),this.main.main.removeAttribute("aria-label");const e=this.content.search.input;e.setAttribute("role","searchbox"),e.setAttribute("aria-controls",this.content.list.id),e.setAttribute("aria-owns",this.content.list.id),e.setAttribute("aria-autocomplete","list"),e.removeAttribute("aria-expanded");let s=(this.settings.ariaLabelledBy||"").trim(),i=null;if(s)i=document.getElementById(s);else{const e=document.querySelector(`select[data-id="${this.settings.id}"]`);e&&(e.id&&(i=document.querySelector(`label[for="${e.id}"]`)),i||"LABEL"!==(null===(t=e.previousElementSibling)||void 0===t?void 0:t.tagName)||(i=e.previousElementSibling),i&&(i.id||(i.id=(e.id||this.settings.id)+"-label"),s=i.id))}s&&document.getElementById(s)?this.main.main.setAttribute("aria-labelledby",s):this.settings.ariaLabel&&this.settings.ariaLabel.trim()&&this.main.main.setAttribute("aria-label",this.settings.ariaLabel.trim()),this.content.search.input.setAttribute("aria-controls",this.content.list.id),this.content.search.input.setAttribute("aria-autocomplete","list"),s&&document.getElementById(s)?this.content.search.input.setAttribute("aria-labelledby",s):this.settings.searchLabelledBy&&document.getElementById(this.settings.searchLabelledBy)?this.content.search.input.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel?this.content.search.input.setAttribute("aria-label",this.settings.searchAriaLabel):this.content.search.input.setAttribute("aria-label","Search options")}mainDiv(){var t;const e=document.createElement("div");e.id=this.settings.id+"-main",e.tabIndex=0,e.onkeydown=t=>{if(t.target!==e)return!0;const s=t=>{this.callbacks.open(),requestAnimationFrame((()=>{this.searchFocus(),t()}))};switch(t.key){case"ArrowDown":return t.preventDefault(),s((()=>this.highlight("down"))),!1;case"ArrowUp":return t.preventDefault(),s((()=>this.highlight("up"))),!1;case"Tab":return this.callbacks.close(),!0;case"Enter":case" ":return t.preventDefault(),s((()=>{const t=this.content.list.querySelector("."+this.classes.highlighted);t&&t.click()})),!1}return!!(1!==t.key.length||t.ctrlKey||t.metaKey||t.altKey)||(t.preventDefault(),this.callbacks.open(),requestAnimationFrame((()=>{var e,s;this.searchFocus();const i=this.content.search.input,n=null!==(e=i.selectionStart)&&void 0!==e?e:i.value.length,a=null!==(s=i.selectionEnd)&&void 0!==s?s:i.value.length;i.value=i.value.slice(0,n)+t.key+i.value.slice(a),i.setSelectionRange(n+1,n+1),this.callbacks.search(i.value)})),!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),i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("aria-label",this.settings.clearAllAriaLabel),i.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),i.click())}));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"),a.setAttribute("aria-hidden","true"),a.setAttribute("focusable","false");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"),o.setAttribute("aria-hidden","true"),o.setAttribute("focusable","false");const r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&o.classList.add(this.classes.hide),o.appendChild(r),e.appendChild(o),{main:e,values:s,deselect:{main:i,svg:a,path:l},arrow:{main:o,path:r}}}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.setAttribute("aria-hidden","true"),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(this.main.values.removeAttribute("role"),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 this.main.values.removeAttribute("role"),void(this.main.values.innerHTML=this.placeholder().outerHTML);{this.main.values.setAttribute("role","list");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()}this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e));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 i=this.store.getSelectedOptions(),l=i.filter((e=>e.selected&&e.id!==t.id),!0);if(!(this.settings.minSelected&&l.length{this.main.main.focus({preventScroll:!0})}))}};const o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("viewBox","0 0 100 100"),o.setAttribute("aria-hidden","true"),o.setAttribute("focusable","false");const r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttribute("d",this.classes.optionDelete),o.appendChild(r),i.appendChild(o),e.appendChild(i),i.onkeydown=t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),i.click())},e.addEventListener("keydown",(t=>{"Enter"===t.key||" "===t.key?(t.preventDefault(),t.stopPropagation()):"Delete"!==t.key&&"Backspace"!==t.key||(t.preventDefault(),t.stopPropagation(),null==i||i.click())})),e.addEventListener("focusin",(()=>{e.setAttribute("aria-describedby",s),i.removeAttribute("aria-hidden"),i.tabIndex=0})),e.addEventListener("focusout",(()=>{e.removeAttribute("aria-describedby"),i.setAttribute("aria-hidden","true"),i.tabIndex=-1}))}return e}contentDiv(){const t=document.createElement("div");t.id=this.settings.id+"-content";const e=this.searchDiv();t.appendChild(e.main);const s=this.listDiv();return t.appendChild(s),{main:t,search:e,list:s}}moveContent(){"relative"!==this.settings.contentPosition&&"down"!==this.settings.openPosition?"up"!==this.settings.openPosition?"up"===this.putContent()?this.moveContentAbove():this.moveContentBelow():this.moveContentAbove():this.moveContentBelow()}searchDiv(){const t=document.createElement("div"),e=document.createElement("input"),i=document.createElement("div");t.classList.add(this.classes.search);const n={main:t,input:e};if(this.settings.showSearch||(t.classList.add(this.classes.hide),e.readOnly=!0),e.type="text",e.placeholder=this.settings.searchPlaceholder,e.tabIndex=-1,this.settings.searchLabelledBy&&this.settings.searchLabelledBy.trim()?e.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel&&this.settings.searchAriaLabel.trim()?e.setAttribute("aria-label",this.settings.searchAriaLabel):e.setAttribute("aria-label","Search options"),e.setAttribute("autocapitalize","off"),e.setAttribute("autocomplete","off"),e.setAttribute("autocorrect","off"),e.oninput=s((t=>{this.callbacks.search(t.target.value)}),100),e.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" ":const e=this.content.list.querySelector("."+this.classes.highlighted);return!e||(e.click(),!1);case"Enter":if(this.callbacks.addable)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(e),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"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false");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 a(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=>{"string"==typeof t?s({text:t,value:t}):i instanceof Error?this.renderError(i.message):s(t)})):"string"==typeof i?s({text:i,value:i}):i instanceof Error?this.renderError(i.message):s(i))},t.appendChild(i),n.addable={main:i,svg:e,path:s}}return n}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)){e[0].classList.add(this.classes.highlighted);const t=e[0].id;return void this.setActiveDescendant(t)}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),this.setActiveDescendant(t.id);break}for(let s=0;s=0?s-1:e.length-1];i.classList.add(this.classes.highlighted),this.setActiveDescendant(i.id),this.ensureElementInView(this.content.list,i);const n=i.parentElement;if(n&&n.classList.contains(this.classes.close)){const t=n.querySelector("."+this.classes.optgroupLabel);t&&t.click()}return}const i=e["down"===t?0:e.length-1];i.classList.add(this.classes.highlighted),this.setActiveDescendant(i.id),this.ensureElementInView(this.content.list,i)}listDiv(){const t=document.createElement("div");return t.classList.add(this.classes.list),t}renderError(t){this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy");const e=document.createElement("div");e.classList.add(this.classes.error),e.textContent=t,this.content.list.appendChild(e),this._announceAssertive(t)}renderSearching(){this.content.list.innerHTML="",this.content.list.setAttribute("aria-busy","true");const t=document.createElement("div");t.classList.add(this.classes.searching),t.textContent=this.settings.searchingText,this.content.list.appendChild(t),this._announcePolite(this.settings.searchingText)}renderOptions(t){if(this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy"),0===t.length){const t=document.createElement("div");t.classList.add(this.classes.search);const e=this.callbacks.addable?this.settings.addableText.replace("{value}",this.content.search.input.value):this.settings.searchText;return this._announcePolite(e),t.innerHTML=e,this.content.list.appendChild(t),void this.content.list.setAttribute("aria-setsize","0")}if(this.settings.allowDeselect&&!this.settings.isMultiple){this.store.filter((t=>t.placeholder),!1).length||this.store.addOption(new a({text:"",value:"",selected:!1,placeholder:!0}),!0)}const e=document.createDocumentFragment();let s=0;const i=t.filter((t=>t instanceof a&&!t.placeholder&&t.display&&!t.disabled)).length,l=t=>{t.classList.contains(this.classes.placeholder)||t.classList.contains(this.classes.disabled)||t.classList.contains(this.classes.hide)||(t.setAttribute("aria-posinset",String(++s)),t.setAttribute("aria-setsize",String(i)))};for(const s of t){if(s instanceof n){const t=document.createElement("div");t.classList.add(this.classes.optgroup),t.setAttribute("role","group"),t.setAttribute("aria-label",s.label);const i=document.createElement("div");i.classList.add(this.classes.optgroupLabel),t.appendChild(i);const n=document.createElement("div");n.classList.add(this.classes.optgroupLabelText),n.textContent=s.label,i.appendChild(n);const a=document.createElement("div");if(a.classList.add(this.classes.optgroupActions),i.appendChild(a),this.settings.isMultiple&&s.selectAll){const t=document.createElement("div");t.classList.add(this.classes.optgroupSelectAll);let e=!0;for(const t of s.options)if(!t.selected){e=!1;break}e&&t.classList.add(this.classes.selected);const i=document.createElement("span");i.textContent=s.selectAllText,t.appendChild(i);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),t.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.optgroupSelectAllBox),n.appendChild(l);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.optgroupSelectAllCheck),n.appendChild(o),t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const i=this.store.getSelected();if(e){const t=i.filter((t=>{for(const e of s.options)if(t===e.id)return!1;return!0}));this.callbacks.setSelected(t,!0)}else{const t=i.concat(s.options.map((t=>t.id)));for(const t of s.options)this.store.getOptionByID(t.id)||this.callbacks.addOption(t);this.callbacks.setSelected(t,!0)}})),a.appendChild(t)}if("off"!==s.closable){const e=document.createElement("div");e.classList.add(this.classes.optgroupClosable);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100"),n.classList.add(this.classes.arrow),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),e.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","path");n.appendChild(l),s.options.some((t=>t.selected))||""!==this.content.search.input.value.trim()||"open"===s.closable?(t.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"close"===s.closable&&(t.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose)),i.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))})),a.appendChild(e)}t.appendChild(i);for(const e of s.options){const s=this.option(e);l(s),t.appendChild(s)}e.appendChild(t)}if(s instanceof a){const t=this.option(s);l(t),e.appendChild(t)}}this.content.list.appendChild(e),this.content.list.removeAttribute("aria-busy");const o=this.getOptions(!0,!0,!0).length;this._announcePolite(`${o} option${1===o?"":"s"} available`)}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=`${this.settings.id}__opt__${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),e.setAttribute("aria-disabled","true")),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.setActiveDescendant(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=[];if(this.settings.isMultiple)if(t.selected)o=l.filter((t=>t.id!==n));else if(o=l.concat(t),!this.settings.closeOnSelect)if(e.shiftKey&&this.lastSelectedOption){const e=this.store.getDataOptions(),s=e.findIndex((t=>t.id===this.lastSelectedOption.id)),i=e.findIndex((e=>e.id===t.id));if(s>=0&&i>=0){const t=Math.min(s,i),n=Math.max(s,i),a=e.slice(t,n+1);a.length>0&&a.length!l.find((e=>e.id===t.id))))))}}else t.selected||(this.lastSelectedOption=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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=s.left+("fixed"===this.settings.contentPosition?0: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+("fixed"===this.settings.contentPosition?0:window.scrollY)+"px",this.content.main.style.left=t.left+("fixed"===this.settings.contentPosition?0: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)}setActiveDescendant(t){if(!t)return this.main.main.removeAttribute("aria-activedescendant"),void this.content.search.input.removeAttribute("aria-activedescendant");this.main.main.setAttribute("aria-activedescendant",t),this.content.search.input.setAttribute("aria-activedescendant",t)}}o._livePolite=null,o._liveAssertive=null;class r{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){if(n.target===this.select&&("disabled"===n.attributeName&&(s=!0),"class"===n.attributeName&&(e=!0),"childList"===n.type)){for(const t of n.addedNodes)if("OPTION"===t.nodeName&&t.value===this.select.value){this.select.dispatchEvent(new Event("change"));break}i=!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:"",defaultSelected:t.defaultSelected,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)}setSelectedByValue(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.value)}}if("OPTION"===s.nodeName){const e=s;e.selected=t.includes(e.value)}}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 n&&this.select.appendChild(this.createOptgroup(e)),e instanceof a&&this.select.appendChild(this.createOption(e));this.select.dispatchEvent(new Event("change",{bubbles:!0})),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.textContent=t.text,""!==t.html&&e.setAttribute("data-html",t.html),e.defaultSelected=t.defaultSelected,e.selected=t.selected,t.disabled&&(e.disabled=!0),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(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.focusSearch=void 0===t.focusSearch||t.focusSearch,this.ariaLabel=t.ariaLabel||"",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.contentAriaLabel=void 0!==t.contentAriaLabel?t.contentAriaLabel:"Select an option",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",this.addableText=t.addableText||'Press "Enter" to add {value}',this.ariaLabelledBy=t.ariaLabelledBy||"",this.searchAriaLabel=t.searchAriaLabel||"Search options",this.searchLabelledBy=t.searchLabelledBy||"",this.clearAllAriaLabel=t.clearAllAriaLabel||"Clear selection"}}return class{constructor(e){var i;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=s((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.windowScroll=s((()=>{(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 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),this.cssClasses=new t(e.cssClasses);const n=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const t in e.events)e.events.hasOwnProperty(t)&&(-1!==n.indexOf(t)?this.events[t]=s(e.events[t],100):this.events[t]=e.events[t]);this.settings.disabled=(null===(i=e.settings)||void 0===i?void 0:i.disabled)?e.settings.disabled:this.selectEl.disabled,this.settings.isMultiple=this.selectEl.multiple,this.settings.style=this.selectEl.style.cssText,this.settings.class=this.selectEl.className.split(" "),this.select=new r(this.selectEl),this.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 l(this.settings.isMultiple?"multiple":"single",e.data?e.data:this.select.getData()),e.data&&this.select.updateOptions(this.store.getData());const a={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 o(this.settings,this.cssClasses,this.store,a),this.render.renderValues(),this.render.renderOptions(this.store.getData());const h=this.selectEl.getAttribute("aria-label"),d=this.selectEl.getAttribute("aria-labelledby");h?this.render.main.main.setAttribute("aria-label",h):d&&this.render.main.main.setAttribute("aria-labelledby",d),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(),s=this.store.validateDataArray(t);if(s)return void(this.events.error&&this.events.error(s));this.store.setData(t);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!i(e,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let t=this.store.getSelectedOptions();return this.settings.keepOrder&&(t=this.store.selectedOrderOptions(t)),t.map((t=>t.value))}setSelected(t,e=!0){const s=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&&!i(s,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 s=this.store.getData();this.select.updateOptions(s),this.render.renderValues(),this.render.renderOptions(s),this.events.afterChange&&!i(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.settings.focusSearch&&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 02f7eca1..d9c0308f 100644 --- a/docs/assets/index.js +++ b/docs/assets/index.js @@ -19,7 +19,7 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/home.js","asset * vue-router v4.5.1 * (c) 2025 Eduardo San Martin Morote * @license MIT - */const Ct=typeof document<"u";function jr(t){return typeof t=="object"||"displayName"in t||"props"in t||"__vccOpts"in t}function Oa(t){return t.__esModule||t[Symbol.toStringTag]==="Module"||t.default&&jr(t.default)}const J=Object.assign;function zs(t,e){const s={};for(const n in e){const i=e[n];s[n]=He(i)?i.map(t):t(i)}return s}const qt=()=>{},He=Array.isArray,zr=/#/g,La=/&/g,Ta=/\//g,Pa=/=/g,Ra=/\?/g,Wr=/\+/g,Da=/%5B/g,ka=/%5D/g,qr=/%5E/g,Ia=/%60/g,Gr=/%7B/g,Fa=/%7C/g,Kr=/%7D/g,Ma=/%20/g;function Dn(t){return encodeURI(""+t).replace(Fa,"|").replace(Da,"[").replace(ka,"]")}function Na(t){return Dn(t).replace(Gr,"{").replace(Kr,"}").replace(qr,"^")}function cn(t){return Dn(t).replace(Wr,"%2B").replace(Ma,"+").replace(zr,"%23").replace(La,"%26").replace(Ia,"`").replace(Gr,"{").replace(Kr,"}").replace(qr,"^")}function Ba(t){return cn(t).replace(Pa,"%3D")}function Ha(t){return Dn(t).replace(zr,"%23").replace(Ra,"%3F")}function Va(t){return t==null?"":Ha(t).replace(Ta,"%2F")}function ss(t){try{return decodeURIComponent(""+t)}catch{}return""+t}const $a=/\/$/,Ua=t=>t.replace($a,"");function Ws(t,e,s="/"){let n,i={},r="",o="";const l=e.indexOf("#");let a=e.indexOf("?");return l=0&&(a=-1),a>-1&&(n=e.slice(0,a),r=e.slice(a+1,l>-1?l:e.length),i=t(r)),l>-1&&(n=n||e.slice(0,l),o=e.slice(l,e.length)),n=qa(n??e,s),{fullPath:n+(r&&"?")+r+o,path:n,query:i,hash:ss(o)}}function ja(t,e){const s=e.query?t(e.query):"";return e.path+(s&&"?")+s+(e.hash||"")}function pi(t,e){return!e||!t.toLowerCase().startsWith(e.toLowerCase())?t:t.slice(e.length)||"/"}function za(t,e,s){const n=e.matched.length-1,i=s.matched.length-1;return n>-1&&n===i&&kt(e.matched[n],s.matched[i])&&Yr(e.params,s.params)&&t(e.query)===t(s.query)&&e.hash===s.hash}function kt(t,e){return(t.aliasOf||t)===(e.aliasOf||e)}function Yr(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(!Wa(t[s],e[s]))return!1;return!0}function Wa(t,e){return He(t)?gi(t,e):He(e)?gi(e,t):t===e}function gi(t,e){return He(e)?t.length===e.length&&t.every((s,n)=>s===e[n]):t.length===1&&t[0]===e}function qa(t,e){if(t.startsWith("/"))return t;if(!t)return e;const s=e.split("/"),n=t.split("/"),i=n[n.length-1];(i===".."||i===".")&&n.push("");let r=s.length-1,o,l;for(o=0;o1&&r--;else break;return s.slice(0,r).join("/")+"/"+n.slice(o).join("/")}const ut={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};var ns;(function(t){t.pop="pop",t.push="push"})(ns||(ns={}));var Gt;(function(t){t.back="back",t.forward="forward",t.unknown=""})(Gt||(Gt={}));function Ga(t){if(!t)if(Ct){const e=document.querySelector("base");t=e&&e.getAttribute("href")||"/",t=t.replace(/^\w+:\/\/[^\/]+/,"")}else t="/";return t[0]!=="/"&&t[0]!=="#"&&(t="/"+t),Ua(t)}const Ka=/^[^#]+#/;function Ya(t,e){return t.replace(Ka,"#")+e}function Qa(t,e){const s=document.documentElement.getBoundingClientRect(),n=t.getBoundingClientRect();return{behavior:e.behavior,left:n.left-s.left-(e.left||0),top:n.top-s.top-(e.top||0)}}const ks=()=>({left:window.scrollX,top:window.scrollY});function Ja(t){let e;if("el"in t){const s=t.el,n=typeof s=="string"&&s.startsWith("#"),i=typeof s=="string"?n?document.getElementById(s.slice(1)):document.querySelector(s):s;if(!i)return;e=Qa(i,t)}else e=t;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.scrollX,e.top!=null?e.top:window.scrollY)}function mi(t,e){return(history.state?history.state.position-e:-1)+t}const un=new Map;function Za(t,e){un.set(t,e)}function Xa(t){const e=un.get(t);return un.delete(t),e}let ec=()=>location.protocol+"//"+location.host;function Qr(t,e){const{pathname:s,search:n,hash:i}=e,r=t.indexOf("#");if(r>-1){let l=i.includes(t.slice(r))?t.slice(r).length:1,a=i.slice(l);return a[0]!=="/"&&(a="/"+a),pi(a,"")}return pi(s,t)+n+i}function tc(t,e,s,n){let i=[],r=[],o=null;const l=({state:p})=>{const g=Qr(t,location),_=s.value,C=e.value;let D=0;if(p){if(s.value=g,e.value=p,o&&o===_){o=null;return}D=C?p.position-C.position:0}else n(g);i.forEach(T=>{T(s.value,_,{delta:D,type:ns.pop,direction:D?D>0?Gt.forward:Gt.back:Gt.unknown})})};function a(){o=s.value}function u(p){i.push(p);const g=()=>{const _=i.indexOf(p);_>-1&&i.splice(_,1)};return r.push(g),g}function c(){const{history:p}=window;p.state&&p.replaceState(J({},p.state,{scroll:ks()}),"")}function f(){for(const p of r)p();r=[],window.removeEventListener("popstate",l),window.removeEventListener("beforeunload",c)}return window.addEventListener("popstate",l),window.addEventListener("beforeunload",c,{passive:!0}),{pauseListeners:a,listen:u,destroy:f}}function vi(t,e,s,n=!1,i=!1){return{back:t,current:e,forward:s,replaced:n,position:window.history.length,scroll:i?ks():null}}function sc(t){const{history:e,location:s}=window,n={value:Qr(t,s)},i={value:e.state};i.value||r(n.value,{back:null,current:n.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function r(a,u,c){const f=t.indexOf("#"),p=f>-1?(s.host&&document.querySelector("base")?t:t.slice(f))+a:ec()+t+a;try{e[c?"replaceState":"pushState"](u,"",p),i.value=u}catch(g){console.error(g),s[c?"replace":"assign"](p)}}function o(a,u){const c=J({},e.state,vi(i.value.back,a,i.value.forward,!0),u,{position:i.value.position});r(a,c,!0),n.value=a}function l(a,u){const c=J({},i.value,e.state,{forward:a,scroll:ks()});r(c.current,c,!0);const f=J({},vi(n.value,a,null),{position:c.position+1},u);r(a,f,!1),n.value=a}return{location:n,state:i,push:l,replace:o}}function nc(t){t=Ga(t);const e=sc(t),s=tc(t,e.state,e.location,e.replace);function n(r,o=!0){o||s.pauseListeners(),history.go(r)}const i=J({location:"",base:t,go:n,createHref:Ya.bind(null,t)},e,s);return Object.defineProperty(i,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(i,"state",{enumerable:!0,get:()=>e.state.value}),i}function ic(t){return typeof t=="string"||t&&typeof t=="object"}function Jr(t){return typeof t=="string"||typeof t=="symbol"}const Zr=Symbol("");var bi;(function(t){t[t.aborted=4]="aborted",t[t.cancelled=8]="cancelled",t[t.duplicated=16]="duplicated"})(bi||(bi={}));function It(t,e){return J(new Error,{type:t,[Zr]:!0},e)}function Je(t,e){return t instanceof Error&&Zr in t&&(e==null||!!(t.type&e))}const yi="[^/]+?",rc={sensitive:!1,strict:!1,start:!0,end:!0},lc=/[.+*?^${}()[\]/\\]/g;function oc(t,e){const s=J({},rc,e),n=[];let i=s.start?"^":"";const r=[];for(const u of t){const c=u.length?[]:[90];s.strict&&!u.length&&(i+="/");for(let f=0;fe.length?e.length===1&&e[0]===80?1:-1:0}function Xr(t,e){let s=0;const n=t.score,i=e.score;for(;s0&&e[e.length-1]<0}const cc={type:0,value:""},uc=/[a-zA-Z0-9_]/;function fc(t){if(!t)return[[]];if(t==="/")return[[cc]];if(!t.startsWith("/"))throw new Error(`Invalid path "${t}"`);function e(g){throw new Error(`ERR (${s})/"${u}": ${g}`)}let s=0,n=s;const i=[];let r;function o(){r&&i.push(r),r=[]}let l=0,a,u="",c="";function f(){u&&(s===0?r.push({type:0,value:u}):s===1||s===2||s===3?(r.length>1&&(a==="*"||a==="+")&&e(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),r.push({type:1,value:u,regexp:c,repeatable:a==="*"||a==="+",optional:a==="*"||a==="?"})):e("Invalid state to consume buffer"),u="")}function p(){u+=a}for(;l{o(b)}:qt}function o(f){if(Jr(f)){const p=n.get(f);p&&(n.delete(f),s.splice(s.indexOf(p),1),p.children.forEach(o),p.alias.forEach(o))}else{const p=s.indexOf(f);p>-1&&(s.splice(p,1),f.record.name&&n.delete(f.record.name),f.children.forEach(o),f.alias.forEach(o))}}function l(){return s}function a(f){const p=mc(f,s);s.splice(p,0,f),f.record.name&&!Si(f)&&n.set(f.record.name,f)}function u(f,p){let g,_={},C,D;if("name"in f&&f.name){if(g=n.get(f.name),!g)throw It(1,{location:f});D=g.record.name,_=J(wi(p.params,g.keys.filter(b=>!b.optional).concat(g.parent?g.parent.keys.filter(b=>b.optional):[]).map(b=>b.name)),f.params&&wi(f.params,g.keys.map(b=>b.name))),C=g.stringify(_)}else if(f.path!=null)C=f.path,g=s.find(b=>b.re.test(C)),g&&(_=g.parse(C),D=g.record.name);else{if(g=p.name?n.get(p.name):s.find(b=>b.re.test(p.path)),!g)throw It(1,{location:f,currentLocation:p});D=g.record.name,_=J({},p.params,f.params),C=g.stringify(_)}const T=[];let m=g;for(;m;)T.unshift(m.record),m=m.parent;return{name:D,path:C,params:_,matched:T,meta:gc(T)}}t.forEach(f=>r(f));function c(){s.length=0,n.clear()}return{addRoute:r,resolve:u,removeRoute:o,clearRoutes:c,getRoutes:l,getRecordMatcher:i}}function wi(t,e){const s={};for(const n of e)n in t&&(s[n]=t[n]);return s}function xi(t){const e={path:t.path,redirect:t.redirect,name:t.name,meta:t.meta||{},aliasOf:t.aliasOf,beforeEnter:t.beforeEnter,props:pc(t),children:t.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in t?t.components||null:t.component&&{default:t.component}};return Object.defineProperty(e,"mods",{value:{}}),e}function pc(t){const e={},s=t.props||!1;if("component"in t)e.default=s;else for(const n in t.components)e[n]=typeof s=="object"?s[n]:s;return e}function Si(t){for(;t;){if(t.record.aliasOf)return!0;t=t.parent}return!1}function gc(t){return t.reduce((e,s)=>J(e,s.meta),{})}function Ei(t,e){const s={};for(const n in t)s[n]=n in e?e[n]:t[n];return s}function mc(t,e){let s=0,n=e.length;for(;s!==n;){const r=s+n>>1;Xr(t,e[r])<0?n=r:s=r+1}const i=vc(t);return i&&(n=e.lastIndexOf(i,n-1)),n}function vc(t){let e=t;for(;e=e.parent;)if(el(e)&&Xr(t,e)===0)return e}function el({record:t}){return!!(t.name||t.components&&Object.keys(t.components).length||t.redirect)}function bc(t){const e={};if(t===""||t==="?")return e;const n=(t[0]==="?"?t.slice(1):t).split("&");for(let i=0;ir&&cn(r)):[n&&cn(n)]).forEach(r=>{r!==void 0&&(e+=(e.length?"&":"")+s,r!=null&&(e+="="+r))})}return e}function yc(t){const e={};for(const s in t){const n=t[s];n!==void 0&&(e[s]=He(n)?n.map(i=>i==null?null:""+i):n==null?n:""+n)}return e}const Ac=Symbol(""),_i=Symbol(""),kn=Symbol(""),tl=Symbol(""),fn=Symbol("");function Bt(){let t=[];function e(n){return t.push(n),()=>{const i=t.indexOf(n);i>-1&&t.splice(i,1)}}function s(){t=[]}return{add:e,list:()=>t.slice(),reset:s}}function dt(t,e,s,n,i,r=o=>o()){const o=n&&(n.enterCallbacks[i]=n.enterCallbacks[i]||[]);return()=>new Promise((l,a)=>{const u=p=>{p===!1?a(It(4,{from:s,to:e})):p instanceof Error?a(p):ic(p)?a(It(2,{from:e,to:p})):(o&&n.enterCallbacks[i]===o&&typeof p=="function"&&o.push(p),l())},c=r(()=>t.call(n&&n.instances[i],e,s,u));let f=Promise.resolve(c);t.length<3&&(f=f.then(u)),f.catch(p=>a(p))})}function qs(t,e,s,n,i=r=>r()){const r=[];for(const o of t)for(const l in o.components){let a=o.components[l];if(!(e!=="beforeRouteEnter"&&!o.instances[l]))if(jr(a)){const c=(a.__vccOpts||a)[e];c&&r.push(dt(c,s,n,o,l,i))}else{let u=a();r.push(()=>u.then(c=>{if(!c)throw new Error(`Couldn't resolve component "${l}" at "${o.path}"`);const f=Oa(c)?c.default:c;o.mods[l]=c,o.components[l]=f;const g=(f.__vccOpts||f)[e];return g&&dt(g,s,n,o,l,i)()}))}}return r}function Oi(t){const e=tt(kn),s=tt(tl),n=Ne(()=>{const a=wt(t.to);return e.resolve(a)}),i=Ne(()=>{const{matched:a}=n.value,{length:u}=a,c=a[u-1],f=s.matched;if(!c||!f.length)return-1;const p=f.findIndex(kt.bind(null,c));if(p>-1)return p;const g=Li(a[u-2]);return u>1&&Li(c)===g&&f[f.length-1].path!==g?f.findIndex(kt.bind(null,a[u-2])):p}),r=Ne(()=>i.value>-1&&Cc(s.params,n.value.params)),o=Ne(()=>i.value>-1&&i.value===s.matched.length-1&&Yr(s.params,n.value.params));function l(a={}){if(Ec(a)){const u=e[wt(t.replace)?"replace":"push"](wt(t.to)).catch(qt);return t.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>u),u}return Promise.resolve()}return{route:n,href:Ne(()=>n.value.href),isActive:r,isExactActive:o,navigate:l}}function wc(t){return t.length===1?t[0]:t}const xc=Ts({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"},viewTransition:Boolean},useLink:Oi,setup(t,{slots:e}){const s=Os(Oi(t)),{options:n}=tt(kn),i=Ne(()=>({[Ti(t.activeClass,n.linkActiveClass,"router-link-active")]:s.isActive,[Ti(t.exactActiveClass,n.linkExactActiveClass,"router-link-exact-active")]:s.isExactActive}));return()=>{const r=e.default&&wc(e.default(s));return t.custom?r:$r("a",{"aria-current":s.isExactActive?t.ariaCurrentValue:null,href:s.href,onClick:s.navigate,class:i.value},r)}}}),Sc=xc;function Ec(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&!(t.button!==void 0&&t.button!==0)){if(t.currentTarget&&t.currentTarget.getAttribute){const e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function Cc(t,e){for(const s in e){const n=e[s],i=t[s];if(typeof n=="string"){if(n!==i)return!1}else if(!He(i)||i.length!==n.length||n.some((r,o)=>r!==i[o]))return!1}return!0}function Li(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const Ti=(t,e,s)=>t??e??s,_c=Ts({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(t,{attrs:e,slots:s}){const n=tt(fn),i=Ne(()=>t.route||n.value),r=tt(_i,0),o=Ne(()=>{let u=wt(r);const{matched:c}=i.value;let f;for(;(f=c[u])&&!f.components;)u++;return u}),l=Ne(()=>i.value.matched[o.value]);cs(_i,Ne(()=>o.value+1)),cs(Ac,l),cs(fn,i);const a=ir();return us(()=>[a.value,l.value,t.name],([u,c,f],[p,g,_])=>{c&&(c.instances[f]=u,g&&g!==c&&u&&u===p&&(c.leaveGuards.size||(c.leaveGuards=g.leaveGuards),c.updateGuards.size||(c.updateGuards=g.updateGuards))),u&&c&&(!g||!kt(c,g)||!p)&&(c.enterCallbacks[f]||[]).forEach(C=>C(u))},{flush:"post"}),()=>{const u=i.value,c=t.name,f=l.value,p=f&&f.components[c];if(!p)return Pi(s.default,{Component:p,route:u});const g=f.props[c],_=g?g===!0?u.params:typeof g=="function"?g(u):g:null,D=$r(p,J({},_,e,{onVnodeUnmounted:T=>{T.component.isUnmounted&&(f.instances[c]=null)},ref:a}));return Pi(s.default,{Component:D,route:u})||D}}});function Pi(t,e){if(!t)return null;const s=t(e);return s.length===1?s[0]:s}const Oc=_c;function Lc(t){const e=dc(t.routes,t),s=t.parseQuery||bc,n=t.stringifyQuery||Ci,i=t.history,r=Bt(),o=Bt(),l=Bt(),a=Ml(ut);let u=ut;Ct&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=zs.bind(null,A=>""+A),f=zs.bind(null,Va),p=zs.bind(null,ss);function g(A,N){let k,B;return Jr(A)?(k=e.getRecordMatcher(A),B=N):B=A,e.addRoute(B,k)}function _(A){const N=e.getRecordMatcher(A);N&&e.removeRoute(N)}function C(){return e.getRoutes().map(A=>A.record)}function D(A){return!!e.getRecordMatcher(A)}function T(A,N){if(N=J({},N||a.value),typeof A=="string"){const v=Ws(s,A,N.path),w=e.resolve({path:v.path},N),E=i.createHref(v.fullPath);return J(v,w,{params:p(w.params),hash:ss(v.hash),redirectedFrom:void 0,href:E})}let k;if(A.path!=null)k=J({},A,{path:Ws(s,A.path,N.path).path});else{const v=J({},A.params);for(const w in v)v[w]==null&&delete v[w];k=J({},A,{params:f(v)}),N.params=f(N.params)}const B=e.resolve(k,N),Y=A.hash||"";B.params=c(p(B.params));const h=ja(n,J({},A,{hash:Na(Y),path:B.path})),d=i.createHref(h);return J({fullPath:h,hash:Y,query:n===Ci?yc(A.query):A.query||{}},B,{redirectedFrom:void 0,href:d})}function m(A){return typeof A=="string"?Ws(s,A,a.value.path):J({},A)}function b(A,N){if(u!==A)return It(8,{from:N,to:A})}function y(A){return I(A)}function S(A){return y(J(m(A),{replace:!0}))}function O(A){const N=A.matched[A.matched.length-1];if(N&&N.redirect){const{redirect:k}=N;let B=typeof k=="function"?k(A):k;return typeof B=="string"&&(B=B.includes("?")||B.includes("#")?B=m(B):{path:B},B.params={}),J({query:A.query,hash:A.hash,params:B.path!=null?{}:A.params},B)}}function I(A,N){const k=u=T(A),B=a.value,Y=A.state,h=A.force,d=A.replace===!0,v=O(k);if(v)return I(J(m(v),{state:typeof v=="object"?J({},Y,v.state):Y,force:h,replace:d}),N||k);const w=k;w.redirectedFrom=N;let E;return!h&&za(n,B,k)&&(E=It(16,{to:w,from:B}),Ae(B,B,!0,!1)),(E?Promise.resolve(E):K(w,B)).catch(x=>Je(x)?Je(x,2)?x:ye(x):U(x,w,B)).then(x=>{if(x){if(Je(x,2))return I(J({replace:d},m(x.to),{state:typeof x.to=="object"?J({},Y,x.to.state):Y,force:h}),N||w)}else x=pe(w,B,!0,d,Y);return re(w,B,x),x})}function W(A,N){const k=b(A,N);return k?Promise.reject(k):Promise.resolve()}function H(A){const N=we.values().next().value;return N&&typeof N.runWithContext=="function"?N.runWithContext(A):A()}function K(A,N){let k;const[B,Y,h]=Tc(A,N);k=qs(B.reverse(),"beforeRouteLeave",A,N);for(const v of B)v.leaveGuards.forEach(w=>{k.push(dt(w,A,N))});const d=W.bind(null,A,N);return k.push(d),fe(k).then(()=>{k=[];for(const v of r.list())k.push(dt(v,A,N));return k.push(d),fe(k)}).then(()=>{k=qs(Y,"beforeRouteUpdate",A,N);for(const v of Y)v.updateGuards.forEach(w=>{k.push(dt(w,A,N))});return k.push(d),fe(k)}).then(()=>{k=[];for(const v of h)if(v.beforeEnter)if(He(v.beforeEnter))for(const w of v.beforeEnter)k.push(dt(w,A,N));else k.push(dt(v.beforeEnter,A,N));return k.push(d),fe(k)}).then(()=>(A.matched.forEach(v=>v.enterCallbacks={}),k=qs(h,"beforeRouteEnter",A,N,H),k.push(d),fe(k))).then(()=>{k=[];for(const v of o.list())k.push(dt(v,A,N));return k.push(d),fe(k)}).catch(v=>Je(v,8)?v:Promise.reject(v))}function re(A,N,k){l.list().forEach(B=>H(()=>B(A,N,k)))}function pe(A,N,k,B,Y){const h=b(A,N);if(h)return h;const d=N===ut,v=Ct?history.state:{};k&&(B||d?i.replace(A.fullPath,J({scroll:d&&v&&v.scroll},Y)):i.push(A.fullPath,Y)),a.value=A,Ae(A,N,k,d),ye()}let Le;function ot(){Le||(Le=i.listen((A,N,k)=>{if(!Ve.listening)return;const B=T(A),Y=O(B);if(Y){I(J(Y,{replace:!0,force:!0}),B).catch(qt);return}u=B;const h=a.value;Ct&&Za(mi(h.fullPath,k.delta),ks()),K(B,h).catch(d=>Je(d,12)?d:Je(d,2)?(I(J(m(d.to),{force:!0}),B).then(v=>{Je(v,20)&&!k.delta&&k.type===ns.pop&&i.go(-1,!1)}).catch(qt),Promise.reject()):(k.delta&&i.go(-k.delta,!1),U(d,B,h))).then(d=>{d=d||pe(B,h,!1),d&&(k.delta&&!Je(d,8)?i.go(-k.delta,!1):k.type===ns.pop&&Je(d,20)&&i.go(-1,!1)),re(B,h,d)}).catch(qt)}))}let at=Bt(),oe=Bt(),Q;function U(A,N,k){ye(A);const B=oe.list();return B.length?B.forEach(Y=>Y(A,N,k)):console.error(A),Promise.reject(A)}function ae(){return Q&&a.value!==ut?Promise.resolve():new Promise((A,N)=>{at.add([A,N])})}function ye(A){return Q||(Q=!A,ot(),at.list().forEach(([N,k])=>A?k(A):N()),at.reset()),A}function Ae(A,N,k,B){const{scrollBehavior:Y}=t;if(!Ct||!Y)return Promise.resolve();const h=!k&&Xa(mi(A.fullPath,0))||(B||!k)&&history.state&&history.state.scroll||null;return ar().then(()=>Y(A,N,h)).then(d=>d&&Ja(d)).catch(d=>U(d,A,N))}const te=A=>i.go(A);let ct;const we=new Set,Ve={currentRoute:a,listening:!0,addRoute:g,removeRoute:_,clearRoutes:e.clearRoutes,hasRoute:D,getRoutes:C,resolve:T,options:t,push:y,replace:S,go:te,back:()=>te(-1),forward:()=>te(1),beforeEach:r.add,beforeResolve:o.add,afterEach:l.add,onError:oe.add,isReady:ae,install(A){const N=this;A.component("RouterLink",Sc),A.component("RouterView",Oc),A.config.globalProperties.$router=N,Object.defineProperty(A.config.globalProperties,"$route",{enumerable:!0,get:()=>wt(a)}),Ct&&!ct&&a.value===ut&&(ct=!0,y(i.location).catch(Y=>{}));const k={};for(const Y in ut)Object.defineProperty(k,Y,{get:()=>a.value[Y],enumerable:!0});A.provide(kn,N),A.provide(tl,sr(k)),A.provide(fn,a);const B=A.unmount;we.add(A),A.unmount=function(){we.delete(A),we.size<1&&(u=ut,Le&&Le(),Le=null,a.value=ut,ct=!1,Q=!1),B()}}};function fe(A){return A.reduce((N,k)=>N.then(()=>H(k)),Promise.resolve())}return Ve}function Tc(t,e){const s=[],n=[],i=[],r=Math.max(e.matched.length,t.matched.length);for(let o=0;okt(u,l))?n.push(l):s.push(l));const a=t.matched[o];a&&(e.matched.find(u=>kt(u,a))||i.push(a))}return[s,n,i]}const Pc=Lc({history:nc(),linkActiveClass:"active",routes:[{path:"/",name:"Home",component:()=>Qe(()=>import("./home.js"),__vite__mapDeps([0,1]))},{path:"/install",name:"Install",component:()=>Qe(()=>import("./install.js"),[])},{path:"/selects",name:"Selects",component:()=>Qe(()=>import("./selects.js"),[])},{path:"/data",name:"Data",component:()=>Qe(()=>import("./data.js"),[])},{path:"/examples",name:"Examples",component:()=>Qe(()=>import("./index2.js"),__vite__mapDeps([2,3]))},{path:"/settings",name:"Settings",component:()=>Qe(()=>import("./index3.js"),__vite__mapDeps([4,5]))},{path:"/events",name:"Events",component:()=>Qe(()=>import("./index4.js"),[])},{path:"/methods",name:"Methods",component:()=>Qe(()=>import("./index5.js"),[])},{path:"/vue",name:"Vue",component:()=>Qe(()=>import("./vue.js"),[])}]});class Rc{constructor(e){e||(e={}),this.main=e.main||"ss-main",this.placeholder=e.placeholder||"ss-placeholder",this.values=e.values||"ss-values",this.single=e.single||"ss-single",this.max=e.max||"ss-max",this.value=e.value||"ss-value",this.valueText=e.valueText||"ss-value-text",this.valueDelete=e.valueDelete||"ss-value-delete",this.valueOut=e.valueOut||"ss-value-out",this.deselect=e.deselect||"ss-deselect",this.deselectPath=e.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=e.arrow||"ss-arrow",this.arrowClose=e.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=e.arrowOpen||"M10,70 L50,30 L90,70",this.content=e.content||"ss-content",this.openAbove=e.openAbove||"ss-open-above",this.openBelow=e.openBelow||"ss-open-below",this.search=e.search||"ss-search",this.searchHighlighter=e.searchHighlighter||"ss-search-highlight",this.searching=e.searching||"ss-searching",this.addable=e.addable||"ss-addable",this.addablePath=e.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=e.list||"ss-list",this.optgroup=e.optgroup||"ss-optgroup",this.optgroupLabel=e.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=e.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=e.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=e.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=e.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=e.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=e.optgroupClosable||"ss-closable",this.option=e.option||"ss-option",this.optionDelete=e.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=e.highlighted||"ss-highlighted",this.open=e.open||"ss-open",this.close=e.close||"ss-close",this.selected=e.selected||"ss-selected",this.error=e.error||"ss-error",this.disabled=e.disabled||"ss-disabled",this.hide=e.hide||"ss-hide"}}function In(){return Math.random().toString(36).substring(2,10)}function Dc(t,e){function s(i,r){return r&&i&&i.classList&&i.classList.contains(r)||r&&i&&i.dataset&&i.dataset.id&&i.dataset.id===e?i:null}function n(i,r){return!i||i===document?null:s(i,r)?i:n(i.parentNode,r)}return s(t,e)||n(t,e)}function Kt(t,e=50,s=!1){let n;return function(...i){const r=self,o=()=>{n=null,s||t.apply(r,i)},l=s&&!n;clearTimeout(n),n=setTimeout(o,e),l&&t.apply(r,i)}}function Gs(t,e){return JSON.stringify(t)===JSON.stringify(e)}function kc(t){const e=t.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,s=>"-"+s.toLowerCase());return t[0]===t[0].toUpperCase()?e.substring(1):e}class Me{constructor(e){if(this.id=!e.id||e.id===""?In():e.id,this.label=e.label||"",this.selectAll=e.selectAll===void 0?!1:e.selectAll,this.selectAllText=e.selectAllText||"Select All",this.closable=e.closable||"off",this.options=[],e.options)for(const s of e.options)this.options.push(new ue(s))}}class ue{constructor(e){this.id=!e.id||e.id===""?In():e.id,this.value=e.value===void 0?e.text:e.value,this.text=e.text||"",this.html=e.html||"",this.defaultSelected=e.defaultSelected!==void 0?e.defaultSelected:!1,this.selected=e.selected!==void 0?e.selected:!1,this.display=e.display!==void 0?e.display:!0,this.disabled=e.disabled!==void 0?e.disabled:!1,this.mandatory=e.mandatory!==void 0?e.mandatory:!1,this.placeholder=e.placeholder!==void 0?e.placeholder:!1,this.class=e.class||"",this.style=e.style||"",this.data=e.data||{}}}class Ic{constructor(e,s){this.selectType="single",this.data=[],this.selectedOrder=[],this.selectType=e,this.setData(s)}validateDataArray(e){if(!Array.isArray(e))return new Error("Data must be an array");for(let s of e)if(s instanceof Me||"label"in s){if(!("label"in s))return new Error("Optgroup must have a label");if("options"in s&&s.options)for(let n of s.options){const i=this.validateOption(n);if(i)return i}}else if(s instanceof ue||"text"in s){const n=this.validateOption(s);if(n)return n}else return new Error("Data object must be a valid optgroup or option");return null}validateOption(e){return"text"in e?null:new Error("Option must have a text")}partialToFullData(e){let s=[];return e.forEach(n=>{if(n instanceof Me||"label"in n){let i=[];"options"in n&&n.options&&n.options.forEach(r=>{i.push(new ue(r))}),i.length>0&&s.push(new Me(n))}(n instanceof ue||"text"in n)&&s.push(new ue(n))}),s}setData(e){this.data=this.partialToFullData(e),this.selectType==="single"&&this.setSelectedBy("id",this.getSelected())}getData(){return this.filter(null,!0)}getDataOptions(){return this.filter(null,!1)}addOption(e,s=!1){if(s){let n=[new ue(e)];this.setData(n.concat(this.getData()))}else this.setData(this.getData().concat(new ue(e)))}setSelectedBy(e,s){let n=null,i=!1;const r=[];for(let l of this.data){if(l instanceof Me)for(let a of l.options)n||(n=a),a.selected=i?!1:s.includes(a[e]),a.selected&&(r.push(a),this.selectType==="single"&&(i=!0));l instanceof ue&&(n||(n=l),l.selected=i?!1:s.includes(l[e]),l.selected&&(r.push(l),this.selectType==="single"&&(i=!0)))}this.selectType==="single"&&n&&!i&&(n.selected=!0,r.push(n));const o=s.map(l=>{var a;return((a=r.find(u=>u[e]===l))==null?void 0:a.id)||""});this.selectedOrder=o}getSelected(){return this.getSelectedOptions().map(e=>e.id)}getSelectedValues(){return this.getSelectedOptions().map(e=>e.value)}getSelectedOptions(){return this.filter(e=>e.selected,!1)}getOptgroupByID(e){for(let s of this.data)if(s instanceof Me&&s.id===e)return s;return null}getOptionByID(e){let s=this.filter(n=>n.id===e,!1);return s.length?s[0]:null}getSelectType(){return this.selectType}getFirstOption(){let e=null;for(let s of this.data)if(s instanceof Me?e=s.options[0]:s instanceof ue&&(e=s),e)break;return e}search(e,s){return e=e.trim(),e===""?this.getData():this.filter(n=>s(n,e),!0)}filter(e,s){const n=[];return this.data.forEach(i=>{if(i instanceof Me){let r=[];if(i.options.forEach(o=>{(!e||e(o))&&(s?r.push(new ue(o)):n.push(new ue(o)))}),r.length>0){let o=new Me(i);o.options=r,n.push(o)}}i instanceof ue&&(!e||e(i))&&n.push(new ue(i))}),n}selectedOrderOptions(e){const s=[];return this.selectedOrder.forEach(n=>{const i=e.find(r=>r.id===n);i&&s.push(i)}),e.forEach(n=>{let i=!1;s.forEach(r=>{if(n.id===r.id){i=!0;return}}),i||s.push(n)}),s}}const ke=class ke{static getLiveAssertive(){let e=document.getElementById("ss-live-assertive");return e||(e=document.createElement("div"),e.id="ss-live-assertive",e.setAttribute("role","status"),e.setAttribute("aria-live","assertive"),e.setAttribute("aria-atomic","true"),e.className="ss-sr-only",document.body.appendChild(e)),e}_announceAssertive(e){const s=ke._liveAssertive||(ke._liveAssertive=ke.getLiveAssertive());s.textContent="",requestAnimationFrame(()=>{s.textContent=e})}clearHighlights(){this.content.list.querySelectorAll("."+this.classes.highlighted).forEach(s=>s.classList.remove(this.classes.highlighted)),this.content.search.input.removeAttribute("aria-activedescendant")}constructor(e,s,n,i){var o;this.store=n,this.settings=e,this.classes=s,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.main.values.setAttribute("role","list"),this.updateAriaAttributes();const r=(o=document.querySelector(`[data-id="${this.settings.id}"]`))==null?void 0:o.closest(".offcanvas-body");r?r.appendChild(this.content.main):this.settings.contentLocation&&this.settings.contentLocation.appendChild(this.content.main)}static getLivePolite(){let e=document.getElementById("ss-live-polite");return e||(e=document.createElement("div"),e.id="ss-live-polite",e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),e.className="ss-sr-only",document.body.appendChild(e)),e}_announcePolite(e){const s=ke._livePolite||(ke._livePolite=ke.getLivePolite());s.textContent="",requestAnimationFrame(()=>{s.textContent=e})}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.content.search.input.setAttribute("aria-expanded","true"),this.moveContent();const e=this.store.getSelectedOptions();if(e.length){const s=e[e.length-1].id,n=this.content.list.querySelector('[data-id="'+s+'"]');n&&this.ensureElementInView(this.content.list,n)}this.settings.contentPosition==="fixed"&&(this.moveContent(),this.scrollHandler=()=>this.moveContent(),this.resizeHandler=()=>this.moveContent(),window.addEventListener("scroll",this.scrollHandler,!0),window.addEventListener("resize",this.resizeHandler)),this.searchFocus()}close(){this.main.main.classList.remove(this.classes.openAbove,this.classes.openBelow),this.content.search.input.setAttribute("aria-expanded","false"),this.content.main.classList.remove(this.classes.openAbove,this.classes.openBelow),this.main.arrow.path.setAttribute("d",this.classes.arrowClose),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=void 0),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=void 0),this.clearHighlights(),this.main.main.focus({preventScroll:!0})}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.main.main.classList.add("ss-2"),this.content.main.classList.add(this.classes.content),this.content.main.classList.add("ss-content-2"),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()));(this.settings.contentPosition==="relative"||this.settings.contentPosition==="fixed")&&this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){var i;this.content.list.setAttribute("role","listbox"),this.content.list.setAttribute("id",this.content.main.id+"-list"),this.content.list.setAttribute("aria-label",this.settings.contentAriaLabel),this.settings.isMultiple&&this.content.list.setAttribute("aria-multiselectable","true"),this.main.main.removeAttribute("aria-labelledby"),this.main.main.removeAttribute("aria-label");const e=this.content.search.input;e.setAttribute("role","combobox"),e.setAttribute("aria-haspopup","listbox"),e.setAttribute("aria-controls",this.content.list.id),e.setAttribute("aria-owns",this.content.list.id),e.setAttribute("aria-expanded","false"),e.setAttribute("aria-autocomplete","list");let s=(this.settings.ariaLabelledBy||"").trim(),n=null;if(s)n=document.getElementById(s);else{const r=document.querySelector(`select[data-id="${this.settings.id}"]`);r&&(r.id&&(n=document.querySelector(`label[for="${r.id}"]`)),!n&&((i=r.previousElementSibling)==null?void 0:i.tagName)==="LABEL"&&(n=r.previousElementSibling),n&&(n.id||(n.id=(r.id||this.settings.id)+"-label"),s=n.id))}s&&document.getElementById(s)?this.main.main.setAttribute("aria-labelledby",s):this.settings.ariaLabel&&this.settings.ariaLabel.trim()&&this.main.main.setAttribute("aria-label",this.settings.ariaLabel.trim()),this.content.search.input.setAttribute("aria-controls",this.content.list.id),this.content.search.input.setAttribute("aria-autocomplete","list"),s&&document.getElementById(s)?this.content.search.input.setAttribute("aria-labelledby",s):this.settings.searchLabelledBy&&document.getElementById(this.settings.searchLabelledBy)?this.content.search.input.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel?this.content.search.input.setAttribute("aria-label",this.settings.searchAriaLabel):this.content.search.input.setAttribute("aria-label","Search options")}mainDiv(){var u;const e=document.createElement("div");e.id=this.settings.id+"-main",e.tabIndex=0,e.onkeydown=c=>{if(c.target!==e)return!0;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 f=this.content.list.querySelector("."+this.classes.highlighted);return f&&f.click(),!1;case"Escape":return this.callbacks.close(),!1}return c.key.length===1&&this.callbacks.open(),!0},e.onclick=c=>{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 n=document.createElement("div");n.classList.add(this.classes.deselect),n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label",this.settings.clearAllAriaLabel),n.addEventListener("keydown",c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),c.stopPropagation(),n.click())});const i=(u=this.store)==null?void 0:u.getSelectedOptions();!this.settings.allowDeselect||this.settings.isMultiple&&i&&i.length<=0?n.classList.add(this.classes.hide):n.classList.remove(this.classes.hide),n.onclick=c=>{if(c.stopPropagation(),this.settings.disabled)return;let f=!0;const p=this.store.getSelectedOptions(),g=[];if(this.callbacks.beforeChange&&(f=this.callbacks.beforeChange(g,p)===!0),f){if(this.settings.isMultiple)this.callbacks.setSelected([],!1),this.updateDeselectAll();else{const _=this.store.getFirstOption(),C=_?_.id:"";this.callbacks.setSelected(C,!1)}this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(this.store.getSelectedOptions())}};const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("viewBox","0 0 100 100"),r.setAttribute("aria-hidden","true"),r.setAttribute("focusable","false");const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.deselectPath),r.appendChild(o),n.appendChild(r),e.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.classList.add(this.classes.arrow),l.setAttribute("viewBox","0 0 100 100"),l.setAttribute("aria-hidden","true"),l.setAttribute("focusable","false");const a=document.createElementNS("http://www.w3.org/2000/svg","path");return a.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&l.classList.add(this.classes.hide),l.appendChild(a),e.appendChild(l),{main:e,values:s,deselect:{main:n,svg:r,path:o},arrow:{main:l,path:a}}}mainFocus(e){e!=="click"&&this.main.main.focus({preventScroll:!0})}placeholder(){const e=this.store.filter(i=>i.placeholder,!1);let s=this.settings.placeholderText;e.length&&(e[0].html!==""?s=e[0].html:e[0].text!==""&&(s=e[0].text));const n=document.createElement("div");return n.classList.add(this.classes.placeholder),n.innerHTML=s,n}renderValues(){if(!this.settings.isMultiple){this.renderSingleValue();return}this.renderMultipleValues(),this.updateDeselectAll()}renderSingleValue(){const e=this.store.filter(n=>n.selected&&!n.placeholder,!1),s=e.length>0?e[0]:null;if(!s)this.main.values.innerHTML=this.placeholder().outerHTML;else{const n=document.createElement("div");n.classList.add(this.classes.single),s.html?n.innerHTML=s.html:n.innerText=s.text,this.main.values.innerHTML=n.outerHTML}!this.settings.allowDeselect||!e.length?this.main.deselect.main.classList.add(this.classes.hide):this.main.deselect.main.classList.remove(this.classes.hide)}renderMultipleValues(){let e=this.main.values.childNodes,s=this.store.filter(i=>i.selected&&i.display,!1);if(s.length===0){this.main.values.innerHTML=this.placeholder().outerHTML;return}else{const i=this.main.values.querySelector("."+this.classes.placeholder);i&&i.remove()}if(s.length>this.settings.maxValuesShown){const i=document.createElement("div");i.classList.add(this.classes.max),i.textContent=this.settings.maxValuesMessage.replace("{number}",s.length.toString()),this.main.values.innerHTML=i.outerHTML;return}else{const i=this.main.values.querySelector("."+this.classes.max);i&&i.remove()}this.settings.keepOrder&&(s=this.store.selectedOrderOptions(s));let n=[];for(let i=0;ia.id===o,!1).length||n.push(r))}for(const i of n)i.classList.add(this.classes.valueOut),setTimeout(()=>{this.main.values.hasChildNodes()&&this.main.values.contains(i)&&this.main.values.removeChild(i)},100);e=this.main.values.childNodes;for(let i=0;i{if(u.preventDefault(),u.stopPropagation(),this.settings.disabled)return;let c=!0;const f=this.store.getSelectedOptions(),p=f.filter(g=>g.selected&&g.id!==e.id,!0);if(!(this.settings.minSelected&&p.length{this.main.main.focus({preventScroll:!0})})}};const l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.setAttribute("viewBox","0 0 100 100"),l.setAttribute("aria-hidden","true"),l.setAttribute("focusable","false");const a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("d",this.classes.optionDelete),l.appendChild(a),i.appendChild(l),s.appendChild(i),i.onkeydown=u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),u.stopPropagation(),i.click())},s.addEventListener("keydown",u=>{u.key==="Enter"||u.key===" "?(u.preventDefault(),u.stopPropagation()):(u.key==="Delete"||u.key==="Backspace")&&(u.preventDefault(),u.stopPropagation(),i==null||i.click())}),s.addEventListener("focusin",()=>{s.setAttribute("aria-describedby",r),i.removeAttribute("aria-hidden"),i.tabIndex=0}),s.addEventListener("focusout",()=>{s.removeAttribute("aria-describedby"),i.setAttribute("aria-hidden","true"),i.tabIndex=-1})}return s}contentDiv(){const e=document.createElement("div");e.id=this.settings.id+"-content";const s=this.searchDiv();e.appendChild(s.main);const n=this.listDiv();return e.appendChild(n),{main:e,search:s,list:n}}moveContent(){if(this.settings.contentPosition==="relative"){this.moveContentBelow();return}if(this.settings.openPosition==="down"){this.moveContentBelow();return}else if(this.settings.openPosition==="up"){this.moveContentAbove();return}this.putContent()==="up"?this.moveContentAbove():this.moveContentBelow()}searchDiv(){const e=document.createElement("div"),s=document.createElement("input"),n=document.createElement("div");e.classList.add(this.classes.search);const i={main:e,input:s};if(this.settings.showSearch||(e.classList.add(this.classes.hide),s.readOnly=!0),s.type="text",s.placeholder=this.settings.searchPlaceholder,s.tabIndex=-1,this.settings.searchLabelledBy&&this.settings.searchLabelledBy.trim()?s.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel&&this.settings.searchAriaLabel.trim()?s.setAttribute("aria-label",this.settings.searchAriaLabel):s.setAttribute("aria-label","Search options"),s.setAttribute("autocapitalize","off"),s.setAttribute("autocomplete","off"),s.setAttribute("autocorrect","off"),s.oninput=Kt(r=>{this.callbacks.search(r.target.value)},100),s.onkeydown=r=>{switch(r.key){case"ArrowUp":case"ArrowDown":return r.key==="ArrowDown"?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Escape":return this.callbacks.close(),!1;case" ":const o=this.content.list.querySelector("."+this.classes.highlighted);return o?(o.click(),!1):!0;case"Enter":if(this.callbacks.addable)return n.click(),!1;{const l=this.content.list.querySelector("."+this.classes.highlighted);if(l)return l.click(),!1}return!0}return!0},e.appendChild(s),this.callbacks.addable){n.classList.add(this.classes.addable);const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("viewBox","0 0 100 100"),r.setAttribute("aria-hidden","true"),r.setAttribute("focusable","false");const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.addablePath),r.appendChild(o),n.appendChild(r),n.onclick=l=>{if(l.preventDefault(),l.stopPropagation(),!this.callbacks.addable)return;const a=this.content.search.input.value.trim();if(a===""){this.content.search.input.focus();return}const u=f=>{let p=new ue(f);if(this.callbacks.addOption(p),this.settings.isMultiple){let g=this.store.getSelected();g.push(p.id),this.callbacks.setSelected(g,!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(f=>{typeof f=="string"?u({text:f,value:f}):c instanceof Error?this.renderError(c.message):u(f)}):typeof c=="string"?u({text:c,value:c}):c instanceof Error?this.renderError(c.message):u(c))},e.appendChild(n),i.addable={main:n,svg:r,path:o}}return i}searchFocus(){this.content.search.input.focus()}getOptions(e=!1,s=!1,n=!1){let i="."+this.classes.option;return e&&(i+=":not(."+this.classes.placeholder+")"),s&&(i+=":not(."+this.classes.disabled+")"),n&&(i+=":not(."+this.classes.hide+")"),Array.from(this.content.list.querySelectorAll(i))}highlight(e){const s=this.getOptions(!0,!0,!0);if(s.length===0)return;if(s.length===1&&!s[0].classList.contains(this.classes.highlighted)){s[0].classList.add(this.classes.highlighted);return}let n=!1;for(const r of s)r.classList.contains(this.classes.highlighted)&&(n=!0);if(!n){for(const r of s)if(r.classList.contains(this.classes.selected)){r.classList.add(this.classes.highlighted);break}}for(let r=0;r=0?r-1:s.length-1];a.classList.add(this.classes.highlighted),this.content.search.input.setAttribute("aria-activedescendant",a.id),this.ensureElementInView(this.content.list,a);const u=a.parentElement;if(u&&u.classList.contains(this.classes.close)){const c=u.querySelector("."+this.classes.optgroupLabel);c&&c.click()}return}const i=s[e==="down"?0:s.length-1];i.classList.add(this.classes.highlighted),this.content.search.input.setAttribute("aria-activedescendant",i.id),this.ensureElementInView(this.content.list,i)}listDiv(){const e=document.createElement("div");return e.classList.add(this.classes.list),e}renderError(e){this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy");const s=document.createElement("div");s.classList.add(this.classes.error),s.textContent=e,this.content.list.appendChild(s),this._announceAssertive(e)}renderSearching(){this.content.list.innerHTML="",this.content.list.setAttribute("aria-busy","true");const e=document.createElement("div");e.classList.add(this.classes.searching),e.textContent=this.settings.searchingText,this.content.list.appendChild(e),this._announcePolite(this.settings.searchingText)}renderOptions(e){if(this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy"),e.length===0){const l=document.createElement("div");l.classList.add(this.classes.search);const a=this.callbacks.addable?this.settings.addableText.replace("{value}",this.content.search.input.value):this.settings.searchText;this._announcePolite(a),l.innerHTML=a,this.content.list.appendChild(l),this.content.list.setAttribute("aria-setsize","0");return}this.settings.allowDeselect&&!this.settings.isMultiple&&(this.store.filter(a=>a.placeholder,!1).length||this.store.addOption(new ue({text:"",value:"",selected:!1,placeholder:!0}),!0));const s=document.createDocumentFragment();let n=0;const i=e.filter(l=>l instanceof ue&&!l.placeholder&&l.display&&!l.disabled).length,r=l=>{!l.classList.contains(this.classes.placeholder)&&!l.classList.contains(this.classes.disabled)&&!l.classList.contains(this.classes.hide)&&(l.setAttribute("aria-posinset",String(++n)),l.setAttribute("aria-setsize",String(i)))};for(const l of e){if(l instanceof Me){const a=document.createElement("div");a.classList.add(this.classes.optgroup),a.setAttribute("role","group"),a.setAttribute("aria-label",l.label);const u=document.createElement("div");u.classList.add(this.classes.optgroupLabel),a.appendChild(u);const c=document.createElement("div");c.classList.add(this.classes.optgroupLabelText),c.textContent=l.label,u.appendChild(c);const f=document.createElement("div");if(f.classList.add(this.classes.optgroupActions),u.appendChild(f),this.settings.isMultiple&&l.selectAll){const p=document.createElement("div");p.classList.add(this.classes.optgroupSelectAll);let g=!0;for(const m of l.options)if(!m.selected){g=!1;break}g&&p.classList.add(this.classes.selected);const _=document.createElement("span");_.textContent=l.selectAllText,p.appendChild(_);const C=document.createElementNS("http://www.w3.org/2000/svg","svg");C.setAttribute("viewBox","0 0 100 100"),C.setAttribute("aria-hidden","true"),C.setAttribute("focusable","false"),p.appendChild(C);const D=document.createElementNS("http://www.w3.org/2000/svg","path");D.setAttribute("d",this.classes.optgroupSelectAllBox),C.appendChild(D);const T=document.createElementNS("http://www.w3.org/2000/svg","path");T.setAttribute("d",this.classes.optgroupSelectAllCheck),C.appendChild(T),p.addEventListener("click",m=>{m.preventDefault(),m.stopPropagation();const b=this.store.getSelected();if(g){const y=b.filter(S=>{for(const O of l.options)if(S===O.id)return!1;return!0});this.callbacks.setSelected(y,!0);return}else{const y=b.concat(l.options.map(S=>S.id));for(const S of l.options)this.store.getOptionByID(S.id)||this.callbacks.addOption(S);this.callbacks.setSelected(y,!0);return}}),f.appendChild(p)}if(l.closable!=="off"){const p=document.createElement("div");p.classList.add(this.classes.optgroupClosable);const g=document.createElementNS("http://www.w3.org/2000/svg","svg");g.setAttribute("viewBox","0 0 100 100"),g.classList.add(this.classes.arrow),g.setAttribute("aria-hidden","true"),g.setAttribute("focusable","false"),p.appendChild(g);const _=document.createElementNS("http://www.w3.org/2000/svg","path");g.appendChild(_),l.options.some(C=>C.selected)||this.content.search.input.value.trim()!==""?(a.classList.add(this.classes.open),_.setAttribute("d",this.classes.arrowOpen)):l.closable==="open"?(a.classList.add(this.classes.open),_.setAttribute("d",this.classes.arrowOpen)):l.closable==="close"&&(a.classList.add(this.classes.close),_.setAttribute("d",this.classes.arrowClose)),u.addEventListener("click",C=>{C.preventDefault(),C.stopPropagation(),a.classList.contains(this.classes.close)?(a.classList.remove(this.classes.close),a.classList.add(this.classes.open),_.setAttribute("d",this.classes.arrowOpen)):(a.classList.remove(this.classes.open),a.classList.add(this.classes.close),_.setAttribute("d",this.classes.arrowClose))}),f.appendChild(p)}a.appendChild(u);for(const p of l.options){const g=this.option(p);r(g),a.appendChild(g)}s.appendChild(a)}if(l instanceof ue){const a=this.option(l);r(a),s.appendChild(a)}}this.content.list.appendChild(s),this.content.list.removeAttribute("aria-busy");const o=this.getOptions(!0,!0,!0).length;this._announcePolite(`${o} option${o===1?"":"s"} available`)}option(e){if(e.placeholder){const n=document.createElement("div");return n.classList.add(this.classes.option),n.classList.add(this.classes.hide),n}const s=document.createElement("div");return s.dataset.id=e.id,s.id=`${this.settings.id}__opt__${e.id}`,s.classList.add(this.classes.option),s.setAttribute("role","option"),e.class&&e.class.split(" ").forEach(n=>{s.classList.add(n)}),e.style&&(s.style.cssText=e.style),this.settings.searchHighlight&&this.content.search.input.value.trim()!==""?s.innerHTML=this.highlightText(e.html!==""?e.html:e.text,this.content.search.input.value,this.classes.searchHighlighter):e.html!==""?s.innerHTML=e.html:s.textContent=e.text,this.settings.showOptionTooltips&&s.textContent&&s.setAttribute("title",s.textContent),e.display||s.classList.add(this.classes.hide),e.disabled&&(s.classList.add(this.classes.disabled),s.setAttribute("aria-disabled","true")),e.selected&&this.settings.hideSelected&&s.classList.add(this.classes.hide),e.selected?(s.classList.add(this.classes.selected),s.setAttribute("aria-selected","true"),this.content.search.input.setAttribute("aria-activedescendant",s.id)):(s.classList.remove(this.classes.selected),s.setAttribute("aria-selected","false")),s.addEventListener("click",n=>{n.preventDefault(),n.stopPropagation();const i=this.store.getSelected(),r=n.currentTarget,o=String(r.dataset.id);if(e.disabled||e.selected&&!this.settings.allowDeselect||this.settings.isMultiple&&this.settings.maxSelected<=i.length&&!e.selected||this.settings.isMultiple&&this.settings.minSelected>=i.length&&e.selected)return;let l=!1;const a=this.store.getSelectedOptions();let u=[];if(this.settings.isMultiple){if(e.selected)u=a.filter(c=>c.id!==o);else if(u=a.concat(e),!this.settings.closeOnSelect)if(n.shiftKey&&this.lastSelectedOption){const c=this.store.getDataOptions();let f=c.findIndex(g=>g.id===this.lastSelectedOption.id),p=c.findIndex(g=>g.id===e.id);if(f>=0&&p>=0){const g=Math.min(f,p),_=Math.max(f,p),C=c.slice(g,_+1);C.length>0&&C.length!a.find(T=>T.id===D.id))))}}else e.selected||(this.lastSelectedOption=e)}this.settings.isMultiple||(e.selected?u=[]:u=[e]),this.callbacks.beforeChange||(l=!0),this.callbacks.beforeChange&&(this.callbacks.beforeChange(u,a)===!1?l=!1:l=!0),l&&(this.store.getOptionByID(o)||this.callbacks.addOption(e),this.callbacks.setSelected(u.map(c=>c.id),!1),this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(u))}),s}destroy(){this.main.main.remove(),this.content.main.remove()}highlightText(e,s,n){let i=e;const r=new RegExp("(?![^<]*>)("+s.trim()+")(?![^<]*>[^<>]*${a}`),i}moveContentAbove(){const e=this.main.main.offsetHeight,s=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 n=this.main.main.getBoundingClientRect();this.content.main.style.margin="-"+(e+s-1)+"px 0px 0px 0px",this.content.main.style.top=n.top+n.height+(this.settings.contentPosition==="fixed"?0:window.scrollY)+"px",this.content.main.style.left=n.left+(this.settings.contentPosition==="fixed"?0:window.scrollX)+"px",this.content.main.style.width=n.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",this.settings.contentPosition!=="relative"&&(this.content.main.style.top=e.top+e.height+(this.settings.contentPosition==="fixed"?0:window.scrollY)+"px",this.content.main.style.left=e.left+(this.settings.contentPosition==="fixed"?0:window.scrollX)+"px",this.content.main.style.width=e.width+"px")}ensureElementInView(e,s){const n=e.scrollTop+e.offsetTop,i=n+e.clientHeight,r=s.offsetTop,o=r+s.clientHeight;ri&&(e.scrollTop+=o-i)}putContent(){const e=this.main.main.offsetHeight,s=this.main.main.getBoundingClientRect(),n=this.content.main.offsetHeight;return window.innerHeight-(s.top+e)<=n&&s.top>n?"up":"down"}updateDeselectAll(){if(!this.store||!this.settings)return;const e=this.store.getSelectedOptions(),s=e&&e.length>0,n=this.settings.isMultiple,i=this.settings.allowDeselect,r=this.main.deselect.main,o=this.classes.hide;i&&!(n&&!s)?r.classList.remove(o):r.classList.add(o)}};ke._livePolite=null,ke._liveAssertive=null;let hn=ke;class Fc{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.getSelectedOptions()),!0}observeCall(e){if(!this.listen)return;let s=!1,n=!1,i=!1;for(const r of e){if(r.target===this.select&&(r.attributeName==="disabled"&&(n=!0),r.attributeName==="class"&&(s=!0),r.type==="childList")){for(const o of r.addedNodes)if(o.nodeName==="OPTION"&&o.value===this.select.value){this.select.dispatchEvent(new Event("change"));break}i=!0}(r.target.nodeName==="OPTGROUP"||r.target.nodeName==="OPTION")&&(i=!0)}s&&this.onClassChange&&this.onClassChange(this.select.className.split(" ")),n&&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 s=this.select.childNodes;for(const n of s)n.nodeName==="OPTGROUP"&&e.push(this.getDataFromOptgroup(n)),n.nodeName==="OPTION"&&e.push(this.getDataFromOption(n));return e}getDataFromOptgroup(e){let s={id:e.id,label:e.label,selectAll:e.dataset?e.dataset.selectall==="true":!1,selectAllText:e.dataset?e.dataset.selectalltext:"Select all",closable:e.dataset?e.dataset.closable:"off",options:[]};const n=e.childNodes;for(const i of n)i.nodeName==="OPTION"&&s.options.push(this.getDataFromOption(i));return s}getDataFromOption(e){return{id:e.id,value:e.value,text:e.text,html:e.dataset&&e.dataset.html?e.dataset.html:"",defaultSelected:e.defaultSelected,selected:e.selected,display:e.style.display!=="none",disabled:e.disabled,mandatory:e.dataset?e.dataset.mandatory==="true":!1,placeholder:e.dataset.placeholder==="true",class:e.className,style:e.style.cssText,data:e.dataset}}getSelectedOptions(){let e=[];const s=this.select.childNodes;for(const n of s){if(n.nodeName==="OPTGROUP"){const i=n.childNodes;for(const r of i)if(r.nodeName==="OPTION"){const o=r;o.selected&&e.push(this.getDataFromOption(o))}}if(n.nodeName==="OPTION"){const i=n;i.selected&&e.push(this.getDataFromOption(i))}}return e}getSelectedValues(){return this.getSelectedOptions().map(e=>e.value)}setSelected(e){this.changeListen(!1);const s=this.select.childNodes;for(const n of s){if(n.nodeName==="OPTGROUP"){const r=n.childNodes;for(const o of r)if(o.nodeName==="OPTION"){const l=o;l.selected=e.includes(l.id)}}if(n.nodeName==="OPTION"){const i=n;i.selected=e.includes(i.id)}}this.changeListen(!0)}setSelectedByValue(e){this.changeListen(!1);const s=this.select.childNodes;for(const n of s){if(n.nodeName==="OPTGROUP"){const r=n.childNodes;for(const o of r)if(o.nodeName==="OPTION"){const l=o;l.selected=e.includes(l.value)}}if(n.nodeName==="OPTION"){const i=n;i.selected=e.includes(i.value)}}this.changeListen(!0)}updateSelect(e,s,n){this.changeListen(!1),e&&(this.select.dataset.id=e),s&&(this.select.style.cssText=s),n&&(this.select.className="",n.forEach(i=>{i.trim()!==""&&this.select.classList.add(i.trim())})),this.changeListen(!0)}updateOptions(e){this.changeListen(!1),this.select.innerHTML="";for(const s of e)s instanceof Me&&this.select.appendChild(this.createOptgroup(s)),s instanceof ue&&this.select.appendChild(this.createOption(s));this.select.dispatchEvent(new Event("change",{bubbles:!0})),this.changeListen(!0)}createOptgroup(e){const s=document.createElement("optgroup");if(s.id=e.id,s.label=e.label,e.selectAll&&(s.dataset.selectAll="true"),e.closable!=="off"&&(s.dataset.closable=e.closable),e.options)for(const n of e.options)s.appendChild(this.createOption(n));return s}createOption(e){const s=document.createElement("option");return s.id=e.id,s.value=e.value,s.textContent=e.text,e.html!==""&&s.setAttribute("data-html",e.html),s.defaultSelected=e.defaultSelected,s.selected=e.selected,e.disabled&&(s.disabled=!0),e.display||(s.style.display="none"),e.placeholder&&s.setAttribute("data-placeholder","true"),e.mandatory&&s.setAttribute("data-mandatory","true"),e.class&&e.class.split(" ").forEach(n=>{s.classList.add(n)}),e.data&&typeof e.data=="object"&&Object.keys(e.data).forEach(n=>{s.setAttribute("data-"+kc(n),e.data[n])}),s}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 Mc{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-"+In(),this.style=e.style||"",this.class=e.class||[],this.disabled=e.disabled!==void 0?e.disabled:!1,this.alwaysOpen=e.alwaysOpen!==void 0?e.alwaysOpen:!1,this.showSearch=e.showSearch!==void 0?e.showSearch:!0,this.focusSearch=e.focusSearch!==void 0?e.focusSearch:!0,this.ariaLabel=e.ariaLabel||"",this.searchPlaceholder=e.searchPlaceholder||"Search",this.searchText=e.searchText||"No Results",this.searchingText=e.searchingText||"Searching...",this.searchHighlight=e.searchHighlight!==void 0?e.searchHighlight:!1,this.closeOnSelect=e.closeOnSelect!==void 0?e.closeOnSelect:!0,this.contentLocation=e.contentLocation||document.body,this.contentPosition=e.contentPosition||"absolute",this.openPosition=e.openPosition||"auto",this.contentAriaLabel=e.contentAriaLabel!==void 0?e.contentAriaLabel:"Select an option",this.placeholderText=e.placeholderText!==void 0?e.placeholderText:"Select Value",this.allowDeselect=e.allowDeselect!==void 0?e.allowDeselect:!1,this.hideSelected=e.hideSelected!==void 0?e.hideSelected:!1,this.keepOrder=e.keepOrder!==void 0?e.keepOrder:!1,this.showOptionTooltips=e.showOptionTooltips!==void 0?e.showOptionTooltips:!1,this.minSelected=e.minSelected||0,this.maxSelected=e.maxSelected||1e3,this.timeoutDelay=e.timeoutDelay||200,this.maxValuesShown=e.maxValuesShown||20,this.maxValuesMessage=e.maxValuesMessage||"{number} selected",this.addableText=e.addableText||'Press "Enter" to add {value}',this.ariaLabelledBy=e.ariaLabelledBy||"",this.searchAriaLabel=e.searchAriaLabel||"Search options",this.searchLabelledBy=e.searchLabelledBy||"",this.clearAllAriaLabel=e.clearAllAriaLabel||"Clear selection"}}class Nc{constructor(e){var o;if(this.events={search:void 0,searchFilter:(l,a)=>l.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=Kt(()=>{!this.settings.isOpen&&!this.settings.isFullOpen||this.render.moveContent()}),this.windowScroll=Kt(()=>{!this.settings.isOpen&&!this.settings.isFullOpen||this.render.moveContent()}),this.documentClick=l=>{this.settings.isOpen&&l.target&&!Dc(l.target,this.settings.id)&&this.close(l.type)},this.windowVisibilityChange=()=>{document.hidden&&this.close()},this.selectEl=typeof e.select=="string"?document.querySelector(e.select):e.select,!this.selectEl){e.events&&e.events.error&&e.events.error(new Error("Could not find select element"));return}if(this.selectEl.tagName!=="SELECT"){e.events&&e.events.error&&e.events.error(new Error("Element isnt of type select"));return}this.selectEl.dataset.ssid&&this.destroy(),this.settings=new Mc(e.settings),this.cssClasses=new Rc(e.cssClasses);const s=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const l in e.events)e.events.hasOwnProperty(l)&&(s.indexOf(l)!==-1?this.events[l]=Kt(e.events[l],100):this.events[l]=e.events[l]);this.settings.disabled=(o=e.settings)!=null&&o.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 Fc(this.selectEl),this.select.updateSelect(this.settings.id,this.settings.style,this.settings.class),this.select.hideUI(),this.select.onValueChange=l=>{this.setSelected(l.map(a=>a.id))},this.select.onClassChange=l=>{this.settings.class=l,this.render.updateClassStyles()},this.select.onDisabledChange=l=>{l?this.disable():this.enable()},this.select.onOptionsChange=l=>{this.setData(l)},this.store=new Ic(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 hn(this.settings,this.cssClasses,this.store,n),this.render.renderValues(),this.render.renderOptions(this.store.getData());const i=this.selectEl.getAttribute("aria-label"),r=this.selectEl.getAttribute("aria-labelledby");i?this.render.main.main.setAttribute("aria-label",i):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),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(e){const s=this.store.getSelected(),n=this.store.validateDataArray(e);if(n){this.events.error&&this.events.error(n);return}this.store.setData(e);const i=this.store.getData();this.select.updateOptions(i),this.render.renderValues(),this.render.renderOptions(i),this.events.afterChange&&!Gs(s,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let e=this.store.getSelectedOptions();return this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e)),e.map(s=>s.value)}setSelected(e,s=!0){const n=this.store.getSelected(),i=this.store.getDataOptions();e=Array.isArray(e)?e:[e];const r=[];for(const l of e){if(i.find(a=>a.id==l)){r.push(l);continue}for(const a of i.filter(u=>u.value==l))r.push(a.id)}this.store.setSelectedBy("id",r);const o=this.store.getData();this.select.updateOptions(o),this.render.renderValues(),this.render.content.search.input.value!==""?this.search(this.render.content.search.input.value):this.render.renderOptions(o),s&&this.events.afterChange&&!Gs(n,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}addOption(e){const s=this.store.getSelected();this.store.getDataOptions().some(i=>i.value===(e.value??e.text))||this.store.addOption(e);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!Gs(s,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.settings.focusSearch&&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(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){this.render.renderOptions(e===""?this.store.getData():this.store.search(e,this.events.searchFilter));return}this.render.renderSearching();const s=this.events.search(e,this.store.getSelectedOptions());if(s instanceof Promise){s.then(n=>{this.render.renderOptions(this.store.partialToFullData(n))}).catch(n=>{this.render.renderError(typeof n=="string"?n:n.message)});return}else Array.isArray(s)?this.render.renderOptions(this.store.partialToFullData(s)):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 Bc="CWYDT23U",Hc="slimselectjscom",Vc=Ts({__name:"carbonad",setup(t){const e=ir(null);let s=!1;return mr(()=>{const n=window.location.hostname==="localhost";if(!s&&!n){s=!0;const i=document.createElement("script");i.id="_carbonads_js",i.src=`//cdn.carbonads.com/carbon.js?serve=${Bc}&placement=${Hc}`,i.async=!0,e.value&&e.value.appendChild(i)}}),(n,i)=>wt(s)?(Zt(),Nr("div",{key:0,class:"carbon-container",ref_key:"container",ref:e},null,512)):Uo("",!0)}}),$c=Ts({name:"App",components:{CarbonAd:Vc},data(){return{nav:null,navDebounce:Kt(()=>{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:"Examples",closable:"close",options:[{text:"countries",value:"examples#countries"},{text:"form reset",value:"examples#formReset"}]},{label:"Settings",closable:"close",options:[{text:"select",value:"settings#select"},{text:"cssClasses",value:"settings#cssClasses"},{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"}]}]}},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 t=this.$route.hash;if(t===""&&window.scroll({top:0,behavior:"smooth"}),t){const e=document.querySelector(t);if(e){const s=document.querySelector("header"),n=document.querySelector("nav"),i=s?s.clientHeight+(window.innerWidth<700?n.clientHeight:0)+8:0;window.scroll({top:e.offsetTop-i,behavior:"smooth"})}}},200)}),this.setDemensions(),window.addEventListener("resize",this.navDebounce),window.addEventListener("nav-updated",this.updateNav)},unmounted(){var t;window.removeEventListener("resize",this.navDebounce),window.removeEventListener("nav-updated",this.updateNav),(t=this.nav)==null||t.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 t={searchHighlight:!0,openContent:"below"};this.width>700&&(t.alwaysOpen=!0,t.contentPosition="relative",t.contentLocation=this.$refs.navContent),this.nav=new Nc({select:this.$refs.nav,data:this.navData,settings:t,events:{afterChange:e=>{const n=e[0].value.split("#"),i=n[0],r=n[1]?"#"+n[1]:void 0;this.$router.push({path:i,hash:r})}}})},updateNav(){setTimeout(()=>{this.nav&&this.nav.setSelected(this.$router.currentRoute.value.fullPath.replace("/",""))},0)}}}),Uc="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",jc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACAAQMAAAD58POIAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZQTFRFyzg3////IltC9QAAAAFiS0dEAf8CLd4AAAAJcEhZcwAACxMAAAsTAQCanBgAAAAkSURBVEjHY2AYBYMV/IeDUQG4AJgeFRgVGBUYFSBNYBQMPgAARjtdvxo6xaMAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTEtMDUtMzBUMjM6MTA6NDQtMDc6MDCm4GvfAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDEwLTEyLTA2VDEyOjIwOjEyLTA4OjAwpIGEmQAAADJ0RVh0UE5HOmNIUk0AY2h1bmsgd2FzIGZvdW5kIChzZWUgQ2hyb21hdGljaXR5LCBhYm92ZSkH0UjaAAAAKXRFWHRQTkc6Z0FNQQBnYW1tYT0wLjQ1NDU1IChTZWUgR2FtbWEsIGFib3ZlKRISLKcAAAAUdEVYdFBORzpJSERSLmJpdF9kZXB0aAA4KYV+UAAAABV0RVh0UE5HOklIRFIuY29sb3JfdHlwZQA2BkqnKwAAABt0RVh0UE5HOklIRFIuaW50ZXJsYWNlX21ldGhvZAAw+zsHjAAAABx0RVh0UE5HOklIRFIud2lkdGgsaGVpZ2h0ADE2LCAxNjjVBg0AAAAodEVYdFBORzpwSFlzAHhfcmVzPTI4MzUsIHlfcmVzPTI4MzUsIHVuaXRzPTGCKXI+AAAAKHRFWHRQTkc6c1JHQgBpbnRlbnQ9MCAoU2VlIFJlbmRlcmluZyBpbnRlbnQp8hEU9QAAAABJRU5ErkJggg==",zc=(t,e)=>{const s=t.__vccOpts||t;for(const[n,i]of e)s[n]=i;return s},Wc={ref:"nav"},qc={class:"nav-content",ref:"navContent"};function Gc(t,e,s,n,i,r){const o=Un("CarbonAd"),l=Un("router-view");return Zt(),Nr(Re,null,[e[4]||(e[4]=$o('

Slim Select 2.0

Advanced select dropdown
',1)),Ze("nav",null,[Ze("select",Wc,null,512),Ze("div",qc,null,512),de(o)]),Ze("main",null,[de(l),Ze("footer",null,[ds(" © "+Vi(t.year)+" ",1),e[0]||(e[0]=Ze("a",{href:"http://webiswhatido.com",style:{color:"#ffffff"},target:"_blank"},"Brian Voelker",-1)),e[1]||(e[1]=ds(". ")),e[2]||(e[2]=Ze("br",null,null,-1)),e[3]||(e[3]=ds(" Slim Select is under the MIT license. "))])])],64)}const Kc=zc($c,[["render",Gc]]);var Ri=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function sl(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ks={exports:{}},Di;function Yc(){return Di||(Di=1,function(t){var e=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};/** + */const Ct=typeof document<"u";function jr(t){return typeof t=="object"||"displayName"in t||"props"in t||"__vccOpts"in t}function Oa(t){return t.__esModule||t[Symbol.toStringTag]==="Module"||t.default&&jr(t.default)}const J=Object.assign;function zs(t,e){const s={};for(const n in e){const i=e[n];s[n]=He(i)?i.map(t):t(i)}return s}const qt=()=>{},He=Array.isArray,zr=/#/g,La=/&/g,Ta=/\//g,Pa=/=/g,Ra=/\?/g,Wr=/\+/g,Da=/%5B/g,ka=/%5D/g,qr=/%5E/g,Ia=/%60/g,Gr=/%7B/g,Fa=/%7C/g,Kr=/%7D/g,Ma=/%20/g;function Dn(t){return encodeURI(""+t).replace(Fa,"|").replace(Da,"[").replace(ka,"]")}function Na(t){return Dn(t).replace(Gr,"{").replace(Kr,"}").replace(qr,"^")}function cn(t){return Dn(t).replace(Wr,"%2B").replace(Ma,"+").replace(zr,"%23").replace(La,"%26").replace(Ia,"`").replace(Gr,"{").replace(Kr,"}").replace(qr,"^")}function Ba(t){return cn(t).replace(Pa,"%3D")}function Ha(t){return Dn(t).replace(zr,"%23").replace(Ra,"%3F")}function Va(t){return t==null?"":Ha(t).replace(Ta,"%2F")}function ss(t){try{return decodeURIComponent(""+t)}catch{}return""+t}const $a=/\/$/,Ua=t=>t.replace($a,"");function Ws(t,e,s="/"){let n,i={},r="",o="";const l=e.indexOf("#");let a=e.indexOf("?");return l=0&&(a=-1),a>-1&&(n=e.slice(0,a),r=e.slice(a+1,l>-1?l:e.length),i=t(r)),l>-1&&(n=n||e.slice(0,l),o=e.slice(l,e.length)),n=qa(n??e,s),{fullPath:n+(r&&"?")+r+o,path:n,query:i,hash:ss(o)}}function ja(t,e){const s=e.query?t(e.query):"";return e.path+(s&&"?")+s+(e.hash||"")}function pi(t,e){return!e||!t.toLowerCase().startsWith(e.toLowerCase())?t:t.slice(e.length)||"/"}function za(t,e,s){const n=e.matched.length-1,i=s.matched.length-1;return n>-1&&n===i&&kt(e.matched[n],s.matched[i])&&Yr(e.params,s.params)&&t(e.query)===t(s.query)&&e.hash===s.hash}function kt(t,e){return(t.aliasOf||t)===(e.aliasOf||e)}function Yr(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(!Wa(t[s],e[s]))return!1;return!0}function Wa(t,e){return He(t)?gi(t,e):He(e)?gi(e,t):t===e}function gi(t,e){return He(e)?t.length===e.length&&t.every((s,n)=>s===e[n]):t.length===1&&t[0]===e}function qa(t,e){if(t.startsWith("/"))return t;if(!t)return e;const s=e.split("/"),n=t.split("/"),i=n[n.length-1];(i===".."||i===".")&&n.push("");let r=s.length-1,o,l;for(o=0;o1&&r--;else break;return s.slice(0,r).join("/")+"/"+n.slice(o).join("/")}const ut={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};var ns;(function(t){t.pop="pop",t.push="push"})(ns||(ns={}));var Gt;(function(t){t.back="back",t.forward="forward",t.unknown=""})(Gt||(Gt={}));function Ga(t){if(!t)if(Ct){const e=document.querySelector("base");t=e&&e.getAttribute("href")||"/",t=t.replace(/^\w+:\/\/[^\/]+/,"")}else t="/";return t[0]!=="/"&&t[0]!=="#"&&(t="/"+t),Ua(t)}const Ka=/^[^#]+#/;function Ya(t,e){return t.replace(Ka,"#")+e}function Qa(t,e){const s=document.documentElement.getBoundingClientRect(),n=t.getBoundingClientRect();return{behavior:e.behavior,left:n.left-s.left-(e.left||0),top:n.top-s.top-(e.top||0)}}const ks=()=>({left:window.scrollX,top:window.scrollY});function Ja(t){let e;if("el"in t){const s=t.el,n=typeof s=="string"&&s.startsWith("#"),i=typeof s=="string"?n?document.getElementById(s.slice(1)):document.querySelector(s):s;if(!i)return;e=Qa(i,t)}else e=t;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.scrollX,e.top!=null?e.top:window.scrollY)}function mi(t,e){return(history.state?history.state.position-e:-1)+t}const un=new Map;function Za(t,e){un.set(t,e)}function Xa(t){const e=un.get(t);return un.delete(t),e}let ec=()=>location.protocol+"//"+location.host;function Qr(t,e){const{pathname:s,search:n,hash:i}=e,r=t.indexOf("#");if(r>-1){let l=i.includes(t.slice(r))?t.slice(r).length:1,a=i.slice(l);return a[0]!=="/"&&(a="/"+a),pi(a,"")}return pi(s,t)+n+i}function tc(t,e,s,n){let i=[],r=[],o=null;const l=({state:p})=>{const g=Qr(t,location),_=s.value,C=e.value;let D=0;if(p){if(s.value=g,e.value=p,o&&o===_){o=null;return}D=C?p.position-C.position:0}else n(g);i.forEach(T=>{T(s.value,_,{delta:D,type:ns.pop,direction:D?D>0?Gt.forward:Gt.back:Gt.unknown})})};function a(){o=s.value}function u(p){i.push(p);const g=()=>{const _=i.indexOf(p);_>-1&&i.splice(_,1)};return r.push(g),g}function c(){const{history:p}=window;p.state&&p.replaceState(J({},p.state,{scroll:ks()}),"")}function f(){for(const p of r)p();r=[],window.removeEventListener("popstate",l),window.removeEventListener("beforeunload",c)}return window.addEventListener("popstate",l),window.addEventListener("beforeunload",c,{passive:!0}),{pauseListeners:a,listen:u,destroy:f}}function vi(t,e,s,n=!1,i=!1){return{back:t,current:e,forward:s,replaced:n,position:window.history.length,scroll:i?ks():null}}function sc(t){const{history:e,location:s}=window,n={value:Qr(t,s)},i={value:e.state};i.value||r(n.value,{back:null,current:n.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function r(a,u,c){const f=t.indexOf("#"),p=f>-1?(s.host&&document.querySelector("base")?t:t.slice(f))+a:ec()+t+a;try{e[c?"replaceState":"pushState"](u,"",p),i.value=u}catch(g){console.error(g),s[c?"replace":"assign"](p)}}function o(a,u){const c=J({},e.state,vi(i.value.back,a,i.value.forward,!0),u,{position:i.value.position});r(a,c,!0),n.value=a}function l(a,u){const c=J({},i.value,e.state,{forward:a,scroll:ks()});r(c.current,c,!0);const f=J({},vi(n.value,a,null),{position:c.position+1},u);r(a,f,!1),n.value=a}return{location:n,state:i,push:l,replace:o}}function nc(t){t=Ga(t);const e=sc(t),s=tc(t,e.state,e.location,e.replace);function n(r,o=!0){o||s.pauseListeners(),history.go(r)}const i=J({location:"",base:t,go:n,createHref:Ya.bind(null,t)},e,s);return Object.defineProperty(i,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(i,"state",{enumerable:!0,get:()=>e.state.value}),i}function ic(t){return typeof t=="string"||t&&typeof t=="object"}function Jr(t){return typeof t=="string"||typeof t=="symbol"}const Zr=Symbol("");var bi;(function(t){t[t.aborted=4]="aborted",t[t.cancelled=8]="cancelled",t[t.duplicated=16]="duplicated"})(bi||(bi={}));function It(t,e){return J(new Error,{type:t,[Zr]:!0},e)}function Je(t,e){return t instanceof Error&&Zr in t&&(e==null||!!(t.type&e))}const yi="[^/]+?",rc={sensitive:!1,strict:!1,start:!0,end:!0},lc=/[.+*?^${}()[\]/\\]/g;function oc(t,e){const s=J({},rc,e),n=[];let i=s.start?"^":"";const r=[];for(const u of t){const c=u.length?[]:[90];s.strict&&!u.length&&(i+="/");for(let f=0;fe.length?e.length===1&&e[0]===80?1:-1:0}function Xr(t,e){let s=0;const n=t.score,i=e.score;for(;s0&&e[e.length-1]<0}const cc={type:0,value:""},uc=/[a-zA-Z0-9_]/;function fc(t){if(!t)return[[]];if(t==="/")return[[cc]];if(!t.startsWith("/"))throw new Error(`Invalid path "${t}"`);function e(g){throw new Error(`ERR (${s})/"${u}": ${g}`)}let s=0,n=s;const i=[];let r;function o(){r&&i.push(r),r=[]}let l=0,a,u="",c="";function f(){u&&(s===0?r.push({type:0,value:u}):s===1||s===2||s===3?(r.length>1&&(a==="*"||a==="+")&&e(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),r.push({type:1,value:u,regexp:c,repeatable:a==="*"||a==="+",optional:a==="*"||a==="?"})):e("Invalid state to consume buffer"),u="")}function p(){u+=a}for(;l{o(b)}:qt}function o(f){if(Jr(f)){const p=n.get(f);p&&(n.delete(f),s.splice(s.indexOf(p),1),p.children.forEach(o),p.alias.forEach(o))}else{const p=s.indexOf(f);p>-1&&(s.splice(p,1),f.record.name&&n.delete(f.record.name),f.children.forEach(o),f.alias.forEach(o))}}function l(){return s}function a(f){const p=mc(f,s);s.splice(p,0,f),f.record.name&&!Si(f)&&n.set(f.record.name,f)}function u(f,p){let g,_={},C,D;if("name"in f&&f.name){if(g=n.get(f.name),!g)throw It(1,{location:f});D=g.record.name,_=J(wi(p.params,g.keys.filter(b=>!b.optional).concat(g.parent?g.parent.keys.filter(b=>b.optional):[]).map(b=>b.name)),f.params&&wi(f.params,g.keys.map(b=>b.name))),C=g.stringify(_)}else if(f.path!=null)C=f.path,g=s.find(b=>b.re.test(C)),g&&(_=g.parse(C),D=g.record.name);else{if(g=p.name?n.get(p.name):s.find(b=>b.re.test(p.path)),!g)throw It(1,{location:f,currentLocation:p});D=g.record.name,_=J({},p.params,f.params),C=g.stringify(_)}const T=[];let m=g;for(;m;)T.unshift(m.record),m=m.parent;return{name:D,path:C,params:_,matched:T,meta:gc(T)}}t.forEach(f=>r(f));function c(){s.length=0,n.clear()}return{addRoute:r,resolve:u,removeRoute:o,clearRoutes:c,getRoutes:l,getRecordMatcher:i}}function wi(t,e){const s={};for(const n of e)n in t&&(s[n]=t[n]);return s}function xi(t){const e={path:t.path,redirect:t.redirect,name:t.name,meta:t.meta||{},aliasOf:t.aliasOf,beforeEnter:t.beforeEnter,props:pc(t),children:t.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in t?t.components||null:t.component&&{default:t.component}};return Object.defineProperty(e,"mods",{value:{}}),e}function pc(t){const e={},s=t.props||!1;if("component"in t)e.default=s;else for(const n in t.components)e[n]=typeof s=="object"?s[n]:s;return e}function Si(t){for(;t;){if(t.record.aliasOf)return!0;t=t.parent}return!1}function gc(t){return t.reduce((e,s)=>J(e,s.meta),{})}function Ei(t,e){const s={};for(const n in t)s[n]=n in e?e[n]:t[n];return s}function mc(t,e){let s=0,n=e.length;for(;s!==n;){const r=s+n>>1;Xr(t,e[r])<0?n=r:s=r+1}const i=vc(t);return i&&(n=e.lastIndexOf(i,n-1)),n}function vc(t){let e=t;for(;e=e.parent;)if(el(e)&&Xr(t,e)===0)return e}function el({record:t}){return!!(t.name||t.components&&Object.keys(t.components).length||t.redirect)}function bc(t){const e={};if(t===""||t==="?")return e;const n=(t[0]==="?"?t.slice(1):t).split("&");for(let i=0;ir&&cn(r)):[n&&cn(n)]).forEach(r=>{r!==void 0&&(e+=(e.length?"&":"")+s,r!=null&&(e+="="+r))})}return e}function yc(t){const e={};for(const s in t){const n=t[s];n!==void 0&&(e[s]=He(n)?n.map(i=>i==null?null:""+i):n==null?n:""+n)}return e}const Ac=Symbol(""),_i=Symbol(""),kn=Symbol(""),tl=Symbol(""),fn=Symbol("");function Bt(){let t=[];function e(n){return t.push(n),()=>{const i=t.indexOf(n);i>-1&&t.splice(i,1)}}function s(){t=[]}return{add:e,list:()=>t.slice(),reset:s}}function dt(t,e,s,n,i,r=o=>o()){const o=n&&(n.enterCallbacks[i]=n.enterCallbacks[i]||[]);return()=>new Promise((l,a)=>{const u=p=>{p===!1?a(It(4,{from:s,to:e})):p instanceof Error?a(p):ic(p)?a(It(2,{from:e,to:p})):(o&&n.enterCallbacks[i]===o&&typeof p=="function"&&o.push(p),l())},c=r(()=>t.call(n&&n.instances[i],e,s,u));let f=Promise.resolve(c);t.length<3&&(f=f.then(u)),f.catch(p=>a(p))})}function qs(t,e,s,n,i=r=>r()){const r=[];for(const o of t)for(const l in o.components){let a=o.components[l];if(!(e!=="beforeRouteEnter"&&!o.instances[l]))if(jr(a)){const c=(a.__vccOpts||a)[e];c&&r.push(dt(c,s,n,o,l,i))}else{let u=a();r.push(()=>u.then(c=>{if(!c)throw new Error(`Couldn't resolve component "${l}" at "${o.path}"`);const f=Oa(c)?c.default:c;o.mods[l]=c,o.components[l]=f;const g=(f.__vccOpts||f)[e];return g&&dt(g,s,n,o,l,i)()}))}}return r}function Oi(t){const e=tt(kn),s=tt(tl),n=Ne(()=>{const a=wt(t.to);return e.resolve(a)}),i=Ne(()=>{const{matched:a}=n.value,{length:u}=a,c=a[u-1],f=s.matched;if(!c||!f.length)return-1;const p=f.findIndex(kt.bind(null,c));if(p>-1)return p;const g=Li(a[u-2]);return u>1&&Li(c)===g&&f[f.length-1].path!==g?f.findIndex(kt.bind(null,a[u-2])):p}),r=Ne(()=>i.value>-1&&Cc(s.params,n.value.params)),o=Ne(()=>i.value>-1&&i.value===s.matched.length-1&&Yr(s.params,n.value.params));function l(a={}){if(Ec(a)){const u=e[wt(t.replace)?"replace":"push"](wt(t.to)).catch(qt);return t.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>u),u}return Promise.resolve()}return{route:n,href:Ne(()=>n.value.href),isActive:r,isExactActive:o,navigate:l}}function wc(t){return t.length===1?t[0]:t}const xc=Ts({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"},viewTransition:Boolean},useLink:Oi,setup(t,{slots:e}){const s=Os(Oi(t)),{options:n}=tt(kn),i=Ne(()=>({[Ti(t.activeClass,n.linkActiveClass,"router-link-active")]:s.isActive,[Ti(t.exactActiveClass,n.linkExactActiveClass,"router-link-exact-active")]:s.isExactActive}));return()=>{const r=e.default&&wc(e.default(s));return t.custom?r:$r("a",{"aria-current":s.isExactActive?t.ariaCurrentValue:null,href:s.href,onClick:s.navigate,class:i.value},r)}}}),Sc=xc;function Ec(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&!(t.button!==void 0&&t.button!==0)){if(t.currentTarget&&t.currentTarget.getAttribute){const e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function Cc(t,e){for(const s in e){const n=e[s],i=t[s];if(typeof n=="string"){if(n!==i)return!1}else if(!He(i)||i.length!==n.length||n.some((r,o)=>r!==i[o]))return!1}return!0}function Li(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const Ti=(t,e,s)=>t??e??s,_c=Ts({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(t,{attrs:e,slots:s}){const n=tt(fn),i=Ne(()=>t.route||n.value),r=tt(_i,0),o=Ne(()=>{let u=wt(r);const{matched:c}=i.value;let f;for(;(f=c[u])&&!f.components;)u++;return u}),l=Ne(()=>i.value.matched[o.value]);cs(_i,Ne(()=>o.value+1)),cs(Ac,l),cs(fn,i);const a=ir();return us(()=>[a.value,l.value,t.name],([u,c,f],[p,g,_])=>{c&&(c.instances[f]=u,g&&g!==c&&u&&u===p&&(c.leaveGuards.size||(c.leaveGuards=g.leaveGuards),c.updateGuards.size||(c.updateGuards=g.updateGuards))),u&&c&&(!g||!kt(c,g)||!p)&&(c.enterCallbacks[f]||[]).forEach(C=>C(u))},{flush:"post"}),()=>{const u=i.value,c=t.name,f=l.value,p=f&&f.components[c];if(!p)return Pi(s.default,{Component:p,route:u});const g=f.props[c],_=g?g===!0?u.params:typeof g=="function"?g(u):g:null,D=$r(p,J({},_,e,{onVnodeUnmounted:T=>{T.component.isUnmounted&&(f.instances[c]=null)},ref:a}));return Pi(s.default,{Component:D,route:u})||D}}});function Pi(t,e){if(!t)return null;const s=t(e);return s.length===1?s[0]:s}const Oc=_c;function Lc(t){const e=dc(t.routes,t),s=t.parseQuery||bc,n=t.stringifyQuery||Ci,i=t.history,r=Bt(),o=Bt(),l=Bt(),a=Ml(ut);let u=ut;Ct&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=zs.bind(null,A=>""+A),f=zs.bind(null,Va),p=zs.bind(null,ss);function g(A,N){let k,B;return Jr(A)?(k=e.getRecordMatcher(A),B=N):B=A,e.addRoute(B,k)}function _(A){const N=e.getRecordMatcher(A);N&&e.removeRoute(N)}function C(){return e.getRoutes().map(A=>A.record)}function D(A){return!!e.getRecordMatcher(A)}function T(A,N){if(N=J({},N||a.value),typeof A=="string"){const v=Ws(s,A,N.path),w=e.resolve({path:v.path},N),E=i.createHref(v.fullPath);return J(v,w,{params:p(w.params),hash:ss(v.hash),redirectedFrom:void 0,href:E})}let k;if(A.path!=null)k=J({},A,{path:Ws(s,A.path,N.path).path});else{const v=J({},A.params);for(const w in v)v[w]==null&&delete v[w];k=J({},A,{params:f(v)}),N.params=f(N.params)}const B=e.resolve(k,N),Y=A.hash||"";B.params=c(p(B.params));const h=ja(n,J({},A,{hash:Na(Y),path:B.path})),d=i.createHref(h);return J({fullPath:h,hash:Y,query:n===Ci?yc(A.query):A.query||{}},B,{redirectedFrom:void 0,href:d})}function m(A){return typeof A=="string"?Ws(s,A,a.value.path):J({},A)}function b(A,N){if(u!==A)return It(8,{from:N,to:A})}function y(A){return I(A)}function S(A){return y(J(m(A),{replace:!0}))}function O(A){const N=A.matched[A.matched.length-1];if(N&&N.redirect){const{redirect:k}=N;let B=typeof k=="function"?k(A):k;return typeof B=="string"&&(B=B.includes("?")||B.includes("#")?B=m(B):{path:B},B.params={}),J({query:A.query,hash:A.hash,params:B.path!=null?{}:A.params},B)}}function I(A,N){const k=u=T(A),B=a.value,Y=A.state,h=A.force,d=A.replace===!0,v=O(k);if(v)return I(J(m(v),{state:typeof v=="object"?J({},Y,v.state):Y,force:h,replace:d}),N||k);const w=k;w.redirectedFrom=N;let E;return!h&&za(n,B,k)&&(E=It(16,{to:w,from:B}),Ae(B,B,!0,!1)),(E?Promise.resolve(E):K(w,B)).catch(x=>Je(x)?Je(x,2)?x:ye(x):U(x,w,B)).then(x=>{if(x){if(Je(x,2))return I(J({replace:d},m(x.to),{state:typeof x.to=="object"?J({},Y,x.to.state):Y,force:h}),N||w)}else x=pe(w,B,!0,d,Y);return re(w,B,x),x})}function W(A,N){const k=b(A,N);return k?Promise.reject(k):Promise.resolve()}function H(A){const N=we.values().next().value;return N&&typeof N.runWithContext=="function"?N.runWithContext(A):A()}function K(A,N){let k;const[B,Y,h]=Tc(A,N);k=qs(B.reverse(),"beforeRouteLeave",A,N);for(const v of B)v.leaveGuards.forEach(w=>{k.push(dt(w,A,N))});const d=W.bind(null,A,N);return k.push(d),fe(k).then(()=>{k=[];for(const v of r.list())k.push(dt(v,A,N));return k.push(d),fe(k)}).then(()=>{k=qs(Y,"beforeRouteUpdate",A,N);for(const v of Y)v.updateGuards.forEach(w=>{k.push(dt(w,A,N))});return k.push(d),fe(k)}).then(()=>{k=[];for(const v of h)if(v.beforeEnter)if(He(v.beforeEnter))for(const w of v.beforeEnter)k.push(dt(w,A,N));else k.push(dt(v.beforeEnter,A,N));return k.push(d),fe(k)}).then(()=>(A.matched.forEach(v=>v.enterCallbacks={}),k=qs(h,"beforeRouteEnter",A,N,H),k.push(d),fe(k))).then(()=>{k=[];for(const v of o.list())k.push(dt(v,A,N));return k.push(d),fe(k)}).catch(v=>Je(v,8)?v:Promise.reject(v))}function re(A,N,k){l.list().forEach(B=>H(()=>B(A,N,k)))}function pe(A,N,k,B,Y){const h=b(A,N);if(h)return h;const d=N===ut,v=Ct?history.state:{};k&&(B||d?i.replace(A.fullPath,J({scroll:d&&v&&v.scroll},Y)):i.push(A.fullPath,Y)),a.value=A,Ae(A,N,k,d),ye()}let Le;function ot(){Le||(Le=i.listen((A,N,k)=>{if(!Ve.listening)return;const B=T(A),Y=O(B);if(Y){I(J(Y,{replace:!0,force:!0}),B).catch(qt);return}u=B;const h=a.value;Ct&&Za(mi(h.fullPath,k.delta),ks()),K(B,h).catch(d=>Je(d,12)?d:Je(d,2)?(I(J(m(d.to),{force:!0}),B).then(v=>{Je(v,20)&&!k.delta&&k.type===ns.pop&&i.go(-1,!1)}).catch(qt),Promise.reject()):(k.delta&&i.go(-k.delta,!1),U(d,B,h))).then(d=>{d=d||pe(B,h,!1),d&&(k.delta&&!Je(d,8)?i.go(-k.delta,!1):k.type===ns.pop&&Je(d,20)&&i.go(-1,!1)),re(B,h,d)}).catch(qt)}))}let at=Bt(),oe=Bt(),Q;function U(A,N,k){ye(A);const B=oe.list();return B.length?B.forEach(Y=>Y(A,N,k)):console.error(A),Promise.reject(A)}function ae(){return Q&&a.value!==ut?Promise.resolve():new Promise((A,N)=>{at.add([A,N])})}function ye(A){return Q||(Q=!A,ot(),at.list().forEach(([N,k])=>A?k(A):N()),at.reset()),A}function Ae(A,N,k,B){const{scrollBehavior:Y}=t;if(!Ct||!Y)return Promise.resolve();const h=!k&&Xa(mi(A.fullPath,0))||(B||!k)&&history.state&&history.state.scroll||null;return ar().then(()=>Y(A,N,h)).then(d=>d&&Ja(d)).catch(d=>U(d,A,N))}const te=A=>i.go(A);let ct;const we=new Set,Ve={currentRoute:a,listening:!0,addRoute:g,removeRoute:_,clearRoutes:e.clearRoutes,hasRoute:D,getRoutes:C,resolve:T,options:t,push:y,replace:S,go:te,back:()=>te(-1),forward:()=>te(1),beforeEach:r.add,beforeResolve:o.add,afterEach:l.add,onError:oe.add,isReady:ae,install(A){const N=this;A.component("RouterLink",Sc),A.component("RouterView",Oc),A.config.globalProperties.$router=N,Object.defineProperty(A.config.globalProperties,"$route",{enumerable:!0,get:()=>wt(a)}),Ct&&!ct&&a.value===ut&&(ct=!0,y(i.location).catch(Y=>{}));const k={};for(const Y in ut)Object.defineProperty(k,Y,{get:()=>a.value[Y],enumerable:!0});A.provide(kn,N),A.provide(tl,sr(k)),A.provide(fn,a);const B=A.unmount;we.add(A),A.unmount=function(){we.delete(A),we.size<1&&(u=ut,Le&&Le(),Le=null,a.value=ut,ct=!1,Q=!1),B()}}};function fe(A){return A.reduce((N,k)=>N.then(()=>H(k)),Promise.resolve())}return Ve}function Tc(t,e){const s=[],n=[],i=[],r=Math.max(e.matched.length,t.matched.length);for(let o=0;okt(u,l))?n.push(l):s.push(l));const a=t.matched[o];a&&(e.matched.find(u=>kt(u,a))||i.push(a))}return[s,n,i]}const Pc=Lc({history:nc(),linkActiveClass:"active",routes:[{path:"/",name:"Home",component:()=>Qe(()=>import("./home.js"),__vite__mapDeps([0,1]))},{path:"/install",name:"Install",component:()=>Qe(()=>import("./install.js"),[])},{path:"/selects",name:"Selects",component:()=>Qe(()=>import("./selects.js"),[])},{path:"/data",name:"Data",component:()=>Qe(()=>import("./data.js"),[])},{path:"/examples",name:"Examples",component:()=>Qe(()=>import("./index2.js"),__vite__mapDeps([2,3]))},{path:"/settings",name:"Settings",component:()=>Qe(()=>import("./index3.js"),__vite__mapDeps([4,5]))},{path:"/events",name:"Events",component:()=>Qe(()=>import("./index4.js"),[])},{path:"/methods",name:"Methods",component:()=>Qe(()=>import("./index5.js"),[])},{path:"/vue",name:"Vue",component:()=>Qe(()=>import("./vue.js"),[])}]});class Rc{constructor(e){e||(e={}),this.main=e.main||"ss-main",this.placeholder=e.placeholder||"ss-placeholder",this.values=e.values||"ss-values",this.single=e.single||"ss-single",this.max=e.max||"ss-max",this.value=e.value||"ss-value",this.valueText=e.valueText||"ss-value-text",this.valueDelete=e.valueDelete||"ss-value-delete",this.valueOut=e.valueOut||"ss-value-out",this.deselect=e.deselect||"ss-deselect",this.deselectPath=e.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=e.arrow||"ss-arrow",this.arrowClose=e.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=e.arrowOpen||"M10,70 L50,30 L90,70",this.content=e.content||"ss-content",this.openAbove=e.openAbove||"ss-open-above",this.openBelow=e.openBelow||"ss-open-below",this.search=e.search||"ss-search",this.searchHighlighter=e.searchHighlighter||"ss-search-highlight",this.searching=e.searching||"ss-searching",this.addable=e.addable||"ss-addable",this.addablePath=e.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=e.list||"ss-list",this.optgroup=e.optgroup||"ss-optgroup",this.optgroupLabel=e.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=e.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=e.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=e.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=e.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=e.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=e.optgroupClosable||"ss-closable",this.option=e.option||"ss-option",this.optionDelete=e.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=e.highlighted||"ss-highlighted",this.open=e.open||"ss-open",this.close=e.close||"ss-close",this.selected=e.selected||"ss-selected",this.error=e.error||"ss-error",this.disabled=e.disabled||"ss-disabled",this.hide=e.hide||"ss-hide"}}function In(){return Math.random().toString(36).substring(2,10)}function Dc(t,e){function s(i,r){return r&&i&&i.classList&&i.classList.contains(r)||r&&i&&i.dataset&&i.dataset.id&&i.dataset.id===e?i:null}function n(i,r){return!i||i===document?null:s(i,r)?i:n(i.parentNode,r)}return s(t,e)||n(t,e)}function Kt(t,e=50,s=!1){let n;return function(...i){const r=self,o=()=>{n=null,s||t.apply(r,i)},l=s&&!n;clearTimeout(n),n=setTimeout(o,e),l&&t.apply(r,i)}}function Gs(t,e){return JSON.stringify(t)===JSON.stringify(e)}function kc(t){const e=t.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,s=>"-"+s.toLowerCase());return t[0]===t[0].toUpperCase()?e.substring(1):e}class Me{constructor(e){if(this.id=!e.id||e.id===""?In():e.id,this.label=e.label||"",this.selectAll=e.selectAll===void 0?!1:e.selectAll,this.selectAllText=e.selectAllText||"Select All",this.closable=e.closable||"off",this.options=[],e.options)for(const s of e.options)this.options.push(new ue(s))}}class ue{constructor(e){this.id=!e.id||e.id===""?In():e.id,this.value=e.value===void 0?e.text:e.value,this.text=e.text||"",this.html=e.html||"",this.defaultSelected=e.defaultSelected!==void 0?e.defaultSelected:!1,this.selected=e.selected!==void 0?e.selected:!1,this.display=e.display!==void 0?e.display:!0,this.disabled=e.disabled!==void 0?e.disabled:!1,this.mandatory=e.mandatory!==void 0?e.mandatory:!1,this.placeholder=e.placeholder!==void 0?e.placeholder:!1,this.class=e.class||"",this.style=e.style||"",this.data=e.data||{}}}class Ic{constructor(e,s){this.selectType="single",this.data=[],this.selectedOrder=[],this.selectType=e,this.setData(s)}validateDataArray(e){if(!Array.isArray(e))return new Error("Data must be an array");for(let s of e)if(s instanceof Me||"label"in s){if(!("label"in s))return new Error("Optgroup must have a label");if("options"in s&&s.options)for(let n of s.options){const i=this.validateOption(n);if(i)return i}}else if(s instanceof ue||"text"in s){const n=this.validateOption(s);if(n)return n}else return new Error("Data object must be a valid optgroup or option");return null}validateOption(e){return"text"in e?null:new Error("Option must have a text")}partialToFullData(e){let s=[];return e.forEach(n=>{if(n instanceof Me||"label"in n){let i=[];"options"in n&&n.options&&n.options.forEach(r=>{i.push(new ue(r))}),i.length>0&&s.push(new Me(n))}(n instanceof ue||"text"in n)&&s.push(new ue(n))}),s}setData(e){this.data=this.partialToFullData(e),this.selectType==="single"&&this.setSelectedBy("id",this.getSelected())}getData(){return this.filter(null,!0)}getDataOptions(){return this.filter(null,!1)}addOption(e,s=!1){if(s){let n=[new ue(e)];this.setData(n.concat(this.getData()))}else this.setData(this.getData().concat(new ue(e)))}setSelectedBy(e,s){let n=null,i=!1;const r=[];for(let l of this.data){if(l instanceof Me)for(let a of l.options)n||(n=a),a.selected=i?!1:s.includes(a[e]),a.selected&&(r.push(a),this.selectType==="single"&&(i=!0));l instanceof ue&&(n||(n=l),l.selected=i?!1:s.includes(l[e]),l.selected&&(r.push(l),this.selectType==="single"&&(i=!0)))}this.selectType==="single"&&n&&!i&&(n.selected=!0,r.push(n));const o=s.map(l=>{var a;return((a=r.find(u=>u[e]===l))==null?void 0:a.id)||""});this.selectedOrder=o}getSelected(){return this.getSelectedOptions().map(e=>e.id)}getSelectedValues(){return this.getSelectedOptions().map(e=>e.value)}getSelectedOptions(){return this.filter(e=>e.selected,!1)}getOptgroupByID(e){for(let s of this.data)if(s instanceof Me&&s.id===e)return s;return null}getOptionByID(e){let s=this.filter(n=>n.id===e,!1);return s.length?s[0]:null}getSelectType(){return this.selectType}getFirstOption(){let e=null;for(let s of this.data)if(s instanceof Me?e=s.options[0]:s instanceof ue&&(e=s),e)break;return e}search(e,s){return e=e.trim(),e===""?this.getData():this.filter(n=>s(n,e),!0)}filter(e,s){const n=[];return this.data.forEach(i=>{if(i instanceof Me){let r=[];if(i.options.forEach(o=>{(!e||e(o))&&(s?r.push(new ue(o)):n.push(new ue(o)))}),r.length>0){let o=new Me(i);o.options=r,n.push(o)}}i instanceof ue&&(!e||e(i))&&n.push(new ue(i))}),n}selectedOrderOptions(e){const s=[];return this.selectedOrder.forEach(n=>{const i=e.find(r=>r.id===n);i&&s.push(i)}),e.forEach(n=>{let i=!1;s.forEach(r=>{if(n.id===r.id){i=!0;return}}),i||s.push(n)}),s}}const ke=class ke{static getLiveAssertive(){let e=document.getElementById("ss-live-assertive");return e||(e=document.createElement("div"),e.id="ss-live-assertive",e.setAttribute("role","status"),e.setAttribute("aria-live","assertive"),e.setAttribute("aria-atomic","true"),e.className="ss-sr-only",document.body.appendChild(e)),e}_announceAssertive(e){const s=ke._liveAssertive||(ke._liveAssertive=ke.getLiveAssertive());s.textContent="",requestAnimationFrame(()=>{s.textContent=e})}clearHighlights(){this.content.list.querySelectorAll("."+this.classes.highlighted).forEach(s=>s.classList.remove(this.classes.highlighted)),this.content.search.input.removeAttribute("aria-activedescendant"),this.main.main.removeAttribute("aria-activedescendant")}constructor(e,s,n,i){var o;this.store=n,this.settings=e,this.classes=s,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.main.values.setAttribute("role","list"),this.updateAriaAttributes();const r=(o=document.querySelector(`[data-id="${this.settings.id}"]`))==null?void 0:o.closest(".offcanvas-body");r?r.appendChild(this.content.main):this.settings.contentLocation&&this.settings.contentLocation.appendChild(this.content.main)}static getLivePolite(){let e=document.getElementById("ss-live-polite");return e||(e=document.createElement("div"),e.id="ss-live-polite",e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),e.className="ss-sr-only",document.body.appendChild(e)),e}_announcePolite(e){const s=ke._livePolite||(ke._livePolite=ke.getLivePolite());s.textContent="",requestAnimationFrame(()=>{s.textContent=e})}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 e=this.store.getSelectedOptions();if(e.length){const s=e[e.length-1].id,n=this.content.list.querySelector('[data-id="'+s+'"]');n&&this.ensureElementInView(this.content.list,n)}this.settings.contentPosition==="fixed"&&(this.moveContent(),this.scrollHandler=()=>this.moveContent(),this.resizeHandler=()=>this.moveContent(),window.addEventListener("scroll",this.scrollHandler,!0),window.addEventListener("resize",this.resizeHandler)),this.searchFocus()}close(){this.main.main.classList.remove(this.classes.openAbove,this.classes.openBelow),this.content.search.input.removeAttribute("aria-expanded"),this.main.main.setAttribute("aria-expanded","false"),this.content.main.classList.remove(this.classes.openAbove,this.classes.openBelow),this.main.arrow.path.setAttribute("d",this.classes.arrowClose),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,!0),this.scrollHandler=void 0),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=void 0),this.clearHighlights(),this.main.main.focus({preventScroll:!0})}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.main.main.classList.add("ss-2"),this.content.main.classList.add(this.classes.content),this.content.main.classList.add("ss-content-2"),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()));(this.settings.contentPosition==="relative"||this.settings.contentPosition==="fixed")&&this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){var i;this.content.list.setAttribute("role","listbox"),this.content.list.setAttribute("id",this.content.main.id+"-list"),this.content.list.setAttribute("aria-label",this.settings.contentAriaLabel),this.main.main.setAttribute("role","combobox"),this.main.main.setAttribute("aria-controls",this.content.list.id),this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-expanded","false"),this.settings.isMultiple&&this.content.list.setAttribute("aria-multiselectable","true"),this.main.main.removeAttribute("aria-labelledby"),this.main.main.removeAttribute("aria-label");const e=this.content.search.input;e.setAttribute("role","searchbox"),e.setAttribute("aria-controls",this.content.list.id),e.setAttribute("aria-owns",this.content.list.id),e.setAttribute("aria-autocomplete","list"),e.removeAttribute("aria-expanded");let s=(this.settings.ariaLabelledBy||"").trim(),n=null;if(s)n=document.getElementById(s);else{const r=document.querySelector(`select[data-id="${this.settings.id}"]`);r&&(r.id&&(n=document.querySelector(`label[for="${r.id}"]`)),!n&&((i=r.previousElementSibling)==null?void 0:i.tagName)==="LABEL"&&(n=r.previousElementSibling),n&&(n.id||(n.id=(r.id||this.settings.id)+"-label"),s=n.id))}s&&document.getElementById(s)?this.main.main.setAttribute("aria-labelledby",s):this.settings.ariaLabel&&this.settings.ariaLabel.trim()&&this.main.main.setAttribute("aria-label",this.settings.ariaLabel.trim()),this.content.search.input.setAttribute("aria-controls",this.content.list.id),this.content.search.input.setAttribute("aria-autocomplete","list"),s&&document.getElementById(s)?this.content.search.input.setAttribute("aria-labelledby",s):this.settings.searchLabelledBy&&document.getElementById(this.settings.searchLabelledBy)?this.content.search.input.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel?this.content.search.input.setAttribute("aria-label",this.settings.searchAriaLabel):this.content.search.input.setAttribute("aria-label","Search options")}mainDiv(){var u;const e=document.createElement("div");e.id=this.settings.id+"-main",e.tabIndex=0,e.onkeydown=c=>{if(c.target!==e)return!0;const f=p=>{this.callbacks.open(),requestAnimationFrame(()=>{this.searchFocus(),p()})};switch(c.key){case"ArrowDown":return c.preventDefault(),f(()=>this.highlight("down")),!1;case"ArrowUp":return c.preventDefault(),f(()=>this.highlight("up")),!1;case"Tab":return this.callbacks.close(),!0;case"Enter":case" ":return c.preventDefault(),f(()=>{const p=this.content.list.querySelector("."+this.classes.highlighted);p&&p.click()}),!1}return c.key.length===1&&!c.ctrlKey&&!c.metaKey&&!c.altKey?(c.preventDefault(),this.callbacks.open(),requestAnimationFrame(()=>{this.searchFocus();const p=this.content.search.input,g=p.selectionStart??p.value.length,_=p.selectionEnd??p.value.length;p.value=p.value.slice(0,g)+c.key+p.value.slice(_),p.setSelectionRange(g+1,g+1),this.callbacks.search(p.value)}),!1):!0},e.onclick=c=>{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 n=document.createElement("div");n.classList.add(this.classes.deselect),n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label",this.settings.clearAllAriaLabel),n.addEventListener("keydown",c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),c.stopPropagation(),n.click())});const i=(u=this.store)==null?void 0:u.getSelectedOptions();!this.settings.allowDeselect||this.settings.isMultiple&&i&&i.length<=0?n.classList.add(this.classes.hide):n.classList.remove(this.classes.hide),n.onclick=c=>{if(c.stopPropagation(),this.settings.disabled)return;let f=!0;const p=this.store.getSelectedOptions(),g=[];if(this.callbacks.beforeChange&&(f=this.callbacks.beforeChange(g,p)===!0),f){if(this.settings.isMultiple)this.callbacks.setSelected([],!1),this.updateDeselectAll();else{const _=this.store.getFirstOption(),C=_?_.id:"";this.callbacks.setSelected(C,!1)}this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(this.store.getSelectedOptions())}};const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("viewBox","0 0 100 100"),r.setAttribute("aria-hidden","true"),r.setAttribute("focusable","false");const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.deselectPath),r.appendChild(o),n.appendChild(r),e.appendChild(n);const l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.classList.add(this.classes.arrow),l.setAttribute("viewBox","0 0 100 100"),l.setAttribute("aria-hidden","true"),l.setAttribute("focusable","false");const a=document.createElementNS("http://www.w3.org/2000/svg","path");return a.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&l.classList.add(this.classes.hide),l.appendChild(a),e.appendChild(l),{main:e,values:s,deselect:{main:n,svg:r,path:o},arrow:{main:l,path:a}}}mainFocus(e){e!=="click"&&this.main.main.focus({preventScroll:!0})}placeholder(){const e=this.store.filter(i=>i.placeholder,!1);let s=this.settings.placeholderText;e.length&&(e[0].html!==""?s=e[0].html:e[0].text!==""&&(s=e[0].text));const n=document.createElement("div");return n.classList.add(this.classes.placeholder),n.innerHTML=s,n.setAttribute("aria-hidden","true"),n}renderValues(){if(!this.settings.isMultiple){this.renderSingleValue();return}this.renderMultipleValues(),this.updateDeselectAll()}renderSingleValue(){const e=this.store.filter(n=>n.selected&&!n.placeholder,!1),s=e.length>0?e[0]:null;if(this.main.values.removeAttribute("role"),!s)this.main.values.innerHTML=this.placeholder().outerHTML;else{const n=document.createElement("div");n.classList.add(this.classes.single),s.html?n.innerHTML=s.html:n.innerText=s.text,this.main.values.innerHTML=n.outerHTML}!this.settings.allowDeselect||!e.length?this.main.deselect.main.classList.add(this.classes.hide):this.main.deselect.main.classList.remove(this.classes.hide)}renderMultipleValues(){let e=this.main.values.childNodes,s=this.store.filter(i=>i.selected&&i.display,!1);if(s.length===0){this.main.values.removeAttribute("role"),this.main.values.innerHTML=this.placeholder().outerHTML;return}else{this.main.values.setAttribute("role","list");const i=this.main.values.querySelector("."+this.classes.placeholder);i&&i.remove()}if(s.length>this.settings.maxValuesShown){const i=document.createElement("div");i.classList.add(this.classes.max),i.textContent=this.settings.maxValuesMessage.replace("{number}",s.length.toString()),this.main.values.innerHTML=i.outerHTML;return}else{const i=this.main.values.querySelector("."+this.classes.max);i&&i.remove()}this.settings.keepOrder&&(s=this.store.selectedOrderOptions(s));let n=[];for(let i=0;ia.id===o,!1).length||n.push(r))}for(const i of n)i.classList.add(this.classes.valueOut),setTimeout(()=>{this.main.values.hasChildNodes()&&this.main.values.contains(i)&&this.main.values.removeChild(i)},100);e=this.main.values.childNodes;for(let i=0;i{if(u.preventDefault(),u.stopPropagation(),this.settings.disabled)return;let c=!0;const f=this.store.getSelectedOptions(),p=f.filter(g=>g.selected&&g.id!==e.id,!0);if(!(this.settings.minSelected&&p.length{this.main.main.focus({preventScroll:!0})})}};const l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.setAttribute("viewBox","0 0 100 100"),l.setAttribute("aria-hidden","true"),l.setAttribute("focusable","false");const a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("d",this.classes.optionDelete),l.appendChild(a),i.appendChild(l),s.appendChild(i),i.onkeydown=u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),u.stopPropagation(),i.click())},s.addEventListener("keydown",u=>{u.key==="Enter"||u.key===" "?(u.preventDefault(),u.stopPropagation()):(u.key==="Delete"||u.key==="Backspace")&&(u.preventDefault(),u.stopPropagation(),i==null||i.click())}),s.addEventListener("focusin",()=>{s.setAttribute("aria-describedby",r),i.removeAttribute("aria-hidden"),i.tabIndex=0}),s.addEventListener("focusout",()=>{s.removeAttribute("aria-describedby"),i.setAttribute("aria-hidden","true"),i.tabIndex=-1})}return s}contentDiv(){const e=document.createElement("div");e.id=this.settings.id+"-content";const s=this.searchDiv();e.appendChild(s.main);const n=this.listDiv();return e.appendChild(n),{main:e,search:s,list:n}}moveContent(){if(this.settings.contentPosition==="relative"){this.moveContentBelow();return}if(this.settings.openPosition==="down"){this.moveContentBelow();return}else if(this.settings.openPosition==="up"){this.moveContentAbove();return}this.putContent()==="up"?this.moveContentAbove():this.moveContentBelow()}searchDiv(){const e=document.createElement("div"),s=document.createElement("input"),n=document.createElement("div");e.classList.add(this.classes.search);const i={main:e,input:s};if(this.settings.showSearch||(e.classList.add(this.classes.hide),s.readOnly=!0),s.type="text",s.placeholder=this.settings.searchPlaceholder,s.tabIndex=-1,this.settings.searchLabelledBy&&this.settings.searchLabelledBy.trim()?s.setAttribute("aria-labelledby",this.settings.searchLabelledBy):this.settings.searchAriaLabel&&this.settings.searchAriaLabel.trim()?s.setAttribute("aria-label",this.settings.searchAriaLabel):s.setAttribute("aria-label","Search options"),s.setAttribute("autocapitalize","off"),s.setAttribute("autocomplete","off"),s.setAttribute("autocorrect","off"),s.oninput=Kt(r=>{this.callbacks.search(r.target.value)},100),s.onkeydown=r=>{switch(r.key){case"ArrowUp":case"ArrowDown":return r.key==="ArrowDown"?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Escape":return this.callbacks.close(),!1;case" ":const o=this.content.list.querySelector("."+this.classes.highlighted);return o?(o.click(),!1):!0;case"Enter":if(this.callbacks.addable)return n.click(),!1;{const l=this.content.list.querySelector("."+this.classes.highlighted);if(l)return l.click(),!1}return!0}return!0},e.appendChild(s),this.callbacks.addable){n.classList.add(this.classes.addable);const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("viewBox","0 0 100 100"),r.setAttribute("aria-hidden","true"),r.setAttribute("focusable","false");const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.addablePath),r.appendChild(o),n.appendChild(r),n.onclick=l=>{if(l.preventDefault(),l.stopPropagation(),!this.callbacks.addable)return;const a=this.content.search.input.value.trim();if(a===""){this.content.search.input.focus();return}const u=f=>{let p=new ue(f);if(this.callbacks.addOption(p),this.settings.isMultiple){let g=this.store.getSelected();g.push(p.id),this.callbacks.setSelected(g,!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(f=>{typeof f=="string"?u({text:f,value:f}):c instanceof Error?this.renderError(c.message):u(f)}):typeof c=="string"?u({text:c,value:c}):c instanceof Error?this.renderError(c.message):u(c))},e.appendChild(n),i.addable={main:n,svg:r,path:o}}return i}searchFocus(){this.content.search.input.focus()}getOptions(e=!1,s=!1,n=!1){let i="."+this.classes.option;return e&&(i+=":not(."+this.classes.placeholder+")"),s&&(i+=":not(."+this.classes.disabled+")"),n&&(i+=":not(."+this.classes.hide+")"),Array.from(this.content.list.querySelectorAll(i))}highlight(e){const s=this.getOptions(!0,!0,!0);if(s.length===0)return;if(s.length===1&&!s[0].classList.contains(this.classes.highlighted)){s[0].classList.add(this.classes.highlighted);const r=s[0].id;this.setActiveDescendant(r);return}let n=!1;for(const r of s)r.classList.contains(this.classes.highlighted)&&(n=!0);if(!n){for(const r of s)if(r.classList.contains(this.classes.selected)){r.classList.add(this.classes.highlighted),this.setActiveDescendant(r.id);break}}for(let r=0;r=0?r-1:s.length-1];l.classList.add(this.classes.highlighted),this.setActiveDescendant(l.id),this.ensureElementInView(this.content.list,l);const a=l.parentElement;if(a&&a.classList.contains(this.classes.close)){const u=a.querySelector("."+this.classes.optgroupLabel);u&&u.click()}return}const i=s[e==="down"?0:s.length-1];i.classList.add(this.classes.highlighted),this.setActiveDescendant(i.id),this.ensureElementInView(this.content.list,i)}listDiv(){const e=document.createElement("div");return e.classList.add(this.classes.list),e}renderError(e){this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy");const s=document.createElement("div");s.classList.add(this.classes.error),s.textContent=e,this.content.list.appendChild(s),this._announceAssertive(e)}renderSearching(){this.content.list.innerHTML="",this.content.list.setAttribute("aria-busy","true");const e=document.createElement("div");e.classList.add(this.classes.searching),e.textContent=this.settings.searchingText,this.content.list.appendChild(e),this._announcePolite(this.settings.searchingText)}renderOptions(e){if(this.content.list.innerHTML="",this.content.list.removeAttribute("aria-busy"),e.length===0){const l=document.createElement("div");l.classList.add(this.classes.search);const a=this.callbacks.addable?this.settings.addableText.replace("{value}",this.content.search.input.value):this.settings.searchText;this._announcePolite(a),l.innerHTML=a,this.content.list.appendChild(l),this.content.list.setAttribute("aria-setsize","0");return}this.settings.allowDeselect&&!this.settings.isMultiple&&(this.store.filter(a=>a.placeholder,!1).length||this.store.addOption(new ue({text:"",value:"",selected:!1,placeholder:!0}),!0));const s=document.createDocumentFragment();let n=0;const i=e.filter(l=>l instanceof ue&&!l.placeholder&&l.display&&!l.disabled).length,r=l=>{!l.classList.contains(this.classes.placeholder)&&!l.classList.contains(this.classes.disabled)&&!l.classList.contains(this.classes.hide)&&(l.setAttribute("aria-posinset",String(++n)),l.setAttribute("aria-setsize",String(i)))};for(const l of e){if(l instanceof Me){const a=document.createElement("div");a.classList.add(this.classes.optgroup),a.setAttribute("role","group"),a.setAttribute("aria-label",l.label);const u=document.createElement("div");u.classList.add(this.classes.optgroupLabel),a.appendChild(u);const c=document.createElement("div");c.classList.add(this.classes.optgroupLabelText),c.textContent=l.label,u.appendChild(c);const f=document.createElement("div");if(f.classList.add(this.classes.optgroupActions),u.appendChild(f),this.settings.isMultiple&&l.selectAll){const p=document.createElement("div");p.classList.add(this.classes.optgroupSelectAll);let g=!0;for(const m of l.options)if(!m.selected){g=!1;break}g&&p.classList.add(this.classes.selected);const _=document.createElement("span");_.textContent=l.selectAllText,p.appendChild(_);const C=document.createElementNS("http://www.w3.org/2000/svg","svg");C.setAttribute("viewBox","0 0 100 100"),C.setAttribute("aria-hidden","true"),C.setAttribute("focusable","false"),p.appendChild(C);const D=document.createElementNS("http://www.w3.org/2000/svg","path");D.setAttribute("d",this.classes.optgroupSelectAllBox),C.appendChild(D);const T=document.createElementNS("http://www.w3.org/2000/svg","path");T.setAttribute("d",this.classes.optgroupSelectAllCheck),C.appendChild(T),p.addEventListener("click",m=>{m.preventDefault(),m.stopPropagation();const b=this.store.getSelected();if(g){const y=b.filter(S=>{for(const O of l.options)if(S===O.id)return!1;return!0});this.callbacks.setSelected(y,!0);return}else{const y=b.concat(l.options.map(S=>S.id));for(const S of l.options)this.store.getOptionByID(S.id)||this.callbacks.addOption(S);this.callbacks.setSelected(y,!0);return}}),f.appendChild(p)}if(l.closable!=="off"){const p=document.createElement("div");p.classList.add(this.classes.optgroupClosable);const g=document.createElementNS("http://www.w3.org/2000/svg","svg");g.setAttribute("viewBox","0 0 100 100"),g.classList.add(this.classes.arrow),g.setAttribute("aria-hidden","true"),g.setAttribute("focusable","false"),p.appendChild(g);const _=document.createElementNS("http://www.w3.org/2000/svg","path");g.appendChild(_),l.options.some(C=>C.selected)||this.content.search.input.value.trim()!==""?(a.classList.add(this.classes.open),_.setAttribute("d",this.classes.arrowOpen)):l.closable==="open"?(a.classList.add(this.classes.open),_.setAttribute("d",this.classes.arrowOpen)):l.closable==="close"&&(a.classList.add(this.classes.close),_.setAttribute("d",this.classes.arrowClose)),u.addEventListener("click",C=>{C.preventDefault(),C.stopPropagation(),a.classList.contains(this.classes.close)?(a.classList.remove(this.classes.close),a.classList.add(this.classes.open),_.setAttribute("d",this.classes.arrowOpen)):(a.classList.remove(this.classes.open),a.classList.add(this.classes.close),_.setAttribute("d",this.classes.arrowClose))}),f.appendChild(p)}a.appendChild(u);for(const p of l.options){const g=this.option(p);r(g),a.appendChild(g)}s.appendChild(a)}if(l instanceof ue){const a=this.option(l);r(a),s.appendChild(a)}}this.content.list.appendChild(s),this.content.list.removeAttribute("aria-busy");const o=this.getOptions(!0,!0,!0).length;this._announcePolite(`${o} option${o===1?"":"s"} available`)}option(e){if(e.placeholder){const n=document.createElement("div");return n.classList.add(this.classes.option),n.classList.add(this.classes.hide),n}const s=document.createElement("div");return s.dataset.id=e.id,s.id=`${this.settings.id}__opt__${e.id}`,s.classList.add(this.classes.option),s.setAttribute("role","option"),e.class&&e.class.split(" ").forEach(n=>{s.classList.add(n)}),e.style&&(s.style.cssText=e.style),this.settings.searchHighlight&&this.content.search.input.value.trim()!==""?s.innerHTML=this.highlightText(e.html!==""?e.html:e.text,this.content.search.input.value,this.classes.searchHighlighter):e.html!==""?s.innerHTML=e.html:s.textContent=e.text,this.settings.showOptionTooltips&&s.textContent&&s.setAttribute("title",s.textContent),e.display||s.classList.add(this.classes.hide),e.disabled&&(s.classList.add(this.classes.disabled),s.setAttribute("aria-disabled","true")),e.selected&&this.settings.hideSelected&&s.classList.add(this.classes.hide),e.selected?(s.classList.add(this.classes.selected),s.setAttribute("aria-selected","true"),this.setActiveDescendant(s.id)):(s.classList.remove(this.classes.selected),s.setAttribute("aria-selected","false")),s.addEventListener("click",n=>{n.preventDefault(),n.stopPropagation();const i=this.store.getSelected(),r=n.currentTarget,o=String(r.dataset.id);if(e.disabled||e.selected&&!this.settings.allowDeselect||this.settings.isMultiple&&this.settings.maxSelected<=i.length&&!e.selected||this.settings.isMultiple&&this.settings.minSelected>=i.length&&e.selected)return;let l=!1;const a=this.store.getSelectedOptions();let u=[];if(this.settings.isMultiple){if(e.selected)u=a.filter(c=>c.id!==o);else if(u=a.concat(e),!this.settings.closeOnSelect)if(n.shiftKey&&this.lastSelectedOption){const c=this.store.getDataOptions(),f=c.findIndex(g=>g.id===this.lastSelectedOption.id),p=c.findIndex(g=>g.id===e.id);if(f>=0&&p>=0){const g=Math.min(f,p),_=Math.max(f,p),C=c.slice(g,_+1);C.length>0&&C.length!a.find(T=>T.id===D.id))))}}else e.selected||(this.lastSelectedOption=e)}this.settings.isMultiple||(e.selected?u=[]:u=[e]),this.callbacks.beforeChange||(l=!0),this.callbacks.beforeChange&&(this.callbacks.beforeChange(u,a)===!1?l=!1:l=!0),l&&(this.store.getOptionByID(o)||this.callbacks.addOption(e),this.callbacks.setSelected(u.map(c=>c.id),!1),this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(u))}),s}destroy(){this.main.main.remove(),this.content.main.remove()}highlightText(e,s,n){let i=e;const r=new RegExp("(?![^<]*>)("+s.trim()+")(?![^<]*>[^<>]*${a}`),i}moveContentAbove(){const e=this.main.main.offsetHeight,s=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 n=this.main.main.getBoundingClientRect();this.content.main.style.margin="-"+(e+s-1)+"px 0px 0px 0px",this.content.main.style.top=n.top+n.height+(this.settings.contentPosition==="fixed"?0:window.scrollY)+"px",this.content.main.style.left=n.left+(this.settings.contentPosition==="fixed"?0:window.scrollX)+"px",this.content.main.style.width=n.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",this.settings.contentPosition!=="relative"&&(this.content.main.style.top=e.top+e.height+(this.settings.contentPosition==="fixed"?0:window.scrollY)+"px",this.content.main.style.left=e.left+(this.settings.contentPosition==="fixed"?0:window.scrollX)+"px",this.content.main.style.width=e.width+"px")}ensureElementInView(e,s){const n=e.scrollTop+e.offsetTop,i=n+e.clientHeight,r=s.offsetTop,o=r+s.clientHeight;ri&&(e.scrollTop+=o-i)}putContent(){const e=this.main.main.offsetHeight,s=this.main.main.getBoundingClientRect(),n=this.content.main.offsetHeight;return window.innerHeight-(s.top+e)<=n&&s.top>n?"up":"down"}updateDeselectAll(){if(!this.store||!this.settings)return;const e=this.store.getSelectedOptions(),s=e&&e.length>0,n=this.settings.isMultiple,i=this.settings.allowDeselect,r=this.main.deselect.main,o=this.classes.hide;i&&!(n&&!s)?r.classList.remove(o):r.classList.add(o)}setActiveDescendant(e){if(!e){this.main.main.removeAttribute("aria-activedescendant"),this.content.search.input.removeAttribute("aria-activedescendant");return}this.main.main.setAttribute("aria-activedescendant",e),this.content.search.input.setAttribute("aria-activedescendant",e)}};ke._livePolite=null,ke._liveAssertive=null;let hn=ke;class Fc{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.getSelectedOptions()),!0}observeCall(e){if(!this.listen)return;let s=!1,n=!1,i=!1;for(const r of e){if(r.target===this.select&&(r.attributeName==="disabled"&&(n=!0),r.attributeName==="class"&&(s=!0),r.type==="childList")){for(const o of r.addedNodes)if(o.nodeName==="OPTION"&&o.value===this.select.value){this.select.dispatchEvent(new Event("change"));break}i=!0}(r.target.nodeName==="OPTGROUP"||r.target.nodeName==="OPTION")&&(i=!0)}s&&this.onClassChange&&this.onClassChange(this.select.className.split(" ")),n&&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 s=this.select.childNodes;for(const n of s)n.nodeName==="OPTGROUP"&&e.push(this.getDataFromOptgroup(n)),n.nodeName==="OPTION"&&e.push(this.getDataFromOption(n));return e}getDataFromOptgroup(e){let s={id:e.id,label:e.label,selectAll:e.dataset?e.dataset.selectall==="true":!1,selectAllText:e.dataset?e.dataset.selectalltext:"Select all",closable:e.dataset?e.dataset.closable:"off",options:[]};const n=e.childNodes;for(const i of n)i.nodeName==="OPTION"&&s.options.push(this.getDataFromOption(i));return s}getDataFromOption(e){return{id:e.id,value:e.value,text:e.text,html:e.dataset&&e.dataset.html?e.dataset.html:"",defaultSelected:e.defaultSelected,selected:e.selected,display:e.style.display!=="none",disabled:e.disabled,mandatory:e.dataset?e.dataset.mandatory==="true":!1,placeholder:e.dataset.placeholder==="true",class:e.className,style:e.style.cssText,data:e.dataset}}getSelectedOptions(){let e=[];const s=this.select.childNodes;for(const n of s){if(n.nodeName==="OPTGROUP"){const i=n.childNodes;for(const r of i)if(r.nodeName==="OPTION"){const o=r;o.selected&&e.push(this.getDataFromOption(o))}}if(n.nodeName==="OPTION"){const i=n;i.selected&&e.push(this.getDataFromOption(i))}}return e}getSelectedValues(){return this.getSelectedOptions().map(e=>e.value)}setSelected(e){this.changeListen(!1);const s=this.select.childNodes;for(const n of s){if(n.nodeName==="OPTGROUP"){const r=n.childNodes;for(const o of r)if(o.nodeName==="OPTION"){const l=o;l.selected=e.includes(l.id)}}if(n.nodeName==="OPTION"){const i=n;i.selected=e.includes(i.id)}}this.changeListen(!0)}setSelectedByValue(e){this.changeListen(!1);const s=this.select.childNodes;for(const n of s){if(n.nodeName==="OPTGROUP"){const r=n.childNodes;for(const o of r)if(o.nodeName==="OPTION"){const l=o;l.selected=e.includes(l.value)}}if(n.nodeName==="OPTION"){const i=n;i.selected=e.includes(i.value)}}this.changeListen(!0)}updateSelect(e,s,n){this.changeListen(!1),e&&(this.select.dataset.id=e),s&&(this.select.style.cssText=s),n&&(this.select.className="",n.forEach(i=>{i.trim()!==""&&this.select.classList.add(i.trim())})),this.changeListen(!0)}updateOptions(e){this.changeListen(!1),this.select.innerHTML="";for(const s of e)s instanceof Me&&this.select.appendChild(this.createOptgroup(s)),s instanceof ue&&this.select.appendChild(this.createOption(s));this.select.dispatchEvent(new Event("change",{bubbles:!0})),this.changeListen(!0)}createOptgroup(e){const s=document.createElement("optgroup");if(s.id=e.id,s.label=e.label,e.selectAll&&(s.dataset.selectAll="true"),e.closable!=="off"&&(s.dataset.closable=e.closable),e.options)for(const n of e.options)s.appendChild(this.createOption(n));return s}createOption(e){const s=document.createElement("option");return s.id=e.id,s.value=e.value,s.textContent=e.text,e.html!==""&&s.setAttribute("data-html",e.html),s.defaultSelected=e.defaultSelected,s.selected=e.selected,e.disabled&&(s.disabled=!0),e.display||(s.style.display="none"),e.placeholder&&s.setAttribute("data-placeholder","true"),e.mandatory&&s.setAttribute("data-mandatory","true"),e.class&&e.class.split(" ").forEach(n=>{s.classList.add(n)}),e.data&&typeof e.data=="object"&&Object.keys(e.data).forEach(n=>{s.setAttribute("data-"+kc(n),e.data[n])}),s}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 Mc{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-"+In(),this.style=e.style||"",this.class=e.class||[],this.disabled=e.disabled!==void 0?e.disabled:!1,this.alwaysOpen=e.alwaysOpen!==void 0?e.alwaysOpen:!1,this.showSearch=e.showSearch!==void 0?e.showSearch:!0,this.focusSearch=e.focusSearch!==void 0?e.focusSearch:!0,this.ariaLabel=e.ariaLabel||"",this.searchPlaceholder=e.searchPlaceholder||"Search",this.searchText=e.searchText||"No Results",this.searchingText=e.searchingText||"Searching...",this.searchHighlight=e.searchHighlight!==void 0?e.searchHighlight:!1,this.closeOnSelect=e.closeOnSelect!==void 0?e.closeOnSelect:!0,this.contentLocation=e.contentLocation||document.body,this.contentPosition=e.contentPosition||"absolute",this.openPosition=e.openPosition||"auto",this.contentAriaLabel=e.contentAriaLabel!==void 0?e.contentAriaLabel:"Select an option",this.placeholderText=e.placeholderText!==void 0?e.placeholderText:"Select Value",this.allowDeselect=e.allowDeselect!==void 0?e.allowDeselect:!1,this.hideSelected=e.hideSelected!==void 0?e.hideSelected:!1,this.keepOrder=e.keepOrder!==void 0?e.keepOrder:!1,this.showOptionTooltips=e.showOptionTooltips!==void 0?e.showOptionTooltips:!1,this.minSelected=e.minSelected||0,this.maxSelected=e.maxSelected||1e3,this.timeoutDelay=e.timeoutDelay||200,this.maxValuesShown=e.maxValuesShown||20,this.maxValuesMessage=e.maxValuesMessage||"{number} selected",this.addableText=e.addableText||'Press "Enter" to add {value}',this.ariaLabelledBy=e.ariaLabelledBy||"",this.searchAriaLabel=e.searchAriaLabel||"Search options",this.searchLabelledBy=e.searchLabelledBy||"",this.clearAllAriaLabel=e.clearAllAriaLabel||"Clear selection"}}class Nc{constructor(e){var o;if(this.events={search:void 0,searchFilter:(l,a)=>l.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=Kt(()=>{!this.settings.isOpen&&!this.settings.isFullOpen||this.render.moveContent()}),this.windowScroll=Kt(()=>{!this.settings.isOpen&&!this.settings.isFullOpen||this.render.moveContent()}),this.documentClick=l=>{this.settings.isOpen&&l.target&&!Dc(l.target,this.settings.id)&&this.close(l.type)},this.windowVisibilityChange=()=>{document.hidden&&this.close()},this.selectEl=typeof e.select=="string"?document.querySelector(e.select):e.select,!this.selectEl){e.events&&e.events.error&&e.events.error(new Error("Could not find select element"));return}if(this.selectEl.tagName!=="SELECT"){e.events&&e.events.error&&e.events.error(new Error("Element isnt of type select"));return}this.selectEl.dataset.ssid&&this.destroy(),this.settings=new Mc(e.settings),this.cssClasses=new Rc(e.cssClasses);const s=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const l in e.events)e.events.hasOwnProperty(l)&&(s.indexOf(l)!==-1?this.events[l]=Kt(e.events[l],100):this.events[l]=e.events[l]);this.settings.disabled=(o=e.settings)!=null&&o.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 Fc(this.selectEl),this.select.updateSelect(this.settings.id,this.settings.style,this.settings.class),this.select.hideUI(),this.select.onValueChange=l=>{this.setSelected(l.map(a=>a.id))},this.select.onClassChange=l=>{this.settings.class=l,this.render.updateClassStyles()},this.select.onDisabledChange=l=>{l?this.disable():this.enable()},this.select.onOptionsChange=l=>{this.setData(l)},this.store=new Ic(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 hn(this.settings,this.cssClasses,this.store,n),this.render.renderValues(),this.render.renderOptions(this.store.getData());const i=this.selectEl.getAttribute("aria-label"),r=this.selectEl.getAttribute("aria-labelledby");i?this.render.main.main.setAttribute("aria-label",i):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),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(e){const s=this.store.getSelected(),n=this.store.validateDataArray(e);if(n){this.events.error&&this.events.error(n);return}this.store.setData(e);const i=this.store.getData();this.select.updateOptions(i),this.render.renderValues(),this.render.renderOptions(i),this.events.afterChange&&!Gs(s,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let e=this.store.getSelectedOptions();return this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e)),e.map(s=>s.value)}setSelected(e,s=!0){const n=this.store.getSelected(),i=this.store.getDataOptions();e=Array.isArray(e)?e:[e];const r=[];for(const l of e){if(i.find(a=>a.id==l)){r.push(l);continue}for(const a of i.filter(u=>u.value==l))r.push(a.id)}this.store.setSelectedBy("id",r);const o=this.store.getData();this.select.updateOptions(o),this.render.renderValues(),this.render.content.search.input.value!==""?this.search(this.render.content.search.input.value):this.render.renderOptions(o),s&&this.events.afterChange&&!Gs(n,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}addOption(e){const s=this.store.getSelected();this.store.getDataOptions().some(i=>i.value===(e.value??e.text))||this.store.addOption(e);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!Gs(s,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.settings.focusSearch&&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(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){this.render.renderOptions(e===""?this.store.getData():this.store.search(e,this.events.searchFilter));return}this.render.renderSearching();const s=this.events.search(e,this.store.getSelectedOptions());if(s instanceof Promise){s.then(n=>{this.render.renderOptions(this.store.partialToFullData(n))}).catch(n=>{this.render.renderError(typeof n=="string"?n:n.message)});return}else Array.isArray(s)?this.render.renderOptions(this.store.partialToFullData(s)):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 Bc="CWYDT23U",Hc="slimselectjscom",Vc=Ts({__name:"carbonad",setup(t){const e=ir(null);let s=!1;return mr(()=>{const n=window.location.hostname==="localhost";if(!s&&!n){s=!0;const i=document.createElement("script");i.id="_carbonads_js",i.src=`//cdn.carbonads.com/carbon.js?serve=${Bc}&placement=${Hc}`,i.async=!0,e.value&&e.value.appendChild(i)}}),(n,i)=>wt(s)?(Zt(),Nr("div",{key:0,class:"carbon-container",ref_key:"container",ref:e},null,512)):Uo("",!0)}}),$c=Ts({name:"App",components:{CarbonAd:Vc},data(){return{nav:null,navDebounce:Kt(()=>{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:"Examples",closable:"close",options:[{text:"countries",value:"examples#countries"},{text:"form reset",value:"examples#formReset"}]},{label:"Settings",closable:"close",options:[{text:"select",value:"settings#select"},{text:"cssClasses",value:"settings#cssClasses"},{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"}]}]}},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 t=this.$route.hash;if(t===""&&window.scroll({top:0,behavior:"smooth"}),t){const e=document.querySelector(t);if(e){const s=document.querySelector("header"),n=document.querySelector("nav"),i=s?s.clientHeight+(window.innerWidth<700?n.clientHeight:0)+8:0;window.scroll({top:e.offsetTop-i,behavior:"smooth"})}}},200)}),this.setDemensions(),window.addEventListener("resize",this.navDebounce),window.addEventListener("nav-updated",this.updateNav)},unmounted(){var t;window.removeEventListener("resize",this.navDebounce),window.removeEventListener("nav-updated",this.updateNav),(t=this.nav)==null||t.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 t={searchHighlight:!0,openContent:"below"};this.width>700&&(t.alwaysOpen=!0,t.contentPosition="relative",t.contentLocation=this.$refs.navContent),this.nav=new Nc({select:this.$refs.nav,data:this.navData,settings:t,events:{afterChange:e=>{const n=e[0].value.split("#"),i=n[0],r=n[1]?"#"+n[1]:void 0;this.$router.push({path:i,hash:r})}}})},updateNav(){setTimeout(()=>{this.nav&&this.nav.setSelected(this.$router.currentRoute.value.fullPath.replace("/",""))},0)}}}),Uc="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",jc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACAAQMAAAD58POIAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZQTFRFyzg3////IltC9QAAAAFiS0dEAf8CLd4AAAAJcEhZcwAACxMAAAsTAQCanBgAAAAkSURBVEjHY2AYBYMV/IeDUQG4AJgeFRgVGBUYFSBNYBQMPgAARjtdvxo6xaMAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTEtMDUtMzBUMjM6MTA6NDQtMDc6MDCm4GvfAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDEwLTEyLTA2VDEyOjIwOjEyLTA4OjAwpIGEmQAAADJ0RVh0UE5HOmNIUk0AY2h1bmsgd2FzIGZvdW5kIChzZWUgQ2hyb21hdGljaXR5LCBhYm92ZSkH0UjaAAAAKXRFWHRQTkc6Z0FNQQBnYW1tYT0wLjQ1NDU1IChTZWUgR2FtbWEsIGFib3ZlKRISLKcAAAAUdEVYdFBORzpJSERSLmJpdF9kZXB0aAA4KYV+UAAAABV0RVh0UE5HOklIRFIuY29sb3JfdHlwZQA2BkqnKwAAABt0RVh0UE5HOklIRFIuaW50ZXJsYWNlX21ldGhvZAAw+zsHjAAAABx0RVh0UE5HOklIRFIud2lkdGgsaGVpZ2h0ADE2LCAxNjjVBg0AAAAodEVYdFBORzpwSFlzAHhfcmVzPTI4MzUsIHlfcmVzPTI4MzUsIHVuaXRzPTGCKXI+AAAAKHRFWHRQTkc6c1JHQgBpbnRlbnQ9MCAoU2VlIFJlbmRlcmluZyBpbnRlbnQp8hEU9QAAAABJRU5ErkJggg==",zc=(t,e)=>{const s=t.__vccOpts||t;for(const[n,i]of e)s[n]=i;return s},Wc={ref:"nav"},qc={class:"nav-content",ref:"navContent"};function Gc(t,e,s,n,i,r){const o=Un("CarbonAd"),l=Un("router-view");return Zt(),Nr(Re,null,[e[4]||(e[4]=$o('

Slim Select 2.0

Advanced select dropdown
',1)),Ze("nav",null,[Ze("select",Wc,null,512),Ze("div",qc,null,512),de(o)]),Ze("main",null,[de(l),Ze("footer",null,[ds(" © "+Vi(t.year)+" ",1),e[0]||(e[0]=Ze("a",{href:"http://webiswhatido.com",style:{color:"#ffffff"},target:"_blank"},"Brian Voelker",-1)),e[1]||(e[1]=ds(". ")),e[2]||(e[2]=Ze("br",null,null,-1)),e[3]||(e[3]=ds(" Slim Select is under the MIT license. "))])])],64)}const Kc=zc($c,[["render",Gc]]);var Ri=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function sl(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ks={exports:{}},Di;function Yc(){return Di||(Di=1,function(t){var e=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/render.test.ts b/src/slim-select/render.test.ts index 69f2b1ba..593238ae 100644 --- a/src/slim-select/render.test.ts +++ b/src/slim-select/render.test.ts @@ -4,7 +4,7 @@ 'use strict' -import { describe, expect, test } from '@jest/globals' +import { describe, expect, test, beforeEach, jest } from '@jest/globals' import Render, { Callbacks } from './render' import Settings from './settings' import Store, { Option } from './store' @@ -23,19 +23,9 @@ describe('render module', () => { beforeEach(() => { const store = new Store('single', [ - { - text: 'test0', - value: 'test0' - }, - { - text: 'test1', - value: 'test1', - html: 'test1' - }, - { - text: 'test2', - selected: true - } + { text: 'test0', value: 'test0' }, + { text: 'test1', value: 'test1', html: 'test1' }, + { text: 'test2', selected: true } ]) const settings = new Settings() @@ -50,15 +40,15 @@ describe('render module', () => { afterChangeMock = jest.fn(() => {}) beforeChangeMock = jest.fn(() => true) - const callbacks = { + const callbacks: Callbacks = { open: openMock, close: closeMock, - addSelected: addSelectedMock, setSelected: setSelectedMock, addOption: addOptionMock, search: searchMock, afterChange: afterChangeMock, - beforeChange: beforeChangeMock + // ensure TS sees a boolean | void, while still counting calls via beforeChangeMock + beforeChange: (newVal, oldVal) => beforeChangeMock(newVal, oldVal) as boolean } render = new Render(settings, classes, store, callbacks) @@ -74,17 +64,14 @@ describe('render module', () => { const settings = new Settings() const classes = new CssClasses() - const callbacks = { + const callbacks: Callbacks = { open: () => {}, close: () => {}, - addSelected: () => {}, setSelected: () => {}, addOption: () => {}, search: () => {}, - beforeChange: () => { - return true - } - } as Callbacks + beforeChange: () => true + } const renderInstance = new Render(settings, classes, store, callbacks) expect(renderInstance).toBeInstanceOf(Render) @@ -119,7 +106,9 @@ describe('render module', () => { expect(render.main.arrow.path.getAttribute('d')).toBe(render.classes.arrowOpen) expect(render.main.main.classList.contains(render.classes.openBelow)).toBe(true) expect(render.main.main.classList.contains(render.classes.openAbove)).toBe(false) - expect(render.content.search.input.getAttribute('aria-expanded')).toBe('true') + // aria-expanded now lives on the combobox container, not the input + expect(render.main.main.getAttribute('aria-expanded')).toBe('true') + expect(render.content.search.input.hasAttribute('aria-expanded')).toBe(false) // moveContentBelow will add class to content as well expect(render.content.main.classList.contains(render.classes.openBelow)).toBe(true) expect(render.content.main.classList.contains(render.classes.openAbove)).toBe(false) @@ -134,7 +123,9 @@ describe('render module', () => { expect(render.main.arrow.path.getAttribute('d')).toBe(render.classes.arrowClose) expect(render.main.main.classList.contains(render.classes.openBelow)).toBe(false) expect(render.main.main.classList.contains(render.classes.openAbove)).toBe(false) - expect(render.content.search.input.getAttribute('aria-expanded')).toBe('false') + // aria-expanded now lives on the combobox container, not the input + expect(render.main.main.getAttribute('aria-expanded')).toBe('false') + expect(render.content.search.input.hasAttribute('aria-expanded')).toBe(false) expect(render.content.main.classList.contains(render.classes.openBelow)).toBe(false) expect(render.content.main.classList.contains(render.classes.openAbove)).toBe(false) }) @@ -144,7 +135,6 @@ describe('render module', () => { test('existing classes and styles are cleared', () => { render.main.main.className = 'test' ;(render.main.main.style as any).color = 'red' - render.content.main.className = 'test' ;(render.content.main.style as any).color = 'red' @@ -152,7 +142,6 @@ describe('render module', () => { expect(render.main.main.classList.contains('test')).toBe(false) expect(render.main.main.style.color).toBeFalsy() - expect(render.content.main.classList.contains('test')).toBe(false) expect(render.content.main.style.color).toBeFalsy() }) @@ -190,18 +179,25 @@ describe('render module', () => { }) describe('updateAriaAttributes', () => { - test('sets correct aria attributes (on input, not main)', () => { + test('sets correct aria attributes on combobox and searchbox', () => { render.updateAriaAttributes() const input = render.content.search.input const list = render.content.list + const main = render.main.main + + // Main is the combobox + expect(main.getAttribute('role')).toBe('combobox') + expect(main.getAttribute('aria-controls')).toBe(list.id) + expect(main.getAttribute('aria-haspopup')).toBe('listbox') + expect(main.getAttribute('aria-expanded')).toBe('false') - expect(input.getAttribute('role')).toBe('combobox') - expect(input.getAttribute('aria-haspopup')).toBe('listbox') + // Input is a plain searchbox (not a combobox) + expect(input.getAttribute('role')).toBe('searchbox') expect(input.getAttribute('aria-controls')).toBe(list.id) expect(input.getAttribute('aria-owns')).toBe(list.id) - expect(input.getAttribute('aria-expanded')).toBe('false') expect(input.getAttribute('aria-autocomplete')).toBe('list') + expect(input.hasAttribute('aria-expanded')).toBe(false) expect(list.getAttribute('role')).toBe('listbox') expect(list.getAttribute('aria-label')).toBe(render.settings.contentAriaLabel) @@ -238,12 +234,14 @@ describe('render module', () => { expect(main.children.item(2)?.children.item(0)).toBeInstanceOf(SVGElement) }) - test('arrow key events on main element move highlight', () => { + test('arrow key events on main element move highlight (opens then focuses search)', () => { const highlightMock = jest.fn(() => {}) render.highlight = highlightMock + const rafOrig = (global as any).requestAnimationFrame + ;(global as any).requestAnimationFrame = (cb: Function) => cb() + render.main.main.dispatchEvent(new KeyboardEvent('keydown', { key: 'ArrowUp' })) - expect(openMock).toHaveBeenCalled() expect(highlightMock).toHaveBeenCalledTimes(1) expect(highlightMock.mock.calls[0]).toStrictEqual(['up']) @@ -251,56 +249,60 @@ describe('render module', () => { expect(openMock).toHaveBeenCalledTimes(2) expect(highlightMock).toHaveBeenCalledTimes(2) expect(highlightMock.mock.calls[1]).toStrictEqual(['down']) + + ;(global as any).requestAnimationFrame = rafOrig }) - test('tab and escape key event on main element triggers close callback', () => { + test('tab key on main triggers close callback', () => { render.main.main.dispatchEvent(new KeyboardEvent('keydown', { key: 'Tab' })) expect(closeMock).toHaveBeenCalled() - render.main.main.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape' })) - expect(closeMock).toHaveBeenCalledTimes(2) }) - test('enter and space key event on main element triggers open callback', () => { + test('enter and space key on main opens and selects highlighted', () => { render.main.main.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' })) expect(openMock).toHaveBeenCalled() render.main.main.dispatchEvent(new KeyboardEvent('keydown', { key: ' ' })) expect(openMock).toHaveBeenCalledTimes(2) }) + test('printable character on main forwards to input and triggers search', () => { + const rafOrig = (global as any).requestAnimationFrame + ;(global as any).requestAnimationFrame = (cb: Function) => cb() + + render.main.main.dispatchEvent(new KeyboardEvent('keydown', { key: 'a' })) + + expect(openMock).toHaveBeenCalled() + expect(render.content.search.input.value).toContain('a') + + ;(global as any).requestAnimationFrame = rafOrig + }) + test('click on main event does nothing if element is disabled', () => { render.settings.disabled = true - render.main.main.dispatchEvent(new MouseEvent('click')) - expect(openMock).not.toHaveBeenCalled() expect(closeMock).not.toHaveBeenCalled() }) test('click on main event triggers open if element is closed', () => { render.main.main.dispatchEvent(new MouseEvent('click')) - expect(openMock).toHaveBeenCalled() expect(closeMock).not.toHaveBeenCalled() }) test('click on main event triggers close if element is opened', () => { render.settings.isOpen = true - render.main.main.dispatchEvent(new MouseEvent('click')) - expect(openMock).not.toHaveBeenCalled() expect(closeMock).toHaveBeenCalled() }) test('click on deselect does nothing if element is disabled', () => { render.settings.disabled = true - const deselectElement: HTMLDivElement = render.main.main.querySelector( '.' + render.classes.deselect ) as HTMLDivElement - deselectElement.dispatchEvent(new MouseEvent('click')) - expect(afterChangeMock).not.toHaveBeenCalled() }) @@ -308,9 +310,7 @@ describe('render module', () => { const deselectElement: HTMLDivElement = render.main.main.querySelector( '.' + render.classes.deselect ) as HTMLDivElement - deselectElement.dispatchEvent(new MouseEvent('click')) - expect(setSelectedMock).toHaveBeenCalled() expect(closeMock).toHaveBeenCalled() expect(afterChangeMock).toHaveBeenCalled() @@ -318,7 +318,6 @@ describe('render module', () => { test('click on deselect on multiple select runs callbacks', () => { render.settings.isMultiple = true - const deselectAllMock = jest.fn() render.updateDeselectAll = deselectAllMock @@ -336,7 +335,6 @@ describe('render module', () => { describe('mainFocus', () => { let focusMock: jest.Mock - beforeEach(() => { focusMock = jest.fn(() => {}) render.main.main.focus = focusMock @@ -361,32 +359,18 @@ describe('render module', () => { test('placeholder uses fallback text if no option is found', () => { render.settings.placeholderText = 'placeholder text' const placeholder = render.placeholder() - expect(placeholder.innerHTML).toBe(render.settings.placeholderText) }) test('placeholder uses option html if option is found', () => { - render.store.setData([ - { - text: 'opt text', - html: '

Option HTML

', - placeholder: true - } - ]) + render.store.setData([{ text: 'opt text', html: '

Option HTML

', placeholder: true }]) const placeholder = render.placeholder() - expect(placeholder.innerHTML).toBe('

Option HTML

') }) test('placeholder uses option text if option is found and no HTML is set', () => { - render.store.setData([ - { - text: 'opt text', - placeholder: true - } - ]) + render.store.setData([{ text: 'opt text', placeholder: true }]) const placeholder = render.placeholder() - expect(placeholder.innerHTML).toBe('opt text') }) }) @@ -399,14 +383,8 @@ describe('render module', () => { test('single select renders HTML option', () => { render.store.setData([ - { - text: 'opt0' - }, - { - text: 'opt1', - html: 'opt1', - selected: true - } + { text: 'opt0' }, + { text: 'opt1', html: 'opt1', selected: true } ]) render.renderValues() @@ -417,40 +395,20 @@ describe('render module', () => { test('multiple select renders all selected values', () => { render.settings.isMultiple = true render.store = new Store('multiple', [ - { - text: 'opt0', - value: 'opt0', - selected: true - }, - { - text: 'opt1', - value: 'opt1', - html: 'opt1', - selected: true - }, - { - text: 'opt2' - } + { text: 'opt0', value: 'opt0', selected: true }, + { text: 'opt1', value: 'opt1', html: 'opt1', selected: true }, + { text: 'opt2' } ]) render.renderValues() expect(render.main.values.children).toHaveLength(2) - expect(render.main.values.children.item(0)).toBeInstanceOf(HTMLDivElement) const chip0 = render.main.values.children.item(0) as HTMLDivElement - - expect(chip0).toBeInstanceOf(HTMLDivElement) - const chip0Text = chip0.querySelector('.' + render.classes.valueText) as HTMLDivElement - expect(chip0Text.textContent).toBe('opt0') - expect(render.main.values.children.item(1)).toBeInstanceOf(HTMLDivElement) const chip1 = render.main.values.children.item(1) as HTMLDivElement const chip1Text = chip1.querySelector('.' + render.classes.valueText) as HTMLDivElement - - expect(chip1).toBeInstanceOf(HTMLDivElement) - expect(chip1Text).toBeTruthy() expect(chip1Text.textContent).toBe('opt1') }) @@ -458,25 +416,10 @@ describe('render module', () => { render.settings.isMultiple = true render.settings.maxValuesShown = 2 render.store = new Store('multiple', [ - { - text: 'opt0', - value: 'opt0', - selected: true - }, - { - text: 'opt1', - value: 'opt1', - html: 'opt1', - selected: true - }, - { - text: 'opt2', - value: 'opt2', - selected: true - }, - { - text: 'opt4' - } + { text: 'opt0', value: 'opt0', selected: true }, + { text: 'opt1', value: 'opt1', html: 'opt1', selected: true }, + { text: 'opt2', value: 'opt2', selected: true }, + { text: 'opt4' } ]) render.renderValues() @@ -509,14 +452,12 @@ describe('render module', () => { beforeEach(() => { contentAboveMock = jest.fn() contentBelowMock = jest.fn() - render.moveContentAbove = contentAboveMock render.moveContentBelow = contentBelowMock }) test('content is moved below when position is relative', () => { render.settings.contentPosition = 'relative' - render.moveContent() expect(contentAboveMock).not.toHaveBeenCalled() expect(contentBelowMock).toHaveBeenCalled() @@ -524,7 +465,6 @@ describe('render module', () => { test('content is moved below when open position is down', () => { render.settings.openPosition = 'down' - render.moveContent() expect(contentAboveMock).not.toHaveBeenCalled() expect(contentBelowMock).toHaveBeenCalled() @@ -532,23 +472,20 @@ describe('render module', () => { test('content is moved above when open position is up', () => { render.settings.openPosition = 'up' - render.moveContent() expect(contentAboveMock).toHaveBeenCalled() expect(contentBelowMock).not.toHaveBeenCalled() }) test('content is moved above when putContent is up', () => { - render.putContent = jest.fn(() => 'up') - + render.putContent = (jest.fn(() => 'up') as unknown) as () => 'up' | 'down' render.moveContent() expect(contentAboveMock).toHaveBeenCalled() expect(contentBelowMock).not.toHaveBeenCalled() }) test('content is moved below when putContent is down', () => { - render.putContent = jest.fn(() => 'down') - + render.putContent = (jest.fn(() => 'down') as unknown) as () => 'up' | 'down' render.moveContent() expect(contentAboveMock).not.toHaveBeenCalled() expect(contentBelowMock).toHaveBeenCalled() @@ -558,26 +495,20 @@ describe('render module', () => { describe('searchDiv', () => { test('search is hidden when showSearch setting is false', () => { render.settings.showSearch = false - const search = render.searchDiv() - expect(search.main.classList.contains(render.classes.hide)).toBe(true) }) test('input is debounced', async () => { const search = render.searchDiv() - search.input.dispatchEvent(new InputEvent('input', { data: 'asdf' })) - await new Promise((r) => setTimeout(r, 101)) - expect(searchMock).toHaveBeenCalled() }) test('arrow keys move highlight', () => { const search = render.searchDiv() const highlightMock = jest.fn(() => {}) - render.highlight = highlightMock search.input.dispatchEvent(new KeyboardEvent('keydown', { key: 'ArrowUp' })) @@ -591,27 +522,19 @@ describe('render module', () => { test('tab triggers close callback', () => { const search = render.searchDiv() - search.input.dispatchEvent(new KeyboardEvent('keydown', { key: 'Tab' })) - expect(closeMock).toHaveBeenCalled() }) test('escape triggers close callback', () => { const search = render.searchDiv() - search.input.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape' })) - expect(closeMock).toHaveBeenCalled() }) test("enter and space don't call addable with empty value", () => { const search = render.searchDiv() - const addableMock = jest.fn((s: string) => ({ - text: s, - value: s.toLowerCase() - })) - + const addableMock = jest.fn((s: string) => ({ text: s, value: s.toLowerCase() })) render.callbacks.addable = addableMock search.input.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' })) @@ -622,11 +545,7 @@ describe('render module', () => { }) test('enter triggers addable when defined and value present', () => { - const addableMock = jest.fn((s: string) => ({ - text: s, - value: s.toLowerCase() - })) - + const addableMock = jest.fn((s: string) => ({ text: s, value: s.toLowerCase() })) render.callbacks.addable = addableMock render.content.search = render.searchDiv() @@ -641,7 +560,6 @@ describe('render module', () => { describe('searchFocus', () => { test('search is focused', () => { expect(document.activeElement).not.toBe(render.content.search.input) - render.searchFocus() expect(document.activeElement).toBe(render.content.search.input) }) @@ -651,87 +569,37 @@ describe('render module', () => { test('returns all options when called without parameters', () => { render.renderOptions(render.store.getDataOptions()) const opts = render.getOptions() - expect(opts).toHaveLength(3) }) test('filters correctly when filtering out placeholders', () => { render.renderOptions( - render.store.partialToFullData([ - { - text: 'opt0', - placeholder: true - }, - { - text: 'opt1' - }, - { - text: 'opt2' - } - ]) + render.store.partialToFullData([{ text: 'opt0', placeholder: true }, { text: 'opt1' }, { text: 'opt2' }]) ) - const opts = render.getOptions(true, false, true) expect(opts).toHaveLength(2) }) test('filters correctly when filtering out disabled options', () => { render.renderOptions( - render.store.partialToFullData([ - { - text: 'opt0', - disabled: true - }, - { - text: 'opt1' - }, - { - text: 'opt2' - } - ]) + render.store.partialToFullData([{ text: 'opt0', disabled: true }, { text: 'opt1' }, { text: 'opt2' }]) ) - const opts = render.getOptions(false, true) expect(opts).toHaveLength(2) }) test('filters correctly when filtering out hidden options', () => { render.renderOptions( - render.store.partialToFullData([ - { - text: 'opt0', - placeholder: true - }, - { - text: 'opt1' - }, - { - text: 'opt2' - } - ]) + render.store.partialToFullData([{ text: 'opt0', placeholder: true }, { text: 'opt1' }, { text: 'opt2' }]) ) - const opts = render.getOptions(false, false, true) expect(opts).toHaveLength(2) }) test('filters correctly when filtering out hidden and disabled options', () => { render.renderOptions( - render.store.partialToFullData([ - { - text: 'opt0', - disabled: true - }, - { - text: 'opt1', - placeholder: true - }, - { - text: 'opt2' - } - ]) + render.store.partialToFullData([{ text: 'opt0', disabled: true }, { text: 'opt1', placeholder: true }, { text: 'opt2' }]) ) - const opts = render.getOptions(false, true, true) expect(opts).toHaveLength(1) }) @@ -740,197 +608,84 @@ describe('render module', () => { describe('highlight', () => { test('simply do nothing without breaking when options are empty', () => { render.renderOptions([]) - expect(() => render.highlight('up')).not.toThrow() }) test('highlight single option that is not already highlighted', () => { - render.renderOptions( - render.store.partialToFullData([ - { - text: 'opt0' - } - ]) - ) - + render.renderOptions(render.store.partialToFullData([{ text: 'opt0' }])) render.highlight('up') - expect(render.getOptions()[0].classList.contains(render.classes.highlighted)).toBe(true) }) test('select first option with down when no option is highlighted or selected', () => { - render.renderOptions( - render.store.partialToFullData([ - { - text: 'opt0' - }, - { - text: 'opt1' - }, - { - text: 'opt2' - } - ]) - ) - + render.renderOptions(render.store.partialToFullData([{ text: 'opt0' }, { text: 'opt1' }, { text: 'opt2' }])) render.highlight('down') - expect(render.getOptions()[0].classList.contains(render.classes.highlighted)).toBe(true) }) test('select last option with up when no option is highlighted or selected', () => { - render.renderOptions( - render.store.partialToFullData([ - { - text: 'opt0' - }, - { - text: 'opt1' - }, - { - text: 'opt2' - } - ]) - ) - + render.renderOptions(render.store.partialToFullData([{ text: 'opt0' }, { text: 'opt1' }, { text: 'opt2' }])) render.highlight('up') - expect(render.getOptions()[2].classList.contains(render.classes.highlighted)).toBe(true) }) test('highlight next option on down after highlighted option', () => { - render.renderOptions( - render.store.partialToFullData([ - { - text: 'opt0', - class: render.classes.highlighted - }, - { - text: 'opt1' - }, - { - text: 'opt2' - } - ]) - ) - + render.renderOptions(render.store.partialToFullData([ + { text: 'opt0', class: render.classes.highlighted }, + { text: 'opt1' }, + { text: 'opt2' } + ])) render.highlight('down') - expect(render.getOptions()[1].classList.contains(render.classes.highlighted)).toBe(true) }) test('highlight previous option on up before highlighted option', () => { - render.renderOptions( - render.store.partialToFullData([ - { - text: 'opt0' - }, - { - text: 'opt1' - }, - { - text: 'opt2', - class: render.classes.highlighted - } - ]) - ) - + render.renderOptions(render.store.partialToFullData([ + { text: 'opt0' }, + { text: 'opt1' }, + { text: 'opt2', class: render.classes.highlighted } + ])) render.highlight('up') - expect(render.getOptions()[1].classList.contains(render.classes.highlighted)).toBe(true) }) test('highlight next option on down after selected option when no options is highlighted', () => { - render.renderOptions( - render.store.partialToFullData([ - { - text: 'opt0', - selected: true - }, - { - text: 'opt1' - }, - { - text: 'opt2' - } - ]) - ) - + render.renderOptions(render.store.partialToFullData([ + { text: 'opt0', selected: true }, + { text: 'opt1' }, + { text: 'opt2' } + ])) render.highlight('down') - expect(render.getOptions()[1].classList.contains(render.classes.highlighted)).toBe(true) }) test('skip to last option when using up at the first option', () => { - render.renderOptions( - render.store.partialToFullData([ - { - text: 'opt0', - selected: true - }, - { - text: 'opt1' - }, - { - text: 'opt2' - } - ]) - ) - + render.renderOptions(render.store.partialToFullData([ + { text: 'opt0', selected: true }, + { text: 'opt1' }, + { text: 'opt2' } + ])) render.highlight('up') - expect(render.getOptions()[2].classList.contains(render.classes.highlighted)).toBe(true) }) test('highlight next option within opt group on down', () => { - render.renderOptions( - render.store.partialToFullData([ - { - text: 'opt0', - selected: true - }, - { - label: 'opt group', - options: [ - { - text: 'opt1' - } - ] - }, - { - text: 'opt2' - } - ]) - ) - + render.renderOptions(render.store.partialToFullData([ + { text: 'opt0', selected: true }, + { label: 'opt group', options: [{ text: 'opt1' }] }, + { text: 'opt2' } + ])) render.highlight('down') - expect(render.getOptions()[1].classList.contains(render.classes.highlighted)).toBe(true) }) test('highlight previous option within opt group on up', () => { - render.renderOptions( - render.store.partialToFullData([ - { - text: 'opt0' - }, - { - label: 'opt group', - options: [ - { - text: 'opt1', - selected: true - } - ] - }, - { - text: 'opt2' - } - ]) - ) - + render.renderOptions(render.store.partialToFullData([ + { text: 'opt0' }, + { label: 'opt group', options: [{ text: 'opt1', selected: true }] }, + { text: 'opt2' } + ])) render.highlight('up') - expect(render.getOptions()[0].classList.contains(render.classes.highlighted)).toBe(true) }) }) @@ -938,7 +693,6 @@ describe('render module', () => { describe('listDiv', () => { test('list div has correct class', () => { const list = render.listDiv() - expect(list.classList.contains(render.classes.list)).toBe(true) }) }) @@ -946,9 +700,7 @@ describe('render module', () => { describe('renderError', () => { test('error message is rendered correctly', () => { expect(render.content.list.children).toHaveLength(0) - render.renderError('test error') - expect(render.content.list.children).toHaveLength(1) expect(render.content.list.children.item(0)).toBeInstanceOf(HTMLDivElement) expect(render.content.list.children.item(0)?.className).toBe(render.classes.error) @@ -957,10 +709,8 @@ describe('render module', () => { test('list is reset on new error', () => { expect(render.content.list.children).toHaveLength(0) - render.renderError('test error') expect(render.content.list.children).toHaveLength(1) - render.renderError('error 2') expect(render.content.list.children).toHaveLength(1) expect(render.content.list.children.item(0)?.textContent).toBe('error 2') @@ -970,10 +720,8 @@ describe('render module', () => { describe('renderSearching', () => { test('search text is rendered correctly', () => { expect(render.content.list.children).toHaveLength(0) - render.settings.searchingText = 'search' render.renderSearching() - expect(render.content.list.children).toHaveLength(1) expect(render.content.list.children.item(0)).toBeInstanceOf(HTMLDivElement) expect(render.content.list.children.item(0)?.className).toBe(render.classes.searching) @@ -982,11 +730,9 @@ describe('render module', () => { test('list is reset on new search text', () => { expect(render.content.list.children).toHaveLength(0) - render.settings.searchingText = 'search' render.renderSearching() expect(render.content.list.children).toHaveLength(1) - render.settings.searchingText = 'search 2' render.renderSearching() expect(render.content.list.children).toHaveLength(1) @@ -994,66 +740,33 @@ describe('render module', () => { }) }) - describe('renderOptions', () => {}) - describe('option', () => { test('add inline styles correctly', () => { - const option = render.option( - new Option({ - text: 'opt', - style: 'color: red' - }) - ) - + const option = render.option(new Option({ text: 'opt', style: 'color: red' })) expect(option.style.color).toBe('red') }) test('add hidden class on option with display false', () => { - const option = render.option( - new Option({ - text: 'opt', - display: false - }) - ) - + const option = render.option(new Option({ text: 'opt', display: false })) expect(option.classList.contains(render.classes.hide)).toBe(true) }) test('add hidden class on selected option when hideSelected setting is true', () => { render.settings.hideSelected = true - - const option = render.option( - new Option({ - text: 'opt', - selected: true - }) - ) - + const option = render.option(new Option({ text: 'opt', selected: true })) expect(option.classList.contains(render.classes.hide)).toBe(true) }) test('title attribute is set when showOptionTooltips setting is true', () => { render.settings.showOptionTooltips = true - - const option = render.option( - new Option({ - text: 'opt' - }) - ) - + const option = render.option(new Option({ text: 'opt' })) expect(option.getAttribute('title')).toBe('opt') }) test('text is highlighted correctly with option text', () => { render.settings.searchHighlight = true render.content.search.input.value = 'opt' - - const option = render.option( - new Option({ - text: 'opt 1' - }) - ) - + const option = render.option(new Option({ text: 'opt 1' })) expect(option.querySelector('mark')).toBeTruthy() expect(option.querySelector('mark')?.textContent).toBe('opt') }) @@ -1061,27 +774,14 @@ describe('render module', () => { test('text is highlighted correctly with option HTML', () => { render.settings.searchHighlight = true render.content.search.input.value = 'opt' - - const option = render.option( - new Option({ - text: 'opt 1', - html: '

opt 1

' - }) - ) - + const option = render.option(new Option({ text: 'opt 1', html: '

opt 1

' })) expect(option.querySelector('mark')).toBeTruthy() expect(option.querySelector('mark')?.textContent).toBe('opt') }) test('click does nothing when option is disabled', () => { - const option = render.option( - new Option({ - text: 'opt 1', - disabled: true - }) - ) + const option = render.option(new Option({ text: 'opt 1', disabled: true })) option.dispatchEvent(new MouseEvent('click')) - expect(addOptionMock).not.toHaveBeenCalled() expect(setSelectedMock).not.toHaveBeenCalled() }) @@ -1089,14 +789,8 @@ describe('render module', () => { test('click does nothing when max count of selected options is reached', () => { render.settings.isMultiple = true render.settings.maxSelected = 1 - - const option = render.option( - new Option({ - text: 'opt 1' - }) - ) + const option = render.option(new Option({ text: 'opt 1' })) option.dispatchEvent(new MouseEvent('click')) - expect(addOptionMock).not.toHaveBeenCalled() expect(setSelectedMock).not.toHaveBeenCalled() }) @@ -1105,30 +799,17 @@ describe('render module', () => { render.settings.isMultiple = true render.settings.allowDeselect = true render.settings.minSelected = 1 - - const option = render.option( - new Option({ - text: 'opt 1', - selected: true - }) - ) + const option = render.option(new Option({ text: 'opt 1', selected: true })) option.dispatchEvent(new MouseEvent('click')) - expect(addOptionMock).not.toHaveBeenCalled() expect(setSelectedMock).not.toHaveBeenCalled() }) - test('click removes option', () => { - const option = render.option( - new Option({ - text: 'new opt 1' - }) - ) - + test('click removes/adds option and triggers callbacks', () => { + const option = render.option(new Option({ text: 'new opt 1' })) option.dispatchEvent(new MouseEvent('click')) - expect(addOptionMock).toHaveBeenCalled() - expect(addOptionMock.mock.calls[0][0].text).toBe('new opt 1') + expect((addOptionMock.mock.calls[0][0] as any).text).toBe('new opt 1') expect(setSelectedMock).toHaveBeenCalled() }) }) @@ -1168,15 +849,11 @@ describe('render module', () => { test('click holding shift key selects range from last clicked to current', () => { renderMultiple.renderOptions(renderMultiple.store.getDataOptions()) - const opts = renderMultiple.getOptions(false, false, true) expect(opts).toHaveLength(3) - opts[0].dispatchEvent(new MouseEvent('click')) expect(afterChangeMock2).toHaveBeenCalledWith([expect.objectContaining({ value: 'test1' })]) - opts[2].dispatchEvent(new MouseEvent('click', { shiftKey: true })) - expect(afterChangeMock2).toHaveBeenCalledWith([ expect.objectContaining({ value: 'test1' }), expect.objectContaining({ value: 'test2' }), @@ -1186,15 +863,11 @@ describe('render module', () => { test('click holding shift key selects range from current to last clicked', () => { renderMultiple.renderOptions(renderMultiple.store.getDataOptions()) - const opts = renderMultiple.getOptions(false, false, true) expect(opts).toHaveLength(3) - opts[2].dispatchEvent(new MouseEvent('click')) expect(afterChangeMock2).toHaveBeenCalledWith([expect.objectContaining({ value: 'test3' })]) - opts[0].dispatchEvent(new MouseEvent('click', { shiftKey: true })) - expect(afterChangeMock2).toHaveBeenCalledWith([ expect.objectContaining({ value: 'test3' }), expect.objectContaining({ value: 'test1' }), @@ -1205,15 +878,11 @@ describe('render module', () => { test('range selection is ignored if range length is greater than maxSelected', () => { renderMultiple.settings.maxSelected = 2 renderMultiple.renderOptions(renderMultiple.store.getDataOptions()) - const opts = renderMultiple.getOptions(false, false, true) expect(opts).toHaveLength(3) - opts[0].dispatchEvent(new MouseEvent('click')) expect(afterChangeMock2).toHaveBeenCalledWith([expect.objectContaining({ value: 'test1' })]) - opts[2].dispatchEvent(new MouseEvent('click', { shiftKey: true })) - expect(afterChangeMock2).toHaveBeenCalledWith([ expect.objectContaining({ value: 'test1' }), expect.objectContaining({ value: 'test3' }) @@ -1225,12 +894,9 @@ describe('render module', () => { test('elements get removed', () => { expect(render.main.main).toBeInstanceOf(HTMLDivElement) expect(render.content.main).toBeInstanceOf(HTMLDivElement) - render.main.main.id = 'main-id' render.content.main.id = 'content-id' - render.destroy() - expect(document.getElementById('main-id')).toBeNull() expect(document.getElementById('content-id')).toBeNull() }) @@ -1239,10 +905,8 @@ describe('render module', () => { describe('moveContentAbove', () => { test('correct classes are set', () => { render.moveContentAbove() - expect(render.main.main.classList.contains(render.classes.openAbove)).toBe(true) expect(render.main.main.classList.contains(render.classes.openBelow)).toBe(false) - expect(render.content.main.classList.contains(render.classes.openAbove)).toBe(true) expect(render.content.main.classList.contains(render.classes.openBelow)).toBe(false) }) @@ -1251,20 +915,16 @@ describe('render module', () => { describe('moveContentBelow', () => { test('correct classes are set', () => { render.moveContentBelow() - expect(render.main.main.classList.contains(render.classes.openAbove)).toBe(false) expect(render.main.main.classList.contains(render.classes.openBelow)).toBe(true) - expect(render.content.main.classList.contains(render.classes.openAbove)).toBe(false) expect(render.content.main.classList.contains(render.classes.openBelow)).toBe(true) }) }) describe('accessibility (a11y)', () => { - test('search input gets ARIA wiring (controls + autocomplete + label fallback)', () => { render.updateAriaAttributes() - expect(render.content.search.input.getAttribute('aria-controls')).toBe(render.content.list.id) expect(render.content.search.input.getAttribute('aria-autocomplete')).toBe('list') expect(render.content.search.input.getAttribute('aria-label')).toBe('Search options') @@ -1272,36 +932,33 @@ describe('render module', () => { test('deselect control has button semantics and label', () => { const deselectEl = render.main.main.querySelector('.' + render.classes.deselect) as HTMLDivElement - expect(deselectEl.getAttribute('role')).toBe('button') expect(deselectEl.getAttribute('tabindex')).toBe('0') expect(deselectEl.getAttribute('aria-label')).toBe(render.settings.clearAllAriaLabel) }) test('token delete control (multi) has button semantics', () => { - const opt = new Option({ text: 'Alpha', value: 'alpha', selected: true }) - const token = render.multipleValue(opt) + const opt = new Option({ text: 'Alpha', value: 'alpha', selected: true }) + const token = render.multipleValue(opt) + const del = token.querySelector('.' + render.classes.valueDelete) as HTMLDivElement - const del = token.querySelector('.' + render.classes.valueDelete) as HTMLDivElement + expect(del).toBeInstanceOf(HTMLDivElement) + expect(del.getAttribute('role')).toBe('button') + // Initially hidden from tab order and SR + expect(del.getAttribute('tabindex')).toBe('-1') + expect(del.getAttribute('aria-hidden')).toBe('true') + expect(del.getAttribute('aria-label')).toContain('Remove Alpha') + expect(del.hasAttribute('title')).toBe(false) - expect(del).toBeInstanceOf(HTMLDivElement) - expect(del.getAttribute('role')).toBe('button') - // Initially hidden from tab order and SR - expect(del.getAttribute('tabindex')).toBe('-1') - expect(del.getAttribute('aria-hidden')).toBe('true') - expect(del.getAttribute('aria-label')).toContain('Remove Alpha') - expect(del.hasAttribute('title')).toBe(false) + // When the chip receives focus, the delete control becomes tabbable and visible to SR + token.dispatchEvent(new FocusEvent('focusin')) + expect(del.getAttribute('tabindex')).toBe('0') + expect(del.hasAttribute('aria-hidden')).toBe(false) - // When the chip receives focus, the delete control becomes tabbable and visible to SR - token.dispatchEvent(new FocusEvent('focusin')) - - expect(del.getAttribute('tabindex')).toBe('0') - expect(del.hasAttribute('aria-hidden')).toBe(false) - - // Chip announces hint for keyboard-remove - const hintId = `${render.settings.id}__chip__${opt.id}__hint` - expect(token.getAttribute('aria-describedby')).toBe(hintId) - }) + // Chip announces hint for keyboard-remove + const hintId = `${render.settings.id}__chip__${opt.id}__hint` + expect(token.getAttribute('aria-describedby')).toBe(hintId) + }) test('renderSearching sets aria-busy and announces via polite live region', () => { const rafOrig = (global as any).requestAnimationFrame @@ -1341,22 +998,13 @@ describe('render module', () => { }) test('renderOptions sets aria-setsize and each option gets aria-posinset', () => { - render.renderOptions( - render.store.partialToFullData([ - { text: 'One' }, - { text: 'Two' }, - { text: 'Three' } - ]) - ) - + render.renderOptions(render.store.partialToFullData([{ text: 'One' }, { text: 'Two' }, { text: 'Three' }])) const opts = render.getOptions(true, true, true) expect(opts).toHaveLength(3) expect(opts[0].getAttribute('aria-posinset')).toBe('1') expect(opts[0].getAttribute('aria-setsize')).toBe('3') - expect(opts[1].getAttribute('aria-posinset')).toBe('2') expect(opts[1].getAttribute('aria-setsize')).toBe('3') - expect(opts[2].getAttribute('aria-posinset')).toBe('3') expect(opts[2].getAttribute('aria-setsize')).toBe('3') }) @@ -1364,49 +1012,33 @@ describe('render module', () => { test('empty results announce and keep aria-setsize = 0', () => { const rafOrig = (global as any).requestAnimationFrame ;(global as any).requestAnimationFrame = (cb: Function) => cb() - render.renderOptions([]) - expect(render.content.list.getAttribute('aria-setsize')).toBe('0') - const polite = document.getElementById('ss-live-polite') as HTMLDivElement expect(polite).toBeTruthy() expect(polite.textContent && polite.textContent.length).toBeGreaterThan(0) - ;(global as any).requestAnimationFrame = rafOrig }) - test('highlight updates aria-activedescendant on input; close clears it', () => { - render.renderOptions( - render.store.partialToFullData([ - { text: 'A' }, - { text: 'B' }, - { text: 'C' } - ]) - ) - + test('highlight updates aria-activedescendant on both input and combobox; close clears both', () => { + render.renderOptions(render.store.partialToFullData([{ text: 'A' }, { text: 'B' }, { text: 'C' }])) render.highlight('down') - const firstVisible = render.getOptions(true, true, true)[0] - const active = render.content.search.input.getAttribute('aria-activedescendant') - - expect(active).toBe(firstVisible.id) + const activeInput = render.content.search.input.getAttribute('aria-activedescendant') + const activeMain = render.main.main.getAttribute('aria-activedescendant') + expect(activeInput).toBe(firstVisible.id) + expect(activeMain).toBe(firstVisible.id) render.close() expect(render.content.search.input.hasAttribute('aria-activedescendant')).toBe(false) + expect(render.main.main.hasAttribute('aria-activedescendant')).toBe(false) }) test('selected option sets aria-selected and updates activedescendant immediately', () => { - const el = render.option( - new Option({ - text: 'Picked', - selected: true - }) - ) - + const el = render.option(new Option({ text: 'Picked', selected: true })) expect(el.getAttribute('aria-selected')).toBe('true') expect(render.content.search.input.getAttribute('aria-activedescendant')).toBe(el.id) + expect(render.main.main.getAttribute('aria-activedescendant')).toBe(el.id) }) - }) }) diff --git a/src/slim-select/render.ts b/src/slim-select/render.ts index 165b82dd..86009556 100644 --- a/src/slim-select/render.ts +++ b/src/slim-select/render.ts @@ -78,6 +78,7 @@ export default class Render { const highlighted = this.content.list.querySelectorAll('.' + this.classes.highlighted) highlighted.forEach(el => el.classList.remove(this.classes.highlighted)) this.content.search.input.removeAttribute('aria-activedescendant') + this.main.main.removeAttribute('aria-activedescendant') } public main: Main @@ -146,7 +147,8 @@ export default class Render { public open(): void { 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.content.search.input.setAttribute('aria-expanded', 'true') + this.main.main.setAttribute('aria-expanded', 'true') + // expanded belongs on the combobox (main), not the input this.moveContent() const selectedOptions = this.store.getSelectedOptions() @@ -171,7 +173,9 @@ export default class Render { public close(): void { this.main.main.classList.remove(this.classes.openAbove, this.classes.openBelow) - this.content.search.input.setAttribute('aria-expanded', 'false') + // expanded belongs on the combobox (main), not the input + this.content.search.input.removeAttribute('aria-expanded') + this.main.main.setAttribute('aria-expanded', 'false') this.content.main.classList.remove(this.classes.openAbove, this.classes.openBelow) this.main.arrow.path.setAttribute('d', this.classes.arrowClose) @@ -229,20 +233,24 @@ export default class Render { this.content.list.setAttribute('role', 'listbox'); this.content.list.setAttribute('id', this.content.main.id + '-list'); this.content.list.setAttribute('aria-label', this.settings.contentAriaLabel); + this.main.main.setAttribute('role', 'combobox'); + this.main.main.setAttribute('aria-controls', this.content.list.id); + this.main.main.setAttribute('aria-haspopup', 'listbox'); + this.main.main.setAttribute('aria-expanded', 'false'); if (this.settings.isMultiple) { this.content.list.setAttribute('aria-multiselectable', 'true'); } this.main.main.removeAttribute('aria-labelledby'); this.main.main.removeAttribute('aria-label'); - + const input = this.content.search.input; - input.setAttribute('role', 'combobox'); - input.setAttribute('aria-haspopup', 'listbox'); + // Input is just the text entry, not a combobox + input.setAttribute('role', 'searchbox'); input.setAttribute('aria-controls', this.content.list.id); input.setAttribute('aria-owns', this.content.list.id); - input.setAttribute('aria-expanded', 'false'); input.setAttribute('aria-autocomplete', 'list'); + input.removeAttribute('aria-expanded'); let labelledById = (this.settings.ariaLabelledBy || '').trim(); let labelEl: HTMLLabelElement | null = null; @@ -306,28 +314,51 @@ export default class Render { // Only react when the shell itself has focus, not when a child (chip/delete/etc) has focus if (e.target !== main) return true; + const focusAndThen = (fn: () => void) => { + this.callbacks.open() + // shift focus first so SR/VoiceOver announces the option on first key press + requestAnimationFrame(() => { + this.searchFocus() + fn() + }) + } + switch (e.key) { - case 'ArrowUp': case 'ArrowDown': - this.callbacks.open(); - e.key === 'ArrowDown' ? this.highlight('down') : this.highlight('up'); - return false; + e.preventDefault() + focusAndThen(() => this.highlight('down')) + return false + case 'ArrowUp': + e.preventDefault() + focusAndThen(() => this.highlight('up')) + return false case 'Tab': - this.callbacks.close(); - return true; + this.callbacks.close() + return true case 'Enter': case ' ': - this.callbacks.open(); - const highlighted = this.content.list.querySelector('.' + this.classes.highlighted) as HTMLDivElement; - if (highlighted) highlighted.click(); - return false; - case 'Escape': - this.callbacks.close(); - return false; + e.preventDefault() + focusAndThen(() => { + const highlighted = this.content.list.querySelector('.' + this.classes.highlighted) as HTMLDivElement + if (highlighted) highlighted.click() + }) + return false } - if (e.key.length === 1) { - this.callbacks.open(); + // Forward printable characters into the search input + if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) { + e.preventDefault() + this.callbacks.open() + requestAnimationFrame(() => { + this.searchFocus() + const inp = this.content.search.input + const selStart = inp.selectionStart ?? inp.value.length + const selEnd = inp.selectionEnd ?? inp.value.length + inp.value = inp.value.slice(0, selStart) + e.key + inp.value.slice(selEnd) + inp.setSelectionRange(selStart + 1, selStart + 1) + this.callbacks.search(inp.value) + }) + return false } return true; @@ -485,6 +516,7 @@ export default class Render { const placeholder = document.createElement('div') placeholder.classList.add(this.classes.placeholder) placeholder.innerHTML = placeholderText + placeholder.setAttribute('aria-hidden', 'true'); return placeholder } @@ -507,6 +539,7 @@ export default class Render { return o.selected && !o.placeholder }, false) as Option[] const selectedSingle = selected.length > 0 ? selected[0] : null + this.main.values.removeAttribute('role'); // If nothing is seleected use settings placeholder text if (!selectedSingle) { @@ -543,9 +576,11 @@ export default class Render { // If selectedOptions is empty set placeholder if (selectedOptions.length === 0) { + this.main.values.removeAttribute('role'); this.main.values.innerHTML = this.placeholder().outerHTML return } else { + this.main.values.setAttribute('role', 'list'); // If there is a placeholder, remove it const placeholder = this.main.values.querySelector('.' + this.classes.placeholder) if (placeholder) { @@ -1036,6 +1071,8 @@ export default class Render { // Check if option doesnt already have highlighted class if (!options[0].classList.contains(this.classes.highlighted)) { options[0].classList.add(this.classes.highlighted) + const id = options[0].id + this.setActiveDescendant(id) return } } @@ -1053,6 +1090,7 @@ export default class Render { for (const o of options) { if (o.classList.contains(this.classes.selected)) { o.classList.add(this.classes.highlighted) + this.setActiveDescendant(o.id) break } } @@ -1065,24 +1103,15 @@ export default class Render { const prevOption = options[i] // Remove highlighted class from current one prevOption.classList.remove(this.classes.highlighted) - - // If previous option has parent classes ss-optgroup with ss-open then click it - const prevParent = prevOption.parentElement - if (prevParent && prevParent.classList.contains(this.classes.open)) { - const optgroupLabel = prevParent.querySelector('.' + this.classes.optgroupLabel) as HTMLDivElement - if (optgroupLabel) { - optgroupLabel.click() - } - } - // Highlight the next one - let selectOption = + const selectOption = options[dir === 'down' ? (i + 1 < options.length ? i + 1 : 0) : i - 1 >= 0 ? i - 1 : options.length - 1] - selectOption.classList.add(this.classes.highlighted); - this.content.search.input.setAttribute('aria-activedescendant', selectOption.id); - this.ensureElementInView(this.content.list, selectOption); - // If selected option has parent classes ss-optgroup with ss-close then click it + selectOption.classList.add(this.classes.highlighted) + this.setActiveDescendant(selectOption.id) + this.ensureElementInView(this.content.list, selectOption) + + // If selected option has parent classes ss-optgroup with ss-close then open it const selectParent = selectOption.parentElement if (selectParent && selectParent.classList.contains(this.classes.close)) { const optgroupLabel = selectParent.querySelector('.' + this.classes.optgroupLabel) as HTMLDivElement @@ -1097,13 +1126,10 @@ export default class Render { // If we get here, there is no highlighted option // So we will highlight the first or last based upon direction - const newly = options[dir === 'down' ? 0 : options.length - 1]; - newly.classList.add(this.classes.highlighted); - - this.content.search.input.setAttribute('aria-activedescendant', newly.id); - - // Scroll to highlighted one - this.ensureElementInView(this.content.list, newly); + const newly = options[dir === 'down' ? 0 : options.length - 1] + newly.classList.add(this.classes.highlighted) + this.setActiveDescendant(newly.id) + this.ensureElementInView(this.content.list, newly) } // Create main container that options will reside @@ -1457,7 +1483,7 @@ export default class Render { if (option.selected) { optionEl.classList.add(this.classes.selected) optionEl.setAttribute('aria-selected', 'true') - this.content.search.input.setAttribute('aria-activedescendant', optionEl.id) + this.setActiveDescendant(optionEl.id) } else { optionEl.classList.remove(this.classes.selected) optionEl.setAttribute('aria-selected', 'false') @@ -1503,10 +1529,10 @@ export default class Render { // Handles range selection if (!this.settings.closeOnSelect) { - if (e.shiftKey && this.lastSelectedOption) { + if ((e as MouseEvent).shiftKey && this.lastSelectedOption) { const options = this.store.getDataOptions() - let lastClickedOptionIndex = options.findIndex((o: Option) => o.id === this.lastSelectedOption!.id) - let currentOptionIndex = options.findIndex((o: Option) => o.id === option.id) + const lastClickedOptionIndex = options.findIndex((o: Option) => o.id === this.lastSelectedOption!.id) + const currentOptionIndex = options.findIndex((o: Option) => o.id === option.id) if (lastClickedOptionIndex >= 0 && currentOptionIndex >= 0) { // Select the range from the last clicked option to the current one, or vice versa. const startIndex = Math.min(lastClickedOptionIndex, currentOptionIndex) @@ -1708,4 +1734,16 @@ export default class Render { deselectButton.classList.add(hideClass) } } + + // Keep the active descendant on the *combobox* so screen readers announce the option on first key press. + private setActiveDescendant(id: string) { + if (!id) { + this.main.main.removeAttribute('aria-activedescendant') + this.content.search.input.removeAttribute('aria-activedescendant') + return + } + this.main.main.setAttribute('aria-activedescendant', id) + // also mirror onto the input for broader AT compatibility + this.content.search.input.setAttribute('aria-activedescendant', id) + } }