vrembem 4.0.0-next.2 → 4.0.0-next.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +3 -7
- package/base.scss +20 -0
- package/dev/base.css +7036 -0
- package/dev/base.css.map +1 -0
- package/dev/index.css +4283 -2819
- package/dev/index.css.map +1 -1
- package/dev/index.js +2380 -1637
- package/dev/index.js.map +1 -1
- package/dev/index.umd.cjs +2382 -1639
- package/dev/index.umd.cjs.map +1 -1
- package/dev/root.css +487 -0
- package/dev/root.css.map +1 -0
- package/dist/base.css +1 -0
- package/dist/base.css.map +1 -0
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +1173 -1443
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +6 -2
- package/dist/index.umd.cjs.map +1 -1
- package/dist/root.css +1 -0
- package/dist/root.css.map +1 -0
- package/index.js +4 -6
- package/index.scss +2 -4
- package/package.json +36 -38
- package/root.scss +21 -0
package/dist/index.umd.cjs
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
(function(J,at){typeof exports=="object"&&typeof module<"u"?at(exports):typeof define=="function"&&define.amd?define(["exports"],at):(J=typeof globalThis<"u"?globalThis:J||self,at(J.vrembem={}))})(this,function(J){"use strict";var at=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},A=(e,t,i)=>(at(e,t,"read from private field"),i?i.call(e):t.get(e)),jt=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},X=(e,t,i,n)=>(at(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),i),D;let Ei=class{constructor(t,i){jt(this,D,void 0),this.value=t,X(this,D,i),this.mql=null}get handler(){return A(this,D)}set handler(t){this.mql&&(typeof this.mql.removeEventListener=="function"?this.mql.removeEventListener("change",A(this,D)):this.mql.removeListener(A(this,D))),X(this,D,t)}mount(t,i){return t&&(this.value=t),i&&X(this,D,i),this.value?(this.mql=window.matchMedia(`(min-width: ${this.value})`),typeof this.mql.addEventListener=="function"?this.mql.addEventListener("change",A(this,D)):this.mql.addListener(A(this,D)),A(this,D).call(this,this.mql),this):this}unmount(){return this.mql?(typeof this.mql.removeEventListener=="function"?this.mql.removeEventListener("change",A(this,D)):this.mql.removeListener(A(this,D)),this.value=null,X(this,D,null),this.mql=null,this):this}};D=new WeakMap;let xi=class{constructor(){this.collection=[]}async register(t){return await this.deregister(t),this.collection.push(t),this.collection}async deregister(t){const i=this.collection.findIndex(n=>n===t);if(i>=0){const n=this.collection[i];Object.getOwnPropertyNames(n).forEach(s=>{delete n[s]}),this.collection.splice(i,1)}return this.collection}async registerCollection(t){return await Promise.all(Array.from(t,i=>{this.register(i)})),this.collection}async deregisterCollection(){for(;this.collection.length>0;)await this.deregister(this.collection[0]);return this.collection}get(t,i="id"){return this.collection.find(n=>n[i]===t)}};const f={inert:":not([inert]):not([inert] *)",negTabIndex:':not([tabindex^="-"])',disabled:":not(:disabled)"},Li=[`a[href]${f.inert}${f.negTabIndex}`,`area[href]${f.inert}${f.negTabIndex}`,`input:not([type="hidden"]):not([type="radio"])${f.inert}${f.negTabIndex}${f.disabled}`,`input[type="radio"]${f.inert}${f.negTabIndex}${f.disabled}`,`select${f.inert}${f.negTabIndex}${f.disabled}`,`textarea${f.inert}${f.negTabIndex}${f.disabled}`,`button${f.inert}${f.negTabIndex}${f.disabled}`,`details${f.inert} > summary:first-of-type${f.negTabIndex}`,`iframe${f.inert}${f.negTabIndex}`,`audio[controls]${f.inert}${f.negTabIndex}`,`video[controls]${f.inert}${f.negTabIndex}`,`[contenteditable]${f.inert}${f.negTabIndex}`,`[tabindex]${f.inert}${f.negTabIndex}`];var yt,lt,ct;let Oi=class{constructor(t=null,i="[data-focus]"){jt(this,yt,void 0),jt(this,lt,void 0),jt(this,ct,void 0),this.el=t,this.selectorFocus=i,X(this,lt,ki.bind(this)),X(this,ct,Ti.bind(this))}get focusable(){return A(this,yt)}set focusable(t){X(this,yt,t),A(this,yt).length?(document.removeEventListener("keydown",A(this,ct)),document.addEventListener("keydown",A(this,lt))):(document.removeEventListener("keydown",A(this,lt)),document.addEventListener("keydown",A(this,ct)))}get focusableFirst(){return this.focusable[0]}get focusableLast(){return this.focusable[this.focusable.length-1]}mount(t,i){t&&(this.el=t),i&&(this.selectorFocus=i),this.focusable=this.getFocusable(),this.focus()}unmount(){this.el=null,this.focusable=[],document.removeEventListener("keydown",A(this,lt)),document.removeEventListener("keydown",A(this,ct))}focus(t=this.el,i=this.selectorFocus){(t.querySelector(i)||t).focus()}getFocusable(t=this.el){const i=[],n=document.activeElement,s=t.scrollTop;return t.querySelectorAll(Li.join(",")).forEach(r=>{r.focus(),document.activeElement===r&&i.push(r)}),t.scrollTop=s,n.focus(),i}};yt=new WeakMap,lt=new WeakMap,ct=new WeakMap;function ki(e){(e.key==="Tab"||e.keyCode===9)&&(e.shiftKey?(document.activeElement===this.focusableFirst||document.activeElement===this.el)&&(e.preventDefault(),this.focusableLast.focus()):(document.activeElement===this.focusableLast||document.activeElement===this.el)&&(e.preventDefault(),this.focusableFirst.focus()))}function Ti(e){(e.key==="Tab"||e.keyCode===9)&&e.preventDefault()}function Ai(e,t){const i=(e.getAttribute(`data-${t}`)||"").replace(/'/g,'"');return i?JSON.parse(i):{}}function Ci(){return getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix").trim()}function Ii(e,t=!0){const i=localStorage.getItem(e),n=i?JSON.parse(i):{};return{get(s){return s?n[s]:n},set(s,r){return r?n[s]=r:delete n[s],t&&localStorage.setItem(e,JSON.stringify(n)),n}}}function Si(e,t,i){const n=t.nodeType===Node.COMMENT_NODE,s=t.nodeType===Node.ELEMENT_NODE;if(t=n||s?t:document.querySelector(t),n&&(i="after"),!t)throw new Error(`Not a valid teleport reference: '${t}'`);if(typeof t[i]!="function")throw new Error(`Not a valid teleport method: '${i}'`);let r=null;return n||(r=document.createComment("teleported #"+e.id),e.before(r)),t[i](e),n&&t.remove(),r}const Pi=(e,t)=>new Promise(i=>{t.transition?(e.classList.remove(t.stateClosed),e.classList.add(t.stateOpening),e.addEventListener("transitionend",function n(s){s.target==e&&(e.classList.add(t.stateOpened),e.classList.remove(t.stateOpening),i(e),this.removeEventListener("transitionend",n))})):(e.classList.add(t.stateOpened),e.classList.remove(t.stateClosed),i(e))}),qi=(e,t)=>new Promise(i=>{t.transition?(e.classList.add(t.stateClosing),e.classList.remove(t.stateOpened),e.addEventListener("transitionend",function n(s){s.target==e&&(e.classList.remove(t.stateClosing),e.classList.add(t.stateClosed),i(e),this.removeEventListener("transitionend",n))})):(e.classList.add(t.stateClosed),e.classList.remove(t.stateOpened),i(e))});function Di(e,t){t&&document.querySelectorAll(t).forEach(i=>{e?i.style.overflow="hidden":i.style.removeProperty("overflow")})}function Mi(e,t){t&&document.querySelectorAll(t).forEach(i=>{e?(i.inert=!0,i.setAttribute("aria-hidden",!0)):(i.inert=null,i.removeAttribute("aria-hidden"))})}function ji(e,t){Mi(!!e,t.selectorInert),Di(!!e,t.selectorOverflow)}const Wi=Object.freeze(Object.defineProperty({__proto__:null,Breakpoint:Ei,Collection:xi,FocusTrap:Oi,closeTransition:qi,getConfig:Ai,getPrefix:Ci,localStore:Ii,openTransition:Pi,teleport:Si,updateGlobalState:ji},Symbol.toStringTag,{value:"Module"})),Ni={autoInit:!1,stateAttr:"aria-checked",stateValue:"mixed"};let _i=class{constructor(t){this.defaults=Ni,this.settings={...this.defaults,...t},this.__handlerClick=this.handlerClick.bind(this),this.settings.autoInit&&this.init()}init(t=null){t&&(this.settings={...this.settings,...t});const i=`[${this.settings.stateAttr}="${this.settings.stateValue}"]`,n=document.querySelectorAll(i);this.setIndeterminate(n),document.addEventListener("click",this.__handlerClick,!1)}destroy(){document.removeEventListener("click",this.__handlerClick,!1)}handlerClick(t){const i=`[${this.settings.stateAttr}="${this.settings.stateValue}"]`,n=t.target.closest(i);n&&(this.removeAriaState(n),this.setIndeterminate(n))}setAriaState(t,i=this.settings.stateValue){t=t.forEach?t:[t],t.forEach(n=>{n.setAttribute(this.settings.stateAttr,i)})}removeAriaState(t){t=t.forEach?t:[t],t.forEach(i=>{i.removeAttribute(this.settings.stateAttr)})}setIndeterminate(t){t=t.forEach?t:[t],t.forEach(i=>{i.hasAttribute(this.settings.stateAttr)?i.indeterminate=!0:i.indeterminate=!1})}};var Oe=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},Wt=(e,t,i)=>(Oe(e,t,"read from private field"),i?i.call(e):t.get(e)),ke=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},Te=(e,t,i,n)=>(Oe(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),i),Ae=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},C=(e,t,i)=>(Ae(e,t,"read from private field"),i?i.call(e):t.get(e)),Nt=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},Y=(e,t,i,n)=>(Ae(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),i),M;let Fi=class{constructor(t,i){Nt(this,M,void 0),this.value=t,Y(this,M,i),this.mql=null}get handler(){return C(this,M)}set handler(t){this.mql&&(typeof this.mql.removeEventListener=="function"?this.mql.removeEventListener("change",C(this,M)):this.mql.removeListener(C(this,M))),Y(this,M,t)}mount(t,i){return t&&(this.value=t),i&&Y(this,M,i),this.value?(this.mql=window.matchMedia(`(min-width: ${this.value})`),typeof this.mql.addEventListener=="function"?this.mql.addEventListener("change",C(this,M)):this.mql.addListener(C(this,M)),C(this,M).call(this,this.mql),this):this}unmount(){return this.mql?(typeof this.mql.removeEventListener=="function"?this.mql.removeEventListener("change",C(this,M)):this.mql.removeListener(C(this,M)),this.value=null,Y(this,M,null),this.mql=null,this):this}};M=new WeakMap;let Bi=class{constructor(){this.collection=[]}async register(t){return await this.deregister(t),this.collection.push(t),this.collection}async deregister(t){const i=this.collection.findIndex(n=>n===t);if(i>=0){const n=this.collection[i];Object.getOwnPropertyNames(n).forEach(s=>{delete n[s]}),this.collection.splice(i,1)}return this.collection}async registerCollection(t){return await Promise.all(Array.from(t,i=>{this.register(i)})),this.collection}async deregisterCollection(){for(;this.collection.length>0;)await this.deregister(this.collection[0]);return this.collection}get(t,i="id"){return this.collection.find(n=>n[i]===t)}};const p={inert:":not([inert]):not([inert] *)",negTabIndex:':not([tabindex^="-"])',disabled:":not(:disabled)"},Ri=[`a[href]${p.inert}${p.negTabIndex}`,`area[href]${p.inert}${p.negTabIndex}`,`input:not([type="hidden"]):not([type="radio"])${p.inert}${p.negTabIndex}${p.disabled}`,`input[type="radio"]${p.inert}${p.negTabIndex}${p.disabled}`,`select${p.inert}${p.negTabIndex}${p.disabled}`,`textarea${p.inert}${p.negTabIndex}${p.disabled}`,`button${p.inert}${p.negTabIndex}${p.disabled}`,`details${p.inert} > summary:first-of-type${p.negTabIndex}`,`iframe${p.inert}${p.negTabIndex}`,`audio[controls]${p.inert}${p.negTabIndex}`,`video[controls]${p.inert}${p.negTabIndex}`,`[contenteditable]${p.inert}${p.negTabIndex}`,`[tabindex]${p.inert}${p.negTabIndex}`];var wt,dt,ut;let Hi=class{constructor(t=null,i="[data-focus]"){Nt(this,wt,void 0),Nt(this,dt,void 0),Nt(this,ut,void 0),this.el=t,this.selectorFocus=i,Y(this,dt,Vi.bind(this)),Y(this,ut,Ji.bind(this))}get focusable(){return C(this,wt)}set focusable(t){Y(this,wt,t),C(this,wt).length?(document.removeEventListener("keydown",C(this,ut)),document.addEventListener("keydown",C(this,dt))):(document.removeEventListener("keydown",C(this,dt)),document.addEventListener("keydown",C(this,ut)))}get focusableFirst(){return this.focusable[0]}get focusableLast(){return this.focusable[this.focusable.length-1]}mount(t,i){t&&(this.el=t),i&&(this.selectorFocus=i),this.focusable=this.getFocusable(),this.focus()}unmount(){this.el=null,this.focusable=[],document.removeEventListener("keydown",C(this,dt)),document.removeEventListener("keydown",C(this,ut))}focus(t=this.el,i=this.selectorFocus){(t.querySelector(i)||t).focus()}getFocusable(t=this.el){const i=[],n=document.activeElement,s=t.scrollTop;return t.querySelectorAll(Ri.join(",")).forEach(r=>{r.focus(),document.activeElement===r&&i.push(r)}),t.scrollTop=s,n.focus(),i}};wt=new WeakMap,dt=new WeakMap,ut=new WeakMap;function Vi(e){(e.key==="Tab"||e.keyCode===9)&&(e.shiftKey?(document.activeElement===this.focusableFirst||document.activeElement===this.el)&&(e.preventDefault(),this.focusableLast.focus()):(document.activeElement===this.focusableLast||document.activeElement===this.el)&&(e.preventDefault(),this.focusableFirst.focus()))}function Ji(e){(e.key==="Tab"||e.keyCode===9)&&e.preventDefault()}function zi(e,t){const i=(e.getAttribute(`data-${t}`)||"").replace(/'/g,'"');return i?JSON.parse(i):{}}function Ki(){return getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix").trim()}function Gi(e,t=!0){const i=localStorage.getItem(e),n=i?JSON.parse(i):{};return{get(s){return s?n[s]:n},set(s,r){return r?n[s]=r:delete n[s],t&&localStorage.setItem(e,JSON.stringify(n)),n}}}const Qi=(e,t)=>new Promise(i=>{t.transition?(e.classList.remove(t.stateClosed),e.classList.add(t.stateOpening),e.addEventListener("transitionend",function n(s){s.target==e&&(e.classList.add(t.stateOpened),e.classList.remove(t.stateOpening),i(e),this.removeEventListener("transitionend",n))})):(e.classList.add(t.stateOpened),e.classList.remove(t.stateClosed),i(e))}),Zi=(e,t)=>new Promise(i=>{t.transition?(e.classList.add(t.stateClosing),e.classList.remove(t.stateOpened),e.addEventListener("transitionend",function n(s){s.target==e&&(e.classList.remove(t.stateClosing),e.classList.add(t.stateClosed),i(e),this.removeEventListener("transitionend",n))})):(e.classList.add(t.stateClosed),e.classList.remove(t.stateOpened),i(e))});function Ui(e,t){t&&document.querySelectorAll(t).forEach(i=>{e?i.style.overflow="hidden":i.style.removeProperty("overflow")})}function Xi(e,t){t&&document.querySelectorAll(t).forEach(i=>{e?(i.inert=!0,i.setAttribute("aria-hidden",!0)):(i.inert=null,i.removeAttribute("aria-hidden"))})}function Xt(e,t){Xi(!!e,t.selectorInert),Ui(!!e,t.selectorOverflow)}const Yi={autoInit:!1,dataOpen:"drawer-open",dataClose:"drawer-close",dataToggle:"drawer-toggle",dataBreakpoint:"drawer-breakpoint",dataConfig:"drawer-config",selectorDrawer:".drawer",selectorDialog:".drawer__dialog",selectorFocus:"[data-focus]",selectorInert:null,selectorOverflow:"body",stateOpened:"is-opened",stateOpening:"is-opening",stateClosing:"is-closing",stateClosed:"is-closed",classModal:"drawer_modal",breakpoints:null,customEventPrefix:"drawer:",eventListeners:!0,store:!0,storeKey:"VB:DrawerState",setTabindex:!0,transition:!0};function tn(e){const t=e.target.closest(`
|
|
1
|
+
(function(y,k){typeof exports=="object"&&typeof module<"u"?k(exports):typeof define=="function"&&define.amd?define(["exports"],k):(y=typeof globalThis<"u"?globalThis:y||self,k(y.vrembem={}))})(this,function(y){"use strict";var ti=y=>{throw TypeError(y)};var ei=(y,k,D)=>k.has(y)||ti("Cannot "+D);var O=(y,k,D)=>(ei(y,k,"read from private field"),D?D.call(y):k.get(y)),Y=(y,k,D)=>k.has(y)?ti("Cannot add the same private member more than once"):k instanceof WeakSet?k.add(y):k.set(y,D),F=(y,k,D,h)=>(ei(y,k,"write to private field"),h?h.call(y,D):k.set(y,D),D);var H,ut,Z,tt,ft,ht,pt,gt,vt;class k{constructor(e,i){Y(this,H);this.value=e,F(this,H,i),this.mql=null}get handler(){return O(this,H)}set handler(e){this.mql&&this.mql.removeEventListener("change",O(this,H)),F(this,H,e)}mount(e,i){return e&&(this.value=e),i&&F(this,H,i),this.value?(this.mql=window.matchMedia(`(min-width: ${this.value})`),this.mql.addEventListener("change",O(this,H)),O(this,H).call(this,this.mql),this):this}unmount(){return this.mql?(this.mql.removeEventListener("change",O(this,H)),this.value=null,F(this,H,null),this.mql=null,this):this}}H=new WeakMap;class D{constructor(){this.collection=[]}async register(e){return await this.deregister(e),this.collection.push(e),this.collection}async deregister(e){const i=this.collection.findIndex(s=>s===e);if(i>=0){const s=this.collection[i];Object.getOwnPropertyNames(s).forEach(n=>{delete s[n]}),this.collection.splice(i,1)}return this.collection}async registerCollection(e){return await Promise.all(Array.from(e,i=>{this.register(i)})),this.collection}async deregisterCollection(){for(;this.collection.length>0;)await this.deregister(this.collection[0]);return this.collection}get(e,i="id"){return this.collection.find(s=>s[i]===e)}}const h={inert:":not([inert]):not([inert] *)",negTabIndex:':not([tabindex^="-"])',disabled:":not(:disabled)"},ii=[`a[href]${h.inert}${h.negTabIndex}`,`area[href]${h.inert}${h.negTabIndex}`,`input:not([type="hidden"]):not([type="radio"])${h.inert}${h.negTabIndex}${h.disabled}`,`input[type="radio"]${h.inert}${h.negTabIndex}${h.disabled}`,`select${h.inert}${h.negTabIndex}${h.disabled}`,`textarea${h.inert}${h.negTabIndex}${h.disabled}`,`button${h.inert}${h.negTabIndex}${h.disabled}`,`details${h.inert} > summary:first-of-type${h.negTabIndex}`,`iframe${h.inert}${h.negTabIndex}`,`audio[controls]${h.inert}${h.negTabIndex}`,`video[controls]${h.inert}${h.negTabIndex}`,`[contenteditable]${h.inert}${h.negTabIndex}`,`[tabindex]${h.inert}${h.negTabIndex}`];class Ht{constructor(e=null,i="[data-focus]"){Y(this,ut);Y(this,Z);Y(this,tt);this.el=e,this.selectorFocus=i,F(this,Z,si.bind(this)),F(this,tt,ni.bind(this))}get focusable(){return O(this,ut)}set focusable(e){F(this,ut,e),O(this,ut).length?(document.removeEventListener("keydown",O(this,tt)),document.addEventListener("keydown",O(this,Z))):(document.removeEventListener("keydown",O(this,Z)),document.addEventListener("keydown",O(this,tt)))}get focusableFirst(){return this.focusable[0]}get focusableLast(){return this.focusable[this.focusable.length-1]}mount(e,i){e&&(this.el=e),i&&(this.selectorFocus=i),this.focusable=this.getFocusable(),this.focus()}unmount(){this.el=null,this.focusable=[],document.removeEventListener("keydown",O(this,Z)),document.removeEventListener("keydown",O(this,tt))}focus(e=this.el,i=this.selectorFocus){(e.querySelector(i)||e).focus()}getFocusable(e=this.el){const i=[],s=document.activeElement,n=e.scrollTop;return e.querySelectorAll(ii.join(",")).forEach(a=>{a.focus(),document.activeElement===a&&i.push(a)}),e.scrollTop=n,s.focus(),i}}ut=new WeakMap,Z=new WeakMap,tt=new WeakMap;function si(t){(t.key==="Tab"||t.keyCode===9)&&(t.shiftKey?(document.activeElement===this.focusableFirst||document.activeElement===this.el)&&(t.preventDefault(),this.focusableLast.focus()):(document.activeElement===this.focusableLast||document.activeElement===this.el)&&(t.preventDefault(),this.focusableFirst.focus()))}function ni(t){(t.key==="Tab"||t.keyCode===9)&&t.preventDefault()}function Tt(){return getComputedStyle(document.body).getPropertyValue("--vb-prefix").trim()}function _t(t,e){const i={fallback:null,element:document.body,...e};if(t.slice(0,2)!=="--"){const n=Tt();n&&(t=`${n}${t}`),t=`--${t}`}const s=getComputedStyle(i.element).getPropertyValue(t).trim();if(s)return s;if(i.fallback)return i.fallback;throw new Error(`CSS variable "${t}" was not found!`)}function zt(t,e){const s=(t.getAttribute(`data-${e}`)||"").replace(/'/g,'"');return s?JSON.parse(s):{}}function Kt(t,e=!0){const i=localStorage.getItem(t),s=i?JSON.parse(i):{};return{get(n){return n?s[n]:s},set(n,r){return r?s[n]=r:delete s[n],e&&localStorage.setItem(t,JSON.stringify(s)),s}}}function Xt(t,e,i){const s=e.nodeType===Node.COMMENT_NODE,n=e.nodeType===Node.ELEMENT_NODE;if(e=s||n?e:document.querySelector(e),s&&(i="after"),!e)throw new Error(`Not a valid teleport reference: '${e}'`);if(typeof e[i]!="function")throw new Error(`Not a valid teleport method: '${i}'`);let r=null;return s||(r=document.createComment("teleported #"+t.id),t.before(r)),e[i](t),s&&e.remove(),r}function ri(t){const e={prefix:_t("prefix-themes",{fallback:"vb-theme-"}),themes:["root","light","dark"],storeKey:"VB:Profile"};for(const[r]of Object.entries(e))t&&t[r]&&(e[r]=t[r]);const i={onInit(){},onChange(){}};for(const[r]of Object.entries(i))t&&t[r]&&(i[r]=t[r]);const s=Kt(e.storeKey),n={settings:e,add(r){e.themes.push(r)},remove(r){const a=e.themes.indexOf(r);~a&&e.themes.splice(a,1)},callback(r){i[r].call(this)},get class(){return`${e.prefix}${this.theme}`},get classes(){return e.themes.map(r=>`${e.prefix}${r}`)},get themes(){return e.themes},get theme(){return s.get("theme")||"root"},set theme(r){e.themes.includes(r)?this.theme!=r&&(s.set("theme",r),document.documentElement.classList.remove(...this.classes),document.documentElement.classList.add(`${e.prefix}${r}`),this.callback("onChange")):console.error(`Not a valid theme value: "${r}"`)}};return n.callback("onInit"),n}function bt(t,e,i,s="transition-duration"){return new Promise(n=>{if(typeof s=="string"){const r=_t(s,{element:t}),a=!!r.includes("ms");s=parseFloat(r)*(a?1:1e3)}t.classList.remove(e.finish),t.classList.add(i.start),setTimeout(()=>{t.classList.add(i.finish),t.classList.remove(i.start),n(t)},s)})}function oi(t,e){e&&document.querySelectorAll(e).forEach(s=>{t?s.style.overflow="hidden":s.style.removeProperty("overflow")})}function ai(t,e){e&&document.querySelectorAll(e).forEach(s=>{t?(s.inert=!0,s.setAttribute("aria-hidden",!0)):(s.inert=null,s.removeAttribute("aria-hidden"))})}function wt(t,e){ai(!!t,e.selectorInert),oi(!!t,e.selectorOverflow)}const li=Object.freeze(Object.defineProperty({__proto__:null,Breakpoint:k,Collection:D,FocusTrap:Ht,cssVar:_t,getConfig:zt,getPrefix:Tt,localStore:Kt,teleport:Xt,themeStore:ri,transition:bt,updateGlobalState:wt},Symbol.toStringTag,{value:"Module"})),ci={autoMount:!1,dataOpen:"drawer-open",dataClose:"drawer-close",dataToggle:"drawer-toggle",dataBreakpoint:"drawer-breakpoint",dataConfig:"drawer-config",selectorDrawer:".drawer",selectorDialog:".drawer__dialog",selectorScreen:".drawer",selectorFocus:"[data-focus]",selectorInert:null,selectorOverflow:"body",stateOpened:"is-opened",stateOpening:"is-opening",stateClosing:"is-closing",stateClosed:"is-closed",classModal:"drawer_modal",breakpoints:null,customEventPrefix:"drawer:",eventListeners:!0,store:!0,storeKey:"VB:DrawerState",setTabindex:!0,transition:!0,transitionDuration:"drawer-transition-duration"};function di(t){t.store==="opened"?t.open(!1,!1):t.store==="closed"?t.close(!1,!1):t.store==="indeterminate"?t.state="indeterminate":t.el.classList.contains(t.getSetting("stateOpened"))?t.open(!1,!1):t.el.classList.contains(t.getSetting("stateClosed"))?t.close(!1,!1):t.state="indeterminate"}async function ui(t){t.store==="opened"?await t.open(!1,!1):t.store==="closed"?await t.close(!1,!1):t.store==="indeterminate"?t.state!="indeterminate"&&(t.state="indeterminate"):(t.state!=t.inlineState&&(t.state=t.inlineState),t.inlineState==="opened"?await t.open(!1,!1):t.inlineState==="closed"&&await t.close(!1,!1))}function fi(t){const e=Tt(),i=t.getAttribute(`data-${this.settings.dataBreakpoint}`);return this.settings.breakpoints&&this.settings.breakpoints[i]?this.settings.breakpoints[i]:getComputedStyle(document.body).getPropertyValue(`--${e}breakpoint-${i}`).trim()?getComputedStyle(document.body).getPropertyValue(`--${e}breakpoint-${i}`).trim():i}function ot(t){const e=typeof t=="string"?this.get(t):this.get(t.id);if(e)return e;throw new Error(`Drawer not found in collection with id of "${t.id||t}".`)}function ge(t){t.state==="opened"?t.mode==="modal"?this.focusTrap.mount(t.dialog,this.settings.selectorFocus):this.focusTrap.focus(t.dialog,this.settings.selectorFocus):(t.trigger&&(t.trigger.focus(),t.trigger=null),this.focusTrap.unmount())}async function hi(t){const e=t.target.closest(`
|
|
2
2
|
[data-${this.settings.dataOpen}],
|
|
3
3
|
[data-${this.settings.dataToggle}],
|
|
4
4
|
[data-${this.settings.dataClose}]
|
|
5
|
-
`);if(t){e.preventDefault(),t.matches(`[data-${this.settings.dataToggle}]`)&&t.getAttribute(`data-${this.settings.dataToggle}`).trim().split(" ").forEach(i=>{const n=this.get(i);n.trigger=t,n.toggle()}),t.matches(`[data-${this.settings.dataOpen}]`)&&t.getAttribute(`data-${this.settings.dataOpen}`).trim().split(" ").forEach(i=>{const n=this.get(i);n.trigger=t,n.open()}),t.matches(`[data-${this.settings.dataClose}]`)&&t.getAttribute(`data-${this.settings.dataClose}`).trim().split(" ").forEach(i=>{if(i){const n=this.get(i);n.trigger=t,n.close()}else{const n=e.target.closest(this.settings.selectorDrawer);n&&this.close(n)}});return}e.target.matches(this.settings.selectorDrawer)&&this.close(e.target.id)}function en(e){if(e.key==="Escape"){const t=this.activeModal;t&&this.close(t)}}async function Yt(e,t=!0){if(!e)return this.collection;const i=this.collection.findIndex(n=>n.id===e.id);if(i>=0){const n=this.collection[i];t&&n.state==="opened"&&await n.close(!1),this.store.set(n.id),n.unmountBreakpoint(),Object.getOwnPropertyNames(n).forEach(s=>{delete n[s]}),this.collection.splice(i,1)}return this.collection}function nn(e){const t=Ki(),i=e.getAttribute(`data-${this.settings.dataBreakpoint}`);return this.settings.breakpoints&&this.settings.breakpoints[i]?this.settings.breakpoints[i]:getComputedStyle(document.body).getPropertyValue(`--${t}breakpoint-${i}`).trim()?getComputedStyle(document.body).getPropertyValue(`--${t}breakpoint-${i}`).trim():i}function te(e){const t=typeof e=="string"?this.get(e):this.get(e.id);if(t)return t;throw new Error(`Drawer not found in collection with id of "${e.id||e}".`)}function Ce(e){return typeof e=="string"?e:typeof e.hasAttribute=="function"?e.hasAttribute(`data-${this.settings.dataOpen}`)?e.getAttribute(`data-${this.settings.dataOpen}`):e.hasAttribute(`data-${this.settings.dataClose}`)?e.getAttribute(`data-${this.settings.dataClose}`)||!1:e.hasAttribute(`data-${this.settings.dataToggle}`)?e.getAttribute(`data-${this.settings.dataToggle}`):e.closest(this.settings.selectorDrawer)?(e=e.closest(this.settings.selectorDrawer),e.id||!1):!1:e.id?e.id:!1}function sn(e){const t=Ce.call(this,e);if(t){const i=document.querySelector(`#${t}`),n=i?i.querySelector(this.settings.selectorDialog):null;return!i&&!n?{error:new Error(`No drawer elements found using the ID: "${t}".`)}:n?{drawer:i,dialog:n}:{error:new Error("Drawer is missing dialog element.")}}else return{error:new Error("Could not resolve the drawer ID.")}}async function Ie(e){this.store.get(e.id)?this.store.get(e.id)==="opened"?await e.open(!1,!1):await e.close(!1,!1):e.el.classList.contains(this.settings.stateOpened)?e.state="opened":(e.el.classList.remove(this.settings.stateOpening),e.el.classList.remove(this.settings.stateClosing),e.el.classList.add(this.settings.stateClosed))}function Se(e){e.state==="opened"?e.mode==="modal"?this.focusTrap.mount(e.dialog,this.settings.selectorFocus):this.focusTrap.focus(e.dialog,this.settings.selectorFocus):(e.trigger&&(e.trigger.focus(),e.trigger=null),this.focusTrap.unmount())}async function ee(e,t,i=!0){const n=te.call(this,e),s={...this.settings,...n.settings};return t!==void 0&&(s.transition=t),n.state==="closed"&&(n.state="opening",await Qi(n.el,s),n.mode==="modal"&&Xt(!0,s),n.state="opened"),i&&Se.call(this,n),n.el.dispatchEvent(new CustomEvent(s.customEventPrefix+"opened",{detail:this,bubbles:!0})),n}async function _t(e,t,i=!0){const n=te.call(this,e),s={...this.settings,...n.settings};return t!==void 0&&(s.transition=t),n.state==="opened"&&(n.state="closing",document.activeElement.blur(),await Zi(n.el,s),n.mode==="modal"&&Xt(!1,s),i&&Se.call(this,n),n.state="closed",n.el.dispatchEvent(new CustomEvent(s.customEventPrefix+"closed",{detail:this,bubbles:!0}))),n}async function Pe(e,t,i){const n=te.call(this,e);return n.state==="closed"?ee.call(this,n,t,i):_t.call(this,n,t,i)}function rn(e){switch(e.mode){case"inline":return on.call(this,e);case"modal":return an.call(this,e);default:throw new Error(`"${e.mode}" is not a valid drawer mode.`)}}async function on(e){return e.el.classList.remove(e.getSetting("classModal")),e.dialog.removeAttribute("aria-modal"),Xt(!1,{...this.settings,...e.settings}),this.focusTrap.unmount(),await Ie.call(this,e),e.el.dispatchEvent(new CustomEvent(e.getSetting("customEventPrefix")+"switchMode",{detail:this,bubbles:!0})),e}async function an(e){return e.el.classList.add(e.getSetting("classModal")),e.dialog.setAttribute("aria-modal","true"),!this.store.get(e.id)&&e.el.classList.contains(e.getSetting("stateOpened"))&&this.store.set(e.id,"opened"),await _t.call(this,e,!1,!1),e.el.dispatchEvent(new CustomEvent(e.getSetting("customEventPrefix")+"switchMode",{detail:this,bubbles:!0})),e}async function ln(e,t){await Yt.call(this,e,!1);const i=this,n=new Fi,s={open(o,c){return ee.call(i,this,o,c)},close(o,c){return _t.call(i,this,o,c)},toggle(o,c){return Pe.call(i,this,o,c)},deregister(){return Yt.call(i,this)},mountBreakpoint(){const o=this.breakpoint,c=this.handleBreakpoint.bind(this);return n.mount(o,c),this},unmountBreakpoint(){return n.unmount(),this},handleBreakpoint(o){return this.mode=o.matches?"inline":"modal",this},getSetting(o){return o in this.settings?this.settings[o]:i.settings[o]}},r={id:e.id,el:e,dialog:t,trigger:null,settings:zi(e,this.settings.dataConfig),get breakpoint(){return nn.call(i,e)},get state(){return a},set state(o){a=o,(o==="opened"||o==="closed")&&this.mode==="inline"&&i.store.set(this.id,this.state)},get mode(){return l},set mode(o){l=o,rn.call(i,this)},...s};let a=e.classList.contains(r.getSetting("stateOpened"))?"opened":"closed",l=e.classList.contains(r.getSetting("classModal"))?"modal":"inline";return r.mode==="modal"?r.dialog.setAttribute("aria-modal","true"):r.dialog.removeAttribute("aria-modal"),r.getSetting("setTabindex")&&r.dialog.setAttribute("tabindex","-1"),this.collection.push(r),r.breakpoint?r.mountBreakpoint():await Ie.call(this,r),r}var $t,Et;let cn=class extends Bi{constructor(t){super(),ke(this,$t,void 0),ke(this,Et,void 0),this.defaults=Yi,this.settings={...this.defaults,...t},this.focusTrap=new Hi,this.store=Gi(this.settings.storeKey,this.settings.store),Te(this,$t,tn.bind(this)),Te(this,Et,en.bind(this)),this.settings.autoInit&&this.init()}get activeModal(){return this.collection.find(t=>t.state==="opened"&&t.mode==="modal")}async init(t=null){t&&(this.settings={...this.settings,...t});const i=document.querySelectorAll(this.settings.selectorDrawer);return await this.registerCollection(i),this.settings.eventListeners&&this.initEventListeners(),this}async destroy(){return await this.deregisterCollection(),this.settings.eventListeners&&this.destroyEventListeners(),this}initEventListeners(){document.addEventListener("click",Wt(this,$t),!1),document.addEventListener("keydown",Wt(this,Et),!1)}destroyEventListeners(){document.removeEventListener("click",Wt(this,$t),!1),document.removeEventListener("keydown",Wt(this,Et),!1)}register(t){const i=sn.call(this,t);return i.error?Promise.reject(i.error):ln.call(this,i.drawer,i.dialog)}deregister(t){const i=this.get(Ce.call(this,t));return Yt.call(this,i)}open(t,i,n){return ee.call(this,t,i,n)}close(t,i,n){return _t.call(this,t,i,n)}toggle(t,i,n){return Pe.call(this,t,i,n)}};$t=new WeakMap,Et=new WeakMap;var qe=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},Ft=(e,t,i)=>(qe(e,t,"read from private field"),i?i.call(e):t.get(e)),De=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},Me=(e,t,i,n)=>(qe(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),i),je=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},Z=(e,t,i)=>(je(e,t,"read from private field"),i?i.call(e):t.get(e)),ie=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},ne=(e,t,i,n)=>(je(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),i);class dn{constructor(){this.collection=[]}async register(t){return await this.deregister(t),this.collection.push(t),this.collection}async deregister(t){const i=this.collection.findIndex(n=>n===t);if(i>=0){const n=this.collection[i];Object.getOwnPropertyNames(n).forEach(s=>{delete n[s]}),this.collection.splice(i,1)}return this.collection}async registerCollection(t){return await Promise.all(Array.from(t,i=>{this.register(i)})),this.collection}async deregisterCollection(){for(;this.collection.length>0;)await this.deregister(this.collection[0]);return this.collection}get(t,i="id"){return this.collection.find(n=>n[i]===t)}}const g={inert:":not([inert]):not([inert] *)",negTabIndex:':not([tabindex^="-"])',disabled:":not(:disabled)"},un=[`a[href]${g.inert}${g.negTabIndex}`,`area[href]${g.inert}${g.negTabIndex}`,`input:not([type="hidden"]):not([type="radio"])${g.inert}${g.negTabIndex}${g.disabled}`,`input[type="radio"]${g.inert}${g.negTabIndex}${g.disabled}`,`select${g.inert}${g.negTabIndex}${g.disabled}`,`textarea${g.inert}${g.negTabIndex}${g.disabled}`,`button${g.inert}${g.negTabIndex}${g.disabled}`,`details${g.inert} > summary:first-of-type${g.negTabIndex}`,`iframe${g.inert}${g.negTabIndex}`,`audio[controls]${g.inert}${g.negTabIndex}`,`video[controls]${g.inert}${g.negTabIndex}`,`[contenteditable]${g.inert}${g.negTabIndex}`,`[tabindex]${g.inert}${g.negTabIndex}`];var xt,ht,ft;let hn=class{constructor(t=null,i="[data-focus]"){ie(this,xt,void 0),ie(this,ht,void 0),ie(this,ft,void 0),this.el=t,this.selectorFocus=i,ne(this,ht,fn.bind(this)),ne(this,ft,pn.bind(this))}get focusable(){return Z(this,xt)}set focusable(t){ne(this,xt,t),Z(this,xt).length?(document.removeEventListener("keydown",Z(this,ft)),document.addEventListener("keydown",Z(this,ht))):(document.removeEventListener("keydown",Z(this,ht)),document.addEventListener("keydown",Z(this,ft)))}get focusableFirst(){return this.focusable[0]}get focusableLast(){return this.focusable[this.focusable.length-1]}mount(t,i){t&&(this.el=t),i&&(this.selectorFocus=i),this.focusable=this.getFocusable(),this.focus()}unmount(){this.el=null,this.focusable=[],document.removeEventListener("keydown",Z(this,ht)),document.removeEventListener("keydown",Z(this,ft))}focus(t=this.el,i=this.selectorFocus){(t.querySelector(i)||t).focus()}getFocusable(t=this.el){const i=[],n=document.activeElement,s=t.scrollTop;return t.querySelectorAll(un.join(",")).forEach(r=>{r.focus(),document.activeElement===r&&i.push(r)}),t.scrollTop=s,n.focus(),i}};xt=new WeakMap,ht=new WeakMap,ft=new WeakMap;function fn(e){(e.key==="Tab"||e.keyCode===9)&&(e.shiftKey?(document.activeElement===this.focusableFirst||document.activeElement===this.el)&&(e.preventDefault(),this.focusableLast.focus()):(document.activeElement===this.focusableLast||document.activeElement===this.el)&&(e.preventDefault(),this.focusableFirst.focus()))}function pn(e){(e.key==="Tab"||e.keyCode===9)&&e.preventDefault()}function gn(e,t){const i=(e.getAttribute(`data-${t}`)||"").replace(/'/g,'"');return i?JSON.parse(i):{}}function We(e,t,i){const n=t.nodeType===Node.COMMENT_NODE,s=t.nodeType===Node.ELEMENT_NODE;if(t=n||s?t:document.querySelector(t),n&&(i="after"),!t)throw new Error(`Not a valid teleport reference: '${t}'`);if(typeof t[i]!="function")throw new Error(`Not a valid teleport method: '${i}'`);let r=null;return n||(r=document.createComment("teleported #"+e.id),e.before(r)),t[i](e),n&&t.remove(),r}const mn=(e,t)=>new Promise(i=>{t.transition?(e.classList.remove(t.stateClosed),e.classList.add(t.stateOpening),e.addEventListener("transitionend",function n(s){s.target==e&&(e.classList.add(t.stateOpened),e.classList.remove(t.stateOpening),i(e),this.removeEventListener("transitionend",n))})):(e.classList.add(t.stateOpened),e.classList.remove(t.stateClosed),i(e))}),vn=(e,t)=>new Promise(i=>{t.transition?(e.classList.add(t.stateClosing),e.classList.remove(t.stateOpened),e.addEventListener("transitionend",function n(s){s.target==e&&(e.classList.remove(t.stateClosing),e.classList.add(t.stateClosed),i(e),this.removeEventListener("transitionend",n))})):(e.classList.add(t.stateClosed),e.classList.remove(t.stateOpened),i(e))});function bn(e,t){t&&document.querySelectorAll(t).forEach(i=>{e?i.style.overflow="hidden":i.style.removeProperty("overflow")})}function yn(e,t){t&&document.querySelectorAll(t).forEach(i=>{e?(i.inert=!0,i.setAttribute("aria-hidden",!0)):(i.inert=null,i.removeAttribute("aria-hidden"))})}function wn(e,t){yn(!!e,t.selectorInert),bn(!!e,t.selectorOverflow)}const $n={autoInit:!1,dataOpen:"modal-open",dataClose:"modal-close",dataReplace:"modal-replace",dataConfig:"modal-config",selectorModal:".modal",selectorDialog:".modal__dialog",selectorRequired:'[role="alertdialog"]',selectorFocus:"[data-focus]",selectorInert:null,selectorOverflow:"body",stateOpened:"is-opened",stateOpening:"is-opening",stateClosing:"is-closing",stateClosed:"is-closed",customEventPrefix:"modal:",eventListeners:!0,teleport:null,teleportMethod:"append",setTabindex:!0,transition:!0};function se(e){const t=typeof e=="string"?this.get(e):this.get(e.id);if(t)return t;throw new Error(`Modal not found in collection with id of "${e.id||e}".`)}function Bt(e){return typeof e=="string"?e:typeof e.hasAttribute=="function"?e.hasAttribute(`data-${this.settings.dataOpen}`)?e.getAttribute(`data-${this.settings.dataOpen}`):e.hasAttribute(`data-${this.settings.dataClose}`)?e.getAttribute(`data-${this.settings.dataClose}`)||!1:e.hasAttribute(`data-${this.settings.dataReplace}`)?e.getAttribute(`data-${this.settings.dataReplace}`):e.closest(this.settings.selectorModal)?(e=e.closest(this.settings.selectorModal),e.id||!1):!1:e.id?e.id:!1}function En(e){const t=Bt.call(this,e);if(t){const i=document.querySelector(`#${t}`),n=i?i.querySelector(this.settings.selectorDialog):null;return!i&&!n?{error:new Error(`No modal elements found using the ID: "${t}".`)}:n?{modal:i,dialog:n}:{error:new Error("Modal is missing dialog element.")}}else return{error:new Error("Could not resolve the modal ID.")}}function Rt(){this.active?this.focusTrap.mount(this.active.dialog,this.settings.selectorFocus):(this.trigger&&(this.trigger.focus(),this.trigger=null),this.focusTrap.unmount())}async function xn(e){let t=e.target.closest(`[data-${this.settings.dataOpen}], [data-${this.settings.dataReplace}]`);if(t){e.preventDefault(),e.target.closest(this.settings.selectorModal)||(this.trigger=t);const i=this.get(Bt.call(this,t));return t.matches(`[data-${this.settings.dataOpen}]`)?i.open():i.replace()}if(t=e.target.closest(`[data-${this.settings.dataClose}]`),t){e.preventDefault();const i=t.getAttribute(`data-${this.settings.dataClose}`);return i==="*"?this.closeAll():this.close(i)}if(e.target.matches(this.settings.selectorModal)&&!e.target.querySelector(this.settings.selectorRequired))return this.close(Bt.call(this,e.target))}function Ln(e){if(e.key==="Escape"&&this.active&&!this.active.dialog.matches(this.settings.selectorRequired))return this.close()}async function re(e,t=!0){if(!e)return this.collection;const i=this.collection.findIndex(n=>n.id===e.id);if(i>=0){const n=this.collection[i];t&&n.state==="opened"?await n.close(!1):this.stack.remove(n),n.getSetting("teleport")&&n.teleportReturn(),Object.getOwnPropertyNames(n).forEach(s=>{delete n[s]}),this.collection.splice(i,1)}return this.collection}async function oe(e,t,i=!0){const n=se.call(this,e),s={...this.settings,...n.settings};return t!==void 0&&(s.transition=t),this.stack.moveToTop(n),n.state==="closed"&&(n.state="opening",this.stack.add(n),await mn(n.el,s),n.state="opened"),i&&Rt.call(this),n.el.dispatchEvent(new CustomEvent(s.customEventPrefix+"opened",{detail:this,bubbles:!0})),n}async function ae(e,t,i=!0){const n=e?se.call(this,e):this.active;if(n&&n.state==="opened"){n.state="closing";const s={...this.settings,...n.settings};t!==void 0&&(s.transition=t),document.activeElement.blur(),await vn(n.el,s),this.stack.remove(n),i&&Rt.call(this),n.state="closed",n.el.dispatchEvent(new CustomEvent(s.customEventPrefix+"closed",{detail:this,bubbles:!0}))}return n}async function le(e,t){const i=[];return await Promise.all(this.stack.value.map(async n=>{e&&e===n.id?Promise.resolve():i.push(await ae.call(this,n,t,!1)),n.trigger=null})),i}async function Ne(e,t,i=!0){const n=se.call(this,e);let s,r;return n.state==="opened"?(s=n,r=await le.call(this,n.id,t)):(s=oe.call(this,n,t,!1),r=le.call(this,!1,t),await Promise.all([s,r])),i&&Rt.call(this),{opened:s,closed:r}}async function On(e,t){await re.call(this,e,!1);const i=this,n={open(r,a){return oe.call(i,this,r,a)},close(r,a){return ae.call(i,this,r,a)},replace(r,a){return Ne.call(i,this,r,a)},deregister(){return re.call(i,this)},teleport(r=this.getSetting("teleport"),a=this.getSetting("teleportMethod")){return this.returnRef?(console.error("Element has already been teleported:",this.el),!1):(this.returnRef=We(this.el,r,a),this.el)},teleportReturn(){return this.returnRef?(this.returnRef=We(this.el,this.returnRef),this.el):(console.error("No return reference found:",this.el),!1)},getSetting(r){return r in this.settings?this.settings[r]:i.settings[r]}},s={id:e.id,state:"closed",el:e,dialog:t,returnRef:null,settings:gn(e,this.settings.dataConfig),...n};return s.dialog.setAttribute("aria-modal","true"),s.dialog.hasAttribute("role")||s.dialog.setAttribute("role","dialog"),s.getSetting("setTabindex")&&s.dialog.setAttribute("tabindex","-1"),s.getSetting("teleport")&&s.teleport(),this.collection.push(s),s.el.classList.contains(this.settings.stateOpened)?await s.open(!1):(s.el.classList.remove(this.settings.stateOpening),s.el.classList.remove(this.settings.stateClosing),s.el.classList.add(this.settings.stateClosed)),s}function kn(e){const t=[];return{get value(){return[...t]},get top(){return t[t.length-1]},updateIndex(){t.forEach((i,n)=>{i.el.style.zIndex=null;const s=getComputedStyle(i.el)["z-index"];i.el.style.zIndex=parseInt(s)+n+1})},updateGlobalState(){wn(this.top,e),this.updateIndex()},add(i){i.el.style.zIndex=null;const n=getComputedStyle(i.el)["z-index"];i.el.style.zIndex=parseInt(n)+t.length+1,t.push(i),this.updateGlobalState()},remove(i){const n=t.findIndex(s=>s.id===i.id);n>=0&&(i.el.style.zIndex=null,t.splice(n,1),this.updateGlobalState())},moveToTop(i){const n=t.findIndex(s=>s.id===i.id);n>=0&&(t.splice(n,1),this.add(i))}}}var Lt,Ot;class Tn extends dn{constructor(t){super(),De(this,Lt,void 0),De(this,Ot,void 0),this.defaults=$n,this.settings={...this.defaults,...t},this.trigger=null,this.focusTrap=new hn,this.stack=kn(this.settings),Me(this,Lt,xn.bind(this)),Me(this,Ot,Ln.bind(this)),this.settings.autoInit&&this.init()}get active(){return this.stack.top}async init(t){t&&(this.settings={...this.settings,...t});const i=document.querySelectorAll(this.settings.selectorModal);return await this.registerCollection(i),this.settings.eventListeners&&this.initEventListeners(),this}async destroy(){return this.trigger=null,await this.deregisterCollection(),this.settings.eventListeners&&this.destroyEventListeners(),this}initEventListeners(){document.addEventListener("click",Ft(this,Lt),!1),document.addEventListener("keydown",Ft(this,Ot),!1)}destroyEventListeners(){document.removeEventListener("click",Ft(this,Lt),!1),document.removeEventListener("keydown",Ft(this,Ot),!1)}register(t){const i=En.call(this,t);return i.error?Promise.reject(i.error):On.call(this,i.modal,i.dialog)}deregister(t){const i=this.get(Bt.call(this,t));return re.call(this,i)}open(t,i,n){return oe.call(this,t,i,n)}close(t,i,n){return ae.call(this,t,i,n)}replace(t,i,n){return Ne.call(this,t,i,n)}async closeAll(t=!1,i,n=!0){const s=await le.call(this,t,i);return n&&Rt.call(this),s}}Lt=new WeakMap,Ot=new WeakMap;var _e=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},Fe=(e,t,i)=>(_e(e,t,"read from private field"),i?i.call(e):t.get(e)),An=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},Cn=(e,t,i,n)=>(_e(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),i);class In{constructor(){this.collection=[]}async register(t){return await this.deregister(t),this.collection.push(t),this.collection}async deregister(t){const i=this.collection.findIndex(n=>n===t);if(i>=0){const n=this.collection[i];Object.getOwnPropertyNames(n).forEach(s=>{delete n[s]}),this.collection.splice(i,1)}return this.collection}async registerCollection(t){return await Promise.all(Array.from(t,i=>{this.register(i)})),this.collection}async deregisterCollection(){for(;this.collection.length>0;)await this.deregister(this.collection[0]);return this.collection}get(t,i="id"){return this.collection.find(n=>n[i]===t)}}function Sn(){return getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix").trim()}const Pn={autoInit:!1,selectorPopover:".popover",selectorArrow:".popover__arrow",stateActive:"is-active",eventListeners:!0,eventType:"click",placement:"bottom"};function Be(e,t){const i=getComputedStyle(e),n={placement:t.placement,event:t.eventType,offset:0,"overflow-padding":0,"flip-padding":0,"arrow-element":t.selectorArrow,"arrow-padding":0};for(const s in n){const r=Sn(),a=i.getPropertyValue(`--${r}popover-${s}`).trim();a&&(n[s]=a)}return n}function ce(e){let t;const i=typeof e=="string"?e.trim().split(" "):[e];switch(i.forEach(function(n,s){i[s]=parseInt(n,10)}),i.length){case 1:t=i[0];break;case 2:t={top:i[0],right:i[1],bottom:i[0],left:i[1]};break;case 3:t={top:i[0],right:i[1],bottom:i[2],left:i[1]};break;case 4:t={top:i[0],right:i[1],bottom:i[2],left:i[3]};break;default:t=!1;break}return t}function qn(e){return[{name:"offset",options:{offset:[0,parseInt(e.offset,10)]}},{name:"preventOverflow",options:{padding:ce(e["overflow-padding"])}},{name:"flip",options:{padding:ce(e["flip-padding"])}},{name:"arrow",options:{element:e["arrow-element"],padding:ce(e["arrow-padding"])}}]}function Re(e){const t=typeof e=="string"?this.get(e):this.get(e.id);if(t)return t;throw new Error(`Popover not found in collection with id of "${e}".`)}function He(e){return typeof e=="string"?e:typeof e.hasAttribute=="function"?e.closest(this.settings.selectorPopover)?(e=e.closest(this.settings.selectorPopover),e.id):e.hasAttribute("aria-controls")?e.getAttribute("aria-controls"):e.hasAttribute("aria-describedby")?e.getAttribute("aria-describedby"):!1:e.id?e.id:!1}function Dn(e){const t=He.call(this,e);if(t){const i=document.querySelector(`#${t}`),n=document.querySelector(`[aria-controls="${t}"]`)||document.querySelector(`[aria-describedby="${t}"]`);return!n&&!i?{error:new Error(`No popover elements found using the ID: "${t}".`)}:n?i?{popover:i,trigger:n}:{error:new Error("No popover associated with the provided popover trigger.")}:{error:new Error("No popover trigger associated with the provided popover.")}}else return{error:new Error("Could not resolve the popover ID.")}}async function de(e){const t=e?Re.call(this,e):await Ve.call(this);return t&&t.state==="opened"&&(t.el.classList.remove(this.settings.stateActive),t.trigger.hasAttribute("aria-controls")&&t.trigger.setAttribute("aria-expanded","false"),t.popper.setOptions({modifiers:[{name:"eventListeners",enabled:!1}]}),t.state="closed",t.trigger===this.trigger&&(this.trigger=null)),t}async function Ve(){const e=[];return await Promise.all(this.collection.map(async t=>{t.state==="opened"&&e.push(await de.call(this,t))})),e}function Je(e){e.state=="opened"&&setTimeout(()=>{const t=e.el.closest(":hover")===e.el||e.trigger.closest(":hover")===e.trigger,i=document.activeElement.closest(`#${e.id}, [aria-controls="${e.id}"], [aria-describedby="${e.id}"]`);return!t&&!i&&e.close(),e},1)}function Mn(e){e.state==="opened"?e.close():(this.trigger=e.trigger,e.open(),ze.call(this,e))}function jn(e){switch(e.key){case"Escape":this.trigger&&this.trigger.focus(),Ve.call(this);return;case"Tab":this.collection.forEach(t=>{Je.call(this,t)});return;default:return}}function ze(e){const t=this;document.addEventListener("click",function i(n){n.target.closest(`#${e.id}, [aria-controls="${e.id}"], [aria-describedby="${e.id}"]`)?e.el&&!e.el.classList.contains(t.settings.stateActive)&&this.removeEventListener("click",i):(e.el&&e.el.classList.contains(t.settings.stateActive)&&e.close(),this.removeEventListener("click",i))})}var j="top",F="bottom",B="right",W="left",ue="auto",kt=[j,F,B,W],pt="start",Tt="end",Wn="clippingParents",Ke="viewport",At="popper",Nn="reference",Ge=kt.reduce(function(e,t){return e.concat([t+"-"+pt,t+"-"+Tt])},[]),Qe=[].concat(kt,[ue]).reduce(function(e,t){return e.concat([t,t+"-"+pt,t+"-"+Tt])},[]),_n="beforeRead",Fn="read",Bn="afterRead",Rn="beforeMain",Hn="main",Vn="afterMain",Jn="beforeWrite",zn="write",Kn="afterWrite",Gn=[_n,Fn,Bn,Rn,Hn,Vn,Jn,zn,Kn];function z(e){return e?(e.nodeName||"").toLowerCase():null}function N(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function tt(e){var t=N(e).Element;return e instanceof t||e instanceof Element}function R(e){var t=N(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function he(e){if(typeof ShadowRoot>"u")return!1;var t=N(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function Qn(e){var t=e.state;Object.keys(t.elements).forEach(function(i){var n=t.styles[i]||{},s=t.attributes[i]||{},r=t.elements[i];!R(r)||!z(r)||(Object.assign(r.style,n),Object.keys(s).forEach(function(a){var l=s[a];l===!1?r.removeAttribute(a):r.setAttribute(a,l===!0?"":l)}))})}function Zn(e){var t=e.state,i={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,i.popper),t.styles=i,t.elements.arrow&&Object.assign(t.elements.arrow.style,i.arrow),function(){Object.keys(t.elements).forEach(function(n){var s=t.elements[n],r=t.attributes[n]||{},a=Object.keys(t.styles.hasOwnProperty(n)?t.styles[n]:i[n]),l=a.reduce(function(o,c){return o[c]="",o},{});!R(s)||!z(s)||(Object.assign(s.style,l),Object.keys(r).forEach(function(o){s.removeAttribute(o)}))})}}const Un={name:"applyStyles",enabled:!0,phase:"write",fn:Qn,effect:Zn,requires:["computeStyles"]};function K(e){return e.split("-")[0]}var et=Math.max,Ht=Math.min,gt=Math.round;function fe(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function Ze(){return!/^((?!chrome|android).)*safari/i.test(fe())}function mt(e,t,i){t===void 0&&(t=!1),i===void 0&&(i=!1);var n=e.getBoundingClientRect(),s=1,r=1;t&&R(e)&&(s=e.offsetWidth>0&>(n.width)/e.offsetWidth||1,r=e.offsetHeight>0&>(n.height)/e.offsetHeight||1);var a=tt(e)?N(e):window,l=a.visualViewport,o=!Ze()&&i,c=(n.left+(o&&l?l.offsetLeft:0))/s,d=(n.top+(o&&l?l.offsetTop:0))/r,b=n.width/s,v=n.height/r;return{width:b,height:v,top:d,right:c+b,bottom:d+v,left:c,x:c,y:d}}function pe(e){var t=mt(e),i=e.offsetWidth,n=e.offsetHeight;return Math.abs(t.width-i)<=1&&(i=t.width),Math.abs(t.height-n)<=1&&(n=t.height),{x:e.offsetLeft,y:e.offsetTop,width:i,height:n}}function Ue(e,t){var i=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(i&&he(i)){var n=t;do{if(n&&e.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function G(e){return N(e).getComputedStyle(e)}function Xn(e){return["table","td","th"].indexOf(z(e))>=0}function U(e){return((tt(e)?e.ownerDocument:e.document)||window.document).documentElement}function Vt(e){return z(e)==="html"?e:e.assignedSlot||e.parentNode||(he(e)?e.host:null)||U(e)}function Xe(e){return!R(e)||G(e).position==="fixed"?null:e.offsetParent}function Yn(e){var t=/firefox/i.test(fe()),i=/Trident/i.test(fe());if(i&&R(e)){var n=G(e);if(n.position==="fixed")return null}var s=Vt(e);for(he(s)&&(s=s.host);R(s)&&["html","body"].indexOf(z(s))<0;){var r=G(s);if(r.transform!=="none"||r.perspective!=="none"||r.contain==="paint"||["transform","perspective"].indexOf(r.willChange)!==-1||t&&r.willChange==="filter"||t&&r.filter&&r.filter!=="none")return s;s=s.parentNode}return null}function Ct(e){for(var t=N(e),i=Xe(e);i&&Xn(i)&&G(i).position==="static";)i=Xe(i);return i&&(z(i)==="html"||z(i)==="body"&&G(i).position==="static")?t:i||Yn(e)||t}function ge(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function It(e,t,i){return et(e,Ht(t,i))}function ts(e,t,i){var n=It(e,t,i);return n>i?i:n}function Ye(){return{top:0,right:0,bottom:0,left:0}}function ti(e){return Object.assign({},Ye(),e)}function ei(e,t){return t.reduce(function(i,n){return i[n]=e,i},{})}var es=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,ti(typeof e!="number"?e:ei(e,kt))};function is(e){var t,i=e.state,n=e.name,s=e.options,r=i.elements.arrow,a=i.modifiersData.popperOffsets,l=K(i.placement),o=ge(l),c=[W,B].indexOf(l)>=0,d=c?"height":"width";if(!(!r||!a)){var b=es(s.padding,i),v=pe(r),h=o==="y"?j:W,$=o==="y"?F:B,u=i.rects.reference[d]+i.rects.reference[o]-a[o]-i.rects.popper[d],w=a[o]-i.rects.reference[o],E=Ct(r),L=E?o==="y"?E.clientHeight||0:E.clientWidth||0:0,O=u/2-w/2,m=b[h],y=L-v[d]-b[$],x=L/2-v[d]/2+O,k=It(m,x,y),T=o;i.modifiersData[n]=(t={},t[T]=k,t.centerOffset=k-x,t)}}function ns(e){var t=e.state,i=e.options,n=i.element,s=n===void 0?"[data-popper-arrow]":n;s!=null&&(typeof s=="string"&&(s=t.elements.popper.querySelector(s),!s)||Ue(t.elements.popper,s)&&(t.elements.arrow=s))}const ss={name:"arrow",enabled:!0,phase:"main",fn:is,effect:ns,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function vt(e){return e.split("-")[1]}var rs={top:"auto",right:"auto",bottom:"auto",left:"auto"};function os(e,t){var i=e.x,n=e.y,s=t.devicePixelRatio||1;return{x:gt(i*s)/s||0,y:gt(n*s)/s||0}}function ii(e){var t,i=e.popper,n=e.popperRect,s=e.placement,r=e.variation,a=e.offsets,l=e.position,o=e.gpuAcceleration,c=e.adaptive,d=e.roundOffsets,b=e.isFixed,v=a.x,h=v===void 0?0:v,$=a.y,u=$===void 0?0:$,w=typeof d=="function"?d({x:h,y:u}):{x:h,y:u};h=w.x,u=w.y;var E=a.hasOwnProperty("x"),L=a.hasOwnProperty("y"),O=W,m=j,y=window;if(c){var x=Ct(i),k="clientHeight",T="clientWidth";if(x===N(i)&&(x=U(i),G(x).position!=="static"&&l==="absolute"&&(k="scrollHeight",T="scrollWidth")),x=x,s===j||(s===W||s===B)&&r===Tt){m=F;var I=b&&x===y&&y.visualViewport?y.visualViewport.height:x[k];u-=I-n.height,u*=o?1:-1}if(s===W||(s===j||s===F)&&r===Tt){O=B;var S=b&&x===y&&y.visualViewport?y.visualViewport.width:x[T];h-=S-n.width,h*=o?1:-1}}var P=Object.assign({position:l},c&&rs),H=d===!0?os({x:h,y:u},N(i)):{x:h,y:u};if(h=H.x,u=H.y,o){var q;return Object.assign({},P,(q={},q[m]=L?"0":"",q[O]=E?"0":"",q.transform=(y.devicePixelRatio||1)<=1?"translate("+h+"px, "+u+"px)":"translate3d("+h+"px, "+u+"px, 0)",q))}return Object.assign({},P,(t={},t[m]=L?u+"px":"",t[O]=E?h+"px":"",t.transform="",t))}function as(e){var t=e.state,i=e.options,n=i.gpuAcceleration,s=n===void 0?!0:n,r=i.adaptive,a=r===void 0?!0:r,l=i.roundOffsets,o=l===void 0?!0:l,c={placement:K(t.placement),variation:vt(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:s,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,ii(Object.assign({},c,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:a,roundOffsets:o})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,ii(Object.assign({},c,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:o})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const ls={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:as,data:{}};var Jt={passive:!0};function cs(e){var t=e.state,i=e.instance,n=e.options,s=n.scroll,r=s===void 0?!0:s,a=n.resize,l=a===void 0?!0:a,o=N(t.elements.popper),c=[].concat(t.scrollParents.reference,t.scrollParents.popper);return r&&c.forEach(function(d){d.addEventListener("scroll",i.update,Jt)}),l&&o.addEventListener("resize",i.update,Jt),function(){r&&c.forEach(function(d){d.removeEventListener("scroll",i.update,Jt)}),l&&o.removeEventListener("resize",i.update,Jt)}}const ds={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:cs,data:{}};var us={left:"right",right:"left",bottom:"top",top:"bottom"};function zt(e){return e.replace(/left|right|bottom|top/g,function(t){return us[t]})}var hs={start:"end",end:"start"};function ni(e){return e.replace(/start|end/g,function(t){return hs[t]})}function me(e){var t=N(e),i=t.pageXOffset,n=t.pageYOffset;return{scrollLeft:i,scrollTop:n}}function ve(e){return mt(U(e)).left+me(e).scrollLeft}function fs(e,t){var i=N(e),n=U(e),s=i.visualViewport,r=n.clientWidth,a=n.clientHeight,l=0,o=0;if(s){r=s.width,a=s.height;var c=Ze();(c||!c&&t==="fixed")&&(l=s.offsetLeft,o=s.offsetTop)}return{width:r,height:a,x:l+ve(e),y:o}}function ps(e){var t,i=U(e),n=me(e),s=(t=e.ownerDocument)==null?void 0:t.body,r=et(i.scrollWidth,i.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),a=et(i.scrollHeight,i.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),l=-n.scrollLeft+ve(e),o=-n.scrollTop;return G(s||i).direction==="rtl"&&(l+=et(i.clientWidth,s?s.clientWidth:0)-r),{width:r,height:a,x:l,y:o}}function be(e){var t=G(e),i=t.overflow,n=t.overflowX,s=t.overflowY;return/auto|scroll|overlay|hidden/.test(i+s+n)}function si(e){return["html","body","#document"].indexOf(z(e))>=0?e.ownerDocument.body:R(e)&&be(e)?e:si(Vt(e))}function St(e,t){var i;t===void 0&&(t=[]);var n=si(e),s=n===((i=e.ownerDocument)==null?void 0:i.body),r=N(n),a=s?[r].concat(r.visualViewport||[],be(n)?n:[]):n,l=t.concat(a);return s?l:l.concat(St(Vt(a)))}function ye(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function gs(e,t){var i=mt(e,!1,t==="fixed");return i.top=i.top+e.clientTop,i.left=i.left+e.clientLeft,i.bottom=i.top+e.clientHeight,i.right=i.left+e.clientWidth,i.width=e.clientWidth,i.height=e.clientHeight,i.x=i.left,i.y=i.top,i}function ri(e,t,i){return t===Ke?ye(fs(e,i)):tt(t)?gs(t,i):ye(ps(U(e)))}function ms(e){var t=St(Vt(e)),i=["absolute","fixed"].indexOf(G(e).position)>=0,n=i&&R(e)?Ct(e):e;return tt(n)?t.filter(function(s){return tt(s)&&Ue(s,n)&&z(s)!=="body"}):[]}function vs(e,t,i,n){var s=t==="clippingParents"?ms(e):[].concat(t),r=[].concat(s,[i]),a=r[0],l=r.reduce(function(o,c){var d=ri(e,c,n);return o.top=et(d.top,o.top),o.right=Ht(d.right,o.right),o.bottom=Ht(d.bottom,o.bottom),o.left=et(d.left,o.left),o},ri(e,a,n));return l.width=l.right-l.left,l.height=l.bottom-l.top,l.x=l.left,l.y=l.top,l}function oi(e){var t=e.reference,i=e.element,n=e.placement,s=n?K(n):null,r=n?vt(n):null,a=t.x+t.width/2-i.width/2,l=t.y+t.height/2-i.height/2,o;switch(s){case j:o={x:a,y:t.y-i.height};break;case F:o={x:a,y:t.y+t.height};break;case B:o={x:t.x+t.width,y:l};break;case W:o={x:t.x-i.width,y:l};break;default:o={x:t.x,y:t.y}}var c=s?ge(s):null;if(c!=null){var d=c==="y"?"height":"width";switch(r){case pt:o[c]=o[c]-(t[d]/2-i[d]/2);break;case Tt:o[c]=o[c]+(t[d]/2-i[d]/2);break}}return o}function Pt(e,t){t===void 0&&(t={});var i=t,n=i.placement,s=n===void 0?e.placement:n,r=i.strategy,a=r===void 0?e.strategy:r,l=i.boundary,o=l===void 0?Wn:l,c=i.rootBoundary,d=c===void 0?Ke:c,b=i.elementContext,v=b===void 0?At:b,h=i.altBoundary,$=h===void 0?!1:h,u=i.padding,w=u===void 0?0:u,E=ti(typeof w!="number"?w:ei(w,kt)),L=v===At?Nn:At,O=e.rects.popper,m=e.elements[$?L:v],y=vs(tt(m)?m:m.contextElement||U(e.elements.popper),o,d,a),x=mt(e.elements.reference),k=oi({reference:x,element:O,strategy:"absolute",placement:s}),T=ye(Object.assign({},O,k)),I=v===At?T:x,S={top:y.top-I.top+E.top,bottom:I.bottom-y.bottom+E.bottom,left:y.left-I.left+E.left,right:I.right-y.right+E.right},P=e.modifiersData.offset;if(v===At&&P){var H=P[s];Object.keys(S).forEach(function(q){var it=[B,F].indexOf(q)>=0?1:-1,nt=[j,F].indexOf(q)>=0?"y":"x";S[q]+=H[nt]*it})}return S}function bs(e,t){t===void 0&&(t={});var i=t,n=i.placement,s=i.boundary,r=i.rootBoundary,a=i.padding,l=i.flipVariations,o=i.allowedAutoPlacements,c=o===void 0?Qe:o,d=vt(n),b=d?l?Ge:Ge.filter(function($){return vt($)===d}):kt,v=b.filter(function($){return c.indexOf($)>=0});v.length===0&&(v=b);var h=v.reduce(function($,u){return $[u]=Pt(e,{placement:u,boundary:s,rootBoundary:r,padding:a})[K(u)],$},{});return Object.keys(h).sort(function($,u){return h[$]-h[u]})}function ys(e){if(K(e)===ue)return[];var t=zt(e);return[ni(e),t,ni(t)]}function ws(e){var t=e.state,i=e.options,n=e.name;if(!t.modifiersData[n]._skip){for(var s=i.mainAxis,r=s===void 0?!0:s,a=i.altAxis,l=a===void 0?!0:a,o=i.fallbackPlacements,c=i.padding,d=i.boundary,b=i.rootBoundary,v=i.altBoundary,h=i.flipVariations,$=h===void 0?!0:h,u=i.allowedAutoPlacements,w=t.options.placement,E=K(w),L=E===w,O=o||(L||!$?[zt(w)]:ys(w)),m=[w].concat(O).reduce(function(rt,Q){return rt.concat(K(Q)===ue?bs(t,{placement:Q,boundary:d,rootBoundary:b,padding:c,flipVariations:$,allowedAutoPlacements:u}):Q)},[]),y=t.rects.reference,x=t.rects.popper,k=new Map,T=!0,I=m[0],S=0;S<m.length;S++){var P=m[S],H=K(P),q=vt(P)===pt,it=[j,F].indexOf(H)>=0,nt=it?"width":"height",_=Pt(t,{placement:P,boundary:d,rootBoundary:b,altBoundary:v,padding:c}),V=it?q?B:W:q?F:j;y[nt]>x[nt]&&(V=zt(V));var Kt=zt(V),st=[];if(r&&st.push(_[H]<=0),l&&st.push(_[V]<=0,_[Kt]<=0),st.every(function(rt){return rt})){I=P,T=!1;break}k.set(P,st)}if(T)for(var Gt=$?3:1,Ee=function(rt){var Q=m.find(function(Zt){var Mt=k.get(Zt);if(Mt)return Mt.slice(0,rt).every(function(bt){return bt})});if(Q)return I=Q,"break"},Dt=Gt;Dt>0;Dt--){var Qt=Ee(Dt);if(Qt==="break")break}t.placement!==I&&(t.modifiersData[n]._skip=!0,t.placement=I,t.reset=!0)}}const $s={name:"flip",enabled:!0,phase:"main",fn:ws,requiresIfExists:["offset"],data:{_skip:!1}};function ai(e,t,i){return i===void 0&&(i={x:0,y:0}),{top:e.top-t.height-i.y,right:e.right-t.width+i.x,bottom:e.bottom-t.height+i.y,left:e.left-t.width-i.x}}function li(e){return[j,B,F,W].some(function(t){return e[t]>=0})}function Es(e){var t=e.state,i=e.name,n=t.rects.reference,s=t.rects.popper,r=t.modifiersData.preventOverflow,a=Pt(t,{elementContext:"reference"}),l=Pt(t,{altBoundary:!0}),o=ai(a,n),c=ai(l,s,r),d=li(o),b=li(c);t.modifiersData[i]={referenceClippingOffsets:o,popperEscapeOffsets:c,isReferenceHidden:d,hasPopperEscaped:b},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":b})}const xs={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Es};function Ls(e,t,i){var n=K(e),s=[W,j].indexOf(n)>=0?-1:1,r=typeof i=="function"?i(Object.assign({},t,{placement:e})):i,a=r[0],l=r[1];return a=a||0,l=(l||0)*s,[W,B].indexOf(n)>=0?{x:l,y:a}:{x:a,y:l}}function Os(e){var t=e.state,i=e.options,n=e.name,s=i.offset,r=s===void 0?[0,0]:s,a=Qe.reduce(function(d,b){return d[b]=Ls(b,t.rects,r),d},{}),l=a[t.placement],o=l.x,c=l.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=o,t.modifiersData.popperOffsets.y+=c),t.modifiersData[n]=a}const ks={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Os};function Ts(e){var t=e.state,i=e.name;t.modifiersData[i]=oi({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const As={name:"popperOffsets",enabled:!0,phase:"read",fn:Ts,data:{}};function Cs(e){return e==="x"?"y":"x"}function Is(e){var t=e.state,i=e.options,n=e.name,s=i.mainAxis,r=s===void 0?!0:s,a=i.altAxis,l=a===void 0?!1:a,o=i.boundary,c=i.rootBoundary,d=i.altBoundary,b=i.padding,v=i.tether,h=v===void 0?!0:v,$=i.tetherOffset,u=$===void 0?0:$,w=Pt(t,{boundary:o,rootBoundary:c,padding:b,altBoundary:d}),E=K(t.placement),L=vt(t.placement),O=!L,m=ge(E),y=Cs(m),x=t.modifiersData.popperOffsets,k=t.rects.reference,T=t.rects.popper,I=typeof u=="function"?u(Object.assign({},t.rects,{placement:t.placement})):u,S=typeof I=="number"?{mainAxis:I,altAxis:I}:Object.assign({mainAxis:0,altAxis:0},I),P=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,H={x:0,y:0};if(x){if(r){var q,it=m==="y"?j:W,nt=m==="y"?F:B,_=m==="y"?"height":"width",V=x[m],Kt=V+w[it],st=V-w[nt],Gt=h?-T[_]/2:0,Ee=L===pt?k[_]:T[_],Dt=L===pt?-T[_]:-k[_],Qt=t.elements.arrow,rt=h&&Qt?pe(Qt):{width:0,height:0},Q=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:Ye(),Zt=Q[it],Mt=Q[nt],bt=It(0,k[_],rt[_]),Js=O?k[_]/2-Gt-bt-Zt-S.mainAxis:Ee-bt-Zt-S.mainAxis,zs=O?-k[_]/2+Gt+bt+Mt+S.mainAxis:Dt+bt+Mt+S.mainAxis,xe=t.elements.arrow&&Ct(t.elements.arrow),Ks=xe?m==="y"?xe.clientTop||0:xe.clientLeft||0:0,fi=(q=P==null?void 0:P[m])!=null?q:0,Gs=V+Js-fi-Ks,Qs=V+zs-fi,pi=It(h?Ht(Kt,Gs):Kt,V,h?et(st,Qs):st);x[m]=pi,H[m]=pi-V}if(l){var gi,Zs=m==="x"?j:W,Us=m==="x"?F:B,ot=x[y],Ut=y==="y"?"height":"width",mi=ot+w[Zs],vi=ot-w[Us],Le=[j,W].indexOf(E)!==-1,bi=(gi=P==null?void 0:P[y])!=null?gi:0,yi=Le?mi:ot-k[Ut]-T[Ut]-bi+S.altAxis,wi=Le?ot+k[Ut]+T[Ut]-bi-S.altAxis:vi,$i=h&&Le?ts(yi,ot,wi):It(h?yi:mi,ot,h?wi:vi);x[y]=$i,H[y]=$i-ot}t.modifiersData[n]=H}}const Ss={name:"preventOverflow",enabled:!0,phase:"main",fn:Is,requiresIfExists:["offset"]};function Ps(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function qs(e){return e===N(e)||!R(e)?me(e):Ps(e)}function Ds(e){var t=e.getBoundingClientRect(),i=gt(t.width)/e.offsetWidth||1,n=gt(t.height)/e.offsetHeight||1;return i!==1||n!==1}function Ms(e,t,i){i===void 0&&(i=!1);var n=R(t),s=R(t)&&Ds(t),r=U(t),a=mt(e,s,i),l={scrollLeft:0,scrollTop:0},o={x:0,y:0};return(n||!n&&!i)&&((z(t)!=="body"||be(r))&&(l=qs(t)),R(t)?(o=mt(t,!0),o.x+=t.clientLeft,o.y+=t.clientTop):r&&(o.x=ve(r))),{x:a.left+l.scrollLeft-o.x,y:a.top+l.scrollTop-o.y,width:a.width,height:a.height}}function js(e){var t=new Map,i=new Set,n=[];e.forEach(function(r){t.set(r.name,r)});function s(r){i.add(r.name);var a=[].concat(r.requires||[],r.requiresIfExists||[]);a.forEach(function(l){if(!i.has(l)){var o=t.get(l);o&&s(o)}}),n.push(r)}return e.forEach(function(r){i.has(r.name)||s(r)}),n}function Ws(e){var t=js(e);return Gn.reduce(function(i,n){return i.concat(t.filter(function(s){return s.phase===n}))},[])}function Ns(e){var t;return function(){return t||(t=new Promise(function(i){Promise.resolve().then(function(){t=void 0,i(e())})})),t}}function _s(e){var t=e.reduce(function(i,n){var s=i[n.name];return i[n.name]=s?Object.assign({},s,n,{options:Object.assign({},s.options,n.options),data:Object.assign({},s.data,n.data)}):n,i},{});return Object.keys(t).map(function(i){return t[i]})}var ci={placement:"bottom",modifiers:[],strategy:"absolute"};function di(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return!t.some(function(n){return!(n&&typeof n.getBoundingClientRect=="function")})}function Fs(e){e===void 0&&(e={});var t=e,i=t.defaultModifiers,n=i===void 0?[]:i,s=t.defaultOptions,r=s===void 0?ci:s;return function(a,l,o){o===void 0&&(o=r);var c={placement:"bottom",orderedModifiers:[],options:Object.assign({},ci,r),modifiersData:{},elements:{reference:a,popper:l},attributes:{},styles:{}},d=[],b=!1,v={state:c,setOptions:function(u){var w=typeof u=="function"?u(c.options):u;$(),c.options=Object.assign({},r,c.options,w),c.scrollParents={reference:tt(a)?St(a):a.contextElement?St(a.contextElement):[],popper:St(l)};var E=Ws(_s([].concat(n,c.options.modifiers)));return c.orderedModifiers=E.filter(function(L){return L.enabled}),h(),v.update()},forceUpdate:function(){if(!b){var u=c.elements,w=u.reference,E=u.popper;if(di(w,E)){c.rects={reference:Ms(w,Ct(E),c.options.strategy==="fixed"),popper:pe(E)},c.reset=!1,c.placement=c.options.placement,c.orderedModifiers.forEach(function(T){return c.modifiersData[T.name]=Object.assign({},T.data)});for(var L=0;L<c.orderedModifiers.length;L++){if(c.reset===!0){c.reset=!1,L=-1;continue}var O=c.orderedModifiers[L],m=O.fn,y=O.options,x=y===void 0?{}:y,k=O.name;typeof m=="function"&&(c=m({state:c,options:x,name:k,instance:v})||c)}}}},update:Ns(function(){return new Promise(function(u){v.forceUpdate(),u(c)})}),destroy:function(){$(),b=!0}};if(!di(a,l))return v;v.setOptions(o).then(function(u){!b&&o.onFirstUpdate&&o.onFirstUpdate(u)});function h(){c.orderedModifiers.forEach(function(u){var w=u.name,E=u.options,L=E===void 0?{}:E,O=u.effect;if(typeof O=="function"){var m=O({state:c,name:w,instance:v,options:L}),y=function(){};d.push(m||y)}})}function $(){d.forEach(function(u){return u()}),d=[]}return v}}var Bs=[ds,As,ls,Un,ks,$s,Ss,ss,xs],Rs=Fs({defaultModifiers:Bs});async function we(e){if(!e)return this.collection;const t=this.collection.findIndex(i=>i.id===e.id);if(t>=0){const i=this.collection[t];i.state==="opened"&&i.close(),i.popper.destroy(),ui(i),Object.getOwnPropertyNames(i).forEach(n=>{delete i[n]}),this.collection.splice(t,1)}return this.collection}function ui(e){return e.__eventListeners&&(e.__eventListeners.forEach(t=>{t.el.forEach(i=>{t.type.forEach(n=>{e[i].removeEventListener(n,t.listener,!1)})})}),delete e.__eventListeners),e}async function $e(e){const t=Re.call(this,e);return t.el.classList.add(this.settings.stateActive),t.trigger.hasAttribute("aria-controls")&&t.trigger.setAttribute("aria-expanded","true"),t.config=Be(t.el,this.settings),t.popper.setOptions({placement:t.config.placement,modifiers:[{name:"eventListeners",enabled:!0},...qn(t.config)]}),t.popper.update(),t.state="opened",t}async function Hs(e,t){we.call(this,e);const i=this,n={open(){return $e.call(i,this)},close(){return de.call(i,this)},deregister(){return we.call(i,this)}},s={id:e.id,state:"closed",el:e,trigger:t,popper:Rs(t,e),config:Be(e,this.settings),...n};return s.trigger.hasAttribute("aria-controls")&&s.trigger.setAttribute("aria-expanded","false"),hi.call(this,s),this.collection.push(s),s.el.classList.contains(this.settings.stateActive)&&(await s.open(),ze.call(this,s)),s}function hi(e){return e.__eventListeners||(e.config.event==="hover"?(e.__eventListeners=[{el:["trigger"],type:["mouseenter","focus"],listener:$e.bind(this,e)},{el:["el","trigger"],type:["mouseleave","focusout"],listener:Je.bind(this,e)}],e.__eventListeners.forEach(t=>{t.el.forEach(i=>{t.type.forEach(n=>{e[i].addEventListener(n,t.listener,!1)})})})):(e.__eventListeners=[{el:["trigger"],type:["click"],listener:Mn.bind(this,e)}],e.__eventListeners.forEach(t=>{t.el.forEach(i=>{t.type.forEach(n=>{e[i].addEventListener(n,t.listener,!1)})})}))),e}var qt;class Vs extends In{constructor(t){super(),An(this,qt,void 0),this.defaults=Pn,this.settings={...this.defaults,...t},this.trigger=null,Cn(this,qt,jn.bind(this)),this.settings.autoInit&&this.init()}async init(t){t&&(this.settings={...this.settings,...t});const i=document.querySelectorAll(this.settings.selectorPopover);return await this.registerCollection(i),this.settings.eventListeners&&this.initEventListeners(!1),this}async destroy(){return this.trigger=null,await this.deregisterCollection(),this.settings.eventListeners&&this.destroyEventListeners(!1),this}initEventListeners(t=!0){t&&this.collection.forEach(i=>{hi.call(this,i)}),document.addEventListener("keydown",Fe(this,qt),!1)}destroyEventListeners(t=!0){t&&this.collection.forEach(i=>{ui(i)}),document.removeEventListener("keydown",Fe(this,qt),!1)}register(t){const i=Dn.call(this,t);return i.error?Promise.reject(i.error):Hs.call(this,i.popover,i.trigger)}deregister(t){const i=this.get(He.call(this,t));return we.call(this,i)}open(t){return $e.call(this,t)}close(t){return de.call(this,t)}}qt=new WeakMap,J.Checkbox=_i,J.Drawer=cn,J.Modal=Tn,J.Popover=Vs,J.core=Wi,Object.defineProperty(J,Symbol.toStringTag,{value:"Module"})});
|
|
5
|
+
`);if(e){t.preventDefault(),e.matches(`[data-${this.settings.dataToggle}]`)&&e.getAttribute(`data-${this.settings.dataToggle}`).trim().split(" ").forEach(s=>{const n=ot.call(this,s);return n.trigger=e,n.toggle()}),e.matches(`[data-${this.settings.dataOpen}]`)&&e.getAttribute(`data-${this.settings.dataOpen}`).trim().split(" ").forEach(s=>{const n=ot.call(this,s);return n.trigger=e,n.open()}),e.matches(`[data-${this.settings.dataClose}]`)&&e.getAttribute(`data-${this.settings.dataClose}`).trim().split(" ").forEach(s=>{if(s){const n=ot.call(this,s);return n.trigger=e,n.close()}else{const n=t.target.closest(this.settings.selectorDrawer);if(n)return this.close(n)}});return}if(this.activeModal&&t.target.matches(this.settings.selectorScreen))return this.close(this.activeModal.id)}function pi(t){if(t.key==="Escape"&&this.activeModal)return this.close(this.activeModal)}async function Yt(t,e=!0){const i=this.collection.findIndex(s=>s.id===t.id);if(i>=0){const s=this.collection[i];e&&s.state==="opened"&&await s.close(!1),this.store.set(s.id),s.unmountBreakpoint(),Object.getOwnPropertyNames(s).forEach(n=>{delete s[n]}),this.collection.splice(i,1)}return this.collection}async function qt(t,e,i=!0){const s=ot.call(this,t),n={...this.settings,...s.settings};return e!==void 0&&(n.transition=e),(s.state==="closed"||s.state==="indeterminate")&&(s.state="opening",n.transition?await bt(s.el,{start:n.stateClosing,finish:n.stateClosed},{start:n.stateOpening,finish:n.stateOpened},n.transitionDuration):(s.el.classList.add(n.stateOpened),s.el.classList.remove(n.stateClosed)),s.state="opened",s.mode==="modal"&&wt(!0,n),i&&ge.call(this,s),s.el.dispatchEvent(new CustomEvent(n.customEventPrefix+"opened",{detail:this,bubbles:!0}))),s}async function Pt(t,e,i=!0){const s=ot.call(this,t),n={...this.settings,...s.settings};return e!==void 0&&(n.transition=e),(s.state==="opened"||s.state==="indeterminate")&&(s.state="closing",document.activeElement.blur(),n.transition?await bt(s.el,{start:n.stateOpening,finish:n.stateOpened},{start:n.stateClosing,finish:n.stateClosed},n.transitionDuration):(s.el.classList.add(n.stateClosed),s.el.classList.remove(n.stateOpened)),s.state="closed",s.mode==="modal"&&wt(!1,n),i&&ge.call(this,s),s.el.dispatchEvent(new CustomEvent(n.customEventPrefix+"closed",{detail:this,bubbles:!0}))),s}async function ve(t,e,i){const s=ot.call(this,t);return s.state==="closed"?qt.call(this,s,e,i):Pt.call(this,s,e,i)}function gi(t){switch(t.mode){case"inline":return vi.call(this,t);case"modal":return mi.call(this,t);default:throw new Error(`"${t.mode}" is not a valid drawer mode.`)}}async function vi(t){return t.el.classList.remove(t.getSetting("classModal")),t.dialog.removeAttribute("aria-modal"),wt(!1,{...this.settings,...t.settings}),this.focusTrap.unmount(),await ui(t),t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix")+"switchMode",{detail:this,bubbles:!0})),t}async function mi(t){return t.el.classList.add(t.getSetting("classModal")),t.dialog.setAttribute("aria-modal","true"),await Pt.call(this,t,!1,!1),t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix")+"switchMode",{detail:this,bubbles:!0})),t}async function bi(t,e={}){await Yt.call(this,t,!1);const i=this,s=new k;let n,r="indeterminate";const a={id:t.id,el:t,dialog:null,trigger:null,settings:{...zt(t,this.settings.dataConfig),...e},inlineState:"indeterminate",get breakpoint(){return fi.call(i,t)},get store(){return i.store.get(this.id)},get mode(){return n},set mode(o){n=o,gi.call(i,this)},get state(){return r},set state(o){r=o,this.mode==="inline"&&o!="opening"&&o!="closing"&&(this.inlineState=o,this.getSetting("store")&&i.store.set(this.id,o)),o==="indeterminate"&&(this.el.classList.remove(this.getSetting("stateOpened")),this.el.classList.remove(this.getSetting("stateOpening")),this.el.classList.remove(this.getSetting("stateClosed")),this.el.classList.remove(this.getSetting("stateClosing")))},open(o,d){return qt.call(i,this,o,d)},close(o,d){return Pt.call(i,this,o,d)},toggle(o,d){return ve.call(i,this,o,d)},deregister(){return Yt.call(i,this)},mountBreakpoint(){const o=this.breakpoint,d=this.handleBreakpoint.bind(this);return s.mount(o,d),this},unmountBreakpoint(){return s.unmount(),this},handleBreakpoint(o){const d=o.matches?"inline":"modal";return this.mode!=d&&(this.mode=d),this},getSetting(o){return o in this.settings?this.settings[o]:i.settings[o]}};this.collection.push(a);const l=t.querySelector(a.getSetting("selectorDialog"));return a.dialog=l||t,a.getSetting("setTabindex")&&a.dialog.setAttribute("tabindex","-1"),await di(a),a.inlineState=a.state,a.mode=t.classList.contains(a.getSetting("classModal"))?"modal":"inline",a.breakpoint&&a.mountBreakpoint(),a}class wi extends D{constructor(i){super();Y(this,ft);Y(this,ht);this.defaults=ci,this.settings={...this.defaults,...i},this.focusTrap=new Ht,this.store=Kt(this.settings.storeKey,this.settings.store),F(this,ft,hi.bind(this)),F(this,ht,pi.bind(this)),this.settings.autoMount&&this.mount()}get activeModal(){return this.collection.find(i=>i.state==="opened"&&i.mode==="modal")}async mount(i=null){i&&(this.settings={...this.settings,...i});const s=document.querySelectorAll(this.settings.selectorDrawer);return await this.registerCollection(s),this.settings.eventListeners&&this.mountEventListeners(),this}async unmount(){return await this.deregisterCollection(),this.settings.eventListeners&&this.unmountEventListeners(),this}mountEventListeners(){document.addEventListener("click",O(this,ft),!1),document.addEventListener("keydown",O(this,ht),!1)}unmountEventListeners(){document.removeEventListener("click",O(this,ft),!1),document.removeEventListener("keydown",O(this,ht),!1)}register(i,s={}){let n=typeof i=="string"?document.getElementById(i):i;return n?bi.call(this,n,s):Promise.reject(new Error(`Failed to register; drawer not found with ID of: "${i.id||i}".`))}deregister(i){let s=this.get(i.id||i);return s?Yt.call(this,s):Promise.reject(new Error(`Failed to deregister; drawer does not exist in collection with ID of: "${i.id||i}".`))}open(i,s,n){return qt.call(this,i,s,n)}close(i,s,n){return Pt.call(this,i,s,n)}toggle(i,s,n){return ve.call(this,i,s,n)}}ft=new WeakMap,ht=new WeakMap;const yi={autoMount:!1,dataOpen:"modal-open",dataClose:"modal-close",dataReplace:"modal-replace",dataConfig:"modal-config",selectorModal:".modal",selectorDialog:".modal__dialog",selectorScreen:".modal",selectorRequired:'[role="alertdialog"]',selectorFocus:"[data-focus]",selectorInert:null,selectorOverflow:"body",stateOpened:"is-opened",stateOpening:"is-opening",stateClosing:"is-closing",stateClosed:"is-closed",customEventPrefix:"modal:",eventListeners:!0,teleport:null,teleportMethod:"append",setTabindex:!0,transition:!0,transitionDuration:"modal-transition-duration"};function yt(t){const e=typeof t=="string"?this.get(t):this.get(t.id);if(e)return e;throw new Error(`Modal not found in collection with id of "${t.id||t}".`)}function Dt(){this.active?this.focusTrap.mount(this.active.dialog,this.settings.selectorFocus):(this.trigger&&(this.trigger.focus(),this.trigger=null),this.focusTrap.unmount())}async function xi(t){const e=t.target.closest(`
|
|
6
|
+
[data-${this.settings.dataOpen}],
|
|
7
|
+
[data-${this.settings.dataReplace}],
|
|
8
|
+
[data-${this.settings.dataClose}]
|
|
9
|
+
`);if(e){if(t.preventDefault(),e.matches(`[data-${this.settings.dataOpen}]`)){const i=e.getAttribute(`data-${this.settings.dataOpen}`).trim(),s=yt.call(this,i);return t.target.closest(this.settings.selectorModal)||(this.trigger=e),s.open()}if(e.matches(`[data-${this.settings.dataReplace}]`)){const i=e.getAttribute(`data-${this.settings.dataReplace}`).trim(),s=yt.call(this,i);return t.target.closest(this.settings.selectorModal)||(this.trigger=e),s.replace()}if(e.matches(`[data-${this.settings.dataClose}]`)){const i=e.getAttribute(`data-${this.settings.dataClose}`).trim();return i==="*"?this.closeAll():this.close(i)}}if(this.active&&t.target.matches(this.settings.selectorScreen)&&!this.active.required)return this.close(this.active.id)}function Ei(t){if(t.key==="Escape"&&this.active&&!this.active.dialog.matches(this.settings.selectorRequired))return this.close()}async function Ut(t,e=!0){const i=this.collection.findIndex(s=>s.id===t.id);if(i>=0){const s=this.collection[i];e&&s.state==="opened"?await s.close(!1):this.stack.remove(s),s.getSetting("teleport")&&s.teleportReturn(),Object.getOwnPropertyNames(s).forEach(n=>{delete s[n]}),this.collection.splice(i,1)}return this.collection}async function Gt(t,e,i=!0){const s=yt.call(this,t),n={...this.settings,...s.settings};return e!==void 0&&(n.transition=e),this.stack.moveToTop(s),s.state==="closed"&&(s.state="opening",this.stack.add(s),n.transition?await bt(s.el,{start:n.stateClosing,finish:n.stateClosed},{start:n.stateOpening,finish:n.stateOpened},n.transitionDuration):(s.el.classList.add(n.stateOpened),s.el.classList.remove(n.stateClosed)),s.state="opened"),i&&Dt.call(this),s.el.dispatchEvent(new CustomEvent(n.customEventPrefix+"opened",{detail:this,bubbles:!0})),s}async function Jt(t,e,i=!0){const s=t?yt.call(this,t):this.active;if(s&&s.state==="opened"){s.state="closing";const n={...this.settings,...s.settings};e!==void 0&&(n.transition=e),document.activeElement.blur(),n.transition?await bt(s.el,{start:n.stateOpening,finish:n.stateOpened},{start:n.stateClosing,finish:n.stateClosed},n.transitionDuration):(s.el.classList.add(n.stateClosed),s.el.classList.remove(n.stateOpened)),this.stack.remove(s),s.state="closed",i&&Dt.call(this),s.el.dispatchEvent(new CustomEvent(n.customEventPrefix+"closed",{detail:this,bubbles:!0}))}return s}async function Qt(t,e){const i=[];return await Promise.all(this.stack.value.map(async s=>{t&&t===s.id?Promise.resolve():i.push(await Jt.call(this,s,e,!1)),s.trigger=null})),i}async function me(t,e,i=!0){const s=yt.call(this,t);let n,r;return s.state==="opened"?(n=s,r=await Qt.call(this,s.id,e)):(r=Qt.call(this,!1,e),n=Gt.call(this,s,e,!1),await Promise.all([n,r])),i&&Dt.call(this),{opened:n,closed:r}}async function Oi(t,e={}){await Ut.call(this,t,!1);const i=this,s={id:t.id,state:"closed",el:t,dialog:null,get required(){return this.dialog.matches(this.getSetting("selectorRequired"))},returnRef:null,settings:{...zt(t,this.settings.dataConfig),...e},open(r,a){return Gt.call(i,this,r,a)},close(r,a){return Jt.call(i,this,r,a)},replace(r,a){return me.call(i,this,r,a)},deregister(){return Ut.call(i,this)},teleport(r=this.getSetting("teleport"),a=this.getSetting("teleportMethod")){return this.returnRef?(console.error("Element has already been teleported:",this.el),!1):(this.returnRef=Xt(this.el,r,a),this.el)},teleportReturn(){return this.returnRef?(this.returnRef=Xt(this.el,this.returnRef),this.el):(console.error("No return reference found:",this.el),!1)},getSetting(r){return r in this.settings?this.settings[r]:i.settings[r]}},n=t.querySelector(s.getSetting("selectorDialog"));return s.dialog=n||t,s.dialog.setAttribute("aria-modal","true"),s.dialog.hasAttribute("role")||s.dialog.setAttribute("role","dialog"),s.getSetting("setTabindex")&&s.dialog.setAttribute("tabindex","-1"),s.getSetting("teleport")&&s.teleport(),this.collection.push(s),s.el.classList.contains(this.settings.stateOpened)?await s.open(!1):(s.el.classList.remove(this.settings.stateOpening),s.el.classList.remove(this.settings.stateClosing),s.el.classList.add(this.settings.stateClosed)),s}function $i(t){const e=[];return{get value(){return[...e]},get top(){return e[e.length-1]},updateIndex(){e.forEach((i,s)=>{i.el.style.zIndex=null;const n=getComputedStyle(i.el)["z-index"];i.el.style.zIndex=parseInt(n)+s+1})},updateGlobalState(){wt(this.top,t),this.updateIndex()},add(i){i.el.style.zIndex=null;const s=getComputedStyle(i.el)["z-index"];i.el.style.zIndex=parseInt(s)+e.length+1,e.push(i),this.updateGlobalState()},remove(i){const s=e.findIndex(n=>n.id===i.id);s>=0&&(i.el.style.zIndex=null,e.splice(s,1),this.updateGlobalState())},moveToTop(i){const s=e.findIndex(n=>n.id===i.id);s>=0&&(e.splice(s,1),this.add(i))}}}class Li extends D{constructor(i){super();Y(this,pt);Y(this,gt);this.defaults=yi,this.settings={...this.defaults,...i},this.trigger=null,this.focusTrap=new Ht,this.stack=$i(this.settings),F(this,pt,xi.bind(this)),F(this,gt,Ei.bind(this)),this.settings.autoMount&&this.mount()}get active(){return this.stack.top}async mount(i){i&&(this.settings={...this.settings,...i});const s=document.querySelectorAll(this.settings.selectorModal);return await this.registerCollection(s),this.settings.eventListeners&&this.mountEventListeners(),this}async unmount(){return this.trigger=null,await this.deregisterCollection(),this.settings.eventListeners&&this.unmountEventListeners(),this}mountEventListeners(){document.addEventListener("click",O(this,pt),!1),document.addEventListener("keydown",O(this,gt),!1)}unmountEventListeners(){document.removeEventListener("click",O(this,pt),!1),document.removeEventListener("keydown",O(this,gt),!1)}register(i,s={}){let n=typeof i=="string"?document.getElementById(i):i;return n?Oi.call(this,n,s):Promise.reject(new Error(`Failed to register; modal not found with ID of: "${i.id||i}".`))}deregister(i){let s=this.get(i.id||i);return s?Ut.call(this,s):Promise.reject(new Error(`Failed to deregister; modal does not exist in collection with ID of: "${i.id||i}".`))}open(i,s,n){return Gt.call(this,i,s,n)}close(i,s,n){return Jt.call(this,i,s,n)}replace(i,s,n){return me.call(this,i,s,n)}async closeAll(i=!1,s,n=!0){const r=await Qt.call(this,i,s);return n&&Dt.call(this),r}}pt=new WeakMap,gt=new WeakMap;const Ci={autoMount:!1,selectorPopover:".popover",selectorArrow:".popover__arrow",stateActive:"is-active",eventListeners:!0,eventType:"click",placement:"bottom",hoverToggleDelay:0};function be(t,e){const i=getComputedStyle(t),s={placement:e.placement,event:e.eventType,offset:0,"overflow-padding":0,"flip-padding":0,"arrow-element":e.selectorArrow,"arrow-padding":0,"toggle-delay":e.hoverToggleDelay};for(const n in s){const r=Tt(),a=i.getPropertyValue(`--${r}popover-${n}`).trim();a&&(s[n]=a)}return s}function Zt(t){let e;const i=typeof t=="string"?t.trim().split(" "):[t];switch(i.forEach(function(s,n){i[n]=parseInt(s,10)}),i.length){case 1:e=i[0];break;case 2:e={top:i[0],right:i[1],bottom:i[0],left:i[1]};break;case 3:e={top:i[0],right:i[1],bottom:i[2],left:i[1]};break;case 4:e={top:i[0],right:i[1],bottom:i[2],left:i[3]};break;default:e=!1;break}return e}function we(t){return[{name:"offset",options:{offset:[0,parseInt(t.offset,10)]}},{name:"preventOverflow",options:{padding:Zt(t["overflow-padding"])}},{name:"flip",options:{padding:Zt(t["flip-padding"])}},{name:"arrow",options:{element:t["arrow-element"],padding:Zt(t["arrow-padding"])}}]}function ye(t){const e=typeof t=="string"?this.get(t):this.get(t.id);if(e)return e;throw new Error(`Popover not found in collection with id of "${t}".`)}function ki(t){return typeof t=="string"?t:typeof t.hasAttribute=="function"?t.closest(this.settings.selectorPopover)?(t=t.closest(this.settings.selectorPopover),t.id):t.hasAttribute("aria-controls")?t.getAttribute("aria-controls"):t.hasAttribute("aria-describedby")?t.getAttribute("aria-describedby"):!1:!1}function Si(t){const e=ki.call(this,t);if(e){const i=document.querySelector(`#${e}`),s=document.querySelector(`[aria-controls="${e}"]`)||document.querySelector(`[aria-describedby="${e}"]`);return!s&&!i?{error:new Error(`No popover elements found using the ID: "${e}".`)}:s?i?{popover:i,trigger:s}:{error:new Error("No popover associated with the provided popover trigger.")}:{error:new Error("No popover trigger associated with the provided popover.")}}else return{error:new Error("Could not resolve the popover ID.")}}async function te(t){const e=t?ye.call(this,t):await xe.call(this);return e&&e.state==="opened"&&(e.el.classList.remove(this.settings.stateActive),e.trigger.hasAttribute("aria-controls")&&e.trigger.setAttribute("aria-expanded","false"),e.popper.setOptions({placement:e.config.placement,modifiers:[{name:"eventListeners",enabled:!1},...we(e.config)]}),e.state="closed",e.trigger===this.trigger&&(this.trigger=null)),e}async function xe(){const t=[];return await Promise.all(this.collection.map(async e=>{e.state==="opened"&&t.push(await te.call(this,e))})),t}function Ee(t){t.state=="opened"&&setTimeout(()=>{const e=t.el.closest(":hover")===t.el||t.trigger.closest(":hover")===t.trigger,i=document.activeElement.closest(`#${t.id}, [aria-controls="${t.id}"], [aria-describedby="${t.id}"]`);return!e&&!i&&t.close(),t},1)}function Ai(t){t.state==="opened"?t.close():(this.trigger=t.trigger,t.open(),Oe.call(this,t))}function Ti(t){t.toggleDelayId&&clearTimeout(t.toggleDelayId);const e=this.activeTooltip?0:t.config["toggle-delay"];this.activeTooltip&&this.activeTooltip.close(),t.toggleDelayId=setTimeout(()=>{t.open()},e)}function Pi(t){t.toggleDelayId&&clearTimeout(t.toggleDelayId),t.toggleDelayId=setTimeout(()=>{Ee.call(this,t)},t.config["toggle-delay"])}function Di(t){switch(t.key){case"Escape":this.trigger&&this.trigger.focus(),xe.call(this);return;case"Tab":this.collection.forEach(e=>{Ee.call(this,e)});return;default:return}}function Oe(t){const e=this;document.addEventListener("click",function i(s){s.target.closest(`#${t.id}, [aria-controls="${t.id}"], [aria-describedby="${t.id}"]`)?t.el&&!t.el.classList.contains(e.settings.stateActive)&&this.removeEventListener("click",i):(t.el&&t.el.classList.contains(e.settings.stateActive)&&t.close(),this.removeEventListener("click",i))})}var M="top",N="bottom",V="right",R="left",ee="auto",xt=[M,N,V,R],at="start",Et="end",Ii="clippingParents",$e="viewport",Ot="popper",Mi="reference",Le=xt.reduce(function(t,e){return t.concat([e+"-"+at,e+"-"+Et])},[]),Ce=[].concat(xt,[ee]).reduce(function(t,e){return t.concat([e,e+"-"+at,e+"-"+Et])},[]),Ri="beforeRead",Bi="read",ji="afterRead",Fi="beforeMain",Ni="main",Vi="afterMain",Wi="beforeWrite",Hi="write",_i="afterWrite",zi=[Ri,Bi,ji,Fi,Ni,Vi,Wi,Hi,_i];function K(t){return t?(t.nodeName||"").toLowerCase():null}function B(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function J(t){var e=B(t).Element;return t instanceof e||t instanceof Element}function W(t){var e=B(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function ie(t){if(typeof ShadowRoot>"u")return!1;var e=B(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function Ki(t){var e=t.state;Object.keys(e.elements).forEach(function(i){var s=e.styles[i]||{},n=e.attributes[i]||{},r=e.elements[i];!W(r)||!K(r)||(Object.assign(r.style,s),Object.keys(n).forEach(function(a){var l=n[a];l===!1?r.removeAttribute(a):r.setAttribute(a,l===!0?"":l)}))})}function Xi(t){var e=t.state,i={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,i.popper),e.styles=i,e.elements.arrow&&Object.assign(e.elements.arrow.style,i.arrow),function(){Object.keys(e.elements).forEach(function(s){var n=e.elements[s],r=e.attributes[s]||{},a=Object.keys(e.styles.hasOwnProperty(s)?e.styles[s]:i[s]),l=a.reduce(function(o,d){return o[d]="",o},{});!W(n)||!K(n)||(Object.assign(n.style,l),Object.keys(r).forEach(function(o){n.removeAttribute(o)}))})}}const Yi={name:"applyStyles",enabled:!0,phase:"write",fn:Ki,effect:Xi,requires:["computeStyles"]};function X(t){return t.split("-")[0]}var Q=Math.max,It=Math.min,lt=Math.round;function se(){var t=navigator.userAgentData;return t!=null&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function ke(){return!/^((?!chrome|android).)*safari/i.test(se())}function ct(t,e,i){e===void 0&&(e=!1),i===void 0&&(i=!1);var s=t.getBoundingClientRect(),n=1,r=1;e&&W(t)&&(n=t.offsetWidth>0&<(s.width)/t.offsetWidth||1,r=t.offsetHeight>0&<(s.height)/t.offsetHeight||1);var a=J(t)?B(t):window,l=a.visualViewport,o=!ke()&&i,d=(s.left+(o&&l?l.offsetLeft:0))/n,c=(s.top+(o&&l?l.offsetTop:0))/r,v=s.width/n,w=s.height/r;return{width:v,height:w,top:c,right:d+v,bottom:c+w,left:d,x:d,y:c}}function ne(t){var e=ct(t),i=t.offsetWidth,s=t.offsetHeight;return Math.abs(e.width-i)<=1&&(i=e.width),Math.abs(e.height-s)<=1&&(s=e.height),{x:t.offsetLeft,y:t.offsetTop,width:i,height:s}}function Se(t,e){var i=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(i&&ie(i)){var s=e;do{if(s&&t.isSameNode(s))return!0;s=s.parentNode||s.host}while(s)}return!1}function q(t){return B(t).getComputedStyle(t)}function qi(t){return["table","td","th"].indexOf(K(t))>=0}function U(t){return((J(t)?t.ownerDocument:t.document)||window.document).documentElement}function Mt(t){return K(t)==="html"?t:t.assignedSlot||t.parentNode||(ie(t)?t.host:null)||U(t)}function Ae(t){return!W(t)||q(t).position==="fixed"?null:t.offsetParent}function Ui(t){var e=/firefox/i.test(se()),i=/Trident/i.test(se());if(i&&W(t)){var s=q(t);if(s.position==="fixed")return null}var n=Mt(t);for(ie(n)&&(n=n.host);W(n)&&["html","body"].indexOf(K(n))<0;){var r=q(n);if(r.transform!=="none"||r.perspective!=="none"||r.contain==="paint"||["transform","perspective"].indexOf(r.willChange)!==-1||e&&r.willChange==="filter"||e&&r.filter&&r.filter!=="none")return n;n=n.parentNode}return null}function $t(t){for(var e=B(t),i=Ae(t);i&&qi(i)&&q(i).position==="static";)i=Ae(i);return i&&(K(i)==="html"||K(i)==="body"&&q(i).position==="static")?e:i||Ui(t)||e}function re(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function Lt(t,e,i){return Q(t,It(e,i))}function Gi(t,e,i){var s=Lt(t,e,i);return s>i?i:s}function Te(){return{top:0,right:0,bottom:0,left:0}}function Pe(t){return Object.assign({},Te(),t)}function De(t,e){return e.reduce(function(i,s){return i[s]=t,i},{})}var Ji=function(e,i){return e=typeof e=="function"?e(Object.assign({},i.rects,{placement:i.placement})):e,Pe(typeof e!="number"?e:De(e,xt))};function Qi(t){var e,i=t.state,s=t.name,n=t.options,r=i.elements.arrow,a=i.modifiersData.popperOffsets,l=X(i.placement),o=re(l),d=[R,V].indexOf(l)>=0,c=d?"height":"width";if(!(!r||!a)){var v=Ji(n.padding,i),w=ne(r),u=o==="y"?M:R,E=o==="y"?N:V,g=i.rects.reference[c]+i.rects.reference[o]-a[o]-i.rects.popper[c],p=a[o]-i.rects.reference[o],x=$t(r),L=x?o==="y"?x.clientHeight||0:x.clientWidth||0:0,C=g/2-p/2,f=v[u],m=L-w[c]-v[E],b=L/2-w[c]/2+C,$=Lt(f,b,m),T=o;i.modifiersData[s]=(e={},e[T]=$,e.centerOffset=$-b,e)}}function Zi(t){var e=t.state,i=t.options,s=i.element,n=s===void 0?"[data-popper-arrow]":s;n!=null&&(typeof n=="string"&&(n=e.elements.popper.querySelector(n),!n)||Se(e.elements.popper,n)&&(e.elements.arrow=n))}const ts={name:"arrow",enabled:!0,phase:"main",fn:Qi,effect:Zi,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function dt(t){return t.split("-")[1]}var es={top:"auto",right:"auto",bottom:"auto",left:"auto"};function is(t,e){var i=t.x,s=t.y,n=e.devicePixelRatio||1;return{x:lt(i*n)/n||0,y:lt(s*n)/n||0}}function Ie(t){var e,i=t.popper,s=t.popperRect,n=t.placement,r=t.variation,a=t.offsets,l=t.position,o=t.gpuAcceleration,d=t.adaptive,c=t.roundOffsets,v=t.isFixed,w=a.x,u=w===void 0?0:w,E=a.y,g=E===void 0?0:E,p=typeof c=="function"?c({x:u,y:g}):{x:u,y:g};u=p.x,g=p.y;var x=a.hasOwnProperty("x"),L=a.hasOwnProperty("y"),C=R,f=M,m=window;if(d){var b=$t(i),$="clientHeight",T="clientWidth";if(b===B(i)&&(b=U(i),q(b).position!=="static"&&l==="absolute"&&($="scrollHeight",T="scrollWidth")),b=b,n===M||(n===R||n===V)&&r===Et){f=N;var A=v&&b===m&&m.visualViewport?m.visualViewport.height:b[$];g-=A-s.height,g*=o?1:-1}if(n===R||(n===M||n===N)&&r===Et){C=V;var S=v&&b===m&&m.visualViewport?m.visualViewport.width:b[T];u-=S-s.width,u*=o?1:-1}}var P=Object.assign({position:l},d&&es),_=c===!0?is({x:u,y:g},B(i)):{x:u,y:g};if(u=_.x,g=_.y,o){var I;return Object.assign({},P,(I={},I[f]=L?"0":"",I[C]=x?"0":"",I.transform=(m.devicePixelRatio||1)<=1?"translate("+u+"px, "+g+"px)":"translate3d("+u+"px, "+g+"px, 0)",I))}return Object.assign({},P,(e={},e[f]=L?g+"px":"",e[C]=x?u+"px":"",e.transform="",e))}function ss(t){var e=t.state,i=t.options,s=i.gpuAcceleration,n=s===void 0?!0:s,r=i.adaptive,a=r===void 0?!0:r,l=i.roundOffsets,o=l===void 0?!0:l,d={placement:X(e.placement),variation:dt(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:n,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,Ie(Object.assign({},d,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:a,roundOffsets:o})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,Ie(Object.assign({},d,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:o})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const ns={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:ss,data:{}};var Rt={passive:!0};function rs(t){var e=t.state,i=t.instance,s=t.options,n=s.scroll,r=n===void 0?!0:n,a=s.resize,l=a===void 0?!0:a,o=B(e.elements.popper),d=[].concat(e.scrollParents.reference,e.scrollParents.popper);return r&&d.forEach(function(c){c.addEventListener("scroll",i.update,Rt)}),l&&o.addEventListener("resize",i.update,Rt),function(){r&&d.forEach(function(c){c.removeEventListener("scroll",i.update,Rt)}),l&&o.removeEventListener("resize",i.update,Rt)}}const os={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:rs,data:{}};var as={left:"right",right:"left",bottom:"top",top:"bottom"};function Bt(t){return t.replace(/left|right|bottom|top/g,function(e){return as[e]})}var ls={start:"end",end:"start"};function Me(t){return t.replace(/start|end/g,function(e){return ls[e]})}function oe(t){var e=B(t),i=e.pageXOffset,s=e.pageYOffset;return{scrollLeft:i,scrollTop:s}}function ae(t){return ct(U(t)).left+oe(t).scrollLeft}function cs(t,e){var i=B(t),s=U(t),n=i.visualViewport,r=s.clientWidth,a=s.clientHeight,l=0,o=0;if(n){r=n.width,a=n.height;var d=ke();(d||!d&&e==="fixed")&&(l=n.offsetLeft,o=n.offsetTop)}return{width:r,height:a,x:l+ae(t),y:o}}function ds(t){var e,i=U(t),s=oe(t),n=(e=t.ownerDocument)==null?void 0:e.body,r=Q(i.scrollWidth,i.clientWidth,n?n.scrollWidth:0,n?n.clientWidth:0),a=Q(i.scrollHeight,i.clientHeight,n?n.scrollHeight:0,n?n.clientHeight:0),l=-s.scrollLeft+ae(t),o=-s.scrollTop;return q(n||i).direction==="rtl"&&(l+=Q(i.clientWidth,n?n.clientWidth:0)-r),{width:r,height:a,x:l,y:o}}function le(t){var e=q(t),i=e.overflow,s=e.overflowX,n=e.overflowY;return/auto|scroll|overlay|hidden/.test(i+n+s)}function Re(t){return["html","body","#document"].indexOf(K(t))>=0?t.ownerDocument.body:W(t)&&le(t)?t:Re(Mt(t))}function Ct(t,e){var i;e===void 0&&(e=[]);var s=Re(t),n=s===((i=t.ownerDocument)==null?void 0:i.body),r=B(s),a=n?[r].concat(r.visualViewport||[],le(s)?s:[]):s,l=e.concat(a);return n?l:l.concat(Ct(Mt(a)))}function ce(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function us(t,e){var i=ct(t,!1,e==="fixed");return i.top=i.top+t.clientTop,i.left=i.left+t.clientLeft,i.bottom=i.top+t.clientHeight,i.right=i.left+t.clientWidth,i.width=t.clientWidth,i.height=t.clientHeight,i.x=i.left,i.y=i.top,i}function Be(t,e,i){return e===$e?ce(cs(t,i)):J(e)?us(e,i):ce(ds(U(t)))}function fs(t){var e=Ct(Mt(t)),i=["absolute","fixed"].indexOf(q(t).position)>=0,s=i&&W(t)?$t(t):t;return J(s)?e.filter(function(n){return J(n)&&Se(n,s)&&K(n)!=="body"}):[]}function hs(t,e,i,s){var n=e==="clippingParents"?fs(t):[].concat(e),r=[].concat(n,[i]),a=r[0],l=r.reduce(function(o,d){var c=Be(t,d,s);return o.top=Q(c.top,o.top),o.right=It(c.right,o.right),o.bottom=It(c.bottom,o.bottom),o.left=Q(c.left,o.left),o},Be(t,a,s));return l.width=l.right-l.left,l.height=l.bottom-l.top,l.x=l.left,l.y=l.top,l}function je(t){var e=t.reference,i=t.element,s=t.placement,n=s?X(s):null,r=s?dt(s):null,a=e.x+e.width/2-i.width/2,l=e.y+e.height/2-i.height/2,o;switch(n){case M:o={x:a,y:e.y-i.height};break;case N:o={x:a,y:e.y+e.height};break;case V:o={x:e.x+e.width,y:l};break;case R:o={x:e.x-i.width,y:l};break;default:o={x:e.x,y:e.y}}var d=n?re(n):null;if(d!=null){var c=d==="y"?"height":"width";switch(r){case at:o[d]=o[d]-(e[c]/2-i[c]/2);break;case Et:o[d]=o[d]+(e[c]/2-i[c]/2);break}}return o}function kt(t,e){e===void 0&&(e={});var i=e,s=i.placement,n=s===void 0?t.placement:s,r=i.strategy,a=r===void 0?t.strategy:r,l=i.boundary,o=l===void 0?Ii:l,d=i.rootBoundary,c=d===void 0?$e:d,v=i.elementContext,w=v===void 0?Ot:v,u=i.altBoundary,E=u===void 0?!1:u,g=i.padding,p=g===void 0?0:g,x=Pe(typeof p!="number"?p:De(p,xt)),L=w===Ot?Mi:Ot,C=t.rects.popper,f=t.elements[E?L:w],m=hs(J(f)?f:f.contextElement||U(t.elements.popper),o,c,a),b=ct(t.elements.reference),$=je({reference:b,element:C,strategy:"absolute",placement:n}),T=ce(Object.assign({},C,$)),A=w===Ot?T:b,S={top:m.top-A.top+x.top,bottom:A.bottom-m.bottom+x.bottom,left:m.left-A.left+x.left,right:A.right-m.right+x.right},P=t.modifiersData.offset;if(w===Ot&&P){var _=P[n];Object.keys(S).forEach(function(I){var et=[V,N].indexOf(I)>=0?1:-1,it=[M,N].indexOf(I)>=0?"y":"x";S[I]+=_[it]*et})}return S}function ps(t,e){e===void 0&&(e={});var i=e,s=i.placement,n=i.boundary,r=i.rootBoundary,a=i.padding,l=i.flipVariations,o=i.allowedAutoPlacements,d=o===void 0?Ce:o,c=dt(s),v=c?l?Le:Le.filter(function(E){return dt(E)===c}):xt,w=v.filter(function(E){return d.indexOf(E)>=0});w.length===0&&(w=v);var u=w.reduce(function(E,g){return E[g]=kt(t,{placement:g,boundary:n,rootBoundary:r,padding:a})[X(g)],E},{});return Object.keys(u).sort(function(E,g){return u[E]-u[g]})}function gs(t){if(X(t)===ee)return[];var e=Bt(t);return[Me(t),e,Me(e)]}function vs(t){var e=t.state,i=t.options,s=t.name;if(!e.modifiersData[s]._skip){for(var n=i.mainAxis,r=n===void 0?!0:n,a=i.altAxis,l=a===void 0?!0:a,o=i.fallbackPlacements,d=i.padding,c=i.boundary,v=i.rootBoundary,w=i.altBoundary,u=i.flipVariations,E=u===void 0?!0:u,g=i.allowedAutoPlacements,p=e.options.placement,x=X(p),L=x===p,C=o||(L||!E?[Bt(p)]:gs(p)),f=[p].concat(C).reduce(function(mt,G){return mt.concat(X(G)===ee?ps(e,{placement:G,boundary:c,rootBoundary:v,padding:d,flipVariations:E,allowedAutoPlacements:g}):G)},[]),m=e.rects.reference,b=e.rects.popper,$=new Map,T=!0,A=f[0],S=0;S<f.length;S++){var P=f[S],_=X(P),I=dt(P)===at,et=[M,N].indexOf(_)>=0,it=et?"width":"height",j=kt(e,{placement:P,boundary:c,rootBoundary:v,altBoundary:w,padding:d}),z=et?I?V:R:I?N:M;m[it]>b[it]&&(z=Bt(z));var jt=Bt(z),st=[];if(r&&st.push(j[_]<=0),l&&st.push(j[z]<=0,j[jt]<=0),st.every(function(mt){return mt})){A=P,T=!1;break}$.set(P,st)}if(T)for(var Ft=E?3:1,ue=function(G){var At=f.find(function(Vt){var nt=$.get(Vt);if(nt)return nt.slice(0,G).every(function(fe){return fe})});if(At)return A=At,"break"},St=Ft;St>0;St--){var Nt=ue(St);if(Nt==="break")break}e.placement!==A&&(e.modifiersData[s]._skip=!0,e.placement=A,e.reset=!0)}}const ms={name:"flip",enabled:!0,phase:"main",fn:vs,requiresIfExists:["offset"],data:{_skip:!1}};function Fe(t,e,i){return i===void 0&&(i={x:0,y:0}),{top:t.top-e.height-i.y,right:t.right-e.width+i.x,bottom:t.bottom-e.height+i.y,left:t.left-e.width-i.x}}function Ne(t){return[M,V,N,R].some(function(e){return t[e]>=0})}function bs(t){var e=t.state,i=t.name,s=e.rects.reference,n=e.rects.popper,r=e.modifiersData.preventOverflow,a=kt(e,{elementContext:"reference"}),l=kt(e,{altBoundary:!0}),o=Fe(a,s),d=Fe(l,n,r),c=Ne(o),v=Ne(d);e.modifiersData[i]={referenceClippingOffsets:o,popperEscapeOffsets:d,isReferenceHidden:c,hasPopperEscaped:v},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":v})}const ws={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:bs};function ys(t,e,i){var s=X(t),n=[R,M].indexOf(s)>=0?-1:1,r=typeof i=="function"?i(Object.assign({},e,{placement:t})):i,a=r[0],l=r[1];return a=a||0,l=(l||0)*n,[R,V].indexOf(s)>=0?{x:l,y:a}:{x:a,y:l}}function xs(t){var e=t.state,i=t.options,s=t.name,n=i.offset,r=n===void 0?[0,0]:n,a=Ce.reduce(function(c,v){return c[v]=ys(v,e.rects,r),c},{}),l=a[e.placement],o=l.x,d=l.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=o,e.modifiersData.popperOffsets.y+=d),e.modifiersData[s]=a}const Es={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:xs};function Os(t){var e=t.state,i=t.name;e.modifiersData[i]=je({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const $s={name:"popperOffsets",enabled:!0,phase:"read",fn:Os,data:{}};function Ls(t){return t==="x"?"y":"x"}function Cs(t){var e=t.state,i=t.options,s=t.name,n=i.mainAxis,r=n===void 0?!0:n,a=i.altAxis,l=a===void 0?!1:a,o=i.boundary,d=i.rootBoundary,c=i.altBoundary,v=i.padding,w=i.tether,u=w===void 0?!0:w,E=i.tetherOffset,g=E===void 0?0:E,p=kt(e,{boundary:o,rootBoundary:d,padding:v,altBoundary:c}),x=X(e.placement),L=dt(e.placement),C=!L,f=re(x),m=Ls(f),b=e.modifiersData.popperOffsets,$=e.rects.reference,T=e.rects.popper,A=typeof g=="function"?g(Object.assign({},e.rects,{placement:e.placement})):g,S=typeof A=="number"?{mainAxis:A,altAxis:A}:Object.assign({mainAxis:0,altAxis:0},A),P=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,_={x:0,y:0};if(b){if(r){var I,et=f==="y"?M:R,it=f==="y"?N:V,j=f==="y"?"height":"width",z=b[f],jt=z+p[et],st=z-p[it],Ft=u?-T[j]/2:0,ue=L===at?$[j]:T[j],St=L===at?-T[j]:-$[j],Nt=e.elements.arrow,mt=u&&Nt?ne(Nt):{width:0,height:0},G=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Te(),At=G[et],Vt=G[it],nt=Lt(0,$[j],mt[j]),fe=C?$[j]/2-Ft-nt-At-S.mainAxis:ue-nt-At-S.mainAxis,Ws=C?-$[j]/2+Ft+nt+Vt+S.mainAxis:St+nt+Vt+S.mainAxis,he=e.elements.arrow&&$t(e.elements.arrow),Hs=he?f==="y"?he.clientTop||0:he.clientLeft||0:0,Ke=(I=P==null?void 0:P[f])!=null?I:0,_s=z+fe-Ke-Hs,zs=z+Ws-Ke,Xe=Lt(u?It(jt,_s):jt,z,u?Q(st,zs):st);b[f]=Xe,_[f]=Xe-z}if(l){var Ye,Ks=f==="x"?M:R,Xs=f==="x"?N:V,rt=b[m],Wt=m==="y"?"height":"width",qe=rt+p[Ks],Ue=rt-p[Xs],pe=[M,R].indexOf(x)!==-1,Ge=(Ye=P==null?void 0:P[m])!=null?Ye:0,Je=pe?qe:rt-$[Wt]-T[Wt]-Ge+S.altAxis,Qe=pe?rt+$[Wt]+T[Wt]-Ge-S.altAxis:Ue,Ze=u&&pe?Gi(Je,rt,Qe):Lt(u?Je:qe,rt,u?Qe:Ue);b[m]=Ze,_[m]=Ze-rt}e.modifiersData[s]=_}}const ks={name:"preventOverflow",enabled:!0,phase:"main",fn:Cs,requiresIfExists:["offset"]};function Ss(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function As(t){return t===B(t)||!W(t)?oe(t):Ss(t)}function Ts(t){var e=t.getBoundingClientRect(),i=lt(e.width)/t.offsetWidth||1,s=lt(e.height)/t.offsetHeight||1;return i!==1||s!==1}function Ps(t,e,i){i===void 0&&(i=!1);var s=W(e),n=W(e)&&Ts(e),r=U(e),a=ct(t,n,i),l={scrollLeft:0,scrollTop:0},o={x:0,y:0};return(s||!s&&!i)&&((K(e)!=="body"||le(r))&&(l=As(e)),W(e)?(o=ct(e,!0),o.x+=e.clientLeft,o.y+=e.clientTop):r&&(o.x=ae(r))),{x:a.left+l.scrollLeft-o.x,y:a.top+l.scrollTop-o.y,width:a.width,height:a.height}}function Ds(t){var e=new Map,i=new Set,s=[];t.forEach(function(r){e.set(r.name,r)});function n(r){i.add(r.name);var a=[].concat(r.requires||[],r.requiresIfExists||[]);a.forEach(function(l){if(!i.has(l)){var o=e.get(l);o&&n(o)}}),s.push(r)}return t.forEach(function(r){i.has(r.name)||n(r)}),s}function Is(t){var e=Ds(t);return zi.reduce(function(i,s){return i.concat(e.filter(function(n){return n.phase===s}))},[])}function Ms(t){var e;return function(){return e||(e=new Promise(function(i){Promise.resolve().then(function(){e=void 0,i(t())})})),e}}function Rs(t){var e=t.reduce(function(i,s){var n=i[s.name];return i[s.name]=n?Object.assign({},n,s,{options:Object.assign({},n.options,s.options),data:Object.assign({},n.data,s.data)}):s,i},{});return Object.keys(e).map(function(i){return e[i]})}var Ve={placement:"bottom",modifiers:[],strategy:"absolute"};function We(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return!e.some(function(s){return!(s&&typeof s.getBoundingClientRect=="function")})}function Bs(t){t===void 0&&(t={});var e=t,i=e.defaultModifiers,s=i===void 0?[]:i,n=e.defaultOptions,r=n===void 0?Ve:n;return function(l,o,d){d===void 0&&(d=r);var c={placement:"bottom",orderedModifiers:[],options:Object.assign({},Ve,r),modifiersData:{},elements:{reference:l,popper:o},attributes:{},styles:{}},v=[],w=!1,u={state:c,setOptions:function(x){var L=typeof x=="function"?x(c.options):x;g(),c.options=Object.assign({},r,c.options,L),c.scrollParents={reference:J(l)?Ct(l):l.contextElement?Ct(l.contextElement):[],popper:Ct(o)};var C=Is(Rs([].concat(s,c.options.modifiers)));return c.orderedModifiers=C.filter(function(f){return f.enabled}),E(),u.update()},forceUpdate:function(){if(!w){var x=c.elements,L=x.reference,C=x.popper;if(We(L,C)){c.rects={reference:Ps(L,$t(C),c.options.strategy==="fixed"),popper:ne(C)},c.reset=!1,c.placement=c.options.placement,c.orderedModifiers.forEach(function(S){return c.modifiersData[S.name]=Object.assign({},S.data)});for(var f=0;f<c.orderedModifiers.length;f++){if(c.reset===!0){c.reset=!1,f=-1;continue}var m=c.orderedModifiers[f],b=m.fn,$=m.options,T=$===void 0?{}:$,A=m.name;typeof b=="function"&&(c=b({state:c,options:T,name:A,instance:u})||c)}}}},update:Ms(function(){return new Promise(function(p){u.forceUpdate(),p(c)})}),destroy:function(){g(),w=!0}};if(!We(l,o))return u;u.setOptions(d).then(function(p){!w&&d.onFirstUpdate&&d.onFirstUpdate(p)});function E(){c.orderedModifiers.forEach(function(p){var x=p.name,L=p.options,C=L===void 0?{}:L,f=p.effect;if(typeof f=="function"){var m=f({state:c,name:x,instance:u,options:C}),b=function(){};v.push(m||b)}})}function g(){v.forEach(function(p){return p()}),v=[]}return u}}var js=[os,$s,ns,Yi,Es,ms,ks,ts,ws],Fs=Bs({defaultModifiers:js});async function de(t){const e=this.collection.findIndex(i=>i.id===t.id);if(e>=0){const i=this.collection[e];i.state==="opened"&&i.close(),i.popper.destroy(),He(i),Object.getOwnPropertyNames(i).forEach(s=>{delete i[s]}),this.collection.splice(e,1)}return this.collection}function He(t){return t.__eventListeners&&(t.__eventListeners.forEach(e=>{e.el.forEach(i=>{e.type.forEach(s=>{t[i].removeEventListener(s,e.listener,!1)})})}),delete t.__eventListeners),t}async function _e(t){const e=ye.call(this,t);return e.el.classList.add(this.settings.stateActive),e.trigger.hasAttribute("aria-controls")&&e.trigger.setAttribute("aria-expanded","true"),e.config=be(e.el,this.settings),e.popper.setOptions({placement:e.config.placement,modifiers:[{name:"eventListeners",enabled:!0},...we(e.config)]}),e.popper.update(),e.state="opened",e}async function Ns(t,e){de.call(this,t);const i=this,s={id:t.id,state:"closed",el:t,trigger:e,toggleDelayId:null,popper:Fs(e,t),config:be(t,this.settings),get isTooltip(){return e.hasAttribute("aria-describedby")},open(){return _e.call(i,this)},close(){return te.call(i,this)},deregister(){return de.call(i,this)}};return s.trigger.hasAttribute("aria-controls")&&s.trigger.setAttribute("aria-expanded","false"),ze.call(this,s),this.collection.push(s),s.el.classList.contains(this.settings.stateActive)&&(await s.open(),Oe.call(this,s)),s.popper.setOptions({placement:s.config.placement}),s}function ze(t){return t.__eventListeners||(t.config.event==="hover"?(t.__eventListeners=[{el:["trigger"],type:["mouseenter","focus"],listener:Ti.bind(this,t)},{el:["el","trigger"],type:["mouseleave","focusout"],listener:Pi.bind(this,t)}],t.__eventListeners.forEach(i=>{i.el.forEach(s=>{i.type.forEach(n=>{t[s].addEventListener(n,i.listener,!1)})})})):(t.__eventListeners=[{el:["trigger"],type:["click"],listener:Ai.bind(this,t)}],t.__eventListeners.forEach(i=>{i.el.forEach(s=>{i.type.forEach(n=>{t[s].addEventListener(n,i.listener,!1)})})}))),t}class Vs extends D{constructor(i){super();Y(this,vt);this.defaults=Ci,this.settings={...this.defaults,...i},this.trigger=null,F(this,vt,Di.bind(this)),this.settings.autoMount&&this.mount()}get active(){return this.collection.find(i=>i.state=="opened")}get activeTooltip(){return this.collection.find(i=>i.state=="opened"&&i.isTooltip)}async mount(i){i&&(this.settings={...this.settings,...i});const s=document.querySelectorAll(this.settings.selectorPopover);return await this.registerCollection(s),this.settings.eventListeners&&this.mountEventListeners(!1),this}async unmount(){return this.trigger=null,await this.deregisterCollection(),this.settings.eventListeners&&this.unmountEventListeners(!1),this}mountEventListeners(i=!0){i&&this.collection.forEach(s=>{ze.call(this,s)}),document.addEventListener("keydown",O(this,vt),!1)}unmountEventListeners(i=!0){i&&this.collection.forEach(s=>{He(s)}),document.removeEventListener("keydown",O(this,vt),!1)}register(i){const s=Si.call(this,i);return s.error?Promise.reject(s.error):Ns.call(this,s.popover,s.trigger)}deregister(i){let s=this.get(i.id||i);return s?de.call(this,s):Promise.reject(new Error(`Failed to deregister; popover does not exist in collection with ID of: "${i.id||i}".`))}open(i){return _e.call(this,i)}close(i){return te.call(this,i)}}vt=new WeakMap,y.Drawer=wi,y.Modal=Li,y.Popover=Vs,y.core=li,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
|
|
6
10
|
//# sourceMappingURL=index.umd.cjs.map
|