text:
(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@egjs/hammerjs'), require('@egjs/component')) :
    typeof define === 'function' && define.amd ? define(['@egjs/hammerjs', '@egjs/component'], factory) :
    (global.eg = global.eg || {}, global.eg.Axes = factory(global.Hammer,global.eg.Component));
}(this, (function (hammerjs,Component) { 'use strict';

    /*! *****************************************************************************
    Copyright (c) Microsoft Corporation. All rights reserved.
    Licensed under the Apache License, Version 2.0 (the "License"); you may not use
    this file except in compliance with the License. You may obtain a copy of the
    License at http://www.apache.org/licenses/LICENSE-2.0

    THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
    WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
    MERCHANTABLITY OR NON-INFRINGEMENT.

    See the Apache Version 2.0 License for specific language governing permissions
    and limitations under the License.
    ***************************************************************************** */
    /* global Reflect, Promise */

    var extendStatics = Object.setPrototypeOf ||
    { __proto__: [] } instanceof Array && function (d, b) {d.__proto__ = b;} ||
    function (d, b) {for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];};

    function __extends(d, b) {
      extendStatics(d, b);
      function __() {this.constructor = d;}
      d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    }

    var __assign = Object.assign || function __assign(t) {
      for (var s, i = 1, n = arguments.length; i < n; i++) {
        s = arguments[i];
        for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
      }
      return t;
    };

    function getInsidePosition(destPos, range, circular, bounce) {
      var toDestPos = destPos;
      var targetRange = [
      circular[0] ? range[0] : bounce ? range[0] - bounce[0] : range[0],
      circular[1] ? range[1] : bounce ? range[1] + bounce[1] : range[1]];

      toDestPos = Math.max(targetRange[0], toDestPos);
      toDestPos = Math.min(targetRange[1], toDestPos);
      return toDestPos;
    }
    // determine outside
    function isOutside(pos, range) {
      return pos < range[0] || pos > range[1];
    }
    function getDuration(distance, deceleration) {
      var duration = Math.sqrt(distance / deceleration * 2);
      // when duration is under 100, then value is zero
      return duration < 100 ? 0 : duration;
    }
    function isCircularable(destPos, range, circular) {
      return circular[1] && destPos > range[1] ||
      circular[0] && destPos < range[0];
    }
    function getCirculatedPos(pos, range, circular) {
      var toPos = pos;
      var min = range[0];
      var max = range[1];
      var length = max - min;
      if (circular[1] && pos > max) {// right
        toPos = (toPos - max) % length + min;
      }
      if (circular[0] && pos < min) {// left
        toPos = (toPos - min) % length + max;
      }
      return toPos;
    }

    /* eslint-disable no-new-func, no-nested-ternary */
    var win;
    if (typeof window === "undefined") {
      // window is undefined in node.js
      win = {};
    } else
    {
      win = window;
    }

    function toArray(nodes) {
      // const el = Array.prototype.slice.call(nodes);
      // for IE8
      var el = [];
      for (var i = 0, len = nodes.length; i < len; i++) {
        el.push(nodes[i]);
      }
      return el;
    }
    function $(param, multi) {
      if (multi === void 0) {multi = false;}
      var el;
      if (typeof param === "string") {// String (HTML, Selector)
        // check if string is HTML tag format
        var match = param.match(/^<([a-z]+)\s*([^>]*)>/);
        // creating element
        if (match) {// HTML
          var dummy = document.createElement("div");
          dummy.innerHTML = param;
          el = toArray(dummy.childNodes);
        } else
        {// Selector
          el = toArray(document.querySelectorAll(param));
        }
        if (!multi) {
          el = el.length >= 1 ? el[0] : undefined;
        }
      } else
      if (param === win) {// window
        el = param;
      } else
      if (param.nodeName && (
      param.nodeType === 1 || param.nodeType === 9)) {// HTMLElement, Document
        el = param;
      } else
      if ("jQuery" in win && param instanceof jQuery ||
      param.constructor.prototype.jquery) {// jQuery
        el = multi ? param.toArray() : param.get(0);
      } else
      if (Array.isArray(param)) {
        el = param.map(function (v) {return $(v);});
        if (!multi) {
          el = el.length >= 1 ? el[0] : undefined;
        }
      }
      return el;
    }
    var raf = win.requestAnimationFrame || win.webkitRequestAnimationFrame;
    var caf = win.cancelAnimationFrame || win.webkitCancelAnimationFrame;
    if (raf && !caf) {
      var keyInfo_1 = {};
      var oldraf_1 = raf;
      raf = function (callback) {
        function wrapCallback(timestamp) {
          if (keyInfo_1[key]) {
            callback(timestamp);
          }
        }
        var key = oldraf_1(wrapCallback);
        keyInfo_1[key] = true;
        return key;
      };
      caf = function (key) {
        delete keyInfo_1[key];
      };
    } else
    if (!(raf && caf)) {
      raf = function (callback) {
        return win.setTimeout(function () {
          callback(win.performance && win.performance.now && win.performance.now() || new Date().getTime());
        }, 16);
      };
      caf = win.clearTimeout;
    }
    /**
       * A polyfill for the window.requestAnimationFrame() method.
       * @see  https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame
       * @private
       */
    function requestAnimationFrame(fp) {
      return raf(fp);
    }
    /**
      * A polyfill for the window.cancelAnimationFrame() method. It cancels an animation executed through a call to the requestAnimationFrame() method.
      * @param {Number} key −	The ID value returned through a call to the requestAnimationFrame() method. <ko>requestAnimationFrame() 메서드가 반환한 아이디 값</ko>
      * @see  https://developer.mozilla.org/en-US/docs/Web/API/Window/cancelAnimationFrame
      * @private
      */
    function cancelAnimationFrame(key) {
      caf(key);
    }
    function map(obj, callback) {
      var tranformed = {};
      for (var k in obj) {
        k && (tranformed[k] = callback(obj[k], k));
      }
      return tranformed;
    }
    function filter(obj, callback) {
      var filtered = {};
      for (var k in obj) {
        k && callback(obj[k], k) && (filtered[k] = obj[k]);
      }
      return filtered;
    }
    function every(obj, callback) {
      for (var k in obj) {
        if (k && !callback(obj[k], k)) {
          return false;
        }
      }
      return true;
    }
    function equal(target, base) {
      return every(target, function (v, k) {return v === base[k];});
    }
    var roundNumFunc = {};
    function roundNumber(num, roundUnit) {
      // Cache for performance
      if (!roundNumFunc[roundUnit]) {
        roundNumFunc[roundUnit] = getRoundFunc(roundUnit);
      }
      return roundNumFunc[roundUnit](num);
    }
    function roundNumbers(num, roundUnit) {
      if (!num || !roundUnit) {
        return num;
      }
      var isNumber = typeof roundUnit === "number";
      return map(num, function (value, key) {return roundNumber(value, isNumber ? roundUnit : roundUnit[key]);});
    }
    function getDecimalPlace(val) {
      if (!isFinite(val)) {
        return 0;
      }
      var v = val + "";
      if (v.indexOf("e") >= 0) {
        // Exponential Format
        // 1e-10, 1e-12
        var p = 0;
        var e = 1;
        while (Math.round(val * e) / e !== val) {
          e *= 10;
          p++;
        }
        return p;
      }
      // In general, following has performance benefit.
      // https://jsperf.com/precision-calculation
      return v.indexOf(".") >= 0 ? v.length - v.indexOf(".") - 1 : 0;
    }
    function inversePow(n) {
      // replace Math.pow(10, -n) to solve floating point issue.
      // eg. Math.pow(10, -4) => 0.00009999999999999999
      return 1 / Math.pow(10, n);
    }
    function getRoundFunc(v) {
      var p = v < 1 ? Math.pow(10, getDecimalPlace(v)) : 1;
      return function (n) {
        if (v === 0) {
          return 0;
        }
        return Math.round(Math.round(n / v) * v * p) / p;
      };
    }

    function minMax(value, min, max) {
      return Math.max(Math.min(value, max), min);
    }
    var AnimationManager = /*#__PURE__*/function () {
      function AnimationManager(_a) {
        var options = _a.options,itm = _a.itm,em = _a.em,axm = _a.axm;
        this.options = options;
        this.itm = itm;
        this.em = em;
        this.axm = axm;
        this.animationEnd = this.animationEnd.bind(this);
      }var __proto = AnimationManager.prototype;
      __proto.getDuration = function (depaPos, destPos, wishDuration) {
        var _this = this;
        var duration;
        if (typeof wishDuration !== "undefined") {
          duration = wishDuration;
        } else
        {
          var durations_1 = map(destPos, function (v, k) {return getDuration(Math.abs(v - depaPos[k]), _this.options.deceleration);});
          duration = Object.keys(durations_1).reduce(function (max, v) {return Math.max(max, durations_1[v]);}, -Infinity);
        }
        return minMax(duration, this.options.minimumDuration, this.options.maximumDuration);
      };
      __proto.createAnimationParam = function (pos, duration, option) {
        var depaPos = this.axm.get();
        var destPos = pos;
        var inputEvent = option && option.event || null;
        return {
          depaPos: depaPos,
          destPos: destPos,
          duration: minMax(duration, this.options.minimumDuration, this.options.maximumDuration),
          delta: this.axm.getDelta(depaPos, destPos),
          inputEvent: inputEvent,
          input: option && option.input || null,
          isTrusted: !!inputEvent,
          done: this.animationEnd };

      };
      __proto.grab = function (axes, option) {
        if (this._animateParam && axes.length) {
          var orgPos_1 = this.axm.get(axes);
          var pos = this.axm.map(orgPos_1, function (v, opt) {return getCirculatedPos(v, opt.range, opt.circular);});
          if (!every(pos, function (v, k) {return orgPos_1[k] === v;})) {
            this.em.triggerChange(pos, false, orgPos_1, option, !!option);
          }
          this._animateParam = null;
          this._raf && cancelAnimationFrame(this._raf);
          this._raf = null;
          this.em.triggerAnimationEnd(!!(option && option.event));
        }
      };
      __proto.getEventInfo = function () {
        if (this._animateParam && this._animateParam.input && this._animateParam.inputEvent) {
          return {
            input: this._animateParam.input,
            event: this._animateParam.inputEvent };

        } else
        {
          return null;
        }
      };
      __proto.restore = function (option) {
        var pos = this.axm.get();
        var destPos = this.axm.map(pos, function (v, opt) {return Math.min(opt.range[1], Math.max(opt.range[0], v));});
        this.animateTo(destPos, this.getDuration(pos, destPos), option);
      };
      __proto.animationEnd = function () {
        var beforeParam = this.getEventInfo();
        this._animateParam = null;
        // for Circular
        var circularTargets = this.axm.filter(this.axm.get(), function (v, opt) {return isCircularable(v, opt.range, opt.circular);});
        Object.keys(circularTargets).length > 0 && this.setTo(this.axm.map(circularTargets, function (v, opt) {return getCirculatedPos(v, opt.range, opt.circular);}));
        this.itm.setInterrupt(false);
        this.em.triggerAnimationEnd(!!beforeParam);
        if (this.axm.isOutside()) {
          this.restore(beforeParam);
        } else
        {
          this.finish(!!beforeParam);
        }
      };
      __proto.finish = function (isTrusted) {
        this._animateParam = null;
        this.itm.setInterrupt(false);
        this.em.triggerFinish(isTrusted);
      };
      __proto.animateLoop = function (param, complete) {
        if (param.duration) {
          this._animateParam = __assign({}, param);
          var info_1 = this._animateParam;
          var self_1 = this;
          var destPos_1 = info_1.destPos;
          var prevPos_1 = info_1.depaPos;
          var prevEasingPer_1 = 0;
          var directions_1 = map(prevPos_1, function (value, key) {
            return value <= destPos_1[key] ? 1 : -1;
          });
          var originalIntendedPos_1 = map(destPos_1, function (v) {return v;});
          var prevTime_1 = new Date().getTime();
          info_1.startTime = prevTime_1;
          (function loop() {
            self_1._raf = null;
            var currentTime = new Date().getTime();
            var ratio = (currentTime - info_1.startTime) / param.duration;
            var easingPer = self_1.easing(ratio);
            var toPos = self_1.axm.map(prevPos_1, function (pos, options, key) {
              var nextPos = ratio >= 1 ?
              destPos_1[key] :
              pos + info_1.delta[key] * (easingPer - prevEasingPer_1);
              // Subtract distance from distance already moved.
              // Recalculate the remaining distance.
              // Fix the bouncing phenomenon by changing the range.
              var circulatedPos = getCirculatedPos(nextPos, options.range, options.circular);
              if (nextPos !== circulatedPos) {
                // circular
                var rangeOffset = directions_1[key] * (options.range[1] - options.range[0]);
                destPos_1[key] -= rangeOffset;
                prevPos_1[key] -= rangeOffset;
              }
              return circulatedPos;
            });
            var isCanceled = !self_1.em.triggerChange(toPos, false, prevPos_1);
            prevPos_1 = toPos;
            prevTime_1 = currentTime;
            prevEasingPer_1 = easingPer;
            if (easingPer >= 1) {
              destPos_1 = self_1.getFinalPos(destPos_1, originalIntendedPos_1);
              if (!equal(destPos_1, self_1.axm.get(Object.keys(destPos_1)))) {
                self_1.em.triggerChange(destPos_1, true, prevPos_1);
              }
              complete();
              return;
            } else
            if (isCanceled) {
              self_1.finish(false);
            } else
            {
              // animationEnd
              self_1._raf = requestAnimationFrame(loop);
            }
          })();
        } else
        {
          this.em.triggerChange(param.destPos, true);
          complete();
        }
      };
      /**
          * Get estimated final value.
          *
          * If destPos is within the 'error range' of the original intended position, the initial intended position is returned.
          *   - eg. original intended pos: 100, destPos: 100.0000000004 ==> return 100;
          * If dest Pos is outside the 'range of error' compared to the originally intended pos, it is returned rounded based on the originally intended pos.
          *   - eg. original intended pos: 100.123 destPos: 50.12345 => return 50.123
          *
          * @param originalIntendedPos
          * @param destPos
          */
      __proto.getFinalPos = function (destPos, originalIntendedPos) {
        var _this = this;
        // compare destPos and originalIntendedPos
        var ERROR_LIMIT = 0.000001;
        var finalPos = map(destPos, function (value, key) {
          if (value >= originalIntendedPos[key] - ERROR_LIMIT && value <= originalIntendedPos[key] + ERROR_LIMIT) {
            // In error range, return original intended
            return originalIntendedPos[key];
          } else
          {
            // Out of error range, return rounded pos.
            var roundUnit = _this.getRoundUnit(value, key);
            var result = roundNumber(value, roundUnit);
            return result;
          }
        });
        return finalPos;
      };
      __proto.getRoundUnit = function (val, key) {
        var roundUnit = this.options.round; // manual mode
        var minRoundUnit = null; // auto mode
        // auto mode
        if (!roundUnit) {
          // Get minimum round unit
          var options = this.axm.getAxisOptions(key);
          minRoundUnit = inversePow(Math.max(getDecimalPlace(options.range[0]), getDecimalPlace(options.range[1]), getDecimalPlace(val)));
        }
        return minRoundUnit || roundUnit;
      };
      __proto.getUserControll = function (param) {
        var userWish = param.setTo();
        userWish.destPos = this.axm.get(userWish.destPos);
        userWish.duration = minMax(userWish.duration, this.options.minimumDuration, this.options.maximumDuration);
        return userWish;
      };
      __proto.animateTo = function (destPos, duration, option) {
        var _this = this;
        var param = this.createAnimationParam(destPos, duration, option);
        var depaPos = __assign({}, param.depaPos);
        var retTrigger = this.em.triggerAnimationStart(param);
        // to control
        var userWish = this.getUserControll(param);
        // You can't stop the 'animationStart' event when 'circular' is true.
        if (!retTrigger && this.axm.every(userWish.destPos, function (v, opt) {return isCircularable(v, opt.range, opt.circular);})) {
          console.warn("You can't stop the 'animation' event when 'circular' is true.");
        }
        if (retTrigger && !equal(userWish.destPos, depaPos)) {
          var inputEvent = option && option.event || null;
          this.animateLoop({
            depaPos: depaPos,
            destPos: userWish.destPos,
            duration: userWish.duration,
            delta: this.axm.getDelta(depaPos, userWish.destPos),
            isTrusted: !!inputEvent,
            inputEvent: inputEvent,
            input: option && option.input || null },
          function () {return _this.animationEnd();});
        }
      };
      __proto.easing = function (p) {
        return p > 1 ? 1 : this.options.easing(p);
      };
      __proto.setTo = function (pos, duration) {
        if (duration === void 0) {duration = 0;}
        var axes = Object.keys(pos);
        this.grab(axes);
        var orgPos = this.axm.get(axes);
        if (equal(pos, orgPos)) {
          return this;
        }
        this.itm.setInterrupt(true);
        var movedPos = filter(pos, function (v, k) {return orgPos[k] !== v;});
        if (!Object.keys(movedPos).length) {
          return this;
        }
        movedPos = this.axm.map(movedPos, function (v, opt) {
          var range = opt.range,circular = opt.circular;
          if (circular && (circular[0] || circular[1])) {
            return v;
          } else
          {
            return getInsidePosition(v, range, circular);
          }
        });
        if (equal(movedPos, orgPos)) {
          return this;
        }
        if (duration > 0) {
          this.animateTo(movedPos, duration);
        } else
        {
          this.em.triggerChange(movedPos);
          this.finish(false);
        }
        return this;
      };
      __proto.setBy = function (pos, duration) {
        if (duration === void 0) {duration = 0;}
        return this.setTo(map(this.axm.get(Object.keys(pos)), function (v, k) {return v + pos[k];}), duration);
      };
      return AnimationManager;
    }();

    var EventManager = /*#__PURE__*/function () {
      function EventManager(axes) {
        this.axes = axes;
      }
      /**
         * This event is fired when a user holds an element on the screen of the device.
         * @ko 사용자가 기기의 화면에 손을 대고 있을 때 발생하는 이벤트
         * @name eg.Axes#hold
         * @event
         * @type {object} The object of data to be sent when the event is fired<ko>이벤트가 발생할 때 전달되는 데이터 객체</ko>
         * @property {Object.<string, number>} pos coordinate <ko>좌표 정보</ko>
         * @property {Object} input The instance of inputType where the event occurred<ko>이벤트가 발생한 inputType 인스턴스</ko>
         * @property {Object} inputEvent The event object received from inputType <ko>inputType으로 부터 받은 이벤트 객체</ko>
         * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call <ko>사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.</ko>
         *
         * @example
         * const axes = new eg.Axes({
         *   "x": {
         *      range: [0, 100]
         *   },
         *   "zoom": {
         *      range: [50, 30]
         *   }
         * }).on("hold", function(event) {
         *   // event.pos
         *   // event.input
         *   // event.inputEvent
         *   // isTrusted
         * });
         */var __proto = EventManager.prototype;
      __proto.triggerHold = function (pos, option) {
        var roundPos = this.getRoundPos(pos).roundPos;
        this.axes.trigger("hold", {
          pos: roundPos,
          input: option.input || null,
          inputEvent: option.event || null,
          isTrusted: true });

      };
      /**
          * Specifies the coordinates to move after the 'change' event. It works when the holding value of the change event is true.
          * @ko 'change' 이벤트 이후 이동할 좌표를 지정한다. change이벤트의 holding 값이 true일 경우에 동작한다
          * @name set
         * @function
          * @param {Object.<string, number>} pos The coordinate to move to <ko>이동할 좌표</ko>
          * @example
          * const axes = new eg.Axes({
          *   "x": {
          *      range: [0, 100]
          *   },
          *   "zoom": {
          *      range: [50, 30]
          *   }
          * }).on("change", function(event) {
          *   event.holding && event.set({x: 10});
          * });
          */
      /** Specifies the animation coordinates to move after the 'release' or 'animationStart' events.
              * @ko 'release' 또는 'animationStart' 이벤트 이후 이동할 좌표를 지정한다.
              * @name setTo
             * @function
              * @param {Object.<string, number>} pos The coordinate to move to <ko>이동할 좌표</ko>
              * @param {Number} [duration] Duration of the animation (unit: ms) <ko>애니메이션 진행 시간(단위: ms)</ko>
              * @example
              * const axes = new eg.Axes({
              *   "x": {
              *      range: [0, 100]
              *   },
              *   "zoom": {
              *      range: [50, 30]
              *   }
              * }).on("animationStart", function(event) {
              *   event.setTo({x: 10}, 2000);
              * });
              */
      /**
                  * This event is fired when a user release an element on the screen of the device.
                  * @ko 사용자가 기기의 화면에서 손을 뗐을 때 발생하는 이벤트
                  * @name eg.Axes#release
                  * @event
                  * @type {object} The object of data to be sent when the event is fired<ko>이벤트가 발생할 때 전달되는 데이터 객체</ko>
                  * @property {Object.<string, number>} depaPos The coordinates when releasing an element<ko>손을 뗐을 때의 좌표 </ko>
                  * @property {Object.<string, number>} destPos The coordinates to move to after releasing an element<ko>손을 뗀 뒤에 이동할 좌표</ko>
                  * @property {Object.<string, number>} delta  The movement variation of coordinate <ko>좌표의 변화량</ko>
                  * @property {Object} inputEvent The event object received from inputType <ko>inputType으로 부터 받은 이벤트 객체</ko>
                  * @property {Object} input The instance of inputType where the event occurred<ko>이벤트가 발생한 inputType 인스턴스</ko>
                  * @property {setTo} setTo Specifies the animation coordinates to move after the event <ko>이벤트 이후 이동할 애니메이션 좌표를 지정한다</ko>
                  * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call <ko>사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.</ko>
                  *
                  * @example
                  * const axes = new eg.Axes({
                  *   "x": {
                  *      range: [0, 100]
                  *   },
                  *   "zoom": {
                  *      range: [50, 30]
                  *   }
                  * }).on("release", function(event) {
                  *   // event.depaPos
                  *   // event.destPos
                  *   // event.delta
                  *   // event.input
                  *   // event.inputEvent
                  *   // event.setTo
                  *   // event.isTrusted
                  *
                  *   // if you want to change the animation coordinates to move after the 'release' event.
                  *   event.setTo({x: 10}, 2000);
                  * });
                  */
      __proto.triggerRelease = function (param) {
        var _a = this.getRoundPos(param.destPos, param.depaPos),roundPos = _a.roundPos,roundDepa = _a.roundDepa;
        param.destPos = roundPos;
        param.depaPos = roundDepa;
        param.setTo = this.createUserControll(param.destPos, param.duration);
        this.axes.trigger("release", param);
      };
      /**
          * This event is fired when coordinate changes.
          * @ko 좌표가 변경됐을 때 발생하는 이벤트
          * @name eg.Axes#change
          * @event
          * @type {object} The object of data to be sent when the event is fired <ko>이벤트가 발생할 때 전달되는 데이터 객체</ko>
          * @property {Object.<string, number>} pos  The coordinate <ko>좌표</ko>
          * @property {Object.<string, number>} delta  The movement variation of coordinate <ko>좌표의 변화량</ko>
          * @property {Boolean} holding Indicates whether a user holds an element on the screen of the device.<ko>사용자가 기기의 화면을 누르고 있는지 여부</ko>
          * @property {Object} input The instance of inputType where the event occurred. If the value is changed by animation, it returns 'null'.<ko>이벤트가 발생한 inputType 인스턴스. 애니메이션에 의해 값이 변경될 경우에는 'null'을 반환한다.</ko>
          * @property {Object} inputEvent The event object received from inputType. If the value is changed by animation, it returns 'null'.<ko>inputType으로 부터 받은 이벤트 객체. 애니메이션에 의해 값이 변경될 경우에는 'null'을 반환한다.</ko>
          * @property {set} set Specifies the coordinates to move after the event. It works when the holding value is true <ko>이벤트 이후 이동할 좌표를 지정한다. holding 값이 true일 경우에 동작한다.</ko>
          * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call <ko>사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.</ko>
          *
          * @example
          * const axes = new eg.Axes({
          *   "x": {
          *      range: [0, 100]
          *   },
          *   "zoom": {
          *      range: [50, 30]
          *   }
          * }).on("change", function(event) {
          *   // event.pos
          *   // event.delta
          *   // event.input
          *   // event.inputEvent
          *   // event.holding
          *   // event.set
          *   // event.isTrusted
          *
          *   // if you want to change the coordinates to move after the 'change' event.
          *   // it works when the holding value of the change event is true.
          *   event.holding && event.set({x: 10});
          * });
          */
      __proto.triggerChange = function (pos, isAccurate, depaPos, option, holding) {
        if (holding === void 0) {holding = false;}
        var am = this.am;
        var axm = am.axm;
        var eventInfo = am.getEventInfo();
        var _a = this.getRoundPos(pos, depaPos),roundPos = _a.roundPos,roundDepa = _a.roundDepa;
        var moveTo = axm.moveTo(roundPos, roundDepa);
        var inputEvent = option && option.event || eventInfo && eventInfo.event || null;
        var param = {
          pos: moveTo.pos,
          delta: moveTo.delta,
          holding: holding,
          inputEvent: inputEvent,
          isTrusted: !!inputEvent,
          input: option && option.input || eventInfo && eventInfo.input || null,
          set: inputEvent ? this.createUserControll(moveTo.pos) : function () {} };

        var result = this.axes.trigger("change", param);
        inputEvent && axm.set(param.set()["destPos"]);
        return result;
      };
      /**
          * This event is fired when animation starts.
          * @ko 에니메이션이 시작할 때 발생한다.
          * @name eg.Axes#animationStart
          * @event
          * @type {object} The object of data to be sent when the event is fired<ko>이벤트가 발생할 때 전달되는 데이터 객체</ko>
          * @property {Object.<string, number>} depaPos The coordinates when animation starts<ko>애니메이션이 시작 되었을 때의 좌표 </ko>
          * @property {Object.<string, number>} destPos The coordinates to move to. If you change this value, you can run the animation<ko>이동할 좌표. 이값을 변경하여 애니메이션을 동작시킬수 있다</ko>
          * @property {Object.<string, number>} delta  The movement variation of coordinate <ko>좌표의 변화량</ko>
          * @property {Number} duration Duration of the animation (unit: ms). If you change this value, you can control the animation duration time.<ko>애니메이션 진행 시간(단위: ms). 이값을 변경하여 애니메이션의 이동시간을 조절할 수 있다.</ko>
          * @property {Object} input The instance of inputType where the event occurred. If the value is changed by animation, it returns 'null'.<ko>이벤트가 발생한 inputType 인스턴스. 애니메이션에 의해 값이 변경될 경우에는 'null'을 반환한다.</ko>
          * @property {Object} inputEvent The event object received from inputType <ko>inputType으로 부터 받은 이벤트 객체</ko>
          * @property {setTo} setTo Specifies the animation coordinates to move after the event <ko>이벤트 이후 이동할 애니메이션 좌표를 지정한다</ko>
          * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call <ko>사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.</ko>
          *
          * @example
          * const axes = new eg.Axes({
          *   "x": {
          *      range: [0, 100]
          *   },
          *   "zoom": {
          *      range: [50, 30]
          *   }
          * }).on("release", function(event) {
          *   // event.depaPos
          *   // event.destPos
          *   // event.delta
          *   // event.input
          *   // event.inputEvent
          *   // event.setTo
          *   // event.isTrusted
          *
          *   // if you want to change the animation coordinates to move after the 'animationStart' event.
          *   event.setTo({x: 10}, 2000);
          * });
          */
      __proto.triggerAnimationStart = function (param) {
        var _a = this.getRoundPos(param.destPos, param.depaPos),roundPos = _a.roundPos,roundDepa = _a.roundDepa;
        param.destPos = roundPos;
        param.depaPos = roundDepa;
        param.setTo = this.createUserControll(param.destPos, param.duration);
        return this.axes.trigger("animationStart", param);
      };
      /**
          * This event is fired when animation ends.
          * @ko 에니메이션이 끝났을 때 발생한다.
          * @name eg.Axes#animationEnd
          * @event
          * @type {object} The object of data to be sent when the event is fired<ko>이벤트가 발생할 때 전달되는 데이터 객체</ko>
          * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call <ko>사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.</ko>
          *
          * @example
          * const axes = new eg.Axes({
          *   "x": {
          *      range: [0, 100]
          *   },
          *   "zoom": {
          *      range: [50, 30]
          *   }
          * }).on("animationEnd", function(event) {
          *   // event.isTrusted
          * });
          */
      __proto.triggerAnimationEnd = function (isTrusted) {
        if (isTrusted === void 0) {isTrusted = false;}
        this.axes.trigger("animationEnd", {
          isTrusted: isTrusted });

      };
      /**
          * This event is fired when all actions have been completed.
          * @ko 에니메이션이 끝났을 때 발생한다.
          * @name eg.Axes#finish
          * @event
          * @type {object} The object of data to be sent when the event is fired<ko>이벤트가 발생할 때 전달되는 데이터 객체</ko>
          * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call <ko>사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.</ko>
          *
          * @example
          * const axes = new eg.Axes({
          *   "x": {
          *      range: [0, 100]
          *   },
          *   "zoom": {
          *      range: [50, 30]
          *   }
          * }).on("finish", function(event) {
          *   // event.isTrusted
          * });
          */
      __proto.triggerFinish = function (isTrusted) {
        if (isTrusted === void 0) {isTrusted = false;}
        this.axes.trigger("finish", {
          isTrusted: isTrusted });

      };
      __proto.createUserControll = function (pos, duration) {
        if (duration === void 0) {duration = 0;}
        // to controll
        var userControl = {
          destPos: __assign({}, pos),
          duration: duration };

        return function (toPos, userDuration) {
          toPos && (userControl.destPos = __assign({}, toPos));
          userDuration !== undefined && (userControl.duration = userDuration);
          return userControl;
        };
      };
      __proto.setAnimationManager = function (am) {
        this.am = am;
      };
      __proto.destroy = function () {
        this.axes.off();
      };
      __proto.getRoundPos = function (pos, depaPos) {
        // round value if round exist
        var roundUnit = this.axes.options.round;
        // if (round == null) {
        // 	return {pos, depaPos}; // undefined, undefined
        // }
        return {
          roundPos: roundNumbers(pos, roundUnit),
          roundDepa: roundNumbers(depaPos, roundUnit) };

      };
      return EventManager;
    }();

    var InterruptManager = /*#__PURE__*/function () {
      function InterruptManager(options) {
        this.options = options;
        this._prevented = false; //  check whether the animation event was prevented
      }var __proto = InterruptManager.prototype;
      __proto.isInterrupting = function () {
        // when interruptable is 'true', return value is always 'true'.
        return this.options.interruptable || this._prevented;
      };
      __proto.isInterrupted = function () {
        return !this.options.interruptable && this._prevented;
      };
      __proto.setInterrupt = function (prevented) {
        !this.options.interruptable && (this._prevented = prevented);
      };
      return InterruptManager;
    }();

    var AxisManager = /*#__PURE__*/function () {
      function AxisManager(axis, options) {
        var _this = this;
        this.axis = axis;
        this.options = options;
        this._complementOptions();
        this._pos = Object.keys(this.axis).reduce(function (acc, v) {
          acc[v] = _this.axis[v].range[0];
          return acc;
        }, {});
      }
      /**
           * set up 'css' expression
           * @private
           */var __proto = AxisManager.prototype;
      __proto._complementOptions = function () {
        var _this = this;
        Object.keys(this.axis).forEach(function (axis) {
          _this.axis[axis] = __assign({
            range: [0, 100],
            bounce: [0, 0],
            circular: [false, false] },
          _this.axis[axis]);
          ["bounce", "circular"].forEach(function (v) {
            var axisOption = _this.axis;
            var key = axisOption[axis][v];
            if (/string|number|boolean/.test(typeof key)) {
              axisOption[axis][v] = [key, key];
            }
          });
        });
      };
      __proto.getDelta = function (depaPos, destPos) {
        var fullDepaPos = this.get(depaPos);
        return map(this.get(destPos), function (v, k) {return v - fullDepaPos[k];});
      };
      __proto.get = function (axes) {
        var _this = this;
        if (axes && Array.isArray(axes)) {
          return axes.reduce(function (acc, v) {
            if (v && v in _this._pos) {
              acc[v] = _this._pos[v];
            }
            return acc;
          }, {});
        } else
        {
          return __assign({}, this._pos, axes || {});
        }
      };
      __proto.moveTo = function (pos, depaPos) {
        if (depaPos === void 0) {depaPos = this._pos;}
        var delta = map(this._pos, function (v, key) {
          return key in pos && key in depaPos ? pos[key] - depaPos[key] : 0;
        });
        this.set(this.map(pos, function (v, opt) {return opt ? getCirculatedPos(v, opt.range, opt.circular) : 0;}));
        return {
          pos: __assign({}, this._pos),
          delta: delta };

      };
      __proto.set = function (pos) {
        for (var k in pos) {
          if (k && k in this._pos) {
            this._pos[k] = pos[k];
          }
        }
      };
      __proto.every = function (pos, callback) {
        var axisOptions = this.axis;
        return every(pos, function (value, key) {return callback(value, axisOptions[key], key);});
      };
      __proto.filter = function (pos, callback) {
        var axisOptions = this.axis;
        return filter(pos, function (value, key) {return callback(value, axisOptions[key], key);});
      };
      __proto.map = function (pos, callback) {
        var axisOptions = this.axis;
        return map(pos, function (value, key) {return callback(value, axisOptions[key], key);});
      };
      __proto.isOutside = function (axes) {
        return !this.every(axes ? this.get(axes) : this._pos, function (v, opt) {return !isOutside(v, opt.range);});
      };
      __proto.getAxisOptions = function (key) {
        return this.axis[key];
      };
      return AxisManager;
    }();

    var InputObserver = /*#__PURE__*/function () {
      function InputObserver(_a) {
        var options = _a.options,itm = _a.itm,em = _a.em,axm = _a.axm,am = _a.am;
        this.isOutside = false;
        this.moveDistance = null;
        this.isStopped = false;
        this.options = options;
        this.itm = itm;
        this.em = em;
        this.axm = axm;
        this.am = am;
      }
      // when move pointer is held in outside
      var __proto = InputObserver.prototype;__proto.atOutside = function (pos) {
        var _this = this;
        if (this.isOutside) {
          return this.axm.map(pos, function (v, opt) {
            var tn = opt.range[0] - opt.bounce[0];
            var tx = opt.range[1] + opt.bounce[1];
            return v > tx ? tx : v < tn ? tn : v;
          });
        } else
        {
          // when start pointer is held in inside
          // get a initialization slope value to prevent smooth animation.
          var initSlope_1 = this.am.easing(0.00001) / 0.00001;
          return this.axm.map(pos, function (v, opt) {
            var min = opt.range[0];
            var max = opt.range[1];
            var out = opt.bounce;
            var circular = opt.circular;
            if (circular && (circular[0] || circular[1])) {
              return v;
            } else
            if (v < min) {// left
              return min - _this.am.easing((min - v) / (out[0] * initSlope_1)) * out[0];
            } else
            if (v > max) {// right
              return max + _this.am.easing((v - max) / (out[1] * initSlope_1)) * out[1];
            }
            return v;
          });
        }
      };
      __proto.get = function (input) {
        return this.axm.get(input.axes);
      };
      __proto.hold = function (input, event) {
        if (this.itm.isInterrupted() || !input.axes.length) {
          return;
        }
        var changeOption = {
          input: input,
          event: event };

        this.isStopped = false;
        this.itm.setInterrupt(true);
        this.am.grab(input.axes, changeOption);
        !this.moveDistance && this.em.triggerHold(this.axm.get(), changeOption);
        this.isOutside = this.axm.isOutside(input.axes);
        this.moveDistance = this.axm.get(input.axes);
      };
      __proto.change = function (input, event, offset) {
        if (this.isStopped || !this.itm.isInterrupting() || this.axm.every(offset, function (v) {return v === 0;})) {
          return;
        }
        var depaPos = this.moveDistance || this.axm.get(input.axes);
        var destPos;
        // for outside logic
        destPos = map(depaPos, function (v, k) {return v + (offset[k] || 0);});
        this.moveDistance && (this.moveDistance = destPos);
        // from outside to inside
        if (this.isOutside &&
        this.axm.every(depaPos, function (v, opt) {return !isOutside(v, opt.range);})) {
          this.isOutside = false;
        }
        depaPos = this.atOutside(depaPos);
        destPos = this.atOutside(destPos);
        var isCanceled = !this.em.triggerChange(destPos, false, depaPos, {
          input: input,
          event: event },
        true);
        if (isCanceled) {
          this.isStopped = true;
          this.moveDistance = null;
          this.am.finish(false);
        }
      };
      __proto.release = function (input, event, offset, inputDuration) {
        if (this.isStopped || !this.itm.isInterrupting() || !this.moveDistance) {
          return;
        }
        var pos = this.axm.get(input.axes);
        var depaPos = this.axm.get();
        var destPos = this.axm.get(this.axm.map(offset, function (v, opt, k) {
          if (opt.circular && (opt.circular[0] || opt.circular[1])) {
            return pos[k] + v;
          } else
          {
            return getInsidePosition(pos[k] + v, opt.range, opt.circular, opt.bounce);
          }
        }));
        var duration = this.am.getDuration(destPos, pos, inputDuration);
        if (duration === 0) {
          destPos = __assign({}, depaPos);
        }
        // prepare params
        var param = {
          depaPos: depaPos,
          destPos: destPos,
          duration: duration,
          delta: this.axm.getDelta(depaPos, destPos),
          inputEvent: event,
          input: input,
          isTrusted: true };

        this.em.triggerRelease(param);
        this.moveDistance = null;
        // to contol
        var userWish = this.am.getUserControll(param);
        var isEqual = equal(userWish.destPos, depaPos);
        var changeOption = {
          input: input,
          event: event };

        if (isEqual || userWish.duration === 0) {
          !isEqual && this.em.triggerChange(userWish.destPos, false, depaPos, changeOption, true);
          this.itm.setInterrupt(false);
          if (this.axm.isOutside()) {
            this.am.restore(changeOption);
          } else
          {
            this.em.triggerFinish(true);
          }
        } else
        {
          this.am.animateTo(userWish.destPos, userWish.duration, changeOption);
        }
      };
      return InputObserver;
    }();

    // export const DIRECTION_NONE = 1;
    var TRANSFORM = function () {
      if (typeof document === "undefined") {
        return "";
      }
      var bodyStyle = (document.head || document.getElementsByTagName("head")[0]).style;
      var target = ["transform", "webkitTransform", "msTransform", "mozTransform"];
      for (var i = 0, len = target.length; i < len; i++) {
        if (target[i] in bodyStyle) {
          return target[i];
        }
      }
      return "";
    }();

    /**
                                                                                * @typedef {Object} AxisOption The Axis information. The key of the axis specifies the name to use as the logical virtual coordinate system.
                                                                                * @ko 축 정보. 축의 키는 논리적인 가상 좌표계로 사용할 이름을 지정한다.
                                                                                * @property {Number[]} [range] The coordinate of range <ko>좌표 범위</ko>
                                                                                * @property {Number} [range.0=0] The coordinate of the minimum <ko>최소 좌표</ko>
                                                                                * @property {Number} [range.1=0] The coordinate of the maximum <ko>최대 좌표</ko>
                                                                                * @property {Number[]} [bounce] The size of bouncing area. The coordinates can exceed the coordinate area as much as the bouncing area based on user action. If the coordinates does not exceed the bouncing area when an element is dragged, the coordinates where bouncing effects are applied are retuned back into the coordinate area<ko>바운스 영역의 크기. 사용자의 동작에 따라 좌표가 좌표 영역을 넘어 바운스 영역의 크기만큼 더 이동할 수 있다. 사용자가 끌어다 놓는 동작을 했을 때 좌표가 바운스 영역에 있으면, 바운스 효과가 적용된 좌표가 다시 좌표 영역 안으로 들어온다</ko>
                                                                                * @property {Number} [bounce.0=0] The size of coordinate of the minimum area <ko>최소 좌표 바운스 영역의 크기</ko>
                                                                                * @property {Number} [bounce.1=0] The size of coordinate of the maximum area <ko>최대 좌표 바운스 영역의 크기</ko>
                                                                                * @property {Boolean[]} [circular] Indicates whether a circular element is available. If it is set to "true" and an element is dragged outside the coordinate area, the element will appear on the other side.<ko>순환 여부. 'true'로 설정한 방향의 좌표 영역 밖으로 엘리먼트가 이동하면 반대 방향에서 엘리먼트가 나타난다</ko>
                                                                                * @property {Boolean} [circular.0=false] Indicates whether to circulate to the coordinate of the minimum <ko>최소 좌표 방향의 순환 여부</ko>
                                                                                * @property {Boolean} [circular.1=false] Indicates whether to circulate to the coordinate of the maximum <ko>최대 좌표 방향의 순환 여부</ko>
                                                                                **/
    /**
                                                                                * @typedef {Object} AxesOption The option object of the eg.Axes module
                                                                                * @ko eg.Axes 모듈의 옵션 객체
                                                                                * @property {Function} [easing=easing.easeOutCubic] The easing function to apply to an animation <ko>애니메이션에 적용할 easing 함수</ko>
                                                                                * @property {Number} [maximumDuration=Infinity] Maximum duration of the animation <ko>가속도에 의해 애니메이션이 동작할 때의 최대 좌표 이동 시간</ko>
                                                                                * @property {Number} [minimumDuration=0] Minimum duration of the animation <ko>가속도에 의해 애니메이션이 동작할 때의 최소 좌표 이동 시간</ko>
                                                                                * @property {Number} [deceleration=0.0006] Deceleration of the animation where acceleration is manually enabled by user. A higher value indicates shorter running time. <ko>사용자의 동작으로 가속도가 적용된 애니메이션의 감속도. 값이 높을수록 애니메이션 실행 시간이 짧아진다</ko>
                                                                                * @property {Boolean} [interruptable=true] Indicates whether an animation is interruptible.<br>- true: It can be paused or stopped by user action or the API.<br>- false: It cannot be paused or stopped by user action or the API while it is running.<ko>진행 중인 애니메이션 중지 가능 여부.<br>- true: 사용자의 동작이나 API로 애니메이션을 중지할 수 있다.<br>- false: 애니메이션이 진행 중일 때는 사용자의 동작이나 API가 적용되지 않는다</ko>
                                                                                * @property {Number} [round = null] Rounding unit. For example, 0.1 rounds to 0.1 decimal point(6.1234 => 6.1), 5 rounds to 5 (93 => 95) <br>[Details](https://github.com/naver/egjs-axes/wiki/round-option)<ko>반올림 단위. 예를 들어 0.1 은 소숫점 0.1 까지 반올림(6.1234 => 6.1), 5 는 5 단위로 반올림(93 => 95).<br>[상세내용](https://github.com/naver/egjs-axes/wiki/round-option)</ko>
                                                                                **/
    /**
                                                                                * @class eg.Axes
                                                                                * @classdesc A module used to change the information of user action entered by various input devices such as touch screen or mouse into the logical virtual coordinates. You can easily create a UI that responds to user actions.
                                                                                * @ko 터치 입력 장치나 마우스와 같은 다양한 입력 장치를 통해 전달 받은 사용자의 동작을 논리적인 가상 좌표로 변경하는 모듈이다. 사용자 동작에 반응하는 UI를 손쉽게 만들수 있다.
                                                                                * @extends eg.Component
                                                                                *
                                                                                * @param {Object.<string, AxisOption>} axis Axis information managed by eg.Axes. The key of the axis specifies the name to use as the logical virtual coordinate system.  <ko>eg.Axes가 관리하는 축 정보. 축의 키는 논리적인 가상 좌표계로 사용할 이름을 지정한다.</ko>
                                                                                * @param {AxesOption} [options] The option object of the eg.Axes module<ko>eg.Axes 모듈의 옵션 객체</ko>
                                                                                * @param {Object.<string, number>} [startPos] The coordinates to be moved when creating an instance. not triggering change event.<ko>인스턴스 생성시 이동할 좌표, change 이벤트는 발생하지 않음.</ko>
                                                                                *
                                                                                * @support {"ie": "10+", "ch" : "latest", "ff" : "latest",  "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "2.3+ (except 3.x)"}
                                                                                * @example
                                                                                *
                                                                                * // 1. Initialize eg.Axes
                                                                                * const axes = new eg.Axes({
                                                                                *	something1: {
                                                                                *		range: [0, 150],
                                                                                *		bounce: 50
                                                                                *	},
                                                                                *	something2: {
                                                                                *		range: [0, 200],
                                                                                *		bounce: 100
                                                                                *	},
                                                                                *	somethingN: {
                                                                                *		range: [1, 10],
                                                                                *	}
                                                                                * }, {
                                                                                *  deceleration : 0.0024
                                                                                * });
                                                                                *
                                                                                * // 2. attach event handler
                                                                                * axes.on({
                                                                                *	"hold" : function(evt) {
                                                                                *	},
                                                                                *	"release" : function(evt) {
                                                                                *	},
                                                                                *	"animationStart" : function(evt) {
                                                                                *	},
                                                                                *	"animationEnd" : function(evt) {
                                                                                *	},
                                                                                *	"change" : function(evt) {
                                                                                *	}
                                                                                * });
                                                                                *
                                                                                * // 3. Initialize inputTypes
                                                                                * const panInputArea = new eg.Axes.PanInput("#area", {
                                                                                *	scale: [0.5, 1]
                                                                                * });
                                                                                * const panInputHmove = new eg.Axes.PanInput("#hmove");
                                                                                * const panInputVmove = new eg.Axes.PanInput("#vmove");
                                                                                * const pinchInputArea = new eg.Axes.PinchInput("#area", {
                                                                                *	scale: 1.5
                                                                                * });
                                                                                *
                                                                                * // 4. Connect eg.Axes and InputTypes
                                                                                * // [PanInput] When the mouse or touchscreen is down and moved.
                                                                                * // Connect the 'something2' axis to the mouse or touchscreen x position and
                                                                                * // connect the 'somethingN' axis to the mouse or touchscreen y position.
                                                                                * axes.connect(["something2", "somethingN"], panInputArea); // or axes.connect("something2 somethingN", panInputArea);
                                                                                *
                                                                                * // Connect only one 'something1' axis to the mouse or touchscreen x position.
                                                                                * axes.connect(["something1"], panInputHmove); // or axes.connect("something1", panInputHmove);
                                                                                *
                                                                                * // Connect only one 'something2' axis to the mouse or touchscreen y position.
                                                                                * axes.connect(["", "something2"], panInputVmove); // or axes.connect(" something2", panInputVmove);
                                                                                *
                                                                                * // [PinchInput] Connect 'something2' axis when two pointers are moving toward (zoom-in) or away from each other (zoom-out).
                                                                                * axes.connect("something2", pinchInputArea);
                                                                                */
    var Axes = /*#__PURE__*/function (_super) {
      __extends(Axes, _super);
      function Axes(axis, options, startPos) {
        if (axis === void 0) {axis = {};}
        if (options === void 0) {options = {};}
        var _this = _super.call(this) || this;
        _this.axis = axis;
        _this._inputs = [];
        _this.options = __assign({
          easing: function easeOutCubic(x) {
            return 1 - Math.pow(1 - x, 3);
          },
          interruptable: true,
          maximumDuration: Infinity,
          minimumDuration: 0,
          deceleration: 0.0006,
          round: null },
        options);
        _this.itm = new InterruptManager(_this.options);
        _this.axm = new AxisManager(_this.axis, _this.options);
        _this.em = new EventManager(_this);
        _this.am = new AnimationManager(_this);
        _this.io = new InputObserver(_this);
        _this.em.setAnimationManager(_this.am);
        startPos && _this.em.triggerChange(startPos);
        return _this;
      }
      /**
         * Connect the axis of eg.Axes to the inputType.
         * @ko eg.Axes의 축과 inputType을 연결한다
         * @method eg.Axes#connect
         * @param {(String[]|String)} axes The name of the axis to associate with inputType <ko>inputType과 연결할 축의 이름</ko>
         * @param {Object} inputType The inputType instance to associate with the axis of eg.Axes <ko>eg.Axes의 축과 연결할 inputType 인스턴스<ko>
         * @return {eg.Axes} An instance of a module itself <ko>모듈 자신의 인스턴스</ko>
         * @example
         * const axes = new eg.Axes({
         *   "x": {
         *      range: [0, 100]
         *   },
         *   "xOther": {
         *      range: [-100, 100]
         *   }
         * });
         *
         * axes.connect("x", new eg.Axes.PanInput("#area1"))
         *    .connect("x xOther", new eg.Axes.PanInput("#area2"))
         *    .connect(" xOther", new eg.Axes.PanInput("#area3"))
         *    .connect(["x"], new eg.Axes.PanInput("#area4"))
         *    .connect(["xOther", "x"], new eg.Axes.PanInput("#area5"))
         *    .connect(["", "xOther"], new eg.Axes.PanInput("#area6"));
         */var __proto = Axes.prototype;
      __proto.connect = function (axes, inputType) {
        var mapped;
        if (typeof axes === "string") {
          mapped = axes.split(" ");
        } else
        {
          mapped = axes.concat();
        }
        // check same instance
        if (~this._inputs.indexOf(inputType)) {
          this.disconnect(inputType);
        }
        // check same element in hammer type for share
        if ("hammer" in inputType) {
          var targets = this._inputs.filter(function (v) {return v.hammer && v.element === inputType.element;});
          if (targets.length) {
            inputType.hammer = targets[0].hammer;
          }
        }
        inputType.mapAxes(mapped);
        inputType.connect(this.io);
        this._inputs.push(inputType);
        return this;
      };
      /**
          * Disconnect the axis of eg.Axes from the inputType.
          * @ko eg.Axes의 축과 inputType의 연결을 끊는다.
          * @method eg.Axes#disconnect
          * @param {Object} [inputType] An inputType instance associated with the axis of eg.Axes <ko>eg.Axes의 축과 연결한 inputType 인스턴스<ko>
          * @return {eg.Axes} An instance of a module itself <ko>모듈 자신의 인스턴스</ko>
          * @example
          * const axes = new eg.Axes({
          *   "x": {
          *      range: [0, 100]
          *   },
          *   "xOther": {
          *      range: [-100, 100]
          *   }
          * });
          *
          * const input1 = new eg.Axes.PanInput("#area1");
          * const input2 = new eg.Axes.PanInput("#area2");
          * const input3 = new eg.Axes.PanInput("#area3");
          *
          * axes.connect("x", input1);
          *    .connect("x xOther", input2)
          *    .connect(["xOther", "x"], input3);
          *
          * axes.disconnect(input1); // disconnects input1
          * axes.disconnect(); // disconnects all of them
          */
      __proto.disconnect = function (inputType) {
        if (inputType) {
          var index = this._inputs.indexOf(inputType);
          if (index >= 0) {
            this._inputs[index].disconnect();
            this._inputs.splice(index, 1);
          }
        } else
        {
          this._inputs.forEach(function (v) {return v.disconnect();});
          this._inputs = [];
        }
        return this;
      };
      /**
          * Returns the current position of the coordinates.
          * @ko 좌표의 현재 위치를 반환한다
          * @method eg.Axes#get
          * @param {Object} [axes] The names of the axis <ko>축 이름들</ko>
          * @return {Object.<string, number>} Axis coordinate information <ko>축 좌표 정보</ko>
          * @example
          * const axes = new eg.Axes({
          *   "x": {
          *      range: [0, 100]
          *   },
          *   "xOther": {
          *      range: [-100, 100]
          *   },
          * 	 "zoom": {
          *      range: [50, 30]
          *   }
          * });
          *
          * axes.get(); // {"x": 0, "xOther": -100, "zoom": 50}
          * axes.get(["x", "zoom"]); // {"x": 0, "zoom": 50}
          */
      __proto.get = function (axes) {
        return this.axm.get(axes);
      };
      /**
          * Moves an axis to specific coordinates.
          * @ko 좌표를 이동한다.
          * @method eg.Axes#setTo
          * @param {Object.<string, number>} pos The coordinate to move to <ko>이동할 좌표</ko>
          * @param {Number} [duration=0] Duration of the animation (unit: ms) <ko>애니메이션 진행 시간(단위: ms)</ko>
          * @return {eg.Axes} An instance of a module itself <ko>모듈 자신의 인스턴스</ko>
          * @example
          * const axes = new eg.Axes({
          *   "x": {
          *      range: [0, 100]
          *   },
          *   "xOther": {
          *      range: [-100, 100]
          *   },
          * 	 "zoom": {
          *      range: [50, 30]
          *   }
          * });
          *
          * axes.setTo({"x": 30, "zoom": 60});
          * axes.get(); // {"x": 30, "xOther": -100, "zoom": 60}
          *
          * axes.setTo({"x": 100, "xOther": 60}, 1000); // animatation
          *
          * // after 1000 ms
          * axes.get(); // {"x": 100, "xOther": 60, "zoom": 60}
          */
      __proto.setTo = function (pos, duration) {
        if (duration === void 0) {duration = 0;}
        this.am.setTo(pos, duration);
        return this;
      };
      /**
          * Moves an axis from the current coordinates to specific coordinates.
          * @ko 현재 좌표를 기준으로 좌표를 이동한다.
          * @method eg.Axes#setBy
          * @param {Object.<string, number>} pos The coordinate to move to <ko>이동할 좌표</ko>
          * @param {Number} [duration=0] Duration of the animation (unit: ms) <ko>애니메이션 진행 시간(단위: ms)</ko>
          * @return {eg.Axes} An instance of a module itself <ko>모듈 자신의 인스턴스</ko>
          * @example
          * const axes = new eg.Axes({
          *   "x": {
          *      range: [0, 100]
          *   },
          *   "xOther": {
          *      range: [-100, 100]
          *   },
          * 	 "zoom": {
          *      range: [50, 30]
          *   }
          * });
          *
          * axes.setBy({"x": 30, "zoom": 10});
          * axes.get(); // {"x": 30, "xOther": -100, "zoom": 60}
          *
          * axes.setBy({"x": 70, "xOther": 60}, 1000); // animatation
          *
          * // after 1000 ms
          * axes.get(); // {"x": 100, "xOther": -40, "zoom": 60}
          */
      __proto.setBy = function (pos, duration) {
        if (duration === void 0) {duration = 0;}
        this.am.setBy(pos, duration);
        return this;
      };
      /**
          * Returns whether there is a coordinate in the bounce area of the target axis.
          * @ko 대상 축 중 bounce영역에 좌표가 존재하는지를 반환한다
          * @method eg.Axes#isBounceArea
          * @param {Object} [axes] The names of the axis <ko>축 이름들</ko>
          * @return {Boolen} Whether the bounce area exists. <ko>bounce 영역 존재 여부</ko>
          * @example
          * const axes = new eg.Axes({
          *   "x": {
          *      range: [0, 100]
          *   },
          *   "xOther": {
          *      range: [-100, 100]
          *   },
          * 	 "zoom": {
          *      range: [50, 30]
          *   }
          * });
          *
          * axes.isBounceArea(["x"]);
          * axes.isBounceArea(["x", "zoom"]);
          * axes.isBounceArea();
          */
      __proto.isBounceArea = function (axes) {
        return this.axm.isOutside(axes);
      };
      /**
         * Destroys properties, and events used in a module and disconnect all connections to inputTypes.
         * @ko 모듈에 사용한 속성, 이벤트를 해제한다. 모든 inputType과의 연결을 끊는다.
         * @method eg.Axes#destroy
         */
      __proto.destroy = function () {
        this.disconnect();
        this.em.destroy();
      };
      /**
          * Version info string
          * @ko 버전정보 문자열
          * @name VERSION
          * @static
          * @type {String}
          * @example
          * eg.Axes.VERSION;  // ex) 3.3.3
          * @memberof eg.Axes
          */
      Axes.VERSION = "2.6.0";
      /**
                                       * @name eg.Axes.TRANSFORM
                                       * @desc Returns the transform attribute with CSS vendor prefixes.
                                       * @ko CSS vendor prefixes를 붙인 transform 속성을 반환한다.
                                       *
                                       * @constant
                                       * @type {String}
                                       * @example
                                       * eg.Axes.TRANSFORM; // "transform" or "webkitTransform"
                                       */
      Axes.TRANSFORM = TRANSFORM;
      /**
                                   * @name eg.Axes.DIRECTION_NONE
                                   * @constant
                                   * @type {Number}
                                   */
      Axes.DIRECTION_NONE = hammerjs.DIRECTION_NONE;
      /**
                                             * @name eg.Axes.DIRECTION_LEFT
                                             * @constant
                                             * @type {Number}
                                            */
      Axes.DIRECTION_LEFT = hammerjs.DIRECTION_LEFT;
      /**
                                             * @name eg.Axes.DIRECTION_RIGHT
                                             * @constant
                                             * @type {Number}
                                            */
      Axes.DIRECTION_RIGHT = hammerjs.DIRECTION_RIGHT;
      /**
                                               * @name eg.Axes.DIRECTION_UP
                                               * @constant
                                               * @type {Number}
                                              */
      Axes.DIRECTION_UP = hammerjs.DIRECTION_UP;
      /**
                                         * @name eg.Axes.DIRECTION_DOWN
                                         * @constant
                                         * @type {Number}
                                        */
      Axes.DIRECTION_DOWN = hammerjs.DIRECTION_DOWN;
      /**
                                             * @name eg.Axes.DIRECTION_HORIZONTAL
                                             * @constant
                                             * @type {Number}
                                            */
      Axes.DIRECTION_HORIZONTAL = hammerjs.DIRECTION_HORIZONTAL;
      /**
                                                         * @name eg.Axes.DIRECTION_VERTICAL
                                                         * @constant
                                                         * @type {Number}
                                                        */
      Axes.DIRECTION_VERTICAL = hammerjs.DIRECTION_VERTICAL;
      /**
                                                     * @name eg.Axes.DIRECTION_ALL
                                                     * @constant
                                                     * @type {Number}
                                                    */
      Axes.DIRECTION_ALL = hammerjs.DIRECTION_ALL;
      return Axes;
    }(Component);

    var SUPPORT_POINTER_EVENTS = "PointerEvent" in win || "MSPointerEvent" in win;
    var SUPPORT_TOUCH = "ontouchstart" in win;
    var UNIQUEKEY = "_EGJS_AXES_INPUTTYPE_";
    function toAxis(source, offset) {
      return offset.reduce(function (acc, v, i) {
        if (source[i]) {
          acc[source[i]] = v;
        }
        return acc;
      }, {});
    }
    function createHammer(element, options) {
      try {
        // create Hammer
        return new hammerjs.Manager(element, __assign({}, options));
      }
      catch (e) {
        return null;
      }
    }
    function convertInputType(inputType) {
      if (inputType === void 0) {inputType = [];}
      var hasTouch = false;
      var hasMouse = false;
      var hasPointer = false;
      inputType.forEach(function (v) {
        switch (v) {
          case "mouse":
            hasMouse = true;
            break;
          case "touch":
            hasTouch = SUPPORT_TOUCH;
            break;
          case "pointer":hasPointer = SUPPORT_POINTER_EVENTS;
          // no default
        }
      });
      if (hasPointer) {
        return hammerjs.PointerEventInput;
      } else
      if (hasTouch && hasMouse) {
        return hammerjs.TouchMouseInput;
      } else
      if (hasTouch) {
        return hammerjs.TouchInput;
      } else
      if (hasMouse) {
        return hammerjs.MouseInput;
      }
      return null;
    }

    // get user's direction
    function getDirectionByAngle(angle, thresholdAngle) {
      if (thresholdAngle < 0 || thresholdAngle > 90) {
        return hammerjs.DIRECTION_NONE;
      }
      var toAngle = Math.abs(angle);
      return toAngle > thresholdAngle && toAngle < 180 - thresholdAngle ?
      hammerjs.DIRECTION_VERTICAL : hammerjs.DIRECTION_HORIZONTAL;
    }
    function getNextOffset(speeds, deceleration) {
      var normalSpeed = Math.sqrt(speeds[0] * speeds[0] + speeds[1] * speeds[1]);
      var duration = Math.abs(normalSpeed / -deceleration);
      return [
      speeds[0] / 2 * duration,
      speeds[1] / 2 * duration];

    }
    function useDirection(checkType, direction, userDirection) {
      if (userDirection) {
        return !!(direction === hammerjs.DIRECTION_ALL ||
        direction & checkType && userDirection & checkType);
      } else
      {
        return !!(direction & checkType);
      }
    }
    /**
       * @typedef {Object} PanInputOption The option object of the eg.Axes.PanInput module.
       * @ko eg.Axes.PanInput 모듈의 옵션 객체
       * @property {String[]} [inputType=["touch","mouse", "pointer"]] Types of input devices.<br>- touch: Touch screen<br>- mouse: Mouse <ko>입력 장치 종류.<br>- touch: 터치 입력 장치<br>- mouse: 마우스</ko>
       * @property {Number[]} [scale] Coordinate scale that a user can move<ko>사용자의 동작으로 이동하는 좌표의 배율</ko>
       * @property {Number} [scale.0=1] horizontal axis scale <ko>수평축 배율</ko>
       * @property {Number} [scale.1=1] vertical axis scale <ko>수직축 배율</ko>
       * @property {Number} [thresholdAngle=45] The threshold value that determines whether user action is horizontal or vertical (0~90) <ko>사용자의 동작이 가로 방향인지 세로 방향인지 판단하는 기준 각도(0~90)</ko>
       * @property {Number} [threshold=0] Minimal pan distance required before recognizing <ko>사용자의 Pan 동작을 인식하기 위해산 최소한의 거리</ko>
       * @property {Object} [hammerManagerOptions={cssProps: {userSelect: "none",touchSelect: "none",touchCallout: "none",userDrag: "none"}] Options of Hammer.Manager <ko>Hammer.Manager의 옵션</ko>
      **/
    /**
           * @class eg.Axes.PanInput
           * @classdesc A module that passes the amount of change to eg.Axes when the mouse or touchscreen is down and moved. use less than two axes.
           * @ko 마우스나 터치 스크린을 누르고 움직일때의 변화량을 eg.Axes에 전달하는 모듈. 두개 이하의 축을 사용한다.
           *
           * @example
           * const pan = new eg.Axes.PanInput("#area", {
           * 		inputType: ["touch"],
           * 		scale: [1, 1.3],
           * });
           *
           * // Connect the 'something2' axis to the mouse or touchscreen x position when the mouse or touchscreen is down and moved.
           * // Connect the 'somethingN' axis to the mouse or touchscreen y position when the mouse or touchscreen is down and moved.
           * axes.connect(["something2", "somethingN"], pan); // or axes.connect("something2 somethingN", pan);
           *
           * // Connect only one 'something1' axis to the mouse or touchscreen x position when the mouse or touchscreen is down and moved.
           * axes.connect(["something1"], pan); // or axes.connect("something1", pan);
           *
           * // Connect only one 'something2' axis to the mouse or touchscreen y position when the mouse or touchscreen is down and moved.
           * axes.connect(["", "something2"], pan); // or axes.connect(" something2", pan);
           *
           * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.PanInput module <ko>eg.Axes.PanInput 모듈을 사용할 엘리먼트</ko>
           * @param {PanInputOption} [options] The option object of the eg.Axes.PanInput module<ko>eg.Axes.PanInput 모듈의 옵션 객체</ko>
           */
    var PanInput = /*#__PURE__*/function () {
      function PanInput(el, options) {
        this.axes = [];
        this.hammer = null;
        this.element = null;
        this.panRecognizer = null;
        /**
                                    * Hammer helps you add support for touch gestures to your page
                                    *
                                    * @external Hammer
                                    * @see {@link http://hammerjs.github.io|Hammer.JS}
                                    * @see {@link http://hammerjs.github.io/jsdoc/Hammer.html|Hammer.JS API documents}
                                    * @see Hammer.JS applies specific CSS properties by {@link http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html|default} when creating an instance. The eg.Axes module removes all default CSS properties provided by Hammer.JS
                                    */
        if (typeof hammerjs.Manager === "undefined") {
          throw new Error("The Hammerjs must be loaded before eg.Axes.PanInput.\nhttp://hammerjs.github.io/");
        }
        this.element = $(el);
        this.options = __assign({
          inputType: ["touch", "mouse", "pointer"],
          scale: [1, 1],
          thresholdAngle: 45,
          threshold: 0,
          hammerManagerOptions: {
            // css properties were removed due to usablility issue
            // http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html
            cssProps: {
              userSelect: "none",
              touchSelect: "none",
              touchCallout: "none",
              userDrag: "none" } } },

        options);
        this.onHammerInput = this.onHammerInput.bind(this);
        this.onPanmove = this.onPanmove.bind(this);
        this.onPanend = this.onPanend.bind(this);
      }var __proto = PanInput.prototype;
      __proto.mapAxes = function (axes) {
        var useHorizontal = !!axes[0];
        var useVertical = !!axes[1];
        if (useHorizontal && useVertical) {
          this._direction = hammerjs.DIRECTION_ALL;
        } else
        if (useHorizontal) {
          this._direction = hammerjs.DIRECTION_HORIZONTAL;
        } else
        if (useVertical) {
          this._direction = hammerjs.DIRECTION_VERTICAL;
        } else
        {
          this._direction = hammerjs.DIRECTION_NONE;
        }
        this.axes = axes;
      };
      __proto.connect = function (observer) {
        var hammerOption = {
          direction: this._direction,
          threshold: this.options.threshold };

        if (this.hammer) {// for sharing hammer instance.
          // hammer remove previous PanRecognizer.
          this.removeRecognizer();
          this.dettachEvent();
        } else
        {
          var keyValue = this.element[UNIQUEKEY];
          if (!keyValue) {
            keyValue = String(Math.round(Math.random() * new Date().getTime()));
          }
          var inputClass = convertInputType(this.options.inputType);
          if (!inputClass) {
            throw new Error("Wrong inputType parameter!");
          }
          this.hammer = createHammer(this.element, __assign({
            inputClass: inputClass },
          this.options.hammerManagerOptions));
          this.element[UNIQUEKEY] = keyValue;
        }
        this.panRecognizer = new hammerjs.Pan(hammerOption);
        this.hammer.add(this.panRecognizer);
        this.attachEvent(observer);
        return this;
      };
      __proto.disconnect = function () {
        this.removeRecognizer();
        if (this.hammer) {
          this.dettachEvent();
        }
        this._direction = hammerjs.DIRECTION_NONE;
        return this;
      };
      /**
         * Destroys elements, properties, and events used in a module.
         * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.
         * @method eg.Axes.PanInput#destroy
         */
      __proto.destroy = function () {
        this.disconnect();
        if (this.hammer && this.hammer.recognizers.length === 0) {
          this.hammer.destroy();
        }
        delete this.element[UNIQUEKEY];
        this.element = null;
        this.hammer = null;
      };
      /**
          * Enables input devices
          * @ko 입력 장치를 사용할 수 있게 한다
          * @method eg.Axes.PanInput#enable
          * @return {eg.Axes.PanInput} An instance of a module itself <ko>모듈 자신의 인스턴스</ko>
          */
      __proto.enable = function () {
        this.hammer && (this.hammer.get("pan").options.enable = true);
        return this;
      };
      /**
          * Disables input devices
          * @ko 입력 장치를 사용할 수 없게 한다.
          * @method eg.Axes.PanInput#disable
          * @return {eg.Axes.PanInput} An instance of a module itself <ko>모듈 자신의 인스턴스</ko>
          */
      __proto.disable = function () {
        this.hammer && (this.hammer.get("pan").options.enable = false);
        return this;
      };
      /**
          * Returns whether to use an input device
          * @ko 입력 장치를 사용 여부를 반환한다.
          * @method eg.Axes.PanInput#isEnable
          * @return {Boolean} Whether to use an input device <ko>입력장치 사용여부</ko>
          */
      __proto.isEnable = function () {
        return !!(this.hammer && this.hammer.get("pan").options.enable);
      };
      __proto.removeRecognizer = function () {
        if (this.hammer && this.panRecognizer) {
          this.hammer.remove(this.panRecognizer);
          this.panRecognizer = null;
        }
      };
      __proto.onHammerInput = function (event) {
        if (this.isEnable()) {
          if (event.isFirst) {
            this.observer.hold(this, event);
          } else
          if (event.isFinal) {
            this.onPanend(event);
          }
        }
      };
      __proto.onPanmove = function (event) {
        var userDirection = getDirectionByAngle(event.angle, this.options.thresholdAngle);
        // not support offset properties in Hammerjs - start
        var prevInput = this.hammer.session.prevInput;
        /* eslint-disable no-param-reassign */
        if (prevInput) {
          event.offsetX = event.deltaX - prevInput.deltaX;
          event.offsetY = event.deltaY - prevInput.deltaY;
        } else
        {
          event.offsetX = 0;
          event.offsetY = 0;
        }
        var offset = this.getOffset([event.offsetX, event.offsetY], [
        useDirection(hammerjs.DIRECTION_HORIZONTAL, this._direction, userDirection),
        useDirection(hammerjs.DIRECTION_VERTICAL, this._direction, userDirection)]);

        var prevent = offset.some(function (v) {return v !== 0;});
        if (prevent) {
          event.srcEvent.preventDefault();
          event.srcEvent.stopPropagation();
        }
        event.preventSystemEvent = prevent;
        prevent && this.observer.change(this, event, toAxis(this.axes, offset));
      };
      __proto.onPanend = function (event) {
        var offset = this.getOffset([
        Math.abs(event.velocityX) * (event.deltaX < 0 ? -1 : 1),
        Math.abs(event.velocityY) * (event.deltaY < 0 ? -1 : 1)],
        [
        useDirection(hammerjs.DIRECTION_HORIZONTAL, this._direction),
        useDirection(hammerjs.DIRECTION_VERTICAL, this._direction)]);

        offset = getNextOffset(offset, this.observer.options.deceleration);
        this.observer.release(this, event, toAxis(this.axes, offset));
      };
      __proto.attachEvent = function (observer) {
        this.observer = observer;
        this.hammer.on("hammer.input", this.onHammerInput).
        on("panstart panmove", this.onPanmove);
      };
      __proto.dettachEvent = function () {
        this.hammer.off("hammer.input", this.onHammerInput).
        off("panstart panmove", this.onPanmove);
        this.observer = null;
      };
      __proto.getOffset = function (properties, direction) {
        var offset = [0, 0];
        var scale = this.options.scale;
        if (direction[0]) {
          offset[0] = properties[0] * scale[0];
        }
        if (direction[1]) {
          offset[1] = properties[1] * scale[1];
        }
        return offset;
      };
      return PanInput;
    }();

    /**
                                            * @class eg.Axes.RotatePanInput
                                            * @classdesc A module that passes the angle moved by touch to Axes and uses one axis of rotation.<br>[Details](https://github.com/naver/egjs-axes/wiki/RotatePanInput)
                                            * @ko 터치에 의해 움직인 각도를 Axes 에 전달하며 1개의 회전축만 사용한다.<br>[상세내용](https://github.com/naver/egjs-axes/wiki/RotatePanInput-%7C-%ED%95%9C%EA%B5%AD%EC%96%B4)
                                            *
                                            * @example
                                            * const input = new eg.Axes.RotatePanInput("#area");
                                            *
                                            * var axes = new eg.Axes({
                                            *	// property name('angle') could be anything you want (eg. x, y, z...)
                                            * 	angle: {
                                            * 		range: [-180, 180] // from -180deg to 180deg
                                            * 	}
                                            * });
                                            *
                                            * axes.connect("angle", input)
                                            *
                                            * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.RotatePanInput module <ko>eg.Axes.RotatePanInput 모듈을 사용할 엘리먼트</ko>
                                            * @param {PanInputOption} [options] The option object of the eg.Axes.PanInput module<ko>eg.Axes.PanInput 모듈의 옵션 객체</ko>
                                            * @extends eg.Axes.PanInput
                                            */
    var RotatePanInput = /*#__PURE__*/function (_super) {
      __extends(RotatePanInput, _super);
      function RotatePanInput(el, options) {
        var _this = _super.call(this, el, options) || this;
        _this.prevQuadrant = null;
        _this.lastDiff = 0;
        return _this;
      }var __proto = RotatePanInput.prototype;
      __proto.mapAxes = function (axes) {
        this._direction = Axes.DIRECTION_ALL;
        this.axes = axes;
      };
      __proto.onHammerInput = function (event) {
        if (this.isEnable()) {
          if (event.isFirst) {
            this.observer.hold(this, event);
            this.onPanstart(event);
          } else
          if (event.isFinal) {
            this.onPanend(event);
          }
        }
      };
      __proto.onPanstart = function (event) {
        var rect = this.element.getBoundingClientRect();
        /**
                                                          * Responsive
                                                          */
        // TODO: how to do if element is ellipse not circle.
        this.coefficientForDistanceToAngle = 360 / (rect.width * Math.PI); // from 2*pi*r * x / 360
        // TODO: provide a way to set origin like https://developer.mozilla.org/en-US/docs/Web/CSS/transform-origin
        this.rotateOrigin = [rect.left + (rect.width - 1) / 2, rect.top + (rect.height - 1) / 2];
        // init angle.
        this.prevAngle = null;
        this.triggerChange(event);
      };
      __proto.onPanmove = function (event) {
        this.triggerChange(event);
      };
      __proto.onPanend = function (event) {
        this.triggerChange(event);
        this.triggerAnimation(event);
      };
      __proto.triggerChange = function (event) {
        var angle = this.getAngle(event.center.x, event.center.y);
        var quadrant = this.getQuadrant(event.center.x, event.center.y);
        var diff = this.getDifference(this.prevAngle, angle, this.prevQuadrant, quadrant);
        this.prevAngle = angle;
        this.prevQuadrant = quadrant;
        if (diff === 0) {
          return;
        }
        this.lastDiff = diff;
        this.observer.change(this, event, toAxis(this.axes, [-diff])); // minus for clockwise
      };
      __proto.triggerAnimation = function (event) {
        var vx = event.velocityX;
        var vy = event.velocityY;
        var velocity = Math.sqrt(vx * vx + vy * vy) * (this.lastDiff > 0 ? -1 : 1); // clockwise
        var duration = Math.abs(velocity / -this.observer.options.deceleration);
        var distance = velocity / 2 * duration;
        this.observer.release(this, event, toAxis(this.axes, [distance * this.coefficientForDistanceToAngle]));
      };
      __proto.getDifference = function (prevAngle, angle, prevQuadrant, quadrant) {
        var diff;
        if (prevAngle === null) {
          diff = 0;
        } else
        if (prevQuadrant === 1 && quadrant === 4) {
          diff = -prevAngle - (360 - angle);
        } else
        if (prevQuadrant === 4 && quadrant === 1) {
          diff = 360 - prevAngle + angle;
        } else
        {
          diff = angle - prevAngle;
        }
        return diff;
      };
      __proto.getPosFromOrigin = function (posX, posY) {
        return {
          x: posX - this.rotateOrigin[0],
          y: this.rotateOrigin[1] - posY };

      };
      __proto.getAngle = function (posX, posY) {
        var _a = this.getPosFromOrigin(posX, posY),x = _a.x,y = _a.y;
        var angle = Math.atan2(y, x) * 180 / Math.PI;
        // console.log(angle, x, y);
        return angle < 0 ? 360 + angle : angle;
      };
      /**
          * Quadrant
          *       y(+)
          *       |
          *   2   |    1
          * --------------->x(+)
          *   3   |    4
          *       |
          */
      __proto.getQuadrant = function (posX, posY) {
        var _a = this.getPosFromOrigin(posX, posY),x = _a.x,y = _a.y;
        var q = 0;
        if (x >= 0 && y >= 0) {
          q = 1;
        } else
        if (x < 0 && y >= 0) {
          q = 2;
        } else
        if (x < 0 && y < 0) {
          q = 3;
        } else
        if (x >= 0 && y < 0) {
          q = 4;
        }
        return q;
      };
      return RotatePanInput;
    }(PanInput);

    /**
                                                                                * @typedef {Object} PinchInputOption The option object of the eg.Axes.PinchInput module
                                                                                * @ko eg.Axes.PinchInput 모듈의 옵션 객체
                                                                                * @property {Number} [scale=1] Coordinate scale that a user can move<ko>사용자의 동작으로 이동하는 좌표의 배율</ko>
                                                                                * @property {Number} [threshold=0] Minimal scale before recognizing <ko>사용자의 Pinch 동작을 인식하기 위해산 최소한의 배율</ko>
                                                                                * @property {Object} [hammerManagerOptions={cssProps: {userSelect: "none",touchSelect: "none",touchCallout: "none",userDrag: "none"}] Options of Hammer.Manager <ko>Hammer.Manager의 옵션</ko>
                                                                                **/
    /**
                                                                                * @class eg.Axes.PinchInput
                                                                                * @classdesc A module that passes the amount of change to eg.Axes when two pointers are moving toward (zoom-in) or away from each other (zoom-out). use one axis.
                                                                                * @ko 2개의 pointer를 이용하여 zoom-in하거나 zoom-out 하는 동작의 변화량을 eg.Axes에 전달하는 모듈. 한 개 의 축을 사용한다.
                                                                                * @example
                                                                                * const pinch = new eg.Axes.PinchInput("#area", {
                                                                                * 		scale: 1
                                                                                * });
                                                                                *
                                                                                * // Connect 'something' axis when two pointers are moving toward (zoom-in) or away from each other (zoom-out).
                                                                                * axes.connect("something", pinch);
                                                                                *
                                                                                * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.PinchInput module <ko>eg.Axes.PinchInput 모듈을 사용할 엘리먼트</ko>
                                                                                * @param {PinchInputOption} [options] The option object of the eg.Axes.PinchInput module<ko>eg.Axes.PinchInput 모듈의 옵션 객체</ko>
                                                                                */
    var PinchInput = /*#__PURE__*/function () {
      function PinchInput(el, options) {
        this.axes = [];
        this.hammer = null;
        this.element = null;
        this._base = null;
        this._prev = null;
        this.pinchRecognizer = null;
        /**
                                      * Hammer helps you add support for touch gestures to your page
                                      *
                                      * @external Hammer
                                      * @see {@link http://hammerjs.github.io|Hammer.JS}
                                      * @see {@link http://hammerjs.github.io/jsdoc/Hammer.html|Hammer.JS API documents}
                                      * @see Hammer.JS applies specific CSS properties by {@link http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html|default} when creating an instance. The eg.Axes module removes all default CSS properties provided by Hammer.JS
                                      */
        if (typeof hammerjs.Manager === "undefined") {
          throw new Error("The Hammerjs must be loaded before eg.Axes.PinchInput.\nhttp://hammerjs.github.io/");
        }
        this.element = $(el);
        this.options = __assign({
          scale: 1,
          threshold: 0,
          inputType: ["touch", "pointer"],
          hammerManagerOptions: {
            // css properties were removed due to usablility issue
            // http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html
            cssProps: {
              userSelect: "none",
              touchSelect: "none",
              touchCallout: "none",
              userDrag: "none" } } },

        options);
        this.onPinchStart = this.onPinchStart.bind(this);
        this.onPinchMove = this.onPinchMove.bind(this);
        this.onPinchEnd = this.onPinchEnd.bind(this);
      }var __proto = PinchInput.prototype;
      __proto.mapAxes = function (axes) {
        this.axes = axes;
      };
      __proto.connect = function (observer) {
        var hammerOption = { threshold: this.options.threshold };
        if (this.hammer) {// for sharing hammer instance.
          // hammer remove previous PinchRecognizer.
          this.removeRecognizer();
          this.dettachEvent();
        } else
        {
          var keyValue = this.element[UNIQUEKEY];
          if (!keyValue) {
            keyValue = String(Math.round(Math.random() * new Date().getTime()));
          }
          var inputClass = convertInputType(this.options.inputType);
          if (!inputClass) {
            throw new Error("Wrong inputType parameter!");
          }
          this.hammer = createHammer(this.element, __assign({
            inputClass: inputClass },
          this.options.hammerManagerOptions));
          this.element[UNIQUEKEY] = keyValue;
        }
        this.pinchRecognizer = new hammerjs.Pinch(hammerOption);
        this.hammer.add(this.pinchRecognizer);
        this.attachEvent(observer);
        return this;
      };
      __proto.disconnect = function () {
        this.removeRecognizer();
        if (this.hammer) {
          this.hammer.remove(this.pinchRecognizer);
          this.pinchRecognizer = null;
          this.dettachEvent();
        }
        return this;
      };
      /**
         * Destroys elements, properties, and events used in a module.
         * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.
         * @method eg.Axes.PinchInput#destroy
         */
      __proto.destroy = function () {
        this.disconnect();
        if (this.hammer && this.hammer.recognizers.length === 0) {
          this.hammer.destroy();
        }
        delete this.element[UNIQUEKEY];
        this.element = null;
        this.hammer = null;
      };
      __proto.removeRecognizer = function () {
        if (this.hammer && this.pinchRecognizer) {
          this.hammer.remove(this.pinchRecognizer);
          this.pinchRecognizer = null;
        }
      };
      __proto.onPinchStart = function (event) {
        this._base = this.observer.get(this)[this.axes[0]];
        var offset = this.getOffset(event.scale);
        this.observer.hold(this, event);
        this.observer.change(this, event, toAxis(this.axes, [offset]));
        this._prev = event.scale;
      };
      __proto.onPinchMove = function (event) {
        var offset = this.getOffset(event.scale, this._prev);
        this.observer.change(this, event, toAxis(this.axes, [offset]));
        this._prev = event.scale;
      };
      __proto.onPinchEnd = function (event) {
        var offset = this.getOffset(event.scale, this._prev);
        this.observer.change(this, event, toAxis(this.axes, [offset]));
        this.observer.release(this, event, toAxis(this.axes, [0]), 0);
        this._base = null;
        this._prev = null;
      };
      __proto.getOffset = function (pinchScale, prev) {
        if (prev === void 0) {prev = 1;}
        return this._base * (pinchScale - prev) * this.options.scale;
      };
      __proto.attachEvent = function (observer) {
        this.observer = observer;
        this.hammer.on("pinchstart", this.onPinchStart).
        on("pinchmove", this.onPinchMove).
        on("pinchend", this.onPinchEnd);
      };
      __proto.dettachEvent = function () {
        this.hammer.off("pinchstart", this.onPinchStart).
        off("pinchmove", this.onPinchMove).
        off("pinchend", this.onPinchEnd);
        this.observer = null;
        this._prev = null;
      };
      /**
          * Enables input devices
          * @ko 입력 장치를 사용할 수 있게 한다
          * @method eg.Axes.PinchInput#enable
          * @return {eg.Axes.PinchInput} An instance of a module itself <ko>모듈 자신의 인스턴스</ko>
          */
      __proto.enable = function () {
        this.hammer && (this.hammer.get("pinch").options.enable = true);
        return this;
      };
      /**
          * Disables input devices
          * @ko 입력 장치를 사용할 수 없게 한다.
          * @method eg.Axes.PinchInput#disable
          * @return {eg.Axes.PinchInput} An instance of a module itself <ko>모듈 자신의 인스턴스</ko>
          */
      __proto.disable = function () {
        this.hammer && (this.hammer.get("pinch").options.enable = false);
        return this;
      };
      /**
          * Returns whether to use an input device
          * @ko 입력 장치를 사용 여부를 반환한다.
          * @method eg.Axes.PinchInput#isEnable
          * @return {Boolean} Whether to use an input device <ko>입력장치 사용여부</ko>
          */
      __proto.isEnable = function () {
        return !!(this.hammer && this.hammer.get("pinch").options.enable);
      };
      return PinchInput;
    }();

    /**
                                           * @typedef {Object} WheelInputOption The option object of the eg.Axes.WheelInput module
                                           * @ko eg.Axes.WheelInput 모듈의 옵션 객체
                                           * @property {Number} [scale=1] Coordinate scale that a user can move<ko>사용자의 동작으로 이동하는 좌표의 배율</ko>
                                          **/
    /**
                                               * @class eg.Axes.WheelInput
                                               * @classdesc A module that passes the amount of change to eg.Axes when the mouse wheel is moved. use one axis.
                                               * @ko 마우스 휠이 움직일때의 변화량을 eg.Axes에 전달하는 모듈. 한 개 의 축을 사용한다.
                                               *
                                               * @example
                                               * const wheel = new eg.Axes.WheelInput("#area", {
                                               * 		scale: 1
                                               * });
                                               *
                                               * // Connect 'something' axis when the mousewheel is moved.
                                               * axes.connect("something", wheel);
                                               *
                                               * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.WheelInput module <ko>eg.Axes.WheelInput 모듈을 사용할 엘리먼트</ko>
                                               * @param {WheelInputOption} [options] The option object of the eg.Axes.WheelInput module<ko>eg.Axes.WheelInput 모듈의 옵션 객체</ko>
                                               */
    var WheelInput = /*#__PURE__*/function () {
      function WheelInput(el, options) {
        this.axes = [];
        this.element = null;
        this._isEnabled = false;
        this._isHolded = false;
        this._timer = null;
        this.element = $(el);
        this.options = __assign({
          scale: 1,
          useNormalized: true },
        options);
        this.onWheel = this.onWheel.bind(this);
      }var __proto = WheelInput.prototype;
      __proto.mapAxes = function (axes) {
        this.axes = axes;
      };
      __proto.connect = function (observer) {
        this.dettachEvent();
        this.attachEvent(observer);
        return this;
      };
      __proto.disconnect = function () {
        this.dettachEvent();
        return this;
      };
      /**
         * Destroys elements, properties, and events used in a module.
         * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.
         * @method eg.Axes.WheelInput#destroy
         */
      __proto.destroy = function () {
        this.disconnect();
        this.element = null;
      };
      __proto.onWheel = function (event) {
        var _this = this;
        if (!this._isEnabled) {
          return;
        }
        event.preventDefault();
        if (event.deltaY === 0) {
          return;
        }
        if (!this._isHolded) {
          this.observer.hold(this, event);
          this._isHolded = true;
        }
        var offset = (event.deltaY > 0 ? -1 : 1) * this.options.scale * (this.options.useNormalized ? 1 : Math.abs(event.deltaY));
        this.observer.change(this, event, toAxis(this.axes, [offset]));
        clearTimeout(this._timer);
        this._timer = setTimeout(function () {
          if (_this._isHolded) {
            _this._isHolded = false;
            _this.observer.release(_this, event, toAxis(_this.axes, [0]));
          }
        }, 50);
      };
      __proto.attachEvent = function (observer) {
        this.observer = observer;
        this.element.addEventListener("wheel", this.onWheel);
        this._isEnabled = true;
      };
      __proto.dettachEvent = function () {
        this.element.removeEventListener("wheel", this.onWheel);
        this._isEnabled = false;
        this.observer = null;
        if (this._timer) {
          clearTimeout(this._timer);
          this._timer = null;
        }
      };
      /**
          * Enables input devices
          * @ko 입력 장치를 사용할 수 있게 한다
          * @method eg.Axes.WheelInput#enable
          * @return {eg.Axes.WheelInput} An instance of a module itself <ko>모듈 자신의 인스턴스</ko>
          */
      __proto.enable = function () {
        this._isEnabled = true;
        return this;
      };
      /**
          * Disables input devices
          * @ko 입력 장치를 사용할 수 없게 한다.
          * @method eg.Axes.WheelInput#disable
          * @return {eg.Axes.WheelInput} An instance of a module itself <ko>모듈 자신의 인스턴스</ko>
          */
      __proto.disable = function () {
        this._isEnabled = false;
        return this;
      };
      /**
          * Returns whether to use an input device
          * @ko 입력 장치를 사용 여부를 반환한다.
          * @method eg.Axes.WheelInput#isEnable
          * @return {Boolean} Whether to use an input device <ko>입력장치 사용여부</ko>
          */
      __proto.isEnable = function () {
        return this._isEnabled;
      };
      return WheelInput;
    }();

    var KEY_LEFT_ARROW = 37;
    var KEY_A = 65;
    var KEY_UP_ARROW = 38;
    var KEY_W = 87;
    var KEY_RIGHT_ARROW = 39;
    var KEY_D = 68;
    var KEY_DOWN_ARROW = 40;
    var KEY_S = 83;
    var DIRECTION_REVERSE = -1;
    var DIRECTION_FORWARD = 1;
    var DIRECTION_HORIZONTAL = -1;
    var DIRECTION_VERTICAL = 1;
    var DELAY = 80;
    /**
                     * @typedef {Object} MoveKeyInputOption The option object of the eg.Axes.MoveKeyInput module
                     * @ko eg.Axes.MoveKeyInput 모듈의 옵션 객체
                     * @property {Array<Number>} [scale] Coordinate scale that a user can move<ko>사용자의 동작으로 이동하는 좌표의 배율</ko>
                     * @property {Number} [scale[0]=1] Coordinate scale for the first axis<ko>첫번째 축의 배율</ko>
                     * @property {Number} [scale[1]=1] Coordinate scale for the decond axis<ko>두번째 축의 배율</ko>
                    **/
    /**
                         * @class eg.Axes.MoveKeyInput
                         * @classdesc A module that passes the amount of change to eg.Axes when the move key stroke is occured. use two axis.
                         * @ko 이동키 입력이 발생했을 때의 변화량을 eg.Axes에 전달하는 모듈. 두 개 의 축을 사용한다.
                         *
                         * @example
                         * const moveKey = new eg.Axes.MoveKeyInput("#area", {
                         * 		scale: [1, 1]
                         * });
                         *
                         * // Connect 'x', 'y' axes when the moveKey is pressed.
                         * axes.connect(["x", "y"], moveKey);
                         *
                         * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.MoveKeyInput module <ko>eg.Axes.MoveKeyInput 모듈을 사용할 엘리먼트</ko>
                         * @param {MoveKeyInputOption} [options] The option object of the eg.Axes.MoveKeyInput module<ko>eg.Axes.MoveKeyInput 모듈의 옵션 객체</ko>
                         */
    var MoveKeyInput = /*#__PURE__*/function () {
      function MoveKeyInput(el, options) {
        this.axes = [];
        this.element = null;
        this._isEnabled = false;
        this._isHolded = false;
        this._timer = null;
        this.element = $(el);
        this.options = __assign({
          scale: [1, 1] },
        options);
        this.onKeydown = this.onKeydown.bind(this);
        this.onKeyup = this.onKeyup.bind(this);
      }var __proto = MoveKeyInput.prototype;
      __proto.mapAxes = function (axes) {
        this.axes = axes;
      };
      __proto.connect = function (observer) {
        this.dettachEvent();
        // add tabindex="0" to the container for making it focusable
        if (this.element.getAttribute("tabindex") !== "0") {
          this.element.setAttribute("tabindex", "0");
        }
        this.attachEvent(observer);
        return this;
      };
      __proto.disconnect = function () {
        this.dettachEvent();
        return this;
      };
      /**
         * Destroys elements, properties, and events used in a module.
         * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.
         * @method eg.Axes.MoveKeyInput#destroy
         */
      __proto.destroy = function () {
        this.disconnect();
        this.element = null;
      };
      __proto.onKeydown = function (e) {
        if (!this._isEnabled) {
          return;
        }
        var isMoveKey = true;
        var direction = DIRECTION_FORWARD;
        var move = DIRECTION_HORIZONTAL;
        switch (e.keyCode) {
          case KEY_LEFT_ARROW:
          case KEY_A:
            direction = DIRECTION_REVERSE;
            break;
          case KEY_RIGHT_ARROW:
          case KEY_D:
            break;
          case KEY_DOWN_ARROW:
          case KEY_S:
            direction = DIRECTION_REVERSE;
            move = DIRECTION_VERTICAL;
            break;
          case KEY_UP_ARROW:
          case KEY_W:
            move = DIRECTION_VERTICAL;
            break;
          default:
            isMoveKey = false;}

        if (move === DIRECTION_HORIZONTAL && !this.axes[0] ||
        move === DIRECTION_VERTICAL && !this.axes[1]) {
          isMoveKey = false;
        }
        if (!isMoveKey) {
          return;
        }
        var offsets = move === DIRECTION_HORIZONTAL ? [+this.options.scale[0] * direction, 0] : [0, +this.options.scale[1] * direction];
        if (!this._isHolded) {
          this.observer.hold(this, event);
          this._isHolded = true;
        }
        clearTimeout(this._timer);
        this.observer.change(this, event, toAxis(this.axes, offsets));
      };
      __proto.onKeyup = function (e) {
        var _this = this;
        if (!this._isHolded) {
          return;
        }
        clearTimeout(this._timer);
        this._timer = setTimeout(function () {
          _this.observer.release(_this, e, toAxis(_this.axes, [0, 0]));
          _this._isHolded = false;
        }, DELAY);
      };
      __proto.attachEvent = function (observer) {
        this.observer = observer;
        this.element.addEventListener("keydown", this.onKeydown, false);
        this.element.addEventListener("keypress", this.onKeydown, false);
        this.element.addEventListener("keyup", this.onKeyup, false);
        this._isEnabled = true;
      };
      __proto.dettachEvent = function () {
        this.element.removeEventListener("keydown", this.onKeydown, false);
        this.element.removeEventListener("keypress", this.onKeydown, false);
        this.element.removeEventListener("keyup", this.onKeyup, false);
        this._isEnabled = false;
        this.observer = null;
      };
      /**
          * Enables input devices
          * @ko 입력 장치를 사용할 수 있게 한다
          * @method eg.Axes.MoveKeyInput#enable
          * @return {eg.Axes.MoveKeyInput} An instance of a module itself <ko>모듈 자신의 인스턴스</ko>
          */
      __proto.enable = function () {
        this._isEnabled = true;
        return this;
      };
      /**
          * Disables input devices
          * @ko 입력 장치를 사용할 수 없게 한다.
          * @method eg.Axes.MoveKeyInput#disable
          * @return {eg.Axes.MoveKeyInput} An instance of a module itself <ko>모듈 자신의 인스턴스</ko>
          */
      __proto.disable = function () {
        this._isEnabled = false;
        return this;
      };
      /**
          * Returns whether to use an input device
          * @ko 입력 장치를 사용 여부를 반환한다.
          * @method eg.Axes.MoveKeyInput#isEnable
          * @return {Boolean} Whether to use an input device <ko>입력장치 사용여부</ko>
          */
      __proto.isEnable = function () {
        return this._isEnabled;
      };
      return MoveKeyInput;
    }();

    Axes.PanInput = PanInput;
    Axes.RotatePanInput = RotatePanInput;
    Axes.PinchInput = PinchInput;
    Axes.WheelInput = WheelInput;
    Axes.MoveKeyInput = MoveKeyInput;

    return Axes;

})));
//# sourceMappingURL=axes.js.map