!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="/assets/packs/",i(i.s=1350)}({1350:function(t,e,i){"use strict";i.r(e);var n,s=function(t,e){return function(){return t.apply(e,arguments)}},o=[].slice,a=[].indexOf||function(t){for(var e=0,i=this.length;e0?n.split(","):[]},n.prototype.lsSet=function(t,e){var i,n,s;try{return e instanceof Array?null!=(n=window.localStorage)?n.setItem(this.lsKey(t),e.slice(-30).join(",")):void 0:null!=(s=window.localStorage)?s.removeItem(this.lsKey(t)):void 0}catch(o){return i=o,this.warn(i)}},n.prototype.migrateLocalStorage=function(){var t;return t=this.lsGetState(),this.lsSetState({seen:null,read:null,_seen:t.seen,_read:t.read}),this.reload()},n.prototype.setState=function(t){return this.state=t,"server"!==this.remoteOptions.activeStorage&&this.lsSetState(t),this.onWidgetUpdate(this),this.log("Widget.setState",t)},n.prototype.show=function(){var t,e,i,n;return this.widgetPosition=(t=null,e=10,i=Math.min,n=Math.max,{update:function(s){s.scrollX,s.scrollY;var o,a,r=s.viewportWidth,h=s.viewportHeight,l=s.badgeX,d=s.badgeY,c=s.badgeWidth,p=s.badgeHeight,g=s.widgetWidth,u=s.widgetHeight,m=s.positionX,f=s.positionY,b=i(u,n(t=t||u,600)),y=null;switch(m){case"right":o=l,"center"==f&&(o+=c);break;case"left":o=l+c-g,"center"==f&&(o-=c);break;default:throw"Invalid positionX: ".concat(m)}switch(f){case"top":a=(y=d-b)+b-e;break;case"bottom":a=h-(y=d+p)-e;break;case"center":a=h-(y=d+(p-t)/2)-e;break;default:throw"Invalid positionY: ".concat(f)}var v=n(i(a,b),i(250,u,t)),w=0-o,W=o+g-r,H=0-y,_=y+(v-=n(0,v+20-h))-h;return W+e>0&&(o-=W+e),w+e>0&&(o=e),_+e>0&&(y-=_+e),H+e>0&&(y=e),{top:y,left:o,height:v}}}),this.setPosition(),this.iframeCont.classList.add("HW_visible"),this.postMessage("opened",{}),this.makeAccessible(),this.visible=!0},n.prototype.getPosition=function(){var t,e,i,n,s,o,a;return t=this.elements.badgeCont.getBoundingClientRect(),n=this.iframeCont.getBoundingClientRect(),(e={badge:{width:t.width,height:t.height,top:t.top,left:t.left},frame:{width:n.width,height:n.height}}).frame.height=parseInt(this.iframeCont.style.height),s=parseInt(e.frame.width),a={top:parseInt(e.badge.height),right:s-e.badge.width},{y:e.badge.top+e.frame.height>document.documentElement.clientHeight,x:e.badge.left+s>document.documentElement.clientWidth},o={x:"right",y:"bottom"},e.badge.left+s>document.documentElement.clientWidth&&e.badge.left-s>=0&&(o.x="left"),e.badge.top+e.frame.height>document.documentElement.clientHeight&&e.badge.top-e.frame.height>=0&&(o.y="top"),(null!=(i=this.localOptions.position)?i.y:void 0)&&(o.y=i.y),(null!=i?i.x:void 0)&&(o.x=i.x),e.badge.left-s<0&&(o.x="fill"),[e.badge,e.frame,a,o]},n.prototype.newSetPosition=function(t){var e,i,n;if(null==t&&(t=!1),e=this.elements.badgeCont.getBoundingClientRect(),n=this.iframeCont.getBoundingClientRect(),i=this.widgetPosition.update({scrollX:window.pageXOffset,scrollY:window.pageYOffset,viewportWidth:document.documentElement.clientWidth,viewportHeight:document.documentElement.clientHeight,badgeX:e.left,badgeY:e.top,badgeWidth:e.width,badgeHeight:e.height,widgetWidth:n.width,widgetHeight:this.currentHeight,positionX:this.position.x,positionY:this.position.y}),t||this.iframeCont.classList.add("HW_notransition"),this.setIframeHeight(i.height),this.iframeCont.style.left=i.left+"px",this.iframeCont.style.top=i.top+"px",!t)return this.iframeCont.offsetHeight,this.iframeCont.classList.remove("HW_notransition")},n.prototype.classicSetPosition=function(){var t,e,i,n,s;return t=(s=this.getPosition())[0],e=s[1],n=s[2],"right"===(i=s[3]).x?this.iframeCont.style.left=t.left+"px":"left"===i.x?this.iframeCont.style.left=t.left-n.right+"px":this.iframeCont.style.left="0px","top"===i.y?this.iframeCont.style.top=t.top+n.top-e.height-t.height+"px":this.iframeCont.style.top=t.top+n.top+"px"},n.prototype.setPosition=function(){return this.newWidgetPositioning?this.newSetPosition():this.classicSetPosition()},n.prototype.updatePosition=function(){if(!this.localOptions.embed&&this.visible)return this.ticking||window.requestAnimationFrame((t=this,function(){return t.setPosition(),t.ticking=!1})),this.ticking=!0;var t},n.prototype.hide=function(){if(this.visible)return this.visible=!1,this.iframeCont.classList.remove("HW_visible"),this.postMessage("closed",{}),this.makeInaccessible(),this.onHideWidget(this)},n.prototype.reload=function(){return this.postMessage("reload")},n.prototype.triggerCallback=function(t,e){var i,n;if(e=Array.prototype.slice.call(arguments),t=e.shift(),null!=this.localCallbacks)return n=this,i=function(){var i;return null!=(i=n.localCallbacks[t])?i.apply(n,e):void 0},setTimeout(i,0)},n.prototype.toggle=function(t){if(t&&(t.preventDefault(),t.stopPropagation()),this.widgetIsReady)return this.visible?this.hide():(this.show(),this.onShowWidget())},n.prototype.showWidgetBadge=function(){return this.badgeIsReady=!0,this.setBadge(this.getUnseenCount()),this.onShowWidgetBadge(this.getUnseenCount())},n.prototype.setBadge=function(t){var e;if((this.setUnseenCount(t),this.badgeIsReady)&&!this.localOptions.embed)return t>=1?(this.elements.badge.classList.add("HW_visible"),this.elements.badge.classList.remove("HW_softHidden"),this.setStyles(this.elements.badge,"badge"),this.elements.badge.innerText=t,this.remoteOptions.eyecatcher?this.setupEyecatcher():void 0):(this.removeEyecatcher(),this.remoteOptions.softHide?(this.elements.badge.classList.remove("HW_visible"),this.elements.badge.classList.add("HW_softHidden"),this.setStyles(this.elements.badge,"badge","softHidden"),this.elements.badge.innerText=""):(window.setTimeout((e=this,function(){return e.elements.badgeCont.classList.remove("HW_visible")}),300),this.elements.badge.classList.remove("HW_visible"),this.elements.badge.classList.add("HW_hidden"),this.elements.badge.innerText=t))},n.prototype.setHeight=function(t){return this.newWidgetPositioning?this.newSetHeight(t):this.classicSetHeight(t)},n.prototype.newSetHeight=function(t){if(this.currentHeight!==t.height&&(this.currentHeight=t.height,this.setIframeHeight(t.height),this.visible))return this.newSetPosition(!0)},n.prototype.setIframeHeight=function(t){return this.iframe.style.height=t+"px",this.iframeCont.style.height=t+"px"},n.prototype.classicSetHeight=function(t){var e;return e=Math.min(t.height,500),this.setIframeHeight(e),this.iframeCont.getBoundingClientRect().y+e>window.innerHeight?(this.widgetPositionUpdated=!0,this.setPosition()):this.widgetPositionUpdated?(this.setPosition(),this.widgetPositionUpdated=!1):void 0},n.prototype.widgetReady=function(t){var e;if(this.iframeData=t,this.attachListeners(),this.elements.badgeCont.classList.add("HW_visible"),this.remoteOptions=t.options,this.state=t.state,this.setBadge(t.badgeCount),window.setTimeout((e=this,function(){return e.showWidgetBadge()}),1e3*(this.widgetIsReady?1:this.remoteOptions.badgeDelay)),this.log("Widget.widgetReady",t),this.changelogs=t.changelogs,this.widgetIsReady||(this.widgetIsReady=!0,this.onWidgetReady(this)),this.onWidgetUpdate(this),this.localOptions.embed)return this.show()},n.prototype.getChangelogs=function(){var t,e,i,n,s,o;for(e=0,i=(n=this.changelogs).length;e=0),t.seen=(o=t.id.toString(),a.call(this.lsGet("seen"),o)>=0);return this.changelogs},n.prototype.getUnseenCount=function(){return this.unseenCount},n.prototype.setUnseenCount=function(t){return this.unseenCount=t,this.elements.badge.dataset.countUnseen=t>0?t:""},n.prototype.getPrivateToken=function(){if(!this.widgetIsReady)throw"getPrivateToken has to be called after `onWidgetReady` callback";return this.remoteOptions.token},n.prototype.setupEyecatcher=function(){var t;if(!this.elements.animate.parentNode)return this.makeStylesheetAsync(this.elements.animate),this.elements.animate.setAttribute("rel","stylesheet"),this.elements.animate.setAttribute("href",this.headwayAnimateCssUrl),document.head.appendChild(this.elements.animate),t=["blank","pulse","jello","rubberBand","wobble","shake","bounce"],this.elements.badge.classList.add("HW_animated"),this.upgradeEyecatcher(t)},n.prototype.makeStylesheetAsync=function(t){return t.setAttribute("media","print"),t.addEventListener("load",(function(e){return t.setAttribute("media","all")}))},n.prototype.upgradeEyecatcher=function(t){var e,i;return e=0,5,this.eyecatcherInterval=setInterval((i=this,function(){var n,s;return n=t[Math.floor(e/5)]||t[t.length-1],s="HW_"+n,i.elements.badge.classList.add(s),setTimeout((function(){return i.elements.badge.classList.remove(s)}),1e3),e++}),5500)},n.prototype.removeEyecatcher=function(){var t;if(this.elements.badge.className="HW_badge",null!=(t=this.elements.animate.parentNode)&&t.removeChild(this.elements.animate),this.eyecatcherInterval)return clearInterval(this.eyecatcherInterval)},n.prototype.documentReady=function(t){switch(document.readyState){case"interactive":case"complete":return t();default:return window.addEventListener("DOMContentLoaded",t,!1)}},n.prototype.getNewWidget=function(){return new n},n.prototype.markGlobal=function(){return this.global=!0},n}(),window.Headway=new n,window.Headway.markGlobal(),"undefined"!==typeof HW_config&&null!==HW_config&&window.Headway.init(HW_config)}});