{"version":3,"sources":["webpack:///./node_modules/@bluekiri/alexandria-contrib-components/components/cookies/client/js/prototype.js","webpack:///./node_modules/@bluekiri/alexandria-contrib-components/components/cookies/client/js/index.js"],"names":["cookies","getCookie","cookieName","name","concat","splitCookie","document","cookie","split","value","i","length","charAt","substring","indexOf","getDomain","hostname","location","substr","module","exports","$","require","elementExist","prototype","selector","arguments","undefined","instance","Object","create","element","querySelector","closeButton","domain","animate","bottom","addEventListener"],"mappings":";4EAAA,IAAMA,EAAU,CACZC,UAAW,SAAYC,GAKnB,IAJA,IAAMC,EAAO,GAAHC,OAAMF,EAAU,KACpBG,EAAcC,SAASC,OAAOC,MAAM,KACtCC,EAAQ,GAEHC,EAAI,EAAGA,EAAIL,EAAYM,OAAQD,IAAK,CAEzC,IADAD,EAAQJ,EAAYK,GACO,MAApBD,EAAMG,OAAO,IAChBH,EAAQA,EAAMI,UAAU,GAE5B,GAA4B,IAAxBJ,EAAMK,QAAQX,GACd,OAAOM,EAAMI,UAAUV,EAAKQ,OAAQF,EAAME,QAGlD,MAAO,IAGXI,UAAW,WACP,IAAMC,EAAaV,SAASW,SAAtBD,SAMN,OAJIA,EAASR,MAAM,KAAKG,QAAU,IAC9BK,EAAWA,EAASE,OAAOF,EAASF,QAAQ,OAGzCE,IAIfG,EAAOC,QAAUpB,G,qBC7BjB,IAAMqB,EAAIC,EAAQ,QACVC,EAAiBD,EAAQ,QAAzBC,aACFC,EAAYF,EAAQ,QAE1BH,EAAOC,QAAU,WAAgE,IAAzCK,EAAQC,UAAAf,OAAA,QAAAgB,IAAAD,UAAA,GAAAA,UAAA,GAAG,6BAC/C,GAAIH,EAAaE,GAAW,CACxB,IAAMG,EAAWC,OAAOC,OAAON,GAkB/B,OAhBAI,EAASG,QAAUzB,SAAS0B,cAAcP,GAC1CG,EAASK,YAAcL,EAASG,QAAQC,cAAc,8BAEtDJ,EAASM,OAASN,EAASb,YAEiB,KAAxCa,EAAS3B,UAAU,kBACnBoB,EAAEO,EAASG,SAASI,QAAQ,CAAEC,OAAQ,GAAK,KAG/CR,EAASK,YAAYI,iBAAiB,SAAS,WACC,KAAxCT,EAAS3B,UAAU,mBACnBK,SAASC,OAAS,4CAAHH,OAA+CwB,EAASM,QACvEb,EAAEO,EAASG,SAASI,QAAQ,CAAEC,QAAS,KAAO,SAI/CR","file":"cookies.9adaa6647897eac00891.bundle.js","sourcesContent":["const cookies = {\n getCookie: function fn(cookieName) {\n const name = `${cookieName}=`;\n const splitCookie = document.cookie.split(';');\n let value = '';\n\n for (let i = 0; i < splitCookie.length; i++) {\n value = splitCookie[i];\n while (value.charAt(0) === ' ') {\n value = value.substring(1);\n }\n if (value.indexOf(name) === 0) {\n return value.substring(name.length, value.length);\n }\n }\n return '';\n },\n\n getDomain: function fn() {\n let { hostname } = document.location;\n\n if (hostname.split('.').length >= 3) {\n hostname = hostname.substr(hostname.indexOf('.'));\n }\n\n return hostname;\n }\n};\n\nmodule.exports = cookies;\n","const $ = require('jquery/dist/jquery');\nconst { elementExist } = require('@bluekiri/alexandria/helpers/domHelpers');\nconst prototype = require('./prototype');\n\nmodule.exports = function CookiesClient(selector = '[data-component=\"Cookies\"]') {\n if (elementExist(selector)) {\n const instance = Object.create(prototype);\n\n instance.element = document.querySelector(selector);\n instance.closeButton = instance.element.querySelector('[data-type=\"close-button\"]');\n\n instance.domain = instance.getDomain();\n\n if (instance.getCookie('cookiesAccept') === '') {\n $(instance.element).animate({ bottom: 0 }, 300);\n }\n\n instance.closeButton.addEventListener('click', () => {\n if (instance.getCookie('cookiesAccept') === '') {\n document.cookie = `cookiesAccept=1; expire=; path=/; domain=${instance.domain}`;\n $(instance.element).animate({ bottom: -150 }, 300);\n }\n });\n\n return instance;\n }\n};\n"],"sourceRoot":""}