UNPKG

@egjs/flicking

Version:

Everyday 30 million people experience. It's reliable, flexible and extendable carousel.

1 lines 136 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Flicking=t()}(this,function(){"use strict";var e=Object.defineProperty,t=Object.defineProperties,n=Object.getOwnPropertyDescriptors,i=Object.getOwnPropertySymbols,r=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,a=Reflect.get,l=Math.pow,h=(t,n,i)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[n]=i,c=(e,t)=>{for(var n in t||(t={}))s.call(t,n)&&h(e,n,t[n]);if(i)for(var n of i(t))o.call(t,n)&&h(e,n,t[n]);return e},u=(e,i)=>t(e,n(i)),d=(e,t,n)=>new Promise((i,r)=>{var s=e=>{try{a(n.next(e))}catch(t){r(t)}},o=e=>{try{a(n.throw(e))}catch(t){r(t)}},a=e=>e.done?i(e.value):Promise.resolve(e.value).then(s,o);a((n=n.apply(e,t)).next())});function g(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,s=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(a){r={error:a}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return o}function _(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(g(arguments[t]));return e}var p=function(e){return void 0===e},f=function(){function e(e,t){var n,i;if(this._canceled=!1,t)try{for(var r=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(Object.keys(t)),s=r.next();!s.done;s=r.next()){var o=s.value;this[o]=t[o]}}catch(a){n={error:a}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}this.eventType=e}var t=e.prototype;return t.stop=function(){this._canceled=!0},t.isCanceled=function(){return this._canceled},e}(),v=function(){function e(){this._eventHandler={}}var t=e.prototype;return t.trigger=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var i=e instanceof f?e.eventType:e,r=_(this._eventHandler[i]||[]);return r.length<=0||(e instanceof f?(e.currentTarget=this,r.forEach(function(t){t(e)})):r.forEach(function(e){e.apply(void 0,_(t))})),this},t.once=function(e,t){var n=this;if("object"==typeof e&&p(t)){var i=e;for(var r in i)this.once(r,i[r]);return this}if("string"==typeof e&&"function"==typeof t){var s=function(){for(var i=[],r=0;r<arguments.length;r++)i[r]=arguments[r];t.apply(void 0,_(i)),n.off(e,s)};this.on(e,s)}return this},t.hasOn=function(e){return!!this._eventHandler[e]},t.on=function(e,t){if("object"==typeof e&&p(t)){var n=e;for(var i in n)this.on(i,n[i]);return this}if("string"==typeof e&&"function"==typeof t){var r=this._eventHandler[e];p(r)&&(this._eventHandler[e]=[],r=this._eventHandler[e]),r.push(t)}return this},t.off=function(e,t){if(p(e))return this._eventHandler={},this;if(p(t)){if("string"==typeof e)return delete this._eventHandler[e],this;var n=e;for(var i in n)this.off(i,n[i]);return this}var r=this._eventHandler[e];if(r)for(var s=r.length,o=0;o<s;++o)if(r[o]===t){r.splice(o,1),s<=1&&delete this._eventHandler[e];break}return this},e.VERSION="3.0.5",e}(),m=f;const E={PREV:"prev",CENTER:"center",NEXT:"next"},x={PREV:"PREV",NEXT:"NEXT",NONE:null},P={SNAP:"snap",FREE_SCROLL:"freeScroll",STRICT:"strict"},b={VIEWPORT:"flicking-viewport",CAMERA:"flicking-camera",VERTICAL:"vertical",HIDDEN:"flicking-hidden",DEFAULT_VIRTUAL:"flicking-panel"},y={LINEAR:"linear",BOUND:"bound"},O={LTR:"ltr",RTL:"rtl"},T={HORIZONTAL:"horizontal",VERTICAL:"vertical"},R=Object.freeze(Object.defineProperty({__proto__:null,ALIGN:E,CIRCULAR_FALLBACK:y,CLASS:b,DIRECTION:x,MOVE_DIRECTION:T,MOVE_TYPE:P,ORDER:O},Symbol.toStringTag,{value:"Module"})),I={READY:"ready",BEFORE_RESIZE:"beforeResize",AFTER_RESIZE:"afterResize",HOLD_START:"holdStart",HOLD_END:"holdEnd",MOVE_START:"moveStart",MOVE:"move",MOVE_END:"moveEnd",WILL_CHANGE:"willChange",CHANGED:"changed",WILL_RESTORE:"willRestore",RESTORED:"restored",SELECT:"select",NEED_PANEL:"needPanel",VISIBLE_CHANGE:"visibleChange",REACH_EDGE:"reachEdge",PANEL_CHANGE:"panelChange"},w=Object.freeze(Object.defineProperty({__proto__:null,EVENTS:I},Symbol.toStringTag,{value:"Module"}));class A{get index(){return this._index}get position(){return this._pos}get panel(){return this._panel}constructor(e){const{index:t,position:n,panel:i}=e;this._index=t,this._pos=n,this._panel=i}}const S={WRONG_TYPE:{code:0,message:(e,t)=>`${e}(${typeof e}) is not a ${t.map(e=>`"${e}"`).join(" or ")}.`},ELEMENT_NOT_FOUND:{code:1,message:e=>`Element with selector "${e}" not found.`},VAL_MUST_NOT_NULL:{code:2,message:(e,t)=>`${t} should be provided. Given: ${e}`},NOT_ATTACHED_TO_FLICKING:{code:3,message:'This module is not attached to the Flicking instance. "init()" should be called first.'},WRONG_OPTION:{code:4,message:(e,t)=>`Option "${e}" is not in correct format, given: ${t}`},INDEX_OUT_OF_RANGE:{code:5,message:(e,t,n)=>`Index "${e}" is out of range: should be between ${t} and ${n}.`},POSITION_NOT_REACHABLE:{code:6,message:e=>`Position "${e}" is not reachable.`},TRANSFORM_NOT_SUPPORTED:{code:7,message:"Browser does not support CSS transform."},STOP_CALLED_BY_USER:{code:8,message:"Event stop() is called by user."},ANIMATION_INTERRUPTED:{code:9,message:"Animation is interrupted by user input."},ANIMATION_ALREADY_PLAYING:{code:10,message:"Animation is already playing."},NOT_ALLOWED_IN_FRAMEWORK:{code:11,message:"This behavior is not allowed in the frameworks like React, Vue, or Angular."},NOT_INITIALIZED:{code:12,message:"Flicking is not initialized yet, call init() first."},NO_ACTIVE:{code:13,message:"There's no active panel that Flicking has selected. This may be due to the absence of any panels."},NOT_ALLOWED_IN_VIRTUAL:{code:14,message:"This behavior is not allowed when the virtual option is enabled"}},C=Object.keys(S).reduce((e,t)=>(e[t]=S[t].code,e),{}),k=Object.keys(S).reduce((e,t)=>(e[t]=S[t].message,e),{}),N=(e,...t)=>(t.forEach(t=>{Object.keys(t).forEach(n=>{e[n]=t[n]})}),e),D=(e,t)=>{let n=null;if($(e)){const i=(t||document).querySelector(e);if(!i)throw new he(k.ELEMENT_NOT_FOUND(e),C.ELEMENT_NOT_FOUND);n=i}else e&&e.nodeType===Node.ELEMENT_NODE&&(n=e);if(!n)throw new he(k.WRONG_TYPE(e,["HTMLElement","string"]),C.WRONG_TYPE);return n},M=(e,t)=>{if(null==e)throw new he(k.VAL_MUST_NOT_NULL(e,t),C.VAL_MUST_NOT_NULL)},z=(e,t,n)=>Math.max(Math.min(e,n),t),L=e=>{if(!e)throw new he(k.NOT_ATTACHED_TO_FLICKING,C.NOT_ATTACHED_TO_FLICKING);return e},H=e=>[].slice.call(e),F=(e,t)=>{let n;if($(e))switch(e){case E.PREV:n=0;break;case E.CENTER:n=.5*t;break;case E.NEXT:n=t;break;default:if(n=j(e,t),null==n)throw new he(k.WRONG_OPTION("align",e),C.WRONG_OPTION)}else n=e;return n},V=(e,t)=>{let n;if(Array.isArray(e))n=e.map(e=>j(e,t));else{const i=j(e,t);n=[i,i]}return n.map(t=>{if(null==t)throw new he(k.WRONG_OPTION("bounce",e),C.WRONG_OPTION);return t})},j=(e,t)=>{const n=B(e);return null==n?null:n.percentage*t+n.absolute},B=e=>{const t=/(?:(\+|-)\s*)?(\d+(?:\.\d+)?(%|px)?)/g;if("number"==typeof e)return{percentage:0,absolute:e};const n={percentage:0,absolute:0};let i=0,r=t.exec(e);for(;null!=r;){let s=r[1];const o=r[2],a=r[3],l=parseFloat(o);if(i<=0&&(s=s||"+"),!s)return null;const h="+"===s?1:-1;"%"===a?n.percentage+=h*(l/100):n.absolute+=h*l,++i,r=t.exec(e)}return 0===i?null:n},G=e=>"object"==typeof e?e.panel:e,W=(e,t)=>e===t?x.NONE:e<t?x.NEXT:x.PREV,X=e=>{Array.isArray(e)||(e=[e]);const t=[];return e.forEach(e=>{if($(e)){const n=document.createElement("div");for(n.innerHTML=e,t.push(...H(n.children));n.firstChild;)n.removeChild(n.firstChild)}else{if(!e||e.nodeType!==Node.ELEMENT_NODE)throw new he(k.WRONG_TYPE(e,["HTMLElement","string"]),C.WRONG_TYPE);t.push(e)}}),t},U=(e,t)=>z(e<0?e+t:e,0,t),Y=(e,t)=>{for(const n of e)if(n===t)return!0;return!1},$=e=>"string"==typeof e,K=(e,t,n)=>{const i=n-t;if(e<t){e=n-(t-e)%i}else if(e>n){e=t+(e-n)%i}return e},q=(e,t)=>{for(const n of e)if(t(n))return n;return null},Z=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n]))return n;return-1},Q=(e,t,n)=>(e-t)/(n-t),J=e=>e?window.getComputedStyle(e)||e.currentStyle:{},ee=(e,{width:t,height:n})=>{e&&(null!=t&&($(t)?e.style.width=t:e.style.width=`${t}px`),null!=n&&($(n)?e.style.height=n:e.style.height=`${n}px`))},te=(e,t,n)=>e>=t&&e<=n,ne=(e,t)=>e>=t?e%t:e<0?U((e+1)%t-1,t):e,ie=e=>{const t=new Array(e);for(let n=0;n<e;n++)t[n]=n;return t},re=({el:e,horizontal:t,useFractionalSize:n,useOffset:i,style:r})=>{let s=0;if(n){const e=parseFloat(t?r.width:r.height)||0,n="border-box"===r.boxSizing,o=t?parseFloat(r.borderLeftWidth||"0")+parseFloat(r.borderRightWidth||"0"):parseFloat(r.borderTopWidth||"0")+parseFloat(r.borderBottomWidth||"0");if(n)s=i?e:e-o;else{const n=t?parseFloat(r.paddingLeft||"0")+parseFloat(r.paddingRight||"0"):parseFloat(r.paddingTop||"0")+parseFloat(r.paddingBottom||"0");s=i?e+n+o:e+n}}else{const n=t?"Width":"Height";s=i?e[`offset${n}`]:e[`client${n}`]}return Math.max(s,0)},se=Object.setPrototypeOf||((e,t)=>(e.__proto__=t,e)),oe=e=>e.replace(/[\s-_]([a-z])/g,(e,t)=>t.toUpperCase()),ae=(e,t)=>{const n={},i=e.attributes,r=i.length;for(let s=0;s<r;++s){const e=i[s],{name:r,value:o}=e;-1!==r.indexOf(t)&&(n[oe(r.replace(t,""))]=o)}return n},le=Object.freeze(Object.defineProperty({__proto__:null,camelize:oe,checkExistence:M,circulateIndex:ne,circulatePosition:K,clamp:z,find:q,findIndex:Z,findRight:(e,t)=>{for(let n=e.length-1;n>=0;n--){const i=e[n];if(t(i))return i}return null},getDataAttributes:ae,getDirection:W,getElement:D,getElementSize:re,getFlickingAttached:L,getMinusCompensatedIndex:U,getProgress:Q,getStyle:J,includes:Y,isBetween:te,isString:$,merge:N,parseAlign:F,parseArithmeticExpression:B,parseArithmeticSize:j,parseBounce:V,parseCSSSizeValue:e=>$(e)?e:`${e}px`,parseElement:X,parsePanelAlign:G,range:ie,setPrototypeOf:se,setSize:ee,toArray:H},Symbol.toStringTag,{value:"Module"}));class he extends Error{constructor(e,t){super(e),se(this,he.prototype),this.name="FlickingError",this.code=t}}class ce{constructor(e){this._flicking=e}getAnchors(){return this._flicking.renderer.panels.map((e,t)=>new A({index:t,position:e.position,panel:e}))}findAnchorIncludePosition(e){return this._flicking.camera.anchorPoints.filter(t=>t.panel.includePosition(e,!0)).reduce((t,n)=>t&&Math.abs(t.position-e)<Math.abs(n.position-e)?t:n,null)}findNearestAnchor(e){const t=this._flicking.camera.anchorPoints;if(t.length<=0)return null;let n=1/0;for(let i=0;i<t.length;i++){const r=t[i],s=Math.abs(r.position-e);if(s>n)return t[i-1];n=s}return t[t.length-1]}clampToReachablePosition(e){const t=this._flicking.camera.range;return z(e,t.min,t.max)}getCircularOffset(){return 0}canReach(e){const t=this._flicking.camera.range;if(e.removed)return!1;const n=e.position;return n>=t.min&&n<=t.max}canSee(e){const t=this._flicking.camera.visibleRange;return e.isVisibleOnRange(t.min,t.max)}}class ue extends ce{checkAvailability(){const e=this._flicking,t=e.renderer,n=t.getPanel(0),i=t.getPanel(t.panelCount-1);if(!n||!i)return!1;const r=e.camera.size,s=n.range.min;return r<i.range.max-s}getRange(){const e=this._flicking,t=e.renderer,n=e.camera.alignPosition,i=t.getPanel(0),r=t.getPanel(t.panelCount-1);if(!i||!r)return{min:0,max:0};const s=e.camera.size,o=i.range.min,a=r.range.max,l=o+n,h=a-s+n;if(s<a-o)return{min:l,max:h};{const t=e.camera.align,n="object"==typeof t?t.camera:t,i=l+F(n,h-l);return{min:i,max:i}}}getAnchors(){const e=this._flicking,t=e.camera,n=e.renderer.panels;if(n.length<=0)return[];const i=e.camera.range,r=n.filter(e=>t.canReach(e));if(r.length>0){const e=r[0].position!==i.min,t=r[r.length-1].position!==i.max,s=e?1:0,o=r.map((e,t)=>new A({index:t+s,position:e.position,panel:e}));return e&&o.splice(0,0,new A({index:0,position:i.min,panel:n[r[0].index-1]})),t&&o.push(new A({index:o.length,position:i.max,panel:n[r[r.length-1].index+1]})),o}if(i.min!==i.max){const e=this._findNearestPanel(i.min,n),t=e.index===n.length-1?e.prev():e,r=t.next();return[new A({index:0,position:i.min,panel:t}),new A({index:1,position:i.max,panel:r})]}return[new A({index:0,position:i.min,panel:this._findNearestPanel(i.min,n)})]}findAnchorIncludePosition(e){const t=this._flicking.camera,n=t.range,i=t.anchorPoints;return i.length<=0?null:e<=n.min?i[0]:e>=n.max?i[i.length-1]:super.findAnchorIncludePosition(e)}_findNearestPanel(e,t){let n=1/0;for(let i=0;i<t.length;i++){const r=t[i],s=Math.abs(r.position-e);if(s>n)return t[i-1];n=s}return t[t.length-1]}}class de extends ce{checkAvailability(){const e=this._flicking,t=e.renderer.panels;if(t.length<=0)return!1;const n=t[0],i=t[t.length-1],r=n.range.min-n.margin.prev,s=i.range.max+i.margin.next,o=e.camera.size,a=s-r;return t.every(e=>a-e.size>=o)}getRange(){const e=this._flicking.renderer.panels;if(e.length<=0)return{min:0,max:0};const t=e[0],n=e[e.length-1];return{min:t.range.min-t.margin.prev,max:n.range.max+n.margin.next}}getAnchors(){return this._flicking.renderer.panels.map((e,t)=>new A({index:t,position:e.position,panel:e}))}findNearestAnchor(e){const t=this._flicking.camera,n=t.anchorPoints;if(n.length<=0)return null;const i=t.range;let r=1/0,s=-1;for(let o=0;o<n.length;o++){const t=n[o],a=Math.min(Math.abs(t.position-e),Math.abs(t.position-i.min+i.max-e),Math.abs(e-i.min+i.max-t.position));a<r&&(r=a,s=o)}return n[s]}findAnchorIncludePosition(e){const t=this._flicking.camera,n=t.range,i=t.anchorPoints,r=t.rangeDiff,s=i.length,o=K(e,n.min,n.max);let a=super.findAnchorIncludePosition(o);if(s>0&&(e===n.min||e===n.max)){const t=[a,new A({index:0,position:i[0].position+r,panel:i[0].panel}),new A({index:s-1,position:i[s-1].position-r,panel:i[s-1].panel})].filter(e=>!!e);a=t.reduce((t,n)=>t&&Math.abs(t.position-e)<Math.abs(n.position-e)?t:n,null)}if(!a)return null;if(e<n.min){const t=-Math.floor((n.min-e)/r)-1;return new A({index:a.index,position:a.position+r*t,panel:a.panel})}if(e>n.max){const t=Math.floor((e-n.max)/r)+1;return new A({index:a.index,position:a.position+r*t,panel:a.panel})}return a}getCircularOffset(){const e=this._flicking;if(!e.camera.circularEnabled)return 0;const t=e.panels.filter(e=>e.toggled),n=t.filter(e=>e.toggleDirection===x.PREV),i=t.filter(e=>e.toggleDirection===x.NEXT);return this._calcPanelAreaSum(n)-this._calcPanelAreaSum(i)}clampToReachablePosition(e){return e}canReach(e){return!e.removed}canSee(e){const t=this._flicking.camera,n=t.range,i=t.rangeDiff,r=t.visibleRange,s=super.canSee(e);return r.min<n.min?s||e.isVisibleOnRange(r.min+i,r.max+i):r.max>n.max?s||e.isVisibleOnRange(r.min-i,r.max-i):s}_calcPanelAreaSum(e){return e.reduce((e,t)=>e+t.sizeIncludingMargin,0)}}class ge extends ce{checkAvailability(){return!0}getRange(){var e,t;const n=this._flicking.renderer,i=n.getPanel(0),r=n.getPanel(n.panelCount-1);return{min:null!=(e=null==i?void 0:i.position)?e:0,max:null!=(t=null==r?void 0:r.position)?t:0}}}let _e=class{constructor(e,{align:t=E.CENTER}={}){this._lookedOffset=0,this._checkTranslateSupport=()=>{const e=["webkitTransform","msTransform","MozTransform","OTransform","transform"],t=document.documentElement.style;let n="";for(const i of e)i in t&&(n=i);if(!n)throw new he(k.TRANSFORM_NOT_SUPPORTED,C.TRANSFORM_NOT_SUPPORTED);this._transform=n},this._flicking=e,this._resetInternalValues(),this._align=t}get element(){return this._el}get children(){return H(this._el.children)}get position(){return this._position}get alignPosition(){return this._alignPos}get offset(){return this._offset-this._circularOffset}get circularEnabled(){return this._circularEnabled}get mode(){return this._mode}get range(){return this._range}get rangeDiff(){return this._range.max-this._range.min}get visiblePanels(){return this._visiblePanels}get visibleRange(){return{min:this._position-this._alignPos,max:this._position-this._alignPos+this.size}}get anchorPoints(){return this._anchors}get controlParams(){return{range:this._range,position:this._position,circular:this._circularEnabled}}get atEdge(){return this._position<=this._range.min||this._position>=this._range.max}get size(){const e=this._flicking;return e?e.horizontal?e.viewport.width:e.viewport.height:0}get progress(){const e=this._flicking,t=this._position+this._offset,n=this.findNearestAnchor(this._position);if(!e||!n)return NaN;const i=n.panel,r=i.position+i.offset,s=e.control.controller.bounce,{min:o,max:a}=this.range,l=this.rangeDiff;if(t===r)return i.index;if(t<r){const e=i.prev();let n=e?e.position+e.offset:o-s[0];return n>r&&(n-=l),i.index-1+Q(t,n,r)}{const e=i.next();let n=e?e.position+e.offset:a+s[1];return n<r&&(n+=l),i.index+Q(t,r,n)}}get panelOrder(){return this._panelOrder}get align(){return this._align}set align(e){this._align=e}init(){const e=this._flicking.viewport.element;return M(e.firstElementChild,"First element child of the viewport element"),this._el=e.firstElementChild,this._checkTranslateSupport(),this._updateMode(),this.updatePanelOrder(),this}destroy(){return this._resetInternalValues(),this}lookAt(e){const t=this._offset,n=this._lookedOffset!==t,i=L(this._flicking),r=this._position;this._position=e;const s=this._togglePanels(r,e);this._refreshVisiblePanels(),this._checkNeedPanel(),this._checkReachEnd(r,e),s?i.renderer.render().then(()=>{this.updateOffset(),this._lookedOffset=this._offset}):n?(this.updateOffset(),this._lookedOffset=this._offset):this.applyTransform()}getPrevAnchor(e){if(this._circularEnabled&&0===e.index){const e=this._anchors,t=this.rangeDiff,n=e[e.length-1];return new A({index:n.index,position:n.position-t,panel:n.panel})}return this._anchors[e.index-1]||null}getNextAnchor(e){const t=this._anchors;if(this._circularEnabled&&e.index===t.length-1){const e=this.rangeDiff,n=t[0];return new A({index:n.index,position:n.position+e,panel:n.panel})}return t[e.index+1]||null}getProgressInPanel(e){const t=e.range;return(this._position-t.min)/(t.max-t.min)}findAnchorIncludePosition(e){return this._mode.findAnchorIncludePosition(e)}findNearestAnchor(e){return this._mode.findNearestAnchor(e)}findActiveAnchor(){var e;const t=L(this._flicking).control.activePanel;return t?null!=(e=q(this._anchors,e=>e.panel.index===t.index))?e:this.findNearestAnchor(t.position):null}clampToReachablePosition(e){return this._mode.clampToReachablePosition(e)}canReach(e){return this._mode.canReach(e)}canSee(e){return this._mode.canSee(e)}updateRange(){const e=L(this._flicking).renderer.panels;return this._updateMode(),this._range=this._mode.getRange(),e.forEach(e=>e.updateCircularToggleDirection()),this}updateAlignPos(){const e=this._align,t="object"==typeof e?e.camera:e;return this._alignPos=F(t,this.size),this}updateAnchors(){return this._anchors=this._mode.getAnchors(),this}updateAdaptiveHeight(){const e=L(this._flicking),t=e.control.activePanel,n=[...e.visiblePanels];if(t&&n.push(t),!e.horizontal||!e.adaptive||!n.length)return;const i=Math.max(...n.map(e=>e.height));e.viewport.setSize({height:i})}updateOffset(){const e=L(this._flicking),t=this._position,n=e.panels.filter(e=>!e.rendered);return this._offset=n.filter(e=>e.position+e.offset<t).reduce((e,t)=>e+t.sizeIncludingMargin,0),this._circularOffset=this._mode.getCircularOffset(),this.applyTransform(),this}updatePanelOrder(){const e=L(this._flicking);if(!e.horizontal)return this;const t=this._el,n=J(t).direction;return n!==this._panelOrder&&(this._panelOrder=n===O.RTL?O.RTL:O.LTR,e.initialized&&e.control.controller.updateDirection()),this}resetNeedPanelHistory(){return this._needPanelTriggered={prev:!1,next:!1},this}applyTransform(){const e=this._el,t=L(this._flicking);if(t.renderer.rendering||!t.initialized)return this;const n=this._position-this._alignPos-this._offset+this._circularOffset;return e.style[this._transform]=t.horizontal?`translate(${this._panelOrder===O.RTL?n:-n}px)`:`translate(0, ${-n}px)`,this}_resetInternalValues(){this._position=0,this._lookedOffset=0,this._alignPos=0,this._offset=0,this._circularOffset=0,this._circularEnabled=!1,this._range={min:0,max:0},this._visiblePanels=[],this._anchors=[],this._needPanelTriggered={prev:!1,next:!1}}_refreshVisiblePanels(){const e=L(this._flicking),t=e.renderer.panels.filter(e=>this.canSee(e)),n=this._visiblePanels;this._visiblePanels=t;const i=t.filter(e=>!Y(n,e)),r=n.filter(e=>!Y(t,e));(i.length>0||r.length>0)&&e.renderer.render().then(()=>{e.trigger(new m(I.VISIBLE_CHANGE,{added:i,removed:r,visiblePanels:t}))})}_checkNeedPanel(){const e=this._needPanelTriggered;if(e.prev&&e.next)return;const t=L(this._flicking),n=t.renderer.panels;if(n.length<=0)return e.prev||(t.trigger(new m(I.NEED_PANEL,{direction:x.PREV})),e.prev=!0),void(e.next||(t.trigger(new m(I.NEED_PANEL,{direction:x.NEXT})),e.next=!0));const i=this._position,r=this.size,s=this._range,o=t.needPanelThreshold,a=i-this._alignPos,l=a+r,h=n[0],c=n[n.length-1];if(!e.prev){(a<=h.range.min+o||i<=s.min+o)&&(t.trigger(new m(I.NEED_PANEL,{direction:x.PREV})),e.prev=!0)}if(!e.next){(l>=c.range.max-o||i>=s.max-o)&&(t.trigger(new m(I.NEED_PANEL,{direction:x.NEXT})),e.next=!0)}}_checkReachEnd(e,t){const n=L(this._flicking),i=this._range,r=e>i.min&&e<i.max,s=t>i.min&&t<i.max;if(!r||s)return;const o=t<=i.min?x.PREV:x.NEXT;n.trigger(new m(I.REACH_EDGE,{direction:o}))}_updateMode(){const e=L(this._flicking);if(e.circular){const t=new de(e),n=t.checkAvailability();if(n)this._mode=t;else{const t=e.circularFallback;this._mode=t===y.BOUND?new ue(e):new ge(e)}this._circularEnabled=n}else this._mode=e.bound?new ue(e):new ge(e),this._circularEnabled=!1}_togglePanels(e,t){if(t===e)return!1;return L(this._flicking).renderer.panels.map(n=>n.toggle(e,t)).some(e=>e)}};const pe=Object.freeze(Object.defineProperty({__proto__:null,BoundCameraMode:ue,Camera:_e,CircularCameraMode:de,LinearCameraMode:ge},Symbol.toStringTag,{value:"Module"}));function fe(e,t){for(var n=e.length,i=0;i<n;++i)if(t(e[i],i))return!0;return!1}function ve(e,t){for(var n=e.length,i=0;i<n;++i)if(t(e[i],i))return e[i];return null}function me(e){var t=e;if(void 0===t){if("undefined"==typeof navigator||!navigator)return"";t=navigator.userAgent||""}return t.toLowerCase()}function Ee(e,t){try{return new RegExp(e,"g").exec(t)}catch(n){return null}}function xe(e){return e.replace(/_/g,".")}function Pe(e,t){var n=null,i="-1";return fe(e,function(e){var r=Ee("("+e.test+")((?:\\/|\\s|:)([0-9|\\.|_]+))?",t);return!(!r||e.brand)&&(n=e,i=r[3]||"-1",e.versionAlias?i=e.versionAlias:e.versionTest&&(i=function(e,t){var n=Ee("("+e+")((?:\\/|\\s|:)([0-9|\\.|_]+))",t);return n?n[3]:""}(e.versionTest.toLowerCase(),t)||i),i=xe(i),!0)}),{preset:n,version:i}}function be(e,t){var n={brand:"",version:"-1"};return fe(e,function(e){var i=ye(t,e);return!!i&&(n.brand=e.id,n.version=e.versionAlias||i.version,"-1"!==n.version)}),n}function ye(e,t){return ve(e,function(e){var n=e.brand;return Ee(""+t.test,n.toLowerCase())})}var Oe=[{test:"phantomjs",id:"phantomjs"},{test:"whale",id:"whale"},{test:"edgios|edge|edg",id:"edge"},{test:"msie|trident|windows phone",id:"ie",versionTest:"iemobile|msie|rv"},{test:"miuibrowser",id:"miui browser"},{test:"samsungbrowser",id:"samsung internet"},{test:"samsung",id:"samsung internet",versionTest:"version"},{test:"chrome|crios",id:"chrome"},{test:"firefox|fxios",id:"firefox"},{test:"android",id:"android browser",versionTest:"version"},{test:"safari|iphone|ipad|ipod",id:"safari",versionTest:"version"}],Te=[{test:"(?=.*applewebkit/(53[0-7]|5[0-2]|[0-4]))(?=.*\\schrome)",id:"chrome",versionTest:"chrome"},{test:"chromium",id:"chrome"},{test:"whale",id:"chrome",versionAlias:"-1",brand:!0}],Re=[{test:"applewebkit",id:"webkit",versionTest:"applewebkit|safari"}],Ie=[{test:"(?=(iphone|ipad))(?!(.*version))",id:"webview"},{test:"(?=(android|iphone|ipad))(?=.*(naver|daum|; wv))",id:"webview"},{test:"webview",id:"webview"}],we=[{test:"windows phone",id:"windows phone"},{test:"windows 2000",id:"window",versionAlias:"5.0"},{test:"windows nt",id:"window"},{test:"win32|windows",id:"window"},{test:"iphone|ipad|ipod",id:"ios",versionTest:"iphone os|cpu os"},{test:"macos|macintel|mac os x",id:"mac"},{test:"android|linux armv81",id:"android"},{test:"tizen",id:"tizen"},{test:"webos|web0s",id:"webos"}];function Ae(e){return!!Pe(Ie,e).preset}function Se(e){return Object.keys(e)}function Ce(e){return"function"==typeof e}var ke="__observers__",Ne="__computed__",De="__CFCS_DETECTED_DEPENDENCIES__",Me=function(e,t){return(Me=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function ze(e,t,n){if(2===arguments.length)for(var i,r=0,s=t.length;r<s;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}function Le(){Object[De]=Object[De]||{};var e=Object[De];return e[1]=e[1]||[],e[1]}var He=function(){function e(e){this._emitter=new v,this._current=e}var t=e.prototype;return Object.defineProperty(t,"current",{get:function(){var e,t=(e=Le())[e.length-1];return null==t||t.push(this),this._current},set:function(e){this._setCurrent(e)},enumerable:!1,configurable:!0}),t.subscribe=function(e){return this.current,this._emitter.on("update",e),this},t.unsubscribe=function(e){return this._emitter.off("update",e),this},t._setCurrent=function(e){var t=this._current,n=e!==t;this._current=e,n&&this._emitter.trigger("update",e,t)},t.toString=function(){return"".concat(this.current)},t.valueOf=function(){return this.current},e}(),Fe=function(e){function t(t){var n=e.call(this)||this;return n._computedCallback=t,n._registered=[],n._onCheckUpdate=function(){n._setCurrent(n.current)},n._current=n.current,n}!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Me(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e);var n=t.prototype;return Object.defineProperty(n,"current",{get:function(){var e,t,n,i,r=this;e=this,t=Le(),i={host:e,observers:n=[],push:function(t){e!==t&&-1===n.indexOf(t)&&n.push(t)}},t.push(i);var s=this._computedCallback(),o=Le().pop();return this._registered.forEach(function(e){e.unsubscribe(r._onCheckUpdate)}),o.observers.forEach(function(e){e.subscribe(r._onCheckUpdate)}),this._registered=o.observers,s},enumerable:!1,configurable:!0}),t}(He);function Ve(e,t,n){void 0===n&&(n=t);var i={configurable:!0,get:function(){return $e(this,n).current},set:function(e){$e(this,n,e).current=e}};Object.defineProperty(e,t,i),n!==t&&Object.defineProperty(e,n,{configurable:!0,get:function(){return $e(this,n).current}})}function je(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.length>1?Ve(e[0],e[1]):function(t,n){return Ve(t,n,e[0])}}function Be(e){e.subscribe=function(e,t){this[e],$e(this,e).subscribe(t)},e.unsubscribe=function(e,t){var n=this;e?e in this&&$e(this,e).unsubscribe(t):Se(Ye(this)).forEach(function(e){n.unsubscribe(e)})}}function Ge(e){Be(e.prototype)}function We(e,t){var n=Ce(e)?e():e,i={};return Ue(i),Se(n).forEach(function(e){var t,r=n[e];(t=r)&&function(e){return"object"==typeof e}(t)&&"current"in t&&"subscribe"in t&&"unsubscribe"in t?Ke(i,e,r):Ke(i,e,Xe(r)),je(e)(i,e)}),Be(i),i}function Xe(e){return new He(e)}function Ue(e){var t={};return Object.defineProperty(e,ke,{get:function(){return t}}),t}function Ye(e,t){var n,i;e[ke]||Ue(e);var r=e[ke];if(!t){var s=null===(i=null===(n=null==e?void 0:e.constructor)||void 0===n?void 0:n.prototype)||void 0===i?void 0:i[Ne];s&&s.forEach(function(t){!(t in r)&&t in e&&e[t]})}return r}function $e(e,t,n){var i=Ye(e);return i[t]||(i[t]=Xe(n)),i[t]}function Ke(e,t,n){Ye(e)[t]=n}function qe(e,t,n){var i=n.get;var r={configurable:!0,get:function(){var e,n=Ye(this,!0);return t in n||(n[t]=(e=i.bind(this),new Fe(e))),$e(this,t).current}};e[Ne]||(e[Ne]=[]);var s=e[Ne];return-1===s.indexOf(t)&&s.push(t),Object.defineProperty(e,t,r),r}var Ze=function(e,t){return(Ze=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function Qe(e,t){function n(){this.constructor=e}Ze(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var Je,et=function(){return et=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},et.apply(this,arguments)};function tt(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o}Je="undefined"==typeof window?{navigator:{userAgent:""}}:window;var nt,it=24,rt="left",st="right",ot="middle",at={1:rt,2:ot,3:st},lt="ontouchstart"in Je&&"safari"===(function(){if("undefined"==typeof navigator||!navigator||!navigator.userAgentData)return!1;var e=navigator.userAgentData,t=e.brands||e.uaList;return!(!t||!t.length)}()?function(e){var t=navigator.userAgentData,n=(t.uaList||t.brands).slice(),i=t.mobile||!1,r=n[0],s=(t.platform||navigator.platform).toLowerCase(),o={name:r.brand,version:r.version,majorVersion:-1,webkit:!1,webkitVersion:"-1",chromium:!1,chromiumVersion:"-1",webview:!!be(Ie,n).brand||Ae(me())},a={name:"unknown",version:"-1",majorVersion:-1};o.webkit=!o.chromium&&fe(Re,function(e){return ye(n,e)});var l=be(Te,n);if(o.chromium=!!l.brand,o.chromiumVersion=l.version||"-1",!o.chromium){var h=be(Re,n);o.webkit=!!h.brand,o.webkitVersion=h.version||"-1"}var c=ve(we,function(e){return new RegExp(""+e.test,"g").exec(s)});a.name=c?c.id:"";var u=be(Oe,n);return o.name=u.brand||o.name,o.version=u.brand&&e?e.uaFullVersion:u.version,o.webkit&&(a.name=i?"ios":"mac"),"ios"===a.name&&o.webview&&(o.version="-1"),a.version=xe(a.version),o.version=xe(o.version),a.majorVersion=parseInt(a.version,10),o.majorVersion=parseInt(o.version,10),{browser:o,os:a,isMobile:i,isHints:!0}}():function(e){var t=me(e),n=!!/mobi/g.exec(t),i={name:"unknown",version:"-1",majorVersion:-1,webview:Ae(t),chromium:!1,chromiumVersion:"-1",webkit:!1,webkitVersion:"-1"},r={name:"unknown",version:"-1",majorVersion:-1},s=Pe(Oe,t),o=s.preset,a=s.version,l=Pe(we,t),h=l.preset,c=l.version,u=Pe(Te,t);if(i.chromium=!!u.preset,i.chromiumVersion=u.version,!i.chromium){var d=Pe(Re,t);i.webkit=!!d.preset,i.webkitVersion=d.version}return h&&(r.name=h.id,r.version=c,r.majorVersion=parseInt(c,10)),o&&(i.name=o.id,i.version=a,i.webview&&"ios"===r.name&&"safari"!==i.name&&(i.webview=!1)),i.majorVersion=parseInt(i.version,10),{browser:i,os:r,isMobile:n,isHints:!1}}(nt)).browser.name,ht=function(){if("undefined"==typeof document)return"";for(var e=(document.head||document.getElementsByTagName("head")[0]).style,t=["transform","webkitTransform","msTransform","mozTransform"],n=0,i=t.length;n<i;n++)if(t[n]in e)return t[n];return""}(),ct={"-webkit-user-select":"none","-ms-user-select":"none","-moz-user-select":"none","user-select":"none","-webkit-user-drag":"none"},ut=function(e){for(var t=[],n=0,i=e.length;n<i;n++)t.push(e[n]);return t},dt=function(e,t){var n;if(void 0===t&&(t=!1),"string"==typeof e){if(e.match(/^<([a-z]+)\s*([^>]*)>/)){var i=document.createElement("div");i.innerHTML=e,n=ut(i.childNodes)}else n=ut(document.querySelectorAll(e));t||(n=n.length>=1?n[0]:void 0)}else e===Je?n=e:"value"in e||"current"in e?n=e.value||e.current:!e.nodeName||1!==e.nodeType&&9!==e.nodeType?"jQuery"in Je&&e instanceof jQuery||e.constructor.prototype.jquery?n=t?e.toArray():e.get(0):Array.isArray(e)&&(n=e.map(function(e){return dt(e)}),t||(n=n.length>=1?n[0]:void 0)):n=e;return n},gt=Je.requestAnimationFrame||Je.webkitRequestAnimationFrame,_t=Je.cancelAnimationFrame||Je.webkitCancelAnimationFrame;if(gt&&!_t){var pt={},ft=gt;gt=function(e){var t=ft(function(n){pt[t]&&e(n)});return pt[t]=!0,t},_t=function(e){delete pt[e]}}else gt&&_t||(gt=function(e){return Je.setTimeout(function(){e(Je.performance&&Je.performance.now&&Je.performance.now()||(new Date).getTime())},16)},_t=Je.clearTimeout);var vt=function(e,t){var n={};for(var i in e)i&&(n[i]=t(e[i],i));return n},mt=function(e,t){var n={};for(var i in e)i&&t(e[i],i)&&(n[i]=e[i]);return n},Et=function(e,t){for(var n in e)if(n&&!t(e[n],n))return!1;return!0},xt=function(e,t){return Et(e,function(e,n){return e===t[n]})},Pt={},bt=function(e,t){return Pt[t]||(Pt[t]=Tt(t)),Pt[t](e)},yt=function(e,t){return e&&t?vt(e,function(e,n){return bt(e,"number"==typeof t?t:t[n])}):e},Ot=function(e){if(!isFinite(e))return 0;var t="".concat(e);if(t.indexOf("e")>=0){for(var n=0,i=1;Math.round(e*i)/i!==e;)i*=10,n++;return n}return t.indexOf(".")>=0?t.length-t.indexOf(".")-1:0},Tt=function(e){var t=e<1?Math.pow(10,Ot(e)):1;return function(n){return 0===e?0:Math.round(Math.round(n/e)*e*t)/t}},Rt=function(e,t,n){return n?!!(30===t||t&e&&n&e):!!(t&e)},It=function(){function e(e){this._axes=e,this.holdingCount=0}var t=e.prototype;return t.hold=function(e,t){var n=this._getRoundPos(e).roundPos;this._axes.trigger(new m("hold",{pos:n,input:t.input||null,inputEvent:t.event||null,isTrusted:!0}))},t.triggerRelease=function(e){var t=this._getRoundPos(e.destPos,e.depaPos),n=t.roundPos,i=t.roundDepa;e.destPos=n,e.depaPos=i,e.setTo=this._createUserControll(e.destPos,e.duration),this._axes.trigger(new m("release",et(et({},e),{bounceRatio:this._getBounceRatio(n)})))},t.triggerChange=function(e,t,n,i){var r=this;void 0===i&&(i=!1);var s=this.animationManager,o=s.axisManager,a=s.getEventInfo(),l=this._getRoundPos(e,t),h=l.roundPos,c=l.roundDepa,u=o.moveTo(h,c),d=(null==n?void 0:n.event)||(null==a?void 0:a.event)||null,g={pos:u.pos,delta:u.delta,bounceRatio:this._getBounceRatio(u.pos),holding:i,inputEvent:d,isTrusted:!!d,input:(null==n?void 0:n.input)||(null==a?void 0:a.input)||null,set:d?this._createUserControll(u.pos):function(){}},_=new m("change",g);return this._axes.trigger(_),Object.keys(u.pos).forEach(function(e){var t=u.pos[e];$e(r._axes,e,t).current=t}),d&&o.set(g.set().destPos),!_.isCanceled()},t.triggerAnimationStart=function(e){var t=this._getRoundPos(e.destPos,e.depaPos),n=t.roundPos,i=t.roundDepa;e.destPos=n,e.depaPos=i,e.setTo=this._createUserControll(e.destPos,e.duration);var r=new m("animationStart",e);return this._axes.trigger(r),!r.isCanceled()},t.triggerAnimationEnd=function(e){void 0===e&&(e=!1),this._axes.trigger(new m("animationEnd",{isTrusted:e}))},t.triggerFinish=function(e){void 0===e&&(e=!1),this._axes.trigger(new m("finish",{isTrusted:e}))},t.setAnimationManager=function(e){this.animationManager=e},t.destroy=function(){this._axes.off()},t._createUserControll=function(e,t){void 0===t&&(t=0);var n={destPos:et({},e),duration:t};return function(e,t){return e&&(n.destPos=et({},e)),void 0!==t&&(n.duration=t),n}},t._getRoundPos=function(e,t){var n=this._axes.options.round;return{roundPos:yt(e,n),roundDepa:yt(t,n)}},t._getBounceRatio=function(e){return this._axes.axisManager.map(e,function(e,t){return e<t.range[0]&&0!==t.bounce[0]?(t.range[0]-e)/t.bounce[0]:e>t.range[1]&&0!==t.bounce[1]?(e-t.range[1])/t.bounce[1]:0})},tt([je],e.prototype,"holdingCount",void 0),e}(),wt=function(){function e(e){this._options=e,this._prevented=!1}var t=e.prototype;return t.isInterrupting=function(){return this._options.interruptable||this._prevented},t.isInterrupted=function(){return!this._options.interruptable&&this._prevented},t.setInterrupt=function(e){this._options.interruptable||(this._prevented=e)},e}(),At=function(e,t,n,i){var r=e,s=[n[0]?t[0]:i?t[0]-i[0]:t[0],n[1]?t[1]:i?t[1]+i[1]:t[1]];return r=Math.max(s[0],r),r=Math.min(s[1],r)},St=function(e,t){return e<t[0]||e>t[1]},Ct=function(e,t,n){return n[1]&&e>t[1]||n[0]&&e<t[0]},kt=function(e,t,n){var i=e,r=t[0],s=t[1],o=s-r;return n[1]&&e>s&&(i=(i-s)%o+r),n[0]&&e<r&&(i=(i-r)%o+s),i},Nt=function(){function e(e){var t=this;this._axis=e,this._complementOptions(),this._pos=Object.keys(this._axis).reduce(function(e,n){return e[n]=t._axis[n].startPos,e},{})}var t=e.prototype;return t.getDelta=function(e,t){var n=this.get(e);return vt(this.get(t),function(e,t){return e-n[t]})},t.get=function(e){var t=this;return e&&Array.isArray(e)?e.reduce(function(e,n){return n&&n in t._pos&&(e[n]=t._pos[n]),e},{}):et(et({},this._pos),e||{})},t.moveTo=function(e,t){void 0===t&&(t=this._pos);var n=vt(this._pos,function(n,i){return i in e&&i in t?e[i]-t[i]:0});return this.set(this.map(e,function(e,t){return t?kt(e,t.range,t.circular):0})),{pos:et({},this._pos),delta:n}},t.set=function(e){for(var t in e)t&&t in this._pos&&(this._pos[t]=e[t])},t.every=function(e,t){var n=this._axis;return Et(e,function(e,i){return t(e,n[i],i)})},t.filter=function(e,t){var n=this._axis;return mt(e,function(e,i){return t(e,n[i],i)})},t.map=function(e,t){var n=this._axis;return vt(e,function(e,i){return t(e,n[i],i)})},t.isOutside=function(e){return!this.every(e?this.get(e):this._pos,function(e,t){return!St(e,t.range)})},t.getAxisOptions=function(e){return this._axis[e]},t.setAxis=function(e){var t=this;Object.keys(e).forEach(function(n){if(!t._axis[n])throw new Error("Axis ".concat(n," does not exist in Axes instance"));t._axis[n]=et(et({},t._axis[n]),e[n])}),this._complementOptions()},t._complementOptions=function(){var e=this;Object.keys(this._axis).forEach(function(t){e._axis[t]=et({range:[0,100],startPos:e._axis[t].range[0],bounce:[0,0],circular:[!1,!1]},e._axis[t]),["bounce","circular"].forEach(function(n){var i=e._axis,r=i[t][n];/string|number|boolean/.test(typeof r)&&(i[t][n]=[r,r])})})},e}(),Dt="ontouchstart"in Je,Mt="PointerEvent"in Je,zt=Mt||"MSPointerEvent"in Je,Lt=function(){function e(){var e=this;this._stopContextMenu=function(t){t.preventDefault(),Je.removeEventListener("contextmenu",e._stopContextMenu)}}var t=e.prototype;return t.extendEvent=function(e){var t,n,i,r=this.prevEvent,s=this._getCenter(e),o=r?this._getMovement(e):{x:0,y:0},a=r?this._getScale(e):1,l=r?(n=s.x-r.center.x,i=s.y-r.center.y,180*Math.atan2(i,n)/Math.PI):0,h=r?r.deltaX+o.x:o.x,c=r?r.deltaY+o.y:o.y,u=o.x,d=o.y,g=this._latestInterval,_=Date.now(),p=g?_-g.timestamp:0,f=r?r.velocityX:0,v=r?r.velocityY:0,m=r?r.directionX:1,E=r?r.directionY:1;return u>0?m=1:u<0&&(m=-1),d>0?E=1:d<0&&(E=-1),(!g||p>=16)&&(g&&(f=(t=[(h-g.deltaX)/p,(c-g.deltaY)/p])[0],v=t[1]),this._latestInterval={timestamp:_,deltaX:h,deltaY:c}),{srcEvent:e,scale:a,angle:l,center:s,deltaX:h,deltaY:c,offsetX:u,offsetY:d,directionX:m,directionY:E,velocityX:f,velocityY:v,preventSystemEvent:!0}},t._getDistance=function(e,t){var n=t.clientX-e.clientX,i=t.clientY-e.clientY;return Math.sqrt(n*n+i*i)},t._getButton=function(e){var t={1:rt,2:st,4:ot},n=this._isTouchEvent(e)?rt:t[e.buttons];return n||null},t._isTouchEvent=function(e){return e.type&&e.type.indexOf("touch")>-1},t._isValidButton=function(e,t){return t.indexOf(e)>-1},t._isValidEvent=function(e,t,n){return(!t||function(e,t){return!!(!t||t.indexOf("any")>-1||t.indexOf("none")>-1&&!e.shiftKey&&!e.ctrlKey&&!e.altKey&&!e.metaKey||t.indexOf("shift")>-1&&e.shiftKey||t.indexOf("ctrl")>-1&&e.ctrlKey||t.indexOf("alt")>-1&&e.altKey||t.indexOf("meta")>-1&&e.metaKey)}(e,t))&&(!n||this._isValidButton(this._getButton(e),n))},t._preventMouseButton=function(e,t){t===st?Je.addEventListener("contextmenu",this._stopContextMenu):t===ot&&e.preventDefault()},e}(),Ht=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=["mousedown"],t.move=["mousemove"],t.end=["mouseup"],t}Qe(t,e);var n=t.prototype;return n.onEventStart=function(e,t,n){var i=this._getButton(e);return this._isValidEvent(e,t,n)?(this._preventMouseButton(e,i),this.extendEvent(e)):null},n.onEventMove=function(e,t,n){return this._isValidEvent(e,t,n)?this.extendEvent(e):null},n.onEventEnd=function(){},n.onRelease=function(){this.prevEvent=null},n.getTouches=function(e,t){return t&&this._isValidButton(at[e.which],t)&&-1===this.end.indexOf(e.type)?1:0},n._getScale=function(){return 1},n._getCenter=function(e){return{x:e.clientX,y:e.clientY}},n._getMovement=function(e){var t=this.prevEvent.srcEvent;return{x:e.clientX-t.clientX,y:e.clientY-t.clientY}},t}(Lt),Ft=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=["touchstart"],t.move=["touchmove"],t.end=["touchend","touchcancel"],t}Qe(t,e);var n=t.prototype;return n.onEventStart=function(e,t){return this._baseTouches=e.touches,this._isValidEvent(e,t)?this.extendEvent(e):null},n.onEventMove=function(e,t){return this._isValidEvent(e,t)?this.extendEvent(e):null},n.onEventEnd=function(e){this._baseTouches=e.touches},n.onRelease=function(){this.prevEvent=null,this._baseTouches=null},n.getTouches=function(e){return e.touches.length},n._getScale=function(e){return 2!==e.touches.length||this._baseTouches.length<2?null:this._getDistance(e.touches[0],e.touches[1])/this._getDistance(this._baseTouches[0],this._baseTouches[1])},n._getCenter=function(e){return{x:e.touches[0].clientX,y:e.touches[0].clientY}},n._getMovement=function(e){var t=this.prevEvent.srcEvent;return e.touches[0].identifier!==t.touches[0].identifier?{x:0,y:0}:{x:e.touches[0].clientX-t.touches[0].clientX,y:e.touches[0].clientY-t.touches[0].clientY}},t}(Lt),Vt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=Mt?["pointerdown"]:["MSPointerDown"],t.move=Mt?["pointermove"]:["MSPointerMove"],t.end=Mt?["pointerup","pointercancel"]:["MSPointerUp","MSPointerCancel"],t._firstInputs=[],t._recentInputs=[],t}Qe(t,e);var n=t.prototype;return n.onEventStart=function(e,t,n){var i=this._getButton(e);return this._isValidEvent(e,t,n)?(this._preventMouseButton(e,i),this._updatePointerEvent(e),this.extendEvent(e)):null},n.onEventMove=function(e,t,n){return this._isValidEvent(e,t,n)?(this._updatePointerEvent(e),this.extendEvent(e)):null},n.onEventEnd=function(e){this._removePointerEvent(e)},n.onRelease=function(){this.prevEvent=null,this._firstInputs=[],this._recentInputs=[]},n.getTouches=function(){return this._recentInputs.length},n._getScale=function(){return 2!==this._recentInputs.length?null:this._getDistance(this._recentInputs[0],this._recentInputs[1])/this._getDistance(this._firstInputs[0],this._firstInputs[1])},n._getCenter=function(e){return{x:e.clientX,y:e.clientY}},n._getMovement=function(e){var t=this.prevEvent.srcEvent;return e.pointerId!==t.pointerId?{x:0,y:0}:{x:e.clientX-t.clientX,y:e.clientY-t.clientY}},n._updatePointerEvent=function(e){var t=this,n=!1;this._recentInputs.forEach(function(i,r){i.pointerId===e.pointerId&&(n=!0,t._recentInputs[r]=e)}),n||(this._firstInputs.push(e),this._recentInputs.push(e))},n._removePointerEvent=function(e){this._firstInputs=this._firstInputs.filter(function(t){return t.pointerId!==e.pointerId}),this._recentInputs=this._recentInputs.filter(function(t){return t.pointerId!==e.pointerId})},t}(Lt),jt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=["mousedown","touchstart"],t.move=["mousemove","touchmove"],t.end=["mouseup","touchend","touchcancel"],t}Qe(t,e);var n=t.prototype;return n.onEventStart=function(e,t,n){var i=this._getButton(e);return this._isTouchEvent(e)&&(this._baseTouches=e.touches),this._isValidEvent(e,t,n)?(this._preventMouseButton(e,i),this.extendEvent(e)):null},n.onEventMove=function(e,t,n){return this._isValidEvent(e,t,n)?this.extendEvent(e):null},n.onEventEnd=function(e){this._isTouchEvent(e)&&(this._baseTouches=e.touches)},n.onRelease=function(){this.prevEvent=null,this._baseTouches=null},n.getTouches=function(e,t){return this._isTouchEvent(e)?e.touches.length:this._isValidButton(at[e.which],t)&&-1===this.end.indexOf(e.type)?1:0},n._getScale=function(e){return this._isTouchEvent(e)?2!==e.touches.length||this._baseTouches.length<2?1:this._getDistance(e.touches[0],e.touches[1])/this._getDistance(this._baseTouches[0],this._baseTouches[1]):this.prevEvent.scale},n._getCenter=function(e){return this._isTouchEvent(e)?{x:e.touches[0].clientX,y:e.touches[0].clientY}:{x:e.clientX,y:e.clientY}},n._getMovement=function(e){var t=this,n=[e,this.prevEvent.srcEvent].map(function(e){return t._isTouchEvent(e)?{id:e.touches[0].identifier,x:e.touches[0].clientX,y:e.touches[0].clientY}:{id:null,x:e.clientX,y:e.clientY}}),i=n[0],r=n[1];return i.id===r.id?{x:i.x-r.x,y:i.y-r.y}:{x:0,y:0}},t}(Lt),Bt=function(e,t){return t.reduce(function(t,n,i){return e[i]&&(t[e[i]]=n),t},{})},Gt=function(e){void 0===e&&(e=[]);var t=!1,n=!1,i=!1;return e.forEach(function(e){switch(e){case"mouse":n=!0;break;case"touch":t=Dt;break;case"pointer":i=zt}}),i?new Vt:t&&n?new jt:t?new Ft:n?new Ht:null};function Wt(e){return e.indexOf("touch")>-1&&{passive:!1}}var Xt=function(){function e(e){var t=e.options,n=e.interruptManager,i=e.eventManager,r=e.axisManager,s=e.animationManager;this._isOutside=!1,this._moveDistance=null,this._isStopped=!1,this.options=t,this._interruptManager=n,this._eventManager=i,this._axisManager=r,this._animationManager=s}var t=e.prototype;return t.get=function(e){return this._axisManager.get(e.axes)},t.hold=function(e,t){if(!this._interruptManager.isInterrupted()&&e.axes.length){var n={input:e,event:t};this._isStopped=!1,this._interruptManager.setInterrupt(!0),this._animationManager.stopAnimation(n),++this._eventManager.holdingCount,this._moveDistance||this._eventManager.hold(this._axisManager.get(),n),this._isOutside=this._axisManager.isOutside(e.axes),this._moveDistance=this._axisManager.get(e.axes)}},t.change=function(e,t,n,i){if(!this._isStopped&&this._interruptManager.isInterrupting()&&!this._axisManager.every(n,function(e){return 0===e})){var r=t.srcEvent?t.srcEvent:t;if(!r.__childrenAxesAlreadyChanged){var s,o=this._moveDistance||this._axisManager.get(e.axes);s=vt(o,function(e,t){return e+(n[t]||0)}),this._moveDistance&&(this._moveDistance=this._axisManager.map(s,function(e,t){var n=t.circular,i=t.range;return n&&(n[0]||n[1])?kt(e,i,n):e})),this._isOutside&&this._axisManager.every(o,function(e,t){return!St(e,t.range)})&&(this._isOutside=!1),o=this._atOutside(o),s=this._atOutside(s),this.options.nested&&this._isEndofAxis(n,o,s)||(r.__childrenAxesAlreadyChanged=!0);var a={input:e,event:t};if(i){var l=this._animationManager.getDuration(s,o);this._animationManager.animateTo(s,l,a)}else{!this._eventManager.triggerChange(s,o,a,!0)&&(this._isStopped=!0,this._moveDistance=null,this._animationManager.finish(!1))}}}},t.release=function(e,t,n,i){if(!this._isStopped&&this._interruptManager.isInterrupting()&&this._moveDistance){var r=t.srcEvent?t.srcEvent:t;r.__childrenAxesAlreadyReleased&&(n=n.map(function(){return 0}));var s=this._axisManager.get(e.axes),o=this._axisManager.get(),a=this._animationManager.getDisplacement(n),l=Bt(e.axes,a),h=this._axisManager.get(this._axisManager.map(l,function(e,t,n){return t.circular&&(t.circular[0]||t.circular[1])?s[n]+e:At(s[n]+e,t.range,t.circular,t.bounce)}));r.__childrenAxesAlreadyReleased=!0;var c=this._animationManager.getDuration(h,s,i);0===c&&(h=et({},o));var u={depaPos:o,destPos:h,duration:c,delta:this._axisManager.getDelta(o,h),inputEvent:t,input:e,isTrusted:!0};--this._eventManager.holdingCount,this._eventManager.triggerRelease(u),0===this._eventManager.holdingCount&&(this._moveDistance=null);var d=this._animationManager.getUserControl(u),g=xt(d.destPos,o),_={input:e,event:t};g||0===d.duration?(g||this._eventManager.triggerChange(d.destPos,o,_,!0),this._interruptManager.setInterrupt(!1),this._axisManager.isOutside()?this._animationManager.restore(_):this._eventManager.triggerFinish(!0)):this._animationManager.animateTo(d.destPos,d.duration,_)}},t._atOutside=function(e){var t=this;return this._isOutside?this._axisManager.map(e,function(e,t){var n=t.range[0]-t.bounce[0],i=t.range[1]+t.bounce[1];return e>i?i:e<n?n:e}):this._axisManager.map(e,function(e,n){var i=n.range[0],r=n.range[1],s=n.bounce,o=n.circular;return o[0]&&e<i||o[1]&&e>r?e:e<i?i-t._animationManager.interpolate(i-e,s[0]):e>r?r+t._animationManager.interpolate(e-r,s[1]):e})},t._isEndofAxis=function(e,t,n){return this._axisManager.every(t,function(i,r,s){return 0===e[s]||t[s]===n[s]&&(o=i,a=r.range,l=r.bounce,!(h=r.circular)[0]&&o===a[0]-l[0]||!h[1]&&o===a[1]+l[1]);var o,a,l,h})},e}(),Ut=function(e,t,n){return Math.max(Math.min(e,n),t)},Yt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._useDuration=!0,t}Qe(t,e);var n=t.prototype;return n.interpolate=function(e,t){var n=this._easing(1e-5)/1e-5;return this._easing(e/(t*n))*t},n.updateAnimation=function(e){var t,n=this._animateParam;if(n){var i=(new Date).getTime()-n.startTime,r=(null==e?void 0:e.destPos)||n.destPos,s=null!==(t=null==e?void 0:e.duration)&&void 0!==t?t:n.duration;if((null==e?void 0:e.restart)||s<=i)this.setTo(r,s-i);else{if(null==e?void 0:e.destPos){var o=this.axisManager.get();this._initialEasingPer=this._prevEasingPer,n.delta=this.axisManager.getDelta(o,r),n.destPos=r}if(null==e?void 0:e.duration){var a=(i+this._durationOffset)/n.duration;this._durationOffset=a*s-i,n.duration=s}}}},n._initState=function(e){return this._initialEasingPer=0,this._prevEasingPer=0,this._durationOffset=0,{pos:e.depaPos,easingPer:0,finished:!1}},n._getNextState=function(e){var t=this,n=this._animateParam,i=e.pos,r=n.destPos,s=vt(i,function(e,t){return e<=r[t]?1:-1}),o=((new Date).getTime()-n.startTime+this._durationOffset)/n.duration,a=this._easing(o),l=this.axisManager.map(i,function(e,l,h){var c=o>=1?r[h]:e+n.delta[h]*(a-t._prevEasingPer)/(1-t._initialEasingPer),u=kt(c,l.range,l.circular);if(c!==u){var d=s[h]*(l.range[1]-l.range[0]);r[h]-=d,i[h]-=d}return u});return this._prevEasingPer=a,{pos:l,easingPer:a,finished:a>=1}},n._easing=function(e){return e>1?1:this._options.easing(e)},t}(function(){function e(e){var t=e.options,n=e.interruptManager,i=e.eventManager,r=e.axisManager;this._options=t,this.interruptManager=n,this.eventManager=i,this.axisManager=r,this.animationEnd=this.animationEnd.bind(this)}var t=e.prototype;return t.getDuration=function(e,t,n){var i,r=this;if(void 0!==n)i=n;el