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