PageSourceSearch

https://www.epm.com.co/etc.clientlibs/epm/clientlibs/clientlib-sit…-658f68384ba96350f30b394a818b3e02-lc.min.js

js epm.com.co collected 2026-10-02 03:29:34 UTC 467,305 bytes, 1 lines download raw bytes

1!function(){var e={97:function(){!function(){"use strict";class e{l2=document.querySelectorAll(".content-nav>ul.level1 li>ul.level2 >li a");navContent=document.querySelectorAll(".nav-content > .cmp-container> .container");close(){this.l2&&0!=this.l2.length&&this.l2.forEach((e=>{e.classList.contains("active")||(this.l2.forEach((e=>e.classList.remove("active"))),this.navContent.forEach((e=>e.classList.remove("active"))))}))}handleClick(){this.l2&&0!=this.l2.length&&this.l2.forEach((o=>{o.addEventListener("click",(()=>{i.close(),e.close();const n=document.getElementById(o.getAttribute("data-content"));o.classList.contains("active")||(this.l2.forEach((e=>e.classList.remove("active"))),this.navContent.forEach((e=>e.classList.remove("active")))),o.classList.toggle("active"),n.parentElement.classList.toggle("active"),window.matchMedia("(max-width:1024px)").matches&&t(o.getAttribute("data-content"))}))}))}}const t=e=>{const t=document.getElementById(e),i=document.querySelectorAll(".cmp-menu .level1 > li > a"),o=document.querySelectorAll(".level2 > li ");if(o.forEach((e=>{e.childNodes.length>2&&e.removeChild(e.lastChild)})),!t)return;const n=document.querySelector(`ul.level2 li a[data-content="${e}"]`);if(!n)return;const a=t.parentElement.cloneNode(!0);1===n.parentElement.children.length&&n.classList.contains("active")&&n.parentElement.appendChild(a),i.forEac
1h((e=>{e.addEventListener("click",(()=>{o.forEach((e=>{e.childNodes.length>2&&e.removeChild(e.lastChild)}))}))}))},i=new class{constructor(){this.handleClick=this.handleClick.bind(this)}initElements(){this.portalList=document.querySelector(".menu .portal-list"),this.portalToggle=document.querySelector(".menu .toggle-portal"),this.portalsContainer=document.getElementById("portals"),this.l2=document.querySelectorAll(".content-nav>ul.level1 li>ul.level2 >li a")}close(){this.portalList&&this.portalList.classList.remove("active"),this.portalToggle&&this.portalToggle.classList.remove("open"),this.portalsContainer&&this.portalsContainer.classList.remove("open")}handleClick(e){e.preventDefault(),this.initElements(),this.portalToggle&&this.portalList?(this.portalList.classList.toggle("active"),this.portalToggle.classList.toggle("open"),this.portalsContainer&&this.portalsContainer.classList.toggle("open")):console.warn("[Portal] No se encontraron elementos requeridos (.toggle-portal / .portal-list).")}handle(){this.initElements(),this.portalToggle&&(this.portalToggle.removeEventListener("click",this.handleClick),this.portalToggle.addEventListener("click",this.handleClick))}},o=(new class{l1=document.querySelectorAll("header.cmp-menu .level1 > li > a");handleClick(){this.l1&&0!=this.l1.length&&this.l1.forEach((e=>{e.addEventListener("click",(t=>{i.close(),o.close(),e.classList.contains("active")||this.l1.forEach((e=>{e.classList.remove("active"),e.nextElementSibling&&e.nextElementSibling.classList.remove("active")})),e.classList.toggle("active"),e.nextElementSibling&&e.nextElementSibling.classList.toggle("active")}))}))}currentLink(){if(!this.l1||0==this.l1.length)return;let e=!1;for(let t of this.l1)window.location.pathname.includes(t.getAttribute("title").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(new RegExp(" ","gi"),"-"))&&(t.dispatchEvent(new Event("click")),e=!0);e||this.l1[0].dispatchEvent(new Event("click"))}},new e),n=new class{links=document.querySelectorAll("header.cmp-menu .top ul.links li");liFlag=!1;handle(){if(this.links&&0!=this.links.length)for(let e of this.links)e.childElementCount>1&&(e.querySelector("a").setAttribute("class","ulList"),e.querySelector("a").addEventListener("click",(()=>{const t=e.querySelector("ul");this.liFlag?(t.style.display="none",this.liFlag=!1):(t.style.display="flex",this.liFlag=!0),e.classList.toggle("open"),e.querySelector("a").classList.toggle("open")})))}},a=new class{constructor(){this.handleDocumentClickCapture=this.handleDocumentClickCapture.bind(this),this.isBound=!1}handleDocumentClickCapture(e){const t=e.target,i=t&&t.closest?t.closest(".menu-accesibillity"):null;if(!i)return;e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation();const o=i.closest(".accesibillity-container"),n=o?o.querySelector(".accesibillity")||o.querySelector("ul.accesibillity"):document.querySelector(".accesibillity")||document.querySelector("ul.accesibillity");n?(n.classList.toggle("active"),i.classList.toggle("open")):console.warn("[Accesibility] No se encontró el panel de accesibilidad.")}handle(){this.isBound||(document.addEventListener("click",this.handleDocumentClickCapture,!0),this.isBound=!0)}},r=new class{constructor(){this.handleToggleFocusOut=this.handleToggleFocusOut.bind(this),this.handleDocumentClick=this.handleDocumentClick.bind(this)}initElements(){this.searchMenuList=document.querySelector(".menu .cmp-menu .nav .search .search-form"),this.searchMenuToggle=document.querySelector(".menu .cmp-menu .nav .search .search-btn"),this.searchMenuParent=document.querySelector(".menu .cmp-menu .nav .search"),this.searchInput=document.querySelector(".menu .cmp-menu .nav .search input[type='search']")}removeCloseListeners(){this.searchMenuToggle&&(this.searchMenuToggle.removeEventListener("focusout",this.handleToggleFocusOut),document.removeEventListener("pointerdown",this.handleDocumentClick))}close(){(this.searchMenuList||this.searchMenuToggle||this.searchMenuParent)&&(this.searchMenuList.classList.remove("open"),this.searchMenuToggle.classList.remove("open"),this.searchMenuParent.classList.remove("open"),this.searchMenuToggle.setAttribute("aria-label","Abrir buscador del sitio web"))}handle(){this.initElements(),this.searchMenuToggle?(this.searchMenuToggle.addEventListener("click",(e=>{e.preventDefault(),this.searchMenuList.classList.toggle("open"),this.searchMenuToggle.classList.toggle("open"),this.searchMenuParent.classList.toggle("open"),this.searchMenuToggle.classList.contains("open")?(this.searchMenuToggle.setAttribute("aria-label","Cerrar buscador del sitio web"),this.searchInput&&setTimeout((()=>{this.searchInput.focus({preventScroll:!0})}),0),this.searchMenuToggle.addEventListener("focusout",this.handleToggleFocusOut),document.addEventListener("pointerdown",this.handleDocumentClick)):(this.searchMenuToggle.setAttribute("aria-label","Abrir buscador del sitio web"),this.removeCloseListeners())})),this.searchMenuToggle.classList.contains("open")?this.searchMenuToggle.setAttribute("aria-label","Cerrar buscador del sitio web"):this.searchMenuToggle.setAttribute("aria-label","Abrir buscador del sitio web")):console.warn("[SearchMenu] No se encontró el botón toggle en el DOM")}handleToggleFocusOut(){requestAnimationFrame((()=>
1{if(!this.searchMenuParent)return;const e=document.activeElement;e&&this.searchMenuParent.contains(e)||(this.close(),this.removeCloseListeners())}))}handleDocumentClick(e){this.searchMenuParent&&!this.searchMenuParent.contains(e.target)&&(this.close(),this.removeCloseListeners())}},s=new class{dropdown=null;toggle=null;content=null;linksContainer=document.querySelector(".menu .cmp-menu ul.links");isCreated=!1;positionEnlaces=document.querySelector(".menu .cmp-menu div.accesibillity-container");init(){this.linksContainer&&this.shouldShowDropdown()&&(this.createDropdown(),this.moveLinksToDropdown(),this.handleClick())}shouldShowDropdown(){return window.innerWidth>=1024&&window.innerWidth<=1500}createDropdown(){this.isCreated||(this.positionEnlaces.insertAdjacentHTML("beforebegin",dropdownHTML),this.dropdown=document.querySelector(".menu .cmp-menu .enlaces-interes-dropdown"),this.content=document.querySelector(".menu .cmp-menu .enlaces-interes-dropdown .dropdown-content"),this.isCreated=!0)}destroyDropdown(){this.isCreated&&this.dropdown&&(this.dropdown.remove(),this.dropdown=null,this.toggle=null,this.content=null,this.isCreated=!1)}moveLinksToDropdown(){if(!this.content||!this.linksContainer)return;this.linksContainer.querySelectorAll("li").forEach((e=>{this.content.appendChild(e.cloneNode(!0))}))}handleClick(){this.toggle&&this.content&&(this.toggle.addEventListener("click",(e=>{e.preventDefault(),e.stopPropagation(),this.toggle.classList.toggle("open"),this.content.classList.toggle("show")})),document.addEventListener("click",(e=>{this.dropdown&&!this.dropdown.contains(e.target)&&this.close()})))}close(){this.toggle&&this.content&&(this.toggle.classList.remove("open"),this.content.classList.remove("show"))}handleResize(){if(this.shouldShowDropdown()&&!this.isCreated){if(!this.linksContainer)return;this.createDropdown(),this.moveLinksToDropdown(),this.handleClick()}else!this.shouldShowDropdown()&&this.isCreated&&this.destroyDropdown()}},c=1024,d=768;let l=!1,u=!1;function m(){return window.innerWidth>c?"pc":window.innerWidth>d?"tablet":"phone"}let p=m(),g=window.innerWidth;function h(){var e;document.querySelector(".cmp-menu.epm")?(console.log("[Menu] Inicializando componentes..."),i.handle(),n.handle(),a.handle(),r.handle(),e=()=>{s.init()},setTimeout((()=>{document.querySelector(".menu .cmp-menu ul.links")&&e()}),50),window.innerWidth<=c&&window.innerWidth>d&&f(),window.innerWidth>c&&v(),window.innerWidth<=d&&y()):console.warn("[Menu] No se encontró la clase base .cmp-menu.epm en el HTML.")}function f(){document.querySelector(".nav").insertAdjacentElement("beforeend",document.querySelector(".accesibillity-container")),document.querySelector(".nav .content-nav").insertAdjacentElement("afterbegin",document.querySelector(".button-portals")),document.querySelector(".nav .content-nav").insertAdjacentElement("afterbegin",document.querySelector(".top-links")),document.querySelector(".nav .content-nav").insertAdjacentElement("beforeend",document.querySelector(".linksTypeClient")),document.querySelector(".nav .btn-close-mobile").classList.contains("active")&&(document.querySelector(".nav .background-load").style.display="block",document.querySelector(".nav .btn-close-mobile").style.display="block"),l&&window.innerWidth>d&&(document.querySelector(".nav").insertAdjacentElement("beforeend",document.querySelector(".search")),document.querySelector(".nav").insertAdjacentElement("beforeend",document.querySelector(".content-actions")),document.querySelector(".nav").insertAdjacentElement("beforeend",document.querySelector(".accesibillity-container")),l=!1),u=!0}function v(){document.querySelector(".top").insertAdjacentElement("beforeend",document.querySelector(".accesibillity-container")),document.querySelector("header.cmp-menu.epm").insertAdjacentElement("afterbegin",document.querySelector(".top-links"));const e=document.querySelector(".top .top-corporate-nav"),t=document.querySelector(".button-portals");t&&e&&e.insertAdjacentElement("afterbegin",t);const i=document.querySelector(".linksTypeClient");i&&e&&e.insertAdjacentElement("beforeend",i),document.querySelector(".nav .btn-close-mobile").classList.contains("active")&&(document.querySelector(".nav .background-load").style.display="none",document.querySelector(".nav .btn-close-mobile").style.display="none"),l&&window.innerWidth>c&&(document.querySelector(".nav .content-nav").insertAdjacentElement("beforeend",document.querySelector(".level1")),document.querySelector(".nav .content-nav").insertAdjacentElement("beforeend",document.querySelector(".search")),document.querySelector(".nav .content-nav").insertAdjacentElement("beforeend",document.querySelector(".content-actions")),u=!1)}function y(){document.querySelector(".nav").insertAdjacentElement("beforeend",document.querySelector(".accesibillity-container")),document.querySelector(".nav .content-nav").insertAdjacentElement("afterbegin",document.querySelector(".button-portals")),document.querySelector(".nav .content-nav").insertAdjacentElement("afterbegin",document.querySelector(".search")),document.querySelector(".nav .content-nav").insertAdjacentElement("afterbegin",document.querySelector(".top-links")),document.querySelector(".nav .content-nav").insertAdjacentElement("beforeend",document.querySelector(".linksTypeClient")),document.querySelector(".nav .content-nav").insertAdjacentElement("beforeend",document.querySelector(".content-actions")),l=!0}document.addEventListener("click",(e=>{e.target.classList.contains("menu-sandwich")&&(document.querySelector(".nav .content-nav").classList.toggle("active"),document.querySelector(".nav .background-load").classList.toggle("active"),document.querySelector(".nav .btn-close-mobile").classList.toggle("active")),e.target.classList.contains("btn-close-mobile")&&(document.querySelector(".nav .content-nav").classList.toggle("active"),document.querySelector(".nav .background-load").classList.toggle("active"),document.querySelector(".nav .btn-close-mobile").classList.toggle("active"))})),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",h):h(),window.addEventListener("resize",(function(){if(!document.querySelector(".cmp-menu.epm"))return;if(navigator.userAgent.match(/iphone|ipad|ipod|mac/i))return;const e=document.activeElement,t=document.querySelector(".menu .cmp-menu .nav .search"),i=window.innerWidth,o=m();t&&e&&t.contains(e)||i===g&&o===p||(o!==p?(g=i,p=o,s.handleResize(),"pc"!==o?"tablet"!==o?"phone"!==o||y():f():v()):g=i)}))}()},116:function(){!function(){"use strict";window.addEventListener("load",(function(e){function t(e){const t=document.body;switch(e){case"large":t.classList.add("large-text"),t.classList.remove("small-text");break;case"small":t.classList.add("small-text"),t.classList.remove("large-text");break;default:t.classList.remove("large-text"),t.classList.remove("small-text")}localStorage.setItem("accessibilityState",e)}function i(){document.body.classList.toggle("dark-mode");const e=document.body.classList.contains("dark-mode");
1Array.from(document.getElementsByClassName("aemform")).forEach((e=>{var t=e.querySelector("iframe");(t.contentDocument||t.contentWindow.document).body.classList.toggle("dark-mode")})),localStorage.setItem("darkModeState",e.toString())}function o(){document.body.classList.toggle("audio-help");const e=document.body.classList.contains("audio-help");localStorage.setItem("audioHelpState",e.toString())}const n=this.document.querySelector("#normal-text");n&&n.addEventListener("click",(e=>{e.preventDefault(),t("normal")}));const a=this.document.querySelector("#small-text");a&&a.addEventListener("click",(e=>{e.preventDefault(),t("small")}));const r=this.document.querySelector("#large-text");r&&r.addEventListener("click",(e=>{e.preventDefault(),t("large")}));const s=this.document.querySelector("#dark-mode");s&&s.addEventListener("click",(e=>{e.preventDefault(),i()}));const c=this.document.querySelector("#audio-help");c&&c.addEventListener("click",(e=>{e.preventDefault(),o()}));const d=localStorage.getItem("accessibilityState");d&&t(d);"true"===localStorage.getItem("darkModeState")&&i();"true"===localStorage.getItem("audioHelpState")&&o();Array.from(document.querySelectorAll(".cmp-tabs__tabpanel")).forEac
1h((e=>{e.removeAttribute("tabindex")}));Array.from(document.querySelectorAll("[tabindex]")).forEach((e=>{e.addEventListener("keydown",(t=>{13==t.keyCode&&(t.preventDefault(),e.click())}))}))}))}()},768:function(){!function(){"use strict";function e(){window.scrollTo({top:0,behavior:"smooth"})}function t(){const e=document.querySelector('a[dataid="cmp-button-skip__cta"], a[aria-label="Saltar al contenido principal"], .cmp-button-skip a');e&&e.focus()}function i(){const e=document.querySelectorAll(".back-to-top-container"),t=window.pageYOffset||document.documentElement.scrollTop;e.forEach((function(e){const i="1"===e.style.opacity||e.classList.contains("show");if(t>300&&!i)e.style.display="block",e.classList.add("show"),e.offsetHeight,e.style.opacity="1",e.style.visibility="visible",e.style.transform="translateY(0)";else if(t<=300&&i){e.style.opacity="0",e.style.visibility="hidden",e.style.transform="translateY(20px)",e.classList.remove("show");const t=e.querySelector(".back-to-top-btn");t&&t.classList.remove("expanded"),setTimeout((function(){e.classList.contains("show")||(e.style.display="none")}),300)}}))}function o(e){e.classList.add("expanded")}function n(e){e.classList.remove("expanded")}function a(i){e(),t()}function r(){const e=document.querySelectorAll(".back-to-top-container");let t;e.forEach((function(e){e.style.transition="opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease",e.style.transform="translateY(20px)",e.style.display="none",e.style.opacity="0",e.style.visibility="hidden"})),document.addEventListener("click",(function(e){const t=e.target.closest(".back-to-top-btn");t&&(e.preventDefault(),a())})),e.forEach((function(e){const t=e.querySelector(".back-to-top-btn");t&&(t.addEventListener("mouseenter",(function(){o(t)})),t.addEventListener("mouseleave",(function(){n(t)})),t.addEventListener("focus",(function(){o(t)})),t.addEventListener("blur",(function(){n(t)})))})),window.addEventListener("scroll",(function(){t&&clearTimeout(t),t=setTimeout(i,10)})),i()}window.BackToTopComponent=window.BackToTopComponent||{},window.BackToTopComponent.scrollToTop=e,window.BackToTopComponent.handleButtonClick=a,window.BackToTopComponent.animateSlideOut=function(e){e.classList.remove("expanded")},window.BackToTopComponent.resetFocusToSkipLink=t,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",r):r(),window.addEventListener("hashchange",(function(){setTimeout(i,100)})),window.addEventListener("resize",(function(){setTimeout(i,100)}))}()},308:function(){!function(){"use strict";window.addEventListener("load",(()=>{document.querySelectorAll(".cmp-blog-category-tabs").forEach((e=>{var t=e.querySelector("#banner-properties"),i=JSON.parse(t.dataset.bannerProperties),o=document.getElementById(t.dataset.titleId).querySelector(".cmp-title__text"),n=document.getElementById(t.dataset.bannerId),a=Array.from(e.querySelector("#category-tabs").getElementsByClassName("cmp-tabs__tab")),r=n.querySelector(".cmp-sectionContainer"),s=e.querySelector("#category-select");function c(e){o.textContent=i[e].title,r.querySelectorAll("img").forEach((t=>{t.src=i[e].image}))}function d(e){s.selectedIndex=e}!function(){a.forEach((e=>{if(""!=e.textContent.trim()){var t=document.createElement("option");t.value=e.textContent,t.textContent=e.textContent,s.appendChild(t)}}));var t=Array.from(e.querySelector("#category-tabs").getElementsByClassName("cmp-tabs__tabpanel"));s.addEventListener("change",(()=>{var e,i=s.selectedIndex;t.forEach(((e,t)=>{t==i?e.classList.add("cmp-tabs__tabpanel--active"):e.classList.remove("cmp-tabs__tabpanel--active")})),c(i),e=i,a.forEach(((t,i)=>{i==e?t.classList.add("cmp-tabs__tab--active"):t.classList.remove("cmp-tabs__tab--active")}))}))}(),a.forEach(((e,t)=>{e.addEventListener("click",(()=>{c(t),d(t)})),e.classList.contains("cmp-tabs__tab--active")&&(e.click(),d(t))}))}))}))}()},637:function(){!function(){"use strict";window.addEventListener("load",(()=>{document.querySelectorAll(".cmp-blog-article__component").forEach((e=>{var t=document.getElementById(e.dataset.titleId).querySelector(".cmp-title__text"),i=document.getElementById(e.dataset.bannerId).querySelector(".cmp-sectionContainer"),o=e.dataset.articleImageTitle;i.setAttribute("title",o),i.setAttribute("alt",o),i.setAttribute("aria-label",o),t.textContent=e.dataset.articleTitle,i.querySelectorAll("img").forEach((t=>{t.src=e.dataset.articleImage,t.alt=e.dataset.articleAltTextImage,t.title=o}))}))}))}()},883:function(){!function(){"use strict";document.querySelectorAll(".cmp-buttonBack").forEach((e=>{e.querySelector(".cmp-button").addEventListener("click",(()=>{window.history.back()}))}))}()},367:function(){window.addEventListener("load",(()=>{const e=document.getElementById("cmp-card-detail-container");if(!e)return;const t=["NumeroPedido","imagen","Producto","Equipo","Marca","LugarDondeSePresentaLaFuga","LugarPrestacionServicio","FechaVigencia","FranjaHoraria","DireccionFacturacion","RazonParaElEstado","ValorCotizacion"],i=function(){try{const e=JSON.parse(localStorage.getItem("pedido")||"null");return e&&"object"==typeof e?t.reduce(((t,i)=>(t[i]=String(e[i]??""),t)),{}):null}catch(e){return console.log("Ha ocurrido un error al procesar el pedido: ",e),null}}();setTimeout((()=>{!function(t){if(t){var i,o,n=`\n                    <div class="card">\n                        <div class="card-header">
1\n                          <span class="radicado"> <span style="color:#007934">N° radicado:</span> <span>${t.NumeroPedido}</span> </span>\n                        </div>\n                        <div class="card-body">\n                          <div class="card-left">\n                            <div class="container-image">\n                                <img src=${t.imagen} alt="imagen-servicio" class="image">\n                            </div>\n                          </div>\n                          <div class="card-right">\n                            <div class="content-right">\n                                <div class="details installation-details">\n                                    <h5>${t.Producto}</h5>\n                                    ${""!==t.Equipo.trim()?`<div><h5 class="title-property">Equipo: </h5> <p class="title-property">${t.Equipo}</p></div>`:""}\n                                    ${""!==t.Marca.trim()?`<div><h5 class="title-property">Marca: </h5><p class="title-property">${t.Marca}</p></div>`:""}\n                                    ${""!==t.LugarDondeSePresentaLaFuga.trim()?`<div><h5 class="title-property">Lugar de fuga: </h5><p class="title-property">${t.LugarDondeSePresentaLaFuga}</p></div>`:""}\n                                    ${""!==t.LugarPrestacionServicio.trim()?`<div><h5 class="title-property">Lugar del daño: </h5><p class="title-property">${t.LugarPrestacionServicio}</p></div>`:""}\n                                  </div>\n                                  <div class="details request-details">\n                                    <h5 style="visibility:hidden">Fecha vigencia</h5> \n                                    <h5 style="visibility:hidden" class="title-property">Fecha: </h5><p style="visibility:hidden" class="title-property">${new Date(t.FechaVigencia).toLocaleDateString()}</p> \n                                    <h5 style="visibility:hidden" class="title-property">Jornada: </h5><p class="title-property">${t.FranjaHoraria}</p> \n                                  </div>\n                                  <div class="details date-details">\n                                    <h5>Dirección</h5>\n                                    <p>${t.DireccionFacturacion}</p>\n                                    ${"En cotización vigente"===t.RazonParaElEstado?`<h5><strong>Fecha vigencia</strong></h5>\n                                    <h5 class="title-property">Fecha: </h5><p class="title-property">${t.FechaVigencia.split("T")[0]}</p>`:""}\n                                  </div>\n                                  <div class="status-box ${t.RazonParaElEstado.toLowerCase().replace(/\s/g,"")}">\n                                    <h5 class="status-label">Estado:</h5>\n                                    <p class="status-text">${t.RazonParaElEstado}</p>\n                                  </div>\n                                   ${"En cotización vigente"===t.RazonParaElEstado?`<div class="quote"> <h2>Valor cotización: <strong>$ ${i=t.ValorCotizacion.split(".")[0],o=i.split("."),o[0]=o[0].replace(/\B(?=(\d{3})+(?!\d))/g,"."),o.join(",")}</strong></h2> </div>`:""}\n                               \n                            </div>\n                          </div>\n                        </div>\n                        <div class="containers-buttons-pedidos">\n                          <div class="buttons">\n                            \n                          </div>\n                        </div>\n                    </div>\n                `;e.innerHTML=n}}(i)}),10)}))},833:function(){!function(){"use strict";window.addEventListener("load",(()=>{let e=window.location.pathname.includes("investors")?"investor":"";const t=document.querySelectorAll(".cmp-contentfragment-pageredirect"),i=document.querySelectorAll(".cmp-pagination__container button p");if(document.querySelectorAll(".cmp-card-icon").forEach((t=>{t.querySelectorAll(".cmp-card-icon__container").forEach((t=>{if(t.querySelectorAll(".cmp-card-icon__item").length>0){let i=t.querySelectorAll(".cmp-card-icon__item")[0].getAttribute("href");if("pdf"===i.substring(i.length-3,i.length)){let i="investor"===e?"View document":"Ver documento";t.querySelectorAll(".cmp-card-icon__button .cmp-button")[0].textContent=i}else{let i="investor"===e?"See more":"Ver más";t.querySelectorAll(".cmp-card-icon__button .cmp-button")[0].textContent=i}}}))})),t.forEach((e=>{const t=e.closest(".cmp-contentfragment");
1if(!t)return;const i=t.querySelector(".cmp-contentfragment__element--botn .cmp-contentfragment__element-value");let o="Acceder al contenido completo";i&&i.textContent&&""!==i.textContent.trim()&&(o=i.textContent.trim()),e.textContent=o;const n=t.querySelector(".cmp-contentfragment__element--altImagen .cmp-contentfragment__element-value"),a=t.querySelector(".cmp-contentfragment__element--main_image .cmp-contentfragment-image");a&&(n&&n.textContent&&""!==n.textContent.trim()?a.setAttribute("alt",n.textContent.trim()):a.setAttribute("alt",""))})),document.querySelectorAll(".cmp-contentfragment__element--botn").forEach((e=>{e.style.display="none"})),i){const t={"Ir al primero":"Go to first",Anterior:"Previous",Siguiente:"Next","Ir al último":"Go to last"};i.forEach((i=>{"investor"==e&&(i.textContent=t[i.textContent])}))}}))}()},661:function(){(()=>{const e=e=>{if(!window.matchMedia("(max-width: 1612px)").matches)return;let t="858px";e>=5?t="423px":e<=4&&(t="643px"),document.documentElement.style.setProperty("--ancho-imagen",t)},t=e=>{const t=[{min:1,max:2,value:1},{min:3,max:4,value:2},{min:5,max:1/0,value:3}].find((t=>e>=t.min&&e<=t.max)),i=t?t.value:1;document.documentElement.style.setProperty("--cantidad-elementos",i)},i=()=>{const i=(()=>{const e=document.querySelector(".cmp-pagination__container")?.getAttribute("data-list-container-id"),t=document.getElementById(e);return t?Array.from(t.children).filter((e=>"none"!==getComputedStyle(e).display)):[]})().length;i>0&&(e(i),t(i))},o=()=>{const e=Array.from(document.querySelectorAll(".paginador-btn"));e.length>4&&e.forEach((e=>{e.removeEventListener("click",i),e.addEventListener("click",i)}))},n=()=>{const n=document.querySelector(".cmp-pagination__container")?.getAttribute("data-list-container-id"),a=Array.from(document.getElementById(n)?.children||[]);o(),a.length>0&&window.matchMedia("(max-width: 1243px)").matches&&(e(a.length),t(a.length),i())};window.addEventListener("load",(()=>{(()=>{const e=document.querySelector(".cmp-pagination__container");if(!e)return;new MutationObserver((e=>{for(const t of e)"childList"===t.type&&Array.from(t.addedNodes).some((e=>1===e.nodeType&&e.classList.contains("paginador-btn")))&&o()})).observe(e,{childList:!0,subtree:!0})})(),n(),window.addEventListener("resize",n)}))})()},194:function(){!function(){"use strict";window.addEventListener("load",(()=>{window.location.pathname.substring(13,21);document.querySelectorAll(".cmp-card-yt").forEach((e=>{e.querySelectorAll(".cmp-card-yt__container").forEach((e=>{if(e.querySelectorAll(".cmp-card-yt__item").length>0){let t=e.querySelectorAll(".cmp-card-yt__item")[0].getAttribute("href");t.substring(t.length-3,t.length)}}))}))}))}()},841:function(){!function(){class e{constructor(){this.dots=document.querySelector(".cmp-carousel__indicators")}handleSwipe(e,t){let i=e-t;this.dots&&(i>50?Array.from(this.dots.children).every((e=>{if(e.classList.contains("cmp-carousel__indicator--active")){if(e.nextElementSibling)return e.nextElementSibling.dispatchEvent(new Event("click")),!1;this.dots.firstElementChild.dispatchEvent(new Event("click"))}return!0})):i<-50&&Array.from(this.dots.children).every((e=>!e.classList.contains("cmp-carousel__indicator--active")||(e.previousElementSibling?(e.previousElementSibling.dispatchEvent(new Event("click")),!1):(this.dots.lastElementChild.dispatchEvent(new Event("click")),!1)))))}accesibilityDots(e){if(!this.dots)return;const t=()=>{Array.from(this.dots.children).forEach((e=>{e.setAttribute("tabindex","0")}))};switch(e){case 1:t();break;case 2:Array.from(this.dots.children).forEach((e=>{e.addEventListener("keydown",(i=>{"Enter"!==i.key&&" "!==i.key||(e.dispatchEvent(new Event("click")),t())}))}))}}}window.addEventListener("load",(()=>{let t=0,i=0;const o=new e;o.accesibilityDots(1),o.accesibilityDots(2),window.addEventListener("touchstart",(e=>{e.target&&e.target.classList.contains("cmp-banner__ImageMobile")&&(t=e.touches[0].clientX)})),window.addEventListener("touchend",(e=>{e.target&&e.target.classList.contains("cmp-banner__ImageMobile")&&(i=e.changedTouches[0].clientX,o.handleSwipe(t,i))}
1))}))}()},668:function(){window.addEventListener("load",(()=>{const e=document.querySelector(".tab-elements");if(e){const t=document.querySelector(".tab-elements").getAttribute("data-banner-id"),i=document.querySelector(".tab-elements").getAttribute("data-banner-title-id");Array.from(e.children).forEach(((e,o)=>{const n=e=>{t&&(imageBanner=document.querySelector(`#${t} img`),imageBanner.src=e.getAttribute("data-tab-banner-image")),i&&(titleBanner=document.querySelector(`#${i} h2`),titleBanner.textContent=e.getAttribute("data-tab-banner-title"))};0===o&&n(e),e.addEventListener("click",(e=>{n(e.target)}))}))}}))},539:function(){!function(){"use strict";window.addEventListener("load",(()=>{const e=document.querySelector(".dateDropDown"),t=document.querySelector(".dateDropDown-info"),i=document.querySelector(".chkInput"),o=document.querySelector(".cmp-blog-article__link"),n=document.querySelector(".cmp-blog-article__date"),a=document.getElementById("blog-banner"),r=t=>{t.preventDefault();const i=e.classList.toggle("active");e.setAttribute("aria-expanded",i)};if(e&&t&&(t.addEventListener("click",r),e.addEventListener("keydown",(e=>{"Enter"!==e.key&&" "!==e.key||r(e)}))),i){const e=i.querySelector("#dataConsent");e.addEventListener("click",(t=>{if(!e.checked)return;const o=i.querySelector(".text-chkInput");o&&o.dispatchEvent(new Event("click")),setTimeout((()=>{const e=document.querySelector(".modal-layer.open");if(!e)return;const t=document.getElementById("closeByIdDecretos");if(console.log("Accept button:",t),t){const e=e=>{e&&e.preventDefault();const t=document.querySelector(".modal-layer.open");if(t){t.classList.remove("open"),console.log("Modal closed");const e=document.getElementById("submit");e&&e.focus()}const i=document.querySelector('[data-cmp-trigger="modalDecretos"]');i&&setTimeout((()=>i.focus()),0)};t.addEventListener("click",e),t.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),e(t))})),t.addEventListener("click",(e=>{e.preventDefault(),console.log("Accept button clicked, default prevented")}),!0)}const i=Array.from(e.querySelectorAll('\n        a[href],\n        button:not([disabled]),\n        textarea:not([disabled]),\n        input:not([disabled]),\n        select:not([disabled]),\n        [tabindex]:not([tabindex="-1"])\n    '));if(0===i.length)return;const o=i[0],n=i[i.length-1],a=e.querySelector('[tabindex="0"]');a?a.focus():o.focus();const r=t=>{if("Tab"===t.key&&(t.shiftKey?document.activeElement===o&&(t.preventDefault(),n.focus()):document.activeElement===n&&(t.preventDefault(),o.focus())),("Enter"===t.key||"Escape"===t.key)&&!e.classList.contains("open")){const e=document.getElementById("submit");e&&e.focus(),document.removeEventListener("keydown",r)}};document.addEventListener("keydown",r)}),100)})),e.addEventListener("keydown",(t=>{"Enter"===t.key&&(t.preventDefault(),e.click())}))}if(o){const e=o.id.toLowerCase().replace(" ","-").replace(/[áéíóú]/gi,(e=>({"á":"a","é":"e","í":"i","ó":"o","ú":"u"}[e]))),t=document.querySelector(".cmp-blog-content"),i=document.querySelector(".cmp-article-share-buttons__container");o.href=`/categorias/${e}`;const r=new Date(n.textContent);r.setDate(r.getDate()+1),n.textContent=new Intl.DateTimeFormat("es-ES",{day:"2-digit",month:"long",year:"numeric"}).format(r);const s=t.textContent;if(t.innerHTML="",t.innerHTML=s,a){const e=document.querySelector(".cmp-banner__ImageDesktop");if(e){const t=document.querySelector(".cmp-blog-article__container"),i=document.querySelector(".cmp-title__text");if(t&&i){const o=t.getAttribute("data-article-image"),n=t.getAttribute("data-article-title");o&&n&&(e.src=o,i.textContent=n)}}}if(Array.from(i.children).forEach((e=>{const t=e.querySelector("a.cmp-button > img").src;e.addEventListener("mouseover",(()=>{e.querySelector("img").src=t.split("_").slice(0,-1).concat("verde.svg").join("_")})),e.addEventListener("mouseout",(()=>{e.querySelector("img").src=t}))})),t){const e=t.querySelector('a[title="video"]');if(e.style.display="none",e){const i=`https://www.youtube.com/embed/${e.href.split("/").pop()}`,o=document.createElement("iframe");o.width="640",o.height="360",o.src=i,o.frameBorder="0",o.allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",o.allowFullscreen=!0,t.appendChild(o)}}}}))}()},541:function(){!function(){"use strict";window.addEventListener("load",(()=>{document.querySelectorAll(".cmp-connection__cards-wrapper").forEach((function(e){const t=e.querySelector(".cmp-connection__cards"),i=e.querySelector(".nav-arrow--left"),o=e.querySelector(".nav-arrow--right"),n=e.querySelector(".nav-arrows-container");function a(){const e=t.clientWidth,i=function(e){let t=Math.floor((e+10)/236);t>1&&(e-226*t)/(t-1)>120&&(t-=1);return Math.max(1,t)}(e);let o;if(e>=1610)o=120;else{const t=(e-226*i)/(i-1);o=Math.min(Math.max(10,t),120)}return t.style.gap=`${o}px`,o}function r(e){"left"===e?t.scrollBy({left:-200,behavior:"smooth"}):t.scrollBy({left:200,behavior:"smooth"})}function s(){const e=t.scrollLeft>0,n=t.scrollLeft<t.scrollWidth-t.clientWidth;i.disabled=!e,o.disabled=!n,i.style.opacity=e?"1":"0.5",o.style.opacity=n?"1":"0.5"}function c(){a(),function(){const e=t.scrollWidth>t.clientWidth;n.style.display=e?"flex":"none"}(),s()}c(),i&&i.addEventListener("click",(function(){r("left"),setTimeout(s,300)})),o&&o.addEventListener("click",(function(){r("right"),setTimeout(s,300)})),t.addEventListener("scroll",s),window.addEventListener("resize",(function(){c()}))}))}))}()},749:function(){!function(){"use strict";window.addEventListener("load",(()=>{const e=["pdf","xlsx","url","ppt","pptx","doc","docx","docs","DOCX","xls","zip","html","xlsm"],t=["descargar","download","go","watch video","ir","ver mas","ver sitio","conocer mas","ver video","ver documento","read document"];document.querySelectorAll(".cmp-tabla").forEach((i=>{let o=i.getElementsByTagName("tbody");for(let i=1;i<=o[0].getElementsByTagName("tr").length-1;i++){const n=o[0].getElementsByTagName("tr")[i];if(n.getElementsByTagName("td").length>0||n.getElementsByTagName("td")[0]){let t=n.getElementsByTagName("td")[0],i=t?t.getElementsByTagName("a")[0]:void 0;if(i){let t=i.getAttribute("href"),o=t.split("."),a=o[o.length-1];if(a&&e.includes(a.toLowerCase())){const e=document.createElement("div"),t=document.createElement("svg");e.setAttribute("class","div-image"),t.classList.toggle("svg-icon"),t.setAttribute("class",`icon_${a.toLowerCase()}`),t.setAttribute("title",`Archivo ${a.toUpperCase()}`),t.setAttribute("alt",`Icono ${a.toUpperCase()}`);let i=n.getElementsByTagName("td")[0];i.className="td-tag",e.appendChild(t),i.appendChild(e)}else if(t.includes("youtube")||t.includes("youtu.be")){const e=document.createElement("div"),t=document.createElement("svg");e.setAttribute("class","div-image"),t.classList.toggle("svg-icon"),t.setAttribute("class","icon_youtube"),t.setAttribute("title","Video de YouTube"),t.setAttribute("alt","Icono YouTube");let i=n.getElementsByTagName("td")[0];i.className="td-tag",e.appendChild(t),i.appendChild(e)}else if(t.includes("https")){const e=document.createElement("div"),t=document.createElement("svg");e.setAttribute("class","div-image"),t.classList.toggle("svg-icon"),t.setAttribute("class","icon_web"),t.setAttribute("title","Enlace Web"),t.setAttribute("alt","Icono Web");let i=n.getElementsByTagName("td")[0];i.className="td-tag",e.appendChild(t),i.appendChild(e)}}}if(void 0!==n.getElementsByTagName("td"))for(let i=1;i<n.getElementsByTagName("td").length;i++){const o=n.getElementsByTagName("td")[i];if(o.querySelector("p")&&o.getElementsByTagName("p")[0].getElementsByTagName("a").length>0){let i=o.getElementsByTagName("p")[0].getElementsByTagName("a")[0];let n=i.innerHTML.split("<")[0];n=n.normalize("NFD").replaceAll(/[\u0300-\u036f]/gi,"").toLowerCase();let a=i.getAttribute("href").split(".");(e.includes(a[a.length-1])&&t.includes(n)||t.includes(n))&&o.getElementsByTagName("p")[0].getElementsByTagName("a")[0].setAttribute("class","download-button")}else if(o.getElementsByTagName("a").length>0){let i=o.getElementsByTagName("a")[0],n=i.textContent;n=n.normalize("NFD").replaceAll(/[\u0300-\u036f]/gi,"").toLowerCase();let a=n.split("("),r=i.getAttribute("href").split(".");(e.includes(r[r.length-1])&&t.includes(a[0])||t.includes(n))&&o.getElementsByTagName("a")[0].setAttribute("class","download-button")}}}}))}))}()},90:function(){!function(){class e{constructor(){this.fixedbutton=document.querySelector(".cmp-fixedbutton"),this.megaMenu=document.querySelector(".cmp-mega-menu")}relocateButtonToChild(){this.fixedbutton&&(this.fixedbutton.cloneNode(!0),this.megaMenu.append(this.fixedbutton))}accebilityButton(){this.fixedbutton&&this.fixedbutton.addEventListener("keydown",(e=>
1{"Enter"===e.key&&this.fixedbutton.querySelector(".btn-tab").click()}))}}window.addEventListener("load",(()=>{const t=new e;t.relocateButtonToChild(),t.accebilityButton()}))}()},999:function(){!function(){"use strict";window.addEventListener("load",(()=>{const e=document.getElementById("float-buttons-hidden");function t(e){let t=document.cookie.match(new RegExp("(?:^|; )"+e.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,"\\$1")+"=([^;]*)"));return t?decodeURIComponent(t[1]):void 0}function i(){window.location.href.includes("/informacion-solicitud")?($("#cart-epm-commerce").css({display:"flex"}),$("#cart-epm-commerce").css({visibility:"visible"}),function(e,i){let o=t(e);setInterval((()=>{let n=t(e);n!==o&&(o=n,i(n))}),1e3)}("cartStep",(e=>{console.log("El valor de la cookie ha cambiado:",e),"Paso 2"==e||"Paso 3"==e?$(".button-badge").css({visibility:"visible"}):$(".button-badge").css({visibility:"hidden"})}))):$("#cart-epm-commerce")&&$("#cart-epm-commerce").css({display:"none"})}e&&e.parentElement.classList.remove("hide"),i(),window.addEventListener("hashchange",(()=>{i()})),window.addEventListener("popstate",(()=>{i()}))}))}()},781:function(){!function(){"use strict";window.addEventListener("load",(()=>{document.querySelectorAll(".cmp-footer-container").forEach((e=>{let t=e.querySelector(".cmp-footer-background"),i=t.getAttribute("image-url");i&&(t.style.backgroundImage="url('"+i+"')")}))}))}()},173:function(){window.addEventListener("load",(()=>{document.querySelectorAll(".cmp-formcart--container").forEach((e=>{var t,i;$.ajax({url:"/bin/ecommerceRecaptcha",type:"GET",processData:!1,contentType:!1,dataType:"json",success:function(e){i=e.RECAPTCHA_ENDPOINT,t=e.RECAPTCHA_KEY;var o=document.createElement("script");o.type="text/javascript",o.src=i+t,document.head.appendChild(o)},error:function(){console.error("Error al obtener captchaId")}});const o=e.querySelector(".cmp-formcart--firststep"),n=document.querySelector("#cmp-formcart--identification"),a=e.querySelector(".cmp-formcart--secondstep"),r=e.querySelector("#cmp-formcart-services"),s=e.querySelector(".cmp-formcart--authorization"),c=e.querySelector(".cmp-formcart--type");let d,l=document.getElementsByName("channel"),u=document.querySelector(".cmp-formcart--channels"),m=document.querySelector(".cmp-formcart--address"),p=(document.querySelector(".cmp-formcart-placa-options"),document.getElementById("form_register--inputplaca"));const g=document.querySelector("#cmp-formcart--containerinputs-ubication");document.querySelector(".cmp-formcart--recibo-btnclose");let h=document.querySelector(".cmp-formcart--contractImage"),f=document.querySelector(".cmp-formcart--searchImage"),v=(document.querySelector(".cmp-formcart--searchImage-direccion"),document.querySelector("#cmp-formcart--observations-message")),y=document.querySelector("#form_register--inputContrato");const C=document.querySelector(".cmp-formcart--containerinputsEmpresa"),E=document.querySelector(".cmp-formcart--firststep-infoSolicitante-title"),A=(document.getElementById("cmp-formcart--Codephone-arrow_down"),document.querySelector(".distinctperson")),S=document.querySelector(".cmp-formcart--sameperson");let b=document.querySelector(".cmp-formcart--contrato"),w=document.querySelector(".form_register--inputDireccion"),L=document.getElementById("form_register--inputNumberidentification"),I=document.getElementById("form_register--inputRelacionInmueble"),N=(document.getElementById("form_register--inputCellphone"),document.querySelector(".cmp-formcart--info")),M=document.querySelector(".cmp-formcart--typearea"),O=document.querySelector(".cmp-formcart--inmueble"),T=document.querySelector(".cmp-formcart--interior"),R=document.getElementById("form_register--inputinterior"),D=(document.querySelector(".cmp-formcart--direccion"),document.querySelector(".cmp-formcart--departamento"),document.querySelector(".cmp-formcart--municipio"),document.querySelector(".form_register--inputDepartamento")),q=document.querySelector(".form_register--inputMunicipio"),P=document.querySelector(".form-services"),k=document.querySelector("#itemscart__cta--buyservice"),x=(document.getElementById("modal-checkout-finalizar-pedido"),document.getElementById("modal-checkout-finalizar-solicitud")),B=document.querySelectorAll(".modal-content");
1document.querySelectorAll("#modal-satisfaccion"),document.querySelector(".container-buy-service").classList.add("disabled");let _=document.querySelector(".cmp-icontextv2"),F=document.getElementById("message-experience"),U=document.getElementById("send-opinion"),H=document.getElementById("validar-email"),j=document.querySelector("#modal-validar-email"),J=document.querySelector("#modal-reintentar"),G=document.querySelector("#modal-reintentar #mensaje-reintentar"),V=document.querySelector("#btn-reintentar"),z=document.querySelector("#email-usuario"),Z=document.querySelector("#codigo-usuario"),Q=document.querySelector("#btn-reenviar"),Y=document.querySelector(".cmp-formcart--btnback"),W=document.getElementById("cerrar-modal"),X=document.querySelector(".cmp-formcart--summary"),K=!1;const ee=document.querySelector(".cmp-formcart--Razonsocial"),te=(document.querySelector(".cmp-formcart--CodePhone"),document.querySelector(".cmp-formcart--Phone"),document.querySelector("#form_register--inputname")),ie=(document.querySelector(".cmp-formcart--lastname"),document.querySelector(".cmp-formcart--Expeditiondate")),oe=document.querySelector(".cmp-formcart--Cellphone"),ne=document.querySelector("#form_register--inputTypeidentification"),ae=document.querySelector("[data-source]").getAttribute("data-source"),re=document.querySelector(".cmp-formcart--TypeidentificationEmpresa"),se=document.querySelector(".cmp-formcart--NumberidentificationEmpresa"),ce=document.getElementById("form_register--inputTypeidentificationEmpresa"),de=document.querySelector(".cmp-formcart--emailEmpresa");document.getElementById("form_register--inputEmail"),document.getElementById("form_register--inputEmailConfirmation");let le,ue,me,pe,ge="",he=!1,fe=!0,ve=!1,ye="",Ce=e.getAttribute("data-codesega").split(",").map(Number);ee.classList.add("hide"),re.classList.add("hide"),de.classList.add("hide"),se.classList.add("hide"),b.classList.add("hide");let Ee="Hogar",Ae="si es la misma persona",Se="",be="direccion",we=["email","sms","whatsapp","telefono"],Le={919900001:"Cédula de extranjería",919900002:"Pasaporte"},Ie=JSON.parse(localStorage.getItem("Cobertura"))||[],Ne="",Me="";function Oe(){document.querySelectorAll(".modal-layer").forEach((e=>{e.classList.remove("open"),document.body.style.overflow="auto"}))}async function Te(){const e=await fetch("/libs/granite/csrf/token.json");return(await e.json()).token}async function Re(e){let t=new FormData,i=await je();t.append("token",i),t.append("data",e);const o=await fetch("/bin/cssopen",{method:"POST",headers:{"CSRF-Token":await Te()},body:t}),n=await o.json();return console.log({datos:n}),n}function De(){$(".cmp-formcart--Errormsg-secondstep").hide(),$('.cmp-formcart--secondstep [class^="cmp-formcart--error"]').hide("slow"),$('.cmp-formcart--secondstep [id^="form_register--error"]').hide("slow"),$('.cmp-formcart--secondstep [class^="form_register--input"]').css("background-color","")}var qe,Pe;
1function ke(e){$("#cart-message").text(e),$("#messages-for-docs").removeClass("hide")}function xe(){$("#loader-div").removeClass("hide")}function Be(){$("#loader-div").addClass("hide")}function _e(e){return""!=e&&/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(e)}function $e(e){return""!=e.trim()&&(!(e.length<10||e.length>10)&&(3==e.charAt(0)&&/^[0-9]+$/.test(e)))}function Fe(e){return""!=e&&!(e.length<=7)}function Ue(e){return""!=e.trim()&&/^[a-zA-ZñÑ\s]+$/.test(e)}function He(e){return/^\d{1,8}$/.test(e)}function je(){return new Promise(((e,i)=>{grecaptcha.ready((function(){grecaptcha.execute(t,{action:"submit"}).then((function(t){e(t)})).catch((function(e){i(e),ke("Lo sentimos, no se pudo generar el token")}))}))}))}function Je(){return"no autorizo"===Se&&we.length>=2?(document.getElementById("errorchannelsMessage").style.display="none",{channel:we,ok:!0}):"no autorizo"===Se&&we.length<=1?(document.getElementById("errorchannelsMessage").style.display="block",{channel:"",ok:!1}):{channel:[],ok:!0}}function Ge(e){document.querySelector(e).scrollIntoView({behavior:"smooth"})}function Ve(){n.reset()}function ze(){let e=$("#cmp-formcart--identification"),t=function(e,t){let i=!0;e.find('[id^="form_register--error"]').hide("slow"),e.find("input").css("background-color","#FFFFFF");let o=$('input[name="terms"]:checked').val();return""===$('select[name="typeidentification"]').val()&&($("#form_register--errortypeidentification").show("slow"),i=!1),o||($("#form_register--errorterms").show("slow"),i=!1),e.find("input:enabled:visible").each((function(){let e=$(this),o=e.val().trim(),n=e.attr("name");"placa"!==n&&""==o&&($("#form_register--error"+n).show("slow"),t.fadeIn().css("display","flex"),e.css("background-color","#FFE1E1"),i=!1)})),i}(e,$(".cmp-formcart--errormsg"));if(!t)return $(".cmp-formcart--errormsg").focus(),{ok:!1};let{channel:i,ok:o}=Je();if(!o)return{ok:!1,data:""};if(t&&o){let t=function(e){let t={};return e.find("input:enabled:visible, select:enabled:visible, textarea:enabled:visible").each((function(){let e=$(this),i=e.attr("name"),o=e.val().trim();if("placa"!==i){if(e.is(":checkbox")&&!e.is(":checked"))return $("#form_register--error"+i).show("slow"),void(isValid=!1);t.authorization=$('input[name="authorization"]:checked').val(),t.sameperson=$('input[name="sameperson"]:checked').val(),t.type=$('input[name="type"]:checked').val(),i&&(t[i]=o)}})),t}(e);return t.channel=i.join(","),{ok:!0,data:t}}}async function Ze(){xe();try{let e=$("#cmp-formcart-services"),t=$(".cmp-formcart--Errormsg-secondstep");if(!function(e,t){let i=!0,o=e.find('select[name="inmueble"]').val();return e.find('[id^="form_register--error"]').hide("slow"),e.find("input").css("background-color","#FFFFFF"),e.find("input:enabled:visible, input:disabled:visible, select:enabled:visible").each((function(){let e=$(this),n=e.val().trim(),a=e.attr("name");if("interior"===a&&"Casa"===o)return!0;""===n&&($("#form_register--error"+a).show("slow"),t.fadeIn().css("display","flex"),e.css("background-color","#FFE1E1"),i=!1)})),i}(e,t))return t.focus(),{ok:!1};if("direccion"===be){let e=await async function(){if(!Fe(w.value))return $(".cmp-formcart--Errormsg-secondstep"),$(".cmp-formcart--Errormsg-secondstep").fadeIn("slow").css("display","flex"),$("#form_register--errordireccion").show("slow"),$("input[name='direccion']").css("background-color","#FFE1E1"),$(".cmp-formcart--Errormsg-secondstep").focus(),void(he=!1);let e=JSON.stringify({direccion:""!==R.value?w.value+"( INTERIOR "+R.value+" )":w.value,municipio:Ie.CodigoMunicipio,departamento:Ie.CodigoDepartamento,pais:"170",sistemaExterno:"E-Commerce",raiseHTTPErrors:!1});const t=await Re(e);if(0!==t.CodigoError&&""!==t.MensajeError)return $("#cmp-formcart--Errormsg-secondstep .cmp-formcart--Errormsg-text").text("Verifica tu información: No se logró validar la dirección, por favor intenta ingresando el número de contrato de tu factura de Servicios Públicos Domiciliarios."),$(".cmp-formcart--Errormsg-secondstep").css("display","flex").fadeIn("slow"),$("#form_register--errordireccion").show("slow"),$("input[name='direccion']").css("background-color","#FFE1E1"),$(".cmp-formcart--Errormsg-secondstep").focus(),he=!1,!1;if(t.ServiciosSuscritos.length<1)return $("#cmp-formcart--Errormsg-secondstep .cmp-formcart--Errormsg-text").text("La dirección que ingresaste no tiene servicios de energía, gas o aguas con EPM, recuerda que debes ingresar una dirección con servicios de EPM porque sobre esta dirección se cobrará la cotización de servicio una vez sea aceptada."),$(".cmp-formcart--Errormsg-secondstep").css("display","flex").fadeIn("slow"),$("#form_register--errordireccion").show("slow"),$("input[name='direccion']").css("background-color","#FFE1E1"),$(".cmp-formcart--Errormsg-secondstep").focus(),he=!1,!1;let i=t.ServiciosSuscritos[0].CodigoMunicipio,o=t.ServiciosSuscritos[0].CodigoDepartamento;return Ne=t.ServiciosSuscritos[0].Categoria,Me=t.ServiciosSuscritos[0].SubCategoria,i!==Number(Ie.CodigoMunicipio)||o!==Number(Ie.CodigoDepartamento)?($("#cmp-formcart--Errormsg-secondstep .cmp-formcart--Errormsg-text").text("La dirección no corresponde con el municipio de cobertura seleccionado."),$(".cmp-formcart--Errormsg-secondstep").fadeIn("slow").css("display","flex"),$("#form_register--errordireccion").show("slow"),$("input[name='direccion']").css("background-color","#FFE1E1"),$(".cmp-formcart--Errormsg-secondstep").focus(),he=!1,!1):(w.value=t.ServiciosSuscritos[0].DireccionCobro,D.value=t.ServiciosSuscritos[0].NombreDepartamento.normalize("NFD").replace(/[\u0300-\u036f]/g,""),q.value=t.ServiciosSuscritos[0].NombreMunicipio.normalize("NFD").replace(/[\u0300-\u036f]/g,""),t.ServiciosSuscritos.map((e=>{if(e.CodigoDepartamento!==Number(Ie.CodigoDepartamento)&&e.CodigoMunicipio!==Number(Ie.CodigoMunicipio))return $("#cmp-formcart--Errormsg-secondstep .cmp-formcart--Errormsg-text").text("La dirección no corresponde con el municipio de cobertura seleccionado."),$(".cmp-formcart--Errormsg-secondstep").fadeIn("slow").css("display","flex"),$("#form_register--errorcontrato").show("slow"),$("input[name='contrato']").css("background-color","#FFE1E1"),$(".cmp-formcart--Errormsg-secondstep").focus(),he=!1,!1})),he=!0,pe=t,!0)}();if(!e)return}if(!function(e,t="101,501,701"){let i=t.split(",").map(Number);return e.map((e=>i.includes(e.TipoProducto))).some((e=>e))}(pe.ServiciosSuscritos))return $("#cmp-formcart--Errormsg-secondstep .cmp-formcart--Errormsg-text").text("La dirección que ingresaste no tiene servicios de energía, gas o aguas con EPM, recuerda que debes ingresar una dirección con servicios de EPM porque sobre esta dirección se cobrará la cotización de servicio una vez sea aceptada."),$(".cmp-formcart--Errormsg-secondstep").css("display","flex").fadeIn("slow"),$("#form_register--errordireccion").show("slow"),$("input[name='direccion']").css("background-color","#FFE1E1"),void $(".cmp-formcart--Errormsg-secondstep").focus();let i=await async function(e){$(".cmp-formcart--Errormsg-secondstep").css("display","none"),$("#form_register--errordireccion").hide(),$("input[name='direccion']").css("background-color","#FFFFFF");try{if(e.length<1)return!1;let t="Hogar"===Ee?1:"Empresa"===Ee&&"1"===ce.value?2:3,i=e[0],o={Categoria:i.Categoria,Contrato:i.Contrato,Departamento:i.CodigoDepartamento,Localidad:i.CodigoMunicipio,NatuCLiente:t,TipoProducto:Number(291),cadenaDirec:i.DireccionCobro,DocIdentidad:"Empresa"===Ee?ce.value:L.value,ValCliente:"S",SistemaExterno:"E-commerce",RaiseHTTPErrors:!1};const n=await fetch("/bin/validarPoliticas",{method:"POST",headers:{"Content-Type":"text/plain","CSRF-Token":await Te()},body:JSON.stringify(o)});if(!n.ok||200!==n.status)return ke("En estos momentos no es posible atender tu solicitud. Te invitamos a comunicarte con la línea de atención al cliente (604) 44 44 800"),$(".cmp-formcart--Errormsg-secondstep").focus(),void setTimeout((()=>{$(".cmp-formcart--Errormsg-secondstep").css("display","none"),$("#form_register--errordireccion").hide(),$("input[name='direccion']").css("background-color","#FFFFFF")}),0);if(n.ok){const e=await n.json();return e.status?(ke("En estos momentos no es posible atender tu solicitud. Te invitamos a comunicarte con la línea de atención al cliente (604) 44 44 800"),$(".cmp-formcart--Errormsg-secondstep").focus(),void setTimeout((()=>{$(".cmp-formcart--Errormsg-secondstep").css("display","none"),$("#form_register--errordireccion").hide(),$("input[name='direccion']").css("background-color","#FFFFFF")}),0)):(0===e.CodigoError||""===e.MensajeError)&&""!==e.Instalacion}}catch(e){ke("En estos momentos no es posible atender tu solicitud. Te invitamos a comunicarte con la línea de atención al cliente (604) 44 44 800"),console.log("Error - VP001")}}(pe.ServiciosSuscritos);if(!i)return $("#cmp-formcart--Errormsg-secondstep .cmp-formcart--Errormsg-text").text("La dirección de la solicitud no cumple con las condiciones de comportamiento de pago para acceder al servicio. Para mayor información comunícate al (604) 4444800"),$(".cmp-formcart--Errormsg-secondstep").css("display","flex").fadeIn("slow"),$("#form_register--errordireccion").show("slow"),$("input[name='direccion']").css("background-color","#FFE1E1"),void $(".cmp-formcart--Errormsg-secondstep").focus();let o=function(e){let t={};return e.find("input:enabled:visible, input:disabled:visible, select:enabled:visible, textarea:enabled:visible").each((function(){let e=$(this),i=e.attr("name"),o=e.val().trim();t.address=$('input[name="address"]:checked').val(),t.typearea=$('input[name="typearea"]:checked').val(),i&&(t[i]=o)})),t}(e);return t.hide("slow"),{ok:!0,data:o}}catch(e){return console.log("Error - GFDS001"),Be(),{ok:!1}}finally{Be()}}a.style.display="none",function(){let e=JSON.parse(localStorage.getItem(ae));null!=e&&function(e){document.querySelector("#itemscart-container");var t=document.querySelectorAll(".btn-micarrito"),i=document.querySelector("#epmatupuerta-location");t.forEach((t=>{var o=t.querySelector(".itemsCountCart");if(0===e&&o)return t.removeChild(o),localStorage.removeItem("Cobertura"),localStorage.removeItem("ServicioID"),void(i.innerHTML="");o?o.textContent=e:e>0&&((o=document.createElement("div")).setAttribute("class","itemsCountCart"),o.textContent=e,t.appendChild(o))}))}(e.length)}(),Ke(),X&&X.querySelector(".cmp-greendisclaimer")&&(X.querySelector(".cmp-greendisclaimer").style.display="none"),oe.addEventListener("keydown",(e=>
1{if(["e","E","-"].includes(e.key))return e.preventDefault()})),ne.addEventListener("change",(e=>{if(L.value="",!Le[e.target.value])return ie.style.display="block",document.getElementById("form_register--inputExpeditiondate").defaultValue="",void(fe=!0);ie.style.display="none",document.getElementById("form_register--inputExpeditiondate").defaultValue=Ke(),fe=!1})),c.addEventListener("click",(e=>{if("radio"==e.target.type){let t=e.target.value;"Hogar"==t&&(Ee="Hogar",Ve(),document.getElementById("type--hogar").checked=!0,E.classList.add("ocultar"),C.classList.add("ocultar"),ee.classList.add("hide"),re.classList.add("hide"),se.classList.add("hide"),de.classList.add("hide"),ie.style.display="block",oe.classList.remove("hide"),u.classList.add("hide")),"Empresa"==t&&(Ee="Empresa",Ve(),document.getElementById("type--empresa").checked=!0,E.classList.remove("ocultar"),C.classList.remove("ocultar"),ee.classList.remove("hide"),de.classList.remove("hide"),re.classList.remove("hide"),se.classList.remove("hide"),u.classList.add("hide"),ie.style.display="block")}})),S.addEventListener("click",(e=>{if("radio"==e.target.type){let t=e.target.value;if("no, es una persona diferente"==t)return A.classList.remove("ocultar"),void(Ae="no, es una persona diferente");if("si es la misma persona"==t)return $(".distinctperson").find("input").each((function(){let e=$(this).attr("name");$(this).val(""),$("#form_register--error"+e).hide("slow"),$("input[name='"+e+"']").css("background-color","#FFFFFF")})),Ae="si es la misma persona",A.classList.add("ocultar"),document.getElementsByName("namedistinctperson")[0].value="",document.getElementsByName("lastnamedistinctperson")[0].value="",document.getElementsByName("emaildistinctperson")[0].value="",void(document.getElementsByName("cellphonedistinctperson")[0].value="")}})),s.addEventListener("click",(e=>{if("radio"===e.target.type){let t=e.target.value;if("no autorizo"==t)return Se="no autorizo",void u.classList.remove("hide");"si autorizo"==t&&(u.classList.add("hide"),Array.from(l).forEach((e=>e.checked=!0)),we=[],document.getElementById("errorchannelsMessage").style.display="none",Se="")}})),u.addEventListener("click",(e=>{if("checkbox"==e.target.type){let t=e.target.value,i=we.indexOf(t);if(-1!==i)return we.splice(i,1),void Je();we.push(t),Je()}})),m.addEventListener("click",(e=>{if("radio"==e.target.type){let t=e.target.value;document.querySelector(".cmp-formcart--observations"),"contrato"==t&&(be="contrato",b.classList.remove("hide"),v.value="",w.value="",g.style.display="none",P.classList.add("disabled"),P.setAttribute("disabled","disabled"),De()),"direccion"==t&&(be="direccion",b.classList.add("hide"),y.value="",N.style.display="block",O.classList.remove("hide"),T.classList.remove("hide"),M.classList.remove("ocultar"),w.disabled=!1,g.style.display="flex",P.classList.remove("disabled"),P.removeAttribute("disabled"),De())}})),B.forEach((e=>{e.addEventListener("click",(e=>{if(!e.target.closest("a")||"epmatp-checkout-mis-pedidos"!==e.target.closest("a").id)return null!==e.target.parentElement.closest("#modal
1-checkout-successfully")?(Oe(),void $("div#modal-satisfaccion").closest(".modal-layer").addClass("open")):void(e.target.classList.contains("close")&&Oe());Oe()}))})),W.addEventListener("click",(e=>{e.preventDefault(),Oe()})),V.addEventListener("click",(async e=>{e.preventDefault(),J.querySelector(".modal-layer").classList.remove("open");let t=await tt(ge);null===t.data.createOrderEPMatp?(G.innerHTML=`Hola ${""+te.value} No fue posible procesar tu solicitud. Por favor intenta nuevamente`,J.querySelector(".modal-layer").classList.add("open")):(Xe(t.data.createOrderEPMatp.data),$("div#modal-checkout-successfully").closest(".modal-layer").addClass("open"))})),f.addEventListener("click",(async e=>{xe(),$("#form_register--errorcontrato").hide("slow"),$("input[name='contrato']").css("background-color","#FFFFFF"),$(".cmp-formcart--Errormsg-secondstep").fadeOut("slow"),$(".cmp-formcart--Errormsg-secondstep").css("display","none"),$("#form_register--errordireccion").hide(),$("input[name='direccion']").css("background-color","#FFFFFF"),P.classList.add("disabled"),P.setAttribute("disabled","disabled");try{if(!He(Number(y.value)))return $(".cmp-formcart--Errormsg-secondstep").fadeIn("slow").css("display","flex"),$(".cmp-formcart--Errormsg-secondstep").focus(),$("#form_register--errorcontrato").show("slow"),$("input[name='contrato']").css("background-color","#FFE1E1"),void(he=!1);let e=JSON.stringify({Contrato:Number(y.value)});const t=await Re(e);if(0!==t.CodigoError&&""!==t.MensajeError)return $("#cmp-formcart--Errormsg-secondstep .cmp-formcart--Errormsg-text").text("Te invitamos a llamar a nuestra línea de atención 604 4444800, debido a que no es posible reconocer la información ingresada."),$(".cmp-formcart--Errormsg-secondstep").fadeIn("slow").css("display","flex"),$("#form_register--errorcontrato").show("slow"),$("input[name='contrato']").css("background-color","#FFE1E1"),$(".cmp-formcart--Errormsg-secondstep").focus(),void(he=!1);t.ServiciosSuscritos[0].NombreMunicipio,t.ServiciosSuscritos[0].NombreDepartamento;let i=t.ServiciosSuscritos[0].CodigoDepartamento,o=t.ServiciosSuscritos[0].CodigoMunicipio;if(Ne=t.ServiciosSuscritos[0].Categoria,Me=t.ServiciosSuscritos[0].SubCategoria,o!==Number(Ie.CodigoMunicipio)||i!==Number(Ie.CodigoDepartamento))return $("#cmp-formcart--Errormsg-secondstep .cmp-formcart--Errormsg-text").text("El número de contrato no corresponde con el municipio de cobertura seleccionado."),$(".cmp-formcart--Errormsg-secondstep").fadeIn("slow").css("display","flex"),$("#form_register--errorcontrato").show("slow"),$("input[name='contrato']").css("background-color","#FFE1E1"),$(".cmp-formcart--Errormsg-secondstep").focus(),void(he=!1);N.style.display="none",O.classList.add("hide"),T.classList.add("hide"),M.classList.add("ocultar"),w.disabled=!0,g.style.display="flex",w.value=t.ServiciosSuscritos[0].DireccionCobro,D.value=t.ServiciosSuscritos[0].NombreDepartamento.normalize("NFD").replace(/[\u0300-\u036f]/g,""),q.value=t.ServiciosSuscritos[0].NombreMunicipio.normalize("NFD").replace(/[\u0300-\u036f]/g,""),t.ServiciosSuscritos.map((e=>{if(e.CodigoDepartamento!==Number(Ie.CodigoMunicipio)&&e.CodigoDepartamento!==Number(Ie.CodigoDepartamento))return $(".cmp-formcart--Errormsg-secondstep").fadeIn("slow").css("display","flex"),$("#form_register--errorcontrato").show("slow"),$("input[name='contrato']").css("background-color","#FFE1E1"),void $(".cmp-formcart--Errormsg-secondstep").focus()})),pe=t,t.ServiciosSuscritos.filter((e=>Ce.includes(e.TipoProducto))),P.classList.remove("disabled"),P.removeAttribute("disabled"),he=!0}catch(e){console.log("Error - VE001")}finally{Be()}})),h.addEventListener("click",(e=>{document.querySelector(".cmp-formcart--recibo").classList.toggle("hide")})),document.querySelector(".cmp-formcart--container").parentElement.parentElement.parentElement.style.padding="0",qe=document.createElement("div"),document.body.appendChild(qe),qe.setAttribute("id","messages-for-docs"),qe.setAttribute("class","hide"),qe.innerHTML="<div id='modal-body-files' style='position:absolute;width:387px;background:#fff;border-radius:30px;top:20%;left:50%;transform: translate(-50%, 0);padding:15px'>\n\t\t\t\t<div class='container-message'>\n\t\t\t\t\t\t<div class='button-close' style='text-align:right;'>\n\t\t\t\t\t\t\t<span id='delete-file' style='cursor:pointer'>\n\t\t\t\t\t\t\t\t<img src='/content/dam/epm/ecommerce/close_icon.png' style='cursor:pointer' />\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class='message-body'style='text-align:center;'>\n\t\t\t\t\t\t\t<img style=\"width:50px; height:50px\" src='/content/dam/epm/ecommerce/bell-notification.png' /><br/>\n\t\t\t\t\t\t\t<h3 style='font-size:28px;margin:0;font-weight:86;line-height:37.2px'>Información importante</h3><br/>\n\t\t\t\t\t\t\t<p style='font-size:16px;' id='cart-message'></p><br/>\n\t\t\t\t\t\t\t<button type='button' id='btn-for-close' style='padding:0.5rem; border-radius:20px;color:#fff;font-size:18px;font-weight:148;background:#36A21D;border:#36A21D;width:120px'>Aceptar</button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>",$("#messages-for-docs").css({position:"fixed",background:"rgba(204, 204, 204, 0.5)",inset:"0","z-index":"9000"}),$("#btn-for-close").on("click",(function(){$("#messages-for-docs").addClass("hide")})),$("#delete-file img").on("click",(function(){$("#messages-for-docs").addClass("hide")})),Pe=document.createElement("div"),document.body.appendChild(Pe),Pe.setAttribute("id","loader-div"),Pe.setAttribute("class","hide"),Pe.innerHTML="<div id='loader-div-body' style='position:absolute;width:387px;top:20%;left:50%;transform: translate(-50%, 0);padding:15px'><div class='container-loader'><div class='loader-body'style='text-align:center;'><img src='/content/dam/epm/ecommerce/loader3.gif' alt='Cargando...' style='max-width:30%;' /></div></div></div>",$("#loader-div").css({position:"fixed",background:"rgb(255 255 255 / 0.8)",inset:"0","z-index":"10000"});const Qe={email:_e,emailconfirmation:function(e){const t=$("input[name='email']").val();return _e(e)&&e===t},name:Ue,lastname:Ue,numeroidentificacion:function(e){if("919900002"===ne.value){if(""==e.trim())return!1;let t=/^[a-zA-Z0-9]+$/;return!/ñ|Ñ/.test(e)&&t.test(e)}return""!=e.trim()&&(7===e.length||8===e.length||10===e.length)&&/^[0-9]+$/.test(e)},datexpedition:function(e){return""!=e.trim()&&e},cellphone:$e,emailEmpresa:_e,razonsocial:function(e){return""!=e.trim()&&/^[0-9a-zA-ZñÑáéíóúÁÉÍÓÚäëïöüÄËÏÖÜ.&$[\]*'°º#+-/\()– ]*$/.test(e)},numeroidentificacionEmpresa:function(e){return""!=e.trim()&&("8"===e.charAt(0)||"9"===e.charAt(0))&&/^\d{9}$/.test(e)},fixedphone:function(e){return""!=e.trim()&&!(e.length<7||e.length>7)&&/^[0-9]+$/.test(e)},namedistinctperson:Ue,lastnamedistinctperson:Ue,cellphonedistinctperson:$e,emaildistinctperson:_e,relacioninmueble:function(e){return""!==e},inmueble:function(e){return""!==e}},Ye={direccion:Fe,interior:function(e){return""!=e.trim()&&!(e.length<2)},contrato:He};async function We(e){xe();try{let{ok:i,data:o}=ze();if(!i||void 0===i)return void Be();const n=await je();if(null==n)return void ke("Ha ocurrido un error generando el token");if(fe){var t={Identificacion:`${o.numeroidentificacion}`,nombres:`${o.name}`,apellidos:`${o.lastname}`,fechaExpedicion:`${o.datexpedition}`,token:`${n}`};const e=await async function(e,t){var i={"Content-Type":"application/json","x-api-key":e};try{const e=await fetch("/bin/registraduria",{method:"POST",headers:i,body:JSON.stringify(t)});if(e.ok)return await e.json();ke("En estos momentos no es posible atender tu solicitud. Te invitamos a comunicarte con la línea de atención al cliente (604) 44 44 800")}catch(e){ke("En estos momentos no es posible atender tu solicitud. Te invitamos a comunicarte con la línea de atención al cliente (604) 44 44 800")}}(n,t);if(!e.valida)return Be(),void ke("Los datos de identificación ingresados son incorrectos, por favor verifícalos e intenta nuevamente. En caso de que la información sea correcta, te invitamos a comunicarte con la línea de atención al cliente (604) 44 44 800")}const a=await async function(){try{const e="\n\t\t\t\tmutation {\n\t\t\t\t\tcreateEmptyCart\n\t\t\t\t  }\n\t\t\t\t",t=await fetch("/bin/crearIdCart",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({query:e})}),{data:i}=await t.json();return i.createEmptyCart}catch(e){console.log("Error: EC-001")}}();if(!a)return Be(),void ke("Ha ocurrido un error guardando los items del carrito");ge=a;const r=await async function(e,t,i,o){le=JSON.parse(localStorage.getItem(o)),ue=i;const n=et(le);if(1==e){dataInfo=`{\n              "paso":${+e},\n\t\t\t\t\t\t\t"cart_id":"${t}",\n\t\t\t\t\t\t\t"cart_items":[${n}],\n\t\t\t\t\t\t\t"apellidos_persona_atencion":"${i.lastnamedistinctperson?i.lastnamedistinctperson:""}",\n\t\t\t\t\t\t\t"autorizacion":"${i.authorization}",\n\t\t\t\t\t\t\t"canales_disponibles":"${i.channel?i.channel:""}",\n\t\t\t\t\t\t\t"correo_persona_atencion":"${i.emaildistinctperson?i.emaildistinctperson:""}",\n\t\t\t\t\t\t\t"nombres_persona_atencion":"${i.namedistinctperson?i.namedistinctperson:""}",\n\t\t\t\t\t\t\t"persona_atencion":"${i.sameperson?i.sameperson:""}",\n\t\t\t\t\t\t\t"telefono_celular_persona_atencion":"${i.cellphonedistinctperson?i.cellphonedistinctperson:""}",\n\t\t\t\t\t\t\t"tipo": "${i.type}",\n      \t\t\t\t"apellidos": "${i.lastname}",\n      \t\t\t\t"correo_empresa": "${i.emailEmpresa?i.emailEmpresa:""}",\n      \t\t\t\t"correo": "${i.email}",\n      \t\t\t\t"fecha_expedicion": "${i.datexpedition?i.datexpedition:""}",\n      \t\t\t\t"indicativo_telefono_fijo": "${i.codephone?i.codephone:""}",\n      \t\t\t\t"nombres": "${i.name}",\n      \t\t\t\t"numero_identificacion_empresa": "${i.numeroidentificacionEmpresa?i.numeroidentificacionEmpresa:""}",\n      \t\t\t\t"numero_identificacion": "${i.numeroidentificacion}",\n      \t\t\t\t"razon_social": "${i.razonsocial?i.razonsocial:""}",\n      \t\t\t\t"telefono_celular": "${i.cellphone}",\n      \t\t\t\t"telefono_fijo": "${i.fixedphone?i.fixedphone:""}",\n      \t\t\t\t"tipo_identificacion_empresa": "${i.typeidentificationEmpresa?i.typeidentificationEmpresa:""}",\n      \t\t\t\t"tipo_identificacion": "${i.typeidentification}",\n              \t\t"placa":"${p.value.trim().length?p.value:"N/A"}",\n\t\t\t\t\t"departamento": "${JSON.parse(localStorage.getItem("Cobertura")).NombreDepartamento}",\n\t\t\t\t\t"codigo_departamento": "${JSON.parse(localStorage.getItem("Cobertura")).CodigoDepartamento}",\n\t\t\t\t\t"municipio":"${JSON.parse(localStorage.getItem("Cobertura")).NombreMunicipio}",\n\t\t\t\t\t"codigo_municipio":"${JSON.parse(localStorage.getItem("Cobertura")).CodigoMunicipio}"\n        \t\t\t}\n\t\t\t\t`;let o="/bin/api/identificacion";const a=await fetch(o,{method:"POST",headers:{"content-type":"application/json"},body:dataInfo}),r=await a.json();return r.status||r.errors?(ke("En estos momentos no es posible atender tu solicitud. Te invitamos a comunicarte con la línea de atención al cliente (604) 44 44 800"),null):r}}(e,a,o,ae);if(null===r)return;
1ue=o,q.value=Ie.NombreMunicipio.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toUpperCase(),D.value=Ie.NombreDepartamento.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toUpperCase(),z.querySelector("h2").innerHTML=o.email,j.querySelector(".modal-layer").classList.add("open");const s={numeroIdentificacion:L.value,tipoIdentificacion:ne.value,unidadNegocio:"92"};localStorage.setItem("consultapedido",JSON.stringify(s))}catch(e){console.log(e)}finally{Be()}}function Xe(e){let t=document.querySelector("#container-mis-pedidos");t.innerHTML="",e.map((e=>{let i=function(e){let t=e.equipo?`<p class="card-pedido--equipo">${e.equipo}${e.marca?" - "+e.marca:""}</p>`:e.marca?`<p class="card-pedido--equipo">${e.marca}</p>`:"";return`\n          <div class="card-pedido">\n            <h5 class="card-pedido--title">${e.tipo}</h5>\n            ${t}\n            <div class="card-pedido--detalle">\n              <h6 class="card-pedido--fecha">${e.fecha}</h6>\n              <h5 class="card-pedido--numero">${e.numero_pedido}</h5>\n            </div>\n          </div>\n        `}(e);t.innerHTML+=i}))}function Ke(){let e=new Date,t=e.getDate(),i=e.getMonth()+1;i<10&&(i="0"+i),t<10&&(t="0"+t);const o=`${e.getFullYear()}-${i}-${t}`;return document.getElementById("form_register--inputExpeditiondate").setAttribute("max",o),o}function et(e){return e.map(((t,i)=>{let o=t.diaVisita||(new Date).toISOString().split("T")[0];return t.jornada,`\n\t\t\t\t\t{\n\t\t\t\t\t\t\t\t"id":${t.id},\n\t\t\t\t\t\t\t\t"sku":"${t.sku}",\n\t\t\t\t\t\t\t\t"quantity":1,\n\t\t\t\t\t\t\t\t"dia_visita":"${o}",\n\t\t\t\t\t\t\t\t"jornada":"${t.jornada}",\n\t\t\t\t\t\t\t\t"equipo":"${t.tipo_electrodomestico?t.tipo_electrodomestico:""}",\n\t\t\t\t\t\t\t\t"marca":"${t.marca?t.marca:""}",\n\t\t\t\t\t\t\t\t"lugar_reparacion":"${t.lugar_fuga?t.lugar_fuga:""}",\n\t\t\t\t\t\t\t\t"antiguedad_equipo":"${t.selectedAntiguedad?t.selectedAntiguedad:""}",\n\t\t\t\t\t\t\t\t"servicio":"${t.servicio?t.servicio:""}",\n\t\t\t\t\t\t\t\t"servicio_id":"${t.servicioIdDisponible?t.servicioIdDisponible:"No_disponible"}",\n\t\t\t\t\t\t\t\t"fecha_inicial":"${t.fecha_inicial}",\n\t\t\t\t\t\t\t\t"fecha_final":"${t.fecha_final}",\n\t\t\t\t\t\t\t\t"tecnico_id":"${t.recursoIdDisponible?t.recursoIdDisponible:"No_disponible"}",\n                \t\t\t\t"piso":"${t.piso?t.piso:"No_disponible"}"\n\t\t\t\t\t} ${i<e.length-1?",":""}\n\t\t\t\t\t`})).join("")}async function tt(e){xe();try{dataInfo=`\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t"paso":4,\n\t\t\t\t\t\t\t"cart_id":"${e}",\n\t\t\t\t\t\t\t"medios_publicidad":"web",\n\t\t\t\t\t\t\t"reenviar":"false"\n\t\t\t\t\t}`;const t=await fetch("/bin/api/finalizar-pedido",{method:"POST",headers:{"content-type":"application/json"},body:dataInfo});return await t.json()}catch(e){console.log(e)}finally{Be()}}function it(e,t="Por favor valida que hayas brindado la información requerida para tu compra, para poder continuar.",i="beforebegin"){const o=document.getElementById(e).parentElement.querySelector(".parent-errormsg");if(o)o.querySelector(".errormsg-text").textContent=t,$(".parent-errormsg").show(),clearTimeout(d);else{let o=`\n\t\t\t\t  <div class="parent-errormsg" style="background-color:#fff;padding:1rem">\n\t\t\t\t  <div class="errormsg" style="display:flex;align-items:center;gap:1rem;border-radius:1rem;padding:0.5rem;background-color:#FFE1E1">\n\t\t\t\t\t<img src="/content/dam/epm/ecommerce/info-error-icon.png" alt="icono-info-error">\n\t\t\t\t\t<p style="color:red;margin:0" class="errormsg-text">${t}</p>\n\t\t\t\t  </div>\n\t\t\t\t  </div>\n\t\t\t\t  `;document.getElementById(e).insertAdjacentHTML(i,o),document.getElementById(e).focus()}d=setTimeout((()=>{$(".parent-errormsg").hide()}),1e4)}async function ot(e,t,i="false"){try{const o=await fetch("/bin/api/seguridad-otp",{method:"POST",headers:{"Content-type":"application/json"},body:JSON.stringify({paso:2,cart_id:e,codigo_seguridad:Number(t),reenviar:i})});return o.ok?await o.json():void ke("En estos momentos no es posible atender tu solicitud. Te invitamos a comunicarte con la línea de atención al cliente (604) 44 44 800")}catch(e){console.log(e)}}function nt(e){localStorage.removeItem(e)}function at(e,t){let i=JSON.parse(localStorage.getItem(e));return null===i?(ke(`${t}`),null):i}$(document).on("blur change","input:visible, select:visible",(function(){let e=$(this).attr("name");"placa"!==e&&Qe[e]&&(Qe[e]($(this).val())?($(".cmp-formcart--errormsg").fadeOut("slow"),$("#form_register--error"+e).hide("slow"),$("[name='"+e+"']").css("background-color","#FFFFFF")):($(".cmp-formcart--errormsg").fadeIn("slow").css("display","flex"),$(".cmp-formcart--errormsg").focus(),$("#form_register--error"+e).show("slow"),$("input[name='"+e+"']").css("background-color","#FFE1E1"),K=!0))})),$(document).ready((function(){$("#cmp-formcart-services").on("blur","input:visible",(function(){let e=$(this).attr("name"),t=$("select[name='inmueble']").val();if("interior"==e&&"Casa"==t)return $("#form_register--error"+e).hide("slow"),void $("input[name='"+e+"']").css("background-color","#FFFFFF");Ye[e]&&(Ye[e]($(this).val())?($(".cmp-formcart--Errormsg-secondstep").fadeOut("slow"),$("#form_register--error"+e).hide("slow"),$("input[name='"+e+"']").css("background-color","#FFFFFF")):($(".cmp-formcart--Errormsg-secondstep").fadeIn("slow").css("display","flex"),$("#form_register--error"+e).show("slow"),$("input[name='"+e+"']").css("background-color","#FFE1E1"),$(".cmp-formcart--Errormsg-secondstep").focus(),K=!0))}))})),$("#form_register--inputinmueble").on("change",(function(){"Casa"===$(this).val()?($(".cmp-formcart--labelinterior .cmp-formcart--required").css("color","transparent"),$("#form_register--errorinterior").hide("slow"),$("#form_register--inputinterior").css("background","#FFFFFF"),$("#form_register--inputinterior").val("")):$(".cmp-formcart--labelinterior .cmp-formcart--required").css("color","red")})),_.addEventListener("click",(e=>{let t=["cmp-icontextv2__item","cmp-icontextv2__image","img-icontextv2","cmp-icontextv2__text"];Array.from(e.target.classList).some((e=>t.includes(e)))&&(document.querySelectorAll(".cmp-icontextv2__item").forEach((e=>{e.classList.remove("selected")})),e.target.closest(".cmp-icontextv2__item").classList.add("selected"),ye=e.target.closest(".cmp-icontextv2__item").querySelector(".cmp-icontextv2__text").textContent.trim())})),U.addEventListener("click",(async e=>{e.preventDefault();let t=F.value;if(""===ye)return void it("image-modal-satisfaccion","Por favor escoje una opción de satisfacción");let i={satisfaccion:ye,message:t};xe();try{"1"===(await async function(e,t){const i=await fetch("/bin/api/encuesta-satisfaccion",{method:"POST",headers:{"Content-type":"application/json"},body:JSON.stringify({paso:5,cart_id:e,satisfaccion:t.satisfaccion,mejoras:t.message,flujo:"checkout",numero_pedido_crm:""})});return await i.json()}(ge,i)).data.createOrderEPMatp.status&&(window.location.href="/epmatupuerta.html")}catch(e){console.log(e)}finally{Be()}})),document.querySelector(".itemscart__cta--emptycart").remove(),n.addEventListener("submit",(async e=>{e.preventDefault();let t=at(ae,"No hay items en el carrito de compras");null!==at("Cobertura","Los servicios del carrito no tienen seleccionado un departamento y/o ciudad")&&null!==t&&(await je(),await We(1))})),r.addEventListener("submit",(async e=>{e.preventDefault();let{ok:t,data:i}=await Ze();if(!t&&""===I.value)return;if(!t&&"contrato"===be)return void ke("Por favor ingresa el número de tu contrato EPM y da click en la lupa.");if(!t)return;let o=await async function(e,t,i){xe();try{et(JSON.parse(localStorage.getItem(i))),dataInfo=`\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t"paso":3,\n\t\t\t\t\t\t\t\t"cart_id":"${e}",\n\t\t\t\t\t\t\t\t"tipo_contrato": "${t.address}",\n\t\t\t\t\t\t\t\t"direccion": "${t.direccion}",\n\t\t\t\t\t\t\t\t"tipo_area": "${t.typearea}",\n\t\t\t\t\t\t\t\t"departamento": "${t.departamento}",\n\t\t\t\t\t\t\t\t"codigo_departamento":"${Ie.CodigoDepartamento}",\n\t\t\t\t\t\t\t\t"municipio": "${t.municipio}",\n\t\t\t\t\t\t\t\t"codigo_municipio":"${Ie.CodigoMunicipio}",\n\t\t\t\t\t\t\t\t"tipo_inmueble": "${t.inmueble}",\n\t\t\t\t\t\t\t\t"interior": "${t.interior}",\n\t\t\t\t\t\t\t\t"numero_contrato": "${t.contrato?t.contrato:""}",\n\t\t\t\t\t\t\t\t"relacion_inmueble":"${t.relacioninmueble}",\n\t\t\t\t\t\t\t\t"tipo_uso":"${Ne}",\n\t\t\t\t\t\t\t\t"estrato":"${Me}",\n\t\t\t\t\t\t\t\t"servicio_open": "true",\n\t\t\t\t\t\t\t\t"observaciones": "${t.message}"\n\t\t\t\t\t}`;const o=await fetch("/bin/api/validar-contrato",{method:"POST",headers:{"content-type":"application/json"},body:dataInfo});return await o.json()}catch(e){console.log(e)}finally{Be()}}(ge,i,ae);me=i;const n=o.data.createOrderEPMatp?.status;void 0!==n?"OK"===o.data.createOrderEPMatp.status&&(a.style.display="none",ve=!0,X&&X.querySelector(".cmp-greendisclaimer")&&(X.querySelector(".cmp-greendisclaimer").style.display="flex"),document.querySelector(".container-buy-service").classList.remove("disabled"),Ge(".itemcart_details-title")):ke("En estos momentos no es posible atender tu solicitud. Te invitamos a comunicarte con la línea de atención al cliente (604) 44 44 800")})),H.addEventListener("click",(async e=>{e.preventDefault(),xe();try{let e=Z.value;"1"===(await ot(ge,e)).data.createOrderEPMatp.status?(o.style.display="none",document.querySelector(".cmp-formcart.services").style.display="block",a.style.display="block",Ge("#cmp-formcart-services"),function(e,t){let i=document.querySelector(e),o=document.getElementById(t);i.style.display="none",o.style.display="block"}(".cmp-formcart-stepone-number","cmp-formcart-stepone-ok_icon"),j.querySelector(".modal-layer").classList.remove("open")):it("container-mensaje-error","Por favor valida nuevamente el código de verificación, pues el que ingresaste es incorrecto, cópialo y pégalo de nuevo o actualízalo, dando clic en Reenviar código","afterbegin")}catch(e){console.log("Error: FS-0012")}finally{Be()}})),Q.addEventListener("click",(async e=>{e.preventDefault(),xe();try{let e=Z.value;"1"===(await ot(ge,e,"true")).data.createOrderEPMatp.status?function(e,t,i="afterbegin"){let o=`\n\t\t\t\t\t\t\t\t<div class="parent-errormsg" style="background-color:#fff;padding:1rem">\n\t\t\t\t\t\t\t\t<div class="errormsg" style="display:flex;align-items:center;gap:1rem;border-radius:1rem;padding:0.5rem;background-color:#CBE9D5">\n\t\t\t\t\t\t\t\t\t<img src="/content/dam/epm/ecommerce/icon-information-green.svg" alt="icono-info-error">\n\t\t\t\t\t\t\t\t\t<p style="color:green;margin:0" class="errormsg-text">${t}</p>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t`;document.getElementById(e).insertAdjacentHTML("afterbegin",o),setTimeout((()=>{$(".parent-errormsg").fadeOut("slow")}),1e4)}("container-mensaje-error","Su codigo ha sido reenviado!"):it("container-mensaje-error","Por favor valida nuevamente el código de verificación, pues el que ingresaste es incorrecto, cópialo y pégalo de nuevo o actualízalo, dando clic en Reenviar código","afterbegin")}catch(e){console.log(e)}finally{Be()}})),Y.addEventListener("click",(e=>{e.preventDefault(),o.style.display="block",Ge("#cmp-formcart--identification"),r.style.display="none",Z.value=""})),k.addEventListener("click",(async e=>{if(e.preventDefault(),!ve)return;let t=await tt(ge);if(null===t.data.createOrderEPMatp)G.innerHTML=`Hola ${""+te.value} No fue posible procesar tu solicitud. Por favor intenta nuevamente`,J.querySelector(".modal-layer").classList.add("open");else{Xe(t.data.createOrderEPMatp.data),document.querySelector(".container-buy-service").classList.add("disabled"),ve=!1;
1let e=document.querySelector("#modal-checkout-succesfully-texto p").innerText.replace("{usuario}",te.value);document.querySelector("#modal-checkout-succesfully-texto p").innerText=e,$("div#modal-checkout-successfully").closest(".modal-layer").addClass("open"),nt(ae),nt("Cobertura"),null!==localStorage.getItem("idCart")&&localStorage.removeItem("idCart")}})),x.addEventListener("click",(e=>{e.preventDefault(),$("div#modal-checkout-successfully").closest(".modal-layer").removeClass("open"),$("div#modal-satisfaccion").closest(".modal-layer").addClass("open")})),function(){let e=JSON.parse(localStorage.getItem("itemsEPM")).some((e=>"Asistencia"===e.servicio)),t=document.querySelector(".cmp-formcart--firststep .cmp-formcart--placa");t.style.display=e?"block":"none"}()}))}))},11:function(){!function(){function e(){var e=document.createElement("div");document.body.appendChild(e),e.setAttribute("id","messages-for-docs"),e.setAttribute("class","hide"),e.innerHTML="<div id='modal-body-files' style='position:absolute;width:387px;background:#fff;border-radius:30px;top:20%;left:50%;transform: translate(-50%, 0);padding:15px'>\n          <div class='container-message'>\n              <div class='button-close' style='text-align:right;'>\n                <span id='delete-file' style='cursor:pointer'>\n                  <img src='/content/dam/epm/ecommerce/close_icon.png' style='cursor:pointer' />\n                </span>\n              </div>\n              <div class='message-body'style='text-align:center;'>\n                <img style=\"width:50px; height:50px\" src='/content/dam/epm/ecommerce/bell-notification.png' /><br/>\n                <h3 style='font-size:28px;margin:0;font-weight:86;line-height:37.2px'>Información importante</h3><br/>\n                <p style='font-size:16px;' id='cart-message'></p><br/>\n                <button type='button' id='btn-for-close' style='padding:0.5rem; cursor: pointer; border-radius:20px;color:#fff;font-size:18px;font-weight:148;background:#36A21D;border:#36A21D;width:120px'>Aceptar</button>\n              </div>\n            </div>\n          </div>",$("#messages-for-docs").css({position:"fixed",background:"rgba(204, 204, 204, 0.5)",inset:"0","z-index":"10000"}),$("#btn-for-close").on("click",(function(){$("#messages-for-docs").addClass("hide")})),$("#delete-file img").on("click",(function(){$("#messages-for-docs").addClass("hide")}))}
1function t(e){$("#cart-message").text(e),$("#messages-for-docs").removeClass("hide")}window.addEventListener("load",(i=>{const o=new URLSearchParams(window.location.search).get("idcart");o&&(!function(){if(null!==document.getElementById("loader-div"))return;let e=document.createElement("div");e.setAttribute("id","loader-div"),e.setAttribute("class","hide"),e.innerHTML="<div id='loader-div-body' style='position:absolute;width:387px;top:20%;left:50%;transform: translate(-50%, 0);padding:15px'><div class='container-loader'><div class='loader-body'style='text-align:center;'><img src='/content/dam/epm/ecommerce/loader3.gif' alt='Cargando...' style='max-width:30%;' /></div></div></div>",$("#loader-div").css({position:"fixed",background:"rgba(255, 255, 255, 0.8)",inset:"0","z-index":"10000"}),document.body.appendChild(e)}(),$("#loader-div").removeClass("hide"),async function(i){const o={method:"GET",headers:{"Content-Type":"application/json"}};try{const n=await fetch(`/bin/consultarCarrito?cart_id=${i}`,o);if(!n.ok)return e(),void t("En estos momentos no es posible atender tu solicitud. Te invitamos a comunicarte con la línea de atención al cliente (604) 44 44 800`");return await n.json()}catch(e){return void console.error("Error en getData:",e)}}(o).then((i=>{!function(i,o){if(!i.listProducts.length)return e(),t("Lo sentimos, no se encontraron productos asociado a tu carrito. Te invitamos a comunicarte con la línea de atención al cliente (604) 44 44 800`");const n=i.listProducts.map((e=>({...e,uid:Math.random().toString(36).substring(2,13),image:e.img_lugar_fuga||e.img_tipo_electro||e.image}))),a=i.municipio.charAt(0).toUpperCase()+i.municipio.slice(1).toLowerCase(),r={NombreDepartamento:i.departamento.charAt(0).toUpperCase()+i.departamento.slice(1).toLowerCase(),CodigoDepartamento:i.codigo_departamento,NombreMunicipio:a,CodigoMunicipio:i.codigo_municipio};localStorage.setItem("itemsEPM",JSON.stringify(n)),localStorage.setItem("idCart",o),localStorage.setItem("Cobertura",JSON.stringify(r))}(i.data.CartList,o),setTimeout((()=>{!function(e){document.querySelector("#itemscart-container");var t=document.querySelector("#btn-micarrito"),i=t.querySelector(".itemsCountCart"),o=document.querySelector("#epmatupuerta-location");if(0===e&&i)return t.removeChild(i),localStorage.removeItem("Cobertura"),localStorage.removeItem("ServicioID"),void(o.innerHTML="");if(i)return void(i.textContent=e);e>0&&((i=document.createElement("div")).setAttribute("class","itemsCountCart"),i.textContent=e,t.appendChild(i))}(JSON.parse(localStorage.getItem("itemsEPM"))||[])}),200),$("#loader-div").addClass("hide")})).catch((e=>{console.log(e)})))}))}()},566:function(){!function(){"use strict";window.addEventListener("load",(function(){try{const e=document.getElementById("identificatorData");if(!e)return;console.log("✅ identificator component init");const t=e.getAttribute("identificator-data-list");if(!t)return;let i={};try{i=JSON.parse(t)}catch(e){return}const o=["190.248.24.96/29","200.13.232.64/24","201.220.30.0/23","201.234.67.128/29","200.13.323.32/27"],n=e=>e.split(".").reduce(((e,t)=>(e<<8)+parseInt(t,10)),0),a=e=>e.map((e=>{const[t,i]=e.split("/"),o=parseInt(i,10),a=0===o?0:4294967295<<32-o>>>0;return{network:n(t)&a,maskBits:a}}));fetch("https://ipinfo.io/json").then((e=>e.json())).then((e=>{const t=e.ip,r=n(t),s=Array.isArray(i.ipList)?i.ipList:[],c=[...o,...s],d=new Set(c.filter((e=>!e.includes("/")))),l=c.filter((e=>e.includes("/"))),u=a(l);let m=!0;if(d.has(t))m=!1;else for(const e of u)if((r&e.maskBits)===e.network){m=!1;break}m&&(window.location.href=i.redirectTo)})).catch((e=>{}))}catch(e){console.error("Error en validación IP:",e)}}))}()},732:function(){!function(){"use strict";window.addEventListener("load",(function(e){document.querySelectorAll(".iframeforms iframe").forEach((e=>{e.height=e.contentWindow.document.body.scrollHeight}));const t=document.querySelectorAll(".cmp-aemform__iframecontent");function i(e){const t=e.contentWindow.document.body.scrollHeight;e.style.height=`${t}px`}function o(e){i(e),function(e){const t=new MutationObserver((()=>i(e))),o=e.contentWindow.document;t.observe(o.body,{childList:!0,subtree:!0})}(e),window.addEventListener("resize",(()=>i(e)))}0!==t.length&&t.forEach((e=>{o(e)}))}))}()},342:function(){window.addEventListener("load",(()=>{Array.from(document.querySelectorAll(".cmp-insight-links")).forEac
1h((e=>{const t=Array.from(e.querySelectorAll(".cmp-insight-links__content")),i=t.length;e.classList.add(`l-${i}`),t.forEach((e=>{e.classList.add(i<=2?"w-500":"w-293"),i<=2&&e.parentElement.classList.add("w-5")}))}))}))},138:function(){!function(){"use strict";window.addEventListener("load",(()=>{let e=window.location.pathname.includes("investors")?"investor":"";document.querySelectorAll(".cmp-news__card-list .cmp-teaser__content").forEach((e=>{const t=e.parentElement.getAttribute("href");e.insertAdjacentHTML("beforeend",`<a class="cmp-teaser__link" href="${t}">Acceder al contenido completo</a>`)})),"investor"===e&&document.querySelectorAll(".cmp-news__card-list .cmp-teaser__content").forEach((e=>{e.querySelector(".cmp-teaser__link").textContent="Learn more"}))}))}()},19:function(){!function(){"use strict";window.addEventListener("load",(function(){document.querySelectorAll(".cmp-listicon")&&document.querySelectorAll(".cmp-listicon").forEach((e=>{let t=e.querySelector(".cmp-listicon__container");if(!t)return;let i=t.querySelector(".cmp-listicon__text").querySelector(".cmp-text");if(!i)return;let o=i.querySelectorAll("p a");if(i&&o.length>0){let e=i.getElementsByTagName("p")[0].getElementsByTagName("a")[0].href;if(".pdf"===e.substring(e.length-4,e.length)){t.querySelector(".cmp-listicon__image").querySelector(".listcon__a").href=e}}}))}))}()},491:function(){!function(){"use strict";const e=e=>{try{const t=document.getElementById(e),i=document.querySelectorAll(".cmp-mega-menu .level1 > li > a"),o=document.querySelectorAll(".level2 > li ");if(o.forEach((e=>{e.childNodes.length>2&&e.removeChild(e.lastChild)})),!t)return;const n=document.querySelector(`ul.level2 li a[data-content="${e}"]`);if(!n)return;const a=t.parentElement.cloneNode(!0);1===n.parentElement.children.length&&n.classList.contains("active")&&n.parentElement.appendChild(a),i.forEac
1h((e=>{e.addEventListener("click",(()=>{o.forEach((e=>{e.childNodes.length>2&&e.removeChild(e.lastChild)}))}))}))}catch(e){console.log("Error | gestionarElementos: ",e)}},t=new class{portalList=document.querySelector(".megamenu .portal-list");portalToggle=document.querySelector(".megamenu .toggle-portal");l2=document.querySelectorAll(".content-nav>ul.level1 li>ul.level2 >li a");close(){try{if(!this.portalList&&!this.portalToggle)return;this.portalList.classList.remove("active"),this.portalToggle.classList.remove("open")}catch(e){console.log("Error | Portal | Close :",e)}}handle(){try{if(!this.portalToggle)return;this.portalToggle.addEventListener("click",(e=>{e.preventDefault(),o.close(),this.portalList.classList.toggle("active"),this.portalToggle.classList.toggle("open")}))}catch(e){console.log("Error | Portal | Handle :",e)}}},i=new class{l1=document.querySelectorAll("header.cmp-mega-menu .level1 > li > a");handleClick(){try{if(!this.l1||0==this.l1.length)return;this.l1.forEach((e=>{e.addEventListener("click",(i=>{t.close(),o.close(),e.classList.contains("active")||this.l1.forEach((e=>{e.classList.remove("active"),e.parentElement.classList.remove("active"),e.nextElementSibling&&e.nextElementSibling.classList.remove("active")})),e.classList.toggle("active"),e.parentElement.classList.toggle("active"),e.nextElementSibling&&e.nextElementSibling.classList.toggle("active")}))}))}catch(e){console.log("Error | firstLevel | handleclick: ",e)}}currentLink(){try{if(!this.l1||0==this.l1.length)return;let e=!1;for(let t of this.l1)window.location.pathname.includes(t.getAttribute("title").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(new RegExp(" ","gi"),"-"))?(e=!0,t.classList.add("active"),t.parentElement.classList.add("active"),t.parentElement.querySelector("ul")&&t.parentElement.querySelector("ul").classList.add("active")):(t.classList.remove("active"),t.parentElement.classList.remove("active"),t.parentElement.querySelector("ul")&&t.parentElement.querySelector("ul").classList.remove("active"));e||(this.l1[0].classList.add("active"),this.l1[0].parentElement.classList.add("active"),this.l1[0].parentElement.querySelector("ul")&&this.l1[0].parentElement.querySelector("ul").classList.add("active"))}catch(e){console.log("Error | FisrtLevel | currentLink: ",e)}}},o=new class{l2=document.querySelectorAll(".content-nav>ul.level1 li>ul.level2 >li a");navContent=document.querySelectorAll(".nav-content > .cmp-container> .container");close(){try{if(!this.l2||0==this.l2.length)return;this.l2.forEach((e=>{e.classList.contains("active")||(this.l2.forEach((e=>e.classList.remove("active"))),this.navContent.forEach((e=>e.classList.remove("active"))))}))}catch(e){console.log("Error | secondLevel | Close: ",e)}}handleClick(){try{if(!this.l2||0==this.l2.length)return;this.l2.forEach((i=>{i.addEventListener("click",(()=>{t.close();const o=document.getElementById(i.getAttribute("data-content"));i.classList.contains("active")||(this.l2.forEach((e=>e.classList.remove("active"))),this.navContent.forEach((e=>e.classList.remove("active")))),i.classList.toggle("active"),o.parentElement.classList.toggle("active"),window.matchMedia("(max-width:1024px)").matches&&e(i.getAttribute("data-content"))}))}))}catch(e){console.log("Error | secondLevel | handleClick :",e)}}},n=new class{links=document.querySelectorAll("header.cmp-mega-menu .top ul.links li");liFlag=!1;handle(){if(this.links&&0!=this.links.length)for(let e of this.links)e.childElementCount>1&&(e.querySelector("a").setAttribute("class","ulList"),e.querySelector("a").addEventListener("click",(()=>{const t=e.querySelector("ul");this.liFlag?(t.style.display="none",this.liFlag=!1):(t.style.display="flex",this.liFlag=!0)})))}};window.addEventListener("load",(function(e){try{t.handle(),i.handleClick(),i.currentLink(),o.handleClick(),n.handle()}catch(e){console.log("Error | Megamenu.js EventListener: ",e)}}))}()},859:function(){!function(){"use strict";window.addEventListener("load",(()=>{document.querySelectorAll(".cmp-page-finder").forEach((e=>{const t="cmp-page-finder__list-item",i="cmp-page-finder__list-item-title",o="cmp-page-finder__list-item-description",n=new URLSearchParams(window.location.search),a=(JSON.parse(e.dataset.pages??"[]"),"Aproximadamente # resultados");var r=e.dataset.searchRoot,s=window.location.href.split("="),c=e.getAttribute("data-search-rootdocument"),d=e.querySelector("#page-finder-search-input"),l=e.querySelector("#page-finder-pages-list"),u=e.querySelector("#page-finder-clear-input-button"),m=e.querySelector("#page-finder-search-button"),p=e.querySelector("#page-finder-number-of-results"),g="",h="";if(s.length>1){let e=decodeURIComponent(s[1]);d.value=e.split("#")[0],window.location.href="#main-cli-usu"}const f=Array.from(document.querySelectorAll(".chk-searchby")),v=Array.from(document.querySelectorAll('input[name="rdb-lastmodification"]'));let y={typeDoc:[],modificacion:"",terminos:[]},C=document.querySelector(".cmp-page-finder__tags"),E=document.querySelector(".cmp-page-finder-searchby"),A=document.querySelector(".cmp-page-finder-searchby__options"),S=document.querySelector(".cmp-page-finder-filter-arrow-searchby"),b=document.querySelector(".cmp-page-finder-lastmodification"),w=document.querySelector(".cmp-page-finder-lastmodification__options"),L=document.querySelector(".cmp-page-finder-filter-arrow-lastmodification");const I=document.querySelector("#cmp-page-finder-btnclearfilter"),N=document.querySelector("#cmp-page-finder-btnsearch"),M=document.getElementById("selectFilterSearchBy");function O(e){for(;C.firstChild;)C.removeChild(C.firstChild);e.forEach((e=>{const t=document.createElement("div");
1t.className="cmp-page-finder-tag-item__container";const i=document.createElement("div");i.className="cmp-page-finder-tag-item";const o=document.createElement("span");o.textContent=e;const n=document.createElement("button");n.className="delete-item";const a=document.createElement("img");a.className="removeTag",a.src="/etc.clientlibs/epm/clientlibs/clientlib-site/resources/images/icons/icon-x-search-green.svg",a.alt="icono cerrar",n.appendChild(a),i.appendChild(o),i.appendChild(n),t.appendChild(i),C.appendChild(t)}))}function T(e){let t="",i=e.terminos.map((e=>encodeURIComponent(e.trim().split(" ").join("-").normalize("NFD").replace(/[\u0300-\u036f]/g,""))));return Object.values(e.typeDoc).forEach((e=>{("document"==e&&null!=c||"image"==e&&null!=c)&&(t+="&"+e+"="+i.join(",")+"&pathrootdocument="+c),"page"==e&&""!=r&&(t+="&"+e+"="+i.join(",")+"&pathroot="+r)})),t.replace("&","/?")}function R(e,t){let i=t.indexOf(e);-1!==i?t.splice(i,1):t.push(e)}function D(e){if("Todos"!=e){let t=new Date,i=new Date;return i.setDate(t.getDate()-parseInt(e)),i.setHours(-5,0,0,0),i.toISOString()}return""}function q(e){document.querySelector(".cmp-page-finder__loader").classList.toggle("hide"),fetch(e).then((e=>e.json())).then((e=>{const{Documentos:n={},Imagenes:r={},Paginas:s={}}=e,c=n.data||[],d=r.data||[],u=s.data||[];console.log("Combinar arrays");!function(e){const n=document.createDocumentFragment(),r=new URL(window.location.href);if(l.innerHTML="",e.length<1)return p.textContent=`No se encontraron resultados para ${y.terminos.join(", ")}`,void(p.style.display="block");p.textContent=a.replace("#",e.length),p.style.display="block",e.forEach((e=>{const a="Página"!==e.typeDoc?e.path:function(e){return"/"+e.split("/").splice(3,1/0).join("/")}(e.path);var s=document.createElement("li");s.classList.add(t);var c=document.createElement("h6");c.classList.add(i);var d=document.createElement("p");d.classList.add(o);var l=document.createElement("a");l.setAttribute("dataId","cmp-page-finder__cta");const u=document.createElement("div");u.classList.add("cmp-page-finder-list__typedoc");const m=document.createElement("div");m.classList.add("cmp-page-finder-list__modifiedElement");var p=document.createElement("a");p.setAttribute("dataId","cmp-page-finder__cta"),p.setAttribute("class","cmp-page-finder_typeDoc_texto");var g=document.createElement("a");g.setAttribute("dataId","cmp-page-finder__cta"),g.setAttribute("class","cmp-page-finder__cta"),g.setAttribute("target","_blank");var h=document.createElement("a");h.setAttribute("class","cmp-page-finder_publicado_texto");var f=document.createElement("span");f.setAttribute("class","cmp-page-finder_typeDoc"),f.style.display="inline";var v=document.createElement("span");v.setAttribute("class","cmp-page-finder_publicado"),v.style.display="inline";const y=e["jcr:lastModified"]||e["cq:lastModified"];g.href=a,g.textContent=r.host+a,f.textContent="Tipo: ",v.textContent="Publicado: ",c.innerHTML=e.title,d.textContent=e["jcr:description"],p.textContent=e.typeDoc,h.textContent=`${y.dayOfMonth}/${y.month+1}/${y.year}`,u.appendChild(f),u.appendChild(p),m.appendChild(v),m.appendChild(h),l.appendChild(c),l.appendChild(g),l.appendChild(d),l.appendChild(u),l.appendChild(m),s.appendChild(l),n.appendChild(s)})),l.appendChild(n)}(function(e,t){const i=Array.isArray(t)?t:[t],o=e.map((e=>{let t=e["jcr:title"];return i.forEach((e=>{const i=function(e){const t={a:"[aáàäâãå]",e:"[eéèëê]",i:"[iíìïî]",o:"[oóòöôõ]",u:"[uúùüû]",c:"[cç]",n:"[nñ]"},i=e.split("").map((e=>{const i=e.toLowerCase();return t[i]||e})).join("");return new RegExp(`(${i})`,"gi")}(e);t=t.replace(i,"<strong>$1</strong>")})),{...e,title:t}}));return o}([...c,...d,...u],y.terminos)),document.querySelector(".cmp-page-finder__loader").classList.add("hide")})).catch((e=>console.log(e)))}M.addEventListener("change",(()=>{const e=M.checked;f.forEach((t=>{t.checked=e}))})),f.forEach((e=>{e.addEventListener("change",(e=>{const t=Array.from(f).every((e=>e.checked)),i=Array.from(f).some((e=>e.checked));t?(selectFilterSearchBy.checked=!0,selectFilterSearchBy.indeterminate=!1):i?(selectFilterSearchBy.checked=!1,selectFilterSearchBy.indeterminate=!0):(selectFilterSearchBy.checked=!1,selectFilterSearchBy.indeterminate=!1)}))}));const P=document.querySelector(".indeterminate");let k=0;function x(){E.classList.add("cmp-filter-searchby-show"),S.classList.add("rotarSearch"),P.tabIndex="0",f.forEach((e=>e.tabIndex="0"))}function B(){E.classList.remove("cmp-filter-searchby-show"),S.classList.remove("rotarSearch"),P.tabIndex="-1",f.forEach((e=>e.tabIndex="-1")),k=0}E.addEventListener("click",(function(e){E.classList.contains("cmp-filter-searchby-show")?e.target.classList.contains("cmp-page-finder-filter-arrow-searchby")&&B():x()}
1)),document.getElementById("page-finder-search-input").value=document.getElementById("page-finder-search-input").value.replace(/[+\-{}´´]/g," "),E.addEventListener("keydown",(e=>{"Enter"===e.key?(e.preventDefault(),E.classList.contains("cmp-filter-searchby-show")?B():x()):"Tab"===e.key&&(++k,E.classList.contains("cmp-filter-searchby-show")||(P.tabIndex="-1",f.forEach((e=>e.tabIndex="-1"))),k>A.childElementCount&&B())}));let _=0;function $(){b.classList.add("cmp-filter-lastmodification-show"),L.classList.add("rotarLastModification"),Array.from(w.children).forEach((e=>e.tabIndex="0"))}function F(){b.classList.remove("cmp-filter-lastmodification-show"),L.classList.remove("rotarLastModification"),Array.from(w.children).forEach((e=>e.tabIndex="-1")),_=0}function U(){let e=d.value,t=function(e,t){return-1!=e.indexOf(t)}(y.terminos,e),i=y.terminos.length>=3;y.typeDoc=f.filter((e=>e.checked)).map((e=>e.value));const o=Array.from(v).find((e=>e.checked));let n=D(o.value);if(y.modificacion=n,""==d.value){let e=T(y);return void q(""!=n?"/bin/page-finder"+e+"&fecha="+n:"/bin/page-finder"+e)}if(t){let e=T(y),t=D(o.value);return e!==g||t!==h?(g=e,void q(""!==(h=t)?"/bin/page-finder"+e+"&fecha="+h:"/bin/page-finder"+e)):void 0}i&&y.terminos.pop(),y.terminos.unshift(e),O(y.terminos);let a=T(y);q(""!=n?"/bin/page-finder"+a+"&fecha="+n:"/bin/page-finder"+a),d.value=""}b.addEventListener("click",(function(e){b.classList.contains("cmp-filter-lastmodification-show")?e.target.classList.contains("cmp-page-finder-filter-arrow-lastmodification")&&F():$()})),b.addEventListener("keydown",(function(e){"Enter"===e.key?(e.preventDefault(),b.classList.contains("cmp-filter-lastmodification-show")?F():$()):"Tab"===e.key?(++_,b.classList.contains("cmp-filter-lastmodification-show")||Array.from(w.children).forEach((e=>e.tabIndex="-1")),_>w.childElementCount&&F()):" "==e.key&&(e.preventDefault(),v.forEach((e=>e.checked=!1)),Array.from(e.target.children)[0].checked=!0)})),I.addEventListener("click",(e=>{y.typeDoc=f.map((e=>"image"!==e.value?e.checked=!0:e.checked=!1)),Array.from(v).map((e=>{"Todos"==e.value&&("image"!==e.value?e.checked=!0:e.checked=!1)})),M.checked=!0,y.terminos=[],O(y.terminos)})),N.addEventListener("click",(e=>{U()})),C.addEventListener("click",(e=>{if(e.target.classList.contains("removeTag")){R(e.target.parentElement.parentElement.querySelector("span").innerText,y.terminos),O(y.terminos)}})),C.addEventListener("keydown",(e=>{if("Enter"==e.key&&e.target.classList.contains("delete-item")){R(e.target.parentElement.querySelector("span").innerText,y.terminos),O(y.terminos)}}));var H=n.get("search");if(null!=H){const e=T({typeDoc:["document","page"],modificacion:"",terminos:[H]});q(`/bin/page-finder${e}`),g=e,y.terminos.push(H),O(y.terminos)}u.addEventListener("click",(()=>{d.value="",m.style.display="flex",u.style.display="none"})),d.addEventListener("keyup",(e=>{"Enter"==e.key&&U()})),d.addEventListener("input",(()=>{d.value.length>0?(m.style.display="none",u.style.display="flex"):(m.style.display="flex",u.style.display="none")}))}))}))}()},426:function(){!function(){"use strict";window.addEventListener("load",(function(e){document.querySelectorAll(".cmp-scrollcontainer").forEach((e=>{var t=e.querySelector(".scroll-wrapper"),i=e.querySelectorAll(".prev-button"),o=e.querySelectorAll(".next-button"),n=t.querySelectorAll(".cmp-card-icon__container, .cmp-cards__container");function a(e){const i=document.querySelector(".cmp-card-icon__container.active"),o=Array.from(n).indexOf(i),a=n[o+e];if(a){const e=t.getBoundingClientRect(),i=a.getBoundingClientRect(),o=i.left-e.left,r=t.offsetWidth/2-i.width/2;t.scrollBy({left:o-r,behavior:"smooth"}
1),n.forEach((e=>e.classList.remove("active"))),a.classList.add("active")}}function r(){if(!e.parentElement.classList.contains("no-buttons")){var t=n[n.length-1].getBoundingClientRect(),i=Math.round(t.right),o=n[0].getBoundingClientRect(),a=Math.round(o.left);a<l().wrapperRectLeft||i>l().wrapperRectRight?s(!0):a==l().wrapperRectLeft&&i==l().wrapperRectRight&&s(!1)}}function s(t){var i=t?"flex":"none";e.querySelectorAll(".scroll-buttons").forEach((e=>{e.style.display=i}))}async function c(){return new Promise((e=>{const t="prev-button-disable";var o;setTimeout((()=>{var e=n[0].getBoundingClientRect();o=Math.round(e.left)==l().wrapperRectLeft,i.forEach((e=>{o?e.classList.add(t):e.classList.remove(t)}))}),400),e(o)}))}function d(){return new Promise((e=>{const t="next-button-disable";setTimeout((()=>{var e=n[n.length-1].getBoundingClientRect(),i=Math.round(e.right)==l().wrapperRectRight;o.forEach((e=>{i?e.classList.add(t):e.classList.remove(t)}))}),400),e(undefined)}))}function l(){var e=t.getBoundingClientRect(),i=Math.round(e.right);return{wrapperRectLeft:Math.round(e.left),wrapperRectRight:i}}i.forEach((e=>{e.addEventListener("click",(function(){window.matchMedia("(max-width:1024px)").matches?a(-1):t.scrollBy({left:-200,behavior:"smooth"}),c()||(e.style.backgroundColor="#8B8D8E"),d()})),e.addEventListener("mouseleave",(function(){c||(e.style.backgroundColor="#36A21D")}))})),o.forEach((e=>{e.addEventListener("click",(function(){window.matchMedia("(max-width:1024px)").matches?a(1):t.scrollBy({left:200,behavior:"smooth"}),d()||(e.style.backgroundColor="#8B8D8E"),c()})),e.addEventListener("mouseleave",(function(){d()||(e.style.backgroundColor="#36A21D")}))})),r(),c(),window.addEventListener("resize",r)}))}))}()},186:function(){!function(){"use strict";window.addEventListener("load",(function(e){let t=document.getElementById("searchable-departamento");if(!t)return;let i=t.getAttribute("data-itemobject"),o=t.getAttribute("data-tipo-select"),n={};i.split(",").forEach((function(e){let t=e.trim().split(":"),i=t[0].trim();n[i]=t[1].trim()}));let a={Antioquia:[{municipio:"ABEJORRAL",Codigo:"002"},{municipio:"ABRIAQUÍ",Codigo:"004"},{municipio:"ALEJANDRÍA",Codigo:"021"},{municipio:"AMAGÁ",Codigo:"030"},{municipio:"AMALFI",Codigo:"031"},{municipio:"ANDES",Codigo:"034"},{municipio:"ANGELÓPOLIS",Codigo:"036"},{municipio:"ANGOSTURA",Codigo:"038"},{municipio:"ANORÍ",Codigo:"040"},{municipio:"ANZÁ",Codigo:"044"},{municipio:"APARTADÓ",Codigo:"045"},{municipio:"ARBOLETES",Codigo:"051"},{municipio:"ARGELIA",Codigo:"055"},{municipio:"ARMENIA",Codigo:"059"},{municipio:"BARBOSA",Codigo:"079"},{municipio:"BELLO",Codigo:"088"},{municipio:"BELMIRA",Codigo:"086"},{municipio:"BETANIA",Codigo:"091"},{municipio:"BETULIA",Codigo:"093"},{municipio:"BRICEÑO",Codigo:"107"},{municipio:"BURITICÁ",Codigo:"113"},{municipio:"CÁCERES",Codigo:"120"},{municipio:"CAICEDO",Codigo:"125"},{municipio:"CALDAS",Codigo:"129"},{municipio:"CAMPAMENTO",Codigo:"134"},{municipio:"CAÑASGORDAS",Codigo:"138"},{municipio:"CARACOLÍ",Codigo:"142"},{municipio:"CARAMANTA",Codigo:"145"},{municipio:"CAREPA",Codigo:"147"},{municipio:"CAROLINA",Codigo:"150"},{municipio:"CAUCASIA",Codigo:"154"},{municipio:"CHIGORODÓ",Codigo:"172"},{municipio:"CISNEROS",Codigo:"190"},{municipio:"CIUDAD BOLÍVAR",Codigo:"101"},{municipio:"COCORNÁ",Codigo:"197"},{municipio:"CONCEPCIÓN",Codigo:"206"},{municipio:"CONCORDIA",Codigo:"209"},{municipio:"COPACABANA",Codigo:"212"},{municipio:"D.DEPTAL ANTIOQUIA",Codigo:"900"},{municipio:"DABEIBA",Codigo:"234"},{municipio:"DON MATÍAS",Codigo:"237"},{municipio:"EBÉJICO",Codigo:"240"},{municipio:"EL BAGRE",Codigo:"250"},{municipio:"EL CARMEN DE VIBORAL",Codigo:"148"},{municipio:"EL SANTUARIO",Codigo:"697"},{municipio:"ENTRERRÍOS",Codigo:"264"},{municipio:"ENVIGADO",Codigo:"266"},{municipio:"FREDONIA",Codigo:"282"},{municipio:"FRONTINO",Codigo:"284"},{municipio:"GIRALDO",Codigo:"306"},{municipio:"GIRARDOTA",Codigo:"308"},{municipio:"GÓMEZ PLATA",Codigo:"310"},{municipio:"GRANADA",Codigo:"313"},{municipio:"GUADALUPE",Codigo:"315"},{municipio:"GUARNE",Codigo:"318"},{municipio:"GUATAPÉ",Codigo:"321"},{municipio:"HELICONIA",Codigo:"347"},{municipio:"HISPANIA",Codigo:"353"},{municipio:"ITAGUI",Codigo:"360"},{municipio:"ITUANGO",Codigo:"361"},{municipio:"JARDÍN",Codigo:"364"},{municipio:"JERICÓ",Codigo:"368"},{municipio:"LA CEJA",Codigo:"376"},{municipio:"LA ESTRELLA",Codigo:"380"},{municipio:"LA PINTADA",Codigo:"390"},{municipio:"LA UNIÓN",Codigo:"400"},{municipio:"LIBORINA",Codigo:"411"},{municipio:"MACEO",Codigo:"425"},{municipio:"MARINILLA",Codigo:"440"},{municipio:"MEDELLIN",Codigo:"001"},{municipio:"MONTEBELLO",Codigo:"467"},{municipio:"MURINDÓ",Codigo:"475"},{municipio:"MUTATÁ",Codigo:"480"},{municipio:"NARIÑO",Codigo:"483"},{municipio:"NECHÍ",Codigo:"495"},{municipio:"NECOCLÍ",Codigo:"490"},{municipio:"OLAYA",Codigo:"501"},{municipio:"PEÑOL",Codigo:"541"},{municipio:"PEQUE",Codigo:"543"},{municipio:"PUEBLORRICO",Codigo:"576"},{municipio:"PUERTO BERRÍO",Codigo:"579"},{municipio:"PUERTO NARE",Codigo:"585"},{municipio:"PUERTO TRIUNFO",Codigo:"591"},{municipio:"REMEDIOS",Codigo:"604"},{municipio:"RETIRO",Codigo:"607"},{municipio:"RIONEGRO",Codigo:"615"},{municipio:"SABANALARGA",Codigo:"628"},{municipio:"SABANETA",Codigo:"631"},{municipio:"SALGAR",Codigo:"642"},{municipio:"SAN ANDRÉS DE CUERQUÍA",Codigo:"647"},{municipio:"SAN CARLOS",Codigo:"649"},{municipio:"SAN FRANCISCO",Codigo:"652"},{municipio:"SAN JERÓNIMO",Codigo:"656"},{municipio:"SAN JOSÉ DE LA MONTAÑA",Codigo:"658"},{municipio:"SAN JUAN DE URABÁ",Codigo:"659"},{municipio:"SAN LUIS",Codigo:"660"},{municipio:"SAN PEDRO DE LOS MILAGROS",Codigo:"664"},{municipio:"SAN PEDRO DE URABÁ",Codigo:"665"},{municipio:"SAN RAFAEL",Codigo:"67"},{municipio:"SAN ROQUE",Codigo:"670"},{municipio:"SAN VICENTE FERRER",Codigo:"674"},{municipio:"SANTA BÁRBARA",Codigo:"679"},{municipio:"SANTA FÉ DE ANTIOQUIA",Codigo:"042"},{municipio:"SANTA ROSA DE OSOS",Codigo:"686"},{municipio:"SANTO DOMINGO",Codigo:"690"},{municipio:"SEGOVIA",Codigo:"736"},{municipio:"SONSÓN",Codigo:"756"},{municipio:"SOPETRÁN",Codigo:"761"},{municipio:"TÁMESIS",Codigo:"789"},{municipio:"TARAZÁ",Codigo:"790"},{municipio:"TARSO",Codigo:"792"},{municipio:"TITIRIBÍ",Codigo:"809"},{municipio:"TOLEDO",Codigo:"819"},{municipio:"TURBO",Codigo:"837"},{municipio:"URAMITA",Codigo:"842"},{municipio:"URRAO",Codigo:"847"},{municipio:"VALDIVIA",Codigo:"854"},{municipio:"VALPARAÍSO",Codigo:"856"},{municipio:"VEGACHÍ",Codigo:"858"},{municipio:"VENECIA",Codigo:"861"},{municipio:"VIGÍA DEL FUERTE",Codigo:"873"},{municipio:"YALÍ",Codigo:"885"},{municipio:"YARUMAL",Codigo:"887"},{municipio:"YOLOMBÓ",Codigo:"890"},{municipio:"YONDÓ",Codigo:"893"},{municipio:"ZARAGOZA",Codigo:"895"}],"Norte de Santander":[{municipio:"ÁBREGO",Codigo:"003"},{municipio:"ARBOLEDAS",Codigo:"051"},{municipio:"BOCHALEMA",Codigo:"099"},{municipio:"BUCARASICA",Codigo:"109"},{municipio:"CÁCHIRA",Codigo:"128"},{municipio:"CÁCOTA",Codigo:"125"},{municipio:"CHINÁCOTA",Codigo:"172"},{municipio:"CHITAGÁ",Codigo:"174"},{municipio:"CONVENCIÓN",Codigo:"206"},{municipio:"CÚCUTA",Codigo:"001"},{municipio:"CUCUTILLA",Codigo:"223"},{municipio:"DURANIA",Codigo:"239"},{municipio:"EL CARMEN",Codigo:"245"},{municipio:"EL TARRA",Codigo:"250"},{municipio:"EL ZULIA",Codigo:"261"},{municipio:"GRAMALOTE",Codigo:"313"},{municipio:"HACARÍ",Codigo:"344"},{municipio:"HERRÁN",Codigo:"347"},{municipio:"JURISDICCIÓN DE OCAÑA",Codigo:"999"},{municipio:"LA ESPERANZA",Codigo:"385"},{municipio:"LA PLAYA",Codigo:"398"},{municipio:"LABATECA",Codigo:"377"},{municipio:"LOS PATIOS",Codigo:"405"},{municipio:"LOURDES",Codigo:"418"},{municipio:"MUTISCUA",Codigo:"480"},{municipio:"OCAÑA",Codigo:"498"},{municipio:"PAMPLONA",Codigo:"518"},{municipio:"PAMPLONITA",Codigo:"520"},{municipio:"PUERTO SANTANDER",Codigo:"553"},{municipio:"RAGONVALIA",Codigo:"599"},{municipio:"SALAZAR",Codigo:"660"},{municipio:"SAN CALIXTO",Codigo:"670"},{municipio:"SAN CAYETANO",Codigo:"673"},{municipio:"SANTIAGO",Codigo:"680"},{municipio:"SARDINATA",Codigo:"720"},{municipio:"SILOS",Codigo:"743"},{municipio:"TEORAMA",Codigo:"800"},{municipio:"TIBÚ",Codigo:"810"},{municipio:"TOLEDO",Codigo:"820"},{municipio:"VILLA CARO",Codigo:"871"},{municipio:"VILLA DEL ROSARIO",Codigo:"874"}],Meta:[{municipio:"ACACÍAS",Codigo:"006"},{municipio:"BARRANCA DE UPÍA",Codigo:"110"},{municipio:"CABUYARO",Codigo:"124"},{municipio:"CASTILLA LA NUEVA",Codigo:"150"},{municipio:"CUBARRAL",Codigo:"223"},{municipio:"CUMARAL",Codigo:"226"},{municipio:"EL CALVARIO",Codigo:"245"},{municipio:"EL CASTILLO",Codigo:"251"},{municipio:"EL DORADO",Codigo:"270"},{municipio:"FUENTE DE ORO",Codigo:"287"},{municipio:"GRANADA",Codigo:"313"},{municipio:"GUAMAL",Codigo:"318"},{municipio:"LA MACARENA",Codigo:"350"},{municipio:"LEJANÍAS",Codigo:"400"},{municipio:"MAPIRIPÁN",Codigo:"325"},{municipio:"MESETAS",Codigo:"330"},{municipio:"PUERTO CONCORDIA",Codigo:"450"},{municipio:"PUERTO GAITÁN",Codigo:"568"},{municipio:"PUERTO LLERAS",Codigo:"577"},{municipio:"PUERTO LÓPEZ",Codigo:"573"},{municipio:"PUERTO RICO",Codigo:"590"},{municipio:"RESTREPO",Codigo:"606"},{municipio:"SAN CARLOS DE GUAROA",Codigo:"680"},{municipio:"SAN JUAN DE ARAMA",Codigo:"683"},{municipio:"SAN JUANITO",Codigo:"686"},{municipio:"SAN MARTÍN",Codigo:"689"},{municipio:"URIBE",Codigo:"370"},{municipio:"VILLAVICENCIO",Codigo:"001"},{municipio:"VISTAHERMOSA",Codigo:"711"}],"Chocó":[{municipio:"ACANDÍ",Codigo:"006"},{municipio:"ALTO BAUDÓ",Codigo:"025"},{municipio:"ATRATO",Codigo:"050"},{municipio:"BAGADÓ",Codigo:"073"},{municipio:"BAHÍA SOLANO",Codigo:"075"},{municipio:"BAJO BAUDÓ",Codigo:"077"},{municipio:"BELÉN DE BAJIRÁ",Codigo:"086"},{municipio:"BOJAYÁ",Codigo:"099"},{municipio:"CARMEN DEL DARIÉN",Codigo:"150"},{municipio:"CÉRTEGUI",Codigo:"160"},{municipio:"CONDOTO",Codigo:"205"},{municipio:"EL CANTÓN DEL SAN PABLO",Codigo:"135"},{municipio:"EL CARMEN DE ATRATO",Codigo:"245"},{municipio:"EL LITORAL DEL SAN JUAN",Codigo:"250"},{municipio:"ISTMINA",Codigo:"361"},{municipio:"JURADÓ",Codigo:"372"},{municipio:"LLORÓ",Codigo:"413"},{municipio:"MEDIO ATRATO",Codigo:"425"},{municipio:"MEDIO BAUDÓ",Codigo:"430"},{municipio:"MEDIO SAN JUAN",Codigo:"450"},{municipio:"NÓVITA",Codigo:"491"},{municipio:"NUQUÍ",Codigo:"495"},{municipio:"QUIBDÓ",Codigo:"001"},{municipio:"RÍO IRÓ",Codigo:"580"},{municipio:"RÍO QUITO",Codigo:"600"},{municipio:"RIOSUCIO",Codigo:"615"},{municipio:"SAN JOSÉ DEL PALMAR",Codigo:"660"},{municipio:"SIPÍ",Codigo:"745"},{municipio:"TADÓ",Codigo:"787"},{municipio:"UNGUÍA",Codigo:"800"},{municipio:"UNIÓN PANAMERICANA",Codigo:"810"}],Huila:[{municipio:"ACEVEDO",Codigo:"006"},{municipio:"AGRADO",Codigo:"013"},{municipio:"AIPE",Codigo:"016"},{municipio:"ALGECIRAS",Codigo:"020"},{municipio:"ALTAMIRA",Codigo:"026"},{municipio:"BARAYA",Codigo:"078"},{municipio:"CAMPOALEGRE",Codigo:"132"},{municipio:"COLOMBIA",Codigo:"206"},{municipio:"ELÍAS",Codigo:"244"},{municipio:"GARZÓN",Codigo:"298"},{municipio:"GIGANTE",Codigo:"306"},{municipio:"GUADALUPE",Codigo:"319"},{municipio:"HOBO",Codigo:"349"},{municipio:"ÍQUIRA",Codigo:"357"},{municipio:"ISNOS",Codigo:"359"},{municipio:"LA ARGENTINA",Codigo:"378"},{municipio:"LA PLATA",Codigo:"396"},{municipio:"NÁTAGA",Codigo:"483"},{municipio:"NEIVA",Codigo:"001"},{municipio:"OPORAPA",Codigo:"503"},{municipio:"PAICOL",Codigo:"518"},{municipio:"PALERMO",Codigo:"524"},{municipio:"PALESTINA",Codigo:"530"},{municipio:"PITAL",Codigo:"548"},{municipio:"PITALITO",Codigo:"551"},{municipio:"RIVERA",Codigo:"615"},{municipio:"SALADOBLANCO",Codigo:"660"},{municipio:"SAN AGUSTÍN",Codigo:"668"},{municipio:"SANTA MARÍA",Codigo:"676"},{municipio:"SUAZA",Codigo:"770"},{municipio:"TARQUI",Codigo:"791"},{municipio:"TELLO",Codigo:"799"},{municipio:"TERUEL",Codigo:"801"},{municipio:"TESALIA",Codigo:"797"},{municipio:"TIMANÁ",Codigo:"807"},{municipio:"VILLAVIEJA",Codigo:"872"},{municipio:"YAGUARÁ",Codigo:"885"}],"Bolívar":[{municipio:"ACHÍ",Codigo:"006"},{municipio:"ALTOS DEL ROSARIO",Codigo:"030"},{municipio:"ARENAL",Codigo:"042"},{municipio:"ARJONA",Codigo:"052"},{municipio:"ARROYOHONDO",Codigo:"062"},{municipio:"BARRANCO DE LOBA",Codigo:"074"},{municipio:"CALAMAR",Codigo:"140"},{municipio:"CANTAGALLO",Codigo:"160"},{municipio:"CARTAGENA DE INDIAS",Codigo:"001"},{municipio:"CICUCO",Codigo:"188"},{municipio:"CLEMENCIA",Codigo:"222"},{municipio:"CÓRDOBA",Codigo:"212"},{municipio:"EL CARMEN DE BOLÍVAR",Codigo:"244"},{municipio:"EL GUAMO",Codigo:"248"},{municipio:"EL PEÑÓN",Codigo:"268"},{municipio:"HATILLO DE LOBA",Codigo:"300"},{municipio:"JURISDICCIÓN DE HATILLO DE LOBA",Codigo:"999"},{municipio:"MAGANGUÉ",Codigo:"430"},{municipio:"MAHATES",Codigo:"433"},{municipio:"MARGARITA",Codigo:"440"},{municipio:"MARÍA LA BAJA",Codigo:"442"},{municipio:"MOMPÓS",Codigo:"468"},{municipio:"MONTECRISTO",Codigo:"458"},{municipio:"MORALES",Codigo:"473"},{municipio:"NOROSÍ",Codigo:"490"},{municipio:"PINILLOS",Codigo:"549"},{municipio:"REGIDOR",Codigo:"580"},{municipio:"RÍO VIEJO",Codigo:"600"},{municipio:"SAN CRISTÓBAL",Codigo:"620"},{municipio:"SAN ESTANISLAO",Codigo:"647"},{municipio:"SAN FERNANDO",Codigo:"650"},{municipio:"SAN JACINTO",Codigo:"654"},{municipio:"SAN JACINTO DEL CAUCA",Codigo:"655"},{municipio:"SAN JUAN NEPOMUCENO",Codigo:"657"},{municipio:"SAN MARTÍN DE LOBA",Codigo:"667"},{municipio:"SAN PABLO",Codigo:"670"},{municipio:"SANTA CATALINA",Codigo:"673"},{municipio:"SANTA ROSA",Codigo:"683"},{municipio:"SANTA ROSA DEL SUR",Codigo:"688"},{municipio:"SIMITÍ",Codigo:"744"},{municipio:"SOPLAVIENTO",Codigo:"760"},{municipio:"TALAIGUA NUEVO",Codigo:"780"},{municipio:"TIQUISIO",Codigo:"810"},{municipio:"TURBACO",Codigo:"836"},{municipio:"TURBANÁ",Codigo:"838"},{municipio:"VILLANUEVA",Codigo:"873"},{municipio:"ZAMBRANO",Codigo:"894"}],Cundinamarca:[{municipio:"AGUA DE DIOS",Codigo:"001"},{municipio:"ALBÁN",Codigo:"019"},{municipio:"ANAPOIMA",Codigo:"035"},{municipio:"ANOLAIMA",Codigo:"040"},{municipio:"APULO",Codigo:"599"},{municipio:"ARBELÁEZ",Codigo:"053"},{municipio:"BELTRÁN",Codigo:"086"},{municipio:"BITUIMA",Codigo:"095"},{municipio:"BOJACÁ",Codigo:"099"},{municipio:"CABRERA",Codigo:"120"},{municipio:"CACHIPAY",Codigo:"123"},{municipio:"CAJICÁ",Codigo:"126"},{municipio:"CAPARRAPÍ",Codigo:"148"},{municipio:"CÁQUEZA",Codigo:"151"},{municipio:"CARMEN DE CARUPA",Codigo:"154"},{municipio:"CHAGUANÍ",Codigo:"168"},{municipio:"CHÍA",Codigo:"175"},{municipio:"CHIPAQUE",Codigo:"178"},{municipio:"CHOACHÍ",Codigo:"181"},{municipio:"CHOCONTÁ",Codigo:"183"},{municipio:"COGUA",Codigo:"200"},{municipio:"COTA",Codigo:"214"},{municipio:"CUCUNUBÁ",Codigo:"224"},{municipio:"EL COLEGIO",Codigo:"245"},{municipio:"EL PEÑÓN",Codigo:"258"},{municipio:"EL ROSAL",Codigo:"260"},{municipio:"FACATATIVÁ",Codigo:"269"},{municipio:"FÓMEQUE",Codigo:"279"},{municipio:"FOSCA",Codigo:"281"},{municipio:"FUNZA",Codigo:"286"},{municipio:"FÚQUENE",Codigo:"288"},{municipio:"FUSAGASUGÁ",Codigo:"290"},{municipio:"GACHALÁ",Codigo:"293"},{municipio:"GACHANCIPÁ",Codigo:"295"},{municipio:"GACHETÁ",Codigo:"297"},{municipio:"GAMA",Codigo:"299"},{municipio:"GIRARDOT",Codigo:"307"},{municipio:"GRANADA",Codigo:"312"},{municipio:"GUACHETÁ",Codigo:"317"},{municipio:"GUADUAS",Codigo:"320"},{municipio:"GUASCA",Codigo:"322"},{municipio:"GUATAQUÍ",Codigo:"324"},{municipio:"GUATAVITA",Codigo:"326"},{municipio:"GUAYABAL DE SÍQUIMA",Codigo:"328"},{municipio:"GUAYABETAL",Codigo:"335"},{municipio:"GUTIÉRREZ",Codigo:"339"},{municipio:"JERUSALÉN",Codigo:"368"},{municipio:"JUNÍN",Codigo:"372"},{municipio:"JURISDICCIÓN DE UBALÁ",Codigo:"998"},{municipio:"LA CALERA",Codigo:"377"},{municipio:"LA MESA",Codigo:"386"},{municipio:"LA PALMA",Codigo:"394"},{municipio:"LA PEÑA",Codigo:"398"},{municipio:"LA VEGA",Codigo:"402"},{municipio:"LENGUAZAQUE",Codigo:"407"},{municipio:"MACHETÁ",Codigo:"426"},{municipio:"MADRID",Codigo:"430"},{municipio:"MANTA",Codigo:"436"},{municipio:"MEDINA",Codigo:"438"},{municipio:"MOSQUERA",Codigo:"473"},{municipio:"NARIÑO",Codigo:"483"},{municipio:"NEMOCÓN",Codigo:"486"},{municipio:"NILO",Codigo:"488"},{municipio:"NIMAIMA",Codigo:"489"},{municipio:"NOCAIMA",Codigo:"491"},{municipio:"PACHO",Codigo:"513"},{municipio:"PAIME",Codigo:"518"},{municipio:"PANDI",Codigo:"524"},{municipio:"PARATEBUENO",Codigo
1:"530"},{municipio:"PASCA",Codigo:"535"},{municipio:"PUERTO SALGAR",Codigo:"572"},{municipio:"PULÍ",Codigo:"580"},{municipio:"QUEBRADANEGRA",Codigo:"592"},{municipio:"QUETAME",Codigo:"594"},{municipio:"QUIPILE",Codigo:"596"},{municipio:"RICAURTE",Codigo:"612"},{municipio:"SAN ANTONIO DEL TEQUENDAMA",Codigo:"645"},{municipio:"SAN BERNARDO",Codigo:"649"},{municipio:"SAN CAYETANO",Codigo:"653"},{municipio:"SAN FRANCISCO",Codigo:"658"},{municipio:"SAN JUAN DE RIOSECO",Codigo:"662"},{municipio:"SASAIMA",Codigo:"718"},{municipio:"SESQUILÉ",Codigo:"736"},{municipio:"SIBATÉ",Codigo:"740"},{municipio:"SILVANIA",Codigo:"743"},{municipio:"SIMIJACA",Codigo:"745"},{municipio:"SOACHA",Codigo:"754"},{municipio:"SOPÓ",Codigo:"758"},{municipio:"SUBACHOQUE",Codigo:"769"},{municipio:"SUESCA",Codigo:"772"},{municipio:"SUPATÁ",Codigo:"777"},{municipio:"SUSA",Codigo:"779"},{municipio:"SUTATAUSA",Codigo:"781"},{municipio:"TABIO",Codigo:"785"},{municipio:"TAUSA",Codigo:"793"},{municipio:"TENA",Codigo:"797"},{municipio:"TENJO",Codigo:"799"},{municipio:"TIBACUY",Codigo:"805"},{municipio:"TIBIRITA",Codigo:"807"},{municipio:"TOCAIMA",Codigo:"815"},{municipio:"TOCANCIPÁ",Codigo:"817"},{municipio:"TOPAIPÍ",Codigo:"823"},{municipio:"UBALÁ",Codigo:"839"},{municipio:"UBAQUE",Codigo:"841"},{municipio:"UBATÉ",Codigo:"999"},{municipio:"UNE",Codigo:"845"},{municipio:"ÚTICA",Codigo:"851"},{municipio:"VENECIA",Codigo:"506"},{municipio:"VERGARA",Codigo:"862"},{municipio:"VIANÍ",Codigo:"867"},{municipio:"VILLA DE SAN DIEGO DE UBATÉ",Codigo:"843"},{municipio:"VILLAGÓMEZ",Codigo:"871"},{municipio:"VILLAPINZÓN",Codigo:"873"},{municipio:"VILLETA",Codigo:"875"},{municipio:"VIOTÁ",Codigo:"878"},{municipio:"YACOPÍ",Codigo:"885"},{municipio:"ZIPACÓN",Codigo:"898"},{municipio:"ZIPAQUIRÁ",Codigo:"899"}],Cesar:[{municipio:"AGUACHICA",Codigo:"011"},{municipio:"AGUSTÍN CODAZZI",Codigo:"013"},{municipio:"ASTREA",Codigo:"032"},{municipio:"BECERRIL",Codigo:"045"},{municipio:"BOSCONIA",Codigo:"060"},{municipio:"CHIMICHAGUA",Codigo:"175"},{municipio:"CHIRIGUANÁ",Codigo:"178"},{municipio:"CURUMANÍ",Codigo:"228"},{municipio:"EL COPEY",Codigo:"238"},{municipio:"EL PASO",Codigo:"250"},{municipio:"GAMARRA",Codigo:"295"},{municipio:"GONZÁLEZ",Codigo:"310"},{municipio:"LA GLORIA",Codigo:"383"},{municipio:"LA JAGUA DE IBIRICO",Codigo:"400"},{municipio:"LA PAZ",Codigo:"621"},{municipio:"MANAURE BALCÓN DEL CESAR",Codigo:"443"},{municipio:"PAILITAS",Codigo:"517"},{municipio:"PELAYA",Codigo:"550"},{municipio:"PUEBLO BELLO",Codigo:"570"},{municipio:"RÍO DE ORO",Codigo:"614"},{municipio:"SAN ALBERTO",Codigo:"710"},{municipio:"SAN DIEGO",Codigo:"750"},{municipio:"SAN MARTÍN",Codigo:"770"},{municipio:"TAMALAMEQUE",Codigo:"787"},{municipio:"VALLEDUPAR",Codigo:"001"}],Santander:[{municipio:"AGUADA",Codigo:"013"},{municipio:"ALBANIA",Codigo:"020"},{municipio:"ARATOCA",Codigo:"051"},{municipio:"BARBOSA",Codigo:"077"},{municipio:"BARICHARA",Codigo:"079"},{municipio:"BARRANCABERMEJA",Codigo:"081"},{municipio:"BETULIA",Codigo:"092"},{municipio:"BOLÍVAR",Codigo:"101"},{municipio:"BUCARAMANGA",Codigo:"001"},{municipio:"CABRERA",Codigo:"121"},{municipio:"CALIFORNIA",Codigo:"132"},{municipio:"CAPITANEJO",Codigo:"147"},{municipio:"CARCASÍ",Codigo:"152"},{municipio:"CEPITÁ",Codigo:"160"},{municipio:"CERRITO",Codigo:"162"},{municipio:"CHARALÁ",Codigo:"167"},{municipio:"CHARTA",Codigo:"169"},{municipio:"CHIMA",Codigo:"176"},{municipio:"CHIPATÁ",Codigo:"179"},{municipio:"CIMITARRA",Codigo:"190"},{municipio:"CONCEPCIÓN",Codigo:"207"},{municipio:"CONFINES",Codigo:"209"},{municipio:"CONTRATACIÓN",Codigo:"211"},{municipio:"COROMORO",Codigo:"217"},{municipio:"CURITÍ",Codigo:"229"},{municipio:"EL CARMEN DE CHUCURÍ",Codigo:"235"},{municipio:"EL GUACAMAYO",Codigo:"245"},{municipio:"EL PEÑÓN",Codigo:"250"},{municipio:"EL PLAYÓN",Codigo:"255"},{municipio:"ENCINO",Codigo:"264"},{municipio:"ENCISO",Codigo:"266"},{municipio:"FLORIÁN",Codigo:"271"},{municipio:"FLORIDABLANCA",Codigo:"276"},{municipio:"GALÁN",Codigo:"296"},{municipio:"GÁMBITA",Codigo:"298"},{municipio:"GIRÓN",Codigo:"307"},{municipio:"GUACA",Codigo:"318"},{municipio:"GUADALUPE",Codigo:"320"},{municipio:"GUAPOTÁ",Codigo:"322"},{municipio:"GUAVATÁ",Codigo:"324"},{municipio:"GÜEPSA",Codigo:"327"},{municipio:"HATO",Codigo:"344"},{municipio:"JESÚS MARÍA",Codigo:"368"},{municipio:"JORDÁN",Codigo:"370"},{municipio:"LA BELLEZA",Codigo:"377"},{municipio:"LA PAZ",Codigo:"397"},{municipio:"LANDÁZURI",Codigo:"385"},{municipio:"LEBRIJA",Codigo:"406"},{municipio:"LOS SANTOS",Codigo:"418"},{municipio:"MACARAVITA",Codigo:"425"},{municipio:"MÁLAGA",Codigo:"432"},{municipio:"MATANZA",Codigo:"444"},{municipio:"MOGOTES",Codigo:"464"},{municipio:"MOLAGAVITA",Codigo:"468"},{municipio:"OCAMONTE",Codigo:"498"},{municipio:"OIBA",Codigo:"500"},{municipio:"ONZAGA",Codigo:"502"},{municipio:"PALMAR",Codigo:"522"},{municipio:"PALMAS DEL SOCORRO",Codigo:"524"},{municipio:"PÁRAMO",Codigo:"533"},{municipio:"PIEDECUESTA",Codigo:"547"},{municipio:"PINCHOTE",Codigo:"549"},{municipio:"PUENTE NACIONAL",Codigo:"572"},{municipio:"PUERTO PARRA",Codigo:"573"},{municipio:"PUERTO WILCHES",Codigo:"575"},{municipio:"RIONEGRO",Codigo:"615"},{municipio:"SABANA DE TORRES",Codigo:"655"},{municipio:"SAN ANDRÉS",Codigo:"669"},{municipio:"SAN BENITO",Codigo:"673"},{municipio:"SAN GIL",Codigo:"679"},{municipio:"SAN JOAQUÍN",Codigo:"682"},{municipio:"SAN JOSÉ DE MIRANDA",Codigo:"684"},{municipio:"SAN MIGUEL",Codigo:"686"},{municipio:"SAN VICENTE DE CHUCURÍ",Codigo:"689"},{municipio:"SANTA BÁRBARA",Codigo:"705"},{municipio:"SANTA HELENA DEL OPÓN",Codigo:"720"},{municipio:"SIMACOTA",Codigo:"745"},{municipio:"SOCORRO",Codigo:"755"},{municipio:"SUAITA",Codigo:"770"},{municipio:"SUCRE",Codigo:"773"},{municipio:"SURATÁ",Codigo:"780"},{municipio:"TONA",Codigo:"820"},{municipio:"VALLE DE SAN JOSÉ",Codigo:"855"},{municipio:"VÉLEZ",Codigo:"861"},{municipio:"VETAS",Codigo:"867"},{municipio:"VILLANUEVA",Codigo:"872"},{municipio:"ZAPATOCA",Codigo:"895"}],Caldas:[{municipio:"AGUADAS",Codigo:"013"},{municipio:"ANSERMA",Codigo:"042"},{municipio:"ARANZAZU",Codigo:"050"},{municipio:"BELALCÁZAR",Codigo:"088"},{municipio:"CHINCHINÁ",Codigo:"174"},{municipio:"FILADELFIA",Codigo:"272"},{municipio:"LA DORADA",Codigo:"380"},{municipio:"LA MERCED",Codigo:"388"},{municipio:"MANIZALES",Codigo:"001"},{municipio:"MANZANARES",Codigo:"433"},{municipio:"MARMATO",Codigo:"442"},{municipio:"MARQUETALIA",Codigo:"444"},{municipio:"MARULANDA",Codigo:"446"},{municipio:"NEIRA",Codigo:"486"},{municipio:"NORCASIA",Codigo:"495"},{municipio:"PÁCORA",Codigo:"513"},{municipio:"PALESTINA",Codigo:"524"},{municipio:"PENSILVANIA",Codigo:"541"},{municipio:"RIOSUCIO",Codigo:"614"},{municipio:"RISARALDA",Codigo:"616"},{municipio:"SALAMINA",Codigo:"653"},{municipio:"SAMANÁ",Codigo:"662"},{municipio:"SAN JOSÉ",Codigo:"665"},{municipio:"SUPÍA",Codigo:"777"},{municipio:"VICTORIA",Codigo:"867"},{municipio:"VILLAMARÍA",Codigo:"873"},{municipio:"VITERBO",Codigo:"877"}
1],Casanare:[{municipio:"AGUAZUL",Codigo:"010"},{municipio:"CHÁMEZA",Codigo:"015"},{municipio:"HATO COROZAL",Codigo:"125"},{municipio:"LA SALINA",Codigo:"136"},{municipio:"MANÍ",Codigo:"139"},{municipio:"MONTERREY",Codigo:"162"},{municipio:"NUNCHÍA",Codigo:"225"},{municipio:"OROCUÉ",Codigo:"230"},{municipio:"PAZ DE ARIPORO",Codigo:"250"},{municipio:"PORE",Codigo:"263"},{municipio:"RECETOR",Codigo:"279"},{municipio:"SABANALARGA",Codigo:"300"},{municipio:"SÁCAMA",Codigo:"315"},{municipio:"SAN LUIS DE PALENQUE",Codigo:"325"},{municipio:"TÁMARA",Codigo:"400"},{municipio:"TAURAMENA",Codigo:"410"},{municipio:"TRINIDAD",Codigo:"430"},{municipio:"VILLANUEVA",Codigo:"440"},{municipio:"YOPAL",Codigo:"001"}],"Nariño":[{municipio:"ALBÁN",Codigo:"019"},{municipio:"ALDANA",Codigo:"022"},{municipio:"ANCUYÁ",Codigo:"036"},{municipio:"ARBOLEDA",Codigo:"051"},{municipio:"BARBACOAS",Codigo:"079"},{municipio:"BELÉN",Codigo:"083"},{municipio:"BUESACO",Codigo:"110"},{municipio:"CHACHAGÜÍ",Codigo:"240"},{municipio:"COLÓN",Codigo:"203"},{municipio:"CONSACÁ",Codigo:"207"},{municipio:"CONTADERO",Codigo:"210"},{municipio:"CÓRDOBA",Codigo:"215"},{municipio:"CUASPÚD",Codigo:"224"},{municipio:"CUMBAL",Codigo:"227"},{municipio:"CUMBITARA",Codigo:"233"},{municipio:"EL CHARCO",Codigo:"250"},{municipio:"EL PEÑOL",Codigo:"254"},{municipio:"EL ROSARIO",Codigo:"256"},{municipio:"EL TABLÓN DE GÓMEZ",Codigo:"258"},{municipio:"EL TAMBO",Codigo:"260"},{municipio:"FRANCISCO PIZARRO",Codigo:"520"},{municipio:"FUNES",Codigo:"287"},{municipio:"GUACHUCAL",Codigo:"317"},{municipio:"GUAITARILLA",Codigo:"320"},{municipio:"GUALMATÁN",Codigo:"323"},{municipio:"ILES",Codigo:"352"},{municipio:"IMUÉS",Codigo:"354"},{municipio:"IPIALES",Codigo:"356"},{municipio:"JURISDICCIÓN DE TUMACO",Codigo:"999"},{municipio:"LA CRUZ",Codigo:"378"},{municipio:"LA FLORIDA",Codigo:"381"},{municipio:"LA LLANADA",Codigo:"385"},{municipio:"LA TOLA",Codigo:"390"},{municipio:"LA UNIÓN",Codigo:"399"},{municipio:"LEIVA",Codigo:"405"},{municipio:"LINARES",Codigo:"411"},{municipio:"LOS ANDES",Codigo:"418"},{municipio:"MAGÜÍ",Codigo:"427"},{municipio:"MALLAMA",Codigo:"435"},{municipio:"MOSQUERA",Codigo:"473"},{municipio:"NARIÑO",Codigo:"480"},{municipio:"OLAYA HERRERA",Codigo:"490"},{municipio:"OSPINA",Codigo:"506"},{municipio:"PASTO",Codigo:"001"},{municipio:"POLICARPA",Codigo:"540"},{municipio:"POTOSÍ",Codigo:"560"},{municipio:"PROVIDENCIA",Codigo:"565"},{municipio:"PUERRES",Codigo:"573"},{municipio:"PUPIALES",Codigo:"585"},{municipio:"RICAURTE",Codigo:"612"},{municipio:"ROBERTO PAYÁN",Codigo:"621"},{municipio:"SAMANIEGO",Codigo:"678"},{municipio:"SAN ANDRÉS DE TUMACO",Codigo:"835"},{municipio:"SAN BERNARDO",Codigo:"685"},{municipio:"SAN LORENZO",Codigo:"687"},{municipio:"SAN PABLO",Codigo:"693"},{municipio:"SAN PEDRO DE CARTAGO",Codigo:"694"},{municipio:"SANDONÁ",Codigo:"683"},{municipio:"SANTA BÁRBARA",Codigo:"696"},{municipio:"SANTA CRUZ (Guachavés)",Codigo:"997"},{municipio:"SANTACRUZ",Codigo:"699"},{municipio:"SAPUYES",Codigo:"720"},{municipio:"TAMINANGO",Codigo:"786"},{municipio:"TANGUA",Codigo:"788"},{municipio:"TUMACO",Codigo:"998"},{municipio:"TÚQUERRES",Codigo:"838"},{municipio:"YACUANQUER",Codigo:"885"}],"La Guajira":[{municipio:"ALBANIA",Codigo:"035"},{municipio:"BARRANCAS",Codigo:"078"},{municipio:"DIBULLA",Codigo:"090"},{municipio:"DISTRACCIÓN",Codigo:"098"},{municipio:"EL MOLINO",Codigo:"110"},{municipio:"FONSECA",Codigo:"279"},{municipio:"HATONUEVO",Codigo:"378"},{municipio:"LA JAGUA DEL PILAR",Codigo:"420"},{municipio:"MAICAO",Codigo:"430"},{municipio:"MANAURE",Codigo:"560"},{municipio:"RIOHACHA",Codigo:"001"},{municipio:"SAN JUAN DEL CESAR",Codigo:"650"},{municipio:"URIBIA",Codigo:"847"},{municipio:"URUMITA",Codigo:"855"},{municipio:"VILLANUEVA",Codigo:"874"}],"Caquetá":[{municipio:"ALBANIA",Codigo:"029"},{municipio:"BELÉN DE LOS ANDAQUÍES",Codigo:"094"},{municipio:"CARTAGENA DEL CHAIRÁ",Codigo:"150"},{municipio:"CURILLO",Codigo:"205"},{municipio:"EL DONCELLO",Codigo:"247"},{municipio:"EL PAUJÍL",Codigo:"256"},{municipio:"FLORENCIA",Codigo:"001"},{municipio:"LA MONTAÑITA",Codigo:"410"},{municipio:"MILÁN",Codigo:"460"},{municipio:"MORELIA",Codigo:"479"},{municipio:"PUERTO RICO",Codigo:"592"},{municipio:"SAN JOSÉ DEL FRAGUA",Codigo:"610"},{municipio:"SAN VICENTE DEL CAGUÁN",Codigo:"753"},{municipio:"SOLANO",Codigo:"756"},{municipio:"SOLITA",Codigo:"785"},{municipio:"VALPARAÍSO",Codigo:"860"}],"Valle del Cauca":[{municipio:"ALCALÁ",Codigo:"020"},{municipio:"ANDALUCÍA",Codigo:"036"},{municipio:"ANSERMANUEVO",Codigo:"041"},{municipio:"ARGELIA",Codigo:"054"},{municipio:"BOLÍVAR",Codigo:"100"},{municipio:"BUENAVENTURA",Codigo:"109"},{municipio:"BUGA",Codigo:"999"},{municipio:"BUGALAGRANDE",Codigo:"113"},{municipio:"CAICEDONIA",Codigo:"122"},{municipio:"CALI",Codigo:"001"},{municipio:"CALIMA",Codigo:"126"},{municipio:"CANDELARIA",Codigo:"130"},{municipio:"CARTAGO",Codigo:"147"},{municipio:"DAGUA",Codigo:"233"},{municipio:"EL ÁGUILA",Codigo:"243"},{municipio:"EL CAIRO",Codigo:"246"},{municipio:"EL CERRITO",Codigo:"248"},{municipio:"EL DOVIO",Codigo:"250"},{municipio:"FLORIDA",Codigo:"275"},{municipio:"GINEBRA",Codigo:"306"},{municipio:"GUACARÍ",Codigo:"318"},{municipio:"GUADALAJARA DE BUGA",Codigo:"111"},{municipio:"JAMUNDÍ",Codigo:"364"},{municipio:"LA CUMBRE",Codigo:"377"},{municipio:"LA UNIÓN",Codigo:"400"},{municipio:"LA VICTORIA",Codigo:"403"},{municipio:"OBANDO",Codigo:"497"},{municipio:"PALMIRA",Codigo:"520"},{municipio:"PRADERA",Codigo:"563"},{municipio:"RESTREPO",Codigo:"606"},{municipio:"RIOFRÍO",Codigo:"616"},{municipio:"ROLDANILLO",Codigo:"622"},{municipio:"SAN PEDRO",Codigo:"670"},{municipio:"SEVILLA",Codigo:"736"},{municipio:"TORO",Codigo:"823"},{municipio:"TRUJILLO",Codigo:"828"},{municipio:"TULUÁ",Codigo:"834"},{municipio:"ULLOA",Codigo:"845"},{municipio:"VERSALLES",Codigo:"863"},{municipio:"VIJES",Codigo:"869"},{municipio:"YOTOCO",Codigo:"890"},{municipio:"YUMBO",Codigo:"892"},{municipio:"ZARZAL",Codigo:"895"}],Magdalena:[{municipio:"ALGARROBO",Codigo:"030"},{municipio:"ARACATACA",Codigo:"053"},{municipio:"ARIGUANÍ",Codigo:"058"},{municipio:"CERRO DE SAN ANTONIO",Codigo:"161"},{municipio:"CHIVOLO",Codigo:"170"},{municipio:"CIÉNAGA",Codigo:"189"},{municipio:"CONCORDIA",Codigo:"205"},{municipio:"EL BANCO",Codigo:"245"},{municipio:"EL PIÑÓN",Codigo:"258"},{municipio:"EL RETÉN",Codigo:"268"},{municipio:"FUNDACIÓN",Codigo:"288"},{municipio:"GUAMAL",Codigo:"318"},{municipio:"NUEVA GRANADA",Codigo:"460"},{municipio:"PEDRAZA",Codigo:"541"},{municipio:"PIJIÑO DEL CARMEN",Codigo:"545"},{municipio:"PIVIJAY",Codigo:"551"},{municipio:"PLATO",Codigo:"555"},{municipio:"PUEBLOVIEJO",Codigo:"570"},{municipio:"REMOLINO",Codigo:"605"},{municipio:"SABANAS DE SAN ÁNGEL",Codigo:"660"},{municipio:"SALAMINA",Codigo:"675"},{municipio:"SAN SEBASTIÁN DE BUENAVISTA",Codigo:"692"},{municipio:"SAN ZENÓN",Codigo:"703"},{municipio:"SANTA ANA",Codigo:"707"},{municipio:"SANTA BÁRBARA DE PINTO",Codigo:"720"},{municipio:"SANTA MARTA",Codigo:"001"},{municipio:"SITIONUEVO",Codigo:"745"},{municipio:"TENERIFE",Codigo:"798"},{municipio:"ZAPAYÁN",Codigo:"960"},{municipio:"ZONA BANANERA",Codigo:"980"}],Cauca:[{municipio:"ALMAGUER",Codigo:"022"},{municipio:"ÁREA EN LITIGIO",Codigo:"999"},{municipio:"ARGELIA",Codigo:"050"},{municipio:"BALBOA",Codigo:"075"},{municipio:"BOLÍVAR",Codigo:"100"},{municipio:"BUENOS AIRES",Codigo:"110"},{municipio:"CAJIBÍO",Codigo:"130"},{municipio:"CALDONO",Codigo:"137"},{municipio:"CALOTO",Codigo:"142"},{municipio:"CORINTO",Codigo:"212"},{municipio:"EL TAMBO",Codigo:"256"},{municipio:"FLORENCIA",Codigo:"290"},{municipio:"GUACHENÉ",Codigo:"300"},{municipio:"GUAPÍ",Codigo:"318"},{municipio:"INZÁ",Codigo:"355"},{municipio:"JAMBALÓ",Codigo:"364"},{municipio:"LA SIERRA",Codigo:"392"},{municipio:"LA VEGA",Codigo:"397"},{municipio:"LÓPEZ DE MICAY",Codigo:"418"},{municipio:"MERCADERES",Codigo:"450"},{municipio:"MIRANDA",Codigo:"455"},{municipio:"MORALES",Codigo:"473"},{municipio:"PADILLA",Codigo:"513"},{municipio:"PÁEZ",Codigo:"517"},{municipio:"PATÍA",Codigo:"532"},{municipio:"PIAMONTE",Codigo:"533"},{municipio:"PIENDAMÓ",Codigo:"548"},{municipio:"POPAYÁN",Codigo:"001"},{municipio:"PUERTO TEJADA",Codigo:"573"},{municipio:"PURACÉ",Codigo:"585"},{municipio:"ROSAS",Codigo:"622"},{municipio:"SAN SEBASTIÁN",Codigo:"693"},{municipio:"SANTA ROSA",Codigo:"701"},{municipio:"SANTANDER DE QUILICHAO",Codigo:"698"},{municipio:"SILVIA",Codigo:"743"},{municipio:"SOTARA",Codigo:"760"},{municipio:"SUÁREZ",Codigo:"780"},{municipio:"SUCRE",Codigo:"785"},{municipio:"TIMBÍO",Codigo:"807"},{municipio:"TIMBIQUÍ",Codigo:"809"},{municipio:"TORIBÍO",Codigo:"821"},{municipio:"TOTORÓ",Codigo:"824"},{municipio:"VILLA RICA",Codigo:"845"}],"Boyacá":[{municipio:"ALMEIDA",Codigo:"022"},{municipio:"AQUITANIA",Codigo:"047"},{municipio:"ARCABUCO",Codigo:"051"},{municipio:"BELÉN",Codigo:"087"},{municipio:"BERBEO",Codigo:"090"},{municipio:"BETÉITIVA",Codigo:"092"},{municipio:"BOAVITA",Codigo:"097"},{municipio:"BOYACÁ",Codigo:"104"},{municipio:"BRICEÑO",Codigo:"106"}
1,{municipio:"BUENAVISTA",Codigo:"109"},{municipio:"BUSBANZÁ",Codigo:"114"},{municipio:"CALDAS",Codigo:"131"},{municipio:"CAMPOHERMOSO",Codigo:"135"},{municipio:"CERINZA",Codigo:"162"},{municipio:"CHINAVITA",Codigo:"172"},{municipio:"CHIQUINQUIRÁ",Codigo:"176"},{municipio:"CHÍQUIZA",Codigo:"232"},{municipio:"CHISCAS",Codigo:"180"},{municipio:"CHITA",Codigo:"183"},{municipio:"CHITARAQUE",Codigo:"185"},{municipio:"CHIVATÁ",Codigo:"187"},{municipio:"CHIVOR",Codigo:"236"},{municipio:"CIÉNEGA",Codigo:"189"},{municipio:"CÓMBITA",Codigo:"204"},{municipio:"COPER",Codigo:"212"},{municipio:"CORRALES",Codigo:"215"},{municipio:"COVARACHÍA",Codigo:"218"},{municipio:"CUBARÁ",Codigo:"223"},{municipio:"CUCAITA",Codigo:"224"},{municipio:"CUÍTIVA",Codigo:"226"},{municipio:"DUITAMA",Codigo:"238"},{municipio:"EL COCUY",Codigo:"244"},{municipio:"EL ESPINO",Codigo:"248"},{municipio:"FIRAVITOBA",Codigo:"272"},{municipio:"FLORESTA",Codigo:"276"},{municipio:"GACHANTIVÁ",Codigo:"293"},{municipio:"GÁMEZA",Codigo:"296"},{municipio:"GARAGOA",Codigo:"299"},{municipio:"GUACAMAYAS",Codigo:"317"},{municipio:"GUATEQUE",Codigo:"322"},{municipio:"GUAYATÁ",Codigo:"325"},{municipio:"GÜICÁN DE LA SIERRA",Codigo:"332"},{municipio:"IZA",Codigo:"362"},{municipio:"JENESANO",Codigo:"367"},{municipio:"JERICÓ",Codigo:"368"},{municipio:"LA CAPILLA",Codigo:"380"},{municipio:"LA UVITA",Codigo:"403"},{municipio:"LA VICTORIA",Codigo:"401"},{municipio:"LABRANZAGRANDE",Codigo:"377"},{municipio:"MACANAL",Codigo:"425"},{municipio:"MARIPÍ",Codigo:"442"},{municipio:"MIRAFLORES",Codigo:"455"},{municipio:"MONGUA",Codigo:"464"},{municipio:"MONGUÍ",Codigo:"466"},{municipio:"MONIQUIRÁ",Codigo:"469"},{municipio:"MOTAVITA",Codigo:"476"},{municipio:"MUZO",Codigo:"480"},{municipio:"NOBSA",Codigo:"491"},{municipio:"NUEVO COLÓN",Codigo:"494"},{municipio:"OICATÁ",Codigo:"500"},{municipio:"OTANCHE",Codigo:"507"},{municipio:"PACHAVITA",Codigo:"511"},{municipio:"PÁEZ",Codigo:"514"},{municipio:"PAIPA",Codigo:"516"},{municipio:"PAJARITO",Codigo:"518"},{municipio:"PANQUEBA",Codigo:"522"},{municipio:"PAUNA",Codigo:"531"},{municipio:"PAYA",Codigo:"533"},{municipio:"PAZ DE RÍO",Codigo:"537"},{municipio:"PESCA",Codigo:"542"},{municipio:"PISBA",Codigo:"550"},{municipio:"PUERTO BOYACÁ",Codigo:"572"},{municipio:"QUÍPAMA",Codigo:"580"},{municipio:"RAMIRIQUÍ",Codigo:"599"},{municipio:"RÁQUIRA",Codigo:"600"},{municipio:"RONDÓN",Codigo:"621"},{municipio:"SABOYÁ",Codigo:"632"},{municipio:"SÁCHICA",Codigo:"638"},{municipio:"SAMACÁ",Codigo:"646"},{municipio:"SAN EDUARDO",Codigo:"660"},{municipio:"SAN JOSÉ DE PARE",Codigo:"664"},{municipio:"SAN LUIS DE GACENO",Codigo:"667"},{municipio:"SAN MATEO",Codigo:"673"},{municipio:"SAN MIGUEL DE SEMA",Codigo:"676"},{municipio:"SAN PABLO DE BORBUR",Codigo:"681"},{municipio:"SANTA MARÍA",Codigo:"690"},{municipio:"SANTA ROSA DE VITERBO",Codigo:"693"},{municipio:"SANTA SOFÍA",Codigo:"696"},{municipio:"SANTANA",Codigo:"686"},{municipio:"SATIVANORTE",Codigo:"720"},{municipio:"SATIVASUR",Codigo:"723"},{municipio:"SIACHOQUE",Codigo:"740"}
1,{municipio:"SOATÁ",Codigo:"753"},{municipio:"SOCHA",Codigo:"757"},{municipio:"SOCOTÁ",Codigo:"755"},{municipio:"SOGAMOSO",Codigo:"759"},{municipio:"SOMONDOCO",Codigo:"761"},{municipio:"SORA",Codigo:"762"},{municipio:"SORACÁ",Codigo:"764"},{municipio:"SOTAQUIRÁ",Codigo:"763"},{municipio:"SUSACÓN",Codigo:"774"},{municipio:"SUTAMARCHÁN",Codigo:"776"},{municipio:"SUTATENZA",Codigo:"778"},{municipio:"TASCO",Codigo:"790"},{municipio:"TENZA",Codigo:"798"},{municipio:"TIBANÁ",Codigo:"804"},{municipio:"TIBASOSA",Codigo:"806"},{municipio:"TINJACÁ",Codigo:"808"},{municipio:"TIPACOQUE",Codigo:"810"},{municipio:"TOCA",Codigo:"814"},{municipio:"TOGÜÍ",Codigo:"816"},{municipio:"TÓPAGA",Codigo:"820"},{municipio:"TOTA",Codigo:"822"},{municipio:"TUNJA",Codigo:"001"},{municipio:"TUNUNGUÁ",Codigo:"832"},{municipio:"TURMEQUÉ",Codigo:"835"},{municipio:"TUTA",Codigo:"837"},{municipio:"TUTAZÁ",Codigo:"839"},{municipio:"ÚMBITA",Codigo:"842"},{municipio:"VENTAQUEMADA",Codigo:"861"},{municipio:"VILLA DE LEYVA",Codigo:"407"},{municipio:"VIRACACHÁ",Codigo:"879"},{municipio:"ZETAQUIRA",Codigo:"897"}],Tolima:[{municipio:"ALPUJARRA",Codigo:"024"},{municipio:"ALVARADO",Codigo:"026"},{municipio:"AMBALEMA",Codigo:"030"},{municipio:"ANZOÁTEGUI",Codigo:"043"},{municipio:"ARMERO GUAYABAL",Codigo:"055"},{municipio:"ATACO",Codigo:"067"},{municipio:"CAJAMARCA",Codigo:"124"},{municipio:"CARMEN DE APICALÁ",Codigo:"148"},{municipio:"CASABIANCA",Codigo:"152"},{municipio:"CHAPARRAL",Codigo:"168"},{municipio:"COELLO",Codigo:"200"},{municipio:"COYAIMA",Codigo:"217"},{municipio:"CUNDAY",Codigo:"226"},{municipio:"DOLORES",Codigo:"236"},{municipio:"ESPINAL",Codigo:"268"},{municipio:"FALAN",Codigo:"270"},{municipio:"FLANDES",Codigo:"275"},{municipio:"FRESNO",Codigo:"283"},{municipio:"GUAMO",Codigo:"319"},{municipio:"HERVEO",Codigo:"347"},{municipio:"HONDA",Codigo:"349"},{municipio:"IBAGUÉ",Codigo:"001"},{municipio:"ICONONZO",Codigo:"352"},{municipio:"LÉRIDA",Codigo:"408"},{municipio:"LÍBANO",Codigo:"411"},{municipio:"MARIQUITA",Codigo:"999"},{municipio:"MELGAR",Codigo:"449"},{municipio:"MURILLO",Codigo:"461"},{municipio:"NATAGAIMA",Codigo:"483"},{municipio:"ORTEGA",Codigo:"504"},{municipio:"PALOCABILDO",Codigo:"520"},{municipio:"PIEDRAS",Codigo:"547"},{municipio:"PLANADAS",Codigo:"555"},{municipio:"PRADO",Codigo:"563"},{municipio:"PURIFICACIÓN",Codigo:"585"},{municipio:"RIOBLANCO",Codigo:"616"},{municipio:"RONCESVALLES",Codigo:"622"},{municipio:"ROVIRA",Codigo:"624"},{municipio:"SALDAÑA",Codigo:"671"},{municipio:"SAN ANTONIO",Codigo:"675"},{municipio:"SAN LUIS",Codigo:"678"},{municipio:"SAN SEBASTIÁN DE MARIQUITA",Codigo:"443"},{municipio:"SANTA ISABEL",Codigo:"686"},{municipio:"SUÁREZ",Codigo:"770"},{municipio:"VALLE DE SAN JUAN",Codigo:"854"},{municipio:"VENADILLO",Codigo:"861"},{municipio:"VILLAHERMOSA",Codigo:"870"},{municipio:"VILLARRICA",Codigo:"873"}],Risaralda:[{municipio:"APÍA",Codigo:"045"},{municipio:"BALBOA",Codigo:"075"},{municipio:"BELÉN DE UMBRÍA",Codigo:"088"},{municipio:"DOSQUEBRADAS",Codigo:"170"},{municipio:"GUÁTICA",Codigo:"318"},{municipio:"LA CELIA",Codigo:"383"},{municipio:"LA VIRGINIA",Codigo:"400"},{municipio:"MARSELLA",Codigo:"440"},{municipio:"MISTRATÓ",Codigo:"456"},{municipio:"PEREIRA",Codigo:"001"},{municipio:"PUEBLO RICO",Codigo:"572"},{municipio:"QUINCHÍA",Codigo:"594"},{municipio:"SANTA ROSA DE CABAL",Codigo:"682"},{municipio:"SANTUARIO",Codigo:"687"}],Arauca:[{municipio:"ARAUCA",Codigo:"001"},{municipio:"ARAUQUITA",Codigo:"065"},{municipio:"CRAVO NORTE",Codigo:"220"},{municipio:"FORTUL",Codigo:"300"},{municipio:"PUERTO RONDÓN",Codigo:"591"},{municipio:"SARAVENA",Codigo:"736"},{municipio:"TAME",Codigo:"794"}],Quindio:[{municipio:"ARMENIA",Codigo:"001"},{municipio:"BUENAVISTA",Codigo:"111"},{municipio:"CALARCÁ",Codigo:"130"},{municipio:"CIRCASIA",Codigo:"190"},{municipio:"CÓRDOBA",Codigo:"212"},{municipio:"FILANDIA",Codigo:"272"},{municipio:"GÉNOVA",Codigo:"302"},{municipio:"LA TEBAIDA",Codigo:"401"},{municipio:"MONTENEGRO",Codigo:"470"},{municipio:"PIJAO",Codigo:"548"},{municipio:"QUIMBAYA",Codigo:"594"},{municipio:"SALENTO",Codigo:"690"}],"Córdoba":[{municipio:"AYAPEL",Codigo:"068"}
1,{municipio:"BUENAVISTA",Codigo:"079"},{municipio:"CANALETE",Codigo:"090"},{municipio:"CERETÉ",Codigo:"162"},{municipio:"CHIMÁ",Codigo:"168"},{municipio:"CHINÚ",Codigo:"182"},{municipio:"CIÉNAGA DE ORO",Codigo:"189"},{municipio:"COTORRA",Codigo:"300"},{municipio:"LA APARTADA",Codigo:"350"},{municipio:"LORICA",Codigo:"417"},{municipio:"LOS CÓRDOBAS",Codigo:"419"},{municipio:"MOMIL",Codigo:"464"},{municipio:"MONTELÍBANO",Codigo:"466"},{municipio:"MONTERÍA",Codigo:"001"},{municipio:"MOÑITOS",Codigo:"500"},{municipio:"PLANETA RICA",Codigo:"555"},{municipio:"PUEBLO NUEVO",Codigo:"570"},{municipio:"PUERTO ESCONDIDO",Codigo:"574"},{municipio:"PUERTO LIBERTADOR",Codigo:"580"},{municipio:"PURÍSIMA DE LA CONCEPCIÓN",Codigo:"586"},{municipio:"SAHAGÚN",Codigo:"660"},{municipio:"SAN ANDRÉS DE SOTAVENTO",Codigo:"670"},{municipio:"SAN ANTERO",Codigo:"672"},{municipio:"SAN BERNARDO DEL VIENTO",Codigo:"675"},{municipio:"SAN CARLOS",Codigo:"678"},{municipio:"SAN JOSÉ DE URÉ",Codigo:"682"},{municipio:"SAN PELAYO",Codigo:"686"},{municipio:"TIERRALTA",Codigo:"807"},{municipio:"TUCHÍN",Codigo:"815"},{municipio:"VALENCIA",Codigo:"855"}],"Atlántico":[{municipio:"BARANOA",Codigo:"078"},{municipio:"BARRANQUILLA",Codigo:"001"},{municipio:"CAMPO DE LA CRUZ",Codigo:"137"},{municipio:"CANDELARIA",Codigo:"141"},{municipio:"GALAPA",Codigo:"296"},{municipio:"JUAN DE ACOSTA",Codigo:"372"},{municipio:"LURUACO",Codigo:"421"},{municipio:"MALAMBO",Codigo:"433"},{municipio:"MANATÍ",Codigo:"436"},{municipio:"PALMAR DE VARELA",Codigo:"520"},{municipio:"PIOJÓ",Codigo:"549"},{municipio:"POLONUEVO",Codigo:"558"},{municipio:"PONEDERA",Codigo:"560"},{municipio:"PUERTO COLOMBIA",Codigo:"573"},{municipio:"REPELÓN",Codigo:"606"},{municipio:"SABANAGRANDE",Codigo:"634"},{municipio:"SABANALARGA",Codigo:"638"},{municipio:"SANTA LUCÍA",Codigo:"675"},{municipio:"SANTO TOMÁS",Codigo:"685"},{municipio:"SOLEDAD",Codigo:"758"},{municipio:"SUAN",Codigo:"770"},{municipio:"TUBARÁ",Codigo:"832"},{municipio:"USIACURÍ",Codigo:"849"}],"Guainía":[{municipio:"BARRANCO MINAS",Codigo:"343"},{municipio:"CACAHUAL",Codigo:"886"},{municipio:"INÍRIDA",Codigo:"001"},{municipio:"LA GUADALUPE",Codigo:"885"},{municipio:"MAPIRIPANA",Codigo:"663"},{municipio:"MORICHAL",Codigo:"888"},{municipio:"PANA PANA",Codigo:"887"},{municipio:"PUERTO COLOMBIA",Codigo:"884"},{municipio:"SAN FELIPE",Codigo:"883"}],"Bogotá":[{municipio:"BOGOTÁ, D.C.",Codigo:"001"}],Sucre:[{municipio:"BUENAVISTA",Codigo:"110"},{municipio:"CAIMITO",Codigo:"124"},{municipio:"CHALÁN",Codigo:"230"},{municipio:"COLOSÓ",Codigo:"204"},{municipio:"COROZAL",Codigo:"215"},{municipio:"COVEÑAS",Codigo:"221"},{municipio:"EL ROBLE",Codigo:"233"},{municipio:"GALERAS",Codigo:"235"},{municipio:"GUARANDA",Codigo:"265"},{municipio:"LA UNIÓN",Codigo:"400"},{municipio:"LOS PALMITOS",Codigo:"418"},{municipio:"MAJAGUAL",Codigo:"429"},{municipio:"MORROA",Codigo:"473"},{municipio:"OVEJAS",Codigo:"508"},{municipio:"PALMITO",Codigo:"523"},{municipio:"SAMPUÉS",Codigo:"670"},{municipio:"SAN BENITO ABAD",Codigo:"678"},{municipio:"SAN JUAN DE BETULIA",Codigo:"702"},{municipio:"SAN LUIS DE SINCÉ",Codigo:"742"},{municipio:"SAN MARCOS",Codigo:"708"},{municipio:"SAN ONOFRE",Codigo:"713"},{municipio:"SAN PEDRO",Codigo:"717"},{municipio:"SANTIAGO DE TOLÚ",Codigo:"820"},{municipio:"SINCÉ",Codigo:"998"},{municipio:"SINCELEJO",Codigo:"001"},{municipio:"SUCRE",Codigo:"771"},{municipio:"TOLÚ",Codigo:"999"},{municipio:"TOLÚ VIEJO",Codigo:"823"}],Guaviare:[{municipio:"CALAMAR",Codigo:"015"},{municipio:"EL RETORNO",Codigo:"025"},{municipio:"MIRAFLORES",Codigo:"200"},{municipio:"SAN JOSÉ DEL GUAVIARE",Codigo:"001"}],"Vaupés":[{municipio:"CARURÚ",Codigo:"161"},{municipio:"MITÚ",Codigo:"001"},{municipio:"PACOA",Codigo:"511"},{municipio:"PAPUNAUA",Codigo:"777"},{municipio:"TARAIRA",Codigo:"666"},{municipio:"YAVARATÉ",Codigo:"889"}],Putumayo:[{municipio:"COLÓN",Codigo:"219"},{municipio:"MOCOA",Codigo:"001"},{municipio:"ORITO",Codigo:"320"},{municipio:"PUERTO ASÍS",Codigo:"568"},{municipio:"PUERTO CAICEDO",Codigo:"569"},{municipio:"PUERTO GUZMÁN",Codigo:"571"},{municipio:"PUERTO LEGUÍZAMO",Codigo:"573"},{municipio:"SAN FRANCISCO",Codigo:"755"},{municipio:"SAN MIGUEL",Codigo:"757"},{municipio:"SANTIAGO",Codigo:"760"},{municipio:"SIBUNDOY",Codigo:"749"},{municipio:"VALLE DEL GUAMUEZ",Codigo:"865"},{municipio:"VILLAGARZÓN",Codigo:"885"}],Vichada:[{municipio:"CUMARIBO",Codigo:"773"},{municipio:"LA PRIMAVERA",Codigo:"524"},{municipio:"PUERTO CARREÑO",Codigo:"001"},{municipio:"SANTA ROSALÍA",Codigo:"624"}],Amazonas:[{municipio:"EL ENCANTO",Codigo:"263"},{municipio:"LA CHORRERA",Codigo:"405"},{municipio:"LA PEDRERA",Codigo:"407"},{municipio:"LA VICTORIA",Codigo:"430"},{municipio:"LETICIA",Codigo:"001"},{municipio:"MIRITÍ - PARANÁ",Codigo:"460"},{municipio:"PUERTO ALEGRÍA",Codigo:"530"},{municipio:"PUERTO ARICA",Codigo:"536"},{municipio:"PUERTO NARIÑO",Codigo:"540"},{municipio:"PUERTO SANTANDER",Codigo:"669"},{municipio:"SANTANDER (ARARACUARA) (COR. DEPARTAMENTAL)",Codigo:"999"},{municipio:"TARAPACÁ",Codigo:"798"}],"Archipiélago de San Andrés":[{municipio:"PROVIDENCIA",Codigo:"564"},{municipio:"SAN ANDRÉS",Codigo:"001"},{municipio:"SANTA CATALINA",Codigo:"999"}]},r=null,s="departamento";function c(e,t){let i=document.getElementById(e);i.innerHTML="";for(let e in t){let o=document.createElement("li");o.textContent=e,o.setAttribute("data-value",t[e]),i.appendChild(o)}i.classList.toggle("show")}function d(e,t){let i=document.getElementById(e);if(i.innerHTML="",t.length>0)for(let e=0;e<t.length;e++){let o=document.createElement("li");o.textContent=l(t[e].municipio),o.setAttribute("data-value",t[e].Codigo),i.appendChild(o)}else{let e=document.createElement("li");e.textContent="Seleccione una opción",e.setAttribute("data-value",""),i.appendChild(e)}i.classList.toggle("show")}function l(e){return e.toLowerCase().replace(/(?:^|\s|[-'"])\S/g,(function(e){return e.toUpperCase()}))}function u(e=[],t="",i,o){let n=document.getElementById(t);if(n.innerHTML="",e[r]){let t=Object.entries(e[r]);n.add(new Option("Seleccione una opción"));for(let e=0;e<t.length;e++){let a=t[e][1],r=l(a[o]),s=a[i];n.add(new Option(r,s))}}else n.add(new Option("Seleccione una opción",""))}function m(e,t){for(let[i,o]of Object.entries(e))if(o===t)return i;return null}function p(e,t,i,o){const n={CodigoDepartamento:e,NombreDepartamento:t,CodigoMunicipio:i,NombreMunicipio:o,pais:"170"};localStorage.setItem("Cobertura",JSON.stringify(n))}if("SelectMultiple"===o){!function(e,t){let i=document.getElementById(e),o=Object.entries(t);for(let e=0;e<o.length;
1e++){let t=o[e];i.add(new Option(t[0],t[1]))}}(s,n),u(a,"municipio","municipio","Codigo");document.getElementById(s);let e=document.getElementById("departamento-input"),t=document.getElementById("municipio-input"),i=document.getElementById("municipio"),o=document.getElementById("departamento-options"),g=document.getElementById("municipio-options"),h=document.getElementById("departamento-arrow"),f=document.getElementById("municipio-arrow");h.addEventListener("click",(function(e){e.stopPropagation(),c("departamento-options",n),this.classList.toggle("open"),f.classList.remove("open"),g.classList.remove("show")})),e.addEventListener("click",(function(){c("departamento-options",n),h.classList.toggle("open")})),t.addEventListener("click",(function(e){e.stopPropagation(),f.classList.toggle("open"),d("municipio-options",a[r]?a[r]:[])})),f.addEventListener("click",(function(e){e.stopPropagation(),d("municipio-options",a[r]?a[r]:[]),this.classList.toggle("open")})),e.addEventListener("input",(function(){let e=this.value.toLowerCase();o.classList.add("show"),o.innerHTML="";for(let t in n)if(t.toLowerCase().includes(e)){let e=document.createElement("li");e.textContent=t,e.setAttribute("data-value",n[t]),o.appendChild(e)}})),o.addEventListener("click",(function(s){if(s.target&&"LI"===s.target.nodeName){e.value=s.target.textContent,e.setAttribute("current_depart",s.target.textContent),e.setAttribute("current_code",s.target.getAttribute("data-value")),h.classList.remove("open"),o.classList.remove("show");let c=m(n,s.target.getAttribute("data-value"));r=c,t.value="",a[r]?u(a,"municipio","Codigo","municipio"):(i.innerHTML="",i.add(new Option("Seleccione una opción",""))),console.log(s.target.getAttribute("data-value"),c,"",""),p(s.target.getAttribute("data-value"),c,"","")}})),t.addEventListener("input",(function(){let e=this.value.toLowerCase();if(g.classList.add("show"),g.innerHTML="",a[r]){let t=Object.entries(a[r]);for(let i=0;i<t.length;i++){let o=t[i][1],n=l(o.municipio);if(n.toLowerCase().includes(e)){let e=document.createElement("li");e.textContent=n,e.setAttribute("data-value",o.Codigo),g.appendChild(e)}}}else{let e=document.createElement("li");e.textContent="Seleccione una opción",e.setAttribute("data-value",""),g.appendChild(e)}})),g.addEventListener("click",(function(e){if(e.target&&"LI"===e.target.nodeName){t.value=e.target.textContent,f.classList.remove("open"),g.classList.remove("show");let i=e.target.getAttribute("data-value"),o=e.target.textContent,n=JSON.parse(localStorage.getItem("Cobertura"))||{},a=n.CodigoDepartamento||e.target.closest(".selectOption").querySelector("#select-container #searchable-departamento .dropdown-container #departamento-input").getAttribute("current_code")||"",r=n.NombreDepartamento||e.target.closest(".selectOption").querySelector("#select-container #searchable-departamento .dropdown-container #departamento-input").getAttribute("current_depart")||"";console.log(a,r,i,o),p(a,r,i,o)}})),document.addEventListener("click",(function(i){e.contains(i.target)||o.contains(i.target)||(o.classList.remove("show"),h.classList.remove("open")),t.contains(i.target)||g.contains(i.target)||(g.classList.remove("show"),f.classList.remove("open"))}))}if("Selectsimple"===o){let e=document.getElementById("departamento-input"),t=document.getElementById("departamento-options"),i=document.getElementById("departamento-arrow");e.addEventListener("click",(function(){c("departamento-options",n),i.classList.toggle("open")})),i.addEventListener("click",(function(e){e.stopPropagation(),c("departamento-options",n),this.classList.toggle("open")})),e.addEventListener("input",(function(){let e=this.value.toLowerCase();t.classList.add("show"),t.innerHTML="";for(let i in n)if(i.toLowerCase().includes(e)){let e=document.createElement("li");e.textContent=i,e.setAttribute("data-value",n[i]),t.appendChild(e)}})),t.addEventListener("click",(function(o){if(o.target&&"LI"===o.target.nodeName){e.value=o.target.textContent,t.classList.remove("show"),i.classList.remove("open");let a=m(n,o.target.getAttribute("data-value"));r=a,function(e,t){const i={codigoRedSocial:e,nombreRedSocial:t};localStorage.setItem("itemRedSocial",JSON.stringify(i))}(o.target.getAttribute("data-value"),a)}})),document.addEventListener("click",(function(o){e.contains(o.target)||t.contains(o.target)||(t.classList.remove("show"),i.classList.remove("open"))}))}!function(){let e=localStorage.getItem("Cobertura"),t=document.getElementById("epmatupuerta-location"),i=localStorage.getItem("current_sku");null!==i&&0!==i.length&&null!==e&&JSON.parse(e)&&JSON.parse(e).CodigoDepartamento&&JSON.parse(e).CodigoMunicipio&&JSON.parse(e).NombreDepartamento&&JSON.parse(e).NombreMunicipio&&JSON.parse(e).pais&&""!==JSON.parse(e).CodigoDepartamento&&""!==JSON.parse(e).CodigoMunicipio&&""!==JSON.parse(e).NombreDepartamento&&""!==JSON.parse(e).NombreMunicipio&&""!==JSON.parse(e).pais||(localStorage.removeItem("Cobertura"),localStorage.removeItem("current_sku"),t.style.display="none")}()}))}()},976:function(){window.addEventListener("load",(()=>{const e=document.createDocumentFragment();if(!document.querySelector("#summary-cart-plantilla"))return;const t=document.querySelector("#summary-cart-plantilla").content,i=document.querySelector(".itemcart_details--wrapper");if(!document.querySelector(".itemcart_list-container-summary"))return;let o=document.querySelector(".itemcart_list-container-summary").getAttribute("data-source"),n=JSON.parse(localStorage.getItem(o))||[];const a=document.querySelector(".itemscart__cta--emptycart"),r=document.querySelector(".itemcart_price--value-total");function s(o){o.map((i=>{const o=t.cloneNode(!0);"Asistencia"!==i.servicio?(o.querySelector(".itemcart_details--item .itemcart_details-place").textContent=i.lugar_fuga?i.lugar_fuga:i.tipo_electrodomestico+" - "+i.marca,o.querySelector(".itemcart_details--item .itemcart_details-date .
1itemcart_details-datetime").textContent=i.diaVisita||"",o.querySelector(".itemcart_details--item .itemcart_details-work .itemcart_details-jornada").textContent=i.jornada):(o.querySelector(".itemcart_details--item .itemcart_details-date").style.display="none",o.querySelector(".itemcart_details--item .itemcart_details-work").style.display="none"),o.querySelector(".itemcart_details--item .itemcart_details-subtitle").textContent=i.servicio||"",o.querySelector(".itemcart_details--item .itemcart_price--detail .itemcart_price--description").textContent="Asistencia"===i.servicio?i.name:"Visita de diagnóstico",o.querySelector(".itemcart_details--item .itemcart_price--detail .itemcart_price--value").textContent=d(i.price)+" *",e.appendChild(o)})),i.innerHTML="",i.appendChild(e)}function c(e){let t=0;return e.map((e=>{t+=e.price})),t}function d(e){var t=Number(e).toFixed(0).split(".");return t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,"."),t.join(",")}var l;null!=(l=a)&&""!=l&&a.addEventListener("click",(e=>{localStorage.removeItem("Cobertura"),localStorage.removeItem("ServicioID"),null!==localStorage.getItem("idCart")&&localStorage.removeItem("idCart"),document.querySelector("#epmatupuerta-location").innerHTML="";const t=new CustomEvent("emptyCart",{detail:{itemsFromCart:[]}});document.dispatchEvent(t),window.location.href="/epmatupuerta.html"})),document.addEventListener("deleteItemCart",(e=>{let t=e.detail.itemsFiltered;s(t);let i=c(t);r.textContent=`$ ${d(i)} *`})),s(n);let u=c(n);r.textContent=`$ ${d(u)} *`,document.addEventListener("emptyCart",(e=>{let t=e.detail.itemsFromCart;localStorage.removeItem(o),r.textContent="$ 0",s(t)})),document.addEventListener("editItemCart",(e=>{let t=e.detail.itemsEdited;s(t);let i=c(t);r.textContent=`$ ${d(i)} *`}))}))},513:function(){!function(){"use strict";if(window.addEventListener("load",(function(e){document.querySelectorAll(".cmp-tabs__tablist").forEach((e=>{const t=()=>{Array.from(e.children).forEach((e=>{e.setAttribute("tabindex","0")}))};t(),Array.from(e.children).forEach(((e,i)=>{e.addEventListener("keydown",(i=>{"Enter"!==i.key&&" "!==i.key||(e.click(),t())})),e.addEventListener("click",(e=>{t()}))}))}))})),document.querySelectorAll(".tabs").length>0&&screen.width>476)return;let e,t,i;function o(e,t){document.getElementsByClassName("cmp-tabs_button")[t].innerHTML=e.target.innerHTML,n(t)}function n(e){document.getElementsByClassName("cmp-tabs__tablist")[parseInt(e)].classList.toggle("show");console.log("button: ",document.getElementsByClassName("cmp-tabs_button")[parseInt(e)]),document.getElementsByClassName("cmp-tabs_button")[parseInt(e)].classList.toggle("upStroke")}window.addEventListener("load",(function(a){try{let a=document.querySelector(".footer-green"),r=document.querySelectorAll(".tabs");for(let i=0;i<r.length;i++){r[i].querySelector(".cmp-tabs");e=document.createElement("div"),e.className="cmp_div-tabs_button",t=document.createElement("a"),t.id=`${i}`,t.className="cmp-tabs_button",t.innerHTML="Selecciona una opción",t.addEventListener("click",(e=>{n(e.target.id)})),e.appendChild(t),r[i].appendChild(e)}a&&function(e){let t=e.querySelectorAll(".tabs");for(let e=0;e<t.length;e++){let i=t[e].getElementsByClassName("cmp-tabs_button")[0],o=t[e].getElementsByClassName("cmp-tabs__tabpanel")[0],n=t[e].querySelector(".cmp-tabs__tab").innerHTML;i.innerHTML=n,i.addEventListener("click",(()=>{o.classList.toggle("show")}))}}(a),i=document.getElementsByClassName("cmp-tabs__tablist");for(let e=0;e<i.length;e++)for(let t=0;t<i[e].getElementsByClassName("cmp-tabs__tab").length;t++)i[e].getElementsByClassName("cmp-tabs__tab")[t].addEventListener("click",(t=>{o(t,e)}),!1)}catch(e){console.error("Error: ",e)}}))}()},694:function(){!function(){"use strict";window.addEventListener("load",(function(e){document.querySelectorAll(".carousel.thumbnail .cmp-carousel").forEach((e=>{const t=e.querySelector(".cmp-carousel__content"),i=Array.from(t.querySelectorAll(".cmp-carousel__item")),o=document.createElement("div");o.classList.add("cmp-carousel__thumbnails"),i.forEach(((t,i)=>{const n=function(e){const t=e.querySelector(".embed iframe");
1if(t)return{src:"https://img.youtube.com/vi/"+new URL(t.getAttribute("src")).pathname.replace("/embed/","")+"/maxresdefault.jpg",title:t.getAttribute("title"),alt:t.getAttribute("alt"),ariaLabel:t.getAttribute("aria-label")};const i=e.querySelector(".image img");return i?{src:i.getAttribute("src"),title:i.getAttribute("title"),alt:i.getAttribute("alt")}:null}(t);let a="";if(!n)return;a=n.alt?n.alt:n.ariaLabel;const r=document.createElement("img");r.setAttribute("src",n.src),r.setAttribute("title",a),r.setAttribute("alt",a);const s=document.createElement("a");s.setAttribute("dataId","cmp-thumbnail__cta"),s.setAttribute("title",n.title),s.classList.add("thumb"),s.appendChild(r),s.addEventListener("click",(t=>{const o=e.querySelectorAll(".cmp-carousel__indicator");if(o&&o.length>0){const e=o[i];e&&e.dispatchEvent(new Event("click"))}})),o.appendChild(s)}));const n=e.querySelector(".cmp-carousel__indicators");e.querySelector(".cmp-carousel__content").insertBefore(o,n)}))}))}()},322:function(){!function(){"use strict";window.addEventListener("load",(function(e){const t=document.querySelectorAll(".toggle-container");t&&t.forEach((function(e){e.querySelector(".toggle-button").addEventListener("click",(function(){e.classList.toggle("active")}))}))}))}()},838:function(){class e{constructor(){this.toolTips=document.querySelectorAll(".tooltipComponent"),this.toolTips.length&&this.init()}init(){this.positionElement()}applyStylesToElement(e,t){Object.assign(e.style,t)}positionElement(){this.toolTips.forEach((e=>{const t=e.querySelector(".cmp-tooltip");if(!t)return;const i=t.parentElement.cloneNode(!0),o=t.getAttribute("data-target-id"),n=document.querySelector(`#${o}`);if(n)if(e.classList.add("hidden"),i.classList.add("tooltip-clone"),n.parentElement.style.position="relative","SELECT"===n.tagName){const e=document.createElement("div"),t=n.parentElement.querySelector("label");if(!t)return;const o=t.cloneNode(!0);t.classList.add("hide"),i.classList.add("options"),e.appendChild(o),e.appendChild(i),this.applyStylesToElement(e,{display:"flex",alignItems:"center",gap:"8px"}),n.parentElement.querySelector(".cmp-form-options__label")?.insertAdjacentElement("beforebegin",e)}else i.classList.add("absolute"),n.parentElement.appendChild(i)}))}}window.addEventListener("load",(()=>{new e}))},523:function(){!function(){"use strict";let e,t,i,o,n,a,r="",s="",c=0,d="",l=[];function u(){try{if(c=0,e[0].setAttribute("value",""),r.length>0)Array.from(s).forEach((function(e){e.remove()})),r.innerHTML=""}catch(e){console.error("Error in function clearData() :",e)}}function m(){try{let t=new XMLHttpRequest;d!==e[0].value&&(d=e[0].value,u(),e[0].value=d);let i=a.getAttribute("datasrc");d=e[0].value;let m=`${i}?fulltext=${d}&resultsOffset=${c}`;c+=10,t.open("GET",m,!0),t.onload=function(){if(setTimeout((function(){}),300),t.status>=200&&t.status<400){let e=JSON.parse(t.responseText);l=l.concat(e),e.length>0&&l.length>0?function(e){try{e.forEach((function(e){let t=document.createElement("li");t.className="cmp-result-li";let i=document.createElement("h5");i.innerHTML=e.title,i.className="cmp-result_item cmp-result_title-id",t.append(i),console.log("element URL: "+e.url);let o=document.createElement("a");o.innerHTML=`${window.origin}${e.url}`,o.href=e.url,o.className="cmp-result_item cmp-result_url-id",t.append(o);const n={weekday:"long",year:"numeric",month:"long",day:"numeric"};let a=new Date(e.lastModified).toLocaleDateString("es-ES",n),r=document.createElement("p");r.innerHTML=`Actualizado ${a}`,r.className="cmp-result_item cmp-result_date-id",t.append(r),void 0!==document.getElementsByClassName("cmp-search__show-results")[0]&&document.getElementsByClassName("cmp-search__show-results")[0].append(t)})),r=document.getElementsByClassName("cmp-result_item"),s=document.getElementsByClassName("cmp-result-ul"),n.innerHTML=`Aproximadamente ${r.length} resultados encontrados.`,o.style.display="flex"}catch(e){console.error("Error in function renderItems() :",e)}}(e):0===e.length&&l.length>0?(n.innerHTML="0 resultados encontrados",o.disabled=!0):n.innerHTML="No se encontraron resultados"}else n.innerHTML="No se encontraron resultados.",console.error("Error en la repuesta del servicio")},t.send()}catch(e){console.error("Error in Function searchResult:() ",e)}}window.addEventListener("load",(function(r){document.querySelector(".cmp-search__container")&&(a=document.querySelector(".cmp-search__form"),e=document.getElementsByClassName("cmp-search__input"),t=document.getElementsByClassName("cmp-search__clear")[0],t.addEventListener("click",u,!1),i=document.getElementsByClassName("cmp-search__button")[0],i.addEventListener("click",m,!1),o=document.querySelector(".cmp-search__more-results"),o.addEventListener("click",m,!1),n=document.getElementsByClassName("cmp_search__info-text")[0],o.style.display="none",e[0].addEventListener("keyup",(function(e){"Enter"===e.code&&m()})),function(){try{let t=window.location.search;if("?wcmmode=disabled"==t)e[0].setAttribute("value",d);else{d="",t=t.split("="),t[1].split("%20").forEach((function(e){d+=e+" "})),e.length>0&&(e[0].setAttribute("value",d),m())}}catch(e){console.error("Error in function setData(): ",e)}}())}))}()}},t={};function i(o){var n=t[o];if(void 0!==n)return n.exports;var a=t[o]={exports:{}};return e[o](a,a.exports,i),a.exports}!function(){"use strict";const e="inversión en infraestructura",t="daños o imprevistos",o="mantenimiento programado",n="conexiones no autorizadas";i(523),i(116),i(768),i(637),i(308),i(883);class a{fecha=null;constructor(){this.c=document.querySelector(".cmp-calendar")}loadScriptJs(e){return new Promise(((t,i)=>{const o=document.createElement("script");o.type="text/javascript",o.src=e,o.onload=t,o.onerror=i,document.head.appendChild(o)}))}getDate(){return a.fecha}getDaysToShow(){return this.c.getAttribute("data-days")}getQuantityRegister(){return this.c.getAttribute("data-qtyregister")}loadScriptCss(e){return new Promise(((t,i)=>{const o=document.createElement("link");o.rel="stylesheet",o.href=e,o.onload=t,o.onerror=i,document.head.appendChild(o)}))}
1showLoader(){const e=this.c?.querySelector(".cmp-calendar--loader");e&&(e.style.display="block")}hideLoader(){const e=this.c?.querySelector(".cmp-calendar--loader");e&&(e.style.display="none")}insertCalendar(e,t={}){const i={...{language:"es-ES",dayNamesMin:["Do","Lu","Ma","Mi","Ju","Vi","Sa"],monthNames:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],onSelect:e=>{a.fecha=e}},...t};$(e).datepicker(i)}insertCalendarWithData(e,t,i={}){const o=t.map((e=>{const t=new Date(e.fecha);return`${t.getUTCFullYear()}-${String(t.getUTCMonth()+1).padStart(2,"0")}-${String(t.getUTCDate()).padStart(2,"0")}`})),n=new Set(o),r={...{language:"es-ES",dayNamesMin:["Do","Lu","Ma","Mi","Ju","Vi","Sa"],monthNames:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],beforeShowDay:e=>{const t=new Date;t.setHours(0,0,0,0);const i=`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`;return e<t?[!1,"Unavailable","No disponible"]:n.has(i)?[!0,"Available","Disponible"]:[!1,"Unavailable","No disponible"]},onSelect:e=>{a.fecha=e,"function"==typeof i.onDateSelected&&i.onDateSelected(e)}},...i};$(e).hasClass("hasDatepicker")&&$(e).datepicker("destroy"),$(e).datepicker(r)}async initializeCalendar(){this.showLoader(),this.hideLoader()}async loadCalendar(){try{this.showLoader(),await this.initializeCalendar(),this.c&&this.insertCalendar(this.c.querySelector(".cmp-calendar--view"))}catch(e){console.log("Error al cargar el calendario",e)}finally{this.hideLoader()}}}function r(e,t,i){if(!e){let e=new Date,t=new Date(e);t.setHours(t.getHours()-5,0,0);let i=t.toISOString().split(".")[0],o=new Date(e);return o.setHours(o.getHours()-4,0,0),{horaInicio:i,horaFin:o.toISOString().split(".")[0]}}const o=e.filter((e=>e.fecha===t)),n=o[0].disponibilidad.map((e=>({...e,isValid:"Mañana"===i?e.horaInicio>="08:00:00"&&e.horaInicio<="11:00:00":e.horaInicio>="12:00:00"&&e.horaInicio<="17:00:00"})));let a=t.split("T")[0],r=n.find((e=>e.isValid));return{horaInicio:a+"T"+r.horaInicio,horaFin:a+"T"+r.horaFin}}function s(){let e=JSON.parse(localStorage.getItem("itemsEPM"))||[];return e.length>=1&&e.some((e=>"Asistencia"===e.categoria))}window.addEventListener("load",(()=>{(new a).loadCalendar()})),window.addEventListener("load",(e=>{let t=document.getElementById("modal-garantia-date");const i=new a;let o,n=JSON.parse(localStorage.getItem("pedido")),s=null;var c,d;n&&n.IDServicio&&n.IDRecurso&&(!function(e,t,i,o){document.querySelector(`${e} .cmp-calendar--view`).innerHTML="",l(t,i).then((t=>{if(null!==document.querySelector(e).querySelector(".hasDatepicker")){const e=document.querySelector(".cmp-calendar--view");o.insertCalendarWithData(e,t,{onDateSelected:e=>{const i=new Date(e).toISOString().split("T")[0],o=t.find((e=>new Date(e.fecha).toISOString().split("T")[0]===i)),n=o?.disponibilidad.find((e=>e.horaInicio>="08:00:00"&&e.horaFin<="12:00:00")),a=o?.disponibilidad.find((e=>e.horaInicio>="13:00:00"&&e.horaFin<="18:00:00")),r=document.getElementById("jornada-manana"),c=document.getElementById("jornada-tarde");r.checked=!1,r.disabled=!n,c.checked=!1,c.disabled=!a,s=e}})}}))}("#calendario-garantia",n.IDServicio,n.IDRecurso,i),c=document.createElement("div"),document.body.appendChild(c),c.setAttribute("id","messages-for-docs"),c.setAttribute("class","hide"),c.innerHTML="<div id='modal-body-files' style='position:absolute;width:387px;background:#fff;border-radius:30px;top:20%;left:50%;transform: translate(-50%, 0);padding:15px'>\n    <div class='container-message'>\n        <div class='button-close' style='text-align:right;'>\n          <span id='delete-file' style='cursor:pointer'>\n            <img src='/content/dam/epm/ecommerce/close_icon.png' style='cursor:pointer' />\n          </span>\n        </div>\n        <div class='message-body'style='text-align:center;'>\n          <img style=\"width:50px; height:50px\" src='/content/dam/epm/ecommerce/bell-notification.png' /><br/>\n          <h3 style='font-size:28px;margin:0;font-weight:86;line-height:37.2px'>Información importante</h3><br/>\n          <p style='font-size:16px;' id='cart-message'></p><br/>\n          <button type='button' id='btn-for-close' style='padding:0.5rem; border-radius:20px;color:#fff;font-size:18px;font-weight:148;background:#36A21D;border:#36A21D;width:120px'>Aceptar</button>\n        </div>\n      </div>\n    </div>",$("#messages-for-docs").css({position:"fixed",background:"rgba(204, 204, 204, 0.5)",inset:"0","z-index":"9000"}),$("#btn-for-close").on("click",(function(){$("#messages-for-docs").addClass("hide")})),$("#delete-file img").on("click",(function(){$("#messages-for-docs").addClass("hide")})),d=document.createElement("div"),document.body.appendChild(d),d.setAttribute("id","loader-div"),d.setAttribute("class","hide"),d.innerHTML="<div id='loader-div-body' style='position:absolute;width:387px;top:20%;left:50%;transform: translate(-50%, 0);padding:15px'><div class='container-loader'><div class='loader-body'style='text-align:center;'><img src='/content/dam/epm/ecommerce/loader3.gif' alt='Cargando...' style='max-width:30%;' /></div></div></div>",$("#loader-div").css({position:"fixed",background:"rgb(255 255 255 / 0.8)",inset:"0","z-index":"10000"}),document.getElementById("form-garantia-finalizar-solicitud").addEventListener("click",(e=>{e.preventDefault(),g()})),t.addEventListener("click",(e=>{e.target.classList.contains("close")&&document.querySelectorAll(".modal-layer").forEach((e=>{e.classList.remove("open"),document.body.style.overflow="auto"}))})));async function l(e,t){const n=new Date,a={crm:{servicioId:e,recursoId:t,cantidadRegistros:Number(i.getQuantityRegister())||100},fechaHoraInicio:n.toISOString().split(".")[0],cantidadDiasAMostrar:Number(i.getDaysToShow())||10};try{i.showLoader();const e=await fetch("/bin/consultaDisponibilidad",{method:"POST",headers:{"Content-Type":"text/plain"},body:JSON.stringify(a)});if(!e.ok){let t=!1;throw localStorage.setItem("responseService",JSON.stringify(t)),new Error("Error en la solicitud "+e.status)}const t=await e.json();return localStorage.getItem("responseService")&&localStorage.removeItem("responseService"),o=t,t}catch(e){console.log(e)}finally{i.hideLoader()}}function u(e){let t=new Date(e);var i=t.getDate(),o=t.getMonth()+1;return i<10&&(i="0"+i),o<10&&(o="0"+o),t.getFullYear().toString()+"-"+o+"-"+i+"T00:00:00+00:00"}function m(){$("#loader-div").addClass("hide")}
1function p(e){$("#cart-message").text(e),$("#messages-for-docs").removeClass("hide")}function g(){let e=function(){let e=document.getElementsByName("jornada"),t="";for(let i=0;i<e.length;i++)if(e[i].checked){t=e[i].value;break}return t}(),t=JSON.parse(localStorage.getItem("formularioGarantia")||[]),i={...n,fechaSeleccionada:s,jornada:e,Observaciones:t.Observaciones,CorreoSolicitante:""!==t.DistinctEmail.trim()?t.DistinctEmail:n.CorreoSolicitante,NombreCompletoSolicitante:""!==t.DistinctNombre.trim()?t.DistinctNombre+" "+t.DistinctApellidos:n.NombreCompletoSolicitante,CelularSolicitante:""!==t.DistinctCelular.trim()?t.DistinctCelular:n.CelularSolicitante};null!==s&&""!==e?(null!==document.querySelector(".modal-calendar-garantia-errormsg")&&document.querySelector(".modal-calendar-garantia-errormsg").remove(),document.querySelector("#modal-garantia-date").querySelector(".modal-layer").classList.remove("open"),$("#loader-div").removeClass("hide"),function(e){var t={Observaciones:e.observacion??"",ContactoAvisar:{Email:e.CorreoSolicitante,IndicativoTelefono:"604",Telefono:"",NumeroIdentificacion:e.NumeroIdentificacionSolicitante,Celular:e.CelularSolicitante,Nombres:e.NombreCompletoSolicitante,TipoIdentificacion:e.TipoIdentificacionSolicitante,NombreCompleto:e.NombreCompletoSolicitante,Apellidos:e.NombreCompletoSolicitante,FormasContacto:{correoElectronico:!0,MensajeDeTexto:!0,WhatsApp:!0,Telefono:!0,Carta:!0}},Productos:[{OrderId:1,NumeroPedidoReferenciaId:e.PedidoID,NumeroPedidoReferencia:e.NumeroPedido,ProductoId:e.IDproducto,ProductoIdGarantia:e.IDProductoGarantia,CodigoProducto:e.CodigoProductoGarantia,PlanFinanciacionPedido:{TipoCobro:0,TipoPago:1,NumeroMaximoCuotas:1},Agendamiento:{ServicioId:e.IDServicio,FechaInicial:r(o,u(e.fechaSeleccionad
1a),e.jornada).horaInicio,FechaFinal:r(o,u(e.fechaSeleccionada),e.jornada).horaFin,TecnicoId:e.IDRecurso}}]},i=JSON.stringify(t),n=JSON.stringify({sistemaOrigen:"E-Commerce",tipoSolicitud:"CrearPedidoGarantia",parametros:i});return console.log(n),fetch("/bin/ejecutarConsumo",{method:"POST",headers:{"Content-type":"text/plain"},body:n}).then((function(e){if(e.ok&&200===e.status)return e.json();throw new Error(`Error en la solicitud: ${e.status} ${e.statusText}`)})).then((function(e){return e})).catch((function(e){throw console.error(e),e}))}(i).then((e=>{if(e.status)return p("En estos momentos no es posible atender tu solicitud. Te invitamos a comunicarte con la línea de atención al cliente (604) 44 44 800");const{error:t,message:i,respuesta:o}=e,n=JSON.parse(o);if(n.Error)return p("En estos momentos no es posible atender tu solicitud. Te invitamos a comunicarte con la línea de atención al cliente (604) 44 44 800"),void m();t||(document.querySelector("#contenedor-form-garantia").style.display="none",document.querySelector("#contenedor-pedido-garantia").style.display="block",document.querySelector("#texto-pedido-garantia .cmp-title__text").textContent=n.ListaPedidos[0].NumeroPedido,localStorage.removeItem("pedido"))})).catch((e=>{console.log(e)})).finally((()=>{m()}))):function(e,t="Por favor valida que hayas brindado la información requerida para tu compra, para poder continuar.",i="afterbegin"){if(null!==document.querySelector(".modal-calendar-garantia-errormsg"))return;let o=`\n            <div class="modal-calendar-garantia-errormsg" style="background-color:#fff;padding:1rem">\n            <div class="errormsg" style="max-width:300px; display:flex;align-items:center;gap:1rem;border-radius:1rem;padding:0.5rem;background-color:#FFE1E1">\n              <img src="/content/dam/epm/ecommerce/info-error-icon.png" alt="icono-info-error">\n              <p style="color:red;margin:0" class="errormsg-text">${t}</p>\n            </div>\n            </div>\n            `;document.getElementById(e).insertAdjacentHTML("afterbegin",o),setTimeout((()=>{$(".modal-calendar-garantia-errormsg").fadeOut("slow"),document.querySelector(".modal-calendar-garantia-errormsg").remove()}),1e4)}("text-title-calendar-garantia")}})),window.addEventListener("load",(async()=>{var e,t,i,o=[],n="itemsEPM",a="",c="",d="",l="",u="",m="",p="",g="",h="",f="",v="",y="",C="",E="",A="";let S=JSON.parse(localStorage.getItem("Cobertura"));var b=document.createElement("link");b.rel="stylesheet",b.href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.9.0/slick.css",document.head.appendChild(b);var w=document.createElement("script");w.type="text/javascript",w.src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.9.0/slick.js",document.head.appendChild(w);var L=document.getElementById("pdp-card-container");function I(e,t="Por favor valida que hayas brindado la información requerida para tu compra, para poder continuar."){const i=document.querySelector(".parent-errormsg");if(i)return i.querySelector(".errormsg-text").textContent=t,void $(".parent-errormsg").show();{let i=`\n\t\t\t\t\t\t\t\t\t<div class="parent-errormsg" style="background-color:#fff;padding:1rem">\n\t\t\t\t\t\t\t\t\t<div class="errormsg" style="display:flex;align-items:center;gap:1rem;border-radius:1rem;padding:0.5rem;background-color:#FFE1E1">\n\t\t\t\t\t\t\t\t\t\t<img src="/content/dam/epm/ecommerce/info-error-icon.png" alt="icono-info-error">\n\t\t\t\t\t\t\t\t\t\t<p style="color:red;margin:0" class="errormsg-text">${t}</p>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t`;document.getElementById(e).insertAdjacentHTML("afterend",i)}}function N(e){return e.sort(((e,t)=>{const i=e.sku.toLowerCase().includes("otro")||e.sku.toLowerCase().includes("no_aplica"),o=t.sku.toLowerCase().includes("otro")||t.sku.toLowerCase().includes("no_aplica");return i&&!o?1:!i&&o?-1:e.sku.localeCompare(t.sku)}))}function M(){const e=document.getElementById("modal-agregar-exitoso");if(e){const t=e.querySelector(".modal-layer");t&&t.classList.add("open")}}function O(){$(".parent-errormsg").hide()}async function T(e,t,i,o,n){const a={crm:{servicioId:e,recursoId:t,cantidadRegistros:Number(i)||100},fechaHoraInicio:o.toISOString().split(".")[0],cantidadDiasAMostrar:Number(n)||10};try{const e=await fetch("/bin/consultaDisponibilidad",{method:"POST",headers:{"Content-Type":"text/plain","CSRF-Token":await R()},body:JSON.stringify(a)});return await e.json()}catch(e){return console.error("Error al consultar disponibilidad:",e),_(),F("En estos momentos no es posible atender tu solicitud. Te invitamos a comunicarte con la línea de atención al cliente (604) 44 44 800"),null}}async function R(){const e=await fetch("/libs/granite/csrf/token.json");return(await e.json()).token}if(X((JSON.parse(localStorage.getItem(n))||[]).length),L&&L.className)if("productsWithAttributes"==L.className){f=document.querySelector(".pdp-data-service").getAttribute("data-servicioidoriente"),y=document.querySelector(".pdp-data-service").getAttribute("data-servicioIdMetropolitano"),v=document.querySelector(".pdp-data-service").getAttribute("data-recursoIdOriente"),C=document.querySelector(".pdp-data-service").getAttribute("data-recursoIdMetropolitano"),E=document.querySelector(".pdp-data-service").getAttribute("data-cantidadRegistros"),A=document.querySelector(".pdp-data-service").getAttribute("data-cantidadDiasAMostrar");var D=S.NombreMunicipio;const e=["Caldas","La Estrella","Sabaneta","Envigado","Itagui","Medellin","Bello","Copacabana","Girardota","Barbosa"];["Rionegro","La Ceja","Marinilla","Guarne","Retiro"].includes(D)?(localStorage.setItem("ServicioID",f),h=f,u=v):e.includes(D)&&(localStorage.setItem("ServicioID",y),h=y,u=C);var q=document.getElementById("pdp-attributes-container").className.split(" ").find((function(e){return e.startsWith("pdp-")}));(async function(e){const t=new FormData;t.append("idSku",e);try{const e=await fetch("/bin/consultaServicioMagento",{method:"POST",headers:{"CSRF-Token":await R()},body:t});return await e.json()}catch(e){return console.error("Error al consultar servicio Magento:",e),_(),F("En estos momentos no es posible atender tu solicitud. Te invitamos a comunicarte con la línea de atención al cliente (604) 44 44 800"),null}})(q?q.split("pdp-")[1]:null).then((e=>{N(e.data.Products.listConfigurables[0].listChilds),N((t=e.data.Products.listConfigurables)[0].listChilds);for(var i=0;i<t.length;i++)$("#pdp-card-container img").attr("src","https://ecommerce.epm.com.co/media/catalog/product"+t[i].image),$("#pdp-card-container h3").text(t[i].name),document.getElementById("pdp-short-description").innerHTML=t[i].short_description,$(".pdp-price").text("Desde: $"+(o=t[i].listChilds[0].price,n=void 0,(n=o.toFixed(0).split("."))[0]=n[0].replace(/\B(?=(\d{3})+(?!\d))/g,"."),n.join(",")+" (IVA incluido)")),t[i].listChilds.length>0&&H(t[i]);var o,n,a=document.createElement("div");a.setAttribute("class","schedule-popup hidden"),a.setAttribute("id","popup-schedule"),document.body.appendChild(a);var r=document.createElement("div");r.setAttribute("class","schedule-body"),r.setAttribute("id","body-schedule"),document.getElementById("popup-schedule").appendChild(r);var s=document.createElement("div");s.setAttribute("class","arrowSchedule"),s.setAttribute("id","arrowSchedule"),r.appendChild(s),s.onclick=x;var d=document.createElement("div");d.setAttribute("class","schedule-header"),d.setAttribute("id","header-schedule"),document.getElementById("body-schedule").appendChild(d);var m=document.createElement("p");m.setAttribute("id","header-schedule-title"),document.getElementById("header-schedule").appendChild(m),m.innerText="Agenda tu visita";var p=document.createElement("p");p.setAttribute("class","schedule-remember"),p.setAttribute("id","title-remember"),document.getElementById("body-schedule").appendChild(p),p.innerText="Recuerda que los campos con asterisco (*) son obligatorios para brindarte un mejor servicio";var g=document.createElement("div");g.setAttribute("id","close-popup-schedule"),g.setAttribute("class","close-popup-btn"),document.getElementById("header-schedule").appendChild(g);var f=document.createElement("img");f.setAttribute("src","/content/dam/epm/ecommerce/schedule-button.png"),f.setAttribute("alt","imagen botón cerrar"),document.getElementById("close-popup-schedule").appendChild(f),f.onclick=function(){V()};var v=document.createElement("div");v.setAttribute("class","schedule-content"),v.setAttribute("id","content-schedule"),document.getElementById("body-schedule").appendChild(v);var y=document.createElement("div");y.setAttribute("class","schedule-container"),y.setAttribute("id","container-schedule"),document.getElementById("content-schedule").appendChild(y);
1var C=document.createElement("div");C.setAttribute("class","schedule-form"),C.setAttribute("id","form-schedule"),C.onclick=Z,document.getElementById("content-schedule").appendChild(C),y.onclick=Y;var S=document.createElement("p");S.setAttribute("id","schedule-text-calendar"),S.setAttribute("class","schedule-text"),document.getElementById("container-schedule").appendChild(S),S.innerText="Selecciona el día para tu visita";var b=document.createElement("div");b.setAttribute("class","calendar-container"),b.setAttribute("id","container-calendar"),document.getElementById("container-schedule").appendChild(b);var w=document.createElement("div");if(w.setAttribute("id","calendar-view"),document.getElementById("container-calendar").appendChild(w),t.some((e=>"Servicio Tecnico"===e.categoria))){var L=document.createElement("div");L.setAttribute("class","brands-container"),L.setAttribute("id","container-brands"),document.getElementById("content-schedule").appendChild(L);var I=document.createElement("div");I.setAttribute("class","brands-content"),I.setAttribute("id","content-brands"),document.getElementById("container-brands").appendChild(I);var M=document.createElement("div");M.setAttribute("class","antiquity-container"),M.setAttribute("id","container-antiquity"),document.getElementById("container-brands").appendChild(M);var O=document.createElement("p");O.setAttribute("class","antiquity-content"),O.setAttribute("id","content-antiquity"),document.getElementById("container-antiquity").appendChild(O),O.innerHTML='Selecciona la antigüedad de tu equipo<span class="obligatorio">*</span>';var R=document.createElement("div");R.setAttribute("class","antiquity-options-container"),document.getElementById("container-antiquity").appendChild(R),[{value:"0-5",label:"0 a 5 años"},{value:"6-10",label:"6 a 10 años"},{value:"10+",label:"Más de 10 años"}].forEach((function(e){var t=document.createElement("label");t.setAttribute("class","antiquity-option");var i=document.createElement("input");i.setAttribute("type","radio"),i.setAttribute("name","antiguedad"),i.setAttribute("value",e.value),i.addEventListener("change",(function(){c=this.value})),t.appendChild(i),t.appendChild(document.createTextNode(e.label)),R.appendChild(t)}));var D=document.createElement("p");D.setAttribute("id","title-text-marcas"),D.setAttribute("tabindex",0),D.setAttribute("class","title-marcas"),document.getElementById("content-brands").appendChild(D),D.innerHTML='Selecciona la marca del producto <span class="obligatorio">*</span>';var q=document.createElement("div");q.setAttribute("id","marcas"),q.setAttribute("class","content-items-marcas"),q.setAttribute("tabindex",0),document.getElementById("content-brands").appendChild(q)}var P=document.createElement("p");P.setAttribute("id","schedule-text-calendar"),P.setAttribute("class","schedule-text"),document.getElementById("container-calendar").appendChild(P),P.innerText="Selecciona la jornada horaria en la que deseas tu visita";var k=document.createElement("div");k.setAttribute("class","calendar-select"),k.setAttribute("id","select-calendar-morning"),document.getElementById("container-calendar").appendChild(k);var B=document.createElement("input");B.setAttribute("id","visit-morning"),B.setAttribute("type","radio"),B.setAttribute("name","jornada"),B.setAttribute("value","Mañana"),B.setAttribute("checked","true");var _=document.createTextNode("Mañana"),F=document.createElement("label");F.appendChild(B),F.appendChild(_),document.getElementById("select-calendar-morning").appendChild(F);var U=document.createElement("div");U.setAttribute("class","calendar-select"),U.setAttribute("id","select-calendar-evening"),document.getElementById("container-calendar").appendChild(U);var j=document.createElement("input");j.setAttribute("id","visit-evening"),j.setAttribute("type","radio"),j.setAttribute("name","jornada"),j.setAttribute("value","tarde");var J=document.createTextNode("Tarde"),G=document.createElement("label");G.appendChild(j),G.appendChild(J),document.getElementById("select-calendar-evening").appendChild(G),document.querySelectorAll('.calendar-select input[type="radio"]').forEach((e=>{e.addEventListener("change",(function(){l=this.checked?this.value:""}))}));var z=document.createElement("div");z.setAttribute("class","calendar-btn-container"),z.setAttribute("id","container-calendar-btn"),document.getElementById("container-schedule").appendChild(z);var Q=document.createElement("a");Q.setAttribute("class","btn-addToCart"),Q.setAttribute("role","button"),Q.setAttribute("tabindex",0),Q.innerText="Agregar Servicio",document.getElementById("container-calendar-btn").appendChild(Q);var W=document.createElement("div");return W.setAttribute("class","btn-cancelar"),W.innerText="Cancelar",document.getElementById("container-calendar-btn").appendChild(W),W.onclick=function(){V()},T(h,u,E,new Date,A)})).then((e=>{if(e.status)return _(),void F("En estos momentos no es posible atender tu solicitud. Te invitamos a comunicarte con la línea de atención al cliente (604) 44 44 800");const t=Array.from(document.querySelectorAll(".btn-addToCart"));return t.length>0&&t.forEach((e=>{e.classList.add("loaded")})),i=e,U(e),e})).catch((e=>{console.error("Error:",e)}))}else{var P=document.getElementById("pdp-single-container").getAttribute("data-idsku").split(",").map((function(e){return e.trim()})),k=P.map((async function(e){const t=new FormData;return t.append("idSku",e),fetch("/bin/consultaServicioMagento",{method:"POST",headers:{"CSRF-Token":await R()},body:t}).then((e=>e.json())).then((e=>e.data.Products.listConfigurables))}));Promise.all(k).then((function(e){e.forEach((function(e,t){var i=document.createElement("div");i.setAttribute("class","cart-single"),document.getElementById("pdp-single-container").appendChild(i);var o=document.createElement("div");o.setAttribute("class","center-single"),i.appendChild(o);var n=document.createElement("img");n.setAttribute("src","https://ecommerce.epm.com.co/media/catalog/product"+e[0].image),n.setAttribute("alt","imagen "+e[0].name),o.appendChild(n);var a,r=document.createElement("p");r.setAttribute("class","productSingle-name"),r.innerText=e[0].name,o.appendChild(r),"Asistencia hogar"==e[0].name?a="backgroundHome":"Asistencia empresa"==e[0].name&&(a="backgroundCompany");var c=document.createElement("div");c.setAttribute("class","price-productSingle "+a),o.appendChild(c);var d=e[0].price,l=document.createElement("p");l.setAttribute("class","productSingle-name"),l.innerText=d.toLocaleStr
1ing("es-CO",{currency:"COP",style:"currency",minimumFractionDigits:0,maximumFractionDigits:0}),c.appendChild(l);var u=document.createTextNode("/Mensual"),m=document.createElement("span");m.appendChild(l),m.appendChild(u),c.appendChild(m);var p=document.createElement("span");p.setAttribute("class","label-iba"),p.innerText="(IVA incluido)",c.appendChild(p);var g=document.createElement("div");g.setAttribute("class","description-productSingle"),g.innerHTML=e[0].short_description,i.appendChild(g);var h=document.createElement("div");h.setAttribute("class","button-productSingle"),i.appendChild(h);let f=document.querySelector(".cmp-singlepdpblock").getAttribute("data-btn-cart-text");var v=document.createElement("a");v.setAttribute("class","btn-addToCart btnSimpleProduct"),v.setAttribute("role","button"),v.setAttribute("data-skuitem",P[t]),v.setAttribute("tabindex",0),v.innerText=f,v.href="/content/epm/ecommerce/carrito.html";let y=document.querySelector(".cmp-singlepdpblock").getAttribute("data-btn-cart-icon"),C=document.querySelector(".cmp-singlepdpblock").getAttribute("data-btn-cart-icon-accessibility");const E=document.createElement("img");E.src=y,E.style.position="absolute",E.style.left="28%",E.style.top="4px",E.alt=C,E.title=C,v.appendChild(E),h.appendChild(v),document.querySelectorAll(".cmp-singlepdpblock").forEach((t=>{t.addEventListener("click",(t=>{t.target.hasAttribute("data-skuitem")&&(t.preventDefault(),t.target.getAttribute("data-skuitem")===e[0].sku&&function(e){if(null===JSON.parse(localStorage.getItem("Cobertura")))document.getElementById("continuar-modal").onclick=function(){B(e)};else{if(s())return;B(e)}}(e[0]))}))}))}))})).catch((function(e){console.error("Error:",e)})),Promise.all(k).then((function(){screen.width<768&&$(document).ready((function(){setTimeout((function(){$("#pdp-single-container").not(".slick-initialized").slick({infinite:!0,arrows:!1,dots:!0,slidesToShow:1,slidesToScroll:1})}),800)}))}))}function x(){let e=document.querySelector(".schedule-content"),t=e.scrollTop;e.scrollHeight,e.clientHeight,t+=200,0!==e.scrollTop&&e.scrollTo({top:t,behavior:"smooth"})}function B(e){let t=JSON.parse(localStorage.getItem("Cobertura"));const s=e.listCoberturas[0].codigo_municipios.split(",");if(e&&e.listCoberturas[0].codigo_departamento===t.CodigoDepartamento&&s.includes(t.CodigoMunicipio)){let t=JSON.parse(localStorage.getItem(n))||[];const{idQueryParam:s,urlParams:g}=Q();if(null!==s){let o=W(s,{...e,servicio:e.categoria,jornada:l,selectedAntiguedad:c,marca:d,tipoElectro:m,recursoIdDisponible:u,servicioIdDisponible:h,descripMarcaOtro:p,diaVisita:a,fecha_inicial:r(i,a+"T00:00:00+00:00",l).horaInicio,fecha_final:r(i,a+"T00:00:00+00:00",l).horaFin,uid:s},t);return localStorage.setItem(n,JSON.stringify(o)),void(d="")}(o=t).push({...e,servicio:e.categoria,jornada:l,selectedAntiguedad:c,marca:d,tipoElectro:m,recursoIdDisponible:u,servicioIdDisponible:h,descripMarcaOtro:p,diaVisita:a,fecha_inicial:r(i,a+"T00:00:00+00:00",l).horaInicio,fecha_final:r(i,a+"T00:00:00+00:00",l).horaFin,uid:Math.random().toString(36).substring(2)}),X(o.length),z(o),d="";const f=document.getElementById("modal-agregar-exitoso");if(f){const e=f.querySelector(".modal-layer");e&&e.classList.add("open")}}}function _(){var e=document.createElement("div");document.body.appendChild(e),e.setAttribute("id","messages-for-docs"),e.setAttribute("class","hide"),e.innerHTML="<div id='modal-body-files' style='position:absolute;width:387px;background:#fff;border-radius:30px;top:20%;left:50%;transform: translate(-50%, 0);padding:15px'>\n\t\t\t<div class='container-message'>\n\t\t\t\t\t<div class='button-close' style='text-align:right;'>\n\t\t\t\t\t\t<span id='delete-file' style='cursor:pointer'>\n\t\t\t\t\t\t\t<img src='/content/dam/epm/ecommerce/close_icon.png' style='cursor:pointer' />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class='message-body'style='text-align:center;'>\n\t\t\t\t\t\t<img style=\"width:50px; height:50px\" src='/content/dam/epm/ecommerce/bell-notification.png' /><br/>\n\t\t\t\t\t\t<h3 style='font-size:28px;margin:0;font-weight:86;line-height:37.2px'>Información importante</h3><br/>\n\t\t\t\t\t\t<p style='font-size:16px;' id='cart-message'></p><br/>\n\t\t\t\t\t\t<button type='button' id='btn-for-close' style='padding:0.5rem; border-radius:20px;color:#fff;font-size:18px;font-weight:148;background:#36A21D;border:#36A21D;width:120px'>Aceptar</button>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>",$("#messages-for-docs").css({position:"fixed",background:"rgba(204, 204, 204, 0.5)",inset:"0","z-index":"9000"}),$("#btn-for-close").on("click",(function(){$("#messages-for-docs").addClass("hide")})),$("#delete-file img").on("click",(function(){$("#messages-for-docs").addClass("hide")}))}
1function F(e){$("#cart-message").text(e),$("#messages-for-docs").removeClass("hide")}function U(e){let t=new Date(e[0].fecha);const i=t.getUTCFullYear(),o=String(t.getUTCMonth()).padStart(2,"0"),n=String(t.getUTCDate()).padStart(2,"0"),r=new Set(e.map((e=>{const t=new Date(e.fecha);return`${t.getUTCFullYear()}-${String(t.getUTCMonth()+1).padStart(2,"0")}-${String(t.getUTCDate()).padStart(2,"0")}`})));$("#calendar-view").datepicker({gotoCurrent:!0,defaultDate:new Date(i,o,n),language:"es-ES",dayNamesMin:["Do","Lu","Ma","Mi","Ju","Vi","Sa"],monthNames:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],beforeShowDay:function(e){const t=new Date;t.setHours(0,0,0,0);const i=`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`;return e<t?[!1,"Unavailable","No disponible"]:r.has(i)?[!0,"Available","Disponible"]:[!1,"Unavailable","No disponible"]},onSelect:function(t,i){const o=$(this).datepicker("getDate");a=o.toISOString().split("T")[0],l="";const n=e.find((e=>new Date(e.fecha).toISOString().split("T")[0]===a));if(n){const e=document.getElementById("select-calendar-morning");e.querySelector("input").checked=!1,e.classList.remove("enabled"),e.querySelector("input").disabled=!0;const t=document.getElementById("select-calendar-evening");t.querySelector("input").checked=!1,t.classList.remove("enabled"),t.querySelector("input").disabled=!0;const i=n.disponibilidad.find((e=>e.horaInicio>="08:00:00"&&e.horaFin<="12:00:00"));i&&(e.classList.add("enabled"),u=i.recursoId,e.querySelector("input").disabled=!1);const o=n.disponibilidad.find((e=>e.horaInicio>="14:00:00"&&e.horaFin<="18:00:00"));o&&(t.classList.add("enabled"),u=o.recursoId,t.querySelector("input").disabled=!1)}}}),$(".ui-datepicker-today a").removeClass("ui-state-active"),$(".Available a").removeClass("ui-state-active")}function H(e){var t,i;$("#sku-section").removeClass("hidden");var o=document.createElement("h4");document.getElementById("sku-section").appendChild(o);let n=document.querySelector(".pdp-data-service").getAttribute("data-btn-cart-text");var a=document.createElement("div");a.setAttribute("id","skucard-block"),a.setAttribute("class","cmp-skucard"),document.getElementById("sku-section").appendChild(a);for(var r=new Set,s=0;s<e.listChilds.length;s++){var c=e.listChilds[s];if("Servicio Tecnico"!=e.categoria||!r.has(c.tipo_electrodomestico)){e.categoria;var d=document.createElement("div");d.setAttribute("class","sku-body"),document.getElementById("skucard-block").appendChild(d);var l=document.createElement("div");l.setAttribute("class","sku-img-cont"),d.appendChild(l),"Reparación Redes Internas"==e.categoria?(t=c.img_lugar_fuga,i=c.lugar_fuga):"Servicio Tecnico"==e.categoria&&(t=c.img_tipo_electro,i=c.tipo_electrodomestico,r.add(c.tipo_electrodomestico));var u=document.createElement("img");u.setAttribute("src","https://ecommerce.epm.com.co/media/attribute/swatch/"+t),u.setAttribute("alt","imagen "+i),l.appendChild(u);var m=document.createElement("p");m.setAttribute("class","sku-name"),m.innerText=i,d.appendChild(m);var p=document.createElement("div");p.setAttribute("class","sku-button-container"),d.appendChild(p);var h=document.createElement("a");h.setAttribute("class","btn-addToCart"),h.setAttribute("role","button"),h.setAttribute("tabindex",0),h.innerText=n,h.onclick=function(t){return function(){if(J(t),t.categoria.includes("Reparación"))return document.getElementById("form-schedule").innerHTML='\n\t\t\t\t\t<div class="form-level" tabindex="0">\n\t\t\t\t\t\t\t<label for="form-level" id="form-level-label" tabindex="0">Por favor, indicanos el piso en el que se encuentra tu vivienda o negocio<span class="required">*</span></label>\n\t\t\t\t\t\t\t<select class="form-level-house" id="form-level-house">\n\t\t\t\t\t\t\t<option value="">Seleccione un piso</option>\n\t\t\t\t\t\t\t\t<option value="-4">Sótano 4</option>\n\t\t\t\t\t\t\t\t<option value="-3">Sótano 3</option>\n\t\t\t\t\t\t\t\t<option value="-2">Sótano 2</option>\n\t\t\t\t\t\t\t\t<option value="-1">Sótano 1</option>\n\t\t\t\t\t\t\t\t<option value="0">0</option>\n\t\t\t\t\t\t\t\t<option value="1">1</option>\n\t\t\t\t\t\t\t\t<option value="2">2</option>\n\t\t\t\t\t\t\t\t<option value="3">3</option>\n\t\t\t\t\t\t\t\t<option value="4">4</option>\n\t\t\t\t\t\t\t\t<option value="5">5</option>\n\t\t\t\t\t\t\t\t<option value="6">6</option>\n\t\t\t\t\t\t\t\t<option value="7">7</option>\n\t\t\t\t\t\t\t\t<option value="8">8</option>\n\t\t\t\t\t\t\t\t<option value="9">9</option>\n\t\t\t\t\t\t\t\t<option value="10">10</option>\n\t\t\t\t\t\t\t\t<option value="11">11</option>\n\t\t\t\t\t\t\t\t<option value="12">12</option>\n\t\t\t\t\t\t\t\t<option value="13">13</option>\n\t\t\t\t\t\t\t\t<option value="14">14</option>\n\t\t\t\t\t\t\t\t<option value="15">15</option>\n\t\t\t\t\t\t\t\t<option value="16">16</option>\n\t\t\t\t\t\t\t\t<option value="17">17</option>\n\t\t\t\t\t\t\t\t<option value="18">18</option>\n\t\t\t\t\t\t\t\t<option value="19">19</option>\n\t\t\t\t\t\t\t\t<option value="20">20</option>\n\t\t\t\t\t\t\t\t<option value="21">21</option>\n\t\t\t\t\t\t\t\t<option value="22">22</option>\n\t\t\t\t\t\t\t\t<option value="23">23</option>\n\t\t\t\t\t\t\t\t<option value="24">24</option>\n\t\t\t\t\t\t\t\t<option value="25">25</option>\n\t\t\t\t\t\t\t\t<option value="26">26</option>\n\t\t\t\t\t\t\t\t<option value="27">27</option>\n\t\t\t\t\t\t\t\t<option value="28">28</option>\n\t\t\t\t\t\t\t\t<option value="29">29</option>\n\t\t\t\t\t\t\t\t<option value="30">30</option>\n\t\t\t\t\t\t\t\t<option value="31">31</option>\n\t\t\t\t\t\t\t\t<option value="32">32</option>\n\t\t\t\t\t\t\t\t<option value="33">33</option>\n\t\t\t\t\t\t\t\t<option value="34">34</option>\n\t\t\t\t\t\t\t\t<option value="35">35</option>\n\t\t\t\t\t\t\t\t<option value="36">36</option>\n\t\t\t\t\t\t\t\t<option value="37">37</option>\n\t\t\t\t\t\t\t\t<option value="38">38</option>\n\t\t\t\t\t\t\t\t<option value="39">39</option>\n\t\t\t\t\t\t\t\t<option value="40">40</option>\n\t\t\t\t\t\t\t</select>\n\t\t\t\t\t</div>\n\t\t\t\t',document.getElementById("form-level-house").addEventListener("change",(function(e){g=e.target.value})),void document.getElementById("form-level-label").focus();j(t,e),document.getElementById("title-text-marcas").focus()}}(c),p.appendChild(h)}}if("Reparación Redes Internas"==e.categoria){$("#sku-section h4").text("Lugares de reparación");var f=document.createElement("div");
1f.setAttribute("id","sku-other-block"),f.setAttribute("class","cmp-pdpaddelement"),document.getElementById("sku-section").appendChild(f);var v=document.createElement("h5");document.getElementById("sku-other-block").appendChild(v),$("#sku-other-block h5").text("En caso de presentarse la fuga en un lugar diferente a los anteriormente mencionados, por favor indicarnos cúal:"),"RRIE_B2BB2C20"===e.sku&&$("#sku-other-block h5").text("Por favor indícanos en caso de creer donde se pueda estar presentando el daño eléctrico");var y=document.createElement("div");y.setAttribute("id","other-input-container"),y.setAttribute("class","pdp-input-container"),document.getElementById("sku-other-block").appendChild(y);var C=document.createElement("input");C.setAttribute("id","pdp-textbox"),C.setAttribute("type","text"),C.setAttribute("placeholder","Escribe el lugar"),document.getElementById("other-input-container").appendChild(C);var E=document.createElement("div");E.setAttribute("id","other-input-btn-container"),E.setAttribute("class","pdp-other-container"),E.setAttribute("align","right"),document.getElementById("sku-other-block").appendChild(E);var A=document.createElement("a");A.setAttribute("class","btn-addToCart other-option"),A.setAttribute("role","button"),A.innerText=n,A.onclick=G,E.appendChild(A)}else"Servicio Tecnico"==e.categoria&&$("#sku-section h4").text("Electrodomésticos y gasodomésticos")}function j(e,t){const i=function(e,t){let i=[];return t.listChilds.forEach((t=>{t.tipo_electrodomestico===e&&"Otro"!==t.marca&&i.push(t)})),localStorage.setItem("brandList",JSON.stringify(i)),i}(e.tipo_electrodomestico,t),o=document.getElementById("marcas");o&&(o.innerHTML="",i.forEach((e=>{var t=function(e){var t=document.createElement("div");if(t.setAttribute("id","container-item-brand"),t.setAttribute("class","container-item-brand"),"No aplica"===e.marca&&t.classList.add("container-item-otro"),e.img_marca&&e.marca){var i=document.createElement("img");i.setAttribute("src","https://ecommerce.epm.com.co/media/attribute/swatch/"+e.img_marca),i.setAttribute("alt","imagen "+e.marca),i.style.width="100%",i.style.height="52px",t.appendChild(i)}else if(e.marca){var o=document.createElement("p");o.setAttribute("class","name-brand-item"),"No aplica"===e.marca&&o.classList.add("marca-otro"),o.textContent=e.marca,t.appendChild(o)}return t.addEventListener("click",(function(){var t=document.getElementById("container-input-otro");t&&t.remove(),document.querySelectorAll(".container-item-brand").forEach((function(e){e.classList.remove("selectedBrand")})),this.classList.add("selectedBrand"),d=e.marca||"",m=e.tipo_electrodomestico,e.price})),t}(e);o.appendChild(t)})),function(e){var t=document.createElement("div");t.setAttribute("id","container-item-otro"),t.setAttribute("class","container-item-otro container-item-brand"),document.getElementById("marcas").appendChild(t);var i=document.createElement("p");i.setAttribute("id","item-otro"),i.setAttribute("class","marca-otro"),i.innerText="Otro",t.appendChild(i),t.addEventListener("click",(function(){var t=document.getElementById("container-input-otro");t&&t.remove(),document.querySelectorAll(".container-item-brand").forEach((function(e){e.classList.remove("selectedBrand")})),this.classList.add("selectedBrand");var i=document.createElement("div");i.setAttribute("id","container-input-otro"),i.setAttribute("class","container-input-otro"),document.getElementById("content-brands").appendChild(i);var o=document.createElement("p");o.setAttribute("class","title-input"),o.innerText="Indica el nombre de la marca de tu producto para instalar",i.appendChild(o);var n=document.createElement("input");n.setAttribute("type","text"),n.setAttribute("id","input-nueva-marca"),n.setAttribute("placeholder","Escribe la marca"),i.appendChild(n);var a=document.createElement("p");a.setAttribute("id","error-mensaje"),a.innerText="Este campo es obligatorio.",i.appendChild(a);var r=e.listChilds.filter((e=>{if("Otro"===e.marca)return e}));r[0].price,m=r[0].tipo_electrodomestico,d=r[0].marca,n.addEventListener("blur",(function(){p=this.value.trim(),a.style.display=""===p?"block":"none"}))}))}(t))}function J(t){if(e=t,$("#popup-schedule").removeClass("hidden"),document.body.style.overflow="hidden",!document.getElementById("calendar-view").classList.contains("hasDatepicker"))return function(){document.getElementById("calendar-view").innerHTML="";const e=document.createElement("img");e.src="/content/dam/epm/ecommerce/loader3.gif",e.alt="spinner",document.getElementById("calendar-view").appendChild(e),T(h,u,E,new Date,A).then((t=>{document.getElementById("calendar-view").classList.remove("hasDatepicker"),e.style.display="none",U(t),localStorage.setItem("dataDisponibilidadEpmatp",JSON.stringify(t))})).catch((e=>{console.log("Ha ocurrido un error  ",e)}))}()}function J(t){e=t,$("#popup-schedule").removeClass("hidden"),document.body.style.overflow="hidden"}function G(){const i=document.getElementById("pdp-textbox").value;if(""===i.trim()){if(!document.getElementById("error-reparacion-interna-energ
1ia")){const e=document.createElement("p");return e.id="error-reparacion-interna-energia",e.innerText="Este campo es obligatorio",e.style.display="block",void document.querySelector("#other-input-container").appendChild(e)}return void(messageError.style.display="block")}let o={...t[0].listChilds.find((e=>e.sku.includes("Otro"))),lugar_fuga:i};e=o,$("#popup-schedule").removeClass("hidden"),document.body.style.overflow="hidden",o.categoria.includes("Reparación")&&(document.getElementById("form-schedule").innerHTML='\n\t\t\t\t\t<div class="form-level" tabindex="0">\n\t\t\t\t\t\t\t<label for="form-level" id="form-level-label" tabindex="0">Por favor, indicanos el piso en el que se encuentra tu vivienda o negocio<span class="required">*</span></label>\n\t\t\t\t\t\t\t<select class="form-level-house" id="form-level-house">\n\t\t\t\t\t\t\t<option value="">Seleccione un piso</option>\n\t\t\t\t\t\t\t\t<option value="-4">Sótano 4</option>\n\t\t\t\t\t\t\t\t<option value="-3">Sótano 3</option>\n\t\t\t\t\t\t\t\t<option value="-2">Sótano 2</option>\n\t\t\t\t\t\t\t\t<option value="-1">Sótano 1</option>\n\t\t\t\t\t\t\t\t<option value="0">0</option>\n\t\t\t\t\t\t\t\t<option value="1">1</option>\n\t\t\t\t\t\t\t\t<option value="2">2</option>\n\t\t\t\t\t\t\t\t<option value="3">3</option>\n\t\t\t\t\t\t\t\t<option value="4">4</option>\n\t\t\t\t\t\t\t\t<option value="5">5</option>\n\t\t\t\t\t\t\t\t<option value="6">6</option>\n\t\t\t\t\t\t\t\t<option value="7">7</option>\n\t\t\t\t\t\t\t\t<option value="8">8</option>\n\t\t\t\t\t\t\t\t<option value="9">9</option>\n\t\t\t\t\t\t\t\t<option value="10">10</option>\n\t\t\t\t\t\t\t\t<option value="11">11</option>\n\t\t\t\t\t\t\t\t<option value="12">12</option>\n\t\t\t\t\t\t\t\t<option value="13">13</option>\n\t\t\t\t\t\t\t\t<option value="14">14</option>\n\t\t\t\t\t\t\t\t<option value="15">15</option>\n\t\t\t\t\t\t\t\t<option value="16">16</option>\n\t\t\t\t\t\t\t\t<option value="17">17</option>\n\t\t\t\t\t\t\t\t<option value="18">18</option>\n\t\t\t\t\t\t\t\t<option value="19">19</option>\n\t\t\t\t\t\t\t\t<option value="20">20</option>\n\t\t\t\t\t\t\t\t<option value="21">21</option>\n\t\t\t\t\t\t\t\t<option value="22">22</option>\n\t\t\t\t\t\t\t\t<option value="23">23</option>\n\t\t\t\t\t\t\t\t<option value="24">24</option>\n\t\t\t\t\t\t\t\t<option value="25">25</option>\n\t\t\t\t\t\t\t\t<option value="26">26</option>\n\t\t\t\t\t\t\t\t<option value="27">27</option>\n\t\t\t\t\t\t\t\t<option value="28">28</option>\n\t\t\t\t\t\t\t\t<option value="29">29</option>\n\t\t\t\t\t\t\t\t<option value="30">30</option>\n\t\t\t\t\t\t\t\t<option value="31">31</option>\n\t\t\t\t\t\t\t\t<option value="32">32</option>\n\t\t\t\t\t\t\t\t<option value="33">33</option>\n\t\t\t\t\t\t\t\t<option value="34">34</option>\n\t\t\t\t\t\t\t\t<option value="35">35</option>\n\t\t\t\t\t\t\t\t<option value="36">36</option>\n\t\t\t\t\t\t\t\t<option value="37">37</option>\n\t\t\t\t\t\t\t\t<option value="38">38</option>\n\t\t\t\t\t\t\t\t<option value="39">39</option>\n\t\t\t\t\t\t\t\t<option value="40">40</option>\n\t\t\t\t\t\t\t</select>\n\t\t\t\t\t</div>\n\t\t\t\t',document.getElementById("form-level-house").addEventListener("change",(function(e){g=e.target.value})),document.getElementById("form-level-label").focus())}function V(){$("#popup-schedule").addClass("hidden"),document.body.style.overflow="auto"}function z(e){localStorage.setItem(n,JSON.stringify(e))}function Z(e){e.target.classList.contains("form-level-house")&&(g=e.target.value)}function Q(){const e=new URLSearchParams(window.location.search);
1return{idQueryParam:e.get("q"),urlParams:e}}function Y(t){if(t.target.parentElement.classList.contains("calendar-btn-container")&&t.target.classList.contains("btn-addToCart")){let t=""!=a&&""!=c&&""!=d&&""!=l;if("Servicio Tecnico"==e.categoria){if(!t)return void I("title-remember");O()}if(e.categoria.includes("Reparación")){if(""==g||""==l||null==l||""==u)return void I("title-remember");O()}const{idQueryParam:s,urlParams:f}=Q();let v=JSON.parse(localStorage.getItem(n))||[];if(null!==s){let t=v.findIndex((e=>e.uid===s)),o={...e,marca:d,selectedAntiguedad:c,piso:g,tipoElectro:m,recursoIdDisponible:u,servicioIdDisponible:h,descripMarcaOtro:p,jornada:l,diaVisita:a,uid:s,fecha_inicial:r(i,a+"T00:00:00+00:00",l).horaInicio,fecha_final:r(i,a+"T00:00:00+00:00",l).horaFin};if(-1!==t){v[t]={...v[t],...o};let e=W(s,o,v);localStorage.setItem(n,JSON.stringify(e)),d="",$("#popup-schedule").addClass("hidden"),document.body.style.overflow="auto";const i="/content/epm/ecommerce/",a="carrito.html";return void(location.href=`${i}${a}`)}}if(o=v,e.categoria.includes("Reparación")){if(e.sku.includes("RRIE_B2BB2C20")){let t={Forma_de_pago:"Contado",Paneles_solares:"No",Tipo_de_Red:"Mixta","Metraje _del_area_de_descargue":0,Disponibilidad_de_acceso:"Si"};return o.push({...e,...t,jornada:l,selectedAntiguedad:c,marca:d,tipoElectro:m,recursoIdDisponible:u,servicioIdDisponible:h,piso:g,descripMarcaOtro:p,diaVisita:a,uid:Math.random().toString(36).substring(2),fecha_inicial:r(i,a+"T00:00:00+00:00",l).horaInicio,fecha_final:r(i,a+"T00:00:00+00:00",l).horaFin}),X(o.length),z(o),d="",g="",$("#popup-schedule").addClass("hidden"),document.body.style.overflow="auto",void M()}if(e.sku.includes("RRIPA_B2BB2C20")||e.sku.includes("RRIIA_B2BB2C20")){let t={Forma_de_pago:"Contado",Antiguedad_de_la_vivienda:0,"Metraje del area de descargue":0,Disponibilidad_de_acceso:"Si"};return o.push({...e,...t,jornada:l,selectedAntiguedad:c,marca:d,tipoElectro:m,recursoIdDisponible:u,servicioIdDisponible:h,piso:g,descripMarcaOtro:p,diaVisita:a,uid:Math.random().toString(36).substring(2),fecha_inicial:r(i,a+"T00:00:00+00:00",l).horaInicio,fecha_final:r(i,a+"T00:00:00+00:00",l).horaFin}),X(o.length),z(o),d="",$("#popup-schedule").addClass("hidden"),document.body.style.overflow="auto",void M()}return}o.push({...e,jornada:l,selectedAntiguedad:c,marca:d,tipoElectro:m,recursoIdDisponible:u,servicioIdDisponible:h,descripMarcaOtro:p,diaVisita:a,uid:Math.random().toString(36).substring(2),fecha_inicial:r(i,a+"T00:00:00+00:00",l).horaInicio,fecha_final:r(i,a+"T00:00:00+00:00",l).horaFin}),X(o.length),z(o),d="",$("#popup-schedule").addClass("hidden"),document.body.style.overflow="auto",M()}}function W(e,t,i){return i.map((i=>i.uid==e?{...i,...t}:i))}function X(e){document.querySelector("#itemscart-container");var t=document.querySelectorAll(".btn-micarrito"),i=document.querySelector("#epmatupuerta-location");t.forEach((t=>{var o=t.querySelector(".itemsCountCart");if(0===e&&o)return t.removeChild(o),localStorage.removeItem("Cobertura"),localStorage.removeItem("ServicioID"),void(i.innerHTML="");o?o.textContent=e:e>0&&((o=document.createElement("div")).setAttribute("class","itemsCountCart"),o.textContent=e,t.appendChild(o))}))}})),window.addEventListener("load",(async()=>{let e=localStorage.getItem("current_sku")||"",t="",i="",o=!1;var n=1e4;const a=localStorage.getItem("Cobertura"),r=localStorage.getItem("itemsEPM"),c=localStorage.getItem("current_sku");g();let d=document.querySelector("#modal-cobertura .modal-layer"),l=document.getElementById("continuar-modal"),u=document.querySelector("#modal-cobertura .modal-layer"),m=(JSON.parse(localStorage.getItem("itemsEPM")),JSON.parse(localStorage.getItem("Cobertura"))||[]);const p=document.getElementById("epmatupuerta-location");function g(){return JSON.parse(localStorage.getItem("Cobertura"))||[]}async function h(e,t){if(e.includes("ASIS"))return s()?(A(),void S("No se puede agregar otro servicio de asistencia, para agregar un servicio de asistencia debes eliminar el ya existente del carrito.")):(f(),v(),u.classList.remove("open"),document.body.style.overflow="auto",E(),void(p&&
1(p.style.display="block")));$("#loader-div").removeClass("hide");const a=await async function(e){const t=new FormData;return localStorage.setItem("current_sku",e),e&&0===e.length&&(e=localStorage.getItem("current_sku")),t.append("idSku",e),fetch("/bin/consultaServicioMagento",{method:"POST",headers:{"CSRF-Token":await y()},body:t}).then((e=>e.json())).then((e=>{i=e.data.Products.listConfigurables[0].listCoberturas[0],e.data.Products.listConfigurables;let t=JSON.parse(localStorage.getItem("Cobertura"))||{};const o=i.codigo_municipios.split(",");return t.CodigoDepartamento===i.codigo_departamento&&o.includes(t.CodigoMunicipio)?{ok:!0,data:e}:{ok:!1,data:null}})).catch((e=>(console.log("Error:",e),!1)))}(e);a.ok?(o?(o=!1,window.location.href="/epmatupuerta/",r&&localStorage.removeItem("itemsEPM")):window.location.href=t,f(),v(),u.classList.remove("open"),document.body.style.overflow="auto",p&&(p.style.display="block"),E()):(v(),function(e="Discúlpanos; este servicio aún no se encuentra disponible en tu municipio, esperamos próximamente llegar a este y otros lugares."){let t=`\n\t\t\t\t\t\t\t\t<div class="parent-errormsg" style="background-color:#fff;padding:1rem">\n\t\t\t\t\t\t\t\t<div class="errormsg" style="display:flex;align-items:center;gap:1rem;border-radius:1rem;padding:0.5rem;background-color:#FFE1E1">\n\t\t\t\t\t\t\t\t\t<img src="/content/dam/epm/ecommerce/info-error-icon.png" alt="icono-info-error">\n\t\t\t\t\t\t\t\t\t<p style="color:red;margin:0" class="errormsg-text">${e}</p>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t`;document.getElementById("select-container").insertAdjacentHTML("beforeend",t),setTimeout((()=>{$(".parent-errormsg").hide()}),n)}(),A(),S("Discúlpanos; este servicio aún no se encuentra disponible en tu municipio, esperamos próximamente llegar a este y otros lugares."),localStorage.removeItem("Cobertura"),localStorage.removeItem("ServicioID"))}function f(e="Se ha agregado un item al carrito"){if(null!==document.querySelector(".addcart-successmsg"))return;let t=`\n              <div tabindex="0" class="addcart-successmsg" style="background-color:#fff;padding:1rem">\n              <div class="errormsg" style="display:flex;align-items:center;gap:1rem;border-radius:1rem;padding:0.5rem;background-color:#CBE9D5">\n                <img src="/content/dam/epm/ecommerce/icon-information-green.svg" alt="icono-info">\n                <p style="color:green;margin:0" class="errormsg-text">${e}</p>\n              </div>\n              </div>\n              `;null!==document.getElementById("pdp-card-container")&&(document.getElementById("pdp-card-container").insertAdjacentHTML("afterbegin",t),document.querySelector(".addcart-successmsg").focus(),setTimeout((()=>{$(".addcart-successmsg").fadeOut("slow"),$(".addcart-successmsg").remove()}),n))}function v(){$("#loader-div").addClass("hide")}async function y(){const e=await fetch("/libs/granite/csrf/token.json");return(await e.json()).token}var C;function E(){document.getElementById("municipio-input").value="",document.getElementById("departamento-input").value=""}function A(){if(null===document.querySelector("#messages-for-docs")){var e=document.createElement("div");document.body.appendChild(e),e.setAttribute("id","messages-for-docs"),e.setAttribute("class","hide"),e.innerHTML="<div id='modal-body-files' style='position:absolute;width:387px;background:#fff;border-radius:30px;top:20%;left:50%;transform: translate(-50%, 0);padding:15px'>\n          <div class='container-message'>\n              <div class='button-close' style='text-align:right;'>\n                <span id='delete-file' style='cursor:pointer'>\n                  <img src='/content/dam/epm/ecommerce/close_icon.png' style='cursor:pointer' />\n                </span>\n              </div>\n              <div class='message-body'style='text-align:center;'>\n                <img style=\"width:50px; height:50px\" src='/content/dam/epm/ecommerce/bell-notification.png' /><br/>\n                <h3 style='font-size:28px;margin:0;font-weight:86;line-height:37.2px'>Información importante</h3><br/>\n                <p style='font-size:16px;' id='cart-message'></p><br/>\n                <button type='button' id='btn-for-close' style='padding:0.5rem; border-radius:20px;color:#fff;font-size:18px;font-weight:148;background:#36A21D;border:#36A21D;width:120px'>Aceptar</button>\n              </div>\n            </div>\n          </div>",$("#messages-for-docs").css({position:"fixed",background:"rgba(204, 204, 204, 0.5)",inset:"0","z-index":"9000"}),$("#btn-for-close").on("click",(function(){$("#messages-for-docs").addClass("hide")})),$("#delete-file img").on("click",(function(){$("#messages-for-docs").addClass("hide")}))}}
1function S(e){$("#cart-message").text(e),$("#messages-for-docs").removeClass("hide")}l&&(l.disabled=!1),document.addEventListener("click",(e=>{if("A"===e.target.tagName&&e.target.href.includes("mis-pedidos")){if(e.preventDefault(),null!==localStorage.getItem("consultapedido"))return void(window.location.href=e.target.href);if(navigator.userAgent.match(/iphone|ipad|ipod|mac/i))return void(window.location.href="/epmatupuerta/consulta-pedidos.html");document.querySelector('[data-cmp-trigger="form-pedidos"]').classList.add("open")}"epmatupuerta-location-change"===e.target.id&&(o=!0,0!==c.length&&c&&(d.classList.add("open"),document.body.style.overflow="hidden"))})),Object.keys(m).length>=1&&p&&(p.classList.remove("cmp-container"),p.style.width="max-content",p.innerHTML="<p style='margin:0; color:#007931'>Usted está comprando para </p>",p.innerHTML+=`<img style='height:20px' src='/content/dam/epm/iconos/ubicacion.svg'/> <a href="#" id="epmatupuerta-location-change" style='color:#007931; cursor: pointer; text-decoration: none'>${m.NombreDepartamento}, ${m.NombreMunicipio}</a>`,p.innerHTML+='<label id="epmatupuerta-location-change-label">Cambiar la ubicación reinicia el carrito de compras. Confirma la ubicación aquí.</label>'),document.querySelectorAll(".cmp-card-description, .cmp-singlepdpblock, .cardFeaturedService").forEach((i=>{i.addEventListener("click",(async i=>{let o=g();if((i.target.hasAttribute("data-skuitem")||i.target.closest("a").hasAttribute("data-skuitem"))&&o.length<1)return i.preventDefault(),E(),u.classList.add("open"),document.body.style.overflow="hidden",function(e="Esta ubicación aplicará para todos los servicios de tu carrito. Para realizar una compra asociada a una ubicación diferente deberás finalizar tu compra o eliminar los servicios que tienes en tu carrito."){if(null!==document.querySelector(".cobertura-successmsg"))return;let t=`\n              <div class="cobertura-successmsg" style="background-color:#fff;padding:1rem">\n              <div class="errormsg" style="display:flex;align-items:center;gap:1rem;border-radius:1rem;padding:0.5rem;background-color:#CBE9D5">\n                <img src="/content/dam/epm/ecommerce/icon-information-green.svg" alt="icono-info">\n                <p style="color:green;margin:0" class="errormsg-text">${e}</p>\n              </div>\n              </div>\n              `;document.getElementById("message-cobertura-green").insertAdjacentHTML("beforeend",t)}(),e=i.target.closest("a").getAttribute("data-skuitem"),localStorage.setItem("current_sku",e),void(t=i.target.closest("a").getAttribute("href"));if((i.target.hasAttribute("data-skuitem")||i.target.closest("a").hasAttribute("data-skuitem"))&&o){if(i.preventDefault(),e=i.target.closest("a").getAttribute("data-skuitem"),localStorage.setItem("current_sku",e),t=i.target.closest("a").getAttribute("href"),await h(e,t),s())return;f()}}))})),l&&l.addEventListener("click",(async i=>{i.preventDefault(),localStorage.setItem("current_sku",e),await h(e,t)})),C=document.createElement("div"),document.body.appendChild(C),C.setAttribute("id","loader-div"),C.setAttribute("class","hide"),C.innerHTML="<div id='loader-div-body' style='position:absolute;width:387px;top:20%;left:50%;transform: translate(-50%, 0);padding:15px'><div class='container-loader'><div class='loader-body'style='text-align:center;'><img src='/content/dam/epm/ecommerce/loader3.gif' alt='Cargando...' style='max-width:30%;' /></div></div></div>",$("#loader-div").css({position:"fixed",background:"rgb(255 255 255 / 0.8)",inset:"0","z-index":"9999"}),document.querySelectorAll("#modal-cobertura .close, #cancelar-modal").forEach((e=>{e.addEventListener("click",(e=>{e.preventDefault(),o?(o=!1,u.classList.remove("open"),document.body.style.overflow="auto",p&&(p.style.display="block")):(p&&(p.style.display="none"),null!==localStorage.getItem("Cobertura")&&localStorage.removeItem("Cobertura"),null!==localStorage.getItem("current_sku")&&localStorage.removeItem("current_sku"),null!==localStorage.getItem("itemsEPM")&&localStorage.removeItem("itemsEPM"),$("#cart-message").text(""),$("#messages-for-docs").addClass("hide"),u.classList.remove("open"),document.body.style.overflow="auto",l.setAttribute("href",""))}))}));const b=document.getElementById("epmatupuerta-location-change");if(b&&(b.addEventListener("mouseover",(e=>{document.getElementById("epmatupuerta-location-change-label").style.display="block"})),b.addEventListener("mouseout",(e=>{document.getElementById("epmatupuerta-location-change-label").style.display="none"})),a&&""!==a&&""!==c&&c&&JSON.parse(a)&&JSON.parse(a).CodigoDepartamento&&JSON.parse(a).CodigoMunicipio&&JSON.parse(a).NombreDepartamento&&JSON.parse(a).NombreMunicipio&&JSON.parse(a).pais)){const e=await async function(e,t){const o=new FormData;return o.append("idSku",t),fetch("/bin/consultaServicioMagento",{method:"POST",headers:{"CSRF-Token":await y()},body:o}).then((e=>e.json())).then((t=>{i=t.data.Products.listConfigurables[0].listCoberturas[0];let o=e;
1const n=i.codigo_municipios.split(",");return o.CodigoDepartamento===i.codigo_departamento&&n.includes(o.CodigoMunicipio)?{ok:!0,data:t}:{ok:!1,data:null}})).catch((e=>(console.log("Error:",e),!1)))}(JSON.parse(a),c);e.ok?(u.classList.remove("open"),document.body.style.overflow="auto",p&&(p.style.display="block")):(u.classList.add("open"),document.body.style.overflow="hidden",p&&(p.style.display="none"),r&&localStorage.removeItem("itemsEPM"))}}));i(367),i(833);window.addEventListener("load",(()=>{Array.from(document.querySelectorAll(".itemcart-container")).forEach((e=>{const t=e.getAttribute("data-source"),i=document.createDocumentFragment(),o=e.querySelector(".plantilla").content,n=e.querySelector(".itemcart_list-container");e.querySelector(".itemcart_details");let r="",s="",c=null;async function d(e,t,i,o,n){const a={crm:{servicioId:e,recursoId:t,cantidadRegistros:Number(i)||100},fechaHoraInicio:o.toISOString().split(".")[0],cantidadDiasAMostrar:Number(n)||10};try{const e=await fetch("/bin/consultaDisponibilidad",{method:"POST",headers:{"Content-Type":"text/plain","CSRF-Token":await u()},body:JSON.stringify(a)});if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return await e.json()}catch(e){return console.error("Error al consultar disponibilidad:",e),s=document.createElement("div"),document.body.appendChild(s),s.setAttribute("id","messages-for-docs"),s.setAttribute("class","hide"),s.innerHTML="<div id='modal-body-files' style='position:absolute;width:387px;background:#fff;border-radius:30px;top:20%;left:50%;transform: translate(-50%, 0);padding:15px'>\n                <div class='container-message'>\n                        <div class='button-close' style='text-align:right;'>\n                            <span id='delete-file' style='cursor:pointer'>\n                                <img src='/content/dam/epm/ecommerce/close_icon.png' style='cursor:pointer' />\n                            </span>\n                        </div>\n                        <div class='message-body'style='text-align:center;'>\n                            <img style=\"width:50px; height:50px\" src='/content/dam/epm/ecommerce/bell-notification.png' /><br/>\n                            <h3 style='font-size:28px;margin:0;font-weight:86;line-height:37.2px'>Información importante</h3><br/>\n                            <p style='font-size:16px;' id='cart-message'></p><br/>\n                            <button type='button' id='btn-for-close' style='padding:0.5rem; border-radius:20px;color:#fff;font-size:18px;font-weight:148;background:#36A21D;border:#36A21D;width:120px'>Aceptar</button>\n                        </div>\n                    </div>\n                </div>",$("#messages-for-docs").css({position:"fixed",background:"rgba(204, 204, 204, 0.5)",inset:"0","z-index":"9000"}),$("#btn-for-close").on("click",(function(){$("#messages-for-docs").addClass("hide")})),$("#delete-file img").on("click",(function(){$("#messages-for-docs").addClass("hide")})),r="En estos momentos no es posible atender tu solicitud. Te invitamos a comunicarte con la línea de atención al cliente (604) 44 44 800",$("#cart-message").text(r),$("#messages-for-docs").removeClass("hide"),null}var r,s}function l(e){let t=new Date(e);var i=t.getDate(),o=t.getMonth()+1;return i<10&&(i="0"+i),o<10&&(o="0"+o),t.getFullYear().toString()+"-"+o+"-"+i}async function u(){const e=await fetch("/libs/granite/csrf/token.json");return(await e.json()).token}function m(){const e=localStorage.getItem(t);return e?JSON.parse(e):[]}function p(){const e=JSON.parse(localStorage.getItem("itemsEPM"))||[],t=e.length>0&&e.every((e=>e.categoria.trim().toLowerCase().startsWith("asistencia")));document.getElementById("info-carrito-green-disclaimer").style.display=t?"none":"flex"}function g(e){document.querySelector("#itemscart-container");var t=document.querySelectorAll(".btn-micarrito"),i=document.querySelector("#epmatupuerta-location");t.forEach((t=>{var o=t.querySelector(".itemsCountCart");if(0===e&&o)return t.removeChild(o),localStorage.removeItem("Cobertura"),localStorage.removeItem("ServicioID"),void(i.innerHTML="");o?o.textContent=e:e>0&&((o=document.createElement("div")).setAttribute("class","itemsCountCart"),o.textContent=e,t.appendChild(o))}))}async function h(e){let t=m().filter((t=>t.uid===e));c=t[0],document.getElementById("loader-div").classList.remove("hide");const i=await d(c.servicioIdDisponible,c.recursoIdDisponible,100,new Date,20);document.getElementById("loader-div").classList.add("hide");const o=new a;i.length>0&&function(e,t,i){let o=document.querySelector(e);
1if(o&&null!==o.querySelector(".hasDatepicker")){$("hasDatepicker").datepicker("destroy");const e=document.querySelector(".cmp-calendar--view");t.insertCalendarWithData(e,i,{onDateSelected:e=>{r=e}})}}("#calendar-edit-item",o,i);const n=document.getElementById("modal-edit-item"),l=document.getElementById("message-error-modal-edit");l&&(l.style.display="none");const u=document.getElementById("title-marcas-edit"),p=u.querySelector(".cmp-title__text"),g=document.getElementById("edit-marcas"),h=document.getElementById("edit-options-antiguedad"),f=h.querySelector("legend"),v=document.getElementById("edit-dropdown-pisos"),y=v.querySelector("label");return p&&p.setAttribute("data-last-letter","*"),f&&f.setAttribute("data-last-letter","*"),y&&y.setAttribute("data-last-letter","*"),s=c.categoria.toLowerCase(),c.categoria.toLowerCase().includes("servicio")?(v.style.display="none",u.style.display="block",g.style.display="flex",h.style.display="flex",n.querySelector(".modal-layer").classList.add("open"),void g.addEventListener("click",(e=>{const t=e.target.closest(".container-item-brand");t&&(document.querySelectorAll(".container-item-brand.active").forEach((e=>{e.classList.remove("active")})),t.classList.add("active"))}))):t[0].categoria.toLowerCase().includes("reparación")?(v.style.display="block",u.style.display="none",g.style.display="none",h.style.display="none",void n.querySelector(".modal-layer").classList.add("open")):void 0}function f(){const e=m();if(e.length<1)return n.innerHTML="",$(".itemcart_details").addClass("hidden"),n.innerHTML='\n        <div class="cmp-formcart--errormsg ocultar" id="emptyCartMessage" style="background-color:#CBE9D5;border-radius:1rem;width:100%;display:flex;gap:1rem;align-items:center;padding:1rem" >\n            <img src="/content/dam/epm/ecommerce/icon-information-green.svg" alt="icono-info-error">\n            <p style="margin:0" class="cmp-formcart--errormsg-text">Tu carrito quedó sin ningún producto.</p>\n        </div>\n        ',void $("#emptyCartMessage").fadeIn().delay(2500).fadeOut();g(e.length);const t=n.querySelector(".itemcart_list--addotherservice");n.innerHTML="",e.map((e=>{const t=o.cloneNode(!0);e.uid,"Asistencia"===e.categoria?(t.querySelector(".location").style.display="none",t.querySelector(".date-time").style.display="none",t.querySelector(".itemcart_card-actions .itemcart_card--edit").style.display="none",t.querySelector(".asistencia").classList.remove("hide"),t.querySelector(".asistencia-texto").innerHTML=e.description,t.querySelector(".itemcart_detail--place_title-asistencia").innerHTML=e.name,t.querySelector(".itemcart_card--image").src=`https://ecommerce.epm.com.co/media/catalog/product${e.image}`):t.querySelector(".itemcart_card--image").src=`https://ecommerce.epm.com.co/media/attribute/swatch/${e.image}`,t.querySelector(".itemcart_card").dataset.id=e.id,t.querySelector(".itemcart_detail--place_title").innerHTML=e.servicio,e.lugar_fuga?t.querySelectorAll(".itemcart_detail-place_description")[0].innerHTML=e.lugar_fuga:t.querySelectorAll(".itemcart_detail--place_subtitle")[0].style.display="none",e.tipo_electrodomestico?t.querySelectorAll(".itemcart_detail-place_description")[1].innerHTML=e.tipo_electrodomestico:t.querySelectorAll(".itemcart_detail--place_subtitle")[1].style.display="none",e.marca?t.querySelectorAll(".itemcart_detail-place_description")[2].innerHTML=e.marca:t.querySelectorAll(".itemcart_detail--place_subtitle")[2].style.display="none",t.querySelector(".itemcart_detail--datetime").innerHTML=e.diaVisita,t.querySelector(".itemcart_detail--jornada").innerHTML=e.jornada,t.querySelector(".itemcart_card--delete").dataset.delete=e.uid,t.querySelector(".itemcart_card--edit").dataset.edit=e.uid,i.appendChild(t)})),n.appendChild(i),n.appendChild(t)}p(),function(){const e=JSON.parse(localStorage.getItem("brandList"))||[],t=document.getElementById("edit-marcas");if(e.length>0){t.innerHTML="",e.forEach((e=>{const i=document.createElement("div");if(i.id="container-item-brand",i.className="container-item-brand","No aplica"===e.marca){i.classList.add("container-item-otro");const t=document.createElement("p");t.className="marca-otro",t.textContent=e.marca,i.appendChild(t)}else{const t=document.createElement("img");t.src="https://ecommerce.epm.com.co/media/attribute/swatch/"+e.img_marca,t.alt=e.marca,i.appendChild(t)}t.appendChild(i)}));const i=document.createElement("div");
1i.id="container-item-brand",i.className="container-item-brand container-item-otro";const o=document.createElement("p");o.className="marca-otro",o.textContent="Otro",i.appendChild(o),t.appendChild(i)}}(),n.addEventListener("click",(async e=>{if(e.target.classList.contains("itemcart_card--delete"))return function(e){let i=m().filter((t=>t.uid!==e));localStorage.setItem(t,JSON.stringify(i)),g(i.length),f(),0==i.length&&localStorage.removeItem(t);const o=new CustomEvent("deleteItemCart",{detail:{itemsFiltered:i}});document.dispatchEvent(o)}(e.target.dataset.delete),void p();if(e.target.classList.contains("itemcart_card--edit")){const i=e.target.dataset.edit;await h(i);const o=document.getElementById("btn-edit-save-changes"),n=document.getElementById("modal-edit-item"),a=document.getElementById("message-error-modal-edit");o.onclick=function(){a&&(a.style.display="none");let e=!1;if(s.includes("servicio")){const t=document.querySelector("#edit-marcas .container-item-brand.active"),i=document.querySelector('input[name="antiguedad"]:checked'),o=document.querySelector('.checkboxButton input[name="jornada"]:checked');t&&i&&o&&r||(e=!0)}else if(s.includes("reparación")){const t=document.querySelector("#edit-dropdown-pisos select"),i=document.querySelector('.checkboxButton input[name="jornada"]:checked');t&&t.value&&i&&r||(e=!0)}if(e)return void(a&&(a.style.display="flex"));let o="",d="",u="";if(s.includes("servicio")){const e=document.querySelector("#edit-marcas .container-item-brand.active img");o=e?e.alt:"";const t=document.querySelector('input[name="antiguedad"]:checked');d=t?t.value:""}else if(s.includes("reparación")){const e=document.querySelector("#edit-dropdown-pisos select");u=e?e.value:""}const p=document.querySelector('.checkboxButton input[name="jornada"]:checked');let g=p?p.value:"",h="Mañana"===g?`${l(r)}T08:00:00`:`${l(r)}T12:00:00`,v="Tarde"===g?`${l(r)}T13:00:00`:`${l(r)}T09:00:00`,y=c.sku;if(o){const e=y.lastIndexOf("-");-1!==e&&(y=y.substring(0,e+1)+o)}let C={sku:y,marca:o,selectedAntiguedad:d,piso:u,diaVisita:l(r),jornada:g,fecha_inicial:h,fecha_final:v};const E=function(e,t,i){return i.map((i=>i.uid==e?{...i,...t}:i))}(i,C,m());localStorage.setItem(t,JSON.stringify(E));const A=new CustomEvent("editItemCart",{detail:{itemsEdited:m()}});document.dispatchEvent(A),f(),n.querySelector(".modal-layer").classList.remove("open")}}})),f(),document.addEventListener("emptyCart",(e=>{e.detail.itemsFromCart,localStorage.removeItem(t),f()}))}))})),window.addEventListener("load",(()=>{const e=document.getElementsByClassName("cmp-card-pedidos")[0],t=document.getElementById("cards-container"),i=document.getElementById("historico-de-pedidos"),o=document.getElementById("pedidoNoActivo");let n=JSON.parse(localStorage.getItem("consultapedido")),r="",s=document.querySelectorAll(".close-modal-button, .close"),c=document.getElementById("open-agenda"),d=document.getElementById("reprogramarCita"),l=document.getElementById("modal-agenda"),u=document.getElementById("modal-agenda-completada");const m=new a;let p=document.getElementById("open-end-cancelar"),g="",h=document.querySelector("#modal-cancelar-two"),f=document.getElementById("modal-satisfaccion"),v=document.querySelector(".cmp-icontextv2"),y=document.getElementById("message-experience"),C=document.getElementById("send-opinion"),E=document.getElementById("finalizar-agenda"),A="00000000-0000-0000-0000-000000000000",S="00000000-0000-0000-0000-000000000000",b="",w=null,L=null,I=null;async function N(e,t){const i=new Date,o={crm:{servicioId:e,recursoId:t,cantidadRegistros:Number(m.getQuantityRegister())||100},fechaHoraInicio:i.toISOString().split(".")[0],cantidadDiasAMostrar:Number(m.getDaysToShow())||10};try{m.showLoader();const e=await fetch("/bin/consultaDisponibilidad",{method:"POST",headers:{"Content-Type":"text/plain"},body:JSON.stringify(o)});if(!e.ok)throw x(),T("En estos momentos no es posible atender tu solicitud. Te invitamos a comunicarte con la línea de atención al cliente (604) 44 44 800"),new Error("Error en la solicitud "+e.status);return await e.json()}catch(e){console.log(e)}
1finally{m.hideLoader()}}function M(e){null===e.ListaPedidos&&(t.appendChild(o),q(),o.style.display="block"),e.ListaPedidos.forEach((e=>{let o="",n="#",a=[];"Cancelado"===e.Estado&&(o=null),!0===e.AplicaGarantia&&e.IDRecurso!==A&&e.IDServicio!==S&&(o="Solicitar Garantía",r="btn-solicitar-garantia",n="/epmatupuerta/garantia.html",a.push(`<a href="${n}" class="btn approve ${r}" data-id="${e.NumeroPedido}">${o}</a>`)),!0===e.AplicaCancelacion&&e.IDRecurso!==A&&e.IDServicio!==S&&(o="Cancelar Servicio",r="btn-cancelar",a.push(`<button class="btn approve ${r}" data-id="${e.NumeroPedido}">${o}</button>`)),!0===e.AplicaReprogramacion&&e.IDRecurso!==A&&e.IDServicio!==S&&(o="Reprogramar visita",r="btn-reprogramar",a.push(`<button class="btn approve ${r}" data-id="${e.NumeroPedido}">${o}</button>`)),"En cotización vigente"===e.RazonParaElEstado&&e.IDRecurso!==A&&e.IDServicio!==S&&(o="Aceptar cotización",r="btn-aprobar-coti",n="/epmatupuerta/aprobar-cotizacion.html",a.push(`<a href="${n}" class="btn approve ${r}" data-id="${e.NumeroPedido}">${o}</a>`));const s=`\n                    <div class="card">\n                        <div class="card-header">\n                          <h5 class="radicado">N° radicado: </h5>\n                          <span class="radicado">${e.NumeroPedido}</span>\n                        </div>\n                        <div class="card-body">\n                          <div class="card-left">\n                          ${"B2BB2C01"===e.CodigoProducto||"B2BB2C03"===e.CodigoProducto||"B2BB2C06"===e.CodigoProducto||"B2BB2C07"===e.CodigoProducto||"B2BB2C05"===e.CodigoProducto||"B2BB2C02"===e.CodigoProducto?'<div class="container-image">\n                                <img src="/content/dam/epm/ecommerce/servicio-tecnico.png" alt="Servicio Tecnico" class="image">\n                               </div>':"B2BB2C30"===e.CodigoProducto||"B2BB2C29"===e.CodigoProducto||"B2BB2C20"===e.CodigoProducto||"B2BB2C21"===e.CodigoProducto||"B2BB2C23"===e.CodigoProducto||"B2BB2C24"===e.CodigoProducto?'<div class="container-image">\n                                <img src="/content/dam/epm/ecommerce/reparacion-redes-internas.png" alt="Reparacion Redes internas" class="image">\n                               </div>':"B2BB2C45"===e.CodigoProducto?'<div class="container-image">\n                                 <img src="/content/dam/epm/ecommerce/asistencia-hogar.png" alt="Asistencia Hogar" class="image">\n                                </div>':"B2BB2C46"===e.CodigoProducto?'<div class="container-image">\n                                   <img src="/content/dam/epm/ecommerce/asistencia-empresa.png" alt="Asistencia Empresa" class="image">\n                                 </div>':"EPMATP01"===e.CodigoProducto||"EPMATP02"===e.CodigoProducto||"EPMATP03"===e.CodigoProducto||"EPMATP04"===e.CodigoProducto||"B2BB2C31"===e.CodigoProducto||"B2BB2C32"===e.CodigoProducto?'<div class="container-image">\n                                    <img src="/content/dam/epm/ecommerce/logo_garantia.svg" alt="Garantia" class="image">\n                                  </div>':""}\n                          </div>\n                          <div class="card-right">\n                            <div class="content-right">\n                                  <div class="details installation-details">\n                                      <h5><strong>${e.Producto}</strong></h5>\n                                        <div class="container-type-product">\n                                          ${""!==e.Equipo.trim()?`<div><h5 class="title-property">Equipo: </h5> <p class="title-property">${e.Equipo}</p></div>`:""}\n                                          ${""!==e.Marca.trim()?`<div><h5 class="title-property">Marca: </h5><p class="title-property">${e.Marca}</p></div>`:""}\n                                          ${""!==e.LugarDondeSePresentaLaFuga.trim()?`<div><h5 class="title-property">Lugar de fuga: </h5><p class="title-property">${e.LugarDondeSePresentaLaFuga}</p></div>`:""}\n                                          ${""!==e.LugarPrestacionServicio.trim()?`<div><h5 class="title-property">Lugar del daño: </h5><p class="title-property">${e.LugarPrestacionServicio}</p></div>`:""}\n                                          ${""!==e.NumeroRadicado.trim()?`<div><h5 class="title-property">Numero de radicado: </h5><p class="title-property">${e.NumeroRadicado}</p></div>`:""}\n                                          ${""!==e.Placa.trim()?`<div><h5 class="title-property">Placa: </h5><p class="title-property">${e.Placa}</p></div>`:""}\n                                        </div>\n                                  </div>\n                                  <div class="details request-details">\n                                  ${e.Producto.includes("Asistencia")?"":`<div class="container-fechas">\n                                        ${!0===e.AplicaReprogramacion||!0===e.AplicaCancelacion||"EnProceso"===e.RazonParaElEstado?`<h5><strong>Fecha programada de visita</strong></h5>\n                                            <h5 class="title-property">Fecha: </h5><p class="title-property">${e.FechaAgenda.split("T")[0]}</p>`:"En cotización vigente"===e.RazonParaElEstado?`<h5><strong>Fecha vigencia</strong></h5>\n                                            <h5 class="title-property">Fecha: </h5><p class="title-property">${e.FechaVigencia.split("T")[0]}</p>`:""}\n                                    </div>`}\n                                    ${""!==e.FranjaHoraria.trim()?`<h5 class="title-property">Jornada: </h5><p class="title-property">${e.FranjaHoraria}</p>`:""}\n                                  </div>\n                                  <div class="details date-details">\n                                    <h5><strong>Dirección</strong></h5>\n                                    <p>${e.DireccionFacturacion}</p>\n                                  </div>\n                            </div>\n                            <div class="status-box ${e.RazonParaElEstado.toLowerCase().replace(/\s/g,"")}">\n                              <h5 class="status-label">Estado:</h5>\n                              <p class="status-text">${e.RazonParaElEstado}</p>\n                            </div>\n                            ${"En cotización vigente"===e.RazonParaElEstado?`<div class="quote"> <h2>Valor cotización: <strong>$ ${c=e.ValorCotizacion.split(".")[0],d=c.split("."),d[0]=d[0].replace(/\B(?=(\d{3})+(?!\d))/g,"."),d.join(",")}</strong></h2> </div>`:""}\n                          </div>\n                        </div>\n                        <div class="containers-buttons-pedidos">\n                          <div class="buttons">\n                            ${a.length>0?a.join(""):""}\n                          </div>\n                        </div>\n                    </div>\n                `;var c,d;e.RazonParaElEstado.toLowerCase().includes("completo")||e.RazonParaElEstado.toLowerCase().includes("cancelado")||e.RazonParaElEstado.toLowerCase().includes("anulado")?(i.style.display="flex",i.innerHTML+=s):t.innerHTML+=s})),[{disparador:"btn-reprogramar",modalId:"modal-reprogramar"},{disparador:"btn-cancelar",modalId:"modal-cancelar"}
1].forEach((({disparador:e,modalId:t})=>{const i=document.querySelectorAll(`.${e}`),o=document.getElementById(t);i.forEach((e=>{e.addEventListener("click",(e=>{e.preventDefault(),o.querySelector(".modal-layer").classList.add("open")}))}))})),document.querySelectorAll(".approve").forEach((t=>{t.addEventListener("click",(t=>{const i=t.target.getAttribute("data-id"),o=e.ListaPedidos.find((e=>e.NumeroPedido===i)),n=function(e){let t="";return"B2BB2C01"===e.CodigoProducto||"B2BB2C03"===e.CodigoProducto||"B2BB2C06"===e.CodigoProducto||"B2BB2C07"===e.CodigoProducto||"B2BB2C05"===e.CodigoProducto||"B2BB2C02"===e.CodigoProducto?t="/content/dam/epm/ecommerce/servicio-tecnico.png":"B2BB2C30"===e.CodigoProducto||"B2BB2C29"===e.CodigoProducto||"B2BB2C20"===e.CodigoProducto||"B2BB2C21"===e.CodigoProducto||"B2BB2C23"===e.CodigoProducto||"B2BB2C24"===e.CodigoProducto?t="/content/dam/epm/ecommerce/reparacion-redes-internas.png":"B2BB2C45"===e.CodigoProducto?t="/content/dam/epm/ecommerce/asistencia-hogar.png":"B2BB2C46"===e.CodigoProducto?t=
1"/content/dam/epm/ecommerce/asistencia-empresa.png":("EPMATP01"===e.CodigoProducto||"EPMATP02"===e.CodigoProducto||"EPMATP03"===e.CodigoProducto||"EPMATP04"===e.CodigoProducto||"B2BB2C31"===e.CodigoProducto||"B2BB2C32"===e.CodigoProducto)
1&&(t="/content/dam/epm/ecommerce/logo_garantia.svg"),t}(o);localStorage.setItem("pedido",JSON.stringify({...o,imagen:n}))}))}))}function O(){$("#loader-div").removeClass("hide")}function T(e){$("#cart-message").text(e),$("#messages-for-docs").removeClass("hide")}var R,D;function q(){$("#loader-div").addClass("hide")}function P(e,t){const i=document.getElementById(e);t.forEach((e=>{e.addEventListener("click",(e=>{e.preventDefault(),i.querySelector(".modal-layer").classList.remove("open")}))}))}function k(e,t){const i=document.getElementById(e);t.forEach((e=>{i.contains(e)&&e.addEventListener("click",(e=>{e.preventDefault(),window.location.reload()}))}))}function x(){document.querySelectorAll(".modal-layer").forEach((e=>{e.classList.remove("open"),document.body.style.overflow="auto"}))}function B(e,t="Actualmente se esta presentando un error al cancelar tu pedido. Por favor intenta de nuevo mas tarde o puedes comunicarte a nuestra línea de atención 6044444800."){let i=`\n            <div class="parent-errormsg" style="background-color:#fff;padding:1rem">\n            <div class="errormsg" style="display:flex;align-items:center;gap:1rem;border-radius:1rem;padding:0.5rem;background-color:#FFE1E1">\n              <img src="/content/dam/epm/ecommerce/info-error-icon.png" alt="icono-info-error">\n              <p style="color:red;margin:0" class="errormsg-text">${t}</p>\n            </div>\n            </div>\n            `;document.getElementById(e).insertAdjacentHTML("beforeend",i),setTimeout((()=>{$(".parent-errormsg").hide()}),1e4)}!function(){let t=document.createElement("div");e&&(e.appendChild(t),t.setAttribute("id","loader-div"),t.setAttribute("class","hide"),t.innerHTML="<div id='loader-div-body' style='position:absolute;width:387px;top:20%;left:50%;transform: translate(-50%, 0);padding:15px'><div class='container-loader'><div class='loader-body'style='text-align:center;'><img src='/content/dam/epm/ecommerce/loader3.gif' alt='Cargando...' style='max-width:30%;' /></div></div></div>",$("#loader-div").css({position:"fixed",background:"rgb(255 255 255 / 0.8)",inset:"0","z-index":"10000"}))}(),d.addEventListener("click",(e=>{e.preventDefault(),function(){L="Reagendar Visita";let e=new Date,t=(e.getHours(),e.getHours(),""),i="",o=function(){let e=document.getElementsByName("jornada"),t="";for(let i=0;i<e.length;i++)if(e[i].checked){t=e[i].value;break}return t}();if("Mañana"===o?(t="10:00:00",i="11:00:00"):(t="14:00:00",i="15:00:00"),localStorage.getItem("diaVisita"),""===w||""===o)return void B("message-error-reprogramar","Por favor valida que hayas brindado la información requerida, para poder continuar.");let n=new Date(w).getFullYear(),a=new Date(w).getMonth()+1,r=new Date(w).getDate(),s=`${a}/${r}/${n}`;g=JSON.parse(localStorage.getItem("pedido")),I=g.NumeroPedido,O();const c={JsonEntrada:{FechaReprogramacion:`${s} ${t}`,HoraInicio:t,HoraFin:i,IdRecurso:g.IDRecurso,IdServicio:g.IDServicio,Pedido:g.NumeroPedido,Sistema:"E-commerce",NumeroDocumento:g.NumeroIdentificacionSolicitante,TipoDocumento:g.TipoIdentificacionSolicitante}};fetch("/bin/ejecutar-accion",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)}).then((e=>200!==e.status?(x(),void T("En estos momentos no es posible atender tu solicitud. Te invitamos a comunicarte con la línea de atención al cliente (604) 44 44 800")):e.json())).then((e=>{q();let t=JSON.parse(e.Respuesta.JsonRespuesta),i=t.Success,o=t.MensajeError;if(i)x(),u.querySelector(".modal-layer").classList.add("open"),localStorage.removeItem("pedido");else{if(o.includes("ErrorNegocioFranja-01")||o.includes("ErrorNegocioFranja-02"))return B("message-error-reprogramar","Te comunicamos que la franja horaria en el día seleccionado ya no esta disponible. Por favor revisa las nuevas disponibilidades y selecciona una nueva.");if(o.includes("no se encuentra disponible para reprogramar"))return B("message-error-reprogramar","Te comunicamos que este pedido ya no se encuentra disponible para reprogramar.");if(o.includes("Has superado el numero máximo"))return B("message-error-reprogramar","Has superado el numero máximo de reprogramaciones permitidas.")}})).catch((e=>{q(),console.error("Error al reprogramar cita:",e)}))}()})),c.addEventListener("click",(e=>{e.preventDefault(),x();let t=JSON.parse(localStorage.getItem("pedido"));!function(e,t,i,o){const n=document.querySelector(`${e} .cmp-calendar--view`);n.innerHTML="",N(t,i).then((t=>{null!==document.querySelector(e).querySelector(".hasDatepicker")&&o.insertCalendarWithData(n,t,{onDateSelected:e=>{const i=new Date(e).toISOString().split("T")[0],o=t.find((e=>new Date(e.fecha).toISOString().split("T")[0]===i)),n=o?.disponibilidad.find((e=>e.horaInicio>="08:00:00"&&e.horaFin<="12:00:00")),a=o?.disponibilidad.find((e=>e.horaInicio>="13:00:00"&&e.horaFin<="18:00:00")),r=document.getElementById("jornada-manana"),s=document.getElementById("jornada-tarde");r.checked=!1,r.disabled=!n,s.checked=!1,s.disabled=!a,w=e}})}))}("#calendario-reprogramar-visita",t.IDServicio,t.IDRecurso,m),l.querySelector(".modal-layer").classList.add("open")})),p.addEventListener("click",(e=>{e.preventDefault(),g=JSON.parse(localStorage.getItem("pedido")),L="Cancelar Pedido",I=g.NumeroPedido,O(),fetch("/bin/ejecutar-accion",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({Pedido:g.PedidoID,TipoDocumento:g.TipoIdentificacionSolicitante,NumeroDocumento:g.NumeroIdentificacionSolicitante,Sistema:"E-commerce"})}).then((e=>e.json())).then((e=>{JSON.parse(e.Respuesta.JsonRespuesta).Succeeded?(q(),x(),h.querySelector(".modal-layer").classList.add("open"),document.body.style.overflow="hidden",localStorage.removeItem("pedido")):(q(),B("select-container-cancelar"))})).catch((e=>{console.error("Error:",e),q()}))})),f.addEventListener("click",(e=>{e.preventDefault(),x()})),R=document.createElement("div"),document.body.appendChild(R),R.setAttribute("id","messages-for-docs"),R.setAttribute("class","hide"),R.innerHTML="<div id='modal-body-files' style='position:absolute;width:387px;background:#fff;border-radius:30px;top:20%;left:50%;transform: translate(-50%, 0);padding:15px'>\n            <div class='container-message'>\n                <div class='button-close' style='text-align:right;'>
1\n                  <span id='delete-file' style='cursor:pointer'>\n                    <img src='/content/dam/epm/ecommerce/close_icon.png' style='cursor:pointer' />\n                  </span>\n                </div>\n                <div class='message-body'style='text-align:center;'>\n                  <img style=\"width:50px; height:50px\" src='/content/dam/epm/ecommerce/bell-notification.png' /><br/>\n                  <h3 style='font-size:28px;margin:0;font-weight:86;line-height:37.2px'>Información importante</h3><br/>\n                  <p style='font-size:16px;' id='cart-message'></p><br/>\n                  <button type='button' id='btn-for-close' style='padding:0.5rem; cursor: pointer; border-radius:20px;color:#fff;font-size:18px;font-weight:148;background:#36A21D;border:#36A21D;width:120px'>Aceptar</button>\n                </div>\n              </div>\n            </div>",$("#messages-for-docs").css({position:"fixed",background:"rgba(204, 204, 204, 0.5)",inset:"0","z-index":"10000"}),$("#btn-for-close").on("click",(function(){$("#messages-for-docs").addClass("hide")})),$("#delete-file img").on("click",(function(){$("#messages-for-docs").addClass("hide")})),n?(D=n,O(),fetch("/bin/consultar-pedidos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({numeroIdentificacion:D.numeroIdentificacion,tipoIdentificacion:D.tipoIdentificacion,unidadNegocio:D.unidadNegocio})}).then((e=>200!==e.status?(t.appendChild(o),o.style.display="block",q(),void T("En estos momentos no es posible atender tu solicitud. Te invitamos a comunicarte con la línea de atención al cliente (604) 44 44 800")):e.json())).then((e=>{if(null===e.ListaPedidos)return t.appendChild(o),o.style.display="block",void q();M(e),q()})).catch((e=>{q(),t.appendChild(o),o.style.display="block",T("En estos momentos no es posible atender tu solicitud. Te invitamos a comunicarte con la línea de atención al cliente (604) 44 44 800"),console.log("Error al obtener los pedidos: ",e)}))):null===n&&(t.appendChild(o),o.style.display="block"),P("modal-reprogramar",s),P("modal-cancelar",s),P("modal-cancelar-two",s),k("modal-cancelar-two",s),k("modal-opinion",s),v.addEventListener("click",(e=>{let t=["cmp-icontextv2__item","cmp-icontextv2__image","img-icontextv2","cmp-icontextv2__text"];Array.from(e.target.classList).some((e=>t.includes(e)))&&(document.querySelectorAll(".cmp-icontextv2__item").forEach((e=>{e.classList.remove("selected")})),e.target.closest(".cmp-icontextv2__item").classList.add("selected"),b=e.target.closest(".cmp-icontextv2__item").querySelector(".cmp-icontextv2__text").textContent.trim())})),E.addEventListener("click",(e=>{e.preventDefault();let t=document.getElementById("modal-opinion");x(),t.querySelector(".modal-layer").classList.add("open")})),C.addEventListener("click",(async e=>{e.preventDefault();let t=y.value;if(t.length<2||""===b)return void B("image-modal-satisfaccion","Por favor llene los campos");let i={satisfaccion:b,message:t,flujo:L,numero_pedido_crm:I};O();try{"1"===(await async function(e){const t=await fetch("/bin/api/encuesta-satisfaccion",{method:"POST",headers:{"Content-type":"application/json"},body:JSON.stringify({paso:Number(5),satisfaccion:e.satisfaccion,mejoras:e.message,flujo:e.flujo,numero_pedido_crm:e.numero_pedido_crm})});return await t.json()}(i)).data.createOrderEPMatp.status&&window.location.reload()}catch(e){console.log(e)}finally{q()}}))}));i(661),i(194),i(841),i(668);window.addEventListener("load",(function(){document.querySelectorAll(".cmp-contentfragment__element--reason").forEach((i=>{switch(i.querySelector(".cmp-contentfragment__element-value").textContent.trim().toLowerCase()){case e:i.classList.add("motivo-inversion-infraestructura");break;case t:i.classList.add("motivo-danos-imprevistos");break;case o:i.classList.add("motivo-mantenimiento-programado");break;case n:i.classList.add("motivo-conexiones-no-autorizadas");break;default:i.classList.add("motivo-otro")}}))}));i(539),i(541),i(749);function c(){const e=document.querySelectorAll(".cmp-pagination");0!==e.length&&e.forEach((e=>{if(!e)return;const t="cmp-pagination__number-active",i="cmp-pagination__number";var o=e.querySelector("#first-page-button"),n=e.querySelector("#last-page-button"),a=e.querySelector("#pagination-container"),r=e.querySelector("#page-indicators-list"),s=1,c=a.getAttribute("data-items-per-page-mobile");if(!(a&&r&&o&&n))return void console.warn("cmp-pagination: elementos requeridos ausentes",{paginationContainer:a,indicatorsContainer:r,firstPageButton:o,lastPageButton:n});var d,l,u=window.innerWidth<=768&&null!=c?c:a.getAttribute("data-items-per-page"),m=a.getAttribute("data-list-container-id"),p=a.getAttribute("data-list-item-class"),g=document.getElementById(m),h=Array.from(g?.getElementsByClassName(p)??[]),f=a.getAttribute("data-hide-pagination");function v(o){var n,c,m=(o-1)*parseInt(u),g=m+parseInt(u);s=o,"procedure-card"==p?d="block":null!=h[0]&&null==d&&(d=window.getComputedStyle(h[0]).getPropertyValue("display")),h.forEach((function(e){e.style.display="none"}));for(var v=m;v<g&&v<h.length;v++)h[v].style.display=d;!function(){if(l=Math.ceil(h.length/u),r.textContent="",l>10){var e=function(e,t){const i=[],o=4,n="…",a=(e,t)=>{for(let o=e;o<=t;o++)i.push(o)};e<=3?(a(1,o),i.push(n,t)):e>=t-3?(i.push(1,n),a(t-o,t)):(i.push(1,n),a(e-1,e+2),i.push(n,t));return i}(parseInt(s),l);e.forEach((e=>{var t,i=document.createElement("li");i.classList.add("paginador-btn"),isNaN(e)?(t=document.createElement("span")).textContent=e:t=y(e),i.append(t),r.append(i)}))}else for(let e=1;e<=l;e++){var t=document.createElement("li");t.classList.add("paginador-btn");var i=y(e);t.append(i),r.append(t)}a.style.display="true"==f&&l<=1?"none":"flex"}(),n=e.querySelector("#prev-button"),c=e.querySelector("#next-button"),A(n,1==s,C),A(c,l==s,E),function(){var e=r.getElementsByClassName(i);for(let i=0;i<e.length;i++)e[i].classList.remove(t),s==e[i].textContent&&e[i].classList.add(t)}()}function y(e){var t=document.createElement("button");return t.classList.add(i),t.textContent=e,t.addEventListener("click",(function(){v(this.textContent)})),t}o.addEventListener("click",(()=>v(1))),n.addEventListener("click",(()=>v(l)));const C=()=>{v(parseInt(s)-1)},E=()=>{v(parseInt(s)+1)};function A(e,t,i){t?e.replaceWith(e.cloneNode(!0)):e.addEventListener("click",i)}async function S(e=5e3){let t=document.querySelector(".cmp-page-finder__loader");await new Promise((i=>{setTimeout((()=>{h=Array.from(g.getElementsByClassName(p)),i(),t&&t.classList.add("hide")}),e),t&&t.classList.remove("hide")})),v(1)}function b(e){return null!=e&&""!=e}h.length>0?v(1):"true"==f&&(a.style.display="none"),function(){var e=a.dataset.selectId,t=a.dataset.inputId,i=a.dataset.buttonId;if(b(e)){var o=document.getElementById(e);u=o.options[0].value,S(),o.addEventListener("change",(()=>{u=o.options[o.selectedIndex].value,S()}))}b(t)&&document.getElementById(t).addEventListener("keyup",(e=>{"Enter"==e.key&&S()})),b(i)&&document.getElementById(i).addEventListener("click",S);var n=document.getElementById("cmp-page-finder-btnsearch");b(n)&&n.addEventListener("click",S)}(),e.querySelector("#pagination-container").addEventListener("dataUpdated",(async e=>{await S(e.detail.time),setTimeout((()=>{v(e.detail.page)}),10)}))}))}window.addEventListener("load",c),window.addEventListener("load",(function(e){var t="";function i(e){console.log("click",e);const i=e.querySelector("input");if(!i)return;const o=i.value.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toUpperCase(),n=e.getAttribute("data-min-length-text");if(o.length>0&&o.length<n)return;const a=e.querySelector(".not-found");a.classList.remove("show");const r=e.getAttribute("data-list-container-id"),s=e.getAttribute("data-list-item-selector");let d=0;if(""==t&&(t=a.textContent),"procedure-cards_id"===r&&"procedure-card"===s){const e=document.getElementsByClassName("procedure-cards-container")[0].querySelectorAll("div[id-tramite]");for(let t=0;t<e.length;t++){const i=e[t].getElementsByClassName("card-title")[0].textContent.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toUpperCase(),n=e[t].getElementsByTagName("p")[0].textContent.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toUpperCase(),a=o.split(" ").join(".*");new RegExp(a).test(n),new RegExp(a).test(i)||new RegExp(a).test(n)?(e[t].style.display="block",e[t].classList.add("procedure-card"),d++):(e[t].style.display="none",e[t].classList.remove("procedure-card"))}c()}const l=document.getElementById(r),u=l.querySelectorAll(s);if("cmp-tabla"===s){const e=l.querySelectorAll(".cmp-tabla table tbody tr");for(let t=1;t<e.length;t++){const i=e[t],n=i.textContent.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toUpperCase(),a=o.split(" ").join(".*");new RegExp(a).test(n)?(i.style.display="",d++):i.style.display="none"}}else u.forEach((e=>{0!==o.length?(e.style.display="none",(e.textContent||e.innerText).toUpperCase().indexOf(o)>-1&&(e.style.display="",d++)):e.style.display=""}));0===d&&("procedure-cards_id"===r&&"procedure-card"===s&&(a.textContent=t+' "'+o.toLowerCase()+'"',c()),a.classList.add("show"))}document.querySelectorAll(".cmp-filter").forEach((e=>{const t=e.querySelector(".cmp-button"),o=e.querySelector("input");t&&o&&(t.addEventListener("click",(t=>{i(e)})),o.addEventListener("input",(function(t){i(e)})),o.addEventListener("keypress",(function(e){"Enter"===e.key&&(e.preventDefault(),t.click())})))}))}));i(90),i(999),i(781),i(173),i(11),i(566),i(732),i(342),i(138),i(19),i(491),i(859),i(426),i(186),i(976),i(513),i(694),i(322),i(838);function d(e){return"number"==typeof e}function l(e){return"string"==typeof e}function u(e){return"boolean"==typeof e}function m(e){return"[object Object]"===Object.prototype.toString.call(e)}function p(e){return Math.abs(e)}function g(e){return Math.sign(e)}function h(e,t){return p(e-t)}function f(e){return A(e).map(Number)}function v(e){return e[y(e)]}function y(e){return Math.max(0,e.length-1)}function C(e,t){return t===y(e)}function E(e,t=0){return Array.from(Array(e),((e,i)=>t+i))}function A(e){return Object.keys(e)}function S(e,t){return[e,t].reduce(((e,t)=>(A(t).forEach((i=>{const o=e[i],n=t[i],a=m(o)&&m(n);e[i]=a?S(o,n):n})),e)),{})}function b(e,t){return void 0!==t.MouseEvent&&e instanceof t.MouseEvent}function w(){let e=[];const t={add:function(i,o,n,a={passive:!0}){let r;if("addEventListener"in i)i.addEventListener(o,n,a),r=()=>i.removeEventListener(o,n,a);else{const e=i;e.addListener(n),r=()=>e.removeListener(n)}return e.push(r),t},clear:function(){e=e.filter((e=>e()))}};return t}function L(e,t,i,o){const n=w(),a=1e3/60;let r=null,s=0,c=0;function d(e){if(!c)return;r||(r=e,i(),i());const n=e-r;for(r=e,s+=n;s>=a;)i(),s-=a;o(s/a),c&&(c=t.requestAnimationFrame(d))}function l(){t.cancelAnimationFrame(c),r=null,s=0,c=0}return{init:function(){n.add(e,"visibilitychange",(()=>{e.hidden&&(r=null,s=0)}))},destroy:function(){l(),n.clear()},start:function(){c||(c=t.requestAnimationFrame(d))},stop:l,update:i,render:o}}function I(e=0,t=0){const i=p(e-t);function o(t){return t<e}function n(e){return e>t}function a(e){return o(e)||n(e)}return{length:i,max:t,min:e,constrain:function(i){return a(i)?o(i)?e:t:i},reachedAny:a,reachedMax:n,reachedMin:o,removeOffset:function(e){return i?e-i*Math.ceil((e-t)/i):e}}}function N(e,t,i){const{constrain:o}=I(0,e),n=e+1;let a=r(t);function r(e){return i?p((n+e)%n):o(e)}function s(){return a}function c(){return N(e,s(),i)}const d={get:s,set:function(e){return a=r(e),d},add:function(e){return c().set(s()+e)},clone:c};return d}function M(e,t,i,o,n,a,r,s,c,d,l,m,f,v,y,C,E,A,S){const{cross:L,direction:N}=e,M=["INPUT","SELECT","TEXTAREA"],O={passive:!1},T=w(),R=w(),D=I(50,225).constrain(v.measure(20)),q={mouse:300,touch:400},P={mouse:500,touch:600},k=y?43:25;let x=!1,B=0,_=0,$=!1,F=!1,U=!1,H=!1;function j(e){if(!b(e,o)&&e.touches.length>=2)return J(e);const t=a.readPoint(e),i=a.readPoint(e,L),r=h(t,B),c=h(i,_);
vendor: 15,063 bytes, line 1
1if(!F&&!H){if(!e.cancelable)return J(e);if(F=r>c,!F)return J(e)}const l=a.pointerMove(e);r>C&&(U=!0),d.useFriction(.3).useDuration(.75),s.start(),n.add(N(l)),e.preventDefault()}function J(e){const t=l.byDistance(0,!1).index!==m.get(),i=a.pointerUp(e)*(y?P:q)[H?"mouse":"touch"],o=function(e,t){const i=m.add(-1*g(e)),o=l.byDistance(e,!y).distance;return y||p(e)<D?o:E&&t?.5*o:l.byIndex(i.get(),0).distance}(N(i),t),n=function(e,t){if(0===e||0===t)return 0;if(p(e)<=p(t))return 0;const i=h(p(e),p(t));return p(i/e)}(i,o),r=k-10*n,s=A+n/50;F=!1,$=!1,R.clear(),d.useDuration(r).useFriction(s),c.distance(o,!y),H=!1,f.emit("pointerUp")}function G(e){U&&(e.stopPropagation(),e.preventDefault(),U=!1)}return{init:function(e){if(!S)return;function s(s){(u(S)||S(e,s))&&function(e){const s=b(e,o);if(H=s,U=y&&s&&!e.buttons&&x,x=h(n.get(),r.get())>=2,s&&0!==e.button)return;if(function(e){const t=e.nodeName||"";return M.includes(t)}(e.target))return;$=!0,a.pointerDown(e),d.useFriction(0).useDuration(0),n.set(r),function(){const e=H?i:t;R.add(e,"touchmove",j,O).add(e,"touchend",J).add(e,"mousemove",j,O).add(e,"mouseup",J)}(),B=a.readPoint(e),_=a.readPoint(e,L),f.emit("pointerDown")}(s)}const c=t;T.add(c,"dragstart",(e=>e.preventDefault()),O).add(c,"touchmove",(()=>{}),O).add(c,"touchend",(()=>{})).add(c,"touchstart",s).add(c,"mousedown",s).add(c,"touchcancel",J).add(c,"contextmenu",J).add(c,"click",G,!0)},destroy:function(){T.clear(),R.clear()},pointerDown:function(){return $}}}function O(e,t){let i,o;function n(e){return e.timeStamp}function a(i,o){const n="client"+("x"===(o||e.scroll)?"X":"Y");return(b(i,t)?i:i.touches[0])[n]}return{pointerDown:function(e){return i=e,o=e,a(e)},pointerMove:function(e){const t=a(e)-a(o),r=n(e)-n(i)>170;return o=e,r&&(i=e),t},pointerUp:function(e){if(!i||!o)return 0;const t=a(o)-a(i),r=n(e)-n(i),s=n(e)-n(o)>170,c=t/r;return r&&!s&&p(c)>.1?c:0},readPoint:a}}function T(e,t,i,o,n,a,r){const s=[e].concat(o);let c,d,l=[],m=!1;function g(e){return n.measureSize(r.measure(e))}return{init:function(n){a&&(d=g(e),l=o.map(g),c=new ResizeObserver((i=>{(u(a)||a(n,i))&&function(i){for(const a of i){if(m)return;const i=a.target===e,r=o.indexOf(a.target),s=i?d:l[r];if(p(g(i?e:o[r])-s)>=.5){n.reInit(),t.emit("resize");break}}}(i)})),i.requestAnimationFrame((()=>{s.forEach((e=>c.observe(e)))})))},destroy:function(){m=!0,c&&c.disconnect()}}}function R(e,t,i,o,n){const a=n.measure(10),r=n.measure(50),s=I(.1,.99);let c=!1;function d(){return!c&&(!!e.reachedAny(i.get())&&!!e.reachedAny(t.get()))}return{shouldConstrain:d,constrain:function(n){if(!d())return;const c=e.reachedMin(t.get())?"min":"max",l=p(e[c]-t.get()),u=i.get()-t.get(),m=s.constrain(l/r);i.subtract(u*m),!n&&p(u)<a&&(i.set(e.constrain(i.get())),o.useDuration(25).useBaseFriction())},toggleActive:function(e){c=!e}}}function D(e,t,i,o){const n=t.min+.1,a=t.max+.1,{reachedMin:r,reachedMax:s}=I(n,a);return{loop:function(t){if(!function(e){return 1===e?s(i.get()):-1===e&&r(i.get())}(t))return;const n=e*(-1*t);o.forEach((e=>e.add(n)))}}}function q(e,t,i,o,n){const{reachedAny:a,removeOffset:r,constrain:s}=o;function c(e){return e.concat().sort(((e,t)=>p(e)-p(t)))[0]}function d(t,o){const n=[t,t+i,t-i];if(!e)return t;if(!o)return c(n);const a=n.filter((e=>g(e)===o));return a.length?c(a):v(n)-i}return{byDistance:function(i,o){const c=n.get()+i,{index:l,distance:u}=function(i){const o=e?r(i):s(i),n=t.map(((e,t)=>({diff:d(e-o,0),index:t}))).sort(((e,t)=>p(e.diff)-p(t.diff))),{index:a}=n[0];return{index:a,distance:o}}(c),m=!e&&a(c);return!o||m?{index:l,distance:i}:{index:l,distance:i+d(t[l]-u,0)}},byIndex:function(e,i){return{index:e,distance:d(t[e]-n.get(),i)}},shortcut:d}}function P(e,t,i,o,n,a,r,s){const c={passive:!0,capture:!0};let l=0;function m(e){"Tab"===e.code&&(l=(new Date).getTime())}return{init:function(p){s&&(a.add(document,"keydown",m,!1),t.forEach(((t,m)=>{a.add(t,"focus",(t=>{(u(s)||s(p,t))&&function(t){if((new Date).getTime()-l>10)return;r.emit("slideFocusStart"),e.scrollLeft=0;const a=i.findIndex((e=>e.includes(t)));d(a)&&(n.useDuration(0),o.index(a,0),r.emit("slideFocus"))}(m)}),c)})))}}}function k(e){let t=e;function i(e){return d(e)?e:e.get()}return{get:function(){return t},set:function(e){t=i(e)},add:function(e){t+=i(e)},subtract:function(e){t-=i(e)}}}function x(e,t){const i="x"===e.scroll?function(e){return`translate3d(${e}px,0px,0px)`}:function(e){return`translate3d(0px,${e}px,0px)`},o=t.style;let n=null,a=!1;return{clear:function(){a||(o.transform="",t.getAttribute("style")||t.removeAttribute("style"))},to:function(t){if(a)return;const r=(s=e.direction(t),Math.round(100*s)/100);var s;r!==n&&(o.transform=i(r),n=r)},toggleActive:function(e){a=!e}}}function B(e,t,i,o,n,a,r,s,c){const d=f(n),l=f(n).reverse(),u=function(){const e=r[0];return g(p(l,e),i,!1)}().concat(function(){const e=t-r[0]-1;return g(p(d,e),-i,!0)}());function m(e,t){return e.reduce(((e,t)=>e-n[t]),t)}function p(e,t){return e.reduce(((e,i)=>m(e,t)>0?e.concat([i]):e),[])}function g(n,r,d){const l=function(e){return a.map(((i,n)=>({start:i-o[n]+.5+e,end:i+t-.5+e})))}(r);return n.map((t=>{const o=d?0:-i,n=d?i:0,a=d?"end":"start",r=l[t][a];return{index:t,loopPoint:r,slideLocation:k(-1),translate:x(e,c[t]),target:()=>s.get()>r?o:n}}))}return{canLoop:function(){return u.every((({index:e})=>m(d.filter((t=>t!==e)),t)<=.1))},clear:function(){u.forEach((e=>e.translate.clear()))},loop:function(){u.forEach((e=>{const{target:t,translate:i,slideLocation:o}=e,n=t();n!==o.get()&&(i.to(n),o.set(n))}))},loopPoints:u}}function _(e,t,i){let o,n=!1;return{init:function(a){i&&(o=new MutationObserver((e=>{n||(u(i)||i(a,e))&&function(e){for(const i of e)if("childList"===i.type){a.reInit(),t.emit("slidesChanged");break}}(e)})),o.observe(e,{childList:!0}))},destroy:function(){o&&o.disconnect(),n=!0}}}function F(e,t,i,o){const n={};let a,r=null,s=null,c=!1;return{init:function(){a=new IntersectionObserver((e=>{c||(e.forEach((e=>{const i=t.indexOf(e.target);n[i]=e})),r=null,s=null,i.emit("slidesInView"))}),{root:e.parentElement,threshold:o}),t.forEach((e=>a.observe(e)))},destroy:function(){a&&a.disconnect(),c=!0},get:function(e=!0){if(e&&r)return r;if(!e&&s)return s;const t=function(e){return A(n).reduce(((t,i)=>{const o=parseInt(i),{isIntersecting:a}=n[o];return(e&&a||!e&&!a)&&t.push(o),t}),[])}(e);return e&&(r=t),e||(s=t),t}}}function U(e,t,i,o,n,a,r,s,c){const{startEdge:l,endEdge:u,direction:m}=e,g=d(i);return{groupSlides:function(e){return g?function(e,t){return f(e).filter((e=>e%t==0)).map((i=>e.slice(i,i+t)))}(e,i):function(e){return e.length?f(e).reduce(((i,d,g)=>{const h=v(i)||0,f=0===h,C=d===y(e),E=n[l]-a[h][l],A=n[l]-a[d][u],S=!o&&f?m(r):0,b=p(A-(!o&&C?m(s):0)-(E+S));return g&&b>t+c&&i.push(d),C&&i.push(e.length),i}),[]).map(((t,i,o)=>{const n=Math.max(o[i-1]||0);return e.slice(n,t)})):[]}(e)}}}function H(e,t,i,o,n,a,r){const{align:s,axis:c,direction:d,startIndex:u,loop:m,duration:A,dragFree:S,dragThreshold:b,inViewThreshold:$,slidesToScroll:H,skipSnaps:j,containScroll:J,watchResize:G,watchSlides:V,watchDrag:z,watchFocus:Z}=a,Q={measure:function(e){const{offsetTop:t,offsetLeft:i,offsetWidth:o,offsetHeight:n}=e;return{top:t,right:i+o,bottom:t+n,left:i,width:o,height:n}}},Y=Q.measure(t),W=i.map(Q.measure),X=function(e,t){const i="rtl"===t,o="y"===e,n=!o&&i?-1:1;return{scroll:o?"y":"x",cross:o?"x":"y",startEdge:o?"top":i?"right":"left",endEdge:o?"bottom":i?"left":"right",measureSize:function(e){const{height:t,width:i}=e;return o?t:i},direction:function(e){return e*n}}}(c,d),K=X.measureSize(Y),ee=function(e){return{measure:function(t){return e*(t/100)}}}(K),te=function(e,t){const i={start:function(){return 0},center:function(e){return o(e)/2},end:o};function o(e){return t-e}return{measure:function(o,n){return l(e)?i[e](o):e(t,o,n)}}}(s,K),ie=!m&&!!J,oe=m||!!J,{slideSizes:ne,slideSizesWithGaps:ae,startGap:re,endGap:se}=function(e,t,i,o,n,a){const{measureSize:r,startEdge:s,endEdge:c}=e,d=i[0]&&n,l=function(){if(!d)return 0;const e=i[0];return p(t[s]-e[s])}(),u=function(){if(!d)return 0;const e=a.getComputedStyle(v(o));return parseFloat(e.getPropertyValue(`margin-${c}`))}(),m=i.map(r),g=i.map(((e,t,i)=>{const o=!t,n=C(i,t);return o?m[t]+l:n?m[t]+u:i[t+1][s]-e[s]})).map(p);return{slideSizes:m,slideSizesWithGaps:g,startGap:l,endGap:u}}(X,Y,W,i,oe,n),ce=U(X,K,H,m,Y,W,re,se,2),{snaps:de,snapsAligned:le}=function(e,t,i,o,n){const{startEdge:a,endEdge:r}=e,{groupSlides:s}=n,c=s(o).map((e=>v(e)[r]-e[0][a])).map(p).map(t.measure),d=o.map((e=>i[a]-e[a])).map((e=>-p(e))),l=s(d).map((e=>e[0])).map(((e,t)=>e+c[t]));return{snaps:d,snapsAligned:l}}(X,te,Y,W,ce),ue=-v(de)+v(ae),{snapsContained:me,scrollContainLimit:pe}=function(e,t,i,o,n){const a=I(-t+e,0),r=i.map(((e,t)=>{const{min:o,max:n}=a,r=a.constrain(e),s=!t,d=C(i,t);return s?n:d||c(o,r)?o:c(n,r)?n:r})).map((e=>parseFloat(e.toFixed(3)))),s=function(){const e=r[0],t=v(r);return I(r.lastIndexOf(e),r.indexOf(t)+1)}();function c(e,t){return h(e,t)<=1}return{snapsContained:function(){if(t<=e+n)return[a.max];if("keepSnaps"===o)return r;const{min:i,max:c}=s;return r.slice(i,c)}(),scrollContainLimit:s}}(K,ue,le,J,2),ge=ie?me:le,{limit:he}=function(e,t,i){const o=t[0];return{limit:I(i?o-e:v(t),o)}}(ue,ge,m),fe=N(y(ge),u,m),ve=fe.clone(),ye=f(i),Ce=L(o,n,(()=>(({dragHandler:e,scrollBody:t,scrollBounds:i,options:{loop:o}})=>{o||i.constrain(e.pointerDown()),t.seek()})(qe)),(e=>(({scrollBody:e,translate:t,location:i,offsetLocation:o,previousLocation:n,scrollLooper:a,slideLooper:r,dragHandler:s,animation:c,eventHandler:d,scrollBounds:l,options:{loop:u}},m)=>{const p=e.settled(),g=!l.shouldConstrain(),h=u?p:p&&g,f=h&&!s.pointerDown();f&&c.stop();const v=i.get()*m+n.get()*(1-m);o.set(v),u&&(a.loop(e.direction()),r.loop()),t.to(o.get()),f&&d.emit("settle"),h||d.emit("scroll")})(qe,e))),Ee=ge[fe.get()],Ae=k(Ee),Se=k(Ee),be=k(Ee),we=k(Ee),Le=function(e,t,i,o,n,a){let r=0,s=0,c=n,d=a,l=e.get(),u=0;function m(e){return c=e,f}function h(e){return d=e,f}const f={direction:function(){return s},duration:function(){return c},velocity:function(){return r},seek:function(){const t=o.get()-e.get();let n=0;return c?(i.set(e),r+=t/c,r*=d,l+=r,e.add(r),n=l-u):(r=0,i.set(o),e.set(o),n=t),s=g(n),u=l,f},settled:function(){return p(o.get()-t.get())<.001},useBaseFriction:function(){return h(a)},useBaseDuration:function(){return m(n)},useFriction:h,useDuration:m};return f}(Ae,be,Se,we,A,.68),Ie=q(m,ge,ue,he,we),Ne=function(e,t,i,o,n,a,r){function s(n){const s=n.distance,c=n.index!==t.get();a.add(s),s&&(o.duration()?e.start():(e.update(),e.render(1),e.update())),c&&(i.set(t.get()),t.set(n.index),r.emit("select"))}return{distance:function(e,t){s(n.byDistance(e,t))},index:function(e,i){const o=t.clone().set(e);s(n.byIndex(o.get(),i))}}}(Ce,fe,ve,Le,Ie,we,r),Me=function(e){const{max:t,length:i}=e;return{get:function(e){return i?(e-t)/-i:0}}}(he),Oe=w(),Te=F(t,i,r,$),{slideRegistry:Re}=function(e,t,i,o,n,a){const{groupSlides:r}=n,{min:s,max:c}=o;return{slideRegistry:function(){const o=r(a),n=!e||"keepSnaps"===t;return 1===i.length?[a]:n?o:o.slice(s,c).map(((e,t,i)=>{const o=!t,n=C(i,t);return o?E(v(i[0])+1):n?E(y(a)-v(i)[0]+1,v(i)[0]):e}))}()}}(ie,J,ge,pe,ce,ye),De=P(e,i,Re,Ne,Le,Oe,r,Z),qe={ownerDocument:o,ownerWindow:n,eventHandler:r,containerRect:Y,slideRects:W,animation:Ce,axis:X,dragHandler:M(X,e,o,n,we,O(X,n),Ae,Ce,Ne,Le,Ie,fe,r,ee,S,b,j,.68,z),eventStore:Oe,percentOfView:ee,index:fe,indexPrevious:ve,limit:he,location:Ae,offsetLocation:be,previousLocation:Se,options:a,resizeHandler:T(t,r,n,i,X,G,Q),scrollBody:Le,scrollBounds:R(he,be,we,Le,ee),scrollLooper:D(ue,he,be,[Ae,be,Se,we]),scrollProgress:Me,scrollSnapList:ge.map(Me.get),scrollSnaps:ge,scrollTarget:Ie,scrollTo:Ne,slideLooper:B(X,K,ue,ne,ae,de,ge,be,i),slideFocus:De,slidesHandler:_(t,r,V),slidesInView:Te,slideIndexes:ye,slideRegistry:Re,slidesToScroll:ce,target:we,translate:x(X,t)};return qe}const j={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function J(e){function t(e,t){return S(e,t||{})}const i={mergeOptions:t,optionsAtMedia:function(i){const o=i.breakpoints||{},n=A(o).filter((t=>e.matchMedia(t).matches)).map((e=>o[e])).reduce(((e,i)=>t(e,i)),{});return t(i,n)},optionsMediaQueries:function(t){return t.map((e=>A(e.breakpoints||{}))).reduce(((e,t)=>e.concat(t)),[]).map(e.matchMedia)}};return i}function G(e,t,i){const o=e.ownerDocument,n=o.defaultView,a=J(n),r=function(e){let t=[];return{init:function(i,o){return t=o.filter((({options:t})=>!1!==e.optionsAtMedia(t).active)),t.forEach((t=>t.init(i,e))),o.reduce(((e,t)=>Object.assign(e,{[t.name]:t})),{})},destroy:function(){t=t.filter((e=>e.destroy()))}}}(a),s=w(),c=function(){let e,t={};function i(e){return t[e]||[]}const o={init:function(t){e=t},emit:function(t){return i(t).forEach((i=>i(e,t))),o},off:function(e,n){return t[e]=i(e).filter((e=>e!==n)),o},on:function(e,n){return t[e]=i(e).concat([n]),o},clear:function(){t={}}};return o}(),{mergeOptions:d,optionsAtMedia:u,optionsMediaQueries:m}=a,{on:p,off:g,emit:h}=c,f=M;let v,y,C,E,A=!1,S=d(j,G.globalOptions),b=d(S),L=[];function I(t){const i=H(e,C,E,o,n,t,c);if(t.loop&&!i.slideLooper.canLoop()){return I(Object.assign({},t,{loop:!1}))}return i}function N(t,i){A||(S=d(S,t),b=u(S),L=i||L,function(){const{container:t,slides:i}=b,o=l(t)?e.querySelector(t):t;C=o||e.children[0];const n=l(i)?C.querySelectorAll(i):i;E=[].slice.call(n||C.children)}(),v=I(b),m([S,...L.map((({options:e})=>e))]).forEach((e=>s.add(e,"change",M))),b.active&&(v.translate.to(v.location.get()),v.animation.init(),v.slidesInView.init(),v.slideFocus.init(D),v.eventHandler.init(D),v.resizeHandler.init(D),v.slidesHandler.init(D),v.options.loop&&v.slideLooper.loop(),C.offsetParent&&E.length&&v.dragHandler.init(D),y=r.init(D,L)))}function M(e,t){const i=R();O(),N(d({startIndex:i},e),t),c.emit("reInit")}function O(){v.dragHandler.destroy(),v.eventStore.clear(),v.translate.clear(),v.slideLooper.clear(),v.resizeHandler.destroy(),v.slidesHandler.destroy(),v.slidesInView.destroy(),v.animation.destroy(),r.destroy(),s.clear()}function T(e,t,i){b.active&&!A&&(v.scrollBody.useBaseFriction().useDuration(!0===t?0:b.duration),v.scrollTo.index(e,i||0))}function R(){return v.index.get()}const D={canScrollNext:function(){return v.index.add(1).get()!==R()},canScrollPrev:function(){return v.index.add(-1).get()!==R()},containerNode:function(){return C},internalEngine:function(){return v},destroy:function(){A||(A=!0,s.clear(),O(),c.emit("destroy"),c.clear())},off:g,on:p,emit:h,plugins:function(){return y},previousScrollSnap:function(){return v.indexPrevious.get()},reInit:f,rootNode:function(){return e},scrollNext:function(e){T(v.index.add(1).get(),e,-1)},scrollPrev:function(e){T(v.index.add(-1).get(),e,1)},scrollProgress:function(){return v.scrollProgress.get(v.offsetLocation.get())},scrollSnapList:function(){return v.scrollSnapList}
1,scrollTo:T,selectedScrollSnap:R,slideNodes:function(){return E},slidesInView:function(){return v.slidesInView.get()},slidesNotInView:function(){return v.slidesInView.get(!1)}};return N(t,i),setTimeout((()=>c.emit("init")),0),D}G.globalOptions=void 0;const V=(e,t,i)=>{const o=()=>{e.scrollPrev()},n=()=>{e.scrollNext()};t.addEventListener("click",o,!1),i.addEventListener("click",n,!1);const a=((e,t,i)=>{const o=()=>{e.canScrollPrev()?t.removeAttribute("disabled"):t.setAttribute("disabled","disabled"),e.canScrollNext()?i.removeAttribute("disabled"):i.setAttribute("disabled","disabled")};return e.on("select",o).on("init",o).on("reInit",o),()=>{t.removeAttribute("disabled"),i.removeAttribute("disabled")}})(e,t,i);return()=>{a(),t.removeEventListener("click",o,!1),i.removeEventListener("click",n,!1)}},z=(e,t)=>{let i=[],o=[],n=[];const a=()=>{t.innerHTML=e.scrollSnapList().map((()=>'<button class="embla__dot" type="button"></button>')).join("");const a=t=>{e.scrollTo(t),n.forEach(((e,i)=>{i===t?e.classList.add("is-selected"):e.classList.remove("is-selected")}))};i=Array.from(t.querySelectorAll(".embla__dot")),o=Array.from(document.querySelectorAll(".embla__slide")),n=Array.from(document.querySelectorAll(".cmp-carousel-info__item")),i.forEach(((e,t)=>{e.addEventListener("click",(()=>a(t)),!1)})),o.forEach(((e,t)=>{e.addEventListener("click",(()=>a(t)),!1)}))},r=()=>{const t=e.previousScrollSnap(),o=e.selectedScrollSnap();i[t].classList.remove("embla__dot--selected"),i[o].classList.add("embla__dot--selected"),n.forEach(((e,t)=>{t===o?e.classList.add("is-selected"):e.classList.remove("is-selected")}))};return e.on("init",a).on("reInit",a).on("init",r).on("reInit",r).on("select",r),()=>{t.innerHTML=""}};class Z{init(){const e=document.querySelector(".cmp-embla")?.getAttribute("data-carousel-loop");try{const t={loop:"true"===e},i=document.querySelector(".embla");if(!i)return void console.warn("No se encontró el elemento .embla en el DOM.");const o=i.querySelector(".embla__viewport"),n=document.querySelector(".embla__dots"),a=document.querySelector(".embla__button--prev"),r=document.querySelector(".embla__button--next"),s=i.querySelector(".embla__container");this.slideInformationNodes=Array.from(document.querySelectorAll(".cmp-carousel-info__item")),this.emblaApi=G(o,t);const c=()=>{const e=this.emblaApi.slideNodes(),t=this.emblaApi.selectedScrollSnap();e.forEach(((e,i)=>{e.classList.toggle("is-selected",i===t)})),this.slideInformationNodes.forEach(((e,i)=>{e.classList.toggle("is-selected",i===t)}))};this.emblaApi.on("init",c),this.emblaApi.on("reInit",c),this.emblaApi.on("select",c),this.removeClickOnImages=((e,t)=>{t.addEventListener("click",(i=>{if(i.target.classList.contains("embla__slide")){const o=Array.from(t.children).indexOf(i.target);e.scrollTo(o)}}))})(this.emblaApi,s),this.removeDotBtns=z(this.emblaApi,n),this.removePrevNextBtns=V(this.emblaApi,a,r),this.emblaApi.on("destroy",this.removeClickOnImages),this.emblaApi.on("destroy",this.removeDotBtns),this.emblaApi.on("destroy",this.removePrevNextBtns)}catch(e){console.error("Error en carrusel V2:",e)}}}let Q=0,Y=[];const W=e=>{Y=e.slideNodes().map((e=>e.querySelector(".embla__slide__image"))),console.log("Tween nodes set:",Y)},X=e=>{Q=.52*e.scrollSnapList().length},K=(e,t)=>{const i=e.internalEngine(),o=e.scrollProgress(),n=e.slidesInView(),a="scroll"===t;e.scrollSnapList().forEach(((e,t)=>{let r=e-o;i.slideRegistry[t].forEach((t=>{if(a&&!n.includes(t))return;i.options.loop&&i.slideLooper.loopPoints.forEach((i=>{const n=i.target();if(t===i.index&&0!==n){const t=Math.sign(n);-1===t&&(r=e-(1+o)),1===t&&(r=e+(1-o))}}));const s=1-Math.abs(r*Q),c=(d=s,l=0,u=1,Math.min(Math.max(d,l),u)).toString();var d,l,u;Y[t].style.transform=`scale(${c})`}))}))};class ee{init(){console.log("Onload Scale Carousel");try{const e={loop:!0},t=document.querySelector(".embla");if(!t)return void console.warn("No se encontró el elemento .embla en el DOM.");const i=t.querySelector(".embla__viewport"),o=document.querySelector(".embla__button--prev"),n=document.querySelector(".embla__button--next"),a=document.querySelector(".embla__dots"),r=G(i,e),s=(e=>(W(e),X(e),K(e),e.on("reInit",W).on("reInit",X).on("reInit",K).on("scroll",K).on("slideFocus",K),()=>{Y.forEach((e=>e.removeAttribute("style")))}))(r),c=V(r,o,n),d=z(r,a);r.on("destroy",s).on("destroy",c).on("destroy",d)}catch(e){console.error("Error en carrusel V2:",e)}}}window.addEventListener("load",(e=>{if(document.querySelector(".cmp-carouselv2")){const e=document.querySelector(".cmp-embla")?.getAttribute("data-carousel-type");if(e)if(document.querySelector(".cmp-carousel-info__item")&&document.querySelector(".cmp-carousel-info__item").classList.add("is-selected"),"default"===e){(new Z).init()}else if("scale"===e){(new ee).init()}}}));class te{constructor(){this.articleLists=document.querySelectorAll(".cmp-blog-articles-list__container"),this.tabContainers=document.querySelectorAll(".tab-elements"),this.bannerContainer=document.getElementById("blog-banner"),this.desktopBannerImage=document.querySelector(".cmp-banner__ImageDesktop")}init(){this.articleLists?.length&&(this.simplifyText(this.articleLists),this.setUpTabsFunctionality())}simplifyText(e){e.forEach((e=>{e.querySelectorAll(".cmp-blog-article-title")?.forEach((e=>{e.textContent.length>80&&(e.textContent=e.textContent.slice(0,80)+"...")}))}))}
1hideAllArticles(){this.articleLists.forEach((e=>{e.querySelectorAll(".cmp-blog-article-title")?.forEach((e=>{const t=e.closest(".blog-card");t&&(t.style.display="none")}))}))}showArticleByElement(e){this.hideAllArticles(),this.tabContainers.forEach((t=>{Array.from(t.children).forEach((t=>{t.classList.toggle("active",t.id===e.id)}))}));const t=document.querySelector(`.blog [data-id="${e.id}"]`);if(t){const e=t.closest(".blog-card");e&&(e.style.display="block")}this.updateBanner()}updateBanner(){if(this.bannerContainer&&this.desktopBannerImage){const e=document.querySelector(".last-article")?.getAttribute("data-image-banner");e&&(this.desktopBannerImage.src=e)}}setUpTabsFunctionality(){this.tabContainers?.length&&this.tabContainers.forEach((e=>{Array.from(e.children).forEach(((e,t)=>{0===t&&this.showArticleByElement(e),e.addEventListener("click",(()=>this.showArticleByElement(e)))}))}))}}class ie{constructor(){this.storagePrefix="lista-",this.selectorContainer=".CustomContentFragmentList div",this.selectorPagination=".paginador",this.clearPaginationStorage(),this.maxItems=0,this.loader=document.querySelector(".customContentFragmentList-loading"),this.blog=new te}init(){Array.from(document.querySelectorAll(this.selectorContainer)).forEac
1h((e=>{const t=e.getAttribute("data-path"),i=e.getAttribute("data-dateName"),o=parseInt(e.getAttribute("data-limit"));this.maxItems=parseInt(e.getAttribute("data-limit"));Array.from(e.querySelectorAll(this.selectorPagination)).forEach((n=>this.setupPagination(n,e,t,i,o)))}))}clearPaginationStorage(){const e=this.storagePrefix;Object.keys(localStorage).forEach((t=>{t.startsWith(e)&&localStorage.removeItem(t)}))}async checkIfHasMore(e,t,i,o){try{const o=`/bin/epm/cf-paginator?path=${e}&datesName=${t}&offset=${i}&limit=1`,n=await fetch(o);if(!n.ok)throw new Error(`Error en la petición: ${n.status}`);return(await n.json()).length>0}catch(e){return console.error("Error al verificar más elementos:",e),!1}}setupPagination(e,t,i,o,n){const a=e.getAttribute("id"),r=t.querySelector(`div [data-pg="child-${a}"]`),s=e.querySelector("#next-button"),c=e.querySelector("#prev-button"),d=e.querySelector("#last-page-button"),l=e.querySelector("#first-page-button");r&&r.childNodes.length>this.maxItems-1&&(e.classList.remove("hide"),l.style.display="none",d.style.display="none"),e.querySelector(".cmp-pagination__container").setAttribute("id","paginador_customContentFragmentList"),c.classList.add("disabled"),this.checkIfHasMore(i,o,this.maxItems,1).then((e=>{e?s.classList.remove("disabled"):s.classList.add("disabled")})),s&&s.addEventListener("click",(()=>this.handlePaginationClick(i,o,a,n,"next",r,c,s))),c&&c.addEventListener("click",(()=>this.handlePaginationClick(i,o,a,n,"prev",r,c,s)))}mostrarRango(e,t,i){const o=i[0];"header-row"===o.id?i.forEach(((i,n)=>{o.style.display="table-row",i.style.display=n>=e+1&&n<t+1?"table-row":"none"})):i.forEach(((i,o)=>{i.style.display=o>=e&&o<t?"block":"none"}))}async handlePaginationClick(e,t,i,o,n,a,r,s){const c=parseInt(o);let d=[];const l=`${this.storagePrefix}${i}`,u=`${this.storagePrefix}${i}_pageIndex`,m=`${this.storagePrefix}${i}_clickCount`,p=`${this.storagePrefix}${i}_lastPageClick`;let g=JSON.parse(localStorage.getItem(l))||[0],h=parseInt(localStorage.getItem(u))||0,f=parseInt(localStorage.getItem(m))||0,v=parseInt(localStorage.getItem(p))||null;const y=a?Array.from(a.children):[];if("next"===n){++f,localStorage.setItem(m,f);let i=(g[h]??0)+c;return f==v&&s.classList.add("disabled"),g.includes(i)?(h=g.indexOf(i),this.mostrarRango(i,i+c,y)):(d=await this.fetchFragments(e,t,i.toString(),o.toString(),s),d.length>0&&(this.renderFragments(d,a),g.push(i),localStorage.setItem(l,JSON.stringify(g)),this.mostrarRango(i,i+c,y),s.classList.remove("disabled"),this.loader&&this.loader.classList.add("hide"),h++),d.length<c&&(s?.classList.add("disabled"),this.loader&&this.loader.classList.add("hide"),localStorage.setItem(p,f))),localStorage.setItem(u,h),void r?.classList.remove("disabled")}if("prev"===n){if(h<=0)return void r?.classList.add("disabled");h--;const e=g[h];this.mostrarRango(e,e+c,y),f=Math.max(0,f-1),localStorage.setItem(m,f),s?.classList.remove("disabled"),0===h&&r?.classList.add("disabled"),localStorage.setItem(u,h)}}async fetchFragments(e,t,i,o,n){try{this.loader&&this.loader.classList.remove("hide"),n.classList.add("disabled");const a=`/bin/epm/cf-paginator?path=${e}&datesName=${t}&offset=${i}&limit=${o}`,r=await fetch(a);if(!r.ok)throw new Error(`Error en la petición: ${r.status}`);const s=await r.json();return s.length<o&&n.classList.add("disabled"),s}catch(e){return console.error("Error al obtener Content Fragments:",e),{}}}renderFragments(e,t){if(Array.isArray(e)&&e.length>0){const i=e[0].modelPath,o={participacion:()=>this.procesarParticipacion(e,t),decretos:()=>this.procesarDecretos(e,t),blog:()=>this.procesarBlog(e,t),noticias:()=>this.procesarNoticias(e,t)};for(const e of Object.keys(o))i.includes(e)&&o[e]()}}formatearFecha(e){const t=new Date(e).toLocaleDateString("es-ES",{month:"long",year:"numeric"}).replace(" de "," ");return t.charAt(0).toUpperCase()+t.slice(1)}procesarDecretos(e,t){t&&Array.isArray(e)&&0!==e.length&&(t.children[0].style.removeProperty("display"),e.forEach((e=>{const{uuid:i,documentoDecretoNormativo:o,titulo:n,descripcion:a,fechaInicio:r,fechaFin:s,paginaEnlace:c}=e,d=document.createElement("tr");d.className="item",d.id=i,d.innerHTML=`\n                <td>\n                    <a style="text-decoration: none; color: unset;" href="${o}">${n}</a>\n                </td>\n                <td>${a}</td>\n                <td style="text-align: center;">${r}</td>\n                <td style="text-align: center;">${s}</td>\n                <td style="text-align: center;" class="button cmp-buttonsecondary"> <a href="${c}" target="_blank" id="btnRedirect"\n                        class="cmp-button">Ver del decreto</a></td>\n            `,t.appendChild(d)})))}procesarParticipacion(e,t){if(!t||!Array.isArray(e)||0===e.length)return;let i;const o=t.children[0];if(o){const e=o.querySelector(".count img");i=e?e.src:""}e.forEach((e=>{const{titulo:o,idformulario:n,imagen:a,titleImage:r,resumen:s,paginaEnlace:c}=e,d=document.createElement("div");d.classList.add("card"),d.id=n,d.innerHTML=`\n                <h3>${o}</h3>\n                <img src="${a}" alt="${r||""}" title="${r||""}" />\n                <div class="count">\n                <img src="${i}" alt="${o}-icon" title="${o}-icon" />\n                    <p class="numberCount"></p>\n                </div>\n                <div class="citizenParticipation-info">\n                    <p>${s}</p>\n                    <a target="_blank" href="${c}" class="cmp-button">Ver el evento</a>\n                </div>\n            `,t.appendChild(d)}))}procesarBlog(e,t){t&&e.forEach((e=>{const{fechaInicio:i,imageArticule:o,linkPage:n,tipoBlog:a,tituloBlog:r}=e,s=document.createElement("article");
1s.className="cmp-blog-article",s.id=a,s.innerHTML=`\n            <div class="cmp-blog-article-image">\n                <a href="${n}" dataId="cmp-blog-arcticle-image__cta" tabindex="-1"\n                    class="imagen-article">\n                    <img src="${o}" alt="${r}" title="${r}">\n                </a>\n                <a class="cmp-blog-article-category" href="${n}" dataId="cmp-blog-article-category__cta">\n                    ${a}\n                </a>\n            </div>\n            <a href="${n}" dataId="cmp-blog-arcticle__cta" class="cmp-blog-article-info">\n                <div class="cmp-blog-article-texts cmp-buttonprimary">\n                    <h3 class="cmp-blog-article-title">${r.length>80?r.slice(0,80)+"...":r}</h3>\n                    <p class="cmp-blog-article-date">${this.formatearFecha(i)}</p>\n                    <p class="cmp-button">Leer noticia</p>\n                </div>\n            </a>\n        `,t.appendChild(s)}))}procesarNoticias(e,t){e&&t&&e.forEach((e=>{const{main_image:i,redirect:o,title:n,summary:a,textoEnlace:r,titleImage:s}=e,c=document.createElement("a");c.classList.add("news_module__card","item"),c.href=o||"#";const d=document.createElement("div");d.classList.add("item_wrapper");const l=document.createElement("img");l.classList.add("item_wrapper_image"),l.src=i||"",l.alt=s||n||"",l.title=s||n||"",d.appendChild(l);const u=document.createElement("div");u.classList.add("news_module_information");const m=document.createElement("div");m.classList.add("item_information");const p=document.createElement("h6");p.classList.add("item_information_title"),p.textContent=n||"";const g=document.createElement("p");g.classList.add("summary"),g.innerHTML=a||"",m.appendChild(p),m.appendChild(g);const h=document.createElement("div");h.classList.add("news_module-button");const f=document.createElement("span");f.setAttribute("tabindex","0"),f.classList.add("cmp-button"),f.textContent=r||"Acceder al contenido",h.appendChild(f),u.appendChild(m),u.appendChild(h),c.appendChild(d),c.appendChild(u),t.appendChild(c)}))}}class oe{async incomingInformation(e){try{let t=e.substring(0,e.length-5);return t=this.base64ToUtf8(t),t=t.substring(5),t=this.base64ToUtf8(t),t}catch(e){return console.log("Error generado en incomingInformation: ",e),""}}base64ToUtf8(e){const t=atob(e),i=new Uint8Array(t.length);for(let e=0;e<t.length;e++)i[e]=t.charCodeAt(e);return new TextDecoder("utf-8").decode(i)}async outgoingInformation(e){let t="";try{return t=Math.random().toString(36).substring(2,7)+btoa(e),t=btoa(t)+Math.random().toString(36).substring(2,7),t}catch(e){return console.error("Error generado en outgoingInformation",e),t}}}class ne{security=new oe;async postService(e,t){console.log("postService: ");const i=document.getElementById("superapp-welcome-id"),o=await this.security.outgoingInformation(JSON.stringify(e)),n=await fetch("/libs/granite/csrf/token.json",{credentials:"include"}),a=(await n.json()).token;return new Promise(((e,n)=>{i&&(document.getElementById("super-app-loader-container-id").style.display="flex");const r={data:o};fetch(t,{method:"POST",body:JSON.stringify(r),headers:{"Content-Type":"application/json","CSRF-Token":a},credentials:"include"}).then((t=>t.json().then((t=>{i&&(document.getElementById("super-app-loader-container-id").style.display="none"),e(t.data)}
1)))).catch((e=>{console.log("error postService: ",e),i&&(document.getElementById("super-app-loader-container-id").style.display="none"),n(e)}))}))}async registLog(e,t){return new Promise(((i,o)=>{fetch("/libs/granite/csrf/token.json",{}).then((i=>i.json().then((i=>{let o={logData:t,logOrigin:e};fetch("/bin/regist-log",{method:"POST",body:JSON.stringify(o),headers:{"Content-Type":"application/json","CSRF-Token":i.token}}).then((e=>e.json().then((e=>{})))).catch((e=>{}))})))).catch((e=>{}))}))}async getCsrfToken(){const e=await fetch("/libs/granite/csrf/token.json");return(await e.json()).token}}class ae{constructor(){this.restServices=new ne,this.cardDetail=document.getElementsByClassName("service-guide-cards")}async generateRecaptchaToken(){return new Promise(((e,t)=>{const i="6LczV9UZAAAAAFJzsR-Fn3QuJ-ucBVaT2Vys6l5K",o=document.createElement("script");o.type="text/javascript",o.src="https://www.google.com/recaptcha/api.js?render="+i,o.onload=()=>{grecaptcha.ready((()=>{grecaptcha.execute(i,{action:"submit"}).then((t=>{console.log("Token: ",t),e(t)})).catch((e=>{console.error("Error al obtener el token:",e),t(e)}))}))},o.onerror=()=>t(new Error("Error al cargar reCAPTCHA")),document.head.appendChild(o)}))}async hideData(){this.cardDetail&&(this.cardDetail[0].style.display="none")}async showData(){this.cardDetail&&(this.cardDetail[0].style.display="flex")}async removeValueFromCache(e,t){let i=function(){const e=localStorage.getItem("previousStep");try{const t=e?JSON.parse(e):[];return Array.isArray(t)?t:[]}catch(e){return[]}}();Array.isArray(i)&&i.length>0&&i.pop(),function(e){localStorage.setItem("previousStep",JSON.stringify(e))}(i)}async writeMessage(e){try{const t={message:e};await this.restServices.postService(t,"/bin/regist-log")}catch(e){console.log("Error | writeLog: ",e.message)}}displayAndUpdateInfo(e){const t=document.querySelector(".service-guide-options-container-info");if(!t)return;t.innerHTML="";const i=document.createElement("h2");i.textContent=e[0].tituloPaso,t.appendChild(i);const o=e[0].descripcinPaso;if(o&&"N/A"!==o){const e=document.createElement("p");e.textContent=o,t.appendChild(e)}}isVisible(e){return!(null===e.offsetParent||"none"===getComputedStyle(e).display||"hidden"===getComputedStyle(e).visibility)}}class re{constructor(){this.btnRedirect=document.querySelectorAll(".cmp_tabla-normativeDecrees .item .btnRedirect"),this.utils=new ae}init(){this.assetManager()}assetManager(){this.btnRedirect.forEach((e=>{e.addEventListener("click",(async t=>{t.preventDefault();const i=e.closest(".item")||e.parentElement?.parentElement;if(!i)return;const o=i.id;try{const i={token:await this.utils.generateRecaptchaToken(),assetId:o,categoria:"Comments"};await this.createAsset(i);const n=e.querySelector("a")?.href;if(n)try{const e=new URL(n,window.location.origin);e.searchParams.set("assetId",o),window.open(e.href,"_blank")}catch(t){console.error("Error construyendo URL de destino:",t)}else console.warn("No se encontró URL de destino en el botón")}catch(e){console.error("Error al crear el asset:",e)}}))}))}async createAsset(e){try{const t=await fetch("/bin/form/create-asset",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return t.ok?await t.json():null}catch(e){return null}}}class se{constructor(){this.secondaryGroup=document.querySelector(".news_new_home-container-secondary"),this.secondaryGroup&&(this.newsButtons=document.querySelector(".news_buttons"),this.secondaryGroup&&(this.summarys=this.secondaryGroup.querySelectorAll(".news_new_home-container-secondary-item_information_summary")))}init(){this.setupCarrouselButtons(),this.hideText()}hideText(){if(this.summarys&&this.summarys.length)for(let e of this.summarys)e.textContent=e.textContent.length>105?e.textContent.slice(0,105)+"...":e.textContent}setupCarrouselButtons(){if(this.secondaryGroup&&this.newsButtons){const e=Array.from(this.secondaryGroup.querySelectorAll(".new"));if(!e.length)return;let t=0;const i=this.newsButtons.querySelector(".news_buttons_prev-button"),o=this.newsButtons.querySelector(".news_buttons_next-button"),n=()=>{e.forEach(((e,i)=>{e.style.display=i>=t&&i<t+2?"block":"none"}))};function a(){t+2<e.length&&(t++,n())}function r(){t>0&&(t--,n())}window.matchMedia("(max-width: 1200px)").matches&&n(),i?.addEventListener("click",r),o?.addEventListener("click",a),window.addEventListener("resize",(()=>{const i=window.matchMedia("(max-width: 1200px)").matches;t+2>e.length&&(t=Math.max(0,e.length-2)),i?n():e.forEach((e=>e.style.display=""))}))}}}window.addEventListener("load",(async()=>{const e=new te,t=new re,i=(new ie,new se),o=document.querySelectorAll(".CustomContentFragmentList");o.length&&o.forEach((o=>{const n=o.querySelector("div > .blog"),a=o.querySelector("div > .normativeDecrees"),r=o.querySelector("div > .news");
1n&&e.init(),a&&t.init(),r&&i.init()}))}));class ce{constructor(e,t){this.select=e,this.selectFacilities=t}createSelect(e,t){if(!this.select)return;this.select.parentElement.classList.remove("hide");const i=[...new Set(e.filter((e=>e.departamento===t)).map((e=>e.municipio)))].map((e=>`<option value="${e}">${e}</option>`)).join("");this.select.innerHTML='<option value="">-- Selecciona una opción --</option>'+i,this.select.addEventListener("change",(i=>{const o=i.target.value,n=e.filter((e=>e.departamento===t&&e.municipio===o)).map((e=>`<option value="${e.servicioSuscrito}">${e.genericoPps}</option>`)).join("");this.selectFacilities&&(this.selectFacilities.innerHTML='<option value="">-- Selecciona una opción --</option>'+n,this.selectFacilities.parentElement.classList.remove("hide"))}))}getGenericoPpsByDepartamentoMunicipio(e,t,i){return e.filter((e=>e.departamento===t&&e.municipio===i)).map((e=>e.genericoPps))}}class de{constructor(){this.select=document.querySelector(".digitalinvoice-form .digitalinvoice-form-departamento .digitalinvoice-form_select"),this.selectMunicipio=document.querySelector(".digitalinvoice-form .digitalinvoice-form-municipio .digitalinvoice-form_select"),this.selectFacilities=document.querySelector(".digitalinvoice-form .digitalinvoice-form-instalacion .digitalinvoice-form_select")}renderDepartmentOptions(e){if(!this.select)return;this.select.parentElement.classList.remove("hide");const t=[...new Set(e.map((e=>e.departamento)))].sort().map((e=>`<option value="${e}">${e}</option>`)).join("");this.select.innerHTML='<option value="">-- Selecciona una opción --</option>'+t,this.select.addEventListener("change",(t=>{this.municipality=new ce(this.selectMunicipio,this.selectFacilities);const i=t.target.value;this.municipality.createSelect(e,i)}))}}class le{constructor(){this.security=new oe,this.restService=new ne,this.department=new de,this.accountid="",this.text="",this.options=[],this.jsonFacilities={idCuenta:"",rol:"",tipoServicio:"",usuario:""},this.jsonRegistrarContrato={peticion:""},this.loader=document.querySelector(".digitalinvoice-loader")}createInfoModal(e){const t=document.querySelector(".modal-container-invoices");t&&t.remove();const i=document.createElement("div");i.className="modal-container-invoices";const o=document.createElement("div");o.className="modal-invoices";const n=document.createElement("div");n.className="modal-invoices-header";const a=document.createElement("h2");a.textContent="Información",n.appendChild(a);const r=document.createElement("div");r.className="modal-invoices-content";const s=document.createElement("p");s.className="modal-invoices-message",s.innerHTML=e,r.appendChild(s);const c=document.createElement("div");c.className="modal-invoices-footer";const d=document.createElement("button");return d.className="modal-invoices-btn",d.textContent="Aceptar",d.addEventListener("click",(()=>i.remove())),c.appendChild(d),o.appendChild(n),o.appendChild(r),o.appendChild(c),i.appendChild(o),document.body.appendChild(i),i.addEventListener("click",(e=>{e.target===i&&i.remove()})),i}async loadClients(e,t){try{this.loader.classList.remove("hide");const i=document.querySelector("#departamento"),o=document.querySelector("#departamento-options"),n=document.querySelector("#departamento-input"),a=await fetch(e),r=await a.json(),s=r.email||"",c=r.rol||"";if(!s||!c)return void this.loader.classList.add("hide");let d,l=[];if("pending"===t){const e=await fetch("/bin/cliente-corporativo/consultar/perfiles"),t=await e.json(),i=document.querySelector(".digitalinvoice-form-cliente");t?.RolesPerfil?(l=t.RolesPerfil.map((e=>e.Rol.toString())),i?.classList.remove("hide")):this.createInfoModal("No cuentas con los perfiles necesarios para este módulo, por favor revisa con tu ejecutivo de cuenta")}if(this.loader.classList.add("hide"),o.innerHTML="",i.innerHTML="","invoice"===t)d=r.clientes||[];else if("pending"===t)if(d=r.clientes||r.data||r.results||r,Array.isArray(r))d=r;else if(!Array.isArray(d)){const e=Object.values(r).filter((e=>Array.isArray(e)));d=e.length>0?e[0]:[]}if(!Array.isArray(d))return void this.loader.classList.add("hide");const u=(e,t)=>
1{if(!e||"object"!=typeof e)return"";const i=t.toLowerCase();for(const t of Object.keys(e))try{if(t.toLowerCase().includes(i)){const i=e[t]?.Value;if(null!=i)return"string"==typeof i?i.trim():i}}catch(e){}return""};for(const e of d){const n=e?.Attributes||{},a=u(n,"accountid");let r,d=u(n,"name")||"Sin nombre";if("string"==typeof d&&(d=d.trim()),!a)continue;if("pending"===t){if(!(a&&c&&s&&Array.isArray(l)))continue;const e=`${a}|${c}|${s}|${JSON.stringify(l)}`;r=await this.security.outgoingInformation(e)}else if("invoice"===t){if(!a||!c||!s)continue;const e=`${a}|${c}|${s}`;r=await this.security.outgoingInformation(e)}const m=document.createElement("li");m.setAttribute("value",r),m.textContent=d,o.appendChild(m);const p=document.createElement("option");p.value=r,p.textContent=d,i.appendChild(p)}this.setupDropdownEvents(o,n)}catch(e){console.error("Error en loadClients:",e),this.loader.classList.add("hide"),this.createInfoModal("Se presentó un error al cargar los clientes")}}setupDropdownEvents(e,t){this.removeExistingEvents(e,t),this.handleListItemClick=i=>{const o=i.target.closest("li");if(!o)return;this.accountid=o.getAttribute("value"),this.text=o.textContent,t.value=this.text,e.style.display="none";const n=new CustomEvent("clientSelected",{detail:{accountid:this.accountid,text:this.text}});document.dispatchEvent(n)},this.handleInputClick=()=>{e.style.display="block"},this.handleInputFilter=()=>{const i=t.value.toLowerCase();Array.from(e.querySelectorAll("li")).forEach((e=>{e.style.display=e.textContent.toLowerCase().includes(i)?"block":"none"})),e.style.display="block"},this.handleOutsideClick=i=>{t.contains(i.target)||e.contains(i.target)||(e.style.display="none")},e.addEventListener("click",this.handleListItemClick),t.addEventListener("click",this.handleInputClick),t.addEventListener("input",this.handleInputFilter),document.addEventListener("click",this.handleOutsideClick)}removeExistingEvents(e,t){this.handleListItemClick&&e.removeEventListener("click",this.handleListItemClick),this.handleInputClick&&t.removeEventListener("click",this.handleInputClick),this.handleInputFilter&&t.removeEventListener("input",this.handleInputFilter),this.handleOutsideClick&&document.removeEventListener("click",this.handleOutsideClick)}async fetchOptions(e,t){try{this.loader.classList.remove("hide");const i=await this.security.incomingInformation(e.accountid),[o,n,a]=i.split("|");Object.assign(this.jsonFacilities,{idCuenta:o,rol:n,tipoServicio:t,usuario:a});const r="/bin/cliente-corporativo/consultar/instalaciones";let s=await this.restService.postService(this.jsonFacilities,r),c=await this.security.incomingInformation(s);if("string"==typeof c)try{c=decodeURIComponent(escape(c))}catch(e){}const d="string"==typeof c?JSON.parse(c):c;if(!d)return;if(!0===d.huboError)return this.loader.classList.add("hide"),void this.createInfoModal("Se ha presentado un error en el sistema, por favor intenta de nuevo más tarde y si el error persiste comunícate con tu ejecutivo de cuenta");this.options=d?.respuesta?.instalaciones||[],this.department.renderDepartmentOptions(this.options),this.loader.classList.add("hide")}catch(e){console.error("Error en fetchOptions:",e),this.loader.classList.add("hide"),this.createInfoModal("Error al consultar las instalaciones")}}async registerContractPayment(e){try{this.loader.classList.remove("hide");const t=Array.isArray(e)?e.join(","):e;Object.assign(this.jsonRegistrarContrato,{peticion:t});const i="/bin/cliente-corporativo/contrato/registrar-contrato-pago";let o=await this.restService.postService(this.jsonRegistrarContrato,i);const n=await this.security.incomingInformation(o),a="string"==typeof n?JSON.parse(n):n;return this.loader.classList.add("hide"),a&&!0===a.huboError?(this.createInfoModal("Se ha presentado un error en el sistema, por favor intenta de nuevo más tarde y si el error persiste comunícate con tu ejecutivo de cuenta"),null):a}catch(e){return console.error("Error en registerContractPayment:",e),this.loader.classList.add("hide"),this.createInfoModal("Error al registrar contrato de pago"),null}}}class ue{constructor(){this.security=new oe,this.restService=new ne,this.client=new le,this.loader=document.querySelector(".digitalinvoice-loader"),this.jsonHistorico={tipoFactura:"",numeroBusqueda:""},this.options=[],this.tableBody=document.querySelector(".table-digital-invoice_body"),this.pdfImage=this.tableBody?.getAttribute("data-image-pdf")||"",this.xmlImage=this.tableBody?.getAttribute("data-image-xml")||"",this.consecutivoRespuesta=null}async fetchHistoricalInvoices(e,t){try{if(!this.tableBody)return;this.loader?.classList.remove("hide"),Object.assign(this.jsonHistorico,{tipoFactura:1,numeroBusqueda:e});const t="/bin/cliente-corporativo/consultar/historico-facturas";let i=await this.restService.postService(this.jsonHistorico,t);const o=await this.security.incomingInformation(i),n="string"==typeof o?JSON.parse(o):o;if(!n)return;if(!0===n.huboError)return this.loader?.classList.add("hide"),void this.client.createInfoModal("Se ha presentado un error en el sistema, por favor intenta de nuevo más tarde y si el error persiste comunícate con tu ejecutivo de cuenta");if(n?.respuesta?.facturas&&Array.isArray(n.respuesta.facturas)&&(this.options=n.respuesta.facturas),!Array.isArray(this.options)||0===this.options.length)return this.loader?.classList.add("hide"),void this.client.createInfoModal("No se encontraron datos de facturas");if(this.tableBody&&(this.tableBody.innerHTML=""),this.options[0].numeroContrato){const e=await this.client.registerContractPayment(this.options[0].numeroContrato);e?.respuesta?.respuesta&&(this.consecutivoRespuesta=e.respuesta.respuesta)}this.options.forEach(((e,t)=>{const i=document.createElement("div");i.classList.add("fila");const o=t===this.options.length-1;i.innerHTML=`\n                <div class="fila_info">\n                    <h4>${e.ano}/${e.nombreMes}</h4>\n                </div>\n                <div class="fila_info">\n                    <h4>${e.fechaFactura}</h4>\n                </div>\n                <div class="fila_info">\n                    <h4>${e.fechaVencimientoCR}</h4>\n                </div>\n                <div class="fila_info image">\n                    <a href="${e.url}" target="_blank">\n                        <img src="${this.pdfImage}" alt="Factura PDF">\n                    </a>\n                </div>\n                <div class="fila_info image">\n                    <a href="${e.urlFacturaXml}" target="_blank">\n                        <img src="${this.xmlImage}" alt="Factura Electrónica">\n                    </a>\n                </div>\n                <div class="fila_info"></div>\n                <div class="fila_info cmp-buttonPrimaria">\n                    <a href="${n.urlPageWeb+"?tipoFactura=3&idConsecutivo="+this.consecutivoRespuesta}" \n                    target="_blank"\n                    class="fila_info_btn cmp-button  ${o?"":"hide"}">${o?"Pagar":""}</a>\n                </div>`,this.tableBody&&this.tableBody.appendChild(i)}))}catch(e){console.error("Error en fetchHistoricalInvoices:",e),this.loader?.classList.add("hide"),this.client.createInfoModal("Se presentó un error al consultar el histórico de facturas")}}}class me{constructor(){this.client=new le,this.historical=new ue,this.digitalInvoice=document.querySelector(".digitalinvoice"),this.dataFormType=document.querySelector("[data-form-type='invoice']"),(this.digitalInvoice||this.dataFormType)&&(this.optionValue=null,this.serviceType=null,this.clientForm=".digitalinvoice-form-cliente .myOptions .container-select .searchable-select .dropdown-container input",this.facilitiesSelect=".digitalinvoice-form .digitalinvoice-form-instalacion .digitalinvoice-form_select",this.btnForm=this.digitalInvoice.querySelector(".digitalinvoice-form_submit"),this.tableDigitalInvoice=this.digitalInvoice.querySelector(".digitalinvoice-table"),this.url=window.location.href,this.digitalInvoiceSelects=[this.digitalInvoice.querySelector(this.clientForm),...Array.from(this.digitalInvoice.querySelectorAll('div[class^="digitalinvoice-form-"] select'))].filter(
1Boolean),this.menuOptions=[document.querySelector('[data-content="content-energia"]'),document.querySelector('[data-content="content-agua"]'),document.querySelector('[data-content="content-gas"]')].filter(Boolean))}init(){this.inferServiceType(),this.bindMenuEvents(),this.bindSelectEvents(),this.bindFormEvents()}inferServiceType(){this.url&&(this.url.includes("energia")?this.serviceType=1:this.url.includes("agua")?this.serviceType=2:this.url.includes("gas")&&(this.serviceType=3))}bindMenuEvents(){this.menuOptions.forEach(((e,t)=>{e?.addEventListener("click",(()=>{this.serviceType=t+1}))}))}async bindSelectEvents(){if(null===document.querySelector(".digitalinvoice-form .digitalinvoice-form-cliente"))return;this.dataFormType?.firstElementChild.classList.add("invoice"),this.dataFormType?.classList.add("invoice-container"),this.digitalInvoiceSelects.forEach(((e,t)=>{if(!e)return;const i=(e.tagName||"").toLowerCase(),o="input"===i||"textarea"===i?"input":"change";e?.addEventListener(o,(e=>{const i=(e.target.value||"").toString().trim();this.digitalInvoiceSelects.slice(t+1).forEach((e=>{e&&e.classList.toggle("hide",""===i)}));const o=this.digitalInvoiceSelects.every((e=>{if(!e)return!1;return""!==(e.value||"").toString().trim()}));this.btnForm.classList.toggle("hide",!o)}))})),await this.client.loadClients("/bin/cliente-corporativo/consultar/clientes","invoice"),document.addEventListener("clientSelected",(async e=>{const t=e.detail;this.clearDependentSelects(),this.tableDigitalInvoice.classList.add("hide"),this.optionValue=null,await this.client.fetchOptions(t,this.serviceType)}));this.digitalInvoice.querySelector(this.facilitiesSelect)?.addEventListener("change",(e=>{this.btnForm.classList.remove("hide"),this.optionValue=e.target.value}))}clearDependentSelects(){const e=this.digitalInvoice.querySelector(this.facilitiesSelect);e&&(e.innerHTML="",e.value="");this.digitalInvoice.querySelectorAll('div[class^="digitalinvoice-form-"] select:not(.digitalinvoice-form-instalacion select)').forEach((e=>{e.innerHTML="",e.value=""})),this.historical?.tableBody&&(this.historical.tableBody.innerHTML="")}bindFormEvents(){this.btnForm?.addEventListener("click",(async e=>{e.preventDefault(),this.tableDigitalInvoice.classList.remove("hide"),this.optionValue&&await this.historical.fetchHistoricalInvoices(this.optionValue,this.serviceType)}))}}class pe{constructor(){this.security=new oe,this.restService=new ne,this.client=new le,this.urlPageWeb="",this.loader=document.querySelector(".digitalinvoice-loader"),this.jsonInstalacionesPendientes={idCuenta:"",rol:"",usuario:"",perfiles:""},this.jsonFacturasPendientes={documentoReferencia:"",listaContratos:[],tipoFactura:1},this.options=[],this.tableBody=document.querySelector(".table-digital-pending_body"),this.tableHeader=document.querySelector(".table-digital-pending_header"),this.pdfImage=this.tableBody?.getAttribute("data-image-pdf"),this.xmlImage=this.tableBody?.getAttribute("data-image-xml"),this.userProfiles=[],this.userRole=null,this.userEmail="",this.direccionesContratos={},this.payButton=document.querySelector(".pay-button"),this.selectAllCheckbox=null,this.initEventListeners()}formatCurrency(e){if(!e||0===e)return"$ 0.00";return"$ "+("string"==typeof e?parseFloat(e):e).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}async fetchPendingInstallations(e){try{this.loader.classList.remove("hide");const t=(await this.security.incomingInformation(e.accountid)).split("|");if(t.length<4)return this.loader.classList.add("hide"),[];const[i,o,n,a]=t;if(!(i&&o&&n&&a))return this.loader.classList.add("hide"),[];let r;try{r=JSON.parse(a||"[]")}catch(e){r=[]}const s={idCuenta:i.trim(),rol:parseInt(o),usuario:n.trim(),perfiles:JSON.stringify(r)},c="/bin/corporativo/instalacion-factura-pendiente";let d,l;try{d=await this.restService.postService(s,c)}catch(e){return console.error("Error calling servlet:",e),this.loader.classList.add("hide"),[]}if(!d)return this.loader.classList.add("hide"),[];try{const e=await this.security.incomingInformation(d);l="string"==typeof e?JSON.parse(e):e}catch(e){return console.error("Error decrypting response:",e),this.loader.classList.add("hide"),this.client.createInfoModal("Error al procesar la respuesta del servidor"),[]}if(this.loader.classList.add("hide"),!0===l?.huboError)return this.client.createInfoModal("Se ha presentado un error en el sistema, por favor intenta de nuevo más tarde y si el error persiste comunícate con tu ejecutivo de cuenta"),[];if(l?.error){const e=503===l.statusCode?"El servicio no está disponible temporalmente. Por favor, intenta de nuevo más tarde.":l.message||"Se presentó un error al consultar las instalaciones";return this.client.createInfoModal(e),[]}if(!l?.respuesta?.instalaciones)return this.client.createInfoModal("No se encontraron instalaciones para el cliente seleccionado"),[];const u=l.respuesta.instalaciones.map((e=>e.valor)),m=[...new Set(u)];if(0===m.length)return this.client.createInfoModal("No se encontraron instalaciones asociadas al cliente seleccionado"),[];const p={},g=[];l.respuesta.codigoMarcopolo&&l.respuesta.codigoMarcopolo.forEach((e=>
1{l.respuesta.instalaciones.forEach((t=>{if(t.campo===e.valor){const i=g.find((e=>e.valor===t.valor));i||(g.push(t),p[t.valor]=e.campo)}}))})),this.direccionesContratos=p,await this.fetchPendingInvoices(m)}catch(e){this.loader.classList.add("hide"),console.error("Error en fetchPendingInstallations:",e),this.client.createInfoModal("Se ha presentado un error en el sistema, por favor intenta de nuevo más tarde y si el error persiste comunícate con tu ejecutivo de cuenta")}}async fetchPendingInvoices(e){try{this.loader.classList.remove("hide"),this.tableBody&&this.tableBody.children.length>0&&(this.tableBody.innerHTML="");const t={documentoReferencia:"",listaContratos:e,tipoFactura:1},i="/bin/corporativo/consultar/facturas-pendientes";let o,n;try{o=await this.restService.postService(t,i)}catch(e){return console.error("Error calling servlet:",e),void this.loader.classList.add("hide")}if(!o)return void this.loader.classList.add("hide");try{const e=await this.security.incomingInformation(o);n="string"==typeof e?JSON.parse(e):e,this.urlPageWeb=n.urlPageWeb||""}catch(e){return console.error("Error decrypting response:",e),this.loader.classList.add("hide"),void this.client.createInfoModal("Error al procesar la respuesta del servidor")}if(this.loader.classList.add("hide"),!0===n?.huboError)return void this.client.createInfoModal("Se ha presentado un error en el sistema, por favor intenta de nuevo más tarde y si el error persiste comunícate con tu ejecutivo de cuenta");if(n?.error){const e=503===n.statusCode?"El servicio no está disponible temporalmente. Por favor, intenta de nuevo más tarde.":n.message||"Se presentó un error al consultar las facturas pendientes";return void this.client.createInfoModal(e)}if(!n)return void this.client.createInfoModal("No se recibió respuesta del servidor");this.renderPendingInvoices(n)}catch(e){this.loader.classList.add("hide"),console.error("Error en fetchPendingInvoices:",e),this.client.createInfoModal("Se ha presentado un error en el sistema, por favor intenta de nuevo más tarde y si el error persiste comunícate con tu ejecutivo de cuenta")}}renderPendingInvoices(e){if(!this.tableBody)return;if(this.selectAllCheckbox=this.tableHeader.querySelector("#selectAll"),this.selectAllCheckbox&&this.selectAllCheckbox.addEventListener("change",(()=>{this.handleSelectAllChange(this.selectAllCheckbox)})),!0===e?.huboError)return void this.client.createInfoModal("Se ha presentado un error en el sistema, por favor intenta de nuevo más tarde y si el error persiste comunícate con tu ejecutivo de cuenta");const t=e.facturas||e.respuesta?.facturas||[];Array.isArray(t)&&0!==t.length?(t.forEach((e=>{const t=document.createElement("div");t.classList.add("fila");const i=this.direccionesContratos?.[e.numeroContrato]||"No se encontró dirección";t.innerHTML=`\n                <div class="fila_info">\n                    <input class="checkbox" type="checkbox" value="${e.numeroContrato}" />\n                </div>\n                <div class="fila_info">\n                    <h4>${e.numeroContrato}</h4>\n                </div>\n                <div class="fila_info">\n                    <h4>${this.formatCurrency(e.valorFactura)}</h4>\n                </div>\n                <div class="fila_info">\n                    <h4>${i}</h4>\n                </div>\n                <div class="fila_info">\n                    <h4>${e.fechaVencimiento}</h4>\n                </div>\n                <div class="fila_info">\n                    <h4>${e.fechaRecargo}</h4>\n                </div>\n                <div class="fila_info">\n                    <h4>${e.cuentasVencidasContrato}</h4>\n                </div>\n                <div class="fila_info image">\n                    <a href="${e.url||"#"}" target="_blank">\n                        <img src="${this.pdfImage}" alt="Factura PDF">\n                    </a>\n                </div>\n                <div class="fila_info image">\n                    <a href="${e.url}" target="_blank">\n                        <img src="${this.xmlImage}" alt="Factura Electrónica">\n                    </a>\n                </div>\n                <div class="fila_info">\n                    <h4>${e.ajustesFactura||""}</h4>\n                </div>\n                <div class="fila_info">\n                    <h4>${e.documentoReferencia||""}</h4>\n                </div>`,this.tableBody.appendChild(t)})),this.addCheckboxEventListeners()):this.client.createInfoModal("No se encontraron facturas pendientes para el cliente seleccionado")}initEventListeners(){this.payButton&&this.payButton.addEventListener("click",(()=>{this.handlePayButtonClick()}))}async handlePayButtonClick(){try{const e=document.querySelectorAll(".table-digital-pending_body .checkbox:checked");if(0===e.length)return void this.client.createInfoModal("Por favor selecciona al menos una factura para proceder con el pago.");const t=Array.from(e).map((e=>e.value));this.loader.classList.remove("hide");const i=await this.client.registerContractPayment(t);if(this.loader.classList.add("hide"),i?.respuesta?.respuesta){const e=`${this.urlPageWeb}?tipoFactura=3&idConsecutivo=${i.respuesta.respuesta}`;window.open(e,"_blank")}else this.client.createInfoModal("No se encontró idConsecutivo")}catch(e){console.error("Error en handlePayButtonClick:",e),this.loader.classList.add("hide"),this.client.createInfoModal("Se ha presentado un error en el sistema, por favor intenta de nuevo más tarde y si el error persiste comunícate con tu ejecutivo de cuenta")}}handleSelectAllChange(e){document.querySelectorAll(".table-digital-pending_body .checkbox").forEach((t=>{t.checked=e.checked})),this.updatePayButtonState()}addCheckboxEventListeners(){document.querySelectorAll(".table-digital-pending_body .checkbox").forEach((e=>{e.addEventListener("change",(()=>{this.updatePayButtonState(),this.updateSelectAllCheckbox()}))}))}updateSelectAllCheckbox(){const e=document.querySelectorAll(".table-digital-pending_body .checkbox"),t=document.querySelectorAll(".table-digital-pending_body .checkbox:checked");this.selectAllCheckbox&&(0===t.length?(this.selectAllCheckbox.checked=!1,this.selectAllCheckbox.indeterminate=!1):t.length===e.length?(this.selectAllCheckbox.checked=!0,this.selectAllCheckbox.indeterminate=!1):(this.selectAllCheckbox.checked=!1,this.selectAllCheckbox.indeterminate=!0))}updatePayButtonState(){const e=document.querySelectorAll(".table-digital-pending_body .checkbox:checked");this.payButton&&(this.payButton.disabled=0===e.length)}}class ge{constructor(){this.client=new le,this.pendingInvoices=new pe,this.digitalInvoice=document.querySelector(".digitalinvoice"),this.dataFormType=document.querySelector("[data-form-type='pending']"),this.digitalInvoice&&(this.clientForm=".digitalpending-form-cliente .myOptions .container-select .searchable-select .dropdown-container input",this.btnForm=this.digitalInvoice.querySelector(".digitalpending-form_submit"),this.tableDigitalPending=this.digitalInvoice.querySelector(".digitalpending-table"),this.url=window.location.href,this.clientSelect=this.digitalInvoice.querySelector(this.clientForm))}init(){this.bindSelectEvents(),this.bindFormEvents()}async bindSelectEvents(){null!==document.querySelector(".digitalinvoice-form .digitalpending-form-cliente")&&(await this.client.loadClients("/bin/cliente-corporativo/consultar/clientes","pen
1ding"),document.addEventListener("clientSelected",(async e=>{const t=e.detail;this.clearPendingTable(),this.tableDigitalPending.classList.add("hide"),this.btnForm.classList.remove("hide"),this.selectedClientData=t})))}clearPendingTable(){const e=this.digitalInvoice.querySelector(".table-digital-pending_body");e&&(e.innerHTML="")}bindFormEvents(){this.dataFormType?.classList.add("pending"),this.btnForm?.addEventListener("click",(async e=>{e.preventDefault(),this.selectedClientData&&(this.tableDigitalPending.classList.remove("hide"),await this.pendingInvoices.fetchPendingInstallations(this.selectedClientData))}))}}window.addEventListener("load",(()=>{const e=document.querySelector(".digitalinvoice-form");if(!e)return;switch(e.getAttribute("data-form-type")){case"invoice":(new me).init();break;case"pending":(new ge).init()}(new oe).init()}));class he{loading=document.querySelector(".procedure-and-services-loading");showLoading(){this.loading.classList.remove("hide"),this.loading.style.display="flex"}hideLoading(){this.loading.style.display="none"}}class fe{loading=new he;async requiServletGet(e){return new Promise(((t,i)=>{this.loading.showLoading();fetch("/bin/requi-servlet-GET?service="+e,{method:"GET"}).then((e=>e.json().then((e=>{this.loading.hideLoading(),t(e)})))).catch((e=>{console.log("error: ",e),i(e)}))}))}async requiServletPost(e,t,i="",o="",n="",a=""){return new Promise(((r,s)=>{this.loading.showLoading();let c={service:e,empresa:t,idTramite:i,idServicio:o,idSubServicio:n,idDetalleMaestro:a};fetch("/bin/requi-servlet-POST",{method:"POST",body:JSON.stringify(c),headers:{"Content-Type":"application/json"}}).then((e=>e.json().then((e=>{this.loading.hideLoading(),r(e)})))).catch((e=>{console.log("error: ",e)}))}))}async registLog(e,t){return new Promise(((i,o)=>{fetch("/libs/granite/csrf/token.json",{}).then((i=>i.json().then((i=>{let o={logData:t,logOrigin:e};fetch("/bin/regist-log",{method:"POST",body:JSON.stringify(o),headers:{"Content-Type":"application/json","CSRF-Token":i.token}}).catch((e=>{console.log("error: ",e)}))})))).catch((e=>{console.log("error: ",e)}))}))}}class ve{constructor(){this.utils=new ae,this.servicesContainerInfo=document.querySelector(".cmp-guide-procedures_services"),this.procedureDetailDiv=document.querySelector(".procedure-detail-content-guias"),this.procedureTitle=document.createElement("h4"),this.procedureDesc=document.createElement("p"),this.serviceGuide=document.querySelector(".service-guide"),this.tabComponent=this.servicesContainerInfo.querySelector(".tabs_guideProcedureAndServices"),this.restServlet=new fe,this.codesJson,this.toolTipsJson,this.imagesJson,this.codesObject,this.imagesObject}async contentFragmentServletGet(e,t){return new Promise(((i,o)=>{fetch("/bin/content-fragment-finder?searchRoot="+e+"&cfModel="+t).then((e=>e.json())).then((e=>{i(e)})).catch((e=>{console.log("error: ",e),o(e)}))}))}async fetchContentFragments(){const e=this.procedureDetailDiv.dataset.cfSearchRoot,t=this.procedureDetailDiv.dataset.cfCodes,i=this.procedureDetailDiv.dataset.cfImages,o=this.procedureDetailDiv.dataset.cfTooltips;
1try{this.codesJson=await this.contentFragmentServletGet(e,t),this.codesObject=Object.values(this.codesJson),this.imagesJson=await this.contentFragmentServletGet(e,i),this.imagesObject=Object.values(this.imagesJson),this.toolTipsJson=await this.contentFragmentServletGet(e,o),this.tootipsObject=Object.values(this.toolTipsJson)}catch(e){console.error("Error fetching content fragments: ",e)}}replaceTexts(e){var t=e.replaceAll("\r\n","<br>");return t=this.replaceCodes(t),t=this.replaceTooltips(t)}replaceCodes(e){return this.codesJson.forEach((t=>{const i=t.code;var o=t.name;if(e.includes("["+i+"]")){const a="haz clic aquí";let r=t.linkType.toLowerCase(),s="formato"==r||"interno"==r?t.internalLink:t.externalLink,c=document.createElement("a");c.classList.add("procedure-link"),o=o.replace(".",""),isNaN(i.replace("[","").replace("]",""))?(c.target="_blank",c.href=s):c.setAttribute("id-tramite",i.replace("[","").replace("]",""));var n=o.charAt(0).toLowerCase()+o.slice(1);e.includes(a+" ["+i+"]")?e=this.replaceTextForElement(a,i,c,e):e.includes(n+" ["+i+"]")?e=this.replaceTextForElement(n,i,c,e):e.includes(o+" ["+i+"]")&&(e=this.replaceTextForElement(o,i,c,e))}})),e}replaceTextForElement(e,t,i,o){return i.textContent=e,o=o.replaceAll(e+" ["+t+"]",i.outerHTML)}replaceTooltips(e){return this.toolTipsJson.forEach((t=>{if(e.includes(t.keyWord)){var i=document.createElement("strong");i.classList.add("procedure-tooltip"),i.textContent=t.keyWord;var o=document.createElement("div");o.classList.add("tooltip-description");var n=document.createElement("img");n.src=t.imagePath;var a=document.createElement("span");a.textContent=t.description,o.appendChild(n),o.appendChild(a),i.appendChild(o),e=e.replaceAll(" "+t.keyWord," "+i.outerHTML)}})),e}addCodesEvents(){document.querySelectorAll("a[id-tramite]").forEach((e=>{e.addEventListener("click",(()=>{this.procedure.activeProcedure(e.getAttribute("id-tramite"))}))}))}async loadProcedureDetail(e,t,i,o){this.serviceGuide.style.display="none",this.procedureDetailDiv.style.display="block",document.querySelector(".cmp-guide-procedures_services-container").classList.toggle("tip",!1),this.procedureTitle.classList.add("procedure-title"),this.procedureDesc.classList.add("procedure-desc");try{const n=await this.restServlet.requiServletPost("GetByIdSubServicioIdDetalleMaestroIdCanal",e,"","",i,o),a=await this.restServlet.requiServletPost("GetByIdTramiteIdSubServicioIdDetalleMaestro",e,t,"",i,o);await this.fetchContentFragments(),this.procedureTitle.textContent=n.find((e=>e.idTramite==t)).pregunta,this.procedureDesc.textContent=a.nombre;const r=this.replaceTexts(n.find((e=>e.idTramite==t)).descripcion),s=this.replaceTexts(a.observaciones),c=this.replaceTexts(n.find((e=>e.idTramite==t)).observacionFormaSolicitud),d=this.replaceTexts(n.find((e=>e.idTramite==t)).tiempoRespuesta),l=this.tabComponent.getElementsByClassName("cmp-tabs__tablist")[0].getElementsByClassName("cmp-tabs__tab"),u=this.tabComponent.getElementsByClassName("cmp-tabs__tabpanel");l[0].innerHTML="¿Qué es?";let m=document.createElement("p");m.innerHTML=r,u[0].replaceChildren(m),l[1].innerHTML="¿Qué Necesito?";let p=document.createElement("p");p.innerHTML=s,u[1].replaceChildren(p),l[2].innerHTML="¿A través de cuál canal puedo realizarlo?";let g=document.createElement("p");g.innerHTML=c,u[2].replaceChildren(g),l[3].innerHTML="¿En cuánto tiempo tendré respuesta?";let h=document.createElement("p");h.innerHTML=d,u[3].replaceChildren(h),this.tabComponent.classList.remove("hide"),this.tabComponent.style.display="block",this.procedureDetailDiv.appendChild(this.procedureTitle),this.procedureDetailDiv.appendChild(this.procedureDesc)}catch(e){console.log("error: "+e)}}}class ye{async renderGuideDetailData(e){new Le;const t=new ae,i=document.querySelector(".cmp-guide-procedures_services-container");t.hideData(),e=e.sort(((e,t)=>e.posicinDeLaTarjeta-t.posicinDeLaTarjeta)),document.querySelector(".procedure-detail-content-guias").style.display="none",document.querySelector(".procedure-detail-content-guias").innerHTML="",t.displayAndUpdateInfo(e);let o=document.getElementById("card-list");o=document.createElement("div"),o.classList.add("service-guide-card-list"),o.setAttribute("id","card-list");const n=document.getElementsByClassName("service-guide-card-detail");n[0].classList.remove("hide"),n[0].style.display="flex",i.classList.toggle("single",1==e.length),i.classList.toggle("list",e.length>3),i.classList.toggle("grid",e.length<=3),e.forEach((({detalleTramite:t,textHelp:i,duracionTramite:n,solicitud:a,botn:r,enlaceTrmite:s,paso:c,idtramite:d,idSubServicio:l,idDetalleMaestro:u})=>
1{const m=document.createElement("div");m.classList.add("cta-detail-card-main"),m.classList.toggle("cta-detail-single-card",1==e.length);const p=document.createElement("div");p.classList.add("cta-detail-card"),p.setAttribute("data-step",1);const g=document.createElement("div");g.classList.add("cta-detail-header"),g.innerHTML=n;const h=document.createElement("div");h.classList.add("cta-detail-body");const f=document.createElement("div");f.classList.add("cta-detail-body-textdiv"),f.innerHTML=a;const v=document.createElement("div");if(v.classList.add("cta-detail-body-button-container"),r||s){const e=document.createElement("button");e.classList.add("cta-detail-body-button"),e.innerHTML=r,e.classList.add("toggle-button"),e.addEventListener("click",(()=>{window.open(s,"_blank")})),v.appendChild(e)}if(d||l||u){m.setAttribute("data-step",c);const e=document.createElement("button");e.classList.add("cta-see-detail"),e.innerHTML=i||"Ver detalle del trámite",e.tabIndex=0,e.classList.add("toggle-button"),e.addEventListener("click",(async e=>{e.preventDefault();(new ve).loadProcedureDetail("d71915f0-ba1b-4eb6-ae24-c64348606bb7",d,l,u),document.querySelectorAll(".cmp-guide-procedures_services-container-cards > *").forEach((e=>e.innerHTML="")),document.querySelectorAll(".cmp-guide-procedures_services-container > *").forEach((e=>{e.childElementCount<2&&(e.innerHTML="")}));let t=JSON.parse(localStorage.getItem("previousStep"))||[];t.push("verDetalle"),localStorage.setItem("previousStep",JSON.stringify(t)),document.querySelector(".start-over-button").style.display="none",document.querySelector(".service-guide-options-container-info").style.display="none",document.querySelector(".cmp-guide-procedures_services-background-image").style.display="none"})),v.appendChild(e)}h.appendChild(f),h.appendChild(v),p.appendChild(g),p.appendChild(h),m.appendChild(p),o.appendChild(m)})),n[0].appendChild(o)}}class Ce{async renderGuideOptionData(e){const t=new ae,i=new Le;t.displayAndUpdateInfo(e),t.hideData(),e=e.sort(((e,t)=>e.posicinDeLaTarjeta-t.posicinDeLaTarjeta)),document.querySelector(".serviceType").textContent=e[0].nombreDelFlujo,document.querySelector(".serviceType").classList[1]&&document.querySelector(".serviceType").classList.remove(document.querySelector(".serviceType").classList[1]),document.querySelector(".serviceType").classList.add(e[0].nombreDelFlujo);const o=document.getElementsByClassName("service-guide-options-card");o[0].classList.remove("hide"),o[0].style.display="flex";let n=document.getElementById("card-list");n=document.createElement("div"),n.classList.add("service-guide-card-list"),n.setAttribute("id","card-list"),document.documentElement.style.setProperty("--grid-columns",e.length),e.forEach((({imagen:e,altIcono:t,ttulo:o,descripcinDeLaTarjeta:a,rutaGua:r,paso:s})=>{const c=document.createElement("div");c.classList.add("container-info-button");const d=document.createElement("img");d.classList.add("cta-image"),d.src=e,d.alt=t||"";const l=document.createElement("div");l.classList.add("cta-image-div"),l.appendChild(d);const u=document.createElement("div");u.classList.add("cta-text-div");const m=document.createElement("p");m.classList.add("cta-card-title"),m.innerHTML=o;const p=document.createElement("p");p.classList.add("cta-card-paragraph"),p.innerHTML=a&&"N/A"!=a?a:"",u.appendChild(p);const g=document.createElement("button");g.setAttribute("title",o),g.setAttribute("data-guide",r),g.setAttribute("data-step",s),g.classList.add("cta-card"),g.classList.add("toggle-button"),g.setAttribute("tabindex","0"),g.addEventListener("click",(async e=>{if(e.preventDefault(),r.includes("dam")){let e={contentFragmentPath:g.getAttribute("data-guide"),nextStep:g.getAttribute("data-step")},t="/bin/procedure-services/get-guide-contentfragment";await i.postRequest(t,e,!1)}else window.open(r,"_blank")})),u.appendChild(m),u.appendChild(p),c.appendChild(l),c.appendChild(u),g.appendChild(c),n.appendChild(g)})),o[0].appendChild(n)}}class Ee{async renderGuideSelectionData(e){const t=new ae,i=new Le;t.hideData(),e=e.sort(((e,t)=>
1e.posicinDeLaTarjeta-t.posicinDeLaTarjeta)),t.displayAndUpdateInfo(e);const o=document.getElementsByClassName("service-guide-selection-card");o[0].classList.remove("hide"),o[0].style.display="flex";let n=document.getElementById("card-list");n=document.createElement("div"),n.classList.add("service-guide-card-list"),n.setAttribute("id","card-list"),e.forEach((({tipoDeOpcin:e,altImagen:t,imagen:o,textoOpcion:a,optionIcon:r,rutaGua:s,paso:c})=>{const d=document.createElement("button");d.classList.add("cta-selection-card"),d.setAttribute("data-guide",s),d.setAttribute("data-step",c),d.classList.add("toggle-button");const l=document.createElement("img");l.classList.add("cta-selection-image"),l.setAttribute("name",`Imagen de ${e}`),l.src=o,l.alt=t||"";const u=document.createElement("h3");u.classList.add("cta-selection-card-title"),u.innerHTML=e;const m=document.createElement("div");m.classList.add("cta-selection-image-div"),m.appendChild(l);const p=document.createElement("div");p.classList.add("cta-selection-text-div"),p.appendChild(u),d.append(m,p),d.addEventListener("click",(async e=>{e.preventDefault(),s.includes("/")&&await i.postRequest("/bin/procedure-services/get-guide-contentfragment",{contentFragmentPath:s,nextStep:c},!1)})),n.appendChild(d)})),o[0].appendChild(n)}}class Ae{async renderGuideOptionData(e){const t=new ae,i=new Le;t.displayAndUpdateInfo(e),t.hideData(),e=function(e){for(let t=0;t<e.length-1;t++)for(let t=0;t<e.length-1;t++)if(e[t].posicinDeLaTarjeta>e[t+1].posicinDeLaTarjeta){let i=e[t];e[t]=e[t+1],e[t+1]=i}return e}(e);const o=document.getElementsByClassName("services-guide-duide-list-card");o[0].classList.remove("hide"),o[0].style.display="flex";let n=document.getElementById("card-list");n?(n.innerHTML="",document.querySelector(".cta-tip__container")&&document.querySelector(".cta-tip__container").remove(),document.querySelector(".cmp-guide-procedures_services-container")&&document.querySelector(".cmp-guide-procedures_services-container").classList.remove("tip")):(n=document.createElement("div"),n.classList.add("service-guide-card-list"),n.setAttribute("id","card-list")),e.forEach((e=>{const t=document.createElement("select");t.setAttribute("data-guide",e.rutaGua),t.setAttribute("data-step",e.paso),t.classList.add("cta-select"),t.setAttribute("aria-label","Municipios");const o=[{value:"0",text:"Selecciona un municipio"}];e.valoresMenuDesplegable.split(",").forEach(((e,t)=>{o.push({value:t,text:e})})),o.forEach((e=>{const i=document.createElement("option");i.value=e.value,i.textContent=e.text,t.appendChild(i)})),t.addEventListener("change",(async()=>{if(e.rutaGua.includes("/")){let e={contentFragmentPath:t.getAttribute("data-guide"),nextStep:t.getAttribute("data-step")},o="/bin/procedure-services/get-guide-contentfragment";await i.postRequest(o,e,!1)}})),n.appendChild(t)})),o[0].appendChild(n)}}class Se{async renderGuideOptionData(e){const t=document.getElementsByClassName("service-guide-tip-card"),i=document.querySelector(".cmp-guide-procedures_services-container");Array.from(i.children).forEach((e=>{0==e.children.length&&(e.style.display="none")})),t[0].classList.remove("hide"),t[0].style.display="flex",i.classList.toggle("tip",!0),e.forEach((({descripcinDeLaTarjeta:e,ttuloDeLaTarjeta:i})=>{const o=document.createElement("div");o.classList.add("cta-tip__container");const n=document.createElement("p");n.classList.add("cta-tip");const a=document.querySelector("span");a.textContent=i,n.innerHTML=e;const r=document.createElement("span");r.classList.add("cta-info-icon"),r.innerHTML="&#9432;",n.insertBefore(a,n.childNodes[0]),o.appendChild(r),o.appendChild(n),t[0].appendChild(o)}))}}class be{async renderGuideOptionData(e){new Le;const t=new ae,i=document.querySelector(".cmp-guide-procedures_services-container");t.hideData(),t.displayAndUpdateInfo(e);const o=document.getElementsByClassName("service-guide-info-card");o[0].classList.remove("hide"),o[0].style.display="flex",i.classList.toggle("tip",!0),e.forEach((({titulo:e,descripcion:t})=>{const i=document.createElement("div");i.classList.add("container-card");const n=document.createElement("div");n.classList.add("containerInfo");const a=document.createElement("p");a.classList.add("titulo"),a.textContent=e,n.appendChild(a),n.innerHTML+=t;const r=document.querySelector(".cta-tip a");r&&r.setAttribute("target","_blank");const s=document.createElement("span");s.classList.add("cta-info-icon"),s.innerHTML='\n                <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n                    <circle cx="10" cy="10" r="9.5" fill="#007934" stroke="white"/>\n                    <path d="M9.99738 4.818C10.2774 4.818 10.52 4.888 10.7254 5.028C10.9214 5.168 11.0194 5.35933 11.0194 5.602L11.0194 
111.314C11.0194 11.5847 10.9214 11.7947 10.7254 11.944C10.5294 12.0933 10.2867 12.168 9.99737 12.168C9.70804 12.168 9.46537 12.0933 9.26937 11.944C9.07337 11.7947 8.97537 11.5847 8.97537 11.314L8.97538 5.602C8.97538 5.35933 9.07804 5.168 9.28338 5.028C9.47938 4.888 9.71738 4.818 9.99738 4.818ZM9.99737 12.966C10.3334 12.966 10.618 13.078 10.8514 13.302C11.0847 13.5353 11.2014 13.8247 11.2014 14.17C11.2014 14.506 11.0847 14.786 10.8514 15.01C10.618 15.2433 10.3334 15.36 9.99737 15.36C9.65204 15.36 9.36737 15.2433 9.14337 15.01C8.91004 14.786 8.79337 14.506 8.79337 14.17C8.79337 13.8247 8.91004 13.5353 9.14337 13.302C9.36737 13.078 9.65204 12.966 9.99737 12.966Z" fill="white"/>\n                </svg>\n            ',i.appendChild(s),i.appendChild(n),o[0].appendChild(i)}))}}class we{async renderGuideOptionData(e){new Le;const t=new ae;document.querySelector(".cmp-guide-procedures_services-container");t.hideData(),t.displayAndUpdateInfo(e);let i=document.getElementById("card-list");i=document.createElement("div"),i.classList.add("service-guide-card-list"),i.setAttribute("id","card-list");const o=document.getElementsByClassName("service-guide-twin-card");o[0].classList.remove("hide"),o[0].style.display="flex",e.forEach((({descripcinTarjeta:e,tituloTarjeta:t})=>{const o=document.createElement("div");o.classList.add("container-card");const n=document.createElement("div");n.classList.add("card-header"),n.innerHTML=t,o.appendChild(n);const a=document.createElement("div");a.classList.add("card-body"),a.innerHTML=e,o.appendChild(a),i.appendChild(o)})),o[0].appendChild(i)}}class Le{async postRequest(e,t,i){return new Promise(((o,n)=>{i||(function(){if(0===Ne().length){Ie(["/content/dam/epm/guia-tramites---servicios/energía/paso-0"])}}(),function(e){let t=Ne();Array.isArray(t)||(t=[]);t.includes(e)||(t.push(e),Ie(t))}(t.contentFragmentPath));const a=new ye,r=new Ce,s=new Ee,c=new Ae,d=new Se,l=new we,u=new be;fetch(e,{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json"}}).then((e=>e.json().then((e=>{document.querySelectorAll(".cmp-guide-procedures_services-container-cards > *").forEach((e=>e.innerHTML="")),document.querySelectorAll(".cmp-guide-procedures_services-container-cards > *").forEach((e=>e.style.display="none")),document.querySelectorAll(".cmp-guide-procedures_services-container > *").forEach((e=>{e.childElementCount<2&&(e.innerHTML="",e.style.display="none")})),document.querySelector(".cmp-guide-procedures_services-container").classList.toggle("tip",!1),document.querySelector(".cmp-guide-procedures_services-container").classList.toggle("list",!1),document.querySelector(".start-over-button")&&(document.querySelector(".start-over-button").style.display="block"),function(){const e=document.querySelector(".progressBar .progressBarFill");if(!e)return;const t=Ne(),i=t[t.length-1]?.split("/").pop().split("-")[1],o=parseFloat(e.style.width)||0;let n=o;const a=/^\d+[a-zA-Z]+\d?$/;t.length>Me.previousLength?(Me.previousStep=i,Me.previousWidth=o,n=2===t.length?10:a.test(i)?o+10:"final"===i?100:o):(n=2===t.length?10:a.test(Me.previousStep)?Math.max(10,o-10):"final"===Me.previousStep?"final"===i?100:Me.previousWidth:o,Me.previousStep=t.length<=2?"1":i||"1b");Me.previousLength=t.length,e.style.width=Math.max(10,Math.min(n,100))+"%"}(),document.querySelector(".cmp-guide-procedures_services-background-image")&&(document.querySelector(".cmp-guide-procedures_services-background-image").style.display="block");const t={serviceGuideOptionsCard:[],serviceGuideSelectionCard:[],serviceGuideCardDetail:[],serviceGuideDuideListCard:[],serviceGuideTipCard:[],serviceGuideTwinCards:[],serviceGuideInfoCard:[]};for(const i of e)t[i.tipoDeTarjeta]&&t[i.tipoDeTarjeta].push(i);document.querySelectorAll(".service-guide")[0].style.display="flex",document.querySelectorAll(".div-button-guide-procedures_services")[0].style.display="flex",t.serviceGuideOptionsCard.length>0&&r.renderGuideOptionData(t.serviceGuideOptionsCard),t.serviceGuideSelectionCard.length>0&&s.renderGuideSelectionData(t.serviceGuideSelectionCard),t.serviceGuideCardDetail.length>0&&a.renderGuideDetailData(t.serviceGuideCardDetail),t.serviceGuideDuideListCard.length>0&&c.renderGuideOptionData(t.serviceGuideDuideListCard),t.serviceGuideTipCard.length>0&&d.renderGuideOptionData(t.serviceGuideTipCard),t.serviceGuideTwinCards.length>0&&l.renderGuideOptionData(t.serviceGuideTwinCards),t.serviceGuideInfoCard.length>0&&u.renderGuideOptionData(t.serviceGuideInfoCard),document.querySelectorAll(".service-guide-card-list")[0].style.display="flex",document.querySelectorAll(".service-guide-options-container-info")[0].style.display="flex"})))).catch((e=>{console.log("error: ",e),document.querySelector(".cmp-guide-procedures_services-container-info").style.display="none"}))}))}}function Ie(e){localStorage.setItem("previousStep",JSON.stringify(e))}function Ne(){const e=localStorage.getItem("previousStep");try{const t=e?JSON.parse(e):[];return Array.isArray(t)?t:[]}catch(e){return[]}}const Me={previousStep:"",previousWidth:0,previousLength:0};!function(){const e=new ae,t=new Le,i="/bin/procedure-services/get-guide-contentfragment";window.onload=o=>{const n=document.querySelector(".cmp-guide-procedures_services-container-info"),a=document.querySelector(".cmp-guide-procedures_services-background-image");a&&(a.style.display="none"),document.querySelectorAll(".service-card-button")&&(document.querySelectorAll(".service-card-button").forEach((e=>{e.addEventListener("click",(async function(){a.style.backgroundImage=`url(${e.parentElement.parentElement.getAttribute("data-bg")})`,n&&(n.style.display="flex");let o={contentFragmentPath:this.dataset.guide,nextStep:this.dataset.step};await t.postRequest(i,o,!1)}))})),document.querySelectorAll(".start-over-button").forEach((t=>{t.addEventListener("click",(function(){e.hideData(),e.showData(),localStorage.removeItem("previousStep"),document.querySelectorAll(".service-guide")[0].style.display="none",document.querySelectorAll(".service-guide-options-container-info")[0].style.display="none",document.querySelectorAll(".cmp-guide-procedures_services-container-cards > *").forEach((e=>e.innerHTML="")),document.querySelectorAll(".cmp-guide-procedures_services-container > *").forEach((e=>{e.childElementCount<2&&(e.innerHTML="")})),document.querySelector(".div-button-guide-procedures_services").style.display="none",document.querySelector(".procedure-detail-content-guias").style.display="none",localStorage.getItem("previousStep")||(document.querySelector(".cmp-guide-procedures_services-background-image").style.display="none")}))})),document.querySelectorAll(".class-back-option").forEach((o=>{o.addEventListener("click",(async function(){const o=document.querySelector(".tabs_guideProcedureAndServices");o&&(o.style.display="none"),document.querySelector(".procedure-detail-content-guias").innerHTML="";const a=JSON.parse(localStorage.getItem("previousStep"));if(2===a.length&&localStorage.removeItem("previousStep"),a.length>2){const o={contentFragmentPath:a[a.length-2],nextStep:"1"};e.removeValueFromCache("previousStep",a[a.length-1]),await t.postRequest(i,o,!0)}
1if(a.length<=2||2===a.length){document.getElementsByClassName("service-guide-options-card")[0].style.display="none",e.showData()}localStorage.getItem("previousStep")||(n.style.display="none",document.querySelector(".cmp-guide-procedures_services-background-image").style.display="none")}))})))},window.addEventListener("beforeunload",(function(){localStorage.removeItem("previousStep")}))}();i(97);const Oe={SERVICESTYPES:{ENERGIA:"1",AGUAS:"2",GAS:"3"},equivalentPqrServiceType:{1:"Energía",2:"Aguas",3:"Gas"},equivalentPqrName:{1:"Petición",2:"Quejas",3:"Reclamos",4:"Recursos"},UNALLOWEDROLS:{1:"Administrador Portal",2:"Ejecutivo Cuenta",4:"Administrador Nominaciones"},ROLES:{ENERGIA:{1240:"Energía telemedido",1241:"Energia no telemedido",1319:"Energía solar telemedida",1244:"Energía termica"},AGUA:{1246:"Aguas telemedida",1247:"Aguas no telemedida"},GAS:{1242:"Gas telemedida",1243:"Gas no telemedida"}},MESSAGES:{SERVER_INTERNAL_ERROR:"Se ha presentado un error en el sistema, por favor intenta de nuevo más tarde y si el error persiste comunícate con tu ejecutivo de cuenta"}};class Te{constructor(){this.createLoader()}static service=new ne;static security=new oe;static#e={};async getProfileRol(){try{const e=await fetch("/bin/cliente-corporativo/consultar/perfiles");if(!e.ok)throw new Error("Ocurrió un error++ "+e.status+" - "+e.statusText);const{Rol:t,Success:i,Mensaje:o,RolesPerfil:n,email:a}=await e.json();return{Rol:t,RolesPerfil:n,emailUser:a}}catch(e){return this.showModalError("En estos momentos no es posible atender tu solicitud. Te invitamos a comunicarte con la línea de atención al cliente (604) 44 44 800"),{Rol:null,RolesPerfil:[],emailUser:null}}}async getProfileInstalations(e,t,i){if(""===e.trim())return this.showModalError("Rol no puede estar vacío");if(""===t)return this.showModalError("Tipo de servicio no puede estar vacío");if(""===i.trim())return this.showModalError("El email no puede estar vacío");try{const o={idCuenta:"",rol:e,tipoServicio:t,usuario:i};let n=JSON.stringify(o);if(null!=Te.getDataCache(n))return JSON.parse(Te.getDataCache(n));const a="/bin/cliente-corporativo/consultar/instalaciones";let r=await Te.service.postService(o,a);const s=await Te.security.incomingInformation(r);return Te.setDataCache(n,s),JSON.parse(s)}catch(e){this.showModalError("En estos momentos no es posible atender tu solicitud."),this.hideLoader()}}async getConsultGeneric(e,t){try{const i={valorPqr:e,valorTipoServicio:t};let o=JSON.stringify(i);if(null!=Te.getDataCache(o))return JSON.parse(Te.getDataCache(o));const n="/bin/cliente-corporativo/pqr/consulta-generica",a=await Te.service.postService(i,n),r=await Te.security.incomingInformation(a);return Te.setDataCache(o,r),JSON.parse(r)}catch(e){this.hideLoader(),this.showModalError("En estos momentos no es posible atender tu solicitud.")}}async consultSegment(e){try{const t={nit:e};let i=JSON.stringify(t);if(null!=Te.getDataCache(i))return JSON.parse(Te.getDataCache(i));const o="/bin/cliente-corporativo/pqr/consultarsegmento",n=await Te.service.postService(t,o);if(!0===n.huboError)return n;const a=await Te.security.incomingInformation(n);return Te.setDataCache(i,a),JSON.parse(a)}catch(e){this.showModalError("En estos momentos no es posible atender tu solicitud.")}}async consultConfiguration(e,t){try{const i={segmentValue:e,subsegmentValue:t},o="/bin/cliente-corporativo/pqr/consultar-configuracion",n=await Te.service.postService(i,o);if(n.huboError)return n;const a=await Te.security.incomingInformation(n);return JSON.parse(a)}catch(e){this.showModalError("En estos momentos no es posible atender tu solicitud.")}}async savePqr(e){try{const t={user:e.user,nit:e.nit,pqrDescription:e.pqrDescription,registerId:e.registerId,selectedService:e.selectedService,pqrName:e.pqrName,pqrCause:e.pqrCause,contract:e.contract,address:e.address,asunto:e.asunto},i="/bin/cliente-corporativo/pqr/guardarpqr",o=await Te.service.postService(t,i);if(o.huboError)return o;const n=await Te.security.incomingInformation(o);return JSON.parse(n)}catch(e){this.showModalError("En estos momentos no es posible atender tu solicitud.")}}isInvalidRol(e){return null!=e&&""!=e.trim()&&Object.keys(Oe.UNALLOWEDROLS).includes(e)}deleteOption(e){document.querySelectorAll("#pqrTipoServicio option").forEach((t=>{t.value===e&&t.remove()}))}hasRolEnergia(e){return Object.keys(Oe.ROLES.ENERGIA).includes(e)}hasRolAgua(e){return Object.keys(Oe.ROLES.AGUA).includes(e)}hasRolGas(e){return Object.keys(Oe.ROLES.GAS).includes(e)}addOptionToSelect(e,t,i){const o=document.createElement("option");o.text=t,o.value=i,e.appendChild(o)}cleanSelect(e){for(;e.children.length>1;)e.removeChild(e.children[1])}showModalError(e){document.getElementById("modalTextErrorPqr").textContent=e,document.getElementById("modalErrorPqr").querySelector(".modal-layer").classList.add("open")}showModalSuccess(e){document.getElementById("modalTextSuccessPqr").textContent=e,document.getElementById("modalSuccessPqr").querySelector(".modal-layer").classList.add("open")}openModal(e){e.querySelector(".modal-layer").classList.add("open")}closeModal(e){e.querySelector(".modal-layer").classList.remove("open")}static setDataCache(e,t){Te.#e[e]=t}static getDataCache(e){return Te.#e[e]}createLoader(){document.body.insertAdjacentHTML("beforeend",'  \n\t\t\t<div class="pqr-loader hide">\n\t\t\t\t<img src="/content/dam/epm/iconos/loading.gif" alt="loader">\n\t\t\t</div>\n\t\t')}showLoader(){document.querySelector(".pqr-loader").classList.remove("hide"),document.body.style.overflowY="hidden"}hideLoader(){document.querySelector(".pqr-loader").classList.add("hide"),document.body.style.overflowY="auto"}areAllObjectValuesValid(e){return Object.values(e).every((e=>{switch(typeof e){case"string":return""!==e&&"n/a"!==e&&null!==e;case"boolean":return!0===e;case"object":return null!==e;default:return!0}}))}}window.addEventListener("load",(async()=>{const e=document.getElementById("formSolicitudPqr");if(!e)return;const t=new Te;t.showLoader();const i=/^[a-zA-Z0-9\s.,;:!¡?¿()\-áéíóúÁÉÍÓÚñÑüÜ]*$/,o=document.getElementById("pqrTipoServicio"),n=document.getElementById("pqrInstalacion"),a=document.getElementById("pqrTipo"),r=document.getElementById("pqrCausa"),s=document.getElementById("pqrDescripcion"),
1c=document.querySelector('[name="pqrTerminosyCondiciones"]'),d=document.querySelector("#formSolicitudPqr p a:nth-child(2)"),l=document.getElementById("modalButtonErrorPqr"),u=document.getElementById("modalButtonCaracteresInvalidPqr"),m=(document.getElementById("modalButtonSuccessPqr"),document.getElementById("pqrGuardar")),p=document.getElementById("pqrAceptarTerminosyCondiciones"),g=(document.querySelector(".cmp-epm-uploaderfile .file-list"),document.querySelector("epm-file-uploader")),h=document.getElementById("pqrTextRequiereAdjunto"),f=document.getElementById("modalCaracteresInvalidosPqr"),v=document.getElementById("modalErrorPqr"),y=(document.getElementById("modalSuccessPqr"),document.getElementById("modalTerminosCondicionesPqr"));e.style.display="none",m.disabled=!0;const C={},E={tipoServicio:"",instalacion:"",tipoPqr:"",causa:"",terminosyCondiciones:!1,isAttachmentRequired:!1,descripcion:""};let A=!1,S=null,b="",w="",L=0;l.addEventListener("click",(e=>{e.preventDefault(),t.closeModal(v)}));const{Rol:I,RolesPerfil:N,emailUser:M}=await t.getProfileRol();if(null===I||0===N.length||null===M)return t.showModalError(Oe.MESSAGES.SERVER_INTERNAL_ERROR),void t.hideLoader();if(t.isInvalidRol(I))return t.showModalError("Tienes un perfil de administrador o ejecutivo de cuenta y estos perfiles no pueden registrar PQRs"),void t.hideLoader();e.style.display="grid",t.hideLoader(),w=M;const O=new Proxy(E,{set(e,i,o){e[i]=o;let n=t.areAllObjectValuesValid(E)&&c.checked;return m.disabled=!n,!0}}),T=N.map((e=>e.Rol)),R=T.some((e=>t.hasRolAgua(e))),D=T.some((e=>t.hasRolEnergia(e))),q=T.some((e=>t.hasRolGas(e)));R||t.deleteOption(Oe.SERVICESTYPES.AGUAS),D||t.deleteOption(Oe.SERVICESTYPES.ENERGIA),q||t.deleteOption(Oe.SERVICESTYPES.GAS),o.addEventListener("change",(async e=>{const i=e.target.value;return O.tipoServicio=i,O.causa="",""===i.trim()||"n/a"===i.trim()?(t.hideLoader(),void t.showModalError("Debes seleccionar un tipo de servicio.")):(t.showLoader(),t.cleanSelect(n),S=await t.getProfileInstalations(I,i,M),S.huboError?(t.hideLoader(),void t.showModalError(S.mensajeError)):void(Array.isArray(S.respuesta.instalaciones)&&(S.respuesta.instalaciones.forEach((e=>{t.addOptionToSelect(n,e.genericoPps,e.codigoMarcopolo)})),t.hideLoader())))})),n.addEventListener("change",(e=>{const t=e.target.value;O.instalacion=t,b=S.respuesta.instalaciones.find((e=>e.codigoMarcopolo===t))})),a.addEventListener("change",(async e=>{try{t.showLoader();const i=e.target.value,n=o.value;if(O.tipoPqr=i,O.causa="",""===i.trim()||"n/a"===i.trim())return t.hideLoader(),void t.showModalError("Debes seleccionar un tipo de pqr.");if(""===n.trim()||"n/a"===n.trim())return t.hideLoader(),void t.showModalError("Debes seleccionar un tipo de servicio.");const a=await t.getConsultGeneric(i,n),s=JSON.parse(a.respuesta);if(!Array.isArray(s))return;t.cleanSelect(r),s.forEach((e=>{const i=e.Attributes["causaspcc.epm_psname"].Value,o=e.Id,n=e.Attributes.epm_anexos.Value;C[o]={Id:o,documentText:i,hasAttachment:n},t.addOptionToSelect(r,i,o)})),t.hideLoader()}catch(e){console.error("Ha ocurriod un error:: "+e)}})),r.addEventListener("change",(e=>{const i=e.target.value;if(O.causa=i,""===i.trim()||"n/a"===i.trim())return t.hideLoader(),void t.showModalError("Debes seleccionar una causa");A=C[i].hasAttachment,O.isAttachmentRequired=!A,h.style.display=A?"block":"none",L>0&&(O.isAttachmentRequired=!0)})),d.addEventListener("click",(e=>{e.preventDefault(),t.openModal(y)})),p.addEventListener("click",(e=>{e.preventDefault(),t.closeModal(y)})),u.addEventListener("click",(e=>{e.preventDefault(),t.closeModal(f)})),s.addEventListener("input",(e=>{e.target.value.trim().length>3?O.descripcion=e.target.value:O.descripcion=""})),c.addEventListener("change",(e=>{O.terminosyCondiciones=e.target.checked})),document.addEventListener("uploaderfile-filecountchanged",(e=>{const{count:t,files:i}=e.detail;if(L=t,t>0&&(h.style.display="none"),!A||!t)return A&&t<1?(h.style.display="block",void(O.isAttachmentRequired=!1)):void(A||(O.isAttachmentRequired=!0));O.isAttachmentRequired=!0})),m.addEventListener("click",(async e=>{try{if(e.preventDefault(),"n/a"===o.value.trim()||""===o.value.trim())return t.showModalError("Tipo de servicio es obligatorio.");if("n/a"===n.value.trim()||""===n.value.trim())return t.showModalError("La instalación es obligatoria.");if("n/a"===a.value.trim()||""===a.value.trim())return t.showModalError("El tipo de pqr es obligatoria.");if("n/a"===r.value.trim()||""===r.value.trim())return t.showModalError("La causa es obligatoria.");if(""===s.value.trim())return t.showModalError("La descripción es obligatoria");if(!i.test(s.value.trim()))return void t.openModal(f);if(""!=s.value.trim()&&s.value.length>345)return t.showModalError("La descripción no puede exceder 345 caracteres.");if(!c.checked)return t.showModalError("Debes aceptar los términos y condiciones.");if(A&&(L<1||""===L))return void t.showModalError("Por favor ten en cuenta que para la causa seleccionad
1a se requiere que adjuntes al menos un archivo.");t.showLoader();const d=await t.consultSegment(b.nit);if(!d.respuesta)return t.showModalError("No existe configuración de radicado para el segmento y subsegmento."),void t.hideLoader();if(!0===d.huboError)return t.showModalError(C.mensajeError),void t.hideLoader();const l=JSON.parse(d.respuesta),u=l[0]?.Attributes["segmento.epm_codigo"].Value,m=l[0]?.Attributes["subsegmento.epm_codigo"].Value,p=await t.consultConfiguration(u,m);if(!0===d.huboError)return t.showModalError(C.mensajeError),void t.hideLoader();const h=p?.list[0]?.idAsunto,v="Cliente gerenciado contrato: "+b.servicioSuscrito+". "+s.value.trim(),y={user:w,nit:b.nit,pqrDescription:v,registerId:g.getAttribute("transaction"),selectedService:Oe.equivalentPqrServiceType[o.value.trim()],pqrName:Oe.equivalentPqrName[a.value.trim()],pqrCause:r.options[r.selectedIndex].textContent,contract:b.servicioSuscrito,address:b.genericoPps,asunto:h},C=await t.savePqr(y);if(!0===C.huboError)return t.showModalError(Oe.MESSAGES.SERVER_INTERNAL_ERROR),void t.hideLoader();const E=C.respuesta.resultadoGenerarRadicado.respuesta;t.showModalSuccess(E),t.hideLoader()}catch(e){t.showModalError(Oe.MESSAGES.SERVER_INTERNAL_ERROR),t.hideLoader()}}))}));class Re{createContentCards(e,t,i,o,n,a=!1){i.classList.add("card_ps-item"),i.setAttribute("tabindex","0");const r=document.createElement("div");r.classList.add("card_image-div");var s=document.createElement("img"),c=e.filter((e=>e.code==n));s.src=c.length>0?c[0].imagePath:"/",s.classList.add("card_image"),r.appendChild(s);const d=document.createElement("div");d.classList.add("card_text-div");const l=document.createElement("p");l.classList.add("card_text"),l.textContent=t,d.appendChild(l),i.appendChild(r),i.appendChild(d),o.append(i),this.addCardHoverEvent(i,s),a&&this.addOnClickEvent(i,s,o)}addCardHoverEvent(e,t){var i=t.src;e.addEventListener("mouseenter",(()=>{t.src=this.getHoverImage(i)})),e.addEventListener("mouseleave",(()=>{e.classList.contains("card-selected")||(t.src=i)}))}addOnClickEvent(e,t,i){e.addEventListener("click",(()=>{i.querySelectorAll(".card_ps-item").forEach((e=>{var t=e.querySelector(".card_image");t.src=t.src.replace("-hover","")})),t.src=this.getHoverImage(t.src)}))}getHoverImage(e){var t=new URL(e).pathname.split(".");return t[0]+"-hover."+t[1]}removeSelectedCardsClass(e){e.querySelectorAll(".card_ps-item").forEach((e=>{e.classList.remove("card-selected")}))}}class De{procedureDetailContainer=document.querySelector(".procedure-detail-content");tabComponent=document.getElementById("procedure_tabs");procedureLinkClass="procedure-link";procedure=new qe;codesJson;toolTipsJson;async createProcedureDetail(e,t,i,o){const n=new fe;this.procedureDetailContainer.querySelector(".procedure-title").textContent=i.pregunta,this.codesJson=t.codes,this.toolTipsJson=t.tooltips;var a=document.querySelector(".master-content").querySelector(".card-selected");this.procedureDetailContainer.querySelector(".procedure-desc").textContent=i.nombre+" - "+a.getAttribute("title");var r=await n.requiServletPost("GetByIdTramiteIdSubServicioIdDetalleMaestro",e,i.id,"",i.idSubServicio,a.getAttribute("id-detalle"));this.procedure.hideProcedures();var s=this.replaceTexts(i.descripcion),c=this.replaceTexts(r.observaciones),d=this.replaceTexts(i.observacionFormaSolicitud),l=this.replaceTexts(i.tiempoRespuesta);const u=this.tabComponent.getElementsByClassName("cmp-tabs__tablist")[0].getElementsByClassName("cmp-tabs__tab"),m=document.getElementById("procedure_tabs").getElementsByClassName("cmp-tabs__tabpanel");window.location.hash=u[0].getAttribute("id").replace("panel",""),u[0].innerHTML="¿Qué es?";let p=document.createElement("p");p.innerHTML="",p.innerHTML=s,m[0].replaceChildren(p),u[1].innerHTML="¿Qué Necesito?";let g=document.createElement("p");g.innerHTML="",g.innerHTML=c,m[1].replaceChildren(g),u[2].innerHTML="¿A través de cuál canal puedo realizarlo?";let h=document.createElement("p");h.innerHTML="",h.innerHTML=d,m[2].replaceChildren(h),u[3].innerHTML="¿En cuánto tiempo tendré respuesta?";let f=document.createElement("p");f.innerHTML="",f.innerHTML=l,m[3].replaceChildren(f),this.tabComponent.style.display="block",this.procedureDetailContainer.querySelector(".back-button").addEventListener("click",(()=>{this.hideProcedureDetail(),o.style.display="flex"})),this.procedureDetailContainer.style.display="flex",this.addCodesEvents()}replaceTexts(e){const t=new fe;t.registLog("E108",e);var i=e.replaceAll("\r\n","<br>");return t.registLog("newText",i),i=this.replaceCodes(i),t.registLog("newText replace codes",i),i=this.replaceTooltips(i),t.registLog("newText replace tooltips",i),i}replaceCodes(e){const t=new fe;
1return this.codesJson.forEach((i=>{const o=i.code;var n=i.name;if(e.includes("["+o+"]")){t.registLog("replaceCodes",e);const r="haz clic aquí";let s=i.linkType.toLowerCase(),c="formato"==s||"interno"==s?i.internalLink:i.externalLink,d=document.createElement("a");d.classList.add(this.procedureLinkClass),n=n.replace(".",""),isNaN(o.replace("[","").replace("]",""))?(d.target="_blank",d.href=c):d.setAttribute("id-tramite",o.replace("[","").replace("]",""));var a=n.charAt(0).toLowerCase()+n.slice(1);e.includes(r+" ["+o+"]")?(t.registLog("replaceCodes Code ",o),t.registLog("text.includes(clickHereText ",e),e=this.replaceTextForElement(r,o,d,e),t.registLog("after text.includes(clickHereText ",e)):e.includes(a+" ["+o+"]")?(t.registLog("firstLetterLowerCaseName",e),e=this.replaceTextForElement(a,o,d,e),t.registLog("after firstLetterLowerCaseName",e)):e.includes(n+" ["+o+"]")&&(t.registLog("name",e),e=this.replaceTextForElement(n,o,d,e),t.registLog("after firstLetterLowerCaseName",e))}})),e}replaceTextForElement(e,t,i,o){return i.textContent=e,o=o.replaceAll(e+" ["+t+"]",i.outerHTML)}replaceTooltips(e){return this.toolTipsJson.forEach((t=>{if(e.includes(t.keyWord)){var i=document.createElement("strong");i.classList.add("procedure-tooltip"),i.textContent=t.keyWord;var o=document.createElement("div");o.classList.add("tooltip-description");var n=document.createElement("img");n.src=t.imagePath;var a=document.createElement("span");a.textContent=t.description,o.appendChild(n),o.appendChild(a),i.appendChild(o),e=e.replaceAll(" "+t.keyWord," "+i.outerHTML)}})),e}hideProcedureDetail(){this.tabComponent.style.display="none",this.procedureDetailContainer.style.display="none"}addCodesEvents(){document.querySelectorAll("a[id-tramite]").forEach((e=>{e.addEventListener("click",(()=>{this.procedure.activeProcedure(e.getAttribute("id-tramite"))}))}))}}class qe{procedureContainer=document.querySelector(".procedure-content");procedureCardsContainer=this.procedureContainer.querySelector(".procedure-cards-container");filterInput=document.querySelector("div[data-list-container-id='procedure-cards_id'] div input");async createProcedure(e,t,i,o){const n=new fe,a=new De;var r=document.querySelector(".master-content").querySelector(".card-selected").getAttribute("id-detalle"),s=await n.requiServletPost("GetByIdSubServicioIdDetalleMaestroIdCanal",t,"","",e,r),c=Object.values(s);this.procedureContainer.querySelector(".procedure-texts").querySelector(".title").innerText="Trámite de {}".replace("{}",i),this.procedureCardsContainer.innerHTML="",c.forEach((e=>{var i=document.createElement("div");i.classList.add("procedure-card");var n=document.createElement("h3");n.classList.add("card-title"),n.innerText=e.pregunta;var r=document.createElement("p");r.classList.add("card-description"),r.innerText=e.nombre;var s=document.createElement("div");s.classList.add("button-container");var c=document.createElement("button");c.innerText="Ver detalle del trámite",c.setAttribute("tabindex","0"),c.addEventListener("click",(()=>{a.createProcedureDetail(t,o,e,this.procedureContainer)})),s.appendChild(c),i.appendChild(n),i.appendChild(r),i.appendChild(s),i.setAttribute("id-tramite",e.id),this.procedureCardsContainer.appendChild(i)})),this.procedureContainer.style.display="flex",this.addOrderEvent(),this.resetInput(),this.hideFilterText()}activeProcedure(e){this.procedureCardsContainer.querySelector('.procedure-card[id-tramite="'+e+'"]').querySelector(".button-container button").click(),document.querySelector(".procedure-detail-content .procedure-title").scrollIntoView({behavior:"smooth"})}hideProcedures(){this.procedureContainer.style.display="none"}addOrderEvent(){var e=this.procedureContainer.querySelector("#procedures-order");e.selectedIndex=0;var t=this.procedureCardsContainer.querySelectorAll("div[id-tramite]"),i=[];t.forEach((e=>{const t=e.querySelector(".card-title").textContent,o=e.querySelector(".card-description").textContent;i.push([t,o,e])}));const o=[...i];e.addEventListener("change",(()=>{switch(e.options[e.selectedIndex].value){case"pregunta":i.sort(((e,t)=>
1e[0].localeCompare(t[0]))),this.procedureCardsContainer.innerHTML="",i.forEach((e=>{this.addCardToContainer(e[2])}));break;case"nombre":i.sort(((e,t)=>e[1].localeCompare(t[1]))),this.procedureCardsContainer.innerHTML="",i.forEach((e=>{this.addCardToContainer(e[2])}));break;case"seleccione":this.procedureCardsContainer.innerHTML="",o.forEach((e=>{this.addCardToContainer(e[2])}))}c()}))}addCardToContainer(e){this.procedureCardsContainer.appendChild(e)}resetInput(){this.filterInput.value=""}hideFilterText(){document.querySelector(".procedure-content .not-found").classList.remove("show")}}class Pe{subServiceContainer=document.getElementById("sub-servicios-content-id");async createSubService(e,t,i,o,n,a,r){const s=new fe,d=new Re,l=new qe,u=new De;var m=await s.requiServletPost("GetByIdServicioIdDetalleMaestroIdCanal",i,"",t,"",e),p=Object.values(m);o.style.display="none";var g=this.subServiceContainer.querySelector(".service-selected"),h=g.querySelector("img");g.querySelector(".service-title").innerText=a,h.src=d.getHoverImage(r.src.replace("-hover",""));var f=this.subServiceContainer.querySelector(".services-cards-container");this.subServiceContainer.querySelector(".title-content").innerHTML="Selecciona el <strong> producto de {}</strong> del que deseas consultar los trámites disponibles".replace("{}",a),f.innerHTML="",p.forEach((e=>{var t=document.createElement("button");t.id="subservicio-"+e.id,d.createContentCards(n.images,e.nombre,t,f,e.id,!0),t.addEventListener("click",(async function(){d.removeSelectedCardsClass(f),this.classList.add("card-selected"),await l.createProcedure(e.id,i,e.nombre,n),u.hideProcedureDetail(),c()}))})),1==f.childElementCount&&f.children[0].click(),this.subServiceContainer.querySelector(".back-button").addEventListener("click",(()=>{this.hideSubMenu(),o.style.display="flex",function(){const e=new qe,t=new De;e.hideProcedures(),t.hideProcedureDetail()}()})),this.subServiceContainer.style.display="flex"}hideSubMenu(){this.subServiceContainer.style.display="none"}}class ke{async createServiceMenu(e,t,i,o){const n=new fe,a=new Pe,r=new Re,s=document.getElementById("servicios-content-id");var c=await n.requiServletPost("GetByIdDetalleMaestroIdCanal",t,"","","",e),d=Object.values(c);s.innerHTML="";var l=document.createElement("div");l.classList.add("services-cards-container");var u=document.createElement("p");u.classList.add("title-content"),u.innerHTML="Selecciona el servicio de <strong>{}</strong> para el que requieres información".replace("{}",i),d.forEach((i=>{var n=document.createElement("button");n.setAttribute("id","servicio-"+i.id),r.createContentCards(o.images,i.nombre,n,l,i.id),n.addEventListener("click",(()=>{a.createSubService(e,i.id,t,s,o,i.nombre,n.querySelector(".card_image"))}))})),s.appendChild(u),s.appendChild(l),s.style.display="flex"}}!function(){var e,t,i;let o,n,a;const r=new fe,s=new ke,c=new Re;async function d(e,t){return new Promise(((i,o)=>{fetch("/bin/content-fragment-finder?searchRoot="+e+"&cfModel="+t).then((e=>e.json())).then((e=>{i(e)})).catch((e=>{console.log("error: ",e),o(e)}))}))}window.addEventListener("load",(async()=>{if(!window.location.pathname.includes("tramites-y-servicios"))return;await async function(){const r=document.getElementById("master-detail");var s=r.dataset.cfSearchRoot,c=r.dataset.cfCodes,l=r.dataset.cfImages,u=r.dataset.cfTooltips;try{e=await d(s,c),o=Object.values(e),i=await d(s,l),n=Object.values(i),t=await d(s,u),a=Object.values(t)}catch(e){console.error("getContentFragment errorr: ",e)}}();var l={images:i,tooltips:t,codes:e};const u=await r.requiServletGet("Maestros-M1"),m=Object.values(u),p=document.getElementById("master-content-id");m[0].detalle.forEach((e=>{const t=m[0].empresa.codigo,o=document.createElement("button");o.setAttribute("title",e.nombreDetalle),o.setAttribute("id-detalle",e.idDetalle),o.setAttribute("empresa",t),o.addEventListener("click",(function(){c.removeSelectedCardsClass(p),s.createServiceMenu(e.idDetalle,t,e.nombreDetalle,l),function(){const e=new Pe,t=new qe,i=new De;e.hideSubMenu(),t.hideProcedures(),i.hideProcedureDetail()}(),this.classList.add("card-selected")})),c.createContentCards(i,e.nombreDetalle,o,p,e.idDetalle,!0)}))})),window.addEventListener("load",(()=>{const e=document.getElementsByClassName("cmp-mega-menu")[0];e&&(e.classList.contains("malambo")&&document.getElementsByTagName("body")[0].classList.add("malambo"),e.classList.contains("oriente")&&document.getElementsByTagName("body")[0].classList.add("oriente"))}))}();class xe{constructor(e){this.form=e,this.formOptions=this.form.querySelectorAll(".cmp-form-options"),this.optionValuesList=[],this.containersAvailable=[],this.formOptions&&this.init()}init(){this.hideShowFields(),this.handleDepartmentAndMunicipies()}hideShowFields(){this.formOptions.forEach((e=>{const t=e.querySelectorAll('[name="handleFields"]');if(!t.length)return;const i=t.length>1?t:t[0]?.children??[];this.optionValuesList=Array.from(i,(e=>e.value)),this.containersAvailable=[...this.optionValuesList.map((e=>this.form.querySelector(`#${e}
1`))).filter(Boolean)],this.containersAvailable.forEach((e=>e.classList.add("hide"))),t.forEach((e=>{if(e.hasAttribute("checked")||e.children.length>0&&"0"!==e.value&&""!==e.value){const t=this.form.querySelector(`#${e.value}`);t&&t.classList.remove("hide")}e.addEventListener("change",(()=>{this.containersAvailable.forEach((e=>e.classList.add("hide")));const t=this.form.querySelector(`#${e.value}`);t&&t.classList.remove("hide")}))}))}))}handleDepartmentAndMunicipies(){const e=[this.form.querySelector('[name="department"]'),this.form.querySelector('[name="municipality"]')];if(!e[0]&&!e[1])return;const[t,i]=e;for(const e of i.children){const[t,i]=e.value.split("-");e.setAttribute("data-department",i),e.value=t}t.addEventListener("change",(()=>{const e=t.options[t.selectedIndex].textContent.trim();for(const t of i.children){const i=t.getAttribute("data-department");t.style.display=i===e?"block":"none"}i.value=""}))}}class Be{constructor(e){this.form=e,this.btnSubmit=e.querySelector("button[type='submit']"),this.btnSubmitContainer=this.btnSubmit?.parentElement,this.utils=new ae,this.visibleFields=[],this.btnSubmit&&this.form}handleSubmitButton(){if(!this.form||!this.btnSubmit||!this.btnSubmitContainer)return;const e=Array.from(this.btnSubmitContainer.classList)[1];this.btnSubmitContainer.classList.remove(e),this.btnSubmit.classList.add("disabled"),this.btnSubmit.disabled=!0;const t=()=>{if(this.visibleFields=Array.from(this.form.querySelectorAll("input.required, select.required")).filter((e=>this.utils.isVisible(e))),!this.visibleFields.length)return this.btnSubmit.classList.remove("disabled"),void(this.btnSubmit.disabled=!1);this.visibleFields.length>0&&this.visibleFields.every((e=>{if("radio"===e.type){const t=this.form.querySelectorAll(`input[type="radio"][name="${e.name}"]`);return Array.from(t).some((e=>e.checked))}return"select"===e.tagName.toLowerCase()?e.value&&"0"!==e.value:""!==e.value.trim()}))?(this.btnSubmit.classList.remove("disabled"),this.btnSubmitContainer.classList.add(e),this.btnSubmit.disabled=!1):(this.btnSubmit.classList.add("disabled"),this.btnSubmitContainer.classList.remove(e),this.btnSubmit.disabled=!0)};this.form.addEventListener("input",t),this.form.addEventListener("change",t),t()}}class _e{constructor(e){e&&(this.form=e,this.formButton=new Be(e),this.utils=new ae,this.touchedFields=[],this.processedFields=new Set,this.init())}init=()=>{this.handleFields()};handleFields=()=>{const e=()=>{this.indice++;const e=[...this.form.querySelectorAll("fieldset > label > input"),...this.form.querySelectorAll("input.cmp-form-text__text"),...this.form.querySelectorAll("textarea"),...this.form.querySelectorAll("fieldset >select"),...this.form.querySelectorAll("coral-textfield"),...this.form.querySelectorAll("coral-select")].filter(Boolean).filter((e=>this.utils.isVisible(e)));this.touchedFields=[...this.touchedFields,...e],this.touchedFields=this.touchedFields.filter(((e,t,i)=>{const o=e.className;return!!o.includes("drop-down")||t===i.findIndex((e=>e.className===o))}));const t=this.touchedFields.filter((t=>!e.includes(t)));for(const e of t){let t=e.parentElement.parentElement?.querySelector("p.cmp-form-text__help-block")??e.parentElement?.parentElement?.querySelector("p.cmp-form-options__help-message");e.classList.remove("has-help"),t?.classList.add("hide")}for(const t of e){const e=t.classList.contains("cmp-form-options__field--drop-down");let i=t.parentElement?.querySelector("p.cmp-form-text__help-block")??t.parentElement?.parentElement?.querySelector("p.cmp-form-options__help-message");if(this.processedFields.has(t)||(i?.classList.add("hide"),this.processedFields.add(t)),t.hasAttribute("placeholder")&&(t.parentElement.querySelector("label").classList.add("required"),t.classList.add("required")),!i)continue;const o=i.closest(".cmp-form-options--radio")||i.closest(".cmp-form-options--checkbox")?t.parentElement?.parentElement:t.parentElement;o?.insertAdjacentElement("afterend",i),o.querySelector("label")?.classList.add("required"),o.querySelector("legend")?.classList.add("required"),t.classList.add("required"),(!e&&""!==t.value.trim()||e&&"0"!==t.value)&&(i.classList.add("hide"),t.classList.remove("has-help")),t.addEventListener("blur",(()=>{""!==t.value.trim()&&"0"!=t.value||(i.classList.remove("hide"),t.classList.add("has-help"))})),t.addEventListener("focus",(()=>{""===t.value.trim()&&"0"==t.value||(i.classList.add("hide"),t.classList.remove("has-help"))}))}this.formButton.handleSubmitButton()};e(),this.form.addEventListener("change",(()=>{e()}))}}window.addEventListener("load",(()=>{const e=document.querySelectorAll(".cmp-form");e.length&&e.forEach((e=>{new xe(e),new _e(e)}))})),window.calendar=a,window.addEventListener("load",(()=>{const e=new oe,t=new ne,i=document.querySelector(".cmp-calendar--view"),o=document.querySelector(".cmp-calendar--loader"),n=document.getElementById("fecha_cita"),r=document.querySelectorAll("[name='horario']"),s=document.querySelector("#inpectionGasForm"),c=document.querySelector("#secondForm"),d=document.querySelector("#responseModal .modal-layer");let l={},u=[];
1if(!s&&!c)return;o.style.display="flex";const m=c?.querySelector("#goBack"),p=(e="servicio")=>{document.querySelectorAll(".modal-layer").forEach((e=>e.classList.remove("open"))),d.classList.add("open");const{containers:t}=formUtils.handleContainersStep(c,!1);t.filter((({id:e})=>"appointment-error-wrapper"===e)).forEach((t=>{t.classList.remove("hide");const i=t.querySelector("#errorServicio"),o=t.querySelector("#errorAgendamiento"),n=t.querySelector(".close-modal-button > a"),a="servicio"===e;i?.parentElement?.classList.toggle("hide",!a),o?.parentElement?.classList.toggle("hide",a),n?.addEventListener("click",(()=>{document.location.reload(),d.classList.remove("open")}),{once:!0})}))},g=c.querySelector("#hora_cita");c.querySelector("#secondStep"),m?.addEventListener("click",(()=>{l={},u=[],s?.classList.remove("hide"),c?.parentElement?.parentElement?.classList.add("hide"),window.localStorage.removeItem("cfv2_requests"),window.localStorage.removeItem("cfv2_formdata"),s&&formUtils.clearStepFields(s),c&&formUtils.clearStepFields(c),i&&(i.innerHTML=""),o.style.display="flex",document.querySelectorAll(".modal-layer").forEach((e=>{e.classList.remove("open")})),document.querySelector("#Direccion")?.classList.add("hide"),document.querySelector("#Contrato")?.classList.add("hide");const e=document.querySelector("#validarContrato");e?.parentElement&&e.parentElement.classList.add("opacity")})),document.addEventListener("formStepModal:success",(async s=>{const{detail:{selectedStepNumber:c}}=s;if("1"!==c)return;const d=await storageInfo.getCombinedFormData(),m={numeroInstalacion:d.data.pagina,tipoTransaccion:"ConsultarDisponibilidadAgenda"},g=await t.postService(m,"/bin/crm/corporate-clients/orquestador"),h=await e.incomingInformation(g),f="string"==typeof h?JSON.parse(h):h,{error:v,errorBusiness:y,data:C={}}=f,{diasDisponiblesJornadas:E=[]}=C;v||y?p("servicio"):E.length?(l={...d,data:{...d.data,...C,diasDisponiblesJornadas:[]},tipoTransaccion:"AgendarServicio",numeroInstalacion:d.data.pagina,Departamento:d.data.codigoDepartamento,Municipio:d.data.codigoMunicipio,Direccion:d.data.direccionEstandarizada},await storageInfo.saveEncryptedFormData(l),o.style.display="none",u=E,(new a).insertCalendarWithData(i,u,{onDateSelected:async e=>{const t=e.split("/"),i=`${t[2]}-${t[0]}-${t[1]}`;Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value").set.call(n,i),n.dispatchEvent(new Event("input",{bubbles:!0})),n.dispatchEvent(new Event("change",{bubbles:!0})),n.dispatchEvent(new Event("blur",{bubbles:!0}));const o=u.find((e=>e.fecha===i));Array.from(r).forEach((e=>{((e,t=[])=>{e.innerHTML="";const i=document.createElement("option");i.value="vacio",i.textContent=t.length?"Selecciona un horario":"No hay horarios disponibles",e.appendChild(i),t.length&&t.forEach((t=>{const i=document.createElement("option");i.value=t.horaInicio,i.textContent=t.horaEtiqueta,e.appendChild(i)})),e.value="vacio"})(e,o?.horarios||[])}))}})):p("agendamiento")})),g.addEventListener("change",(async e=>{const t=e.target.value,i=n.value,o=u.find((e=>e.fecha===i))?.horarios?.find((e=>e.horaInicio===t));o&&(Object.assign(l,{fecha:i,horaInicioJornada:o.horaInicioJornadaPT,horaFinJornada:o.horaFinJornadaPT,idContratista:o.idContratista,idGrupoContratistaJornada:o.idGrupoContratistaJornada,hora:o.horaEtiqueta,FechaInicioVisita:o.horaInicio,FechaFinVisita:o.horaFin}),await storageInfo.saveEncryptedFormData(l))}))}));class $e{async showElement(e){document.getElementById(e).style.display="flex",document.getElementById(e).style.flexDirection="column"}async hideElement(e){document.getElementById(e).style.display="none"}async setElementText(e,t){document.getElementById(e).textContent=t}async getCookieValue(e){try{const t=document.cookie?document.cookie.split("; "):[];for(const i of t){const t=i.split("="),o=t.shift(),n=t.join("=");if(decodeURIComponent(o)===e)return decodeURIComponent(n)}return"false"}catch(e){return console.log("GetCookieValue: ",erroe.message),"false"}}async getCookieAsNumber(e){const t=e+"=",i=document.cookie.split(";");for(let e of i)if(e=e.trim(),e.startsWith(t))return Number(e.substring(t.length));return null}async customizer(e){const t=JSON.parse(e.response),i=document.body;t.accessibility.contrast&&i.classList.add("dark-mode")}async showModal(){document.getElementById("super-app-modal-id").style.display="flex",document.getElementById("super-app-modal-button-id").click()}async closeSuperAppModal(){document.getElementById("super-app-modal-id").style.display="none",document.getElementsByClassName("close")[0].click()}async hideModalContent(){await this.hideElement("super-app-modal-warning-icon"),await this.hideElement("super-app-modal-success-icon"),await this.hideElement("super-app-modal-alert-icon"),await this.hideElement("super-app-modal-info-icon"),await this.hideElement("super-app-modal-message-necesitas-activar-nfc"),await this.hideElement("super-app-modal-message-necesitas-activar-nfc-second-message"),await this.hideElement("super-app-modal-message-conecta-con-pse"),await this.hideElement("super-app-modal-message-transaccion-en-proceso"),await this.hideElement("super-app-modal-message-pago-exitoso"),await this.hideElement("super-app-modal-message-opcion-no-disponible"),await this.hideElement("super-app-modal-message-tiempo-agotado"),await this.hideElement("super-app-modal-message-tarjeta-medidor-invalido"),await this.hideElement("super-app-modal-message-no-pudo-leer-tarjeta"),await this.hideElement("super-app-modal-message-pago-fallido"),await this.hideElement("super-app-modal-message-saldo-pendiente"),await this.hideElement("super-app-modal-message-error-lectura"),await this.hideElement("super-app-modal-message-no-lee-tarjeta"),await this.hideElement("super-app-modal-message-tarjeta-invalida"),await this.hideElement("super-app-to-init-card-read-id"),await this.hideElement("pse-transaction-in-progress-container-id"),await this.hideElement("pse-no-banking-institution-container-id"),await this.hideElement("pse-no-pse-service-container-id"),await this.hideElement("pse-no-payment-container-id"),await this.hideElement("pse-success-payment-container-id"),await this.hideElement("pse-confirm-payment-due-container-id"),await this.hideElement("pse-confirm-payment-failed-container-id"),await this.hideElement("pse-confirmed-payment-container-id"),await this.hideElement("super-app-container-no-recheck-transaction-id"),await this.hideElement("super-app-preventive-validation-container-id")}async hideScreenContent(){await this.hideElement("superapp-welcome-web-id"),await this.hideElement("superapp-container-footer-id"),await this.hideElement("superapp-welcome-id"),await this.hideElement("super-app-puntos-recarga-screen-id"),await this.hideElement("superapp-card-recharge-screen-id"),await this.hideElement("super-app-user-data-screen-id"),await this.hideElement("super-app-pse-recharge-value-id"),await this.hideElement("superapp-card-recharge-final-screen-id"),await this.hideElement("super-app-card-success-recharge-id"),await this.hideElement("superapp-card-active-balance-screen-id"),await this.hideElement("super-app-loader-container-id"),await this.hideElement("super-app-pse-form-container-id"),await this.hideElement("super-app-recharge-title-scree-id"),await this.hideElement("super-app-recheck-title-scree-id")}async errorLecturaMessage(){await this.hideModalContent(),await this.hideScreenContent(),await this.showElement("super-app-modal-alert-icon"),await this.showElement("super-app-modal-message-error-lectura"),await this.showModal()}async readCardErrorMessage(e){await this.utils.writeMessage(`Falló en enviar comando de la fase ${JSON.stringify(e)}`),await this.hideModalContent(),await this.hideScreenContent(),await this.showElement("super-app-modal-alert-icon"),await this.showElement("super-app-modal-message-no-lee-tarjeta"),await this.showModal()}}class Fe{constructor(){this.utils=new ae,this.customizeMethods=new $e}async getIsFlutter(){try{const e=await irisAuthService.isFlutter;if(e)return await this.utils.writeMessage(`Is Flutter, Data: ${e}`),console.log("Is Flutter, data: ",e),void 0!==e}catch(e){return console.log("Error | getIsFlutter: ",e.message),await this.utils.writeMessage(`getIsFlutter | Error: ${e.message}`),!1}}async getIsAutheticate(){console.log("SuperAppMethods | getIsAutheticate");try{const e=await irisAuthService.isAuthenticate();if(e)await this.utils.writeMessage(`Is Authenticate Data: ${e.response}`),await this.getUserInformation();else{console.log("Is Not Authenticate");const e=document.querySelector("#superapp-userInfo-id p");e.textContent="El usuario no ha iniciado sesión en la super app",e.style.display="block"}}catch(e){console.log("Error | getIsAuthenticate: ",e.message)}}async getUserInformation(){console.log("SuperAppMethods | getUserInformation");try{const e=await irisInfoDeviceServices.getInformationUser();e.response?(console.log("SuperAppMethods | informationuserData: ",e.response),await this.utils.writeMessage(`User Information Data: ${e.response}`)):await this.utils.writeMessage(`getUserInformation No response: ${e}`)}catch(e){showErrorMessage("No ha sido posible obtener la información del usuario"),await this.utils.writeMessage(`Error | getUserInformation: ${e.message}`)}}async showUserInformation(e){await this.utils.writeMessage(`ShowUser Information: Usuario ${e.id}, ${e.fullName}, ${e.phoneNumber}
1, ${e.identificationNumber}, ${e.email}`);const t=document.querySelector("#superapp-userInfo-id p");t.textContent=`Usuario ${e.id}, ${e.fullName}, ${e.phoneNumber}, ${e.identificationNumber}, ${e.email}`,t.style.display="block"}async getInfoGeneral(){await this.utils.writeMessage("SuperAppMethods | getInfoGeneral Function");try{const e=await irisInfoDeviceServices.getInfoGeneral();if(await this.utils.writeMessage(`General Information Data: ${JSON.stringify(e)}`),e.response)return await this.utils.writeMessage("getGeneralInfoData success"),e.response}catch(e){await this.utils.writeMessage(`Error | getInfoGeneral : ${e.message}`)}}async getIsAvailableNFC(){let e=!1;try{const t=await irisISODEPNFCService.nfcIsEnabled();await this.utils.writeMessage("getIsAvailableNFC | isNFCEnabled: "+JSON.stringify(t)),t.response?(await this.utils.writeMessage("Available NFC Data: "+JSON.stringify(t.response)),e=!0):(await this.utils.writeMessage("No Available NFC Data: "+JSON.stringify(t)),await this.customizeMethods.showElement("super-app-modal-warning-icon"),await this.customizeMethods.showElement("super-app-modal-message-necesitas-activar-nfc-second-message"))}catch(e){await this.utils.writeMessage("getIsAvailableNFC | Error :"+JSON.stringify(e.message)),await this.customizeMethods.showElement("super-app-modal-warning-icon"),await this.customizeMethods.showElement("super-app-modal-message-necesitas-activar-nfc-second-message")}return e}}
1class Ue{constructor(){this.utils=new ae,this.security=new oe,this.restServices=new ne,this.customizeMethods=new $e}async manageRechargevalue(e){const t=document.getElementById("super-app-recharge-value-id"),i=document.getElementById("super-app-total-value-id");t.textContent=e,i.textContent=e}async managePSEForm(e,t,i){await this.utils.writeMessage("managePSEForm Init");try{if(t=(t=t.replace("$","")).replace(".",""),null===e.get("identification")||null===e.get("identificationNumber")||null===e.get("fullName")||null===e.get("email")||null===e.get("phoneNumber")||null===e.get("address")||null===e.get("type")||null===e.get("financeEntity")||0===e.get("financeEntity")||"0"===e.get("financeEntity"))await this.utils.writeMessage("managePSEForm Init Algun elemento es null"),null===e.get("type")&&(console.log("type es nulo"),document.getElementById("form-options-1295029835-helpMessage").style.display="block"),null===e.get("identification")&&(console.log("identification es nulo"),document.getElementById("form-options-1507692997-helpMessage").style.display="block"),null!==e.get("financeEntity")&&0!==e.get("financeEntity")&&"0"!==e.get("financeEntity")||(console.log("financeEntity es nulo"),document.getElementById("form-options-728928397-helpMessage").style.display="block");else{await this.utils.writeMessage("managePSEForm Init Else"),document.getElementById("form-options-1295029835-helpMessage").style.display="none",document.getElementById("form-options-1507692997-helpMessage").style.display="none",document.getElementById("pse-form-financial-field-id-helpMessage").style.display="none",await this.utils.writeMessage("managePSEForm Init Else 2"),await this.utils.writeMessage("managePSEForm Init Inicia crear payload");const o={operation:"CrearRegistroPago",tipoIdentificacion:e.get("identification"),numeroIdentificacion:e.get("identificationNumber"),CardSN:i,nombreCompleto:e.get("fullName"),correoElectronico:e.get("email"),celular:e.get("phoneNumber"),direccion:e.get("address"),tipoUsuario:e.get("type"),idBanco:e.get("financeEntity"),ValorRecarga:t};await this.utils.writeMessage("managePSEForm | createrecordRequest");const n=await this.restServices.postService(o,"/bin/supperapp/PSEServlet");await this.security.incomingInformation(n).then((async e=>{const t=JSON.parse(e);if(t.codigoCUS&&void 0!==t.urlPSE&&(await this.customizeMethods.hideModalContent(),await this.customizeMethods.showElement("super-app-modal-info-icon"),await this.customizeMethods.showElement("super-app-modal-message-conecta-con-pse"),await this.customizeMethods.showModal(),setTimeout((async()=>{window.location.href=t.urlPSE}),2e3)),t.codigoError)switch(await this.utils.writeMessage("CreatePayResponse Error"),t.codigoError){case"-1":await this.utils.writeMessage("Mensaje : -1",t.mensajeError),await this.customizeMethods.hideModalContent(),await this.customizeMethods.showElement("super-app-modal-warning-icon"),await this.customizeMethods.showElement("pse-transaction-in-progress-container-id"),await this.customizeMethods.showModal();break;case"-2":await this.utils.writeMessage("Mensaje -2: ",t.mensajeError),await this.customizeMethods.hideModalContent(),await this.customizeMethods.showElement("super-app-modal-warning-icon"),await this.customizeMethods.showElement("pse-no-banking-institution-container-id"),await this.customizeMethods.showModal();break;case"-3":await this.utils.writeMessage("Mensaje : -3",t.mensajeError),await this.customizeMethods.hideModalContent(),await this.customizeMethods.showElement("super-app-modal-warning-icon"),await this.customizeMethods.showElement("pse-no-pse-service-container-id"),await this.customizeMethods.showModal();break;case-99:await this.utils.writeMessage("Mensaje : -99",t.mensajeError),await this.customizeMethods.hideModalContent(),await this.customizeMethods.showElement("pse-no-payment-container-id"),await this.customizeMethods.showElement("super-app-modal-warning-icon"),await this.customizeMethods.showModal()}})).catch((async e=>{await this.utils.writeMessage("PSE Service Error: ",e.message),await this.customizeMethods.errorLecturaMessage()}))}}
1catch(e){console.log("catch managePSEForm  ",e.message),await this.utils.writeMessage("Error managePSEForm: ",e.message),await this.customizeMethods.errorLecturaMessage()}}async confirmPayment(e){try{const t={idTransaccion:e,operation:"ConfirmarPago"},i=await this.restServices.postService(t,"/bin/supperapp/PSEServlet");await this.security.incomingInformation(i).then((async e=>{const t=JSON.parse(e);if(document.getElementById("pse-confirm-payment-due-button-id").addEventListener("click",(async function(){await this.customizeMethods.closeSuperAppModal(),await this.customizeMethods.hideModalContent(),await this.customizeMethods.showElement("superapp-welcome-id")})),document.getElementById("pse-confirm-payment-failed-button-id").addEventListener("click",(async function(){await this.customizeMethods.closeSuperAppModal(),await this.customizeMethods.hideModalContent(),await this.customizeMethods.showElement("superapp-welcome-id")})),"Aprobado"===t.estadoCUS&&t.codigoCUS)switch(t.estadoCUS){case"Aprobado":return await this.customizeMethods.hideModalContent(),await this.customizeMethods.showElement("super-app-modal-success-icon"),await this.customizeMethods.showElement("pse-success-payment-container-id"),await this.customizeMethods.showModal(),!0;case"Pendiente":await this.customizeMethods.hideModalContent(),await this.customizeMethods.showElement("super-app-modal-info-icon"),await this.customizeMethods.showElement("pse-confirm-payment-due-container-id"),await this.customizeMethods.showModal();break;case"Rechazado":await this.customizeMethods.hideModalContent(),await this.customizeMethods.showElement("super-app-modal-alert-icon"),await this.customizeMethods.showElement("pse-confirm-payment-failed-container-id"),await this.customizeMethods.showModal()}})).catch((async e=>{await this.utils.writeMessage("Confirm payment service | Error: ",e.message),await this.customizeMethods.errorLecturaMessage()}))}catch(e){await this.utils.writeMessage("Error confirm payment function: ",e.message),await this.customizeMethods.errorLecturaMessage()}}}class He{constructor(){this.utils=new ae,this.customizeMethods=new $e}async sendApduCommand(e){try{await this.utils.writeMessage("SuperAppSetCommand | sendApduCommand"),await this.utils.writeMessage("SuperAppSetCommand | arregloAPDUReq: ",e);let t=await irisISODEPNFCService.nfcSendAPDUCommand(e);return console.log("SuperAppSetCommand | nfcResponse: ",t),await this.utils.writeMessage("nfcResponse: ",t),t}catch(e){throw console.log("SuperAppSetCommand | errorResponse: ",e),e.response="ISODEPNFCInvalidAPDUCommand",e.response}}}class je{constructor(){this.utils=new ae,this.security=new oe,this.restService=new ne,this.superAppMethods=new Fe,this.superAppSetCommand=new He,this.customizeMethods=new $e}async voucherPhase(e,t,i,o){try{await this.utils.writeMessage("SuperAppPhaseVoucher | pantalla final");const n=JSON.parse(o.mensajeOperacion);await this.utils.writeMessage("SuperAppPhaseVoucher | recheckPhase: "+JSON.stringify(o)),await this.utils.writeMessage("SuperAppPhaseVoucher | firstResponse: "+JSON.stringify(e)),await this.utils.writeMessage("SuperAppPhaseVoucher | Mensaje Operación: "+JSON.stringify(n)),await this.utils.writeMessage("SuperAppPhaseVoucher | lastSuccessPhaseResponse: "+JSON.stringify(i)),await this.utils.writeMessage("SuperAppPhaseVoucher | Inicio formateo precio");const a=Number(i.valorTransaccion),r=new Intl.NumberFormat("es-CO",{style:"currency",currency:"COP",minimumFractionDigits:0,maximumFractionDigits:0}).format(a);await this.customizeMethods.setElementText("super-app-recharge-summary-value-id",r),await this.customizeMethods.setElementText("super-app-recharge-summary-measure-id",n.m3Recarga+" m3");const[s,c]=n.fechaRecarga.split("T"),[d,l]=c.split(".");await this.customizeMethods.setElementText("super-app-recharge-summary-date-id",s),await this.customizeMethods.setElementText("super-app-recharge-summary-time-id",d),await this.customizeMethods.setElementText("recharge-final-screen-medidor-id",n.idElementoMedicion),await this.customizeMethods.setElementText("recharge-final-screen-nro-tarjeta-id",t),await this.customizeMethods.setElementText("recharge-final-screen-direccion-id",e.direccion),await this.customizeMethods.setElementText("recharge-final-screen-titular-id",e.nombreCliente),await this.customizeMethods.setElementText("recharge-final-screen-numero-aprobacion-id",i.codigoCUS);document.querySelector("#recharge-final-screen-notification-id p b").textContent=" "+i.correoElectronico,await this.customizeMethods.hideScreenContent(),await this.customizeMethods.showElement("super-app-card-success-recharge-id"),await this.utils.writeMessage("SuperAppPhaseVoucher | send Voucher");const u={repisado:!0,operation:"Comprobante",idTransaccion:i.idTransaccion};this.restService.postService(u,"/bin/supperapp/PSEServlet")}catch(e){throw await this.utils.writeMessage("SuperAppPhaseVoucher | Error: "+JSON.stringify(e)),e}}}class Je{constructor(){this.utils=new ae,this.security=new oe,this.restService=new ne,this.superAppMethods=new Fe,this.superAppSetCommand=new He,this.customizeMethods=new $e}async recheckPhase(e,t,i,o,n,a){try{console.log("SuperAppPhaseRecharge | rechPhase",e),await this.utils.writeMessage("SuperAppPhaseRecharge | rechPhase",e);const n={marcaModSerie:t.marcaModSerie,Operacion:"Repisar",CardSN:o,IdCanalVenta:825,TipoLector:"USB",idTransacCanalVenta:a,APDUResponse:i.response},r=await this.restService.postService(n,"/bin/supperapp/recharge");await this.utils.writeMessage("SuperAppPhaseRecharge | Recharge Service");const s=await this.security.incomingInformation(r),c=JSON.parse(s);if(await this.utils.writeMessage("SuperAppPhaseRecharge | Recharge response"),c.estadoOperacion)return c.arregloAPDUReq[0].index=
1parseInt(c.arregloAPDUReq[0].index),c.arregloAPDUReq[1].index=parseInt(c.arregloAPDUReq[1].index),c;await irisISODEPNFCService.nfcStopSession(),await this.customizeMethods.errorLecturaMessage()}catch(e){throw console.log("SuperAppPhaseRecheck | Error : ",e),await this.utils.writeMessage(`SuperAppPhaseRecheck | Error : ${e}`),e}}}class Ge{constructor(){this.utils=new ae,this.security=new oe,this.restService=new ne,this.superAppMethods=new Fe,this.superAppSetCommand=new He,this.customizeMethods=new $e}async validatePhase(e,t){try{await this.utils.writeMessage("SuperAppPhaseValidate.js | validatePhase");const i={Operacion:"ValidarIdentificar",CardSN:e,ValorRecarga:t};this.utils.writeMessage("SuperAppPhaseValidate.js | validateRequest"),await this.utils.writeMessage("SuperAppPhaseValidate.js | before validate phase");const o=await this.restService.postService(i,"/bin/supperapp/recharge"),n=await this.security.incomingInformation(o),a=JSON.parse(n);if(await this.utils.writeMessage("Proceso repisar validateRequestData: ",JSON.stringify(a)),a.estadoOperacion)return a.arregloAPDUReq[0].index=parseInt(a.arregloAPDUReq[0].index),a.arregloAPDUReq[1].index=parseInt(a.arregloAPDUReq[1].index),a;console.log("SuperAppPhaseValidate | else"),await this.utils.writeMessage(`Error en respuesta de servicio Validar: ${JSON.stringify(o)}`),await this.customizeMethods.showElement("super-app-modal-warning-icon"),await this.customizeMethods.showElement("super-app-modal-message-tarjeta-invalida"),await this.customizeMethods.showModal()}catch(e){throw await this.utils.writeMessage(`SuperAppPhaseValidate | validatePhase: ${JSON.stringify(e)}`),e}}}class Ve{constructor(){this.utils=new ae,this.security=new oe,this.restService=new ne,this.superAppMethods=new Fe,this.superAppSetCommand=new He,this.customizeMethods=new $e}async certificatePhase(e,t,i){try{await this.utils.writeMessage("SuperAppPhaseCertificate | certificatePhase");const o={Operacion:"Certificar",CardSN:t,ValorRecarga:i,APDUResponse:e.response};await this.utils.writeMessage("SuperAppPhaseCertificate | certificateRequest: ",o);const n=await this.restService.postService(o,"/bin/supperapp/recharge"),a=await this.security.incomingInformation(n);await this.utils.writeMessage("SuperAppPhaseCertificate | third service");const r=JSON.parse(a);if(await this.utils.writeMessage("SuperAppPhaseCertificate | certificate: ",r.estadoOperacion),r.estadoOperacion)return r.arregloAPDUReq[0].index=parseInt(r.arregloAPDUReq[0].index),r.arregloAPDUReq[1].index=parseInt(r.arregloAPDUReq[1].index),r;await irisISODEPNFCService.nfcStopSession(),await this.customizeMethods.errorLecturaMessage()}catch(e){throw console.log("SuperAppPhaseCertificate | error: ",e),await this.utils.writeMessage(`SuperAppPhaseCertificate | certificatePhase: ${e}`),e}}}class ze{constructor(){this.utils=new ae,this.security=new oe,this.restService=new ne,this.superAppMethods=new Fe,this.superAppSetCommand=new He,this.customizeMethods=new $e}async authenticatePhase(e,t,i){try{console.log("SuperAppPhaseAuthenticate | authenticatePhase"),await this.utils.writeMessage("Init SuperAppPhaseAuthenticate | authenticatePhase");const o={Operacion:"Autenticar",CardSN:t,ValorRecarga:i,APDUResponse:e.response},n=await this.restService.postService(o,"/bin/supperapp/recharge");await this.utils.writeMessage("SuperAppPhaseAuthenticate | authenticateService");const a=await this.security.incomingInformation(n),r=JSON.parse(a);if(await this.utils.writeMessage("SuperAppPhaseAuthenticate | authChannels"),r.estadoOperacion)return r.arregloAPDUReq[0].index=parseInt(r.arregloAPDUReq[0].index),r;await this.utils.writeMessage(`SuperAppPhaseAuthenticate | Error Segundo catch Autenticar: ${error.message}`),await irisISODEPNFCService.nfcStopSession(),await this.customizeMethods.errorLecturaMessage()}catch(e){throw console.log("SuperAppPhaseAuthenticate | AuthenticatePhase error: ",e),await this.utils.writeMessage(`SuperAppPhaseAuthenticate | AuthenticatePhase error:  ${e}`),e}}}class Ze{constructor(){this.utils=new ae,this.security=new oe,this.restServices=new ne,this.customizeMethods=new $e}async requestLastSuccessTransaction(e){try{await this.utils.writeMessage("SuperAppPhaseLastSuccessTransaction | requestLastSuccessTransaction");const t={Operacion:"ConsultarUltimaTransaccionExitosa",CardSN:e};await this.utils.writeMessage("SuperAppPhaseLastSuccessTransaction | requestLastSuccessTransaction");const i=await this.restServices.postService(t,"/bin/supperapp/recharge"),o=await this.security.incomingInformation(i);await this.utils.writeMessage("requestLastSuccessTransaction | Result: "+JSON.stringify(o));const n=JSON.parse(o);if(n.idTransaccion)return await this.utils.writeMessage("SuperAppPhaseLastSuccessTransaction | entró al if: "+JSON.stringify(n)),n;await this.utils.writeMessage("SuperAppPhaseLastSuccessTransaction | Respuesta erronea del servicio ObtenerIdUltimaTransaccionExitosa"),await this.utils.writeMessage("No hay una transacción pendiente que se pueda repisar"),await this.customizeMethods.hideModalContent(),await this.customizeMethods.showElement("super-app-modal-info-icon"),await this.customizeMethods.showElement("super-app-container-no-recheck-transaction-id"),await this.customizeMethods.showModal()}catch(e){throw await this.utils.writeMessage("SuperAppPhaseLastSuccessTransaction | Error : "+JSON.stringify(e)),e}}}class Qe{constructor(){this.utils=new ae,this.security=new oe,this.restServices=new ne,this.superAppPhaseRecheck=new Je,this.customizeMethods=new $e,this.superAppPhaseVoucher=new je,this.superAppPhaseValidate=new Ge,this.superAppPhaseCertificate=new Ve,this.superAppPhaseAuthenticate=new ze,this.superAppPhaseLastSuccessTransaction=new Ze}async requestRecheck(e){await this.utils.writeMessage("SuperAppRecheckProccess | init Prueba 2");try{const t=await this.superAppPhaseLastSuccessTransaction.requestLastSuccessTransaction(e);await this.utils.writeMessage("SuperAppRecheckProccess | lastSuccessPhaseResponse: "+JSON.stringify(t)),irisISODEPNFCService.nfcStartSession("120"),await this.utils.writeMessage("Sesión NFC Iniciada");const i=await this.superAppPhaseValidate.validatePhase(e,t.valorTransaccion);if(await this.utils.writeMessage("SuperAppRecheckProccess | validatePhaseResponse"),i){await this.utils.writeMessage("SuperAppRecheckProccess | Seteo 1er comando: "+JSON.stringify(i.arregloAPDUReq));const o=await this.sendApduCommand(i.arregloAPDUReq);await this.utils.writeMessage("SuperAppRecheckProccess | Respuesta 1er: "+JSON.stringify(o));const n=await this.superAppPhaseAuthenticate.authenticatePhase(o,e,t.valorTransaccion);if(await this.utils.writeMessage("SuperAppRecheckProccess | authenticatePhaseReponse"+JSON.stringify(n.arregloAPDUReq)),n){await this.utils.writeMessage("SuperAppRecheckProccess | Seteo 2do comando");const o=await this.sendApduCommand(n.arregloAPDUReq);await this.utils.writeMessage("SuperAppRecheckProccess | Respuesta 2do comando: "+JSON.stringify(o));const a=await this.superAppPhaseCertificate.certificatePhase(o,e,t.valorTransaccion);if(await this.utils.writeMessage("SuperAppRecheckProccess | certificatePhaseResponse: "+JSON.stringify(a)),a){await this.utils.writeMessage("SuperAppRecheckProccess | Seteo 3er comando: "+JSON.stringify(a.arregloAPDUReq));const o=await this.sendApduCommand(a.arregloAPDUReq);await this.utils.writeMessage("SuperAppRecheckProccess | Respuesta 3er comando: "+JSON.stringify(o));const n=await this.superAppPhaseRecheck.recheckPhase("Repisar",i,o,e,t.valorTransaccion,t.idTransaccionOpen);if(await this.utils.writeMessage("SuperAppRecheckProccess | recheckPhase"),n){await this.utils.writeMessage("SuperAppRecheckProccess | Seteo 4to comando");const o=await this.sendApduCommand(n.arregloAPDUReq);if(await this.utils.writeMessage("SuperAppRecheckProccess | Respuesta 4to comando: "+JSON.stringify(o)),await irisISODEPNFCService.nfcStopSession(),o){await this.utils.writeMessage("SuperAppRecheckProccess | Recheck apduResponse");const a={message:"Recarga Recheck: ",fourthApduResponse:o};await this.restServices.postService(a,"/bin/regist-log"),await this.utils.writeMessage("SuperAppRecheckProccess | Tarjeta Recargada"),await this.superAppPhaseVoucher.voucherPhase(i,e,t,n)}else await irisISODEPNFCService.nfcStopSession(),await this.utils.writeMessage("Tarjeta no recargada"),await this.customizeMethods.hideModalContent(),await this.customizeMethods.showElement("super-app-modal-alert-icon"),await this.customizeMethods.showElement("super-app-modal-message-pago-fallido"),await this.customizeMethods.showModal()}else await irisISODEPNFCService.nfcStopSession(),await this.customizeMethods.readCardErrorMessage("Repisar")}else await irisISODEPNFCService.nfcStopSession(),await this.customizeMethods.readCardErrorMessage("Certificar")}else await irisISODEPNFCService.nfcStopSession(),await this.customizeMethods.readCardErrorMessage("Autenticar")}else await irisISODEPNFCService.nfcStopSession(),await this.customizeMethods.readCardErrorMessage("ValidarIdentificar")}catch(e){await this.utils.writeMessage("SuperAppRecheckProccess| rechargeProccess: "+JSON.stringify(e)),e.includes("estadoOperacion")&&(await this.utils.writeMessage("Undefined EstadoOperacion| rechargeProccess: "+JSON.stringify(e)),await irisISODEPNFCService.nfcStopSession(),await this.customizeMethods.errorLecturaMessage()),e.includes("establecer")&&(await this.utils.writeMessage("SuperAppRecheckProccess | id de establecer: "+JSON.stringify(e)),await this.customizeMethods.showElement("super-app-modal-warning-icon"),await this.customizeMethods.showElement("super-app-modal-message-no-lee-tarjeta"),await this.customizeMethods.showModal()),await this.customizeMethods.showModal()}}async sendApduCommand(e){await this.utils.writeMessage("SuperAppRecheckProccess | this.sendApduCommand: "+JSON.stringify(e));try{let t=await irisISODEPNFCService.nfcSendAPDUCommand(e);return await this.utils.writeMessage("nfcResponse: "+JSON.stringify(t)),t}catch(e){switch(await irisISODEPNFCService.nfcStopSession(),await this.utils.writeMessage("SuperAppRecheckProccess | this.sendApduCommand Error response: "+JSON.stringify(e)),await this.utils.writeMessage("SuperAppRecheckProccess | this.sendApduCommand Message error response: "+JSON.stringify(e.message)),await this.customizeMethods.hideModalContent(),e.response){case"ISODEPNFCReadingTimeout":await this.utils.writeMessage("SuperAppRecheckProccess | ISODEPNFCReadingTimeout"),await this.customizeMethods.showElement("super-app-modal-warning-icon"),await this.customizeMethods.showElement("super-app-modal-message-tiempo-agotado");break;case"ISODEPNFCTagNotCompatible":await this.utils.writeMessage("SuperAppRecheckProccess | ISODEPNFCTagNotCompatible"),await this.customizeMethods.showElement("super-app-modal-warning-icon"),await this.customizeMethods.showElement("super-app-modal-message-tarjeta-invalida");break;case"ISODEPNFCOutOfSync":await this.utils.writeMessage("SuperAppRecheckProccess | ISODEPNFCOutOfSync"),await this.customizeMethods.showElement("super-app-modal-warning-icon"),await this.customizeMethods.showElement("super-app-modal-message-no-lee-tarjeta");break;case"ISODEPNFCInvalidAPDUCommand":await this.utils.writeMessage("SuperAppRecheckProccess | ISODEPNFCInvalidAPDUCommand"),await this.customizeMethods.showElement("super-app-modal-alert-icon"),await this.customizeMethods.showElement("super-app-modal-message-error-lectura")}await this.customizeMethods.showModal()}}}class Ye{constructor(){this.utils=new ae,this.security=new oe,this.restServices=new ne,this.customizeMethods=new $e}async RecordWaterPaymentTransaction(e,t){let i="";try{await this.utils.writeMessage("RecordWaterPaymentTransaction");const o={Operacion:"RegistroPagoTransaccionAguas",idTransaccion:t};await this.utils.writeMessage("RecordWaterPaymentTransaction | before service");const n=await this.restServices.postService(o,"/bin/supperapp/recharge");await this.security.incomingInformation(n).then((async t=>{const o=JSON.parse(t);if(await this.utils.writeMessage("RecordWaterPaymentTransaction | serviceResponse"+JSON.stringify(o)),null!==o.idTransaccionPago&&null!=o.idTransaccionOpen&&null!==o.fechaRegistro)switch(await this.utils.writeMessage("RecordWaterPaymentTransaction | if"),await this.customizeMethods.closeSuperAppModal(),await this.customizeMethods.hideModalContent(),i=o.idTransacionOpen,e){case"confirmedPayment":await this.utils.writeMessage("RecordWaterPaymentTransaction | confirmedPayment"),await this.customizeMethods.showElement("superapp-card-recharge-screen-id"),i=o.idTransaccionOpen;break;case"successPayment":await this.utils.writeMessage("RecordWaterPaymentTransaction | successPayment"),await this.customizeMethods.showElement("superapp-card-recharge-final-screen-id"),i=o.idTransaccionOpen}else await this.utils.writeMessage("RecordWaterPaymentTransaction | else"),i="none",await this.customizeMethods.hideModalContent(),await this.customizeMethods.showElement("super-app-modal-alert-icon"),await this.customizeMethods.showElement("super-app-modal-message-error-lectura")}))}catch(e){await this.utils.writeMessage("RecordWaterPaymentTransaction | error: "+JSON.stringify(e)),await this.customizeMethods.hideModalContent(),await this.customizeMethods.showElement("super-app-modal-alert-icon"),await this.customizeMethods.showElement("super-app-modal-message-error-lectura")}return i}}class We{#t;#i;#o;#n;#a;#r;#s;#c;#d;#l;#u;#m;#p;#g;#h;#f;#v;#y;constructor(){this.#i=document.getElementById("superapp-consultaHistorialRecarga-xp"),this.#y=new ae}#C(){this.#i&&(this.#y.writeMessage("[SuperAppConsultarHistoricosRecarga] Inicio del flujo de consulta de históricos"),this.#E(),this.#A(),this.#S())}iniciar(){this.#C()}#E(){this.#o=this.#i.querySelector("#contrato"),this.#n=this.#i.querySelector("#direccion"),this.#a=this.#i.querySelector("#superapp-consultaHistorialRecarga-step-0"),this.#r=this.#i.querySelector("#superapp-consultaHistorialRecarga-step-1"),this.#s=this.#r?.querySelector("#contratoForm"),this.#c=this.#r?.querySelector("#direccionForm"),this.#d=this.#i.querySelector("#infoHistorial"),this.#l=this.#i.querySelector("#infoDetalle"),this.#u=this.#l?.querySelector("#infoHistorialTemplate"),this.#m=this.#l?.querySelector("#encabezadoHistorial"),this.#p=this.#l?.querySelector("#detalleRecargas")}#A(){this.#o?.addEventListener("click",(e=>{e.preventDefault(),this.#b("contrato")})),this.#n?.addEventListener("click",(e=>{e.preventDefault(),this.#b("direccion")}))}#w(e){return`${e}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}#b(e){this.#y.writeMessage(`[SuperAppConsultarHistoricosRecarga] Usuario seleccionó: ${e}`);const t=this.#s?.parentElement?.parentElement,i=this.#c?.parentElement?.parentElement;t?.classList.add("hide"),i?.classList.add("hide"),this.#l?.parentElement?.classList.add("hide"),this.#d?.parentElement?.classList.add("hide"),this.#p?.parentElement?.classList.add("hide");const o=document.querySelector("[title='modal_image']"),n=t?.querySelector("#calendarContrato")?.querySelector(".cmp-calendar--view"),a=i?.querySelector("#calendarDireccion")?.querySelector(".cmp-calendar--view");if(t?.querySelector(".modal-layer")?.classList.remove("open"),i?.querySelector(".modal-layer")?.classList.remove("open"),"contrato"===e){this.#s?.getAttribute("data-servlet-path");const e=this.#s?.querySelector("[name='fechaInicial']"),i=this.#s?.querySelector("[name='fechaFinal']");e?.setAttribute("readonly",!0),i?.setAttribute("readonly",!0),t?.classList.remove("hide"),n?.parentElement?.classList.add("hide"),window.formValidations?.validateFields?.(this.#s),o?.addEventListener("click",(e=>{e.preventDefault(),this.#y.writeMessage("[SuperAppConsultarHistoricosRecarga] Usuario abrió información del formulario de contrato");const{containers:i}=window.formUtils.handleContainersStep(t);t?.querySelector(".modal-layer")?.classList.add("open");i.find((e=>"imageRefence"===e.id))?.classList.remove("hide")})),this.#f=e,e?.addEventListener("pointerdown",(()=>{this.#y.writeMessage("[SuperAppConsultarHistoricosRecarga] Usuario abrió calendario de fecha inicial - contrato"),this.#f=e,this.#L(n),n?._handleOutsideClick&&(document.removeEventListener("pointerdown",n._handleOutsideClick),setTimeout((()=>{document.addEventListener("pointerdown",n._handleOutsideClick)}),0))})),i?.addEventListener("pointerdown",(()=>{this.#y.writeMessage("
1[SuperAppConsultarHistoricosRecarga] Usuario abrió calendario de fecha final - contrato"),this.#f=i,this.#L(n,"75%"),n?._handleOutsideClick&&(document.removeEventListener("pointerdown",n._handleOutsideClick),setTimeout((()=>{document.addEventListener("pointerdown",n._handleOutsideClick)}),0))})),this.#I(n,(()=>this.#f))}if("direccion"===e){const e=this.#c?.getAttribute("data-servlet-path")||"",t=this.#c?.querySelector("[name='fechaInicial']"),o=this.#c?.querySelector("[name='fechaFinal']");t?.setAttribute("readonly",!0),o?.setAttribute("readonly",!0),i?.classList.remove("hide"),a?.parentElement?.classList.add("hide"),formOptions.initialize(this.#c),window.normalSubmit?.handleSubmit?.(this.#c,e),window.formValidations?.validateFields?.(this.#c),this.#v=t,t?.addEventListener("pointerdown",(()=>{this.#y.writeMessage("[SuperAppConsultarHistoricosRecarga] Usuario abrió calendario de fecha inicial - dirección"),this.#v=t,this.#L(a),a?._handleOutsideClick&&(document.removeEventListener("pointerdown",a._handleOutsideClick),setTimeout((()=>{document.addEventListener("pointerdown",a._handleOutsideClick)}),0))})),o?.addEventListener("pointerdown",(()=>{this.#y.writeMessage("[SuperAppConsultarHistoricosRecarga] Usuario abrió calendario de fecha final - dirección"),this.#v=o,this.#L(a,"75%"),a?._handleOutsideClick&&(document.removeEventListener("pointerdown",a._handleOutsideClick),setTimeout((()=>{document.addEventListener("pointerdown",a._handleOutsideClick)}),0))})),this.#I(a,(()=>this.#v))}this._formHttpSuccessBound||(this._formHttpSuccessBound=!0,this.#N())}#I(e,t){if(!e||!t)return;const i=new a;e?.parentElement?.querySelector(".cmp-calendar--loader")?.classList.add("hide"),$(e).hasClass("hasDatepicker")&&$(e).datepicker("destroy"),window.__calendarActiveInput=window.__calendarActiveInput||null;const o=e=>{e.target.closest(".ui-datepicker")&&(window.__calendarActiveInput=t())},n=i=>{const a=t(),r=a?.closest(".textfield"),s=i.target,c=s===a||r?.contains(s),d=!!s.closest(".ui-datepicker");c||d||(window.__calendarActiveInput=null,this.#M(e),document.removeEventListener("pointerdown",n),document.removeEventListener("pointerdown",o))};i.insertCalendar(e,{onSelect:i=>{const a=t();if(!a)return;const r=i.split("/"),s=`${r[2]}-${r[0]}-${r[1]}`;a.value=s,window.__calendarActiveInput=null,a.dispatchEvent(new Event("input",{bubbles:!0})),a.dispatchEvent(new Event("change",{bubbles:!0})),a.dispatchEvent(new Event("blur",{bubbles:!0})),this.#M(e),document.removeEventListener("pointerdown",n),document.removeEventListener("pointerdown",o)}}),document.addEventListener("pointerdown",o),e._handleOutsideClick=n}#L(e,t="52%"){const i=e?.parentElement;i&&(i.classList.remove("hide"),i.style.position="absolute",i.style.zIndex="9999",i.style.background="#fff",i.style.top=t,i.style.left="calc(50% - 152.5px)")}#M(e){const t=e?.parentElement;t&&t.classList.add("hide")}#N(){document.addEventListener("formHttp:success",(({detail:e})=>{this.#y.writeMessage("[SuperAppConsultarHistoricosRecarga] Respuesta exitosa del servicio de históricos");const t=this.#s?.parentElement?.parentElement,i=this.#c?.parentElement?.parentElement,o=document.querySelector("#infoHistorial.cmp-accordion")||document.querySelector("#infoHistorial .cmp-accordion"),{data:n,data:{InfoRecarga:a=[]}={}}=e||{};if(!o||!a.length)return void this.#y.writeMessage("[SuperAppConsultarHistoricosRecarga] Respuesta recibida sin información de recargas");this.#y.writeMessage(`[SuperAppConsultarHistoricosRecarga] Recargas recibidas: ${a.length}`),t?.querySelector(".modal-layer")?.classList.remove("open"),i?.querySelector(".modal-layer")?.classList.remove("open"),t?.classList.add("hide"),i?.classList.add("hide"),this.#l?.parentElement?.classList.remove("hide"),this.#d?.parentElement?.classList.remove("hide"),this.#p?.parentElement?.classList.remove("hide"),this.#m.querySelector(".text").innerHTML=`\n                    <p style="margin: unset">Municipio:</p>\n                    <p><strong>${n.Localidad}</strong></p>\n\n                    <p style="margin: unset">Dirección:</p>\n                    <p><strong>${n.Direccion}</strong></p>\n\n                    <p style="margin: unset">Fecha de consulta:</p>\n                    <p><strong>${n.FechaIni} a ${n.FechaFin}</strong></p>\n                `,o.innerHTML="",a.forEach(((e,t)=>{this.#y.writeMessage(`[SuperAppConsultarHistoricosRecarga] Procesando recarga ${t+1} de ${a.length}`);const i=this.#w("historial-button"),r=this.#w("historial-panel"),s=this.#w("template"),c=document.createElement("div");
1c.className="cmp-accordion__item",c.dataset.cmpHookAccordion="item",c.innerHTML=`\n                        <h3 class="cmp-accordion__header">\n                            <button\n                                id="${i}"\n                                class="cmp-accordion__button"\n                                type="button"\n                                aria-controls="${r}"\n                                aria-expanded="false"\n                                data-cmp-hook-accordion="button"\n                            >\n                                <span class="cmp-accordion__title">\n                                    Recarga ${e.FechaCompra.split(" ")[0].replace(/-/gi,"/")}\n                                </span>\n\n                                <span class="cmp-accordion__icon"></span>\n                            </button>\n                        </h3>\n\n                        <div\n                            id="${r}"\n                            class="cmp-accordion__panel cmp-accordion__panel--hidden"\n                            role="region"\n                            aria-labelledby="${i}"\n                            data-cmp-hook-accordion="panel"\n                            hidden\n                        ></div>\n                    `;const d=c.querySelector(`#${r}`),l=this.#u?.parentElement?.cloneNode(!0);if(!d||!l)return;d.appendChild(l);const u=d.querySelector("#info_1"),m=d.querySelector("#info_2"),p=d.querySelector("#info_3"),g=d.querySelector("#info_4"),h=d.querySelector("#download_buttons");setTimeout((()=>{const e=l.querySelector(".accordion button"),t=l.querySelector(".cmp-accordion__panel"),i=this.#w("panelLayer");t&&(t.id=i),e&&e.setAttribute("aria-controls",i)}),1e3),l.querySelectorAll("img").forEach((e=>{e.style.minWidth="40px"})),h?.querySelectorAll(".button > a").forEach(((t,i)=>{if(t.style.minWidth="auto",t.classList.add(0===i?"pdf":"xml"),0===i){const i=""===e.UrlPdfFactura||null===e.UrlPdfFactura;t.parentElement.classList.toggle("hide",i),t.href=i?"":e.UrlPdfFactura}if(1===i){const i=""===e.UrlXmlFactura||null===e.UrlXmlFactura;t.parentElement.classList.toggle("hide",i),t.href=i?"":e.UrlXmlFactura}})),e.UrlPdfFactura||e.UrlXmlFactura||h.parentElement.parentElement.classList.add("hide"),l.children[0]&&(l.children[0].id=s),l.classList.remove("hide"),o.appendChild(c),u&&(u.id=this.#w("container-info1"),u.innerHTML=`\n                            <p style="margin: unset">Fecha:</p>\n                            <p><strong>${e.FechaCompra}</strong></p>\n\n                            <p style="margin: unset">Número del medidor:</p>\n                            <p><strong>${e.Medidor}</strong></p>\n\n                            <p style="margin: unset">Contrato:</p>\n                            <p><strong>${e.Contrato}</strong></p>\n\n                            <p style="margin: unset">Valor de la recarga:</p>\n                            <h5><strong>${e.ValorCompra}</strong></h5>\n\n                            <p style="margin: unset">M3:</p>\n                            <p><strong>${e.Unidades}</strong></p>\n\n                            <p style="margin: unset">Estrato:</p>\n                            <p><strong>${e.Estrato}</strong></p>\n\n                            <p style="margin: unset">Valor pagado a la deuda:</p>\n                            <h5><strong>${e.AbonoDeuda}</strong></h5>\n\n                            <p style="margin: unset">Saldo pendiente de deuda:</p>\n                            <h5><strong>${e.SaldoPendiente}</strong></h5>\n\n                            <p style="margin: unset">Canal:</p>\n                            <p><strong>${e.CanalVenta}</strong></p>\n                        `);let f="";if(e.DetalleRecarga?.forEach((({Concepto:t,Valor:i},o)=>{f+=`\n                                <p style="margin: unset">${t}</p>\n                                <p><strong>${i}</strong></p>\n                            `,(o+1)%2==0&&o!==e.DetalleRecarga.length-1&&(f+="<hr>")})),m&&(m.id=this.#w("container-info2"),m.innerHTML=f),p&&(p.id=this.#w("container-info3"),p.innerHTML=`\n                            <h4 style="margin: unset">\n                                Condiciones de financiación de la deuda\n                            </h4>\n\n                            <br>\n\n                            <p>\n                                <strong>Tasa: </strong>0%\n                            </p>\n\n                            <p>\n                                <strong>Plazo: </strong>\n                                Se abona con el 10% de cada recarga.\n                            </p>\n\n                            <p>\n                                <strong>Aplica: </strong>\n                                Deuda aguas prepago y deuda COVID-19.\n                            </p>\n\n                            <hr>\n\n                            <h4>\n                                <strong>\n                                    Fecha Inicio de los cobros diferidos COVID19:\n                                </strong>\n                            </h4>\n\n                            <p>\n                                <strong>\n                                    ${n.FechaIniCobrosCovid}\n                                </strong>\n                            </p>\n                        `),g){g.id=this.#w("container-info4");const t=e.DeudaCovidConsumo?.length>0,i=e.DeudaCovidConsumo?.[0]||{};g.innerHTML=`\n                            <p style="margin: unset">\n                                <strong>Fecha: </strong>\n                                ${e.FechaCompra||""}\n                            </p>\n\n                            <p style="margin: unset">\n                                <strong>Valor de la recarga: </strong>\n                                ${e.ValorCompra||""}\n                            </p>\n\n                            <p style="margin: unset">\n                                <strong>M3: </strong>\n                                ${e.Unidades||""}\n                            </p>\n\n                            ${t?`\n                                        <hr>\n\n                                        <h3 style="margin: unset">\n                                            ${i.Descripcion||""}\n                                        </h3>\n\n                                        <p style="margin: unset">\n                                            <strong>\n                                                Valor abonado a la deuda:\n                                            </strong>\n                                            ${i.ValorAbonadoDeuda||""}\n                                        </p>\n\n                                        <p style="margin: unset">\n                                            <strong>\n                                                Saldo de la deuda:\n                                            </strong>\n                                            ${i.SaldoDeuda||""}\n                                        </p>\n                                    `:""}\n                        `}}));o.querySelectorAll('[data-cmp-hook-accordion="button"]').forEach((e=>{e.addEventListener("click",(()=>{const t=e.getAttribute("aria-controls"),i=document.getElementById(t),o="true"===e.getAttribute("aria-expanded");e.setAttribute("aria-expanded",String(!o)),i&&(i.hidden=o,i.classList.toggle("cmp-accordion__panel--hidden",o),i.classList.toggle("cmp-accordion__panel--expanded",!o),e.classList.toggle("cmp-accordion__button--expanded",!o))}))}))}))}#S(){this.#i?.parentElement?.classList.remove("hide"),document.querySelector("#superapp-welcome-id")?.parentElement?.classList.add("hide")}}!function(){let e="",t="",i="",o="",n="";const a=new ae,r=new oe,s=new ne,c=new Fe,d=new Ue,l=new $e,u=new Qe,m=new Ye,p=new We;async function g(){try{const e=await l.getCookieAsNumber("rechargeValue");await a.writeMessage("recharge Value: "+JSON.stringify(e));let t=await irisISODEPNFCService.nfcGetTagUID();if(t.response){const i=t.response;await a.writeMessage("cardSN: "+JSON.stringify(i));const o={operation:"ObtenerSaldoDisponible",cardSN:i},c=await s.postService(o,"/bin/supperapp/PSEServlet");await a.writeMessage("RechargeProccess | ObtenerSaldoDisponible: "+JSON.stringify(c));const d={Operacion:"ValidarIdentificar",CardSN:i,ValorRecarga:e};await a.writeMessage("rechargeProccess | validateRequest");const u=await s.postService(d,"/bin/supperapp/recharge");await r.incomingInformation(u).then((async t=>{const o=JSON.parse(t);if(await a.writeMessage("firstResponse: "+JSON.stringify(o)),o.estadoOperacion){irisISODEPNFCService.nfcStartSession("120"),await a.writeMessage("Sesión NFC Iniciada: "),o.arregloAPDUReq[0].index=Number.parseInt(o.arregloAPDUReq[0].index),o.arregloAPDUReq[1].index=Number.parseInt(o.arregloAPDUReq[1].index),await a.writeMessage("Rechargue Process | Envio 1er comando");let t=await f(o.arregloAPDUReq);if(await a.writeMessage("Rechargue Process | Respuesta 1er comando"+JSON.stringify(t)),t){await a.writeMessage("Consumo del segundo servicio");const d={Operacion:"Autenticar",CardSN:i,ValorRecarga:e,APDUResponse:t.response};await a.writeMessage("AuthenticateRequest: ");const u=await s.postService(d,"/bin/supperapp/recharge");await a.writeMessage("authenticateService"),await r.incomingInformation(u).then((async d=>{const u=JSON.parse(d);if(await a.writeMessage("authChannels"),u.estadoOperacion){u.arregloAPDUReq[0].index=Number.parseInt(u.arregloAPDUReq[0].index),await a.writeMessage("arregloAPDUReq segundo comando"+JSON.stringify(u)),await a.writeMessage("Rechargue Process | Envio 2do comando");const d=await f(u.arregloAPDUReq);if(await a.writeMessage("Rechargue Process | Respuesta 2do comando: "+JSON.stringify(d)),d){const u={Operacion:"Certificar",CardSN:i,ValorRecarga:e,APDUResponse:d.response};await a.writeMessage("Rechargue Process | certificateRequest");const m=await s.postService(u,"/bin/supperapp/recharge");await r.incomingInformation(m).then((async d=>{const u=JSON.parse(d);if(await a.writeMessage("Rechargue Process | certificate"),u.estadoOperacion){u.arregloAPDUReq[0].index=Number.parseInt(u.arregloAPDUReq[0].index),u.arregloAPDUReq[1].index=Number.parseInt(u.arregloAPDUReq[1].index),await a.writeMessage("Rechargue Process | Envio 3er comando");const d=await f(u.arregloAPDUReq);if(await a.writeMessage("Rechargue Process | Respuesta 3er comando: "+JSON.stringify(d)),d){const t={Operacion:"Recargar",CardSN:i,ValorRecarga:e,APDUResponse:d.response,marcaModSerie:o.marcaModSerie,Departamento:o.departamento,Direccion:o.direccion,IdCliente:o.idCliente,Localidad:o.localidad,NombreCliente:o.nombreCliente,idTransacCanalVenta:n},u=await s.postService(t,"/bin/supperapp/recharge");await a.writeMessage("Rechargue Process | Recharge Service"),await r.incomingInformation(u).then((async e=>{const t=JSON.parse(e);if(t.estadoOperacion){t.arregloAPDUReq[0].index=Number.parseInt(t.arregloAPDUReq[0].index),t.arregloAPDUReq[1].index=Number.parseInt(t.arregloAPDUReq[1].index),await a.writeMessage("Rechargue Process | Seteo cuarto comando: ");const e=await f(t.arregloAPDUReq);await a.writeMessage("Rechargue Process | Rechargue Process | Recarga apduResponse: "+JSON.stringify(e));const n={message:"Recarga apduResponse: ",fourthApduResponse:e};if(await s.postService(n,"/bin/regist-log"),e){await a.writeMessage("Rechargue Process | Tarjeta Recargada"),await irisISODEPNFCService.nfcStopSession();const e={repisado:!1,operation:"Comprobante",idTransaccion:await l.getCookieValue("transaccionId")},n=await s.postService(e,"/bin/supperapp/PSEServlet");await a.writeMessage("Rechargue Process | sendVoucher Service"),await r.incomingInformation(n).then((async e=>{const t=JSON.parse(e);await a.writeMessage("Rechargue Process | sendVoucher"+JSON.stringify(t)),"Aprobado"===t.EstadoCUS&&await a.writeMessage("Rechargue Process | Construcción pantalla final")})).catch((async e=>{await irisISODEPNFCService.nfcStopSession(),await a.writeMessage(`Error quinto servicio enviar comprobante: ${e.message}`),await l.errorLecturaMessage()})),await r.incomingInformation(c).then((async e=>{const n=JSON.parse(e);if(await a.writeMessage("ObtenerSaldoDisponible flujo recarga: "+JSON.stringify(n)),n.tieneSaldoDisponible&&0!==n.valorDisponible){await l.hideElement("superapp-card-recharge-final-screen-id");const e=JSON.parse(t.mensajeOperacion);await a.writeMessage("Mensaje Operación"),await a.writeMessage("Inicio formateo precio");const r=Number(n.valorDisponible),s=new Intl.NumberFormat("es-CO",{style:"currency",currency:"COP",minimumFractionDigits:0,maximumFractionDigits:0}).format(r);await l.setElementText("super-app-recharge-summary-value-id",s),await l.setElementText("super-app-recharge-summary-measure-id",e.m3Recarga+" m3");const[c,d]=e.fechaRecarga.split("T"),[u,m]=d.split(".");await l.setElementText("super-app-recharge-summary-date-id",c),await l.setElementText("super-app-recharge-summary-time-id",u),await l.setElementText("recharge-final-screen-medidor-id",e.idElementoMedicion),await l.setElementText("recharge-final-screen-nro-tarjeta-id",i),await l.setElementText("recharge-final-screen-direccion-id",o.direccion),await l.setElementText("recharge-final-screen-titular-id",o.nombreCliente),await l.setElementText("recharge-final-screen-numero-aprobacion-id",n.codigoCUS);document.querySelector("#recharge-final-screen-notification-id p b").textContent=" "+n.correoElectronico,await l.hideModalContent(),await l.hideScreenContent(),await l.showElement("super-app-card-success-recharge-id"),await a.writeMessage("final del mapeo de la pantalla final")}else await l.setElementText("recharge-screen-medidor-id",cardInfo.marcaModSerie),await l.setElementText("recharge-screen-nro-tarjeta-id",i),await l.setElementText("recharge-screen-direccion-id",cardInfo.direccion),await l.setElementText("recharge-screen-titular-id",cardInfo.nombreCliente),await l.hideScreenContent(),await l.showElement("super-app-user-data-screen-id")}
1)).catch((async e=>{await a.writeMessage(`Error servicio enviar comprobante: ${e.message}`),await l.errorLecturaMessage()}))}else await a.writeMessage("Tarjeta no recargada"),await irisISODEPNFCService.nfcStopSession(),await l.hideModalContent(),await l.showElement("super-app-modal-alert-icon"),await l.showElement("super-app-modal-message-pago-fallido"),await l.showModal()}else await irisISODEPNFCService.nfcStopSession(),await l.errorLecturaMessage()})).catch((async e=>{await irisISODEPNFCService.nfcStopSession(),await a.writeMessage(`Error cuarto catch Recargar: ${e.message}`),await l.errorLecturaMessage()}))}else void 0===t?(await a.writeMessage("Respuesta del 3er comando undefined: "+JSON.stringify(t)),await irisISODEPNFCService.nfcStopSession(),await l.hideModalContent(),await l.showElement("super-app-modal-warning-icon"),await l.showElement("super-app-modal-message-no-lee-tarjeta"),await l.showModal()):(await a.writeMessage("Falló en enviar 3er comando"),await irisISODEPNFCService.nfcStopSession(),await l.hideModalContent(),await l.showElement("super-app-modal-alert-icon"),await l.showElement("super-app-modal-message-no-lee-tarjeta"),await l.showModal())}else await irisISODEPNFCService.nfcStopSession(),await l.errorLecturaMessage()})).catch((async e=>{await irisISODEPNFCService.nfcStopSession(),await a.writeMessage("Error tercer catch Certificar: "+JSON.stringify(e.message)),await l.errorLecturaMessage()}))}else void 0===t?(await a.writeMessage("Respuesta del 2do comando undefined: "+JSON.stringify(t)),await irisISODEPNFCService.nfcStopSession(),await l.hideModalContent(),await l.showElement("super-app-modal-warning-icon"),await l.showElement("super-app-modal-message-no-lee-tarjeta"),await l.showModal()):(await a.writeMessage("Falló en enviar 2do comando"),await irisISODEPNFCService.nfcStopSession(),await l.hideModalContent(),await l.showElement("super-app-modal-alert-icon"),await l.showElement("super-app-modal-message-no-lee-tarjeta"),await l.showModal())}else await a.writeMessage(`Error Segundo catch Autenticar: ${error.message}`),await irisISODEPNFCService.nfcStopSession(),await l.errorLecturaMessage()})).catch((async e=>{await irisISODEPNFCService.nfcStopSession(),await a.writeMessage("Error Segundo catch Autenticar: "+JSON.stringify(e.message)),await l.errorLecturaMessage()}))}else void 0===t?(await a.writeMessage("Respuesta del 1er comando undefined: "+JSON.stringify(t)),await irisISODEPNFCService.nfcStopSession(),await l.hideModalContent(),await l.showElement("super-app-modal-warning-icon"),await l.showElement("super-app-modal-message-no-lee-tarjeta"),await l.showModal()):(await a.writeMessage("Falló en enviar 1er comando"),await irisISODEPNFCService.nfcStopSession(),await l.hideModalContent(),await l.showElement("super-app-modal-warning-icon"),await l.showElement("super-app-modal-message-no-lee-tarjeta"),await l.showModal())}else await a.writeMessage("Error en respuesta de servicio Validar: "+JSON.stringify(u)),await l.showElement("super-app-modal-warning-icon"),await l.showElement("super-app-modal-message-tarjeta-invalida"),await l.showModal()})).catch((async e=>{await a.writeMessage("Error Primer catch Validar: "+JSON.stringify(e.message)),await l.errorLecturaMessage()}))}else await a.writeMessage("Error en la lectura de la tarjeta get tagUid"),await l.showElement("super-app-modal-alert-icon"),await l.showElement("super-app-modal-message-tarjeta-invalida"),await l.showModal()}catch(e){await a.writeMessage("NFC Error | rechargeProccess: "+JSON.stringify(e)),console.log("NFC Error | rechargeProccess: "+JSON.stringify(e)),e.message.includes("estadoOperacion")?(await a.writeMessage("Undefined EstadoOperacion| rechargeProccess if: "+JSON.stringify(e)),await irisISODEPNFCService.nfcStopSession(),await l.errorLecturaMessage()):(await a.writeMessage("Error Comando | rechargeProccess else: "+JSON.stringify(e)),await irisISODEPNFCService.nfcStopSession(),await v(e))}}async function h(t){await a.writeMessage("Init Proccess");try{let i=await irisISODEPNFCService.nfcGetTagUID();if(i.response)switch(e=i.response,await a.writeMessage("First fase cardSN: "+JSON.stringify(e)),t){case"Recharge":{const t={Operacion:"ValidarIdentificar",CardSN:e,ValorRecarga:1e4},i=await s.postService(t,"/bin/supperapp/recharge");await r.incomingInformation(i).then((async t=>{const n=JSON.parse(t);if(await a.writeMessage("cardInfo"),n.estadoOperacion){irisISODEPNFCService.nfcStartSession("120"),await a.writeMessage("Sesión NFC validación preventiva Iniciada"),n.arregloAPDUReq[0].index=Number.parseInt(n.arregloAPDUReq[0].index),n.arregloAPDUReq[1].index=Number.parseInt(n.arregloAPDUReq[1].index);const t=8e3;try{await Promise.race([f(n.arregloAPDUReq),new Promise(((e,i)=>{setTimeout((()=>{i(new Error("TimeOut"))}),t)}))]),await a.writeMessage("Validación preventiva Iniciada Exitosa"),await irisISODEPNFCService.nfcStopSession(),await a.writeMessage("Validación preventiva Sesión NFC Detenida");const c={operation:"ObtenerSaldoDisponible",cardSN:e},d=await s.postService(c,"/bin/supperapp/PSEServlet");await r.incomingInformation(d).then((async t=>{const r=JSON.parse(t);await a.writeMessage("First fase balance Info: "+JSON.stringify(e)),r.tieneSaldoDisponible&&0!==r.valorDisponible?(await a.writeMessage(`Hay un pago pendiente por recargar: ${i}`),await l.hideModalContent(),await l.showElement("super-app-modal-info-icon"),await l.showElement("pse-confirmed-payment-container-id"),await l.showModal(),o=r.idTransaccion):(await l.setElementText("recharge-screen-medidor-id",n.marcaModSerie),await l.setElementText("recharge-screen-nro-tarjeta-id",e),await l.setElementText("recharge-screen-direccion-id",n.direccion),await l.setElementText("recharge-screen-titular-id",n.nombreCliente),await l.hideElement("superapp-card-recharge-screen-id"),await l.showElement("super-app-user-data-screen-id"))})).catch((async e=>{await a.writeMessage("First fase Error Servicio Balance Info: "+JSON.stringify(e.message)),await l.errorLecturaMessage()}))}catch(t){await a.writeMessage("Validación Preventiva Error: "+JSON.stringify(t)),"TimeOut"===t.message?(await a.writeMessage("Validación Preventiva El proceso superó los 8 segundos"),await irisISODEPNFCService.nfcStopSession(),await a.writeMessage(`${e} no pasó la validación`),await l.hideModalContent(),await l.showElement("super-app-modal-warning-icon"),await l.showElement("super-app-preventive-validation-container-id"),await l.showModal()):await a.writeMessage("Validación Preventiva Error en el promise race")}}else await a.writeMessage("Error en respuesta de servicio Validar: "+JSON.stringify(i)),await l.hideModalContent(),await l.showElement("super-app-modal-warning-icon"),await l.showElement("super-app-modal-message-tarjeta-invalida"),await l.showModal()})).catch((async e=>{await a.writeMessage("First fase Error Primer catch Validar: "+JSON.stringify(e.message)),await l.errorLecturaMessage()}));break}case"Recheck_flow":await a.writeMessage("Recheck_flow | Switch Recheck_flow"),await u.requestRecheck(e)}else await a.writeMessage("First fase Error en la lectura de la tarjeta get tagUid"),await l.showElement("super-app-modal-alert-icon"),await l.showElement("super-app-modal-message-error-lectura"),await l.showModal()}catch(e){if(await a.writeMessage(`Catch Error | First fase: ${JSON.stringify(e)}`),e.status){const t=decodeURIComponent(escape(e.response));await a.writeMessage("mensaje"+t),e.response,await l.hideModalContent(),await l.showElement("super-app-modal-alert-icon"),await l.showElement("super-app-modal-message-error-lectura"),await l.showModal()}else await a.writeMessage("NFC Error Comando| First fase: ${error}: "+ +JSON.stringify(e)),await v(e)}}async function f(e){await a.writeMessage("RechargeProcess | sendApduCommand: "+e);try{let t=await irisISODEPNFCService.nfcSendAPDUCommand(e);return await a.writeMessage("RechargeProcess | NfcResponse: "+JSON.stringify(t)),t}catch(e){switch(await a.writeMessage("RechargeProcess | sendApduCommand Message error response: "+JSON.stringify(e)),await a.writeMessage("RechargeProcess | sendApduCommand Error response: "+e),await irisISODEPNFCService.nfcStopSession(),await l.hideModalContent(),e.response){case"ISODEPNFCReadingTimeout":await l.showElement("super-app-modal-warning-icon"),await l.showElement("super-app-modal-message-tiempo-agotado");break;case"ISODEPNFCTagNotCompatible":await l.showElement("super-app-modal-warning-icon"),await l.showElement("super-app-modal-message-tarjeta-invalida");break;case"ISODEPNFCOutOfSync":await l.showElement("super-app-modal-warning-icon"),await l.showElement("super-app-modal-message-no-lee-tarjeta");break;case"ISODEPNFCInvalidAPDUCommand":await l.showElement("super-app-modal-alert-icon"),await l.showElement("super-app-modal-message-error-lectura")}await l.showModal()}}async function v(e){switch(await l.hideModalContent(),e.response){case"ISODEPNFCReadingTimeout":await l.showElement("super-app-modal-warning-icon"),await l.showElement("super-app-modal-message-tiempo-agotado");break;case"ISODEPNFCTagNotCompatible":await l.showElement("super-app-modal-warning-icon"),await l.showElement("super-app-modal-message-tarjeta-invalida");break;case"ISODEPNFCOutOfSync":await l.showElement("super-app-modal-warning-icon"),await l.showElement("super-app-modal-message-no-lee-tarjeta");break;case"ISODEPNFCInvalidAPDUCommand":await l.showElement("super-app-modal-alert-icon"),await l.showElement("super-app-modal-message-error-lectura")}await l.showModal()}window.addEventListener("load",(async function(){if(!document.getElementById("superapp-welcome-id"))return;await l.hideModalContent(),document.getElementById("super-app-pse-form-back-button-id").addEventListener("click",(async function(){await l.hideElement("super-app-pse-form-container-id"),await l.showElement("super-app-pse-recharge-value-id")})),document.getElementById("pse-no-payment-button-id").addEventListener("click",(async function(e){e.preventDefault(),await l.closeSuperAppModal(),await l.hideModalContent(),await l.hideScreenContent(),await l.showElement("superapp-welcome-id");document.getElementById("super-app-pse-form-id").reset()})),document.getElementById("pse-no-pse-service-button-id").addEventListener("click",(async function(e){e.preventDefault(),await l.closeSuperAppModal(),await l.hideModalContent(),await l.hideScreenContent(),await l.showElement("superapp-welcome-id");document.getElementById("super-app-pse-form-id").reset()})),document.getElementById("pse-no-banking-institution-button-id").addEventListener("click",(async function(e){e.preventDefault(),await l.closeSuperAppModal(),await l.hideModalContent(),await l.hideScreenContent(),await l.showElement("superapp-welcome-id");document.getElementById("super-app-pse-form-id").reset()})),document.getElementById("pse-transaction-in-progress-button-id").addEventListener("click",(async function(e){e.preventDefault(),await l.closeSuperAppModal(),await l.hideModalContent(),await l.hideScreenContent(),await l.showElement("superapp-welcome-id");document.getElementById("super-app-pse-form-id").reset()})),document.getElementById("super-app-to-init-card-read-button-id").addEventListener("click",(async function(){await l.hideElement("superapp-welcome-id"),await l.hideModalContent(),await l.closeSuperAppModal(),await l.showElement("superapp-card-recharge-screen-id"),setTimeout((async function(){await h("Recharge")}
1),3e3)})),document.getElementById("pse-confirmed-payment-button-id").addEventListener("click",(async function(){await a.writeMessage("Confirmed payment init TransactionId: "+JSON.stringify(o));const e=document.getElementById("pse-success-payment-button-id");e.setAttribute("aria-disabled","true");const t=await m.RecordWaterPaymentTransaction("confirmedPayment",o);t&&"none"!==t&&(n=t,await a.writeMessage("Confirmed Payment | idTransacionOpen: "+JSON.stringify(n)),setTimeout((async function(){await g()}),1e3)),e.removeAttribute("aria-disabled")})),document.getElementById("superapp-consultaHistorialRecarga-id").addEventListener("click",(async function(e){e.preventDefault();try{p.iniciar()}catch(e){console.log("Error superapp-consultaHistorialRecarga-xp: ",e)}})),document.getElementById("superapp-recargarTarjeta-id").addEventListener("click",(async function(e){e.preventDefault();try{!0===await c.getIsAvailableNFC()&&(await l.hideElement("superapp-welcome-id"),await l.hideModalContent(),await l.closeSuperAppModal(),await l.showElement("super-app-recharge-title-scree-id"),await l.hideElement("super-app-recheck-title-scree-id"),await l.showElement("superapp-card-recharge-screen-id"),setTimeout((async function(){console.log("iniciar proceso"),await h("Recharge")}),3e3))}catch(e){await a.writeMessage("error rechargue click: "+JSON.stringify(e))}})),document.getElementById("superapp-recheck-card-id").addEventListener("click",(async function(e){e.preventDefault();try{await c.getIsAvailableNFC()&&(await l.hideElement("superapp-welcome-id"),await l.hideModalContent(),await l.closeSuperAppModal(),await l.hideElement("super-app-recharge-title-scree-id"),await l.showElement("super-app-recheck-title-scree-id"),await l.showElement("superapp-card-recharge-screen-id"),setTimeout((async function(){await h("Recheck_flow")}),1e3))}catch(e){alert("error recheck click: "+JSON.stringify(e))}})),document.getElementById("super-app-modal-button-tiempo-agotado-aceptar").addEventListener("click",(async function(e){await l.closeSuperAppModal(),await l.hideModalContent(),await l.hideElement("superapp-card-recharge-screen-id"),await l.showElement("superapp-welcome-id")})),document.getElementById("super-app-modal-button-no-lee-tarjeta-intentar-de-nuevo").addEventListener("click",(async function(e){await l.closeSuperAppModal(),await l.hideModalContent(),await l.showElement("superapp-card-recharge-screen-id"),await g()})),document.getElementById("super-app-modal-button-tarjeta-medidor-invalido-intentar-nuevo").addEventListener("click",(async function(e){await l.closeSuperAppModal(),await l.hideModalContent(),await l.showElement("superapp-card-recharge-screen-id"),await g()})),document.getElementById("super-app-preventive-validation-retry-button-id").addEventListener("click",(async function(e){await l.closeSuperAppModal(),await l.hideModalContent(),await l.hideScreenContent(),await l.showElement("superapp-welcome-id")})),document.getElementById("super-app-modal-button-no-leer-tarjeta-consultar-ultima").addEventListener("click",(async function(e){await l.closeSuperAppModal(),await l.hideModalContent(),await l.showElement("superapp-card-recharge-screen-id"),await g()})),document.getElementById("super-app-modal-button-tarjeta-invalida").addEventListener("click",(async function(e){await l.closeSuperAppModal(),await l.hideModalContent(),await l.showElement("superapp-card-recharge-screen-id"),await g()})),document.getElementById("super-app-modal-button-error-lectura-aceptar").addEventListener("click",(async function(e){await l.closeSuperAppModal(),await l.hideModalContent(),await l.hideScreenContent(),await l.showElement("superapp-welcome-id")})),document.getElementById("super-app-button-no-recheck-transaction-id").addEventListener("click",(async function(e){await l.closeSuperAppModal(),await l.hideModalContent(),await l.hideScreenContent(),await l.showElement("superapp-welcome-id")})),document.getElementById("super-app-modal-button-pago-fallido-intentar-de-nuevo").addEventListener("click",(async function(e){await l.closeSuperAppModal(),await l.hideModalContent(),await l.hideElement("superapp-welcome-id")})),document.getElementById("super-app-modal-button-ir-inicio").addEventListener("click",(async function(e){await l.closeSuperAppModal(),await l.hideModalContent(),await l.hideElement("super-app-modal-message-necesitas-activar-nfc"),await l.showElement("superapp-welcome-id")})),document.getElementById("super-app-modal-button-activar-nfc-cancelar").addEventListener("click",(async function(e){await l.closeSuperAppModal(),await l.hideModalContent(),await l.hideElement("super-app-modal-message-necesitas-activar-nfc"),await l.showElement("superapp-welcome-id")})),document.getElementById("super-app-modal-button-transaccion-proceso-aceptar").addEventListener("click",(async function(e){await l.closeSuperAppModal(),await l.hideModalContent(),await l.hideElement("superapp-card-recharge-screen-id"),await l.showElement("superapp-welcome-id")})),document.getElementById("super-app-modal-button-pago-exitoso-continuar").addEventListener("click",(async function(e){await l.closeSuperAppModal(),await l.hideModalContent(),await l.hideScreenContent(),await l.showElement("super-app-card-success-recharge-id")})),document.getElementById("super-app-modal-button-opcion-no-disponible-aceptar").addEventListener("click",(async function(e){await l.closeSuperAppModal(),await l.hideModalContent(),await l.hideElement("superapp-welcome-id"),await l.showElement("super-app-puntos-recarga-screen-id")})),document.getElementById("super-app-modal-button-opcion-no-disponible-puntos-recarga").addEventListener("click",(async function(e){await l.closeSuperAppModal(),await l.hideModalContent(),await l.hideScreenContent(),await l.showElement("super-app-puntos-recarga-screen-id")})),document.getElementById("super-app-modal-button-no-leer-tarjeta-volver").addEventListener("click",(async function(e){await l.closeSuperAppModal(),await l.hideModalContent(),await l.hideScreenContent(),await l.showElement("super-app-puntos-recarga-screen-id")})),document.getElementById("super-app-modal-button-saldo-pendiente-volver").addEventListener("click",(async function(e){await l.closeSuperAppModal(),await l.hideModalContent(),await l.hideScreenContent(),await l.showElement("super-app-puntos-recarga-screen-id")})),document.getElementById("super-app-details-value-input").addEventListener("input",(function(e){const t=document.getElementById("super-app-first-form-button-id");t.setAttribute("aria-disabled","true"),t.style.pointerEvents="none",t.style.opacity="0.5";let i=e.target.value;if(i=i.replaceAll(".","").replaceAll("$",""),""===i)return void(e.target.value="");let o=Number.parseInt(i);if(isNaN(o))return void(e.target.value="");o<6e3||o>1e5?e.target.setAttribute("input-alert","true"):(t.removeAttribute("aria-disabled"),t.style.pointerEvents="auto",t.style.opacity="1");let n=o.toString().replaceAll(/\B(?=(\d{3})+(?!\d))/g,".");e.target.value="$"+n})),document.getElementById("super-app-first-form-button-id").addEventListener("click",(async function(e){e.preventDefault(),i=document.getElementById("super-app-details-value-input").value,await d.manageRechargevalue(i),await l.hideScreenContent(),await l.showElement("super-app-pse-recharge-value-id")})),document.getElementById("super-app-details-value-input").addEventListener("keydown",(function(e){"Enter"===e.key&&e.preventDefault()})),document.getElementById("super-app-second-back-button-id").addEventListener("click",(async function(){await l.hideScreenContent(),await l.showElement("superapp-welcome-id")})),document.getElementById("super-app-pse-screen-continuar-button-id").addEventListener("click",(async function(e){e.preventDefault();null===document.getElementById("pse-form-financial-field-id")?(await l.hideModalContent(),await l.showElement("super-app-modal-warning-icon"),await l.showElement("pse-no-pse-service-container-id"),await l.showModal()):(await l.hideScreenContent(),await l.showElement("super-app-pse-form-container-id"))})),document.getElementById("super-app-pse-screen-volver-button-id").addEventListener("click",(async function(){await l.hideScreenContent(),await l.showElement("super-app-user-data-screen-id")}));const r=document.getElementById("super-app-pse-form-id");if(r.addEventListener("submit",(async function(t){t.preventDefault();const o=new FormData(r);await d.managePSEForm(o,i,e)})),document.getElementById("super-app-card-success-end-button-id").addEventListener("click",(async function(e){e.preventDefault(),await l.hideScreenContent(),await l.hideElement("super-app-card-success-recharge-id"),await l.showElement("superapp-welcome-id")})),document.getElementById("pse-success-payment-button-id").addEventListener("click",(async function(){const e=document.getElementById("pse-success-payment-button-id");e.setAttribute("aria-disabled","true");const i=await m.RecordWaterPaymentTransaction("successPayment",t);i&&"none"!==i&&(n=i,await g()),e.removeAttribute("aria-disabled")})),document.getElementById("superapp-consultaUltimaRecarga-id").addEventListener("click",(function(){})),t=await l.getCookieValue("transaccionId"),await a.writeMessage("cookValue: "+JSON.stringify(t)),"false"===t){await a.writeMessage("Super App Init");try{if(await a.writeMessage("Is flutter?: "+JSON.stringify(await c.getIsFlutter())),await a.writeMessage("Esta en flutter? ",await c.getIsFlutter()),await c.getIsAvailableNFC()){const e=await c.getInfoGeneral();if(await c.getIsFlutter()&&await async function(){const e=navigator.userAgent;let t=!!(e.includes("Android")||e.includes("Mobile")||e.includes("iPhone")||e.includes("iPad"));return await a.writeMessage("esDispositivoMovil function"),t}()){await a.writeMessage("generalInfo: "+JSON.stringify(e));const t=JSON.parse(e);await a.writeMessage("general info response: "+JSON.stringify(t)),await a.writeMessage("Reponse platform: "+JSON.stringify(t.platform)),"android"===t.platform?(await a.writeMessage("Estás en un dispositivo Android"),await a.writeMessage("Estás en un dispositivo móvil"),await l.showElement("superapp-welcome-id"),await c.getIsAutheticate()):(await a.writeMessage("Estás en un dispositivo IOS/Iphone"),await l.showElement("super-app-puntos-recarga-screen-id"),await c.getIsAutheticate())}else if(await c.getIsFlutter()){await a.writeMessage("generalInfo 2: "+JSON.stringify(e));const t=JSON.parse(e);await a.writeMessage("general info response 2: "+JSON.stringify(t)),await a.writeMessage("Reponse platform 2: "+JSON.stringify(t.platform)),"android"===t.platform?(await a.writeMessage("Estás en un dispositivo Android 2"),await a.writeMessage("Estás en un dispositivo móvil 2"),await l.showElement("superapp-welcome-id"),await c.getIsAutheticate()):(await a.writeMessage("Estás en un dispositivo IOS 2"),await a.writeMessage("Estás en un dispositivo Iphone 2"),await l.showElement("super-app-puntos-recarga-screen-id"),await c.getIsAutheticate())}else await a.writeMessage("Estás en un dispositivo de escritorio"),await l.showElement("superapp-container-header-id"),await l.showElement("superapp-container-footer-id"),await l.showElement("superapp-welcome-web-id")}else await a.writeMessage("Dispositivo no tiene NFC"),await l.showElement("super-app-puntos-recarga-screen-id")}catch(e){await a.writeMessage("First catch | Error: "+JSON.stringify(e.message))}}else await d.confirmPayment(t)}))}(),window.addEventListener("load",(e=>{let t=document.getElementById("modal-satisfaccion"),i=document.getElementById("close-modal-satisfaccion"),o=document.querySelector(".cmp-icontextv2"),n=document.getElementById("message-experience"),s=document.getElementById("send-opinion"),
1c="",d=document.getElementById("modal-aprobar-cotizacion-date");const l=new a;let u=JSON.parse(localStorage.getItem("pedido")),m=null;var p,g,h;async function f(e,t){const i=new Date,o={crm:{servicioId:e,recursoId:t,cantidadRegistros:Number(l.getQuantityRegister())||100},fechaHoraInicio:i.toISOString().split(".")[0],cantidadDiasAMostrar:Number(l.getDaysToShow())||10};try{l.showLoader();const e=await fetch("/bin/consultaDisponibilidad",{method:"POST",headers:{"Content-Type":"text/plain"},body:JSON.stringify(o)});if(!e.ok){let t=!1;throw localStorage.setItem("responseService",JSON.stringify(t)),new Error("Error en la solicitud "+e.status)}const t=await e.json();return localStorage.getItem("responseService")&&localStorage.removeItem("responseService"),p=t,t}catch(e){console.log(e)}finally{l.hideLoader()}}function v(e){let t=new Date(e);var i=t.getDate(),o=t.getMonth()+1;return i<10&&(i="0"+i),o<10&&(o="0"+o),t.getFullYear().toString()+"-"+o+"-"+i+"T00:00:00+00:00"}function y(){let e=document.getElementsByName("jornada"),t="";for(let i=0;i<e.length;i++)if(e[i].checked){t=e[i].value;break}return t}function C(){$("#loader-div").removeClass("hide")}function E(){$("#loader-div").addClass("hide")}
1function A(e){$("#cart-message").text(e),$("#messages-for-docs").removeClass("hide")}function S(){localStorage.getItem("diaVisita");let e=y(),i=JSON.parse(localStorage.getItem("formularioCotizacion")||[]),o=JSON.parse(localStorage.getItem("pedido")),n={...o,fechaSeleccionada:m,jornada:e,Observaciones:i.Observaciones,CorreoSolicitante:""!==i.DistinctEmail.trim()?i.DistinctEmail:o.CorreoSolicitante,NombreCompletoSolicitante:""!==i.DistinctNombre.trim()?i.DistinctNombre+" "+i.DistinctApellidos:o.NombreCompletoSolicitante,CelularSolicitante:""!==i.DistinctCelular.trim()?i.DistinctCelular:o.CelularSolicitante};""!==m&&""!==e?(null!==document.querySelector(".modal-calendar-cotizacion-errormsg")&&document.querySelector(".modal-calendar-cotizacion-errormsg").remove(),document.querySelector("#modal-aprobar-cotizacion-date").querySelector(".modal-layer").classList.remove("open"),C(),async function(e,t){new Date;var i=y(),o=t,n=parseInt(r(p,v(o),i).horaInicio.split("T")[1].split(":")[0]),a=n>12?n+":00:00 PM":n+":00:00 AM";""!==o&&""!==i||console.log("No hay horario visita"),e=JSON.parse(localStorage.getItem("pedido"));var s={JsonEntrada:{FechaReprogramacion:`${o} ${a}`,HoraInicio:r(p,v(o),i).horaInicio.split("T")[1],HoraFin:r(p,v(o),i).horaFin.split("T")[1],IdRecurso:e.IDRecurso,IdServicio:e.IDServicio,Pedido:e.NumeroPedido,Sistema:"E-commerce",NumeroDocumento:e.NumeroIdentificacionSolicitante,TipoDocumento:e.TipoIdentificacionSolicitante}},c={method:"POST",headers:{"Content-type":"text/plain","CSRF-Token":await async function(){const e=await fetch("/libs/granite/csrf/token.json");return(await e.json()).token}()},body:JSON.stringify(s)};return fetch("/bin/ejecutar-accion",c).then((function(e){if(e.ok&&200===e.status)return e.json();throw new Error(`Error en la solicitud: ${e.status} ${e.statusText}`)})).then((function(e){return e})).catch((function(e){throw console.error(e),e}))}(n,m).then((e=>{if(e.status)return A("En estos momentos no es posible atender tu solicitud. Te invitamos a comunicarte con la línea de atención al cliente (604) 44 44 800");const{Error:i,Respuesta:o}=e;var n=JSON.parse(o.JsonRespuesta);if(!n.Success)return A(n.MensajeError),void E();var a=JSON.parse(o.JsonRespuesta),r=JSON.parse(a.Agenda);t.querySelector(".modal-layer").classList.add("open"),document.querySelector("#texto-pedido-cotizacion .cmp-title__text").textContent=r.Pedido})).catch((e=>{console.log(e)})).finally((()=>{E()}))):function(e,t="Por favor valida que hayas brindado la información requerida para tu compra, para poder continuar.",i="afterbegin"){if(null!==document.querySelector(".modal-calendar-cotizacion-errormsg"))return;let o=`\n            <div class="modal-calendar-cotizacion-errormsg" style="background-color:#fff;padding:1rem">\n            <div class="errormsg" style="max-width:300px; display:flex;align-items:center;gap:1rem;border-radius:1rem;padding:0.5rem;background-color:#FFE1E1">\n              <img src="/content/dam/epm/ecommerce/info-error-icon.png" alt="icono-info-error">\n              <p style="color:red;margin:0" class="errormsg-text">${t}</p>\n            </div>\n            </div>\n            `;document.getElementById(e).insertAdjacentHTML("afterbegin",o),setTimeout((()=>{$(".modal-calendar-cotizacion-errormsg").fadeOut("slow"),document.querySelector(".modal-calendar-cotizacion-errormsg").remove()}),1e4)}("text-title-calendar-cotizacion")}function b(){document.querySelector("#contenedor-form-cotizacion").style.display="none",document.querySelector("#contenedor-pedido-cotizacion").style.display="block",document.querySelectorAll(".modal-layer").forEach((e=>{e.classList.remove("open"),document.body.style.overflow="auto"}))}u&&u.IDServicio&&u.IDRecurso&&(!function(e,t,i,o){f(t,i).then((t=>{let i=document.querySelector(e);if(i&&null!==i.querySelector(".hasDatepicker")){$("hasDatepicker").datepicker("destroy");const e=document.querySelector(".cmp-calendar--view");o.insertCalendarWithData(e,t,{onDateSelected:e=>{const i=new Date(e).toISOString().split("T")[0],o=t.find((e=>new Date(e.fecha).toISOString().split("T")[0]===i)),n=o?.disponibilidad.find((e=>e.horaInicio>="08:00:00"&&e.horaFin<="12:00:00")),a=o?.disponibilidad.find((e=>e.horaInicio>="13:00:00"&&e.horaFin<="18:00:00")),r=document.getElementById("jornada-manana"),s=document.getElementById("jornada-tarde");r.checked=!1,r.disabled=!n,s.checked=!1,s.disabled=!a,m=e}})}}))}("#calendario-garantia",u.IDServicio,u.IDRecurso,l),g=document.createElement("div"),document.body.appendChild(g),g.setAttribute("id","messages-for-docs"),g.setAttribute("class","hide"),g.innerHTML="<div id='modal-body-files' style='position:absolute;width:387px;background:#fff;border-radius:30px;top:20%;left:50%;transform: translate(-50%, 0);padding:15px'>\n    <div class='container-message'>\n        <div class='button-close' style='text-align:right;'>
1\n          <span id='delete-file' style='cursor:pointer'>\n            <img src='/content/dam/epm/ecommerce/close_icon.png' style='cursor:pointer' />\n          </span>\n        </div>\n        <div class='message-body'style='text-align:center;'>\n          <img style=\"width:50px; height:50px\" src='/content/dam/epm/ecommerce/bell-notification.png' /><br/>\n          <h3 style='font-size:28px;margin:0;font-weight:86;line-height:37.2px'>Información importante</h3><br/>\n          <p style='font-size:16px;' id='cart-message'></p><br/>\n          <button type='button' id='btn-for-close' style='padding:0.5rem; border-radius:20px;color:#fff;font-size:18px;font-weight:148;background:#36A21D;border:#36A21D;width:120px'>Aceptar</button>\n        </div>\n      </div>\n    </div>",$("#messages-for-docs").css({position:"fixed",background:"rgba(204, 204, 204, 0.5)",inset:"0","z-index":"9000"}),$("#btn-for-close").on("click",(function(){$("#messages-for-docs").addClass("hide")})),$("#delete-file img").on("click",(function(){$("#messages-for-docs").addClass("hide")})),h=document.createElement("div"),document.body.appendChild(h),h.setAttribute("id","loader-div"),h.setAttribute("class","hide"),h.innerHTML="<div id='loader-div-body' style='position:absolute;width:387px;top:20%;left:50%;transform: translate(-50%, 0);padding:15px'><div class='container-loader'><div class='loader-body'style='text-align:center;'><img src='/content/dam/epm/ecommerce/loader3.gif' alt='Cargando...' style='max-width:30%;' /></div></div></div>",$("#loader-div").css({position:"fixed",background:"rgb(255 255 255 / 0.8)",inset:"0","z-index":"10000"}),document.getElementById("form-aprobar-cotizacion-finalizar-solicitud").addEventListener("click",(e=>{e.preventDefault(),S()})),d.addEventListener("click",(e=>{e.target.classList.contains("close")&&document.querySelectorAll(".modal-layer").forEach((e=>{e.classList.remove("open"),document.body.style.overflow="auto"}))})),i.addEventListener("click",(e=>{e.preventDefault(),b()})),o.addEventListener("click",(e=>{let t=["cmp-icontextv2__item","cmp-icontextv2__image","img-icontextv2","cmp-icontextv2__text"];Array.from(e.target.classList).some((e=>t.includes(e)))&&(document.querySelectorAll(".cmp-icontextv2__item").forEach((e=>{e.classList.remove("selected")})),e.target.closest(".cmp-icontextv2__item").classList.add("selected"),c=e.target.closest(".cmp-icontextv2__item").querySelector(".cmp-icontextv2__text").textContent.trim())})),s.addEventListener("click",(async e=>{e.preventDefault();let t=n.value;if(t.length<2||""===c)return void function(e,t="Actualmente se esta presentando un error al cancelar tu pedido. Por favor intenta de nuevo mas tarde o puedes comunicarte a nuestra línea de atención 6044444800."){let i=`\n            <div class="parent-errormsg" style="background-color:#fff;padding:1rem">\n            <div class="errormsg" style="display:flex;align-items:center;gap:1rem;border-radius:1rem;padding:0.5rem;background-color:#FFE1E1">\n              <img src="/content/dam/epm/ecommerce/info-error-icon.png" alt="icono-info-error">\n              <p style="color:red;margin:0" class="errormsg-text">${t}</p>\n            </div>\n            </div>\n            `;document.getElementById(e).insertAdjacentHTML("beforeend",i),setTimeout((()=>{$(".parent-errormsg").hide()}),1e4)}("image-modal-satisfaccion","Por favor llene los campos");let i={satisfaccion:c,message:t};C();try{"1"===(await async function(e){const t=await fetch("/bin/api/encuesta-satisfaccion",{method:"POST",headers:{"Content-type":"application/json"},body:JSON.stringify({paso:Number(5),satisfaccion:e.satisfaccion,mejoras:e.message,flujo:"Aceptar cotizacion",numero_pedido_crm:u.NumeroPedido})});return await t.json()}(i)).data.createOrderEPMatp.status&&b()}catch(e){console.log(e)}finally{E()}})))})),window.addEventListener("load",(function(){try{const e=document.getElementsByClassName("cmp-aemform__iframecontent");if(!(e.length>0))return;{const t=e[0],i=(t.contentDocument||t.contentWindow.document).querySelector("form");if(!i)return;i.querySelectorAll("a").forEach((e=>{"Términos y condiciones"===e.textContent.trim()&&(e.id="modal-terminos",e.addEventListener("click",(e=>{e.preventDefault(),window.parent.postMessage({action:"abrirModal"},"*")})))}))}}catch(e){return void console.error("No se pudo acceder al contenido del iframe. ¿Same-origin?",e)}}))}()}();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.