{"version":3,"sources":["webpack:///./modules/ProductTagline.ts"],"names":["__webpack_require__","r","__webpack_exports__","ProductTagline","element","this","tagline","querySelectorAll","counter","querySelector","counterWidth","showCounter","setup","selector","Array","from","document","filter","node","dataset","moduleInitialized","forEach","prototype","taglineLength","length","taglineWidth","clientWidth","taglineWrapperWidth","Eucerin","isMobile","remainingTags","setCounter","secondTagline","style","maxWidth","display","classList","add","innerHTML"],"mappings":"2FAAAA,EAAAC,EAAAC,GAAA,IAEAC,EAAA,WAWI,SAAAA,EAAmBC,GAAAC,KAAAD,UACfC,KAAKC,QAAUD,KAAKD,QAAQG,iBAAiB,kBAC7CF,KAAKG,QAAUH,KAAKD,QAAQK,cAAc,YAC1CJ,KAAKK,aAAe,GACpBL,KAAKM,cAmCb,OA9CWR,EAAAS,MAAP,SAAaC,QAAA,IAAAA,MANM,kCAOfC,MAAMC,KAAKC,SAAST,iBAAiBM,IAAWI,OAAO,SAACC,GAAsB,OAACA,EAAKC,QAAQC,oBAAmBC,QAAQ,SAACjB,GACpH,IAAID,EAAeC,GACnBA,EAAQe,QAAQC,kBAAoB,UAW5CjB,EAAAmB,UAAAX,YAAA,WACI,IAAMY,EAAgBlB,KAAKC,QAAQkB,OACnCC,EAAepB,KAAKD,QAAQK,cAAc,aAAaiB,YACvDC,EAAsBtB,KAAKD,QAAQsB,YAEnC,GAAGE,QAAQC,UAAaN,EAAgB,EAAG,CACvC,IAAMO,EAAgBP,EAAgB,EACtClB,KAAK0B,WAAWD,GAIpB,IAAIF,QAAQC,SAAS,CACjB,IAAMG,EAAgB3B,KAAKD,QAAQK,cAAc,+BACjD,GAAIgB,EAAepB,KAAKK,aAAeiB,GAGnC,GAFCtB,KAAKD,QAAQK,cAAc,aAA6BwB,MAAMC,SAAW,oBAEvEF,EAAc,CACZA,EAA8BC,MAAME,QAAU,OACzCL,EAAgBP,EAAgB,EACtClB,KAAK0B,WAAWD,SAEjB,GAAGP,EAAgB,EAAE,CAClBO,EAAgBP,EAAgB,EACtClB,KAAK0B,WAAWD,MAK5B3B,EAAAmB,UAAAS,WAAA,SAAWD,GACPzB,KAAKG,QAAQ4B,UAAUC,IAAI,QAC3BhC,KAAKG,QAAQ8B,UAAa,IAAIR,GAEtC3B,EAlDA,eAoDA,IAAIA,EAAeS","file":"./modules/ProductTagline.cfa3eb2d.js","sourcesContent":["const moduleSelector = '[data-module=\"ProductTagline\"]';\r\n\r\nexport default class ProductTagline {\r\n    tagline;\r\n    counter;\r\n    counterWidth: number;\r\n    static setup(selector: string = moduleSelector): void {\r\n        Array.from(document.querySelectorAll(selector)).filter((node: HTMLElement) => !node.dataset.moduleInitialized).forEach((element: HTMLElement) => {\r\n            new ProductTagline(element);\r\n            element.dataset.moduleInitialized = 'true';\r\n        });\r\n    }\r\n\r\n    constructor(public element: HTMLElement) {\r\n        this.tagline = this.element.querySelectorAll(\".taglines span\");\r\n        this.counter = this.element.querySelector(\".counter\");\r\n        this.counterWidth = 30;\r\n        this.showCounter();\r\n    }\r\n\r\n    showCounter(){\r\n        const taglineLength = this.tagline.length,\r\n        taglineWidth = this.element.querySelector(\".taglines\").clientWidth,\r\n        taglineWrapperWidth = this.element.clientWidth;\r\n\r\n        if(Eucerin.isMobile && (taglineLength > 1)){\r\n            const remainingTags = taglineLength - 1;\r\n            this.setCounter(remainingTags);\r\n            \r\n        }\r\n\r\n        if(!Eucerin.isMobile){\r\n            const secondTagline = this.element.querySelector(\".taglines span:nth-child(2)\");\r\n            if (taglineWidth + this.counterWidth > taglineWrapperWidth){\r\n                (this.element.querySelector(\".taglines\") as HTMLElement).style.maxWidth = \"calc(100% - 30px)\"\r\n\r\n                if(secondTagline){\r\n                    (secondTagline as HTMLElement).style.display = \"none\";\r\n                    const remainingTags = taglineLength - 1;\r\n                    this.setCounter(remainingTags);\r\n                }\r\n            } else if(taglineLength > 2){\r\n                const remainingTags = taglineLength - 2;\r\n                this.setCounter(remainingTags);\r\n            }\r\n        }\r\n    }\r\n\r\n    setCounter(remainingTags){\r\n        this.counter.classList.add(\"show\");\r\n        this.counter.innerHTML =  `+${remainingTags}`; \r\n    }\r\n}\r\n\r\nnew ProductTagline.setup();"],"sourceRoot":""}