!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("./foundation.core"),require("./foundation.smoothScroll"),require("./foundation.util.motion"),require("jquery")):"function"==typeof define&&define.amd?define(["./foundation.core","./foundation.smoothScroll","./foundation.util.motion","jquery"],e):"object"==typeof exports?exports["foundation.magellan"]=e(require("./foundation.core"),require("./foundation.smoothScroll"),require("./foundation.util.motion"),require("jquery")):(t.__FOUNDATION_EXTERNAL__=t.__FOUNDATION_EXTERNAL__||{},t.__FOUNDATION_EXTERNAL__["foundation.magellan"]=e(t.__FOUNDATION_EXTERNAL__["foundation.core"],t.__FOUNDATION_EXTERNAL__["foundation.smoothScroll"],t.__FOUNDATION_EXTERNAL__["foundation.util.motion"],t.jQuery))}(window,function(i,n,o,r){return a={"./foundation.core":function(t,e){t.exports=i},"./foundation.smoothScroll":function(t,e){t.exports=n},"./foundation.util.motion":function(t,e){t.exports=o},"./js/entries/plugins/foundation.magellan.js":function(t,e,i){"use strict";i.r(e);var n=i("./foundation.core");i.d(e,"Foundation",function(){return n.Foundation});var o=i("./js/foundation.magellan.js");i.d(e,"Magellan",function(){return o.Magellan}),n.Foundation.plugin(o.Magellan,"Magellan")},"./js/foundation.magellan.js":function(t,e,i){"use strict";i.r(e),i.d(e,"Magellan",function(){return n});var e=i("jquery"),a=i.n(e),r=i("./foundation.core"),s=i("./foundation.smoothScroll"),l=i("./js/foundation.util.triggers.js");function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function c(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function u(t,e){return(u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function f(i){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=d(i);return function(t,e){{if(e&&("object"===o(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined")}return function(t){if(void 0!==t)return t;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(t)}(this,n?(t=d(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments))}}function d(t){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var n=function(){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&u(t,e)}(o,r["Plugin"]);var t,e,i,n=f(o);function o(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),n.apply(this,arguments)}return t=o,(e=[{key:"_setup",value:function(t,e){this.$element=t,this.options=a.a.extend({},o.defaults,this.$element.data(),e),this.className="Magellan",l.Triggers.init(a.a),this._init(),this.calcPoints()}},{key:"_init",value:function(){var t=this.$element[0].id||Object(r.GetYoDigits)(6,"magellan");this.$targets=a()("[data-magellan-target]"),this.$links=this.$element.find("a"),this.$element.attr({"data-resize":t,"data-scroll":t,id:t}),this.$active=a()(),this.scrollPos=parseInt(window.pageYOffset,10),this._events()}},{key:"calcPoints",value:function(){var i=this,t=document.body,e=document.documentElement;this.points=[],this.winHeight=Math.round(Math.max(window.innerHeight,e.clientHeight)),this.docHeight=Math.round(Math.max(t.scrollHeight,t.offsetHeight,e.clientHeight,e.scrollHeight,e.offsetHeight)),this.$targets.each(function(){var t=a()(this),e=Math.round(t.offset().top-i.options.threshold);t.targetPoint=e,i.points.push(e)})}},{key:"_events",value:function(){var e=this;a()(window).one("load",function(){e.options.deepLinking&&location.hash&&e.scrollToLoc(location.hash),e.calcPoints(),e._updateActive()}),e.onLoadListener=Object(r.onLoad)(a()(window),function(){e.$element.on({"resizeme.zf.trigger":e.reflow.bind(e),"scrollme.zf.trigger":e._updateActive.bind(e)}).on("click.zf.magellan",'a[href^="#"]',function(t){t.preventDefault();t=this.getAttribute("href");e.scrollToLoc(t)})}),this._deepLinkScroll=function(){e.options.deepLinking&&e.scrollToLoc(window.location.hash)},a()(window).on("hashchange",this._deepLinkScroll)}},{key:"scrollToLoc",value:function(t){this._inTransition=!0;var e=this,i={animationEasing:this.options.animationEasing,animationDuration:this.options.animationDuration,threshold:this.options.threshold,offset:this.options.offset};s.SmoothScroll.scrollToLoc(t,i,function(){e._inTransition=!1})}},{key:"reflow",value:function(){this.calcPoints(),this._updateActive()}},{key:"_updateActive",value:function(){var e,i,t,n,o,r,s=this;this._inTransition||(e=parseInt(window.pageYOffset,10),i=this.scrollPos>e,(this.scrollPos=e)<this.points[0]-this.options.offset-(i?this.options.threshold:0)||(r=e+this.winHeight===this.docHeight?this.points.length-1:(o=this.points.filter(function(t){return t-s.options.offset-(i?s.options.threshold:0)<=e})).length?o.length-1:0),t=this.$active,n="",void 0!==r?(this.$active=this.$links.filter('[href="#'+this.$targets.eq(r).data("magellan-target")+'"]'),this.$active.length&&(n=this.$active[0].getAttribute("href"))):this.$active=a()(),o=!(!this.$active.length&&!t.length||this.$active.is(t)),r=n!==window.location.hash,o&&(t.removeClass(this.options.activeClass),this.$active.addClass(this.options.activeClass)),this.options.deepLinking&&r&&(window.history.pushState?(r=n||window.location.pathname+window.location.search,this.options.updateHistory?window.history.pushState({},"",r):window.history.replaceState({},"",r)):window.location.hash=n),o&&this.$element.trigger("update.zf.magellan",[this.$active]))}},{key:"_destroy",value:function(){var t;this.$element.off(".zf.trigger .zf.magellan").find(".".concat(this.options.activeClass)).removeClass(this.options.activeClass),this.options.deepLinking&&(t=this.$active[0].getAttribute("href"),window.location.hash.replace(t,"")),a()(window).off("hashchange",this._deepLinkScroll),this.onLoadListener&&a()(window).off(this.onLoadListener)}}])&&c(t.prototype,e),i&&c(t,i),o}();n.defaults={animationDuration:500,animationEasing:"linear",threshold:50,activeClass:"is-active",deepLinking:!1,updateHistory:!1,offset:0}},"./js/foundation.util.triggers.js":function(t,e,i){"use strict";i.r(e),i.d(e,"Triggers",function(){return c});var e=i("jquery"),r=i.n(e),n=i("./foundation.core"),o=i("./foundation.util.motion");function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(e,i){e.data(i).split(" ").forEach(function(t){r()("#".concat(t))["close"===i?"trigger":"triggerHandler"]("".concat(i,".zf.trigger"),[e])})}var l=function(){for(var t=["WebKit","Moz","O","Ms",""],e=0;e<t.length;e++)if("".concat(t[e],"MutationObserver")in window)return window["".concat(t[e],"MutationObserver")];return!1}(),c={Listeners:{Basic:{},Global:{}},Initializers:{}};function u(t,e,i){var n,o=Array.prototype.slice.call(arguments,3);r()(window).on(e,function(){n&&clearTimeout(n),n=setTimeout(function(){i.apply(null,o)},t||10)})}c.Listeners.Basic={openListener:function(){a(r()(this),"open")},closeListener:function(){r()(this).data("close")?a(r()(this),"close"):r()(this).trigger("close.zf.trigger")},toggleListener:function(){r()(this).data("toggle")?a(r()(this),"toggle"):r()(this).trigger("toggle.zf.trigger")},closeableListener:function(t){var e=r()(this).data("closable");t.stopPropagation(),""!==e?o.Motion.animateOut(r()(this),e,function(){r()(this).trigger("closed.zf")}):r()(this).fadeOut().trigger("closed.zf")},toggleFocusListener:function(){var t=r()(this).data("toggle-focus");r()("#".concat(t)).triggerHandler("toggle.zf.trigger",[r()(this)])}},c.Initializers.addOpenListener=function(t){t.off("click.zf.trigger",c.Listeners.Basic.openListener),t.on("click.zf.trigger","[data-open]",c.Listeners.Basic.openListener)},c.Initializers.addCloseListener=function(t){t.off("click.zf.trigger",c.Listeners.Basic.closeListener),t.on("click.zf.trigger","[data-close]",c.Listeners.Basic.closeListener)},c.Initializers.addToggleListener=function(t){t.off("click.zf.trigger",c.Listeners.Basic.toggleListener),t.on("click.zf.trigger","[data-toggle]",c.Listeners.Basic.toggleListener)},c.Initializers.addCloseableListener=function(t){t.off("close.zf.trigger",c.Listeners.Basic.closeableListener),t.on("close.zf.trigger","[data-closeable], [data-closable]",c.Listeners.Basic.closeableListener)},c.Initializers.addToggleFocusListener=function(t){t.off("focus.zf.trigger blur.zf.trigger",c.Listeners.Basic.toggleFocusListener),t.on("focus.zf.trigger blur.zf.trigger","[data-toggle-focus]",c.Listeners.Basic.toggleFocusListener)},c.Listeners.Global={resizeListener:function(t){l||t.each(function(){r()(this).triggerHandler("resizeme.zf.trigger")}),t.attr("data-events","resize")},scrollListener:function(t){l||t.each(function(){r()(this).triggerHandler("scrollme.zf.trigger")}),t.attr("data-events","scroll")},closeMeListener:function(t,e){t=t.namespace.split(".")[0];r()("[data-".concat(t,"]")).not('[data-yeti-box="'.concat(e,'"]')).each(function(){var t=r()(this);t.triggerHandler("close.zf.trigger",[t])})}},c.Initializers.addClosemeListener=function(t){var e=r()("[data-yeti-box]"),i=["dropdown","tooltip","reveal"];t&&("string"==typeof t?i.push(t):"object"===s(t)&&"string"==typeof t[0]?i=i.concat(t):console.error("Plugin names must be strings")),e.length&&(i=i.map(function(t){return"closeme.zf.".concat(t)}).join(" "),r()(window).off(i).on(i,c.Listeners.Global.closeMeListener))},c.Initializers.addResizeListener=function(t){var e=r()("[data-resize]");e.length&&u(t,"resize.zf.trigger",c.Listeners.Global.resizeListener,e)},c.Initializers.addScrollListener=function(t){var e=r()("[data-scroll]");e.length&&u(t,"scroll.zf.trigger",c.Listeners.Global.scrollListener,e)},c.Initializers.addMutationEventsListener=function(t){if(!l)return!1;function e(t){var e=r()(t[0].target);switch(t[0].type){case"attributes":"scroll"===e.attr("data-events")&&"data-events"===t[0].attributeName&&e.triggerHandler("scrollme.zf.trigger",[e,window.pageYOffset]),"resize"===e.attr("data-events")&&"data-events"===t[0].attributeName&&e.triggerHandler("resizeme.zf.trigger",[e]),"style"===t[0].attributeName&&(e.closest("[data-mutate]").attr("data-events","mutate"),e.closest("[data-mutate]").triggerHandler("mutateme.zf.trigger",[e.closest("[data-mutate]")]));break;case"childList":e.closest("[data-mutate]").attr("data-events","mutate"),e.closest("[data-mutate]").triggerHandler("mutateme.zf.trigger",[e.closest("[data-mutate]")]);break;default:return!1}}var i=t.find("[data-resize], [data-scroll], [data-mutate]");if(i.length)for(var n=0;n<=i.length-1;n++)new l(e).observe(i[n],{attributes:!0,childList:!0,characterData:!1,subtree:!0,attributeFilter:["data-events","style"]})},c.Initializers.addSimpleListeners=function(){var t=r()(document);c.Initializers.addOpenListener(t),c.Initializers.addCloseListener(t),c.Initializers.addToggleListener(t),c.Initializers.addCloseableListener(t),c.Initializers.addToggleFocusListener(t)},c.Initializers.addGlobalListeners=function(){var t=r()(document);c.Initializers.addMutationEventsListener(t),c.Initializers.addResizeListener(250),c.Initializers.addScrollListener(),c.Initializers.addClosemeListener()},c.init=function(t,e){Object(n.onLoad)(r()(window),function(){!0!==r.a.triggersInitialized&&(c.Initializers.addSimpleListeners(),c.Initializers.addGlobalListeners(),r.a.triggersInitialized=!0)}),e&&(e.Triggers=c,e.IHearYou=c.Initializers.addGlobalListeners)}},8:function(t,e,i){t.exports=i("./js/entries/plugins/foundation.magellan.js")},jquery:function(t,e){t.exports=r}},l={},s.m=a,s.c=l,s.d=function(t,e,i){s.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},s.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(s.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)s.d(i,n,function(t){return e[t]}.bind(null,n));return i},s.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return s.d(e,"a",e),e},s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},s.p="",s(s.s=8);function s(t){if(l[t])return l[t].exports;var e=l[t]={i:t,l:!1,exports:{}};return a[t].call(e.exports,e,e.exports,s),e.l=!0,e.exports}var a,l});
//# sourceMappingURL=foundation.magellan.min.js.map
