@egjs/flicking
Advanced tools
Comparing version 3.8.0 to 3.8.1
@@ -0,1 +1,2 @@ | ||
import type { OnChange, OnFinish, OnHold } from "@egjs/axes"; | ||
import State from "./State"; | ||
@@ -7,6 +8,6 @@ import { FlickingContext } from "../types"; | ||
readonly playing = true; | ||
onHold(e: any, { viewport, triggerEvent, transitTo }: FlickingContext): void; | ||
onChange(e: any, { moveCamera, transitTo }: FlickingContext): void; | ||
onFinish(e: any, { flicking, viewport, triggerEvent, transitTo }: FlickingContext): void; | ||
onHold(e: OnHold, { viewport, triggerEvent, transitTo }: FlickingContext): void; | ||
onChange(e: OnChange, { moveCamera, transitTo }: FlickingContext): void; | ||
onFinish(e: OnFinish, { flicking, viewport, triggerEvent, transitTo }: FlickingContext): void; | ||
} | ||
export default AnimatingState; |
@@ -0,1 +1,2 @@ | ||
import type { OnAnimationEnd, OnChange, OnRelease } from "@egjs/axes"; | ||
import State from "./State"; | ||
@@ -7,6 +8,6 @@ import { FlickingContext } from "../types"; | ||
readonly playing = true; | ||
onAnimationEnd(e: any, { transitTo }: FlickingContext): void; | ||
onChange(e: any, { viewport, transitTo }: FlickingContext): void; | ||
onRelease(e: any, { transitTo }: FlickingContext): void; | ||
onAnimationEnd(e: OnAnimationEnd, { transitTo }: FlickingContext): void; | ||
onChange(e: OnChange, { viewport, transitTo }: FlickingContext): void; | ||
onRelease(e: OnRelease, { transitTo }: FlickingContext): void; | ||
} | ||
export default DisabledState; |
@@ -0,1 +1,2 @@ | ||
import type { OnChange, OnRelease } from "@egjs/axes"; | ||
import State from "./State"; | ||
@@ -7,5 +8,5 @@ import { FlickingContext } from "../types"; | ||
readonly playing = true; | ||
onChange(e: any, { moveCamera, transitTo }: FlickingContext): void; | ||
onRelease(e: any, context: FlickingContext): void; | ||
onChange(e: OnChange, { moveCamera, transitTo }: FlickingContext): void; | ||
onRelease(e: OnRelease, context: FlickingContext): void; | ||
} | ||
export default DraggingState; |
@@ -0,1 +1,2 @@ | ||
import type { OnChange, OnRelease, OnFinish } from "@egjs/axes"; | ||
import State from "./State"; | ||
@@ -8,6 +9,6 @@ import { FlickingContext } from "../types"; | ||
private releaseEvent; | ||
onChange(e: any, context: FlickingContext): void; | ||
onRelease(e: any, context: FlickingContext): void; | ||
onFinish(e: any, { viewport, triggerEvent, transitTo }: FlickingContext): void; | ||
onChange(e: OnChange, context: FlickingContext): void; | ||
onRelease(e: OnRelease, context: FlickingContext): void; | ||
onFinish(e: OnFinish, { viewport, triggerEvent, transitTo }: FlickingContext): void; | ||
} | ||
export default HoldingState; |
@@ -0,1 +1,2 @@ | ||
import type { OnHold, OnChange } from "@egjs/axes"; | ||
import State from "./State"; | ||
@@ -8,5 +9,5 @@ import { FlickingContext } from "../types"; | ||
onEnter(): void; | ||
onHold(e: any, { flicking, viewport, triggerEvent, transitTo }: FlickingContext): void; | ||
onChange(e: any, context: FlickingContext): void; | ||
onHold(e: OnHold, { flicking, viewport, triggerEvent, transitTo }: FlickingContext): void; | ||
onChange(e: OnChange, context: FlickingContext): void; | ||
} | ||
export default IdleState; |
@@ -0,1 +1,2 @@ | ||
import type { OnAnimationEnd, OnChange, OnFinish, OnHold, OnRelease } from "@egjs/axes"; | ||
import Panel from "../components/Panel"; | ||
@@ -13,8 +14,8 @@ import { ValueOf, Direction, StateType, FlickingContext } from "../types"; | ||
onExit(nextState: State): void; | ||
onHold(e: any, context: FlickingContext): void; | ||
onChange(e: any, context: FlickingContext): void; | ||
onRelease(e: any, context: FlickingContext): void; | ||
onAnimationEnd(e: any, context: FlickingContext): void; | ||
onFinish(e: any, context: FlickingContext): void; | ||
onHold(e: OnHold, context: FlickingContext): void; | ||
onChange(e: OnChange, context: FlickingContext): void; | ||
onRelease(e: OnRelease, context: FlickingContext): void; | ||
onAnimationEnd(e: OnAnimationEnd, context: FlickingContext): void; | ||
onFinish(e: OnFinish, context: FlickingContext): void; | ||
} | ||
export default State; |
@@ -8,2 +8,3 @@ import Flicking from "./Flicking"; | ||
import { DiffResult } from "@egjs/list-differ"; | ||
import { OnRelease } from "@egjs/axes"; | ||
export declare type ValueOf<T> = T[keyof T]; | ||
@@ -48,14 +49,3 @@ export declare type ElementLike = string | HTMLElement; | ||
viewport: Viewport; | ||
axesEvent: { | ||
delta: { | ||
flick: number; | ||
}; | ||
depaPos: { | ||
flick: number; | ||
}; | ||
destPos: { | ||
flick: number; | ||
}; | ||
duration: number; | ||
}; | ||
axesEvent: OnRelease; | ||
state: State; | ||
@@ -62,0 +52,0 @@ swipeDistance: number; |
@@ -7,5 +7,5 @@ /* | ||
repository: https://github.com/naver/egjs-flicking | ||
version: 3.8.0 | ||
version: 3.8.1 | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("@egjs/component"),require("@egjs/imready"),require("@egjs/axes")):"function"==typeof define&&define.amd?define(["@egjs/component","@egjs/imready","@egjs/axes"],t):((e=e||self).eg=e.eg||{},e.eg.Flicking=t(e.eg.Component,e.ImReady,e.eg.Axes))}(this,function(e,n,i){"use strict";var r=function(e,t){return(r=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 o(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function p(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var i=Array(e),r=0,t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,r++)i[r]=o[a];return i}var s={SNAP:"snap",FREE_SCROLL:"freeScroll"},a={snap:{type:"snap",count:1},freeScroll:{type:"freeScroll"}},l="undefined"!=typeof document,u={classPrefix:"eg-flick",deceleration:.0075,horizontal:!0,circular:!1,infinite:!1,infiniteThreshold:0,lastIndex:1/0,threshold:40,duration:100,panelEffect:function(e){return 1-Math.pow(1-e,3)},defaultIndex:0,inputType:["touch","mouse"],thresholdAngle:45,bounce:10,autoResize:!1,adaptive:!1,zIndex:2e3,bound:!1,overflow:!1,hanger:"50%",anchor:"50%",gap:0,moveType:a.snap,useOffset:!1,isEqualSize:!1,isConstantSize:!1,renderOnlyVisible:!1,renderExternal:!1,resizeOnContentsReady:!1,iOSEdgeSwipeThreshold:30,collectStatistics:!0},h={position:"relative",zIndex:u.zIndex,overflow:"hidden"},c={width:"100%",height:"100%",willChange:"transform"},g={position:"absolute"},P={HOLD_START:"holdStart",HOLD_END:"holdEnd",MOVE_START:"moveStart",MOVE:"move",MOVE_END:"moveEnd",CHANGE:"change",RESTORE:"restore",SELECT:"select",NEED_PANEL:"needPanel",VISIBLE_CHANGE:"visibleChange",CONTENT_ERROR:"contentError"},f={HOLD:"hold",CHANGE:"change",RELEASE:"release",ANIMATION_END:"animationEnd",FINISH:"finish"},d=0,v=1,m=2,x=3,E=4,b={PREV:"PREV",NEXT:"NEXT"},t={prev:!0,next:!0,moveTo:!0,getIndex:!0,getAllPanels:!0,getCurrentPanel:!0,getElement:!0,getSize:!0,getPanel:!0,getPanelCount:!0,getStatus:!0,getVisiblePanels:!0,enableInput:!0,disableInput:!0,destroy:!0,resize:!0,setStatus:!0,isPlaying:!0},C=function(){var e={webkitTransform:"-webkit-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",OTransform:"-o-transform",transform:"transform"};if(!l)return{name:e.transform,has3d:!0};var t,n=document.documentElement.style,i="";for(t in e)t in n&&(i=t);if(!i)throw new Error("Browser doesn't support CSS3 2D Transforms.");var r=document.createElement("div");document.documentElement.insertBefore(r,null),r.style[i]="translate3d(1px, 1px, 1px)";e=window.getComputedStyle(r).getPropertyValue(e[i]);r.parentElement.removeChild(r);var o={name:i,has3d:0<e.length&&"none"!==e};return C=function(){return o},o},S=C();function y(i){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];return e.forEach(function(n){Object.keys(n).forEach(function(e){var t=n[e];i[e]=t})}),i}function I(e){Array.isArray(e)||(e=[e]);var n=[];return e.forEach(function(e){if(A(e)){var t=document.createElement("div");for(t.innerHTML=e,n.push.apply(n,R(t.children));t.firstChild;)t.removeChild(t.firstChild)}else n.push(e)}),n}function A(e){return"string"==typeof e}function w(e,t){return e.classList?e.classList.contains(t):0<=e.className.split(" ").indexOf(t)}function M(t,n){Object.keys(n).forEach(function(e){t.style[e]=n[e]})}function z(e,t,n){return Math.max(Math.min(e,n),t)}function T(e,t,n){return t<=e&&e<=n}function R(e){return[].slice.call(e)}function N(e,t,n){var i=null!=n?n:t/2,r=/(?:(\+|\-)\s*)?(\d+(?:\.\d+)?(%|px)?)/g;if("number"==typeof e)return z(e,0,t);for(var o=0,a=0,s=r.exec(e);null!=s;){var l=s[1],h=s[2],c=s[3],h=parseFloat(h);if(!(l=o<=0?l||"+":l))return i;"%"===c&&(h=h/100*t),a+="+"===l?h:-h,++o,s=r.exec(e)}return 0===o?i:z(a,0,t)}function O(e,t){var n=t[0],i=t[1],t=t[2];return i<e&&t-i?(e-i)/(t-i):e<i&&i-n?(e-i)/(i-n):e!==i&&t-n?(e-n)/(t-n):0}function k(e,t){for(var n=0;n<e.length;n+=1){var i=e[n];if(i&&t(i))return n}return-1}function B(e){for(var t=[],n=0;n<e;n+=1)t[n]=n;return t}function V(e,t,n,i){var r=i?n-t+1:n-t;return e<t?e=n-(i?(t-e-1)%r:(t-e)%r):n<e&&(e=t+(i?(e-n-1)%r:(e-n)%r)),e}function H(e,t){t.className?e.setAttribute("class",t.className):e.removeAttribute("class"),t.style?e.setAttribute("style",t.style):e.removeAttribute("style")}function L(e,t){return t?{x:0,y:0,width:e.offsetWidth,height:e.offsetHeight}:{x:(e=e.getBoundingClientRect()).left,y:e.top,width:e.width,height:e.height}}var D=function(){function o(e,t,n){this.viewport=n,this.prevSibling=null,this.nextSibling=null,this.clonedPanels=[],this.state={index:t,position:0,relativeAnchorPosition:0,size:0,isClone:!1,isVirtual:!1,cloneIndex:-1,originalStyle:{className:"",style:""},cachedBbox:null},this.setElement(e)}var e=o.prototype;return e.resize=function(e){var t=this.state,n=this.viewport.options,i=e||this.getBbox();this.state.cachedBbox=i;e=t.size;t.size=n.horizontal?i.width:i.height,e!==t.size&&(t.relativeAnchorPosition=N(n.anchor,t.size)),t.isClone||this.clonedPanels.forEach(function(e){e=e.state;e.size=t.size,e.cachedBbox=t.cachedBbox,e.relativeAnchorPosition=t.relativeAnchorPosition})},e.unCacheBbox=function(){this.state.cachedBbox=null},e.getProgress=function(){var e=this.viewport,t=e.options,n=e.panelManager.getPanelCount(),i=e.getScrollAreaSize();return(t.circular?Math.floor(this.getPosition()/i)*n:0)+this.getIndex()-e.getCurrentProgress()},e.getOutsetProgress=function(){var e=this.viewport,t=[-this.getSize(),e.getRelativeHangerPosition()-this.getRelativeAnchorPosition(),e.getSize()];return O(this.getPosition()-e.getCameraPosition(),t)},e.getVisibleRatio=function(){var e=this.viewport,t=this.getSize(),n=this.getPosition()-e.getCameraPosition(),i=n+t,n=Math.min(e.getSize(),i)-Math.max(n,0);return 0<=n?n/t:0},e.focus=function(e){var t=this.viewport,n=t.getCurrentPanel();t.getHangerPosition()!==this.getAnchorPosition()&&n&&(n=n.getPosition()===this.getPosition()?"":P.CHANGE,t.moveTo(this,t.findEstimatedPosition(this),n,null,e))},e.update=function(t,e){void 0===t&&(t=null),void 0===e&&(e=!0);var n=this.getIdenticalPanels();t&&n.forEach(function(e){t(e.getElement())}),e&&(n.forEach(function(e){e.unCacheBbox()}),this.viewport.addVisiblePanel(this),this.viewport.resize())},e.prev=function(){var e=this.viewport.options,t=this.prevSibling;if(!t)return null;var n=this.getIndex(),i=this.getPosition(),r=t.getIndex(),o=t.getPosition(),a=t.getSize(),s=1<n-r,r=e.infinite&&0<n&&n<r;if(s||r)return null;a=i-a-e.gap,e=t;return o!==a&&(e=t.clone(t.getCloneIndex(),!0)).setPosition(a),e},e.next=function(){var e=this.viewport,t=e.options,n=this.nextSibling,i=e.panelManager.getLastIndex();if(!n)return null;var r=this.getIndex(),o=this.getPosition(),a=n.getIndex(),s=n.getPosition(),e=1<a-r,r=t.infinite&&r<i&&a<r;if(e||r)return null;o=o+this.getSize()+t.gap,t=n;return s!==o&&(t=n.clone(n.getCloneIndex(),!0)).setPosition(o),t},e.insertBefore=function(e){var t=this.viewport,n=I(e),i=t.panelManager.firstPanel(),e=this.prevSibling,e=e&&i.getIndex()!==this.getIndex()?Math.max(e.getIndex()+1,this.getIndex()-n.length):Math.max(this.getIndex()-n.length,0);return t.insert(e,n)},e.insertAfter=function(e){return this.viewport.insert(this.getIndex()+1,e)},e.remove=function(){return this.viewport.remove(this.getIndex()),this},e.destroy=function(e){for(var t in e.preserveUI||(e=this.state.originalStyle,H(this.element,e)),this)this[t]=null},e.getElement=function(){return this.element},e.getAnchorPosition=function(){return this.state.position+this.state.relativeAnchorPosition},e.getRelativeAnchorPosition=function(){return this.state.relativeAnchorPosition},e.getIndex=function(){return this.state.index},e.getPosition=function(){return this.state.position},e.getSize=function(){return this.state.size},e.getBbox=function(){var e,t,n=this.state,i=this.viewport,r=this.element,o=i.options;return r?n.cachedBbox||(e=Boolean(r.parentNode),t=i.getCameraElement(),e||(t.appendChild(r),i.addVisiblePanel(this)),n.cachedBbox=L(r,o.useOffset),!e&&i.options.renderExternal&&t.removeChild(r)):n.cachedBbox={x:0,y:0,width:0,height:0},n.cachedBbox},e.isClone=function(){return this.state.isClone},e.getOverlappedClass=function(e){for(var t=this.element,n=0,i=e;n<i.length;n++){var r=i[n];if(w(t,r))return r}},e.getCloneIndex=function(){return this.state.cloneIndex},e.getClonedPanels=function(){return this.state.isClone?this.original.getClonedPanels():this.clonedPanels},e.getIdenticalPanels=function(){return this.state.isClone?this.original.getIdenticalPanels():p([this],this.clonedPanels)},e.getOriginalPanel=function(){return this.state.isClone?this.original:this},e.setIndex=function(t){this.state.index=t,this.clonedPanels.forEach(function(e){return e.state.index=t})},e.setPosition=function(e){return this.state.position=e,this},e.setPositionCSS=function(e){var t,n,i,r,o;void 0===e&&(e=0),this.element&&(n=(t=this.state).position,i=this.viewport.options,r=this.element.style,o=i.horizontal?r.left:r.top,e=n-e+"px",t.isVirtual||o===e||(i.horizontal?r.left=e:r.top=e))},e.clone=function(e,t,n){void 0===t&&(t=!1);var i=this.state,r=this.viewport,n=n,n=new o(n=!n&&this.element?t?this.element:this.element.cloneNode(!0):n,i.index,r),r=n.state;return n.original=i.isClone?this.original:this,r.isClone=!0,r.isVirtual=t,r.cloneIndex=e,r.size=i.size,r.relativeAnchorPosition=i.relativeAnchorPosition,r.originalStyle=i.originalStyle,r.cachedBbox=i.cachedBbox,t?(n.prevSibling=this.prevSibling,n.nextSibling=this.nextSibling):this.clonedPanels.push(n),n},e.removeElement=function(){var e;this.viewport.options.renderExternal||(e=this.element).parentNode&&e.parentNode.removeChild(e),this.state.isClone||this.removeClonedPanelsAfter(0)},e.removeClonedPanelsAfter=function(e){var t=this.viewport.options,e=this.clonedPanels.splice(e);t.renderExternal||e.forEach(function(e){e.removeElement()})},e.setElement=function(e){var t,n;!e||e!==(t=this.element)&&(n=this.viewport.options,t?n.horizontal?e.style.left=t.style.left:e.style.top=t.style.top:((t=this.state.originalStyle).className=e.getAttribute("class"),t.style=e.getAttribute("style")),this.element=e,n.classPrefix&&(e=e,n=n.classPrefix+"-panel",e.classList?e.classList.add(n):w(e,n)||(e.className=(e.className+" "+n).replace(/\s{2,}/g," "))),M(this.element,g))},o}(),_=function(){function e(e,t){this.cameraElement=e,this.panels=[],this.clones=[],this.range={min:-1,max:-1},this.length=0,this.cloneCount=0,this.options=t,this.lastIndex=t.lastIndex}var t=e.prototype;return t.firstPanel=function(){return this.panels[this.range.min]},t.lastPanel=function(){return this.panels[this.range.max]},t.allPanels=function(){return p(this.panels,this.clones.reduce(function(e,t){return p(e,t)},[]))},t.originalPanels=function(){return this.panels},t.clonedPanels=function(){return this.clones},t.replacePanels=function(e,t){this.panels=e,this.clones=t,this.range={min:k(e,function(e){return Boolean(e)}),max:e.length-1},this.length=e.filter(function(e){return Boolean(e)}).length},t.has=function(e){return!!this.panels[e]},t.get=function(e){return this.panels[e]},t.getPanelCount=function(){return this.length},t.getLastIndex=function(){return this.lastIndex},t.getRange=function(){return this.range},t.getCloneCount=function(){return this.cloneCount},t.setLastIndex=function(e){this.lastIndex=e;var t=this.firstPanel(),n=this.lastPanel();t&&n&&(t=this.range,n.getIndex()>e&&(n=this.panels.splice(e+1),this.length-=n.length,(e=n.filter(function(e){return!!e})[0].prevSibling)?t.max=e.getIndex():(t.min=-1,t.max=-1),this.shouldRender()&&n.forEach(function(e){return e.removeElement()})))},t.setCloneCount=function(e){this.cloneCount=e},t.insert=function(n,e){var i=this.panels,t=this.range,r=this.options.circular,o=this.lastIndex,a=this.findFirstPanelFrom(n),s=this.firstPanel(),s=a?a.getElement():r&&s?s.getClonedPanels()[0].getElement():null;this.insertNewPanels(e,s);var l,h=e.length;return n>t.max?e.forEach(function(e,t){i[n+t]=e}):((t=k(s=i.slice(n,n+e.length),function(e){return e}))<0&&(t=s.length),h=e.length-t,i.splice.apply(i,p([n,t],e)),i.length>o+1&&(s=i.splice(o+1).filter(function(e){return Boolean(e)}),this.length-=s.length,t=o-k(this.panels.concat().reverse(),function(e){return e}),this.panels.splice(1+t),this.range.max=t,this.shouldRender()&&s.forEach(function(e){return e.removeElement()}))),0<h&&i.slice(n+e.length).forEach(function(e){e.setIndex(e.getIndex()+h)}),this.length+=e.length,this.updateIndex(n),r&&(this.addNewClones(n,e,e.length-h,a),a=this.clones,l=this.panels.length,a[0]&&a[0].length>o+1&&a.forEach(function(e){e.splice(l)})),h},t.replace=function(e,t){var n=this.panels,i=this.range,r=this.options.circular,o=this.findFirstPanelFrom(e+t.length),a=this.firstPanel(),a=o?o.getElement():r&&a?a.getClonedPanels()[0].getElement():null;this.insertNewPanels(t,a),e>i.max&&(n[e]=null);i=n.splice.apply(n,p([e,t.length],t)),n=i.filter(function(e){return Boolean(e)}).length;return this.length+=t.length-n,this.updateIndex(e),r&&this.addNewClones(e,t,t.length,o),this.shouldRender()&&i.forEach(function(e){return e&&e.removeElement()}),i},t.remove=function(t,n){void 0===n&&(n=1);var e=this.options.circular,i=this.panels,r=this.clones;n=Math.max(n,0);var o=i.splice(t,n).filter(function(e){return!!e});this.shouldRender()&&o.forEach(function(e){return e.removeElement()}),e&&r.forEach(function(e){e.splice(t,n)}),i.slice(t).forEach(function(e){e.setIndex(e.getIndex()-n)});var a,s=i.length-1;return i[s]||(a=k(i.concat().reverse(),function(e){return e}),s=a<0?-1:s-a,i.splice(s+1),e&&r.forEach(function(e){e.splice(s+1)})),this.range={min:k(i,function(e){return e}),max:s},this.length-=o.length,this.length<=0&&(this.clones=[],this.cloneCount=0),o},t.chainAllPanels=function(){var e,t,i=this.allPanels().filter(function(e){return!!e}),n=i.length;n<=1||(i.slice(1,i.length-1).forEach(function(e,t){var n=i[t],t=i[t+2];e.prevSibling=n,e.nextSibling=t}),e=i[0],t=i[n-1],e.prevSibling=null,e.nextSibling=i[1],t.prevSibling=i[n-2],t.nextSibling=null,this.options.circular&&((e.prevSibling=t).nextSibling=e))},t.insertClones=function(e,n,t,i){void 0===i&&(i=0);var r,o,a=this.clones,s=this.lastIndex;a[e]?(r=a[e],n>=r.length?t.forEach(function(e,t){r[n+t]=e}):(r.splice.apply(r,p([n,i],t)),t.length>s+1&&t.splice(s+1))):(o=[],t.forEach(function(e,t){o[n+t]=e}),a[e]=o)},t.removeClonesAfter=function(t){this.panels.forEach(function(e){e.removeClonedPanelsAfter(t)}),this.clones.splice(t)},t.findPanelOf=function(e){for(var t=0,n=this.allPanels();t<n.length;t++){var i=n[t];if(i)if(i.getElement().contains(e))return i}},t.findFirstPanelFrom=function(e){for(var t=0,n=this.panels.slice(e);t<n.length;t++){var i=n[t];if(i&&i.getIndex()>=e&&i.getElement().parentNode)return i}},t.addNewClones=function(r,o,a,e){for(var s=this,l=this.cameraElement,t=this.getCloneCount(),n=this.lastPanel(),h=n?n.getClonedPanels():[],c=e?e.getClonedPanels():[],u=this,i=0,g=B(t);i<g.length;i++)!function(t){var e=c[t],n=h[t],i=e?e.getElement():n?n.getElement().nextElementSibling:null,n=o.map(function(e){e=e.clone(t);return s.shouldRender()&&l.insertBefore(e.getElement(),i),e});u.insertClones(t,r,n,a)}(g[i])},t.updateIndex=function(e){var t=this.panels,n=this.range,t=t.length-1;t>n.max&&(n.max=t),(e<n.min||n.min<0)&&(n.min=e)},t.insertNewPanels=function(e,t){var n;this.shouldRender()&&(n=document.createDocumentFragment(),e.forEach(function(e){return n.appendChild(e.getElement())}),this.cameraElement.insertBefore(n,t))},t.shouldRender=function(){var e=this.options;return!e.renderExternal&&!e.renderOnlyVisible},e}(),F=function(){function e(){this.delta=0,this.direction=null,this.targetPanel=null,this.lastPosition=0}var t=e.prototype;return t.onEnter=function(e){this.delta=e.delta,this.direction=e.direction,this.targetPanel=e.targetPanel,this.lastPosition=e.lastPosition},t.onExit=function(e){},t.onHold=function(e,t){},t.onChange=function(e,t){},t.onRelease=function(e,t){},t.onAnimationEnd=function(e,t){},t.onFinish=function(e,t){},e}(),G=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=d,e.holding=!1,e.playing=!1,e}o(e,t);var n=e.prototype;return n.onEnter=function(){this.direction=null,this.targetPanel=null,this.delta=0,this.lastPosition=0},n.onHold=function(e,t){var n=t.flicking,i=t.viewport,r=t.triggerEvent,o=t.transitTo;if(n.getPanelCount()<=0)return i.options.infinite&&i.moveCamera(i.getCameraPosition(),e),void o(E);this.lastPosition=i.getCameraPosition(),r(P.HOLD_START,e,!0).onSuccess(function(){o(v)}).onStopped(function(){o(E)})},n.onChange=function(e,t){var n=t.triggerEvent,i=t.transitTo;n(P.MOVE_START,e,!1).onSuccess(function(){i(x).onChange(e,t)}).onStopped(function(){i(E)})},e}(F),X=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=v,e.holding=!0,e.playing=!0,e.releaseEvent=null,e}o(e,t);var n=e.prototype;return n.onChange=function(e,t){var n=t.flicking,i=t.triggerEvent,r=t.transitTo,n=n.options.horizontal?e.inputEvent.offsetX:e.inputEvent.offsetY;this.direction=n<0?b.NEXT:b.PREV,i(P.MOVE_START,e,!0).onSuccess(function(){r(m).onChange(e,t)}).onStopped(function(){r(E)})},n.onRelease=function(e,t){var n=t.viewport,i=t.triggerEvent,t=t.transitTo;if(i(P.HOLD_END,e,!0),0!==e.delta.flick)return e.setTo({flick:n.getCameraPosition()},0),void t(d);this.releaseEvent=e},n.onFinish=function(e,t){var n,i,r,o=t.viewport,a=t.triggerEvent;(0,t.transitTo)(d),this.releaseEvent&&(t="touchend"===(r=(n=this.releaseEvent).inputEvent.srcEvent).type?(i=r.changedTouches[0],document.elementFromPoint(i.clientX,i.clientY)):r.target,i=o.panelManager.findPanelOf(t),r=o.getCameraPosition(),i&&(o=i.getPosition(),a(P.SELECT,n,!0,{direction:r<o?b.NEXT:o<r?b.PREV:null,index:i.getIndex(),panel:i,element:t})))},e}(F),j=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=m,e.holding=!0,e.playing=!0,e}o(e,t);var n=e.prototype;return n.onChange=function(e,t){var n=t.moveCamera,i=t.transitTo;e.delta.flick&&n(e).onStopped(function(){i(E)})},n.onRelease=function(e,t){var n=t.flicking,i=t.viewport,r=t.triggerEvent,o=t.transitTo,a=t.stopCamera,s=this.delta,l=Math.abs(s),h=n.options,c=h.horizontal,u=i.moveType,g=e.inputEvent,t=c?g.velocityX:g.velocityY,n=c?g.deltaX:g.deltaY,s=1<Math.abs(t)?t<0:0<l?0<s:n<0,l=i.options.bound?Math.max(l,Math.abs(n)):l,g=g.deltaX?Math.abs(180*Math.atan(g.deltaY/g.deltaX)/Math.PI):90,g=c?g<=h.thresholdAngle:g>h.thresholdAngle,g=l>=h.threshold&&g,s={viewport:i,axesEvent:e,state:this,swipeDistance:l,isNextDirection:s};r(P.HOLD_END,e,!0);r=this.targetPanel;if(!g&&r){var f=u.findPanelWhenInterrupted(s);return i.moveTo(f.panel,f.destPos,f.eventType,e,f.duration),void o(x)}r=i.getCurrentPanel(),f=i.getNearestPanel();if(!r||!f)return e.stop(),void o(d);s=g?u.findTargetPanel(s):u.findRestorePanel(s);i.moveTo(s.panel,s.destPos,s.eventType,e,s.duration).onSuccess(function(){o(x)}).onStopped(function(){o(E),a(e)})},e}(F),q=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=x,e.holding=!1,e.playing=!0,e}o(e,t);var n=e.prototype;return n.onHold=function(e,t){var n=t.viewport,i=t.triggerEvent,r=t.transitTo,o=n.options,a=n.getScrollArea(),s=n.getScrollAreaSize(),l=Math.floor((this.lastPosition+this.delta-a.prev)/s),t=this.targetPanel;o.circular&&0!==l&&t&&(a=n.panelManager.getCloneCount(),o=t.getPosition(),a=V(t.getCloneIndex()-l,-1,a-1,!0),s=o-l*s,(a=t.getIdenticalPanels()[a+1].clone(a,!0)).setPosition(s),this.targetPanel=a),this.delta=0,this.lastPosition=n.getCameraPosition(),n.setCurrentPanel(n.getNearestPanel()),i(P.HOLD_START,e,!0).onSuccess(function(){r(m)}).onStopped(function(){r(E)})},n.onChange=function(e,t){var n=t.moveCamera,i=t.transitTo;e.delta.flick&&n(e).onStopped(function(){i(E)})},n.onFinish=function(e,t){var n=t.flicking,i=t.viewport,r=t.triggerEvent,o=t.transitTo,t=e&&e.isTrusted;i.options.bound?i.setCurrentPanel(this.targetPanel):i.setCurrentPanel(i.getNearestPanel()),n.options.adaptive&&i.updateAdaptiveSize(),o(d),i.updateCameraPosition(),r(P.MOVE_END,e,t,{direction:this.direction})},e}(F),Y=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=E,e.holding=!1,e.playing=!0,e}o(e,t);var n=e.prototype;return n.onAnimationEnd=function(e,t){(0,t.transitTo)(d)},n.onChange=function(e,t){var n=t.viewport,t=t.transitTo;e.stop(),n.updateAxesPosition(n.getCameraPosition()),t(d)},n.onRelease=function(e,t){t=t.transitTo;0===e.delta.flick&&t(d)},e}(F),U=function(){function e(){var i=this;this.state=new G,this.transitTo=function(e){var t=i.state;if(t.type!==e){var n=void 0;switch(e){case d:n=new G;break;case v:n=new X;break;case m:n=new j;break;case x:n=new q;break;case E:n=new Y}t.onExit(n),n.onEnter(t),i.state=n}return i.state}}var t=e.prototype;return t.fire=function(e,t,n){var i=this.state;switch(e){case f.HOLD:i.onHold(t,n);break;case f.CHANGE:i.onChange(t,n);break;case f.RELEASE:i.onRelease(t,n);break;case f.ANIMATION_END:i.onAnimationEnd(t,n);break;case f.FINISH:i.onFinish(t,n)}},t.getState=function(){return this.state},e}(),W=function(n){function e(e){var t=n.call(this)||this;return t.type=s.SNAP,t.count=e,t}o(e,n);var t=e.prototype;return t.findTargetPanel=function(e){var t=e.viewport,n=e.axesEvent,i=e.swipeDistance,r=this.count,o=Math.abs(n.delta.flick),a=t.getCurrentPanel(),s=t.getNearestPanel(),l=this.calcBrinkOfChange(e),n=s.getIndex()===a.getIndex(),a=t.canSetBoundMode()&&n,a=!t.isOutOfBound()&&(i<=l||a);return 1<r&&l<o?this.findSnappedPanel(e):a?this.findAdjacentPanel(e):{panel:s,duration:t.options.duration,destPos:t.findEstimatedPosition(s),eventType:i<=l||t.isOutOfBound()&&n?P.RESTORE:P.CHANGE}},t.findSnappedPanel=function(e){for(var t=e.axesEvent,n=e.viewport,i=e.state,r=e.isNextDirection,o=Math.abs(t.delta.flick),a=this.calcBrinkOfChange(e),s=this.count,e=n.options,l=n.getScrollAreaSize(),h=e.gap/2,c=t.destPos.flick+n.getRelativeHangerPosition(),u=n.getNearestPanel(),g=u.getCloneIndex()+1,f=0;f<s;){var d=u.getOriginalPanel(),p=d.getPosition()+g*l,v=d.getSize();if(r&&c<p+v+h||!r&&p-h<c)break;d=r?u.nextSibling:u.prevSibling;if(!d)break;v=u.getIndex(),p=d.getIndex();(r&&p<=v||!r&&v<=p)&&(g=r?g+1:g-1),u=d,f+=1}e=u.getOriginalPanel().getPosition();0!==g&&(u=u.clone(u.getCloneIndex(),!0)).setPosition(e+g*l);e=n.options.duration,e=z(t.duration,e,e*f);return{panel:u,destPos:n.findEstimatedPosition(u),duration:e,eventType:Math.max(o,i.delta)>a?P.CHANGE:P.RESTORE}},t.findAdjacentPanel=function(e){var t=e.viewport,n=e.isNextDirection,i=t.options,r=t.getCurrentIndex(),o=t.panelManager.get(r),a=t.getHangerPosition(),s=t.getScrollArea(),l=o.getIdenticalPanels()[1],e=i.circular&&Math.abs(o.getAnchorPosition()-a)>Math.abs(l.getAnchorPosition()-a)?l:o,r=e.getPosition(),a=n?e.nextSibling:e.prevSibling,l=a?P.CHANGE:P.RESTORE,o=a||e,a=o.getRelativeAnchorPosition(),a=(i.circular?n?r+e.getSize()+a+i.gap:r-(o.getSize()-a)-i.gap:o.getAnchorPosition())-t.getRelativeHangerPosition();return{panel:o,destPos:t.canSetBoundMode()?z(a,s.prev,s.next):a,duration:i.duration,eventType:l}},e}(function(){function e(){}var t=e.prototype;return t.is=function(e){return e===this.type},t.findRestorePanel=function(e){var t=e.viewport,n=t.options,e=n.circular?this.findRestorePanelInCircularMode(e):t.getCurrentPanel();return{panel:e,destPos:t.findEstimatedPosition(e),duration:n.duration,eventType:P.RESTORE}},t.findPanelWhenInterrupted=function(e){var t=e.state,e=e.viewport,t=t.targetPanel;return{panel:t,destPos:e.findEstimatedPosition(t),duration:e.options.duration,eventType:""}},t.calcBrinkOfChange=function(e){var t=e.viewport,n=e.isNextDirection,i=t.options,r=t.getCurrentPanel(),e=i.gap/2,t=r.getRelativeAnchorPosition(),e=n?r.getSize()-t+e:t+e;return e=Math.max(e,i.threshold)},t.findRestorePanelInCircularMode=function(e){var t=e.viewport,n=t.getCurrentPanel().getOriginalPanel(),i=t.getHangerPosition(),t=n.getIdenticalPanels()[1],i=Math.abs(n.getAnchorPosition()-i)>Math.abs(t.getAnchorPosition()-i);return!e.isNextDirection&&i?t:n},e}()),J=function(h){function e(){var e=h.call(this,1/0)||this;return e.type=s.FREE_SCROLL,e}o(e,h);var t=e.prototype;return t.findTargetPanel=function(e){var t=e.axesEvent,n=e.state,i=e.viewport,r=t.destPos.flick,o=this.calcBrinkOfChange(e),a=i.getScrollArea(),s=i.getCurrentPanel(),l=i.options;if(o<Math.abs(t.delta.flick+n.delta)){e=h.prototype.findSnappedPanel.call(this,e);return e.duration=t.duration,e.destPos=r,e.eventType=l.circular||e.panel!==s?P.CHANGE:"",e}l=z(l=l.circular?V(r,a.prev,a.next,!1):r,a.prev,a.next);return l+=i.getRelativeHangerPosition(),{panel:i.findNearestPanelAt(l),destPos:r,duration:t.duration,eventType:""}},t.findRestorePanel=function(e){return this.findTargetPanel(e)},t.findPanelWhenInterrupted=function(e){e=e.viewport;return{panel:e.getNearestPanel(),destPos:e.getCameraPosition(),duration:0,eventType:""}},t.calcBrinkOfChange=function(e){var t=e.viewport,n=e.isNextDirection,i=t.options,r=t.getCurrentPanel(),o=i.gap/2,e=t.stateMachine.getState().lastPosition,i=r.getPosition(),e=e+t.getRelativeHangerPosition(),t=t.getScrollAreaSize(),o=n?i+r.getSize()-e+o:e-i+o,o=Math.abs(o%t);return Math.min(o,t-o)},e}(W),K=function(){function e(e,t,n){var i=this;this.plugins=[],this.stopCamera=function(e){e&&e.setTo&&e.setTo({flick:i.state.position},0),i.stateMachine.transitTo(d)},this.flicking=e,this.triggerEvent=n,this.state={size:0,position:0,panelMaintainRatio:0,relativeHangerPosition:0,positionOffset:0,scrollArea:{prev:0,next:0},translate:S,infiniteThreshold:0,checkedIndexes:[],isAdaptiveCached:!1,isViewportGiven:!1,isCameraGiven:!1,originalViewportStyle:{className:null,style:null},originalCameraStyle:{className:null,style:null},cachedBbox:null},this.options=t,this.stateMachine=new U,this.visiblePanels=[],this.panelBboxes={},this.build()}var t=e.prototype;return t.moveTo=function(e,t,n,i,r){var o=this;void 0===r&&(r=this.options.duration);var a=this.state,s=this.stateMachine.getState(),l=a.position,h=!!i&&i.isTrusted,a=t===l?null:l<t?b.NEXT:b.PREV,h=n===P.CHANGE?this.triggerEvent(P.CHANGE,i,h,{index:e.getIndex(),panel:e,direction:a}):n===P.RESTORE?this.triggerEvent(P.RESTORE,i,h):{onSuccess:function(e){return e(),this},onStopped:function(){return this}};return h.onSuccess(function(){s.delta=0,s.lastPosition=o.getCameraPosition(),s.targetPanel=e,s.direction=t===l?null:l<t?b.NEXT:b.PREV,t===l&&(o.nearestPanel=e,o.currentPanel=e),(i&&i.setTo?i:o.axes).setTo({flick:t},r)}),h},t.moveCamera=function(e,t){var n=this.state,i=this.options,r=n.translate.name,o=n.scrollArea;i.circular&&!T(e,o.prev,o.next)&&(e=V(e,o.prev,o.next,!1)),n.position=e,this.nearestPanel=this.findNearestPanel();var a,s,l,h=this.nearestPanel,c=h?h.getPosition():0;h?(a=this.getHangerPosition(),s=h.getPosition(),l=h.getSize(),o=i.gap/2,n.panelMaintainRatio=(a-s+o)/(l+2*o)):n.panelMaintainRatio=0,this.checkNeedPanel(t),e+=(h?h.getPosition():0)-c,n.position=e,this.updateVisiblePanels();c=i.renderOnlyVisible?n.positionOffset:0,c=(i.horizontal?[-(e-c),0]:[0,-(e-c)]).map(function(e){return Math.round(e)+"px"}).join(", ");this.cameraElement.style[r]=n.translate.has3d?"translate3d("+c+", 0px)":"translate("+c+")"},t.unCacheBbox=function(){var e=this.state,t=this.options;e.cachedBbox=null,this.visiblePanels=[];var n=this.viewportElement;t.horizontal?n.style.height="":n.style.width="",e.isAdaptiveCached=!1,this.panelBboxes={}},t.resize=function(){this.updateSize(),this.updateOriginalPanelPositions(),this.updateAdaptiveSize(),this.updateScrollArea(),this.updateClonePanels(),this.updateVisiblePanelPositions(),this.updateCameraPosition(),this.updatePlugins()},t.findNearestPanel=function(){var e=this.state,t=this.panelManager,n=this.getHangerPosition();return this.isOutOfBound()?e.position<=e.scrollArea.prev?t.firstPanel():t.lastPanel():this.findNearestPanelAt(n)},t.findNearestPanelAt=function(e){for(var t,n=1/0,i=0,r=this.panelManager.allPanels();i<r.length;i++){var o=r[i];if(o){var a=o.getPosition(),s=a+o.getSize(),s=T(e,a,s)?0:Math.min(Math.abs(a-e),Math.abs(s-e));if(n<s)break;if(s===n&&Math.abs(e-t.getAnchorPosition())<Math.abs(e-o.getAnchorPosition()))break;n=s,t=o}}return t},t.findNearestIdenticalPanel=function(e){var n=e,i=1/0,r=this.getHangerPosition();return e.getIdenticalPanels().forEach(function(e){var t=e.getAnchorPosition(),t=Math.abs(t-r);t<i&&(n=e,i=t)}),n},t.findShortestPositionToPanel=function(e){var t=this.state,n=this.options,i=e.getAnchorPosition(),r=this.getHangerPosition(),o=Math.abs(r-i),e=t.scrollArea.next-t.scrollArea.prev;if(n.circular)return o<=e-o?i-t.relativeHangerPosition:r<i?i-t.relativeHangerPosition-e:i-t.relativeHangerPosition+e;i-=t.relativeHangerPosition;return this.canSetBoundMode()?z(i,t.scrollArea.prev,t.scrollArea.next):i},t.findEstimatedPosition=function(e){var t=this.getScrollArea(),e=e.getAnchorPosition()-this.getRelativeHangerPosition();return e=this.canSetBoundMode()?z(e,t.prev,t.next):e},t.addVisiblePanel=function(e){this.getVisibleIndexOf(e)<0&&this.visiblePanels.push(e)},t.enable=function(){this.panInput||this.createPanInput()},t.disable=function(){this.panInput&&(this.panInput.destroy(),this.panInput=null,this.stateMachine.transitTo(d))},t.insert=function(i,e){var n=this,t=this.panelManager.getLastIndex();if(i<0||t<i)return[];var r=this.state,o=this.options,a=I(e).map(function(e,t){return new D(e,i+t,n)}).slice(0,t-i+1);if(a.length<=0)return[];var s=this.panelManager.insert(i,a);return this.resizePanels(a),this.currentPanel||(this.currentPanel=a[0],this.nearestPanel=a[0],e=a[0],t=this.findEstimatedPosition(e),r.position=t,this.updateAxesPosition(t),r.panelMaintainRatio=(e.getRelativeAnchorPosition()+o.gap/2)/(e.getSize()+o.gap)),this.updateCheckedIndexes({min:i,max:i}),r.checkedIndexes.forEach(function(e,t){var n=e[0],e=e[1];i<n&&r.checkedIndexes.splice(t,1,[n+s,e+s])}),this.resize(),a},t.replace=function(n,e){var i=this,t=this.state,r=this.options,o=this.panelManager,a=o.getLastIndex();if(n<0||a<n)return[];var s=I(e).map(function(e,t){return new D(e,n+t,i)}).slice(0,a-n+1);if(s.length<=0)return[];o.replace(n,s).forEach(function(e){e=i.getVisibleIndexOf(e);-1<e&&i.visiblePanels.splice(e,1)}),this.resizePanels(s);var l=this.currentPanel;return!l?(this.currentPanel=s[0],this.nearestPanel=s[0],e=s[0],a=this.findEstimatedPosition(e),t.position=a,this.updateAxesPosition(a),t.panelMaintainRatio=(e.getRelativeAnchorPosition()+r.gap/2)/(e.getSize()+r.gap)):T(l.getIndex(),n,n+s.length-1)&&(this.currentPanel=o.get(l.getIndex())),this.updateCheckedIndexes({min:n,max:n+s.length-1}),this.resize(),s},t.remove=function(e,t){void 0===t&&(t=1);var n=this.state;e=Math.max(e,0);var i=this.panelManager,r=this.getCurrentIndex(),o=i.remove(e,t);T(r,e,e+t-1)&&(r=Math.max(e-1,i.getRange().min),this.currentPanel=i.get(r)),0<t&&(this.updateCheckedIndexes({min:e-1,max:e+t}),this.visiblePanels=[]),i.getPanelCount()<=0&&(this.currentPanel=void 0,this.nearestPanel=void 0),this.resize();i=n.scrollArea;return(n.position<i.prev||n.position>i.next)&&(i=V(n.position,i.prev,i.next,!1),this.moveCamera(i),this.updateAxesPosition(i)),o},t.updateAdaptiveSize=function(){var e,t,n,i=this.state,r=this.options,o=r.horizontal,a=this.getCurrentPanel();a&&(t=r.adaptive||!i.isAdaptiveCached,e=this.viewportElement.style,t&&(t=void 0,t=r.adaptive?(a=a.getBbox(),o?a.height:a.width):this.panelManager.originalPanels().reduce(function(e,t){t=t.getBbox();return Math.max(e,o?t.height:t.width)},0),i.isAdaptiveCached||(n=this.updateBbox(),t=Math.max(t,o?n.height:n.width),i.isAdaptiveCached=!0),n=t+"px",o?(e.height=n,i.cachedBbox.height=t):(e.width=n,i.cachedBbox.width=t)))},t.updateCameraPosition=function(){var e=this.state,t=this.getCurrentPanel(),n=this.getCameraPosition(),i=this.stateMachine.getState(),r=this.moveType.is(s.FREE_SCROLL),o=this.getRelativeHangerPosition(),a=this.options.gap/2;i.holding||i.playing?this.updateVisiblePanels():(n=r?(i=this.canSetBoundMode()&&(n===e.scrollArea.prev||n===e.scrollArea.next),r=this.getNearestPanel(),i||!r?n:r.getPosition()-a+(r.getSize()+2*a)*e.panelMaintainRatio-o):t?t.getAnchorPosition()-o:n,this.canSetBoundMode()&&(n=z(n,e.scrollArea.prev,e.scrollArea.next)),this.updateAxesPosition(n),this.moveCamera(n))},t.updateBbox=function(){var e=this.state,t=this.options,n=this.viewportElement;return e.cachedBbox||(e.cachedBbox=L(n,t.useOffset)),e.cachedBbox},t.updatePlugins=function(){var t=this;this.plugins.forEach(function(e){e.update&&e.update(t.flicking)})},t.destroy=function(t){var n,e,i,r=this.state,o=this.flicking.getElement(),a=this.viewportElement,s=this.cameraElement,l=this.panelManager.originalPanels();for(i in this.removePlugins(this.plugins),t.preserveUI||(H(a,r.originalViewportStyle),H(s,r.originalCameraStyle),r.isCameraGiven||this.options.renderExternal||(n=r.isViewportGiven?a:o,e=r.isViewportGiven?s:a,l.forEach(function(e){n.appendChild(e.getElement())}),n.removeChild(e))),this.axes.destroy(),null!==(e=this.panInput)&&void 0!==e&&e.destroy(),l.forEach(function(e){e.destroy(t)}),this)this[i]=null},t.restore=function(e){var t=e.panels,n=this.options.defaultIndex,i=this.cameraElement,r=this.panelManager;i.innerHTML=t.map(function(e){return e.html}).join(""),this.refreshPanels();var o=r.originalPanels(),a=[];t.forEach(function(e,t){t=o[t];t.setIndex(e.index),t.setPosition(e.position),a[e.index]=t}),r.replacePanels(a,[]),r.setCloneCount(0);t=r.getPanelCount();this.currentPanel=0<t?r.get(e.index)||r.get(n)||r.firstPanel():void 0,this.visiblePanels=a.filter(function(e){return Boolean(e)}),this.resize(),this.axes.setTo({flick:e.position},0),this.moveCamera(e.position)},t.calcVisiblePanels=function(){var e=this.panelManager.allPanels();if(this.options.renderOnlyVisible){var t=this.getCameraPosition(),n=this.getSize(),i=this.nearestPanel,r=function(e,t,n){for(var i=[],r=e;;){var o=t(r);if(!o||n(o))break;i.push(o),r=o}return i},o=this.panelManager.getPanelCount(),a=function(e){return e.getIndex()+(e.getCloneIndex()+1)*o};return p([i],r(i,function(e){var t=e.nextSibling;return t&&t.getPosition()>=e.getPosition()?t:null},function(e){return e.getPosition()>=t+n}),r(i,function(e){var t=e.prevSibling;return t&&t.getPosition()<=e.getPosition()?t:null},function(e){return e.getPosition()+e.getSize()<=t})).sort(function(e,t){return a(e)-a(t)})}return e.filter(function(e){e=e.getOutsetProgress();return-1<e&&e<1})},t.getCurrentPanel=function(){return this.currentPanel},t.getCurrentIndex=function(){var e=this.currentPanel;return e?e.getIndex():-1},t.getNearestPanel=function(){return this.nearestPanel},t.getCurrentProgress=function(){var e=this.stateMachine.getState(),t=e.playing||e.holding?this.nearestPanel:this.currentPanel,n=this.panelManager;if(!t)return NaN;var i=this.getScrollArea(),r=i.prev,o=i.next,a=this.getCameraPosition(),s=this.isOutOfBound(),l=t.prevSibling,h=t.nextSibling,e=this.getHangerPosition(),i=t.getAnchorPosition();s&&l&&h&&a<o&&e-l.getAnchorPosition()<i-e&&(h=(t=l).nextSibling,l=t.prevSibling,i=t.getAnchorPosition());n=t.getIndex()+(t.getCloneIndex()+1)*n.getPanelCount(),t=t.getSize();s&&(o+(c=this.getRelativeHangerPosition())<i?e=i+e-c-o:i<r+c&&(e=i+e-c-r));var s=i<=e,o=this.options.gap,c=i,r=i;s?r=h?h.getAnchorPosition():i+t+o:c=l?l.getAnchorPosition():i-t-o;c=(e-c)/(r-c);return(s?n:l?l.getIndex():n-1)+c},t.updateAxesPosition=function(e){var t=this.axes;t.off(),t.setTo({flick:e},0),t.on(this.axesHandlers)},t.getSize=function(){return this.state.size},t.getScrollArea=function(){return this.state.scrollArea},t.isOutOfBound=function(){var e=this.state,t=this.options,n=e.scrollArea;return!t.circular&&t.bound&&(e.position<=n.prev||e.position>=n.next)},t.canSetBoundMode=function(){var e=this.options;return e.bound&&!e.circular},t.getViewportElement=function(){return this.viewportElement},t.getCameraElement=function(){return this.cameraElement},t.getScrollAreaSize=function(){var e=this.state.scrollArea;return e.next-e.prev},t.getRelativeHangerPosition=function(){return this.state.relativeHangerPosition},t.getHangerPosition=function(){return this.state.position+this.state.relativeHangerPosition},t.getCameraPosition=function(){return this.state.position},t.getPositionOffset=function(){return this.state.positionOffset},t.getCheckedIndexes=function(){return this.state.checkedIndexes},t.getVisiblePanels=function(){return this.visiblePanels},t.setCurrentPanel=function(e){this.currentPanel=e},t.setLastIndex=function(e){var t=this.currentPanel,n=this.panelManager;n.setLastIndex(e),t&&t.getIndex()>e&&(this.currentPanel=n.lastPanel()),this.resize()},t.setVisiblePanels=function(e){this.visiblePanels=e},t.connectAxesHandler=function(e){var t=this.axes;this.axesHandlers=e,t.on(e)},t.addPlugins=function(e){var t=this,e=[].concat(e);return e.forEach(function(e){e.init(t.flicking)}),this.plugins=this.plugins.concat(e),this},t.removePlugins=function(e){var n=this,i=this.plugins;return[].concat(e).forEach(function(e){var t=i.indexOf(e);-1<t&&i.splice(t,1),e.destroy(n.flicking)}),this},t.updateCheckedIndexes=function(i){var r=this.state,o=0;r.checkedIndexes.concat().forEach(function(e,t){var n=e[0],e=e[1];i.min<=e&&i.max>=n&&(r.checkedIndexes.splice(t-o,1),o++)})},t.appendUncachedPanelElements=function(e){var t,n,i,r=this,o=this.options,a=document.createDocumentFragment();o.isEqualSize?(t=this.visiblePanels,n=o.isEqualSize,i={},this.visiblePanels=[],Object.keys(this.panelBboxes).forEach(function(e){i[e]=!0}),e.forEach(function(e){var t=e.getOverlappedClass(n);t&&!i[t]?(o.renderExternal||a.appendChild(e.getElement()),r.visiblePanels.push(e),i[t]=!0):t||(o.renderExternal||a.appendChild(e.getElement()),r.visiblePanels.push(e))}),t.forEach(function(e){r.addVisiblePanel(e)})):(o.renderExternal||e.forEach(function(e){return a.appendChild(e.getElement())}),this.visiblePanels=e.filter(function(e){return Boolean(e)})),o.renderExternal||this.cameraElement.appendChild(a)},t.updateClonePanels=function(){var e=this.panelManager;this.options.circular&&0<e.getPanelCount()&&(this.clonePanels(),this.updateClonedPanelPositions()),e.chainAllPanels()},t.getVisibleIndexOf=function(t){return k(this.visiblePanels,function(e){return e===t})},t.build=function(){this.setElements(),this.applyCSSValue(),this.setMoveType(),this.setAxesInstance(),this.refreshPanels(),this.setDefaultPanel(),this.resize(),this.moveToDefaultPanel()},t.setElements=function(){var e=this.state,t=this.options,n=this.flicking.getElement(),i=t.classPrefix,r=n.children[0],o=r&&w(r,i+"-viewport"),a=o?r:document.createElement("div"),t=(o?a:n).children[0],r=t&&w(t,i+"-camera"),s=r?t:document.createElement("div");r?e.originalCameraStyle={className:s.getAttribute("class"),style:s.getAttribute("style")}:(s.className=i+"-camera",R((o?a:n).children).forEach(function(e){s.appendChild(e)})),o?e.originalViewportStyle={className:a.getAttribute("class"),style:a.getAttribute("style")}:(a.className=i+"-viewport",n.appendChild(a)),r&&o||a.appendChild(s),this.viewportElement=a,this.cameraElement=s,e.isViewportGiven=o,e.isCameraGiven=r},t.applyCSSValue=function(){var e=this.options,t=this.viewportElement,n=this.cameraElement,i=this.viewportElement.style;M(t,h),M(n,c),t.style.zIndex=""+e.zIndex,e.horizontal?(i.minHeight="100%",i.width="100%"):(i.minWidth="100%",i.height="100%"),e.overflow&&(i.overflow="visible"),this.panelManager=new _(this.cameraElement,e)},t.setMoveType=function(){var e=this.options.moveType;switch(e.type){case s.SNAP:this.moveType=new W(e.count);break;case s.FREE_SCROLL:this.moveType=new J;break;default:throw new Error("moveType is not correct!")}},t.setAxesInstance=function(){var e=this.state,t=this.options,e=e.scrollArea;this.axes=new i({flick:{range:[e.prev,e.next],circular:t.circular,bounce:[0,0]}},{easing:t.panelEffect,deceleration:t.deceleration,interruptable:!0}),this.createPanInput()},t.refreshPanels=function(){var n=this,e=this.panelManager,t=R(this.cameraElement.children).map(function(e,t){return new D(e,t,n)});e.replacePanels(t,[]),this.visiblePanels=t.filter(function(e){return Boolean(e)})},t.setDefaultPanel=function(){var e=this.options,t=this.panelManager,n=this.panelManager.getRange(),n=z(e.defaultIndex,n.min,n.max);this.currentPanel=t.get(n)},t.clonePanels=function(){var e=this.state,t=this.options,r=this.panelManager,n=t.gap,i=e.size,o=r.firstPanel(),a=r.lastPanel();if(o){for(var s,l=r.originalPanels(),h=l.concat().reverse(),c=a.getPosition()+a.getSize()-o.getPosition()+n,e=o.getRelativeAnchorPosition(),a=this.getRelativeHangerPosition(),u=(a-e)%c,g=0,f=0,d=h;f<d.length;f++){var p=d[f];if(p&&u<=(g+=p.getSize()+n)){s=p;break}}for(var v,P=(i-a+e)%c,g=0,m=0,x=l;m<x.length;m++){p=x[m];if(p&&P<=(g+=p.getSize()+n)){v=p;break}}var h=0!==s.getIndex()&&s.getIndex()<=v.getIndex(),E=Math.ceil((a+o.getSize()-e)/c)+Math.ceil((i-a+e)/c)-1+(h?1:0),h=r.getCloneCount();if(r.setCloneCount(E),!t.renderExternal)if(h<E)for(var C=this,S=h;S<E;S++)!function(t){var e,n=l.map(function(e){return e.clone(t)}),i=document.createDocumentFragment();n.forEach(function(e){return i.appendChild(e.getElement())}),C.cameraElement.appendChild(i),(e=C.visiblePanels).push.apply(e,n.filter(function(e){return Boolean(e)})),r.insertClones(t,0,n)}(S);else E<h&&r.removeClonesAfter(E)}},t.moveToDefaultPanel=function(){var e=this.state,t=this.panelManager,n=this.options,i=this.panelManager.getRange(),i=z(n.defaultIndex,i.min,i.max),t=t.get(i),i=0;t&&(i=t.getAnchorPosition()-e.relativeHangerPosition,i=this.canSetBoundMode()?z(i,e.scrollArea.prev,e.scrollArea.next):i),this.moveCamera(i),this.axes.setTo({flick:i},0)},t.updateSize=function(){var e=this.state,t=this.options,n=this.panelManager.originalPanels().filter(function(e){return Boolean(e)}),i=this.updateBbox(),r=e.size;e.size=t.horizontal?i.width:i.height,r!==e.size&&(e.relativeHangerPosition=N(t.hanger,e.size),e.infiniteThreshold=N(t.infiniteThreshold,e.size)),n.length<=0||this.resizePanels(n)},t.updateOriginalPanelPositions=function(){var e,t,n,i,r,o=this.options.gap,a=this.panelManager,s=a.firstPanel(),l=a.originalPanels();s&&(i=this.currentPanel,e=this.nearestPanel,t=this.stateMachine.getState(),n=this.state.scrollArea,r=s.getPosition(),a=s,e?a=!T(t.lastPosition+t.delta,n.prev,n.next)?i:e:0<s.getIndex()&&(a=i),i=l.slice(0,a.getIndex()+(a.getCloneIndex()+1)*l.length).reduce(function(e,t){return e+t.getSize()+o},0),r=a.getPosition()-i,l.forEach(function(e){var t=r,n=e.getSize();e.setPosition(t),r+=n+o}),this.options.renderOnlyVisible||l.forEach(function(e){return e.setPositionCSS()}))},t.updateClonedPanelPositions=function(){var e=this.state,t=this.options,n=this.panelManager,i=n.clonedPanels().reduce(function(e,t){return p(e,t)},[]).filter(function(e){return Boolean(e)}),r=e.scrollArea,e=n.firstPanel(),n=n.lastPanel();if(e){for(var o=n.getPosition()+n.getSize()-e.getPosition()+t.gap,a=0,s=i;a<s.length;a++){var l=(g=s[a]).getOriginalPanel(),l=o*(g.getCloneIndex()+1)+l.getPosition();g.setPosition(l)}for(var h=e.getPosition(),c=0,u=i.concat().reverse();c<u.length;c++){var g,f=(g=u[c]).getSize(),d=h-f-t.gap;if(d+f<=r.prev)break;g.setPosition(d),h=d}this.options.renderOnlyVisible||i.forEach(function(e){e.setPositionCSS()})}},t.updateVisiblePanelPositions=function(){var t=this;this.options.renderOnlyVisible&&this.visiblePanels.forEach(function(e){e.setPositionCSS(t.state.positionOffset)})},t.updateScrollArea=function(){var e,t=this.state,n=this.panelManager,i=this.options,r=this.axes,o=n.firstPanel(),a=n.lastPanel(),s=t.relativeHangerPosition;o?this.canSetBoundMode()?(e=a.getPosition()+a.getSize()-o.getPosition())>=t.size?t.scrollArea={prev:o.getPosition(),next:a.getPosition()+a.getSize()-t.size}:(n=N(i.anchor,e),n=o.getPosition()+z(n,e-(t.size-s),s),t.scrollArea={prev:n-s,next:n-s}):i.circular?(e=a.getPosition()+a.getSize()-o.getPosition()+i.gap,t.scrollArea={prev:o.getAnchorPosition()-s,next:e+o.getAnchorPosition()-s}):t.scrollArea={prev:o.getAnchorPosition()-s,next:a.getAnchorPosition()-s}:t.scrollArea={prev:0,next:0};var l,h=t.size,s=i.bounce;l=(i=s)&&i.constructor===Array?s.map(function(e){return N(e,h,u.bounce)}):[l=N(s,h,u.bounce),l];r=r.axis.flick;r.range=[t.scrollArea.prev,t.scrollArea.next],r.bounce=l},t.checkNeedPanel=function(e){var t=this.state,n=this.options,i=this.panelManager,r=this.currentPanel,o=this.nearestPanel,a=this.stateMachine.getState();if(n.infinite){var s=n.gap,l=t.infiniteThreshold,h=i.getLastIndex();if(!(h<0))if(r&&o){for(var c=o.getPosition(),u=a.holding||a.playing?o:r;u;){var g=u.getIndex(),f=u.nextSibling,f=!(g===(m=i.lastPanel()).getIndex())&&f?f.getIndex():h+1,d=o.getPosition(),p=u.getPosition()+u.getSize()-(d-c)+s-l<=t.position+t.size;1<f-g&&p&&this.triggerNeedPanel({axesEvent:e,siblingPanel:u,direction:b.NEXT,indexRange:{min:g+1,max:f-1,length:f-g-1}}),n.circular&&g===h&&p&&(0<(v=(P=i.firstPanel())?P.getIndex():-1)&&this.triggerNeedPanel({axesEvent:e,siblingPanel:u,direction:b.NEXT,indexRange:{min:0,max:v-1,length:v}}));var v=i.lastPanel();if(v&&g===v.getIndex()||!p)break;u=u.nextSibling}for(u=o;u;){var P,m,x=t.position,E=u.getIndex(),C=u.prevSibling,C=!(E===(P=i.firstPanel()).getIndex())&&C?C.getIndex():-1,d=o.getPosition(),p=x<=u.getPosition()-(d-c)-s+l;1<E-C&&p&&this.triggerNeedPanel({axesEvent:e,siblingPanel:u,direction:b.PREV,indexRange:{min:C+1,max:E-1,length:E-C-1}}),n.circular&&0===E&&p&&(m=i.lastPanel())&&m.getIndex()<h&&(S=m.getIndex(),this.triggerNeedPanel({axesEvent:e,siblingPanel:u,direction:b.PREV,indexRange:{min:S+1,max:h,length:h-S}}));var S=i.firstPanel();if(S&&E===S.getIndex()||!p)break;u=u.prevSibling}}else this.triggerNeedPanel({axesEvent:e,siblingPanel:null,direction:null,indexRange:{min:0,max:h,length:h+1}})}},t.triggerNeedPanel=function(e){var n,i=this,t=e.axesEvent,r=e.siblingPanel,o=e.direction,a=e.indexRange,s=this.options,l=this.state.checkedIndexes,h=l.some(function(e){var t=e[0],e=e[1];return t===a.min||e===a.max}),e=this.flicking.hasOn(P.NEED_PANEL);!h&&e&&(l.push([a.min,a.max]),n=r?r.getIndex():0,l=!!t&&t.isTrusted,this.triggerEvent(P.NEED_PANEL,t,l,{index:n,panel:r,direction:o,range:a,fill:function(e){var t=i.panelManager;if(!r)return i.insert(t.getRange().max+1,e);e=I(e),e=o===b.NEXT?e.slice(0,a.length):e.slice(-a.length);return o===b.NEXT?s.circular&&n===t.getLastIndex()?i.insert(0,e):r.insertAfter(e):o===b.PREV?s.circular&&0===n?i.insert(a.max-e.length+1,e):r.insertBefore(e):i.insert(0,e)}}))},t.updateVisiblePanels=function(){var t=this.state,e=this.options,n=this.panelManager,i=this.stateMachine.getState(),r=this.cameraElement,o=e.renderExternal;if(e.renderOnlyVisible)if(this.nearestPanel){var a,s=this.visiblePanels,l=this.calcVisiblePanels(),h=this.checkVisiblePanelChange(s,l),e=h.addedPanels,s=h.removedPanels;e.length<=0&&s.length<=0||(i.holding?l.push.apply(l,s):(h=l[0].getPosition(),t.positionOffset=h),l.forEach(function(e){e.setPositionCSS(t.positionOffset)}),o||(i.holding||s.forEach(function(e){e=e.getElement();e.parentNode&&r.removeChild(e)}),a=document.createDocumentFragment(),e.forEach(function(e){a.appendChild(e.getElement())}),r.appendChild(a)),i=l[0],s=l[l.length-1],s={min:(e=function(e){return e.getIndex()+(e.getCloneIndex()+1)*n.getPanelCount()})(i),max:e(s)},this.visiblePanels=l,this.flicking.trigger(P.VISIBLE_CHANGE,{type:P.VISIBLE_CHANGE,range:s}))}else for(this.visiblePanels=[];r.firstChild;)r.removeChild(r.firstChild)},t.checkVisiblePanelChange=function(i,r){var o=i.map(function(){return 0}),a=r.map(function(){return 0});return i.forEach(function(n,i){r.forEach(function(e,t){n===e&&(o[i]++,a[t]++)})}),{removedPanels:o.reduce(function(e,t,n){return 0===t?p(e,[i[n]]):e},[]),addedPanels:a.reduce(function(e,t,n){return 0===t?p(e,[r[n]]):e},[])}},t.resizePanels=function(e){var n,t,i=this.options,r=this.panelBboxes;!0!==i.isEqualSize?i.isEqualSize?(n=i.isEqualSize,e.forEach(function(e){var t=e.getOverlappedClass(n);t?(e.resize(r[t]),r[t]=e.getBbox()):e.resize()})):e.forEach(function(e){e.resize()}):(r.default||(i=e[0],r.default=i.getBbox()),t=r.default,e.forEach(function(e){e.resize(t)}))},t.createPanInput=function(){var e=this.options;this.panInput=new i.PanInput(this.viewportElement,{inputType:e.inputType,thresholdAngle:e.thresholdAngle,iOSEdgeSwipeThreshold:e.iOSEdgeSwipeThreshold,scale:e.horizontal?[-1,0]:[0,-1]}),this.axes.connect(e.horizontal?["flick",""]:["","flick"],this.panInput)},e}(),e=function(c){function e(e,t){void 0===t&&(t={});var h=c.call(this)||this;if(h.contentsReadyChecker=null,h.isPanelChangedAtBeforeSync=!1,h.resize=function(){var e=h.viewport,t=h.options,n=h.getElement(),i=e.panelManager.allPanels();t.isConstantSize||i.forEach(function(e){return e.unCacheBbox()});var r=t.renderOnlyVisible&&!t.isConstantSize&&!0!==t.isEqualSize,t=n.parentElement,n=t.style.height;return t.style.height=t.offsetHeight+"px",e.unCacheBbox(),e.updateBbox(),r&&e.appendUncachedPanelElements(i),e.resize(),t.style.height=n,h},h.triggerEvent=function(e,t,n,i){void 0===i&&(i={});var r,o,a,s=h.viewport,l=!0;return s&&(r=s.stateMachine.getState(),o=(a=s.getScrollArea()).prev,a=a.next,a=O(s.getCameraPosition(),[o,o,a]),h.options.circular&&(a%=1),l=!c.prototype.trigger.call(h,e,y({type:e,index:h.getIndex(),panel:h.getCurrentPanel(),direction:r.direction,holding:r.holding,progress:a,axesEvent:t,isTrusted:n},i))),{onSuccess:function(e){return l||e(),this},onStopped:function(e){return l&&e(),this}}},h.moveCamera=function(e){var t,n,i=h.viewport,r=i.stateMachine.getState(),o=h.options,a=e.pos.flick,s=i.getCameraPosition();return e.isTrusted&&r.holding&&(t=o.horizontal?e.inputEvent.offsetX:e.inputEvent.offsetY,n=a-s,t=t<0==a<s,n=0===(n=o.circular&&t?(0<n?-1:1)*(i.getScrollAreaSize()-Math.abs(n)):n)?r.direction:0<n?b.NEXT:b.PREV,r.direction=n),r.delta+=e.delta.flick,i.moveCamera(a,e),h.triggerEvent(P.MOVE,e,e.isTrusted).onStopped(function(){i.moveCamera(s,e)})},A(e)){if(!(n=document.querySelector(e)))throw new Error("Base element doesn't exist.")}else{if(!e.nodeName||1!==e.nodeType)throw new Error("Element should be provided in string or HTMLElement.");n=e}h.wrapper=n,h.options=y({},u,t);var n=h.options,t=n.moveType;return t in a&&(n.moveType=a[t]),h.viewport=new K(h,h.options,h.triggerEvent),h.listenInput(),h.listenResize(),h}o(e,c);var t=e.prototype;return t.prev=function(e){var t=this.getCurrentPanel(),n=this.viewport.stateMachine.getState();return!t||n.type!==d||(t=t.prev())&&t.focus(e),this},t.next=function(e){var t=this.getCurrentPanel(),n=this.viewport.stateMachine.getState();return!t||n.type!==d||(t=t.next())&&t.focus(e),this},t.moveTo=function(e,t){var n=this.viewport,i=n.panelManager.get(e),r=n.stateMachine.getState();if(!i||r.type!==d)return this;var o=i.getAnchorPosition(),a=n.getHangerPosition(),s=i;this.options.circular&&(l=[o-(r=n.getScrollAreaSize()),o,o+r].reduce(function(e,t){return Math.abs(t-a)<Math.abs(e-a)?t:e},1/0)-i.getRelativeAnchorPosition(),r=i.getIdenticalPanels(),0<(o=l-o)?s=r[1]:o<0&&(s=r[r.length-1]),(s=s.clone(s.getCloneIndex(),!0)).setPosition(l));var l=this.getIndex();if(a===s.getAnchorPosition()&&l===e)return this;i=i.getIndex()===n.getCurrentIndex()?"":P.CHANGE;return n.moveTo(s,n.findEstimatedPosition(s),i,null,t),this},t.getIndex=function(){return this.viewport.getCurrentIndex()},t.getElement=function(){return this.wrapper},t.getSize=function(){return this.viewport.getSize()},t.getCurrentPanel=function(){var e=this.viewport.getCurrentPanel();return e||null},t.getPanel=function(e){e=this.viewport.panelManager.get(e);return e||null},t.getAllPanels=function(e){var t=this.viewport.panelManager;return(e?t.allPanels():t.originalPanels()).filter(function(e){return!!e})},t.getVisiblePanels=function(){return this.viewport.calcVisiblePanels()},t.getPanelCount=function(){return this.viewport.panelManager.getPanelCount()},t.getCloneCount=function(){return this.viewport.panelManager.getCloneCount()},t.getLastIndex=function(){return this.viewport.panelManager.getLastIndex()},t.setLastIndex=function(e){return this.viewport.setLastIndex(e),this},t.isPlaying=function(){return this.viewport.stateMachine.getState().playing},t.enableInput=function(){return this.viewport.enable(),this},t.disableInput=function(){return this.viewport.disable(),this},t.getStatus=function(){var e=this.viewport,t=e.panelManager.originalPanels().filter(function(e){return!!e}).map(function(e){return{html:e.getElement().outerHTML,index:e.getIndex(),position:e.getPosition()}});return{index:e.getCurrentIndex(),panels:t,position:e.getCameraPosition()}},t.setStatus=function(e){this.viewport.restore(e)},t.addPlugins=function(e){return this.viewport.addPlugins(e),this},t.removePlugins=function(e){return this.viewport.removePlugins(e),this},t.destroy=function(e){for(var t in void 0===e&&(e={}),this.off(),this.options.autoResize&&window.removeEventListener("resize",this.resize),this.viewport.destroy(e),null!==(e=this.contentsReadyChecker)&&void 0!==e&&e.destroy(),this)this[t]=null},t.prepend=function(e){var t=this.viewport,n=I(e),e=Math.max(t.panelManager.getRange().min-n.length,0),n=t.insert(e,n);return this.checkContentsReady(n),n},t.append=function(e){var t=this.viewport,e=t.insert(t.panelManager.getRange().max+1,e);return this.checkContentsReady(e),e},t.replace=function(e,t){t=this.viewport.replace(e,t);return this.checkContentsReady(t),t},t.remove=function(e,t){return void 0===t&&(t=1),this.viewport.remove(e,t)},t.getRenderingIndexes=function(e){var t=this.viewport,n=t.getVisiblePanels(),i=e.maintained.reduce(function(e,t){var n=t[0];return e[t[1]]=n,e},{}),r=e.list.length,e=e.added,e=p(n.map(function(e){return(e=e).getIndex()+(e.getCloneIndex()+1)*r}).filter(function(e){return null!=i[e%r]}),e),o=t.panelManager.allPanels();return t.setVisiblePanels(e.map(function(e){return o[e]})),e},t.beforeSync=function(e){var t=this,o=e.maintained,a=e.added,n=e.changed,r=e.removed,i=this.viewport,s=i.panelManager,l=this.options.circular,h=s.getCloneCount(),c=s.clonedPanels(),e=i.getVisiblePanels().filter(function(t){return k(r,function(e){return e===t.getIndex()})<0});if(i.setVisiblePanels(e),a.length<=0&&r.length<=0&&n.length<=0&&h===c.length)return this;var u=s.originalPanels(),g=[],f=B(h).map(function(){return[]});o.forEach(function(e){var t=e[0],e=e[1];g[e]=u[t],g[e].setIndex(e)}),a.forEach(function(e){g[e]=new D(null,e,t.viewport)}),l&&B(h).forEach(function(n){var i=c[n],r=f[n];o.forEach(function(e){var t=e[0],e=e[1];r[e]=i?i[t]:g[e].clone(n,!1),r[e].setIndex(e)}),a.forEach(function(e){var t=g[e];r[e]=t.clone(n,!1)})}),a.forEach(function(e){i.updateCheckedIndexes({min:e,max:e})}),r.forEach(function(e){i.updateCheckedIndexes({min:e-1,max:e+1})});var d=i.getCheckedIndexes();d.forEach(function(e,t){var n=e[0],i=e[1],e=a.filter(function(e){return e<n&&s.has(e)}).length-r.filter(function(e){return e<n}).length;d.splice(t,1,[n+e,i+e])}),0<n.length&&o.forEach(function(e){e=e[1];i.updateCheckedIndexes({min:e,max:e})}),s.replacePanels(g,f),this.isPanelChangedAtBeforeSync=!0},t.sync=function(e){var n=e.list,t=e.maintained,i=e.added,r=e.changed,o=e.removed;if(i.length<=0&&o.length<=0&&r.length<=0)return this;var a,s,l=this.viewport,h=this.options,c=h.renderOnlyVisible,u=h.circular,g=l.panelManager;c||(h=g.getRange(),e=e,u&&(a=h.max,s=n.length/(g.getCloneCount()+1)>>0,g=i.filter(function(e){return e<s}),o=o.filter(function(e){return e<=a}),e={added:g,maintained:t.filter(function(e){return e[0]<=a}),removed:o,changed:r.filter(function(e){return e[0]<=a})}),this.beforeSync(e));var f=c?l.getVisiblePanels():this.getAllPanels(!0);return i.forEach(function(e){var t=n[e],e=f[e];e.setElement(t),e.unCacheBbox()}),this.isPanelChangedAtBeforeSync&&(l.setVisiblePanels([]),this.isPanelChangedAtBeforeSync=!1),l.resize(),this},t.listenInput=function(){var n=this,e=n.viewport,i=e.stateMachine;n.eventContext={flicking:n,viewport:n.viewport,transitTo:i.transitTo,triggerEvent:n.triggerEvent,moveCamera:n.moveCamera,stopCamera:e.stopCamera};var r,o={};for(r in f)!function(){var t=f[r];o[t]=function(e){return i.fire(t,e,n.eventContext)}}();n.viewport.connectAxesHandler(o)},t.listenResize=function(){var t=this,e=this.options;e.autoResize&&window.addEventListener("resize",this.resize),e.resizeOnContentsReady&&((e=new n).on("preReady",function(){t.resize()}),e.on("readyElement",function(e){e.hasLoading&&e.isPreReadyOver&&t.resize()}),e.on("error",function(e){t.trigger(P.CONTENT_ERROR,{type:P.CONTENT_ERROR,element:e.element})}),e.check([this.wrapper]),this.contentsReadyChecker=e)},t.checkContentsReady=function(e){var t;null!==(t=this.contentsReadyChecker)&&void 0!==t&&t.check(e.map(function(e){return e.getElement()}))},e.VERSION="3.8.0",e.DIRECTION=b,e.EVENTS=P,e}(e);return e.withFlickingMethods=function(e,r){Object.keys(t).forEach(function(i){e[i]||(e[i]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=(n=this[r])[i].apply(n,e);return n===this[r]?this:n})})},e.DEFAULT_OPTIONS=u,e.MOVE_TYPE=s,e}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("@egjs/component"),require("@egjs/imready"),require("@egjs/axes")):"function"==typeof define&&define.amd?define(["@egjs/component","@egjs/imready","@egjs/axes"],t):((e=e||self).eg=e.eg||{},e.eg.Flicking=t(e.eg.Component,e.eg.ImReady,e.eg.Axes))}(this,function(e,n,i){"use strict";var r=function(e,t){return(r=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 o(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function p(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var i=Array(e),r=0,t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,r++)i[r]=o[a];return i}var s={SNAP:"snap",FREE_SCROLL:"freeScroll"},a={snap:{type:"snap",count:1},freeScroll:{type:"freeScroll"}},l="undefined"!=typeof document,u={classPrefix:"eg-flick",deceleration:.0075,horizontal:!0,circular:!1,infinite:!1,infiniteThreshold:0,lastIndex:1/0,threshold:40,duration:100,panelEffect:function(e){return 1-Math.pow(1-e,3)},defaultIndex:0,inputType:["touch","mouse"],thresholdAngle:45,bounce:10,autoResize:!1,adaptive:!1,zIndex:2e3,bound:!1,overflow:!1,hanger:"50%",anchor:"50%",gap:0,moveType:a.snap,useOffset:!1,isEqualSize:!1,isConstantSize:!1,renderOnlyVisible:!1,renderExternal:!1,resizeOnContentsReady:!1,iOSEdgeSwipeThreshold:30,collectStatistics:!0},h={position:"relative",zIndex:u.zIndex,overflow:"hidden"},c={width:"100%",height:"100%",willChange:"transform"},g={position:"absolute"},P={HOLD_START:"holdStart",HOLD_END:"holdEnd",MOVE_START:"moveStart",MOVE:"move",MOVE_END:"moveEnd",CHANGE:"change",RESTORE:"restore",SELECT:"select",NEED_PANEL:"needPanel",VISIBLE_CHANGE:"visibleChange",CONTENT_ERROR:"contentError"},f={HOLD:"hold",CHANGE:"change",RELEASE:"release",ANIMATION_END:"animationEnd",FINISH:"finish"},d=0,v=1,m=2,x=3,E=4,b={PREV:"PREV",NEXT:"NEXT"},t={prev:!0,next:!0,moveTo:!0,getIndex:!0,getAllPanels:!0,getCurrentPanel:!0,getElement:!0,getSize:!0,getPanel:!0,getPanelCount:!0,getStatus:!0,getVisiblePanels:!0,enableInput:!0,disableInput:!0,destroy:!0,resize:!0,setStatus:!0,isPlaying:!0},C=function(){var e={webkitTransform:"-webkit-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",OTransform:"-o-transform",transform:"transform"};if(!l)return{name:e.transform,has3d:!0};var t,n=document.documentElement.style,i="";for(t in e)t in n&&(i=t);if(!i)throw new Error("Browser doesn't support CSS3 2D Transforms.");var r=document.createElement("div");document.documentElement.insertBefore(r,null),r.style[i]="translate3d(1px, 1px, 1px)";e=window.getComputedStyle(r).getPropertyValue(e[i]);r.parentElement.removeChild(r);var o={name:i,has3d:0<e.length&&"none"!==e};return C=function(){return o},o},S=C();function y(i){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];return e.forEach(function(n){Object.keys(n).forEach(function(e){var t=n[e];i[e]=t})}),i}function I(e){Array.isArray(e)||(e=[e]);var n=[];return e.forEach(function(e){if(A(e)){var t=document.createElement("div");for(t.innerHTML=e,n.push.apply(n,R(t.children));t.firstChild;)t.removeChild(t.firstChild)}else n.push(e)}),n}function A(e){return"string"==typeof e}function w(e,t){return e.classList?e.classList.contains(t):0<=e.className.split(" ").indexOf(t)}function M(t,n){Object.keys(n).forEach(function(e){t.style[e]=n[e]})}function z(e,t,n){return Math.max(Math.min(e,n),t)}function T(e,t,n){return t<=e&&e<=n}function R(e){return[].slice.call(e)}function N(e,t,n){var i=null!=n?n:t/2,r=/(?:(\+|\-)\s*)?(\d+(?:\.\d+)?(%|px)?)/g;if("number"==typeof e)return z(e,0,t);for(var o=0,a=0,s=r.exec(e);null!=s;){var l=s[1],h=s[2],c=s[3],h=parseFloat(h);if(!(l=o<=0?l||"+":l))return i;"%"===c&&(h=h/100*t),a+="+"===l?h:-h,++o,s=r.exec(e)}return 0===o?i:z(a,0,t)}function O(e,t){var n=t[0],i=t[1],t=t[2];return i<e&&t-i?(e-i)/(t-i):e<i&&i-n?(e-i)/(i-n):e!==i&&t-n?(e-n)/(t-n):0}function k(e,t){for(var n=0;n<e.length;n+=1){var i=e[n];if(i&&t(i))return n}return-1}function B(e){for(var t=[],n=0;n<e;n+=1)t[n]=n;return t}function V(e,t,n,i){var r=i?n-t+1:n-t;return e<t?e=n-(i?(t-e-1)%r:(t-e)%r):n<e&&(e=t+(i?(e-n-1)%r:(e-n)%r)),e}function H(e,t){t.className?e.setAttribute("class",t.className):e.removeAttribute("class"),t.style?e.setAttribute("style",t.style):e.removeAttribute("style")}function L(e,t){return t?{x:0,y:0,width:e.offsetWidth,height:e.offsetHeight}:{x:(e=e.getBoundingClientRect()).left,y:e.top,width:e.width,height:e.height}}var D=function(){function o(e,t,n){this.viewport=n,this.prevSibling=null,this.nextSibling=null,this.clonedPanels=[],this.state={index:t,position:0,relativeAnchorPosition:0,size:0,isClone:!1,isVirtual:!1,cloneIndex:-1,originalStyle:{className:"",style:""},cachedBbox:null},this.setElement(e)}var e=o.prototype;return e.resize=function(e){var t=this.state,n=this.viewport.options,i=e||this.getBbox();this.state.cachedBbox=i;e=t.size;t.size=n.horizontal?i.width:i.height,e!==t.size&&(t.relativeAnchorPosition=N(n.anchor,t.size)),t.isClone||this.clonedPanels.forEach(function(e){e=e.state;e.size=t.size,e.cachedBbox=t.cachedBbox,e.relativeAnchorPosition=t.relativeAnchorPosition})},e.unCacheBbox=function(){this.state.cachedBbox=null},e.getProgress=function(){var e=this.viewport,t=e.options,n=e.panelManager.getPanelCount(),i=e.getScrollAreaSize();return(t.circular?Math.floor(this.getPosition()/i)*n:0)+this.getIndex()-e.getCurrentProgress()},e.getOutsetProgress=function(){var e=this.viewport,t=[-this.getSize(),e.getRelativeHangerPosition()-this.getRelativeAnchorPosition(),e.getSize()];return O(this.getPosition()-e.getCameraPosition(),t)},e.getVisibleRatio=function(){var e=this.viewport,t=this.getSize(),n=this.getPosition()-e.getCameraPosition(),i=n+t,n=Math.min(e.getSize(),i)-Math.max(n,0);return 0<=n?n/t:0},e.focus=function(e){var t=this.viewport,n=t.getCurrentPanel();t.getHangerPosition()!==this.getAnchorPosition()&&n&&(n=n.getPosition()===this.getPosition()?"":P.CHANGE,t.moveTo(this,t.findEstimatedPosition(this),n,null,e))},e.update=function(t,e){void 0===t&&(t=null),void 0===e&&(e=!0);var n=this.getIdenticalPanels();t&&n.forEach(function(e){t(e.getElement())}),e&&(n.forEach(function(e){e.unCacheBbox()}),this.viewport.addVisiblePanel(this),this.viewport.resize())},e.prev=function(){var e=this.viewport.options,t=this.prevSibling;if(!t)return null;var n=this.getIndex(),i=this.getPosition(),r=t.getIndex(),o=t.getPosition(),a=t.getSize(),s=1<n-r,r=e.infinite&&0<n&&n<r;if(s||r)return null;a=i-a-e.gap,e=t;return o!==a&&(e=t.clone(t.getCloneIndex(),!0)).setPosition(a),e},e.next=function(){var e=this.viewport,t=e.options,n=this.nextSibling,i=e.panelManager.getLastIndex();if(!n)return null;var r=this.getIndex(),o=this.getPosition(),a=n.getIndex(),s=n.getPosition(),e=1<a-r,r=t.infinite&&r<i&&a<r;if(e||r)return null;o=o+this.getSize()+t.gap,t=n;return s!==o&&(t=n.clone(n.getCloneIndex(),!0)).setPosition(o),t},e.insertBefore=function(e){var t=this.viewport,n=I(e),i=t.panelManager.firstPanel(),e=this.prevSibling,e=e&&i.getIndex()!==this.getIndex()?Math.max(e.getIndex()+1,this.getIndex()-n.length):Math.max(this.getIndex()-n.length,0);return t.insert(e,n)},e.insertAfter=function(e){return this.viewport.insert(this.getIndex()+1,e)},e.remove=function(){return this.viewport.remove(this.getIndex()),this},e.destroy=function(e){for(var t in e.preserveUI||(e=this.state.originalStyle,H(this.element,e)),this)this[t]=null},e.getElement=function(){return this.element},e.getAnchorPosition=function(){return this.state.position+this.state.relativeAnchorPosition},e.getRelativeAnchorPosition=function(){return this.state.relativeAnchorPosition},e.getIndex=function(){return this.state.index},e.getPosition=function(){return this.state.position},e.getSize=function(){return this.state.size},e.getBbox=function(){var e,t,n=this.state,i=this.viewport,r=this.element,o=i.options;return r?n.cachedBbox||(e=Boolean(r.parentNode),t=i.getCameraElement(),e||(t.appendChild(r),i.addVisiblePanel(this)),n.cachedBbox=L(r,o.useOffset),!e&&i.options.renderExternal&&t.removeChild(r)):n.cachedBbox={x:0,y:0,width:0,height:0},n.cachedBbox},e.isClone=function(){return this.state.isClone},e.getOverlappedClass=function(e){for(var t=this.element,n=0,i=e;n<i.length;n++){var r=i[n];if(w(t,r))return r}},e.getCloneIndex=function(){return this.state.cloneIndex},e.getClonedPanels=function(){return this.state.isClone?this.original.getClonedPanels():this.clonedPanels},e.getIdenticalPanels=function(){return this.state.isClone?this.original.getIdenticalPanels():p([this],this.clonedPanels)},e.getOriginalPanel=function(){return this.state.isClone?this.original:this},e.setIndex=function(t){this.state.index=t,this.clonedPanels.forEach(function(e){return e.state.index=t})},e.setPosition=function(e){return this.state.position=e,this},e.setPositionCSS=function(e){var t,n,i,r,o;void 0===e&&(e=0),this.element&&(n=(t=this.state).position,i=this.viewport.options,r=this.element.style,o=i.horizontal?r.left:r.top,e=n-e+"px",t.isVirtual||o===e||(i.horizontal?r.left=e:r.top=e))},e.clone=function(e,t,n){void 0===t&&(t=!1);var i=this.state,r=this.viewport,n=n,n=new o(n=!n&&this.element?t?this.element:this.element.cloneNode(!0):n,i.index,r),r=n.state;return n.original=i.isClone?this.original:this,r.isClone=!0,r.isVirtual=t,r.cloneIndex=e,r.size=i.size,r.relativeAnchorPosition=i.relativeAnchorPosition,r.originalStyle=i.originalStyle,r.cachedBbox=i.cachedBbox,t?(n.prevSibling=this.prevSibling,n.nextSibling=this.nextSibling):this.clonedPanels.push(n),n},e.removeElement=function(){var e;this.viewport.options.renderExternal||(e=this.element).parentNode&&e.parentNode.removeChild(e),this.state.isClone||this.removeClonedPanelsAfter(0)},e.removeClonedPanelsAfter=function(e){var t=this.viewport.options,e=this.clonedPanels.splice(e);t.renderExternal||e.forEach(function(e){e.removeElement()})},e.setElement=function(e){var t,n;!e||e!==(t=this.element)&&(n=this.viewport.options,t?n.horizontal?e.style.left=t.style.left:e.style.top=t.style.top:((t=this.state.originalStyle).className=e.getAttribute("class"),t.style=e.getAttribute("style")),this.element=e,n.classPrefix&&(e=e,n=n.classPrefix+"-panel",e.classList?e.classList.add(n):w(e,n)||(e.className=(e.className+" "+n).replace(/\s{2,}/g," "))),M(this.element,g))},o}(),_=function(){function e(e,t){this.cameraElement=e,this.panels=[],this.clones=[],this.range={min:-1,max:-1},this.length=0,this.cloneCount=0,this.options=t,this.lastIndex=t.lastIndex}var t=e.prototype;return t.firstPanel=function(){return this.panels[this.range.min]},t.lastPanel=function(){return this.panels[this.range.max]},t.allPanels=function(){return p(this.panels,this.clones.reduce(function(e,t){return p(e,t)},[]))},t.originalPanels=function(){return this.panels},t.clonedPanels=function(){return this.clones},t.replacePanels=function(e,t){this.panels=e,this.clones=t,this.range={min:k(e,function(e){return Boolean(e)}),max:e.length-1},this.length=e.filter(function(e){return Boolean(e)}).length},t.has=function(e){return!!this.panels[e]},t.get=function(e){return this.panels[e]},t.getPanelCount=function(){return this.length},t.getLastIndex=function(){return this.lastIndex},t.getRange=function(){return this.range},t.getCloneCount=function(){return this.cloneCount},t.setLastIndex=function(e){this.lastIndex=e;var t=this.firstPanel(),n=this.lastPanel();t&&n&&(t=this.range,n.getIndex()>e&&(n=this.panels.splice(e+1),this.length-=n.length,(e=n.filter(function(e){return!!e})[0].prevSibling)?t.max=e.getIndex():(t.min=-1,t.max=-1),this.shouldRender()&&n.forEach(function(e){return e.removeElement()})))},t.setCloneCount=function(e){this.cloneCount=e},t.insert=function(n,e){var i=this.panels,t=this.range,r=this.options.circular,o=this.lastIndex,a=this.findFirstPanelFrom(n),s=this.firstPanel(),s=a?a.getElement():r&&s?s.getClonedPanels()[0].getElement():null;this.insertNewPanels(e,s);var l,h=e.length;return n>t.max?e.forEach(function(e,t){i[n+t]=e}):((t=k(s=i.slice(n,n+e.length),function(e){return e}))<0&&(t=s.length),h=e.length-t,i.splice.apply(i,p([n,t],e)),i.length>o+1&&(s=i.splice(o+1).filter(function(e){return Boolean(e)}),this.length-=s.length,t=o-k(this.panels.concat().reverse(),function(e){return e}),this.panels.splice(1+t),this.range.max=t,this.shouldRender()&&s.forEach(function(e){return e.removeElement()}))),0<h&&i.slice(n+e.length).forEach(function(e){e.setIndex(e.getIndex()+h)}),this.length+=e.length,this.updateIndex(n),r&&(this.addNewClones(n,e,e.length-h,a),a=this.clones,l=this.panels.length,a[0]&&a[0].length>o+1&&a.forEach(function(e){e.splice(l)})),h},t.replace=function(e,t){var n=this.panels,i=this.range,r=this.options.circular,o=this.findFirstPanelFrom(e+t.length),a=this.firstPanel(),a=o?o.getElement():r&&a?a.getClonedPanels()[0].getElement():null;this.insertNewPanels(t,a),e>i.max&&(n[e]=null);i=n.splice.apply(n,p([e,t.length],t)),n=i.filter(function(e){return Boolean(e)}).length;return this.length+=t.length-n,this.updateIndex(e),r&&this.addNewClones(e,t,t.length,o),this.shouldRender()&&i.forEach(function(e){return e&&e.removeElement()}),i},t.remove=function(t,n){void 0===n&&(n=1);var e=this.options.circular,i=this.panels,r=this.clones;n=Math.max(n,0);var o=i.splice(t,n).filter(function(e){return!!e});this.shouldRender()&&o.forEach(function(e){return e.removeElement()}),e&&r.forEach(function(e){e.splice(t,n)}),i.slice(t).forEach(function(e){e.setIndex(e.getIndex()-n)});var a,s=i.length-1;return i[s]||(a=k(i.concat().reverse(),function(e){return e}),s=a<0?-1:s-a,i.splice(s+1),e&&r.forEach(function(e){e.splice(s+1)})),this.range={min:k(i,function(e){return e}),max:s},this.length-=o.length,this.length<=0&&(this.clones=[],this.cloneCount=0),o},t.chainAllPanels=function(){var e,t,i=this.allPanels().filter(function(e){return!!e}),n=i.length;n<=1||(i.slice(1,i.length-1).forEach(function(e,t){var n=i[t],t=i[t+2];e.prevSibling=n,e.nextSibling=t}),e=i[0],t=i[n-1],e.prevSibling=null,e.nextSibling=i[1],t.prevSibling=i[n-2],t.nextSibling=null,this.options.circular&&((e.prevSibling=t).nextSibling=e))},t.insertClones=function(e,n,t,i){void 0===i&&(i=0);var r,o,a=this.clones,s=this.lastIndex;a[e]?(r=a[e],n>=r.length?t.forEach(function(e,t){r[n+t]=e}):(r.splice.apply(r,p([n,i],t)),t.length>s+1&&t.splice(s+1))):(o=[],t.forEach(function(e,t){o[n+t]=e}),a[e]=o)},t.removeClonesAfter=function(t){this.panels.forEach(function(e){e.removeClonedPanelsAfter(t)}),this.clones.splice(t)},t.findPanelOf=function(e){for(var t=0,n=this.allPanels();t<n.length;t++){var i=n[t];if(i)if(i.getElement().contains(e))return i}},t.findFirstPanelFrom=function(e){for(var t=0,n=this.panels.slice(e);t<n.length;t++){var i=n[t];if(i&&i.getIndex()>=e&&i.getElement().parentNode)return i}},t.addNewClones=function(r,o,a,e){for(var s=this,l=this.cameraElement,t=this.getCloneCount(),n=this.lastPanel(),h=n?n.getClonedPanels():[],c=e?e.getClonedPanels():[],u=this,i=0,g=B(t);i<g.length;i++)!function(t){var e=c[t],n=h[t],i=e?e.getElement():n?n.getElement().nextElementSibling:null,n=o.map(function(e){e=e.clone(t);return s.shouldRender()&&l.insertBefore(e.getElement(),i),e});u.insertClones(t,r,n,a)}(g[i])},t.updateIndex=function(e){var t=this.panels,n=this.range,t=t.length-1;t>n.max&&(n.max=t),(e<n.min||n.min<0)&&(n.min=e)},t.insertNewPanels=function(e,t){var n;this.shouldRender()&&(n=document.createDocumentFragment(),e.forEach(function(e){return n.appendChild(e.getElement())}),this.cameraElement.insertBefore(n,t))},t.shouldRender=function(){var e=this.options;return!e.renderExternal&&!e.renderOnlyVisible},e}(),F=function(){function e(){this.delta=0,this.direction=null,this.targetPanel=null,this.lastPosition=0}var t=e.prototype;return t.onEnter=function(e){this.delta=e.delta,this.direction=e.direction,this.targetPanel=e.targetPanel,this.lastPosition=e.lastPosition},t.onExit=function(e){},t.onHold=function(e,t){},t.onChange=function(e,t){},t.onRelease=function(e,t){},t.onAnimationEnd=function(e,t){},t.onFinish=function(e,t){},e}(),G=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=d,e.holding=!1,e.playing=!1,e}o(e,t);var n=e.prototype;return n.onEnter=function(){this.direction=null,this.targetPanel=null,this.delta=0,this.lastPosition=0},n.onHold=function(e,t){var n=t.flicking,i=t.viewport,r=t.triggerEvent,o=t.transitTo;if(n.getPanelCount()<=0)return i.options.infinite&&i.moveCamera(i.getCameraPosition(),e),void o(E);this.lastPosition=i.getCameraPosition(),r(P.HOLD_START,e,!0).onSuccess(function(){o(v)}).onStopped(function(){o(E)})},n.onChange=function(e,t){var n=t.triggerEvent,i=t.transitTo;n(P.MOVE_START,e,!1).onSuccess(function(){i(x).onChange(e,t)}).onStopped(function(){i(E)})},e}(F),X=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=v,e.holding=!0,e.playing=!0,e.releaseEvent=null,e}o(e,t);var n=e.prototype;return n.onChange=function(e,t){var n=t.flicking,i=t.triggerEvent,r=t.transitTo,n=n.options.horizontal?e.inputEvent.offsetX:e.inputEvent.offsetY;this.direction=n<0?b.NEXT:b.PREV,i(P.MOVE_START,e,!0).onSuccess(function(){r(m).onChange(e,t)}).onStopped(function(){r(E)})},n.onRelease=function(e,t){var n=t.viewport,i=t.triggerEvent,t=t.transitTo;if(i(P.HOLD_END,e,!0),0!==e.delta.flick)return e.setTo({flick:n.getCameraPosition()},0),void t(d);e.inputEvent.srcEvent.cancelable&&(this.releaseEvent=e)},n.onFinish=function(e,t){var n,i,r,o=t.viewport,a=t.triggerEvent;(0,t.transitTo)(d),this.releaseEvent&&(t="touchend"===(r=(n=this.releaseEvent).inputEvent.srcEvent).type?(i=r.changedTouches[0],document.elementFromPoint(i.clientX,i.clientY)):r.target,i=o.panelManager.findPanelOf(t),r=o.getCameraPosition(),i&&(o=i.getPosition(),a(P.SELECT,n,!0,{direction:r<o?b.NEXT:o<r?b.PREV:null,index:i.getIndex(),panel:i,element:t})))},e}(F),j=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=m,e.holding=!0,e.playing=!0,e}o(e,t);var n=e.prototype;return n.onChange=function(e,t){var n=t.moveCamera,i=t.transitTo;e.delta.flick&&n(e).onStopped(function(){i(E)})},n.onRelease=function(e,t){var n=t.flicking,i=t.viewport,r=t.triggerEvent,o=t.transitTo,a=t.stopCamera,s=this.delta,l=Math.abs(s),h=n.options,c=h.horizontal,u=i.moveType,g=e.inputEvent,t=c?g.velocityX:g.velocityY,n=c?g.deltaX:g.deltaY,s=1<Math.abs(t)?t<0:0<l?0<s:n<0,l=i.options.bound?Math.max(l,Math.abs(n)):l,g=g.deltaX?Math.abs(180*Math.atan(g.deltaY/g.deltaX)/Math.PI):90,g=c?g<=h.thresholdAngle:g>h.thresholdAngle,g=l>=h.threshold&&g,s={viewport:i,axesEvent:e,state:this,swipeDistance:l,isNextDirection:s};r(P.HOLD_END,e,!0);r=this.targetPanel;if(!g&&r){var f=u.findPanelWhenInterrupted(s);return i.moveTo(f.panel,f.destPos,f.eventType,e,f.duration),void o(x)}r=i.getCurrentPanel(),f=i.getNearestPanel();if(!r||!f)return e.stop(),void o(d);s=g?u.findTargetPanel(s):u.findRestorePanel(s);i.moveTo(s.panel,s.destPos,s.eventType,e,s.duration).onSuccess(function(){o(x)}).onStopped(function(){o(E),a(e)})},e}(F),q=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=x,e.holding=!1,e.playing=!0,e}o(e,t);var n=e.prototype;return n.onHold=function(e,t){var n=t.viewport,i=t.triggerEvent,r=t.transitTo,o=n.options,a=n.getScrollArea(),s=n.getScrollAreaSize(),l=Math.floor((this.lastPosition+this.delta-a.prev)/s),t=this.targetPanel;o.circular&&0!==l&&t&&(a=n.panelManager.getCloneCount(),o=t.getPosition(),a=V(t.getCloneIndex()-l,-1,a-1,!0),s=o-l*s,(a=t.getIdenticalPanels()[a+1].clone(a,!0)).setPosition(s),this.targetPanel=a),this.delta=0,this.lastPosition=n.getCameraPosition(),n.setCurrentPanel(n.getNearestPanel()),i(P.HOLD_START,e,!0).onSuccess(function(){r(m)}).onStopped(function(){r(E)})},n.onChange=function(e,t){var n=t.moveCamera,i=t.transitTo;e.delta.flick&&n(e).onStopped(function(){i(E)})},n.onFinish=function(e,t){var n=t.flicking,i=t.viewport,r=t.triggerEvent,o=t.transitTo,t=e&&e.isTrusted;i.options.bound?i.setCurrentPanel(this.targetPanel):i.setCurrentPanel(i.getNearestPanel()),n.options.adaptive&&i.updateAdaptiveSize(),o(d),i.updateCameraPosition(),r(P.MOVE_END,e,t,{direction:this.direction})},e}(F),Y=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type=E,e.holding=!1,e.playing=!0,e}o(e,t);var n=e.prototype;return n.onAnimationEnd=function(e,t){(0,t.transitTo)(d)},n.onChange=function(e,t){var n=t.viewport,t=t.transitTo;e.stop(),n.updateAxesPosition(n.getCameraPosition()),t(d)},n.onRelease=function(e,t){t=t.transitTo;0===e.delta.flick&&t(d)},e}(F),U=function(){function e(){var i=this;this.state=new G,this.transitTo=function(e){var t=i.state;if(t.type!==e){var n=void 0;switch(e){case d:n=new G;break;case v:n=new X;break;case m:n=new j;break;case x:n=new q;break;case E:n=new Y}t.onExit(n),n.onEnter(t),i.state=n}return i.state}}var t=e.prototype;return t.fire=function(e,t,n){var i=this.state;switch(e){case f.HOLD:i.onHold(t,n);break;case f.CHANGE:i.onChange(t,n);break;case f.RELEASE:i.onRelease(t,n);break;case f.ANIMATION_END:i.onAnimationEnd(t,n);break;case f.FINISH:i.onFinish(t,n)}},t.getState=function(){return this.state},e}(),W=function(n){function e(e){var t=n.call(this)||this;return t.type=s.SNAP,t.count=e,t}o(e,n);var t=e.prototype;return t.findTargetPanel=function(e){var t=e.viewport,n=e.axesEvent,i=e.swipeDistance,r=this.count,o=Math.abs(n.delta.flick),a=t.getCurrentPanel(),s=t.getNearestPanel(),l=this.calcBrinkOfChange(e),n=s.getIndex()===a.getIndex(),a=t.canSetBoundMode()&&n,a=!t.isOutOfBound()&&(i<=l||a);return 1<r&&l<o?this.findSnappedPanel(e):a?this.findAdjacentPanel(e):{panel:s,duration:t.options.duration,destPos:t.findEstimatedPosition(s),eventType:i<=l||t.isOutOfBound()&&n?P.RESTORE:P.CHANGE}},t.findSnappedPanel=function(e){for(var t=e.axesEvent,n=e.viewport,i=e.state,r=e.isNextDirection,o=Math.abs(t.delta.flick),a=this.calcBrinkOfChange(e),s=this.count,e=n.options,l=n.getScrollAreaSize(),h=e.gap/2,c=t.destPos.flick+n.getRelativeHangerPosition(),u=n.getNearestPanel(),g=u.getCloneIndex()+1,f=0;f<s;){var d=u.getOriginalPanel(),p=d.getPosition()+g*l,v=d.getSize();if(r&&c<p+v+h||!r&&p-h<c)break;d=r?u.nextSibling:u.prevSibling;if(!d)break;v=u.getIndex(),p=d.getIndex();(r&&p<=v||!r&&v<=p)&&(g=r?g+1:g-1),u=d,f+=1}e=u.getOriginalPanel().getPosition();0!==g&&(u=u.clone(u.getCloneIndex(),!0)).setPosition(e+g*l);e=n.options.duration,e=z(t.duration,e,e*f);return{panel:u,destPos:n.findEstimatedPosition(u),duration:e,eventType:Math.max(o,i.delta)>a?P.CHANGE:P.RESTORE}},t.findAdjacentPanel=function(e){var t=e.viewport,n=e.isNextDirection,i=t.options,r=t.getCurrentIndex(),o=t.panelManager.get(r),a=t.getHangerPosition(),s=t.getScrollArea(),l=o.getIdenticalPanels()[1],e=i.circular&&Math.abs(o.getAnchorPosition()-a)>Math.abs(l.getAnchorPosition()-a)?l:o,r=e.getPosition(),a=n?e.nextSibling:e.prevSibling,l=a?P.CHANGE:P.RESTORE,o=a||e,a=o.getRelativeAnchorPosition(),a=(i.circular?n?r+e.getSize()+a+i.gap:r-(o.getSize()-a)-i.gap:o.getAnchorPosition())-t.getRelativeHangerPosition();return{panel:o,destPos:t.canSetBoundMode()?z(a,s.prev,s.next):a,duration:i.duration,eventType:l}},e}(function(){function e(){}var t=e.prototype;return t.is=function(e){return e===this.type},t.findRestorePanel=function(e){var t=e.viewport,n=t.options,e=n.circular?this.findRestorePanelInCircularMode(e):t.getCurrentPanel();return{panel:e,destPos:t.findEstimatedPosition(e),duration:n.duration,eventType:P.RESTORE}},t.findPanelWhenInterrupted=function(e){var t=e.state,e=e.viewport,t=t.targetPanel;return{panel:t,destPos:e.findEstimatedPosition(t),duration:e.options.duration,eventType:""}},t.calcBrinkOfChange=function(e){var t=e.viewport,n=e.isNextDirection,i=t.options,r=t.getCurrentPanel(),e=i.gap/2,t=r.getRelativeAnchorPosition(),e=n?r.getSize()-t+e:t+e;return e=Math.max(e,i.threshold)},t.findRestorePanelInCircularMode=function(e){var t=e.viewport,n=t.getCurrentPanel().getOriginalPanel(),i=t.getHangerPosition(),t=n.getIdenticalPanels()[1],i=Math.abs(n.getAnchorPosition()-i)>Math.abs(t.getAnchorPosition()-i);return!e.isNextDirection&&i?t:n},e}()),J=function(h){function e(){var e=h.call(this,1/0)||this;return e.type=s.FREE_SCROLL,e}o(e,h);var t=e.prototype;return t.findTargetPanel=function(e){var t=e.axesEvent,n=e.state,i=e.viewport,r=t.destPos.flick,o=this.calcBrinkOfChange(e),a=i.getScrollArea(),s=i.getCurrentPanel(),l=i.options;if(o<Math.abs(t.delta.flick+n.delta)){e=h.prototype.findSnappedPanel.call(this,e);return e.duration=t.duration,e.destPos=r,e.eventType=l.circular||e.panel!==s?P.CHANGE:"",e}l=z(l=l.circular?V(r,a.prev,a.next,!1):r,a.prev,a.next);return l+=i.getRelativeHangerPosition(),{panel:i.findNearestPanelAt(l),destPos:r,duration:t.duration,eventType:""}},t.findRestorePanel=function(e){return this.findTargetPanel(e)},t.findPanelWhenInterrupted=function(e){e=e.viewport;return{panel:e.getNearestPanel(),destPos:e.getCameraPosition(),duration:0,eventType:""}},t.calcBrinkOfChange=function(e){var t=e.viewport,n=e.isNextDirection,i=t.options,r=t.getCurrentPanel(),o=i.gap/2,e=t.stateMachine.getState().lastPosition,i=r.getPosition(),e=e+t.getRelativeHangerPosition(),t=t.getScrollAreaSize(),o=n?i+r.getSize()-e+o:e-i+o,o=Math.abs(o%t);return Math.min(o,t-o)},e}(W),K=function(){function e(e,t,n){var i=this;this.plugins=[],this.stopCamera=function(e){e&&e.setTo&&e.setTo({flick:i.state.position},0),i.stateMachine.transitTo(d)},this.flicking=e,this.triggerEvent=n,this.state={size:0,position:0,panelMaintainRatio:0,relativeHangerPosition:0,positionOffset:0,scrollArea:{prev:0,next:0},translate:S,infiniteThreshold:0,checkedIndexes:[],isAdaptiveCached:!1,isViewportGiven:!1,isCameraGiven:!1,originalViewportStyle:{className:null,style:null},originalCameraStyle:{className:null,style:null},cachedBbox:null},this.options=t,this.stateMachine=new U,this.visiblePanels=[],this.panelBboxes={},this.build()}var t=e.prototype;return t.moveTo=function(e,t,n,i,r){var o=this;void 0===r&&(r=this.options.duration);var a=this.state,s=this.stateMachine.getState(),l=a.position,h=!!i&&i.isTrusted,a=t===l?null:l<t?b.NEXT:b.PREV,h=n===P.CHANGE?this.triggerEvent(P.CHANGE,i,h,{index:e.getIndex(),panel:e,direction:a}):n===P.RESTORE?this.triggerEvent(P.RESTORE,i,h):{onSuccess:function(e){return e(),this},onStopped:function(){return this}};return h.onSuccess(function(){s.delta=0,s.lastPosition=o.getCameraPosition(),s.targetPanel=e,s.direction=t===l?null:l<t?b.NEXT:b.PREV,t===l&&(o.nearestPanel=e,o.currentPanel=e),(i&&i.setTo?i:o.axes).setTo({flick:t},r)}),h},t.moveCamera=function(e,t){var n=this.state,i=this.options,r=n.translate.name,o=n.scrollArea;i.circular&&!T(e,o.prev,o.next)&&(e=V(e,o.prev,o.next,!1)),n.position=e,this.nearestPanel=this.findNearestPanel();var a,s,l,h=this.nearestPanel,c=h?h.getPosition():0;h?(a=this.getHangerPosition(),s=h.getPosition(),l=h.getSize(),o=i.gap/2,n.panelMaintainRatio=(a-s+o)/(l+2*o)):n.panelMaintainRatio=0,this.checkNeedPanel(t),e+=(h?h.getPosition():0)-c,n.position=e,this.updateVisiblePanels();c=i.renderOnlyVisible?n.positionOffset:0,c=(i.horizontal?[-(e-c),0]:[0,-(e-c)]).map(function(e){return Math.round(e)+"px"}).join(", ");this.cameraElement.style[r]=n.translate.has3d?"translate3d("+c+", 0px)":"translate("+c+")"},t.unCacheBbox=function(){var e=this.state,t=this.options;e.cachedBbox=null,this.visiblePanels=[];var n=this.viewportElement;t.horizontal?n.style.height="":n.style.width="",e.isAdaptiveCached=!1,this.panelBboxes={}},t.resize=function(){this.updateSize(),this.updateOriginalPanelPositions(),this.updateAdaptiveSize(),this.updateScrollArea(),this.updateClonePanels(),this.updateVisiblePanelPositions(),this.updateCameraPosition(),this.updatePlugins()},t.findNearestPanel=function(){var e=this.state,t=this.panelManager,n=this.getHangerPosition();return this.isOutOfBound()?e.position<=e.scrollArea.prev?t.firstPanel():t.lastPanel():this.findNearestPanelAt(n)},t.findNearestPanelAt=function(e){for(var t,n=1/0,i=0,r=this.panelManager.allPanels();i<r.length;i++){var o=r[i];if(o){var a=o.getPosition(),s=a+o.getSize(),s=T(e,a,s)?0:Math.min(Math.abs(a-e),Math.abs(s-e));if(n<s)break;if(s===n&&Math.abs(e-t.getAnchorPosition())<Math.abs(e-o.getAnchorPosition()))break;n=s,t=o}}return t},t.findNearestIdenticalPanel=function(e){var n=e,i=1/0,r=this.getHangerPosition();return e.getIdenticalPanels().forEach(function(e){var t=e.getAnchorPosition(),t=Math.abs(t-r);t<i&&(n=e,i=t)}),n},t.findShortestPositionToPanel=function(e){var t=this.state,n=this.options,i=e.getAnchorPosition(),r=this.getHangerPosition(),o=Math.abs(r-i),e=t.scrollArea.next-t.scrollArea.prev;if(n.circular)return o<=e-o?i-t.relativeHangerPosition:r<i?i-t.relativeHangerPosition-e:i-t.relativeHangerPosition+e;i-=t.relativeHangerPosition;return this.canSetBoundMode()?z(i,t.scrollArea.prev,t.scrollArea.next):i},t.findEstimatedPosition=function(e){var t=this.getScrollArea(),e=e.getAnchorPosition()-this.getRelativeHangerPosition();return e=this.canSetBoundMode()?z(e,t.prev,t.next):e},t.addVisiblePanel=function(e){this.getVisibleIndexOf(e)<0&&this.visiblePanels.push(e)},t.enable=function(){this.panInput||this.createPanInput()},t.disable=function(){this.panInput&&(this.panInput.destroy(),this.panInput=null,this.stateMachine.transitTo(d))},t.insert=function(i,e){var n=this,t=this.panelManager.getLastIndex();if(i<0||t<i)return[];var r=this.state,o=this.options,a=I(e).map(function(e,t){return new D(e,i+t,n)}).slice(0,t-i+1);if(a.length<=0)return[];var s=this.panelManager.insert(i,a);return this.resizePanels(a),this.currentPanel||(this.currentPanel=a[0],this.nearestPanel=a[0],e=a[0],t=this.findEstimatedPosition(e),r.position=t,this.updateAxesPosition(t),r.panelMaintainRatio=(e.getRelativeAnchorPosition()+o.gap/2)/(e.getSize()+o.gap)),this.updateCheckedIndexes({min:i,max:i}),r.checkedIndexes.forEach(function(e,t){var n=e[0],e=e[1];i<n&&r.checkedIndexes.splice(t,1,[n+s,e+s])}),this.resize(),a},t.replace=function(n,e){var i=this,t=this.state,r=this.options,o=this.panelManager,a=o.getLastIndex();if(n<0||a<n)return[];var s=I(e).map(function(e,t){return new D(e,n+t,i)}).slice(0,a-n+1);if(s.length<=0)return[];o.replace(n,s).forEach(function(e){e=i.getVisibleIndexOf(e);-1<e&&i.visiblePanels.splice(e,1)}),this.resizePanels(s);var l=this.currentPanel;return!l?(this.currentPanel=s[0],this.nearestPanel=s[0],e=s[0],a=this.findEstimatedPosition(e),t.position=a,this.updateAxesPosition(a),t.panelMaintainRatio=(e.getRelativeAnchorPosition()+r.gap/2)/(e.getSize()+r.gap)):T(l.getIndex(),n,n+s.length-1)&&(this.currentPanel=o.get(l.getIndex())),this.updateCheckedIndexes({min:n,max:n+s.length-1}),this.resize(),s},t.remove=function(e,t){void 0===t&&(t=1);var n=this.state;e=Math.max(e,0);var i=this.panelManager,r=this.getCurrentIndex(),o=i.remove(e,t);T(r,e,e+t-1)&&(r=Math.max(e-1,i.getRange().min),this.currentPanel=i.get(r)),0<t&&(this.updateCheckedIndexes({min:e-1,max:e+t}),this.visiblePanels=[]),i.getPanelCount()<=0&&(this.currentPanel=void 0,this.nearestPanel=void 0),this.resize();i=n.scrollArea;return(n.position<i.prev||n.position>i.next)&&(i=V(n.position,i.prev,i.next,!1),this.moveCamera(i),this.updateAxesPosition(i)),o},t.updateAdaptiveSize=function(){var e,t,n,i=this.state,r=this.options,o=r.horizontal,a=this.getCurrentPanel();a&&(t=r.adaptive||!i.isAdaptiveCached,e=this.viewportElement.style,t&&(t=void 0,t=r.adaptive?(a=a.getBbox(),o?a.height:a.width):this.panelManager.originalPanels().reduce(function(e,t){t=t.getBbox();return Math.max(e,o?t.height:t.width)},0),i.isAdaptiveCached||(n=this.updateBbox(),t=Math.max(t,o?n.height:n.width),i.isAdaptiveCached=!0),n=t+"px",o?(e.height=n,i.cachedBbox.height=t):(e.width=n,i.cachedBbox.width=t)))},t.updateCameraPosition=function(){var e=this.state,t=this.getCurrentPanel(),n=this.getCameraPosition(),i=this.stateMachine.getState(),r=this.moveType.is(s.FREE_SCROLL),o=this.getRelativeHangerPosition(),a=this.options.gap/2;i.holding||i.playing?this.updateVisiblePanels():(n=r?(i=this.canSetBoundMode()&&(n===e.scrollArea.prev||n===e.scrollArea.next),r=this.getNearestPanel(),i||!r?n:r.getPosition()-a+(r.getSize()+2*a)*e.panelMaintainRatio-o):t?t.getAnchorPosition()-o:n,this.canSetBoundMode()&&(n=z(n,e.scrollArea.prev,e.scrollArea.next)),this.updateAxesPosition(n),this.moveCamera(n))},t.updateBbox=function(){var e=this.state,t=this.options,n=this.viewportElement;return e.cachedBbox||(e.cachedBbox=L(n,t.useOffset)),e.cachedBbox},t.updatePlugins=function(){var t=this;this.plugins.forEach(function(e){e.update&&e.update(t.flicking)})},t.destroy=function(t){var n,e,i,r=this.state,o=this.flicking.getElement(),a=this.viewportElement,s=this.cameraElement,l=this.panelManager.originalPanels();for(i in this.removePlugins(this.plugins),t.preserveUI||(H(a,r.originalViewportStyle),H(s,r.originalCameraStyle),r.isCameraGiven||this.options.renderExternal||(n=r.isViewportGiven?a:o,e=r.isViewportGiven?s:a,l.forEach(function(e){n.appendChild(e.getElement())}),n.removeChild(e))),this.axes.destroy(),null!==(e=this.panInput)&&void 0!==e&&e.destroy(),l.forEach(function(e){e.destroy(t)}),this)this[i]=null},t.restore=function(e){var t=e.panels,n=this.options.defaultIndex,i=this.cameraElement,r=this.panelManager;i.innerHTML=t.map(function(e){return e.html}).join(""),this.refreshPanels();var o=r.originalPanels(),a=[];t.forEach(function(e,t){t=o[t];t.setIndex(e.index),t.setPosition(e.position),a[e.index]=t}),r.replacePanels(a,[]),r.setCloneCount(0);t=r.getPanelCount();this.currentPanel=0<t?r.get(e.index)||r.get(n)||r.firstPanel():void 0,this.visiblePanels=a.filter(function(e){return Boolean(e)}),this.resize(),this.axes.setTo({flick:e.position},0),this.moveCamera(e.position)},t.calcVisiblePanels=function(){var e=this.panelManager.allPanels();if(this.options.renderOnlyVisible){var t=this.getCameraPosition(),n=this.getSize(),i=this.nearestPanel,r=function(e,t,n){for(var i=[],r=e;;){var o=t(r);if(!o||n(o))break;i.push(o),r=o}return i},o=this.panelManager.getPanelCount(),a=function(e){return e.getIndex()+(e.getCloneIndex()+1)*o};return p([i],r(i,function(e){var t=e.nextSibling;return t&&t.getPosition()>=e.getPosition()?t:null},function(e){return e.getPosition()>=t+n}),r(i,function(e){var t=e.prevSibling;return t&&t.getPosition()<=e.getPosition()?t:null},function(e){return e.getPosition()+e.getSize()<=t})).sort(function(e,t){return a(e)-a(t)})}return e.filter(function(e){e=e.getOutsetProgress();return-1<e&&e<1})},t.getCurrentPanel=function(){return this.currentPanel},t.getCurrentIndex=function(){var e=this.currentPanel;return e?e.getIndex():-1},t.getNearestPanel=function(){return this.nearestPanel},t.getCurrentProgress=function(){var e=this.stateMachine.getState(),t=e.playing||e.holding?this.nearestPanel:this.currentPanel,n=this.panelManager;if(!t)return NaN;var i=this.getScrollArea(),r=i.prev,o=i.next,a=this.getCameraPosition(),s=this.isOutOfBound(),l=t.prevSibling,h=t.nextSibling,e=this.getHangerPosition(),i=t.getAnchorPosition();s&&l&&h&&a<o&&e-l.getAnchorPosition()<i-e&&(h=(t=l).nextSibling,l=t.prevSibling,i=t.getAnchorPosition());n=t.getIndex()+(t.getCloneIndex()+1)*n.getPanelCount(),t=t.getSize();s&&(o+(c=this.getRelativeHangerPosition())<i?e=i+e-c-o:i<r+c&&(e=i+e-c-r));var s=i<=e,o=this.options.gap,c=i,r=i;s?r=h?h.getAnchorPosition():i+t+o:c=l?l.getAnchorPosition():i-t-o;c=(e-c)/(r-c);return(s?n:l?l.getIndex():n-1)+c},t.updateAxesPosition=function(e){var t=this.axes;t.off(),t.setTo({flick:e},0),t.on(this.axesHandlers)},t.getSize=function(){return this.state.size},t.getScrollArea=function(){return this.state.scrollArea},t.isOutOfBound=function(){var e=this.state,t=this.options,n=e.scrollArea;return!t.circular&&t.bound&&(e.position<=n.prev||e.position>=n.next)},t.canSetBoundMode=function(){var e=this.options;return e.bound&&!e.circular},t.getViewportElement=function(){return this.viewportElement},t.getCameraElement=function(){return this.cameraElement},t.getScrollAreaSize=function(){var e=this.state.scrollArea;return e.next-e.prev},t.getRelativeHangerPosition=function(){return this.state.relativeHangerPosition},t.getHangerPosition=function(){return this.state.position+this.state.relativeHangerPosition},t.getCameraPosition=function(){return this.state.position},t.getPositionOffset=function(){return this.state.positionOffset},t.getCheckedIndexes=function(){return this.state.checkedIndexes},t.getVisiblePanels=function(){return this.visiblePanels},t.setCurrentPanel=function(e){this.currentPanel=e},t.setLastIndex=function(e){var t=this.currentPanel,n=this.panelManager;n.setLastIndex(e),t&&t.getIndex()>e&&(this.currentPanel=n.lastPanel()),this.resize()},t.setVisiblePanels=function(e){this.visiblePanels=e},t.connectAxesHandler=function(e){var t=this.axes;this.axesHandlers=e,t.on(e)},t.addPlugins=function(e){var t=this,e=[].concat(e);return e.forEach(function(e){e.init(t.flicking)}),this.plugins=this.plugins.concat(e),this},t.removePlugins=function(e){var n=this,i=this.plugins;return[].concat(e).forEach(function(e){var t=i.indexOf(e);-1<t&&i.splice(t,1),e.destroy(n.flicking)}),this},t.updateCheckedIndexes=function(i){var r=this.state,o=0;r.checkedIndexes.concat().forEach(function(e,t){var n=e[0],e=e[1];i.min<=e&&i.max>=n&&(r.checkedIndexes.splice(t-o,1),o++)})},t.appendUncachedPanelElements=function(e){var t,n,i,r=this,o=this.options,a=document.createDocumentFragment();o.isEqualSize?(t=this.visiblePanels,n=o.isEqualSize,i={},this.visiblePanels=[],Object.keys(this.panelBboxes).forEach(function(e){i[e]=!0}),e.forEach(function(e){var t=e.getOverlappedClass(n);t&&!i[t]?(o.renderExternal||a.appendChild(e.getElement()),r.visiblePanels.push(e),i[t]=!0):t||(o.renderExternal||a.appendChild(e.getElement()),r.visiblePanels.push(e))}),t.forEach(function(e){r.addVisiblePanel(e)})):(o.renderExternal||e.forEach(function(e){return a.appendChild(e.getElement())}),this.visiblePanels=e.filter(function(e){return Boolean(e)})),o.renderExternal||this.cameraElement.appendChild(a)},t.updateClonePanels=function(){var e=this.panelManager;this.options.circular&&0<e.getPanelCount()&&(this.clonePanels(),this.updateClonedPanelPositions()),e.chainAllPanels()},t.getVisibleIndexOf=function(t){return k(this.visiblePanels,function(e){return e===t})},t.build=function(){this.setElements(),this.applyCSSValue(),this.setMoveType(),this.setAxesInstance(),this.refreshPanels(),this.setDefaultPanel(),this.resize(),this.moveToDefaultPanel()},t.setElements=function(){var e=this.state,t=this.options,n=this.flicking.getElement(),i=t.classPrefix,r=n.children[0],o=r&&w(r,i+"-viewport"),a=o?r:document.createElement("div"),t=(o?a:n).children[0],r=t&&w(t,i+"-camera"),s=r?t:document.createElement("div");r?e.originalCameraStyle={className:s.getAttribute("class"),style:s.getAttribute("style")}:(s.className=i+"-camera",R((o?a:n).children).forEach(function(e){s.appendChild(e)})),o?e.originalViewportStyle={className:a.getAttribute("class"),style:a.getAttribute("style")}:(a.className=i+"-viewport",n.appendChild(a)),r&&o||a.appendChild(s),this.viewportElement=a,this.cameraElement=s,e.isViewportGiven=o,e.isCameraGiven=r},t.applyCSSValue=function(){var e=this.options,t=this.viewportElement,n=this.cameraElement,i=this.viewportElement.style;M(t,h),M(n,c),t.style.zIndex=""+e.zIndex,e.horizontal?(i.minHeight="100%",i.width="100%"):(i.minWidth="100%",i.height="100%"),e.overflow&&(i.overflow="visible"),this.panelManager=new _(this.cameraElement,e)},t.setMoveType=function(){var e=this.options.moveType;switch(e.type){case s.SNAP:this.moveType=new W(e.count);break;case s.FREE_SCROLL:this.moveType=new J;break;default:throw new Error("moveType is not correct!")}},t.setAxesInstance=function(){var e=this.state,t=this.options,e=e.scrollArea;this.axes=new i({flick:{range:[e.prev,e.next],circular:t.circular,bounce:[0,0]}},{easing:t.panelEffect,deceleration:t.deceleration,interruptable:!0}),this.createPanInput()},t.refreshPanels=function(){var n=this,e=this.panelManager,t=R(this.cameraElement.children).map(function(e,t){return new D(e,t,n)});e.replacePanels(t,[]),this.visiblePanels=t.filter(function(e){return Boolean(e)})},t.setDefaultPanel=function(){var e=this.options,t=this.panelManager,n=this.panelManager.getRange(),n=z(e.defaultIndex,n.min,n.max);this.currentPanel=t.get(n)},t.clonePanels=function(){var e=this.state,t=this.options,r=this.panelManager,n=t.gap,i=e.size,o=r.firstPanel(),a=r.lastPanel();if(o){for(var s,l=r.originalPanels(),h=l.concat().reverse(),c=a.getPosition()+a.getSize()-o.getPosition()+n,e=o.getRelativeAnchorPosition(),a=this.getRelativeHangerPosition(),u=(a-e)%c,g=0,f=0,d=h;f<d.length;f++){var p=d[f];if(p&&u<=(g+=p.getSize()+n)){s=p;break}}for(var v,P=(i-a+e)%c,g=0,m=0,x=l;m<x.length;m++){p=x[m];if(p&&P<=(g+=p.getSize()+n)){v=p;break}}var h=0!==s.getIndex()&&s.getIndex()<=v.getIndex(),E=Math.ceil((a+o.getSize()-e)/c)+Math.ceil((i-a+e)/c)-1+(h?1:0),h=r.getCloneCount();if(r.setCloneCount(E),!t.renderExternal)if(h<E)for(var C=this,S=h;S<E;S++)!function(t){var e,n=l.map(function(e){return e.clone(t)}),i=document.createDocumentFragment();n.forEach(function(e){return i.appendChild(e.getElement())}),C.cameraElement.appendChild(i),(e=C.visiblePanels).push.apply(e,n.filter(function(e){return Boolean(e)})),r.insertClones(t,0,n)}(S);else E<h&&r.removeClonesAfter(E)}},t.moveToDefaultPanel=function(){var e=this.state,t=this.panelManager,n=this.options,i=this.panelManager.getRange(),i=z(n.defaultIndex,i.min,i.max),t=t.get(i),i=0;t&&(i=t.getAnchorPosition()-e.relativeHangerPosition,i=this.canSetBoundMode()?z(i,e.scrollArea.prev,e.scrollArea.next):i),this.moveCamera(i),this.axes.setTo({flick:i},0)},t.updateSize=function(){var e=this.state,t=this.options,n=this.panelManager.originalPanels().filter(function(e){return Boolean(e)}),i=this.updateBbox(),r=e.size;e.size=t.horizontal?i.width:i.height,r!==e.size&&(e.relativeHangerPosition=N(t.hanger,e.size),e.infiniteThreshold=N(t.infiniteThreshold,e.size)),n.length<=0||this.resizePanels(n)},t.updateOriginalPanelPositions=function(){var e,t,n,i,r,o=this.options.gap,a=this.panelManager,s=a.firstPanel(),l=a.originalPanels();s&&(i=this.currentPanel,e=this.nearestPanel,t=this.stateMachine.getState(),n=this.state.scrollArea,r=s.getPosition(),a=s,e?a=!T(t.lastPosition+t.delta,n.prev,n.next)?i:e:0<s.getIndex()&&(a=i),i=l.slice(0,a.getIndex()+(a.getCloneIndex()+1)*l.length).reduce(function(e,t){return e+t.getSize()+o},0),r=a.getPosition()-i,l.forEach(function(e){var t=r,n=e.getSize();e.setPosition(t),r+=n+o}),this.options.renderOnlyVisible||l.forEach(function(e){return e.setPositionCSS()}))},t.updateClonedPanelPositions=function(){var e=this.state,t=this.options,n=this.panelManager,i=n.clonedPanels().reduce(function(e,t){return p(e,t)},[]).filter(function(e){return Boolean(e)}),r=e.scrollArea,e=n.firstPanel(),n=n.lastPanel();if(e){for(var o=n.getPosition()+n.getSize()-e.getPosition()+t.gap,a=0,s=i;a<s.length;a++){var l=(g=s[a]).getOriginalPanel(),l=o*(g.getCloneIndex()+1)+l.getPosition();g.setPosition(l)}for(var h=e.getPosition(),c=0,u=i.concat().reverse();c<u.length;c++){var g,f=(g=u[c]).getSize(),d=h-f-t.gap;if(d+f<=r.prev)break;g.setPosition(d),h=d}this.options.renderOnlyVisible||i.forEach(function(e){e.setPositionCSS()})}},t.updateVisiblePanelPositions=function(){var t=this;this.options.renderOnlyVisible&&this.visiblePanels.forEach(function(e){e.setPositionCSS(t.state.positionOffset)})},t.updateScrollArea=function(){var e,t=this.state,n=this.panelManager,i=this.options,r=this.axes,o=n.firstPanel(),a=n.lastPanel(),s=t.relativeHangerPosition;o?this.canSetBoundMode()?(e=a.getPosition()+a.getSize()-o.getPosition())>=t.size?t.scrollArea={prev:o.getPosition(),next:a.getPosition()+a.getSize()-t.size}:(n=N(i.anchor,e),n=o.getPosition()+z(n,e-(t.size-s),s),t.scrollArea={prev:n-s,next:n-s}):i.circular?(e=a.getPosition()+a.getSize()-o.getPosition()+i.gap,t.scrollArea={prev:o.getAnchorPosition()-s,next:e+o.getAnchorPosition()-s}):t.scrollArea={prev:o.getAnchorPosition()-s,next:a.getAnchorPosition()-s}:t.scrollArea={prev:0,next:0};var l,h=t.size,s=i.bounce;l=(i=s)&&i.constructor===Array?s.map(function(e){return N(e,h,u.bounce)}):[l=N(s,h,u.bounce),l];r=r.axis.flick;r.range=[t.scrollArea.prev,t.scrollArea.next],r.bounce=l},t.checkNeedPanel=function(e){var t=this.state,n=this.options,i=this.panelManager,r=this.currentPanel,o=this.nearestPanel,a=this.stateMachine.getState();if(n.infinite){var s=n.gap,l=t.infiniteThreshold,h=i.getLastIndex();if(!(h<0))if(r&&o){for(var c=o.getPosition(),u=a.holding||a.playing?o:r;u;){var g=u.getIndex(),f=u.nextSibling,f=!(g===(m=i.lastPanel()).getIndex())&&f?f.getIndex():h+1,d=o.getPosition(),p=u.getPosition()+u.getSize()-(d-c)+s-l<=t.position+t.size;1<f-g&&p&&this.triggerNeedPanel({axesEvent:e,siblingPanel:u,direction:b.NEXT,indexRange:{min:g+1,max:f-1,length:f-g-1}}),n.circular&&g===h&&p&&(0<(v=(P=i.firstPanel())?P.getIndex():-1)&&this.triggerNeedPanel({axesEvent:e,siblingPanel:u,direction:b.NEXT,indexRange:{min:0,max:v-1,length:v}}));var v=i.lastPanel();if(v&&g===v.getIndex()||!p)break;u=u.nextSibling}for(u=o;u;){var P,m,x=t.position,E=u.getIndex(),C=u.prevSibling,C=!(E===(P=i.firstPanel()).getIndex())&&C?C.getIndex():-1,d=o.getPosition(),p=x<=u.getPosition()-(d-c)-s+l;1<E-C&&p&&this.triggerNeedPanel({axesEvent:e,siblingPanel:u,direction:b.PREV,indexRange:{min:C+1,max:E-1,length:E-C-1}}),n.circular&&0===E&&p&&(m=i.lastPanel())&&m.getIndex()<h&&(S=m.getIndex(),this.triggerNeedPanel({axesEvent:e,siblingPanel:u,direction:b.PREV,indexRange:{min:S+1,max:h,length:h-S}}));var S=i.firstPanel();if(S&&E===S.getIndex()||!p)break;u=u.prevSibling}}else this.triggerNeedPanel({axesEvent:e,siblingPanel:null,direction:null,indexRange:{min:0,max:h,length:h+1}})}},t.triggerNeedPanel=function(e){var n,i=this,t=e.axesEvent,r=e.siblingPanel,o=e.direction,a=e.indexRange,s=this.options,l=this.state.checkedIndexes,h=l.some(function(e){var t=e[0],e=e[1];return t===a.min||e===a.max}),e=this.flicking.hasOn(P.NEED_PANEL);!h&&e&&(l.push([a.min,a.max]),n=r?r.getIndex():0,l=!!t&&t.isTrusted,this.triggerEvent(P.NEED_PANEL,t,l,{index:n,panel:r,direction:o,range:a,fill:function(e){var t=i.panelManager;if(!r)return i.insert(t.getRange().max+1,e);e=I(e),e=o===b.NEXT?e.slice(0,a.length):e.slice(-a.length);return o===b.NEXT?s.circular&&n===t.getLastIndex()?i.insert(0,e):r.insertAfter(e):o===b.PREV?s.circular&&0===n?i.insert(a.max-e.length+1,e):r.insertBefore(e):i.insert(0,e)}}))},t.updateVisiblePanels=function(){var t=this.state,e=this.options,n=this.panelManager,i=this.stateMachine.getState(),r=this.cameraElement,o=e.renderExternal;if(e.renderOnlyVisible)if(this.nearestPanel){var a,s=this.visiblePanels,l=this.calcVisiblePanels(),h=this.checkVisiblePanelChange(s,l),e=h.addedPanels,s=h.removedPanels;e.length<=0&&s.length<=0||(i.holding?l.push.apply(l,s):(h=l[0].getPosition(),t.positionOffset=h),l.forEach(function(e){e.setPositionCSS(t.positionOffset)}),o||(i.holding||s.forEach(function(e){e=e.getElement();e.parentNode&&r.removeChild(e)}),a=document.createDocumentFragment(),e.forEach(function(e){a.appendChild(e.getElement())}),r.appendChild(a)),i=l[0],s=l[l.length-1],s={min:(e=function(e){return e.getIndex()+(e.getCloneIndex()+1)*n.getPanelCount()})(i),max:e(s)},this.visiblePanels=l,this.flicking.trigger(P.VISIBLE_CHANGE,{type:P.VISIBLE_CHANGE,range:s}))}else for(this.visiblePanels=[];r.firstChild;)r.removeChild(r.firstChild)},t.checkVisiblePanelChange=function(i,r){var o=i.map(function(){return 0}),a=r.map(function(){return 0});return i.forEach(function(n,i){r.forEach(function(e,t){n===e&&(o[i]++,a[t]++)})}),{removedPanels:o.reduce(function(e,t,n){return 0===t?p(e,[i[n]]):e},[]),addedPanels:a.reduce(function(e,t,n){return 0===t?p(e,[r[n]]):e},[])}},t.resizePanels=function(e){var n,t,i=this.options,r=this.panelBboxes;!0!==i.isEqualSize?i.isEqualSize?(n=i.isEqualSize,e.forEach(function(e){var t=e.getOverlappedClass(n);t?(e.resize(r[t]),r[t]=e.getBbox()):e.resize()})):e.forEach(function(e){e.resize()}):(r.default||(i=e[0],r.default=i.getBbox()),t=r.default,e.forEach(function(e){e.resize(t)}))},t.createPanInput=function(){var e=this.options;this.panInput=new i.PanInput(this.viewportElement,{inputType:e.inputType,thresholdAngle:e.thresholdAngle,iOSEdgeSwipeThreshold:e.iOSEdgeSwipeThreshold,scale:e.horizontal?[-1,0]:[0,-1],releaseOnScroll:!0}),this.axes.connect(e.horizontal?["flick",""]:["","flick"],this.panInput)},e}(),e=function(c){function e(e,t){void 0===t&&(t={});var h=c.call(this)||this;if(h.contentsReadyChecker=null,h.isPanelChangedAtBeforeSync=!1,h.resize=function(){var e=h.viewport,t=h.options,n=h.getElement(),i=e.panelManager.allPanels();t.isConstantSize||i.forEach(function(e){return e.unCacheBbox()});var r=t.renderOnlyVisible&&!t.isConstantSize&&!0!==t.isEqualSize,t=n.parentElement,n=t.style.height;return t.style.height=t.offsetHeight+"px",e.unCacheBbox(),e.updateBbox(),r&&e.appendUncachedPanelElements(i),e.resize(),t.style.height=n,h},h.triggerEvent=function(e,t,n,i){void 0===i&&(i={});var r,o,a,s=h.viewport,l=!0;return s&&(r=s.stateMachine.getState(),o=(a=s.getScrollArea()).prev,a=a.next,a=O(s.getCameraPosition(),[o,o,a]),h.options.circular&&(a%=1),l=!c.prototype.trigger.call(h,e,y({type:e,index:h.getIndex(),panel:h.getCurrentPanel(),direction:r.direction,holding:r.holding,progress:a,axesEvent:t,isTrusted:n},i))),{onSuccess:function(e){return l||e(),this},onStopped:function(e){return l&&e(),this}}},h.moveCamera=function(e){var t,n,i=h.viewport,r=i.stateMachine.getState(),o=h.options,a=e.pos.flick,s=i.getCameraPosition();return e.isTrusted&&r.holding&&(t=o.horizontal?e.inputEvent.offsetX:e.inputEvent.offsetY,n=a-s,t=t<0==a<s,n=0===(n=o.circular&&t?(0<n?-1:1)*(i.getScrollAreaSize()-Math.abs(n)):n)?r.direction:0<n?b.NEXT:b.PREV,r.direction=n),r.delta+=e.delta.flick,i.moveCamera(a,e),h.triggerEvent(P.MOVE,e,e.isTrusted).onStopped(function(){i.moveCamera(s,e)})},A(e)){if(!(n=document.querySelector(e)))throw new Error("Base element doesn't exist.")}else{if(!e.nodeName||1!==e.nodeType)throw new Error("Element should be provided in string or HTMLElement.");n=e}h.wrapper=n,h.options=y({},u,t);var n=h.options,t=n.moveType;return t in a&&(n.moveType=a[t]),h.viewport=new K(h,h.options,h.triggerEvent),h.listenInput(),h.listenResize(),h}o(e,c);var t=e.prototype;return t.prev=function(e){var t=this.getCurrentPanel(),n=this.viewport.stateMachine.getState();return!t||n.type!==d||(t=t.prev())&&t.focus(e),this},t.next=function(e){var t=this.getCurrentPanel(),n=this.viewport.stateMachine.getState();return!t||n.type!==d||(t=t.next())&&t.focus(e),this},t.moveTo=function(e,t){var n=this.viewport,i=n.panelManager.get(e),r=n.stateMachine.getState();if(!i||r.type!==d)return this;var o=i.getAnchorPosition(),a=n.getHangerPosition(),s=i;this.options.circular&&(l=[o-(r=n.getScrollAreaSize()),o,o+r].reduce(function(e,t){return Math.abs(t-a)<Math.abs(e-a)?t:e},1/0)-i.getRelativeAnchorPosition(),r=i.getIdenticalPanels(),0<(o=l-o)?s=r[1]:o<0&&(s=r[r.length-1]),(s=s.clone(s.getCloneIndex(),!0)).setPosition(l));var l=this.getIndex();if(a===s.getAnchorPosition()&&l===e)return this;i=i.getIndex()===n.getCurrentIndex()?"":P.CHANGE;return n.moveTo(s,n.findEstimatedPosition(s),i,null,t),this},t.getIndex=function(){return this.viewport.getCurrentIndex()},t.getElement=function(){return this.wrapper},t.getSize=function(){return this.viewport.getSize()},t.getCurrentPanel=function(){var e=this.viewport.getCurrentPanel();return e||null},t.getPanel=function(e){e=this.viewport.panelManager.get(e);return e||null},t.getAllPanels=function(e){var t=this.viewport.panelManager;return(e?t.allPanels():t.originalPanels()).filter(function(e){return!!e})},t.getVisiblePanels=function(){return this.viewport.calcVisiblePanels()},t.getPanelCount=function(){return this.viewport.panelManager.getPanelCount()},t.getCloneCount=function(){return this.viewport.panelManager.getCloneCount()},t.getLastIndex=function(){return this.viewport.panelManager.getLastIndex()},t.setLastIndex=function(e){return this.viewport.setLastIndex(e),this},t.isPlaying=function(){return this.viewport.stateMachine.getState().playing},t.enableInput=function(){return this.viewport.enable(),this},t.disableInput=function(){return this.viewport.disable(),this},t.getStatus=function(){var e=this.viewport,t=e.panelManager.originalPanels().filter(function(e){return!!e}).map(function(e){return{html:e.getElement().outerHTML,index:e.getIndex(),position:e.getPosition()}});return{index:e.getCurrentIndex(),panels:t,position:e.getCameraPosition()}},t.setStatus=function(e){this.viewport.restore(e)},t.addPlugins=function(e){return this.viewport.addPlugins(e),this},t.removePlugins=function(e){return this.viewport.removePlugins(e),this},t.destroy=function(e){for(var t in void 0===e&&(e={}),this.off(),this.options.autoResize&&window.removeEventListener("resize",this.resize),this.viewport.destroy(e),null!==(e=this.contentsReadyChecker)&&void 0!==e&&e.destroy(),this)this[t]=null},t.prepend=function(e){var t=this.viewport,n=I(e),e=Math.max(t.panelManager.getRange().min-n.length,0),n=t.insert(e,n);return this.checkContentsReady(n),n},t.append=function(e){var t=this.viewport,e=t.insert(t.panelManager.getRange().max+1,e);return this.checkContentsReady(e),e},t.replace=function(e,t){t=this.viewport.replace(e,t);return this.checkContentsReady(t),t},t.remove=function(e,t){return void 0===t&&(t=1),this.viewport.remove(e,t)},t.getRenderingIndexes=function(e){var t=this.viewport,n=t.getVisiblePanels(),i=e.maintained.reduce(function(e,t){var n=t[0];return e[t[1]]=n,e},{}),r=e.list.length,e=e.added,e=p(n.map(function(e){return(e=e).getIndex()+(e.getCloneIndex()+1)*r}).filter(function(e){return null!=i[e%r]}),e),o=t.panelManager.allPanels();return t.setVisiblePanels(e.map(function(e){return o[e]})),e},t.beforeSync=function(e){var t=this,o=e.maintained,a=e.added,n=e.changed,r=e.removed,i=this.viewport,s=i.panelManager,l=this.options.circular,h=s.getCloneCount(),c=s.clonedPanels(),e=i.getVisiblePanels().filter(function(t){return k(r,function(e){return e===t.getIndex()})<0});if(i.setVisiblePanels(e),a.length<=0&&r.length<=0&&n.length<=0&&h===c.length)return this;var u=s.originalPanels(),g=[],f=B(h).map(function(){return[]});o.forEach(function(e){var t=e[0],e=e[1];g[e]=u[t],g[e].setIndex(e)}),a.forEach(function(e){g[e]=new D(null,e,t.viewport)}),l&&B(h).forEach(function(n){var i=c[n],r=f[n];o.forEach(function(e){var t=e[0],e=e[1];r[e]=i?i[t]:g[e].clone(n,!1),r[e].setIndex(e)}),a.forEach(function(e){var t=g[e];r[e]=t.clone(n,!1)})}),a.forEach(function(e){i.updateCheckedIndexes({min:e,max:e})}),r.forEach(function(e){i.updateCheckedIndexes({min:e-1,max:e+1})});var d=i.getCheckedIndexes();d.forEach(function(e,t){var n=e[0],i=e[1],e=a.filter(function(e){return e<n&&s.has(e)}).length-r.filter(function(e){return e<n}).length;d.splice(t,1,[n+e,i+e])}),0<n.length&&o.forEach(function(e){e=e[1];i.updateCheckedIndexes({min:e,max:e})}),s.replacePanels(g,f),this.isPanelChangedAtBeforeSync=!0},t.sync=function(e){var n=e.list,t=e.maintained,i=e.added,r=e.changed,o=e.removed;if(i.length<=0&&o.length<=0&&r.length<=0)return this;var a,s,l=this.viewport,h=this.options,c=h.renderOnlyVisible,u=h.circular,g=l.panelManager;c||(h=g.getRange(),e=e,u&&(a=h.max,s=n.length/(g.getCloneCount()+1)>>0,g=i.filter(function(e){return e<s}),o=o.filter(function(e){return e<=a}),e={added:g,maintained:t.filter(function(e){return e[0]<=a}),removed:o,changed:r.filter(function(e){return e[0]<=a})}),this.beforeSync(e));var f=c?l.getVisiblePanels():this.getAllPanels(!0);return i.forEach(function(e){var t=n[e],e=f[e];e.setElement(t),e.unCacheBbox()}),this.isPanelChangedAtBeforeSync&&(l.setVisiblePanels([]),this.isPanelChangedAtBeforeSync=!1),l.resize(),this},t.listenInput=function(){var n=this,e=n.viewport,i=e.stateMachine;n.eventContext={flicking:n,viewport:n.viewport,transitTo:i.transitTo,triggerEvent:n.triggerEvent,moveCamera:n.moveCamera,stopCamera:e.stopCamera};var r,o={};for(r in f)!function(){var t=f[r];o[t]=function(e){return i.fire(t,e,n.eventContext)}}();n.viewport.connectAxesHandler(o)},t.listenResize=function(){var t=this,e=this.options;e.autoResize&&window.addEventListener("resize",this.resize),e.resizeOnContentsReady&&((e=new n).on("preReady",function(){t.resize()}),e.on("readyElement",function(e){e.hasLoading&&e.isPreReadyOver&&t.resize()}),e.on("error",function(e){t.trigger(P.CONTENT_ERROR,{type:P.CONTENT_ERROR,element:e.element})}),e.check([this.wrapper]),this.contentsReadyChecker=e)},t.checkContentsReady=function(e){var t;null!==(t=this.contentsReadyChecker)&&void 0!==t&&t.check(e.map(function(e){return e.getElement()}))},e.VERSION="3.8.1",e.DIRECTION=b,e.EVENTS=P,e}(e);return e.withFlickingMethods=function(e,r){Object.keys(t).forEach(function(i){e[i]||(e[i]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=(n=this[r])[i].apply(n,e);return n===this[r]?this:n})})},e.DEFAULT_OPTIONS=u,e.MOVE_TYPE=s,e}); | ||
//# sourceMappingURL=flicking.min.js.map |
{ | ||
"name": "@egjs/flicking", | ||
"version": "3.8.0", | ||
"version": "3.8.1", | ||
"description": "Everyday 30 million people experience. It's reliable, flexible and extendable carousel.", | ||
@@ -89,3 +89,3 @@ "main": "dist/flicking.js", | ||
"dependencies": { | ||
"@egjs/axes": "^2.7.0", | ||
"@egjs/axes": "^2.8.0", | ||
"@egjs/component": "^2.2.2", | ||
@@ -92,0 +92,0 @@ "@egjs/imready": "^1.1.2", |
@@ -1,8 +0,1 @@ | ||
// flicking.js | ||
// flicking.min.js | ||
// flicking.pkgd.js | ||
// flicking.pkgd.min.js | ||
// flicking.esm.js | ||
const buildHelper = require("@egjs/build-helper"); | ||
@@ -13,2 +6,3 @@ | ||
"@egjs/component": "eg.Component", | ||
"@egjs/imready": "eg.ImReady", | ||
} | ||
@@ -15,0 +9,0 @@ const name = "eg.Flicking"; |
@@ -1935,2 +1935,3 @@ /** | ||
scale: options.horizontal ? [-1, 0] : [0, -1], | ||
releaseOnScroll: true, | ||
}); | ||
@@ -1937,0 +1938,0 @@ |
@@ -5,3 +5,3 @@ /** | ||
*/ | ||
import type { OnChange, OnFinish, OnHold } from "@egjs/axes"; | ||
import State from "./State"; | ||
@@ -17,3 +17,3 @@ import { STATE_TYPE, EVENTS } from "../consts"; | ||
public onHold(e: any, { viewport, triggerEvent, transitTo }: FlickingContext): void { | ||
public onHold(e: OnHold, { viewport, triggerEvent, transitTo }: FlickingContext): void { | ||
const options = viewport.options; | ||
@@ -54,3 +54,3 @@ const scrollArea = viewport.getScrollArea(); | ||
public onChange(e: any, { moveCamera, transitTo }: FlickingContext): void { | ||
public onChange(e: OnChange, { moveCamera, transitTo }: FlickingContext): void { | ||
if (!e.delta.flick) { | ||
@@ -66,3 +66,3 @@ return; | ||
public onFinish(e: any, { flicking, viewport, triggerEvent, transitTo }: FlickingContext) { | ||
public onFinish(e: OnFinish, { flicking, viewport, triggerEvent, transitTo }: FlickingContext) { | ||
const isTrusted = e && e.isTrusted; | ||
@@ -69,0 +69,0 @@ |
@@ -5,3 +5,3 @@ /** | ||
*/ | ||
import type { OnAnimationEnd, OnChange, OnRelease } from "@egjs/axes"; | ||
import State from "./State"; | ||
@@ -16,7 +16,7 @@ import { STATE_TYPE } from "../consts"; | ||
public onAnimationEnd(e: any, { transitTo }: FlickingContext): void { | ||
public onAnimationEnd(e: OnAnimationEnd, { transitTo }: FlickingContext): void { | ||
transitTo(STATE_TYPE.IDLE); | ||
} | ||
public onChange(e: any, { viewport, transitTo }: FlickingContext): void { | ||
public onChange(e: OnChange, { viewport, transitTo }: FlickingContext): void { | ||
// Can stop Axes's change event | ||
@@ -30,3 +30,3 @@ e.stop(); | ||
public onRelease(e: any, { transitTo }: FlickingContext): void { | ||
public onRelease(e: OnRelease, { transitTo }: FlickingContext): void { | ||
// This is needed when stopped hold start event | ||
@@ -33,0 +33,0 @@ if (e.delta.flick === 0) { |
@@ -5,3 +5,3 @@ /** | ||
*/ | ||
import type { OnChange, OnRelease } from "@egjs/axes"; | ||
import State from "./State"; | ||
@@ -16,3 +16,3 @@ import { STATE_TYPE, EVENTS } from "../consts"; | ||
public onChange(e: any, { moveCamera, transitTo }: FlickingContext): void { | ||
public onChange(e: OnChange, { moveCamera, transitTo }: FlickingContext): void { | ||
if (!e.delta.flick) { | ||
@@ -28,3 +28,3 @@ return; | ||
public onRelease(e: any, context: FlickingContext): void { | ||
public onRelease(e: OnRelease, context: FlickingContext): void { | ||
const { flicking, viewport, triggerEvent, transitTo, stopCamera } = context; | ||
@@ -96,3 +96,3 @@ | ||
// There're no panels | ||
e.stop(); | ||
(e as any).stop(); | ||
transitTo(STATE_TYPE.IDLE); | ||
@@ -99,0 +99,0 @@ return; |
@@ -5,3 +5,3 @@ /** | ||
*/ | ||
import type { OnChange, OnRelease, OnFinish } from "@egjs/axes"; | ||
import State from "./State"; | ||
@@ -18,3 +18,3 @@ import { STATE_TYPE, EVENTS, DIRECTION } from "../consts"; | ||
public onChange(e: any, context: FlickingContext): void { | ||
public onChange(e: OnChange, context: FlickingContext): void { | ||
const { flicking, triggerEvent, transitTo } = context; | ||
@@ -40,3 +40,3 @@ | ||
public onRelease(e: any, context: FlickingContext): void { | ||
public onRelease(e: OnRelease, context: FlickingContext): void { | ||
const { viewport, triggerEvent, transitTo } = context; | ||
@@ -58,2 +58,7 @@ | ||
if (!e.inputEvent.srcEvent.cancelable) { | ||
// Released by scrolling | ||
return; | ||
} | ||
// Can't handle select event here, | ||
@@ -64,3 +69,3 @@ // As "finish" axes event happens | ||
public onFinish(e: any, { viewport, triggerEvent, transitTo }: FlickingContext): void { | ||
public onFinish(e: OnFinish, { viewport, triggerEvent, transitTo }: FlickingContext): void { | ||
// Should transite to IDLE state before select event | ||
@@ -67,0 +72,0 @@ // As user expects hold is already finished |
@@ -5,3 +5,3 @@ /** | ||
*/ | ||
import type { OnHold, OnChange } from "@egjs/axes"; | ||
import State from "./State"; | ||
@@ -23,3 +23,3 @@ import { EVENTS, STATE_TYPE } from "../consts"; | ||
public onHold(e: any, { flicking, viewport, triggerEvent, transitTo }: FlickingContext): void { | ||
public onHold(e: OnHold, { flicking, viewport, triggerEvent, transitTo }: FlickingContext): void { | ||
// Shouldn't do any action until any panels on flicking area | ||
@@ -45,3 +45,3 @@ if (flicking.getPanelCount() <= 0) { | ||
// By methods call | ||
public onChange(e: any, context: FlickingContext): void { | ||
public onChange(e: OnChange, context: FlickingContext): void { | ||
const { triggerEvent, transitTo } = context; | ||
@@ -48,0 +48,0 @@ |
@@ -5,3 +5,3 @@ /** | ||
*/ | ||
import type { OnAnimationEnd, OnChange, OnFinish, OnHold, OnRelease } from "@egjs/axes"; | ||
import Panel from "../components/Panel"; | ||
@@ -30,19 +30,19 @@ import { ValueOf, Direction, StateType, FlickingContext } from "../types"; | ||
public onHold(e: any, context: FlickingContext): void { | ||
public onHold(e: OnHold, context: FlickingContext): void { | ||
// DO NOTHING | ||
} | ||
public onChange(e: any, context: FlickingContext): void { | ||
public onChange(e: OnChange, context: FlickingContext): void { | ||
// DO NOTHING | ||
} | ||
public onRelease(e: any, context: FlickingContext): void { | ||
public onRelease(e: OnRelease, context: FlickingContext): void { | ||
// DO NOTHING | ||
} | ||
public onAnimationEnd(e: any, context: FlickingContext): void { | ||
public onAnimationEnd(e: OnAnimationEnd, context: FlickingContext): void { | ||
// DO NOTHING | ||
} | ||
public onFinish(e: any, context: FlickingContext): void { | ||
public onFinish(e: OnFinish, context: FlickingContext): void { | ||
// DO NOTHING | ||
@@ -49,0 +49,0 @@ } |
@@ -13,2 +13,3 @@ /** | ||
import { DiffResult } from "@egjs/list-differ"; | ||
import { OnRelease } from "@egjs/axes"; | ||
@@ -97,8 +98,3 @@ export type ValueOf<T> = T[keyof T]; | ||
viewport: Viewport; | ||
axesEvent: { | ||
delta: { flick: number }; | ||
depaPos: { flick: number }; | ||
destPos: { flick: number }; | ||
duration: number; | ||
}; | ||
axesEvent: OnRelease; | ||
state: State; | ||
@@ -105,0 +101,0 @@ swipeDistance: number; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3679658
25562
Updated@egjs/axes@^2.8.0