vrembem 1.42.1 → 3.0.1

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.
@@ -1,2 +1,2 @@
1
- const t=(t,e)=>{e&&document.querySelectorAll(e).forEach(e=>{t?(e.inert=!0,e.setAttribute("aria-hidden",!0)):(e.inert=null,e.removeAttribute("aria-hidden"))})},e=(t,e)=>{e&&document.querySelectorAll(e).forEach(e=>{t?e.style.overflow="hidden":e.style.removeProperty("overflow")})},n=t=>{t&&document.querySelectorAll(t).forEach(t=>{t.setAttribute("tabindex","-1")})},s=(t,...e)=>{(t=t.forEach?t:[t]).forEach(t=>{t.classList.add(...e)})};var i=['a[href]:not([tabindex^="-"])','area[href]:not([tabindex^="-"])','input:not([type="hidden"]):not([type="radio"]):not([disabled]):not([tabindex^="-"])','input[type="radio"]:not([disabled]):not([tabindex^="-"])','select:not([disabled]):not([tabindex^="-"])','textarea:not([disabled]):not([tabindex^="-"])','button:not([disabled]):not([tabindex^="-"])','iframe:not([tabindex^="-"])','audio[controls]:not([tabindex^="-"])','video[controls]:not([tabindex^="-"])','[contenteditable]:not([tabindex^="-"])','[tabindex]:not([tabindex^="-"])'];const r=(t,e)=>{const n=t.querySelector(`[data-${e.dataFocus}]`);if(n)n.focus();else{const e=t.querySelector('[tabindex="-1"]');e&&e.focus()}},o=(t=null)=>{t&&t.memory&&t.memory.trigger&&(t.memory.trigger.focus(),t.memory.trigger=null)};class a{constructor(){this.target=null,this.__handlerFocusTrap=this.handlerFocusTrap.bind(this)}init(t){this.target=t,this.inner=this.target.querySelector('[tabindex="-1"]'),this.focusable=this.getFocusable(),this.focusable.length?(this.focusableFirst=this.focusable[0],this.focusableLast=this.focusable[this.focusable.length-1],this.target.addEventListener("keydown",this.__handlerFocusTrap)):this.target.addEventListener("keydown",this.handlerFocusLock)}destroy(){this.target&&(this.inner=null,this.focusable=null,this.focusableFirst=null,this.focusableLast=null,this.target.removeEventListener("keydown",this.__handlerFocusTrap),this.target.removeEventListener("keydown",this.handlerFocusLock),this.target=null)}refresh(){this.target&&(this.target.removeEventListener("keydown",this.__handlerFocusTrap),this.target.removeEventListener("keydown",this.handlerFocusLock),this.focusable=this.getFocusable(),this.focusable.length?(this.focusableFirst=this.focusable[0],this.focusableLast=this.focusable[this.focusable.length-1],this.target.addEventListener("keydown",this.__handlerFocusTrap)):(this.focusableFirst=null,this.focusableLast=null,this.target.addEventListener("keydown",this.handlerFocusLock)))}handlerFocusTrap(t){("Tab"===t.key||9===t.keyCode)&&(t.shiftKey?document.activeElement!==this.focusableFirst&&document.activeElement!==this.inner||(this.focusableLast.focus(),t.preventDefault()):document.activeElement!==this.focusableLast&&document.activeElement!==this.inner||(this.focusableFirst.focus(),t.preventDefault()))}handlerFocusLock(t){("Tab"===t.key||9===t.keyCode)&&t.preventDefault()}getFocusable(){const t=[],e=document.activeElement,n=this.inner?this.inner.scrollTop:0;return this.target.querySelectorAll(i.join(",")).forEach(e=>{e.focus(),e===document.activeElement&&t.push(e)}),this.inner&&(this.inner.scrollTop=n),e.focus(),t}}const c=function(t,e=0){return"string"!=typeof t?t:e?document.querySelector(t):document.querySelectorAll(t)},l=(t,...e)=>(t=[].slice.call(t=t.forEach?t:[t]),e.some(e=>t.some(t=>{if(t.classList.contains(e))return!0})));function d(t,e,n=!1){if(n){const s=c(t);if(!s.length)throw new Error(`Move target element "${t}" not found!`);const i=c(n,1);if(!i)throw new Error(`Move reference element "${n}" not found!`);s.forEach(t=>{switch(e){case"after":return i.after(t),{ref:i,el:t,type:e};case"before":return i.before(t),{ref:i,el:t,type:e};case"append":return i.append(t),{ref:i,el:t,type:e};case"prepend":return i.prepend(t),{ref:i,el:t,type:e};default:throw new Error(`Move type "${e}" does not exist!`)}})}}const u=(t,...e)=>{(t=t.forEach?t:[t]).forEach(t=>{t.classList.remove(...e)})},h=(t,e)=>new Promise(n=>{e.transition?(t.classList.remove(e.stateClosed),t.classList.add(e.stateOpening),t.addEventListener("transitionend",function s(){t.classList.add(e.stateOpened),t.classList.remove(e.stateOpening),n(t),this.removeEventListener("transitionend",s)})):(t.classList.add(e.stateOpened),t.classList.remove(e.stateClosed),n(t))}),f=(t,e)=>new Promise(n=>{e.transition?(t.classList.add(e.stateClosing),t.classList.remove(e.stateOpened),t.addEventListener("transitionend",function s(){t.classList.remove(e.stateClosing),t.classList.add(e.stateClosed),n(t),this.removeEventListener("transitionend",s)})):(t.classList.add(e.stateClosed),t.classList.remove(e.stateOpened),n(t))});var p={__proto__:null,setInert:t,setOverflowHidden:e,setTabindex:n,addClass:s,camelCase:t=>t.replace(/-([a-z])/g,function(t){return t[1].toUpperCase()}),focusTarget:r,focusTrigger:o,FocusTrap:a,getElement:c,hasClass:l,hyphenCase:t=>t.replace(/([a-z][A-Z])/g,function(t){return t[0]+"-"+t[1].toLowerCase()}),moveElement:d,removeClass:u,toggleClass:(t,...e)=>{(t=t.forEach?t:[t]).forEach(t=>{e.forEach(e=>{t.classList.toggle(e)})})},openTransition:h,closeTransition:f};function g(){return(g=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t}).apply(this,arguments)}var m={autoInit:!1,stateAttr:"aria-checked",stateValue:"mixed"};class v{constructor(t){this.defaults=m,this.settings=g({},this.defaults,t),this.__handlerClick=this.handlerClick.bind(this),this.settings.autoInit&&this.init()}init(t=null){t&&(this.settings=g({},this.settings,t));const e=document.querySelectorAll(`[${this.settings.stateAttr}="${this.settings.stateValue}"]`);this.setIndeterminate(e),document.addEventListener("click",this.__handlerClick,!1)}destroy(){document.removeEventListener("click",this.__handlerClick,!1)}handlerClick(t){const e=t.target.closest(`[${this.settings.stateAttr}="${this.settings.stateValue}"]`);e&&(this.removeAriaState(e),this.setIndeterminate(e))}setAriaState(t,e=this.settings.stateValue){(t=t.forEach?t:[t]).forEach(t=>{t.setAttribute(this.settings.stateAttr,e)})}removeAriaState(t){(t=t.forEach?t:[t]).forEach(t=>{t.removeAttribute(this.settings.stateAttr)})}setIndeterminate(t){(t=t.forEach?t:[t]).forEach(t=>{t.indeterminate=!!t.hasAttribute(this.settings.stateAttr)})}}var y={autoInit:!1,dataDrawer:"drawer",dataDialog:"drawer-dialog",dataToggle:"drawer-toggle",dataOpen:"drawer-open",dataClose:"drawer-close",dataBreakpoint:"drawer-breakpoint",dataFocus:"drawer-focus",stateOpened:"is-opened",stateOpening:"is-opening",stateClosing:"is-closing",stateClosed:"is-closed",classModal:"drawer_modal",selectorInert:null,selectorOverflow:null,breakpoints:null,customEventPrefix:"drawer:",eventListeners:!0,stateSave:!0,stateKey:"DrawerState",setTabindex:!0,transition:!0};class b{constructor(t){this.mediaQueryLists=[],this.parent=t,this.prefix=this.getVariablePrefix(),this.__check=this.check.bind(this)}init(){document.querySelectorAll(`[data-${this.parent.settings.dataBreakpoint}]`).forEach(t=>{const e=t.getAttribute(`data-${this.parent.settings.dataDrawer}`),n=t.getAttribute(`data-${this.parent.settings.dataBreakpoint}`),s=this.getBreakpoint(n),i=window.matchMedia("(min-width:"+s+")");this.match(i,t),"function"==typeof i.addEventListener?i.addEventListener("change",this.__check):i.addListener(this.__check),this.mediaQueryLists.push({mql:i,drawer:e})})}destroy(){this.mediaQueryLists&&this.mediaQueryLists.length&&this.mediaQueryLists.forEach(t=>{t.mql.removeListener(this.__check)}),this.mediaQueryLists=null}check(t=null){this.mediaQueryLists&&this.mediaQueryLists.length&&(this.mediaQueryLists.forEach(e=>{if(t&&t.media!=e.mql.media)return;const n=document.querySelector(`[data-${this.parent.settings.dataDrawer}="${e.drawer}"]`);n&&this.match(e.mql,n)}),document.dispatchEvent(new CustomEvent(this.parent.settings.customEventPrefix+"breakpoint",{bubbles:!0})))}match(t,e){t.matches?this.parent.switchToDefault(e):this.parent.switchToModal(e)}getBreakpoint(t){let e=t;return this.parent.settings.breakpoints&&this.parent.settings.breakpoints[t]?e=this.parent.settings.breakpoints[t]:getComputedStyle(document.body).getPropertyValue(this.prefix+t)&&(e=getComputedStyle(document.body).getPropertyValue(this.prefix+t)),e}getVariablePrefix(){let t="--";return t+=getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix"),t+="breakpoint-",t}}function w(t){return"string"!=typeof t?t:document.querySelector(`[data-${this.settings.dataDrawer}="${t}"]`)}function E(t){return Promise.reject(new Error(`Did not find drawer with key: "${t}"`))}async function x(n){const s=this.getDrawer(n);return s?l(s,this.settings.stateOpened)?(this.working=!0,l(s,this.settings.classModal)&&(t(!1,this.settings.selectorInert),e(!1,this.settings.selectorOverflow)),await f(s,this.settings),this.stateSave(s),o(this),this.focusTrap.destroy(),s.dispatchEvent(new CustomEvent(this.settings.customEventPrefix+"closed",{detail:this,bubbles:!0})),this.working=!1,s):s:E(n)}function O(t){if(this.working)return;let e=t.target.closest(`[data-${this.settings.dataToggle}]`);if(e){const n=e.getAttribute(`data-${this.settings.dataToggle}`);return this.memory.trigger=e,this.toggle(n),void t.preventDefault()}if(e=t.target.closest(`[data-${this.settings.dataOpen}]`),e){const n=e.getAttribute(`data-${this.settings.dataOpen}`);return this.memory.trigger=e,this.open(n),void t.preventDefault()}if(e=t.target.closest(`[data-${this.settings.dataClose}]`),e){const n=e.getAttribute(`data-${this.settings.dataClose}`);if(n)this.memory.trigger=e,this.close(n);else{const e=t.target.closest(`[data-${this.settings.dataDrawer}]`);e&&this.close(e)}t.preventDefault()}else t.target.hasAttribute(`data-${this.settings.dataDrawer}`)&&this.close(t.target)}function L(t){if(!this.working&&"Escape"===t.key){const t=document.querySelector(`.${this.settings.classModal}.${this.settings.stateOpened}`);t&&this.close(t)}}async function k(n){const s=this.getDrawer(n);if(!s)return E(n);if(l(s,this.settings.stateOpened))return r(s,this.settings),s;{this.working=!0;const n=l(s,this.settings.classModal);return n&&e(!0,this.settings.selectorOverflow),await h(s,this.settings),this.stateSave(s),n&&(this.focusTrap.init(s),t(!0,this.settings.selectorInert)),r(s,this.settings),s.dispatchEvent(new CustomEvent(this.settings.customEventPrefix+"opened",{detail:this,bubbles:!0})),this.working=!1,s}}function _(t,e){if(!e.stateSave)return A(e);const n=localStorage.getItem(e.stateKey)?JSON.parse(localStorage.getItem(e.stateKey)):{};return(t?[t]:document.querySelectorAll(`[data-${e.dataDrawer}]`)).forEach(t=>{if(l(t,e.classModal))return;const s=t.getAttribute(`data-${e.dataDrawer}`);n[s]=l(t,e.stateOpened)?e.stateOpened:e.stateClosed}),localStorage.setItem(e.stateKey,JSON.stringify(n)),n}function A(t){return localStorage.getItem(t.stateKey)&&localStorage.removeItem(t.stateKey),{}}async function C(t){const e=this.getDrawer(t);return e?l(e,this.settings.classModal)?void 0:(s(e,this.settings.classModal),s(e,this.settings.stateClosed),u(e,this.settings.stateOpened),e.dispatchEvent(new CustomEvent(this.settings.customEventPrefix+"toModal",{bubbles:!0})),e):E(t)}async function S(n){const i=this.getDrawer(n);return i?l(i,this.settings.classModal)?(t(!1,this.settings.selectorInert),e(!1,this.settings.selectorOverflow),u(i,this.settings.classModal),this.focusTrap.destroy(),n=i.getAttribute(`data-${this.settings.dataDrawer}`),this.state[n]==this.settings.stateOpened&&(s(i,this.settings.stateOpened),u(i,this.settings.stateClosed)),i.dispatchEvent(new CustomEvent(this.settings.customEventPrefix+"toDefault",{bubbles:!0})),i):void 0:E(n)}async function D(t){const e=this.getDrawer(t);return e?l(e,this.settings.stateOpened)?this.close(e):this.open(e):E(t)}class ${constructor(t){this.defaults=y,this.settings=g({},this.defaults,t),this.working=!1,this.memory={},this.state={},this.focusTrap=new a,this.breakpoint=new b(this),this.__handlerClick=O.bind(this),this.__handlerKeydown=L.bind(this),this.settings.autoInit&&this.init()}init(t=null){t&&(this.settings=g({},this.settings,t)),this.stateSet(),this.settings.setTabindex&&this.setTabindex(),this.breakpoint.init(),this.settings.eventListeners&&this.initEventListeners()}destroy(){this.breakpoint.destroy(),this.memory={},this.state={},localStorage.removeItem(this.settings.stateKey),this.settings.eventListeners&&this.destroyEventListeners()}initEventListeners(){document.addEventListener("click",this.__handlerClick,!1),document.addEventListener("touchend",this.__handlerClick,!1),document.addEventListener("keydown",this.__handlerKeydown,!1)}destroyEventListeners(){document.removeEventListener("click",this.__handlerClick,!1),document.removeEventListener("touchend",this.__handlerClick,!1),document.removeEventListener("keydown",this.__handlerKeydown,!1)}getDrawer(t){return w.call(this,t)}setTabindex(){return n(`\n [data-${this.settings.dataDrawer}]\n [data-${this.settings.dataDialog}]\n `)}stateSet(){this.state=function(t){if(!t.stateSave)return A(t);const e=localStorage.getItem(t.stateKey);if(!e||e&&0===Object.keys(JSON.parse(e)).length)return _(null,t);const n=JSON.parse(localStorage.getItem(t.stateKey));return Object.keys(n).forEach(e=>{const i=document.querySelector(`[data-${t.dataDrawer}="${e}"]`);i&&(n[e]==t.stateOpened?s(i,t.stateOpened):u(i,t.stateOpened))}),n}(this.settings)}stateSave(t=null){this.state=_(t,this.settings)}stateClear(){this.state=A(this.settings)}switchToDefault(t){return S.call(this,t)}switchToModal(t){return C.call(this,t)}toggle(t){return D.call(this,t)}open(t){return k.call(this,t)}close(t){return x.call(this,t)}}var T={autoInit:!1,dataModal:"modal",dataDialog:"modal-dialog",dataOpen:"modal-open",dataClose:"modal-close",dataFocus:"modal-focus",dataRequired:"modal-required",dataConfig:"modal-config",stateOpened:"is-opened",stateOpening:"is-opening",stateClosing:"is-closing",stateClosed:"is-closed",selectorInert:null,selectorOverflow:"body",customEventPrefix:"modal:",eventListeners:!0,moveModals:{ref:null,type:null},setTabindex:!0,transition:!0};function M(t){const e=t.getAttribute(`data-${this.settings.dataConfig}`);if(e){const t=JSON.parse(e);return g({},this.settings,t)}return this.settings}function P(t){return"string"!=typeof t?t:document.querySelector(`[data-${this.settings.dataModal}="${t}"]`)}function j(t=this.settings.moveModals.type,e=this.settings.moveModals.ref){const n=document.querySelectorAll(`[data-${this.settings.dataModal}]`);n.length&&d(n,t,e)}async function q(n=!0){const s=document.querySelector(`[data-${this.settings.dataModal}].${this.settings.stateOpened}`);if(s){this.working=!0;const i=M.call(this,s);return t(!1,i.selectorInert),e(!1,i.selectorOverflow),await f(s,i),n&&o(this),this.focusTrap.destroy(),s.dispatchEvent(new CustomEvent(i.customEventPrefix+"closed",{detail:this,bubbles:!0})),this.working=!1,s}return s}async function I(t){if(this.working)return;const e=t.target.closest(`[data-${this.settings.dataOpen}]`);if(e){t.preventDefault();const n=e.getAttribute(`data-${this.settings.dataOpen}`),s=t.target.closest(`[data-${this.settings.dataModal}]`);return s||(this.memory.trigger=e),await this.close(!s),void this.open(n)}if(t.target.closest(`[data-${this.settings.dataClose}]`))return t.preventDefault(),void this.close();!t.target.hasAttribute(`data-${this.settings.dataModal}`)||t.target.hasAttribute(`data-${this.settings.dataRequired}`)||this.close()}function F(t){if(!this.working&&"Escape"===t.key){const t=document.querySelector(`[data-${this.settings.dataModal}].${this.settings.stateOpened}`);t&&!t.hasAttribute(`data-${this.settings.dataRequired}`)&&this.close()}}function B(){document.querySelectorAll(`[data-${this.settings.dataModal}]`).forEach(n=>{n.classList.contains(this.settings.stateOpened)&&(t(!1,this.settings.selectorInert),e(!1,this.settings.selectorOverflow),o(this),this.focusTrap.destroy()),u(n,this.settings.stateOpened,this.settings.stateOpening,this.settings.stateClosing),s(n,this.settings.stateClosed)})}async function V(n){const s=P.call(this,n);if(!s)return Promise.reject(new Error(`Did not find modal with key: "${n}"`));const i=M.call(this,s);return l(s,i.stateClosed)?(this.working=!0,e(!0,i.selectorOverflow),await h(s,i),this.focusTrap.init(s),r(s,i),t(!0,i.selectorInert),s.dispatchEvent(new CustomEvent(i.customEventPrefix+"opened",{detail:this,bubbles:!0})),this.working=!1,s):s}class K{constructor(t){this.defaults=T,this.settings=g({},this.defaults,t),this.working=!1,this.memory={},this.focusTrap=new a,this.__handlerClick=I.bind(this),this.__handlerKeydown=F.bind(this),this.settings.autoInit&&this.init()}init(t=null){t&&(this.settings=g({},this.settings,t)),this.moveModals(),this.setInitialState(),this.settings.setTabindex&&this.setTabindex(),this.settings.eventListeners&&this.initEventListeners()}destroy(){this.memory={},this.settings.eventListeners&&this.destroyEventListeners()}initEventListeners(){document.addEventListener("click",this.__handlerClick,!1),document.addEventListener("touchend",this.__handlerClick,!1),document.addEventListener("keydown",this.__handlerKeydown,!1)}destroyEventListeners(){document.removeEventListener("click",this.__handlerClick,!1),document.removeEventListener("touchend",this.__handlerClick,!1),document.removeEventListener("keydown",this.__handlerKeydown,!1)}getModal(t){return P.call(this,t)}setTabindex(){return n(`\n [data-${this.settings.dataModal}]\n [data-${this.settings.dataDialog}]\n `)}setInitialState(){return B.call(this)}moveModals(t,e){return j.call(this,t,e)}open(t){return V.call(this,t)}close(t){return q.call(this,t)}}var W={autoInit:!1,selectorPopover:".popover",selectorArrow:".popover__arrow",stateActive:"is-active",eventListeners:!0,eventType:"click",placement:"bottom"};function R(t){return t.target.classList.remove(this.settings.stateActive),t.trigger.hasAttribute("aria-controls")&&t.trigger.setAttribute("aria-expanded","false"),t.popper.setOptions({modifiers:[{name:"eventListeners",enabled:!1}]}),t.state="closed",t.trigger===this.memory.trigger&&(this.memory.trigger=null),t}function H(){return this.collection.forEach(t=>{"opened"===t.state&&t.close()}),this.collection}function N(t){"opened"==t.state&&setTimeout(()=>{const e=t.target.closest(":hover")===t.target||t.trigger.closest(":hover")===t.trigger,n=document.activeElement.closest(`#${t.id}, [aria-controls="${t.id}"]`);return e||n||t.close(),t},1)}function Q(t){t.target.classList.contains(this.settings.stateActive)?t.close():(this.memory.trigger=t.trigger,t.open(),J.call(this,t))}function z(t){switch(t.key){case"Escape":return this.memory.trigger&&this.memory.trigger.focus(),void H.call(this);case"Tab":return void this.collection.forEach(t=>{N.call(this,t)});default:return}}function J(t){const e=this;document.addEventListener("click",function n(s){s.target.closest(`#${t.id}, [aria-controls="${t.id}"]`)?t.target&&!t.target.classList.contains(e.settings.stateActive)&&this.removeEventListener("click",n):(t.target&&t.target.classList.contains(e.settings.stateActive)&&t.close(),this.removeEventListener("click",n))})}function U(t,e){const n=getComputedStyle(t),s={placement:e.placement,event:e.eventType,offset:0,"overflow-padding":0,"flip-padding":0,"arrow-element":e.selectorArrow,"arrow-padding":0};for(const t in s){const e=getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix"),i=n.getPropertyValue(`--${e}popover-${t}`).trim();i&&(s[t]=i)}return s}function X(t){let e;const n="string"==typeof t?t.trim().split(" "):[t];switch(n.forEach(function(t,e){n[e]=parseInt(t,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}return e}function Y(t){return"string"==typeof t?t:"function"==typeof t.hasAttribute?t.hasAttribute("aria-controls")?t.getAttribute("aria-controls"):t.hasAttribute("aria-describedby")?t.getAttribute("aria-describedby"):!!t.closest(this.settings.selectorPopover)&&t.id:!!t.id&&t.id}function Z(t){const e=Y.call(this,t);if(e){const t=document.querySelector(`[aria-controls="${e}"]`)||document.querySelector(`[aria-describedby="${e}"]`),n=document.querySelector(`#${e}`);return t||n?t?n||console.error("No popover associated with the provided popover trigger:",t):console.error("No popover trigger associated with the provided popover:",n):console.error("No popover elements found using the provided ID:",e),!(!t||!n)&&{trigger:t,target:n}}return console.error("Could not resolve the popover ID:",t),!1}var G="top",tt="bottom",et="right",nt="left",st=[G,tt,et,nt],it=/*#__PURE__*/st.reduce(function(t,e){return t.concat([e+"-start",e+"-end"])},[]),rt=/*#__PURE__*/[].concat(st,["auto"]).reduce(function(t,e){return t.concat([e,e+"-start",e+"-end"])},[]),ot=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function at(t){return t?(t.nodeName||"").toLowerCase():null}function ct(t){if(null==t)return window;if("[object Window]"!==t.toString()){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function lt(t){return t instanceof ct(t).Element||t instanceof Element}function dt(t){return t instanceof ct(t).HTMLElement||t instanceof HTMLElement}function ut(t){return"undefined"!=typeof ShadowRoot&&(t instanceof ct(t).ShadowRoot||t instanceof ShadowRoot)}function ht(t){return t.split("-")[0]}var ft=Math.max,pt=Math.min,gt=Math.round;function mt(t,e){void 0===e&&(e=!1);var n=t.getBoundingClientRect(),s=1,i=1;if(dt(t)&&e){var r=t.offsetHeight,o=t.offsetWidth;o>0&&(s=gt(n.width)/o||1),r>0&&(i=gt(n.height)/r||1)}return{width:n.width/s,height:n.height/i,top:n.top/i,right:n.right/s,bottom:n.bottom/i,left:n.left/s,x:n.left/s,y:n.top/i}}function vt(t){var e=mt(t),n=t.offsetWidth,s=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-s)<=1&&(s=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:s}}function yt(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&ut(n)){var s=e;do{if(s&&t.isSameNode(s))return!0;s=s.parentNode||s.host}while(s)}return!1}function bt(t){return ct(t).getComputedStyle(t)}function wt(t){return["table","td","th"].indexOf(at(t))>=0}function Et(t){return((lt(t)?t.ownerDocument:t.document)||window.document).documentElement}function xt(t){return"html"===at(t)?t:t.assignedSlot||t.parentNode||(ut(t)?t.host:null)||Et(t)}function Ot(t){return dt(t)&&"fixed"!==bt(t).position?t.offsetParent:null}function Lt(t){for(var e=ct(t),n=Ot(t);n&&wt(n)&&"static"===bt(n).position;)n=Ot(n);return n&&("html"===at(n)||"body"===at(n)&&"static"===bt(n).position)?e:n||function(t){var e=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&dt(t)&&"fixed"===bt(t).position)return null;for(var n=xt(t);dt(n)&&["html","body"].indexOf(at(n))<0;){var s=bt(n);if("none"!==s.transform||"none"!==s.perspective||"paint"===s.contain||-1!==["transform","perspective"].indexOf(s.willChange)||e&&"filter"===s.willChange||e&&s.filter&&"none"!==s.filter)return n;n=n.parentNode}return null}(t)||e}function kt(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function _t(t,e,n){return ft(t,pt(e,n))}function At(t){return Object.assign({},{top:0,right:0,bottom:0,left:0},t)}function Ct(t,e){return e.reduce(function(e,n){return e[n]=t,e},{})}function St(t){return t.split("-")[1]}var Dt={top:"auto",right:"auto",bottom:"auto",left:"auto"};function $t(t){var e,n=t.popper,s=t.popperRect,i=t.placement,r=t.variation,o=t.offsets,a=t.position,c=t.gpuAcceleration,l=t.adaptive,d=t.roundOffsets,u=t.isFixed,h=o.x,f=void 0===h?0:h,p=o.y,g=void 0===p?0:p,m="function"==typeof d?d({x:f,y:g}):{x:f,y:g};f=m.x,g=m.y;var v=o.hasOwnProperty("x"),y=o.hasOwnProperty("y"),b=nt,w=G,E=window;if(l){var x=Lt(n),O="clientHeight",L="clientWidth";x===ct(n)&&"static"!==bt(x=Et(n)).position&&"absolute"===a&&(O="scrollHeight",L="scrollWidth"),x=x,(i===G||(i===nt||i===et)&&"end"===r)&&(w=tt,g-=(u&&E.visualViewport?E.visualViewport.height:x[O])-s.height,g*=c?1:-1),i!==nt&&(i!==G&&i!==tt||"end"!==r)||(b=et,f-=(u&&E.visualViewport?E.visualViewport.width:x[L])-s.width,f*=c?1:-1)}var k,_=Object.assign({position:a},l&&Dt),A=!0===d?function(t){var e=t.y,n=window.devicePixelRatio||1;return{x:gt(t.x*n)/n||0,y:gt(e*n)/n||0}}({x:f,y:g}):{x:f,y:g};return f=A.x,g=A.y,Object.assign({},_,c?((k={})[w]=y?"0":"",k[b]=v?"0":"",k.transform=(E.devicePixelRatio||1)<=1?"translate("+f+"px, "+g+"px)":"translate3d("+f+"px, "+g+"px, 0)",k):((e={})[w]=y?g+"px":"",e[b]=v?f+"px":"",e.transform="",e))}var Tt={passive:!0},Mt={left:"right",right:"left",bottom:"top",top:"bottom"};function Pt(t){return t.replace(/left|right|bottom|top/g,function(t){return Mt[t]})}var jt={start:"end",end:"start"};function qt(t){return t.replace(/start|end/g,function(t){return jt[t]})}function It(t){var e=ct(t);return{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Ft(t){return mt(Et(t)).left+It(t).scrollLeft}function Bt(t){var e=bt(t);return/auto|scroll|overlay|hidden/.test(e.overflow+e.overflowY+e.overflowX)}function Vt(t){return["html","body","#document"].indexOf(at(t))>=0?t.ownerDocument.body:dt(t)&&Bt(t)?t:Vt(xt(t))}function Kt(t,e){var n;void 0===e&&(e=[]);var s=Vt(t),i=s===(null==(n=t.ownerDocument)?void 0:n.body),r=ct(s),o=i?[r].concat(r.visualViewport||[],Bt(s)?s:[]):s,a=e.concat(o);return i?a:a.concat(Kt(xt(o)))}function Wt(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function Rt(t,e){return"viewport"===e?Wt(function(t){var e=ct(t),n=Et(t),s=e.visualViewport,i=n.clientWidth,r=n.clientHeight,o=0,a=0;return s&&(i=s.width,r=s.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(o=s.offsetLeft,a=s.offsetTop)),{width:i,height:r,x:o+Ft(t),y:a}}(t)):lt(e)?function(t){var e=mt(t);return e.top=e.top+t.clientTop,e.left=e.left+t.clientLeft,e.bottom=e.top+t.clientHeight,e.right=e.left+t.clientWidth,e.width=t.clientWidth,e.height=t.clientHeight,e.x=e.left,e.y=e.top,e}(e):Wt(function(t){var e,n=Et(t),s=It(t),i=null==(e=t.ownerDocument)?void 0:e.body,r=ft(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),o=ft(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-s.scrollLeft+Ft(t),c=-s.scrollTop;return"rtl"===bt(i||n).direction&&(a+=ft(n.clientWidth,i?i.clientWidth:0)-r),{width:r,height:o,x:a,y:c}}(Et(t)))}function Ht(t){var e,n=t.reference,s=t.element,i=t.placement,r=i?ht(i):null,o=i?St(i):null,a=n.x+n.width/2-s.width/2,c=n.y+n.height/2-s.height/2;switch(r){case G:e={x:a,y:n.y-s.height};break;case tt:e={x:a,y:n.y+n.height};break;case et:e={x:n.x+n.width,y:c};break;case nt:e={x:n.x-s.width,y:c};break;default:e={x:n.x,y:n.y}}var l=r?kt(r):null;if(null!=l){var d="y"===l?"height":"width";switch(o){case"start":e[l]=e[l]-(n[d]/2-s[d]/2);break;case"end":e[l]=e[l]+(n[d]/2-s[d]/2)}}return e}function Nt(t,e){void 0===e&&(e={});var n=e.placement,s=void 0===n?t.placement:n,i=e.boundary,r=void 0===i?"clippingParents":i,o=e.rootBoundary,a=void 0===o?"viewport":o,c=e.elementContext,l=void 0===c?"popper":c,d=e.altBoundary,u=void 0!==d&&d,h=e.padding,f=void 0===h?0:h,p=At("number"!=typeof f?f:Ct(f,st)),g=t.rects.popper,m=t.elements[u?"popper"===l?"reference":"popper":l],v=function(t,e,n){var s="clippingParents"===e?function(t){var e=Kt(xt(t)),n=["absolute","fixed"].indexOf(bt(t).position)>=0&&dt(t)?Lt(t):t;return lt(n)?e.filter(function(t){return lt(t)&&yt(t,n)&&"body"!==at(t)}):[]}(t):[].concat(e),i=[].concat(s,[n]),r=i.reduce(function(e,n){var s=Rt(t,n);return e.top=ft(s.top,e.top),e.right=pt(s.right,e.right),e.bottom=pt(s.bottom,e.bottom),e.left=ft(s.left,e.left),e},Rt(t,i[0]));return r.width=r.right-r.left,r.height=r.bottom-r.top,r.x=r.left,r.y=r.top,r}(lt(m)?m:m.contextElement||Et(t.elements.popper),r,a),y=mt(t.elements.reference),b=Ht({reference:y,element:g,strategy:"absolute",placement:s}),w=Wt(Object.assign({},g,b)),E="popper"===l?w:y,x={top:v.top-E.top+p.top,bottom:E.bottom-v.bottom+p.bottom,left:v.left-E.left+p.left,right:E.right-v.right+p.right},O=t.modifiersData.offset;if("popper"===l&&O){var L=O[s];Object.keys(x).forEach(function(t){var e=[et,tt].indexOf(t)>=0?1:-1,n=[G,tt].indexOf(t)>=0?"y":"x";x[t]+=L[n]*e})}return x}function Qt(t,e){void 0===e&&(e={});var n=e.boundary,s=e.rootBoundary,i=e.padding,r=e.flipVariations,o=e.allowedAutoPlacements,a=void 0===o?rt:o,c=St(e.placement),l=c?r?it:it.filter(function(t){return St(t)===c}):st,d=l.filter(function(t){return a.indexOf(t)>=0});0===d.length&&(d=l);var u=d.reduce(function(e,r){return e[r]=Nt(t,{placement:r,boundary:n,rootBoundary:s,padding:i})[ht(r)],e},{});return Object.keys(u).sort(function(t,e){return u[t]-u[e]})}function zt(t,e,n){return void 0===n&&(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 Jt(t){return[G,et,tt,nt].some(function(e){return t[e]>=0})}function Ut(t,e,n){void 0===n&&(n=!1);var s,i,r=dt(e),o=dt(e)&&function(t){var e=t.getBoundingClientRect(),n=gt(e.width)/t.offsetWidth||1,s=gt(e.height)/t.offsetHeight||1;return 1!==n||1!==s}(e),a=Et(e),c=mt(t,o),l={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(r||!r&&!n)&&(("body"!==at(e)||Bt(a))&&(l=(s=e)!==ct(s)&&dt(s)?{scrollLeft:(i=s).scrollLeft,scrollTop:i.scrollTop}:It(s)),dt(e)?((d=mt(e,!0)).x+=e.clientLeft,d.y+=e.clientTop):a&&(d.x=Ft(a))),{x:c.left+l.scrollLeft-d.x,y:c.top+l.scrollTop-d.y,width:c.width,height:c.height}}function Xt(t){var e=new Map,n=new Set,s=[];function i(t){n.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach(function(t){if(!n.has(t)){var s=e.get(t);s&&i(s)}}),s.push(t)}return t.forEach(function(t){e.set(t.name,t)}),t.forEach(function(t){n.has(t.name)||i(t)}),s}var Yt={placement:"bottom",modifiers:[],strategy:"absolute"};function Zt(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return!e.some(function(t){return!(t&&"function"==typeof t.getBoundingClientRect)})}function Gt(t){void 0===t&&(t={});var e=t.defaultModifiers,n=void 0===e?[]:e,s=t.defaultOptions,i=void 0===s?Yt:s;return function(t,e,s){void 0===s&&(s=i);var r,o,a={placement:"bottom",orderedModifiers:[],options:Object.assign({},Yt,i),modifiersData:{},elements:{reference:t,popper:e},attributes:{},styles:{}},c=[],l=!1,d={state:a,setOptions:function(s){var r="function"==typeof s?s(a.options):s;u(),a.options=Object.assign({},i,a.options,r),a.scrollParents={reference:lt(t)?Kt(t):t.contextElement?Kt(t.contextElement):[],popper:Kt(e)};var o,l,h=function(t){var e=Xt(t);return ot.reduce(function(t,n){return t.concat(e.filter(function(t){return t.phase===n}))},[])}((o=[].concat(n,a.options.modifiers),l=o.reduce(function(t,e){var n=t[e.name];return t[e.name]=n?Object.assign({},n,e,{options:Object.assign({},n.options,e.options),data:Object.assign({},n.data,e.data)}):e,t},{}),Object.keys(l).map(function(t){return l[t]})));return a.orderedModifiers=h.filter(function(t){return t.enabled}),a.orderedModifiers.forEach(function(t){var e=t.options,n=t.effect;if("function"==typeof n){var s=n({state:a,name:t.name,instance:d,options:void 0===e?{}:e});c.push(s||function(){})}}),d.update()},forceUpdate:function(){if(!l){var t=a.elements,e=t.reference,n=t.popper;if(Zt(e,n)){a.rects={reference:Ut(e,Lt(n),"fixed"===a.options.strategy),popper:vt(n)},a.reset=!1,a.placement=a.options.placement,a.orderedModifiers.forEach(function(t){return a.modifiersData[t.name]=Object.assign({},t.data)});for(var s=0;s<a.orderedModifiers.length;s++)if(!0!==a.reset){var i=a.orderedModifiers[s],r=i.fn,o=i.options;"function"==typeof r&&(a=r({state:a,options:void 0===o?{}:o,name:i.name,instance:d})||a)}else a.reset=!1,s=-1}}},update:(r=function(){return new Promise(function(t){d.forceUpdate(),t(a)})},function(){return o||(o=new Promise(function(t){Promise.resolve().then(function(){o=void 0,t(r())})})),o}),destroy:function(){u(),l=!0}};if(!Zt(t,e))return d;function u(){c.forEach(function(t){return t()}),c=[]}return d.setOptions(s).then(function(t){!l&&s.onFirstUpdate&&s.onFirstUpdate(t)}),d}}var te=/*#__PURE__*/Gt({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(t){var e=t.state,n=t.instance,s=t.options,i=s.scroll,r=void 0===i||i,o=s.resize,a=void 0===o||o,c=ct(e.elements.popper),l=[].concat(e.scrollParents.reference,e.scrollParents.popper);return r&&l.forEach(function(t){t.addEventListener("scroll",n.update,Tt)}),a&&c.addEventListener("resize",n.update,Tt),function(){r&&l.forEach(function(t){t.removeEventListener("scroll",n.update,Tt)}),a&&c.removeEventListener("resize",n.update,Tt)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(t){var e=t.state;e.modifiersData[t.name]=Ht({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(t){var e=t.state,n=t.options,s=n.gpuAcceleration,i=void 0===s||s,r=n.adaptive,o=void 0===r||r,a=n.roundOffsets,c=void 0===a||a,l={placement:ht(e.placement),variation:St(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i,isFixed:"fixed"===e.options.strategy};null!=e.modifiersData.popperOffsets&&(e.styles.popper=Object.assign({},e.styles.popper,$t(Object.assign({},l,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:c})))),null!=e.modifiersData.arrow&&(e.styles.arrow=Object.assign({},e.styles.arrow,$t(Object.assign({},l,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:c})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})},data:{}},{name:"applyStyles",enabled:!0,phase:"write",fn:function(t){var e=t.state;Object.keys(e.elements).forEach(function(t){var n=e.styles[t]||{},s=e.attributes[t]||{},i=e.elements[t];dt(i)&&at(i)&&(Object.assign(i.style,n),Object.keys(s).forEach(function(t){var e=s[t];!1===e?i.removeAttribute(t):i.setAttribute(t,!0===e?"":e)}))})},effect:function(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(t){var s=e.elements[t],i=e.attributes[t]||{},r=Object.keys(e.styles.hasOwnProperty(t)?e.styles[t]:n[t]).reduce(function(t,e){return t[e]="",t},{});dt(s)&&at(s)&&(Object.assign(s.style,r),Object.keys(i).forEach(function(t){s.removeAttribute(t)}))})}},requires:["computeStyles"]},{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(t){var e=t.state,n=t.name,s=t.options.offset,i=void 0===s?[0,0]:s,r=rt.reduce(function(t,n){return t[n]=function(t,e,n){var s=ht(t),i=[nt,G].indexOf(s)>=0?-1:1,r="function"==typeof n?n(Object.assign({},e,{placement:t})):n,o=r[0],a=r[1];return o=o||0,a=(a||0)*i,[nt,et].indexOf(s)>=0?{x:a,y:o}:{x:o,y:a}}(n,e.rects,i),t},{}),o=r[e.placement],a=o.y;null!=e.modifiersData.popperOffsets&&(e.modifiersData.popperOffsets.x+=o.x,e.modifiersData.popperOffsets.y+=a),e.modifiersData[n]=r}},{name:"flip",enabled:!0,phase:"main",fn:function(t){var e=t.state,n=t.options,s=t.name;if(!e.modifiersData[s]._skip){for(var i=n.mainAxis,r=void 0===i||i,o=n.altAxis,a=void 0===o||o,c=n.fallbackPlacements,l=n.padding,d=n.boundary,u=n.rootBoundary,h=n.altBoundary,f=n.flipVariations,p=void 0===f||f,g=n.allowedAutoPlacements,m=e.options.placement,v=ht(m),y=c||(v!==m&&p?function(t){if("auto"===ht(t))return[];var e=Pt(t);return[qt(t),e,qt(e)]}(m):[Pt(m)]),b=[m].concat(y).reduce(function(t,n){return t.concat("auto"===ht(n)?Qt(e,{placement:n,boundary:d,rootBoundary:u,padding:l,flipVariations:p,allowedAutoPlacements:g}):n)},[]),w=e.rects.reference,E=e.rects.popper,x=new Map,O=!0,L=b[0],k=0;k<b.length;k++){var _=b[k],A=ht(_),C="start"===St(_),S=[G,tt].indexOf(A)>=0,D=S?"width":"height",$=Nt(e,{placement:_,boundary:d,rootBoundary:u,altBoundary:h,padding:l}),T=S?C?et:nt:C?tt:G;w[D]>E[D]&&(T=Pt(T));var M=Pt(T),P=[];if(r&&P.push($[A]<=0),a&&P.push($[T]<=0,$[M]<=0),P.every(function(t){return t})){L=_,O=!1;break}x.set(_,P)}if(O)for(var j=function(t){var e=b.find(function(e){var n=x.get(e);if(n)return n.slice(0,t).every(function(t){return t})});if(e)return L=e,"break"},q=p?3:1;q>0&&"break"!==j(q);q--);e.placement!==L&&(e.modifiersData[s]._skip=!0,e.placement=L,e.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},{name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var e=t.state,n=t.options,s=t.name,i=n.mainAxis,r=void 0===i||i,o=n.altAxis,a=void 0!==o&&o,c=n.tether,l=void 0===c||c,d=n.tetherOffset,u=void 0===d?0:d,h=Nt(e,{boundary:n.boundary,rootBoundary:n.rootBoundary,padding:n.padding,altBoundary:n.altBoundary}),f=ht(e.placement),p=St(e.placement),g=!p,m=kt(f),v="x"===m?"y":"x",y=e.modifiersData.popperOffsets,b=e.rects.reference,w=e.rects.popper,E="function"==typeof u?u(Object.assign({},e.rects,{placement:e.placement})):u,x="number"==typeof E?{mainAxis:E,altAxis:E}:Object.assign({mainAxis:0,altAxis:0},E),O=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,L={x:0,y:0};if(y){if(r){var k,_="y"===m?G:nt,A="y"===m?tt:et,C="y"===m?"height":"width",S=y[m],D=S+h[_],$=S-h[A],T=l?-w[C]/2:0,M="start"===p?b[C]:w[C],P="start"===p?-w[C]:-b[C],j=e.elements.arrow,q=l&&j?vt(j):{width:0,height:0},I=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},F=I[_],B=I[A],V=_t(0,b[C],q[C]),K=g?b[C]/2-T-V-F-x.mainAxis:M-V-F-x.mainAxis,W=g?-b[C]/2+T+V+B+x.mainAxis:P+V+B+x.mainAxis,R=e.elements.arrow&&Lt(e.elements.arrow),H=null!=(k=null==O?void 0:O[m])?k:0,N=S+W-H,Q=_t(l?pt(D,S+K-H-(R?"y"===m?R.clientTop||0:R.clientLeft||0:0)):D,S,l?ft($,N):$);y[m]=Q,L[m]=Q-S}if(a){var z,J=y[v],U="y"===v?"height":"width",X=J+h["x"===m?G:nt],Y=J-h["x"===m?tt:et],Z=-1!==[G,nt].indexOf(f),st=null!=(z=null==O?void 0:O[v])?z:0,it=Z?X:J-b[U]-w[U]-st+x.altAxis,rt=Z?J+b[U]+w[U]-st-x.altAxis:Y,ot=l&&Z?function(t,e,n){var s=_t(t,e,n);return s>n?n:s}(it,J,rt):_t(l?it:X,J,l?rt:Y);y[v]=ot,L[v]=ot-J}e.modifiersData[s]=L}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(t){var e,n=t.state,s=t.name,i=t.options,r=n.elements.arrow,o=n.modifiersData.popperOffsets,a=ht(n.placement),c=kt(a),l=[nt,et].indexOf(a)>=0?"height":"width";if(r&&o){var d=function(t,e){return At("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:Ct(t,st))}(i.padding,n),u=vt(r),h="y"===c?G:nt,f="y"===c?tt:et,p=n.rects.reference[l]+n.rects.reference[c]-o[c]-n.rects.popper[l],g=o[c]-n.rects.reference[c],m=Lt(r),v=m?"y"===c?m.clientHeight||0:m.clientWidth||0:0,y=v/2-u[l]/2+(p/2-g/2),b=_t(d[h],y,v-u[l]-d[f]);n.modifiersData[s]=((e={})[c]=b,e.centerOffset=b-y,e)}},effect:function(t){var e=t.state,n=t.options.element,s=void 0===n?"[data-popper-arrow]":n;null!=s&&("string"!=typeof s||(s=e.elements.popper.querySelector(s)))&&yt(e.elements.popper,s)&&(e.elements.arrow=s)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(t){var e=t.state,n=t.name,s=e.rects.reference,i=e.rects.popper,r=e.modifiersData.preventOverflow,o=Nt(e,{elementContext:"reference"}),a=Nt(e,{altBoundary:!0}),c=zt(o,s),l=zt(a,i,r),d=Jt(c),u=Jt(l);e.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:l,isReferenceHidden:d,hasPopperEscaped:u},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":u})}}]});function ee(t){var e;return t.target.classList.add(this.settings.stateActive),t.trigger.hasAttribute("aria-controls")&&t.trigger.setAttribute("aria-expanded","true"),t.config=U(t.target,this.settings),t.popper.setOptions({placement:t.config.placement,modifiers:[{name:"eventListeners",enabled:!0},...(e=t.config,[{name:"offset",options:{offset:[0,parseInt(e.offset,10)]}},{name:"preventOverflow",options:{padding:X(e["overflow-padding"])}},{name:"flip",options:{padding:X(e["flip-padding"])}},{name:"arrow",options:{element:e["arrow-element"],padding:X(e["arrow-padding"])}}])]}),t.popper.update(),t.state="opened",t}function ne(t,e){this.deregister(e.id);const n=te(t,e),s=this,i={open(){ee.call(s,this)},close(){R.call(s,this)},deregister(){se.call(s,this)}},r=g({id:e.id,state:"closed",trigger:t,target:e,popper:n,config:U(e,this.settings)},i);return ie.call(this,r),r.target.classList.contains(this.settings.stateActive)?(r.open(),J.call(this,r)):r.close(),this.collection.push(r),r}function se(t){const e=this.collection.findIndex(e=>e.id===t.id);if(e>=0){const t=this.collection[e];"opened"===t.state&&t.close(),t.popper.destroy(),re(t),Object.getOwnPropertyNames(t).forEach(e=>{delete t[e]}),this.collection.splice(e,1)}return this.collection}function ie(t){return t.__eventListeners||("hover"===t.config.event?(t.__eventListeners=[{el:["trigger"],type:["mouseenter","focus"],listener:ee.bind(this,t)},{el:["trigger","target"],type:["mouseleave","focusout"],listener:N.bind(this,t)}],t.__eventListeners.forEach(e=>{e.el.forEach(n=>{e.type.forEach(s=>{t[n].addEventListener(s,e.listener,!1)})})})):(t.__eventListeners=[{el:["trigger"],type:["click"],listener:Q.bind(this,t)}],t.__eventListeners.forEach(e=>{e.el.forEach(n=>{e.type.forEach(s=>{t[n].addEventListener(s,e.listener,!1)})})}))),t}function re(t){return t.__eventListeners&&(t.__eventListeners.forEach(e=>{e.el.forEach(n=>{e.type.forEach(s=>{t[n].removeEventListener(s,e.listener,!1)})})}),delete t.__eventListeners),t}class oe extends class{constructor(){this.collection=[]}register(t){return this.deregister(t),this.collection.push(t),this.collection}deregister(t){const e=this.collection.findIndex(e=>e===t);if(e>=0){const t=this.collection[e];Object.getOwnPropertyNames(t).forEach(e=>{delete t[e]}),this.collection.splice(e,1)}return this.collection}registerCollection(t){return t.forEach(t=>{this.register(t)}),this.collection}deregisterCollection(){for(;this.collection.length>0;)this.deregister(this.collection[0]);return this.collection}get(t,e="id"){return this.collection.find(n=>n[e]===t)||null}}{constructor(t){super(),this.defaults=W,this.settings=g({},this.defaults,t),this.memory={trigger:null},this.__handlerKeydown=z.bind(this),this.settings.autoInit&&this.init()}init(t=null){t&&(this.settings=g({},this.settings,t));const e=document.querySelectorAll(this.settings.selectorPopover);this.registerCollection(e),this.settings.eventListeners&&this.initEventListeners(!1)}destroy(){this.deregisterCollection(),this.settings.eventListeners&&this.destroyEventListeners(!1)}initEventListeners(t=!0){t&&this.collection.forEach(t=>{ie.call(this,t)}),document.addEventListener("keydown",this.__handlerKeydown,!1)}destroyEventListeners(t=!0){t&&this.collection.forEach(t=>{re(t)}),document.removeEventListener("keydown",this.__handlerKeydown,!1)}register(t){const e=Z.call(this,t);return!!e&&ne.call(this,e.trigger,e.target)}deregister(t){const e=this.get(Y(t));return!!e&&se.call(this,e)}open(t){const e=this.get(t);return!!e&&e.open()}close(t){if(t){const e=this.get(t);return!!e&&e.close()}return H.call(this)}}export{v as Checkbox,$ as Drawer,K as Modal,oe as Popover,p as core};
1
+ function t(){return(t=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t}).apply(this,arguments)}var e=0;function i(t){return"__private_"+e+++"_"+t}function n(t,e){if(!Object.prototype.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var s=/*#__PURE__*/i("handler");class r{constructor(t,e){Object.defineProperty(this,s,{writable:!0,value:void 0}),this.value=t,n(this,s)[s]=e,this.mql=null}get handler(){return n(this,s)[s]}set handler(t){this.mql&&("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",n(this,s)[s]):this.mql.removeListener(n(this,s)[s])),n(this,s)[s]=t}mount(t,e){return t&&(this.value=t),e&&(n(this,s)[s]=e),this.value?(this.mql=window.matchMedia(`(min-width: ${this.value})`),"function"==typeof this.mql.addEventListener?this.mql.addEventListener("change",n(this,s)[s]):this.mql.addListener(n(this,s)[s]),n(this,s)[s](this.mql),this):this}unmount(){return this.mql?("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",n(this,s)[s]):this.mql.removeListener(n(this,s)[s]),this.value=null,n(this,s)[s]=null,this.mql=null,this):this}}class o{constructor(){this.collection=[]}async register(t){return await this.deregister(t),this.collection.push(t),this.collection}async deregister(t){const e=this.collection.findIndex(e=>e===t);if(e>=0){const t=this.collection[e];Object.getOwnPropertyNames(t).forEach(e=>{delete t[e]}),this.collection.splice(e,1)}return this.collection}async registerCollection(t){return await Promise.all(Array.from(t,t=>{this.register(t)})),this.collection}async deregisterCollection(){for(;this.collection.length>0;)await this.deregister(this.collection[0]);return this.collection}get(t,e="id"){return this.collection.find(i=>i[e]===t)}}var a=['a[href]:not([tabindex^="-"])','area[href]:not([tabindex^="-"])','input:not([type="hidden"]):not([type="radio"]):not([disabled]):not([tabindex^="-"])','input[type="radio"]:not([disabled]):not([tabindex^="-"])','select:not([disabled]):not([tabindex^="-"])','textarea:not([disabled]):not([tabindex^="-"])','button:not([disabled]):not([tabindex^="-"])','iframe:not([tabindex^="-"])','audio[controls]:not([tabindex^="-"])','video[controls]:not([tabindex^="-"])','[contenteditable]:not([tabindex^="-"])','[tabindex]:not([tabindex^="-"])'],l=/*#__PURE__*/i("focusable"),c=/*#__PURE__*/i("handleFocusTrap"),d=/*#__PURE__*/i("handleFocusLock");class u{constructor(t=null,e="[data-focus]"){Object.defineProperty(this,l,{writable:!0,value:void 0}),Object.defineProperty(this,c,{writable:!0,value:void 0}),Object.defineProperty(this,d,{writable:!0,value:void 0}),this.el=t,this.selectorFocus=e,n(this,c)[c]=h.bind(this),n(this,d)[d]=f.bind(this)}get focusable(){return n(this,l)[l]}set focusable(t){n(this,l)[l]=t,n(this,l)[l].length?(document.removeEventListener("keydown",n(this,d)[d]),document.addEventListener("keydown",n(this,c)[c])):(document.removeEventListener("keydown",n(this,c)[c]),document.addEventListener("keydown",n(this,d)[d]))}get focusableFirst(){return this.focusable[0]}get focusableLast(){return this.focusable[this.focusable.length-1]}mount(t,e){t&&(this.el=t),e&&(this.selectorFocus=e),this.focusable=this.getFocusable(),this.focus()}unmount(){this.el=null,this.focusable=[],document.removeEventListener("keydown",n(this,c)[c]),document.removeEventListener("keydown",n(this,d)[d])}focus(t=this.el,e=this.selectorFocus){(t.querySelector(e)||t).focus()}getFocusable(t=this.el){const e=[],i=document.activeElement,n=t.scrollTop;return t.querySelectorAll(a.join(",")).forEach(t=>{t.focus(),document.activeElement===t&&e.push(t)}),t.scrollTop=n,i.focus(),e}}function h(t){("Tab"===t.key||9===t.keyCode)&&(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 f(t){("Tab"===t.key||9===t.keyCode)&&t.preventDefault()}function p(t,e){const i=(t.getAttribute(`data-${e}`)||"").replace(/'/g,'"');return i?JSON.parse(i):{}}function g(t,e=!0){function i(e){localStorage.setItem(t,JSON.stringify(e))}return new Proxy(function(){const e=localStorage.getItem(t);return e?JSON.parse(e):{}}(),{set:(t,n,s)=>(t[n]=s,e&&i(t),!0),deleteProperty:(t,n)=>(delete t[n],e&&i(t),!0)})}function m(t,e,i){const n=e.nodeType===Node.COMMENT_NODE,s=e.nodeType===Node.ELEMENT_NODE;if(n&&(i="after"),!(e=n||s?e:document.querySelector(e)))throw new Error(`Not a valid teleport reference: '${e}'`);if("function"!=typeof e[i])throw new Error(`Not a valid teleport method: '${i}'`);let r=null;return n||(r=document.createComment("teleported #"+t.id),t.before(r)),e[i](t),n&&e.remove(),r}const v=(t,e)=>new Promise(i=>{e.transition?(t.classList.remove(e.stateClosed),t.classList.add(e.stateOpening),t.addEventListener("transitionend",function n(){t.classList.add(e.stateOpened),t.classList.remove(e.stateOpening),i(t),this.removeEventListener("transitionend",n)})):(t.classList.add(e.stateOpened),t.classList.remove(e.stateClosed),i(t))}),b=(t,e)=>new Promise(i=>{e.transition?(t.classList.add(e.stateClosing),t.classList.remove(e.stateOpened),t.addEventListener("transitionend",function n(){t.classList.remove(e.stateClosing),t.classList.add(e.stateClosed),i(t),this.removeEventListener("transitionend",n)})):(t.classList.add(e.stateClosed),t.classList.remove(e.stateOpened),i(t))});function y(t,e){var i,n;i=!!t,(n=e.selectorInert)&&document.querySelectorAll(n).forEach(t=>{i?(t.inert=!0,t.setAttribute("aria-hidden",!0)):(t.inert=null,t.removeAttribute("aria-hidden"))}),function(t,e){e&&document.querySelectorAll(e).forEach(e=>{t?e.style.overflow="hidden":e.style.removeProperty("overflow")})}(!!t,e.selectorOverflow)}var w={__proto__:null,Breakpoint:r,Collection:o,FocusTrap:u,getConfig:p,getPrefix:function(){return getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix").trim()},localStore:g,teleport:m,openTransition:v,closeTransition:b,updateGlobalState:y},E={autoInit:!1,stateAttr:"aria-checked",stateValue:"mixed"};class x{constructor(e){this.defaults=E,this.settings=t({},this.defaults,e),this.__handlerClick=this.handlerClick.bind(this),this.settings.autoInit&&this.init()}init(e=null){e&&(this.settings=t({},this.settings,e));const i=document.querySelectorAll(`[${this.settings.stateAttr}="${this.settings.stateValue}"]`);this.setIndeterminate(i),document.addEventListener("click",this.__handlerClick,!1)}destroy(){document.removeEventListener("click",this.__handlerClick,!1)}handlerClick(t){const e=t.target.closest(`[${this.settings.stateAttr}="${this.settings.stateValue}"]`);e&&(this.removeAriaState(e),this.setIndeterminate(e))}setAriaState(t,e=this.settings.stateValue){(t=t.forEach?t:[t]).forEach(t=>{t.setAttribute(this.settings.stateAttr,e)})}removeAriaState(t){(t=t.forEach?t:[t]).forEach(t=>{t.removeAttribute(this.settings.stateAttr)})}setIndeterminate(t){(t=t.forEach?t:[t]).forEach(t=>{t.indeterminate=!!t.hasAttribute(this.settings.stateAttr)})}}var O={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 L(t){const e=t.target.closest(`\n [data-${this.settings.dataOpen}],\n [data-${this.settings.dataToggle}],\n [data-${this.settings.dataClose}]\n `);e?(t.preventDefault(),e.matches(`[data-${this.settings.dataToggle}]`)&&e.getAttribute(`data-${this.settings.dataToggle}`).trim().split(" ").forEach(t=>{const i=this.get(t);i.trigger=e,i.toggle()}),e.matches(`[data-${this.settings.dataOpen}]`)&&e.getAttribute(`data-${this.settings.dataOpen}`).trim().split(" ").forEach(t=>{const i=this.get(t);i.trigger=e,i.open()}),e.matches(`[data-${this.settings.dataClose}]`)&&e.getAttribute(`data-${this.settings.dataClose}`).trim().split(" ").forEach(i=>{if(i){const t=this.get(i);t.trigger=e,t.close()}else{const e=t.target.closest(this.settings.selectorDrawer);e&&this.close(e)}})):t.target.matches(this.settings.selectorDrawer)&&this.close(t.target.id)}function A(t){if("Escape"===t.key){const t=this.activeModal;t&&this.close(t)}}async function k(t,e=!0){if(!t)return this.collection;const i=this.collection.findIndex(e=>e.id===t.id);if(i>=0){const t=this.collection[i];e&&"opened"===t.state&&await t.close(!1),delete this.store[t.id],t.unmountBreakpoint(),Object.getOwnPropertyNames(t).forEach(e=>{delete t[e]}),this.collection.splice(i,1)}return this.collection}function C(){return getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix").trim()}function P(t){const e=C(),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 S(t){const e=this.get("string"==typeof t?t:t.id);if(e)return e;throw new Error(`Drawer not found in collection with id of "${t.id||t}".`)}function $(t){return"string"==typeof t?t:"function"==typeof t.hasAttribute?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)).id||!1:!!t.id&&t.id}function D(t){const e=$.call(this,t);if(e){const t=document.querySelector(`#${e}`),i=t?t.querySelector(this.settings.selectorDialog):null;return t||i?i?{drawer:t,dialog:i}:{error:new Error("Drawer is missing dialog element.")}:{error:new Error(`No drawer elements found using the ID: "${e}".`)}}return{error:new Error("Could not resolve the drawer ID.")}}async function j(t){this.store[t.id]?"opened"===this.store[t.id]?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 T(t){"opened"===t.state?"modal"===t.mode?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 q(e,i,n=!0){const s=S.call(this,e),r=t({},this.settings,s.settings);return void 0!==i&&(r.transition=i),"closed"===s.state&&(s.state="opening",await v(s.el,r),"modal"===s.mode&&y(!0,r),s.state="opened"),n&&T.call(this,s),s.el.dispatchEvent(new CustomEvent(r.customEventPrefix+"opened",{detail:this,bubbles:!0})),s}async function I(e,i,n=!0){const s=S.call(this,e),r=t({},this.settings,s.settings);return void 0!==i&&(r.transition=i),"opened"===s.state&&(s.state="closing",document.activeElement.blur(),await b(s.el,r),"modal"===s.mode&&y(!1,r),n&&T.call(this,s),s.state="closed",s.el.dispatchEvent(new CustomEvent(r.customEventPrefix+"closed",{detail:this,bubbles:!0}))),s}async function _(t,e,i){const n=S.call(this,t);return"closed"===n.state?q.call(this,n,e,i):I.call(this,n,e,i)}function M(t){switch(t.mode){case"inline":return R.call(this,t);case"modal":return N.call(this,t);default:throw new Error(`"${t.mode}" is not a valid drawer mode.`)}}async function R(e){return e.el.classList.remove(e.getSetting("classModal")),e.dialog.removeAttribute("aria-modal"),y(!1,t({},this.settings,e.settings)),this.focusTrap.unmount(),await j.call(this,e),e.el.dispatchEvent(new CustomEvent(e.getSetting("customEventPrefix")+"switchMode",{detail:this,bubbles:!0})),e}async function N(t){return t.el.classList.add(t.getSetting("classModal")),t.dialog.setAttribute("aria-modal","true"),!this.store[t.id]&&t.el.classList.contains(t.getSetting("stateOpened"))&&(this.store[t.id]="opened"),await I.call(this,t,!1,!1),t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix")+"switchMode",{detail:this,bubbles:!0})),t}async function B(e,i){await k.call(this,e,!1);const n=this,s=new r,o={open(t,e){return q.call(n,this,t,e)},close(t,e){return I.call(n,this,t,e)},toggle(t,e){return _.call(n,this,t,e)},deregister(){return k.call(n,this)},mountBreakpoint(){const t=this.breakpoint,e=this.handleBreakpoint.bind(this);return s.mount(t,e),this},unmountBreakpoint(){return s.unmount(),this},handleBreakpoint(t){return this.mode=t.matches?"inline":"modal",this},getSetting(t){return t in this.settings?this.settings[t]:n.settings[t]}},a=t({id:e.id,el:e,dialog:i,trigger:null,settings:p(e,this.settings.dataConfig),get breakpoint(){return P.call(n,e)},get state(){return l},set state(t){l=t,"opened"!==t&&"closed"!==t||"inline"===this.mode&&(n.store[this.id]=this.state)},get mode(){return c},set mode(t){c=t,M.call(n,this)}},o);let l=e.classList.contains(a.getSetting("stateOpened"))?"opened":"closed",c=e.classList.contains(a.getSetting("classModal"))?"modal":"inline";return"modal"===a.mode?a.dialog.setAttribute("aria-modal","true"):a.dialog.removeAttribute("aria-modal"),a.getSetting("setTabindex")&&a.dialog.setAttribute("tabindex","-1"),this.collection.push(a),a.breakpoint?a.mountBreakpoint():await j.call(this,a),a}var F=/*#__PURE__*/i("handleClick"),V=/*#__PURE__*/i("handleKeydown");class W extends o{constructor(e){super(),Object.defineProperty(this,F,{writable:!0,value:void 0}),Object.defineProperty(this,V,{writable:!0,value:void 0}),this.defaults=O,this.settings=t({},this.defaults,e),this.focusTrap=new u,this.store=g(this.settings.storeKey,this.settings.store),n(this,F)[F]=L.bind(this),n(this,V)[V]=A.bind(this),this.settings.autoInit&&this.init()}get activeModal(){return this.collection.find(t=>"opened"===t.state&&"modal"===t.mode)}async init(e=null){e&&(this.settings=t({},this.settings,e));const i=document.querySelectorAll(this.settings.selectorDrawer);return await this.registerCollection(i),this.settings.eventListeners&&this.initEventListeners(),this}async destroy(){return await this.deregisterCollection(),this.settings.eventListeners&&this.destroyEventListeners(),this}initEventListeners(){document.addEventListener("click",n(this,F)[F],!1),document.addEventListener("touchend",n(this,F)[F],!1),document.addEventListener("keydown",n(this,V)[V],!1)}destroyEventListeners(){document.removeEventListener("click",n(this,F)[F],!1),document.removeEventListener("touchend",n(this,F)[F],!1),document.removeEventListener("keydown",n(this,V)[V],!1)}register(t){const e=D.call(this,t);return e.error?Promise.reject(e.error):B.call(this,e.drawer,e.dialog)}deregister(t){const e=this.get($.call(this,t));return k.call(this,e)}open(t,e,i){return q.call(this,t,e,i)}close(t,e,i){return I.call(this,t,e,i)}toggle(t,e,i){return _.call(this,t,e,i)}}var H={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 z(t){const e=this.get("string"==typeof t?t:t.id);if(e)return e;throw new Error(`Modal not found in collection with id of "${t.id||t}".`)}function K(t){return"string"==typeof t?t:"function"==typeof t.hasAttribute?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)).id||!1:!!t.id&&t.id}function U(t){const e=K.call(this,t);if(e){const t=document.querySelector(`#${e}`),i=t?t.querySelector(this.settings.selectorDialog):null;return t||i?i?{modal:t,dialog:i}:{error:new Error("Modal is missing dialog element.")}:{error:new Error(`No modal elements found using the ID: "${e}".`)}}return{error:new Error("Could not resolve the modal ID.")}}function J(){this.active?this.focusTrap.mount(this.active.dialog,this.settings.selectorFocus):(this.trigger&&(this.trigger.focus(),this.trigger=null),this.focusTrap.unmount())}async function X(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 i=this.get(K.call(this,e));return e.matches(`[data-${this.settings.dataOpen}]`)?i.open():i.replace()}if(e=t.target.closest(`[data-${this.settings.dataClose}]`),e){t.preventDefault();const i=e.getAttribute(`data-${this.settings.dataClose}`);return"*"===i?this.closeAll():this.close(i)}if(t.target.matches(this.settings.selectorModal)&&!t.target.querySelector(this.settings.selectorRequired))return this.close(K.call(this,t.target))}function Y(t){if("Escape"===t.key&&this.active&&!this.active.dialog.matches(this.settings.selectorRequired))return this.close()}async function G(t,e=!0){if(!t)return this.collection;const i=this.collection.findIndex(e=>e.id===t.id);if(i>=0){const t=this.collection[i];if(e&&"opened"===t.state)await t.close(!1);else{const e=this.stack.findIndex(e=>e.id===t.id);e>=0&&this.stack.splice(e,1)}t.getSetting("teleport")&&t.teleportReturn(),Object.getOwnPropertyNames(t).forEach(e=>{delete t[e]}),this.collection.splice(i,1)}return this.collection}async function Q(e,i,n=!0){const s=z.call(this,e),r=t({},this.settings,s.settings);void 0!==i&&(r.transition=i);const o=this.stack.findIndex(t=>t.id===s.id);if(o>=0&&(this.stack.splice(o,1),this.stack.push(s)),"closed"===s.state){s.state="opening",s.el.style.zIndex=null;const t=getComputedStyle(s.el)["z-index"];s.el.style.zIndex=parseInt(t)+this.stack.length+1,this.stack.push(s),await v(s.el,r),s.state="opened"}return n&&J.call(this),s.el.dispatchEvent(new CustomEvent(r.customEventPrefix+"opened",{detail:this,bubbles:!0})),s}async function Z(e,i,n=!0){const s=e?z.call(this,e):this.active;if(s&&"opened"===s.state){s.state="closing";const e=t({},this.settings,s.settings);void 0!==i&&(e.transition=i),document.activeElement.blur(),await b(s.el,e),s.el.style.zIndex=null;const r=this.stack.findIndex(t=>t.id===s.id);this.stack.splice(r,1),n&&J.call(this),s.state="closed",s.el.dispatchEvent(new CustomEvent(e.customEventPrefix+"closed",{detail:this,bubbles:!0}))}return s}async function tt(t,e){const i=[];return await Promise.all(this.stack.map(async n=>{t&&t===n.id?Promise.resolve():i.push(await Z.call(this,n,e,!1)),n.trigger=null})),i}async function et(t,e,i=!0){const n=z.call(this,t);let s,r;return"opened"===n.state?(s=n,r=await tt.call(this,n.id,e)):(s=Q.call(this,n,e,!1),r=tt.call(this,!1,e),await Promise.all([s,r])),i&&J.call(this),{opened:s,closed:r}}async function it(e,i){await G.call(this,e,!1);const n=this,s={open(t,e){return Q.call(n,this,t,e)},close(t,e){return Z.call(n,this,t,e)},replace(t,e){return et.call(n,this,t,e)},deregister(){return G.call(n,this)},teleport(t=this.getSetting("teleport"),e=this.getSetting("teleportMethod")){return this.returnRef?(console.error("Element has already been teleported:",this.el),!1):(this.returnRef=m(this.el,t,e),this.el)},teleportReturn(){return this.returnRef?(this.returnRef=m(this.el,this.returnRef),this.el):(console.error("No return reference found:",this.el),!1)},getSetting(t){return t in this.settings?this.settings[t]:n.settings[t]}},r=t({id:e.id,state:"closed",el:e,dialog:i,returnRef:null,settings:p(e,this.settings.dataConfig)},s);return r.dialog.setAttribute("aria-modal","true"),r.dialog.hasAttribute("role")||r.dialog.setAttribute("role","dialog"),r.getSetting("setTabindex")&&r.dialog.setAttribute("tabindex","-1"),r.getSetting("teleport")&&r.teleport(),this.collection.push(r),r.el.classList.contains(this.settings.stateOpened)?await r.open(!1):(r.el.classList.remove(this.settings.stateOpening),r.el.classList.remove(this.settings.stateClosing),r.el.classList.add(this.settings.stateClosed)),r}var nt=/*#__PURE__*/i("handleClick"),st=/*#__PURE__*/i("handleKeydown");class rt extends o{constructor(e){super(),Object.defineProperty(this,nt,{writable:!0,value:void 0}),Object.defineProperty(this,st,{writable:!0,value:void 0}),this.defaults=H,this.settings=t({},this.defaults,e),this.trigger=null,this.focusTrap=new u,this.stack=new Proxy([],{set:(t,e,i)=>(t[e]=i,"length"===e&&(y(this.active,this.settings),this.stack.forEach((t,e)=>{t.el.style.zIndex=null;const i=getComputedStyle(t.el)["z-index"];t.el.style.zIndex=parseInt(i)+e+1})),!0)}),n(this,nt)[nt]=X.bind(this),n(this,st)[st]=Y.bind(this),this.settings.autoInit&&this.init()}get active(){return this.stack[this.stack.length-1]}async init(e){e&&(this.settings=t({},this.settings,e));const i=document.querySelectorAll(this.settings.selectorModal);return await this.registerCollection(i),this.settings.eventListeners&&this.initEventListeners(),this}async destroy(){return this.trigger=null,await this.deregisterCollection(),this.settings.eventListeners&&this.destroyEventListeners(),this}initEventListeners(){document.addEventListener("click",n(this,nt)[nt],!1),document.addEventListener("touchend",n(this,nt)[nt],!1),document.addEventListener("keydown",n(this,st)[st],!1)}destroyEventListeners(){document.removeEventListener("click",n(this,nt)[nt],!1),document.removeEventListener("touchend",n(this,nt)[nt],!1),document.removeEventListener("keydown",n(this,st)[st],!1)}register(t){const e=U.call(this,t);return e.error?Promise.reject(e.error):it.call(this,e.modal,e.dialog)}deregister(t){const e=this.get(K.call(this,t));return G.call(this,e)}open(t,e,i){return Q.call(this,t,e,i)}close(t,e,i){return Z.call(this,t,e,i)}replace(t,e,i){return et.call(this,t,e,i)}async closeAll(t=!1,e,i=!0){const n=await tt.call(this,t,e);return i&&J.call(this),n}}var ot={autoInit:!1,selectorPopover:".popover",selectorArrow:".popover__arrow",stateActive:"is-active",eventListeners:!0,eventType:"click",placement:"bottom"};function at(t,e){const i=getComputedStyle(t),n={placement:e.placement,event:e.eventType,offset:0,"overflow-padding":0,"flip-padding":0,"arrow-element":e.selectorArrow,"arrow-padding":0};for(const t in n){const e=C(),s=i.getPropertyValue(`--${e}popover-${t}`).trim();s&&(n[t]=s)}return n}function lt(t){let e;const i="string"==typeof t?t.trim().split(" "):[t];switch(i.forEach(function(t,e){i[e]=parseInt(t,10)}),i.length){case 1:e=i[0];break;case 2:e={top:i[0],right:i[1],bottom:i[0],left:i[1]};break;case 3:e={top:i[0],right:i[1],bottom:i[2],left:i[1]};break;case 4:e={top:i[0],right:i[1],bottom:i[2],left:i[3]};break;default:e=!1}return e}function ct(t){const e=this.get("string"==typeof t?t:t.id);if(e)return e;throw new Error(`Popover not found in collection with id of "${t}".`)}function dt(t){return"string"==typeof t?t:"function"==typeof t.hasAttribute?t.closest(this.settings.selectorPopover)?(t=t.closest(this.settings.selectorPopover)).id:t.hasAttribute("aria-controls")?t.getAttribute("aria-controls"):!!t.hasAttribute("aria-describedby")&&t.getAttribute("aria-describedby"):!!t.id&&t.id}function ut(t){const e=dt.call(this,t);if(e){const t=document.querySelector(`#${e}`),i=document.querySelector(`[aria-controls="${e}"]`)||document.querySelector(`[aria-describedby="${e}"]`);return i||t?i?t?{popover:t,trigger:i}:{error:new Error("No popover associated with the provided popover trigger.")}:{error:new Error("No popover trigger associated with the provided popover.")}:{error:new Error(`No popover elements found using the ID: "${e}".`)}}return{error:new Error("Could not resolve the popover ID.")}}async function ht(t){const e=t?ct.call(this,t):await ft.call(this);return e&&"opened"===e.state&&(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 ft(){const t=[];return await Promise.all(this.collection.map(async e=>{"opened"===e.state&&t.push(await ht.call(this,e))})),t}function pt(t){"opened"==t.state&&setTimeout(()=>{const e=t.el.closest(":hover")===t.el||t.trigger.closest(":hover")===t.trigger,i=document.activeElement.closest(`#${t.id}, [aria-controls="${t.id}"]`);return e||i||t.close(),t},1)}function gt(t){"opened"===t.state?t.close():(this.trigger=t.trigger,t.open(),vt.call(this,t))}function mt(t){switch(t.key){case"Escape":return this.trigger&&this.trigger.focus(),void ft.call(this);case"Tab":return void this.collection.forEach(t=>{pt.call(this,t)});default:return}}function vt(t){const e=this;document.addEventListener("click",function i(n){n.target.closest(`#${t.id}, [aria-controls="${t.id}"]`)?t.el&&!t.el.classList.contains(e.settings.stateActive)&&this.removeEventListener("click",i):(t.el&&t.el.classList.contains(e.settings.stateActive)&&t.close(),this.removeEventListener("click",i))})}var bt="top",yt="bottom",wt="right",Et="left",xt=[bt,yt,wt,Et],Ot=/*#__PURE__*/xt.reduce(function(t,e){return t.concat([e+"-start",e+"-end"])},[]),Lt=/*#__PURE__*/[].concat(xt,["auto"]).reduce(function(t,e){return t.concat([e,e+"-start",e+"-end"])},[]),At=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function kt(t){return t?(t.nodeName||"").toLowerCase():null}function Ct(t){if(null==t)return window;if("[object Window]"!==t.toString()){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function Pt(t){return t instanceof Ct(t).Element||t instanceof Element}function St(t){return t instanceof Ct(t).HTMLElement||t instanceof HTMLElement}function $t(t){return"undefined"!=typeof ShadowRoot&&(t instanceof Ct(t).ShadowRoot||t instanceof ShadowRoot)}function Dt(t){return t.split("-")[0]}var jt=Math.max,Tt=Math.min,qt=Math.round;function It(t,e){void 0===e&&(e=!1);var i=t.getBoundingClientRect(),n=1,s=1;if(St(t)&&e){var r=t.offsetHeight,o=t.offsetWidth;o>0&&(n=qt(i.width)/o||1),r>0&&(s=qt(i.height)/r||1)}return{width:i.width/n,height:i.height/s,top:i.top/s,right:i.right/n,bottom:i.bottom/s,left:i.left/n,x:i.left/n,y:i.top/s}}function _t(t){var e=It(t),i=t.offsetWidth,n=t.offsetHeight;return Math.abs(e.width-i)<=1&&(i=e.width),Math.abs(e.height-n)<=1&&(n=e.height),{x:t.offsetLeft,y:t.offsetTop,width:i,height:n}}function Mt(t,e){var i=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(i&&$t(i)){var n=e;do{if(n&&t.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function Rt(t){return Ct(t).getComputedStyle(t)}function Nt(t){return["table","td","th"].indexOf(kt(t))>=0}function Bt(t){return((Pt(t)?t.ownerDocument:t.document)||window.document).documentElement}function Ft(t){return"html"===kt(t)?t:t.assignedSlot||t.parentNode||($t(t)?t.host:null)||Bt(t)}function Vt(t){return St(t)&&"fixed"!==Rt(t).position?t.offsetParent:null}function Wt(t){for(var e=Ct(t),i=Vt(t);i&&Nt(i)&&"static"===Rt(i).position;)i=Vt(i);return i&&("html"===kt(i)||"body"===kt(i)&&"static"===Rt(i).position)?e:i||function(t){var e=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&St(t)&&"fixed"===Rt(t).position)return null;var i=Ft(t);for($t(i)&&(i=i.host);St(i)&&["html","body"].indexOf(kt(i))<0;){var n=Rt(i);if("none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||-1!==["transform","perspective"].indexOf(n.willChange)||e&&"filter"===n.willChange||e&&n.filter&&"none"!==n.filter)return i;i=i.parentNode}return null}(t)||e}function Ht(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function zt(t,e,i){return jt(t,Tt(e,i))}function Kt(t){return Object.assign({},{top:0,right:0,bottom:0,left:0},t)}function Ut(t,e){return e.reduce(function(e,i){return e[i]=t,e},{})}function Jt(t){return t.split("-")[1]}var Xt={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Yt(t){var e,i=t.popper,n=t.popperRect,s=t.placement,r=t.variation,o=t.offsets,a=t.position,l=t.gpuAcceleration,c=t.adaptive,d=t.roundOffsets,u=t.isFixed,h=o.x,f=void 0===h?0:h,p=o.y,g=void 0===p?0:p,m="function"==typeof d?d({x:f,y:g}):{x:f,y:g};f=m.x,g=m.y;var v=o.hasOwnProperty("x"),b=o.hasOwnProperty("y"),y=Et,w=bt,E=window;if(c){var x=Wt(i),O="clientHeight",L="clientWidth";x===Ct(i)&&"static"!==Rt(x=Bt(i)).position&&"absolute"===a&&(O="scrollHeight",L="scrollWidth"),x=x,(s===bt||(s===Et||s===wt)&&"end"===r)&&(w=yt,g-=(u&&x===E&&E.visualViewport?E.visualViewport.height:x[O])-n.height,g*=l?1:-1),s!==Et&&(s!==bt&&s!==yt||"end"!==r)||(y=wt,f-=(u&&x===E&&E.visualViewport?E.visualViewport.width:x[L])-n.width,f*=l?1:-1)}var A,k=Object.assign({position:a},c&&Xt),C=!0===d?function(t){var e=t.y,i=window.devicePixelRatio||1;return{x:qt(t.x*i)/i||0,y:qt(e*i)/i||0}}({x:f,y:g}):{x:f,y:g};return f=C.x,g=C.y,Object.assign({},k,l?((A={})[w]=b?"0":"",A[y]=v?"0":"",A.transform=(E.devicePixelRatio||1)<=1?"translate("+f+"px, "+g+"px)":"translate3d("+f+"px, "+g+"px, 0)",A):((e={})[w]=b?g+"px":"",e[y]=v?f+"px":"",e.transform="",e))}var Gt={passive:!0},Qt={left:"right",right:"left",bottom:"top",top:"bottom"};function Zt(t){return t.replace(/left|right|bottom|top/g,function(t){return Qt[t]})}var te={start:"end",end:"start"};function ee(t){return t.replace(/start|end/g,function(t){return te[t]})}function ie(t){var e=Ct(t);return{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function ne(t){return It(Bt(t)).left+ie(t).scrollLeft}function se(t){var e=Rt(t);return/auto|scroll|overlay|hidden/.test(e.overflow+e.overflowY+e.overflowX)}function re(t){return["html","body","#document"].indexOf(kt(t))>=0?t.ownerDocument.body:St(t)&&se(t)?t:re(Ft(t))}function oe(t,e){var i;void 0===e&&(e=[]);var n=re(t),s=n===(null==(i=t.ownerDocument)?void 0:i.body),r=Ct(n),o=s?[r].concat(r.visualViewport||[],se(n)?n:[]):n,a=e.concat(o);return s?a:a.concat(oe(Ft(o)))}function ae(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function le(t,e){return"viewport"===e?ae(function(t){var e=Ct(t),i=Bt(t),n=e.visualViewport,s=i.clientWidth,r=i.clientHeight,o=0,a=0;return n&&(s=n.width,r=n.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(o=n.offsetLeft,a=n.offsetTop)),{width:s,height:r,x:o+ne(t),y:a}}(t)):Pt(e)?function(t){var e=It(t);return e.top=e.top+t.clientTop,e.left=e.left+t.clientLeft,e.bottom=e.top+t.clientHeight,e.right=e.left+t.clientWidth,e.width=t.clientWidth,e.height=t.clientHeight,e.x=e.left,e.y=e.top,e}(e):ae(function(t){var e,i=Bt(t),n=ie(t),s=null==(e=t.ownerDocument)?void 0:e.body,r=jt(i.scrollWidth,i.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),o=jt(i.scrollHeight,i.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),a=-n.scrollLeft+ne(t),l=-n.scrollTop;return"rtl"===Rt(s||i).direction&&(a+=jt(i.clientWidth,s?s.clientWidth:0)-r),{width:r,height:o,x:a,y:l}}(Bt(t)))}function ce(t){var e,i=t.reference,n=t.element,s=t.placement,r=s?Dt(s):null,o=s?Jt(s):null,a=i.x+i.width/2-n.width/2,l=i.y+i.height/2-n.height/2;switch(r){case bt:e={x:a,y:i.y-n.height};break;case yt:e={x:a,y:i.y+i.height};break;case wt:e={x:i.x+i.width,y:l};break;case Et:e={x:i.x-n.width,y:l};break;default:e={x:i.x,y:i.y}}var c=r?Ht(r):null;if(null!=c){var d="y"===c?"height":"width";switch(o){case"start":e[c]=e[c]-(i[d]/2-n[d]/2);break;case"end":e[c]=e[c]+(i[d]/2-n[d]/2)}}return e}function de(t,e){void 0===e&&(e={});var i=e.placement,n=void 0===i?t.placement:i,s=e.boundary,r=void 0===s?"clippingParents":s,o=e.rootBoundary,a=void 0===o?"viewport":o,l=e.elementContext,c=void 0===l?"popper":l,d=e.altBoundary,u=void 0!==d&&d,h=e.padding,f=void 0===h?0:h,p=Kt("number"!=typeof f?f:Ut(f,xt)),g=t.rects.popper,m=t.elements[u?"popper"===c?"reference":"popper":c],v=function(t,e,i){var n="clippingParents"===e?function(t){var e=oe(Ft(t)),i=["absolute","fixed"].indexOf(Rt(t).position)>=0&&St(t)?Wt(t):t;return Pt(i)?e.filter(function(t){return Pt(t)&&Mt(t,i)&&"body"!==kt(t)}):[]}(t):[].concat(e),s=[].concat(n,[i]),r=s.reduce(function(e,i){var n=le(t,i);return e.top=jt(n.top,e.top),e.right=Tt(n.right,e.right),e.bottom=Tt(n.bottom,e.bottom),e.left=jt(n.left,e.left),e},le(t,s[0]));return r.width=r.right-r.left,r.height=r.bottom-r.top,r.x=r.left,r.y=r.top,r}(Pt(m)?m:m.contextElement||Bt(t.elements.popper),r,a),b=It(t.elements.reference),y=ce({reference:b,element:g,strategy:"absolute",placement:n}),w=ae(Object.assign({},g,y)),E="popper"===c?w:b,x={top:v.top-E.top+p.top,bottom:E.bottom-v.bottom+p.bottom,left:v.left-E.left+p.left,right:E.right-v.right+p.right},O=t.modifiersData.offset;if("popper"===c&&O){var L=O[n];Object.keys(x).forEach(function(t){var e=[wt,yt].indexOf(t)>=0?1:-1,i=[bt,yt].indexOf(t)>=0?"y":"x";x[t]+=L[i]*e})}return x}function ue(t,e){void 0===e&&(e={});var i=e.boundary,n=e.rootBoundary,s=e.padding,r=e.flipVariations,o=e.allowedAutoPlacements,a=void 0===o?Lt:o,l=Jt(e.placement),c=l?r?Ot:Ot.filter(function(t){return Jt(t)===l}):xt,d=c.filter(function(t){return a.indexOf(t)>=0});0===d.length&&(d=c);var u=d.reduce(function(e,r){return e[r]=de(t,{placement:r,boundary:i,rootBoundary:n,padding:s})[Dt(r)],e},{});return Object.keys(u).sort(function(t,e){return u[t]-u[e]})}function he(t,e,i){return void 0===i&&(i={x:0,y:0}),{top:t.top-e.height-i.y,right:t.right-e.width+i.x,bottom:t.bottom-e.height+i.y,left:t.left-e.width-i.x}}function fe(t){return[bt,wt,yt,Et].some(function(e){return t[e]>=0})}function pe(t,e,i){void 0===i&&(i=!1);var n,s,r=St(e),o=St(e)&&function(t){var e=t.getBoundingClientRect(),i=qt(e.width)/t.offsetWidth||1,n=qt(e.height)/t.offsetHeight||1;return 1!==i||1!==n}(e),a=Bt(e),l=It(t,o),c={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(r||!r&&!i)&&(("body"!==kt(e)||se(a))&&(c=(n=e)!==Ct(n)&&St(n)?{scrollLeft:(s=n).scrollLeft,scrollTop:s.scrollTop}:ie(n)),St(e)?((d=It(e,!0)).x+=e.clientLeft,d.y+=e.clientTop):a&&(d.x=ne(a))),{x:l.left+c.scrollLeft-d.x,y:l.top+c.scrollTop-d.y,width:l.width,height:l.height}}function ge(t){var e=new Map,i=new Set,n=[];function s(t){i.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach(function(t){if(!i.has(t)){var n=e.get(t);n&&s(n)}}),n.push(t)}return t.forEach(function(t){e.set(t.name,t)}),t.forEach(function(t){i.has(t.name)||s(t)}),n}var me={placement:"bottom",modifiers:[],strategy:"absolute"};function ve(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return!e.some(function(t){return!(t&&"function"==typeof t.getBoundingClientRect)})}function be(t){void 0===t&&(t={});var e=t.defaultModifiers,i=void 0===e?[]:e,n=t.defaultOptions,s=void 0===n?me:n;return function(t,e,n){void 0===n&&(n=s);var r,o,a={placement:"bottom",orderedModifiers:[],options:Object.assign({},me,s),modifiersData:{},elements:{reference:t,popper:e},attributes:{},styles:{}},l=[],c=!1,d={state:a,setOptions:function(n){var r="function"==typeof n?n(a.options):n;u(),a.options=Object.assign({},s,a.options,r),a.scrollParents={reference:Pt(t)?oe(t):t.contextElement?oe(t.contextElement):[],popper:oe(e)};var o,c,h=function(t){var e=ge(t);return At.reduce(function(t,i){return t.concat(e.filter(function(t){return t.phase===i}))},[])}((o=[].concat(i,a.options.modifiers),c=o.reduce(function(t,e){var i=t[e.name];return t[e.name]=i?Object.assign({},i,e,{options:Object.assign({},i.options,e.options),data:Object.assign({},i.data,e.data)}):e,t},{}),Object.keys(c).map(function(t){return c[t]})));return a.orderedModifiers=h.filter(function(t){return t.enabled}),a.orderedModifiers.forEach(function(t){var e=t.options,i=t.effect;if("function"==typeof i){var n=i({state:a,name:t.name,instance:d,options:void 0===e?{}:e});l.push(n||function(){})}}),d.update()},forceUpdate:function(){if(!c){var t=a.elements,e=t.reference,i=t.popper;if(ve(e,i)){a.rects={reference:pe(e,Wt(i),"fixed"===a.options.strategy),popper:_t(i)},a.reset=!1,a.placement=a.options.placement,a.orderedModifiers.forEach(function(t){return a.modifiersData[t.name]=Object.assign({},t.data)});for(var n=0;n<a.orderedModifiers.length;n++)if(!0!==a.reset){var s=a.orderedModifiers[n],r=s.fn,o=s.options;"function"==typeof r&&(a=r({state:a,options:void 0===o?{}:o,name:s.name,instance:d})||a)}else a.reset=!1,n=-1}}},update:(r=function(){return new Promise(function(t){d.forceUpdate(),t(a)})},function(){return o||(o=new Promise(function(t){Promise.resolve().then(function(){o=void 0,t(r())})})),o}),destroy:function(){u(),c=!0}};if(!ve(t,e))return d;function u(){l.forEach(function(t){return t()}),l=[]}return d.setOptions(n).then(function(t){!c&&n.onFirstUpdate&&n.onFirstUpdate(t)}),d}}var ye=/*#__PURE__*/be({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(t){var e=t.state,i=t.instance,n=t.options,s=n.scroll,r=void 0===s||s,o=n.resize,a=void 0===o||o,l=Ct(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return r&&c.forEach(function(t){t.addEventListener("scroll",i.update,Gt)}),a&&l.addEventListener("resize",i.update,Gt),function(){r&&c.forEach(function(t){t.removeEventListener("scroll",i.update,Gt)}),a&&l.removeEventListener("resize",i.update,Gt)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(t){var e=t.state;e.modifiersData[t.name]=ce({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(t){var e=t.state,i=t.options,n=i.gpuAcceleration,s=void 0===n||n,r=i.adaptive,o=void 0===r||r,a=i.roundOffsets,l=void 0===a||a,c={placement:Dt(e.placement),variation:Jt(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:s,isFixed:"fixed"===e.options.strategy};null!=e.modifiersData.popperOffsets&&(e.styles.popper=Object.assign({},e.styles.popper,Yt(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:l})))),null!=e.modifiersData.arrow&&(e.styles.arrow=Object.assign({},e.styles.arrow,Yt(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})},data:{}},{name:"applyStyles",enabled:!0,phase:"write",fn:function(t){var e=t.state;Object.keys(e.elements).forEach(function(t){var i=e.styles[t]||{},n=e.attributes[t]||{},s=e.elements[t];St(s)&&kt(s)&&(Object.assign(s.style,i),Object.keys(n).forEach(function(t){var e=n[t];!1===e?s.removeAttribute(t):s.setAttribute(t,!0===e?"":e)}))})},effect:function(t){var e=t.state,i={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,i.popper),e.styles=i,e.elements.arrow&&Object.assign(e.elements.arrow.style,i.arrow),function(){Object.keys(e.elements).forEach(function(t){var n=e.elements[t],s=e.attributes[t]||{},r=Object.keys(e.styles.hasOwnProperty(t)?e.styles[t]:i[t]).reduce(function(t,e){return t[e]="",t},{});St(n)&&kt(n)&&(Object.assign(n.style,r),Object.keys(s).forEach(function(t){n.removeAttribute(t)}))})}},requires:["computeStyles"]},{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(t){var e=t.state,i=t.name,n=t.options.offset,s=void 0===n?[0,0]:n,r=Lt.reduce(function(t,i){return t[i]=function(t,e,i){var n=Dt(t),s=[Et,bt].indexOf(n)>=0?-1:1,r="function"==typeof i?i(Object.assign({},e,{placement:t})):i,o=r[0],a=r[1];return o=o||0,a=(a||0)*s,[Et,wt].indexOf(n)>=0?{x:a,y:o}:{x:o,y:a}}(i,e.rects,s),t},{}),o=r[e.placement],a=o.y;null!=e.modifiersData.popperOffsets&&(e.modifiersData.popperOffsets.x+=o.x,e.modifiersData.popperOffsets.y+=a),e.modifiersData[i]=r}},{name:"flip",enabled:!0,phase:"main",fn:function(t){var e=t.state,i=t.options,n=t.name;if(!e.modifiersData[n]._skip){for(var s=i.mainAxis,r=void 0===s||s,o=i.altAxis,a=void 0===o||o,l=i.fallbackPlacements,c=i.padding,d=i.boundary,u=i.rootBoundary,h=i.altBoundary,f=i.flipVariations,p=void 0===f||f,g=i.allowedAutoPlacements,m=e.options.placement,v=Dt(m),b=l||(v!==m&&p?function(t){if("auto"===Dt(t))return[];var e=Zt(t);return[ee(t),e,ee(e)]}(m):[Zt(m)]),y=[m].concat(b).reduce(function(t,i){return t.concat("auto"===Dt(i)?ue(e,{placement:i,boundary:d,rootBoundary:u,padding:c,flipVariations:p,allowedAutoPlacements:g}):i)},[]),w=e.rects.reference,E=e.rects.popper,x=new Map,O=!0,L=y[0],A=0;A<y.length;A++){var k=y[A],C=Dt(k),P="start"===Jt(k),S=[bt,yt].indexOf(C)>=0,$=S?"width":"height",D=de(e,{placement:k,boundary:d,rootBoundary:u,altBoundary:h,padding:c}),j=S?P?wt:Et:P?yt:bt;w[$]>E[$]&&(j=Zt(j));var T=Zt(j),q=[];if(r&&q.push(D[C]<=0),a&&q.push(D[j]<=0,D[T]<=0),q.every(function(t){return t})){L=k,O=!1;break}x.set(k,q)}if(O)for(var I=function(t){var e=y.find(function(e){var i=x.get(e);if(i)return i.slice(0,t).every(function(t){return t})});if(e)return L=e,"break"},_=p?3:1;_>0&&"break"!==I(_);_--);e.placement!==L&&(e.modifiersData[n]._skip=!0,e.placement=L,e.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},{name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var e=t.state,i=t.options,n=t.name,s=i.mainAxis,r=void 0===s||s,o=i.altAxis,a=void 0!==o&&o,l=i.tether,c=void 0===l||l,d=i.tetherOffset,u=void 0===d?0:d,h=de(e,{boundary:i.boundary,rootBoundary:i.rootBoundary,padding:i.padding,altBoundary:i.altBoundary}),f=Dt(e.placement),p=Jt(e.placement),g=!p,m=Ht(f),v="x"===m?"y":"x",b=e.modifiersData.popperOffsets,y=e.rects.reference,w=e.rects.popper,E="function"==typeof u?u(Object.assign({},e.rects,{placement:e.placement})):u,x="number"==typeof E?{mainAxis:E,altAxis:E}:Object.assign({mainAxis:0,altAxis:0},E),O=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,L={x:0,y:0};if(b){if(r){var A,k="y"===m?bt:Et,C="y"===m?yt:wt,P="y"===m?"height":"width",S=b[m],$=S+h[k],D=S-h[C],j=c?-w[P]/2:0,T="start"===p?y[P]:w[P],q="start"===p?-w[P]:-y[P],I=e.elements.arrow,_=c&&I?_t(I):{width:0,height:0},M=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},R=M[k],N=M[C],B=zt(0,y[P],_[P]),F=g?y[P]/2-j-B-R-x.mainAxis:T-B-R-x.mainAxis,V=g?-y[P]/2+j+B+N+x.mainAxis:q+B+N+x.mainAxis,W=e.elements.arrow&&Wt(e.elements.arrow),H=null!=(A=null==O?void 0:O[m])?A:0,z=S+V-H,K=zt(c?Tt($,S+F-H-(W?"y"===m?W.clientTop||0:W.clientLeft||0:0)):$,S,c?jt(D,z):D);b[m]=K,L[m]=K-S}if(a){var U,J=b[v],X="y"===v?"height":"width",Y=J+h["x"===m?bt:Et],G=J-h["x"===m?yt:wt],Q=-1!==[bt,Et].indexOf(f),Z=null!=(U=null==O?void 0:O[v])?U:0,tt=Q?Y:J-y[X]-w[X]-Z+x.altAxis,et=Q?J+y[X]+w[X]-Z-x.altAxis:G,it=c&&Q?function(t,e,i){var n=zt(t,e,i);return n>i?i:n}(tt,J,et):zt(c?tt:Y,J,c?et:G);b[v]=it,L[v]=it-J}e.modifiersData[n]=L}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(t){var e,i=t.state,n=t.name,s=t.options,r=i.elements.arrow,o=i.modifiersData.popperOffsets,a=Dt(i.placement),l=Ht(a),c=[Et,wt].indexOf(a)>=0?"height":"width";if(r&&o){var d=function(t,e){return Kt("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:Ut(t,xt))}(s.padding,i),u=_t(r),h="y"===l?bt:Et,f="y"===l?yt:wt,p=i.rects.reference[c]+i.rects.reference[l]-o[l]-i.rects.popper[c],g=o[l]-i.rects.reference[l],m=Wt(r),v=m?"y"===l?m.clientHeight||0:m.clientWidth||0:0,b=v/2-u[c]/2+(p/2-g/2),y=zt(d[h],b,v-u[c]-d[f]);i.modifiersData[n]=((e={})[l]=y,e.centerOffset=y-b,e)}},effect:function(t){var e=t.state,i=t.options.element,n=void 0===i?"[data-popper-arrow]":i;null!=n&&("string"!=typeof n||(n=e.elements.popper.querySelector(n)))&&Mt(e.elements.popper,n)&&(e.elements.arrow=n)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(t){var e=t.state,i=t.name,n=e.rects.reference,s=e.rects.popper,r=e.modifiersData.preventOverflow,o=de(e,{elementContext:"reference"}),a=de(e,{altBoundary:!0}),l=he(o,n),c=he(a,s,r),d=fe(l),u=fe(c);e.modifiersData[i]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:d,hasPopperEscaped:u},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":u})}}]});async function we(t){if(!t)return this.collection;const e=this.collection.findIndex(e=>e.id===t.id);if(e>=0){const t=this.collection[e];"opened"===t.state&&t.close(),t.popper.destroy(),Ee(t),Object.getOwnPropertyNames(t).forEach(e=>{delete t[e]}),this.collection.splice(e,1)}return this.collection}function Ee(t){return t.__eventListeners&&(t.__eventListeners.forEach(e=>{e.el.forEach(i=>{e.type.forEach(n=>{t[i].removeEventListener(n,e.listener,!1)})})}),delete t.__eventListeners),t}async function xe(t){const e=ct.call(this,t);var i;return e.el.classList.add(this.settings.stateActive),e.trigger.hasAttribute("aria-controls")&&e.trigger.setAttribute("aria-expanded","true"),e.config=at(e.el,this.settings),e.popper.setOptions({placement:e.config.placement,modifiers:[{name:"eventListeners",enabled:!0},...(i=e.config,[{name:"offset",options:{offset:[0,parseInt(i.offset,10)]}},{name:"preventOverflow",options:{padding:lt(i["overflow-padding"])}},{name:"flip",options:{padding:lt(i["flip-padding"])}},{name:"arrow",options:{element:i["arrow-element"],padding:lt(i["arrow-padding"])}}])]}),e.popper.update(),e.state="opened",e}async function Oe(e,i){we.call(this,e);const n=this,s={open(){return xe.call(n,this)},close(){return ht.call(n,this)},deregister(){return we.call(n,this)}},r=t({id:e.id,state:"closed",el:e,trigger:i,popper:ye(i,e),config:at(e,this.settings)},s);return r.trigger.hasAttribute("aria-controls")&&r.trigger.setAttribute("aria-expanded","false"),Le.call(this,r),this.collection.push(r),r.el.classList.contains(this.settings.stateActive)&&(await r.open(),vt.call(this,r)),r}function Le(t){return t.__eventListeners||("hover"===t.config.event?(t.__eventListeners=[{el:["trigger"],type:["mouseenter","focus"],listener:xe.bind(this,t)},{el:["el","trigger"],type:["mouseleave","focusout"],listener:pt.bind(this,t)}],t.__eventListeners.forEach(e=>{e.el.forEach(i=>{e.type.forEach(n=>{t[i].addEventListener(n,e.listener,!1)})})})):(t.__eventListeners=[{el:["trigger"],type:["click"],listener:gt.bind(this,t)}],t.__eventListeners.forEach(e=>{e.el.forEach(i=>{e.type.forEach(n=>{t[i].addEventListener(n,e.listener,!1)})})}))),t}var Ae=/*#__PURE__*/i("handleKeydown");class ke extends o{constructor(e){super(),Object.defineProperty(this,Ae,{writable:!0,value:void 0}),this.defaults=ot,this.settings=t({},this.defaults,e),this.trigger=null,n(this,Ae)[Ae]=mt.bind(this),this.settings.autoInit&&this.init()}async init(e){e&&(this.settings=t({},this.settings,e));const i=document.querySelectorAll(this.settings.selectorPopover);return await this.registerCollection(i),this.settings.eventListeners&&this.initEventListeners(!1),this}async destroy(){return this.trigger=null,await this.deregisterCollection(),this.settings.eventListeners&&this.destroyEventListeners(!1),this}initEventListeners(t=!0){t&&this.collection.forEach(t=>{Le.call(this,t)}),document.addEventListener("keydown",n(this,Ae)[Ae],!1)}destroyEventListeners(t=!0){t&&this.collection.forEach(t=>{Ee(t)}),document.removeEventListener("keydown",n(this,Ae)[Ae],!1)}register(t){const e=ut.call(this,t);return e.error?Promise.reject(e.error):Oe.call(this,e.popover,e.trigger)}deregister(t){const e=this.get(dt.call(this,t));return we.call(this,e)}open(t){return xe.call(this,t)}close(t){return ht.call(this,t)}}export{x as Checkbox,W as Drawer,rt as Modal,ke as Popover,w as core};
2
2
  //# sourceMappingURL=scripts.modern.js.map