@egjs/flicking
Advanced tools
Comparing version 4.0.0-beta.5 to 4.0.0-beta.6
@@ -61,2 +61,3 @@ import Flicking, { FlickingOptions } from "../Flicking"; | ||
getNextAnchor(anchor: AnchorPoint): AnchorPoint | null; | ||
getProgressInPanel(panel: Panel): number; | ||
findAnchorIncludePosition(position: number): AnchorPoint | null; | ||
@@ -69,4 +70,3 @@ findNearestAnchor(position: number): AnchorPoint | null; | ||
updateAnchors(): this; | ||
updatePosition(): this; | ||
updateAdaptiveHeight(): this; | ||
updateAdaptiveHeight(): void; | ||
resetNeedPanelHistory(): this; | ||
@@ -73,0 +73,0 @@ protected _resetInternalValues(): void; |
@@ -15,2 +15,3 @@ export declare const CODE: { | ||
readonly NOT_INITIALIZED: 12; | ||
readonly NO_ACTIVE: 13; | ||
}; | ||
@@ -25,8 +26,9 @@ export declare const MESSAGE: { | ||
readonly POSITION_NOT_REACHABLE: (position: number) => string; | ||
readonly TRANSFORM_NOT_SUPPORTED: "Browser does not support CSS transform"; | ||
readonly STOP_CALLED_BY_USER: "Event stop() is called by user"; | ||
readonly ANIMATION_INTERRUPTED: "Animation is interrupted by user input"; | ||
readonly ANIMATION_ALREADY_PLAYING: "Animation is already playing"; | ||
readonly NOT_ALLOWED_IN_FRAMEWORK: "This behavior is not allowed in the frameworks like React, Vue, or Angular"; | ||
readonly NOT_INITIALIZED: "Flicking is not initialized yet, call init() first"; | ||
readonly TRANSFORM_NOT_SUPPORTED: "Browser does not support CSS transform."; | ||
readonly STOP_CALLED_BY_USER: "Event stop() is called by user."; | ||
readonly ANIMATION_INTERRUPTED: "Animation is interrupted by user input."; | ||
readonly ANIMATION_ALREADY_PLAYING: "Animation is already playing."; | ||
readonly NOT_ALLOWED_IN_FRAMEWORK: "This behavior is not allowed in the frameworks like React, Vue, or Angular."; | ||
readonly NOT_INITIALIZED: "Flicking is not initialized yet, call init() first."; | ||
readonly NO_ACTIVE: "There's no active panel that Flicking has selected. This may be due to the absence of any panels."; | ||
}; |
@@ -22,4 +22,5 @@ import { OnRelease } from "@egjs/axes"; | ||
disable(): this; | ||
updatePosition(_progressInPanel: number): this; | ||
updateInput(): this; | ||
resetActivePanel(): this; | ||
resetActive(): this; | ||
moveToPanel(panel: Panel, { duration, direction, axesEvent }: { | ||
@@ -37,4 +38,4 @@ duration: number; | ||
}): Promise<void>; | ||
protected _setActivePanel: (newActivePanel: Panel, prevActivePanel: Panel | null, isTrusted: boolean) => void; | ||
protected _setActive: (newActivePanel: Panel, prevActivePanel: Panel | null, isTrusted: boolean) => void; | ||
} | ||
export default Control; |
import { OnRelease } from "@egjs/axes"; | ||
import Control from "./Control"; | ||
export interface FreeControlOptions { | ||
stopAtEdge: boolean; | ||
} | ||
declare class FreeControl extends Control { | ||
private _stopAtEdge; | ||
get stopAtEdge(): FreeControlOptions["stopAtEdge"]; | ||
set stopAtEdge(val: FreeControlOptions["stopAtEdge"]); | ||
constructor({ stopAtEdge }?: Partial<FreeControlOptions>); | ||
updatePosition(progressInPanel: number): this; | ||
moveToPosition(position: number, duration: number, axesEvent?: OnRelease): Promise<void>; | ||
} | ||
export default FreeControl; |
@@ -10,3 +10,3 @@ import Component from "@egjs/component"; | ||
import { LiteralUnion, ValueOf } from "./type/internal"; | ||
import { ElementLike, Plugin, Status } from "./type/external"; | ||
import { ElementLike, Plugin, Status, MoveTypeOptions } from "./type/external"; | ||
export interface FlickingEvents { | ||
@@ -45,3 +45,3 @@ [EVENTS.READY]: ReadyEvent; | ||
inputType: string[]; | ||
moveType: ValueOf<typeof MOVE_TYPE>; | ||
moveType: ValueOf<typeof MOVE_TYPE> | MoveTypeOptions<ValueOf<typeof MOVE_TYPE>>; | ||
threshold: number; | ||
@@ -52,2 +52,3 @@ interruptable: boolean; | ||
preventClickOnDrag: boolean; | ||
disableOnInit: boolean; | ||
renderOnlyVisible: boolean; | ||
@@ -82,2 +83,3 @@ autoInit: boolean; | ||
private _preventClickOnDrag; | ||
private _disableOnInit; | ||
private _renderOnlyVisible; | ||
@@ -122,2 +124,3 @@ private _autoResize; | ||
get preventClickOnDrag(): FlickingOptions["preventClickOnDrag"]; | ||
get disableOnInit(): FlickingOptions["disableOnInit"]; | ||
get renderOnlyVisible(): FlickingOptions["renderOnlyVisible"]; | ||
@@ -144,6 +147,7 @@ get autoInit(): boolean; | ||
set preventClickOnDrag(val: FlickingOptions["preventClickOnDrag"]); | ||
set disableOnInit(val: FlickingOptions["disableOnInit"]); | ||
set renderOnlyVisible(val: FlickingOptions["renderOnlyVisible"]); | ||
set autoResize(val: FlickingOptions["autoResize"]); | ||
set useOrderManipulator(val: FlickingOptions["useOrderManipulator"]); | ||
constructor(root: HTMLElement | string, { align, defaultIndex, horizontal, circular, bound, adaptive, needPanelThreshold, deceleration, duration, easing, inputType, moveType, threshold, interruptable, bounce, iOSEdgeSwipeThreshold, preventClickOnDrag, renderOnlyVisible, autoInit, autoResize, renderExternal, useOrderManipulator }?: Partial<FlickingOptions>); | ||
constructor(root: HTMLElement | string, { align, defaultIndex, horizontal, circular, bound, adaptive, needPanelThreshold, deceleration, duration, easing, inputType, moveType, threshold, interruptable, bounce, iOSEdgeSwipeThreshold, preventClickOnDrag, disableOnInit, renderOnlyVisible, autoInit, autoResize, renderExternal, useOrderManipulator }?: Partial<FlickingOptions>); | ||
init(): this; | ||
@@ -150,0 +154,0 @@ destroy(): void; |
import Flicking from "../Flicking"; | ||
import { MOVE_TYPE } from "../const/external"; | ||
import { ValueOf } from "./internal"; | ||
import { FreeControlOptions } from "../control/FreeControl"; | ||
export declare type ElementLike = string | HTMLElement; | ||
@@ -10,7 +13,7 @@ export interface Plugin { | ||
index?: number; | ||
position?: number; | ||
visibleOffset?: { | ||
index: number; | ||
position: number; | ||
position?: { | ||
panel: number; | ||
progressInPanel: number; | ||
}; | ||
visibleOffset?: number; | ||
panels: Array<{ | ||
@@ -21,1 +24,4 @@ index: number; | ||
} | ||
export declare type MoveTypeOptions<T extends ValueOf<typeof MOVE_TYPE>> = T extends typeof MOVE_TYPE.FREE_SCROLL ? [T] | [T, Partial<FreeControlOptions>] : [ | ||
T | ||
]; |
@@ -7,5 +7,5 @@ /* | ||
repository: https://github.com/naver/egjs-flicking | ||
version: 4.0.0-beta.5 | ||
version: 4.0.0-beta.6 | ||
*/ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("@egjs/component"),require("@egjs/axes")):"function"==typeof define&&define.amd?define(["@egjs/component","@egjs/axes"],n):(e="undefined"!=typeof globalThis?globalThis:e||self).Flicking=n(e.eg.Component,e.eg.Axes)}(this,function(T,o){"use strict";var i=function(e,n){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])})(e,n)};function a(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function t(){this.constructor=e}i(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}var r=function(){return(r=Object.assign||function(e){for(var n,t=1,i=arguments.length;t<i;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e}).apply(this,arguments)};function t(e,a,l,s){return new(l=l||Promise)(function(t,n){function i(e){try{o(s.next(e))}catch(e){n(e)}}function r(e){try{o(s.throw(e))}catch(e){n(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof l?n:new l(function(e){e(n)})).then(i,r)}o((s=s.apply(e,a||[])).next())})}function f(t,i){var r,o,a,l={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},e={next:n(0),throw:n(1),return:n(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function n(n){return function(e){return function(n){if(r)throw new TypeError("Generator is already executing.");for(;l;)try{if(r=1,o&&(a=2&n[0]?o.return:n[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,n[1])).done)return a;switch(o=0,(n=a?[2&n[0],a.value]:n)[0]){case 0:case 1:a=n;break;case 4:return l.label++,{value:n[1],done:!1};case 5:l.label++,o=n[1],n=[0];continue;case 7:n=l.ops.pop(),l.trys.pop();continue;default:if(!(a=0<(a=l.trys).length&&a[a.length-1])&&(6===n[0]||2===n[0])){l=0;continue}if(3===n[0]&&(!a||n[1]>a[0]&&n[1]<a[3])){l.label=n[1];break}if(6===n[0]&&l.label<a[1]){l.label=a[1],a=n;break}if(a&&l.label<a[2]){l.label=a[2],l.ops.push(n);break}a[2]&&l.ops.pop(),l.trys.pop();continue}n=i.call(t,l)}catch(e){n=[6,e],o=0}finally{r=a=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,e])}}}function c(e){var n="function"==typeof Symbol&&Symbol.iterator,t=n&&e[n],i=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&i>=e.length?void 0:e)&&e[i++],done:!e}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function h(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var i,r,o=t.call(e),a=[];try{for(;(void 0===n||0<n--)&&!(i=o.next()).done;)a.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(t=o.return)&&t.call(o)}finally{if(r)throw r.error}}return a}function d(e,n){for(var t=0,i=n.length,r=e.length;t<i;t++,r++)e[r]=n[t];return e}function e(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return e.forEach(function(n){Object.keys(n).forEach(function(e){t[e]=n[e]})}),t}function l(e,n,t){return Math.max(Math.min(e,t),n)}function b(e,n){if(!e)throw new N(x(n),A.NOT_ATTACHED_TO_FLICKING);return e}function g(e){return[].slice.call(e)}function p(e){return Boolean(e)&&e.constructor===Array}function s(e,n){var t;if(W(e))switch(e){case G.PREV:t=0;break;case G.CENTER:t=.5*n;break;case G.NEXT:t=n;break;default:if(null==(t=B(e,n)))throw new N(w("align",e),A.WRONG_OPTION)}else t=e;return t}function _(e,n){return e===n?V.NONE:e<n?V.NEXT:V.PREV}function m(e,n){return l(e<0?e+n:e,0,n)}function v(e,n){var t,i;try{for(var r=c(e),o=r.next();!o.done;o=r.next())if(o.value===n)return 1}catch(e){t={error:e}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}}function u(e,n){for(var t=0;t<e.length;t++)if(n(e[t]))return t;return-1}function E(e,n,t){return(e-n)/(t-n)}function P(e){return window.getComputedStyle(e)||e.currentStyle}var y,N=function(i){function r(e,n){var t=i.call(this,e)||this;return t.message=e,t.code=n,Object.setPrototypeOf(t,r.prototype),t.name="FlickingError",t}return a(r,i),r}(Error),A={WRONG_TYPE:0,ELEMENT_NOT_FOUND:1,VAL_MUST_NOT_NULL:2,NOT_ATTACHED_TO_FLICKING:3,WRONG_OPTION:4,INDEX_OUT_OF_RANGE:5,POSITION_NOT_REACHABLE:6,TRANSFORM_NOT_SUPPORTED:7,STOP_CALLED_BY_USER:8,ANIMATION_INTERRUPTED:9,ANIMATION_ALREADY_PLAYING:10,NOT_ALLOWED_IN_FRAMEWORK:11,NOT_INITIALIZED:12},I=function(e,n){return e+"("+typeof e+") is not a "+n.map(function(e){return'"'+e+'"'}).join(" or ")+"."},C=function(e){return'Element with selector "'+e+'" not found.'},O=function(e,n){return n+" should be provided. Given: "+e},x=function(e){return e+' is not attached to the Flicking instance. "init()" should be called first.'},w=function(e,n){return'Option "'+e+'" is not in correct format, given: '+n},R=function(e,n,t){return'Index "'+e+'" is out of range: should be between '+n+" and "+t+"."},k=function(e){return'Position "'+e+'" is not reachable.'},S="Browser does not support CSS transform",D="Event stop() is called by user",j="Animation is interrupted by user input",L="Animation is already playing",M="This behavior is not allowed in the frameworks like React, Vue, or Angular",z="Flicking is not initialized yet, call init() first",H={READY:"ready",BEFORE_RESIZE:"beforeResize",AFTER_RESIZE:"afterResize",HOLD_START:"holdStart",HOLD_END:"holdEnd",MOVE_START:"moveStart",MOVE:"move",MOVE_END:"moveEnd",WILL_CHANGE:"willChange",CHANGED:"changed",WILL_RESTORE:"willRestore",RESTORED:"restored",SELECT:"select",NEED_PANEL:"needPanel",VISIBLE_CHANGE:"visibleChange",REACH_EDGE:"reachEdge"},G={PREV:"prev",CENTER:"center",NEXT:"next"},V={PREV:"PREV",NEXT:"NEXT",NONE:null},F={SNAP:"snap",FREE_SCROLL:"freeScroll"},n={__proto__:null,EVENTS:H,ALIGN:G,DIRECTION:V,MOVE_TYPE:F,ERROR_CODE:A},B=function(e,n){var t=/(?:(\+|\-)\s*)?(\d+(?:\.\d+)?(%|px)?)/g;if("number"==typeof e)return e;for(var i=0,r=0,o=t.exec(e);null!=o;){var a=o[1],l=o[2],s=o[3],l=parseFloat(l);if(!(a=i<=0?a||"+":a))return null;"%"===s&&(l=l/100*n),r+="+"===a?l:-l,++i,o=t.exec(e)}return 0===i?null:r},W=function(e){return"string"==typeof e},X=function(){function e(e){this._el=e,this._width=0,this._height=0,this._padding={left:0,right:0,top:0,bottom:0},this._isBorderBoxSizing=!1}var n=e.prototype;return Object.defineProperty(n,"element",{get:function(){return this._el},enumerable:!1,configurable:!0}),Object.defineProperty(n,"width",{get:function(){return this._width-this._padding.left-this._padding.right},enumerable:!1,configurable:!0}),Object.defineProperty(n,"height",{get:function(){return this._height-this._padding.top-this._padding.bottom},enumerable:!1,configurable:!0}),Object.defineProperty(n,"padding",{get:function(){return this._padding},enumerable:!1,configurable:!0}),n.setSize=function(e){var n=e.width,t=e.height,i=this._el,r=this._padding,e=this._isBorderBoxSizing;null!=n&&(W(n)?i.style.width=n:(n=e?n+r.left+r.right:n,i.style.width=n+"px")),null!=t&&(W(t)?i.style.height=t:(t=e?t+r.top+r.bottom:t,i.style.height=t+"px")),this.resize()},n.resize=function(){var e=this._el,n=P(e);this._width=e.offsetWidth,this._height=e.offsetHeight,this._padding={left:parseFloat(n.paddingLeft),right:parseFloat(n.paddingRight),top:parseFloat(n.paddingTop),bottom:parseFloat(n.paddingBottom)},this._isBorderBoxSizing="border-box"===n.boxSizing},e}();(le=y=y||{})[le.IDLE=0]="IDLE",le[le.HOLDING=1]="HOLDING",le[le.DRAGGING=2]="DRAGGING",le[le.ANIMATING=3]="ANIMATING",le[le.DISABLED=4]="DISABLED";var U=function(){function e(){}var n=e.prototype;return n.onHold=function(e){},n.onChange=function(e){},n.onRelease=function(e){},n.onAnimationEnd=function(e){},n.onFinish=function(e){},e}(),Y=function(n){function e(){var e=null!==n&&n.apply(this,arguments)||this;return e.holding=!1,e.animating=!1,e}a(e,n);var t=e.prototype;return t.onHold=function(e){var n=e.flicking,t=e.axesEvent,e=e.transitTo;n.renderer.panelCount<=0?e(y.DISABLED):(t=new T.ComponentEvent(H.HOLD_START,{axesEvent:t}),n.trigger(t),t.isCanceled()?e(y.DISABLED):e(y.HOLDING))},t.onChange=function(e){var n=e.flicking,t=e.axesEvent,i=e.transitTo,r=n.control.controller.animatingContext,t=new T.ComponentEvent(H.MOVE_START,{isTrusted:t.isTrusted,holding:this.holding,direction:_(r.start,r.end),axesEvent:t});n.trigger(t),t.isCanceled()?i(y.DISABLED):i(y.ANIMATING).onChange(e)},e}(U),K=function(n){function e(){var e=null!==n&&n.apply(this,arguments)||this;return e.holding=!0,e.animating=!1,e._releaseEvent=null,e}a(e,n);var t=e.prototype;return t.onChange=function(e){var n=e.flicking,t=e.axesEvent,i=e.transitTo,r=t.inputEvent,r=n.horizontal?r.offsetX:r.offsetY,t=new T.ComponentEvent(H.MOVE_START,{isTrusted:t.isTrusted,holding:this.holding,direction:_(0,-r),axesEvent:t});n.trigger(t),t.isCanceled()?i(y.DISABLED):i(y.DRAGGING).onChange(e)},t.onRelease=function(e){var n=e.flicking,t=e.axesEvent,e=e.transitTo;if(n.trigger(new T.ComponentEvent(H.HOLD_END,{axesEvent:t})),0!==t.delta.flick)return t.setTo({flick:n.camera.position},0),void e(y.IDLE);this._releaseEvent=t},t.onFinish=function(e){var n=e.flicking;if((0,e.transitTo)(y.IDLE),this._releaseEvent){var t,i=this._releaseEvent.inputEvent.srcEvent;t="touchend"===i.type?(e=i.changedTouches[0],document.elementFromPoint(e.clientX,e.clientY)):i.target;var r,o,i=n.renderer.panels,a=null;try{for(var l=c(i),s=l.next();!s.done;s=l.next()){var u=s.value;if(u.contains(t)){a=u;break}}}catch(e){o={error:e}}finally{try{s&&!s.done&&(r=l.return)&&r.call(l)}finally{if(o)throw o.error}}a&&(r=n.camera.position,o=a.position,n.trigger(new T.ComponentEvent(H.SELECT,{index:a.index,panel:a,direction:_(r,o)})))}},e}(U),Z={HOLD:"hold",CHANGE:"change",RELEASE:"release",ANIMATION_END:"animationEnd",FINISH:"finish"},q="flick",J=function(n){function e(){var e=null!==n&&n.apply(this,arguments)||this;return e.holding=!0,e.animating=!0,e}a(e,n);var t=e.prototype;return t.onChange=function(e){var n,t=e.flicking,i=e.axesEvent,r=e.transitTo;i.delta[q]&&(e=(n=t.camera).position,n.lookAt(i.pos[q]),i=new T.ComponentEvent(H.MOVE,{isTrusted:i.isTrusted,holding:this.holding,direction:_(0,i.delta[q]),axesEvent:i}),t.trigger(i),i.isCanceled()&&(n.lookAt(e),r(y.DISABLED)))},t.onRelease=function(e){var n=e.flicking,t=e.axesEvent,i=e.transitTo;n.trigger(new T.ComponentEvent(H.HOLD_END,{axesEvent:t})),n.renderer.panelCount<=0?i(y.IDLE):(i(y.ANIMATING),e=n.control,i=t.destPos[q],n=Math.max(t.duration,n.duration),e.moveToPosition(i,n,t))},e}(U),Q=function(n){function e(){var e=null!==n&&n.apply(this,arguments)||this;return e.holding=!1,e.animating=!0,e}a(e,n);var t=e.prototype;return t.onHold=function(e){var n=e.flicking,t=e.axesEvent,e=e.transitTo,t=new T.ComponentEvent(H.HOLD_START,{axesEvent:t});n.trigger(t),t.isCanceled()?e(y.DISABLED):e(y.DRAGGING)},t.onChange=function(e){var n,t=e.flicking,i=e.axesEvent,r=e.transitTo;i.delta.flick&&(e=(n=t.camera).position,n.lookAt(i.pos.flick),i=new T.ComponentEvent(H.MOVE,{isTrusted:i.isTrusted,holding:this.holding,direction:_(0,i.delta.flick),axesEvent:i}),t.trigger(i),i.isCanceled()&&(t.camera.lookAt(e),r(y.DISABLED)))},t.onFinish=function(e){var n=e.flicking,t=e.axesEvent,i=e.transitTo,e=n.camera,e=e.findAnchorIncludePosition(e.position);n.horizontal&&n.adaptive&&e&&n.viewport.setSize({height:e.panel.height}),i(y.IDLE);i=n.control.controller.animatingContext;n.trigger(new T.ComponentEvent(H.MOVE_END,{isTrusted:t.isTrusted,direction:_(i.start,i.end),axesEvent:t}))},e}(U),$=function(n){function e(){var e=null!==n&&n.apply(this,arguments)||this;return e.holding=!1,e.animating=!0,e}a(e,n);var t=e.prototype;return t.onAnimationEnd=function(e){(0,e.transitTo)(y.IDLE)},t.onChange=function(e){var n=e.axesEvent,e=e.transitTo;n.stop(),e(y.IDLE)},t.onRelease=function(e){var n=e.axesEvent,e=e.transitTo;0===n.delta.flick&&e(y.IDLE)},e}(U),ee=function(){function e(){var t=this;this.transitTo=function(e){var n;switch(e){case y.IDLE:n=new Y;break;case y.HOLDING:n=new K;break;case y.DRAGGING:n=new J;break;case y.ANIMATING:n=new Q;break;case y.DISABLED:n=new $}return t._state=n,t._state},this._state=new Y}var n=e.prototype;return Object.defineProperty(n,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),n.fire=function(e,n){var t=this._state,i=r(r({},n),{transitTo:this.transitTo});switch(e){case Z.HOLD:t.onHold(i);break;case Z.CHANGE:t.onChange(i);break;case Z.RELEASE:t.onRelease(i);break;case Z.ANIMATION_END:t.onAnimationEnd(i);break;case Z.FINISH:t.onFinish(i)}},e}(),ne=function(){function e(){this._resetInternalValues(),this._stateMachine=new ee}var n=e.prototype;return Object.defineProperty(n,"axes",{get:function(){return this._axes},enumerable:!1,configurable:!0}),Object.defineProperty(n,"state",{get:function(){return this._stateMachine.state},enumerable:!1,configurable:!0}),Object.defineProperty(n,"animatingContext",{get:function(){return this._animatingContext},enumerable:!1,configurable:!0}),Object.defineProperty(n,"enabled",{get:function(){var e;return null!==(e=null===(e=this._panInput)||void 0===e?void 0:e.isEnable())&&void 0!==e&&e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"position",{get:function(){var e;return null!==(e=null===(e=this._axes)||void 0===e?void 0:e.get([q])[q])&&void 0!==e?e:0},enumerable:!1,configurable:!0}),Object.defineProperty(n,"bounce",{get:function(){var e;return null===(e=this._axes)||void 0===e?void 0:e.axis[q].bounce},enumerable:!1,configurable:!0}),n.init=function(t){var e,i=this;this._flicking=t,this._axes=new o(((e={})[q]={range:[0,0],circular:!1,bounce:[0,0]},e),{deceleration:t.deceleration,interruptable:t.interruptable,easing:t.easing}),this._panInput=new o.PanInput(t.viewport.element,{inputType:t.inputType,iOSEdgeSwipeThreshold:t.iOSEdgeSwipeThreshold,scale:t.horizontal?[-1,0]:[0,-1]});var r=this._axes;r.connect(t.horizontal?[q,""]:["",q],this._panInput);for(var n in Z)!function(e){var n=Z[e];r.on(n,function(e){i._stateMachine.fire(n,{flicking:t,axesEvent:e})})}(n);return this},n.destroy=function(){var e;null!==(e=this._axes)&&void 0!==e&&e.destroy(),null!==(e=this._panInput)&&void 0!==e&&e.destroy(),this._resetInternalValues()},n.enable=function(){var e;return null!==(e=this._panInput)&&void 0!==e&&e.enable(),this},n.disable=function(){var e;return null!==(e=this._panInput)&&void 0!==e&&e.disable(),this},n.update=function(){var n,t,e=b(this._flicking,"Control"),i=e.camera,r=this._axes,o=i.controlParams,a=r.axis[q];return a.circular=[o.circular,o.circular],a.range=[o.range.min,o.range.max],a.bounce=(n=e.bounce,t=i.size,(p(n)?n.map(function(e){return B(e,t)}):[i=B(n,t),i]).map(function(e){if(null==e)throw new N(w("bounce",n),A.WRONG_OPTION);return e})),r.axm.set(((r={})[q]=o.position,r)),this},n.animateTo=function(n,t,r){var i=this,o=this._axes;if(!o)return Promise.reject(new N(x("Control"),A.NOT_ATTACHED_TO_FLICKING));var e=o.get([q])[q];if(e===n)return b(this._flicking,"Control").camera.lookAt(n),Promise.resolve();this._animatingContext={start:e,end:n,offset:0};function a(){var e;o.once(Z.FINISH,function(){i._animatingContext={start:0,end:0,offset:0}}),r?r.setTo(((e={})[q]=n,e),t):o.setTo(((e={})[q]=n,e),t)}return 0===t?(a(),o.axm.set(((e={})[q]=n,e)),Promise.resolve()):new Promise(function(e,n){function t(){o.off(Z.HOLD,i),e()}var i=function(){o.off(Z.FINISH,t),n(new N(j,A.ANIMATION_INTERRUPTED))};o.once(Z.FINISH,t),r||o.once(Z.HOLD,i),a()})},n._resetInternalValues=function(){this._flicking=null,this._axes=null,this._panInput=null,this._animatingContext={start:0,end:0,offset:0}},e}(),te=function(){function e(){var o=this;this._setActivePanel=function(e,n,t){var i,r=b(o._flicking,"Control");(o._activePanel=e)!==n?r.trigger(new T.ComponentEvent(H.CHANGED,{index:e.index,panel:e,prevIndex:null!==(i=null==n?void 0:n.index)&&void 0!==i?i:-1,prevPanel:n,isTrusted:t,direction:n?_(n.position,e.position):V.NONE})):r.trigger(new T.ComponentEvent(H.RESTORED,{isTrusted:t}))},this._flicking=null,this._controller=new ne,this._activePanel=null}var n=e.prototype;return Object.defineProperty(n,"controller",{get:function(){return this._controller},enumerable:!1,configurable:!0}),Object.defineProperty(n,"activeIndex",{get:function(){var e;return null!==(e=null===(e=this._activePanel)||void 0===e?void 0:e.index)&&void 0!==e?e:-1},enumerable:!1,configurable:!0}),Object.defineProperty(n,"activePanel",{get:function(){return this._activePanel},enumerable:!1,configurable:!0}),Object.defineProperty(n,"animating",{get:function(){return this._controller.state.animating},enumerable:!1,configurable:!0}),Object.defineProperty(n,"holding",{get:function(){return this._controller.state.holding},enumerable:!1,configurable:!0}),n.init=function(e){return this._flicking=e,this._controller.init(e),this},n.destroy=function(){this._controller.destroy(),this._flicking=null,this._activePanel=null},n.enable=function(){return this._controller.enable(),this},n.disable=function(){return this._controller.disable(),this},n.updateInput=function(){return this._controller.update(),this},n.resetActivePanel=function(){return this._activePanel=null,this},n.moveToPanel=function(o,e){var a=e.duration,n=e.direction,l=void 0===n?V.NONE:n,s=e.axesEvent;return t(this,void 0,void 0,function(){var n,t,i,r;return f(this,function(e){if(r=b(this._flicking,"Control"),t=r.camera,n=o.position,t.canReach(o))t.controlParams.circular&&(i=this._controller.position,r=t.rangeDiff,n=[n,n+r,n-r].filter(function(e){return l===V.NONE||(l===V.PREV?e<=i:i<=e)}).reduce(function(e,n){return Math.abs(i-n)<Math.abs(i-e)?n:e},1/0));else{if(t=t.findNearestAnchor(n),o.removed||!t)return[2,Promise.reject(new N(k(o.position),A.POSITION_NOT_REACHABLE))];n=t.position,o=t.panel}return this._triggerIndexChangeEvent(o,o.position,s),[2,this._animateToPosition({position:n,duration:a,newActivePanel:o,axesEvent:s})]})})},n._triggerIndexChangeEvent=function(e,n,t){var i=b(this._flicking,"Control"),r=e!==this._activePanel?H.WILL_CHANGE:H.WILL_RESTORE,o=i.camera,a=this._activePanel,n=new T.ComponentEvent(r,{index:e.index,panel:e,isTrusted:(null==t?void 0:t.isTrusted)||!1,direction:_(null!==(a=null==a?void 0:a.position)&&void 0!==a?a:o.position,n)});if(i.trigger(n),n.isCanceled())throw new N(D,A.STOP_CALLED_BY_USER)},n._animateToPosition=function(e){var a=e.position,l=e.duration,s=e.newActivePanel,u=e.axesEvent;return t(this,void 0,void 0,function(){var n,t,i,r,o=this;return f(this,function(e){return n=this._activePanel,t=function(){return o._controller.animateTo(a,l,u)},i=(null==u?void 0:u.isTrusted)||!1,0===l?(r=t(),this._setActivePanel(s,n,i),[2,r]):[2,t().then(function(){return o._setActivePanel(s,n,i)})]})})},e}(),ie=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return a(n,e),n.prototype.moveToPosition=function(s,u,c){return t(this,void 0,void 0,function(){var n,t,i,r,o,a,l;return f(this,function(e){return r=b(this._flicking,"Control"),o=r.camera,n=this._activePanel,i=o.clampToReachablePosition(s),t=o.findNearestAnchor(i),console.log(t),t&&n?(i=n.position,r=Math.abs(s-i)>=r.threshold,o=i<s?o.getNextAnchor(t):o.getPrevAnchor(t),r&&t.position!==n.position?(l=t.panel,a=t.position):r&&o?(l=o.panel,a=o.position):(a=n.position,l=n),this._triggerIndexChangeEvent(l,s,c),[2,this._animateToPosition({position:a,duration:u,newActivePanel:l,axesEvent:c})]):[2,Promise.reject(new N(k(s),A.POSITION_NOT_REACHABLE))]})})},n}(te),re=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return a(n,e),n.prototype.moveToPosition=function(i,r,o){return t(this,void 0,void 0,function(){var n,t;return f(this,function(e){return t=b(this._flicking,"Control"),n=t.camera,t=n.clampToReachablePosition(i),(t=n.findAnchorIncludePosition(t))?((t=t.panel)!==this._activePanel&&this._triggerIndexChangeEvent(t,i,o),[2,this._animateToPosition({position:i,duration:r,newActivePanel:t,axesEvent:o})]):[2,Promise.reject(new N(k(i),A.POSITION_NOT_REACHABLE))]})})},n}(te),oe={__proto__:null,Control:te,SnapControl:ie,FreeControl:re,AxesController:ne,State:U,IdleState:Y,HoldingState:K,DraggingState:J,AnimatingState:Q,DisabledState:$,StateMachine:ee},ae=function(){function e(e){var n=e.index,t=e.position,e=e.panel;this._index=n,this._pos=t,this._panel=e}var n=e.prototype;return Object.defineProperty(n,"index",{get:function(){return this._index},enumerable:!1,configurable:!0}),Object.defineProperty(n,"position",{get:function(){return this._pos},enumerable:!1,configurable:!0}),Object.defineProperty(n,"panel",{get:function(){return this._panel},enumerable:!1,configurable:!0}),e}(),le=function(){function e(e){var l=this,e=(void 0===e?{}:e).align,e=void 0===e?G.CENTER:e;this._checkTranslateSupport=function(){var n,e,t=document.documentElement.style,i="";try{for(var r=c(["webkitTransform","msTransform","MozTransform","OTransform","transform"]),o=r.next();!o.done;o=r.next()){var a=o.value;a in t&&(i=a)}}catch(e){n={error:e}}finally{try{o&&!o.done&&(e=r.return)&&e.call(r)}finally{if(n)throw n.error}}if(!i)throw new N(S,A.TRANSFORM_NOT_SUPPORTED);l._transform=i},this._flicking=null,this._resetInternalValues(),this._align=e}var n=e.prototype;return Object.defineProperty(n,"element",{get:function(){return this._el},enumerable:!1,configurable:!0}),Object.defineProperty(n,"position",{get:function(){return this._position},enumerable:!1,configurable:!0}),Object.defineProperty(n,"alignPosition",{get:function(){return this._alignPos},enumerable:!1,configurable:!0}),Object.defineProperty(n,"offset",{get:function(){return this._offset},set:function(e){this._offset=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"range",{get:function(){return this._range},enumerable:!1,configurable:!0}),Object.defineProperty(n,"rangeDiff",{get:function(){return this._range.max-this._range.min},enumerable:!1,configurable:!0}),Object.defineProperty(n,"visiblePanels",{get:function(){return this._visiblePanels},enumerable:!1,configurable:!0}),Object.defineProperty(n,"visibleRange",{get:function(){return{min:this._position-this._alignPos,max:this._position-this._alignPos+this.size}},enumerable:!1,configurable:!0}),Object.defineProperty(n,"anchorPoints",{get:function(){return this._anchors},enumerable:!1,configurable:!0}),Object.defineProperty(n,"controlParams",{get:function(){return{range:this._range,position:this._position,circular:!1}},enumerable:!1,configurable:!0}),Object.defineProperty(n,"atEdge",{get:function(){return this._position<=this._range.min||this._position>=this._range.max},enumerable:!1,configurable:!0}),Object.defineProperty(n,"size",{get:function(){var e=this._flicking;return e?e.horizontal?e.viewport.width:e.viewport.height:0},enumerable:!1,configurable:!0}),Object.defineProperty(n,"progress",{get:function(){var e=this._flicking,n=this._position+this._offset,t=this.findNearestAnchor(this._position);if(!e||!t)return NaN;var i=t.panel,r=i.position+i.offset,o=e.control.controller.bounce,a=this.range,t=a.min,e=a.max,a=this.rangeDiff;if(n===r)return i.index;if(n<r){var l=i.prev(),l=l?l.position+l.offset:t-o[0];return r<l&&(l-=a),i.index-1+E(n,l,r)}l=i.next(),o=l?l.position+l.offset:e+o[1];return o<r&&(o+=a),i.index+E(n,r,o)},enumerable:!1,configurable:!0}),Object.defineProperty(n,"align",{get:function(){return this._align},set:function(e){this._align=e},enumerable:!1,configurable:!0}),n.init=function(e){e=(this._flicking=e).viewport.element;return function(e,n){if(null==e)throw new N(O(e,n),A.VAL_MUST_NOT_NULL)}(e.firstElementChild,"First element child of the viewport element"),this._el=e.firstElementChild,this._checkTranslateSupport(),this},n.destroy=function(){return this._flicking=null,this._resetInternalValues(),this},n.lookAt=function(e){var n=this._position;return this._position=e,this._refreshVisiblePanels(),this._checkNeedPanel(),this._checkReachEnd(n,e),this._applyTransform(),this},n.getPrevAnchor=function(e){return this._anchors[e.index-1]||null},n.getNextAnchor=function(e){return this._anchors[e.index+1]||null},n.findAnchorIncludePosition=function(e){var n,t,i=this._anchors;try{for(var r=c(i),o=r.next();!o.done;o=r.next()){var a=o.value;if(a.panel.includePosition(e,!0))return a}}catch(e){n={error:e}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(n)throw n.error}}return null},n.findNearestAnchor=function(e){var n=this._anchors;if(n.length<=0)return null;for(var t=1/0,i=0;i<n.length;i++){var r=n[i],r=Math.abs(r.position-e);if(t<r)return n[i-1];t=r}return n[n.length-1]},n.clampToReachablePosition=function(e){var n=this._range;return l(e,n.min,n.max)},n.canReach=function(e){var n=this._range;if(e.removed)return!1;e=e.position;return e>=n.min&&e<=n.max},n.canSee=function(e){var n=this.visibleRange;return e.includeRange(n.min,n.max,!1)},n.updateAlignPos=function(){var e=this._align,e="object"==typeof e?e.camera:e;return this._alignPos=s(e,this.size),this},n.updateAnchors=function(){var e=b(this._flicking,"Camera").renderer.panels;return this._anchors=e.map(function(e,n){return new ae({index:n,position:e.position,panel:e})}),this},n.updatePosition=function(){var e=b(this._flicking,"Camera").control.activePanel;return e&&this.lookAt(e.position),this},n.updateAdaptiveHeight=function(){var e=b(this._flicking,"Camera"),n=this.findAnchorIncludePosition(this._position);return e.horizontal&&e.adaptive&&n&&e.viewport.setSize({height:n.panel.height}),this},n.resetNeedPanelHistory=function(){return this._needPanelTriggered={prev:!1,next:!1},this},n._resetInternalValues=function(){this._position=0,this._alignPos=0,this._offset=0,this._range={min:0,max:0},this._visiblePanels=[],this._anchors=[],this._needPanelTriggered={prev:!1,next:!1}},n._refreshVisiblePanels=function(){var n=this,e=b(this._flicking,"Camera"),t=e.renderer.panels.filter(function(e){return n.canSee(e)}),i=this._visiblePanels,r=(this._visiblePanels=t).filter(function(e){return!v(i,e)}),o=i.filter(function(e){return!v(t,e)});(0<r.length||0<o.length)&&(e.renderer.render(),e.trigger(new T.ComponentEvent(H.VISIBLE_CHANGE,{added:r,removed:o,visiblePanels:t})))},n._checkNeedPanel=function(){var e=this._needPanelTriggered;if(!e.prev||!e.next){var n=b(this._flicking,"Camera"),t=n.renderer.panels;if(t.length<=0)return e.prev||(n.trigger(new T.ComponentEvent(H.NEED_PANEL,{direction:V.PREV})),e.prev=!0),void(e.next||(n.trigger(new T.ComponentEvent(H.NEED_PANEL,{direction:V.NEXT})),e.next=!0));var i=this._position,r=this.size,o=this._range,a=n.needPanelThreshold,l=i-this._alignPos,s=l+r,r=t[0],t=t[t.length-1];e.prev||(l<=r.range.min+a||i<=o.min+a)&&(n.trigger(new T.ComponentEvent(H.NEED_PANEL,{direction:V.PREV})),e.prev=!0),e.next||(t.range.max-a<=s||i>=o.max-a)&&(n.trigger(new T.ComponentEvent(H.NEED_PANEL,{direction:V.NEXT})),e.next=!0)}},n._checkReachEnd=function(e,n){var t=b(this._flicking,"Camera"),i=this._range,r=e>i.min&&e<i.max,e=n>i.min&&n<i.max;r&&!e&&(i=n<=i.min?V.PREV:V.NEXT,t.trigger(new T.ComponentEvent(H.REACH_EDGE,{direction:i})))},n._applyTransform=function(){var e=this._el,n=b(this._flicking,"Camera"),t=this._position-this._alignPos-this._offset;e.style[this._transform]=n.horizontal?"translate("+-t+"px)":"translate(0, "+-t+"px)"},e}(),se=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return a(n,e),n.prototype.updateRange=function(){var e=b(this._flicking,"Camera").renderer,n=e.getPanel(0),e=e.getPanel(e.panelCount-1);return this._range={min:null!==(n=null==n?void 0:n.position)&&void 0!==n?n:0,max:null!==(e=null==e?void 0:e.position)&&void 0!==e?e:0},this},n}(le),ue=function(u){function e(){var e=null!==u&&u.apply(this,arguments)||this;return e._circularOffset=0,e._circularEnabled=!1,e._panelTooglePoints={},e}a(e,u);var n=e.prototype;return Object.defineProperty(n,"controlParams",{get:function(){return{range:this._range,position:this._position,circular:this._circularEnabled}},enumerable:!1,configurable:!0}),n.getPrevAnchor=function(e){if(!this._circularEnabled||0!==e.index)return u.prototype.getPrevAnchor.call(this,e);var n=this._anchors,e=this.rangeDiff,n=n[n.length-1];return new ae({index:n.index,position:n.position-e,panel:n.panel})},n.getNextAnchor=function(e){var n=this._anchors;if(!this._circularEnabled||e.index!==n.length-1)return u.prototype.getNextAnchor.call(this,e);e=this.rangeDiff,n=n[0];return new ae({index:n.index,position:n.position+e,panel:n.panel})},n.findAnchorIncludePosition=function(e){if(!this._circularEnabled)return u.prototype.findAnchorIncludePosition.call(this,e);var n,t,i=this._range,r=(o=e,n=i.min,t=i.max,r=t-n,o<n?o=t-(n-o)%r:t<o&&(o=n+(o-t)%r),o),o=u.prototype.findAnchorIncludePosition.call(this,r);if(!o)return null;var r=this.rangeDiff;if(e<i.min){var a=-Math.floor((i.min-e)/r)-1;return new ae({index:o.index,position:o.position+r*a,panel:o.panel})}if(e>i.max){a=Math.floor((e-i.max)/r)+1;return new ae({index:o.index,position:o.position+r*a,panel:o.panel})}return o},n.clampToReachablePosition=function(e){return this._circularEnabled?e:u.prototype.clampToReachablePosition.call(this,e)},n.canReach=function(e){return!e.removed&&(!!this._circularEnabled||u.prototype.canReach.call(this,e))},n.canSee=function(e){var n=this._range,t=this.rangeDiff,i=this.visibleRange,r=u.prototype.canSee.call(this,e);return this._circularEnabled?i.min<n.min?r||e.includeRange(i.min+t,i.max+t,!1):i.max>n.max?r||e.includeRange(i.min-t,i.max-t,!1):r:r},n.updateRange=function(){var e=b(this._flicking,"Camera").renderer,n=e.panels;if(n.length<=0)return this._resetInternalValues(),this;var a,l,s,u,c,f,h,d,g,p=this._position,t=n[0],i=n[n.length-1],r=t.range.min-t.margin.prev,o=i.range.max+i.margin.next,_=this.size,m=o-r,v=n.every(function(e){return m-e.size>=_});return v?(this._range={min:r,max:o},a={},l=this._alignPos,s=[],u=[],c=[],f=[],h=this._range,d=h.min-l,g=h.max-l+_,n.forEach(function(e){var n,t,i,r=e.includeRange(g-_,g,!1),o=e.includeRange(d,d+_,!1);r&&(n=e.range.max+h.min-h.max+l,a[n]=i={panel:e,direction:V.PREV,toggled:t=p<n},t&&(s.push(e),u.push(i))),o&&(t=(n=e.range.min+h.max-_+l)<p,a[n]=i={panel:e,direction:V.NEXT,toggled:!1},t&&(c.push(e),f.push(i)))}),e.elementManipulator.movePanelElementsToStart(s,u),e.elementManipulator.movePanelElementsToEnd(c,f),this._circularOffset=this._calcPanelAreaSum(s)-this._calcPanelAreaSum(c),this._panelTooglePoints=a):(this._range={min:t.position,max:i.position},this._circularOffset=0,this._panelTooglePoints={}),this._circularEnabled=v,this},n.lookAt=function(r){var o,a,e,n=b(this._flicking,"Camera"),l=this._position,s=this._panelTooglePoints,t=n.renderer.elementManipulator,i=Object.keys(s).map(function(e){return parseFloat(e)}).sort(function(e,n){return e-n});return r===l||(l<r?(o=[],e=i.reduce(function(e,n){var t=s[n],i=t.direction===V.NEXT&&!t.toggled||t.direction===V.PREV&&t.toggled;return l<=n&&n<=r&&i&&(t.toggled=!t.toggled,e.push(t.panel),o.push(t)),e},[]),t.movePanelElementsToEnd(e,o),this._circularOffset-=this._calcPanelAreaSum(e)):(a=[],e=i.reduce(function(e,n){var t=s[n],i=t.direction===V.NEXT&&t.toggled||t.direction===V.PREV&&!t.toggled;return n<=l&&r<=n&&i&&(t.toggled=!t.toggled,e.push(t.panel),a.push(t)),e},[]),t.movePanelElementsToStart(e,a),this._circularOffset+=this._calcPanelAreaSum(e)),n.renderer.render()),u.prototype.lookAt.call(this,r)},n._applyTransform=function(){var e=this._el,n=b(this._flicking,"Camera"),t=this._position-this._alignPos-this._offset+this._circularOffset;e.style[this._transform]=n.horizontal?"translate("+-t+"px)":"translate(0, "+-t+"px)"},n._resetInternalValues=function(){u.prototype._resetInternalValues.call(this),this._circularOffset=0,this._circularEnabled=!1,this._panelTooglePoints={}},n._calcPanelAreaSum=function(e){return e.reduce(function(e,n){return e+n.sizeIncludingMargin},0)},e}(le),ce=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}a(n,e);var t=n.prototype;return t.updateRange=function(){var e=b(this._flicking,"Camera").renderer,n=this._alignPos,t=e.getPanel(0),i=e.getPanel(e.panelCount-1);if(!t||!i)return this._range={min:0,max:0},this;var r=this.size,o=t.range.min,e=i.range.max;return this._range=r<e-o?{min:o+n,max:e-r+n}:{min:t.position,max:i.position},this},t.updateAnchors=function(){var n=this,e=b(this._flicking,"Camera").renderer.panels;if(e.length<=0)return this._anchors=[],this;var t=this._range,i=e.filter(function(e){return n.canReach(e)}),r=i[0].position!==t.min,o=i[i.length-1].position!==t.max,a=r?1:0,i=i.map(function(e,n){return new ae({index:n+a,position:e.position,panel:e})});return r&&i.splice(0,0,new ae({index:0,position:t.min,panel:function(e,n){var t,i;try{for(var r=c(e),o=r.next();!o.done;o=r.next()){var a=o.value;if(n(a))return a}}catch(e){t={error:e}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}return null}(e,function(e){return e.includePosition(t.min)})})),o&&i.push(new ae({index:i.length,position:t.max,panel:function(e,n){for(var t=e.length-1;0<=t;t--){var i=e[t];if(n(i))return i}return null}(e,function(e){return e.includePosition(t.max)})})),this._anchors=i,this},n}(le),te={__proto__:null,Camera:le,LinearCamera:se,CircularCamera:ue,BoundCamera:ce},fe=function(){function e(e){var n=e.el,t=e.index,i=e.align,e=e.flicking;this._el=n,this._index=t,this._flicking=e,this._align=i,this._removed=!1,this._resetInternalStates()}var n=e.prototype;return Object.defineProperty(n,"element",{get:function(){return this._el},enumerable:!1,configurable:!0}),Object.defineProperty(n,"index",{get:function(){return this._index},enumerable:!1,configurable:!0}),Object.defineProperty(n,"position",{get:function(){return this._pos+this._alignPos},enumerable:!1,configurable:!0}),Object.defineProperty(n,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),Object.defineProperty(n,"sizeIncludingMargin",{get:function(){return this._size+this._margin.prev+this._margin.next},enumerable:!1,configurable:!0}),Object.defineProperty(n,"height",{get:function(){return this._height},enumerable:!1,configurable:!0}),Object.defineProperty(n,"margin",{get:function(){return this._margin},enumerable:!1,configurable:!0}),Object.defineProperty(n,"alignPosition",{get:function(){return this._alignPos},enumerable:!1,configurable:!0}),Object.defineProperty(n,"offset",{get:function(){return this._offset},enumerable:!1,configurable:!0}),Object.defineProperty(n,"removed",{get:function(){return this._removed},enumerable:!1,configurable:!0}),Object.defineProperty(n,"range",{get:function(){return{min:this._pos,max:this._pos+this._size}},enumerable:!1,configurable:!0}),Object.defineProperty(n,"progress",{get:function(){var e=this._flicking;return this.index-e.camera.progress},enumerable:!1,configurable:!0}),Object.defineProperty(n,"outsetProgress",{get:function(){var e=this.position+this._offset,n=this._alignPos,t=this._flicking.camera,i=t.position;if(i===e)return 0;if(i<e){var r=e+(t.size-t.alignPosition)+n;return-E(i,e,r)}n=e-(t.alignPosition+this._size-n);return 1-E(i,n,e)},enumerable:!1,configurable:!0}),Object.defineProperty(n,"visibleRatio",{get:function(){var e=this.range,n=this._size,t=this._offset,i=this._flicking.camera.visibleRange,r=e.min+t,e=e.max+t;if(e<=i.min||r>=i.max)return 0;t=n;return i.min>r&&(t-=i.min-r),i.max<e&&(t-=e-i.max),t/n},enumerable:!1,configurable:!0}),Object.defineProperty(n,"align",{get:function(){return this._align},set:function(e){this._align=e},enumerable:!1,configurable:!0}),n.resize=function(){var e=this._el,n=P(e),t=this._flicking,i=t.horizontal,t=t.renderer.panels[this._index-1];return this._size=i?e.offsetWidth:e.offsetHeight,this._margin=i?{prev:parseFloat(n.marginLeft),next:parseFloat(n.marginRight)}:{prev:parseFloat(n.marginTop),next:parseFloat(n.marginBottom)},this._pos=t?t.range.max+t.margin.next+this._margin.prev:this._margin.prev,this._height=i?e.offsetHeight:this._size,this._updateAlignPos(),this},n.contains=function(e){return this._el.contains(e)},n.destroy=function(){this._resetInternalStates(),this._removed=!0},n.includePosition=function(e,n){return this.includeRange(e,e,n=void 0===n?!1:n)},n.includeRange=function(e,n,t){var i=this._margin,r=this.range;return(t=void 0===t?!1:t)&&(r.min-=i.prev,r.max+=i.next),n>=r.min&&e<=r.max},n.focus=function(e){return this._flicking.moveTo(this._index,e)},n.prev=function(){var e=this._index,n=this._flicking,t=n.renderer,i=t.panelCount;return 1===i?null:n.circularEnabled?t.getPanel(0===e?i-1:e-1):t.getPanel(e-1)},n.next=function(){var e=this._index,n=this._flicking,t=n.renderer,i=t.panelCount;return 1===i?null:n.circularEnabled?t.getPanel(e===i-1?0:e+1):t.getPanel(e+1)},n.increaseIndex=function(e){return this._index+=Math.max(e,0),this},n.decreaseIndex=function(e){return this._index-=Math.max(e,0),this},n.increasePosition=function(e){return this._moveBy(Math.max(e,0)),this},n.decreasePosition=function(e){return this._moveBy(-Math.max(e,0)),this},n.increaseOffset=function(e){return this._offset+=Math.max(e,0),this},n.decreaseOffset=function(e){return this._offset-=Math.max(e,0),this},n.resetOffset=function(){return this._offset=0,this},n._moveBy=function(e){return this._pos+=e,this},n._updateAlignPos=function(){this._alignPos=s(this._align,this._size)},n._resetInternalStates=function(){this._size=0,this._pos=0,this._margin={prev:0,next:0},this._height=0,this._alignPos=0,this._offset=0},e}(),he=function(n){function e(){var e=n.call(this)||this;return e._flicking=null,e}a(e,n);var t=e.prototype;return t.init=function(e){this._flicking=e},t.destroy=function(){this._flicking=null},t.insertPanelElements=function(e,n){return this},t.movePanelElementsToStart=function(e,n){var t=b(this._flicking,"Renderer").camera.rangeDiff;return e.forEach(function(e,n){e.decreaseOffset(t)}),0<e.length&&this.trigger("orderChanged"),this},t.movePanelElementsToEnd=function(e,n){var t=b(this._flicking,"Renderer").camera.rangeDiff;return e.forEach(function(e,n){e.increaseOffset(t)}),0<e.length&&this.trigger("orderChanged"),this},t.resetPanelElementOrder=function(e){return e.forEach(function(e){e.resetOffset()}),0<e.length&&this.trigger("orderChanged"),this},t.removePanelElements=function(e){return this},t.removeAllChildNodes=function(e){return this},t.removeAllTextNodes=function(e){return this},e}(T),U=function(){function e(e){var n=void 0===e?{}:e,e=n.align,e=void 0===e?G.CENTER:e,n=n.elementManipulator,n=void 0===n?new he:n;this._align=e,this._flicking=null,this._elementManipulator=n,this._panels=[]}var n=e.prototype;return Object.defineProperty(n,"panels",{get:function(){return this._panels},enumerable:!1,configurable:!0}),Object.defineProperty(n,"panelCount",{get:function(){return this._panels.length},enumerable:!1,configurable:!0}),Object.defineProperty(n,"elementManipulator",{get:function(){return this._elementManipulator},enumerable:!1,configurable:!0}),Object.defineProperty(n,"align",{get:function(){return this._align},set:function(e){this._align=e;var n=this._getPanelAlign();this._panels.forEach(function(e){e.align=n})},enumerable:!1,configurable:!0}),n.init=function(e){return this._flicking=e,this._elementManipulator.init(e),this._collectPanels(),this},n.destroy=function(){this._flicking=null,this._panels=[],this._elementManipulator.destroy()},n.getPanel=function(e){return this._panels[e]||null},n.insert=function(e,n){var t=this._panels,i=this._elementManipulator,r=b(this._flicking,"Renderer"),o=r.control,a=this._getPanelAlign(),n=function(e){p(e)||(e=[e]);var t=[];return e.forEach(function(e){if(W(e)){var n=document.createElement("div");for(n.innerHTML=e,t.push.apply(t,d([],h(g(n.children))));n.firstChild;)n.removeChild(n.firstChild)}else{if(!e||e.nodeType!==Node.ELEMENT_NODE)throw new N(I(e,["HTMLElement","string"]),A.WRONG_TYPE);t.push(e)}}),t}(n),l=m(e,t.length),e=t.slice(l),s=n.map(function(e,n){return new fe({el:e,index:l+n,align:a,flicking:r})});if(s.length<=0)return[];i.resetPanelElementOrder(t),t.splice.apply(t,d([l,0],h(s))),i.insertPanelElements(s,e[0]||null),s.forEach(function(e){return e.resize()});var u=this._getPanelSizeSum(s);return e.forEach(function(e){e.increaseIndex(s.length),e.increasePosition(u)}),this._updateCameraAndControl(),this.render(),0<s.length&&!o.animating&&o.moveToPanel(o.activePanel||s[0],{duration:0}).catch(function(){}),s},n.remove=function(e,n){void 0===n&&(n=1);var t=this._panels,i=this._elementManipulator,r=b(this._flicking,"Renderer"),o=r.camera,a=r.control,l=a.activePanel,r=m(e,t.length),e=t.slice(r+n),s=t.splice(r,n);if(s.length<=0)return[];i.resetPanelElementOrder(t);var u=this._getPanelSizeSum(s);return e.forEach(function(e){e.decreaseIndex(s.length),e.decreasePosition(u)}),i.removePanelElements(s),s.forEach(function(e){return e.destroy()}),this._updateCameraAndControl(),v(s,l)&&a.resetActivePanel(),this.render(),0<s.length&&!a.animating&&((l=v(s,l)?e[0]||t[t.length-1]:l)?a.moveToPanel(l,{duration:0}).catch(function(){}):o.lookAt(0)),s},n.updatePanelSize=function(){return this._panels.forEach(function(e){return e.resize()}),this},n._collectPanels=function(){var t=b(this._flicking,"Renderer"),e=t.camera.element;this._elementManipulator.removeAllTextNodes(e);var i=this._getPanelAlign(),e=g(e.children);return this._panels=e.map(function(e,n){return new fe({flicking:t,el:e,index:n,align:i})}),this},n._getPanelAlign=function(){var e=this._align;return"object"==typeof e?e.panel:e},n._getPanelSizeSum=function(e){var n=e[0],t=e[e.length-1],e=t.margin.next-n.margin.prev;return t.range.max-n.range.min+e},n._updateCameraAndControl=function(){var e=b(this._flicking,"Renderer"),n=e.camera,e=e.control;n.updateRange(),n.updateAnchors(),n.resetNeedPanelHistory(),e.updateInput()},e}(),de=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return a(n,e),n.prototype.render=function(){return this},n}(U),ge=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}a(n,e);var t=n.prototype;return t.render=function(){var e=b(this._flicking,"Renderer"),n=e.camera,t=n.element,i=e.renderer.panels,r=n.visiblePanels,e=this._elementManipulator;if(i.length<=0||r.length<=0)return n.offset=0,this;var i=d([],h(i)).sort(function(e,n){return e.position+e.offset-(n.position+n.offset)}),o=d([],h(r)).sort(function(e,n){return e.position+e.offset-(n.position+n.offset)});e.removeAllChildNodes(t),e.insertPanelElements(o,null);e=u(i,function(e){return e.index===o[0].index}),e=i.slice(0,e),e=this._calcPanelRangeSize(e);return n.offset=e,this},t._calcPanelRangeSize=function(e){return e.reduce(function(e,n){return e+n.sizeIncludingMargin},0)},n}(de),pe=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}a(n,e);var t=n.prototype;return t.insertPanelElements=function(e,n){var t=b(this._flicking,"Renderer").camera.element,n=(null==n?void 0:n.element)||null,i=document.createDocumentFragment();return e.forEach(function(e){return i.appendChild(e.element)}),t.insertBefore(i,n),this},t.movePanelElementsToStart=function(e){var n=b(this._flicking,"Renderer").camera,t=n.element,i=n.rangeDiff,n=e.map(function(e){return e.element}),t=v(n,t.firstElementChild)?null:t.firstElementChild;return this._relocatePanelElements(e,t),e.forEach(function(e){e.decreaseOffset(i)}),this},t.movePanelElementsToEnd=function(e){var n=b(this._flicking,"Renderer").camera.rangeDiff;return this._relocatePanelElements(e,null),e.forEach(function(e){e.increaseOffset(n)}),this},t.resetPanelElementOrder=function(e){var n=b(this._flicking,"Renderer").camera.element;return this._relocatePanelElements(e.filter(function(e){return e.element.parentElement===n}),null),e.forEach(function(e){e.resetOffset()}),this},t.removePanelElements=function(e){var n=b(this._flicking,"Renderer").camera.element;return e.forEach(function(e){n.removeChild(e.element)}),this},t.removeAllChildNodes=function(e){for(;e.firstChild;)e.removeChild(e.firstChild);return this},t.removeAllTextNodes=function(n){return n.childNodes.forEach(function(e){e.nodeType===Node.TEXT_NODE&&n.removeChild(e)}),this},t._relocatePanelElements=function(e,n){var t=b(this._flicking,"Renderer").camera.element,i=document.createDocumentFragment();e.forEach(function(e){return i.appendChild(e.element)}),t.insertBefore(i,n)},n}(he),_e=function(i){function e(){return null!==i&&i.apply(this,arguments)||this}a(e,i);var n=e.prototype;return n.movePanelElementsToStart=function(e,t){var n=b(this._flicking,"Renderer");return n.circular&&!n.renderOnlyVisible&&e.forEach(function(e,n){t[n].toggled?e.element.style.order="-1":e.element.style.order="0"}),i.prototype.movePanelElementsToStart.call(this,e,t)},n.movePanelElementsToEnd=function(e,t){var n=b(this._flicking,"Renderer");return n.circular&&!n.renderOnlyVisible&&e.forEach(function(e,n){t[n].toggled?e.element.style.order="1":e.element.style.order="0"}),i.prototype.movePanelElementsToEnd.call(this,e,t)},n.resetPanelElementOrder=function(e){var n=b(this._flicking,"Renderer");return n.circular&&!n.renderOnlyVisible&&e.forEach(function(e){e.element.style.order="0"}),i.prototype.resetPanelElementOrder.call(this,e)},e}(he),le={__proto__:null,Renderer:U,RawRenderer:de,VisibleRenderer:ge,OffsetManipulator:he,ElementManipulator:pe,OrderManipulator:_e},U=function(x){function e(e,n){var t=void 0===n?{}:n,i=t.align,r=void 0===i?G.CENTER:i,o=t.defaultIndex,a=void 0===o?0:o,l=t.horizontal,s=void 0===l||l,u=t.circular,c=void 0!==u&&u,f=t.bound,h=void 0!==f&&f,d=t.adaptive,g=void 0!==d&&d,p=t.needPanelThreshold,_=void 0===p?0:p,m=t.deceleration,v=void 0===m?.0075:m,b=t.duration,E=void 0===b?500:b,P=t.easing,y=void 0===P?function(e){return 1-Math.pow(1-e,3)}:P,n=t.inputType,i=void 0===n?["mouse","touch"]:n,o=t.moveType,l=void 0===o?"snap":o,u=t.threshold,f=void 0===u?40:u,d=t.interruptable,p=void 0===d||d,m=t.bounce,b=void 0===m?"20%":m,P=t.iOSEdgeSwipeThreshold,n=void 0===P?30:P,o=t.preventClickOnDrag,u=void 0===o||o,d=t.renderOnlyVisible,m=void 0!==d&&d,P=t.autoInit,o=void 0===P||P,d=t.autoResize,P=void 0===d||d,d=t.renderExternal,d=void 0!==d&&d,t=t.useOrderManipulator,t=void 0!==t&&t,O=x.call(this)||this;return O.resize=function(){var e=O._viewport,n=O._renderer,t=O._camera,i=O._control,r=e.width,o=e.height;O.trigger(new T.ComponentEvent(H.BEFORE_RESIZE,{width:r,height:o,element:e.element})),e.resize(),n.updatePanelSize(),n.elementManipulator.resetPanelElementOrder(n.panels),t.updateAlignPos(),t.updateRange(),t.updateAnchors(),i.updateInput(),t.updatePosition();i=e.width,t=e.height;return O.trigger(new T.ComponentEvent(H.AFTER_RESIZE,{width:e.width,height:e.height,prev:{width:r,height:o},sizeChanged:i!==r||t!==o,element:e.element})),O},O._preventClickWhenDragged=function(e){O._control.animating&&e.preventDefault()},O._initialized=!1,O._plugins=[],O._align=r,O._defaultIndex=a,O._horizontal=s,O._circular=c,O._bound=h,O._adaptive=g,O._needPanelThreshold=_,O._deceleration=v,O._duration=E,O._easing=y,O._inputType=i,O._moveType=l,O._threshold=f,O._interruptable=p,O._bounce=b,O._iOSEdgeSwipeThreshold=n,O._preventClickOnDrag=u,O._renderOnlyVisible=m,O._autoResize=P,O._autoInit=o,O._renderExternal=d,O._useOrderManipulator=t,O._viewport=new X(function(e,n){var t=null;if(W(e)){n=(n||document).querySelector(e);if(!n)throw new N(C(e),A.ELEMENT_NOT_FOUND);t=n}else e&&e.nodeType===Node.ELEMENT_NODE&&(t=e);if(!t)throw new N(I(e,["HTMLElement","string"]),A.WRONG_TYPE);return t}(e)),O._renderer=O._createRenderer(),O._camera=O._createCamera(),O._control=O._createControl(),O._autoInit&&O.init(),O}a(e,x);var n=e.prototype;return Object.defineProperty(n,"control",{get:function(){return this._control},enumerable:!1,configurable:!0}),Object.defineProperty(n,"camera",{get:function(){return this._camera},enumerable:!1,configurable:!0}),Object.defineProperty(n,"renderer",{get:function(){return this._renderer},enumerable:!1,configurable:!0}),Object.defineProperty(n,"viewport",{get:function(){return this._viewport},enumerable:!1,configurable:!0}),Object.defineProperty(n,"initialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(n,"circularEnabled",{get:function(){return this._camera.controlParams.circular},enumerable:!1,configurable:!0}),Object.defineProperty(n,"index",{get:function(){return this._control.activeIndex},enumerable:!1,configurable:!0}),Object.defineProperty(n,"element",{get:function(){return this._viewport.element},enumerable:!1,configurable:!0}),Object.defineProperty(n,"currentPanel",{get:function(){return this._control.activePanel},enumerable:!1,configurable:!0}),Object.defineProperty(n,"panels",{get:function(){return this._renderer.panels},enumerable:!1,configurable:!0}),Object.defineProperty(n,"panelCount",{get:function(){return this._renderer.panelCount},enumerable:!1,configurable:!0}),Object.defineProperty(n,"visiblePanels",{get:function(){return this._camera.visiblePanels},enumerable:!1,configurable:!0}),Object.defineProperty(n,"animating",{get:function(){return this._control.animating},enumerable:!1,configurable:!0}),Object.defineProperty(n,"holding",{get:function(){return this._control.holding},enumerable:!1,configurable:!0}),Object.defineProperty(n,"plugins",{get:function(){return this._plugins},enumerable:!1,configurable:!0}),Object.defineProperty(n,"align",{get:function(){return this._align},set:function(e){this._align=e,this._renderer.align=e,this._camera.align=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"defaultIndex",{get:function(){return this._defaultIndex},set:function(e){this._defaultIndex=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"horizontal",{get:function(){return this._horizontal},set:function(e){this._horizontal=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"circular",{get:function(){return this._circular},set:function(e){this._circular=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"bound",{get:function(){return this._bound},set:function(e){this._bound=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"adaptive",{get:function(){return this._adaptive},set:function(e){this._adaptive=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"needPanelThreshold",{get:function(){return this._needPanelThreshold},enumerable:!1,configurable:!0}),Object.defineProperty(n,"deceleration",{get:function(){return this._deceleration},set:function(e){this._deceleration=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"easing",{get:function(){return this._easing},set:function(e){this._easing=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"duration",{get:function(){return this._duration},set:function(e){this._duration=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"inputType",{get:function(){return this._inputType},set:function(e){this._inputType=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"moveType",{get:function(){return this._moveType},set:function(e){this._moveType=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"threshold",{get:function(){return this._threshold},set:function(e){this._threshold=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"interruptable",{get:function(){return this._interruptable},set:function(e){this._interruptable=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"bounce",{get:function(){return this._bounce},set:function(e){this._bounce=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"iOSEdgeSwipeThreshold",{get:function(){return this._iOSEdgeSwipeThreshold},set:function(e){this._iOSEdgeSwipeThreshold=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"preventClickOnDrag",{get:function(){return this._preventClickOnDrag},set:function(e){this._preventClickOnDrag=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"renderOnlyVisible",{get:function(){return this._renderOnlyVisible},set:function(e){this._renderOnlyVisible=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"autoInit",{get:function(){return this._autoInit},enumerable:!1,configurable:!0}),Object.defineProperty(n,"autoResize",{get:function(){return this._autoResize},set:function(e){this._autoResize=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"renderExternal",{get:function(){return this._renderExternal},enumerable:!1,configurable:!0}),Object.defineProperty(n,"useOrderManipulator",{get:function(){return this._useOrderManipulator},set:function(e){this._useOrderManipulator=e},enumerable:!1,configurable:!0}),n.init=function(){var n=this;if(this._initialized)return this;var e=this._camera,t=this._renderer,i=this._control,r=this._viewport;return e.init(this),t.init(this),i.init(this),this.resize(),this._moveToInitialPanel(),this._autoResize&&window.addEventListener("resize",this.resize),this._preventClickOnDrag&&r.element.addEventListener("click",this._preventClickWhenDragged),this._plugins.forEach(function(e){return e.init(n)}),this._initialized=!0,this.trigger(new T.ComponentEvent(H.READY)),this},n.destroy=function(){this._initialized&&(this.off(),window.removeEventListener("resize",this.resize),this._viewport.element.removeEventListener("click",this._preventClickWhenDragged),this._control.destroy(),this._camera.destroy(),this._renderer.destroy(),this._plugins.forEach(function(e){return e.destroy()}),this._initialized=!1)},n.prev=function(e){var n;return void 0===e&&(e=this._duration),this.moveTo(null!==(n=null===(n=null===(n=this._control.activePanel)||void 0===n?void 0:n.prev())||void 0===n?void 0:n.index)&&void 0!==n?n:-1,e,V.PREV)},n.next=function(e){var n;return void 0===e&&(e=this._duration),this.moveTo(null!==(n=null===(n=null===(n=this._control.activePanel)||void 0===n?void 0:n.next())||void 0===n?void 0:n.index)&&void 0!==n?n:this._renderer.panelCount,e,V.NEXT)},n.moveTo=function(e,n,t){void 0===n&&(n=this._duration),void 0===t&&(t=V.NONE);var i=this._renderer,r=i.panelCount,i=i.getPanel(e);return i?this._control.animating?Promise.reject(new N(L,A.ANIMATION_ALREADY_PLAYING)):this._control.moveToPanel(i,{duration:n,direction:t}):Promise.reject(new N(R(e,0,r-1),A.INDEX_OUT_OF_RANGE))},n.getPanel=function(e){return this._renderer.getPanel(e)},n.enableInput=function(){return this._control.enable(),this},n.disableInput=function(){return this._control.disable(),this},n.getStatus=function(e){var n=void 0===e?{}:e,t=n.index,i=void 0===t||t,e=n.position,t=void 0===e||e,e=n.includePanelHTML,r=void 0!==e&&e,e=n.visiblePanelsOnly,n=void 0!==e&&e,e={panels:(n?this.visiblePanels:this.panels).map(function(e){var n={index:e.index};return r&&(n.html=e.element.outerHTML),n})};return i&&(e.index=this.index),t&&(e.position=this._camera.position),n&&(t=this.visiblePanels,e.visibleOffset={index:null!==(n=null===(n=t[0])||void 0===n?void 0:n.index)&&void 0!==n?n:0,position:t[0]?t[0].range.min-t[0].margin.prev:0}),e},n.setStatus=function(e){if(!this._initialized)throw new N(z,A.NOT_INITIALIZED);var n=e.index,t=e.position,i=e.visibleOffset,r=e.panels,o=this._renderer,a=this._control;null!==(e=r[0])&&void 0!==e&&e.html&&!this._renderExternal&&(o.remove(0,this.panels.length),o.insert(0,r.map(function(e){return e.html}))),n&&(n=i?n-i.index:n,this.moveTo(n,0).catch(function(){})),t&&this._moveType===F.FREE_SCROLL&&(t=i?t-i.position:t,a.moveToPosition(t,0).catch(function(){}))},n.addPlugins=function(){for(var e,n=this,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return this._initialized&&t.forEach(function(e){return e.init(n)}),(e=this._plugins).push.apply(e,d([],h(t))),this},n.removePlugins=function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return e.forEach(function(n){var e=u(t._plugins,function(e){return e===n});0<=e&&(n.destroy(),t._plugins.splice(e,1))}),this},n.append=function(e){return this.insert(this._renderer.panelCount,e)},n.prepend=function(e){return this.insert(0,e)},n.insert=function(e,n){if(this._renderExternal)throw new N(M,A.NOT_ALLOWED_IN_FRAMEWORK);return this._renderer.insert(e,n)},n.remove=function(e,n){if(void 0===n&&(n=1),this._renderExternal)throw new N(M,A.NOT_ALLOWED_IN_FRAMEWORK);return this._renderer.remove(e,n)},n._createControl=function(){var e=this._moveType,n=Object.keys(F).map(function(e){return F[e]});if(!v(n,e))throw new N(w("moveType",JSON.stringify(e)),A.WRONG_OPTION);switch(e){case F.SNAP:return new ie;case F.FREE_SCROLL:return new re}},n._createCamera=function(){var e={align:this._align};return this._circular?(this._bound&&console.warn('"circular" and "bound" option cannot be used together, ignoring bound.'),new ue(e)):new(this._bound?ce:se)(e)},n._createRenderer=function(){var e=new(this._useOrderManipulator?_e:this._renderExternal?he:pe),e={align:this._align,elementManipulator:e};return this._createActualRenderer(e)},n._createActualRenderer=function(e){return new(this._renderOnlyVisible?ge:de)(e)},n._moveToInitialPanel=function(){var e=this._renderer,n=this._control,e=e.getPanel(this._defaultIndex)||e.getPanel(0);e&&n.moveToPanel(e,{duration:0})},e.VERSION="4.0.0-beta.5",e}(T);return e(U,{__proto__:null,Panel:fe,Viewport:X,FlickingError:N,AnchorPoint:ae}),e(U,te),e(U,oe),e(U,le),e(U,n),U}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("@egjs/component"),require("@egjs/axes")):"function"==typeof define&&define.amd?define(["@egjs/component","@egjs/axes"],n):(e="undefined"!=typeof globalThis?globalThis:e||self).Flicking=n(e.eg.Component,e.eg.Axes)}(this,function(A,o){"use strict";var i=function(e,n){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])})(e,n)};function a(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function t(){this.constructor=e}i(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}var r=function(){return(r=Object.assign||function(e){for(var n,t=1,i=arguments.length;t<i;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e}).apply(this,arguments)};function h(e,a,l,s){return new(l=l||Promise)(function(t,n){function i(e){try{o(s.next(e))}catch(e){n(e)}}function r(e){try{o(s.throw(e))}catch(e){n(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof l?n:new l(function(e){e(n)})).then(i,r)}o((s=s.apply(e,a||[])).next())})}function f(t,i){var r,o,a,l={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},e={next:n(0),throw:n(1),return:n(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function n(n){return function(e){return function(n){if(r)throw new TypeError("Generator is already executing.");for(;l;)try{if(r=1,o&&(a=2&n[0]?o.return:n[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,n[1])).done)return a;switch(o=0,(n=a?[2&n[0],a.value]:n)[0]){case 0:case 1:a=n;break;case 4:return l.label++,{value:n[1],done:!1};case 5:l.label++,o=n[1],n=[0];continue;case 7:n=l.ops.pop(),l.trys.pop();continue;default:if(!(a=0<(a=l.trys).length&&a[a.length-1])&&(6===n[0]||2===n[0])){l=0;continue}if(3===n[0]&&(!a||n[1]>a[0]&&n[1]<a[3])){l.label=n[1];break}if(6===n[0]&&l.label<a[1]){l.label=a[1],a=n;break}if(a&&l.label<a[2]){l.label=a[2],l.ops.push(n);break}a[2]&&l.ops.pop(),l.trys.pop();continue}n=i.call(t,l)}catch(e){n=[6,e],o=0}finally{r=a=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,e])}}}function c(e){var n="function"==typeof Symbol&&Symbol.iterator,t=n&&e[n],i=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&i>=e.length?void 0:e)&&e[i++],done:!e}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function d(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var i,r,o=t.call(e),a=[];try{for(;(void 0===n||0<n--)&&!(i=o.next()).done;)a.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(t=o.return)&&t.call(o)}finally{if(r)throw r.error}}return a}function g(e,n){for(var t=0,i=n.length,r=e.length;t<i;t++,r++)e[r]=n[t];return e}function e(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return e.forEach(function(n){Object.keys(n).forEach(function(e){t[e]=n[e]})}),t}function t(e,n,t){return Math.max(Math.min(e,t),n)}function b(e,n){if(!e)throw new N(O(n),I.NOT_ATTACHED_TO_FLICKING);return e}function p(e){return[].slice.call(e)}function _(e){return Boolean(e)&&e.constructor===Array}function l(e,n){var t;if(B(e))switch(e){case H.PREV:t=0;break;case H.CENTER:t=.5*n;break;case H.NEXT:t=n;break;default:if(null==(t=F(e,n)))throw new N(T("align",e),I.WRONG_OPTION)}else t=e;return t}function m(e,n){return e===n?V.NONE:e<n?V.NEXT:V.PREV}function v(e,n){return t(e<0?e+n:e,0,n)}function E(e,n){var t,i;try{for(var r=c(e),o=r.next();!o.done;o=r.next())if(o.value===n)return 1}catch(e){t={error:e}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}}function s(e,n,t){return(e-n)/(t-n)}function u(e){return window.getComputedStyle(e)||e.currentStyle}var P,N=function(i){function r(e,n){var t=i.call(this,e)||this;return t.message=e,t.code=n,Object.setPrototypeOf(t,r.prototype),t.name="FlickingError",t}return a(r,i),r}(Error),I={WRONG_TYPE:0,ELEMENT_NOT_FOUND:1,VAL_MUST_NOT_NULL:2,NOT_ATTACHED_TO_FLICKING:3,WRONG_OPTION:4,INDEX_OUT_OF_RANGE:5,POSITION_NOT_REACHABLE:6,TRANSFORM_NOT_SUPPORTED:7,STOP_CALLED_BY_USER:8,ANIMATION_INTERRUPTED:9,ANIMATION_ALREADY_PLAYING:10,NOT_ALLOWED_IN_FRAMEWORK:11,NOT_INITIALIZED:12,NO_ACTIVE:13},C=function(e,n){return e+"("+typeof e+") is not a "+n.map(function(e){return'"'+e+'"'}).join(" or ")+"."},R=function(e){return'Element with selector "'+e+'" not found.'},y=function(e,n){return n+" should be provided. Given: "+e},O=function(e){return e+' is not attached to the Flicking instance. "init()" should be called first.'},T=function(e,n){return'Option "'+e+'" is not in correct format, given: '+n},w=function(e,n,t){return'Index "'+e+'" is out of range: should be between '+n+" and "+t+"."},x=function(e){return'Position "'+e+'" is not reachable.'},k="Browser does not support CSS transform.",S="Event stop() is called by user.",D="Animation is interrupted by user input.",j="Animation is already playing.",L="This behavior is not allowed in the frameworks like React, Vue, or Angular.",M="Flicking is not initialized yet, call init() first.",z={READY:"ready",BEFORE_RESIZE:"beforeResize",AFTER_RESIZE:"afterResize",HOLD_START:"holdStart",HOLD_END:"holdEnd",MOVE_START:"moveStart",MOVE:"move",MOVE_END:"moveEnd",WILL_CHANGE:"willChange",CHANGED:"changed",WILL_RESTORE:"willRestore",RESTORED:"restored",SELECT:"select",NEED_PANEL:"needPanel",VISIBLE_CHANGE:"visibleChange",REACH_EDGE:"reachEdge"},H={PREV:"prev",CENTER:"center",NEXT:"next"},V={PREV:"PREV",NEXT:"NEXT",NONE:null},G={SNAP:"snap",FREE_SCROLL:"freeScroll"},n={__proto__:null,EVENTS:z,ALIGN:H,DIRECTION:V,MOVE_TYPE:G,ERROR_CODE:I},F=function(e,n){var t=/(?:(\+|\-)\s*)?(\d+(?:\.\d+)?(%|px)?)/g;if("number"==typeof e)return e;for(var i=0,r=0,o=t.exec(e);null!=o;){var a=o[1],l=o[2],s=o[3],l=parseFloat(l);if(!(a=i<=0?a||"+":a))return null;"%"===s&&(l=l/100*n),r+="+"===a?l:-l,++i,o=t.exec(e)}return 0===i?null:r},B=function(e){return"string"==typeof e},W=function(){function e(e){this._el=e,this._width=0,this._height=0,this._padding={left:0,right:0,top:0,bottom:0},this._isBorderBoxSizing=!1}var n=e.prototype;return Object.defineProperty(n,"element",{get:function(){return this._el},enumerable:!1,configurable:!0}),Object.defineProperty(n,"width",{get:function(){return this._width-this._padding.left-this._padding.right},enumerable:!1,configurable:!0}),Object.defineProperty(n,"height",{get:function(){return this._height-this._padding.top-this._padding.bottom},enumerable:!1,configurable:!0}),Object.defineProperty(n,"padding",{get:function(){return this._padding},enumerable:!1,configurable:!0}),n.setSize=function(e){var n=e.width,t=e.height,i=this._el,r=this._padding,e=this._isBorderBoxSizing;null!=n&&(B(n)?i.style.width=n:(n=e?n+r.left+r.right:n,i.style.width=n+"px")),null!=t&&(B(t)?i.style.height=t:(t=e?t+r.top+r.bottom:t,i.style.height=t+"px")),this.resize()},n.resize=function(){var e=this._el,n=u(e);this._width=e.offsetWidth,this._height=e.offsetHeight,this._padding={left:parseFloat(n.paddingLeft),right:parseFloat(n.paddingRight),top:parseFloat(n.paddingTop),bottom:parseFloat(n.paddingBottom)},this._isBorderBoxSizing="border-box"===n.boxSizing},e}();(ae=P=P||{})[ae.IDLE=0]="IDLE",ae[ae.HOLDING=1]="HOLDING",ae[ae.DRAGGING=2]="DRAGGING",ae[ae.ANIMATING=3]="ANIMATING",ae[ae.DISABLED=4]="DISABLED";var X=function(){function e(){}var n=e.prototype;return n.onHold=function(e){},n.onChange=function(e){},n.onRelease=function(e){},n.onAnimationEnd=function(e){},n.onFinish=function(e){},e}(),U=function(n){function e(){var e=null!==n&&n.apply(this,arguments)||this;return e.holding=!1,e.animating=!1,e}a(e,n);var t=e.prototype;return t.onHold=function(e){var n=e.flicking,t=e.axesEvent,e=e.transitTo;n.renderer.panelCount<=0?e(P.DISABLED):(t=new A.ComponentEvent(z.HOLD_START,{axesEvent:t}),n.trigger(t),t.isCanceled()?e(P.DISABLED):e(P.HOLDING))},t.onChange=function(e){var n=e.flicking,t=e.axesEvent,i=e.transitTo,r=n.control.controller.animatingContext,t=new A.ComponentEvent(z.MOVE_START,{isTrusted:t.isTrusted,holding:this.holding,direction:m(r.start,r.end),axesEvent:t});n.trigger(t),t.isCanceled()?i(P.DISABLED):i(P.ANIMATING).onChange(e)},e}(X),Y=function(n){function e(){var e=null!==n&&n.apply(this,arguments)||this;return e.holding=!0,e.animating=!1,e._releaseEvent=null,e}a(e,n);var t=e.prototype;return t.onChange=function(e){var n=e.flicking,t=e.axesEvent,i=e.transitTo,r=t.inputEvent,r=n.horizontal?r.offsetX:r.offsetY,t=new A.ComponentEvent(z.MOVE_START,{isTrusted:t.isTrusted,holding:this.holding,direction:m(0,-r),axesEvent:t});n.trigger(t),t.isCanceled()?i(P.DISABLED):i(P.DRAGGING).onChange(e)},t.onRelease=function(e){var n=e.flicking,t=e.axesEvent,e=e.transitTo;if(n.trigger(new A.ComponentEvent(z.HOLD_END,{axesEvent:t})),0!==t.delta.flick)return t.setTo({flick:n.camera.position},0),void e(P.IDLE);this._releaseEvent=t},t.onFinish=function(e){var n=e.flicking;if((0,e.transitTo)(P.IDLE),this._releaseEvent){var t,i=this._releaseEvent.inputEvent.srcEvent;t="touchend"===i.type?(e=i.changedTouches[0],document.elementFromPoint(e.clientX,e.clientY)):i.target;var r,o,i=n.renderer.panels,a=null;try{for(var l=c(i),s=l.next();!s.done;s=l.next()){var u=s.value;if(u.contains(t)){a=u;break}}}catch(e){o={error:e}}finally{try{s&&!s.done&&(r=l.return)&&r.call(l)}finally{if(o)throw o.error}}a&&(r=n.camera.position,o=a.position,n.trigger(new A.ComponentEvent(z.SELECT,{index:a.index,panel:a,direction:m(r,o)})))}},e}(X),K={HOLD:"hold",CHANGE:"change",RELEASE:"release",ANIMATION_END:"animationEnd",FINISH:"finish"},Z="flick",q=function(n){function e(){var e=null!==n&&n.apply(this,arguments)||this;return e.holding=!0,e.animating=!0,e}a(e,n);var t=e.prototype;return t.onChange=function(e){var n,t=e.flicking,i=e.axesEvent,r=e.transitTo;i.delta[Z]&&(e=(n=t.camera).position,n.lookAt(i.pos[Z]),i=new A.ComponentEvent(z.MOVE,{isTrusted:i.isTrusted,holding:this.holding,direction:m(0,i.delta[Z]),axesEvent:i}),t.trigger(i),i.isCanceled()&&(n.lookAt(e),r(P.DISABLED)))},t.onRelease=function(e){var n=e.flicking,t=e.axesEvent,i=e.transitTo;n.trigger(new A.ComponentEvent(z.HOLD_END,{axesEvent:t})),n.renderer.panelCount<=0?i(P.IDLE):(i(P.ANIMATING),e=n.control,i=t.destPos[Z],n=Math.max(t.duration,n.duration),e.moveToPosition(i,n,t))},e}(X),J=function(n){function e(){var e=null!==n&&n.apply(this,arguments)||this;return e.holding=!1,e.animating=!0,e}a(e,n);var t=e.prototype;return t.onHold=function(e){var n=e.flicking,t=e.axesEvent,e=e.transitTo,t=new A.ComponentEvent(z.HOLD_START,{axesEvent:t});n.trigger(t),t.isCanceled()?e(P.DISABLED):e(P.DRAGGING)},t.onChange=function(e){var n,t=e.flicking,i=e.axesEvent,r=e.transitTo;i.delta.flick&&(e=(n=t.camera).position,n.lookAt(i.pos.flick),i=new A.ComponentEvent(z.MOVE,{isTrusted:i.isTrusted,holding:this.holding,direction:m(0,i.delta.flick),axesEvent:i}),t.trigger(i),i.isCanceled()&&(t.camera.lookAt(e),r(P.DISABLED)))},t.onFinish=function(e){var n=e.flicking,t=e.axesEvent;(0,e.transitTo)(P.IDLE);e=n.control.controller.animatingContext;n.trigger(new A.ComponentEvent(z.MOVE_END,{isTrusted:t.isTrusted,direction:m(e.start,e.end),axesEvent:t}))},e}(X),Q=function(n){function e(){var e=null!==n&&n.apply(this,arguments)||this;return e.holding=!1,e.animating=!0,e}a(e,n);var t=e.prototype;return t.onAnimationEnd=function(e){(0,e.transitTo)(P.IDLE)},t.onChange=function(e){var n=e.axesEvent,e=e.transitTo;n.stop(),e(P.IDLE)},t.onRelease=function(e){var n=e.axesEvent,e=e.transitTo;0===n.delta.flick&&e(P.IDLE)},e}(X),$=function(){function e(){var t=this;this.transitTo=function(e){var n;switch(e){case P.IDLE:n=new U;break;case P.HOLDING:n=new Y;break;case P.DRAGGING:n=new q;break;case P.ANIMATING:n=new J;break;case P.DISABLED:n=new Q}return t._state=n,t._state},this._state=new U}var n=e.prototype;return Object.defineProperty(n,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),n.fire=function(e,n){var t=this._state,i=r(r({},n),{transitTo:this.transitTo});switch(e){case K.HOLD:t.onHold(i);break;case K.CHANGE:t.onChange(i);break;case K.RELEASE:t.onRelease(i);break;case K.ANIMATION_END:t.onAnimationEnd(i);break;case K.FINISH:t.onFinish(i)}},e}(),ee=function(){function e(){this._resetInternalValues(),this._stateMachine=new $}var n=e.prototype;return Object.defineProperty(n,"axes",{get:function(){return this._axes},enumerable:!1,configurable:!0}),Object.defineProperty(n,"state",{get:function(){return this._stateMachine.state},enumerable:!1,configurable:!0}),Object.defineProperty(n,"animatingContext",{get:function(){return this._animatingContext},enumerable:!1,configurable:!0}),Object.defineProperty(n,"enabled",{get:function(){var e;return null!==(e=null===(e=this._panInput)||void 0===e?void 0:e.isEnable())&&void 0!==e&&e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"position",{get:function(){var e;return null!==(e=null===(e=this._axes)||void 0===e?void 0:e.get([Z])[Z])&&void 0!==e?e:0},enumerable:!1,configurable:!0}),Object.defineProperty(n,"bounce",{get:function(){var e;return null===(e=this._axes)||void 0===e?void 0:e.axis[Z].bounce},enumerable:!1,configurable:!0}),n.init=function(t){var e,i=this;this._flicking=t,this._axes=new o(((e={})[Z]={range:[0,0],circular:!1,bounce:[0,0]},e),{deceleration:t.deceleration,interruptable:t.interruptable,easing:t.easing}),this._panInput=new o.PanInput(t.viewport.element,{inputType:t.inputType,iOSEdgeSwipeThreshold:t.iOSEdgeSwipeThreshold,scale:t.horizontal?[-1,0]:[0,-1]});var r=this._axes;r.connect(t.horizontal?[Z,""]:["",Z],this._panInput);for(var n in K)!function(e){var n=K[e];r.on(n,function(e){i._stateMachine.fire(n,{flicking:t,axesEvent:e})})}(n);return this},n.destroy=function(){var e;null!==(e=this._axes)&&void 0!==e&&e.destroy(),null!==(e=this._panInput)&&void 0!==e&&e.destroy(),this._resetInternalValues()},n.enable=function(){var e;return null!==(e=this._panInput)&&void 0!==e&&e.enable(),this},n.disable=function(){var e;return null!==(e=this._panInput)&&void 0!==e&&e.disable(),this},n.update=function(){var n,t,e=b(this._flicking,"Control"),i=e.camera,r=this._axes,o=i.controlParams,a=r.axis[Z];return a.circular=[o.circular,o.circular],a.range=[o.range.min,o.range.max],a.bounce=(n=e.bounce,t=i.size,(_(n)?n.map(function(e){return F(e,t)}):[i=F(n,t),i]).map(function(e){if(null==e)throw new N(T("bounce",n),I.WRONG_OPTION);return e})),r.axm.set(((r={})[Z]=o.position,r)),this},n.animateTo=function(n,t,r){var i=this,o=this._axes;if(!o)return Promise.reject(new N(O("Control"),I.NOT_ATTACHED_TO_FLICKING));var e=o.get([Z])[Z];if(e===n)return b(this._flicking,"Control").camera.lookAt(n),Promise.resolve();this._animatingContext={start:e,end:n,offset:0};function a(){var e;o.once(K.FINISH,function(){i._animatingContext={start:0,end:0,offset:0}}),r?r.setTo(((e={})[Z]=n,e),t):o.setTo(((e={})[Z]=n,e),t)}return 0===t?(a(),o.axm.set(((e={})[Z]=n,e)),Promise.resolve()):new Promise(function(e,n){function t(){o.off(K.HOLD,i),e()}var i=function(){o.off(K.FINISH,t),n(new N(D,I.ANIMATION_INTERRUPTED))};o.once(K.FINISH,t),r||o.once(K.HOLD,i),a()})},n._resetInternalValues=function(){this._flicking=null,this._axes=null,this._panInput=null,this._animatingContext={start:0,end:0,offset:0}},e}(),ne=function(){function e(){var o=this;this._setActive=function(e,n,t){var i,r=b(o._flicking,"Control");o._activePanel=e,r.camera.updateAdaptiveHeight(),e!==n?r.trigger(new A.ComponentEvent(z.CHANGED,{index:e.index,panel:e,prevIndex:null!==(i=null==n?void 0:n.index)&&void 0!==i?i:-1,prevPanel:n,isTrusted:t,direction:n?m(n.position,e.position):V.NONE})):r.trigger(new A.ComponentEvent(z.RESTORED,{isTrusted:t}))},this._flicking=null,this._controller=new ee,this._activePanel=null}var n=e.prototype;return Object.defineProperty(n,"controller",{get:function(){return this._controller},enumerable:!1,configurable:!0}),Object.defineProperty(n,"activeIndex",{get:function(){var e;return null!==(e=null===(e=this._activePanel)||void 0===e?void 0:e.index)&&void 0!==e?e:-1},enumerable:!1,configurable:!0}),Object.defineProperty(n,"activePanel",{get:function(){return this._activePanel},enumerable:!1,configurable:!0}),Object.defineProperty(n,"animating",{get:function(){return this._controller.state.animating},enumerable:!1,configurable:!0}),Object.defineProperty(n,"holding",{get:function(){return this._controller.state.holding},enumerable:!1,configurable:!0}),n.init=function(e){return this._flicking=e,this._controller.init(e),this},n.destroy=function(){this._controller.destroy(),this._flicking=null,this._activePanel=null},n.enable=function(){return this._controller.enable(),this},n.disable=function(){return this._controller.disable(),this},n.updatePosition=function(e){var n=b(this._flicking,"Control").camera,t=this._activePanel;return t&&n.lookAt(n.clampToReachablePosition(t.position)),this},n.updateInput=function(){return this._controller.update(),this},n.resetActive=function(){return this._activePanel=null,this},n.moveToPanel=function(a,e){var l=e.duration,n=e.direction,s=void 0===n?V.NONE:n,u=e.axesEvent;return h(this,void 0,void 0,function(){var n,t,i,r,o;return f(this,function(e){return n=b(this._flicking,"Control"),o=n.camera,t=a.position,i=o.findNearestAnchor(t),a.removed||!i?[2,Promise.reject(new N(x(a.position),I.POSITION_NOT_REACHABLE))]:(o.canReach(a)?n.circularEnabled&&(r=this._controller.position,o=o.rangeDiff,t=[t,t+o,t-o].filter(function(e){return s===V.NONE||(s===V.PREV?e<=r:r<=e)}).reduce(function(e,n){return Math.abs(r-n)<Math.abs(r-e)?n:e},1/0)):(t=i.position,a=i.panel),this._triggerIndexChangeEvent(a,a.position,u),[2,this._animateToPosition({position:t,duration:l,newActivePanel:a,axesEvent:u})])})})},n._triggerIndexChangeEvent=function(e,n,t){var i=b(this._flicking,"Control"),r=e!==this._activePanel?z.WILL_CHANGE:z.WILL_RESTORE,o=i.camera,a=this._activePanel,n=new A.ComponentEvent(r,{index:e.index,panel:e,isTrusted:(null==t?void 0:t.isTrusted)||!1,direction:m(null!==(a=null==a?void 0:a.position)&&void 0!==a?a:o.position,n)});if(i.trigger(n),n.isCanceled())throw new N(S,I.STOP_CALLED_BY_USER)},n._animateToPosition=function(e){var a=e.position,l=e.duration,s=e.newActivePanel,u=e.axesEvent;return h(this,void 0,void 0,function(){var n,t,i,r,o=this;return f(this,function(e){return n=this._activePanel,t=function(){return o._controller.animateTo(a,l,u)},i=(null==u?void 0:u.isTrusted)||!1,l<=0?(r=t(),this._setActive(s,n,i),[2,r]):[2,t().then(function(){return o._setActive(s,n,i)})]})})},e}(),te=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return a(n,e),n.prototype.moveToPosition=function(s,u,c){return h(this,void 0,void 0,function(){var n,t,i,r,o,a,l;return f(this,function(e){return r=b(this._flicking,"Control"),n=r.camera,t=this._activePanel,o=n.clampToReachablePosition(s),(i=n.findNearestAnchor(o))&&t?(o=t.position,r=Math.abs(s-o)>=r.threshold,o=o<s?n.getNextAnchor(i):n.getPrevAnchor(i),r&&i.position!==t.position?(l=i.panel,a=i.position):r&&o?(l=o.panel,a=o.position):(a=n.clampToReachablePosition(t.position),l=t),this._triggerIndexChangeEvent(l,s,c),[2,this._animateToPosition({position:a,duration:u,newActivePanel:l,axesEvent:c})]):[2,Promise.reject(new N(x(s),I.POSITION_NOT_REACHABLE))]})})},n}(ne),ie=function(t){function e(e){var n=(void 0===e?{}:e).stopAtEdge,e=void 0===n||n,n=t.call(this)||this;return n._stopAtEdge=e,n}a(e,t);var n=e.prototype;return Object.defineProperty(n,"stopAtEdge",{get:function(){return this._stopAtEdge},set:function(e){this._stopAtEdge=e},enumerable:!1,configurable:!0}),n.updatePosition=function(e){var n=b(this._flicking,"Control").camera,t=this._activePanel;return t&&(e=(t=t.range).min+(t.max-t.min)*e,n.lookAt(n.clampToReachablePosition(e))),this},n.moveToPosition=function(i,r,o){return h(this,void 0,void 0,function(){var n,t;return f(this,function(e){return n=b(this._flicking,"Control"),t=n.camera,n=t.clampToReachablePosition(i),(t=t.findAnchorIncludePosition(n))?((t=t.panel)!==this._activePanel&&this._triggerIndexChangeEvent(t,i,o),[2,this._animateToPosition({position:this._stopAtEdge?n:i,duration:r,newActivePanel:t,axesEvent:o})]):[2,Promise.reject(new N(x(i),I.POSITION_NOT_REACHABLE))]})})},e}(ne),re={__proto__:null,Control:ne,SnapControl:te,FreeControl:ie,AxesController:ee,State:X,IdleState:U,HoldingState:Y,DraggingState:q,AnimatingState:J,DisabledState:Q,StateMachine:$},oe=function(){function e(e){var n=e.index,t=e.position,e=e.panel;this._index=n,this._pos=t,this._panel=e}var n=e.prototype;return Object.defineProperty(n,"index",{get:function(){return this._index},enumerable:!1,configurable:!0}),Object.defineProperty(n,"position",{get:function(){return this._pos},enumerable:!1,configurable:!0}),Object.defineProperty(n,"panel",{get:function(){return this._panel},enumerable:!1,configurable:!0}),e}(),ae=function(){function e(e){var l=this,e=(void 0===e?{}:e).align,e=void 0===e?H.CENTER:e;this._checkTranslateSupport=function(){var n,e,t=document.documentElement.style,i="";try{for(var r=c(["webkitTransform","msTransform","MozTransform","OTransform","transform"]),o=r.next();!o.done;o=r.next()){var a=o.value;a in t&&(i=a)}}catch(e){n={error:e}}finally{try{o&&!o.done&&(e=r.return)&&e.call(r)}finally{if(n)throw n.error}}if(!i)throw new N(k,I.TRANSFORM_NOT_SUPPORTED);l._transform=i},this._flicking=null,this._resetInternalValues(),this._align=e}var n=e.prototype;return Object.defineProperty(n,"element",{get:function(){return this._el},enumerable:!1,configurable:!0}),Object.defineProperty(n,"position",{get:function(){return this._position},enumerable:!1,configurable:!0}),Object.defineProperty(n,"alignPosition",{get:function(){return this._alignPos},enumerable:!1,configurable:!0}),Object.defineProperty(n,"offset",{get:function(){return this._offset},set:function(e){this._offset=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"range",{get:function(){return this._range},enumerable:!1,configurable:!0}),Object.defineProperty(n,"rangeDiff",{get:function(){return this._range.max-this._range.min},enumerable:!1,configurable:!0}),Object.defineProperty(n,"visiblePanels",{get:function(){return this._visiblePanels},enumerable:!1,configurable:!0}),Object.defineProperty(n,"visibleRange",{get:function(){return{min:this._position-this._alignPos,max:this._position-this._alignPos+this.size}},enumerable:!1,configurable:!0}),Object.defineProperty(n,"anchorPoints",{get:function(){return this._anchors},enumerable:!1,configurable:!0}),Object.defineProperty(n,"controlParams",{get:function(){return{range:this._range,position:this._position,circular:!1}},enumerable:!1,configurable:!0}),Object.defineProperty(n,"atEdge",{get:function(){return this._position<=this._range.min||this._position>=this._range.max},enumerable:!1,configurable:!0}),Object.defineProperty(n,"size",{get:function(){var e=this._flicking;return e?e.horizontal?e.viewport.width:e.viewport.height:0},enumerable:!1,configurable:!0}),Object.defineProperty(n,"progress",{get:function(){var e=this._flicking,n=this._position+this._offset,t=this.findNearestAnchor(this._position);if(!e||!t)return NaN;var i=t.panel,r=i.position+i.offset,o=e.control.controller.bounce,a=this.range,t=a.min,e=a.max,a=this.rangeDiff;if(n===r)return i.index;if(n<r){var l=i.prev(),l=l?l.position+l.offset:t-o[0];return r<l&&(l-=a),i.index-1+s(n,l,r)}l=i.next(),o=l?l.position+l.offset:e+o[1];return o<r&&(o+=a),i.index+s(n,r,o)},enumerable:!1,configurable:!0}),Object.defineProperty(n,"align",{get:function(){return this._align},set:function(e){this._align=e},enumerable:!1,configurable:!0}),n.init=function(e){e=(this._flicking=e).viewport.element;return function(e,n){if(null==e)throw new N(y(e,n),I.VAL_MUST_NOT_NULL)}(e.firstElementChild,"First element child of the viewport element"),this._el=e.firstElementChild,this._checkTranslateSupport(),this},n.destroy=function(){return this._flicking=null,this._resetInternalValues(),this},n.lookAt=function(e){var n=this._position;return this._position=e,this._refreshVisiblePanels(),this._checkNeedPanel(),this._checkReachEnd(n,e),this._applyTransform(),this},n.getPrevAnchor=function(e){return this._anchors[e.index-1]||null},n.getNextAnchor=function(e){return this._anchors[e.index+1]||null},n.getProgressInPanel=function(e){e=e.range;return(this._position-e.min)/(e.max-e.min)},n.findAnchorIncludePosition=function(t){return this._anchors.filter(function(e){return e.panel.includePosition(t,!0)}).reduce(function(e,n){return e&&Math.abs(e.position-t)<Math.abs(n.position-t)?e:n},null)},n.findNearestAnchor=function(e){var n=this._anchors;if(n.length<=0)return null;for(var t=1/0,i=0;i<n.length;i++){var r=n[i],r=Math.abs(r.position-e);if(t<r)return n[i-1];t=r}return n[n.length-1]},n.clampToReachablePosition=function(e){var n=this._range;return t(e,n.min,n.max)},n.canReach=function(e){var n=this._range;if(e.removed)return!1;e=e.position;return e>=n.min&&e<=n.max},n.canSee=function(e){var n=this.visibleRange;return e.includeRange(n.min,n.max,!1)},n.updateAlignPos=function(){var e=this._align,e="object"==typeof e?e.camera:e;return this._alignPos=l(e,this.size),this},n.updateAnchors=function(){var e=b(this._flicking,"Camera").renderer.panels;return this._anchors=e.map(function(e,n){return new oe({index:n,position:e.position,panel:e})}),this},n.updateAdaptiveHeight=function(){var e=b(this._flicking,"Camera"),n=e.control.activePanel;e.horizontal&&e.adaptive&&n&&e.viewport.setSize({height:n.height})},n.resetNeedPanelHistory=function(){return this._needPanelTriggered={prev:!1,next:!1},this},n._resetInternalValues=function(){this._position=0,this._alignPos=0,this._offset=0,this._range={min:0,max:0},this._visiblePanels=[],this._anchors=[],this._needPanelTriggered={prev:!1,next:!1}},n._refreshVisiblePanels=function(){var n=this,e=b(this._flicking,"Camera"),t=e.renderer.panels.filter(function(e){return n.canSee(e)}),i=this._visiblePanels,r=(this._visiblePanels=t).filter(function(e){return!E(i,e)}),o=i.filter(function(e){return!E(t,e)});(0<r.length||0<o.length)&&(e.renderer.render(),e.trigger(new A.ComponentEvent(z.VISIBLE_CHANGE,{added:r,removed:o,visiblePanels:t})))},n._checkNeedPanel=function(){var e=this._needPanelTriggered;if(!e.prev||!e.next){var n=b(this._flicking,"Camera"),t=n.renderer.panels;if(t.length<=0)return e.prev||(n.trigger(new A.ComponentEvent(z.NEED_PANEL,{direction:V.PREV})),e.prev=!0),void(e.next||(n.trigger(new A.ComponentEvent(z.NEED_PANEL,{direction:V.NEXT})),e.next=!0));var i=this._position,r=this.size,o=this._range,a=n.needPanelThreshold,l=i-this._alignPos,s=l+r,r=t[0],t=t[t.length-1];e.prev||(l<=r.range.min+a||i<=o.min+a)&&(n.trigger(new A.ComponentEvent(z.NEED_PANEL,{direction:V.PREV})),e.prev=!0),e.next||(t.range.max-a<=s||i>=o.max-a)&&(n.trigger(new A.ComponentEvent(z.NEED_PANEL,{direction:V.NEXT})),e.next=!0)}},n._checkReachEnd=function(e,n){var t=b(this._flicking,"Camera"),i=this._range,r=e>i.min&&e<i.max,e=n>i.min&&n<i.max;r&&!e&&(i=n<=i.min?V.PREV:V.NEXT,t.trigger(new A.ComponentEvent(z.REACH_EDGE,{direction:i})))},n._applyTransform=function(){var e=this._el,n=b(this._flicking,"Camera"),t=this._position-this._alignPos-this._offset;e.style[this._transform]=n.horizontal?"translate("+-t+"px)":"translate(0, "+-t+"px)"},e}(),le=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return a(n,e),n.prototype.updateRange=function(){var e=b(this._flicking,"Camera").renderer,n=e.getPanel(0),e=e.getPanel(e.panelCount-1);return this._range={min:null!==(n=null==n?void 0:n.position)&&void 0!==n?n:0,max:null!==(e=null==e?void 0:e.position)&&void 0!==e?e:0},this},n}(ae),se=function(u){function e(){var e=null!==u&&u.apply(this,arguments)||this;return e._circularOffset=0,e._circularEnabled=!1,e._panelTooglePoints={},e}a(e,u);var n=e.prototype;return Object.defineProperty(n,"controlParams",{get:function(){return{range:this._range,position:this._position,circular:this._circularEnabled}},enumerable:!1,configurable:!0}),n.getPrevAnchor=function(e){if(!this._circularEnabled||0!==e.index)return u.prototype.getPrevAnchor.call(this,e);var n=this._anchors,e=this.rangeDiff,n=n[n.length-1];return new oe({index:n.index,position:n.position-e,panel:n.panel})},n.getNextAnchor=function(e){var n=this._anchors;if(!this._circularEnabled||e.index!==n.length-1)return u.prototype.getNextAnchor.call(this,e);e=this.rangeDiff,n=n[0];return new oe({index:n.index,position:n.position+e,panel:n.panel})},n.findAnchorIncludePosition=function(e){if(!this._circularEnabled)return u.prototype.findAnchorIncludePosition.call(this,e);var n,t,i=this._range,r=(o=e,n=i.min,t=i.max,r=t-n,o<n?o=t-(n-o)%r:t<o&&(o=n+(o-t)%r),o),o=u.prototype.findAnchorIncludePosition.call(this,r);if(!o)return null;var r=this.rangeDiff;if(e<i.min){var a=-Math.floor((i.min-e)/r)-1;return new oe({index:o.index,position:o.position+r*a,panel:o.panel})}if(e>i.max){a=Math.floor((e-i.max)/r)+1;return new oe({index:o.index,position:o.position+r*a,panel:o.panel})}return o},n.clampToReachablePosition=function(e){return this._circularEnabled?e:u.prototype.clampToReachablePosition.call(this,e)},n.canReach=function(e){return!e.removed&&(!!this._circularEnabled||u.prototype.canReach.call(this,e))},n.canSee=function(e){var n=this._range,t=this.rangeDiff,i=this.visibleRange,r=u.prototype.canSee.call(this,e);return this._circularEnabled?i.min<n.min?r||e.includeRange(i.min+t,i.max+t,!1):i.max>n.max?r||e.includeRange(i.min-t,i.max-t,!1):r:r},n.updateRange=function(){var e=b(this._flicking,"Camera").renderer,n=e.panels;if(n.length<=0)return this._resetInternalValues(),this;var a,l,s,u,c,h,f,d,g,p=this._position,t=n[0],i=n[n.length-1],r=t.range.min-t.margin.prev,o=i.range.max+i.margin.next,_=this.size,m=o-r,v=n.every(function(e){return m-e.size>=_});return v?(this._range={min:r,max:o},a={},l=this._alignPos,s=[],u=[],c=[],h=[],f=this._range,d=f.min-l,g=f.max-l+_,n.forEach(function(e){var n,t,i,r=e.includeRange(g-_,g,!1),o=e.includeRange(d,d+_,!1);r&&(n=e.range.max+f.min-f.max+l,a[n]=i={panel:e,direction:V.PREV,toggled:t=p<n},t&&(s.push(e),u.push(i))),o&&(t=(n=e.range.min+f.max-_+l)<p,a[n]=i={panel:e,direction:V.NEXT,toggled:!1},t&&(c.push(e),h.push(i)))}),e.elementManipulator.movePanelElementsToStart(s,u),e.elementManipulator.movePanelElementsToEnd(c,h),this._circularOffset=this._calcPanelAreaSum(s)-this._calcPanelAreaSum(c),this._panelTooglePoints=a):(this._range={min:t.position,max:i.position},this._circularOffset=0,this._panelTooglePoints={}),this._circularEnabled=v,this},n.lookAt=function(r){var o,a,e,n=b(this._flicking,"Camera"),l=this._position,s=this._panelTooglePoints,t=n.renderer.elementManipulator,i=Object.keys(s).map(function(e){return parseFloat(e)}).sort(function(e,n){return e-n});return r===l||(l<r?(o=[],e=i.reduce(function(e,n){var t=s[n],i=t.direction===V.NEXT&&!t.toggled||t.direction===V.PREV&&t.toggled;return l<=n&&n<=r&&i&&(t.toggled=!t.toggled,e.push(t.panel),o.push(t)),e},[]),t.movePanelElementsToEnd(e,o),this._circularOffset-=this._calcPanelAreaSum(e)):(a=[],e=i.reduce(function(e,n){var t=s[n],i=t.direction===V.NEXT&&t.toggled||t.direction===V.PREV&&!t.toggled;return n<=l&&r<=n&&i&&(t.toggled=!t.toggled,e.push(t.panel),a.push(t)),e},[]),t.movePanelElementsToStart(e,a),this._circularOffset+=this._calcPanelAreaSum(e)),this._position=r,n.renderer.render()),u.prototype.lookAt.call(this,r)},n._applyTransform=function(){var e=this._el,n=b(this._flicking,"Camera"),t=this._position-this._alignPos-this._offset+this._circularOffset;e.style[this._transform]=n.horizontal?"translate("+-t+"px)":"translate(0, "+-t+"px)"},n._resetInternalValues=function(){u.prototype._resetInternalValues.call(this),this._circularOffset=0,this._circularEnabled=!1,this._panelTooglePoints={}},n._calcPanelAreaSum=function(e){return e.reduce(function(e,n){return e+n.sizeIncludingMargin},0)},e}(ae),ue=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}a(n,e);var t=n.prototype;return t.updateRange=function(){var e=b(this._flicking,"Camera").renderer,n=this._alignPos,t=e.getPanel(0),i=e.getPanel(e.panelCount-1);if(!t||!i)return this._range={min:0,max:0},this;var r=this.size,o=t.range.min,e=i.range.max;return this._range=r<e-o?{min:o+n,max:e-r+n}:{min:t.position,max:i.position},this},t.updateAnchors=function(){var n=this,e=b(this._flicking,"Camera").renderer.panels;if(e.length<=0)return this._anchors=[],this;var t=this._range,i=e.filter(function(e){return n.canReach(e)}),r=i[0].position!==t.min,o=i[i.length-1].position!==t.max,a=r?1:0,l=i.map(function(e,n){return new oe({index:n+a,position:e.position,panel:e})});return r&&l.splice(0,0,new oe({index:0,position:t.min,panel:e[i[0].index-1]})),o&&l.push(new oe({index:l.length,position:t.max,panel:e[i[i.length-1].index+1]})),this._anchors=l,this},n}(ae),ne={__proto__:null,Camera:ae,LinearCamera:le,CircularCamera:se,BoundCamera:ue},ce=function(){function e(e){var n=e.el,t=e.index,i=e.align,e=e.flicking;this._el=n,this._index=t,this._flicking=e,this._align=i,this._removed=!1,this._resetInternalStates()}var n=e.prototype;return Object.defineProperty(n,"element",{get:function(){return this._el},enumerable:!1,configurable:!0}),Object.defineProperty(n,"index",{get:function(){return this._index},enumerable:!1,configurable:!0}),Object.defineProperty(n,"position",{get:function(){return this._pos+this._alignPos},enumerable:!1,configurable:!0}),Object.defineProperty(n,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),Object.defineProperty(n,"sizeIncludingMargin",{get:function(){return this._size+this._margin.prev+this._margin.next},enumerable:!1,configurable:!0}),Object.defineProperty(n,"height",{get:function(){return this._height},enumerable:!1,configurable:!0}),Object.defineProperty(n,"margin",{get:function(){return this._margin},enumerable:!1,configurable:!0}),Object.defineProperty(n,"alignPosition",{get:function(){return this._alignPos},enumerable:!1,configurable:!0}),Object.defineProperty(n,"offset",{get:function(){return this._offset},enumerable:!1,configurable:!0}),Object.defineProperty(n,"removed",{get:function(){return this._removed},enumerable:!1,configurable:!0}),Object.defineProperty(n,"range",{get:function(){return{min:this._pos,max:this._pos+this._size}},enumerable:!1,configurable:!0}),Object.defineProperty(n,"progress",{get:function(){var e=this._flicking;return this.index-e.camera.progress},enumerable:!1,configurable:!0}),Object.defineProperty(n,"outsetProgress",{get:function(){var e=this.position+this._offset,n=this._alignPos,t=this._flicking.camera,i=t.position;if(i===e)return 0;if(i<e){var r=e+(t.size-t.alignPosition)+n;return-s(i,e,r)}n=e-(t.alignPosition+this._size-n);return 1-s(i,n,e)},enumerable:!1,configurable:!0}),Object.defineProperty(n,"visibleRatio",{get:function(){var e=this.range,n=this._size,t=this._offset,i=this._flicking.camera.visibleRange,r=e.min+t,e=e.max+t;if(e<=i.min||r>=i.max)return 0;t=n;return i.min>r&&(t-=i.min-r),i.max<e&&(t-=e-i.max),t/n},enumerable:!1,configurable:!0}),Object.defineProperty(n,"align",{get:function(){return this._align},set:function(e){this._align=e},enumerable:!1,configurable:!0}),n.resize=function(){var e=this._el,n=u(e),t=this._flicking,i=t.horizontal,t=t.renderer.panels[this._index-1];return this._size=i?e.offsetWidth:e.offsetHeight,this._margin=i?{prev:parseFloat(n.marginLeft||"0"),next:parseFloat(n.marginRight||"0")}:{prev:parseFloat(n.marginTop||"0"),next:parseFloat(n.marginBottom||"0")},this._pos=t?t.range.max+t.margin.next+this._margin.prev:this._margin.prev,this._height=i?e.offsetHeight:this._size,this._updateAlignPos(),this},n.contains=function(e){return this._el.contains(e)},n.destroy=function(){this._resetInternalStates(),this._removed=!0},n.includePosition=function(e,n){return this.includeRange(e,e,n=void 0===n?!1:n)},n.includeRange=function(e,n,t){var i=this._margin,r=this.range;return(t=void 0===t?!1:t)&&(r.min-=i.prev,r.max+=i.next),n>=r.min&&e<=r.max},n.focus=function(e){return this._flicking.moveTo(this._index,e)},n.prev=function(){var e=this._index,n=this._flicking,t=n.renderer,i=t.panelCount;return 1===i?null:n.circularEnabled?t.getPanel(0===e?i-1:e-1):t.getPanel(e-1)},n.next=function(){var e=this._index,n=this._flicking,t=n.renderer,i=t.panelCount;return 1===i?null:n.circularEnabled?t.getPanel(e===i-1?0:e+1):t.getPanel(e+1)},n.increaseIndex=function(e){return this._index+=Math.max(e,0),this},n.decreaseIndex=function(e){return this._index-=Math.max(e,0),this},n.increasePosition=function(e){return this._moveBy(Math.max(e,0)),this},n.decreasePosition=function(e){return this._moveBy(-Math.max(e,0)),this},n.increaseOffset=function(e){return this._offset+=Math.max(e,0),this},n.decreaseOffset=function(e){return this._offset-=Math.max(e,0),this},n.resetOffset=function(){return this._offset=0,this},n._moveBy=function(e){return this._pos+=e,this},n._updateAlignPos=function(){this._alignPos=l(this._align,this._size)},n._resetInternalStates=function(){this._size=0,this._pos=0,this._margin={prev:0,next:0},this._height=0,this._alignPos=0,this._offset=0},e}(),he=function(n){function e(){var e=n.call(this)||this;return e._flicking=null,e}a(e,n);var t=e.prototype;return t.init=function(e){this._flicking=e},t.destroy=function(){this._flicking=null},t.insertPanelElements=function(e,n){return this},t.movePanelElementsToStart=function(e,n){var t=b(this._flicking,"Renderer").camera.rangeDiff;return e.forEach(function(e,n){e.decreaseOffset(t)}),0<e.length&&this.trigger("orderChanged"),this},t.movePanelElementsToEnd=function(e,n){var t=b(this._flicking,"Renderer").camera.rangeDiff;return e.forEach(function(e,n){e.increaseOffset(t)}),0<e.length&&this.trigger("orderChanged"),this},t.resetPanelElementOrder=function(e){return e.forEach(function(e){e.resetOffset()}),0<e.length&&this.trigger("orderChanged"),this},t.removePanelElements=function(e){return this},t.removeAllChildNodes=function(e){return this},t.removeAllTextNodes=function(e){return this},e}(A),X=function(){function e(e){var n=void 0===e?{}:e,e=n.align,e=void 0===e?H.CENTER:e,n=n.elementManipulator,n=void 0===n?new he:n;this._align=e,this._flicking=null,this._elementManipulator=n,this._panels=[]}var n=e.prototype;return Object.defineProperty(n,"panels",{get:function(){return this._panels},enumerable:!1,configurable:!0}),Object.defineProperty(n,"panelCount",{get:function(){return this._panels.length},enumerable:!1,configurable:!0}),Object.defineProperty(n,"elementManipulator",{get:function(){return this._elementManipulator},enumerable:!1,configurable:!0}),Object.defineProperty(n,"align",{get:function(){return this._align},set:function(e){this._align=e;var n=this._getPanelAlign();this._panels.forEach(function(e){e.align=n})},enumerable:!1,configurable:!0}),n.init=function(e){return this._flicking=e,this._elementManipulator.init(e),this._collectPanels(),this},n.destroy=function(){this._flicking=null,this._panels=[],this._elementManipulator.destroy()},n.getPanel=function(e){return this._panels[e]||null},n.insert=function(e,n){var t=this._panels,i=this._elementManipulator,r=b(this._flicking,"Renderer"),o=r.control,a=this._getPanelAlign(),n=function(e){_(e)||(e=[e]);var t=[];return e.forEach(function(e){if(B(e)){var n=document.createElement("div");for(n.innerHTML=e,t.push.apply(t,g([],d(p(n.children))));n.firstChild;)n.removeChild(n.firstChild)}else{if(!e||e.nodeType!==Node.ELEMENT_NODE)throw new N(C(e,["HTMLElement","string"]),I.WRONG_TYPE);t.push(e)}}),t}(n),l=v(e,t.length),e=t.slice(l),s=n.map(function(e,n){return new ce({el:e,index:l+n,align:a,flicking:r})});if(s.length<=0)return[];i.resetPanelElementOrder(t),t.splice.apply(t,g([l,0],d(s))),i.insertPanelElements(s,e[0]||null),s.forEach(function(e){return e.resize()});var u=this._getPanelSizeSum(s);return e.forEach(function(e){e.increaseIndex(s.length),e.increasePosition(u)}),this._updateCameraAndControl(),this.render(),0<s.length&&!o.animating&&o.moveToPanel(o.activePanel||s[0],{duration:0}).catch(function(){}),s},n.remove=function(e,n){void 0===n&&(n=1);var t=this._panels,i=this._elementManipulator,r=b(this._flicking,"Renderer"),o=r.camera,a=r.control,l=a.activePanel,r=v(e,t.length),e=t.slice(r+n),s=t.splice(r,n);if(s.length<=0)return[];i.resetPanelElementOrder(t);var u=this._getPanelSizeSum(s);return e.forEach(function(e){e.decreaseIndex(s.length),e.decreasePosition(u)}),i.removePanelElements(s),s.forEach(function(e){return e.destroy()}),this._updateCameraAndControl(),E(s,l)&&a.resetActive(),this.render(),0<s.length&&!a.animating&&((l=E(s,l)?e[0]||t[t.length-1]:l)?a.moveToPanel(l,{duration:0}).catch(function(){}):o.lookAt(0)),s},n.updatePanelSize=function(){return this._panels.forEach(function(e){return e.resize()}),this},n._collectPanels=function(){var t=b(this._flicking,"Renderer"),e=t.camera.element;this._elementManipulator.removeAllTextNodes(e);var i=this._getPanelAlign(),e=p(e.children);return this._panels=e.map(function(e,n){return new ce({flicking:t,el:e,index:n,align:i})}),this},n._getPanelAlign=function(){var e=this._align;return"object"==typeof e?e.panel:e},n._getPanelSizeSum=function(e){var n=e[0],t=e[e.length-1],e=t.margin.next-n.margin.prev;return t.range.max-n.range.min+e},n._updateCameraAndControl=function(){var e=b(this._flicking,"Renderer"),n=e.camera,e=e.control;n.updateRange(),n.updateAnchors(),n.resetNeedPanelHistory(),e.updateInput()},e}(),fe=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return a(n,e),n.prototype.render=function(){return this},n}(X),de=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}a(n,e);var t=n.prototype;return t.render=function(){var e=b(this._flicking,"Renderer"),n=e.camera,t=n.element,i=e.renderer.panels,r=n.visiblePanels,o=this._elementManipulator;if(i.length<=0||r.length<=0)return n.offset=0,this;e.holding&&(a=g([],d(i)).filter(function(e){return e.element.parentElement===t&&!E(r,e)}),r.push.apply(r,g([],d(a))));var a=g([],d(r)).sort(function(e,n){return e.position+e.offset-(n.position+n.offset)});e.holding||o.removeAllChildNodes(t),o.insertPanelElements(a,null);i=i.filter(function(e){return!E(r,e)}).filter(function(e){return e.range.max+e.offset<n.visibleRange.min}),i=this._calcPanelRangeSize(i);return n.offset=i,this},t._calcPanelRangeSize=function(e){return e.reduce(function(e,n){return e+n.sizeIncludingMargin},0)},n}(fe),ge=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}a(n,e);var t=n.prototype;return t.insertPanelElements=function(e,n){var t=b(this._flicking,"Renderer").camera.element,n=(null==n?void 0:n.element)||null,i=document.createDocumentFragment();return e.forEach(function(e){return i.appendChild(e.element)}),t.insertBefore(i,n),this},t.movePanelElementsToStart=function(e){var n=b(this._flicking,"Renderer").camera,t=n.element,i=n.rangeDiff,n=e.map(function(e){return e.element}),t=E(n,t.firstElementChild)?null:t.firstElementChild;return this._relocatePanelElements(e,t),e.forEach(function(e){e.decreaseOffset(i)}),this},t.movePanelElementsToEnd=function(e){var n=b(this._flicking,"Renderer").camera.rangeDiff;return this._relocatePanelElements(e,null),e.forEach(function(e){e.increaseOffset(n)}),this},t.resetPanelElementOrder=function(e){var n=b(this._flicking,"Renderer").camera.element;return this._relocatePanelElements(e.filter(function(e){return e.element.parentElement===n}),null),e.forEach(function(e){e.resetOffset()}),this},t.removePanelElements=function(e){var n=b(this._flicking,"Renderer").camera.element;return e.forEach(function(e){n.removeChild(e.element)}),this},t.removeAllChildNodes=function(e){for(;e.firstChild;)e.removeChild(e.firstChild);return this},t.removeAllTextNodes=function(n){return n.childNodes.forEach(function(e){e.nodeType===Node.TEXT_NODE&&n.removeChild(e)}),this},t._relocatePanelElements=function(e,n){var t=b(this._flicking,"Renderer").camera.element,i=document.createDocumentFragment();e.forEach(function(e){return i.appendChild(e.element)}),t.insertBefore(i,n)},n}(he),pe=function(i){function e(){return null!==i&&i.apply(this,arguments)||this}a(e,i);var n=e.prototype;return n.movePanelElementsToStart=function(e,t){var n=b(this._flicking,"Renderer");return n.circular&&!n.renderOnlyVisible&&e.forEach(function(e,n){t[n].toggled?e.element.style.order="-1":e.element.style.order="0"}),i.prototype.movePanelElementsToStart.call(this,e,t)},n.movePanelElementsToEnd=function(e,t){var n=b(this._flicking,"Renderer");return n.circular&&!n.renderOnlyVisible&&e.forEach(function(e,n){t[n].toggled?e.element.style.order="1":e.element.style.order="0"}),i.prototype.movePanelElementsToEnd.call(this,e,t)},n.resetPanelElementOrder=function(e){var n=b(this._flicking,"Renderer");return n.circular&&!n.renderOnlyVisible&&e.forEach(function(e){e.element.style.order="0"}),i.prototype.resetPanelElementOrder.call(this,e)},e}(he),ae={__proto__:null,Renderer:X,RawRenderer:fe,VisibleRenderer:de,OffsetManipulator:he,ElementManipulator:ge,OrderManipulator:pe},X=function(x){function e(e,n){var t=void 0===n?{}:n,i=t.align,r=void 0===i?H.CENTER:i,o=t.defaultIndex,a=void 0===o?0:o,l=t.horizontal,s=void 0===l||l,u=t.circular,c=void 0!==u&&u,h=t.bound,f=void 0!==h&&h,d=t.adaptive,g=void 0!==d&&d,p=t.needPanelThreshold,_=void 0===p?0:p,m=t.deceleration,v=void 0===m?.0075:m,b=t.duration,E=void 0===b?500:b,P=t.easing,y=void 0===P?function(e){return 1-Math.pow(1-e,3)}:P,O=t.inputType,n=void 0===O?["mouse","touch"]:O,i=t.moveType,o=void 0===i?"snap":i,l=t.threshold,u=void 0===l?40:l,h=t.interruptable,d=void 0===h||h,p=t.bounce,m=void 0===p?"20%":p,b=t.iOSEdgeSwipeThreshold,P=void 0===b?30:b,O=t.preventClickOnDrag,i=void 0===O||O,l=t.disableOnInit,h=void 0!==l&&l,p=t.renderOnlyVisible,b=void 0!==p&&p,O=t.autoInit,l=void 0===O||O,p=t.autoResize,O=void 0===p||p,p=t.renderExternal,p=void 0!==p&&p,t=t.useOrderManipulator,t=void 0!==t&&t,T=x.call(this)||this;return T.resize=function(){var e=T._viewport,n=T._renderer,t=T._camera,i=T._control,r=i.activePanel,o=e.width,a=e.height,r=r?t.getProgressInPanel(r):0;T.trigger(new A.ComponentEvent(z.BEFORE_RESIZE,{width:o,height:a,element:e.element})),e.resize(),n.elementManipulator.insertPanelElements(n.panels,null),n.updatePanelSize(),n.elementManipulator.resetPanelElementOrder(n.panels),n.render(),t.updateAlignPos(),t.updateRange(),t.updateAnchors(),i.animating||(i.updatePosition(r),i.updateInput());r=e.width,i=e.height;return T.trigger(new A.ComponentEvent(z.AFTER_RESIZE,{width:e.width,height:e.height,prev:{width:o,height:a},sizeChanged:r!==o||i!==a,element:e.element})),T},T._preventClickWhenDragged=function(e){T._control.animating&&e.preventDefault()},T._initialized=!1,T._plugins=[],T._align=r,T._defaultIndex=a,T._horizontal=s,T._circular=c,T._bound=f,T._adaptive=g,T._needPanelThreshold=_,T._deceleration=v,T._duration=E,T._easing=y,T._inputType=n,T._moveType=o,T._threshold=u,T._interruptable=d,T._bounce=m,T._iOSEdgeSwipeThreshold=P,T._preventClickOnDrag=i,T._disableOnInit=h,T._renderOnlyVisible=b,T._autoResize=O,T._autoInit=l,T._renderExternal=p,T._useOrderManipulator=t,T._viewport=new W(function(e,n){var t=null;if(B(e)){n=(n||document).querySelector(e);if(!n)throw new N(R(e),I.ELEMENT_NOT_FOUND);t=n}else e&&e.nodeType===Node.ELEMENT_NODE&&(t=e);if(!t)throw new N(C(e,["HTMLElement","string"]),I.WRONG_TYPE);return t}(e)),T._renderer=T._createRenderer(),T._camera=T._createCamera(),T._control=T._createControl(),T._autoInit&&T.init(),T}a(e,x);var n=e.prototype;return Object.defineProperty(n,"control",{get:function(){return this._control},enumerable:!1,configurable:!0}),Object.defineProperty(n,"camera",{get:function(){return this._camera},enumerable:!1,configurable:!0}),Object.defineProperty(n,"renderer",{get:function(){return this._renderer},enumerable:!1,configurable:!0}),Object.defineProperty(n,"viewport",{get:function(){return this._viewport},enumerable:!1,configurable:!0}),Object.defineProperty(n,"initialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(n,"circularEnabled",{get:function(){return this._camera.controlParams.circular},enumerable:!1,configurable:!0}),Object.defineProperty(n,"index",{get:function(){return this._control.activeIndex},enumerable:!1,configurable:!0}),Object.defineProperty(n,"element",{get:function(){return this._viewport.element},enumerable:!1,configurable:!0}),Object.defineProperty(n,"currentPanel",{get:function(){return this._control.activePanel},enumerable:!1,configurable:!0}),Object.defineProperty(n,"panels",{get:function(){return this._renderer.panels},enumerable:!1,configurable:!0}),Object.defineProperty(n,"panelCount",{get:function(){return this._renderer.panelCount},enumerable:!1,configurable:!0}),Object.defineProperty(n,"visiblePanels",{get:function(){return this._camera.visiblePanels},enumerable:!1,configurable:!0}),Object.defineProperty(n,"animating",{get:function(){return this._control.animating},enumerable:!1,configurable:!0}),Object.defineProperty(n,"holding",{get:function(){return this._control.holding},enumerable:!1,configurable:!0}),Object.defineProperty(n,"plugins",{get:function(){return this._plugins},enumerable:!1,configurable:!0}),Object.defineProperty(n,"align",{get:function(){return this._align},set:function(e){this._align=e,this._renderer.align=e,this._camera.align=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"defaultIndex",{get:function(){return this._defaultIndex},set:function(e){this._defaultIndex=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"horizontal",{get:function(){return this._horizontal},set:function(e){this._horizontal=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"circular",{get:function(){return this._circular},set:function(e){this._circular=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"bound",{get:function(){return this._bound},set:function(e){this._bound=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"adaptive",{get:function(){return this._adaptive},set:function(e){this._adaptive=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"needPanelThreshold",{get:function(){return this._needPanelThreshold},enumerable:!1,configurable:!0}),Object.defineProperty(n,"deceleration",{get:function(){return this._deceleration},set:function(e){this._deceleration=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"easing",{get:function(){return this._easing},set:function(e){this._easing=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"duration",{get:function(){return this._duration},set:function(e){this._duration=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"inputType",{get:function(){return this._inputType},set:function(e){this._inputType=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"moveType",{get:function(){return this._moveType},set:function(e){this._moveType=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"threshold",{get:function(){return this._threshold},set:function(e){this._threshold=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"interruptable",{get:function(){return this._interruptable},set:function(e){this._interruptable=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"bounce",{get:function(){return this._bounce},set:function(e){this._bounce=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"iOSEdgeSwipeThreshold",{get:function(){return this._iOSEdgeSwipeThreshold},set:function(e){this._iOSEdgeSwipeThreshold=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"preventClickOnDrag",{get:function(){return this._preventClickOnDrag},set:function(e){this._preventClickOnDrag=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"disableOnInit",{get:function(){return this._disableOnInit},set:function(e){this._disableOnInit=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"renderOnlyVisible",{get:function(){return this._renderOnlyVisible},set:function(e){this._renderOnlyVisible=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"autoInit",{get:function(){return this._autoInit},enumerable:!1,configurable:!0}),Object.defineProperty(n,"autoResize",{get:function(){return this._autoResize},set:function(e){this._autoResize=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"renderExternal",{get:function(){return this._renderExternal},enumerable:!1,configurable:!0}),Object.defineProperty(n,"useOrderManipulator",{get:function(){return this._useOrderManipulator},set:function(e){this._useOrderManipulator=e},enumerable:!1,configurable:!0}),n.init=function(){var n=this;if(this._initialized)return this;var e=this._camera,t=this._renderer,i=this._control,r=this._viewport;return e.init(this),t.init(this),i.init(this),this.resize(),this._moveToInitialPanel(),this._autoResize&&window.addEventListener("resize",this.resize),this._preventClickOnDrag&&r.element.addEventListener("click",this._preventClickWhenDragged),this._disableOnInit&&this.disableInput(),this._plugins.forEach(function(e){return e.init(n)}),this._initialized=!0,this.trigger(new A.ComponentEvent(z.READY)),this},n.destroy=function(){this._initialized&&(this.off(),window.removeEventListener("resize",this.resize),this._viewport.element.removeEventListener("click",this._preventClickWhenDragged),this._control.destroy(),this._camera.destroy(),this._renderer.destroy(),this._plugins.forEach(function(e){return e.destroy()}),this._initialized=!1)},n.prev=function(e){var n;return void 0===e&&(e=this._duration),this.moveTo(null!==(n=null===(n=null===(n=this._control.activePanel)||void 0===n?void 0:n.prev())||void 0===n?void 0:n.index)&&void 0!==n?n:-1,e,V.PREV)},n.next=function(e){var n;return void 0===e&&(e=this._duration),this.moveTo(null!==(n=null===(n=null===(n=this._control.activePanel)||void 0===n?void 0:n.next())||void 0===n?void 0:n.index)&&void 0!==n?n:this._renderer.panelCount,e,V.NEXT)},n.moveTo=function(e,n,t){void 0===n&&(n=this._duration),void 0===t&&(t=V.NONE);var i=this._renderer,r=i.panelCount,i=i.getPanel(e);return i?this._control.animating?Promise.reject(new N(j,I.ANIMATION_ALREADY_PLAYING)):this._control.moveToPanel(i,{duration:n,direction:t}):Promise.reject(new N(w(e,0,r-1),I.INDEX_OUT_OF_RANGE))},n.getPanel=function(e){return this._renderer.getPanel(e)},n.enableInput=function(){return this._control.enable(),this},n.disableInput=function(){return this._control.disable(),this},n.getStatus=function(e){var n=void 0===e?{}:e,t=n.index,i=void 0===t||t,r=n.position,e=void 0===r||r,t=n.includePanelHTML,o=void 0!==t&&t,r=n.visiblePanelsOnly,t=void 0!==r&&r,n=this._camera,r={panels:(t?this.visiblePanels:this.panels).map(function(e){var n={index:e.index};return o&&(n.html=e.element.outerHTML),n})};return i&&(r.index=this.index),!e||(e=n.findNearestAnchor(n.position))&&(r.position={panel:e.panel.index,progressInPanel:n.getProgressInPanel(e.panel)}),t&&(t=this.visiblePanels,r.visibleOffset=null!==(t=null===(t=t[0])||void 0===t?void 0:t.index)&&void 0!==t?t:0),r},n.setStatus=function(e){if(!this._initialized)throw new N(M,I.NOT_INITIALIZED);var n=e.index,t=e.position,i=e.visibleOffset,r=e.panels,o=this._renderer,a=this._control;null!==(e=r[0])&&void 0!==e&&e.html&&!this._renderExternal&&(o.remove(0,this.panels.length),o.insert(0,r.map(function(e){return e.html}))),n&&this.moveTo(i?n-i:n,0).catch(function(){}),t&&this._moveType===G.FREE_SCROLL&&(n=t.panel,t=t.progressInPanel,t=(n=o.panels[i?n-i:n].range).min+(n.max-n.min)*t,a.moveToPosition(t,0).catch(function(){}))},n.addPlugins=function(){for(var e,n=this,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return this._initialized&&t.forEach(function(e){return e.init(n)}),(e=this._plugins).push.apply(e,g([],d(t))),this},n.removePlugins=function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return e.forEach(function(n){var e=function(e,n){for(var t=0;t<e.length;t++)if(n(e[t]))return t;return-1}(t._plugins,function(e){return e===n});0<=e&&(n.destroy(),t._plugins.splice(e,1))}),this},n.append=function(e){return this.insert(this._renderer.panelCount,e)},n.prepend=function(e){return this.insert(0,e)},n.insert=function(e,n){if(this._renderExternal)throw new N(L,I.NOT_ALLOWED_IN_FRAMEWORK);return this._renderer.insert(e,n)},n.remove=function(e,n){if(void 0===n&&(n=1),this._renderExternal)throw new N(L,I.NOT_ALLOWED_IN_FRAMEWORK);return this._renderer.remove(e,n)},n._createControl=function(){var e=this._moveType,n=Object.keys(G).map(function(e){return G[e]});if(!E(n,e))throw new N(T("moveType",JSON.stringify(e)),I.WRONG_OPTION);switch(e){case G.SNAP:return new te;case G.FREE_SCROLL:return new ie}},n._createCamera=function(){var e={align:this._align};return this._circular?(this._bound&&console.warn('"circular" and "bound" option cannot be used together, ignoring bound.'),new se(e)):new(this._bound?ue:le)(e)},n._createRenderer=function(){var e=new(this._useOrderManipulator?pe:this._renderExternal?he:ge),e={align:this._align,elementManipulator:e};return this._createActualRenderer(e)},n._createActualRenderer=function(e){return new(this._renderOnlyVisible?de:fe)(e)},n._moveToInitialPanel=function(){var e=this._renderer,n=this._control,e=e.getPanel(this._defaultIndex)||e.getPanel(0);e&&n.moveToPanel(e,{duration:0})},e.VERSION="4.0.0-beta.6",e}(A);return e(X,{__proto__:null,Panel:ce,Viewport:W,FlickingError:N,AnchorPoint:oe}),e(X,ne),e(X,re),e(X,ae),e(X,n),X}); | ||
//# sourceMappingURL=flicking.min.js.map |
{ | ||
"name": "@egjs/flicking", | ||
"version": "4.0.0-beta.5", | ||
"version": "4.0.0-beta.6", | ||
"description": "Everyday 30 million people experience. It's reliable, flexible and extendable carousel.", | ||
@@ -104,2 +104,3 @@ "main": "dist/flicking.js", | ||
"@daybrush/jsdoc": "^0.3.10", | ||
"@egjs/flicking-plugins": "^4.0.0-beta.1", | ||
"@egjs/release-helper": "0.0.3", | ||
@@ -106,0 +107,0 @@ "@rollup/plugin-commonjs": "^11.1.0", |
@@ -29,3 +29,3 @@ <h1 align="center" style="max-width: 100%;"> | ||
<h3 align="center"> | ||
<a href="https://naver.github.io/egjs-flicking/">Demo</a> / <a href="https://naver.github.io/egjs-flicking/release/latest/doc/index.html">Documentation</a> / <a href="https://naver.github.io/egjs/"><img height="20" src="https://naver.github.io/egjs/img/logo.svg"/> Other components</a> | ||
<a href="https://naver.github.io/egjs-flicking/">Demo</a> / <a href="https://naver.github.io/egjs-flicking/docs/api/Flicking">Documentation</a> / <a href="https://naver.github.io/egjs/"><img height="20" src="https://naver.github.io/egjs/img/logo.svg"/> Other components</a> | ||
</h3> | ||
@@ -32,0 +32,0 @@ |
@@ -25,2 +25,3 @@ /* eslint-disable @typescript-eslint/no-var-requires */ | ||
open: true, | ||
port: 3000, | ||
contentBase: "test/manual" | ||
@@ -27,0 +28,0 @@ }), |
@@ -7,3 +7,3 @@ /* | ||
import AnchorPoint from "~/core/AnchorPoint"; | ||
import { find, findRight, getFlickingAttached } from "~/utils"; | ||
import { getFlickingAttached } from "~/utils"; | ||
@@ -78,3 +78,3 @@ /** | ||
position: range.min, | ||
panel: find(panels, panel => panel.includePosition(range.min))! | ||
panel: panels[reachablePanels[0].index - 1] | ||
})); | ||
@@ -87,3 +87,3 @@ } | ||
position: range.max, | ||
panel: findRight(panels, panel => panel.includePosition(range.max))! | ||
panel: panels[reachablePanels[reachablePanels.length - 1].index + 1] | ||
})); | ||
@@ -90,0 +90,0 @@ } |
@@ -139,2 +139,10 @@ /* | ||
/** | ||
* Return the camera's position progress from the first panel to last panel | ||
* Range is from 0 to last panel's index | ||
* @ko 첫번째 패널로부터 마지막 패널까지의 카메라 위치의 진행도를 반환합니다 | ||
* 범위는 0부터 마지막 패널의 인덱스까지입니다 | ||
* @type {number} | ||
* @readonly | ||
*/ | ||
public get progress() { | ||
@@ -308,2 +316,16 @@ const flicking = this._flicking; | ||
/** | ||
* Return the camera's position progress in the panel below | ||
* Value is from 0 to 1 when the camera's inside panel | ||
* Value can be lower than 0 or bigger than 1 when it's in the margin area | ||
* @ko 현재 카메라 아래 패널에서의 위치 진행도를 반환합니다 | ||
* 반환값은 카메라가 패널 내부에 있을 경우 0부터 1까지의 값을 갖습니다 | ||
* 패널의 margin 영역에 있을 경우 0보다 작거나 1보다 큰 값을 반환할 수 있습니다 | ||
*/ | ||
public getProgressInPanel(panel: Panel) { | ||
const panelRange = panel.range; | ||
return (this._position - panelRange.min) / (panelRange.max - panelRange.min); | ||
} | ||
/** | ||
* Return {@link AnchorPoint} that includes given position | ||
@@ -318,10 +340,11 @@ * If there's no {@link AnchorPoint} that includes the given position, return `null` instead | ||
const anchors = this._anchors; | ||
const anchorsIncludingPosition = anchors.filter(anchor => anchor.panel.includePosition(position, true)); | ||
for (const anchor of anchors) { | ||
if (anchor.panel.includePosition(position, true)) { | ||
return anchor; | ||
} | ||
} | ||
return anchorsIncludingPosition.reduce((nearest: AnchorPoint | null, anchor) => { | ||
if (!nearest) return anchor; | ||
return null; | ||
return Math.abs(nearest.position - position) < Math.abs(anchor.position - position) | ||
? nearest | ||
: anchor; | ||
}, null); | ||
} | ||
@@ -439,4 +462,4 @@ | ||
/** | ||
* Update position after resizing | ||
* @ko resize 이후에 position을 업데이트합니다 | ||
* Update Viewport's height to active panel's height | ||
* @ko 현재 선택된 패널의 높이와 동일하도록 뷰포트의 높이를 업데이트합니다 | ||
* @throws {FlickingError} | ||
@@ -448,30 +471,14 @@ * {@link Constants.ERROR_CODE NOT_ATTACHED_TO_FLICKING} When {@link Camera#init init} is not called before | ||
*/ | ||
public updatePosition(): this { | ||
public updateAdaptiveHeight() { | ||
const flicking = getFlickingAttached(this._flicking, "Camera"); | ||
const activePanel = flicking.control.activePanel; | ||
if (activePanel) { | ||
this.lookAt(activePanel.position); | ||
} | ||
if (!flicking.horizontal || !flicking.adaptive || !activePanel) return; | ||
return this; | ||
flicking.viewport.setSize({ | ||
height: activePanel.height | ||
}); | ||
} | ||
/** | ||
* | ||
*/ | ||
public updateAdaptiveHeight(): this { | ||
const flicking = getFlickingAttached(this._flicking, "Camera"); | ||
const anchorBelow = this.findAnchorIncludePosition(this._position); | ||
if (flicking.horizontal && flicking.adaptive && anchorBelow) { | ||
flicking.viewport.setSize({ | ||
height: anchorBelow.panel.height | ||
}); | ||
} | ||
return this; | ||
} | ||
/** | ||
* Reset the history of {@link Flicking#event:needPanel needPanel} events so it can be triggered again | ||
@@ -478,0 +485,0 @@ * @ko 발생한 {@link Flicking#event:needPanel needPanel} 이벤트들을 초기화하여 다시 발생할 수 있도록 합니다 |
@@ -286,2 +286,3 @@ /* | ||
this._position = pos; | ||
flicking.renderer.render(); | ||
@@ -288,0 +289,0 @@ |
@@ -28,2 +28,3 @@ /* | ||
* @property {number} NOT_INITIALIZED When the {@link Flicking#init} is not called before but is needed<ko>{@link Flicking#init}의 호출이 필요하나, 아직 호출되지 않았을 경우</ko> | ||
* @property {number} NO_ACTIVE When there're no active panel that flicking has selected. This may be due to the absence of any panels<ko>현재 Flicking이 선택한 패널이 없을 경우. 일반적으로 패널이 하나도 없는 경우에 발생할 수 있습니다</ko> | ||
*/ | ||
@@ -43,3 +44,4 @@ export const CODE = { | ||
NOT_ALLOWED_IN_FRAMEWORK: 11, | ||
NOT_INITIALIZED: 12 | ||
NOT_INITIALIZED: 12, | ||
NO_ACTIVE: 13 | ||
} as const; | ||
@@ -55,8 +57,9 @@ | ||
POSITION_NOT_REACHABLE: (position: number) => `Position "${position}" is not reachable.`, | ||
TRANSFORM_NOT_SUPPORTED: "Browser does not support CSS transform", | ||
STOP_CALLED_BY_USER: "Event stop() is called by user", | ||
ANIMATION_INTERRUPTED: "Animation is interrupted by user input", | ||
ANIMATION_ALREADY_PLAYING: "Animation is already playing", | ||
NOT_ALLOWED_IN_FRAMEWORK: "This behavior is not allowed in the frameworks like React, Vue, or Angular", | ||
NOT_INITIALIZED: "Flicking is not initialized yet, call init() first" | ||
TRANSFORM_NOT_SUPPORTED: "Browser does not support CSS transform.", | ||
STOP_CALLED_BY_USER: "Event stop() is called by user.", | ||
ANIMATION_INTERRUPTED: "Animation is interrupted by user input.", | ||
ANIMATION_ALREADY_PLAYING: "Animation is already playing.", | ||
NOT_ALLOWED_IN_FRAMEWORK: "This behavior is not allowed in the frameworks like React, Vue, or Angular.", | ||
NOT_INITIALIZED: "Flicking is not initialized yet, call init() first.", | ||
NO_ACTIVE: "There's no active panel that Flicking has selected. This may be due to the absence of any panels." | ||
} as const; |
@@ -43,7 +43,6 @@ /* | ||
/** | ||
* Currently active panel | ||
* An active panel | ||
* @ko 현재 선택된 패널 | ||
* @type {Panel} | ||
* @type {Panel | null} | ||
* @readonly | ||
* @see Panel | ||
*/ | ||
@@ -167,2 +166,24 @@ public get activePanel() { return this._activePanel; } | ||
/** | ||
* Update position after resizing | ||
* @ko resize 이후에 position을 업데이트합니다 | ||
* @param {number} progressInPanel Previous camera's progress in active panel before resize<ko>Resize 이전 현재 선택된 패널 내에서의 카메라 progress 값</ko> | ||
* @throws {FlickingError} | ||
* {@link Constants.ERROR_CODE NOT_ATTACHED_TO_FLICKING} When {@link Camera#init init} is not called before | ||
* <ko>{@link Constants.ERROR_CODE NOT_ATTACHED_TO_FLICKING} {@link Camera#init init}이 이전에 호출되지 않은 경우</ko> | ||
* @chainable | ||
* @return {this} | ||
*/ | ||
public updatePosition(_progressInPanel: number): this { // eslint-disable-line @typescript-eslint/no-unused-vars | ||
const flicking = getFlickingAttached(this._flicking, "Control"); | ||
const camera = flicking.camera; | ||
const activePanel = this._activePanel; | ||
if (activePanel) { | ||
camera.lookAt(camera.clampToReachablePosition(activePanel.position)); | ||
} | ||
return this; | ||
} | ||
/** | ||
* Update {@link Control#controller controller}'s state | ||
@@ -180,8 +201,8 @@ * @ko {@link Control#controller controller}의 내부 상태를 갱신합니다 | ||
/** | ||
* Reset {@link Control#activePanel activePanel} to `null` | ||
* @ko {@link Control#activePanel activePanel}을 `null`로 초기화합니다 | ||
* Reset {@link Control#activePanel activePanel} and {@link Control#activeAnchor activeAnchor} to `null` | ||
* @ko {@link Control#activePanel activePanel}와 {@link Control#activeAnchor activeAnchor}를 `null`로 초기화합니다 | ||
* @chainable | ||
* @return {this} | ||
*/ | ||
public resetActivePanel(): this { | ||
public resetActive(): this { | ||
this._activePanel = null; | ||
@@ -243,14 +264,12 @@ | ||
let position = panel.position; | ||
const nearestAnchor = camera.findNearestAnchor(position); | ||
if (panel.removed || !nearestAnchor) { | ||
return Promise.reject(new FlickingError(ERROR.MESSAGE.POSITION_NOT_REACHABLE(panel.position), ERROR.CODE.POSITION_NOT_REACHABLE)); | ||
} | ||
if (!camera.canReach(panel)) { | ||
const nearestAnchor = camera.findNearestAnchor(position); | ||
if (panel.removed || !nearestAnchor) { | ||
return Promise.reject(new FlickingError(ERROR.MESSAGE.POSITION_NOT_REACHABLE(panel.position), ERROR.CODE.POSITION_NOT_REACHABLE)); | ||
} | ||
// Override position & panel if that panel is not reachable | ||
position = nearestAnchor.position; | ||
panel = nearestAnchor.panel; | ||
} else if (camera.controlParams.circular) { | ||
} else if (flicking.circularEnabled) { | ||
// Circular mode is enabled, find nearest distance to panel | ||
@@ -316,12 +335,12 @@ const camPos = this._controller.position; // Actual position of the Axes | ||
if (duration === 0) { | ||
if (duration <= 0) { | ||
const animation = animate(); | ||
this._setActivePanel(newActivePanel, currentPanel, isTrusted); | ||
this._setActive(newActivePanel, currentPanel, isTrusted); | ||
return animation; | ||
} else { | ||
return animate().then(() => this._setActivePanel(newActivePanel, currentPanel, isTrusted)); | ||
return animate().then(() => this._setActive(newActivePanel, currentPanel, isTrusted)); | ||
} | ||
} | ||
protected _setActivePanel = (newActivePanel: Panel, prevActivePanel: Panel | null, isTrusted: boolean) => { | ||
protected _setActive = (newActivePanel: Panel, prevActivePanel: Panel | null, isTrusted: boolean) => { | ||
const flicking = getFlickingAttached(this._flicking, "Control"); | ||
@@ -331,2 +350,4 @@ | ||
flicking.camera.updateAdaptiveHeight(); | ||
if (newActivePanel !== prevActivePanel) { | ||
@@ -333,0 +354,0 @@ flicking.trigger(new ComponentEvent(EVENTS.CHANGED, { |
@@ -12,2 +12,6 @@ /* | ||
export interface FreeControlOptions { | ||
stopAtEdge: boolean; | ||
} | ||
/** | ||
@@ -18,3 +22,48 @@ * A {@link Control} that can be scrolled freely without alignment | ||
class FreeControl extends Control { | ||
private _stopAtEdge: FreeControlOptions["stopAtEdge"]; | ||
/** | ||
* Make scroll animation to stop at the start/end of the scroll area, not going out the bounce area | ||
* @ko 스크롤 애니메이션을 스크롤 영역의 시작과 끝부분에서 멈추도록 하여, 바운스 영역을 넘어가지 않도록 합니다 | ||
* @type {boolean} | ||
* @default true | ||
*/ | ||
public get stopAtEdge() { return this._stopAtEdge; } | ||
public set stopAtEdge(val: FreeControlOptions["stopAtEdge"]) { this._stopAtEdge = val; } | ||
public constructor({ | ||
stopAtEdge = true | ||
}: Partial<FreeControlOptions> = {}) { | ||
super(); | ||
this._stopAtEdge = stopAtEdge; | ||
} | ||
/** | ||
* Update position after resizing | ||
* @ko resize 이후에 position을 업데이트합니다 | ||
* @param {number} progressInPanel Previous camera's progress in active panel before resize<ko>Resize 이전 현재 선택된 패널 내에서의 카메라 progress 값</ko> | ||
* @throws {FlickingError} | ||
* {@link Constants.ERROR_CODE NOT_ATTACHED_TO_FLICKING} When {@link Camera#init init} is not called before | ||
* <ko>{@link Constants.ERROR_CODE NOT_ATTACHED_TO_FLICKING} {@link Camera#init init}이 이전에 호출되지 않은 경우</ko> | ||
* @chainable | ||
* @return {this} | ||
*/ | ||
public updatePosition(progressInPanel: number): this { | ||
const flicking = getFlickingAttached(this._flicking, "Control"); | ||
const camera = flicking.camera; | ||
const activePanel = this._activePanel; | ||
if (activePanel) { | ||
const panelRange = activePanel.range; | ||
const newPosition = panelRange.min + (panelRange.max - panelRange.min) * progressInPanel; | ||
camera.lookAt(camera.clampToReachablePosition(newPosition)); | ||
} | ||
return this; | ||
} | ||
/** | ||
* Move {@link Camera} to the given position | ||
@@ -74,3 +123,3 @@ * @ko {@link Camera}를 주어진 좌표로 이동합니다 | ||
return this._animateToPosition({ position, duration, newActivePanel: targetPanel, axesEvent }); | ||
return this._animateToPosition({ position: this._stopAtEdge ? targetPos : position, duration, newActivePanel: targetPanel, axesEvent }); | ||
} | ||
@@ -77,0 +126,0 @@ } |
@@ -62,4 +62,2 @@ /* | ||
console.log(anchorAtPosition); | ||
if (!anchorAtPosition || !activePanel) { | ||
@@ -89,3 +87,3 @@ return Promise.reject(new FlickingError(ERROR.MESSAGE.POSITION_NOT_REACHABLE(position), ERROR.CODE.POSITION_NOT_REACHABLE)); | ||
// Restore to active panel | ||
targetPos = activePanel.position; | ||
targetPos = camera.clampToReachablePosition(activePanel.position); | ||
targetPanel = activePanel; | ||
@@ -92,0 +90,0 @@ } |
@@ -76,8 +76,2 @@ /* | ||
const camera = flicking.camera; | ||
const anchorBelow = camera.findAnchorIncludePosition(camera.position); | ||
if (flicking.horizontal && flicking.adaptive && anchorBelow) { | ||
flicking.viewport.setSize({ height: anchorBelow.panel.height }); | ||
} | ||
transitTo(STATE_TYPE.IDLE); | ||
@@ -84,0 +78,0 @@ |
@@ -228,9 +228,10 @@ /* | ||
this._size = horizontal ? el.offsetWidth : el.offsetHeight; | ||
this._margin = horizontal | ||
? { | ||
prev: parseFloat(elStyle.marginLeft), | ||
next: parseFloat(elStyle.marginRight) | ||
prev: parseFloat(elStyle.marginLeft || "0"), | ||
next: parseFloat(elStyle.marginRight || "0") | ||
} : { | ||
prev: parseFloat(elStyle.marginTop), | ||
next: parseFloat(elStyle.marginBottom) | ||
prev: parseFloat(elStyle.marginTop || "0"), | ||
next: parseFloat(elStyle.marginBottom || "0") | ||
}; | ||
@@ -237,0 +238,0 @@ |
@@ -5,3 +5,3 @@ /* | ||
*/ | ||
import { getStyle, isString, parseCSSSizeValue } from "~/utils"; | ||
import { getStyle, isString } from "~/utils"; | ||
@@ -8,0 +8,0 @@ /** |
@@ -22,3 +22,3 @@ /* | ||
import { LiteralUnion, ValueOf } from "~/type/internal"; | ||
import { ElementLike, Plugin, Status } from "~/type/external"; | ||
import { ElementLike, Plugin, Status, MoveTypeOptions } from "~/type/external"; | ||
@@ -66,3 +66,3 @@ /** | ||
inputType: string[]; | ||
moveType: ValueOf<typeof MOVE_TYPE>; | ||
moveType: ValueOf<typeof MOVE_TYPE> | MoveTypeOptions<ValueOf<typeof MOVE_TYPE>>; | ||
threshold: number; | ||
@@ -73,2 +73,3 @@ interruptable: boolean; | ||
preventClickOnDrag: boolean; | ||
disableOnInit: boolean; | ||
// PERFORMANCE | ||
@@ -124,2 +125,3 @@ renderOnlyVisible: boolean; | ||
private _preventClickOnDrag: FlickingOptions["preventClickOnDrag"]; | ||
private _disableOnInit: FlickingOptions["disableOnInit"]; | ||
private _renderOnlyVisible: FlickingOptions["renderOnlyVisible"]; | ||
@@ -361,4 +363,4 @@ private _autoResize: FlickingOptions["autoResize"]; | ||
* @ko 디폴트 애니메이션 재생 시간 (ms) | ||
* @type {number} | ||
* @default 500 | ||
* @type number | ||
*/ | ||
@@ -370,3 +372,3 @@ public get duration() { return this._duration; } | ||
* @ko 활성화할 입력 장치 종류 | ||
* @type string[] | ||
* @type {string[]} | ||
* @default ["touch", "mouse"] | ||
@@ -379,7 +381,15 @@ * @see {@link https://naver.github.io/egjs-axes/release/latest/doc/global.html#PanInputOption Possible values (PanInputOption#inputType)} | ||
* Movement style by user input. This will change instance type of {@link Flicking#control} | ||
* You can use the values of the constant {@link MOVE_TYPE} | ||
* @ko 사용자 입력에 의한 이동 방식. 이 값에 따라 {@link Flicking#control}의 인스턴스 타입이 결정됩니다 | ||
* @type string | ||
* 상수 {@link MOVE_TYPE}에 정의된 값들을 이용할 수 있습니다 | ||
* @type {string | [string] | [string, object]} | ||
* @default "snap" | ||
* @see {@link Constants.MOVE_TYPE} | ||
* @see {@link MOVE_TYPE} | ||
* @see {@link FreeControlOptions} | ||
* @example | ||
* |moveType|control| | ||
* |:---:|:---:| | ||
* |"snap"|{@link SnapControl}| | ||
* |"freeScroll"|{@link FreeControl}| | ||
* | ||
* ```ts | ||
@@ -389,5 +399,14 @@ * import Flicking, { MOVE_TYPE } from "@egjs/flicking"; | ||
* const flicking = new Flicking({ | ||
* moveType: MOVE_TYPE.FREE_SCROLL | ||
* moveType: MOVE_TYPE.SNAP | ||
* }); | ||
* ``` | ||
* | ||
* ```ts | ||
* const flicking = new Flicking({ | ||
* // If you want more specific settings for the moveType | ||
* // [moveType, options for that moveType] | ||
* // In this case, it's ["freeScroll", FreeControlOptions] | ||
* moveType: [MOVE_TYPE.FREE_SCROLL, { stopAtEdge: true }] | ||
* }); | ||
* ``` | ||
*/ | ||
@@ -455,2 +474,9 @@ public get moveType() { return this._moveType; } | ||
public get preventClickOnDrag() { return this._preventClickOnDrag; } | ||
/** | ||
* Automatically call {@link Flicking#disableInput disableInput()} on initialization | ||
* @ko Flicking init시에 {@link Flicking#disableInput disableInput()}을 바로 호출합니다 | ||
* @type {boolean} | ||
* @default false | ||
*/ | ||
public get disableOnInit() { return this._disableOnInit; } | ||
// PERFORMANCE | ||
@@ -530,2 +556,3 @@ /** | ||
public set preventClickOnDrag(val: FlickingOptions["preventClickOnDrag"]) { this._preventClickOnDrag = val; } | ||
public set disableOnInit(val: FlickingOptions["disableOnInit"]) { this._disableOnInit = val; } | ||
// PERFORMANCE | ||
@@ -583,2 +610,3 @@ public set renderOnlyVisible(val: FlickingOptions["renderOnlyVisible"]) { this._renderOnlyVisible = val; } | ||
preventClickOnDrag = true, | ||
disableOnInit = false, | ||
renderOnlyVisible = false, | ||
@@ -614,2 +642,3 @@ autoInit = true, | ||
this._preventClickOnDrag = preventClickOnDrag; | ||
this._disableOnInit = disableOnInit; | ||
this._renderOnlyVisible = renderOnlyVisible; | ||
@@ -663,2 +692,5 @@ this._autoResize = autoResize; | ||
} | ||
if (this._disableOnInit) { | ||
this.disableInput(); | ||
} | ||
@@ -884,2 +916,3 @@ this._plugins.forEach(plugin => plugin.init(this)); | ||
}> = {}): Status { | ||
const camera = this._camera; | ||
const panels = visiblePanelsOnly ? this.visiblePanels : this.panels; | ||
@@ -903,3 +936,11 @@ | ||
if (position) { | ||
status.position = this._camera.position; | ||
const nearestAnchor = camera.findNearestAnchor(camera.position); | ||
if (nearestAnchor) { | ||
status.position = { | ||
panel: nearestAnchor.panel.index, | ||
progressInPanel: camera.getProgressInPanel(nearestAnchor.panel) | ||
}; | ||
} | ||
} | ||
@@ -910,8 +951,3 @@ | ||
status.visibleOffset = { | ||
index: visiblePanels[0]?.index ?? 0, | ||
position: visiblePanels[0] | ||
? (visiblePanels[0].range.min - visiblePanels[0].margin.prev) | ||
: 0 | ||
}; | ||
status.visibleOffset = visiblePanels[0]?.index ?? 0; | ||
} | ||
@@ -951,3 +987,3 @@ | ||
const panelIndex = visibleOffset | ||
? index - visibleOffset.index | ||
? index - visibleOffset | ||
: index; | ||
@@ -959,7 +995,10 @@ | ||
if (position && this._moveType === MOVE_TYPE.FREE_SCROLL) { | ||
const cameraPosition = visibleOffset | ||
? position - visibleOffset.position | ||
: position; | ||
const { panel, progressInPanel } = position; | ||
const panelIndex = visibleOffset | ||
? panel - visibleOffset | ||
: panel; | ||
const panelRange = renderer.panels[panelIndex].range; | ||
const newCameraPos = panelRange.min + (panelRange.max - panelRange.min) * progressInPanel; | ||
void control.moveToPosition(cameraPosition, 0).catch(() => void 0); | ||
void control.moveToPosition(newCameraPos, 0).catch(() => void 0); | ||
} | ||
@@ -1019,4 +1058,8 @@ } | ||
const activePanel = control.activePanel; | ||
const prevWidth = viewport.width; | ||
const prevHeight = viewport.height; | ||
const prevProgressInPanel = activePanel | ||
? camera.getProgressInPanel(activePanel) | ||
: 0; | ||
@@ -1030,10 +1073,17 @@ this.trigger(new ComponentEvent(EVENTS.BEFORE_RESIZE, { | ||
viewport.resize(); | ||
renderer.elementManipulator.insertPanelElements(renderer.panels, null); | ||
renderer.updatePanelSize(); | ||
renderer.elementManipulator.resetPanelElementOrder(renderer.panels); | ||
renderer.render(); | ||
camera.updateAlignPos(); | ||
camera.updateRange(); | ||
camera.updateAnchors(); | ||
control.updateInput(); | ||
camera.updatePosition(); | ||
if (control.animating) { | ||
// TODO: | ||
} else { | ||
control.updatePosition(prevProgressInPanel); | ||
control.updateInput(); | ||
} | ||
const newWidth = viewport.width; | ||
@@ -1040,0 +1090,0 @@ const newHeight = viewport.height; |
@@ -109,2 +109,3 @@ /* | ||
this._collectPanels(); | ||
return this; | ||
@@ -236,3 +237,3 @@ } | ||
if (includes(panelsRemoved, activePanel)) { | ||
control.resetActivePanel(); | ||
control.resetActive(); | ||
} | ||
@@ -239,0 +240,0 @@ |
@@ -7,3 +7,3 @@ /* | ||
import Panel from "~/core/Panel"; | ||
import { findIndex, getFlickingAttached } from "~/utils"; | ||
import { getFlickingAttached, includes } from "~/utils"; | ||
@@ -34,15 +34,23 @@ /** | ||
const panelsSortedByActualPosition = [...panels] | ||
.sort((a, b) => (a.position + a.offset) - (b.position + b.offset)); | ||
if (flicking.holding) { | ||
// Do not remove previous visible panel elements | ||
// As that can stop the touch events on mobile devices | ||
const wasVisiblePanels = [...panels] | ||
.filter(panel => panel.element.parentElement === cameraElement && !includes(visiblePanels, panel)); | ||
visiblePanels.push(...wasVisiblePanels); | ||
} | ||
const visibleSortedByActualPosition = [...visiblePanels] | ||
.sort((a, b) => (a.position + a.offset) - (b.position + b.offset)); | ||
// Remove remaining(removed) elements | ||
elementManipulator.removeAllChildNodes(cameraElement); | ||
if (!flicking.holding) { | ||
// Remove remaining(removed) elements | ||
elementManipulator.removeAllChildNodes(cameraElement); | ||
} | ||
elementManipulator.insertPanelElements(visibleSortedByActualPosition, null); | ||
const firstVisibleIdx = findIndex(panelsSortedByActualPosition, panel => panel.index === visibleSortedByActualPosition[0].index); | ||
const invisiblePrevPanels = panels | ||
.filter(panel => !includes(visiblePanels, panel)) | ||
.filter(panel => panel.range.max + panel.offset < camera.visibleRange.min); | ||
const invisiblePrevPanels = panelsSortedByActualPosition.slice(0, firstVisibleIdx); | ||
const invisibleSize = this._calcPanelRangeSize(invisiblePrevPanels); | ||
@@ -49,0 +57,0 @@ |
import Flicking from "~/Flicking"; | ||
import { MOVE_TYPE } from "~/const/external"; | ||
import { ValueOf } from "~/type/internal"; | ||
import { FreeControlOptions } from "~/control/FreeControl"; | ||
@@ -28,14 +31,18 @@ /** | ||
* @property {number} index An index of the active panel<ko>활성화된 패널의 인덱스</ko> | ||
* @property {number} position A camera {@link Camera#position position}<ko>카메라 {@link Camera#position position}</ko> | ||
* @property {object} visibleOffset An offset to visible panel's original index and position. This value is available only when `visiblePanelsOnly` is `true` | ||
* <ko>현재 보이는 패널들을 저장했을 때, 원래의 인덱스와 위치 좌표 대비 offset. `visiblePanelsOnly` 옵션을 사용했을 때만 사용 가능합니다</ko> | ||
* @property {string[]} panels An `outerHTML` array of panel elements<ko>패널의 `outerHTML` 배열</ko> | ||
* @property {object} position A info to restore camera {@link Camera#position position}<ko>카메라 {@link Camera#position position}을 설정하기 위한 정보들</ko> | ||
* @property {number} [position.panel] An index of the panel camera is located at<ko>카메라가 위치한 패널의 인덱스</ko> | ||
* @property {number} [position.progressInPanel] A progress of the camera position inside the panel<ko>패널 내에서의 카메라 위치의 진행도</ko> | ||
* @property {number} visibleOffset An offset to visible panel's original index. This value is available only when `visiblePanelsOnly` is `true` | ||
* <ko>현재 보이는 패널들을 저장했을 때, 원래의 인덱스 대비 offset. `visiblePanelsOnly` 옵션을 사용했을 때만 사용 가능합니다</ko> | ||
* @property {object[]} panels A data array of panels<ko>패널의 정보를 담은 배열</ko> | ||
* @property {index} [panels.index] An index of the panel<ko>패널의 인덱스</ko> | ||
* @property {string | undefined} [panels.html] An `outerHTML` of the panel element<ko>패널 엘리먼트의 `outerHTML`</ko> | ||
*/ | ||
export interface Status { | ||
index?: number; | ||
position?: number; | ||
visibleOffset?: { | ||
index: number; | ||
position: number; | ||
position?: { | ||
panel: number; | ||
progressInPanel: number; | ||
}; | ||
visibleOffset?: number; | ||
panels: Array<{ | ||
@@ -46,1 +53,7 @@ index: number; | ||
} | ||
/* eslint-disable @typescript-eslint/indent */ | ||
export type MoveTypeOptions<T extends ValueOf<typeof MOVE_TYPE>> = | ||
T extends typeof MOVE_TYPE.FREE_SCROLL ? [T] | [T, Partial<FreeControlOptions>] : | ||
[T]; | ||
/* eslint-enable */ |
25
TODO.md
native | ||
- 시작부터 disableInput 옵션 추가 | ||
???? - 도중 인터럽트시에는 willChange 호출 안됨 | ||
- 시작부터 disableInput 옵션 추가 => 해결 | ||
- bound - 마지막 인덱스가 0?? => 해결 | ||
- viewport 좌/우 padding 적용시 bound 이상함 => 해결 | ||
- adaptive도 적용됨 | ||
- bound - 양방향 애니메이션 => 해결 | ||
- bound 상태에서 resize시에 위치 이상 => 해결 | ||
- control - activeAnchor 추가 => 해결 | ||
- freeScroll - 카메라 포지션 비율 단위 유지 => 해결 | ||
- get/setStatus의 경우도 마찬가지 => 해결 | ||
- 인풋 끝나는 시점에 render => 해결 | ||
- freeScroll - boundAtEdge 옵션 추가 => 해결 | ||
- 애니메이션 도중에 패널 추가될 경우(offset) | ||
- freeScroll - 바운드 영역 밖으로 나갈시 에러 => ??? | ||
- 도중 인터럽트시에는 willChange 호출 안됨 => ???? | ||
- bound + adaptive 사용시에, AnchorPoint에 엮인 패널들의 높이가 다를 경우... | ||
- freeScroll - 카메라 포지션 비율 단위 유지 | ||
- get/setStatus의 경우도 마찬가지 | ||
- bound - prev방향 애니메이션 | ||
- bound 상태에서 resize시에 위치 이상 | ||
- freeScroll - 바운드 영역 밖으로 나갈시 에러 | ||
frameworks | ||
- 로드시 onReady 호출 | ||
- export all from native | ||
- circular: 엘리먼트 순서 안바뀌는 버그 | ||
- 로드시 onReady 호출 => 해결 | ||
- export all from native => 해결 | ||
react | ||
- renderOnlyVisible + resize시에 패널이 전부 사라짐 | ||
- 아마도 margin NaN 때문 |
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
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
2885057
29480
99
115