| Current Path : /home/eolienneia/www/templates/yootheme/vendor/assets/uikit/dist/js/components/ |
| Current File : /home/eolienneia/www/templates/yootheme/vendor/assets/uikit/dist/js/components/slider.min.js |
/*! UIkit 3.11.2-dev.4c11be04b | https://www.getuikit.com | (c) 2014 - 2022 YOOtheme | MIT License */(function(t,p){typeof exports=="object"&&typeof module<"u"?module.exports=p(require("uikit-util")):typeof define=="function"&&define.amd?define("uikitslider",["uikit-util"],p):(t=typeof globalThis<"u"?globalThis:t||self,t.UIkitSlider=p(t.UIkit.util))})(this,function(t){"use strict";var p={connected:function(){!t.hasClass(this.$el,this.$name)&&t.addClass(this.$el,this.$name)}},T={props:{autoplay:Boolean,autoplayInterval:Number,pauseOnHover:Boolean},data:{autoplay:!1,autoplayInterval:7e3,pauseOnHover:!0},connected:function(){this.autoplay&&this.startAutoplay()},disconnected:function(){this.stopAutoplay()},update:function(){t.attr(this.slides,"tabindex","-1")},events:[{name:"visibilitychange",el:function(){return document},filter:function(){return this.autoplay},handler:function(){document.hidden?this.stopAutoplay():this.startAutoplay()}}],methods:{startAutoplay:function(){var e=this;this.stopAutoplay(),this.interval=setInterval(function(){return(!e.draggable||!t.$(":focus",e.$el))&&(!e.pauseOnHover||!t.matches(e.$el,":hover"))&&!e.stack.length&&e.show("next")},this.autoplayInterval)},stopAutoplay:function(){this.interval&&clearInterval(this.interval)}}},R={props:{draggable:Boolean},data:{draggable:!0,threshold:10},created:function(){var e=this;["start","move","end"].forEach(function(s){var n=e[s];e[s]=function(i){var h=t.getEventPos(i).x*(t.isRtl?-1:1);e.prevPos=h!==e.pos?e.pos:e.prevPos,e.pos=h,n(i)}})},events:[{name:t.pointerDown,delegate:function(){return this.selSlides},handler:function(e){!this.draggable||!t.isTouch(e)&&C(e.target)||t.closest(e.target,t.selInput)||e.button>0||this.length<2||this.start(e)}},{name:"dragstart",handler:function(e){e.preventDefault()}}],methods:{start:function(){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,t.on(document,t.pointerMove,this.move,{passive:!1}),t.on(document,t.pointerUp+" "+t.pointerCancel+" input",this.end,!0),t.css(this.list,"userSelect","none")},move:function(e){var s=this,n=this.pos-this.drag;if(!(n===0||this.prevPos===this.pos||!this.dragging&&Math.abs(n)<this.threshold)){t.css(this.list,"pointerEvents","none"),e.cancelable&&e.preventDefault(),this.dragging=!0,this.dir=n<0?1:-1;for(var i=this,h=i.slides,g=this,r=g.prevIndex,f=Math.abs(n),o=this.getIndex(r+this.dir,r),c=this._getDistance(r,o)||h[r].offsetWidth;o!==r&&f>c;)this.drag-=c*this.dir,r=o,f-=c,o=this.getIndex(r+this.dir,r),c=this._getDistance(r,o)||h[r].offsetWidth;this.percent=f/c;var a=h[r],d=h[o],v=this.index!==o,l=r===o,m;[this.index,this.prevIndex].filter(function(u){return!t.includes([o,r],u)}).forEach(function(u){t.trigger(h[u],"itemhidden",[s]),l&&(m=!0,s.prevIndex=r)}),(this.index===r&&this.prevIndex!==r||m)&&t.trigger(h[this.index],"itemshown",[this]),v&&(this.prevIndex=r,this.index=o,!l&&t.trigger(a,"beforeitemhide",[this]),t.trigger(d,"beforeitemshow",[this])),this._transitioner=this._translate(Math.abs(this.percent),a,!l&&d),v&&(!l&&t.trigger(a,"itemhide",[this]),t.trigger(d,"itemshow",[this]))}},end:function(){if(t.off(document,t.pointerMove,this.move,{passive:!1}),t.off(document,t.pointerUp+" "+t.pointerCancel+" input",this.end,!0),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{var e=(t.isRtl?this.dir*(t.isRtl?1:-1):this.dir)<0==this.prevPos>this.pos;this.index=e?this.index:this.prevIndex,e&&(this.percent=1-this.percent),this.show(this.dir>0&&!e||this.dir<0&&e?"next":"previous",!0)}t.css(this.list,{userSelect:"",pointerEvents:""}),this.drag=this.percent=null}}};function C(e){return!e.children.length&&e.childNodes.length}var D={data:{selNav:!1},computed:{nav:function(e,s){var n=e.selNav;return t.$(n,s)},selNavItem:function(e){var s=e.attrItem;return"["+s+"],[data-"+s+"]"},navItems:function(e,s){return t.$$(this.selNavItem,s)}},update:{write:function(){var e=this;this.nav&&this.length!==this.nav.children.length&&t.html(this.nav,this.slides.map(function(s,n){return"<li "+e.attrItem+'="'+n+'"><a href></a></li>'}).join("")),this.navItems.concat(this.nav).forEach(function(s){return s&&(s.hidden=!e.maxIndex)}),this.updateNav()},events:["resize"]},events:[{name:"click",delegate:function(){return this.selNavItem},handler:function(e){e.preventDefault(),this.show(t.data(e.current,this.attrItem))}},{name:"itemshow",handler:"updateNav"}],methods:{updateNav:function(){var e=this,s=this.getValidIndex();this.navItems.forEach(function(n){var i=t.data(n,e.attrItem);t.toggleClass(n,e.clsActive,t.toNumber(i)===s),t.toggleClass(n,"uk-invisible",e.finite&&(i==="previous"&&s===0||i==="next"&&s>=e.maxIndex))})}}},W={mixins:[T,R,D],props:{clsActivated:Boolean,easing:String,index:Number,finite:Boolean,velocity:Number,selSlides:String},data:function(){return{easing:"ease",finite:!1,velocity:1,index:0,prevIndex:-1,stack:[],percent:0,clsActive:"uk-active",clsActivated:!1,Transitioner:!1,transitionOptions:{}}},connected:function(){this.prevIndex=-1,this.index=this.getValidIndex(this.$props.index),this.stack=[]},disconnected:function(){t.removeClass(this.slides,this.clsActive)},computed:{duration:function(e,s){var n=e.velocity;return b(s.offsetWidth/n)},list:function(e,s){var n=e.selList;return t.$(n,s)},maxIndex:function(){return this.length-1},selSlides:function(e){var s=e.selList,n=e.selSlides;return s+" "+(n||"> *")},slides:{get:function(){return t.$$(this.selSlides,this.$el)},watch:function(){this.$reset()}},length:function(){return this.slides.length}},events:{itemshown:function(){this.$update(this.list)}},methods:{show:function(e,s){var n=this;if(s===void 0&&(s=!1),!(this.dragging||!this.length)){var i=this,h=i.stack,g=s?0:h.length,r=function(){h.splice(g,1),h.length&&n.show(h.shift(),!0)};if(h[s?"unshift":"push"](e),!s&&h.length>1){h.length===2&&this._transitioner.forward(Math.min(this.duration,200));return}var f=this.getIndex(this.index),o=t.hasClass(this.slides,this.clsActive)&&this.slides[f],c=this.getIndex(e,this.index),a=this.slides[c];if(o===a){r();return}if(this.dir=O(e,f),this.prevIndex=f,this.index=c,o&&!t.trigger(o,"beforeitemhide",[this])||!t.trigger(a,"beforeitemshow",[this,o])){this.index=this.prevIndex,r();return}var d=this._show(o,a,s).then(function(){return o&&t.trigger(o,"itemhidden",[n]),t.trigger(a,"itemshown",[n]),new t.Promise(function(v){t.fastdom.write(function(){h.shift(),h.length?n.show(h.shift(),!0):n._transitioner=null,v()})})});return o&&t.trigger(o,"itemhide",[this]),t.trigger(a,"itemshow",[this]),d}},getIndex:function(e,s){return e===void 0&&(e=this.index),s===void 0&&(s=this.index),t.clamp(t.getIndex(e,this.slides,s,this.finite),0,this.maxIndex)},getValidIndex:function(e,s){return e===void 0&&(e=this.index),s===void 0&&(s=this.prevIndex),this.getIndex(e,s)},_show:function(e,s,n){if(this._transitioner=this._getTransitioner(e,s,this.dir,t.assign({easing:n?s.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&&!e)return this._translate(1),t.Promise.resolve();var i=this.stack,h=i.length;return this._transitioner[h>1?"forward":"show"](h>1?Math.min(this.duration,75+75/(h-1)):this.duration,this.percent)},_getDistance:function(e,s){return this._getTransitioner(e,e!==s&&s).getDistance()},_translate:function(e,s,n){s===void 0&&(s=this.prevIndex),n===void 0&&(n=this.index);var i=this._getTransitioner(s!==n?s:!1,n);return i.translate(e),i},_getTransitioner:function(e,s,n,i){return e===void 0&&(e=this.prevIndex),s===void 0&&(s=this.index),n===void 0&&(n=this.dir||1),i===void 0&&(i=this.transitionOptions),new this.Transitioner(t.isNumber(e)?this.slides[e]:e,t.isNumber(s)?this.slides[s]:s,n*(t.isRtl?-1:1),i)}}};function O(e,s){return e==="next"?1:e==="previous"||e<s?-1:1}function b(e){return .5*e+300}var B={update:{write:function(){if(!(this.stack.length||this.dragging)){var e=this.getValidIndex(this.index);(!~this.prevIndex||this.index!==e)&&this.show(e)}},events:["resize"]}};function _(e,s){return e===void 0&&(e=0),s===void 0&&(s="%"),e+=e?s:"",t.isIE?"translateX("+e+")":"translate3d("+e+", 0, 0)"}function L(e,s,n,i){var h=i.center,g=i.easing,r=i.list,f=new t.Deferred,o=e?x(e,r,h):x(s,r,h)+t.dimensions(s).width*n,c=s?x(s,r,h):o+t.dimensions(e).width*n*(t.isRtl?-1:1);return{dir:n,show:function(a,d,v){d===void 0&&(d=0);var l=v?"linear":g;return a-=Math.round(a*t.clamp(d,-1,1)),this.translate(d),d=e?d:t.clamp(d,0,1),$(this.getItemIn(),"itemin",{percent:d,duration:a,timing:l,dir:n}),e&&$(this.getItemIn(!0),"itemout",{percent:1-d,duration:a,timing:l,dir:n}),t.Transition.start(r,{transform:_(-c*(t.isRtl?-1:1),"px")},a,l).then(f.resolve,t.noop),f.promise},cancel:function(){t.Transition.cancel(r)},reset:function(){t.css(r,"transform","")},forward:function(a,d){return d===void 0&&(d=this.percent()),t.Transition.cancel(r),this.show(a,d,!0)},translate:function(a){var d=this.getDistance()*n*(t.isRtl?-1:1);t.css(r,"transform",_(t.clamp(-c+(d-d*a),-I(r),t.dimensions(r).width)*(t.isRtl?-1:1),"px"));var v=this.getActives(),l=this.getItemIn(),m=this.getItemIn(!0);a=e?t.clamp(a,-1,1):0,t.children(r).forEach(function(u){var N=t.includes(v,u),E=u===l,S=u===m,z=E||!S&&(N||n*(t.isRtl?-1:1)===-1^w(u,r)>w(e||s));$(u,"itemtranslate"+(z?"in":"out"),{dir:n,percent:S?1-a:E?a:N?1:0})})},percent:function(){return Math.abs((t.css(r,"transform").split(",")[4]*(t.isRtl?-1:1)+o)/(c-o))},getDistance:function(){return Math.abs(c-o)},getItemIn:function(a){a===void 0&&(a=!1);var d=this.getActives(),v=A(r,x(s||e,r,h));if(a){var l=d;d=v,v=l}return v[t.findIndex(v,function(m){return!t.includes(d,m)})]},getActives:function(){return A(r,x(e||s,r,h))}}}function x(e,s,n){var i=w(e,s);return n?i-P(e,s):Math.min(i,y(s))}function y(e){return Math.max(0,I(e)-t.dimensions(e).width)}function I(e){return t.children(e).reduce(function(s,n){return t.dimensions(n).width+s},0)}function P(e,s){return t.dimensions(s).width/2-t.dimensions(e).width/2}function w(e,s){return e&&(t.position(e).left+(t.isRtl?t.dimensions(e).width-t.dimensions(s).width:0))*(t.isRtl?-1:1)||0}function A(e,s){s-=1;var n=t.dimensions(e).width,i=s+n+2;return t.children(e).filter(function(h){var g=w(h,e),r=g+Math.min(t.dimensions(h).width,n);return g>=s&&r<=i})}function $(e,s,n){t.trigger(e,t.createEvent(s,!1,!1,n))}var M={mixins:[p,W,B],props:{center:Boolean,sets:Boolean},data:{center:!1,sets:!1,attrItem:"uk-slider-item",selList:".uk-slider-items",selNav:".uk-slider-nav",clsContainer:"uk-slider-container",Transitioner:L},computed:{avgWidth:function(){return I(this.list)/this.length},finite:function(e){var s=e.finite;return s||Math.ceil(I(this.list))<Math.floor(t.dimensions(this.list).width+V(this.list)+this.center)},maxIndex:function(){if(!this.finite||this.center&&!this.sets)return this.length-1;if(this.center)return t.last(this.sets);var e=0,s=y(this.list),n=t.findIndex(this.slides,function(i){if(e>=s)return!0;e+=t.dimensions(i).width});return~n?n:this.length-1},sets:function(e){var s=this,n=e.sets;if(!!n){var i=t.dimensions(this.list).width/(this.center?2:1),h=0,g=i,r=0;return n=t.sortBy(this.slides,"offsetLeft").reduce(function(f,o,c){var a=t.dimensions(o).width,d=r+a;if(d>h&&(!s.center&&c>s.maxIndex&&(c=s.maxIndex),!t.includes(f,c))){var v=s.slides[c+1];s.center&&v&&a<g-t.dimensions(v).width/2?g-=a:(g=i,f.push(c),h=r+i+(s.center?a/2:0))}return r+=a,f},[]),!t.isEmpty(n)&&n}},transitionOptions:function(){return{center:this.center,list:this.list}}},connected:function(){t.toggleClass(this.$el,this.clsContainer,!t.$("."+this.clsContainer,this.$el))},update:{write:function(){var e=this;this.navItems.forEach(function(n){var i=t.toNumber(t.data(n,e.attrItem));i!==!1&&(n.hidden=!e.maxIndex||i>e.maxIndex||e.sets&&!t.includes(e.sets,i))}),this.length&&!this.dragging&&!this.stack.length&&(this.reorder(),this._translate(1));var s=this._getTransitioner(this.index).getActives();this.slides.forEach(function(n){return t.toggleClass(n,e.clsActive,t.includes(s,n))}),this.clsActivated&&(!this.sets||t.includes(this.sets,t.toFloat(this.index)))&&this.slides.forEach(function(n){return t.toggleClass(n,e.clsActivated||"",t.includes(s,n))})},events:["resize"]},events:{beforeitemshow:function(e){!this.dragging&&this.sets&&this.stack.length<2&&!t.includes(this.sets,this.index)&&(this.index=this.getValidIndex());var s=Math.abs(this.index-this.prevIndex+(this.dir>0&&this.index<this.prevIndex||this.dir<0&&this.index>this.prevIndex?(this.maxIndex+1)*this.dir:0));if(!this.dragging&&s>1){for(var n=0;n<s;n++)this.stack.splice(1,0,this.dir>0?"next":"previous");e.preventDefault();return}var i=this.dir<0||!this.slides[this.prevIndex]?this.index:this.prevIndex;this.duration=b(this.avgWidth/this.velocity)*(t.dimensions(this.slides[i]).width/this.avgWidth),this.reorder()},itemshow:function(){~this.prevIndex&&t.addClass(this._getTransitioner().getItemIn(),this.clsActive)}},methods:{reorder:function(){var e=this;if(this.finite){t.css(this.slides,"order","");return}var s=this.dir>0&&this.slides[this.prevIndex]?this.prevIndex:this.index;if(this.slides.forEach(function(f,o){return t.css(f,"order",e.dir>0&&o<s?1:e.dir<0&&o>=e.index?-1:"")}),!!this.center)for(var n=this.slides[s],i=t.dimensions(this.list).width/2-t.dimensions(n).width/2,h=0;i>0;){var g=this.getIndex(--h+s,s),r=this.slides[g];t.css(r,"order",g>s?-2:-1),i-=t.dimensions(r).width}},getValidIndex:function(e,s){if(e===void 0&&(e=this.index),s===void 0&&(s=this.prevIndex),e=this.getIndex(e,s),!this.sets)return e;var n;do{if(t.includes(this.sets,e))return e;n=e,e=this.getIndex(e+this.dir,s)}while(e!==n);return e}}};function V(e){return Math.max.apply(Math,[0].concat(t.children(e).map(function(s){return t.dimensions(s).width})))}return typeof window<"u"&&window.UIkit&&window.UIkit.component("slider",M),M});