"mousemove touchmove touchstart touchend wheel".split(" ").forEach(function (e) { window.addEventListener(e, function () { if (window.jQuery) { jQuery('body').addClass('penci-ready-js'); } }, false); }); var menuhbh_mobile = document.querySelector(".button-menu-mobile"); if (menuhbh_mobile !== null) { menuhbh_mobile.addEventListener('click', function () { if (window.jQuery) { return false; } if (menuhbh_mobile.classList.contains('header-builder')) { document.body.classList.toggle("open-mobile-builder-sidebar-nav"); } else { document.body.classList.toggle("open-sidebar-nav"); } }); } var menuhbh_toggle = document.querySelector(".penci-menuhbg-toggle"); if (menuhbh_toggle !== null) { menuhbh_toggle.addEventListener('click', function () { if (window.jQuery) { return false; } this.classList.toggle('active'); document.body.classList.toggle("penci-menuhbg-open"); }); } var menuhbh_search = document.querySelector(".pcheader-icon a.search-click"); if (menuhbh_search !== null) { menuhbh_search.addEventListener('click', function (e) { if (window.jQuery) { return false; } var closet = this.closest('.wrapper-boxed'), pbcloset = this.closest('.penci_nav_col'), sform = document.querySelector('.show-search'); if (closet.classList.contains('header-search-style-showup')) { this.classList.toggle('active'); sform.classList.toggle('active'); } else { this.classList.toggle('fade'); sform.classList.toggle('fade'); } var opentimeout = setTimeout(function () { closet.querySelector('.search-input').focus(); if (pbcloset !== null && !!pbcloset.querySelector('.search-input')) { pbcloset.querySelector('.search-input').focus(); } }, 200, function () { clearTimeout(opentimeout); }); e.stopPropagation(); return false; }); } function penci_check_isValidHttpUrl(string) { let url; try { url = new URL(string); } catch (_) { return false; } return url.protocol === "http:" || url.protocol === "https:"; } var links = document.querySelectorAll("a"); if (links !== null) { links.forEach((link) => { link.addEventListener('click', function (e) { if (window.jQuery) { return false; } var linkurl = this.getAttribute('href'); if (linkurl !== null && penci_check_isValidHttpUrl(linkurl)) { window.location.href = linkurl; } }); link.addEventListener('ontouchstart', function (e) { if (window.jQuery) { return false; } var linkurl = this.getAttribute('href'); if (linkurl !== null && penci_check_isValidHttpUrl(linkurl)) { window.location.href = linkurl; } }); }); } class SoledadLazyLoad{constructor(e){this.triggerEvents=e,this.eventOptions={passive:!0},this.userEventListener=this.triggerListener.bind(this),this.delayedScripts={normal:[],async:[],defer:[]},this.allJQueries=[]}_addUserInteractionListener(e){this.triggerEvents.forEach(t=>window.addEventListener(t,e.userEventListener,e.eventOptions))}_removeUserInteractionListener(e){this.triggerEvents.forEach(t=>window.removeEventListener(t,e.userEventListener,e.eventOptions))}triggerListener(){this._removeUserInteractionListener(this),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",this._loadEverythingNow.bind(this)):this._loadEverythingNow()}async _loadEverythingNow(){this._delayEventListeners(),this._delayJQueryReady(this),this._handleDocumentWrite(),this._registerAllDelayedScripts(),this._preloadAllScripts(),await this._loadScriptsFromList(this.delayedScripts.normal),await this._loadScriptsFromList(this.delayedScripts.defer),await this._loadScriptsFromList(this.delayedScripts.async),await this._triggerDOMContentLoaded(),await this._triggerWindowLoad(),window.dispatchEvent(new Event("soledadspeed-allScriptsLoaded"))}_registerAllDelayedScripts(){document.querySelectorAll("script[type=PenciLazyScript]").forEach(e=>{e.hasAttribute("src")?e.hasAttribute("async")&&!1!==e.async?this.delayedScripts.async.push(e):e.hasAttribute("defer")&&!1!==e.defer||"module"===e.getAttribute("data-pencilazy-type")?this.delayedScripts.defer.push(e):this.delayedScripts.normal.push(e):this.delayedScripts.normal.push(e)})}async _transformScript(e){return await this._requestAnimFrame(),new Promise(t=>{const n=document.createElement("script");let i;[...e.attributes].forEach(e=>{let t=e.nodeName;"type"!==t&&("data-pencilazy-type"===t&&(t="type",i=e.nodeValue),n.setAttribute(t,e.nodeValue))}),e.hasAttribute("src")?(n.addEventListener("load",t),n.addEventListener("error",t)):(n.text=e.text,t()),e.parentNode.replaceChild(n,e)})}async _loadScriptsFromList(e){const t=e.shift();return t?(await this._transformScript(t),this._loadScriptsFromList(e)):Promise.resolve()}_preloadAllScripts(){var e=document.createDocumentFragment();[...this.delayedScripts.normal,...this.delayedScripts.defer,...this.delayedScripts.async].forEach(t=>{const n=t.getAttribute("src");if(n){const t=document.createElement("link");t.href=n,t.rel="preload",t.as="script",e.appendChild(t)}}),document.head.appendChild(e)}_delayEventListeners(){let e={};function t(t,n){!function(t){function n(n){return e[t].eventsToRewrite.indexOf(n)>=0?"soledadspeed-"+n:n}e[t]||(e[t]={originalFunctions:{add:t.addEventListener,remove:t.removeEventListener},eventsToRewrite:[]},t.addEventListener=function(){arguments[0]=n(arguments[0]),e[t].originalFunctions.add.apply(t,arguments)},t.removeEventListener=function(){arguments[0]=n(arguments[0]),e[t].originalFunctions.remove.apply(t,arguments)})}(t),e[t].eventsToRewrite.push(n)}function n(e,t){let n=e[t];Object.defineProperty(e,t,{get:()=>n||function(){},set(i){e["soledad"+t]=n=i}})}t(document,"DOMContentLoaded"),t(window,"DOMContentLoaded"),t(window,"load"),t(window,"pageshow"),t(document,"readystatechange"),n(document,"onreadystatechange"),n(window,"onload"),n(window,"onpageshow")}_delayJQueryReady(e){let t=window.jQuery;Object.defineProperty(window,"jQuery",{get:()=>t,set(n){if(n&&n.fn&&!e.allJQueries.includes(n)){n.fn.ready=n.fn.init.prototype.ready=function(t){e.domReadyFired?t.bind(document)(n):document.addEventListener("soledadspeed-DOMContentLoaded",()=>t.bind(document)(n))};const t=n.fn.on;n.fn.on=n.fn.init.prototype.on=function(){if(this[0]===window){function e(e){return e.split(" ").map(e=>"load"===e||0===e.indexOf("load.")?"soledadspeed-jquery-load":e).join(" ")}"string"==typeof arguments[0]||arguments[0]instanceof String?arguments[0]=e(arguments[0]):"object"==typeof arguments[0]&&Object.keys(arguments[0]).forEach(t=>{delete Object.assign(arguments[0],{[e(t)]:arguments[0][t]})[t]})}return t.apply(this,arguments),this},e.allJQueries.push(n)}t=n}})}async _triggerDOMContentLoaded(){this.domReadyFired=!0,await this._requestAnimFrame(),document.dispatchEvent(new Event("soledadspeed-DOMContentLoaded")),await this._requestAnimFrame(),window.dispatchEvent(new Event("soledadspeed-DOMContentLoaded")),await this._requestAnimFrame(),document.dispatchEvent(new Event("soledadspeed-readystatechange")),await this._requestAnimFrame(),document.soledadonreadystatechange&&document.soledadonreadystatechange()}async _triggerWindowLoad(){await this._requestAnimFrame(),window.dispatchEvent(new Event("soledadspeed-load")),await this._requestAnimFrame(),window.soledadonload&&window.soledadonload(),await this._requestAnimFrame(),this.allJQueries.forEach(e=>e(window).trigger("soledadspeed-jquery-load")),window.dispatchEvent(new Event("soledadspeed-pageshow")),await this._requestAnimFrame(),window.soledadonpageshow&&window.soledadonpageshow()}_handleDocumentWrite(){const e=new Map;document.write=document.writeln=function(t){const n=document.currentScript,i=document.createRange(),a=n.parentElement;let d=e.get(n);void 0===d&&(d=n.nextSibling,e.set(n,d));const s=document.createDocumentFragment();i.setStart(s,0),s.appendChild(i.createContextualFragment(t)),a.insertBefore(s,d)}}async _requestAnimFrame(){return new Promise(e=>requestAnimationFrame(e))}static run(){const e=new SoledadLazyLoad(["keydown","mousemove","touchmove","touchstart","touchend","wheel"]);e._addUserInteractionListener(e)}}SoledadLazyLoad.run(); "use strict";window.penciLazyConfig={cssDelayType:"interact"},(()=>{const e=window.penciLazyConfig||{},t=!0;let n=[];const o={HTMLDocument:document.addEventListener.bind(document),Window:window.addEventListener.bind(window)},c={};let a,d=!1,r=!1,s=[],i=[];function l(t){(i=[...document.querySelectorAll("link[data-soledad_pagespeed-delay]")]).length&&function(t,n){t=t||"js";const c=n?"onload":e[t+"DelayType"]||"onload",a="js"===t?f:u;switch("js"===t&&(n||"onload"===c?y():g(y)),c){case"interact":let e=!1;const d=()=>{e||(e=!0,"js"===t?function(e){"loading"!==document.readyState?e():o.Window("DOMContentLoaded",()=>e())}(()=>setTimeout(a,2)):a())};["mousemove","mousedown","keydown","touchstart","wheel"].forEach(e=>{document.addEventListener(e,d,{passive:!0,once:!0})})}}("css",t)}function u(){i.forEach(e=>m(e))}function f(e){if(y(),!e){d=!0,a=document.readyState;let e="loading";Object.defineProperty(document,"readyState",{configurable:!0,get:()=>e,set:t=>e=t})}let t;const o=new Promise(e=>t=e),c=()=>{s.length?m(s.shift()).then(c):t()};c(),o.then(w).catch(e=>{console.error(e),w()}),setTimeout(()=>!n.length||w(),45e3)}function m(e){let t;const n=e.dataset.src,o=e=>new Promise(t=>{e.addEventListener("load",t),e.addEventListener("error",t)});if(n){const c=document.createElement("script");t=o(c),e.getAttributeNames().forEach(t=>{"src"===t||(c[t]=e[t])}),c.async=!1,c.src=n,e.parentNode.replaceChild(c,e)}const c=e.dataset.href;return c&&(t=o(e),e.href=c),t||Promise.resolve()}function h(e){try{e.cb.call(e.context,c[e.event],...e.args)}catch(e){console.error(e)}}function w(){if(r)return;t&&console.log("Firing Load Events",n),r=!0;const e=n.filter(e=>"readystatechange"===e.event);document.readyState="interactive",e.forEach(e=>h(e));for(const e of n)"DOMContentLoaded"===e.event&&h(e);for(const e of n)"load"===e.event&&h(e);n=[],r=!1,g(()=>{document.readyState="complete",setTimeout(()=>{e.forEach(e=>h(e))},2)})}function g(e){"complete"===(a||document.readyState)?e():o.Window("load",()=>e())}l(),document.addEventListener("pencilazy-load-css",()=>l(!0))})();