!function(){"use strict";class t extends HTMLElement{constructor(){super(),this.widgetId="p24_installments",this.modalId="p24_installment_modal",this.config=window?.p24InstallmentsData?.config||{}}connectedCallback(){this.showModal="true"===this.getAttribute("show-modal"),this.type=this.getAttribute("type")||"mini",this.updateContent()}async updateContent(){if(await(async(t,e,n=()=>{},a=!1,l=!1)=>{let i=document.getElementById(t);if(i&&a&&(i.remove(),i=!1),!i){const a=document.createElement("script");return a.src=e,a.id=t,l&&(a.type="application/javascript"),document.head.appendChild(a),await new Promise((t=>{a.addEventListener("load",(()=>t(n())))}))}return n(),!0})("p24-installments","https://apm.przelewy24.pl/installments/installment-calculator-app.umd.sdk.js",(()=>{}),!1,!0),!window.InstallmentCalculatorApp)return;const t=new window.InstallmentCalculatorApp(this.config);if((await t.create(`${this.type}-widget`)).render(this.widgetId),this.showModal){let e=document.getElementById(this.modalId);e||(e=document.createElement("div"),e.id=this.modalId,document.body.appendChild(e));const n=await t.create("calculator-modal"),a=document.getElementById(this.widgetId);n.render(this.modalId),a&&a.addEventListener("click",(()=>{const t=document.getElementById("installment-calculator-modal");t&&(t.style.display="block")}))}}}customElements.define("p24-installment",t)}();
