{"version":3,"sources":["components/analytics/delayed-script/_base/delayed-script.js"],"names":["DelayedScript","Component","constructor","el","requiredCookiesConsent","Number","parseInt","$el","dataset","requiredConsent","content","isNaN","callback","ev","onCookiesConsentStored","detail","EventBus","getInstance","addEventListener","consent","window","cookieConsent","removeEventListener","console","log","nodes","Util","parseStringToElements","replaceWith"],"mappings":"aAAA,KAAMA,CAAAA,aAAN,QAA4BC,CAAAA,SAAU,CAElCC,WAAW,CAACC,EAAD,CAAK,CACZ,MAAMA,EAAN,EAEA,KAAKC,sBAAL,CAA8BC,MAAM,CAACC,QAAP,CAAgB,KAAKC,GAAL,CAASC,OAAT,CAAiBC,eAAjC,CAA9B,CACA,KAAKC,OAAL,CAAe,KAAKH,GAAL,CAASC,OAAT,CAAiBE,OAAhC,CACA,GAAIC,KAAK,CAAC,KAAKP,sBAAN,CAAL,EAAsC,CAAC,KAAKM,OAAhD,CAAyD,CACrD,MACH,CAED,KAAME,CAAAA,QAAQ,CAAIC,EAAD,EAAQ,KAAKC,sBAAL,CAA4BD,EAAE,CAACE,MAA/B,CAAuCH,QAAvC,CAAzB,CACAI,QAAQ,CAACC,WAAT,GAAuBC,gBAAvB,CAAwC,sBAAxC,CAAgEN,QAAhE,EACA,KAAKE,sBAAL,CAA4B,CAACK,OAAO,CAAEC,MAAM,CAACC,aAAjB,CAA5B,CAA6DT,QAA7D,CACH,CAMDE,sBAAsB,CAACD,EAAD,CAAKD,QAAL,CAAe,CACjC,GAAI,CAAC,KAAKF,OAAV,CAAmB,CACfM,QAAQ,CAACC,WAAT,GAAuBK,mBAAvB,CAA2C,sBAA3C,CAAmEV,QAAnE,EACA,MACH,CAED,KAAMO,CAAAA,OAAO,CAAG,KAAKf,sBAAL,CAA8BS,EAAE,CAACM,OAAjD,CACA,GAAIA,OAAO,GAAK,KAAKf,sBAArB,CAA6C,CACzCmB,OAAO,CAACC,GAAR,CAAY,UAAZ,EACA,KAAMC,CAAAA,KAAK,CAAGC,IAAI,CAACC,qBAAL,CAA2B,KAAKjB,OAAhC,CAAd,CACA,KAAKH,GAAL,CAASqB,WAAT,CAAqB,GAAGH,KAAxB,EAEA,KAAKf,OAAL,CAAe,EAAf,CACAM,QAAQ,CAACC,WAAT,GAAuBK,mBAAvB,CAA2C,sBAA3C,CAAmEV,QAAnE,CACH,CACJ,CAnCiC","sourcesContent":["class DelayedScript extends Component {\n\n constructor(el) {\n super(el);\n\n this.requiredCookiesConsent = Number.parseInt(this.$el.dataset.requiredConsent);\n this.content = this.$el.dataset.content;\n if (isNaN(this.requiredCookiesConsent) || !this.content) {\n return\n }\n\n const callback = (ev) => this.onCookiesConsentStored(ev.detail, callback);\n EventBus.getInstance().addEventListener('cookiesConsentStored', callback);\n this.onCookiesConsentStored({consent: window.cookieConsent}, callback); // Pro načítání scriptů přes ajax\n }\n\n /**\n * @param {{consent: number}} ev\n * @param callback\n */\n onCookiesConsentStored(ev, callback) {\n if (!this.content) {\n EventBus.getInstance().removeEventListener('cookiesConsentStored', callback)\n return\n }\n\n const consent = this.requiredCookiesConsent & ev.consent\n if (consent === this.requiredCookiesConsent) {\n console.log('printing')\n const nodes = Util.parseStringToElements(this.content)\n this.$el.replaceWith(...nodes)\n // Odstraníme, již jsme scripty načetly\n this.content = ''\n EventBus.getInstance().removeEventListener('cookiesConsentStored', callback)\n }\n }\n\n}\n"],"file":"delayed-script.min.js"}