{"version":3,"file":"NoticeManager-643b9bf0.js","names":["define","Moduler","create","defaults","visitorNotice","init","self","this","notices","el","querySelectorAll","options","addEventListener","e","acceptClose","target","closest","preventDefault","notice","hideNotice","setCookie","cookieName","length","getAttribute","cookieExpires","utils","fadeOut","parentElement","removeChild","classList","remove","fadeIn","cookieExpiresIn","expires","date","Date","setTime","getTime","toUTCString","document","cookie"],"sources":["NoticeManager.js"],"mappings":"AAAAA,OAAO,CAAC,YAAY,SAAUC,GAC1B,aAMA,OAAOA,EAAQC,OAAO,CAClBC,SAAU,CACNC,cAAe,qBAGnBC,KAAM,WACF,IAAIC,EAAOC,KAEXD,EAAKE,QAAUF,EAAKG,GAAGC,iBAAiBJ,EAAKK,QAAQP,eAErDE,EAAKG,GAAGG,iBAAiB,SAAS,SAAUC,GACxC,IAAIC,EAAcD,EAAEE,OAAOC,QAAQ,sBAEnC,GAAa,MADDH,EAAEE,OAAOC,QAAQ,cACO,MAAfF,EAAqB,CACtCD,EAAEI,iBACF,IAAIC,EAASL,EAAEE,OAAOC,QAAQV,EAAKK,QAAQP,eAC3CE,EAAKa,WAAWD,EAAuB,MAAfJ,EAC5B,CACJ,GACJ,EAEAK,WAAY,SAAUD,EAAQE,GAC1B,IAAId,EAAOC,KAGPc,GAFqBf,EAAKE,QAAQc,OAErBJ,EAAOK,aAAa,qBACjCC,EAAgBN,EAAOK,aAAa,uBAEpCH,GAAaC,GACbf,EAAKc,UAAUC,EAAYG,GAG/BvB,EAAQwB,MAAMC,QAAQR,EAAQ,KAAK,WAC/BA,EAAOS,cAAcC,YAAYV,GACjCZ,EAAKE,QAAUF,EAAKG,GAAGC,iBAAiBJ,EAAKK,QAAQP,eACjDE,EAAKE,QAAQc,OAAS,IACtBhB,EAAKE,QAAQ,GAAGqB,UAAUC,OAAO,YACjC7B,EAAQwB,MAAMM,OAAOzB,EAAKE,QAAQ,GAAI,KAE9C,GACJ,EAEAY,UAAW,SAAUC,EAAYW,GAC7B,IAAIC,EAAU,GACd,GAAID,EAAkB,EAAG,CACrB,IAAIE,EAAO,IAAIC,KACfD,EAAKE,QAAQF,EAAKG,UAA+B,GAAlBL,EAAuB,KACtDC,EAAU,YAAcC,EAAKI,aACjC,CAEAC,SAASC,OAASnB,EAAa,QAAUY,EAAU,yBACvD,GAER","sourcesContent":["define(['moduler'], function (Moduler) {\r\n 'use strict';\r\n\r\n /**\r\n * Notice manager for non-disruptive visitor notices displayed at the top of window.\r\n */\r\n\r\n return Moduler.create({\r\n defaults: {\r\n visitorNotice: '.js-visitorNotice'\r\n },\r\n\r\n init: function () {\r\n var self = this;\r\n\r\n self.notices = self.el.querySelectorAll(self.options.visitorNotice);\r\n\r\n self.el.addEventListener('click', function (e) {\r\n var acceptClose = e.target.closest('.js-acceptAndClose');\r\n var close = e.target.closest('.js-close');\r\n if (close != null || acceptClose != null) {\r\n e.preventDefault();\r\n var notice = e.target.closest(self.options.visitorNotice);\r\n self.hideNotice(notice, acceptClose != null);\r\n }\r\n });\r\n },\r\n\r\n hideNotice: function (notice, setCookie) {\r\n var self = this,\r\n visitorNoticesLeft = self.notices.length,\r\n fadeFn = visitorNoticesLeft > 1 ? 'fadeOut' : 'slideUp',\r\n cookieName = notice.getAttribute('data-cookie-name'),\r\n cookieExpires = notice.getAttribute('data-cookie-expires');\r\n\r\n if (setCookie && cookieName) {\r\n self.setCookie(cookieName, cookieExpires);\r\n }\r\n\r\n Moduler.utils.fadeOut(notice, 200, function () {\r\n notice.parentElement.removeChild(notice);\r\n self.notices = self.el.querySelectorAll(self.options.visitorNotice);\r\n if (self.notices.length > 0) {\r\n self.notices[0].classList.remove('u-hidden');\r\n Moduler.utils.fadeIn(self.notices[0], 200);\r\n }\r\n });\r\n },\r\n\r\n setCookie: function (cookieName, cookieExpiresIn) {\r\n var expires = '';\r\n if (cookieExpiresIn > 0) {\r\n var date = new Date();\r\n date.setTime(date.getTime() + (cookieExpiresIn * 60 * 1000));\r\n expires = ';expires=' + date.toUTCString();\r\n }\r\n\r\n document.cookie = cookieName + '=seen' + expires + ';SameSite=Strict;path=/';\r\n }\r\n });\r\n});"]}