PageSourceSearch

https://www.clubdeperrosygatos.cl/wp-content/plugins/cpg-ecommerce/assets/cpg-h-header.js?ver=0.3.178

js clubdeperrosygatos.cl collected 2026-10-08 02:47:08 UTC 16,514 bytes, 2 lines download raw bytes

1!function(){var cpgBootAttempts=0;function cpgBoot(){if(!window.jQuery){if(cpgBootAttempts++<200)window.setTimeout(cpgBoot,50);return}!function(t){"use strict";var e=window.wc_cart_fragments_params||{},n=window.cpgHeaderData||{},a=n.wcAjaxUrl||(e.wc_ajax_url?e.wc_ajax_url.replace("%%endpoint%%","get_refreshed_fragments"):""),r={fragmentName:e.fragment_name||n.fragmentName||"",cartHashKey:e.cart_hash_key||n.cartHashKey||"wc_cart_hash",requestTimeout:Number(e.request_timeout)||Number(n.requestTimeout)||5e3,wcAjaxUrl:a,ajaxUrl:n.ajaxUrl,nonce:n.nonce,cartHashCookie:n.cartHashCookie||"woocommerce_cart_hash",cartCountCookie:n.cartCountCookie||"woocommerce_items_in_cart",cartUrl:n.cartUrl,checkoutUrl:n.checkoutUrl,accountUrl:n.accountUrl,i18n:n.i18n||{}},o=!1;function c(){o||(o=!0,t(document.body).trigger("wc_fragments_loaded"))}function i(){t(document.body).trigger("wc_fragments_refreshed")}function s(e){t(document.body).trigger("wc_fragments_ajax_error",[e||null])}var u=function(t){var e=document.cookie.match(new RegExp("(?:^|; )"+t.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1")+"=([^;]*)"));return e?decodeURIComponent(e[1]):""};function d(){var t=parseInt(u(r.cartCountCookie),10),e=u(r.cartHashCookie);return isFinite(t)&&t>0&&e.length>0}var l="cpg_h_cart_snapshot_v1",m=function(t){try{var e=window.sessionStorage.getItem(l);if(!e)return null;var n=JSON.parse(e);return!n||"1"!==n.version||!n.fragments||n.count<=0||t&&n.cartHash!==t?null:n}catch(a){return null}},f=function(t,e,n){var a=n||u(r.cartHashCookie);try{window.sessionStorage.setItem(l,JSON.stringify({version:"1",cartHash:a,count:e,fragments:t,savedAt:Date.now()}))}catch(o){}!function(t,e){try{r.fragmentName&&window.sessionStorage.setItem(r.fragmentName,JSON.stringify(t||{})),r.cartHashKey&&(window.sessionStorage.setItem(r.cartHashKey,e||""),window.localStorage.setItem(r.cartHashKey,e||"")),e&&!window.sessionStorage.getItem("wc_cart_created")&&window.sessionStorage.setItem("wc_cart_created",String(Date.now()))}catch(o){}}(t,a)},g=function(){try{window.sessionStorage.removeItem(l)}catch(t){}!function(){try{r.fragmentName&&window.sessionStorage.removeItem(r.fragmentName),window.sessionStorage.removeItem("wc_cart_created"),r.cartHashKey&&(window.sessionStorage.setItem(r.cartHashKey,""),window.localStorage.setItem(r.cartHashKey,""))}catch(t){}}()};function p(e){if(!e||"object"!=typeof e)return!1;var n=!1;return Object.keys(e).forEach(function(a){var r=e[a];if(function(t){return"string"==typeof t&&t.trim().length>0}(r))if("[data-cpg-header-cart-count]"!==a){var o=t(a);if(o.length){var c;try{c=t(t.parseHTML(r.trim(),document,!0))}catch(i){return}c&&c.length&&(o.each(function(e,n){t(n).replaceWith(c.clone(!0))}),n=!0)}}else n=function(e){var n,a=t("[data-cpg-header-cart-count]");if(!a.length)return!1;try{n=t(t.parseHTML(e.trim(),document,!0)).filter("[data-cpg-header-cart-count]").first()}catch(i){return!1}if(!n||!n.length)return!1;var r=n.attr("data-cart-count")||"0",o=n.attr("aria-label")||"",c=n.hasClass("is-empty"),s=n.text();return a.each(function(e,n){var a=t(n);a.find("[data-cpg-header-cart-count]").remove(),a.attr("data-cart-count",r).attr("aria-label",o).toggleClass("is-empty",c).text(s)}),!0}(r)||n}),h(),n}function v(){t("[data-cpg-header-cart-count]").each(function(){var e=t(this);e.find("[data-cpg-header-cart-count]").remove(),e.attr("data-cart-count","0").text("0").addClass("is-empty")});var e=t("#cpg-h-cart-drawer-footer");e.length&&e.hide(),g()}function h(){var e=t("#cpg-h-cart-drawer-footer");if(e.length){var n=0,a=t("[data-cpg-header-cart-content]").first();a.length&&(n=parseInt(a.find(".cpg-mini-cart__content-inner").attr("data-cart-count"),10)||0),n||(n=parseInt(t("[data-cpg-header-cart-count]").first().attr("data-cart-count"),10)||0),n>0?e.css("display","").show():e.hide()}}var w=0,y=0;function _(){return w+=1}function b(t){return!(t<y)&&(y=t,!0)}var k=null;function L(e){if(k)return k;if("forced"!==e&&!d())return v(),c(),i(),t.Deferred().resolve(null).promise();var n=_();return C(!0),k=t.ajax({url:r.wcAjaxUrl,type:"POST",data:{time:Date.now()},dataType:"json",cache:!1,timeout:r.requestTimeout}).then(function(t){if(!b(n))return null;if(!t||!t.fragments)return null;p(t.fragments);var e=parseInt(u(r.cartCountCookie),10)||0;return e>0?f(t.fragments,e,t.cart_hash):g(),i(),t}).catch(function(t){return s(t),null}).always(function(){C(!1),k=null})}function C(e){t("#cpg-h-cart-drawer").toggleClass("is-syncing",!!e)}function x(){if(!d())return v(),void c();var t=u(r.cartHashCookie),e=m(t);if(e&&(p(e.fragments),c()),e&&Date.now()-(e.savedAt||0)<3e5)return;L("bootstrap-non-empty")}function S(){if("MutationObserver"in window){var t="WeakSet"in window?new WeakSet:null,e=[];new MutationObserver(function(t){for(var e=0;e<t.length;e++){var a=t[e].target;a&&1===a.nodeType&&a.classList&&a.classList.contains("snize-add-to-cart-button")&&a.classList.contains("size-button-view-cart")&&n(a)}}).observe(document.body,{attributes:!0,attributeFilter:["class","redirect-url"],subtree:!0})}function n(n){var a;(a=n,t?t.has(a):-1!==e.indexOf(a))||(!function(n){t?t.add(n):e.push(n)}(n),L("forced"),H(r.i18n&&r.i18n.addedToCart||"Producto añadido a tu carrito.","success"))}}t(document.body).on("added_to_cart",function(t,e,n){var a=_();if(e&&b(a)){p(e);var o=parseInt(u(r.cartCountCookie),10)||0;o>0&&f(e,o,n)}c()}),t(document.body).on("removed_from_cart",function(t,e,n){var a=_();e&&b(a)&&p(e),d()||v(),c()}),t(document.body).on("wc_fragment_refresh updated_wc_div",function(){L("event")}),document.addEventListener("cpg_cart_force_sync",function(){L("forced")});var E={},I={},A={};function q(t,e,n,a){var o=Object.keys(e).map(function(t){return encodeURIComponent(t)+"="+encodeURIComponent(e[t])}).join("&");fetch(r.ajaxUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},body:"action="+encodeURIComponent(t)+"&"+o,credentials:"same-origin",signal:a}).then(function(t){return t.json()}).then(n).catch(function(t){t&&"AbortError"===t.name||(s(t),n({success:!1}))})}function T(e,n){var a,o,s;if(a=Date.now()-(O||Date.now()),o=Math.max(0,D-a),window.setTimeout(K,o),!e||!e.success||!e.data)return(s=t("#cpg-h-cart-drawer")).addClass("has-error"),void window.setTimeout(function(){s.removeClass("has-error")},2500);if(b(n)){var d=e.data.header_fragments;if(d){p(d);var l=parseInt(e.data.count,10)||0;l>0?f(d,l,u(r.cartHashCookie)):g()}
1e.data.notices&&e.data.notices.length&&e.data.notices.forEach(function(t){t&&t.message&&H(t.message,t.type||"info")}),c(),i()}}function H(t,e){if(t){var n=function(){var t=document.getElementById("cpg-toast-stack");return t||((t=document.createElement("div")).id="cpg-toast-stack",t.className="cpg-toast-stack",t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","false"),document.body.appendChild(t)),t}(),a=document.createElement("div");a.className="cpg-toast cpg-toast--"+(e||"success"),a.setAttribute("role","error"===e?"alert":"status"),a.innerHTML='<span class="cpg-toast__icon" aria-hidden="true">'+function(t){return"error"===t?'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>':"info"===t?'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg>':'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg>'}(e)+'</span><span class="cpg-toast__msg"></span><button type="button" class="cpg-toast__close" aria-label="'+(r.i18n&&r.i18n.close||"Cerrar")+'"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round"><path d="M18 6 6 18"/><path d="M6 6l12 12"/></svg></button><span class="cpg-toast__progress"><span class="cpg-toast__progress-bar"></span></span>',a.querySelector(".cpg-toast__msg").textContent=t,n.appendChild(a);var o=!1,c=window.setTimeout(i,8e3);window.requestAnimationFrame(function(){a.classList.add("is-visible");var t=a.querySelector(".cpg-toast__progress-bar");t&&(t.style.animationDuration="8s",t.classList.add("is-counting"))}),a.querySelector(".cpg-toast__close").addEventListener("click",function(){window.clearTimeout(c),i()})}function i(){o||(o=!0,a.classList.remove("is-visible"),a.classList.add("is-leaving"),window.setTimeout(function(){a.remove()},300))}}function j(t,e){if(e)try{document.dispatchEvent(new CustomEvent(t,{detail:{productId:parseInt(e.product_id,10)||0,variationId:parseInt(e.variation_id,10)||0,remaining:null===e.remaining||void 0===e.remaining?null:parseInt(e.remaining,10),name:e.name||""}}))}catch(n){}}function U(t,e,n){window.clearTimeout(E[t]),E[t]=window.setTimeout(function(){!function(t,e,n){A[t]&&A[t].abort();var a="undefined"!=typeof AbortController?new AbortController:null;A[t]=a,I[t]=(I[t]||0)+1;var o=I[t],c=_();n.classList.add("is-updating"),F(),q("cpg_update_qty",{nonce:r.nonce,cart_item_key:t,quantity:e},function(e){if(I[t]===o){n.classList.remove("is-updating"),T(e,c);var a=e&&e.data&&e.data.stock_sync;a&&j(a.removed?"cpg_cart_item_removed":"cpg_cart_stock_sync",a)}},a?a.signal:void 0)}(t,e,n)},500)}document.addEventListener("cpg_cart_item_removed",function(t){var e,n=t&&t.detail||{};n.name&&H((e=n.name,(r.i18n&&r.i18n.removedFromCart||"%s se eliminó del carrito.").replace("%s",e)),"success")}),document.addEventListener("cpg_show_toast",function(t){var e=t&&t.detail||{};e.message&&H(e.message,e.type||"info")});var D=350,N=6e3,M=null,O=null;function B(){var t=document.getElementById("cpg-h-cart-drawer");return t?{itemsLabel:t.querySelector(".cpg-h-cart-drawer__items-label"),items:Array.prototype.slice.call(t.querySelectorAll(".cpg-h-cart-item")),subtotal:t.querySelector(".cpg-h-cart-drawer__subtotal-val")}:null}function F(){var t=B();t&&(t.itemsLabel&&t.itemsLabel.classList.add("is-loading"),t.items.forEach(function(t){t.classList.add("is-loading")}),t.subtotal&&t.subtotal.classList.add("is-loading"),O=Date.now(),window.clearTimeout(M),M=window.setTimeout(K,N))}function K(){window.clearTimeout(M),M=null;var t=B();t&&(t.itemsLabel&&t.itemsLabel.classList.remove("is-loading"),t.items.forEach(function(t){t.classList.remove("is-loading")}),t.subtotal&&t.subtotal.classList.remove("is-loading"))}t(document).on("click",".cpg-h-cart-qty__btn",function(e){e.preventDefault();var n=t(this),a=n.closest(".cpg-h-cart-qty"),r=n.closest(".cpg-h-cart-item");if(a.length&&r.length){var o=a.data("key"),c=parseInt(a.data("min"),10)||1,i=parseInt(a.data("max"),10)||0,s=a.find("[data-qty]"),u=parseInt(s.text(),10)||1;if(n.hasClass("cpg-h-cart-qty__plus")){if(i>0&&u>=i)return;u+=1}else(u=Math.max(0,u-1))<c&&0!==u&&(u=c);s.text(u),U(o,u,r.get(0))}}),t(document).on("click",".cpg-h-cart-item__remove",function(e){e.preventDefault();var n=t(this),a=n.data("key"),o=n.closest(".cpg-h-cart-item");a&&o.length&&function(t,e){e.classList.add("is-removing"),F();var n=_();q("cpg_remove_item",{nonce:r.nonce,cart_item_key:t},function(t){T(t,n);var e=t&&t.data&&t.data.removed_item;e&&j("cpg_cart_item_removed",e)})}(a,o.get(0))});var R=null;function J(){var t=document.getElementById("cpg-h-cart-drawer");t&&"true"!==t.getAttribute("aria-hidden")&&(t.setAttribute("aria-hidden","true"),document.body.style.overflow="",R&&"function"==typeof R.focus&&R.focus({preventScroll:!0}),R=null)}function P(){var t=document.querySelectorAll(".cpg-h-account");if(t.length){var e=matchMedia("(hover: none), (pointer: coarse)").matches;t.forEach(function(t){var n=t.querySelector(".cpg-h-account__trigger");n&&(!t.closest(".cpg-h-mobile-header")?function(t,e,n){var a=null;function r(){t.classList.add("is-open"),e.setAttribute("aria-expanded","true")}function o(){t.classList.remove("is-open"),e.setAttribute("aria-expanded","fal
1se")}n||(t.addEventListener("mouseenter",function(){window.clearTimeout(a),r()}),t.addEventListener("mouseleave",function(){a=window.setTimeout(o,150)}));e.addEventListener("click",function(e){e.preventDefault(),t.classList.contains("is-open")?o():r()}),document.addEventListener("click",function(e){t.contains(e.target)||o()}),document.addEventListener("keydown",function(n){"Escape"===n.key&&t.classList.contains("is-open")&&(o(),e.focus())})}(t,n,e):function(t,e){var n=t.classList.contains("cpg-h-account--guest"),a=!!document.querySelector("[data-cpg-dash-menu-toggle]"),o=n||a?null:function(){var t=document.querySelector("[data-cpg-dash-navdrawer]"),e=document.querySelector("[data-cpg-dash-navoverlay]");if(!t||!e)return{open:function(){return!1}};var n=t.querySelector("[data-cpg-dash-menu-close]"),a=!1;function r(){return a||(a=!0,e.hidden=!1,t.hidden=!1,requestAnimationFrame(function(){requestAnimationFrame(function(){document.body.classList.add("cpg-dash-menu-open")})})),!0}function o(){a&&(a=!1,document.body.classList.remove("cpg-dash-menu-open"),window.setTimeout(function(){e.hidden=!0,t.hidden=!0},260))}n&&n.addEventListener("click",o);return e.addEventListener("click",o),document.addEventListener("keydown",function(t){"Escape"===t.key&&a&&o()}),{open:r}}();function c(){r.accountUrl&&(window.location.href=r.accountUrl)}e.addEventListener("click",function(t){if(t.preventDefault(),n)c();else{var e=document.querySelector("[data-cpg-dash-menu-toggle]");e?e.click():o&&o.open()||c()}})}(t,n))})}}function W(){document.querySelectorAll("[data-cpg-header-cart-count]").forEach(function(t){var e=t.querySelectorAll("[data-cpg-header-cart-count]");if(e.length){var n=e[e.length-1];t.setAttribute("data-cart-count",n.getAttribute("data-cart-count")||"0"),t.setAttribute("aria-label",n.getAttribute("aria-label")||""),t.classList.toggle("is-empty",n.classList.contains("is-empty")),t.textContent=n.textContent}})}function z(){var t=document.querySelector(".cpg-h-account--user .cpg-h-account__eyebrow[data-cpg-greeting]");if(t){var e;try{e=parseInt(new Intl.DateTimeFormat("en-US",{timeZone:"America/Santiago",hour:"numeric",hourCycle:"h23"}).format(new Date),10)}catch(o){return}if(!isNaN(e)){24===e&&(e=0);var n,a=r.i18n||{};n=e>=6&&e<12?a.greetingMorning||"Buen día,":e>=12&&e<19?a.greetingAfternoon||"Buenas tardes,":a.greetingNight||"Buenas noches,",t.textContent=n}}}function V(){P(),z(),x(),function(){if(r.cartHashKey&&"addEventListener"in window){var t=null;window.addEventListener("storage",function(e){e.key===r.cartHashKey&&e.newValue!==e.oldValue&&(t&&window.clearTimeout(t),t=window.setTimeout(function(){t=null,L("cross-tab-sync")},200))})}}(),function(){if(W(),"MutationObserver"in window){var t=!1;new MutationObserver(function(){t||(t=!0,window.requestAnimationFrame(function(){t=!1,W()}))}).observe(document.body,{childList:!0,subtree:!0})}}(),S(),window.addEventListener("pageshow",function(t){t.persisted&&(x(),z())})}document.addEventListener("click",function(t){if(t.target.closest("[data-cpg-h-cart-trigger]"))return t.preventDefault(),void function(){var t=document.getElementById("cpg-h-cart-drawer");if(t){h(),R=document.activeElement,t.setAttribute("aria-hidden","false"),document.body.style.overflow="hidden";var e=t.querySelector(".cpg-h-cart-drawer__panel");e&&(e.setAttribute("tabindex","-1"),window.requestAnimationFrame(function(){e.focus({preventScroll:!0})}
1))}}();t.target.closest("[data-cpg-h-cart-close]")&&(t.preventDefault(),J())}),document.addEventListener("keydown",function(t){if("Escape"===t.key){var e=document.getElementById("cpg-h-cart-drawer");e&&"false"===e.getAttribute("aria-hidden")&&J()}}),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",V):V()}(window.jQuery)}cpgBoot()}();
2!function(){"use strict";window.jQuery&&window.jQuery(document.body).on("added_to_cart",function(t,e,o,a){var r=window.cpgHeaderData||{};if(r.catalogAddToCartToast){var c=r.i18n||{},d=function(t){if(!t||"function"!=typeof t.closest)return"";var e=t.closest(".cpg-product-card, .cpg-featured-slide");if(!e)return"";var o=e.querySelector(".cpg-product-title, h3");return o?o.textContent.replace(/\s+/g," ").trim():""}(a&&"function"==typeof a.get?a.get(0):null),n=d?(c.addedToCartNamed||"%s se agregó al carrito.").replace("%s",d):c.addedToCart||"Producto añadido a tu carrito.";"function"==typeof CustomEvent&&document.dispatchEvent(new CustomEvent("cpg_show_toast",{detail:{message:n,type:"success"}}))}})}();

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.