UNPKG

routebar

Version:

A visual component for navigating between panel cells containing user content.

6 lines 62.5 kB
var rb=function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=13)}([function(t,e,n){var i,r;i=[],void 0!==(r=function(){function t(e){this.name=this.name||"CustomError",this.property=e,this.message=this.name+": "+e,Error.captureStackTrace?Error.captureStackTrace(this,t):this.stack=(new Error).stack}function e(e,n){n="function"==typeof n?"function() {...}":JSON.stringify(n),n='wrong function argument "'+e+'": '+n,this.name="ArgumentError",t.apply(this,[n])}function n(e,n){this.name="PathNotFoundError";var i="path not found: from "+e.toString()+" to "+n.toString();t.apply(this,[i])}function i(e){this.name="FatalError",t.apply(this,arguments)}function r(e,n){this.name="NotRealizedError";var i="Not realized "+e+":"+n;t.apply(this,[i])}return e.prototype=Object.create(t.prototype),e.prototype.constructor=e,n.prototype=Object.create(t.prototype),n.prototype.constructor=n,i.prototype=Object.create(t.prototype),i.prototype.constructor=i,r.prototype=Object.create(t.prototype),r.prototype.constructor=r,{ArgumentError:e,PathNotFoundError:n,NotRealizedError:r,FatalError:i}}.apply(e,i))&&(t.exports=r)},function(t,e,n){var i,r;i=[n(0)],void 0!==(r=function(t){"use strict";function e(e){if("left"===e)return"right";if("right"===e)return"left";if("top"===e)return"bottom";if("bottom"===e)return"top";if("center"===e)return"center";throw new t.ArgumentError("side",e)}function n(e){if("left"===e)return"left";if("right"===e)return"left";if("top"===e)return"top";if("bottom"===e)return"top";if("center"===e)return"center";throw new t.ArgumentError("side",e)}function i(t,e){return(t%e+e)%e}function r(t){return t.charAt(0).toUpperCase()+t.slice(1)}function o(t,e){for(var n in e)e.hasOwnProperty(n)&&(t.prototype[n]=e[n])}function s(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t}function a(){}return Array.prototype.find||(Array.prototype.find=function(t){if(null==this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,n=Object(this),i=n.length>>>0,r=arguments[1],o=0;o<i;o++)if(e=n[o],t.call(r,e,o,n))return e}),function(t){t.closest=t.closest||function(t){for(var e=this;e;){if(e.matches(t))return e;e=e.parentElement}return null}}(Element.prototype),{sides:["left","top","right","bottom"],sidesWithCenter:["center","left","top","right","bottom"],isMobile:function(){var t=!1;return function(e){(/(android|ipad|playbook|silk|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4)))&&(t=!0)}(navigator.userAgent||navigator.vendor||window.opera),t}(),nop:a,cycledNumber:i,oppositeSide:e,getStartSide:n,capitalizeFirstLetter:r,mixin:o,inherite:s}}.apply(e,i))&&(t.exports=r)},function(t,e,n){var i,r;i=[n(1),n(0)],void 0!==(r=function(t,e){"use strict";function n(){}return n.prototype.configure=function(t){throw new e.NotRealizedError("IPlugin","configure")},n.prototype.destroy=function(){throw new e.NotRealizedError("IPlugin","destroy")},n}.apply(e,i))&&(t.exports=r)},function(t,e,n){var i,r;i=[n(1),n(2),n(0)],void 0!==(r=function(t,e,n){"use strict";function i(){}return t.inherite(i,e),i.prototype.isEnable=function(){throw new n.NotRealizedError("IControl","isEnable")},i.prototype.enable=function(){throw new n.NotRealizedError("IControl","enable")},i.prototype.disable=function(){throw new n.NotRealizedError("IControl","disable")},i}.apply(e,i))&&(t.exports=r)},function(t,e,n){var i,r;i=[n(0)],void 0!==(r=function(t){"use strict";function e(t,n,i){e._mainScreenSetted||(e._mainScreen=this),this._children=[],this._parents=[];var r,o,s,a;"object"==typeof t?(n=t.children,i=t.parents,r=t.isPermanent,o=t.isDirectedGraph,s=t.defaultChildIndex,a=t.defaultParentIndex,t=t.html):"string"!=typeof t&&(t=""),void 0===r&&(r=e.isPermanent),void 0===o&&(o=e.isDirectedGraph),void 0===s&&(s=e.defaultChildIndex),void 0===a&&(a=e.defaultParentIndex),this._id="screen_"+e._length++,this._html=t,this._temporary=!r,this._isDirectedGraph=!!o,this._defaultChildIndex=s,this._defaultParentIndex=a,this.resetChildren(n),this.resetParents(i)}return e.prototype.toString=function(){return this._id},e.prototype.html=function(t){return"string"==typeof t&&(this._html=t),this._html},e.prototype.isTemporary=function(){return this._temporary},e.prototype.isDirectedGraph=function(){return this._isDirectedGraph},e.prototype.defaultChildIndex=function(t){return"number"==typeof t&&(this._defaultChildIndex=t),this._defaultChildIndex},e.prototype.defaultParentIndex=function(t){return"number"==typeof t&&(this._defaultParentIndex=t),this._defaultParentIndex},e.prototype._addScreen=function(t,e){return e?this.getChildIndex(t)!==-1?console.log('screenModel: "'+t.toString()+'" child screen exists!'):(this._children.push(t),t._parents.push(this)):this.getParentIndex(t)!==-1?console.log('screenModel: "'+t.toString()+'" parent screen exists!'):(this._parents.push(t),t._children.push(this)),this._isDirectedGraph||t._isAddingState||(this._isAddingState=!0,t._addScreen(this,e),this._isAddingState=!1),this},e.prototype._getScreenIndex=function(n,i){var r=-1;if("number"==typeof n){if(isNaN(n))throw new t.ArgumentError("screen",n);r=n}else if("string"==typeof n)n=i.find(function(t,e){if(t.toString()===n)return r=e,!0});else{if(!(n instanceof e))throw new t.ArgumentError("screen",n);r=i.indexOf(n)}return r},e.prototype._removeScreen=function(t,e){var n=e?this._children:this._parents,i=this._getScreenIndex(t,n);if(i!==-1){var r=n.splice(i,1)[0];return e?r.removeParent(this):r.removeChild(this),this._isDirectedGraph||r._removeScreen(this,e),this}},e.prototype.sortChildren=function(t){return this._children=this._children.sort(t),e._runUpdateFn(this),this},e.prototype.childrenLength=function(){return this._children.length},e.prototype.getChildIndex=function(t){return this._getScreenIndex(t,this._children)},e.prototype.getChild=function(t){var e=this.getChildIndex(t);return this._children[e]},e.prototype.removeChild=function(t){return this._removeScreen(t,!0),e._runUpdateFn(this),this},e.prototype.pushChildren=function(n){if(Array.isArray(n))for(var i=0;i<n.length;i++)this._addScreen(n[i],!0);else{if(!(n instanceof e))throw e._runUpdateFn(this),new t.ArgumentError("children",n);this._addScreen(n,!0)}return e._runUpdateFn(this),this},e.prototype.resetChildren=function(t){return this._clearChildren().pushChildren(t||[]),this},e.prototype._clearChildren=function(){for(var t=this._children.length-1;t>=0;t--)this._removeScreen(this._children[t],!0);return this},e.prototype.sortParents=function(t){return this._parents=this._parents.sort(t),e._runUpdateFn(this),this},e.prototype.parentsLength=function(){return this._parents.length},e.prototype.getParentIndex=function(t){return this._getScreenIndex(t,this._parents)},e.prototype.getParent=function(t){var e=this.getParentIndex(t);return this._parents[e]},e.prototype.removeParent=function(t){return this._removeScreen(t,!1),e._runUpdateFn(this),this},e.prototype.pushParents=function(n){if(Array.isArray(n))for(var i=0;i<n.length;i++)this._addScreen(n[i],!1);else{if(!(n instanceof e))throw e._runUpdateFn(this),new t.ArgumentError("parents",n);this._addScreen(n,!1)}return e._runUpdateFn(this),this},e.prototype.resetParents=function(t){return this._clearParents().pushParents(t||[]),this},e.prototype._clearParents=function(){for(var t=this._parents.length-1;t>=0;t--)this._removeScreen(this._parents[t],!1);return this},e.configure=function(t){e.isPermanent=t.isPermanent,e.isDirectedGraph=t.isDirectedGraph,e.defaultChildIndex=t.defaultChildIndex,e.defaultParentIndex=t.defaultParentIndex},e.configure({isPermanent:!1,isDirectedGraph:!0,defaultChildIndex:0,defaultParentIndex:0}),e._length=1,e._relativeUpdateFn=[],e.setMainScreen=function(t){e._mainScreen=t,e._mainScreenSetted=!0},e.getMainScreen=function(){return e._mainScreen},e.registerUpdateFn=function(t){e._relativeUpdateFn.push(t)},e.unregisterUpdateFn=function(t){e._relativeUpdateFn=e._relativeUpdateFn.filter(function(e){return e!==t})},e.clearUpdateFn=function(){e._relativeUpdateFn=[]},e._runUpdateFn=function(t){e._relativeUpdateFn.forEach(function(e){e.call(void 0,t)})},e}.apply(e,i))&&(t.exports=r)},function(t,e,n){var i,r;i=[n(14)],void 0!==(r=function(t){"use strict";function e(e,n){function i(){$(function(){for(var i=$(".rb-wrapper"),r=[],o=0;o<i.length;o++){var s=i.eq(o),a=s.data("id")||s.attr("id")||"instance_"+o;if(void 0===rb.Instances[a]){s.html('<div class="rb"><div tabindex="-1" class="rb__fake-element"></div></div>');var c=s.find(">.rb"),h=new t(c,e&&e[a]);r.push(h._loadingPromise),Object.defineProperty(rb.Instances,a,{value:h,configurable:!0,enumerable:!0})}}Promise.all(r).then(function(){n&&n(rb.Instances)})})}function r(){"undefined"==typeof jQuery?setTimeout(r,0):i()}"function"==typeof e&&(n=e,e=void 0),r()}function n(t){rb.Instances.hasOwnProperty(t)&&(rb.Instances[t].destroy(),delete rb.Instances[t])}function i(t,e){var n=[];for(var i in rb.Instances)if(rb.Instances.hasOwnProperty(i)){var r=rb.Instances[i];n.push(r[t].apply(r,e))}return n}function r(t){i("configure",arguments)}function o(t,e){return Promise.all(i("move",arguments))}function s(){return i("moveBack",arguments)}function a(t){return Promise.all(i("animateWrongSide",arguments))}function c(t,e){return Promise.all(i("setScreen",arguments))}function h(t){i("reload",arguments)}function u(){for(var t in rb.Instances)n(t)}return{init:e,remove:n,Batch:{configure:r,move:o,moveBack:s,animateWrongSide:a,setScreen:c,reload:h,removeAll:u}}}.apply(e,i))&&(t.exports=r)},function(t,e){},function(t,e,n){var i,r;i=[n(1),n(2),n(0),n(18)],void 0!==(r=function(t,e,n){"use strict";function i(t,e){if(this._elementsPool=e,!(t instanceof $))throw new n.ArgumentError("mainDiv",t);this._mainDiv=t}return t.inherite(i,e),i.prototype.configure=function(t){function e(t,e){if("number"==typeof e)return e>0?e:1;if(void 0===e)return 500;throw new n.ArgumentError(t,e)}"object"==typeof t&&(void 0!==t.wrongTime1&&(this._wrongTime1=e("wrongTime1",t.wrongTime1)),void 0!==t.wrongTime2&&(this._wrongTime2=e("wrongTime2",t.wrongTime2)),void 0!==t.correctTime&&(this._correctTime=e("correctTime",t.correctTime)),void 0!==t.wrongEasing1&&(this._wrongEasing1=t.wrongEasing1),void 0!==t.wrongEasing2&&(this._wrongEasing2=t.wrongEasing2),void 0!==t.correctEasing&&(this._correctEasing=t.correctEasing),void 0!==t.showAdjacentScreens&&(this._showAdjacentScreens=t.showAdjacentScreens))},i.prototype._animate=function(e,n,i,r,o,s,a){s&&s();var c,h={};h[t.getStartSide(n)]=i+"%",c={duration:o,easing:r,queue:!1,done:a},e.animate(h,c)},i.prototype._updateState=function(t,e){this._isAnimate&&(this._isAnimate=!1,this._new&&this._new.stop(),this._old&&this._old.stop(!1,!0),this._cur&&this._cur.stop(),this._prev&&this._prev.stop(!1,!0),this._next&&this._next.stop(!1,!0),this._res(!1)),this._isAnimate=!0,this._old=e.oldElem,this._new=e.newElem,this._cur=e.curElem,this._prev=e.prevElem,this._next=e.nextElem,this._res=t},i.prototype.goToWrongSide=function(e){var n=this,i=this._elementsPool.getElementBySide("center"),r=this._elementsPool.getElementBySide(e),o=this._elementsPool.getElementBySide(t.oppositeSide(e));return new Promise(function(t,s){function a(t,i,r,o,s){n._animate(t,e,"+="+c,n._wrongEasing1,n._isAnimate?n._wrongTime1:10,function(){i-=100,r-=100,t.css({left:i+"%",top:r+"%"}),o&&o()},function(){n._animate(t,e,"-="+c,n._wrongEasing2,n._isAnimate?n._wrongTime2:10,void 0,function(){s&&s()})})}n._updateState(t,{curElem:i,prevElem:o,nextElem:r});var c=0,h=0,u=0;"left"===e?(h=-100,c=-10):"right"===e?(h=100,c=10):"top"===e?(u=-100,c=-10):"bottom"===e&&(u=100,c=10),n._showAdjacentScreens&&(a(r,100+h,100+u,function(){r.toggleClass("rb__hiding-screen",!0)},function(){r.toggleClass("rb__hiding-screen",!1)}),a(o,100-h,100-u,function(){o.toggleClass("rb__hiding-screen",!0)},function(){o.toggleClass("rb__hiding-screen",!1)})),a(i,100,100,void 0,function(){n._isAnimate=!1,n._res(!0)})})},i.prototype.goToCorrectSide=function(e){var n=this,i=this._elementsPool.getElementBySide("center"),r=this._elementsPool.getElementBySide(t.oppositeSide(e));return new Promise(function(t,o){function s(t,i,r,o,s){n._animate(t,e,"-="+a,n._correctEasing,n._correctTime,function(){i-=100,r-=100,t.css({left:i+"%",top:r+"%"}),o&&o()},function(){s&&s()})}n._updateState(t,{oldElem:r,newElem:i});var a=0,c=0,h=0;"left"===e?(c=-100,a=-100):"right"===e?(c=100,a=100):"top"===e?(h=-100,a=-100):"bottom"===e&&(h=100,a=100),n._showAdjacentScreens&&s(r,100,100,function(){r.toggleClass("rb__hiding-screen",!0)},function(){r.toggleClass("rb__hiding-screen",!1)}),s(i,100+c,100+h,void 0,function(){n._isAnimate=!1,n._res(!0)})})},i.prototype.goToCenter=function(){this._elementsPool.getElementBySide("center").css({left:"0%",top:"0%"})},i.prototype.destroy=function(){this._new&&this._new.stop(),this._old&&this._old.stop(),this._cur&&this._cur.stop(),this._prev&&this._prev.stop(),this._next&&this._next.stop(),this._res&&this._res(!1)},i}.apply(e,i))&&(t.exports=r)},function(t,e,n){var i,r;i=[n(1),n(3),n(0)],void 0!==(r=function(t,e,n){"use strict";function i(t,e,i){if(!(t instanceof $))throw new n.ArgumentError("mainDiv",t);if("function"!=typeof e)throw new n.ArgumentError("actionFn",e);this._isEnable=!1,this._mainDiv=t.parent(),this._actionFn=e,this._afterRender=i}return t.inherite(i,e),i.prototype.configure=function(t){"object"==typeof t&&(void 0!==t.hideArrowsTime&&(this._hideArrowsTime=t.hideArrowsTime),void 0!==t.showArrowsOutside&&(this._showArrowsOutside=t.showArrowsOutside),void 0!==t.showArrowsOnHover&&(this._showArrowsOnHover=t.showArrowsOnHover),void 0!==t.hideArrowsAfterTime&&(this._hideArrowsAfterTime=t.hideArrowsAfterTime)),this._containerClass=this._showArrowsOnHover?"rb__arrow-container-hover":"rb__arrow-container"},i.prototype.isEnable=function(){return this._isEnable},i.prototype.enable=function(){if(!this._isEnable){var e=this,n=function(t){function n(t){var e=t.clientX,i=t.clientY;a<e&&e<h&&c<i&&i<u||(r.toggleClass("rb__arrow-none",!1),r.toggleClass("rb__arrow-cursor",!0),o.off("mousemove",n))}function i(){r.toggleClass("rb__arrow-none",!0),r.toggleClass("rb__arrow-cursor",!1),o.on("mousemove",n)}if(e._hideArrowsAfterTime){var r=$(t.currentTarget),o=$("body"),s=r.offset(),a=s.left,c=s.top,h=a+r.width(),u=c+r.height();r.length&&(r[0].hideArrowId=setTimeout(i,e._hideArrowsTime))}},i=function(t){if(e._hideArrowsAfterTime){var n=$(t.currentTarget);clearTimeout(n[0].hideArrowId)}},r=function(r){var o=$(r.currentTarget);i(r),e._afterRender.add(n.bind(void 0,r),!0),e._actionFn(o,t.sides,function(t,e){return t.is(".rb__arrow-container_"+e)})},o="";t.sides.forEach(function(t){o+='<div class="'+e._containerClass+" rb__arrow-cursor rb__arrow-container_"+t+(e._showArrowsOutside?" rb__arrow-outside_"+t:"")+'"><div class="rb__arrow rb__arrow_'+t+'"></div></div>'}),this._mainDiv.append($(o));var s=this._mainDiv.find(">."+this._containerClass);s.on("click",r),s.on("mouseenter",n),s.on("mouseleave",i),this._clickHandler=r,this._mouseEnterHandler=n,this._mouseLeaveHandler=i,this._isEnable=!0}},i.prototype.disable=function(){if(this._isEnable){for(var t=this._mainDiv.find(">."+this._containerClass),e=0;e<t.length;e++)clearTimeout(t[e].hideArrowId);t.off("click",this._clickHandler),t.off("mouseenter",this._mouseEnterHandler),t.off("mouseleave",this._mouseLeaveHandler),this._clickHandler=null,this._mouseEnterHandler=null,this._mouseLeaveHandler=null,this._mainDiv.find(">."+this._containerClass).remove(),this._isEnable=!1}},i.prototype.destroy=function(){this.disable()},i}.apply(e,i))&&(t.exports=r)},function(t,e,n){var i,r;i=[n(1),n(2)],void 0!==(r=function(t,e){"use strict";function n(t){this._actions={},this._index=0,this._mainDiv=t}return t.inherite(n,e),n.prototype.configure=function(t){"object"==typeof t&&void 0!==t.loadingDiv&&(this._loadingDiv=$(t.loadingDiv))},n.prototype.add=function(t,e){return"function"==typeof t?(this._actions[this._index++]={action:t,once:e},this._index-1):null},n.prototype.remove=function(t){this._actions.hasOwnProperty(t)&&delete this._actions[t]},n.prototype.runActions=function(t,e){var n=[],i=[],r=this;return Object.keys(this._actions).length?(this._mainDiv.append(this._loadingDiv),Object.keys(this._actions).map(function(t){var r=this._actions[t],o=r.action.apply(void 0,e);r.once&&this.remove(t),o instanceof Promise?n.push(o):i.push(o)}.bind(this)),Promise.all(n).then(function(e){if(r._loadingDiv.remove(),i.concat(e).every(function(t){return t!==!1}))return t&&t()},function(e){if(r._loadingDiv.remove(),console.error(e),i.every(function(t){return t!==!1}))return t&&t()})):t&&t()},n.prototype.destroy=function(){this._actions=null},n}.apply(e,i))&&(t.exports=r)},function(t,e,n){var i,r;i=[],void 0!==(r=function(){"use strict";function t(){this._controls={}}return t.prototype.add=function(t,e,n){return this._controls.hasOwnProperty(t)?console.log("ControlManager - add - control already exists: "+t):(this._controls[t]=e,n&&this.enable(t)),this},t.prototype.remove=function(t){return this._controls.hasOwnProperty(t)?delete this._controls[t]:console.log("ControlManager - remove - control not found: "+t),this},t.prototype.isEnable=function(t){return this._controls.hasOwnProperty(t)?this._controls[t].isEnable():(console.log("ControlManager - isEnable - control not found: "+t),null)},t.prototype.enable=function(t){return this._controls.hasOwnProperty(t)?this._controls[t].enable():console.log("ControlManager - enable - control not found: "+t),this},t.prototype.disable=function(t){return this._controls.hasOwnProperty(t)?this._controls[t].disable():console.log("ControlManager - disable - control not found: "+t),this},t.prototype._doAll=function(t){var e={};for(var n in this._controls)this._controls.hasOwnProperty(n)&&(e[n]=this.isEnable(n),t?this.enable(n):this.disable(n));return e},t.prototype.disableAll=function(){return this._doAll(!1)},t.prototype.enableAll=function(){return this._doAll(!0)},t.prototype.enableByValues=function(t){for(var e in t)t.hasOwnProperty(e)&&(t[e]?this.enable(e):this.disable(e));return this},t.prototype.configure=function(t){for(var e in this._controls)this._controls.hasOwnProperty(e)&&this._controls[e].configure(t)},t.prototype.destroy=function(){this.disableAll(),this._controls=null},t}.apply(e,i))&&(t.exports=r)},function(t,e,n){var i,r;i=[n(1),n(2)],void 0!==(r=function(t,e){"use strict";function n(t,e){this._mainDiv=t,this._screenManager=e,this._elements={},this._elementsBySide={}}return t.inherite(n,e),n.prototype.configure=function(t){"object"==typeof t&&(void 0!==t.loadingHtml&&(this._loadingHtml=t.loadingHtml),void 0!==t.saveHistoryInPool&&(this._saveHistoryInPool=t.saveHistoryInPool))},n.prototype.prepareSide=function(){function t(t){return i._screenManager._getRelativeScreenByScreen(n,t)}function e(t,e){var n,r=e.toString();i._elements.hasOwnProperty(r)?n=i._elements[r].element:(n=$('<div class="rb__side rb__hidden rb__loading" data-id="'+r+'">'+i._loadingHtml+"</div>"),i._mainDiv.prepend(n),i._elements[r]={element:n,screen:e,state:"loading"}),"center"===t&&(n.toggleClass("rb__center",!0),n.toggleClass("rb__hidden",!1)),i._elementsBySide[t]=r}var n=this._screenManager.getCurScreen(),i=this,r=t("left"),o=t("top"),s=t("right"),a=t("bottom");this.getElementBySide("center").toggleClass("rb__center",!1),this._mainDiv.find(">.rb__side").toggleClass("rb__hidden",!0),i._elementsBySide={},n&&e("center",n),r&&e("left",r),o&&e("top",o),s&&e("right",s),a&&e("bottom",a)},n.prototype.getElementBySide=function(t){var e=this._elementsBySide[t];return e?this._elements[e].element:$()},n.prototype.loadElements=function(){var t=this;Object.keys(this._elements).forEach(function(e){var n=t._elements[e];t._elementsBySide.center===e||t._elementsBySide.left===e||t._elementsBySide.top===e||t._elementsBySide.right===e||t._elementsBySide.bottom===e?"loading"===n.state&&(n.element.html(n.screen.html()),n.element.toggleClass("rb__loading",!1),n.state="loaded"):n.screen.isTemporary()&&(t._saveHistoryInPool&&t._screenManager._containsHistory(t._elements[e].screen)||(t._elements[e].element.remove(),delete t._elements[e]))})},n.prototype.destroy=function(){var t=this;Object.keys(this._elements).forEach(function(e){t._elements[e].element.remove()}),this._elements=null,this._elementsBySide=null,this._screenManager=null},n}.apply(e,i))&&(t.exports=r)},function(t,e,n){var i,r;i=[n(1),n(3),n(0)],void 0!==(r=function(t,e,n){"use strict";function i(t,e){if(!(t instanceof $))throw new n.ArgumentError("mainDiv",t);if("function"!=typeof e)throw new n.ArgumentError("actionFn",e);this._isEnable=!1,this._mainDiv=t,this._actionFn=e}return t.inherite(i,e),i.prototype.configure=function(t){"object"==typeof t&&(void 0!==t.leftKey&&(this._leftKey=t.leftKey),void 0!==t.topKey&&(this._topKey=t.topKey),void 0!==t.rightKey&&(this._rightKey=t.rightKey),void 0!==t.bottomKey&&(this._bottomKey=t.bottomKey))},i.prototype.isEnable=function(){return this._isEnable},i.prototype.enable=function(){if(!this._isEnable){var t=this,e=function(e){t._actionFn(e.which,[t._leftKey,t._topKey,t._rightKey,t._bottomKey],function(t,e){return t===e}),t._actionFn(e.key,[t._leftKey,t._topKey,t._rightKey,t._bottomKey],function(t,e){return t===e}),e.stopPropagation()},n=function(t){e(t)};this._mainDiv.on("keydown",n),this._mainDivHandler=n,this._isEnable=!0}},i.prototype.disable=function(){this._isEnable&&(this._mainDiv.off("keydown",this._mainDivHandler),this._mainDivHandler=null,this._isEnable=!1)},i.prototype.destroy=function(){this.disable()},i}.apply(e,i))&&(t.exports=r)},function(t,e,n){var i,r;i=[n(4),n(5),n(2),n(3),n(6)],void 0!==(r=function(t,e,n,i){"use strict";return Object.create(null,{Screen:{value:t},start:{value:e.init},remove:{value:e.remove},Instances:{value:{}},Batch:{value:e.Batch},IPlugin:{value:n},IControl:{value:i}})}.apply(e,i))&&(t.exports=r)},function(t,e,n){var i,r;i=[n(0),n(2),n(4),n(7),n(15),n(9),n(10),n(16),n(8),n(12),n(11),n(1)],void 0!==(r=function(t,e,n,i,r,o,s,a,c,h,u,l){"use strict";function p(e,p){if(!(e instanceof $))throw new t.ArgumentError("mainDiv",e);this._mainDiv=e,this.beforeMoveDispatcher=new o(e),this.beforeRenderDispatcher=new o(e),this.afterRenderDispatcher=new o(e),this._screenManager=new r,this._elementsPool=new u(e,this._screenManager),this._animation=new i(e,this._elementsPool),this._controlManager=new s,l.isMobile?this._controlManager.add("swipes",new a(e,this._moveByActionValue.bind(this))):this._controlManager.add("arrows",new c(e,this._moveByActionValue.bind(this),this.afterRenderDispatcher)).add("keyboard",new h(e,this._moveByActionValue.bind(this))),this._plugins=[],this.resetConfig(),this._loadingPromise=this.setScreen(p||n.getMainScreen(),!1),this._controlManager.enableAll();var f=this;this._clickHandler=function(t){$(t.target).closest(".rb").length&&!$(document.activeElement).closest(".rb").length&&f.activate()},e.on("click",this._clickHandler),this._relativeUpdateFn=this._reloadScreen.bind(this),n.registerUpdateFn(this._relativeUpdateFn)}var f=l.sidesWithCenter;return p.prototype.resetConfig=function(){this.configure({wrongTime1:500,wrongTime2:500,correctTime:1e3,wrongEasing1:"easeInExpo",wrongEasing2:"easeOutElastic",correctEasing:"easeOutExpo",hideArrowsAfterTime:!0,hideArrowsTime:2e3,showArrowsOutside:!0,showArrowsOnHover:!0,loadingHtml:'<div class="rb__loading_wrapper"><div class="rb__loader"></div></div>',leftKey:[37,"a"],topKey:[38,"w"],rightKey:[39,"d"],bottomKey:[40,"s"],maxHistoryLength:10,lockControls:!1,showAdjacentScreens:!0,saveHistoryInPool:!1,pointersForSwipe:1,isDirectPath:!0,savePrevious:!0,cyclicStep:!0,getRight:function(t){var e=t.defaultChildIndex();return t.getChild(e)},getLeft:function(t){var e=t.defaultParentIndex();return t.getParent(e)},getTop:function(t,e){function n(t,n){return e?l.cycledNumber(t-1,n):t-1}var i;if("left"===this._lastSide)return i=this._lastScreen.getParentIndex(t),this._lastScreen.getParent(n(i,this._lastScreen.parentsLength()));if("right"===this._lastSide)return i=this._lastScreen.getChildIndex(t),this._lastScreen.getChild(n(i,this._lastScreen.childrenLength()));var r=this._getLeft(t);if(r)return i=r.getChildIndex(t),r.getChild(n(i,r.childrenLength()));var o=this._getRight(t);return o?(i=o.getParentIndex(t),o.getParent(n(i,o.parentsLength()))):void 0},getBottom:function(t,e){function n(t,n){return e?l.cycledNumber(t+1,n):t+1}var i;if("left"===this._lastSide)return i=this._lastScreen.getParentIndex(t),this._lastScreen.getParent(n(i,this._lastScreen.parentsLength()));if("right"===this._lastSide)return i=this._lastScreen.getChildIndex(t),this._lastScreen.getChild(n(i,this._lastScreen.childrenLength()));var r=this._getLeft(t);if(r)return i=r.getChildIndex(t),r.getChild(n(i,r.childrenLength()));var o=this._getRight(t);return o?(i=o.getParentIndex(t),o.getParent(n(i,o.parentsLength()))):void 0}})},p.prototype.configure=function(t){t&&(this._plugins.forEach(function(e){e.configure(t)}),this._animation.configure(t),this._elementsPool.configure(t),this._screenManager.configure(t),this._controlManager.configure(t),t.loadingHtml?t.loadingDiv='<div class="rb__loading">'+t.loadingHtml+"</div>":null===t.loadingHtml&&(t.loadingDiv=""),this.beforeMoveDispatcher.configure(t),this.beforeRenderDispatcher.configure(t),this.afterRenderDispatcher.configure(t),"object"==typeof t&&void 0!==t.lockControls&&(this._lockControls=t.lockControls),this._screenManager.getCurScreen()&&this._reloadScreen())},p.prototype.getControlManager=function(){return this._controlManager},p.prototype.getScreenManager=function(){return this._screenManager},p.prototype.move=function(t,e){var n=this,i=this._screenManager.getCurScreen();if(t){var r=n._screenManager.getRelativeScreen(t),o=!r;return Promise.race([this.beforeMoveDispatcher.runActions(n._moveInner.bind(n,t,i,e),[t,n,o])])}},p.prototype._moveInner=function(e,n,i){var r=this;return i=i!==!1,this._lockControls&&!this._locks&&(this._locks=this._controlManager.disableAll()),this._screenManager._updateScreens("center",n,i),new Promise(function(n,o){var s=r._screenManager.getRelativeScreen(e),a=r._screenManager.getCurScreen();s?"center"===e?(r._elementsPool.prepareSide(),r._animation.goToCenter(),r._renderHtml(e,n.bind(void 0,{how:"center",isOk:!0}))):f.indexOf(e)!==-1?("left"!==e&&"right"!==e||(r._screenManager._lastSide=e,r._screenManager._lastScreen=a),r.getScreenManager()._setRelativeScreen(e,s,a,!0,!0),r._screenManager._updateScreens(e,void 0,i),r._elementsPool.prepareSide(),r._animation.goToCorrectSide(e).then(function(t){t&&r._renderHtml(e,n.bind(void 0,{how:"correctSide",isOk:t}))})):o(new t.ArgumentError("side",e)):r._animation.goToWrongSide(e).then(function(t){t&&r._renderHtml(e,n.bind(void 0,{how:"wrongSide",isOk:t}))})})},p.prototype._moveByActionValue=function(t,e,n){function i(t,e){var i;return Array.isArray(e)?(i=e.find(function(e){return n(t,e)}),i=void 0!==i):i=n(t,e),i}var r;return i(t,e[0])?r="left":i(t,e[1])?r="top":i(t,e[2])?r="right":i(t,e[3])&&(r="bottom"),this.move(r)},p.prototype.moveBack=function(){var t=this._screenManager.popHistory();if(t){var e=this._screenManager.getCurScreen(),n=t.screen,i=t.side,r=!1;if("left"===i&&e.getParent(n))r=!0;else if("right"===i&&e.getChild(n))r=!0;else if("bottom"===i&&this._screenManager._getBottom(e,this._screenManager._cyclicStep)===n)r=!0;else{if("top"!==i||this._screenManager._getTop(e,this._screenManager._cyclicStep)!==n)return null;r=!0}r&&this.getScreenManager()._setRelativeScreen(i,e,n);var o=this;if(i)return Promise.race([this.beforeMoveDispatcher.runActions(o._moveInner.bind(o,t.side,e,!1),[i,o,null])])}return null},p.prototype.animateWrongSide=function(t){return this._animation.goToWrongSide(t)},p.prototype.setScreen=function(t,e){return this._moveInner("center",t,e)},p.prototype._reloadScreen=function(){return this.setScreen(this._screenManager.getCurScreen(),!1)},p.prototype.reload=function(t){t=t||"center";var e=this._elementsPool.getElementBySide(t),n=this._screenManager.getRelativeScreen(t);e.html(n.html())},p.prototype._renderHtml=function(t,e){function n(){i.activate(),i.afterRenderDispatcher.runActions(l.nop,r),i._lockControls&&(i._controlManager.enableByValues(i._locks),i._locks=null),e()}var i=this,r=[t,i];this.beforeRenderDispatcher.runActions(function(){var t,e,r=0;e=i._mainDiv.find("iframe"),i._elementsPool.loadElements(),e=i._mainDiv.find("iframe").not(e),t=e.length,e.one("load",function(){r++,t===r&&n()}),setTimeout(function(){0===t&&n()},0)},r)},p.prototype.activate=function(){this._mainDiv.find(">.rb__fake-element").focus()},p.prototype.goToScreen=function(e){function n(s,a,c,h){if(!s)return i._controlManager.enableByValues(r),void h(new t.PathNotFoundError(o,e));if(a===s.length-1)return i._controlManager.enableByValues(r),void c();if(a>s.length-1)return i._controlManager.enableByValues(r),void h(new t.FatalError("goToScreen : i > path.length - 1"));var u,l=s[a],p=s[a+1];l.getChild(p)?u="right":l.getParent(p)?u="left":i._screenManager._getBottom(l,i._screenManager._cyclicStep)===p?u="bottom":i._screenManager._getTop(l,i._screenManager._cyclicStep)===p?u="top":(i._controlManager.enableByValues(r),h(new t.FatalError("goToScreen : side not found"))),i.getScreenManager()._setRelativeScreen(u,l,p,!0),i.afterRenderDispatcher.add(function(){i.afterRenderDispatcher.add(function(){n(s,a+1,c,h)},!0),i.move(u)},!0),i.setScreen(l,!1)}var i=this,r=this._controlManager.disableAll(),o=this._screenManager.getCurScreen(),s=this._screenManager.findShortestPath(o,e);return function(t){return new Promise(function(e,i){n(t,0,e,i)})}(s)},p.prototype.addPlugin=function(t){t instanceof e?this._plugins.push(t):console.error("Moving - addPlugin - argument must be IPlugin")},p.prototype.removePlugin=function(t){var e=this._plugins.indexOf(t);e!=-1&&(t.destroy(),this._plugins.splice(e,1))},p.prototype.destroy=function(){n.unregisterUpdateFn(this._relativeUpdateFn),this._plugins.forEach(function(t){t.destroy()}),this.beforeMoveDispatcher.destroy(),this.beforeRenderDispatcher.destroy(),this.afterRenderDispatcher.destroy(),this._animation.destroy(),this._controlManager.destroy(),this._screenManager.destroy(),this._elementsPool.destroy(),this._animation=null,this._elementsPool=null,this._screenManager=null,this._controlManager=null,this.beforeMoveDispatcher=null,this.beforeRenderDispatcher=null,this.afterRenderDispatcher=null,this._mainDiv.off("click",this._clickHandler),this._mainDiv.remove()},p}.apply(e,i))&&(t.exports=r)},function(t,e,n){var i,r;i=[n(1),n(4),n(2),n(0)],void 0!==(r=function(t,e,n,i){"use strict";function r(){this._history=[],this._curScreen=null,this._relativeUpdateFn=this._updateRelativeScreen.bind(this),e.registerUpdateFn(this._relativeUpdateFn)}return t.inherite(r,n),r.prototype.configure=function(t){if("object"==typeof t){if(void 0!==t.maxHistoryLength){if(!("number"==typeof t.maxHistoryLength&&t.maxHistoryLength>=0))throw new i.ArgumentError("maxHistoryLength",t.maxHistoryLength);this._maxHistoryLength=t.maxHistoryLength,this._history.length>this._maxHistoryLength&&(this._history=this._history.slice(this._history.length-this._maxHistoryLength))}void 0!==t.isDirectPath&&(this._isDirectPath=t.isDirectPath),void 0!==t.cyclicStep&&(this._cyclicStep=t.cyclicStep),void 0!==t.getLeft&&(this._getLeft=t.getLeft),void 0!==t.getRight&&(this._getRight=t.getRight),void 0!==t.getTop&&(this._getTop=t.getTop),void 0!==t.getBottom&&(this._getBottom=t.getBottom),void 0!==t.savePrevious&&(this._savePrevious=t.savePrevious)}},r.prototype._updateScreens=function(e,n,i){var r=!1;if(n)this._curScreen!==n&&(r=!0),this._curScreen=n;else if(this.getRelativeScreen(e)){var o=this._curScreen;this._curScreen=this.getRelativeScreen(e),"center"!==e&&(r=!0)}return r&&i!==!1&&(this._history.push({screen:o,side:t.oppositeSide(e),lastSide:this._lastSide,lastScreen:this._lastScreen}),this._history.length>this._maxHistoryLength&&this._history.shift()),this._curScreen},r.prototype._getRelativeScreenByScreen=function(n,r){if(!(n instanceof e))throw new i.ArgumentError("screen",n);if(t.sidesWithCenter.indexOf(r)===-1)throw new i.ArgumentError("side",r);return"center"===r?n:"left"===r?this._getLeft(n):"top"===r?this._getTop(n,this._cyclicStep):"right"===r?this._getRight(n):"bottom"===r?this._getBottom(n,this._cyclicStep):null},r.prototype._setRelativeScreen=function(t,n,r,o,s){if(!(r instanceof e))throw new i.ArgumentError("targetScreen",r);if(!(n instanceof e))throw new i.ArgumentError("baseScreen",n);var a=!o||this._savePrevious;if(t===(s?"left":"right")&&a){var c=n.getChildIndex(r);if(c===-1)throw new i.FatalError("Base screen is "+n.toString()+". Child screen not found: ",r.toString());n.defaultChildIndex(c)}if(t===(s?"right":"left")&&a){var h=n.getParentIndex(r);if(h===-1)throw new i.FatalError("Base screen is "+n.toString()+". Parent screen not found: ",r.toString());n.defaultParentIndex(h)}},r.prototype._updateRelativeScreen=function(t){if(!(t instanceof e))throw new i.ArgumentError("screen",t);this._getRight(t)||t.defaultChildIndex(0),this._getLeft(t)||t.defaultParentIndex(0)},r.prototype.getCurScreen=function(){return this._curScreen},r.prototype.getRelativeScreen=function(t){return this._getRelativeScreenByScreen(this._curScreen,t)},r.prototype.clearHistory=function(){this._history=[]},r.prototype.popHistory=function(){var t=this._history.pop();return t?(this._lastSide=t.lastSide,this._lastScreen=t.lastScreen):(this._lastSide=null,this._lastScreen=null),t},r.prototype._containsHistory=function(t){return this._history.some(function(e){return e.screen===t})},r.prototype.findShortestPath=function(t,e){var n=this,i=function(t,e){var i,r={},o={0:[t]},s={};for(r[t]=0;o&&(i=Object.keys(o)).length;){i.sort(function(t,e){return t-e});var a,c=i[0],h=o[c],u=h.shift(),l=+c;a=n._isDirectPath?u&&u._children.concat(u._parents).concat(n._getRelativeScreenByScreen(u,"top")).concat(n._getRelativeScreenByScreen(u,"bottom"))||[]:u&&[n._getRelativeScreenByScreen(u,"left"),n._getRelativeScreenByScreen(u,"top"),n._getRelativeScreenByScreen(u,"right"),n._getRelativeScreenByScreen(u,"bottom")]||[],h.length||delete o[c];for(var p=0;p<a.length;p++){var f=a[p],d=l+1,g=r[f];(void 0===g||g>d)&&(r[f]=d,function(t,e){o[t]||(o[t]=[]),o[t].push(e)}(d,f),s[f]=u)}}return void 0===r[e]?null:s}(t,e);return i?function(t,e){for(var n=[],i=e;i;)n.push(i),i=t[i];return n.reverse(),n}(i,e):null},r.prototype.destroy=function(){e.unregisterUpdateFn(this._relativeUpdateFn),this._history=null,this._curScreen=null},r}.apply(e,i))&&(t.exports=r)},function(t,e,n){var i,r;i=[n(1),n(3),n(0),n(17)],void 0!==(r=function(t,e,n,i){"use strict";function r(t,e){if(!(t instanceof $))throw new n.ArgumentError("mainDiv",t);if("function"!=typeof e)throw new n.ArgumentError("actionFn",e);this._isEnable=!1,this._mainDiv=t,this._actionFn=e,this._hammertime=new i(t[0]),this._hammertime.get("swipe").set({direction:i.DIRECTION_ALL})}return t.inherite(r,e),r.prototype.configure=function(t){"object"==typeof t&&void 0!==t.pointersForSwipe&&this._hammertime.get("swipe").set({pointers:t.pointersForSwipe})},r.prototype.isEnable=function(){return this._isEnable},r.prototype.enable=function(){function t(t){e._mainDiv.is(t.target.closest(".rb"))&&e._actionFn(t.direction,[i.DIRECTION_RIGHT,i.DIRECTION_DOWN,i.DIRECTION_LEFT,i.DIRECTION_UP],function(t,e){return t===e}),t.preventDefault(),t.srcEvent.stopPropagation()}if(!this._isEnable){var e=this;this._hammertime.on("swipe",t),this._swipeHandler=t,this._isEnable=!0}},r.prototype.disable=function(){this._isEnable&&(this._hammertime.off("swipe",this._swipeHandler),this._swipeHandler=null,this._isEnable=!1)},r.prototype.destroy=function(){this.disable()},r}.apply(e,i))&&(t.exports=r)},function(t,e,n){var i;/*! Hammer.JS - v2.0.8 - 2016-04-23 * http://hammerjs.github.io/ * * Copyright (c) 2016 Jorik Tangelder; * Licensed under the MIT license */ !function(r,o,s,a){"use strict";function c(t,e,n){return setTimeout(f(t,n),e)}function h(t,e,n){return!!Array.isArray(t)&&(u(t,n[e],n),!0)}function u(t,e,n){var i;if(t)if(t.forEach)t.forEach(e,n);else if(t.length!==a)for(i=0;i<t.length;)e.call(n,t[i],i,t),i++;else for(i in t)t.hasOwnProperty(i)&&e.call(n,t[i],i,t)}function l(t,e,n){var i="DEPRECATED METHOD: "+e+"\n"+n+" AT \n";return function(){var e=new Error("get-stack-trace"),n=e&&e.stack?e.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=r.console&&(r.console.warn||r.console.log);return o&&o.call(r.console,i,n),t.apply(this,arguments)}}function p(t,e,n){var i,r=e.prototype;i=t.prototype=Object.create(r),i.constructor=t,i._super=r,n&&dt(i,n)}function f(t,e){return function(){return t.apply(e,arguments)}}function d(t,e){return typeof t==_t?t.apply(e?e[0]||a:a,e):t}function g(t,e){return t===a?e:t}function v(t,e,n){u(b(e),function(e){t.addEventListener(e,n,!1)})}function _(t,e,n){u(b(e),function(e){t.removeEventListener(e,n,!1)})}function m(t,e){for(;t;){if(t==e)return!0;t=t.parentNode}return!1}function y(t,e){return t.indexOf(e)>-1}function b(t){return t.trim().split(/\s+/g)}function w(t,e,n){if(t.indexOf&&!n)return t.indexOf(e);for(var i=0;i<t.length;){if(n&&t[i][n]==e||!n&&t[i]===e)return i;i++}return-1}function S(t){return Array.prototype.slice.call(t,0)}function E(t,e,n){for(var i=[],r=[],o=0;o<t.length;){var s=e?t[o][e]:t[o];w(r,s)<0&&i.push(t[o]),r[o]=s,o++}return n&&(i=e?i.sort(function(t,n){return t[e]>n[e]}):i.sort()),i}function T(t,e){for(var n,i,r=e[0].toUpperCase()+e.slice(1),o=0;o<gt.length;){if(n=gt[o],(i=n?n+r:e)in t)return i;o++}return a}function P(){return Et++}function I(t){var e=t.ownerDocument||t;return e.defaultView||e.parentWindow||r}function x(t,e){var n=this;this.manager=t,this.callback=e,this.element=t.element,this.target=t.options.inputTarget,this.domHandler=function(e){d(t.options.enable,[t])&&n.handler(e)},this.init()}function A(t){var e=t.options.inputClass;return new(e?e:It?U:xt?W:Pt?K:z)(t,C)}function C(t,e,n){var i=n.pointers.length,r=n.changedPointers.length,o=e&Ct&&i-r==0,s=e&(Dt|Ot)&&i-r==0;n.isFirst=!!o,n.isFinal=!!s,o&&(t.session={}),n.eventType=e,M(t,n),t.emit("hammer.input",n),t.recognize(n),t.session.prevInput=n}function M(t,e){var n=t.session,i=e.pointers,r=i.length;n.firstInput||(n.firstInput=R(e)),r>1&&!n.firstMultiple?n.firstMultiple=R(e):1===r&&(n.firstMultiple=!1);var o=n.firstInput,s=n.firstMultiple,a=s?s.center:o.center,c=e.center=k(i);e.timeStamp=bt(),e.deltaTime=e.timeStamp-o.timeStamp,e.angle=j(a,c),e.distance=B(a,c),D(n,e),e.offsetDirection=F(e.deltaX,e.deltaY);var h=H(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=h.x,e.overallVelocityY=h.y,e.overallVelocity=yt(h.x)>yt(h.y)?h.x:h.y,e.scale=s?N(s.pointers,i):1,e.rotation=s?L(s.pointers,i):0,e.maxPointers=n.prevInput?e.pointers.length>n.prevInput.maxPointers?e.pointers.length:n.prevInput.maxPointers:e.pointers.length,O(n,e);var u=t.element;m(e.srcEvent.target,u)&&(u=e.srcEvent.target),e.target=u}function D(t,e){var n=e.center,i=t.offsetDelta||{},r=t.prevDelta||{},o=t.prevInput||{};e.eventType!==Ct&&o.eventType!==Dt||(r=t.prevDelta={x:o.deltaX||0,y:o.deltaY||0},i=t.offsetDelta={x:n.x,y:n.y}),e.deltaX=r.x+(n.x-i.x),e.deltaY=r.y+(n.y-i.y)}function O(t,e){var n,i,r,o,s=t.lastInterval||e,c=e.timeStamp-s.timeStamp;if(e.eventType!=Ot&&(c>At||s.velocity===a)){var h=e.deltaX-s.deltaX,u=e.deltaY-s.deltaY,l=H(c,h,u);i=l.x,r=l.y,n=yt(l.x)>yt(l.y)?l.x:l.y,o=F(h,u),t.lastInterval=e}else n=s.velocity,i=s.velocityX,r=s.velocityY,o=s.direction;e.velocity=n,e.velocityX=i,e.velocityY=r,e.direction=o}function R(t){for(var e=[],n=0;n<t.pointers.length;)e[n]={clientX:mt(t.pointers[n].clientX),clientY:mt(t.pointers[n].clientY)},n++;return{timeStamp:bt(),pointers:e,center:k(e),deltaX:t.deltaX,deltaY:t.deltaY}}function k(t){var e=t.length;if(1===e)return{x:mt(t[0].clientX),y:mt(t[0].clientY)};for(var n=0,i=0,r=0;r<e;)n+=t[r].clientX,i+=t[r].clientY,r++;return{x:mt(n/e),y:mt(i/e)}}function H(t,e,n){return{x:e/t||0,y:n/t||0}}function F(t,e){return t===e?Rt:yt(t)>=yt(e)?t<0?kt:Ht:e<0?Ft:Bt}function B(t,e,n){n||(n=zt);var i=e[n[0]]-t[n[0]],r=e[n[1]]-t[n[1]];return Math.sqrt(i*i+r*r)}function j(t,e,n){n||(n=zt);var i=e[n[0]]-t[n[0]],r=e[n[1]]-t[n[1]];return 180*Math.atan2(r,i)/Math.PI}function L(t,e){return j(e[1],e[0],Ut)+j(t[1],t[0],Ut)}function N(t,e){return B(e[0],e[1],Ut)/B(t[0],t[1],Ut)}function z(){this.evEl=qt,this.evWin=Wt,this.pressed=!1,x.apply(this,arguments)}function U(){this.evEl=Qt,this.evWin=Vt,x.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function X(){this.evTarget=Gt,this.evWin=Zt,this.started=!1,x.apply(this,arguments)}function q(t,e){var n=S(t.touches),i=S(t.changedTouches);return e&(Dt|Ot)&&(n=E(n.concat(i),"identifier",!0)),[n,i]}function W(){this.evTarget=te,this.targetIds={},x.apply(this,arguments)}function Y(t,e){var n=S(t.touches),i=this.targetIds;if(e&(Ct|Mt)&&1===n.length)return i[n[0].identifier]=!0,[n,n];var r,o,s=S(t.changedTouches),a=[],c=this.target;if(o=n.filter(function(t){return m(t.target,c)}),e===Ct)for(r=0;r<o.length;)i[o[r].identifier]=!0,r++;for(r=0;r<s.length;)i[s[r].identifier]&&a.push(s[r]),e&(Dt|Ot)&&delete i[s[r].identifier],r++;return a.length?[E(o.concat(a),"identifier",!0),a]:void 0}function K(){x.apply(this,arguments);var t=f(this.handler,this);this.touch=new W(this.manager,t),this.mouse=new z(this.manager,t),this.primaryTouch=null,this.lastTouches=[]}function Q(t,e){t&Ct?(this.primaryTouch=e.changedPointers[0].identifier,V.call(this,e)):t&(Dt|Ot)&&V.call(this,e)}function V(t){var e=t.changedPointers[0];if(e.identifier===this.primaryTouch){var n={x:e.clientX,y:e.clientY};this.lastTouches.push(n);var i=this.lastTouches,r=function(){var t=i.indexOf(n);t>-1&&i.splice(t,1)};setTimeout(r,ee)}}function $(t){for(var e=t.srcEvent.clientX,n=t.srcEvent.clientY,i=0;i<this.lastTouches.length;i++){var r=this.lastTouches[i],o=Math.abs(e-r.x),s=Math.abs(n-r.y);if(o<=ne&&s<=ne)return!0}return!1}function G(t,e){this.manager=t,this.set(e)}function Z(t){if(y(t,ae))return ae;var e=y(t,ce),n=y(t,he);return e&&n?ae:e||n?e?ce:he:y(t,se)?se:oe}function J(t){this.options=dt({},this.defaults,t||{}),this.id=P(),this.manager=null,this.options.enable=g(this.options.enable,!0),this.state=le,this.simultaneous={},this.requireFail=[]}function tt(t){return t&ve?"cancel":t&de?"end":t&fe?"move":t&pe?"start":""}function et(t){return t==Bt?"down":t==Ft?"up":t==kt?"left":t==Ht?"right":""}function nt(t,e){var n=e.manager;return n?n.get(t):t}function it(){J.apply(this,arguments)}function rt(){it.apply(this,arguments),this.pX=null,this.pY=null}function ot(){it.apply(this,arguments)}function st(){J.apply(this,arguments),this._timer=null,this._input=null}function at(){it.apply(this,arguments)}function ct(){it.apply(this,arguments)}function ht(){J.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function ut(t,e){return e=e||{},e.recognizers=g(e.recognizers,ut.defaults.preset),new lt(t,e)}function lt(t,e){this.options=dt({},ut.defaults,e||{}),this.options.inputTarget=this.options.inputTarget||t,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=t,this.input=A(this),this.touchAction=new G(this,this.options.touchAction),pt(this,!0),u(this.options.recognizers,function(t){var e=this.add(new t[0](t[1]));t[2]&&e.recognizeWith(t[2]),t[3]&&e.requireFailure(t[3])},this)}function pt(t,e){var n=t.element;if(n.style){var i;u(t.options.cssProps,function(r,o){i=T(n.style,o),e?(t.oldCssProps[i]=n.style[i],n.style[i]=r):n.style[i]=t.oldCssProps[i]||""}),e||(t.oldCssProps={})}}function ft(t,e){var n=o.createEvent("Event");n.initEvent(t,!0,!0),n.gesture=e,e.target.dispatchEvent(n)}var dt,gt=["","webkit","Moz","MS","ms","o"],vt=o.createElement("div"),_t="function",mt=Math.round,yt=Math.abs,bt=Date.now;dt="function"!=typeof Object.assign?function(t){if(t===a||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n<arguments.length;n++){var i=arguments[n];if(i!==a&&null!==i)for(var r in i)i.hasOwnProperty(r)&&(e[r]=i[r])}return e}:Object.assign;var wt=l(function(t,e,n){for(var i=Object.keys(e),r=0;r<i.length;)(!n||n&&t[i[r]]===a)&&(t[i[r]]=e[i[r]]),r++;return t},"extend","Use `assign`."),St=l(function(t,e){return wt(t,e,!0)},"merge","Use `assign`."),Et=1,Tt=/mobile|tablet|ip(ad|hone|od)|android/i,Pt="ontouchstart"in r,It=T(r,"PointerEvent")!==a,xt=Pt&&Tt.test(navigator.userAgent),At=25,Ct=1,Mt=2,Dt=4,Ot=8,Rt=1,kt=2,Ht=4,Ft=8,Bt=16,jt=kt|Ht,Lt=Ft|Bt,Nt=jt|Lt,zt=["x","y"],Ut=["clientX","clientY"];x.prototype={handler:function(){},init:function(){this.evEl&&v(this.element,this.evEl,this.domHandler),this.evTarget&&v(this.target,this.evTarget,this.domHandler),this.evWin&&v(I(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&_(this.element,this.evEl,this.domHandler),this.evTarget&&_(this.target,this.evTarget,this.domHandler),this.evWin&&_(I(this.element),this.evWin,this.domHandler)}};var Xt={mousedown:Ct,mousemove:Mt,mouseup:Dt},qt="mousedown",Wt="mousemove mouseup";p(z,x,{handler:function(t){var e=Xt[t.type];e&Ct&&0===t.button&&(this.pressed=!0),e&Mt&&1!==t.which&&(e=Dt),this.pressed&&(e&Dt&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:"mouse",srcEvent:t}))}});var Yt={pointerdown:Ct,pointermove:Mt,pointerup:Dt,pointercancel:Ot,pointerout:Ot},Kt={2:"touch",3:"pen",4:"mouse",5:"kinect"},Qt="pointerdown",Vt="pointermove pointerup pointercancel";r.MSPointerEvent&&!r.PointerEvent&&(Qt="MSPointerDown",Vt="MSPointerMove MSPointerUp MSPointerCancel"),p(U,x,{handler:function(t){var e=this.store,n=!1,i=t.type.toLowerCase().replace("ms",""),r=Yt[i],o=Kt[t.pointerType]||t.pointerType,s="touch"==o,a=w(e,t.pointerId,"pointerId");r&Ct&&(0===t.button||s)?a<0&&(e.push(t),a=e.length-1):r&(Dt|Ot)&&(n=!0),a<0||(e[a]=t,this.callback(this.manager,r,{pointers:e,changedPointers:[t],pointerType:o,srcEvent:t}),n&&e.splice(a,1))}});var $t={touchstart:Ct,touchmove:Mt,touchend:Dt,touchcancel:Ot},Gt="touchstart",Zt="touchstart touchmove touchend touchcancel";p(X,x,{handler:function(t){var e=$t[t.type];if(e===Ct&&(this.started=!0),this.started){var n=q.call(this,t,e);e&(Dt|Ot)&&n[0].length-n[1].length==0&&(this.started=!1),this.callback(this.manager,e,{pointers:n[0],changedPointers:n[1],pointerType:"touch",srcEvent:t})}}});var Jt={touchstart:Ct,touchmove:Mt,touchend:Dt,touchcancel:Ot},te="touchstart touchmove touchend touchcancel";p(W,x,{handler:function(t){var e=Jt[t.type],n=Y.call(this,t,e);n&&this.callback(this.manager,e,{pointers:n[0],changedPointers:n[1],pointerType:"touch",srcEvent:t})}});var ee=2500,ne=25;p(K,x,{handler:function(t,e,n){var i="touch"==n.pointerType,r="mouse"==n.pointerType;if(!(r&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(i)Q.call(this,e,n);else if(r&&$.call(this,n))return;this.callback(t,e,n)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var ie=T(vt.style,"touchAction"),re=ie!==a,oe="auto",se="manipulation",ae="none",ce="pan-x",he="pan-y",ue=function(){if(!re)return!1;var t={},e=r.CSS&&r.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(n){t[n]=!e||r.CSS.supports("touch-action",n)}),t}();G.prototype={set:function(t){"compute"==t&&(t=this.compute()),re&&this.manager.element.style&&ue[t]&&(this.manager.element.style[ie]=t),this.actions=t.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var t=[];return u(this.manager.recognizers,function(e){d(e.options.enable,[e])&&(t=t.concat(e.getTouchAction()))}),Z(t.join(" "))},preventDefaults:function(t){var e=t.srcEvent,n=t.offsetDirection;if(this.manage