UNPKG

xtendui

Version:

Xtend UI is a powerful frontend library of tailwind components enhanced by vanilla js. It helps you build interfaces with advanced interactions and animations.

2 lines 205 kB
/*! For license information please see xtendui.min.js.LICENSE.txt */ (()=>{var e={863:(e,t,n)=>{"use strict";var o={};n.r(o),n.d(o,{createFocusTrap:()=>C});var a=n(199),i=n.n(a);const r={};"undefined"!=typeof window&&(window.XtSetGlobal&&(n.g["string"==typeof window.XtSetGlobal?window.XtSetGlobal:"Xt"]=r),r._running={},r._currents={},r.options={},r._mountArr=[],r._unmountArr=[],r._focusTrapArr=[],r.scrollDelay=!1,r.resizeDelay=200,r.medialoadedDelay=!1,r.durationTimescale=1,r.autoTimescale=1,r.scrolltoHashforce=null,r.formScrollWindowFactor=.2,r.ready=function(){let{func:e,state:t="interactive complete",raf:n=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const o=[...t.split(" ")];if(o.includes(document.readyState))n?requestAnimationFrame((()=>{e()})):e();else{const t=()=>{o.includes(document.readyState)&&(e(),document.removeEventListener("readystatechange",t))};document.addEventListener("readystatechange",t)}},r._mutationObserver=new MutationObserver((e=>{for(const t of e)if("childList"===t.type){for(const e of t.addedNodes)1===e.nodeType&&r._mountCheck({added:e});for(const e of t.removedNodes)1===e.nodeType&&r._unmountCheck({removed:e})}})),r.ready({func:()=>{r._mutationObserver.disconnect(),r._mutationObserver.observe(document.documentElement,{characterData:!1,attributes:!1,childList:!0,subtree:!0})}}),r.refresh=()=>{r._mountCheck()},r.mount=e=>{r._mountArr.push(e),r.ready({raf:e.raf,func:()=>{r._mountCheck({obj:e})}})},r.unmount=e=>{r._unmountArr.push(e)},r._mountCheck=function(){let{added:e=document.documentElement,obj:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e.closest("html"))return;const n=t?[t]:r._mountArr;for(const t of n){const n=[];e.matches(t.matches)&&n.push(e);for(const o of e.querySelectorAll(t.matches))n.push(o);if(n.length)for(const[e,a]of n.entries()){var o;if(t.root&&!t.root.contains(a))continue;const n=null!==(o=t.ignoreMount)&&void 0!==o?o:".xt-ignore";if(n&&a.closest(n))continue;if(t.done=t.done?t.done:[],t.done.includes(a))return;t.done.push(a);const i=t.mount({ref:a,obj:t,index:e});i&&r.unmount({ref:a,root:t.root,ignoreUnmount:t.ignoreUnmount,unmount:i,unmountRemove:function(){t.done=t.done.filter((e=>e!==a)),r._unmountArr=r._unmountArr.filter((e=>e!==this))}})}}},r._unmountCheck=function(){let{removed:e=document.documentElement}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e.closest("html"))for(const n of r._unmountArr)if(e===n.ref||e.contains(n.ref)){var t;if(n.root&&!n.root.contains(n.ref))continue;const e=null!==(t=n.ignoreUnmount)&&void 0!==t?t:".xt-ignore";if(e&&n.ref.closest(e))continue;n.unmount({obj:n}),n.unmountRemove()}},r._set=function(){let{name:e,el:t,self:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r.dataStorage.set(t,e,n)},r.get=function(){let{name:e,el:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return r.dataStorage.get(t,e)},r._remove=function(){let{name:e,el:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return r.dataStorage.remove(t,e)},r._initMatches=function(){let{self:e,optionsInitial:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=e.options;if(void 0===e.initial&&(e.matches&&r._removeMatches({self:e,optionsInitial:t}),n.matches)){e.matches=[];const o=Object.entries(n.matches);if(o.length)for(const[n,a]of o){const o=matchMedia(n);e.matches.push({mql:o,value:a}),r._eventMatches({self:e,mql:o,value:a,skipReinit:!0,optionsInitial:t}),o.addEventListener("change",r._eventMatches.bind(null,{self:e,mql:o,value:a,optionsInitial:t}))}}},r._eventMatches=function(){let{self:e,mql:t,value:n,skipReinit:o=!1,optionsInitial:a}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.container.closest("html")&&(t.matches?e.options=r.merge([e.options,n]):e.options=r.mergeReset({start:e.options,reset:a,check:n}),o||r.frame({el:e.container,ns:"".concat(e.ns,"MatchFrame"),func:()=>{r._eventReinit({self:e})}}))},r._removeMatches=function(){var e;let{self:t,optionsInitial:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(null!==(e=t.matches)&&void 0!==e&&e.length)for(const e of t.matches){const o=e.mql,a=e.value;o.removeEventListener("change",r._eventMatches.bind(null,{self:t,mql:o,value:a,optionsInitial:n}))}},r._eventReinit=function(){var e,t;let{self:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;(null==o||null===(e=o.detail)||void 0===e||!e.container||null!=o&&null!==(t=o.detail)&&void 0!==t&&t.container.contains(n.container))&&r.eventDelay({e:o,el:n.container,ns:"".concat(n.ns,"Reinit"),func:()=>{n.reinit()}})},r.dataStorage={_storage:new Map,set:(e,t,n)=>{r.dataStorage._storage.has(e)||r.dataStorage._storage.set(e,new Map);const o=r.dataStorage._storage.get(e);return o.set(t,n),o.get(t)},put:(e,t,n)=>{r.dataStorage._storage.has(e)||r.dataStorage._storage.set(e,new Map);const o=r.dataStorage._storage.get(e),a=o.get(t);return a||(o.set(t,n),o.get(t))},get:(e,t)=>{const n=r.dataStorage._storage.get(e);return n?n.get(t):null},getAll:e=>{const t=r.dataStorage._storage.get(e);return t||null},has:(e,t)=>r.dataStorage._storage.get(e).has(t),remove:(e,t)=>{const n=r.dataStorage._storage.get(e);if(!n)return null;const o=n.delete(t);return!1===n.size&&r.dataStorage._storage.delete(e),o}},r._classBody={currents:[],add:e=>{r._classBody.currents.push(e)},remove:e=>{r._classBody.currents=r._classBody.currents.filter((t=>t.c!==e.c||t.ns!==e.ns))},get:e=>r._classBody.currents.filter((t=>t.c===e.c))},r._friction=function(){let{el:e,obj:t,transform:n=!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r.frame({el:e,ns:"xtFrictionFrame"}),r.frame({el:e,ns:"xtFrictionInitFrame",func:()=>{if(r.visible({el:e})){let o,a;if(n){const t=r.getTranslate({el:e});o=t[0],a=t[1]}else{const t=e.getBoundingClientRect();o=t.left,a=t.top}let i=t.x-o,s=t.y-a;const c=t.friction;if(c&&r.dataStorage.get(e,"xtFrictionX")&&1e3!==r.durationTimescale?(o+=c({delta:Math.abs(i)})*Math.sign(i),a+=c({delta:Math.abs(s)})*Math.sign(s),n?e.style.transform="translateX(".concat(o,"px) translateY(").concat(a,"px)"):(e.style.left="".concat(o,"px"),e.style.top="".concat(a,"px"))):(o=t.x,a=t.y,n?e.style.transform="translateX(".concat(o,"px) translateY(").concat(a,"px)"):(e.style.top="".concat(a,"px"),e.style.left="".concat(o,"px"))),r.dataStorage.set(e,"xtFrictionX",o),r.dataStorage.set(e,"xtFrictionY",a),c&&1e3!==r.durationTimescale){const c=t.frictionLimit?t.frictionLimit:1.5;i=t.x-o,s=t.y-a,r.frame({el:e,ns:"xtFrictionFrame",func:()=>{Math.abs(i)>=c||Math.abs(s)>=c?r._friction({el:e,obj:t,transform:n}):(r.dataStorage.remove(e,"xtFrictionX"),r.dataStorage.remove(e,"xtFrictionY"))}})}}}})},r.getTranslate=function(){let{el:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=[],n=getComputedStyle(e),o=n.transform;let a=o.match(/^matrix3d\((.+)\)$/);return a?t.push(parseFloat(a[1].split(", ")[13])):(a=o.match(/^matrix\((.+)\)$/),a?t.push(parseFloat(a[1].split(", ")[4])):t.push(0),a?t.push(parseFloat(a[1].split(", ")[5])):t.push(0)),t},r.contains=function(){let{els:e,tr:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e instanceof HTMLElement)return e.contains(t);for(const n of e)if(n.contains(t))return!0;return!1},r.uniqueId=()=>(r.uid=void 0!==r.uid?r.uid:0,"xt-".concat(r.uid++)),r.merge=e=>{const t={};for(const n of e)if(n)for(const[e,o]of Object.entries(n))Array.isArray(o)?(t[e]=t[e]?t[e]:[],t[e].push(...o)):null===o||"object"!=typeof o||o.nodeName||o===window?t[e]=o:t[e]=r.merge([t[e],o]);return t},r.mergeReset=function(){let{start:e,reset:t,check:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const o=e;for(const[a,i]of Object.entries(n))null===i||"object"!=typeof i||Array.isArray(i)||i.nodeName||i===window?e[a]===n[a]&&(o[a]=t[a]):o[a]=r.mergeReset({start:e[a],reset:t[a],check:n[a]});return o},r.sanitize=e=>i().sanitize(e),r.node=e=>{let{sanitize:t=!0,str:n}=e;const o=document.createElement("template");return o.innerHTML=t?r.sanitize(n.trim()):n.trim(),o.content.firstChild},r.nodes=e=>{let{sanitize:t=!0,str:n}=e;const o=document.createElement("template");return o.innerHTML=t?r.sanitize(n.trim()):n.trim(),o.content.childNodes},r.script=function(){let{url:e,callback:t,defer:n=!0,async:o=!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!document.querySelector('script[src="'.concat(e,'"]'))){const a=document.createElement("script");t&&(a.onload=t),a.type="text/javascript",a.src=e,a.defer=n,a.async=o,document.body.append(a)}},r.frame=function(){let{el:e,ns:t="",func:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};cancelAnimationFrame(r.dataStorage.get(e,"".concat(t,"Frame"))),n&&r.dataStorage.set(e,"".concat(t,"Frame"),requestAnimationFrame((()=>{n()})))},r.frameDouble=function(){let{el:e,ns:t="",func:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};cancelAnimationFrame(r.dataStorage.get(e,"".concat(t,"FrameDouble"))),n&&r.dataStorage.set(e,"".concat(t,"FrameDouble"),requestAnimationFrame((()=>{r.dataStorage.set(e,"".concat(t,"FrameDouble"),requestAnimationFrame((()=>{n()})))})))},r.on=function(){let{el:e,ns:t="",duration:n,raf:o=!0,initial:a=!1,callback:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r.animTimeout({el:e,ns:t}),e.classList.add("on"),e.classList.remove("out","done");const s=()=>{e.classList.add("in"),r.animTimeout({el:e,ns:t,duration:n,actionCurrent:"In",func:()=>{e.classList.add("done"),i&&i()}})};o?r.frameDouble({el:e,ns:t,func:s}):(r.frameDouble({el:e,ns:t}),s()),a&&e.classList.add("initial"),r.frameDouble({el:e,ns:"".concat(t,"Initial"),func:()=>{a&&e.classList.remove("initial")}})},r.off=function(){let{el:e,ns:t="",duration:n,raf:o=!0,initial:a=!1,callback:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r.animTimeout({el:e,ns:t}),e.classList.remove("on","done");const s=()=>{e.classList.remove("in"),e.classList.add("out"),r.animTimeout({el:e,ns:t,duration:n,actionCurrent:"Out",func:()=>{e.classList.remove("out"),i&&i()}})};o?r.frameDouble({el:e,ns:t,func:s}):(r.frameDouble({el:e,ns:t}),s()),a&&e.classList.add("initial"),r.frameDouble({el:e,ns:"".concat(t,"Initial"),func:()=>{a&&e.classList.remove("initial")}})},r.animTimeout=function(){let{el:e,ns:t="",duration:n,actionCurrent:o,func:a}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var i;(clearTimeout(r.dataStorage.get(e,"".concat(t,"AnimTimeout"))),a)&&(n=null!==(i=r.animTime({el:e,duration:n,actionCurrent:o}))&&void 0!==i?i:0,n?r.dataStorage.set(e,"".concat(t,"AnimTimeout"),setTimeout(a,n)):a())},r.animTime=function(){let{el:e,duration:t,actionCurrent:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const o=n&&e.getAttribute("data-xt-duration-".concat(n))||e.getAttribute("data-xt-duration");return o?isNaN(parseFloat(o))?o:parseFloat(o)/r.durationTimescale:"function"==typeof t?t:t||0===t?t/r.durationTimescale:void 0},r.delayTime=function(){let{el:e,duration:t,actionCurrent:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const o=n&&e.getAttribute("data-xt-delay-".concat(n))||e.getAttribute("data-xt-delay");return o?isNaN(parseFloat(o))?o:parseFloat(o)/r.durationTimescale:"function"==typeof t?t:t||0===t?t/r.durationTimescale:void 0},r.queryAll=function(){let{els:e,query:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!t||0===e.length)return[];if(e.length){const n=[];for(const o of e)n.push(...o.querySelectorAll(t));return n}return Array.from(e.querySelectorAll(t))},r.visible=function(){let{el:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},r.eventDelay=function(){let{e,el:t,ns:n="",duration:o,func:a}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(r.frame({el:t,ns:"".concat(n,"EventDelayFrame")}),clearTimeout(r.dataStorage.get(window,"eventDelaySaveTimeout")),clearTimeout(r.dataStorage.get(t,"".concat(n,"eventDelayTimeout"))),a)if(e){var i;let c=null==e||null===(i=e.detail)||void 0===i?void 0:i.delay;if(c=(null!=o?o:c)?c:r["".concat(e.type,"Delay")],"resize"===e.type){var s;const t=window.innerWidth+window.outerWidth,n=window.innerHeight+window.outerHeight;if((null==e||null===(s=e.detail)||void 0===s||!s.force)&&r.dataStorage.get(window,"xtEventDelayWidth")===t&&(matchMedia("(hover: none)").matches||r.dataStorage.get(window,"xtEventDelayHeight")===n))return;r.dataStorage.set(window,"eventDelaySaveTimeout",setTimeout((()=>{r.dataStorage.set(window,"xtEventDelayWidth",t),r.dataStorage.set(window,"xtEventDelayHeight",n)}),r["".concat(e.type,"Delay")]))}c?r.dataStorage.set(t,"".concat(n,"eventDelayTimeout"),setTimeout((()=>{a(e)}),c)):r.frame({el:t,ns:"".concat(n,"EventDelayFrame"),func:()=>{a(e)}})}else r.frame({el:t,ns:"".concat(n,"EventDelayFrame"),func:()=>{a(e)}})},r.dataStorage.set(document.documentElement,"xtEventDelayWidth",window.innerWidth),r.dataStorage.set(document.documentElement,"xtEventDelayHeight",window.innerHeight),r._setScrollbarWidth=()=>{if(void 0===r.scrollbarWidth){const e=r.dataStorage.put(window,"resize/scrollbar",r._setScrollbarWidth);removeEventListener("resize",e),addEventListener("resize",e)}const e=document.createElement("div");e.style.visibility="hidden",e.style.width="100%",e.style.msOverflowStyle="scrollbar",e.classList.add("xt-ignore","xt-overflow-main"),document.body.append(e),e.style.overflow="scroll";const t=document.createElement("div");t.style.width="100%",t.classList.add("xt-ignore"),e.append(t);const n=e.offsetWidth,o=t.offsetWidth;r.scrollbarWidth=n-o,document.documentElement.style.setProperty("--scrollbar-width","".concat(r.scrollbarWidth,"px")),e.remove()},r.ready({func:()=>{r._setScrollbarWidth()}}),r._innerHeightSet=()=>{r.innerHeight=window.innerHeight,document.documentElement.style.setProperty("--vh","".concat(.01*r.innerHeight,"px"))},addEventListener("resize",(e=>{r.eventDelay({e,el:document.documentElement,ns:"WindowHeightResize",duration:0,func:()=>{r._innerHeightSet()}})})),r.ready({func:()=>{r._innerHeightSet()}}),r.scrolltriggerRerfreshFix=function(){let{ScrollTrigger:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.config({autoRefreshEvents:"visibilitychange,DOMContentLoaded,load"});const t=t=>{r.eventDelay({e:t,ns:"xtScrolltriggerRerfreshFix",func:()=>{e.refresh()}})};removeEventListener("resize",t),addEventListener("resize",t)});var s=n(614),c=n.n(s),l=["input","select","textarea","a[href]","button","[tabindex]","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])',"details>summary:first-of-type","details"],d=l.join(","),u="undefined"==typeof Element?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,p=function(e,t,n){var o=Array.prototype.slice.apply(e.querySelectorAll(d));return t&&u.call(e,d)&&o.unshift(e),o=o.filter(n)},f=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return isNaN(t)?function(e){return"true"===e.contentEditable}(e)?0:"AUDIO"!==e.nodeName&&"VIDEO"!==e.nodeName&&"DETAILS"!==e.nodeName||null!==e.getAttribute("tabindex")?e.tabIndex:0:t},m=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},g=function(e){return"INPUT"===e.tagName},h=function(e){return function(e){return g(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||e.ownerDocument,o=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=o(window.CSS.escape(e.name));else try{t=o(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var a=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]}(t,e.form);return!a||a===e}(e)},v=function(e,t){return!(t.disabled||function(e){return g(e)&&"hidden"===e.type}(t)||function(e,t){if("hidden"===getComputedStyle(e).visibility)return!0;var n=u.call(e,"details>summary:first-of-type")?e.parentElement:e;if(u.call(n,"details:not([open]) *"))return!0;if(t&&"full"!==t){if("non-zero-area"===t){var o=e.getBoundingClientRect(),a=o.width,i=o.height;return 0===a&&0===i}}else for(;e;){if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}(t,e.displayCheck)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return"SUMMARY"===e.tagName}))}(t)||function(e){if(g(e)||"SELECT"===e.tagName||"TEXTAREA"===e.tagName||"BUTTON"===e.tagName)for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;n<t.children.length;n++){var o=t.children.item(n);if("LEGEND"===o.tagName)return!o.contains(e)}return!0}t=t.parentElement}return!1}(t))},_=function(e,t){return!(!v(e,t)||h(t)||f(t)<0)},b=l.concat("iframe").join(","),y=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==u.call(e,b)&&v(t,e)};function w(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function S(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var x,E=(x=[],{activateTrap:function(e){if(x.length>0){var t=x[x.length-1];t!==e&&t.pause()}var n=x.indexOf(e);-1===n||x.splice(n,1),x.push(e)},deactivateTrap:function(e){var t=x.indexOf(e);-1!==t&&x.splice(t,1),x.length>0&&x[x.length-1].unpause()}}),L=function(e){return setTimeout(e,0)},A=function(e,t){var n=-1;return e.every((function(e,o){return!t(e)||(n=o,!1)})),n},N=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return"function"==typeof e?e.apply(void 0,n):e},k=function(e){return e.target.shadowRoot&&"function"==typeof e.composedPath?e.composedPath()[0]:e.target},C=function(e,t){var n,o=(null==t?void 0:t.document)||document,a=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?w(Object(n),!0).forEach((function(t){S(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0},t),i={containers:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0},r=function(e,t,n){return e&&void 0!==e[t]?e[t]:a[n||t]},s=function(e){return!(!e||!i.containers.some((function(t){return t.contains(e)})))},c=function(e){var t=a[e];if("function"==typeof t){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];t=t.apply(void 0,i)}if(!t){if(void 0===t||!1===t)return t;throw new Error("`".concat(e,"` was specified but was not a node, or did not return a node"))}var s=t;if("string"==typeof t&&!(s=o.querySelector(t)))throw new Error("`".concat(e,"` as selector refers to no known node"));return s},l=function(){var e=c("initialFocus");if(!1===e)return!1;if(void 0===e)if(s(o.activeElement))e=o.activeElement;else{var t=i.tabbableGroups[0];e=t&&t.firstTabbableNode||c("fallbackFocus")}if(!e)throw new Error("Your focus-trap needs to have at least one focusable element");return e},d=function(){if(i.tabbableGroups=i.containers.map((function(e){var t,n,o,a=(n=[],o=[],p(e,(t=t||{}).includeContainer,_.bind(null,t)).forEach((function(e,t){var a=f(e);0===a?n.push(e):o.push({documentOrder:t,tabIndex:a,node:e})})),o.sort(m).map((function(e){return e.node})).concat(n));if(a.length>0)return{container:e,firstTabbableNode:a[0],lastTabbableNode:a[a.length-1]}})).filter((function(e){return!!e})),i.tabbableGroups.length<=0&&!c("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times")},u=function e(t){!1!==t&&t!==o.activeElement&&(t&&t.focus?(t.focus({preventScroll:!!a.preventScroll}),i.mostRecentlyFocusedNode=t,function(e){return e.tagName&&"input"===e.tagName.toLowerCase()&&"function"==typeof e.select}(t)&&t.select()):e(l()))},g=function(e){var t=c("setReturnFocus",e);return t||!1!==t&&e},h=function(e){var t=k(e);s(t)||(N(a.clickOutsideDeactivates,e)?n.deactivate({returnFocus:a.returnFocusOnDeactivate&&!y(t)}):N(a.allowOutsideClick,e)||e.preventDefault())},v=function(e){var t=k(e),n=s(t);n||t instanceof Document?n&&(i.mostRecentlyFocusedNode=t):(e.stopImmediatePropagation(),u(i.mostRecentlyFocusedNode||l()))},b=function(e){if(function(e){return"Escape"===e.key||"Esc"===e.key||27===e.keyCode}(e)&&!1!==N(a.escapeDeactivates,e))return e.preventDefault(),void n.deactivate();(function(e){return"Tab"===e.key||9===e.keyCode})(e)&&function(e){var t=k(e);d();var n=null;if(i.tabbableGroups.length>0){var o=A(i.tabbableGroups,(function(e){return e.container.contains(t)}));if(o<0)n=e.shiftKey?i.tabbableGroups[i.tabbableGroups.length-1].lastTabbableNode:i.tabbableGroups[0].firstTabbableNode;else if(e.shiftKey){var a=A(i.tabbableGroups,(function(e){var n=e.firstTabbableNode;return t===n}));if(a<0&&i.tabbableGroups[o].container===t&&(a=o),a>=0){var r=0===a?i.tabbableGroups.length-1:a-1;n=i.tabbableGroups[r].lastTabbableNode}}else{var s=A(i.tabbableGroups,(function(e){var n=e.lastTabbableNode;return t===n}));if(s<0&&i.tabbableGroups[o].container===t&&(s=o),s>=0){var l=s===i.tabbableGroups.length-1?0:s+1;n=i.tabbableGroups[l].firstTabbableNode}}}else n=c("fallbackFocus");n&&(e.preventDefault(),u(n))}(e)},x=function(e){if(!N(a.clickOutsideDeactivates,e)){var t=k(e);s(t)||N(a.allowOutsideClick,e)||(e.preventDefault(),e.stopImmediatePropagation())}},C=function(){if(i.active)return E.activateTrap(n),i.delayInitialFocusTimer=a.delayInitialFocus?L((function(){u(l())})):u(l()),o.addEventListener("focusin",v,!0),o.addEventListener("mousedown",h,{capture:!0,passive:!1}),o.addEventListener("touchstart",h,{capture:!0,passive:!1}),o.addEventListener("click",x,{capture:!0,passive:!1}),o.addEventListener("keydown",b,{capture:!0,passive:!1}),n},O=function(){if(i.active)return o.removeEventListener("focusin",v,!0),o.removeEventListener("mousedown",h,!0),o.removeEventListener("touchstart",h,!0),o.removeEventListener("click",x,!0),o.removeEventListener("keydown",b,!0),n};return(n={activate:function(e){if(i.active)return this;var t=r(e,"onActivate"),n=r(e,"onPostActivate"),a=r(e,"checkCanFocusTrap");a||d(),i.active=!0,i.paused=!1,i.nodeFocusedBeforeActivation=o.activeElement,t&&t();var s=function(){a&&d(),C(),n&&n()};return a?(a(i.containers.concat()).then(s,s),this):(s(),this)},deactivate:function(e){if(!i.active)return this;clearTimeout(i.delayInitialFocusTimer),i.delayInitialFocusTimer=void 0,O(),i.active=!1,i.paused=!1,E.deactivateTrap(n);var t=r(e,"onDeactivate"),o=r(e,"onPostDeactivate"),a=r(e,"checkCanReturnFocus");t&&t();var s=r(e,"returnFocus","returnFocusOnDeactivate"),c=function(){L((function(){s&&u(g(i.nodeFocusedBeforeActivation)),o&&o()}))};return s&&a?(a(g(i.nodeFocusedBeforeActivation)).then(c,c),this):(c(),this)},pause:function(){return i.paused||!i.active||(i.paused=!0,O()),this},unpause:function(){return i.paused&&i.active?(i.paused=!1,d(),C(),this):this},updateContainerElements:function(e){var t=[].concat(e).filter(Boolean);return i.containers=t.map((function(e){return"string"==typeof e?o.querySelector(e):e})),i.active&&d(),this}}).updateContainerElements(e),n};function O(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}r.RJSON=c(),r.focusTrap=o;class D{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};O(this,"_optionsCustom",void 0),O(this,"_optionsDefault",void 0),O(this,"_optionsInitial",void 0),O(this,"_componentNs",void 0),O(this,"_mode",void 0),O(this,"_classes",[]),O(this,"_classesIn",[]),O(this,"_classesOut",[]),O(this,"_classesDone",[]),O(this,"_classesInitial",[]),O(this,"_classesBefore",[]),O(this,"_classesAfter",[]),O(this,"_initialCurrents",[]),O(this,"_destroyElements",void 0),O(this,"_containerElements",void 0),O(this,"_containerTargets",void 0),O(this,"_oldIndex",void 0),O(this,"_inverse",void 0),O(this,"_queueIn",[]),O(this,"_queueOut",[]),O(this,"_autoblock",void 0),O(this,"_disabledManual",void 0),O(this,"_hasHash",void 0),O(this,"_autorunning",void 0),O(this,"_observer",void 0),O(this,"_focusTrap",void 0),O(this,"componentName",void 0),O(this,"ns",void 0),O(this,"options",void 0),O(this,"initial",void 0),O(this,"disabled",!1),O(this,"container",void 0),O(this,"elements",[]),O(this,"targets",[]),O(this,"index",void 0),O(this,"direction",void 0),O(this,"_usedWidth",void 0),O(this,"_wrap",void 0),O(this,"_keepHeight",void 0),O(this,"_autoHeight",void 0),O(this,"_groups",void 0),O(this,"drag",{}),O(this,"pags",void 0);const n=this;n.container=e,n._optionsCustom=t,n.componentName=n.constructor.componentName,n._componentNs=n.componentName.replace("-","."),r._set({name:n.componentName,el:n.container,self:n}),n._init()}_init(){this._initVars(),this._initLogic()}_initVars(){const e=this;e._optionsDefault=r.merge([e.constructor.optionsDefaultSuper,e.constructor.optionsDefault]),e._optionsDefault=r.merge([e._optionsDefault,r.options[e.componentName]]),e._optionsInitial=e.options=r.merge([e._optionsDefault,e._optionsCustom]);const t=e.options;e._classes=t.class?[...t.class.split(" ")]:[],e._classesIn=t.classIn?[...t.classIn.split(" ")]:[],e._classesOut=t.classOut?[...t.classOut.split(" ")]:[],e._classesDone=t.classDone?[...t.classDone.split(" ")]:[],e._classesInitial=t.classInitial?[...t.classInitial.split(" ")]:[],e._classesBefore=t.classBefore?[...t.classBefore.split(" ")]:[],e._classesAfter=t.classAfter?[...t.classAfter.split(" ")]:[]}_initLogic(){let{save:e=!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=this;t._destroyElements=[document,window,t.container],t.enable(),t._initSetup(),r._initMatches({self:t,optionsInitial:t._optionsInitial}),t._initScope(),t._initAria(),t._initEvents(),t._initStart({save:e}),(t.options.disabled||t._disabledManual)&&t.disable()}_initSetup(){const e=this,t=e.options;var n;(e._containerTargets=e.container,t.targets&&-1!==t.targets.indexOf("#"))?(e._mode="unique",e._containerTargets=document.documentElement,e.ns="".concat(e.componentName,"-").concat(t.targets.toString(),"-").concat(e._classes.toString())):(e._mode="multiple",e.ns=null!==(n=e.ns)&&void 0!==n?n:r.uniqueId());e.ns=e.ns.replace(/^[^a-z]+|[ ,#_:.-]+/gi,""),e._addNamespace(),e._setCurrents([])}_initScope(){this._initScopeElements(),this._initScopeTargets()}_initScopeElements(){const e=this,t=e.options;if(e._containerElements=e.container,t.elements){-1!==t.elements.indexOf("#")&&(e._containerElements=document.documentElement);let n=Array.from(e._containerElements.querySelectorAll(t.elements));t.exclude&&(n=n.filter((e=>!e.matches(t.exclude)))),e.elements=n,e._destroyElements.push(...e.elements)}e.elements.length||(e.elements=[e.container])}_initScopeTargets(){const e=this,t=e.options;if(t.targets){let n=Array.from(e._containerTargets.querySelectorAll(t.targets));t.exclude&&(n=n.filter((e=>!e.matches(t.exclude)))),e.targets=n,e._destroyElements.push(...e.targets)}}_initStart(){let{save:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=this,n=t.options;t._setCurrents([]);let o=0;t.initial=!0,t.index=null,t._oldIndex=null,r._running[t.ns]=[],o=t._initActivate({save:e});const a=n.min-o;if(a>0&&(o+=a),a>0)for(let e=0;e<a;e++){const o=t.elements[e];if(o)if(n.on){const e=n.on.split(" ")[0];o.dispatchEvent(new CustomEvent(e,{detail:{force:!0}}))}else t._eventOn({el:o,force:!0})}e&&(t._initialCurrents=t._getCurrents().slice(0)),0===o&&r.frame({el:t.container,ns:"".concat(t.ns,"Init"),func:()=>{t.container.setAttribute("data-".concat(t.componentName,"-init"),""),t.container.dispatchEvent(new CustomEvent("init.".concat(t._componentNs))),t._eventAutostart(),t.initial=!1,n.debug&&console.debug("".concat(t.componentName," init"),t)}})}_initActivate(){var e;let{save:t=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=this,o=n.options,a=e=>{for(const t of n._classes)if(e.classList.contains(t)||e.checked)return!0;return!1},i=n._hashChange({save:t});let s=null!==(e=i.currents)&&void 0!==e?e:0;for(const e of n.getElementsGroups()){let c=!1;if(t?!0===o.classSkip||o.classSkip.elements||(c=a(e)):n._initialCurrents.includes(e)&&(c=!0),c&&s<o.max||i.arr.includes(e))e.classList.add(...n._classes),e.classList.add(...n._classesIn),e.classList.add(...n._classesInitial);else{if(!0!==o.classSkip&&!o.classSkip.elements){const t=n.getElements({el:e});for(const e of t)e.classList.remove(...n._classes,...n._classesIn,...n._classesOut,...n._classesDone,...n._classesInitial,...n._classesBefore,...n._classesAfter)}if(!0!==o.classSkip&&!o.classSkip.elementsInner){const t=r.queryAll({els:e,query:o.elementsInner});for(const e of t)e.classList.remove(...n._classes,...n._classesIn,...n._classesOut,...n._classesDone,...n._classesInitial,...n._classesBefore,...n._classesAfter)}}const l=n.getTargets({el:e});for(const d of l)if(t&&!c&&(!0===o.classSkip||o.classSkip.targets||(c=a(d))),c&&s<o.max||i.arr.includes(e))d.classList.add(...n._classes),d.classList.add(...n._classesIn),d.classList.add(...n._classesInitial);else if(!0===o.classSkip||o.classSkip.targets||d.classList.remove(...n._classes,...n._classesIn,...n._classesOut,...n._classesDone,...n._classesInitial,...n._classesBefore,...n._classesAfter),!0!==o.classSkip&&!o.classSkip.targetsInner){const e=r.queryAll({els:d,query:o.targetsInner});for(const t of e)t.classList.remove(...n._classes,...n._classesIn,...n._classesOut,...n._classesDone,...n._classesInitial,...n._classesBefore,...n._classesAfter)}if(c&&s<o.max)if(s++,o.on){const t=o.on.split(" ")[0];e.dispatchEvent(new CustomEvent(t,{detail:{force:!0}}))}else n._eventOn({el:e,force:!0})}return s}_initAria(){const e=this,t=e.options;if(e._initAriaRole(),t.aria&&e.targets.length){for(const n of e.targets)if(!0===t.aria||t.aria.labelledby||t.aria.controls){n.getAttribute("id")||n.setAttribute("id",r.uniqueId())}for(const n of e.elements){if((!0===t.aria||t.aria.activation)&&n.setAttribute("aria-selected","false"),!0===t.aria||t.aria.labelledby||t.aria.controls){n.getAttribute("id")||n.setAttribute("id",r.uniqueId())}if(!0===t.aria||t.aria.controls){const t=e.getTargets({el:n});let o=" ";o+="";for(const e of t)o+=" ".concat(e.getAttribute("id"));n.setAttribute("aria-controls",o.trim())}}for(const n of e.targets){if(!0===t.aria||t.aria.activation){const e=n.getAttribute("role");"tabpanel"!==e&&"listbox"!==e&&"tooltip"!==e&&"dialog"!==e||n.setAttribute("aria-expanded","false")}if(!0===t.aria||t.aria.describedby){const t=e.getElements({el:n});let o=" ";o+="";for(const e of t)o+=" ".concat(e.getAttribute("id"));n.setAttribute("aria-describedby",o.trim())}if(!0===t.aria||t.aria.labelledby){const t=e.getElements({el:n});let o=" ";o+="";for(const e of t)o+=" ".concat(e.getAttribute("id"));n.setAttribute("aria-labelledby",o.trim())}}}}_initAriaRole(){const e=this,t=e.options;if(t.aria&&e.targets.length&&(!0===t.aria||t.aria.role)&&"multiple"===e._mode){e.container.setAttribute("role","tablist"),t.max>1&&e.container.setAttribute("aria-multiselectable","true");for(const t of e.elements)t.setAttribute("role","tab");for(const t of e.targets)t.setAttribute("role","tabpanel")}}_initEvents(){const e=this,t=e.options;e._removeEvents();for(const n of e.elements){const o=r.dataStorage.put(n,"".concat(t.on,"/oncustom/").concat(e.ns),e._eventOnHandler.bind(e,{el:n,force:!0}));if(n.addEventListener("on.trigger.".concat(e._componentNs),o),t.on){const o=r.dataStorage.put(n,"".concat(t.on,"/on/").concat(e.ns),e._eventOnHandler.bind(e,{el:n})),a=[...t.on.split(" ")];for(const e of a)n.addEventListener(e,o)}const a=r.dataStorage.put(n,"".concat(t.off,"/offcustom/").concat(e.ns),e._eventOffHandler.bind(e,{el:n,force:!0}));if(n.addEventListener("off.trigger.".concat(e._componentNs),a),t.off){const o=r.dataStorage.put(n,"".concat(t.off,"/off/").concat(e.ns),e._eventOffHandler.bind(e,{el:n})),a=[...t.off.split(" ")];for(const e of a)[...t.on.split(" ")].includes(e)||n.addEventListener(e,o)}if(t.on){if(t.preventEvent){const o=[...t.on.split(" ")];if(o.includes("click")||o.includes("mouseenter")||o.includes("mousehover")){const t=r.dataStorage.put(n,"touchend/preventevent/".concat(e.ns),e._eventPreventeventStartHandler.bind(e,{el:n}));n.addEventListener("touchend",t)}if(o.includes("click")){const t=r.dataStorage.put(n,"mouseup/preventevent/".concat(e.ns),e._eventPreventeventStartHandler.bind(e,{el:n}));n.addEventListener("mouseup",t)}}r.dataStorage.put(n,"active/preventevent/".concat(e.ns),e.hasCurrent({el:n}))}}for(const n of e.targets){const o=r.dataStorage.put(n,"".concat(t.on,"/oncustom/").concat(e.ns),e._eventOnHandler.bind(e,{el:n,force:!0}));n.addEventListener("on.trigger.".concat(e._componentNs),o);const a=r.dataStorage.put(n,"".concat(t.off,"/offcustom/").concat(e.ns),e._eventOffHandler.bind(e,{el:n,force:!0}));n.addEventListener("off.trigger.".concat(e._componentNs),a)}if(t.auto&&t.auto.time){const n=r.dataStorage.put(e.container,"autostart/".concat(e.ns),e._eventAutostart.bind(e)),o=r.dataStorage.put(e.container,"autostop/".concat(e.ns),e._eventAutostop.bind(e)),a=r.dataStorage.set(window,"focus/auto/".concat(e.ns),n);addEventListener("focus",a);const i=r.dataStorage.set(window,"blur/auto/".concat(e.ns),o);if(addEventListener("blur",i),e.container.addEventListener("autostart.trigger.".concat(e._componentNs),n),e.container.addEventListener("autostop.trigger.".concat(e._componentNs),o),t.auto.pause){const n=e.container.querySelectorAll(t.auto.pause);if(n.length){e._destroyElements.push(...n);for(const t of n){const n=r.dataStorage.put(t,"mouseenter focus/auto/".concat(e.ns),e._eventAutostop.bind(e)),o=["mouseenter","focus"];for(const e of o)t.addEventListener(e,n);const a=r.dataStorage.put(t,"mouseleave blur/auto/".concat(e.ns),e._eventAutostart.bind(e)),i=["mouseleave","blur"];for(const e of i)t.addEventListener(e,a)}}}}if(t.hash){for(const n of e.elements)if(n.getAttribute(t.hash)){e._hasHash=!0;break}if(!e._hasHash)for(const n of e.targets)if(n.getAttribute(t.hash)){e._hasHash=!0;break}}if(e._hasHash){const t=r.dataStorage.put(window,"popstate/".concat(e.ns),e._hashChange.bind(e).bind(e,{save:!0}));addEventListener("popstate",t)}if(t.jump)for(const t of e.targets){const n=r.dataStorage.put(t,"click/jump/".concat(e.ns),e._eventJumpHandler.bind(e).bind(e,{el:t}));t.addEventListener("click",n,!0),e.disabled||t.classList.add("xt-jump")}if(t.navigation&&(e.navs=e.container.querySelectorAll(t.navigation),e.navs.length)){e._destroyElements.push(...e.navs);for(const t of e.navs){const n=r.dataStorage.put(t,"click/nav/".concat(e.ns),e._eventNavHandler.bind(e).bind(e,{el:t}));t.addEventListener("click",n)}}if(t.keyboard&&t.keyboard.selector){const n="object"===t.keyboard.selector?[e.container]:e.container.querySelectorAll(t.keyboard.selector);e._destroyElements.push(...n);for(const t of n){t.setAttribute("tabindex","0");const n=r.dataStorage.put(t,"focus/keyboard/".concat(e.ns),e._eventKeyboardfocusHandler.bind(e));t.addEventListener("focus",n);const o=r.dataStorage.put(t,"blur/keyboard/".concat(e.ns),e._eventKeyboardblurHandler.bind(e));t.addEventListener("blur",o)}}if(t.closeauto){const t=r.dataStorage.set(window,"closeauto.trigger.xt/".concat(e.ns),e._eventCloseautoHandler.bind(e));addEventListener("closeauto.trigger.xt",t,!0)}if(t.openauto){const t=r.dataStorage.set(window,"openauto.trigger.xt/".concat(e.ns),e._eventOpenautoHandler.bind(e));addEventListener("openauto.trigger.xt",t,!0)}if(t.mediaLoaded||t.mediaLoadedReinit){for(const t of e.elements){const n=Array.from(t.querySelectorAll("img")).filter((e=>!e.closest(".xt-clone")));e._destroyElements.push(...n);for(const o of n)if(!r.dataStorage.get(o,"".concat(e.ns,"MedialoadedDone")))if(r.dataStorage.set(o,"".concat(e.ns,"MedialoadedDone"),!0),o.complete)e._eventMedialoadedHandler({img:o,el:t});else{const n=r.dataStorage.put(o,"load/media/".concat(e.ns),e._eventMedialoadedHandler.bind(e).bind(e,{img:o,el:t,deferred:!0}));o.addEventListener("load",n)}}for(const t of e.targets){const n=Array.from(t.querySelectorAll("img")).filter((e=>!e.closest(".xt-clone")));e._destroyElements.push(...n);for(const o of n)if(!r.dataStorage.get(o,"".concat(e.ns,"MedialoadedDone")))if(o.complete)e._eventMedialoadedHandler({img:o,el:t});else{const n=r.dataStorage.put(o,"load/media/".concat(e.ns),e._eventMedialoadedHandler.bind(e).bind(e,{img:o,el:t,deferred:!0}));o.addEventListener("load",n)}}}t.visibleReinit&&(r.visible({el:e.container})||(e._observer=new IntersectionObserver(((t,n)=>{for(const o of t)o.intersectionRatio>0&&(e._eventVisibleReinit(),n.disconnect(),e._observer=null)}),{root:null}),e._observer.observe(e.container)))}_eventOnHandler(e,t){var n;let{el:o,force:a=!1}=e;const i=this,s=i.options;if(a=a||(null==t||null===(n=t.detail)||void 0===n?void 0:n.force),o=s.groupElements||i.targets.includes(o)?i.getElements({el:o})[0]:o,!a&&s.eventLimit){const e=i._containerElements.querySelectorAll(s.eventLimit);if(i._containerElements.matches(s.eventLimit))return;if(e.length&&r.contains({els:e,tr:t.target}))return}i._eventOn({el:o,force:a},t)}_eventOffHandler(e,t){var n;let{el:o,force:a=!1}=e;const i=this,s=i.options;if(a=a||(null==t||null===(n=t.detail)||void 0===n?void 0:n.force),o=s.groupElements||i.targets.includes(o)?i.getElements({el:o})[0]:o,!a&&s.eventLimit){const e=i._containerElements.querySelectorAll(s.eventLimit);if(i._containerElements.matches(s.eventLimit))return;if(e.length&&r.contains({els:e,tr:t.target}))return}i._eventOff({el:o,force:a},t)}_eventPreventeventStartHandler(){let{el:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=this;r.dataStorage.put(e,"active/preventevent/".concat(t.ns),t.hasCurrent({el:e}));const n=r.dataStorage.put(e,"click/preventevent/".concat(t.ns),t._eventPreventeventHandler.bind(t,{el:e}));e.addEventListener("click",n);const o=r.dataStorage.put(e,"off/preventevent/".concat(t.ns),t._eventPreventeventResetHandler.bind(t,{el:e}));e.addEventListener("off.".concat(t._componentNs),o)}_eventPreventeventEndHandler(){let{el:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=this,n=r.dataStorage.get(e,"click/preventevent/".concat(t.ns));e.removeEventListener("click",n);const o=r.dataStorage.get(e,"off/preventevent/".concat(t.ns));e.removeEventListener("off.".concat(t._componentNs),o)}_eventPreventeventHandler(e,t){let{el:n}=e;const o=this;r.dataStorage.get(n,"active/preventevent/".concat(o.ns))||r.dataStorage.get(n,"".concat(o.ns,"PreventeventDone"))?(o._eventPreventeventEndHandler({el:n}),r.dataStorage.remove(n,"".concat(o.ns,"PreventeventDone")),r.dataStorage.remove(n,"active/preventevent/".concat(o.ns))):(r.dataStorage.set(n,"".concat(o.ns,"PreventeventDone"),!0),t.preventDefault())}_eventPreventeventResetHandler(){let{el:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=this;t._eventPreventeventEndHandler({el:e}),r.dataStorage.remove(e,"".concat(t.ns,"PreventeventDone")),r.dataStorage.remove(e,"active/preventevent/".concat(t.ns))}_hashChange(){let{save:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=this,n=t.options;let o=0;const a=[];if(t.disabled)return{currents:o,arr:a};if(t._hasHash&&!r.dataStorage.get(t.container,"".concat(t.ns,"HashSkip"))){const i=decodeURI(location.hash.split("#")[1]);if(i){const s=(e,t)=>e.getAttribute(n.hash)===t;for(const c of t.elements){let l=!1;e&&(l=s(c,i));const d=t.getTargets({el:c});for(const t of d)e&&!l&&(l=s(t,i));if(l&&o<n.max){if(o++,a.push(c),r.dataStorage.set(t.container,"".concat(t.ns,"HashSkip"),!0),n.on){const e=n.on.split(" ")[0];c.dispatchEvent(new CustomEvent(e,{detail:{force:!0}}))}else t._eventOn({el:c,force:!0});r.dataStorage.set(t.container,"".concat(t.ns,"HashSkip"),!1)}}}}return{currents:o,arr:a}}_eventJumpHandler(e,t){let{el:n}=e;const o=this;o.disabled||o.targets.includes(n)&&o._eventJump({el:n},t)}_eventNavHandler(e,t){let{el:n}=e;this._eventNav({el:n},t)}_eventKeyboardfocusHandler(){const e=this,t=r.dataStorage.put(document,"keyup/keyboard/".concat(e.ns),e._eventKeyboardHandler.bind(e));document.addEventListener("keyup",t)}_eventKeyboardblurHandler(){const e=r.dataStorage.get(document,"keyup/keyboard/".concat(this.ns));document.removeEventListener("keyup",e)}_eventKeyboardHandler(e){const t=this,n=t.options,o=e.keyCode?e.keyCode:e.which;let a,i;n.keyboard.vertical?n.keyboard.inverse?(a=40,i=38):(a=38,i=40):n.keyboard.inverse?(a=39,i=37):(a=37,i=39),o===a?t.goToPrev({amount:1}):o===i&&t.goToNext({amount:1})}_eventCloseautoHandler(e){var t,n;const o=this;if(null==e||null===(t=e.detail)||void 0===t||!t.container||null!=e&&null!==(n=e.detail)&&void 0!==n&&n.container.contains(o.container)){const t=o._getCurrents();for(const n of t)o._eventOff({el:n,force:!0},e)}}_eventOpenautoHandler(e){const t=this;let n;for(const o of Array.from(t.elements).filter((t=>t.contains(e.target)))){n=o;break}if(!n)for(const o of Array.from(t.targets).filter((t=>t.contains(e.target)))){n=o;break}n&&t._eventOn({el:n},e)}_eventMedialoadedHandler(){let{img:e,el:t,deferred:n=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const o=this,a=o.options;r.dataStorage.set(e,"".concat(o.ns,"MedialoadedDone"),!0),a.mediaLoadedReinit&&n&&r.eventDelay({e:{detail:{delay:r.medialoadedDelay}},el:o.container,ns:"".concat(o.ns,"MedialoadedReinit"),func:()=>{o._eventMediaLoadedReinit()}}),a.mediaLoaded&&t.classList.add("xt-medialoaded"),t.dispatchEvent(new CustomEvent("medialoaded.".concat(o._componentNs),{detail:{deferred:n}}))}getElementsGroups(){const e=this,t=[];for(const n of e.elements){const e=n.getAttribute("data-xt-group");if(e){t.filter((t=>t.getAttribute("data-xt-group")===e)).length||t.push(n)}else t.push(n)}return t}_groupFilter(){let{els:e,attr:t,some:n=!1,same:o=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const a=this.options,i=[];for(const s of e){let e=s.getAttribute("data-xt-group");if(o){const t=s.getAttribute("data-xt-group-same");t&&(e+=a.groupSeparator+t)}if(e!==t){if(n){var r;const n=null==t?void 0:t.split(a.groupSeparator).filter((e=>e)),o=null===(r=e)||void 0===r?void 0:r.split(a.groupSeparator).filter((e=>e));o&&n&&o.some((e=>n.includes(e)))&&i.push(s)}}else i.push(s)}return i}getElements(){let{el:e,same:t=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=this,o=n.options;if(!n.elements||!n.elements.length)return[];if(!e)return[];if("unique"===n._mode){const e=[],t=r.dataStorage.get(n.ns,"xtNamespace");if(t){for(const n of t)e.push(...n.elements);return e}return[]}if("multiple"===n._mode){let a,i=e.getAttribute("data-xt-group");if(t){const t=e.getAttribute("data-xt-group-same");t&&(i+=o.groupSeparator+t)}const r=!n.elements.includes(e),s=n._groupFilter({els:n.elements,attr:i,some:r,same:t}),c=n._groupFilter({els:n.targets,attr:i,some:r,same:t});if(i)a=s;else if(Array.from(n.elements).includes(e))a=[e].filter((e=>e));else{a=[s[c.findIndex((t=>t===e))]].filter((e=>e))}return a}}getTargets(){let{el:e,same:t=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=this,o=n.options;if(!n.targets||!n.targets.length)return[];if(!e)return[];if("unique"===n._mode){return n.targets}if("multiple"===n._mode){let a,i=e.getAttribute("data-xt-group");if(t){const t=e.getAttribute("data-xt-group-same");t&&(i+=o.groupSeparator+t)}const r=!n.targets.includes(e),s=n._groupFilter({els:n.elements,attr:i,some:r,same:t}),c=n._groupFilter({els:n.targets,attr:i,some:r,same:t});if(i)a=c;else if(Array.from(n.targets).includes(e))a=[e].filter((e=>e));else{a=[c[s.findIndex((t=>t===e))]].filter((e=>e))}return a}}_getCurrents(){return r._currents[this.ns]}_setCurrents(e){r._currents[this.ns]=e}_addCurrent(){let{el:e,running:t=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=this;if(!n.hasCurrent({el:e,running:t})){(t?r._running:r._currents)[n.ns].push(e)}}_removeCurrent(){let{el:e,running:t=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=t?r._running:r._currents;n[this.ns]=n[this.ns].filter((t=>t!==e))}hasCurrent(){let{el:e,same:t=!1,running:n=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const o=this,a=o.options.groupElements||o.targets.includes(e)?o.getElements({el:e,same:t}):[e];return(n?r._running:r._currents)[o.ns].filter((e=>a.includes(e))).length}_checkOn(){let{el:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return!this.hasCurrent({el:e})}_checkOff(){let{el:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=this;return!(t.options.min-t._getCurrents().length>=0)&&t.hasCurrent({el:e})}_checkOnRunning(){let{obj:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=e.elements.runningOn||!this.hasCurrent({el:e.elements.queueEls[0],running:!0});return e.elements.runningOn=t,t}_checkOffRunning(){let{obj:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=e.elements.runningOff||this.hasCurrent({el:e.elements.queueEls[0],running:!0});return e.elements.runningOff=t,t}_setIndex(){var e;let{el:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=this,o=n.getIndex({el:t});n._oldIndex=null!==(e=n.index)&&void 0!==e?e:o,n.index=o}getIndex(){let{el:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=this;e=t.getElements({el:e})[0];let n=null;for(const[o,a]of t.getElementsGroups().entries())if(e===a){n=o;break}return n}_setDirection(){const e=this;null===e.index||e.index===e._oldIndex?e.direction=0:null!==e._inverse?e.direction=e._inverse?-1:1:e.direction=e.index<e._oldIndex?-1:1}_activate(){let{el:e,type:t,skipSame:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const o=this,a=o.options;n||!0===a.classSkip||a.classSkip[t]||(e.checked=!0,e.classList.add(...o._classes),e.classList.remove(...o._classesOut,...o._classesDone),r.frameDouble({el:e,func:()=>{e.classList.add(...o._classesIn)}}),e.classList.remove(...o._classesBefore,...o._classesAfter),o.direction<0?e.classList.add(...o._classesBefore):o.direction>0&&e.classList.add(...o._classesAfter))}_activateDone(){let{el:e,type:t,skipSame:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const o=this,a=o.options;n||!0===a.classSkip||a.classSkip[t]||(r.frameDouble({el:e}),e.classList.add(...o._classesIn,...o._classesDone))}_activateHash(){let{obj:e,el:t,type:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const o=this,a=o.options;if(!r.dataStorage.get(o.container,"".concat(o.ns,"HashSkip"))&&o._hasHash&&!o.initial){const i=e.elements.queueEls[0];if("elements"===n&&o.getElements({el:i}).includes(t)||"targets"===n&&o.getTargets({el:i}).includes(t)){const e=t.getAttribute(a.hash);e&&r.frame({el:window,ns:"".concat(o.ns,"Hash"),func:()=>{r.dataStorage.set(o.container,"".concat(o.ns,"HashSkip"),!0),history.pushState({},"","#".concat(encodeURIComponent(e))),r.dataStorage.set(o.container,"".concat(o.ns,"HashSkip"),!1)}})}}}_deactivate(){let{el:e,type:t,skipSame:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const o=this,a=o.options;n||!0===a.classSkip||a.classSkip[t]||(e.checked=!1,e.classList.remove(...o._classes,...o._classesDone),r.frameDouble({el:e,func:()=>{e.classList.remove(...o._classesIn),e.classList.add(...o._classesOut)}}),e.classList.remove(...o._classesBefore,...o._classesAfter),o.direction<0?e.classList.add(...o._classesBefore):o.direction>0&&e.classList.add(...o._classesAfter))}_deactivateDone(){let{el:e,type:t,skipSame:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const o=this,a=o.options;n||!0===a.classSkip||a.classSkip[t]||(r.frameDouble({el:e}),e.classList.remove(...o._classesIn,...o._classesOut))}_deactivateHash(){let{obj:e,el:t,type:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const o=this,a=o.options;if(!r.dataStorage.get(o.container,"".concat(o.ns,"HashSkip"))&&a.hash&&o._hasHash&&!o.initial){const i=e.elements.queueEls[0];if("elements"===n&&o.getElements({el:i}).includes(t)||"targets"===n&&o.getTargets({el:i}).includes(t)){const e=t.getAttribute(a.hash);e&&e===location.hash.split("#")[1]&&r.frame({el:window,ns:"".concat(o.ns,"Hash"),func:()=>{r.dataStorage.set(o.container,"".concat(o.ns,"HashSkip"),!0),history.pushState({},"","#"),r.dataStorage.set(o.container,"".concat(o.ns,"HashSkip"),!1)}})}}}_eventOn(e,t){var n;let{el:o,force:a=!1}=e;const i=this,s=i.options;if(a=a||(null==t||null===(n=t.detail)||void 0===n?void 0:n.force),i.disabled&&!a)return!1;if(a||i._checkOn({el:o})&&(!t||!t.type||t.type!=="off.trigger.".concat(i._componentNs))){i._eventAutostop();const e=s.groupElements||i.targets.includes(o)?i.getElements({el:o,same:!0}):[o],n=i.getTargets({el:o,same:!0});i._addCurrent({el:e[0]}),i._setIndex({el:e[0]}),i._setDirection();const c="In",l="Out",d=r.queryAll({els:o,query:s.elementsInner}),u=r.queryAll({els:n,query:s.targetsInner});let p=i._eventQueue({elements:e,targets:n,elementsInner:d,targetsInner:u,force:a,e:t});const f=i._getCurrents();if(f.length>s.max){const e=i._eventOff({el:f[0],objFilter:p});!s.queue&&null!=e&&e.obj&&(p=e.obj)}s.queue?i["_queue".concat(c)].unshift(p):i["_queue".concat(c)]=[p];for(const e in i["_queue".concat(c)][0])i._queueStart({actionCurrent:c,actionOther:l,type:e,index:0});return!0}return[...s.on.split(" ")].includes(null==t?void 0:t.type)&&i._eventOff({el:o},t),!1}_eventOff(){var e;let{el:t,force:n=!1,objFilter:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=arguments.length>1?arguments[1]:void 0;const i=this,s=i.options;if(n=n||(null==a||null===(e=a.detail)||void 0===e?void 0:e.force),i.disabled&&!n)return!1;if(n||i._checkOff({el:t})){const e=s.groupElements||i.targets.includes(t)?i.getElements({el:t,same:!0}):[t];i._removeCurrent({el: