!function(t){var e={};function i(n){if(e[n])return e[n].exports;var s=e[n]={i:n,l:!1,exports:{}};return t[n].call(s.exports,s,s.exports,i),s.l=!0,s.exports}i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)i.d(n,s,function(e){return t[e]}.bind(null,s));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=39)}({39:function(t,e){for(var i=[{label:"xs",value:0},{label:"sm",value:580},{label:"md",value:768},{label:"lg",value:992},{label:"xl",value:1200},{label:"xxl",value:3e3}],n=[],s=0;s<i.length;s++)n.push(i[s].label);var o=window.innerWidth;function a(t,e){clearTimeout(t.timeId),t.timeId=setTimeout((function(){t()}),e)}function l(t){this.selector=t,this.isCollapsed=!1,this.isTablet=!1,this.isMobile=!1,this.isDesktop=!1,this.isAtTop=!0,this.hasScrolled=!1,this.isMinified=!1,this.hasOverlay=!1,this.lastActiveTab=null,this.tabsClosed=!0,this.element=document.getElementById(t),this.header=document.getElementById("header"),this.tabs=["buy-tickets","live-departures"]}l.prototype.handleScroll=function(){var t=document.body.classList.contains("page-no-scrolling");if(!document.body.classList.contains("page-overlay-on")&&!t){var e=document.getElementById("btjcd-tabs");e&&(window.scrollY>e.offsetHeight?this.minify():this.unminify())}},l.prototype.handleResize=function(){var t=window.innerWidth;t!==o&&(this.setState(),this.showLastActiveTab(),this.hideLastActiveTab(),this.handleScroll(),o=t)},l.prototype.minify=function(){this.isMinified||(this.isMinified=!0,this.element.dataset.isMinified=!0,this.header.classList.add("header-minify")),this.hideLastActiveTab(!0)},l.prototype.unminify=function(){this.isMinified&&(this.isMinified=!1,this.element.dataset.isMinified=!1,this.header.classList.remove("header-minify")),this.showLastActiveTab()},l.prototype.setState=function(){var t=function(){for(var t=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,e=0;e<i.length;e++){var n=i[e].value,s=1e4;if(i[e+1]&&(s=i[e+1].value),t>=n&&t<s)return i[e].label}return!1}();this.isTablet=!1,this.isMobile=!1,this.isDesktop=!1,"lg"===t||"xl"===t||"xxl"===t?this.isDesktop=!0:"md"===t?this.isTablet=!0:"sm"!==t&&"xs"!==t||(this.isMobile=!0)},l.prototype.showLastActiveTab=function(){if(this.isDesktop){var t=!1;t=this.lastActiveTab?this.tabs[this.lastActiveTab]:this.tabs[0];var e=document.getElementById("tbt-".concat(t));t&&e&&new window.Tab(e).show()}},l.prototype.hideLastActiveTab=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.tabsClosed=!1,this.isMobile||this.isTablet||t){var e=document.getElementById("tbt-tbh-btld");e&&(e.classList.contains("active")||(new window.Tab(e).show(),(this.isMobile||this.isTablet)&&(this.tabsClosed=!0)))}},l.prototype.setListeners=function(){var t=this,e=this;window.addEventListener("scroll",(function(){a((function(){e.handleScroll()}),100)})),window.addEventListener("resize",(function(){a((function(){e.handleResize()}),100)})),this.tabs.forEach((function(i,n){var s=document.getElementById("tbt-".concat(i));s&&(s.addEventListener("mousedown",(function(i){t.isTablet&&(e.lastActiveTab!==n||e.tabsClosed?(e.tabsClosed=!1,e.lastActiveTab=null):(e.hideLastActiveTab(),i.preventDefault()))})),s.addEventListener("show.bs.tab",(function(i){t.isTablet&&e.lastActiveTab===n&&e.tabsClosed?i.preventDefault():e.lastActiveTab=n})))}))},l.prototype.constructMe=function(){this.setState(),this.setListeners(),this.showLastActiveTab()},function(t,e){t.behaviors.journeyPlannerBar={attach:function(t){console.log("Loaded -- Journey Panner Bar"),e("journeyPlanner","html",document).forEach((function(t){new l("hdr").constructMe()}))}}}(Drupal,once)}});
//# sourceMappingURL=journey-planner-bar.js.map