let isModalScriptLoaded=!1;const loadImagePromise=async t=>{if(t)return new Promise((e,o)=>{const n=new Image;n.onload=()=>e(n),n.onerror=()=>o(new Error(`Error al cargar la imagen: ${t}`)),n.src=t})},estaEnVistaParaCargar=t=>t.getBoundingClientRect().top<=globalThis.innerHeight&&t.getBoundingClientRect().bottom>=0&&"none"!==getComputedStyle(t).display,fnlazy_loader_img=function(){const t=Array.from(document.querySelectorAll("img.lazy_loader_img")),e=new Set;for(const o of t){const t=o.getBoundingClientRect().top,n=o.getBoundingClientRect().bottom;if(!e.has(o)&&(t<=globalThis.innerHeight&&n>=0&&"none"!==getComputedStyle(o).display)){const a=o.dataset.src;if(0===t&&0===n&&!o.offsetParent)continue;e.add(o),loadImagePromise(a).then(t=>{o.src=a,o.classList.remove("lazy_loader_img")}).catch(t=>{console.error(t)})}}},fnlazy_loader_backgroundImage=function(){const t=Array.from(document.querySelectorAll(".lazy_loader_backgroundImage")),e=new Set;for(const o of t){if(e.has(o))continue;if(!estaEnVistaParaCargar(o))continue;const t=o.dataset.src;e.add(o),loadImagePromise(t).then(e=>{document.getElementById(o.getAttribute("id")).style.backgroundImage="url('"+t+"')",o.classList.remove("lazy_loader_backgroundImage")}).catch(t=>{console.error(t)})}},fnlazy_loader_backgroundImage_comp=function(){const t=Array.from(document.querySelectorAll(".lazy_loader_backgroundImage_comp")),e=new Set;for(const o of t){if(e.has(o))continue;if(!estaEnVistaParaCargar(o))continue;const t=o.getAttribute("id"),n=o.dataset.srcM,a=o.dataset.srcT,r=o.dataset.srcD;let i=null;globalThis.matchMedia("(min-width: 1280px)").matches?i=r:globalThis.matchMedia("(min-width: 768px)").matches?i=a:globalThis.matchMedia("(min-width: 1px)").matches&&(i=n),e.add(o),loadImagePromise(i).then(e=>{const i=document.createElement("STYLE"),c=document.createTextNode(`\n\t\t\t\t\t\t@media (min-width: 320px) {\n\t\t\t\t\t\t\t.bcp_container_imagen_${t} {\n\t\t\t\t\t\t\t\tbackground-image: url(${n});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t@media (min-width: 768px) {\n\t\t\t\t\t\t\t.bcp_container_imagen_${t} {\n\t\t\t\t\t\t\t\tbackground-image: url(${a});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t@media (min-width: 1280px) {\n\t\t\t\t\t\t\t.bcp_container_imagen_${t} {\n\t\t\t\t\t\t\t\tbackground-image: url(${r});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t`);i.appendChild(c),document.getElementById(t).appendChild(i),o.classList.remove("lazy_loader_backgroundImage_comp")}).catch(t=>{console.error(t)})}},lazyLoadingBackgroundImage=function(){const t=Array.from(document.querySelectorAll(".lazy_loading_backgroundImage")),e=new Set;for(const o of t){if(e.has(o))continue;if(!estaEnVistaParaCargar(o))continue;const t=o.getAttribute("id"),n=o.dataset.srcM,a=o.dataset.srcT,r=o.dataset.srcD;let i=null;globalThis.matchMedia("(min-width: 1280px)").matches?i=r:globalThis.matchMedia("(min-width: 768px)").matches?i=a:globalThis.matchMedia("(min-width: 1px)").matches&&(i=n),e.add(o),loadImagePromise(i).then(e=>{const i=document.createElement("STYLE"),c=document.createTextNode(`\n\t\t\t\t\t\t@media (max-width: 767px) {\n\t\t\t\t\t\t\t[id="${t}"] {\n\t\t\t\t\t\t\t\tbackground-image: url(${n});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t@media (min-width: 768px) and (max-width: 1279px) {\n\t\t\t\t\t\t\t[id="${t}"] {\n\t\t\t\t\t\t\t\tbackground-image: url(${a});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t@media (min-width: 1280px) {\n\t\t\t\t\t\t\t[id="${t}"] {\n\t\t\t\t\t\t\t\tbackground-image: url(${r});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t`);i.appendChild(c),document.getElementById(t).appendChild(i),o.classList.remove("lazy_loading_backgroundImage"),delete o.dataset.srcM,delete o.dataset.srcT,delete o.dataset.srcD}).catch(t=>{console.error(t)})}},fnlazy_loader_backgroundImage_comp_demanda=function(t){const e=Array.from(t),o=new Set;for(const t of e){if(o.has(t))continue;const e=t.getAttribute("id"),n=t.dataset.srcM,a=t.dataset.srcT,r=t.dataset.srcD;let i=null;globalThis.matchMedia("(min-width: 1280px)").matches?i=r:globalThis.matchMedia("(min-width: 768px)").matches?i=a:globalThis.matchMedia("(min-width: 1px)").matches&&(i=n),o.add(t),loadImagePromise(i).then(o=>{const i=document.createElement("STYLE"),c=document.createTextNode(`\n\t\t\t\t\t@media (max-width: 767px) {\n\t\t\t\t\t\t[id="${e}"] {\n\t\t\t\t\t\t\tbackground-image: url(${n});\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t@media (min-width: 768px) and (max-width: 1279px) {\n\t\t\t\t\t\t[id="${e}"] {\n\t\t\t\t\t\t\tbackground-image: url(${a});\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t@media (min-width: 1280px) {\n\t\t\t\t\t\t[id="${e}"] {\n\t\t\t\t\t\t\tbackground-image: url(${r});\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t`);i.appendChild(c),document.getElementById(e).appendChild(i),t.classList.remove("lazy_loader_backgroundImage_comp_demanda")}).catch(t=>{console.error(t)})}},fnlazy_loader_img_a_demanda=function(t){const e=Array.from(t),o=new Set;for(const t of e){if(o.has(t))continue;const e=t.dataset.src;o.add(t),loadImagePromise(e).then(o=>{t.src=e,t.classList.remove("lazy_loader_img_a_demanda")}).catch(t=>{console.error(t)})}},fnCallLazyLoader=function(){fnlazy_loader_img(),fnlazy_loader_backgroundImage(),fnlazy_loader_backgroundImage_comp(),lazyLoadingBackgroundImage()},fnCallLazyLoaderADemanda=function(t){fnlazy_loader_img_a_demanda(t)};fnCallLazyLoader(),document.addEventListener("scroll",fnCallLazyLoader),globalThis.addEventListener("resize",fnCallLazyLoader),globalThis.addEventListener("orientationchange",fnCallLazyLoader),globalThis.addEventListener("DOMContentLoaded",fnCallLazyLoader),globalThis.addEventListener("load",fnCallLazyLoader);const fnGetParent=function(t,e){for(Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||function(t){return(this.document||this.ownerDocument).querySelectorAll(t).length>-1});t&&t!==document;t=t.parentNode)if(t.matches(e))return t;return null},procesarElementoConDosHijos=t=>{for(const e of t.childNodes)if(e.nodeType===Node.TEXT_NODE){const t=document.createElement("span");t.dataset.translate="true",t.textContent=e.textContent,e.replaceWith(t)}else procesarElemento(e)},procesarElemento=t=>{t.childNodes.length>1?procesarElementoConDosHijos(t):t.dataset.translate="true"},agregarDataTransaleElementosHijosDescripcion=t=>{if(!t)return;const e=t.children;if(e)for(const t of e){Array.from(t.childNodes).filter(t=>t.nodeType===Node.TEXT_NODE&&""!==t.textContent.trim()).length>0?procesarElemento(t):agregarDataTransaleElementosHijosDescripcion(t)}},setFormatearEnlaceBoton=function(t){for(const e of document.querySelectorAll(t)){switch(e.getAttribute("tipo_enlace")){case"Formulario_Solicitalo":case"Modal_Tarjeta":case"Modal_Prestamo":case"Modal_Seguro":case"Modal_SeguroPT":e.removeAttribute("href"),e.removeAttribute("target"),e.setAttribute("role","button"),e.removeAttribute("enlace");break;case"Pagina_Externa":e.setAttribute("href",e.getAttribute("enlace")),e.setAttribute("target","_blank"),e.removeAttribute("tipo_enlace"),e.removeAttribute("enlace");break;case"Pagina_Interna":e.setAttribute("href",e.getAttribute("enlace")),e.removeAttribute("target"),e.removeAttribute("tipo_enlace"),e.removeAttribute("enlace");break;case"Ninguna":e.remove()}}},mostrarFormatearModal=t=>{t.removeAttribute("href"),t.removeAttribute("target"),t.setAttribute("role","button")},bcp_formatear_enlace_boton_jsnativo=function(t){if(document.querySelectorAll(t).length>0)for(const e of document.querySelectorAll(t)){const o=e.getAttribute("tipo_enlace"),n=fnGetParent(e,"a");if(null==n)console.warn("No se encontro el atributo del elemento",t);else switch(o){case"Pagina_Externa":n.setAttribute("target","_blank"),n.setAttribute("href",e.getAttribute("enlace")),n.setAttribute("role","link");break;case"Pagina_Interna":n.setAttribute("href",e.getAttribute("enlace")),n.removeAttribute("target"),n.setAttribute("role","link");break;case"Formulario_Solicitalo":case"Modal_Tarjeta":case"Modal_Prestamo":case"Modal_Seguro":case"Modal_SeguroPT":mostrarFormatearModal(n);break;case"Ninguna":n.remove()}}else console.warn("No se encontro el elemento",t)};function getLeadID(){return crypto.randomUUID().replaceAll("-","")}const fnObjetoSinDuplicado=function(t,e){return t.filter((t,o,n)=>n.map(t=>t[e]).indexOf(t[e])===o)},slideUp=function(t,e=500){t.style.transitionProperty="height, margin, padding",t.style.transitionDuration=e+"ms",t.style.boxSizing="border-box",t.style.height=t.offsetHeight+"px",t.style.overflow="hidden",t.style.height=0,t.style.paddingTop=0,t.style.paddingBottom=0,t.style.marginTop=0,t.style.marginBottom=0,globalThis.setTimeout(()=>{t.style.display="none",t.style.removeProperty("height"),t.style.removeProperty("padding-top"),t.style.removeProperty("padding-bottom"),t.style.removeProperty("margin-top"),t.style.removeProperty("margin-bottom"),t.style.removeProperty("overflow"),t.style.removeProperty("transition-duration"),t.style.removeProperty("transition-property")},e)},slideDown=function(t,e=500){if("none"!==globalThis.getComputedStyle(t).display&&t.style.removeProperty("display"),"none"===globalThis.getComputedStyle(t).display){t.style.display="block";const o=t.offsetHeight;t.style.overflow="hidden",t.style.height=0,t.style.paddingTop=0,t.style.paddingBottom=0,t.style.marginTop=0,t.style.marginBottom=0,t.style.boxSizing="border-box",t.style.transitionProperty="height, margin, padding",t.style.transitionDuration=e+"ms",t.style.height=o+"px",t.style.removeProperty("padding-top"),t.style.removeProperty("padding-bottom"),t.style.removeProperty("margin-top"),t.style.removeProperty("margin-bottom"),globalThis.setTimeout(()=>{t.style.removeProperty("height"),t.style.removeProperty("overflow"),t.style.removeProperty("transition-duration"),t.style.removeProperty("transition-property")},e)}},slideToggle=function(t,e=500){return"none"===globalThis.getComputedStyle(t).display?slideDown(t,e):slideUp(t,e)},getCookie=function(t){for(let e,o=t+"=",n=decodeURIComponent(document.cookie).split(";"),a=0;a{const a=t[e],r=n[e];return"string"==typeof a&&"string"==typeof r?"asc"===o?a.localeCompare(r):r.localeCompare(a):"asc"===o?a-r:r-a})}const getLineaServicioActivo=function(){const t=globalThis.location.pathname.toLocaleLowerCase();let e="Personas";return t.includes("/pymes")?e="PyMES":t.includes("/empresas")&&(e="Empresas"),e};function getDerivacion(t){if(t.getAttribute("href")){const e=t.getAttribute("href");if("/"!==e.substring(0,1)&&!e.includes("www.viabcp.com"))return!0}return!1}async function digestMessage(t,e="SHA-256"){const o=(new TextEncoder).encode(t),n=await crypto.subtle.digest(e,o);return Array.from(new Uint8Array(n)).map(t=>t.toString(16).padStart(2,"0")).join("")}async function obtenerSha256(t){return await digestMessage(t,"SHA-256")}async function obtenerSha512(t){return await digestMessage(t,"SHA-512")}function fnsha256(t){function e(t,e){return t>>>e|t<<32-e}const o=(0,Math.pow)(2,32),n="length";let a,r,i="";const c=[],s=8*t[n];let l=fnsha256.h=fnsha256.h||[];const d=fnsha256.k=fnsha256.k||[];let m=d[n];const u={};for(let t=2;m<64;t++)if(!u[t]){for(a=0;a<313;a+=t)u[a]=t;l[m]=Math.trunc(Math.pow(t,.5)*o),d[m++]=Math.trunc(Math.pow(t,1/3)*o)}for(t+="€";t[n]%64-56;)t+="\0";for(a=0;a>8)return;c[a>>2]|=r<<(3-a)%4*8}for(c[c[n]]=Math.trunc(s/o),c[c[n]]=s,r=0;r>>3)+t[a-7]+(e(n,17)^e(n,19)^n>>>10))),s=(e(r,2)^e(r,13)^e(r,22))+(r&l[1]^r&l[2]^l[1]&l[2]);l=[Math.trunc(c+s)].concat(l),l[4]=Math.trunc(l[4]+c)}for(a=0;a<8;a++)l[a]=Math.trunc(l[a]+o[a])}for(a=0;a<8;a++)for(r=3;r+1;r--){const t=l[a]>>8*r&255;i+=(t<16?0:"")+t.toString(16)}return i}function getCategoriaProducto(){const t=getLineaServicioActivo(),e=globalThis.location.pathname.split("/");let o="";switch("personas"===t.toLowerCase()?o=e[1]:("pymes"===t.toLowerCase()||"empresas"===t.toLowerCase())&&(o=e[2]),o.toLowerCase()){case"credito":case"creditos":return"Crédito";case"seguros":return"Seguro";case"tarjetas":return"Tarjeta";case"financiamiento":return"Financiamiento";case"cobros":return"Cobro";case"pagos":return"Pago";default:return}}function getNombreProducto(){const t=document.querySelector(".bcp_banner_sin_carousel");if(null!=t)return t.querySelector(".banner_title").innerText.trim()}function setCookie(t,e,o,n=!1){const a=new Date;a.setTime(a.getTime()+o);const r="; expires="+a.toGMTString();let i="";n&&(i=";domain=.viabcp.com;"),document.cookie=t+"="+e+";"+r+";path=/"+i}function bcp_posicionar_formulario_solicitalo(){let t="";const e=document.querySelectorAll(".bcp-formulario");for(const o of e)o.getAttribute("nomproducto")&&(t=o);if(null!=t&&""!=t){let e=t.offsetTop;const o=globalThis.screen.width,n=document.querySelector(".bcp_formulario_pasos_varios");if(globalThis.screen.width<768&&n){e=document.querySelector(".banner_descarga .activo")?n.offsetTop+18:n.offsetTop-30}o>=768&&o<992&&(e-=50),e-=110,document.querySelector("html, body").scrollTo({top:e,left:0,behavior:"smooth"})}}function fnPlayVideo(t){if(""!=t.getAttribute("enlace-video")){const e="#bcp_id_modal_video_que_es_"+t.getAttribute("id");bcp_mostrar_modal_jsnativo(document.querySelector(e))}}function registrarCalificacionFeedbackBCP(t){const e=document.querySelector("form-feedback.validarfeedbackbcp");try{if(e){const o=new Formulario(e);ejecutarRegistroCalificacionFeedbackBCP(t,o)}}catch(t){console.error(t),e&&grecaptcha.reset(e.querySelector("#recaptchaFormFeedbackComp").getAttribute("index"))}}const guardarCookieAudienceDigitalAdobe=async(t,e)=>{const o=63072e6;let n;switch(t.toUpperCase()){case"DNI":n="01";break;case"CE":n="02";break;case"RUC":n="03";break;case"PASS":n="04"}if(!n)return;const a=`${n}-${await obtenerSha256(e)}`;setCookie("audience.digital_id",a,o,!0),setCookie("audience.identity.source","Form",o,!0),setCookie("audience.identity.state","Non-Authenticated",o,!0),digitalData.push({audience:{digital_id:a,identity:{source:"Form",state:"Non-Authenticated"}},event:"trackAudience"})};document.addEventListener("DOMContentLoaded",()=>{if(document.querySelectorAll(".bcp_texto_enriquecido_formateado.accesibilidad ul li").length>0)for(const t of document.querySelectorAll(".bcp_texto_enriquecido_formateado.accesibilidad ul li")){const e=`${t.innerHTML}`;t.innerHTML=e}if(globalThis.ibmPortalConfig&&!globalThis.ibmPortalConfig.isUserLoggedIn){const t=document.querySelectorAll("section.ibmPortalControl.wpthemeControl");for(const e of t)e.removeAttribute("aria-label"),e.removeAttribute("role");const e=document.querySelectorAll(".wpthemeMenuLoading");for(const t of e)t.remove();document.querySelector(".wpthemeMainContent").removeAttribute("aria-label")}});