index-legacy-f65c539c.js 6.8 KB

1
  1. !function(){function t(t,a){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=a){var n,i,r,u,o=[],l=!0,c=!1;try{if(r=(a=a.call(t)).next,0===e){if(Object(a)!==a)return;l=!1}else for(;!(l=(n=r.call(a)).done)&&(o.push(n.value),o.length!==e);l=!0);}catch(v){c=!0,i=v}finally{try{if(!l&&null!=a.return&&(u=a.return(),Object(u)!==u))return}finally{if(c)throw i}}return o}}(t,a)||function(t,a){if(!t)return;if("string"==typeof t)return e(t,a);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(t,a)}(t,a)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function e(t,e){(null==e||e>t.length)&&(e=t.length);for(var a=0,n=new Array(e);a<e;a++)n[a]=t[a];return n}System.register(["./index-legacy-34afeea3.js"],(function(e,a){"use strict";var n,i,r,u,o,l,c,v,f,s,h,d,p,g,w,m,y,b,S,x,C,A,M,O,T,j,z,I,D;return{setters:[function(t){n=t.t,i=t.T,r=t.x,u=t.v,o=t.d,l=t.n,c=t.j,v=t.y,f=t.a4,s=t.i,h=t.A,d=t.w,p=t.as,g=t.at,w=t.aS,m=t.o,y=t.av,b=t.aw,S=t.am,x=t.an,C=t.D,A=t.g,M=t.ar,O=t.p,T=t.aG,j=t.G,z=t.H,I=t.K,D=t.a7}],execute:function(){var a=t(n("swipe"),2),E=a[0],X=a[1],Y={loop:i,width:r,height:r,vertical:Boolean,autoplay:u(0),duration:u(500),touchable:i,lazyRender:Boolean,initialSwipe:u(0),indicatorColor:String,showIndicators:i,stopPropagation:i},k=Symbol(E),P=o({name:E,props:Y,emits:["change","dragStart","dragEnd"],setup:function(t,e){var a,n,i=e.emit,r=e.slots,u=l(),o=l(),I=c({rect:null,width:0,height:0,offset:0,active:0,swiping:!1}),D=!1,E=v(),Y=f(k),P=Y.children,B=Y.linkChildren,G=s((function(){return P.length})),H=s((function(){return I[t.vertical?"height":"width"]})),R=s((function(){return t.vertical?E.deltaY.value:E.deltaX.value})),K=s((function(){return I.rect?(t.vertical?I.rect.height:I.rect.width)-H.value*G.value:0})),U=s((function(){return H.value?Math.ceil(Math.abs(K.value)/H.value):G.value})),W=s((function(){return G.value*H.value})),$=s((function(){return(I.active+G.value)%G.value})),q=s((function(){var e=t.vertical?"vertical":"horizontal";return E.direction.value===e})),F=s((function(){var e={transitionDuration:"".concat(I.swiping?0:t.duration,"ms"),transform:"translate".concat(t.vertical?"Y":"X","(").concat(I.offset,"px)")};if(H.value){var a=t.vertical?"height":"width",n=t.vertical?"width":"height";e[a]="".concat(W.value,"px"),e[n]=t[n]?"".concat(t[n],"px"):""}return e})),J=function(e){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=e*H.value;t.loop||(n=Math.min(n,-K.value));var i=a-n;return t.loop||(i=z(i,K.value,0)),i},L=function(e){var a=e.pace,n=void 0===a?0:a,r=e.offset,u=void 0===r?0:r,o=e.emitChange;if(!(G.value<=1)){var l=I.active,c=function(e){var a=I.active;return e?t.loop?z(a+e,-1,G.value):z(a+e,0,U.value):a}(n),v=J(c,u);if(t.loop){if(P[0]&&v!==K.value){var f=v<K.value;P[0].setOffset(f?W.value:0)}if(P[G.value-1]&&0!==v){var s=v>0;P[G.value-1].setOffset(s?-W.value:0)}}I.active=c,I.offset=v,o&&c!==l&&i("change",$.value)}},N=function(){I.swiping=!0,I.active<=-1?L({pace:G.value}):I.active>=G.value&&L({pace:-G.value})},Q=function(){N(),E.reset(),T((function(){I.swiping=!1,L({pace:1,emitChange:!0})}))},V=function(){return clearTimeout(a)},Z=function e(){V(),+t.autoplay>0&&G.value>1&&(a=setTimeout((function(){Q(),e()}),+t.autoplay))},_=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:+t.initialSwipe;if(u.value){var a=function(){var a,n;if(!M(u)){var i={width:u.value.offsetWidth,height:u.value.offsetHeight};I.rect=i,I.width=+(null!=(a=t.width)?a:i.width),I.height=+(null!=(n=t.height)?n:i.height)}G.value&&-1===(e=Math.min(G.value-1,e))&&(e=G.value-1),I.active=e,I.swiping=!0,I.offset=J(e),P.forEach((function(t){t.setOffset(0)})),Z()};M(u)?O().then(a):a()}},tt=function(){return _(I.active)},et=function(e){!t.touchable||e.touches.length>1||(E.start(e),D=!1,n=Date.now(),V(),N())},at=function(){if(t.touchable&&I.swiping){var e=Date.now()-n,a=R.value/e;if((Math.abs(a)>.25||Math.abs(R.value)>H.value/2)&&q.value){var r=t.vertical?E.offsetY.value:E.offsetX.value,u=0;u=t.loop?r>0?R.value>0?-1:1:0:-Math[R.value>0?"ceil":"floor"](R.value/H.value),L({pace:u,emitChange:!0})}else R.value&&L({pace:0});D=!1,I.swiping=!1,i("dragEnd",{index:$.value}),Z()}},nt=function(e,a){var n=a===$.value,i=n?{backgroundColor:t.indicatorColor}:void 0;return A("i",{style:i,class:X("indicator",{active:n})},null)};return h({prev:function(){N(),E.reset(),T((function(){I.swiping=!1,L({pace:-1,emitChange:!0})}))},next:Q,state:I,resize:tt,swipeTo:function(e){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};N(),E.reset(),T((function(){var n;n=t.loop&&e===G.value?0===I.active?0:e:e%G.value,a.immediate?T((function(){I.swiping=!1})):I.swiping=!1,L({pace:n-I.active,emitChange:!0})}))}}),B({size:H,props:t,count:G,activeIndicator:$}),d((function(){return t.initialSwipe}),(function(t){return _(+t)})),d(G,(function(){return _(I.active)})),d((function(){return t.autoplay}),Z),d([p,g,function(){return t.width},function(){return t.height}],tt),d(w(),(function(t){"visible"===t?Z():V()})),m(_),y((function(){return _(I.active)})),b((function(){return _(I.active)})),S(V),x(V),C("touchmove",(function(e){t.touchable&&I.swiping&&(E.move(e),q.value&&(!t.loop&&(0===I.active&&R.value>0||I.active===G.value-1&&R.value<0)||(j(e,t.stopPropagation),L({offset:R.value}),D||(i("dragStart",{index:$.value}),D=!0))))}),{target:o}),function(){var e;return A("div",{ref:u,class:X()},[A("div",{ref:o,style:F.value,class:X("track",{vertical:t.vertical}),onTouchstartPassive:et,onTouchend:at,onTouchcancel:at},[null==(e=r.default)?void 0:e.call(r)]),r.indicator?r.indicator({active:$.value,total:G.value}):t.showIndicators&&G.value>1?A("div",{class:X("indicators",{vertical:t.vertical})},[Array(G.value).fill("").map(nt)]):void 0])}}}),B=(e("S",I(P)),t(n("swipe-item"),2)),G=B[0],H=B[1],R=o({name:G,setup:function(t,e){var a,n=e.slots,i=c({offset:0,inited:!1,mounted:!1}),r=D(k),u=r.parent,o=r.index;if(u){var l=s((function(){var t={},e=u.props.vertical;return u.size.value&&(t[e?"height":"width"]="".concat(u.size.value,"px")),i.offset&&(t.transform="translate".concat(e?"Y":"X","(").concat(i.offset,"px)")),t})),v=s((function(){var t=u.props,e=t.loop;if(!t.lazyRender||a)return!0;if(!i.mounted)return!1;var n=u.activeIndicator.value,r=u.count.value-1,l=0===n&&e?r:n-1,c=n===r&&e?0:n+1;return a=o.value===n||o.value===l||o.value===c}));return m((function(){O((function(){i.mounted=!0}))})),h({setOffset:function(t){i.offset=t}}),function(){var t;return A("div",{class:H(),style:l.value},[v.value?null==(t=n.default)?void 0:t.call(n):null])}}}});e("a",I(R))}}}))}();