xtendui
Version:
Xtend UI is a powerful frontend library of Tailwind CSS components enhanced by vanilla js. It helps you build interfaces with advanced interactions and animations.
3 lines • 28.3 kB
JavaScript
/*! For license information please see 637.min.js.LICENSE.txt */
;(globalThis.webpackChunkxtendui=globalThis.webpackChunkxtendui||[]).push([[637],{235:(t,e,r)=>{var a=r(6846),o=r(3037),n=r(3326),s=r(5096),i=r(3603).get,g=RegExp.prototype,d=TypeError;a&&o&&s(g,"dotAll",{configurable:!0,get:function(){if(this!==g){if("RegExp"===n(this))return!!i(this).dotAll;throw new d("Incompatible receiver, RegExp required")}}})},1794:(t,e,r)=>{var a=r(392),o=r(3326),n=r(9489)("match");t.exports=function(t){var e;return a(t)&&(void 0!==(e=t[n])?!!e:"RegExp"===o(t))}},5637:(t,e,r)=>{r.r(e),r.d(e,{SliderInit:()=>o});r(793),r(1484),r(6119),r(6961),r(4615),r(7849),r(235),r(2925),r(9526);var a=r(5498);class o extends a.Xt.Toggle{_initScope(){const t=this,e=t.options;t.wheel.deltaY=!1,t.wheel.timeout,t.dragger=t.container.querySelector(e.drag.dragger),t._destroyElements.push(t.dragger),t.dragger.classList.add("initial"),t._destroyDrag(),t.drag._wrapDir=0,t.drag._wrapIndex=null;const r=t.dragger.getBoundingClientRect();t.drag.size=t.drag.width=r.width,t.drag.height=r.height,t.drag._left=r.left,0!==t.drag.size&&(t.disabled||e.drag.noMouse||t.dragger.classList.add("xt-grab"),e.autoHeight&&(t._autoHeight=t.container.querySelector(e.autoHeight)),e.keepHeight&&(t._keepHeight=t.container.querySelector(e.keepHeight)),t.drag._position=t.drag._final=t.drag._initial=0,t._destroyNooverflow(),t._destroyWrap(),t._destroyPagination(),t._initScopeTargets(),t._initGroups(),t._initPagination(),t._initScopeElements())}_initScopeElements(){super._initScopeElements();const t=this,e=t.options;t.elements=t.elements.filter((t=>!t.classList.contains(...e.elementsTemplate.split(" "))))}_initGroups(){const t=this,e=t.options;let r=0,o=0;for(const r of t.targets)e.noobserver||(a.Xt.unobserve({container:r,id:t.ns}),t._resetPerfSize.bind(t,r)());for(const n of t.targets){let s,i,g,d;if("absolute"===e.mode)s=0,i=t.drag.width,g=t.drag.height,d=t.drag.height;else{const e=n.getBoundingClientRect();s=e.left-t.drag._left,i=e.width,g=e.height;d=(n.children.length?n.children[0]:n).offsetHeight}r+=i,o=i>o?i:o,a.Xt.dataStorage.set(n,`${t.ns}TrLeftInitial`,s),a.Xt.dataStorage.set(n,`${t.ns}TrLeft`,s),a.Xt.dataStorage.set(n,`${t.ns}TrWidth`,i),a.Xt.dataStorage.set(n,`${t.ns}TrHeight`,g),a.Xt.dataStorage.set(n,`${t.ns}TrHeightContent`,d)}t.drag.sizeContent=r,t._initGroupsInitial(),e.nooverflow&&(t.drag._availableSpace<=0?(t.dragger.classList.add(...e.nooverflow.split(" ")),t._disabledManual=!0,t._initGroupsInitial({group:1})):t._destroyNooverflow()),t._initGroupsPosition(),e.wrap&&"absolute"!==e.mode?t.drag._availableSpace>=o&&(t._wrap=!0):t._wrap=!1,t.drag._wrapFirst=0,t.drag._wrapLast=t._groups.length-1,t._initGroupsContain();for(const e of t._groups)e.targetsInitial=[...e.targets];t._initGroupsSame()}_initGroupsInitial(){let{group:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=this,r=e.options;e._groups=[];let o=0;t=t??r.group;const n=t?e.drag.size*t:0;let s=n;e.drag._availableSpace=-e.drag.size;for(const[t,r]of e.targets.entries()){const i=a.Xt.dataStorage.get(r,`${e.ns}TrWidth`);s-=i,e.drag._availableSpace+=i,s>=0||0!==t&&(o++,s=n,s-=i),e._groups[o]?e._groups[o].targets.push(r):e._groups[o]={target:r,targets:[r]},r.removeAttribute("data-xt-group"),r.setAttribute("data-xt-group",`${e.ns}-${o}`),r.removeAttribute("data-xt-group-same")}}_initGroupsPosition(){const t=this,e=t.options;t._usedWidth=0;for(const r of t._groups){const o=r.target,n=a.Xt.dataStorage.get(o,`${t.ns}TrLeft`),s=t.getTargets({el:o});let i,g=1/0,d=0;for(const r of s){g=a.Xt.dataStorage.get(r,`${t.ns}TrLeft`)<g?n:g,"absolute"===e.mode&&(g+=t._usedWidth),d+=a.Xt.dataStorage.get(r,`${t.ns}TrWidth`),t._usedWidth+=d}"center"===e.align?i=t.drag.size/2-g-d/2:"left"===e.align?i=-g:"right"===e.align&&(i=t.drag.size-g-d);for(const e of s)a.Xt.dataStorage.set(e,`${t.ns}GroupLeft`,i),a.Xt.dataStorage.set(e,`${t.ns}GroupWidth`,d)}}_initGroupsContain(){const t=this,e=t.options;if(e.contain&&"absolute"!==e.mode&&!t._wrap&&t._usedWidth>t.drag.size){const e=t._groups[t.drag._wrapFirst].target,r=t._groups[t.drag._wrapLast].target,o=-a.Xt.dataStorage.get(e,`${t.ns}TrLeft`),n=-a.Xt.dataStorage.get(r,`${t.ns}TrLeft`)-a.Xt.dataStorage.get(r,`${t.ns}GroupWidth`)+t.drag.size;let s=0;for(let e=0;e<t._groups.length-s;e++){const r=t._groups[e];for(const n of r.targets){let i=a.Xt.dataStorage.get(n,`${t.ns}GroupLeft`);if(!(i>=o)){e=t._groups.length;break}{i=o;const n=0;let g=a.Xt.dataStorage.get(t._groups[n].target,`${t.ns}GroupWidth`);if(g+=a.Xt.dataStorage.get(r.target,`${t.ns}GroupWidth`),e>n){const e=t._groups[n].target.getAttribute("data-xt-group");for(const a of r.targets)t._groups[n].targets.push(a),a.setAttribute("data-xt-group",e)}for(const e of t._groups[n].targets)a.Xt.dataStorage.set(e,`${t.ns}GroupLeft`,i),a.Xt.dataStorage.set(e,`${t.ns}GroupWidth`,g);e>n&&(t._groups.splice(e,1),s++,e--)}}}for(let e=t._groups.length-1;e>=0;e--){const r=t._groups[e];for(const o of r.targets){let s=a.Xt.dataStorage.get(o,`${t.ns}GroupLeft`);if(!(s<=n)){e=0;break}{s=n;const o=t._groups.length-1;let i=a.Xt.dataStorage.get(t._groups[o].target,`${t.ns}GroupWidth`);if(i+=a.Xt.dataStorage.get(r.target,`${t.ns}GroupWidth`),e<o){const e=t._groups[o].target.getAttribute("data-xt-group");for(const a of r.targets)t._groups[o].targets.unshift(a),a.setAttribute("data-xt-group",e)}for(const e of t._groups[o].targets)a.Xt.dataStorage.set(e,`${t.ns}GroupLeft`,s),a.Xt.dataStorage.set(e,`${t.ns}GroupWidth`,i);e<o&&t._groups.splice(e,1)}}}for(const e of t._groups){let r=0;const o=a.Xt.dataStorage.get(e.target,`${t.ns}GroupLeft`);for(const o of e.targets)r+=a.Xt.dataStorage.get(o,`${t.ns}TrWidth`);for(const n of e.targets)a.Xt.dataStorage.set(n,`${t.ns}GroupLeft`,o),a.Xt.dataStorage.set(n,`${t.ns}GroupWidth`,r)}t.drag._wrapFirst=0,t.drag._wrapLast=t._groups.length-1}}_initGroupsSame(){const t=this,e=t.options;if(e.groupSame&&"absolute"!==e.mode)for(const[r,o]of t._groups.entries()){const n=o.target,s=n.getAttribute("data-xt-group"),i=a.Xt.dataStorage.get(n,`${t.ns}GroupWidth`),g=a.Xt.dataStorage.get(n,`${t.ns}GroupLeft`),d=a.Xt.dataStorage.get(n,`${t.ns}TrLeft`)+g,l=t.drag.size-d-i;let c=0;for(let o=0;o<=t._groups.length-1;o++){let n=r+1+o;if(n=t._wrap&&n>t._groups.length-1?n-t._groups.length:n,n>t._groups.length-1)break;const i=t._groups[r];for(let r=0;r<t._groups[n].targetsInitial.length;r++){const g=t._groups[n].targetsInitial[r];if(c+=a.Xt.dataStorage.get(g,`${t.ns}TrWidth`),!(c<=l)){o=t._groups.length-1;break}{i.targets.push(g);const t=s+e.groupSeparator+g.getAttribute("data-xt-group")+e.groupSeparator+(g.getAttribute("data-xt-group-same")??"");g.setAttribute("data-xt-group-same",t)}}}c=0;for(let o=0;o<=t._groups.length-1;o++){let n=r-1-o;if(n=t._wrap&&n<0?n+t._groups.length:n,n<0)break;const i=t._groups[r];for(let r=t._groups[n].targetsInitial.length-1;r>=0;r--){const g=t._groups[n].targetsInitial[r];if(c+=a.Xt.dataStorage.get(g,`${t.ns}TrWidth`),!(c<=d)){o=t._groups.length-1;break}{i.targets.unshift(g);const t=g.getAttribute("data-xt-group")+e.groupSeparator+s+e.groupSeparator+(g.getAttribute("data-xt-group-same")??"");g.setAttribute("data-xt-group-same",t)}}}}}_initPagination(){const t=this,e=t.options;if(!t.targets.length)return!1;const r=t.container.querySelectorAll(e.pagination);r.length||console.error("Error: Xt.Slider pagination not found for",t.container),t.pags=t.pags?t.pags:[];const o=`${e.elements}.${e.elementsTemplate.split(" ").join(".")}`,n=`${e.elements}:not(.${e.elementsTemplate.split(" ").join(".")})`;for(const[s,i]of r.entries()){const r=i.querySelector(o);r||console.error(`Error: Xt.Slider ${o} not found inside`,i);const g=r.parentNode;t.pags[s]=[];for(const[o,i]of t._groups.entries()){const d=document.createElement("div"),l=r.cloneNode(!0);l.classList.remove(...e.elementsTemplate.split(" ")),d.append(l);let c=d.innerHTML;const p=["xt-clone"];let _=new RegExp("xt-content","ig");if(-1!==c.search(_)){let t="";for(const e of i.targets){const r=e.querySelector("[data-xt-slider-content]");r&&(t+=r.innerHTML);const a=e.querySelector("[data-xt-slider-element-classes]");a&&p.push(a.getAttribute("data-xt-slider-element-classes"))}c=c.replace(_,t)}_=new RegExp("xt-num","ig"),-1!==c.search(_)&&(c=c.replace(_,(o+1).toString())),_=new RegExp("xt-tot","ig"),-1!==c.search(_)&&(c=c.replace(_,t._groups.length.toString())),d.innerHTML=a.Xt.sanitize(c),p.length&&d.children[0].classList.add(...p),d.children[0].setAttribute("data-xt-group",i.target.getAttribute("data-xt-group")),g.insertBefore(d.children[0],r),d.remove(),t.pags[s][o]=g.querySelectorAll(n)[o],t._groups[o].element=t.pags[0][o]}}}_initEvents(){super._initEvents();const t=this,e=t.options,r=a.Xt.dataStorage.put(t.container,`init/${t.ns}`,t._eventInitHandler.bind(t));t.container.addEventListener("init.xt.slider",r);const o=a.Xt.dataStorage.put(window,`mousedown touchstart/drag/${t.ns}`,t._eventDragstartHandler.bind(t)),n=e.drag.noMouse?["touchstart"]:["mousedown","touchstart"];for(const t of n)addEventListener(t,o,{passive:!1});const s=a.Xt.dataStorage.put(t.dragger,`dragstart/drag/${t.ns}`,t._eventDragstartFix);t.dragger.addEventListener("dragstart",s);const i=a.Xt.dataStorage.put(window,`resize.xt/${t.ns}`,a.Xt._eventReinit.bind(null,{self:t}));addEventListener("resize.xt",i)}_initStart(){let{save:t=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=this;0!==e.drag.size&&(e._initPerfSize(),a.Xt.frame({el:e.container,ns:`${e.ns}InitDrag`,func:()=>{e.drag._instant=!0,e.drag._dragging=!1,e.dragger.dispatchEvent(new CustomEvent(`dragposition.${e._componentNs}`)),e._logicDragposition()}}),super._initStart({save:t}))}_initPerfSize(){const t=this,e=t.options;"relative"!==e.mode||e.noobserver||a.Xt.perf({func:()=>{for(const e of t.targets){const r=t._funcPerfSize.bind(t,e);a.Xt.observe({container:e,func:r,id:t.ns})}}})}_setPerfSize(t){const e=this,r=e.options,o=a.Xt.dataStorage.get(t,`${e.ns}TrWidth`),n=a.Xt.dataStorage.get(t,`${e.ns}TrHeight`);t.style.width=`${o}px`,t.style.height=`${n}px`;for(const e of t.children)e.style.display="none";r.a11y.hidden&&t.setAttribute("aria-hidden","true")}_resetPerfSize(t){const e=this.options;t.style.height="",t.style.width="";for(const e of t.children)e.style.display="";e.a11y.hidden&&t.setAttribute("aria-hidden","false")}_funcPerfSize(t,e){const r=this;e?r._resetPerfSize.bind(r,t)():r._setPerfSize.bind(r,t)()}_eventInitHandler(){this.dragger.classList.remove("initial")}_eventDragstartFix(t){t.preventDefault()}_eventDragstartHandler(t){const e=this,r=e.options;if(e.dragger.contains(t.target)&&(!t.button||2!==t.button)){if(r.eventLimit){const o=e._containerTargets.querySelectorAll(r.eventLimit);a.Xt.contains({els:o,tr:t.target})||e._eventDragstart(t)}else e._eventDragstart(t);const o=a.Xt.dataStorage.put(window,`mouseup touchend/drag/${e.ns}`,e._eventDragendHandler.bind(e)),n=["mouseup","touchend"];for(const t of n)addEventListener(t,o)}}_eventDragendHandler(t){const e=this,r=e.options;if(r.eventLimit){const o=e._containerTargets.querySelectorAll(r.eventLimit);a.Xt.contains({els:o,tr:t.target})||e._eventDragend(t)}else e._eventDragend(t)}_eventDragstart(t){const e=this,r=a.Xt.dataStorage.put(window,`mousemove touchmove/drag/${e.ns}`,e._eventDragHandler.bind(e)),o=["mousemove","touchmove"];for(const t of o)addEventListener(t,r,{passive:!1});e._logicDragstart(t)}_eventDragHandler(t){this._logicDragmove(t)}_eventDragend(t){const e=this,r=a.Xt.dataStorage.get(window,`mouseup touchend/drag/${e.ns}`),o=["mouseup","touchend"];for(const t of o)removeEventListener(t,r);const n=a.Xt.dataStorage.get(window,`mousemove touchmove/drag/${e.ns}`),s=["mousemove","touchmove"];for(const t of s)removeEventListener(t,n);e._logicDragend(t)}_eventOn(t,e){let{el:r,force:o=!1}=t;const n=this,s=n.options;if(n.disabled)return;let i;for(const t of n._groups)(t.element===r||t.targetsInitial.includes(r))&&(i=t);if(!i)return;const g=i;r=i.element;const d=i.target,l=n.drag._instant;super._eventOn({el:r,force:o},e);const c=n._groups[n.drag._wrapFirst].target,p=n._groups[n.drag._wrapLast].target,_=a.Xt.dataStorage.get(c,`${n.ns}GroupLeft`),u=a.Xt.dataStorage.get(p,`${n.ns}GroupLeft`),h="absolute"!==s.mode?u:a.Xt.dataStorage.get(c,`${n.ns}GroupWidth`);if(n.drag._initial=a.Xt.dataStorage.get(d,`${n.ns}GroupLeft`),"absolute"===s.mode&&!n.initial&&n.direction){const t=Math.abs(n.drag._initial-n.drag._position)>h;if(s.loop&&d===p&&t&&n.direction<0){const t=u-_+n.drag._position-h;n.drag._final=t,n.drag._instant=!0,n.drag._dragging=!1,n.dragger.dispatchEvent(new CustomEvent(`dragposition.${n._componentNs}`)),n._logicDragposition()}else if(s.loop&&d===c&&t&&n.direction>0){const t=_-u+n.drag._position+h;n.drag._final=t,n.drag._instant=!0,n.drag._dragging=!1,n.dragger.dispatchEvent(new CustomEvent(`dragposition.${n._componentNs}`)),n._logicDragposition()}else if(t){const t=n.drag._final-n.drag._position-h*n.direction;n.drag._final=n.drag._initial-t,n.drag._instant=!0,n.drag._dragging=!1,n.dragger.dispatchEvent(new CustomEvent(`dragposition.${n._componentNs}`)),n._logicDragposition()}}if(n.drag._final=n.drag._initial,n.drag._direction=null,n.drag._ratioInverse=Math.abs(n.drag._final-n.drag._position)/Math.abs(h-_),n.drag._ratio=1-n.drag._ratioInverse,n.drag._instant=!1,n.drag._dragging=!1,n.dragger.dispatchEvent(new CustomEvent(`dragposition.${n._componentNs}`)),n._logicDragposition(),n.drag._instant=l,a.Xt.frame({el:n.container,ns:`${n.ns}isInstant`,func:()=>{n.drag._instant=!1}}),n._eventWrap({index:n.index}),n._autoHeight||n._keepHeight&&n.initial){let t=0;for(const e of g.targets){const r=a.Xt.dataStorage.get(e,`${n.ns}TrHeightContent`);t=r>t?r:t}t>0&&(t+="px",n._autoHeight.style.height!==t&&(n._autoHeight.style.height=t,d.dispatchEvent(new CustomEvent(`autoheight.${n._componentNs}`))),n._keepHeight&&n.initial&&(n._keepHeight.style.height=t))}}_setDirection(){const t=this;if(null===t.index||t.index===t._oldIndex)t.direction=0;else if(null!==t._inverse)t.direction=t._inverse?-1:1;else{const e=a.Xt.dataStorage.get(t._groups[t.index].target,`${t.ns}GroupLeft`),r=a.Xt.dataStorage.get(t._groups[t._oldIndex].target,`${t.ns}GroupLeft`);t.direction=e>r?-1:1}t._inverse=t.direction<0}_eventWrap(){let{index:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=this;if(e._wrap){const r=e._groups[t].target,o=a.Xt.dataStorage.get(r,`${e.ns}GroupLeft`),n=a.Xt.dataStorage.get(r,`${e.ns}GroupWidth`);let s=e.direction;s||(s=e.drag._final>-e.drag.size?-1:1),e.drag._wrapDir===s&&e.drag._wrapIndex===t||(e.drag._wrapDir=s,e.drag._wrapIndex=t,e._eventMove({index:t,direction:s,wrapLeft:o,previousWidth:n,wrapSpace:n}))}}_eventMove(){let{index:t,direction:e,wrapLeft:r,previousWidth:o,wrapSpace:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const s=this,i=s.options,g=s._groups.length;if(e<0?(t=s.getPrevIndex({index:t}),s.drag._wrapFirst=t,s.drag._wrapFirst=s.drag._wrapFirst<g?s.drag._wrapFirst:s.drag._wrapFirst-g,s.drag._wrapFirst=s.drag._wrapFirst>=0?s.drag._wrapFirst:g+s.drag._wrapFirst,s.drag._wrapLast=s.drag._wrapFirst-1,s.drag._wrapLast=s.drag._wrapLast<g?s.drag._wrapLast:s.drag._wrapLast-g,s.drag._wrapLast=s.drag._wrapLast>=0?s.drag._wrapLast:g+s.drag._wrapLast):e>0&&(t=s.getNextIndex({index:t}),s.drag._wrapLast=t,s.drag._wrapLast=s.drag._wrapLast<g?s.drag._wrapLast:s.drag._wrapLast-g,s.drag._wrapLast=s.drag._wrapLast>=0?s.drag._wrapLast:g+s.drag._wrapLast,s.drag._wrapFirst=s.drag._wrapLast+1,s.drag._wrapFirst=s.drag._wrapFirst<g?s.drag._wrapFirst:s.drag._wrapFirst-g,s.drag._wrapFirst=s.drag._wrapFirst>=0?s.drag._wrapFirst:g+s.drag._wrapFirst),null===t)return;let d,l=r;const c=s._groups[t].targetsInitial,p=c[0],_=a.Xt.dataStorage.get(p,`${s.ns}TrLeftInitial`),u=a.Xt.dataStorage.get(p,`${s.ns}GroupWidth`);e<0?"center"===i.align?l+=o/2+u/2:"left"===i.align?l+=u:"right"===i.align&&(l+=o):e>0&&("center"===i.align?l-=o/2+u/2:"left"===i.align?l-=o:"right"===i.align&&(l-=u));for(const t of c)a.Xt.dataStorage.set(t,`${s.ns}GroupLeft`,l);e<0?d=r+_+u:e>0&&(d=r+_-o),"center"===i.align?d-=s.drag.size/2-o/2:"left"===i.align?d-=0:"right"===i.align&&(d-=s.drag.size-o);for(const t of c){const e=a.Xt.dataStorage.get(t,`${s.ns}TrLeftInitial`);a.Xt.dataStorage.set(t,`${s.ns}TrLeft`,e-d),t.style.transform=`translateX(${-d}px)`}e<0?"center"===i.align?n+=u+o/2:"left"===i.align?n+=u+s.drag.size-o:"right"===i.align&&(n+=u):e>0&&("center"===i.align?n+=u+o/2:"left"===i.align?n+=u:"right"===i.align&&(n+=u+s.drag.size-o)),n<=s.drag.size&&s._eventMove({index:t,direction:e,wrapLeft:l,previousWidth:u,wrapSpace:n})}dragstart(t){this._logicDragstart(t)}_logicDragstart(t){const e=this;e.disabled||(void 0!==t.clientX?(e.drag._start=t.clientX,e.drag._startOther=t.clientY):t.touches&&t.touches.length&&(e.drag._start=t.touches[0].clientX,e.drag._startOther=t.touches[0].clientY),e._eventAutostop(),e._autoblock=!0,e.drag._lock=!1,e.drag._prevent=!1,e.drag._index=e.index,e.drag._old=e.drag._start,e.drag._overflow=null,e.dragger.dispatchEvent(new CustomEvent(`dragstart.${e._componentNs}`)))}dragmove(t){let{keepActivated:e,setup:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this._logicDragmove(t,{keepActivated:e,setup:r})}_logicDragmove(t){let{keepActivated:e=!1,setup:r=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const o=this,n=o.options;if(o.disabled)return;if(void 0!==t.clientX?(o.drag._current=t.clientX,o.drag._currentOther=t.clientY):t.touches&&t.touches.length&&(o.drag._current=t.touches[0].clientX,o.drag._currentOther=t.touches[0].clientY),o.drag._distance=o.drag._start-o.drag._current,o.drag._distanceOther=o.drag._startOther-o.drag._currentOther,o.drag._lock||o.drag._prevent||(Math.abs(o.drag._distanceOther)>n.drag.threshold?o.drag._prevent=!0:Math.abs(o.drag._distance)>n.drag.threshold&&(o.drag._lock=!0)),o.drag._start===o.drag._current)return;if(r&&(o.drag._current=Math.sign(o.drag._current)),o.drag._prevent)return;if(o.drag._lock&&(t.cancelable&&t.preventDefault(),!e))for(const t of o.targets)t.classList.add("pointer-events-none");const s=o._groups[o.drag._wrapFirst].target,i=o._groups[o.drag._wrapLast].target,g=a.Xt.dataStorage.get(s,`${o.ns}GroupLeft`),d=a.Xt.dataStorage.get(i,`${o.ns}GroupLeft`),l="absolute"!==n.mode?d:a.Xt.dataStorage.get(s,`${o.ns}GroupWidth`);let c=o.drag._position+(o.drag._current-o.drag._old)*n.drag.factor;if(o.drag._direction=o.drag._current>o.drag._old?-1:1,o.drag._old=o.drag._current,!o._wrap&&"absolute"!==n.mode){const t=Math.sign(o.drag._distance),e=n.drag.overflow?n.drag.overflow:()=>0;if(c>g&&t<0){o.drag._overflow=o.drag._overflow?o.drag._overflow:o.drag._current;const t=o.drag._current-o.drag._overflow;c=t>=0?g+e({overflow:t}):c}else if(c<d&&t>0){o.drag._overflow=o.drag._overflow?o.drag._overflow:o.drag._current;const t=o.drag._current-o.drag._overflow;c=t<=0?d-e({overflow:-t}):c}}if(o.drag._final=c,o.direction=Math.sign(o.drag._initial-o.drag._final),o._inverse=o.direction<0,o.drag._ratio=Math.abs(o.drag._final-o.drag._initial)/Math.abs(l-g),o.drag._ratio=o.drag._ratio>1?1:o.drag._ratio,o.drag._ratio=o.drag._ratio<-1?-1:o.drag._ratio,o.drag._ratioInverse=1-o.drag._ratio,"absolute"===n.mode&&(o.direction>0&&o.drag._final>o.drag._initial||o.direction<0&&o.drag._final<o.drag._initial)&&(o.drag._ratio=0,o.drag._ratioInverse=0),o.drag._instant=!0,o.direction!==o.directionOld?o.drag._dragging=!1:o.drag._dragging=!0,o.dragger.dispatchEvent(new CustomEvent(`dragposition.${o._componentNs}`)),o._logicDragposition(),o.dragger.dispatchEvent(new CustomEvent(`drag.${o._componentNs}`)),o._inverse=null,o.directionOld=o.direction,o.drag._lock&&"absolute"!==n.mode){const t=o._logicDragfind({index:o.index});null!==t&&t!==o.index&&(super._eventOn({el:o._groups[t].element,force:!0}),o._eventWrap({index:t}))}}dragend(t){this._logicDragend(t)}_logicDragend(t){const e=this,r=e.options;if(!e.disabled){void 0!==t.clientX?(e.drag._current=t.clientX,e.drag._currentOther=t.clientY):t.touches&&t.touches.length&&(e.drag._current=t.touches[0].clientX,e.drag._currentOther=t.touches[0].clientY),e._autoblock=!1;for(const t of e.targets)t.classList.remove("pointer-events-none");e.drag._start!==e.drag._current?requestAnimationFrame((()=>{if(e.drag._lock){const t=e.index;if(t!==e.drag._index)r.free&&!e.drag._overflow||e.goToNum({index:t});else{const a=Math.sign(e.drag._distance);a>0&&e.drag._direction>0&&(r.loop||e._wrap||t!==e.getElementsGroups().length-1)?r.free&&t!==e.getElementsGroups().length-1||e.goToNext({amount:1}):a<0&&e.drag._direction<0&&(r.loop||e._wrap||0!==t)?r.free&&0!==t||e.goToPrev({amount:1}):e._wrap||e._logicDragreset()}}else r.free||e._logicDragreset();e._eventAutostart(),e.dragger.dispatchEvent(new CustomEvent(`dragend.${e._componentNs}`))})):e.dragger.dispatchEvent(new CustomEvent(`dragend.${e._componentNs}`))}}_logicDragreset(){const t=this,e=t.options;t.direction=-Math.sign(t.drag._initial-t.drag._final),t._inverse=t.direction<0;const r=t._groups[t.drag._wrapFirst].target,o=t._groups[t.drag._wrapLast].target,n=a.Xt.dataStorage.get(r,`${t.ns}GroupLeft`),s=a.Xt.dataStorage.get(o,`${t.ns}GroupLeft`),i="absolute"!==e.mode?s:a.Xt.dataStorage.get(r,`${t.ns}GroupWidth`);t.drag._ratio=1-Math.abs(t.drag._final-t.drag._initial)/Math.abs(i-n),t.drag._ratioInverse=1-t.drag._ratio,t.drag._final=t.drag._initial,t.drag._direction=null,t.drag._instant=!1,t.drag._dragging=!1,t.dragger.dispatchEvent(new CustomEvent(`dragposition.${t._componentNs}`)),t._logicDragposition(),t.dragger.dispatchEvent(new CustomEvent(`dragreset.${t._componentNs}`)),t._inverse=null,t._eventAutostart()}_logicDragfind(){let{index:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=this,r=e.drag._direction;if(r<0){const r=e._groups[e.drag._wrapFirst].target,o=a.Xt.dataStorage.get(r,`${e.ns}GroupLeft`);if(e.drag._final>=o)return e.drag._wrapFirst;for(let r=t;r>=0;r--){const o=e._groups[r].target,n=a.Xt.dataStorage.get(o,`${e.ns}GroupLeft`),s=a.Xt.dataStorage.get(o,`${e.ns}GroupWidth`);if(e.drag._final<n+s/2)return r;if(0===r&&(r=e._groups.length),r===t+1)break}}else if(r>0){const r=e._groups[e.drag._wrapLast].target,o=a.Xt.dataStorage.get(r,`${e.ns}GroupLeft`);if(e.drag._final<=o)return e.drag._wrapLast;for(let r=t;r<e._groups.length;r++){const o=e._groups[r].target,n=a.Xt.dataStorage.get(o,`${e.ns}GroupLeft`),s=a.Xt.dataStorage.get(o,`${e.ns}GroupWidth`);if(e.drag._final>n-s/2)return r;if(r===e._groups.length-1&&(r=-1),r===t-1)break}}return null}_logicDragposition(){const t=this,e=t.options;e.dragposition||"absolute"===e.mode||(t.drag._instant?t.dragger.classList.remove("on"):t.dragger.classList.add("on"),t.drag._position=t.drag._final,t.dragger.style.transform=`translateX(${t.drag._final}px)`)}wheelEvent(){let{factor:t=-1,timeout:e=250,threshold:r=10}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=arguments.length>1?arguments[1]:void 0;const o=this,n=o.options;let s=a.deltaY*t;return Math.abs(s)<r?o.wheel.deltaY&&(clearTimeout(o.wheel.timeout),o._wheelStop({clientX:s})):(o.wheel.deltaY?(s=o.wheel.deltaY+s,o._wheelMove({clientX:s})):(o._wheelStart(),o._wheelMove({clientX:s,setup:!0}),o._wheelMove({clientX:s})),clearTimeout(o.wheel.timeout),o.wheel.timeout=setTimeout((()=>{o._wheelStop({clientX:s})}),e)),!(o.drag._direction&&!(o.drag._direction>0)||!n.loop&&!o._wrap&&o.index===o.getElementsGroups().length-1)||!(o.drag._direction&&!(o.drag._direction<0)||!n.loop&&!o._wrap&&0===o.index)}_wheelStart(){const t=this;t.wheel._wheeling=!1,t.wheel.deltaY=!1,t.dragstart({clientX:0})}_wheelMove(t){let{clientX:e,setup:r}=t;const a=this;r||(a.wheel._wheeling=!0),a.wheel.deltaY=e,a.dragmove({clientX:e},{keepActivated:!0,setup:r})}_wheelStop(t){let{clientX:e}=t;const r=this;r.wheel._wheeling=!1,r.wheel.deltaY=!1,r.dragend({clientX:e})}enable(){const t=this,e=t.options;if(t.disabled&&(e.drag.noMouse||t.dragger.classList.add("xt-grab"),e.hideDisable)){const r=t.container.querySelectorAll(e.hideDisable);for(const t of r)t.classList.remove("hidden")}super.enable()}disable(){let{skipEvent:t=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=this,r=e.options;if(!e.disabled&&(e._destroyGrab(),e._destroyIntraction(),r.hideDisable)){const t=e.container.querySelectorAll(r.hideDisable);for(const e of t)e.classList.add("hidden")}super.disable({skipEvent:t})}destroy(){let{weak:t=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=this;e._destroyGrab(),e._destroyIntraction(),e._destroyNooverflow(),e._destroyDrag(),e._destroyAutoheight(),e._destroyPagination(),e._destroyWrap(),e._destroyPerfSize(),super.destroy({weak:t})}_destroyGrab(){const t=this;t.dragger&&t.dragger.classList.remove("xt-grab")}_destroyIntraction(){const t=this;for(const e of t.targets)e.classList.remove("pointer-events-none")}_destroyDrag(){const t=this;t.dragger.style.transform&&(t.dragger.style.transform="")}_destroyNooverflow(){const t=this,e=t.options;e.nooverflow&&(t.dragger.classList.remove(...e.nooverflow.split(" ")),t._disabledManual=!1)}_destroyAutoheight(){const t=this;(t._autoHeight||t._keepHeight)&&(t._autoHeight.style.height="")}_destroyPagination(){const t=this;if(t.pags&&t.pags.length){for(const e of t.pags)for(const t of e)t.remove();t.pags=[]}}_destroyWrap(){const t=this;for(const e of t.targets)e.style.transform=""}_destroyPerfSize(){const t=this,e=t.options;if("relative"===e.mode&&!e.noobserver)for(const e of t.targets)a.Xt.hasobserve({container:e,id:t.ns})&&a.Xt.unobserve({container:e,id:t.ns})}}},6119:(t,e,r)=>{var a=r(7508),o=r(987),n=r(7184),s=r(7609),i=r(7004),g=r(1379);a({target:"Array",proto:!0,arity:1,forced:1!==[].unshift(0)||!function(){try{Object.defineProperty([],"length",{writable:!1}).unshift()}catch(t){return t instanceof TypeError}}()},{unshift:function(t){var e=o(this),r=n(e),a=arguments.length;if(a){g(r+a);for(var d=r;d--;){var l=d+a;d in e?e[l]=e[d]:i(e,l)}for(var c=0;c<a;c++)e[c]=arguments[c]}return s(e,r+a)}})},7004:(t,e,r)=>{var a=r(217),o=TypeError;t.exports=function(t,e){if(!delete t[e])throw new o("Cannot delete property "+a(e)+" of "+a(t))}},7849:(t,e,r)=>{var a=r(6846),o=r(2506),n=r(8026),s=r(4346),i=r(1037),g=r(7325),d=r(8362),l=r(230).f,c=r(6399),p=r(1794),_=r(6933),u=r(8536),h=r(7099),f=r(7246),v=r(2138),w=r(7737),m=r(9883),S=r(3603).enforce,b=r(9459),X=r(9489),L=r(3037),$=r(448),x=X("match"),y=o.RegExp,E=y.prototype,G=o.SyntaxError,D=n(E.exec),T=n("".charAt),A=n("".replace),k=n("".indexOf),I=n("".slice),W=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,z=/a/g,H=/a/g,M=new y(z)!==z,F=h.MISSED_STICKY,C=h.UNSUPPORTED_Y,N=a&&(!M||F||L||$||w((function(){return H[x]=!1,y(z)!==z||y(H)===H||"/a/i"!==String(y(z,"i"))})));if(s("RegExp",N)){for(var P=function(t,e){var r,a,o,n,s,l,h=c(E,this),f=p(t),v=void 0===e,w=[],b=t;if(!h&&f&&v&&t.constructor===P)return t;if((f||c(E,t))&&(t=t.source,v&&(e=u(b))),t=void 0===t?"":_(t),e=void 0===e?"":_(e),b=t,L&&"dotAll"in z&&(a=!!e&&k(e,"s")>-1)&&(e=A(e,/s/g,"")),r=e,F&&"sticky"in z&&(o=!!e&&k(e,"y")>-1)&&C&&(e=A(e,/y/g,"")),$&&(n=function(t){for(var e,r=t.length,a=0,o="",n=[],s=d(null),i=!1,g=!1,l=0,c="";a<=r;a++){if("\\"===(e=T(t,a)))e+=T(t,++a);else if("]"===e)i=!1;else if(!i)switch(!0){case"["===e:i=!0;break;case"("===e:if(o+=e,"?:"===I(t,a+1,a+3))continue;D(W,I(t,a+1))&&(a+=2,g=!0),l++;continue;case">"===e&&g:if(""===c||m(s,c))throw new G("Invalid capture group name");s[c]=!0,n[n.length]=[c,l],g=!1,c="";continue}g?c+=e:o+=e}return[o,n]}(t),t=n[0],w=n[1]),s=i(y(t,e),h?this:E,P),(a||o||w.length)&&(l=S(s),a&&(l.dotAll=!0,l.raw=P(function(t){for(var e,r=t.length,a=0,o="",n=!1;a<=r;a++)"\\"!==(e=T(t,a))?n||"."!==e?("["===e?n=!0:"]"===e&&(n=!1),o+=e):o+="[\\s\\S]":o+=e+T(t,++a);return o}(t),r)),o&&(l.sticky=!0),w.length&&(l.groups=w)),t!==b)try{g(s,"source",""===b?"(?:)":b)}catch(t){}return s},O=l(y),R=0;O.length>R;)f(P,y,O[R++]);E.constructor=P,P.prototype=E,v(o,"RegExp",P,{constructor:!0})}b("RegExp")},8536:(t,e,r)=>{var a=r(6671),o=r(9883),n=r(6399),s=r(6461),i=RegExp.prototype;t.exports=function(t){var e=t.flags;return void 0!==e||"flags"in i||o(t,"flags")||!n(i,t)?e:a(s,t)}},9459:(t,e,r)=>{var a=r(9073),o=r(5096),n=r(9489),s=r(6846),i=n("species");t.exports=function(t){var e=a(t);s&&e&&!e[i]&&o(e,i,{configurable:!0,get:function(){return this}})}}}]);
//# sourceMappingURL=637.min.js.map