splide-1.0.x-dev/js/components/splide.swipedetect.min.js
js/components/splide.swipedetect.min.js
!function(P,W,t,n){"use strict";var Z="swipedetect",_=".swidet",A="pointerdown",B="pointermove",E="pointerup",H="click",O="dblclick",U="wheel",j="down",F="up",G="left",J="right",K="none",L=!1,N=null,Q=300,R=!1,V=[],$=P.windowSize()||{},tt={prevDiff:-1,scale:1,x:0,y:0};function et(t){var e=t.dir===G||t.dir===J?t.x:t.y;return t.distance="start"===t.phase?0:e,t.rect=P.rect(t.el),t}function it(t){return Math.abs(t)}function o(u){var p,d,h,g,t,e,v=this.root,i=this.options,n=i.nickClass||"",n=n?"is-"+n:"is",o=n+"-dragging",r=n+"-moved",a=n+"-wheeled",s=i.activatedClass||"is-activated",n=function(t,e){},m={},c=i.onClick||n,w=i.callback||n,y=i.onZoomIn||n,D=i.onZoomOut||n,x=i.onPinched||n,l=i.onWheel||!1,f=i.max||2,M=i.vertical||!1,C=i.threshold||100,b=K;function k(t){P.equal(t.target,"img")&&!R&&(t.stopPropagation(),L=!1,tt.img=t.target,tt.isDown=!1,tt.trigger=t.type,tt.x=0,tt.y=0,m=et(tt),c(t,m))}function I(t){P.addClass(v,a);var e=P.rect(u),i=(t.clientX-e.x)/tt.scale,n=(t.clientY-e.y)/tt.scale,o=W.wheelDelta(t),r=0<o?tt.scale+.2:tt.scale-.2;tt.scale=Math.min(Math.max(1,r),f);var s=0<o?.1:-.1,e=$.width/2,r=$.height/2;tt.x+=-i*s*2+u.offsetWidth*s,tt.y+=-n*s*2+u.offsetHeight*s;e=M?0:Math.min(Math.max(-e,tt.x),e),r=Math.min(Math.max(-r,tt.y),r);L=!1,tt.el=u,tt.isDown=!1,tt.isMin=tt.isMax=!1,tt.trigger=t.type,tt.event=t,o<0?(tt.dir="up",tt.y===r&&(tt.isMin=!0,D(t,tt))):(tt.dir="down",tt.isMax=!0),tt.x=e,tt.y=r,m=et(tt),l(t,m)}function z(t,e,i,n){t&&e&&(n?i?P.addClass(t,e):setTimeout(function(){P.removeClass(t,e)},e===o?5:10):P[i?"addClass":"removeClass"](t,e))}function S(t,e){z(v,o,t,e)}function T(t,e){z(t,r,e)}function X(t){P.off(u,B,Y),P.off(u,E,q),function(t){for(var e=0;e<V.length;e++)if(V[e].pointerId===t.pointerId){V.splice(e,1);break}}(t),T(u,!1),S(!1,!0),u.style.transition=""}function Y(t){if(!L)return!1;t.preventDefault();for(var e=0;e<V.length;e++)if(t.pointerId===V[e].pointerId){V[e]=t;break}var i=function(t){for(var e=0;e<V.length;e++)if(V[e].pointerId===t)return e;return-1}(t.pointerId),n=V[i]||t,o=n.clientX,r=n.clientY,s=o-p,a=r-d,c=it(s/a),l=it(a/s),f=it(l<c?s:a),i=M?0:h+s,o=g+a,r=!1;if(f<C&&(l<c?(b=s<0?G:J,r=M):b=a<0?F:j),r)return S(!1),!1;tt.x=i,tt.y=o,tt.dir=b,tt.event=n,tt.trigger=t.type,2===V.length&&(n=Math.sqrt(Math.pow(V[1].clientX-V[0].clientX,2)+Math.pow(V[1].clientY-V[0].clientY,2)),tt.curDiff=n,0<tt.prevDiff&&(n>tt.prevDiff&&(tt.zoom="in",P.trigger(v,Z+":zoomin",{touch:tt}),y(t,tt)),n<tt.prevDiff&&(tt.zoom="out",P.trigger(v,Z+":zoomout",{touch:tt}),D(t,tt))),x(t,tt),tt.prevDiff=n),S(!0),tt.phase="move",m=et(tt),w(t,m),u.style.transition="none 0s ease 0s"}function q(t){t=t,L&&(tt.event=t,tt.phase="end",tt.isDown=!1,tt.trigger=t.type,m=et(tt),w(t,m),X(t)),V.length<2&&(tt.prevDiff=-1),N&&clearTimeout(N),R&&setTimeout(function(){R=!1},31),tt.isDown=!1,L=!1}Q=i.downDelay||Q,l&&(t=u,P[!0?"on":"off"](t,U+_,I,{passive:!0})),e=u,P[!0?"on":"off"](e,H+_+" "+O+_,k),P.on(u,A,function(t){P.hasClass(v,s)&&(t=t,P.equal(t.target,"img")&&(tt.img=t.target,t.preventDefault()),L=!0,V.push(t),p=t.clientX,d=t.clientY,h=tt.x,g=tt.y,tt.el=u,tt.dir=b,tt.phase="start",tt.viewport=P.isUnd(P.viewport)?{}:P.viewport.init({}),tt.event=t,tt.isDown=!0,tt.trigger=t.type,P.removeClass(v,a),m=et(tt),S(!1),T(u,!0),w(t,m),P.on(u,B,P.debounce(Y,250)),P.on(u,E,q),N=setTimeout(function(){R=!(N=null)},Q))})}t.SwipeDetect=function(t,e){var i=this;return P.isStr(t)&&(t=P.find(n,t)),i.root=P.isElm(t)?t:n,i.options=e,setTimeout(function(){(function(){var t=this.options.target||".slide__content";(t=this.options.elms||P.findAll(this.root,t))&&t.length&&P.each(t,o.bind(this))}).call(i)}),i},SwipeDetect.prototype.constructor=SwipeDetect}(dBlazy,dSplide,this,this.document);
