(()=>{class t extends HTMLElement{static get observedAttributes(){return["title","description","retryButtonText"]}connectedCallback(){this.build()}attributeChangedCallback(){this.firstElementChild&&(this.removeChild(this.firstElementChild),this.build())}build(){const t=this.createAlertDetails(),e=this.createCardContent();t.appendChild(e),this.appendChild(t)}createAlertDetails(){const t=document.createElement("div");return t.classList.add("mp-alert-details-card"),t}createCardContent(){const t=document.createElement("div");t.classList.add("mp-alert-details-card-content");const e=document.createElement("div");e.classList.add("mp-alert-details-card-content-left");const n=document.createElement("div");n.classList.add("mp-alert-details-card-content-right"),t.appendChild(e),t.appendChild(n);const i=this.createBadge(),a=this.createTitle(),r=this.createDescription(),s=this.createRetryButton();return e.appendChild(i),n.appendChild(a),n.appendChild(r),n.appendChild(s),t}createBadge(){const t=document.createElement("div");return t.innerHTML="!",t.classList.add("mp-alert-details-badge"),t}createTitle(){const t=document.createElement("p");return t.innerHTML=this.getAttribute("title"),t.classList.add("mp-alert-details-title"),t}createDescription(){const t=document.createElement("p");return t.innerHTML=this.getAttribute("description"),t.classList.add("mp-alert-details-description"),t}createRetryButton(){const t=this.getAttribute("retryButtonText"),e=document.createElement("button");return e.classList.add("mp-alert-details-retry-button"),e.innerHTML=t,e.onclick=()=>document.location.reload(),e}}customElements.define("alert-details",t)})(),(()=>{class t extends HTMLElement{connectedCallback(){this.render()}getBadgeIcon(t="warning"){return{error:"X",warning:"!"}[t]}render(){const t=this.getAttribute("description")||"",e=this.getAttribute("type")||"warning",n=this.getBadgeIcon(e);this.innerHTML=`\n      <div class="mp-andes-notice-card ${e}">\n        <div class="mp-andes-notice-card-content">\n          <div class="mp-andes-notice-badge ${e}">${n}</div>\n          <span class="mp-andes-notice-description">\n            ${t}\n          </span>\n        </div>\n      </div>\n    `}}customElements.define("andes-notice",t)})(),(()=>{class t extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.render()}render(){const t=document.createElement("div");t.classList.add("mp-info-notification");const e=document.createElement("div");e.classList.add("content");const n=document.createElement("img");n.src=this.getAttribute("src"),n.alt="Icone de informação",n.classList.add("icon");const i=document.createElement("div");i.classList.add("message"),i.textContent=this.getAttribute("message")||"Mensagem de informação",e.appendChild(n),e.appendChild(i),t.appendChild(e);const a=document.createElement("div");a.classList.add("footer");const r=document.createElement("img");r.src=this.getAttribute("icon"),r.alt="Footer Icon",r.classList.add("footer-icon"),a.appendChild(r),a.appendChild(document.createTextNode(this.getAttribute("footer-text")||"Procesado por Mercado Pago")),this.shadowRoot.append(t),this.shadowRoot.append(a),this.applyStyles()}applyStyles(){const t=document.createElement("style");t.textContent="\n      .mp-info-notification {\n        display: flex !important;\n        flex-direction: column !important;\n        padding: 12px !important;\n        background-color: #f7f7f7 !important;\n        border-radius: 8px !important;\n        border-left: 4px solid var(--andes-accent-color) !important;\n        margin-bottom: 16px !important;\n      }\n\n      .content {\n        display: flex !important;\n        align-items: center !important;\n      }\n\n      .icon {\n        max-width: 16px !important;\n        max-height: 16px !important;\n        margin-right: 8px !important;\n      }\n\n      @media (max-width: 600px){\n        .icon {\n          margin-bottom: 15px !important;\n        }\n      }\n\n      @media (max-width: 300px){\n        .icon {\n          margin-bottom: 35px !important;\n        }\n      }\n\n      .message {\n        flex-grow: 1 !important;\n        color: #333 !important;\n        padding: 10px !important;\n        font-family: 'Proxima Nova', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif !important;\n        font-size: 14px !important;\n        font-weight: 400 !important;\n        line-height: 18px !important;\n        text-align: left !important;\n      }\n\n      .footer {\n        display: flex !important;\n        align-items: center !important;\n        color: #999 !important;\n        margin-top: 24px !important;\n        font-family: 'Proxima Nova', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif !important;\n        font-size: 12px !important;\n        font-weight: 600 !important;\n        line-height: 15px !important;\n        text-align: left !important;\n      }\n\n      .footer-icon {\n        max-width: 20px !important;\n        margin-right: 8px !important;\n      }\n    ",this.shadowRoot.appendChild(t)}}customElements.define("checkout-notice",t)})(),(()=>{class t extends HTMLElement{helper=this.createHelper();inputContainer=this.createInputContainer();connectedCallback(){this.build()}build(){const t=document.createElement("div");t.classList.add("mp-yape-input-code-container");const e=document.createElement("div");e.classList.add("mp-yape-label-container");const n=document.createElement("label");n.setAttribute("id","yape-input-code-label"),n.textContent=this.getAttribute("label")||"Código de aprobación";const i=document.createElement("div");i.classList.add("mp-yape-icon-wrapper");const a=document.createElement("img");a.src=this.getAttribute("src"),a.alt="Icone de ajuda",a.classList.add("mp-yape-icon");const r=document.createElement("div");r.classList.add("mp-yape-tooltip"),r.textContent=this.getAttribute("tooltip-text")||"Encuéntralo en el menú de la app de Yape.",i.appendChild(a),i.appendChild(r),e.appendChild(n),e.appendChild(i),t.appendChild(e),this.inputs=[];for(let t=0;t<6;t+=1){const e=document.createElement("input");e.type="text",e.maxLength="1",e.classList.add("mp-yape-code-input"),e.setAttribute("input-index",t),this.inputs.push(e),e.addEventListener("input",(e=>{/\d/.test(e.target.value)?1===e.target.value.length&&t<5&&this.inputs[t+1].focus():e.target.value="",this.updateClassesOnInput()})),e.addEventListener("keydown",(t=>{const e=parseInt(t.target.getAttribute("input-index"));"ArrowLeft"===t.key&&e>0?this.inputs[e-1].focus():"ArrowRight"===t.key&&e<5?this.inputs[e+1].focus():"Backspace"===t.key&&e>0&&!t.target.value&&this.inputs[e-1].focus()})),0===t&&e.addEventListener("paste",(t=>this.handlePaste(t))),e.addEventListener("focus",(()=>{e.classList.add("mp-input-code-focus"),e.classList.remove("mp-input-code-error"),this.helper.firstElementChild.style.display="none",document.getElementById("yape-input-code-label").style.color="#111111"})),e.addEventListener("blur",(()=>{setTimeout((()=>{this.validate()}),100)})),this.inputContainer.appendChild(e)}t.appendChild(this.inputContainer),this.appendChild(t),this.appendChild(this.helper),this.applyStyles()}validate(){this.checkForErrors(this.helper,this.inputContainer)}handlePaste(t){if(t.preventDefault(),!Array.isArray(this.inputs))return;const e=((t.clipboardData||window.clipboardData).getData("text")||"").split("").filter((t=>/\d/.test(t)));e.length>0&&e.forEach(((t,e)=>{e<this.inputs.length&&(this.inputs[e].value=t)})),this.updateClassesOnInput()}updateClassesOnInput(){this.inputs.forEach((t=>{t.classList.remove("mp-input-code-error"),t.classList.add("mp-input-code-focus")}))}checkForErrors(t,e){const n=e.querySelectorAll("input"),i=Array.from(n).every((t=>""!==t.value)),a=Array.from(n).some((t=>""!==t.value));document.activeElement.classList.contains("mp-yape-code-input")||i||(n.forEach((t=>t.classList.add("mp-input-code-error"))),t.firstElementChild.style.display="flex",document.getElementById("yape-input-code-label").style.color="#f23d4f",document.getElementById("helper-approval-code").childNodes[1].innerHTML=a?document.querySelector("input-code").getAttribute("invalid-error-message"):document.querySelector("input-code").getAttribute("empty-error-message"))}applyStyles(){const t=document.createElement("style");t.textContent="\n      .mp-checkout-container .mp-yape-input-code-container {\n        display: flex !important;\n        flex-direction: column !important;\n        font-family: 'Proxima Nova', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif !important;\n      }\n\n      .mp-checkout-container .mp-yape-label-container {\n        display: flex !important;\n        align-items: flex-start !important;\n        margin-bottom: -8px !important;\n        font-style: normal !important;\n        font-weight: 400 !important;\n        height: 30px !important;\n        line-height: 18px !important;\n        font-size: 14px !important;\n        padding-left: 6px !important\n      }\n\n      .mp-checkout-container .mp-yape-icon-wrapper {\n        position: relative !important;\n        display: flex !important;\n        align-items: center !important;\n      }\n\n      .mp-checkout-container .mp-yape-icon {\n        max-width: 20px !important;\n        margin-left: 4px !important;\n        cursor: pointer !important;\n      }\n\n      .mp-checkout-container .mp-yape-tooltip {\n        display: none !important;\n        position: absolute !important;\n        top: -55px !important;\n        left: 50% !important;\n        transform: translateX(-50%) !important;\n        background-color: white !important;\n        padding: 8px !important;\n        border-radius: 8px !important;\n        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;\n        z-index: 100 !important;\n        white-space: nowrap !important;\n        pointer-events: none !important;\n        font-family: 'Proxima Nova', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif !important;\n        font-size: 14px !important;\n        font-weight: 400 !important;\n        line-height: 28px !important;\n        text-align: left !important;\n\n      }\n\n      .mp-checkout-container .mp-yape-tooltip::after {\n        content: \"\";\n        position: absolute;\n        bottom: -8px;\n        left: 51%;\n        transform: translateX(-70%);\n        border-width: 8px 8px 0 8px;\n        border-style: solid;\n        z-index: 101;\n        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\n        clip-path: polygon(100% 0%, 0% 0%, 50% 100%);\n        color: white;\n      }\n\n      .mp-checkout-container .mp-yape-icon-wrapper:hover .mp-yape-tooltip {\n        display: block !important;\n      }\n\n      .mp-checkout-container .mp-yape-input-container {\n        display: flex !important;\n        gap: 8px !important;\n      }\n\n      .mp-checkout-container .mp-yape-code-input {\n        width: 38px !important;\n        height: 48px !important;\n        background: #ffffff !important;\n        text-align: center !important;\n        font-size: 24px !important;\n        border: 1px solid #ccc !important;\n        border-radius: 4px !important;\n        font-size: 16px !important;\n        line-height: 20px !important;\n        font-family: 'Proxima Nova', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif !important;\n        font-weight: 400 !important;\n        box-sizing: border-box;\n      }\n\n      .mp-checkout-container .mp-yape-code-input:nth-child(4){\n        margin-left: 10px !important;\n      }\n\n      .mp-checkout-container .mp-input-code-focus {\n        border: 1px solid var(--andes-accent-color) !important;\n      }\n\n      .mp-checkout-container .mp-input-code-error {\n        border: 1px solid #f23d4f !important;\n      }\n\n      @media screen and (max-width: 375px){\n        #mp-checkout-yape-root.mp-checkout-yape-container .mp-yape-input-container {\n          flex-direction: row !important;\n          gap: 2px !important;\n        }\n\n        #mp-checkout-yape-root.mp-checkout-yape-container {\n          padding: 24px 0!important;\n        }\n      }\n\n      @media only screen and (min-width: 376px) and (max-width: 480px){\n        #mp-checkout-yape-root.mp-checkout-yape-container {\n          padding: 24px 0!important;\n        }\n      }\n    ",this.appendChild(t)}createInputContainer(){const t=document.createElement("div");return t.classList.add("mp-yape-input-container"),t}createHelper(){const t=document.createElement("input-helper");return t.setAttribute("isVisible",!1),t.setAttribute("type","error"),t.setAttribute("message","error"),t.setAttribute("input-id","helper-approval-code"),t}}customElements.define("input-code",t)})(),(()=>{class t extends HTMLElement{connectedCallback(){this.build()}build(){const t=this.createInputDocument();this.appendChild(t)}createInputDocument(){const t=document.createElement("div");t.classList.add("mp-input-document"),t.setAttribute("data-cy","input-document-container");const e=this.createLabel(this.getAttribute("label-message")),n=this.createHelper(this.getAttribute("helper-empty")),i=this.createHiddenField(this.getAttribute("hidden-id")),a=this.createInput(n,i,e);return t.appendChild(e),t.appendChild(a),t.appendChild(i),t.appendChild(n),t}createLabel(t){const e=document.createElement("input-label");return e.setAttribute("message",t),e.setAttribute("isOptional","false"),e}createInput(t,e,n){const i=document.createElement("div");i.classList.add("mp-input"),i.setAttribute("id","form-checkout__identificationNumber-container");const a=JSON.parse(this.getAttribute("documents")),r=this.getAttribute("validate"),s=this.createVerticalLine(),l=this.createSelect(i,t,a,r),o=this.createDocument(i,l,t,n);return l.addEventListener("change",(()=>{i.classList.remove("mp-focus"),i.classList.remove("mp-error"),t.firstElementChild.style.display="none",this.setInpuProperties(l,o),this.setMaskInputDocument(l,o,e),this.updateLabelState(n,!1)})),i.appendChild(l),i.appendChild(s),i.appendChild(o),this.setMaskInputDocument(l,o,e),i}setInpuProperties(t,e){"CPF"===t.value?(e.value="",e.setAttribute("maxlength","14"),e.setAttribute("placeholder","999.999.999-99")):"CNPJ"===t.value?(e.value="",e.setAttribute("maxlength","18"),e.setAttribute("placeholder","99.999.999/0001-99")):"CI"===t.value?(e.value="",e.setAttribute("maxlength","8"),e.setAttribute("placeholder","99999999")):(e.value="",e.setAttribute("maxlength","20"),e.setAttribute("placeholder",""))}createSelect(t,e,n,i){const a=document.createElement("select");return a.classList.add("mp-document-select"),a.setAttribute("name",this.getAttribute("select-name")),a.setAttribute("id",this.getAttribute("select-id")),a.setAttribute("data-checkout",this.getAttribute("select-data-checkout")),a.setAttribute("data-cy","select-document"),n&&n.forEach((t=>{this.createOption(a,t)})),i&&(a.addEventListener("focus",(()=>{t.classList.add("mp-focus"),e.firstElementChild.style.display="none"})),a.addEventListener("focusout",(()=>{t.classList.remove("mp-focus"),e.firstElementChild.style.display="none"}))),a}createOption(t,e){const n=document.createElement("option");n.innerHTML=e,n.value=e,t.appendChild(n)}createHiddenField(t){const e=document.createElement("input");return e.setAttribute("type","hidden"),e.setAttribute("id",t),e}createVerticalLine(){const t=document.createElement("div");return t.classList.add("mp-vertical-line"),t}isValidCPF(t,e){if("string"!=typeof t)return!1;if(!(t=t.replace(/[\s.-]*/gim,""))||0===t.length)return this.updateHelperErrorMessage(e,this.getAttribute("helper-empty")),!1;if("00000000000"===t||"11111111111"===t||"22222222222"===t||"33333333333"===t||"44444444444"===t||"55555555555"===t||"66666666666"===t||"77777777777"===t||"88888888888"===t||"99999999999"===t)return this.updateHelperErrorMessage(e,this.getAttribute("helper-wrong")),!1;if(0===parseInt(t,10))return this.updateHelperErrorMessage(e,this.getAttribute("helper-wrong")),!1;if(!t||11!==t.length)return this.updateHelperErrorMessage(e,this.getAttribute("helper-invalid")),!1;let n,i=0;for(let e=1;e<=9;e+=1)i+=parseInt(t.substring(e-1,e))*(11-e);if(n=10*i%11,10!==n&&11!==n||(n=0),n!==parseInt(t.substring(9,10)))return this.updateHelperErrorMessage(e,this.getAttribute("helper-wrong")),!1;i=0;for(let e=1;e<=10;e+=1)i+=parseInt(t.substring(e-1,e))*(12-e);return n=10*i%11,10!==n&&11!==n||(n=0),n===parseInt(t.substring(10,11))||(this.updateHelperErrorMessage(e,this.getAttribute("helper-wrong")),!1)}isValidCNPJ(t,e){if(""===(t=t.replace(/[^\d]+/g,"")))return this.updateHelperErrorMessage(e,this.getAttribute("helper-empty")),!1;if("00000000000000"===t||"11111111111111"===t||"22222222222222"===t||"33333333333333"===t||"44444444444444"===t||"55555555555555"===t||"66666666666666"===t||"77777777777777"===t||"88888888888888"===t||"99999999999999"===t)return this.updateHelperErrorMessage(e,this.getAttribute("helper-wrong")),!1;if(0===parseInt(t,10))return this.updateHelperErrorMessage(e,this.getAttribute("helper-wrong")),!1;if(14!==t.length)return this.updateHelperErrorMessage(e,this.getAttribute("helper-invalid")),!1;let n=t.length-2,i=t.substring(0,n);const a=t.substring(n);let r=0,s=n-7;for(let t=n;t>=1;t-=1)r+=i.charAt(n-t)*s--,s<2&&(s=9);let l=r%11<2?0:11-r%11;if(l!==Number(a.charAt(0)))return this.updateHelperErrorMessage(e,this.getAttribute("helper-wrong")),!1;n+=1,i=t.substring(0,n),r=0,s=n-7;for(let t=n;t>=1;t-=1)r+=i.charAt(n-t)*s--,s<2&&(s=9);return l=r%11<2?0:11-r%11,l===Number(a.charAt(1))||(this.updateHelperErrorMessage(e,this.getAttribute("helper-wrong")),!1)}isValidCI(t,e){if("string"!=typeof t||0===t.length)return this.updateHelperErrorMessage(e,this.getAttribute("helper-empty")),!1;let n=0,i=0,a=0;const r=t[t.length-1];if(t.length<=6)for(i=t.length;i<7;i+=1)t=`0${t}`;for(i=0;i<7;i+=1)n+=parseInt("2987634"[i],10)*parseInt(t[i],10)%10;return a=n%10==0?0:10-n%10,r===a.toString()||(this.updateHelperErrorMessage(e,this.getAttribute("helper-wrong")),!1)}isValidGenericDocument(t,e){return"string"==typeof t&&0!==t.length||(this.updateHelperErrorMessage(e,this.getAttribute("helper-empty")),!1)}setMaskInputDocument(t,e,n){const i={CPF:t=>t.replace(/\D+/g,"").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d{1,2})/,"$1-$2").replace(/(-\d{2})\d+?$/,"$1"),CNPJ:t=>t.replace(/\D+/g,"").replace(/(\d{2})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1/$2").replace(/(\d{4})(\d)/,"$1-$2").replace(/(-\d{2})\d+?$/,"$1"),CI:t=>t.replace(/\D+/g,"")};e.addEventListener("input",(a=>{if(void 0!==i[t.value]&&(a.target.value=i[t.value](a.target.value)),n){const t=a.target.value.replace(/[^\w\s]/gi,"");n.value=t}this.validateDocumentRealTime(a.target,t,e.parentElement)}))}validateDocumentRealTime(t,e,n){const i=n.parentElement.querySelector("input-helper"),a=n.parentElement.querySelector("input-label"),r={CPF:t=>this.isValidCPF(t,i),CNPJ:t=>this.isValidCNPJ(t,i),CI:t=>this.isValidCI(t,i),CC:t=>this.isValidGenericDocument(t,i),CE:t=>this.isValidGenericDocument(t,i),NIT:t=>this.isValidGenericDocument(t,i)}[e.value];if(!r)return;const s=r(t.value);this.updateValidationState(s,t,n,i,a)}updateValidationState(t,e,n,i,a){t?this.setValidState(e,n,i,a):this.setInvalidState(e,n,i,a)}setValidState(t,e,n,i){e.classList.remove("mp-error","mp-error-2px"),n.firstElementChild.style.display="none",t.setAttribute("name",this.getAttribute("input-name")),this.updateLabelState(i,!1)}setInvalidState(t,e,n,i){""===t.value.trim()?(e.classList.add("mp-error-2px"),t.setAttribute("name",this.getAttribute("input-name")),this.updateLabelState(i,!0)):(e.classList.add("mp-error-2px"),n.firstElementChild.style.display="flex",t.setAttribute("name",this.getAttribute("flag-error")),this.updateLabelState(i,!0))}createDocument(t,e,n,i){const a=document.createElement("input");return this.getAttribute("input-id")&&a.setAttribute("id",this.getAttribute("input-id")),a.setAttribute("name",this.getAttribute("input-name")),a.setAttribute("data-checkout",this.getAttribute("input-data-checkout")),a.setAttribute("data-cy","input-document"),a.classList.add("mp-document"),a.type="text",a.inputMode="text",this.setInpuProperties(e,a),a.addEventListener("focus",(()=>{this.handleInputFocus(t,n,a,i)})),a.addEventListener("focusout",(()=>{this.handleInputFocusOut(t,n,a,i)})),a}handleInputFocus(t,e,n,i){if(t.classList.contains("mp-error"))return t.classList.remove("mp-error"),void t.classList.add("mp-error-2px");t.classList.remove("mp-error-2px"),t.classList.add("mp-focus"),e.firstElementChild.style.display="none",n.setAttribute("name",this.getAttribute("input-name")),this.updateLabelState(i,!1)}handleInputFocusOut(t,e,n,i){t.classList.remove("mp-focus"),""===n.value.trim()?this.clearErrorStates(t,e,i):this.handleNonEmptyInput(t)}clearErrorStates(t,e,n){t.classList.remove("mp-error-2px","mp-error"),e&&(e.firstElementChild.style.display="none"),this.updateLabelState(n,!1)}handleNonEmptyInput(t){t.classList.contains("mp-error-2px")&&(t.classList.remove("mp-error-2px"),t.classList.add("mp-error"))}updateLabelState(t,e){e?t.firstElementChild.classList.add("mp-label-error"):t.firstElementChild.classList.remove("mp-label-error")}updateHelperErrorMessage(t,e){t.setAttribute("message",e),t.querySelector(".mp-helper-message").innerHTML=e}createHelper(t){const e=document.createElement("input-helper");return e.setAttribute("isVisible",!1),e.setAttribute("type","error"),e.setAttribute("message",t),e.setAttribute("input-id","mp-doc-number-helper"),e}}customElements.define("input-document",t)})(),(()=>{class t extends HTMLElement{helper=this.createHelper();input=this.createInput();connectedCallback(){this.build()}build(){const t=this.createInputField();this.appendChild(t)}createInputField(){const t=document.createElement("div");t.classList.add("mp-yape-input-field"),t.setAttribute("data-cy","input-field-container");const e=this.createLabel(this.getAttribute("label-message"));return t.appendChild(e),t.appendChild(this.input),t.appendChild(this.helper),t}createLabel(t){const e=document.createElement("input-label");return e.setAttribute("message",t),e.setAttribute("isOptional","true"),e}validate(){""===this.input.value?(this.helper.firstElementChild.style.display="flex",document.getElementById("helper-input-field").childNodes[1].innerHTML=document.querySelector("input-field").getAttribute("empty-error-message"),this.input.classList.add("mp-input-field-error"),document.querySelector('[data-cy="input-label"]').style.setProperty("color","#f23d4f","important")):this.input.value.length<11?(this.helper.firstElementChild.style.display="flex",document.getElementById("helper-input-field").childNodes[1].innerHTML=document.querySelector("input-field").getAttribute("invalid-error-message"),this.input.classList.add("mp-input-field-error"),document.querySelector('[data-cy="input-label"]').style.setProperty("color","#f23d4f","important")):(this.helper.firstElementChild.style.display="none",document.querySelector('[data-cy="input-label"]').style.setProperty("color","#111111","important"))}createInput(){const t=document.createElement("input");return t.classList.add("mp-yape-input"),t.setAttribute("id","checkout__yapePhoneNumber"),t.setAttribute("maxlength","11"),t.setAttribute("placeholder","Ej.: 872 123 432"),t.setAttribute("aria-hidden","true"),t.setAttribute("data-cy","input-field"),t.setAttribute("name","phoneNumber"),t.setAttribute("required","true"),t.addEventListener("input",(()=>{const e=t.value.replace(/\D/g,"");let n="";for(let t=0;t<e.length;t+=1)n+=e[t],(t+1)%3==0&&t!==e.length-1&&(n+=" ");t.value=n})),t.addEventListener("focus",(()=>{t.classList.add("mp-input-field-focus"),t.classList.remove("mp-input-field-error"),this.helper.firstElementChild.style.display="none"})),t.addEventListener("blur",(()=>{this.validate()})),t}createHelper(){const t=document.createElement("input-helper");return t.setAttribute("isVisible","false"),t.setAttribute("type","error"),t.setAttribute("message","error"),t.setAttribute("input-id","helper-input-field"),t}}customElements.define("input-field",t)})(),(()=>{class t extends HTMLElement{connectedCallback(){this.build()}build(){this.appendChild(this.createHelper())}createHelper(){const t=document.createElement("div");t.classList.add("mp-helper"),t.setAttribute("id",this.getAttribute("input-id")),t.setAttribute("data-cy","helper-container"),t.setAttribute("role","alert"),this.validateVisibility(t);const e=this.getAttribute("message"),n=this.getAttribute("type")||"error",i=this.createHelperMessage(e,n);if("error"===n){const e=this.createIcon();t.appendChild(e)}return t.appendChild(i),t}createIcon(){const t=document.createElement("div");return t.innerHTML='\n    <svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">\n      <rect width="12" height="12" rx="6" fill="#CC1818"/><path d="M6.72725 2.90918H5.27271L5.45452 6.90918H6.54543L6.72725 2.90918Z" fill="white"/>\n      <path d="M5.99998 7.63645C6.40164 7.63645 6.72725 7.96206 6.72725 8.36373C6.72725 8.76539 6.40164 9.091 5.99998 9.091C5.59832 9.091 5.27271 8.76539 5.27271 8.36373C5.27271 7.96206 5.59832 7.63645 5.99998 7.63645Z" fill="white"/>\n    </svg>',t.classList.add("mp-helper-icon"),t.setAttribute("tabindex","-1"),t.setAttribute("aria-hidden","true"),t}createHelperMessage(t,e){const n=document.createElement("div");return n.textContent=t,n.classList.add("mp-helper-message"),n.classList.add(e),n.setAttribute("data-cy","helper-message"),n.setAttribute("tabindex","-1"),n.setAttribute("aria-hidden","true"),n}updateMessage(t){this.setAttribute("message",t),this.querySelector(".mp-helper-message").textContent=t}validateVisibility(t){let e=this.getAttribute("isVisible");"string"==typeof e&&(e="false"!==e),t.style.display=e?"flex":"none"}}customElements.define("input-helper",t)})(),(()=>{class t extends HTMLElement{connectedCallback(){this.build()}build(){this.appendChild(this.createLabel())}createLabel(){const t=document.createElement("div");t.classList.add("mp-input-label"),t.setAttribute("data-cy","input-label");const e=this.getAttribute("message");t.innerHTML=e;let n=this.getAttribute("isOptional");if("string"==typeof n&&(n="false"!==n),!n){const e=document.createElement("b");e.innerHTML="*",e.style="color: red",t.appendChild(e)}return t}}customElements.define("input-label",t)})(),(()=>{class t extends HTMLElement{connectedCallback(){this.build()}build(){this.appendChild(this.createContainer())}createContainer(){const t=document.createElement("div");return t.classList.add("mp-input-radio-container"),t.appendChild(this.createRadio()),t.appendChild(this.createLabel()),t}createRadio(){const t=document.createElement("input"),e=this.getAttribute("dataRate");return t.classList.add("mp-input-radio-radio"),t.type="radio",t.id=this.getAttribute("identification"),t.name=this.getAttribute("name"),t.value=this.getAttribute("value"),t.setAttribute("data-cy","input-radio"),e&&t.setAttribute("dataRate",e),t}createLabel(){const t=document.createElement("label");return t.classList.add("mp-input-radio-label"),t.htmlFor=this.getAttribute("identification"),t}}customElements.define("input-radio",t)})(),(()=>{class t extends HTMLElement{connectedCallback(){this.build()}build(){this.appendChild(this.createContainer())}createContainer(){const t=document.createElement("div");return t.classList.add("mp-input-select-container"),t.appendChild(this.createLabel()),t.appendChild(this.createInput()),t.appendChild(this.createHelper()),t}createInput(){const t=document.createElement("div");return t.classList.add("mp-input-select-input"),t.appendChild(this.createSelect()),t}createSelect(){const t=document.createElement("select"),e=this.getAttribute("name");t.classList.add("mp-input-select-select"),t.setAttribute("id",e),t.setAttribute("name",e);const n=this.getAttribute("options")&&JSON.parse(this.getAttribute("options"));if(this.getAttribute("default-option")){const e=document.createElement("option");e.setAttribute("selected","selected"),e.setAttribute("hidden","hidden"),e.innerHTML=this.getAttribute("default-option"),t.appendChild(e)}return n&&0!==n.length&&n.forEach((e=>{t.appendChild(this.createOption(e))})),t}createOption(t){const e=document.createElement("option");return e.innerHTML=t.description,e.value=t.id,e}createLabel(){const t=document.createElement("input-label"),e=this.getAttribute("optional");return t.setAttribute("message",this.getAttribute("label")),"false"===e?t.setAttribute("isOptional",e):t.setAttribute("isOptional","true"),t}createHelper(){const t=document.createElement("input-helper");return t.setAttribute("isVisible",!1),t.setAttribute("message",this.getAttribute("helper-message")),t.setAttribute("input-id","mp-doc-number-helper"),t.setAttribute("type","message"),t}createHiddenField(t){const e=document.createElement("input");return e.setAttribute("type","hidden"),e.setAttribute("id",t),e}}customElements.define("input-select",t)})(),(()=>{class t extends HTMLElement{static get observedAttributes(){return["columns","name","button-name","bank-interest-text"]}constructor(){super(),this.index=0,this.limit=5,this.offset=this.limit,this.columns=null,this.total=0}connectedCallback(){this.build()}attributeChangedCallback(){this.firstElementChild&&(this.removeChild(this.firstElementChild),this.build())}build(){this.appendChild(this.createContainer())}setColumns(){return this.columns=JSON.parse(this.getAttribute("columns")),this}setTotal(){return this.total=this.columns.length,this}createContainer(){const t=document.createElement("div");return this.setColumns(),this.columns&&(this.setTotal(),t.classList.add("mp-input-table-container"),t.setAttribute("data-cy","input-table-container"),t.appendChild(this.createList()),t.appendChild(this.createBankInterestDisclaimer())),t}createList(){const t=document.createElement("div");t.classList.add("mp-input-table-list"),t.setAttribute("data-cy","input-table-list");const e=this.createLink();return e.onclick=()=>this.appendItems(this.columns,t,e,!0),this.appendItems(this.columns,t,e,!1),t.appendChild(e),t}createItem(t){const e=document.createElement("div");return e.classList.add("mp-input-table-item"),e.appendChild(this.createLabel(t)),e}createLabel(t){const{id:e,value:n,rowText:i,rowObs:a,highlight:r,img:s,alt:l,dataRate:o}=t,d=this.getAttribute("name"),c=document.createElement("div");return c.classList.add("mp-input-table-label"),c.appendChild(this.createOption(e,d,n,i,s,l,o)),a&&c.appendChild(this.createRowObs(a,r)),c.onclick=()=>{document.getElementById(e).checked=!0},c}createOption(t,e,n,i,a,r,s){const l=document.createElement("div");return l.classList.add("mp-input-table-option"),l.appendChild(this.createRadio(t,e,n,s)),a?l.appendChild(this.createRowTextWithImg(i,a,r)):l.appendChild(this.createRowText(i)),l}createRadio(t,e,n,i){const a=document.createElement("input-radio");return a.setAttribute("name",e),a.setAttribute("value",n),a.setAttribute("identification",t),a.setAttribute("dataRate",i),a}createRowText(t){const e=document.createElement("span");return e.classList.add("mp-input-table-row-text"),e.innerHTML=t,e}createRowTextWithImg(t,e,n){const i=document.createElement("span"),a=document.createElement("payment-method-logo");return a.setAttribute("src",e),a.setAttribute("alt",n),a.style.marginRight="10px",i.classList.add("mp-input-table-row-text-image"),i.innerHTML=t,i.appendChild(a),i}createRowObs(t,e){const n=document.createElement("span");return e?n.classList.add("mp-input-table-row-obs-highlight"):n.classList.add("mp-input-table-row-obs"),n.innerHTML=t,n}createLink(){const t=document.createElement("div");t.classList.add("mp-input-table-container-link");const e=document.createElement("a");return e.setAttribute("id","more-options"),e.classList.add("mp-input-table-link"),e.innerHTML=this.getAttribute("button-name"),t.appendChild(e),t}createBankInterestDisclaimer(){const t=document.createElement("div");t.classList.add("mp-input-table-bank-interest-container");const e=document.createElement("p");return e.classList.add("mp-input-table-bank-interest-text"),e.innerText=this.getAttribute("bank-interest-text"),t.appendChild(e),t}appendItems(t,e,n,i){this.validateLimit();for(let a=this.index;a<this.limit;a+=1)i?e.insertBefore(this.createItem(t[a]),n):e.appendChild(this.createItem(t[a]));this.limit>=this.total&&n.style.setProperty("display","none","important"),this.index+=this.offset,this.limit+=this.offset,this.validateLimit()}validateLimit(){this.limit>this.total&&(this.limit=this.total)}}customElements.define("input-table",t)})(),(()=>{class t extends HTMLElement{static get observedAttributes(){return["label","placeholder","value","tooltip","validation-regexp","error-message","tooltip-position","tooltip-label"]}constructor(){super(),this._value="",this._showError=!1,this._inputEl=null,this._onDocumentClick=this._onDocumentClick.bind(this)}connectedCallback(){this._value=this.getAttribute("value")||"",this.render()}disconnectedCallback(){document.removeEventListener("click",this._onDocumentClick)}attributeChangedCallback(t,e,n){"value"===t&&this._inputEl&&this._inputEl.value!==n&&(this._inputEl.value=n||"",this._value=n||""),"value"!==t&&this.render()}get value(){return this._inputEl?this._inputEl.value:this._value}set value(t){this.setAttribute("value",t),this._inputEl&&(this._inputEl.value=t),this._value=t}_validate(t){const e=this.getAttribute("validation-regexp");if(!e||!t)return!0;try{return new RegExp(e).test(t)}catch{return!0}}_onInput(t){this._value=t.target.value,this.setAttribute("value",this._value),this._showError&&(this._showError=!1,this._updateErrorState())}_onChange(t){const e=t.target.value;e&&!this._validate(e)?this._showError=!0:this._showError=!1,this._updateErrorState(),this.dispatchEvent(new CustomEvent("change",{detail:{value:e,valid:!this._showError}}))}_onDocumentClick(t){this.contains(t.target)||this._hideTooltip()}_toggleTooltip(){this.querySelector(".mp-input-with-tooltip-tooltip-content").classList.contains("show")?this._hideTooltip():this._showTooltip()}_showTooltip(){this.querySelector(".mp-input-with-tooltip-tooltip-content").classList.add("show"),document.addEventListener("click",this._onDocumentClick)}_hideTooltip(){this.querySelector(".mp-input-with-tooltip-tooltip-content").classList.remove("show"),document.removeEventListener("click",this._onDocumentClick)}_updateErrorState(){const t=this.querySelector(".mp-input-with-tooltip-input-container"),e=this.querySelector(".mp-input-with-tooltip-label");t&&(this._showError?(t.classList.add("error"),e.classList.add("error")):(t.classList.remove("error"),e.classList.remove("error")));const n=this.querySelector(".mp-input-with-tooltip-helper-error");n&&(n.style.display=this._showError?"flex":"none")}render(){const t=this.getAttribute("label")||"",e=this.getAttribute("placeholder")||"",n=this.getAttribute("tooltip")||"",i=this.getAttribute("tooltip-label")||"Mais informações",a=this.getAttribute("error-message")||"Valor inválido",r=this._value||"",s=this._showError,l=this.getAttribute("tooltip-position")||"right";this.innerHTML=`\n      <label\n        tabindex="0"\n        for="mp-input-with-tooltip-input"\n        class="mp-input-with-tooltip-label"\n      >${t}</label>\n      <div class="mp-input-with-tooltip-input-container${s?" error":""}">\n        <input\n          id="mp-input-with-tooltip-input"\n          class="mp-input-with-tooltip-input"\n          placeholder="${e}"\n          value="${r}"\n        />\n        <span\n          class="mp-input-with-tooltip-tooltip-icon"\n          tabindex="0"\n          aria-label="${i}"\n          role="button"\n        >?</span>\n        <div\n          aria-describedby="mp-input-with-tooltip-tooltip-content"\n          class="mp-input-with-tooltip-tooltip-content mp-input-with-tooltip-tooltip-${l}"\n        >\n          <span\n            id="mp-input-with-tooltip-tooltip-content"\n            tabindex="0"\n            role="tooltip"\n          >\n            ${n}\n          </span>\n        </div>\n      </div>\n      <div\n        id="mp-input-with-tooltip-helper-error"\n        tabindex="0"\n        class="mp-input-with-tooltip-helper-error"\n        style="display:${s?"block":"none"}"\n      >\n        <svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">\n          <rect width="12" height="12" rx="6" fill="#CC1818"/>\n          <path d="M6.72725 2.90918H5.27271L5.45452 6.90918H6.54543L6.72725 2.90918Z" fill="white"/>\n          <path d="M5.99998 7.63645C6.40164 7.63645 6.72725 7.96206 6.72725 8.36373C6.72725 8.76539 6.40164 9.091 5.99998 9.091C5.59832 9.091 5.27271 8.76539 5.27271 8.36373C5.27271 7.96206 5.59832 7.63645 5.99998 7.63645Z" fill="white"/>\n        </svg>\n        ${a}\n      </div>\n    `,this._inputEl=this.querySelector("input"),this._inputEl.value=r,this._inputEl.addEventListener("input",this._onInput.bind(this)),this._inputEl.addEventListener("change",this._onChange.bind(this));const o=this.querySelector(".mp-input-with-tooltip-tooltip-icon");o.addEventListener("click",(()=>{this._toggleTooltip()})),o.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||this._toggleTooltip()}))}}customElements.define("input-with-tooltip",t)})(),(()=>{class t extends HTMLElement{connectedCallback(){this.build()}build(){this.appendChild(this.createContainer())}createContainer(){const t=document.createElement("div");return t.classList.add("mp-payment-method-logo-slider-container"),t.appendChild(this.createContent()),t}createContent(){const t=JSON.parse(this.getAttribute("methods")),e=document.createElement("div");e.classList.add("mp-payment-method-logo-slider-content"),e.appendChild(this.createImage(t[0]));const n=e.firstChild;return this.createSlider(n,t),e}createImage({src:t,alt:e}){const n=document.createElement("payment-method-logo");return n.setAttribute("src",t),n.setAttribute("alt",e),n}createSlider(t,e,n=0){t.setAttribute("src",e[n].src),t.setAttribute("alt",e[n].alt),n=n<e.length-1?n+1:0,setTimeout((()=>{this.createSlider(t,e,n)}),2e3)}}customElements.define("payment-method-logo-slider",t)})(),(()=>{class t extends HTMLElement{static get observedAttributes(){return["src","alt"]}connectedCallback(){this.build()}attributeChangedCallback(){this.firstElementChild&&(this.removeChild(this.firstElementChild),this.build())}build(){this.appendChild(this.createContainer())}createContainer(){const t=document.createElement("div");return t.classList.add("mp-payment-method-logo-container"),t.appendChild(this.createImage()),t}createImage(){const t=document.createElement("img");return t.classList.add("mp-payment-method-logo-image"),t.alt=this.getAttribute("alt"),t.src=this.getAttribute("src"),t.onerror=t=>t.target?.parentNode?.parentNode?.parentNode?.removeChild(t.target.parentNode.parentNode),t}}customElements.define("payment-method-logo",t)})(),(()=>{class t extends HTMLElement{connectedCallback(){this.build()}build(){this.appendChild(this.createContainer())}createContainer(){const t=JSON.parse(this.getAttribute("methods")),e=document.createElement("div");return e.classList.add("mp-payment-methods-container"),t.forEach((t=>{e.appendChild(this.createPaymentMethodType(t))})),e}createPaymentMethodType(t){const{title:e,label:n,payment_methods:i}=t,a=document.createElement("div");return a.classList.add("mp-payment-method-type-container"),i&&0!==i.length&&(a.appendChild(this.createHeader(e,n)),a.appendChild(this.createContent(i))),a}createHeader(t,e){const n=document.createElement("div");return n.classList.add("mp-payment-methods-header"),t&&n.appendChild(this.createTitle(t)),e&&n.appendChild(this.createBadge(e)),n}createTitle(t){const e=document.createElement("p");return e.classList.add("mp-payment-methods-title"),e.innerHTML=t,e}createBadge(t){const e=document.createElement("div"),n=document.createElement("span");return n.classList.add("mp-payment-methods-badge-text"),n.innerHTML=t,e.classList.add("mp-payment-methods-badge"),e.appendChild(n),e}createContent(t){const e=document.createElement("div");return e.classList.add("mp-payment-methods-content"),t.forEach((t=>{e.appendChild(this.createImage(t))})),e}createImage(t){const{src:e,alt:n}=t,i=document.createElement("payment-method-logo");return i.setAttribute("src",e),i.setAttribute("alt",n),i}}customElements.define("payment-methods",t)})(),(()=>{class t extends HTMLElement{connectedCallback(){this.build()}build(){this.appendChild(this.createContainer())}createContainer(){const t=document.createElement("div");return t.classList.add("mp-pix-template-container"),t.setAttribute("data-cy","pix-template-container"),t.appendChild(this.createImage()),t.appendChild(this.createTitle()),t.appendChild(this.createSubtitle()),t}createTitle(){const t=document.createElement("p");return t.classList.add("mp-pix-template-title"),t.innerText=this.getAttribute("title"),t}createSubtitle(){const t=document.createElement("p");return t.classList.add("mp-pix-template-subtitle"),t.innerText=this.getAttribute("subtitle"),t}createImage(){const t=document.createElement("img");return t.classList.add("mp-pix-template-image"),t.src=this.getAttribute("src"),t.alt=this.getAttribute("alt"),t}}customElements.define("pix-template",t)})(),(()=>{class t extends HTMLElement{connectedCallback(){this.build()}build(){this.appendChild(this.createContainer())}createContainer(){const t=document.createElement("div");return t.classList.add("mp-terms-and-conditions-container"),t.setAttribute("data-cy","terms-and-conditions-container"),t.appendChild(this.createText()),t.appendChild(this.createLink()),t}createText(){const t=document.createElement("span");return t.classList.add("mp-terms-and-conditions-text"),t.innerHTML=this.getAttribute("description"),t}createLink(){const t=document.createElement("a");return t.classList.add("mp-terms-and-conditions-link"),t.innerHTML=this.getAttribute("link-text"),t.href=this.getAttribute("link-src"),t.target="blank",t}}customElements.define("terms-and-conditions",t)})(),(()=>{class t extends HTMLElement{connectedCallback(){this.build()}build(){const t=this.createTestMode(),e=this.createCardHeader(),n=this.createCardContent();t.appendChild(e),t.appendChild(n),this.appendChild(t)}createTestMode(){const t=document.createElement("div");return t.classList.add("mp-test-mode-card"),t.setAttribute("data-cy","test-mode-card"),t}createCardContent(){const t=document.createElement("div");t.classList.add("mp-test-mode-card-content");const e=document.createElement("p");e.innerHTML=this.getAttribute("description"),e.classList.add("mp-test-mode-description"),e.setAttribute("data-cy","test-mode-description"),t.appendChild(e);const n=this.getAttribute("link-text"),i=this.getAttribute("link-src"),a=document.createElement("a");return a.classList.add("mp-test-mode-link"),a.innerHTML=n,a.href=i,a.target="blank",e.appendChild(a),t}createCardHeader(){const t=document.createElement("div");t.classList.add("mp-test-mode-card-content");const e=this.createBadge(),n=this.createTitle();return t.appendChild(e),t.appendChild(n),t}createBadge(){const t=document.createElement("div");return t.innerHTML="!",t.classList.add("mp-test-mode-badge"),t}createTitle(){const t=document.createElement("p");return t.innerHTML=this.getAttribute("title"),t.classList.add("mp-test-mode-title"),t.setAttribute("data-cy","test-mode-title"),t}}customElements.define("test-mode",t)})();