(function(e,t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],function(o){return t(o,e,e.document)}):"object"==typeof module&&module.exports?module.exports=t(require("jquery"),e,e.document):t(jQuery,e,e.document)})("undefined"!=typeof window?window:this,function(e,t,o,n){"use strict";function r(){return b.height()+R.offset}function s(o,n,s,i){if(w===o&&(s=!1),D===!0)return!0;if(m[o]){if(M=!1,k===!0&&(R.afterRender(),k=!1),s&&"function"==typeof R.before&&R.before(o,g)===!1)return!0;if(S=1,O=p[o],k===!1&&w>o&&i===!1&&v[o]&&(l=r(),S=parseInt(g[o].outerHeight()/l),O=parseInt(p[o])+(g[o].outerHeight()-l)),R.updateHash&&R.sectionName&&(k!==!0||0!==o))if(history.pushState)try{history.replaceState(null,null,m[o])}catch(e){t.console&&console.warn("Scrollify warning: Page must be hosted to manipulate the hash value.")}else t.location.hash=m[o];if(w=o,n)e(R.target).stop().scrollTop(O),s&&R.after(o,g);else{if(x=!0,e().velocity?e(R.target).stop().velocity("scroll",{duration:R.scrollSpeed,easing:R.easing,offset:O,mobileHA:!1}):e(R.target).stop().animate({scrollTop:O},R.scrollSpeed,R.easing),t.location.hash.length&&R.sectionName&&t.console)try{e(t.location.hash).length&&console.warn("Scrollify warning: ID matches hash value - this will cause the page to anchor.")}catch(e){}e(R.target).promise().done(function(){x=!1,k=!1,s&&R.after(o,g)})}}}function i(e){function t(t){for(var o=0,n=e.slice(Math.max(e.length-t,1)),r=0;r=n}function a(e,t){for(var o=m.length;o>=0;o--)"string"==typeof e?m[o]===e&&(y=o,s(o,t,!0,!0)):o===e&&(y=o,s(o,t,!0,!0))}var c,u,l,h,d,f,p=[],m=[],g=[],v=[],y=0,w=0,S=1,H=!1,b=e(t),E=b.scrollTop(),M=!1,x=!1,T=!1,D=!1,I=[],N=(new Date).getTime(),k=!0,L=!1,O=0,z="onwheel"in o?"wheel":o.onmousewheel!==n?"mousewheel":"DOMMouseScroll",R={section:".section",sectionName:"section-name",interstitialSection:"",easing:"easeOutExpo",scrollSpeed:1100,offset:0,scrollbars:!0,target:"html,body",standardScrollElements:!1,setHeights:!0,overflowScroll:!0,updateHash:!0,touchScroll:!0,before:function(){},after:function(){},afterResize:function(){},afterRender:function(){}},j=function(n){function a(t){e().velocity?e(R.target).stop().velocity("scroll",{duration:R.scrollSpeed,easing:R.easing,offset:t,mobileHA:!1}):e(R.target).stop().animate({scrollTop:t},R.scrollSpeed,R.easing)}function w(t){t&&(E=b.scrollTop());var o=R.section;v=[],R.interstitialSection.length&&(o+=","+R.interstitialSection),R.scrollbars===!1&&(R.overflowScroll=!1),l=r(),e(o).each(function(t){var o=e(this);R.setHeights?o.is(R.interstitialSection)?v[t]=!1:o.css("height","auto").outerHeight()0?p[o]=parseInt(n.offset().top)+R.offset:p[o]=parseInt(n.offset().top),R.sectionName&&n.data(R.sectionName)?m[o]="#"+n.data(R.sectionName).toString().replace(/ /g,"-"):n.is(R.interstitialSection)===!1?m[o]="#"+(o+1):(m[o]="#",o===e(r).length-1&&o>1&&(p[o]=p[o-1]+(parseInt(e(e(r)[o-1]).outerHeight())-parseInt(e(t).height()))+parseInt(n.outerHeight()))),g[o]=n;try{e(m[o]).length&&t.console&&console.warn("Scrollify warning: Section names can't match IDs - this will cause the browser to anchor.")}catch(e){}t.location.hash===m[o]&&(y=o,H=!0)}),!0===o&&s(y,!1,!1,!1)}function O(){return!v[y]||(E=b.scrollTop(),!(E>parseInt(p[y])))}function j(){return!v[y]||(E=b.scrollTop(),l=r(),!(Ey||O())&&(y=i,s(i,e,t,!1))},wheelHandler:function(o){if(D===!0)return!0;if(R.standardScrollElements&&(e(o.target).is(R.standardScrollElements)||e(o.target).closest(R.standardScrollElements).length))return!0;v[y]||o.preventDefault();var n=(new Date).getTime();o=o||t.event;var r=o.originalEvent.wheelDelta||-o.originalEvent.deltaY||-o.originalEvent.detail,a=Math.max(-1,Math.min(1,r));if(I.length>149&&I.shift(),I.push(Math.abs(r)),n-N>200&&(I=[]),N=n,x)return!1;if(a<0){if(y0&&y>0&&O()){if(!i(I))return!1;o.preventDefault(),y--,x=!0,s(y,!1,!0,!1)}},keyHandler:function(t){return D===!0||o.activeElement.readOnly===!1||(!(!R.standardScrollElements||!e(t.target).is(R.standardScrollElements)&&!e(t.target).closest(R.standardScrollElements).length)||x!==!0&&void(38==t.keyCode||33==t.keyCode?y>0&&O()&&(t.preventDefault(),y--,s(y,!1,!0,!1)):40!=t.keyCode&&34!=t.keyCode||yMath.abs(d.touches.touchstart.x-d.touches.touchmove.x)&&(t.preventDefault(),d.touches.direction="y",d.options.timeStamp+d.options.timeGap<(new Date).getTime()&&0==d.touches.touchend&&(d.touches.touchend=!0,d.touches.touchstart.y>-1&&Math.abs(d.touches.touchmove.y-d.touches.touchstart.y)>d.options.distance&&(d.touches.touchstart.y-1&&d.touches.touchmove.y>-1&&"y"===d.touches.direction&&(Math.abs(d.touches.touchmove.y-d.touches.touchstart.y)>d.options.distance&&(d.touches.touchstart.yS?(a(parseInt(p[y])+l*S),S+=1):a(parseInt(p[y])+(g[y].outerHeight()-l))))},up:function(){y>=0&&(O()&&y>0?(y--,s(y,!1,!0,!1)):S>2?(l=r(),S-=1,a(parseInt(p[y])+l*S)):(S=1,a(parseInt(p[y]))))},init:function(){if(o.addEventListener&&R.touchScroll){var e={passive:!1};o.addEventListener("touchstart",d.touchHandler,e),o.addEventListener("touchmove",d.touchHandler,e),o.addEventListener("touchend",d.touchHandler,e)}}},f={refresh:function(e,t){clearTimeout(u),u=setTimeout(function(){w(!0),k(t,!1),e&&R.afterResize()},400)},handleUpdate:function(){f.refresh(!1,!1)},handleResize:function(){f.refresh(!0,!1)},handleOrientation:function(){f.refresh(!0,!0)}},R=e.extend(R,n),w(!1),k(!1,!0),!0===H?s(y,!1,!0,!0):setTimeout(function(){h.calculateNearest(!0,!1)},200),p.length&&(h.init(),d.init(),b.on("resize",f.handleResize),o.addEventListener&&t.addEventListener("orientationchange",f.handleOrientation,!1))};return j.move=function(t){return t!==n&&(t.originalEvent&&(t=e(this).attr("href")),void a(t,!1))},j.instantMove=function(e){return e!==n&&void a(e,!0)},j.next=function(){y0&&(y-=1,s(y,!1,!0,!0))},j.instantNext=function(){y0&&(y-=1,s(y,!0,!0,!0))},j.destroy=function(){return!!L&&(R.setHeights&&e(R.section).each(function(){e(this).css("height","auto")}),b.off("resize",f.handleResize),R.scrollbars&&(b.off("mousedown",h.handleMousedown),b.off("mouseup",h.handleMouseup),b.off("scroll",h.handleScroll)),b.off(z,h.wheelHandler),b.off("keydown",h.keyHandler),o.addEventListener&&R.touchScroll&&(o.removeEventListener("touchstart",d.touchHandler,!1),o.removeEventListener("touchmove",d.touchHandler,!1),o.removeEventListener("touchend",d.touchHandler,!1)),p=[],m=[],g=[],void(v=[]))},j.update=function(){return!!L&&void f.handleUpdate()},j.current=function(){return g[y]},j.currentIndex=function(){return y},j.disable=function(){D=!0},j.enable=function(){D=!1,L&&h.calculateNearest(!1,!1)},j.isDisabled=function(){return D},j.setOptions=function(o){return!!L&&void("object"==typeof o?(R=e.extend(R,o),f.handleUpdate()):t.console&&console.warn("Scrollify warning: setOptions expects an object."))},e.scrollify=j,j});