UNPKG

uikit

Version:

UIkit is a lightweight and modular front-end framework for developing fast and powerful web interfaces.

2 lines (1 loc) • 24.3 kB
/*! UIkit 3.21.0 | https://www.getuikit.com | (c) 2014 - 2024 YOOtheme | MIT License */(function(i,w){typeof exports=="object"&&typeof module<"u"?module.exports=w(require("uikit-util")):typeof define=="function"&&define.amd?define("uikitslideshow",["uikit-util"],w):(i=typeof globalThis<"u"?globalThis:i||self,i.UIkitSlideshow=w(i.UIkit.util))})(this,function(i){"use strict";var w={connected(){i.addClass(this.$el,this.$options.id)}};function dt(t,e="update"){t._connected&&t._updates.length&&(t._queued||(t._queued=new Set,i.fastdom.read(()=>{t._connected&&ct(t,t._queued),delete t._queued})),t._queued.add(e.type||e))}function ct(t,e){for(const{read:n,write:s,events:a=[]}of t._updates){if(!e.has("update")&&!a.some(h=>e.has(h)))continue;let r;n&&(r=n.call(t,t._data,e),r&&i.isPlainObject(r)&&i.assign(t._data,r)),s&&r!==!1&&i.fastdom.write(()=>{t._connected&&s.call(t,t._data,e)})}}function W(t){return T(i.observeResize,t,"resize")}function lt(t){return T(i.observeIntersection,t)}function ft(t={}){return lt({handler:function(e,n){const{targets:s=this.$el,preload:a=5}=t;for(const r of i.toNodes(i.isFunction(s)?s(this):s))i.$$('[loading="lazy"]',r).slice(0,a-1).forEach(h=>i.removeAttr(h,"loading"));for(const r of e.filter(({isIntersecting:h})=>h).map(({target:h})=>h))n.unobserve(r)},...t})}function ut(t){return T((e,n)=>({disconnect:i.on(gt(e),"scroll",n,{passive:!0})}),t,"scroll")}function T(t,e,n){return{observe:t,handler(){dt(this,n)},...e}}function gt(t){return i.toNodes(t).map(e=>{const{ownerDocument:n}=e,s=i.scrollParent(e,!0);return s===n.scrollingElement?n:s})}var mt={props:{media:Boolean},data:{media:!1},connected(){const t=pt(this.media,this.$el);if(this.matchMedia=!0,t){this.mediaObj=window.matchMedia(t);const e=()=>{this.matchMedia=this.mediaObj.matches,i.trigger(this.$el,i.createEvent("mediachange",!1,!0,[this.mediaObj]))};this.offMediaObj=i.on(this.mediaObj,"change",()=>{e(),this.$emit("resize")}),e()}},disconnected(){var t;(t=this.offMediaObj)==null||t.call(this)}};function pt(t,e){if(i.isString(t)){if(i.startsWith(t,"@"))t=i.toFloat(i.css(e,`--uk-breakpoint-${t.slice(1)}`));else if(isNaN(t))return t}return t&&i.isNumeric(t)?`(min-width: ${t}px)`:""}function xt(t,e){var n;return(n=t==null?void 0:t.startsWith)==null?void 0:n.call(t,e)}const{isArray:ge,from:vt}=Array;function wt(t){return typeof t=="function"}function O(t){return t!==null&&typeof t=="object"}function bt(t){return O(t)&&t===t.window}function It(t){return L(t)===9}function R(t){return L(t)>=1}function L(t){return!bt(t)&&O(t)&&t.nodeType}function M(t){return typeof t=="string"}function $t(t){return t===void 0}function b(t){return t&&m(t)[0]}function m(t){return R(t)?[t]:Array.from(t||[]).filter(R)}function U(t){const e=Object.create(null);return(n,...s)=>e[n]||(e[n]=t(n,...s))}function P(t,e,n){var s;if(O(e)){for(const a in e)P(t,a,e[a]);return}if($t(n))return(s=b(t))==null?void 0:s.getAttribute(e);for(const a of m(t))wt(n)&&(n=n.call(a,P(a,e))),n===null?yt(a,e):a.setAttribute(e,n)}function yt(t,e){m(t).forEach(n=>n.removeAttribute(e))}const St=typeof window<"u"&&Element.prototype.checkVisibility||function(){return this.offsetWidth||this.offsetHeight||this.getClientRects().length};function kt(t){return m(t).some(e=>St.call(e))}function _t(t){var e;return(e=b(t))==null?void 0:e.parentElement}function At(t,e){return m(t).filter(n=>B(n,e))}function B(t,e){return m(t).some(n=>n.matches(e))}function Ct(t,e){t=b(t);const n=t?vt(t.children):[];return e?At(n,e):n}function V(t,e){return e?m(t).indexOf(b(e)):Ct(_t(t)).indexOf(t)}function zt(t,e){return m(Mt(t,b(e),"querySelectorAll"))}const Nt=/([!>+~-])(?=\s+[!>+~-]|\s*$)/g,Et=/.*?[^\\](?![^(]*\))(?:,|$)/g,Tt=/\s*,$/,Ot=U(t=>{var e;t=t.replace(Nt,"$1 *");let n=!1;const s=[];for(let a of(e=t.match(Et))!=null?e:[])a=a.replace(Tt,"").trim(),n||(n=["!","+","~","-",">"].includes(a[0])),s.push(a);return{selector:s.join(","),selectors:s,isContextSelector:n}}),q=U(t=>{t=t.slice(1).trim();const e=t.indexOf(" ");return~e?[t.slice(0,e),t.slice(e+1)]:[t,""]});function Mt(t,e=document,n){if(!t||!M(t))return t;const s=Ot(t);if(!s.isContextSelector)return H(e,n,s.selector);t="";const a=s.selectors.length===1;for(let r of s.selectors){let h,o=e;if(r[0]==="!"&&([h,r]=q(r),o=e.parentElement.closest(h),!r&&a)||o&&r[0]==="-"&&([h,r]=q(r),o=o.previousElementSibling,o=B(o,h)?o:null,!r&&a))return o;if(o){if(a)return r[0]==="~"||r[0]==="+"?(r=`:scope > :nth-child(${V(o)+1}) ${r}`,o=o.parentElement):r[0]===">"&&(r=`:scope ${r}`),H(o,n,r);t+=`${t?",":""}${Pt(o)} ${r}`}}return It(e)||(e=e.ownerDocument),H(e,n,t)}function H(t,e,n){try{return t[e](n)}catch{return null}}function Pt(t){const e=[];for(;t.parentNode;){const n=P(t,"id");if(n){e.unshift(`#${Ht(n)}`);break}else{let{tagName:s}=t;s!=="HTML"&&(s+=`:nth-child(${V(t)+1})`),e.unshift(s),t=t.parentNode}}return e.join(" > ")}function Ht(t){return M(t)?CSS.escape(t):""}const Ft=/^<(\w+)\s*\/?>(?:<\/\1>)?$/;function Dt(t){const e=Ft.exec(t);if(e)return document.createElement(e[1]);const n=document.createElement("template");return n.innerHTML=t.trim(),jt(n.content.childNodes)}function jt(t){return t.length>1?t:t[0]}function Wt(t,e){return Rt(t)?m(Dt(t)):zt(t,e)}function Rt(t){return M(t)&&xt(t.trim(),"<")}function Lt(t){return kt(t)?Math.ceil(Math.max(0,...Wt("[stroke]",t).map(e=>e.getTotalLength()))):0}const _={x:A,y:A,rotate:A,scale:A,color:F,backgroundColor:F,borderColor:F,blur:x,hue:x,fopacity:x,grayscale:x,invert:x,saturate:x,sepia:x,opacity:Bt,stroke:Vt,bgx:X,bgy:X},{keys:G}=Object;Z(G(_),"list"),Z(G(_),void 0);function A(t,e,n){let s=z(n)||{x:"px",y:"px",rotate:"deg"}[t]||"",a;return t==="x"||t==="y"?(t=`translate${i.ucfirst(t)}`,a=r=>i.toFloat(i.toFloat(r).toFixed(s==="px"?0:6))):t==="scale"&&(s="",a=r=>{var h;return z([r])?i.toPx(r,"width",e,!0)/e[`offset${(h=r.endsWith)!=null&&h.call(r,"vh")?"Height":"Width"}`]:i.toFloat(r)}),n.length===1&&n.unshift(t==="scale"?1:0),n=v(n,a),(r,h)=>{r.transform=`${r.transform||""} ${t}(${I(n,h)}${s})`}}function F(t,e,n){return n.length===1&&n.unshift($(e,t,"")),n=v(n,s=>Ut(e,s)),(s,a)=>{const[r,h,o]=Y(n,a),c=r.map((f,d)=>(f+=o*(h[d]-f),d===3?i.toFloat(f):parseInt(f,10))).join(",");s[t]=`rgba(${c})`}}function Ut(t,e){return $(t,"color",e).split(/[(),]/g).slice(1,-1).concat(1).slice(0,4).map(i.toFloat)}function x(t,e,n){n.length===1&&n.unshift(0);const s=z(n)||{blur:"px",hue:"deg"}[t]||"%";return t={fopacity:"opacity",hue:"hue-rotate"}[t]||t,n=v(n),(a,r)=>{const h=I(n,r);a.filter=`${a.filter||""} ${t}(${h+s})`}}function Bt(t,e,n){return n.length===1&&n.unshift($(e,t,"")),n=v(n),(s,a)=>{s[t]=I(n,a)}}function Vt(t,e,n){n.length===1&&n.unshift(0);const s=z(n),a=Lt(e);return n=v(n.reverse(),r=>(r=i.toFloat(r),s==="%"?r*a/100:r)),n.some(([r])=>r)?(i.css(e,"strokeDasharray",a),(r,h)=>{r.strokeDashoffset=I(n,h)}):i.noop}function X(t,e,n,s){n.length===1&&n.unshift(0);const a=t==="bgy"?"height":"width";s[t]=v(n,o=>i.toPx(o,a,e));const r=["bgx","bgy"].filter(o=>o in s);if(r.length===2&&t==="bgx")return i.noop;if($(e,"backgroundSize","")==="cover")return qt(t,e,n,s);const h={};for(const o of r)h[o]=Q(e,o);return J(r,h,s)}function qt(t,e,n,s){const a=Gt(e);if(!a.width)return i.noop;const r={width:e.offsetWidth,height:e.offsetHeight},h=["bgx","bgy"].filter(d=>d in s),o={};for(const d of h){const l=s[d].map(([ue])=>ue),g=Math.min(...l),p=Math.max(...l),E=l.indexOf(g)<l.indexOf(p),ht=p-g;o[d]=`${(E?-ht:0)-(E?g:p)}px`,r[d==="bgy"?"height":"width"]+=ht}const c=i.Dimensions.cover(a,r);for(const d of h){const l=d==="bgy"?"height":"width",g=c[l]-r[l];o[d]=`max(${Q(e,d)},-${g}px) + ${o[d]}`}const f=J(h,o,s);return(d,l)=>{f(d,l),d.backgroundSize=`${c.width}px ${c.height}px`,d.backgroundRepeat="no-repeat"}}function Q(t,e){return $(t,`background-position-${e.slice(-1)}`,"")}function J(t,e,n){return function(s,a){for(const r of t){const h=I(n[r],a);s[`background-position-${r.slice(-1)}`]=`calc(${e[r]} + ${h}px)`}}}const K={},C={};function Gt(t){const e=i.css(t,"backgroundImage").replace(/^none|url\(["']?(.+?)["']?\)$/,"$1");if(C[e])return C[e];const n=new Image;return e&&(n.src=e,!n.naturalWidth&&!K[e])?(i.once(n,"error load",()=>{C[e]=D(n),i.trigger(t,i.createEvent("load",!1))}),K[e]=!0,D(n)):C[e]=D(n)}function D(t){return{width:t.naturalWidth,height:t.naturalHeight}}function v(t,e=i.toFloat){const n=[],{length:s}=t;let a=0;for(let r=0;r<s;r++){let[h,o]=i.isString(t[r])?t[r].trim().split(/ (?![^(]*\))/):[t[r]];if(h=e(h),o=o?i.toFloat(o)/100:null,r===0?o===null?o=0:o&&n.push([h,0]):r===s-1&&(o===null?o=1:o!==1&&(n.push([h,o]),o=1)),n.push([h,o]),o===null)a++;else if(a){const c=n[r-a-1][1],f=(o-c)/(a+1);for(let d=a;d>0;d--)n[r-d][1]=c+f*(a-d+1);a=0}}return n}function Y(t,e){const n=i.findIndex(t.slice(1),([,s])=>e<=s)+1;return[t[n-1][0],t[n][0],(e-t[n-1][1])/(t[n][1]-t[n-1][1])]}function I(t,e){const[n,s,a]=Y(t,e);return n+Math.abs(n-s)*a*(n<s?1:-1)}const Xt=/^-?\d+(?:\.\d+)?(\S+)?/;function z(t,e){var n;for(const s of t){const a=(n=s.match)==null?void 0:n.call(s,Xt);if(a)return a[1]}return e}function $(t,e,n){const s=t.style[e],a=i.css(i.css(t,e,n),e);return t.style[e]=s,a}function Z(t,e){return t.reduce((n,s)=>(n[s]=e,n),{})}function Qt(t,e){return e>=0?Math.pow(t,e+1):1-Math.pow(1-t,1-e)}var Jt={props:{parallax:Boolean,parallaxTarget:Boolean,parallaxStart:String,parallaxEnd:String,parallaxEasing:Number},data:{parallax:!1,parallaxTarget:!1,parallaxStart:0,parallaxEnd:0,parallaxEasing:0},observe:[W({target:({$el:t,parallaxTarget:e})=>[t,e],filter:({parallax:t})=>t}),ut({filter:({parallax:t})=>t})],computed:{parallaxTarget({parallaxTarget:t},e){return t&&i.query(t,e)||this.list}},update:{read(){if(!this.parallax)return!1;const t=this.parallaxTarget;if(!t)return!1;const e=i.toPx(this.parallaxStart,"height",t,!0),n=i.toPx(this.parallaxEnd,"height",t,!0),s=Qt(i.scrolledOver(t,e,n),this.parallaxEasing);return{parallax:this.getIndexAt(s)}},write({parallax:t}){const[e,n]=t,s=this.getValidIndex(e+Math.ceil(n)),a=this.slides[e],r=this.slides[s],{triggerShow:h,triggerShown:o,triggerHide:c,triggerHidden:f}=Kt(this);if(~this.prevIndex)for(const l of new Set([this.index,this.prevIndex]))i.includes([s,e],l)||(c(this.slides[l]),f(this.slides[l]));const d=this.prevIndex!==e||this.index!==s;this.dir=1,this.prevIndex=e,this.index=s,a!==r&&c(a),h(r),d&&o(a),this._translate(a===r?1:n,a,r)},events:["scroll","resize"]},methods:{getIndexAt(t){const e=t*(this.length-1);return[Math.floor(e),e%1]}}};function Kt(t){const{clsSlideActive:e,clsEnter:n,clsLeave:s}=t;return{triggerShow:a,triggerShown:r,triggerHide:h,triggerHidden:o};function a(c){i.hasClass(c,s)&&(h(c),o(c)),i.hasClass(c,e)||(i.trigger(c,"beforeitemshow",[t]),i.trigger(c,"itemshow",[t]))}function r(c){i.hasClass(c,n)&&i.trigger(c,"itemshown",[t])}function h(c){i.hasClass(c,e)||a(c),i.hasClass(c,n)&&r(c),i.hasClass(c,s)||(i.trigger(c,"beforeitemhide",[t]),i.trigger(c,"itemhide",[t]))}function o(c){i.hasClass(c,s)&&i.trigger(c,"itemhidden",[t])}}var Yt={update:{write(){if(this.stack.length||this.dragging||this.parallax)return;const t=this.getValidIndex();!~this.prevIndex||this.index!==t?this.show(t):this._translate(1,this.prevIndex,this.index)},events:["resize"]}},tt={slide:{show(t){return[{transform:u(t*-100)},{transform:u()}]},percent(t){return y(t)},translate(t,e){return[{transform:u(e*-100*t)},{transform:u(e*100*(1-t))}]}}};function y(t){return Math.abs(i.css(t,"transform").split(",")[4]/t.offsetWidth)}function u(t=0,e="%"){return t+=t?e:"",`translate3d(${t}, 0, 0)`}function et(t){return`scale3d(${t}, ${t}, 1)`}function Zt(t,e,n,{animation:s,easing:a}){const{percent:r,translate:h,show:o=i.noop}=s,c=o(n);let f;return{dir:n,show(d,l=0,g){const p=g?"linear":a;return d-=Math.round(d*i.clamp(l,-1,1)),this.translate(l),N(e,"itemin",{percent:l,duration:d,timing:p,dir:n}),N(t,"itemout",{percent:1-l,duration:d,timing:p,dir:n}),new Promise(E=>{f||(f=E),Promise.all([i.Transition.start(e,c[1],d,p),i.Transition.start(t,c[0],d,p)]).then(()=>{this.reset(),f()},i.noop)})},cancel(){return i.Transition.cancel([e,t])},reset(){for(const d in c[0])i.css([e,t],d,"")},async forward(d,l=this.percent()){return await this.cancel(),this.show(d,l,!0)},translate(d){if(d===this.percent())return;this.reset();const l=h(d,n);i.css(e,l[1]),i.css(t,l[0]),N(e,"itemtranslatein",{percent:d,dir:n}),N(t,"itemtranslateout",{percent:1-d,dir:n})},percent(){return r(t||e,e,n)},getDistance(){return t==null?void 0:t.offsetWidth}}}function N(t,e,n){i.trigger(t,i.createEvent(e,!1,!1,n))}var te={props:{i18n:Object},data:{i18n:null},methods:{t(t,...e){var n,s,a;let r=0;return((a=((n=this.i18n)==null?void 0:n[t])||((s=this.$options.i18n)==null?void 0:s[t]))==null?void 0:a.replace(/%s/g,()=>e[r++]||""))||""}}},ee={props:{autoplay:Boolean,autoplayInterval:Number,pauseOnHover:Boolean},data:{autoplay:!1,autoplayInterval:7e3,pauseOnHover:!0},connected(){i.attr(this.list,"aria-live",this.autoplay?"off":"polite"),this.autoplay&&this.startAutoplay()},disconnected(){this.stopAutoplay()},update(){i.attr(this.slides,"tabindex","-1")},events:[{name:"visibilitychange",el:()=>document,filter:({autoplay:t})=>t,handler(){document.hidden?this.stopAutoplay():this.startAutoplay()}}],methods:{startAutoplay(){this.stopAutoplay(),this.interval=setInterval(()=>{this.stack.length||this.draggable&&i.matches(this.$el,":focus-within")&&!i.matches(this.$el,":focus")||this.pauseOnHover&&i.matches(this.$el,":hover")||this.show("next")},this.autoplayInterval)},stopAutoplay(){clearInterval(this.interval)}}};const S={passive:!1,capture:!0},nt={passive:!0,capture:!0},ne="touchstart mousedown",j="touchmove mousemove",it="touchend touchcancel mouseup click input scroll",st=t=>t.preventDefault();var ie={props:{draggable:Boolean},data:{draggable:!0,threshold:10},created(){for(const t of["start","move","end"]){const e=this[t];this[t]=n=>{const s=i.getEventPos(n).x*(i.isRtl?-1:1);this.prevPos=s===this.pos?this.prevPos:this.pos,this.pos=s,e(n)}}},events:[{name:ne,passive:!0,delegate:({selList:t})=>`${t} > *`,handler(t){!this.draggable||this.parallax||!i.isTouch(t)&&se(t.target)||t.target.closest(i.selInput)||t.button>0||this.length<2||this.start(t)}},{name:"dragstart",handler(t){t.preventDefault()}},{name:j,el:({list:t})=>t,handler:i.noop,...S}],methods:{start(){this.drag=this.pos,this._transitioner?(this.percent=this._transitioner.percent(),this.drag+=this._transitioner.getDistance()*this.percent*this.dir,this._transitioner.cancel(),this._transitioner.translate(this.percent),this.dragging=!0,this.stack=[]):this.prevIndex=this.index,i.on(document,j,this.move,S),i.on(document,it,this.end,nt),i.css(this.list,"userSelect","none")},move(t){const e=this.pos-this.drag;if(e===0||this.prevPos===this.pos||!this.dragging&&Math.abs(e)<this.threshold)return;this.dragging||i.on(this.list,"click",st,S),t.cancelable&&t.preventDefault(),this.dragging=!0,this.dir=e<0?1:-1;let{slides:n,prevIndex:s}=this,a=Math.abs(e),r=this.getIndex(s+this.dir),h=rt.call(this,s,r);for(;r!==s&&a>h;)this.drag-=h*this.dir,s=r,a-=h,r=this.getIndex(s+this.dir),h=rt.call(this,s,r);this.percent=a/h;const o=n[s],c=n[r],f=this.index!==r,d=s===r;let l;for(const g of[this.index,this.prevIndex])i.includes([r,s],g)||(i.trigger(n[g],"itemhidden",[this]),d&&(l=!0,this.prevIndex=s));(this.index===s&&this.prevIndex!==s||l)&&i.trigger(n[this.index],"itemshown",[this]),f&&(this.prevIndex=s,this.index=r,d||(i.trigger(o,"beforeitemhide",[this]),i.trigger(o,"itemhide",[this])),i.trigger(c,"beforeitemshow",[this]),i.trigger(c,"itemshow",[this])),this._transitioner=this._translate(Math.abs(this.percent),o,!d&&c)},end(){if(i.off(document,j,this.move,S),i.off(document,it,this.end,nt),this.dragging)if(this.dragging=null,this.index===this.prevIndex)this.percent=1-this.percent,this.dir*=-1,this._show(!1,this.index,!0),this._transitioner=null;else{const t=(i.isRtl?this.dir*(i.isRtl?1:-1):this.dir)<0==this.prevPos>this.pos;this.index=t?this.index:this.prevIndex,t&&(this.percent=1-this.percent),this.show(this.dir>0&&!t||this.dir<0&&t?"next":"previous",!0)}setTimeout(()=>i.off(this.list,"click",st,S)),i.css(this.list,{userSelect:""}),this.drag=this.percent=null}}};function rt(t,e){return this._getTransitioner(t,t!==e&&e).getDistance()||this.slides[t].offsetWidth}function se(t){return i.css(t,"userSelect")!=="none"&&i.toArray(t.childNodes).some(e=>e.nodeType===3&&e.textContent.trim())}i.memoize((t,e)=>{const n=Object.keys(e),s=n.concat(t).map(a=>[i.hyphenate(a),`data-${i.hyphenate(a)}`]).flat();return{attributes:n,filter:s}});let re=1;function at(t,e=null){return(e==null?void 0:e.id)||`${t.$options.id}-${re++}`}const k={TAB:9,ESC:27,SPACE:32,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40};var ae={i18n:{next:"Next slide",previous:"Previous slide",slideX:"Slide %s",slideLabel:"%s of %s",role:"String"},data:{selNav:!1,role:"region"},computed:{nav:({selNav:t},e)=>i.$(t,e),navChildren(){return i.children(this.nav)},selNavItem:({attrItem:t})=>`[${t}],[data-${t}]`,navItems(t,e){return i.$$(this.selNavItem,e)}},watch:{nav(t,e){i.attr(t,"role","tablist"),e&&this.$emit()},list(t){i.isTag(t,"ul")&&i.attr(t,"role","presentation")},navChildren(t){i.attr(t,"role","presentation")},navItems(t){for(const e of t){const n=i.data(e,this.attrItem),s=i.$("a,button",e)||e;let a,r=null;if(i.isNumeric(n)){const h=i.toNumber(n),o=this.slides[h];o&&(o.id||(o.id=at(this,o)),r=o.id),a=this.t("slideX",i.toFloat(n)+1),i.attr(s,"role","tab")}else this.list&&(this.list.id||(this.list.id=at(this,this.list)),r=this.list.id),a=this.t(n);i.attr(s,{"aria-controls":r,"aria-label":i.attr(s,"aria-label")||a})}},slides(t){t.forEach((e,n)=>i.attr(e,{role:this.nav?"tabpanel":"group","aria-label":this.t("slideLabel",n+1,this.length),"aria-roledescription":this.nav?null:"slide"}))},length(t){const e=this.navChildren.length;if(this.nav&&t!==e){i.empty(this.nav);for(let n=0;n<t;n++)i.append(this.nav,`<li ${this.attrItem}="${n}"><a href></a></li>`)}}},connected(){i.attr(this.$el,{role:this.role,"aria-roledescription":"carousel"})},update:[{write(){this.navItems.concat(this.nav).forEach(t=>t&&(t.hidden=!this.maxIndex)),this.updateNav()},events:["resize"]}],events:[{name:"click keydown",delegate:({selNavItem:t})=>t,filter:({parallax:t})=>!t,handler(t){t.target.closest("a,button")&&(t.type==="click"||t.keyCode===k.SPACE)&&(t.preventDefault(),this.show(i.data(t.current,this.attrItem)))}},{name:"itemshow",handler:"updateNav"},{name:"keydown",delegate:({selNavItem:t})=>t,filter:({parallax:t})=>!t,handler(t){const{current:e,keyCode:n}=t,s=i.data(e,this.attrItem);if(!i.isNumeric(s))return;let a=n===k.HOME?0:n===k.END?"last":n===k.LEFT?"previous":n===k.RIGHT?"next":-1;~a&&(t.preventDefault(),this.show(a))}}],methods:{updateNav(){const t=this.getValidIndex();for(const e of this.navItems){const n=i.data(e,this.attrItem),s=i.$("a,button",e)||e;if(i.isNumeric(n)){const r=i.toNumber(n)===t;i.toggleClass(e,this.clsActive,r),i.toggleClass(s,"uk-disabled",this.parallax),i.attr(s,{"aria-selected":r,tabindex:r&&!this.parallax?null:-1}),r&&s&&i.matches(i.parent(e),":focus-within")&&s.focus()}else i.toggleClass(e,"uk-invisible",this.finite&&(n==="previous"&&t===0||n==="next"&&t>=this.maxIndex))}}}},oe={mixins:[ee,ie,ae,te],props:{clsActivated:String,easing:String,index:Number,finite:Boolean,velocity:Number},data:()=>({easing:"ease",finite:!1,velocity:1,index:0,prevIndex:-1,stack:[],percent:0,clsActive:"uk-active",clsActivated:"",clsEnter:"uk-slide-enter",clsLeave:"uk-slide-leave",clsSlideActive:"uk-slide-active",Transitioner:!1,transitionOptions:{}}),connected(){this.prevIndex=-1,this.index=this.getValidIndex(this.$props.index),this.stack=[]},disconnected(){i.removeClass(this.slides,this.clsActive)},computed:{duration:({velocity:t},e)=>de(e.offsetWidth/t),list:({selList:t},e)=>i.$(t,e),maxIndex(){return this.length-1},slides(){return i.children(this.list)},length(){return this.slides.length}},watch:{slides(t,e){e&&this.$emit()}},events:{itemshow({target:t}){i.addClass(t,this.clsEnter,this.clsSlideActive)},itemshown({target:t}){i.removeClass(t,this.clsEnter)},itemhide({target:t}){i.addClass(t,this.clsLeave)},itemhidden({target:t}){i.removeClass(t,this.clsLeave,this.clsSlideActive)}},methods:{show(t,e=!1){var n;if(this.dragging||!this.length||this.parallax)return;const{stack:s}=this,a=e?0:s.length,r=()=>{s.splice(a,1),s.length&&this.show(s.shift(),!0)};if(s[e?"unshift":"push"](t),!e&&s.length>1){s.length===2&&((n=this._transitioner)==null||n.forward(Math.min(this.duration,200)));return}const h=this.getIndex(this.index),o=i.hasClass(this.slides,this.clsActive)&&this.slides[h],c=this.getIndex(t,this.index),f=this.slides[c];if(o===f){r();return}if(this.dir=he(t,h),this.prevIndex=h,this.index=c,o&&!i.trigger(o,"beforeitemhide",[this])||!i.trigger(f,"beforeitemshow",[this,o])){this.index=this.prevIndex,r();return}const d=this._show(o,f,e).then(()=>{o&&i.trigger(o,"itemhidden",[this]),i.trigger(f,"itemshown",[this]),s.shift(),this._transitioner=null,s.length&&requestAnimationFrame(()=>s.length&&this.show(s.shift(),!0))});return o&&i.trigger(o,"itemhide",[this]),i.trigger(f,"itemshow",[this]),d},getIndex(t=this.index,e=this.index){return i.clamp(i.getIndex(t,this.slides,e,this.finite),0,Math.max(0,this.maxIndex))},getValidIndex(t=this.index,e=this.prevIndex){return this.getIndex(t,e)},async _show(t,e,n){if(this._transitioner=this._getTransitioner(t,e,this.dir,{easing:n?e.offsetWidth<600?"cubic-bezier(0.25, 0.46, 0.45, 0.94)":"cubic-bezier(0.165, 0.84, 0.44, 1)":this.easing,...this.transitionOptions}),!n&&!t){this._translate(1);return}const{length:s}=this.stack;return this._transitioner[s>1?"forward":"show"](s>1?Math.min(this.duration,75+75/(s-1)):this.duration,this.percent)},_translate(t,e=this.prevIndex,n=this.index){const s=this._getTransitioner(e===n?!1:e,n);return s.translate(t),s},_getTransitioner(t=this.prevIndex,e=this.index,n=this.dir||1,s=this.transitionOptions){return new this.Transitioner(i.isNumber(t)?this.slides[t]:t,i.isNumber(e)?this.slides[e]:e,n*(i.isRtl?-1:1),s)}}};function he(t,e){return t==="next"?1:t==="previous"||t<e?-1:1}function de(t){return .5*t+300}var ce={mixins:[oe],props:{animation:String},data:{animation:"slide",clsActivated:"uk-transition-active",Animations:tt,Transitioner:Zt},computed:{animation({animation:t,Animations:e}){return{...e[t]||e.slide,name:t}},transitionOptions(){return{animation:this.animation}}},observe:W(),events:{beforeitemshow({target:t}){i.addClass(t,this.clsActive)},itemshown({target:t}){i.addClass(t,this.clsActivated)},itemhidden({target:t}){i.removeClass(t,this.clsActive,this.clsActivated)}}},le={observe:ft({target:({slides:t})=>t,targets:t=>t.getAdjacentSlides()}),methods:{getAdjacentSlides(){return[1,-1].map(t=>this.slides[this.getIndex(this.index+t)])}}},fe={...tt,fade:{show(){return[{opacity:0,zIndex:0},{zIndex:-1}]},percent(t){return 1-i.css(t,"opacity")},translate(t){return[{opacity:1-t,zIndex:0},{zIndex:-1}]}},scale:{show(){return[{opacity:0,transform:et(1+.5),zIndex:0},{zIndex:-1}]},percent(t){return 1-i.css(t,"opacity")},translate(t){return[{opacity:1-t,transform:et(1+.5*t),zIndex:0},{zIndex:-1}]}},pull:{show(t){return t<0?[{transform:u(30),zIndex:-1},{transform:u(),zIndex:0}]:[{transform:u(-100),zIndex:0},{transform:u(),zIndex:-1}]},percent(t,e,n){return n<0?1-y(e):y(t)},translate(t,e){return e<0?[{transform:u(30*t),zIndex:-1},{transform:u(-100*(1-t)),zIndex:0}]:[{transform:u(-t*100),zIndex:0},{transform:u(30*(1-t)),zIndex:-1}]}},push:{show(t){return t<0?[{transform:u(100),zIndex:0},{transform:u(),zIndex:-1}]:[{transform:u(-30),zIndex:-1},{transform:u(),zIndex:0}]},percent(t,e,n){return n>0?1-y(e):y(t)},translate(t,e){return e<0?[{transform:u(t*100),zIndex:0},{transform:u(-30*(1-t)),zIndex:-1}]:[{transform:u(-30*t),zIndex:-1},{transform:u(100*(1-t)),zIndex:0}]}}},ot={mixins:[w,ce,Yt,Jt,le],props:{ratio:String,minHeight:String,maxHeight:String},data:{ratio:"16:9",minHeight:void 0,maxHeight:void 0,selList:".uk-slideshow-items",attrItem:"uk-slideshow-item",selNav:".uk-slideshow-nav",Animations:fe},watch:{list(t){i.css(t,{aspectRatio:this.ratio?this.ratio.replace(":","/"):void 0,minHeight:this.minHeight,maxHeight:this.maxHeight,minWidth:"100%",maxWidth:"100%"})}},methods:{getAdjacentSlides(){return[1,-1].map(t=>this.slides[this.getIndex(this.index+t)])}}};return typeof window<"u"&&window.UIkit&&window.UIkit.component("slideshow",ot),ot});