{"version":3,"file":"compare-at-price-info-section-xxxxxxxxxxxxxxxxxxxx.min.js","mappings":"yBAOA,MAAMA,2BAA2BC,YAQvBC,cAAgBC,KAAKC,gBAAgBC,KAAKF,MAE3C,iBAAAG,GACLH,KAAKI,uBACLJ,KAAKK,QACP,CAEO,oBAAAC,GACUN,KAAKO,WAAWC,cAAc,UACtCC,oBAAoB,QAAST,KAAKD,cAC3C,CAEQ,oBAAAK,GACDJ,KAAKO,aACRP,KAAKU,aAAa,CAAEC,KAAM,SAC1BX,KAAKO,WAAWK,UAAY,87BAEhC,CAEQ,MAAAP,GACSL,KAAKO,WAAWC,cAAc,UACtCK,iBAAiB,QAASb,KAAKD,cACxC,CAEQ,eAAAE,CAAgBa,GAEtB,MAAMC,EAAiB,IAAIC,YAAoB,mCAAoC,CACjFC,OAAQ,CAAEC,QAASlB,KAAKmB,QAAQD,WAElCE,cAAcL,EAChB,EASGM,eAAeC,IAAI,0BACtBD,eAAeE,OAAO,wBAAyB1B","sources":["webpack://lange/./scripts/sections/compare-at-price-info/compare-at-price-info/index.ts"],"sourcesContent":["import { CustomElement } from '@integrabeauty/custom-elements';\nimport html from './index.html';\nimport styles from './index.scss';\n\n/**\n * Renders a button which, when clicked, requests showing the compare at price modal.\n */\nclass CompareAtPriceInfo extends HTMLElement implements CustomElement {\n  declare readonly dataset: {\n    /**\n     * Content to be displayed in the compare at price modal for a particular variant\n     */\n    content: string;\n  };\n\n  private onButtonBound = this.onButtonClicked.bind(this);\n\n  public connectedCallback() {\n    this.initializeShadowRoot();\n    this.render();\n  }\n\n  public disconnectedCallback() {\n    const anchor = this.shadowRoot.querySelector('button');\n    anchor.removeEventListener('click', this.onButtonBound);\n  }\n\n  private initializeShadowRoot() {\n    if (!this.shadowRoot) {\n      this.attachShadow({ mode: 'open' });\n      this.shadowRoot.innerHTML = `<style>${styles}</style>${html}`;\n    }\n  }\n\n  private render() {\n    const anchor = this.shadowRoot.querySelector('button');\n    anchor.addEventListener('click', this.onButtonBound);\n  }\n\n  private onButtonClicked(_event: Event) {\n    type Detail = WindowEventMap['compare-at-price-modal-requested']['detail'];\n    const modalShowEvent = new CustomEvent<Detail>('compare-at-price-modal-requested', {\n      detail: { content: this.dataset.content }\n    });\n    dispatchEvent(modalShowEvent);\n  }\n}\n\ndeclare global {\n  interface HTMLElementTagNameMap {\n    'compare-at-price-info': CompareAtPriceInfo;\n  }\n}\n\nif (!customElements.get('compare-at-price-info')) {\n  customElements.define('compare-at-price-info', CompareAtPriceInfo);\n}\n"],"names":["CompareAtPriceInfo","HTMLElement","onButtonBound","this","onButtonClicked","bind","connectedCallback","initializeShadowRoot","render","disconnectedCallback","shadowRoot","querySelector","removeEventListener","attachShadow","mode","innerHTML","addEventListener","_event","modalShowEvent","CustomEvent","detail","content","dataset","dispatchEvent","customElements","get","define"],"sourceRoot":""}