forked from julianshapiro/velocity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
velocity.min.js
7 lines (7 loc) · 25.5 KB
/
velocity.min.js
1
2
3
4
5
6
7
/*!
* Velocity.js: Accelerated JavaScript animation.
* @version 0.0.0
* @docs julian.com/research/velocity
* @license Copyright 2014 Julian Shapiro. MIT License: http://en.wikipedia.org/wiki/MIT_License
*/
!function(e,t,r){function a(e){for(var t=-1,r=e?e.length:0,a=[];++t<r;){var o=e[t];o&&a.push(o)}return a}function o(e){return"[object Function]"===Object.prototype.toString.call(e)}function n(e){if(e)for(var t=(new Date).getTime(),a=0,o=p.State.calls.length;o>a;a++)if(p.State.calls[a]){var l=p.State.calls[a],d=l[0],g=l[2],h=l[3];h||(h=p.State.calls[a][3]=t-16);for(var y=Math.min((t-h)/g.duration,1),m=0,v=d.length;v>m;m++){var w=d[m],b=w.element;if(u.data(b,c)){var x=!1;g.display&&"none"!==g.display&&(f.setPropertyValue(b,"display",g.display),p.State.calls[a][2].display=!1);for(var P in w)if("element"!==P){var V,k=w[P];if(k.currentValue,V=1===y?k.endValue:k.startValue+(k.endValue-k.startValue)*p.Easings[k.easing](y),k.currentValue=V,f.Hooks.registered[P]){var S=f.Hooks.getRoot(P),C=u.data(b,c).rootPropertyValueCache[S];C&&(k.rootPropertyValue=C)}var T=f.setPropertyValue(b,P,k.currentValue+("auto"===V?"":k.unitType),k.rootPropertyValue,k.scrollContainer);f.Hooks.registered[P]&&(u.data(b,c).rootPropertyValueCache[S]=f.Normalizations.registered[S]?f.Normalizations.registered[S]("extract",null,T[1]):T[1]),"transform"===T[0]&&(x=!0)}g.mobileHA&&(u.data(b,c).transformCache.translate3d===r?(u.data(b,c).transformCache.translate3d="(0, 0, 0)",x=!0):1===y&&(delete u.data(b,c).transformCache.translate3d,x=!0)),x&&f.flushTransformCache(b)}}1===y&&i(a)}p.State.isTicking&&s(n)}function i(e){for(var t=p.State.calls[e][0],a=p.State.calls[e][1],o=p.State.calls[e][2],n=!1,i=0,l=t.length;l>i;i++){var s=t[i].element;"none"===o.display&&o.loop===!1&&f.setPropertyValue(s,"display",o.display),u.queue(s)[1]!==r&&/\$\.velocity\.queueEntryFlag/i.test(u.queue(s)[1])||u.data(s,c)&&(u.data(s,c).isAnimating=!1,u.data(s,c).rootPropertyValueCache={}),i===l-1&&o.complete&&o.complete.call(a,a),u.dequeue(s)}p.State.calls[e]=!1;for(var d=0,g=p.State.calls.length;g>d;d++)if(p.State.calls[d]!==!1){n=!0;break}n===!1&&(p.State.isTicking=!1,delete p.State.calls,p.State.calls=[])}var l=function(){if(t.documentMode)return t.documentMode;for(var e=7;e>4;e--){var a=t.createElement("div");if(a.innerHTML="<!--[if IE "+e+"]><span></span><![endif]-->",a.getElementsByTagName("span").length)return a=null,e}return r}(),s=window.requestAnimationFrame||function(){var e=0;return window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){var r,a=(new Date).getTime();return r=Math.max(0,16-(a-e)),e=a+r,setTimeout(function(){t(a+r)},r)}}(),u=window.jQuery||function(){function e(e){var t=e.length,r=o.type(e);return"function"===r||o.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===r||0===t||"number"==typeof t&&t>0&&t-1 in e}function a(e){var t=n[e]={};return o.each(e.match(/\S+/g)||[],function(e,r){t[r]=!0}),t}var o=function(e,t){return new o.fn.init(e,t)};o.fn=o.prototype={init:function(e){if(e.nodeType)return this[0]=e,this;throw Error("The parameter given was not a DOM node.")},offset:function(){var e=this[0].getBoundingClientRect();return{top:e.top+(window.pageYOffset||t.scrollTop||0)-(t.clientTop||0),left:e.left+(window.pageXOffset||t.scrollLeft||0)-(t.clientLeft||0)}},position:function(){function e(){for(var e=this.offsetParent||t;e&&"html"===!e.nodeType.toLowerCase&&"static"===e.style.position;)e=e.offsetParent;return e||t}var r=this[0],e=e.apply(r),a=this.offset(),n=/^(?:body|html)$/i.test(e.nodeName)?{top:0,left:0}:o(e).offset();return a.top-=parseFloat(r.style.marginTop)||0,a.left-=parseFloat(r.style.marginLeft)||0,e.style&&(n.top+=parseFloat(e.style.borderTopWidth)||0,n.left+=parseFloat(e.style.borderLeftWidth)||0),{top:a.top-n.top,left:a.left-n.left}}},o.fn.init.prototype=o.fn;var n={},i={},l={};return hasOwn=l.hasOwnProperty,toString=l.toString,"Boolean Number String Function Array Date RegExp Object Error".split(" ").forEach(function(e){l["[object "+e+"]"]=e.toLowerCase()}),o.expando="velocity"+(Math.random()+"").replace(/\D/g,""),o.cache={},o.uuid=1,o.isWindow=function(e){return null!=e&&e==e.window},o.type=function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[toString.call(e)]||"object":typeof e},o.isArray=Array.isArray||function(e){return"array"===o.type(e)},o.camelCase=function(e){return e.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,function(e,t){return t.toUpperCase()})},o.each=function(t,r,a){var o=0,n=e(t);if(a){if(n)for(;o<t.length&&r.apply(t[o],a)!==!1;o++);else for(o in t)if(r.apply(t[o],a)===!1)break}else if(n)for(;o<t.length&&r.call(t[o],o,t[o])!==!1;o++);else for(o in t)if(r.call(t[o],o,t[o])===!1)break;return t},o.data=function(e,t,a){var n,l=e[o.expando]||(e[o.expando]=++o.uuid),s=o.camelCase(t);if(a!==r)return n=i[l]||(i[l]={}),t!==r&&(n[s]=a),n;if(n=l&&i[l]){if(t in n)return n[t];if(s in n)return n[s]}},o.extend=function(e){function t(e,a,n){for(key in a)n&&(o.isPlainObject(a[key])||o.isArray(a[key]))?(o.isPlainObject(a[key])&&!o.isPlainObject(e[key])&&(e[key]={}),o.isArray(a[key])&&!o.isArray(e[key])&&(e[key]=[]),t(e[key],a[key],n)):a[key]!==r&&(e[key]=a[key])}var a,n=[].slice.call(arguments,1);return"boolean"==typeof e&&(a=e,e=n.shift()),o.each(n,function(r,o){t(e,o,a)}),e},o.queue=function(t,a,n){function i(t,a){var o=a||[];return null!=t&&(e(Object(t))?!function(e,t){var a=t.length,o=e.length,n=0;if("number"==typeof a)for(;a>n;n++)e[o++]=t[n];else for(;t[n]!==r;)e[o++]=t[n++];return e.length=o,e}(o,"string"==typeof t?[t]:t):[].push.call(o,t)),o}if(t){var l;return a=(a||"fx")+"queue",l=o.data(t,a),n&&(!l||o.isArray(n)?l=o.data(t,a,i(n)):l.push(n)),l||[]}},o.dequeue=function(e,t){t=t||"fx";var r=o.queue(e,t),a=r.length,n=r.shift(),i=function(e,t){var r=t+"queueHooks";return o.data(e,r)||o.data(e,r,{empty:o.Callbacks("once memory").add(function(){o.removeData(e,[t+"queue",r])})})},l=i(e,t),s=function(){o.dequeue(e,t)};"inprogress"===n&&(n=r.shift(),a--),n&&("fx"===t&&r.unshift("inprogress"),delete l.stop,n.call(e,s,l)),!a&&l&&l.empty&&l.empty.fire()},o.isPlainObject=function(e){var t;if(!e||"object"!==o.type(e)||e.nodeType||o.isWindow(e))return!1;try{if(e.constructor&&!hasOwn.call(e,"constructor")&&!hasOwn.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(a){return!1}for(t in e);return t===r||hasOwn.call(e,t)},o.isEmptyObject=function(e){var t;for(t in e)return!1;return!0},o.removeData=function(e,t){var r=e[o.expando],a=r&&i[r];a&&o.each(t,function(e,t){delete a[t?o.camelCase(this):t]})},o.Callbacks=function(e){e="string"==typeof e?n[e]||a(e):o.extend({},e);var t,r,i,l,s,u,c=[],p=!e.once&&[],f=function(a){for(r=e.memory&&a,i=!0,s=u||0,u=0,l=c.length,t=!0;c&&l>s;s++)if(c[s].apply(a[0],a[1])===!1&&e.stopOnFalse){r=!1;break}t=!1,c&&(p?p.length&&f(p.shift()):r?c=[]:d.disable())},d={add:function(){if(c){var a=c.length;!function n(t){o.each(t,function(t,r){var a=o.type(r);"function"===a?e.unique&&d.has(r)||c.push(r):r&&r.length&&"string"!==a&&n(r)})}(arguments),t?l=c.length:r&&(u=a,f(r))}return this},remove:function(){if(c){var e=function(e,t,r){var a,o=t.indexOf||function(e){for(var t=0,r=this.length;r>t;t++)if(this[t]===e)return t;return-1};if(t){if(o)return o.call(t,e,r);for(a=t.length,r=r?0>r?Math.max(0,a+r):r:0;a>r;r++)if(r in t&&t[r]===e)return r}return-1};o.each(arguments,function(r,a){for(var o;(o=e(a,c,o))>-1;)c.splice(o,1),t&&(o>l||l--,o>s||s--)})}return this},empty:function(){return c=[],l=0,this},fireWith:function(e,r){return!c||i&&!p||(r=r||[],r=[e,r.slice?r.slice():r],t?p.push(r):f(r)),this},fire:function(){return d.fireWith(this,arguments),this}};return d},o}(),c="velocity",p={State:{isMobile:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),prefixElement:t.createElement("div"),prefixMatches:{},scrollAnchor:null,scrollProperty:null,isTicking:!1,calls:[]},Classes:{extracted:{},extract:function(){}},CSS:{},Sequences:{},Utilities:u,animate:function(){},debug:!1};window.pageYOffset!==r?(p.State.scrollAnchor=window,p.State.scrollProperty="pageYOffset"):(p.State.scrollAnchor=t.documentElement||t.body.parentNode||t.body,p.State.scrollProperty="scrollTop"),function(){var e={};p.Easings={},u.each(["Quad","Cubic","Quart","Quint","Expo"],function(t,r){e[r]=function(e){return Math.pow(e,t+2)}}),u.extend(e,{Sine:function(e){return 1-Math.cos(e*Math.PI/2)},Circ:function(e){return 1-Math.sqrt(1-e*e)},Elastic:function(e){return 0===e||1===e?e:-Math.pow(2,8*(e-1))*Math.sin((80*(e-1)-7.5)*Math.PI/15)},Back:function(e){return e*e*(3*e-2)},Bounce:function(e){for(var t,r=4;e<((t=Math.pow(2,--r))-1)/11;);return 1/Math.pow(4,3-r)-7.5625*Math.pow((3*t-2)/22-e,2)}}),u.each(e,function(e,t){p.Easings["easeIn"+e]=t,p.Easings["easeOut"+e]=function(e){return 1-t(1-e)},p.Easings["easeInOut"+e]=function(e){return.5>e?t(2*e)/2:1-t(-2*e+2)/2}}),p.Easings.swing=p.Easings.swing||function(e){return.5-Math.cos(e*Math.PI)/2},p.Easings.spring=function(e){return 1-Math.cos(4.5*e*Math.PI)*Math.exp(6*-e)}}();var f=p.CSS={RegEx:{valueUnwrap:/^[A-z]+\((.*)\)$/i,wrappedValueAlreadyExtracted:/[0-9.]+ [0-9.]+ [0-9.]+( [0-9.]+)?/,valueSplit:/([A-z]+\(.+\))|(([A-z0-9#-.]+?)(?=\s|$))/gi},Hooks:{templates:{color:["Red Green Blue Alpha","255 255 255 1"],backgroundColor:["Red Green Blue Alpha","255 255 255 1"],borderColor:["Red Green Blue Alpha","255 255 255 1"],outlineColor:["Red Green Blue Alpha","255 255 255 1"],textShadow:["Color X Y Blur","black 0px 0px 0px"],boxShadow:["Color X Y Blur Spread","black 0px 0px 0px 0px"],clip:["Top Right Bottom Left","0px 0px 0px 0px"],backgroundPosition:["X Y","0% 0%"],transformOrigin:["X Y Z","50% 50% 0%"],perspectiveOrigin:["X Y","50% 50%"]},registered:{},register:function(){var e,t,r;if(l)for(e in f.Hooks.templates){t=f.Hooks.templates[e],r=t[0].split(" ");var a=t[1].match(f.RegEx.valueSplit);"Color"===r[0]&&(r.push(r.shift()),a.push(a.shift()),f.Hooks.templates[e]=[r.join(" "),a.join(" ")])}for(e in f.Hooks.templates){t=f.Hooks.templates[e],r=t[0].split(" ");for(var o in r){var n=e+r[o],i=o;f.Hooks.registered[n]=[e,i]}}},getRoot:function(e){var t=f.Hooks.registered[e];return t?t[0]:e},cleanRootPropertyValue:function(e,t){return f.RegEx.valueUnwrap.test(t)&&(t=t.match(f.Hooks.RegEx.valueUnwrap)[1]),f.Values.isCSSNullValue(t)&&(t=f.Hooks.templates[e][1]),t},extractValue:function(e,t){var r=f.Hooks.registered[e];if(r){var a=r[0],o=r[1];return t=f.Hooks.cleanRootPropertyValue(a,t),(""+t).match(f.RegEx.valueSplit)[o]}return t},injectValue:function(e,t,r){var a=f.Hooks.registered[e];if(a){var o,n,i=a[0],l=a[1];return r=f.Hooks.cleanRootPropertyValue(i,r),o=(""+r).match(f.RegEx.valueSplit),o[l]=t,n=o.join(" ")}return r}},Normalizations:{registered:{clip:function(e,t,r){switch(e){case"name":return"clip";case"extract":var a;return f.RegEx.wrappedValueAlreadyExtracted.test(r)?a=r:(a=(""+r).match(f.RegEx.valueUnwrap),a&&(a=a[1].replace(/,(\s+)?/g," "))),a;case"inject":return"rect("+r+")"}},opacity:function(e,t,r){if(8<l)switch(e){case"name":return"opacity";case"extract":return r;case"inject":return r}else switch(e){case"name":return"filter";case"extract":var a=(""+r).match(/alpha\(opacity=(.*)\)/i);return r=a?a[1]/100:1;case"inject":return t.style.zoom=1,"alpha(opacity="+parseInt(100*r)+")"}}},register:function(){function e(e){var t,r=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,a=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i;return e=e.replace(r,function(e,t,r,a){return t+t+r+r+a+a}),t=a.exec(e),t?"rgb("+(parseInt(t[1],16)+" "+parseInt(t[2],16)+" "+parseInt(t[3],16))+")":"rgb(0 0 0)"}var t=["translateX","translateY","scale","scaleX","scaleY","skewX","skewY","rotateZ"];9<l&&(t=t.concat(["translateZ","scaleZ","rotateX","rotateY"]));for(var a=0,o=t.length;o>a;a++)!function(){var e=t[a];f.Normalizations.registered[e]=function(t,a,o){switch(t){case"name":return"transform";case"extract":return u.data(a,c).transformCache[e]===r?/^scale/i.test(e)?1:0:u.data(a,c).transformCache[e].replace(/[()]/g,"");case"inject":var n=!1;switch(e.substr(0,e.length-1)){case"translate":n=!/(%|px|em|rem|\d)$/i.test(o);break;case"scale":n=!/(\d)$/i.test(o);break;case"skew":n=!/(deg|\d)$/i.test(o);break;case"rotate":n=!/(deg|\d)$/i.test(o)}return n||(u.data(a,c).transformCache[e]="("+o+")"),u.data(a,c).transformCache[e]}}}();for(var n=["color","backgroundColor","borderColor","outlineColor"],a=0,i=n.length;i>a;a++)!function(){var t=n[a];f.Normalizations.registered[t]=function(a,o,n){switch(a){case"name":return t;case"extract":var i;if(f.RegEx.wrappedValueAlreadyExtracted.test(n))i=n;else{var s,u={aqua:"rgb(0, 255, 255);",black:"rgb(0, 0, 0)",blue:"rgb(0, 0, 255)",fuchsia:"rgb(255, 0, 255)",gray:"rgb(128, 128, 128)",green:"rgb(0, 128, 0)",lime:"rgb(0, 255, 0)",maroon:"rgb(128, 0, 0)",navy:"rgb(0, 0, 128)",olive:"rgb(128, 128, 0)",purple:"rgb(128, 0, 128)",red:"rgb(255, 0, 0)",silver:"rgb(192, 192, 192)",teal:"rgb(0, 128, 128)",white:"rgb(255, 255, 255)",yellow:"rgb(255, 255, 0)"};/^[A-z]+$/i.test(n)?s=u[n]!==r?u[n]:u.black:/^#([A-f\d]{3}){1,2}$/i.test(n)?s=e(n):/^rgba?\(/i.test(n)||(s=u.black),i=(""+(s||n)).match(f.RegEx.valueUnwrap)[1].replace(/,(\s+)?/g," ")}return 8<l&&3===i.split(" ").length&&(i+=" 1"),i;case"inject":return l>8?3===n.split(" ").length&&(n+=" 1"):4===n.split(" ").length&&(n=n.split(/\s+/).slice(0,3).join(" ")),(l>8?"rgba":"rgb")+"("+n.replace(/\s+/g,",").replace(/\.(\d)+(?=,)/g,"")+")"}}}()}},Names:{camelCase:function(e){return e.replace(/-(\w)/g,function(e,t){return t.toUpperCase()})},prefixCheck:function(e){if(p.State.prefixMatches[e])return[p.State.prefixMatches[e],!0];for(var t=["","Webkit","Moz","ms","O"],r=0,a=t.length;a>r;r++){var o;if(o=0===r?e:t[r]+e.replace(/^\w/,function(e){return e.toUpperCase()}),"string"==typeof p.State.prefixElement.style[o])return p.State.prefixMatches[e]=o,[o,!0]}return[e,!1]}},Values:{isCSSNullValue:function(e){return 0==e||/^(none|auto|transparent|(rgba\(0, ?0, ?0, ?0\)))$/i.test(e)},getUnitType:function(e){return/^(rotate|skew)/i.test(e)?"deg":/(^(scale|scaleX|scaleY|scaleZ|opacity|alpha|fillOpacity|flexGrow|flexHeight|zIndex|fontWeight)$)|color/i.test(e)?"":"px"}},getPropertyValue:function(e,t,a,o){function n(e,t){if(!o){if("height"===t&&"border-box"!==f.getPropertyValue(e,"boxSizing").toLowerCase())return e.offsetHeight-(parseFloat(f.getPropertyValue(e,"borderTopWidth"))||0)-(parseFloat(f.getPropertyValue(e,"borderBottomWidth"))||0)-(parseFloat(f.getPropertyValue(e,"paddingTop"))||0)-(parseFloat(f.getPropertyValue(e,"paddingBottom"))||0);if("width"===t&&"border-box"!==f.getPropertyValue(e,"boxSizing").toLowerCase())return e.offsetWidth-(parseFloat(f.getPropertyValue(e,"borderLeftWidth"))||0)-(parseFloat(f.getPropertyValue(e,"borderRightWidth"))||0)-(parseFloat(f.getPropertyValue(e,"paddingLeft"))||0)-(parseFloat(f.getPropertyValue(e,"paddingRight"))||0)}var a=0;if(8>=l&&window.Zepto)a=window.Zepto.fn.css.call(e,t);else{var i;i=u.data(e,c)===r?window.getComputedStyle(e,null):u.data(e,c).computedStyle?u.data(e,c).computedStyle:u.data(e,c).computedStyle=window.getComputedStyle(e,null),l&&"borderColor"===t&&(t="borderTopColor"),a=9===l&&"filter"===t?i.getPropertyValue(t):i[t],""===a&&(a=e.style[t])}if("auto"===a&&/^(top|right|bottom|left)$/i.test(t)){var s=n(e,"position");("fixed"===s||"absolute"===s&&/top|left/i.test(t))&&(a=u(e).position()[t]+"px")}return a}var i;if(f.Hooks.registered[t]){var s=t,d=f.Hooks.getRoot(s);a===r&&(a=f.getPropertyValue(e,f.Names.prefixCheck(d)[0])),f.Normalizations.registered[d]&&(a=f.Normalizations.registered[d]("extract",e,a)),i=f.Hooks.extractValue(s,a)}else if(f.Normalizations.registered[t]){var g,h;g=f.Normalizations.registered[t]("name",e),"transform"!==g&&(h=n(e,f.Names.prefixCheck(g)[0]),f.Values.isCSSNullValue(h)&&f.Hooks.templates[t]&&(h=f.Hooks.templates[t][1])),i=f.Normalizations.registered[t]("extract",e,h)}return/^[\d-]/.test(i)||(i=n(e,f.Names.prefixCheck(t)[0])),f.Values.isCSSNullValue(i)&&(i=0),p.debug<2||console.log("Get "+t+": "+i),i},setPropertyValue:function(e,t,r,a,o){var n=t;if("scroll"===t)o?o.scrollTop=r:window.scrollTo(null,r);else if(f.Normalizations.registered[t]&&"transform"===f.Normalizations.registered[t]("name",e))f.Normalizations.registered[t]("inject",e,r),n="transform",r=u.data(e,c).transformCache[t];else{if(f.Hooks.registered[t]){var i=t,s=f.Hooks.getRoot(t);a=a||f.getPropertyValue(e,s),r=f.Hooks.injectValue(i,r,a),t=s}if(f.Normalizations.registered[t]&&(r=f.Normalizations.registered[t]("inject",e,r),t=f.Normalizations.registered[t]("name",e)),n=f.Names.prefixCheck(t)[0],l>8)e.style[n]=r;else try{e.style[n]=r}catch(d){console.log("Error setting ["+n+"] to ["+r+"]")}p.debug<2||console.log("Set "+t+" ("+n+"): "+r)}return[n,r]},flushTransformCache:function(e){var t,r,a="";for(t in u.data(e,c).transformCache)r=u.data(e,c).transformCache[t],9===l&&"rotateZ"===t&&(t="rotate"),a+=t+r+" ";f.setPropertyValue(e,"transform",a)}};f.Hooks.register(),f.Normalizations.register(),p.animate=function(){function i(){var i=this,l=u.extend({},e.velocity.defaults,g),v={};if("stop"===h)return u.queue(i,"string"==typeof g?g:"",[]),!0;switch(u.data(i,c)===r&&u.data(i,c,{isAnimating:!1,computedStyle:null,tweensContainer:null,rootPropertyValueCache:{},transformCache:{}}),(""+l.duration).toLowerCase()){case"fast":l.duration=200;break;case"normal":l.duration=400;break;case"slow":l.duration=600;break;default:l.duration=parseFloat(l.duration)||parseFloat(e.velocity.defaults.duration)||400}p.Easings[l.easing]||(l.easing=p.Easings[e.velocity.defaults.easing]?e.velocity.defaults.easing:"swing"),/^\d/.test(l.delay)&&u.queue(i,l.queue,function(e){p.queueEntryFlag=!0,setTimeout(e,parseFloat(l.delay))}),l.display&&(l.display=l.display.toLowerCase()),l.mobileHA=l.mobileHA&&p.State.isMobile,u.queue(i,l.queue,function(e){function w(e){var t=r,a=r,n=r;return"[object Array]"===Object.prototype.toString.call(e)?(t=e[0],/^[\d-]/.test(e[1])||o(e[1])?n=e[1]:"string"==typeof e[1]&&(p.Easings[e[1]]!==r&&(a=e[1]),e[2]&&(n=e[2]))):t=e,a=a||l.easing,o(t)&&(t=t.call(i,m,y)),o(n)&&(n=n.call(i,m,y)),[t||0,a,n]}function P(e,t){var r,a;return a=(""+(t||0)).toLowerCase().replace(/[%A-z]+$/,function(e){return r=e,""}),r||(r=f.Values.getUnitType(e)),[a,r]}function V(){var e={parent:i.parentNode,position:f.getPropertyValue(i,"position"),fontSize:f.getPropertyValue(i,"fontSize")},r=e.position===b.lastPosition&&e.parent===b.lastParent,a=e.fontSize===b.lastFontSize;b.lastParent=e.parent,b.lastPosition=e.position,b.lastFontSize=e.fontSize,null===b.remToPxRatio&&(b.remToPxRatio=parseFloat(f.getPropertyValue(t.body,"fontSize"))||16);var o={overflowX:null,overflowY:null,boxSizing:null,width:null,minWidth:null,maxWidth:null,height:null,minHeight:null,maxHeight:null,paddingLeft:null},n={},l=10;n.remToPxRatio=b.remToPxRatio,o.overflowX=f.getPropertyValue(i,"overflowX"),o.overflowY=f.getPropertyValue(i,"overflowY"),o.boxSizing=f.getPropertyValue(i,"boxSizing"),o.width=f.getPropertyValue(i,"width",null,!0),o.minWidth=f.getPropertyValue(i,"minWidth"),o.maxWidth=f.getPropertyValue(i,"maxWidth")||"none",o.height=f.getPropertyValue(i,"height",null,!0),o.minHeight=f.getPropertyValue(i,"minHeight"),o.maxHeight=f.getPropertyValue(i,"maxHeight")||"none",o.paddingLeft=f.getPropertyValue(i,"paddingLeft"),r?(n.percentToPxRatioWidth=b.lastPercentToPxWidth,n.percentToPxRatioHeight=b.lastPercentToPxHeight):(f.setPropertyValue(i,"overflowX","hidden"),f.setPropertyValue(i,"overflowY","hidden"),f.setPropertyValue(i,"boxSizing","content-box"),f.setPropertyValue(i,"width",l+"%"),f.setPropertyValue(i,"minWidth",l+"%"),f.setPropertyValue(i,"maxWidth",l+"%"),f.setPropertyValue(i,"height",l+"%"),f.setPropertyValue(i,"minHeight",l+"%"),f.setPropertyValue(i,"maxHeight",l+"%")),a?n.emToPxRatio=b.lastEmToPx:f.setPropertyValue(i,"paddingLeft",l+"em"),r||(n.percentToPxRatioWidth=b.lastPercentToPxWidth=(parseFloat(f.getPropertyValue(i,"width",null,!0))||0)/l,n.percentToPxRatioHeight=b.lastPercentToPxHeight=(parseFloat(f.getPropertyValue(i,"height",null,!0))||0)/l),a||(n.emToPxRatio=b.lastEmToPx=(parseFloat(f.getPropertyValue(i,"paddingLeft"))||0)/l);for(var s in o)f.setPropertyValue(i,s,o[s]);return p.debug<1||console.log("Unit ratios: "+JSON.stringify(n),i),n}if(p.queueEntryFlag=!0,0===m&&g&&o(g.begin)&&g.begin.call(s,s),"scroll"===h){var k,S,C=parseFloat(l.offset)||0;l.container?l.container.jquery||l.container.nodeType?(l.container=l.container[0]||l.container,k=l.container.scrollTop,S=k+u(i).position().top+C):l.container=null:(k=p.State.scrollAnchor[p.State.scrollProperty],S=u(i).offset().top+C),v={scroll:{rootPropertyValue:!1,startValue:k,currentValue:k,endValue:S,unitType:"",easing:l.easing,scrollContainer:l.container},element:i}}else if("reverse"===h){if(!u.data(i,c).tweensContainer)return u.dequeue(i,l.queue),r;"none"===u.data(i,c).opts.display&&(u.data(i,c).opts.display="block"),u.data(i,c).opts.loop=!1,l=u.extend({},u.data(i,c).opts,g);var T=u.extend(!0,{},u.data(i,c).tweensContainer);for(var H in T)if("element"!==H){var R=T[H].startValue;T[H].startValue=T[H].currentValue=T[H].endValue,T[H].endValue=R,g&&(T[H].easing=l.easing)}v=T}else if("start"===h){var T;u.data(i,c).tweensContainer&&u.data(i,c).isAnimating===!0&&(T=u.data(i,c).tweensContainer);for(var E in d){var z=w(d[E]),q=z[0],A=z[1],F=z[2];E=f.Names.camelCase(E);var N=f.Hooks.getRoot(E),j=!1;if(f.Names.prefixCheck(N)[1]!==!1||f.Normalizations.registered[N]!==r){l.display&&"none"!==l.display&&/opacity|filter/.test(E)&&!F&&0!==q&&(F=0),l._cacheValues&&T&&T[E]?(F===r&&(F=T[E].endValue+T[E].unitType),j=u.data(i,c).rootPropertyValueCache[N]):f.Hooks.registered[E]?F===r?(j=f.getPropertyValue(i,N),F=f.getPropertyValue(i,E,j)):j=f.Hooks.templates[N][1]:F===r&&(F=f.getPropertyValue(i,E));var O,M,W,B;O=P(E,F),F=O[0],W=O[1],O=P(E,q),q=O[0].replace(/^([+-\/*])=/,function(e,t){return B=t,""}),M=O[1],F=parseFloat(F)||0,q=parseFloat(q)||0;var Y;if("%"===M&&(/^(fontSize|lineHeight)$/.test(E)?(q/=100,M="em"):/^scale/.test(E)?(q/=100,M=""):/(Red|Green|Blue)$/i.test(E)&&(q=255*(q/100),M="")),/[\/*]/.test(B))M=W;else if(W!==M&&0!==F)if(0===q)M=W;else{Y=Y||V();var L=/margin|padding|left|right|width|text|word|letter/i.test(E)||/X$/.test(E)?"x":"y";switch(W){case"%":F*="x"===L?Y.percentToPxRatioWidth:Y.percentToPxRatioHeight;break;case"em":F*=Y.emToPxRatio;break;case"rem":F*=Y.remToPxRatio;break;case"px":}switch(M){case"%":F*=1/("x"===L?Y.percentToPxRatioWidth:Y.percentToPxRatioHeight);break;case"em":F*=1/Y.emToPxRatio;break;case"rem":F*=1/Y.remToPxRatio;break;case"px":}}switch(B){case"+":q=F+q;break;case"-":q=F-q;break;case"*":q=F*q;break;case"/":q=F/q}v[E]={rootPropertyValue:j,startValue:F,currentValue:F,endValue:q,unitType:M,easing:A},p.debug&&console.log("tweensContainer ("+E+"): "+JSON.stringify(v[E]),i)}else p.debug&&console.log("Skipping ["+N+"] due to a lack of browser support.")}v.element=i}v.element&&(x.push(v),u.data(i,c).tweensContainer=v,u.data(i,c).opts=l,u.data(i,c).isAnimating=!0,m===y-1?(p.State.calls.length>1e4&&(p.State.calls=a(p.State.calls)),p.State.calls.push([x,s,l]),p.State.isTicking===!1&&(p.State.isTicking=!0,n())):m++),""!==l.queue&&"fx"!==l.queue&&setTimeout(e,l.duration+l.delay)}),(l.queue===!1||(""===l.queue||"fx"===l.queue)&&"inprogress"!==u.queue(i)[0])&&u.dequeue(i)}var l,s,d,g;this.jquery||window.Zepto&&window.Zepto.zepto.isZ(this)?(l=!0,s=this,d=arguments[0],g=arguments[1]):(l=!1,s=arguments[0].jquery?arguments[0].get():arguments[0],d=arguments[1],g=arguments[2]);var h,y=s.length||1,m=0;switch(d){case"scroll":h="scroll";break;case"reverse":h="reverse";break;case"stop":h="stop";break;default:if(!u.isPlainObject(d)||u.isEmptyObject(d))return"string"==typeof d&&p.Sequences[d]?(u.each(s,function(e,t){p.Sequences[d].call(t,t,g||{},e,y)}),s):(p.debug&&console.log("First argument was not a property map, a known action, or a registered sequence. Aborting."),s);h="start"}if("stop"!==d&&"object"!=typeof g){var v=l?1:2;g={};for(var w=v;w<arguments.length;w++)/^\d/.test(arguments[w])?g.duration=parseFloat(arguments[w]):"string"==typeof arguments[w]?g.easing=arguments[w].replace(/^\s+|\s+$/g,""):o(arguments[w])&&(g.complete=arguments[w])}var b={lastParent:null,lastPosition:null,lastFontSize:null,lastPercentToPxWidth:null,lastPercentToPxHeight:null,lastEmToPx:null,remToPxRatio:null},x=[];if(g&&!o(g.complete)&&(g.complete=null),l)s.each(i);else if(s.nodeType)i.call(s);else if(s[0]&&s[0].nodeType)for(var P in s)i.call(s[P]);var V=u.extend({},e.velocity.defaults,g);if(V.loop=parseInt(V.loop),V.loop)for(var k=0;k<2*V.loop-1;k++)l?s.velocity("reverse",{delay:V.delay}):p.animate(s,"reverse",{delay:V.delay});return s},e.velocity=p,window.Zepto&&(window.Zepto.fn.velocity=p.animate)}(window.Zepto||window,document),(window.Zepto||window).velocity.defaults={queue:"",duration:400,easing:"swing",complete:null,display:null,loop:!1,delay:!1,mobileHA:!0,_cacheValues:!0},function(e){e.velocity.Sequences.slideDown=function(t,r){var a={height:null,marginTop:null,marginBottom:null,paddingTop:null,paddingBottom:null},o={overflow:null,overflowY:null},n=r.complete;r.delay=r.delay||1,r.begin=function(){o.overflow=e.velocity.CSS.getPropertyValue(t,"overflow"),o.overflowY=e.velocity.CSS.getPropertyValue(t,"overflowY"),this.style.overflow="hidden",this.style.overflowY="hidden",t.style.height="auto",t.style.display="block";for(var r in a)a[r]=[e.velocity.CSS.getPropertyValue(t,r),0]},r.complete=function(){n&&n.call(this,this),this.style.overflow=o.overflow,this.style.overflowY=o.overflowY},e.velocity.animate(t,a,r)},e.velocity.Sequences.slideUp=function(t,r){var a={height:null,marginTop:null,marginBottom:null,paddingTop:null,paddingBottom:null,overflow:null,overflowY:null},o=r.complete;r.display=r.display||"none",r._cacheValues=!1,r.begin=function(){for(var r in a)a[r]=e.velocity.CSS.getPropertyValue(t,r);this.style.overflow="hidden",this.style.overflowY="hidden"},r.complete=function(){o&&o.call(this,this);for(var e in a)this.style[e]=a[e]},e.velocity.animate(t,{height:[0,a.height],marginTop:[0,a.marginTop],marginBottom:[0,a.marginBottom],paddingTop:[0,a.paddingTop],paddingBottom:[0,a.paddingBottom]},r)}}(window.Zepto||window);