!(function () { var e = { 137: function (e, t, a) { var r = a(847); e.exports = function (e) { var t, a, n, i, o, s = decodeURI(window.location.pathname.toLowerCase().replace("/", "")), l = s.split("/"), c = "", d = 1, p = [], u = {}, g = [], h = {}, f = "", C = "", m = { categoryTitle: null, childCategories: null, filters: null, specialFilters: { priceRanges: null, brand: null }, selectorsClass: "customFilterSelectorCC", activeSelectorsClass: "active", disableClass: "disabled", notAvailableCombinations: !0, addFiltersBtn: null, cleanFiltersBtn: null, shelf: null, filtersSummary: null, orderControls: null, pagination: { wraper: "
", previousBtnText: "Anterior", nextBtnText: "Siguiente", onlyBtnPage: !1 }, }, v = function () { return $.ajax({ url: "/api/catalog_system/pub/brand/list", method: "GET", dataType: "json" }); }, y = function (e) { for (var t = "c", a = 1; e.length > a; a++) t += ",c"; return t; }; function b(e) { var u, C, L = "", F = ""; switch ( ($.isEmptyObject(h) || $.each(h, function (e, t) { $.each(t, function (t, a) { (L += "/" + encodeURIComponent(a)), (F += ",specificationFilter_" + e); }); }), p.length && $.each(p, function (e, t) { (L += "/" + encodeURIComponent(t)), (F += ",priceFrom"); }), g.length && "Brand" !== i && $.each(g, function (e, t) { (L += "/" + encodeURIComponent(t)), (F += ",b"); }), i) ) { case "Landing": (u = a), (C = "productClusterIds"); break; case "Search": (u = vtxctx.searchTerm), (C = "ft"); break; case "Brand": (u = s), (C = "b"); break; case "Brand in Category": case "Category": (u = s), (C = y(l)); break; case "Search in Category": (u = s + "/" + vtxctx.searchTerm), (C = y(l) + ",ft"); break; case "Cluster in Category": (u = s + "/" + a), (C = y(l) + ",productClusterIds"); } $.ajax({ url: "/api/catalog_system/pub/facets/search/" + u + L + "?map=" + C + F, method: "get" }).then(function (s) { (t = s), (window.categoryInfo = t); var u = 0; function C() { 0 <= i.indexOf("Category") ? (m.filters ? ($.each(t.SpecificationFilters, function (e, t) { var a, r, n = m.filters[e]; n ? ((a = ""), n.order && t.sort(n.order), $.each(t, function (t, r) { var i = n.selector.replace(/\{{name}}/g, r.Name).replace(/\{{quantity}}/g, r.Quantity), o = $(i).attr("data-filtervalue", r.Name).attr("data-filterid", r.Link.split("specificationFilter_")[1]).addClass(m.selectorsClass); "color" === e.toLowerCase() && o.css("background-color", r.Name), (a += o[0].outerHTML); }), (r = $(n.structure.replace(/\{{title}}/g, e).replace("{{selectors}}", a)) .attr("data-filtername", e) .addClass("customFilterCC")), $(n.path).append(r[0].outerHTML)) : console.warn("CATEGORY CONTROLLERS: No se ha configurado el filtro " + e); }), B(), (m.addFiltersBtn || m.cleanFiltersBtn) && $(m.cleanFiltersBtn).click(function () { $.isEmptyObject(h) || ((h = ""), (d = 1), R("filter"), $("." + m.selectorsClass).removeClass(m.activeSelectorsClass), $(document).trigger("categoryControllers:clean_filters")); }), $(document).trigger("categoryControllers:filters_Rendered")) : console.warn("CATEGORY CONTROLLERS: No hay configuración para los filtros de categoria."), t.PriceRanges && t.PriceRanges.length && (m.specialFilters && m.specialFilters.priceRanges ? (function () { var e = ""; $.each(t.PriceRanges, function (t, a) { var r = $(m.specialFilters.priceRanges.selector.replace(/\{{name}}/g, a.Name)) .attr("data-pricerange", a.Slug) .addClass("priceRangeSelectorCC"); e += r[0].outerHTML; }); var a = $(m.specialFilters.priceRanges.structure.replace("{{selectors}}", e)).addClass("priceRangesContainerCC"); $(m.specialFilters.priceRanges.path).append(a), T(); })() : console.warn("CATEGORY CONTROLLERS: No hay configuración para los rangos de precios.")), "Brand in Category" != i && t.Brands.length && (m.specialFilters && m.specialFilters.brand ? (function () { var e = ""; $.each(t.Brands, function (t, a) { var r = $(m.specialFilters.brand.selector.replace(/\{{name}}/g, a.Name)) .attr("data-brand", a.Name) .addClass("brandSelectorCC"); e += r[0].outerHTML; }); var a = $(m.specialFilters.brand.structure.replace("{{selectors}}", e)).addClass("brandContainerCC"); $(m.specialFilters.brand.path).append(a), O(); })() : console.warn("CATEGORY CONTROLLERS: No hay configuración para las marcas."))) : console.info("CATEGORY CONTROLLERS: Los controles de filters solo estan disponibles para la página de categoria."), m.childCategories ? (function () { function e(t, r) { var n = ""; $.each(t, function (t, o) { var s; "Landing" == i && ((s = o.Link.replace("/", "").split("/")), (n = "/" + a + "?map=" + y(s) + ",productClusterIds")); var l = $("<" + m.childCategories.offspringWraper + ">").attr("data-categorypath", o.Link), c = m.childCategories.addLink ? '' + (o.Name ? o.Name : o.name) + (m.childCategories && o.Quantity ? " (" + o.Quantity + ")" : "") + "" : (o.Name ? o.Name : o.name) + (m.childCategories && o.Quantity ? " (" + o.Quantity + ")" : ""), d = $(m.childCategories.structure.replace(/\{{title}}/g, c)).attr("data-categorypath", o.Link); o.Children && o.Children.length && d.addClass("has-children"), $(r).append(d[0].outerHTML), ((o.Children && o.Children.length) || (o.children && o.children.length)) && ($(r).append(l[0].outerHTML), e(o.Children, m.childCategories.offspringWraper + '[data-categorypath="' + o.Link + '"]')); }); } $(m.categoryTitle).html(vtxctx.categoryName), 0 <= i.indexOf("Category") ? (function () { var a = 0; !(function t(n) { a == l.length - 1 ? n.Children.length ? ($(document).trigger("categoryControllers:subcategory_Rendered", [n]), e(n.Children, m.childCategories.path)) : (function () { var e = { url: "/api/catalog_system/pub/facets/search/" + vtxctx.departmentName + "?map=c", method: "GET", dataType: "json" }; return $.ajax(e); })().then(function (t) { $.each(t.CategoriesTrees, function (t, a) { a.Id == vtxctx.departmentyId && e(a.Children, m.childCategories.path); }); }) : (a++, $.each(n.Children, function (e, n) { r.slug(n.Name) == l[a] && t(n); })); })(t.CategoriesTrees[0]); })() : e(t.CategoriesTrees, m.childCategories.path); })() : console.warn("CATEGORY CONTROLLERS: No hay configuración para el menú de categorias (childCategories)."), m.orderControls ? ((m.orderControls.defaultOrder || n) && (f = n || m.orderControls.defaultOrder), (function () { var e = { OrderByPriceASC: "Menor precio", OrderByPriceDESC: "Mayor precio", OrderByTopSaleDESC: "Más vendidos", OrderByNameASC: "A - Z", OrderByNameDESC: "Z - A", OrderByReleaseDateDESC: "Fecha de lanzamiento", OrderByBestDiscountDESC: "Mayor descuento", OrderByScoreDESC: "Mas populares", OrderByReviewRateDESC: "Mejores calificaciones", }; $.each(m.orderControls.list, function (t, a) { var r = $(m.orderControls.structure.replace(/\{{name}}/g, 1 == a ? e[t] : a)) .attr("data-ordervalue", t) .addClass("orderOptionCC"); $(m.orderControls.path).append(r); }), $("select#O").removeAttr("onchange"), $("select#O").off("change"), "SELECT" == $(m.orderControls.path).prop("tagName") ? $(m.orderControls.path).change(function () { (f = $(this).find(":selected").data("ordervalue")), (d = 1), R("loadPage"); }) : $(".orderOptionCC").click(function () { $(this).siblings(".orderOptionCC").removeClass(m.orderControls.activeClass), $(this).hasClass(m.orderControls.activeClass) ? ((f = ""), $(this).removeClass(m.orderControls.activeClass)) : ((f = $(this).data("ordervalue")), $(this).addClass(m.orderControls.activeClass)), (d = 1), R("loadPage"); }), $(document).trigger("categoryControllers:orderControls_Rendered"); })()) : console.warn("CATEGORY CONTROLLERS: No hay configuración para los controles de orden."), m.shelf ? (R("loadPage"), m.pagination.path ? ((m.pagination.onlyBtnPage ? function () { var e; 1 < o ? ((e = $(m.pagination.wraper).html(m.pagination.nextBtnText).addClass("paginationPlusBtnCC paginationControlCC")[0].outerHTML), $(m.pagination.path).html(e), $(m.pagination.path).show(), w()) : $(m.pagination.path).hide(); } : x)(), $(document).on("click", ".paginationNextBtnCC", function () { d++; }), $(document).on("click", ".paginationPrevBtnCC", function () { d--; }), $(document).on("click", ".paginationNumberCC", function () { $(this).hasClass(m.activeSelectorsClass) || (d = $(this).data("page")); }), $(document).on("click", ".paginationControlCC", function () { m.pagination.onlyBtnPage || (x(), R("loadPage")); }), $(document).on("click", ".paginationPlusBtnCC", function () { $(m.shelf.path).attr("data-status") || (d < o && (d++, R("nextPage"), w())); })) : $(window).scroll(function () { var e = $(document).scrollTop(), t = $(m.shelf.path).offset().top + $(m.shelf.path).height(); (t > $(window).height() ? t - $(window).height() : $(document).height() - $(window).height()) <= e && ($(m.shelf.path).attr("data-status") || (d < o && (d++, R("nextPage")))); })) : console.warn("CATEGORY CONTROLLERS: No hay configuración para la vitrina de productos."), (function () { var e = N(); e.filtersLoaded && ((d = e.pageNumber || 1), (h = e.selectedFiltersData || {}), (p = e.selectedPriceRanges || []), (g = e.selectedBrand || []), (f = e.selectedOrderOption || ""), Object.keys(h).forEach(function (e) { h[e].forEach(function (t) { $("[data-filterid='" + e + "']") .filter("[data-filtervalue='" + t + "']") .addClass(m.activeSelectorsClass); }); }), p.forEach(function (e) { $("[data-pricerange='" + e + "']").addClass(m.activeSelectorsClass); }), g.forEach(function (e) { $("[data-brand='" + e + "']").addClass(m.activeSelectorsClass); }), f && $(m.orderControls.path) .find("[data-ordervalue='" + f + "']") .prop("selected", !0), b("Reset Pagination Controls")); })(); } $.each(t.Departments, function (e, t) { u += t.Quantity; }), $(document).trigger("categoryControllers:categoryInfoLoaded", [s, u]), m.shelf && (o = Math.ceil(u / m.shelf.itemsNumber)), "First Load" === e ? "Category" == i || "Search in Category" == i || "Cluster in Category" == i || "Brand in Category" == i ? (function () { var e = { url: "/api/catalog_system/pub/category/tree/" + l.length, method: "GET", dataType: "json" }; return $.ajax(e); })().then(function (e) { var t; (t = 0), (function e(a) { $.each(a, function (a, n) { l[t] && r.slug(n.name) == r.slug(l[t]) && (t++, (c += "/" + n.id), t < l.length && e(n.children)); }); })(e), "Brand in Category" == i || (m.specialFilters && m.specialFilters.brand) ? v().then(function (e) { S(e), C(); }) : C(); }) : "Brand" == i ? v() .then(function (e) { S(e), C(); }) .fail(function () { console.warn("CATEGORY CONTROLLERS: Hubo un error al cargar el listado de marcas"); }) : C() : "Reset Pagination Controls" === e ? m.pagination.onlyBtnPage || x() : m.notAvailableCombinations && $(".customFilterCC ." + m.selectorsClass + ":not(.filtersSummarySelectorCC)").each(function () { var e = $(this).attr("data-filtervalue"), a = $(this).parents(".customFilterCC").attr("data-filtername"), r = !1, n = t.SpecificationFilters[a] || {}; $.each(n, function (t, a) { a.Name == e && (r = !0); }), "hide" == m.notAvailableCombinations ? r ? $(this).show() : $(this).hide() : "disable" == m.notAvailableCombinations && (r ? $(this) .removeClass(m.disableClass + " unavailableCombinationCC") .css("pointer-events", "auto") : $(this) .addClass(m.disableClass + " unavailableCombinationCC") .css("pointer-events", "none")); }), m.pagination.onlyBtnPage || x(); }); } function S(e) { $.each(e, function (e, t) { var a; t.isActive && ((a = r.slug(t.name).toUpperCase()), (u[a] = t.id)); }); } function w() { $('.paginationNumberCC[data-page="' + d + '"]').addClass(m.activeSelectorsClass), 1 == d ? $(".paginationPrevBtnCC").hide() : $(".paginationPrevBtnCC").show(), d == o ? $(".paginationNextBtnCC, .paginationPlusBtnCC").hide() : $(".paginationNextBtnCC, .paginationPlusBtnCC").show(); } function x() { function e() { return 1 == d ? 1 : 2 == d ? d - 1 : d - 2; } if (1 < o) { $(".pager .pageBtnsContainer").html(""); var t = $(m.pagination.wraper).html(m.pagination.previousBtnText).addClass("paginationPrevBtnCC paginationControlCC").css("display", "none")[0].outerHTML; 2 < e() && ((t += $(m.pagination.wraper).html("1").attr("data-page", "1").addClass("paginationNumberCC paginationControlCC")[0].outerHTML), (t += $(m.pagination.wraper).html("...").addClass("paginationSeparator")[0].outerHTML)); for (var a = e(); a <= (o == d ? d : d == o - 1 ? d + 1 : d + 2); a++) t += $(m.pagination.wraper).html(a).attr("data-page", a).addClass("paginationNumberCC paginationControlCC")[0].outerHTML; d < o - 2 && ((t += $(m.pagination.wraper).html("...").addClass("paginationSeparator")[0].outerHTML), (t += $(m.pagination.wraper).html(o).attr("data-page", o).addClass("paginationNumberCC paginationControlCC")[0].outerHTML)), (t += $(m.pagination.wraper).html(m.pagination.nextBtnText).addClass("paginationNextBtnCC paginationControlCC")[0].outerHTML), $(m.pagination.path).html(t), w(), $(m.pagination.path).show(); } else $(m.pagination.path).hide(); } function T(e) { $((e ? e + " " : "") + ".priceRangeSelectorCC").click(function (e) { e.stopPropagation(), e.preventDefault(); var t = $(this).data("pricerange"); $('.priceRangeSelectorCC[data-pricerange="' + t + '"]').toggleClass(m.activeSelectorsClass), p.length ? $.each(p, function (e, a) { a == t ? p.splice(e) : e == p.length - 1 && p.push(t); }) : p.push(t), m.addFiltersBtn || ((d = 1), R("filter")); }); } function O(e) { $((e ? e + " " : "") + ".brandSelectorCC").click(function (e) { e.stopPropagation(), e.preventDefault(); var t, a = $(this).data("brand"); $('.brandSelectorCC[data-brand="' + a + '"]').toggleClass(m.activeSelectorsClass), g.length && -1 !== (t = g.indexOf(a)) ? g.splice(t, 1) : g.push(a), m.addFiltersBtn || ((d = 1), R("filter")); }); } function B(e) { $((e ? e + " " : "") + "." + m.selectorsClass).click(function (e) { console.log("weiowqewq"), e.stopPropagation(), e.preventDefault(); var t, a = $(this).data("filterid"), r = $(this).data("filtervalue"); $("." + m.selectorsClass + '[data-filterid="' + a + '"][data-filtervalue="' + r + '"]').toggleClass(m.activeSelectorsClass), h[a] ? ($.grep(h[a], function (e, a) { if (e === r) return (t = a), !0; }), isNaN(t) ? h[a].push(r) : h[a].splice(t, 1)) : (h[a] = [r]), console.log("selectedFiltesrData", h), m.addFiltersBtn || ((d = 1), R("filter")); }); } function R(e) { function t() { var e = ""; return ( m.addFiltersBtn && (e += ", " + m.cleanFiltersBtn), m.cleanFiltersBtn && (e += ", " + m.cleanFiltersBtn), m.orderControls && m.orderControls.path && (e += ", " + m.orderControls.path), m.filtersSummary && m.filtersSummary.path && (e += ", " + m.filtersSummary.path), m.pagination.path && (e += ", " + m.pagination.path), $("." + m.selectorsClass + ":not(.unavailableCombinationCC)" + e) ); } switch (e) { case "filter": b(); case "loadPage": n("search", "start"); break; case "nextPage": n("scroll", "start"); break; case "error": $(document).trigger("categoryControllers:search_Error"); case "done": "Searching" == $(m.shelf.path).attr("data-status") ? n("search", "done") : n("scroll", "done"), m.filtersSummary && ($(m.filtersSummary.path).html(""), $(".customFilterCC").each(function () { var e, t = $(this).find("." + m.selectorsClass + "." + m.activeSelectorsClass), a = ""; t.length && (t.each(function (e, t) { var r; m.filtersSummary.wraper ? ((r = $(m.filtersSummary.wraper.replace(/\{{value}}/g, $(this).data("filtervalue")))), m.addFiltersBtn || r .attr("data-filterid", $(this).data("filterid")) .attr("data-filtervalue", $(this).data("filtervalue")) .addClass(m.selectorsClass + " " + m.activeSelectorsClass + " filtersSummarySelectorCC"), (a += r[0].outerHTML)) : (a += (0 == e ? "" : ", ") + $(this).data("filtervalue")); }), (e = m.filtersSummary.structure.replace(/\{{title}}/g, $(this).data("filtername")).replace(/\{{content}}/g, a)), $(m.filtersSummary.path).append(e), $(document).trigger("categoryControllers:filterSummary_render")); }), $(".priceRangesContainerCC").each(function () { var e, t = $(this).find(".priceRangeSelectorCC." + m.activeSelectorsClass), a = ""; t.length && (t.each(function (e, t) { var r; m.filtersSummary.wraper ? ((r = $(m.filtersSummary.wraper.replace(/\{{value}}/g, $(this).text()))), m.addFiltersBtn || r.attr("data-pricerange", $(this).data("pricerange")).addClass("priceRangeSelectorCC " + m.activeSelectorsClass), (a += r[0].outerHTML)) : (a += (0 == e ? "" : ", ") + $(this).text()); }), (e = m.filtersSummary.structure.replace(/\{{title}}/g, "Rango de precios").replace(/\{{content}}/g, a)), $(m.filtersSummary.path).append(e)); }), $(".brandContainerCC").each(function () { var e, t = $(this).find(".brandSelectorCC." + m.activeSelectorsClass), a = ""; t.length && (t.each(function (e, t) { var r; m.filtersSummary.wraper ? ((r = $(m.filtersSummary.wraper.replace(/\{{value}}/g, $(this).text()))), m.addFiltersBtn || r.attr("data-brand", $(this).data("brand")).addClass("brandSelectorCC " + m.activeSelectorsClass), (a += r[0].outerHTML)) : (a += (0 == e ? "" : ", ") + $(this).text()); }), (e = m.filtersSummary.structure.replace(/\{{title}}/g, "Marcas").replace(/\{{content}}/g, a)), $(m.filtersSummary.path).append(e)); }), !m.addFiltersBtn && m.filtersSummary.wraper && (B(m.filtersSummary.path), T(m.filtersSummary.path), O(m.filtersSummary.path))), $(document).trigger("categoryControllers:search_Done", [d, h, p, g, f]); } function n(e, n) { function s() { "start" == n ? (t().addClass(m.disableClass).css("pointer-events", "none"), (function () { function e() { var e = ""; return ( g.length && $.each(g, function (t, a) { var n = r.slug(a).toUpperCase(), i = u[n]; i ? (e += "&fq=B:" + encodeURIComponent(i)) : console.warn("CATEGORY CONTROLLERS: No se ha encontrado el ID de marca " + a); }), e ); } var t; switch ( ((function (e, t, a, r, n) { var i = N(); (i.pageNumber = e), (i.selectedFiltersData = t), (i.selectedBrand = a), (i.selectedPriceRanges = r), (i.selectedOrderOption = n), (sessionStorage.categoryFilters = JSON.stringify(i)); })(d, h, g, p, f), $(document).trigger("categoryControllers:search_Started", [d, h, g, p, f]), i) ) { case "Landing": t = "fq=H:" + a; break; case "Search": t = "ft=" + encodeURIComponent(vtxctx.searchTerm); break; case "Brand": t = e(); break; case "Brand in Category": t = "fq=C:" + c.replace("/", "") + e(); break; case "Search in Category": t = "fq=C:" + c.replace("/", "") + "&ft=" + encodeURIComponent(vtxctx.searchTerm); break; case "Cluster in Category": t = "fq=C:" + c.replace("/", "") + "&fq=H:" + a; break; case "Category": t = "fq=C:" + c.replace("/", ""); } var n = window.location.origin + "/buscapagina?" + t + C + "&PS=" + m.shelf.itemsNumber + "&sl=" + m.shelf.templateId + "&cc=" + m.shelf.itemsNumber + "&PageNumber=" + d + "&sm=0" + (function () { var e = ""; return ( $.isEmptyObject(h) || $.each(h, function (t, a) { $.each(a, function (a, r) { e += "&fq=specificationFilter_" + t + ":" + encodeURIComponent(r); }); }), e ); })() + e() + (function () { var e = ""; return ( p.length && $.each(p, function (t, a) { var r = "[" + a.replace("de-", "").replace("-a-", "+TO+") + "]"; e += "&fq=P:" + r; }), e ); })() + (f ? "&O=" + f : ""); $.ajax({ url: n }) .then(function (e) { e ? (function (e) { var t = $(e).find("li[layout]:not(.helperComplement)"); m.shelf.productWrapper ? t.each(function () { $(m.shelf.path).append($(m.shelf.productWrapper).append($(this).html())); }) : t.each(function () { $(m.shelf.path).append($(this).html()); }), R("done"); })(e) : ((o = d), R("done"), $(document).trigger("categoryControllers:all_Products_Loaded")); }) .fail(function (e) { if (e.status === 500) { handleError500(); } R("error"); }); var s = window.location.origin + "/buscapagina?" + t + "&PS=1&sl=" + m.shelf.templateId + "&cc=1&PageNumber=0&sm=0"; $.ajax({ url: s + "&O=OrderByPriceDESC" }) .then(function (e) { var t; e ? ((t = e.split('data-bestPrice="')[1].split('"')[0]), sessionStorage.setItem("maxPrice", t)) : console.log("no se encontraron productos"); }) .fail(function(e) { if (e.status === 500) { handleError500(); } }); $.ajax({ url: s + "&O=OrderByPriceASC" }) .then(function (e) { var t; e ? ((t = e.split('data-bestPrice="')[1].split('"')[0]), sessionStorage.setItem("minPrice", t)) : console.log("no se encontraron productos"); }) .fail(function(e) { if (e.status === 500) { handleError500(); } }); })()) : ($(m.shelf.path).attr("data-status", ""), t().removeClass(m.disableClass).css("pointer-events", "auto")); } "scroll" == e ? ($(m.shelf.path).attr("data-status", "Waiting"), s()) : $(m.shelf.path).fadeIn(function () { $(m.shelf.path).attr("data-status", "Searching"), "start" == n && $(m.shelf.path).html(""), s(); }); } } function N() { var e = !0, t = sessionStorage.getItem("categoryFilters"); if (t) try { t = JSON.parse(t); } catch (a) { e = !(t = {}); } else e = !(t = {}); return ( t.categoryPathName || (t.categoryPathName = window.location.pathname), t.categoryPathName !== window.location.pathname && (((t = {}).categoryPathName = window.location.pathname), sessionStorage.removeItem("categoryFilters"), (e = !1)), (t.filtersLoaded = e), t ); } return (function () { var t; $.extend(!0, m, e), m.responsive && ((t = !1), $.each(m.responsive, function (e, a) { parseInt(e) >= $(window).width() && !t && ($.extend(!0, m, a), (t = !0)); })), $("body") .attr("class") .split(" ") .forEach(function (e) { -1 < e.indexOf("H_") && (a = e.replace("H_", "")), -1 < e.indexOf("O_") && (n = e.replace("O_", "")); }), $(document).on("RangeSliderBar", function (e, t, a) { (d = 1), (p = ["de-".concat(t, "-a-").concat(a)]), R("filter"); }); var o, c, u = $(".wrapbuttons").attr("default-categoty"); sessionStorage.getItem("FilterBanner") ? ("undefined" != (o = JSON.parse(sessionStorage.getItem("FilterBanner"))).category ? ((C = "&fq=C:" + o.category), $('.seemore[data-categoty="' + o.category + '"]').addClass("active")) : $(".wrapbuttons :first-child a").addClass("active"), "undefined" != o.collection && ((a = o.collection), $('.filterCollection li[data-collection="' + o.collection + '"]').addClass("active")), sessionStorage.removeItem("FilterBanner")) : u && ($(".wrapbuttons :first-child a").addClass("active"), (C = "&fq=C:" + u)), $(document).on("filterCategory", function (e, t) { (C = "&fq=C:" + t), (d = 1), R("filter"); }), $(document).on("filterCollection", function (e, t) { (a = t), (d = 1), R("filter"); }), vtxctx.searchTerm ? (i = a ? "Landing" : vtxctx.searchTerm.toLowerCase() == decodeURI(s) ? "Search" : "Search in Category") : /^\d+$/.test(l[l.length - 1]) ? ((i = "Cluster in Category"), (a = l[l.length - 1])) : (i = vtxctx.categoryName && l.length && r.slug(l[l.length - 1]) == r.slug(vtxctx.categoryName) ? "Category" : 1 == l.length ? "Brand" : "Brand in Category"), console.info("searchContext", i), $(document).trigger("categoryControllers:searchContext", i), ("Brand" != i && "Brand in Category" != i) || ((c = l[l.length - 1].replace(/\-/g, " ").toUpperCase()), g.push(c)), ("Search in Category" != i && "Cluster in Category" != i && "Brand in Category" != i) || ((s = s.replace(/\/(?:.(?!\/))+$/, "")), l.splice(l.length - 1, 1)), b("First Load"); })(); }; }, 847: function (e) { var t = { slug: function (e) { e = (e = e.replace(/^\s+|\s+$/g, "")).toLowerCase(); for (var t = "ãàáäâẽèéëêìíïîõòóöôùúüûñç·/_,:;", a = 0, r = t.length; a < r; a++) e = e.replace(new RegExp(t.charAt(a), "g"), "aaaaaeeeeeiiiiooooouuuunc------".charAt(a)); return e .replace(/[^a-z0-9 -]/g, "") .replace(/\s+/g, "-") .replace(/-+/g, "-"); }, share: function (e, t) { var a, r = { url: encodeURIComponent(window.location), title: encodeURIComponent(document.title), description: (function (e) { for (var t = document.getElementsByTagName("meta"), a = 0; a < t.length; a++) if ("description" == t[a].getAttribute("name")) return t[a].getAttribute("content"); return ""; })(), }, n = { facebook: { url: "https://www.facebook.com/sharer/sharer.php?u={url}&t={title}" }, twitter: { url: "https://twitter.com/home?status={title} - {url}" }, google: { url: "https://plus.google.com/share?url={url}" }, linkedin: { url: "https://www.linkedin.com/shareArticle?mini=true&url={url}&title={title}&summary={description}" }, pinterest: { url: "http://pinterest.com/pin/create/button/?url={url}&media={media}&description={description}" }, whatsapp: { url: "https://api.whatsapp.com/send?text={title} - {url}" }, }, i = ((height = 550), (window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width) / 2 - 275 + 10), o = (window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height) / 2 - height / 2 + 50; switch (e) { case "facebook": a = n.facebook.url.replace("{url}", r.url).replace("{title}", r.title); break; case "twitter": a = n.twitter.url.replace("{url}", r.url).replace("{title}", r.title); break; case "google": a = n.google.url.replace("{url}", r.url); break; case "linkedin": a = n.linkedin.url.replace("{url}", r.url).replace("{title}", r.title).replace("{description}", r.description); break; case "pinterest": a = n.pinterest.url.replace("{url}", r.url).replace("{media}", t).replace("{description}", r.description); break; case "whatsapp": a = n.whatsapp.url.replace("{url}", r.url).replace("{title}", r.title); } a && window.open(a, r.title, "scrollbars=yes, width=550, height=" + height + ", top=" + o + ", left=" + i); }, device: function () { var e = $(window).width(), t = $(window).height(), a = { type: "", orientation: "" }; return (a.type = 1024 < e ? "Desktop" : 667 < e ? "Tablet" : "Mobile"), (a.orientation = t < e ? "Landscape" : "Portrite"), a; }, pricesFormat: function (e, t, r) { var n = d(e), i = p(e), o = d(t), s = p(t), l = d(r), c = p(r); function d(e) { return Number(e.trim().replace(/\$|\,|\./g, "")); } function p(e) { return /(\$.+\,\d{2})$/.test(e) ? 100 : 1; } return { bestPriceTax: 0 < n ? "$" + a((n + l) / i, 0, ".", ",") : "", listPriceTax: 0 < o ? "$" + a(Math.round((l / n + 1) * o) / s, 0, ".", ",") : "", PriceTax: 0 < l ? "$" + a(l / c, 0, ".", ",") : "" }; }, currencyFormat: a, getSpecificSizeImage: function (e, t, a) { var r = e.substring(e.indexOf("ids/") + 4), n = r.substring(0, r.indexOf("/")), i = n.substring(0, n.indexOf("-")) + "-" + t + "-" + a; return e.replace(n, i); }, helperGetSpecificSizeImage: function (e, t, a) { var r = e.substring(e.indexOf("ids/") + 4), n = r.substring(0, r.indexOf("/")), i = n.substring(0, n.indexOf("-")) + "-" + t + "-" + a; return e.replace(n, i); }, }; function a(e, t, a, r) { var n = e, i = ((t = isNaN((t = Math.abs(t))) ? 2 : t), (r = null == r ? "." : r), (a = null == a ? "," : a), n < 0 ? "-" : ""), o = parseInt((n = Math.abs(+n || 0).toFixed(t))) + "", s = 3 < (s = o.length) ? s % 3 : 0; return ( i + (s ? o.substr(0, s) + a : "") + o.substr(s).replace(/(\d{3})(?=\d)/g, "$1" + a) + (t ? r + Math.abs(n - o) .toFixed(t) .slice(2) : "") ); } e.exports = t; }, }, t = {}; function a(r) { var n = t[r]; if (void 0 !== n) return n.exports; var i = (t[r] = { exports: {} }); return e[r](i, i.exports, a), i.exports; } (a.n = function (e) { var t = e && e.__esModule ? function () { return e.default; } : function () { return e; }; return a.d(t, { a: t }), t; }), (a.d = function (e, t) { for (var r in t) a.o(t, r) && !a.o(e, r) && Object.defineProperty(e, r, { enumerable: !0, get: t[r] }); }), (a.o = function (e, t) { return Object.prototype.hasOwnProperty.call(e, t); }), (function () { "use strict"; var e = a(137), t = a.n(e), r = a(847); $(document).ready(function () { var e, a, n, i; function o(e, t, a) { var r = e.find(t).hasClass("sqrmeters") || ((r = e.find("".concat(t)).text().replace("$", "")), (n = parseInt(r.replace(/\./g, "")).toFixed(0)), e.find("".concat(t)).text( "$ " .concat( (n + "00") .toString() .split("") .reverse() .splice(2) .join("") .replace(/(?=\d*\.?)(\d{3})/g, "$1.") .split("") .reverse() .join("") .replace(/^[\.]/, ""), " " ) .concat( (function (e) { switch (e) { case "Metro": return "m"; case "Metro Cuadrado": return "m2"; case "Unidad": return "ud"; case "Caja": return "Caja"; default: return ""; } })(a) ) ), e.find(t).addClass("sqrmeters")); } function s(e) { var t = e, a = $(t).attr("data-id") ? $(t).attr("data-id") : ""; "" !== a && fetch("/api/catalog_system/pub/products/search/?fq=productId:" + a) .then(function (e) { return e.json(); }) .then(function (e) { !(function (e, t) { var a = t[0]; 0 !== t.length && (o(e, ".new-price", a["Unidad de Venta"][0]), "" !== e.find(".original-price-discount").text() && "0" !== e.find(".original-price-discount").text() && o(e, ".original-price-discount", a["Unidad de Venta"][0])); })(t, e), (function (e, t) { t[0]["Mas vendido"] && "SI" === t[0]["Mas vendido"][0] && e.find(".mas-vendidos").css("display", "flex"), t[0].productClusters && t[0].productClusters[399] ? e.find(".promo-liquidacion").css("display", "flex") : e.find(".image-product").css("marginTop", "25px"); })(t, e); }); var r = t.find(".new-price").text().replace("$", "$ "); t.find(".new-price").text(r); } function l(e) { return `
  • {{name}} ({{quantity}})
  • `; } 0 !== $(".search-category").length && ((a = (e = $(".searchResultsTime")).next()), $(".before-load-categories").css({ display: "none" }), $(".search-category .searchResultsTime, .search-category .sub, .after-load-categories").css({ display: "block" }), $(e[1]).remove(), $(a[1]).remove(), (a = (e = $(".searchResultsTime")).next()), e.wrap("
    "), a.appendTo(e.parent()), $(".bt-refinar").wrap(""), 0 === $(".search-multiple-navigator").length && ($(".search-single-navigator").attr("style", "display: block !important"), (n = $(".search-single-navigator h3")[0]), $(n).append(""), $(".no-text").html("")), $(".search-multiple-navigator") .children() .each(function (e, t) { var a = $(t), r = a.find("h5"); "H4" === t.nodeName && ($(t).html("FILTROS"), $(t).after('
    ')), "FIELDSET" === t.nodeName && (0 == $(t).children("div").children().length && (t.style.display = "none"), $(t).appendTo(".content-filter-mobile"), r.each(function (e, t) { "Colores" == t.innerText && (a.find("label").each(function (e, t) { var a = t.innerText.split(" ")[0]; $(t).css({ display: "flex", alignItems: "center" }); var r = $(t) .contents() .filter(function () { return 1 === this.nodeType; }); (t.innerHTML = ""), $(t).append(r), $(t).append("
    " + getColor(a)[1]); }), a.css({ listStyle: "none" })); })), r.append(''), $(".footer-filter").appendTo(".search-multiple-navigator"); }), $(".categories-nav").after('
    '), $(".open-filter").click(function () { $(".overlay-categories-filter").css({ zIndex: 21 }), gsap.to(".overlay-categories-filter", { duration: 0.3, opacity: 1 }), gsap.to(".categories-nav", { duration: 0.3, x: "0%", right: "0px", opacity: 1 }), $(document.body).css({ overflow: "hidden" }); }), $(".close-filter").click(function () { gsap.to(".overlay-categories-filter", { duration: 0.3, opacity: 0 }), gsap.to(".categories-nav", { duration: 0.3, x: "100%", right: "-30px", opacity: 0 }), setTimeout(function () { $(".overlay-categories-filter").css({ zIndex: -1 }); }, 400), $(document.body).css({ overflow: "" }); }), window.innerWidth <= 770 && $(".categories-nav").appendTo(document.body)), 0 !== $(".departament-nav").length && ($(".departament-nav .menu-departamento") .children() .each(function (e, t) { var a; "H4" === t.nodeName && ((a = $(t).children()[0]), $(".departament-control-container select").append("")); }), $(".departament-control-container select").on("change", function (e) { document.location.href = e.target.value; })), $(document).on("filtersChange", function (e, t) { $("#apliedfilterlist ul li").remove(), t.forEach(function (e) { var t, a = $("
  • "), r = document.createElement("span"); r.classList.add("class", "closse"), r.setAttribute("data-filter", e.valueFilter), r.setAttribute("data-filter-type", e.filter), (r.innerText = "X"), r.addEventListener("click", function (e) { var t = e.target.getAttribute("data-filter"); setTimeout(function () { document.querySelector('label[data-filter="' + t + '"]').click(); }, 200); }), "Color" === e.filter ? (a.append(r), a.append('' + e.filter + ' ')) : "Rango de precio" === e.filter ? (a.append(r), (t = e.valueFilter.split("[")[1].split("]")[0].split("TO")), a.append("" + e.filter + " desde " + t[0] + " hasta " + t[1] + "")) : (a.append(r), a.append("" + e.filter + " " + e.valueFilter + "")), $("#apliedfilterlist ul").append(a); }); }), $(document).on("categoryControllers:filters_Rendered", function () { var e = setTimeout(function () { sessionStorage.getItem("maxPrice") && ((function () { var e = sessionStorage.getItem("maxPrice").split("$")[1].split(",")[0]; e = parseInt(e.replace(/\./g, "")); var t = sessionStorage.getItem("minPrice").split("$")[1].split(",")[0]; (t = parseInt(t.replace(/\./g, ""))), $(".priceRangesContainerCC").html( '\n

    Rango de precios

    \n
    \n
    \n
    \n
    \n\n
    \n' .concat(r.currencyFormat(t, 0, ".", ","), ' - ') .concat(r.currencyFormat(e, 0, ".", ","), "\n
    \n
    \n ") ), $("#slider-range").slider({ range: !0, min: t, max: e, step: 1e3, values: [t, e], slide: function (e, t) { $("#min-price").html(r.currencyFormat(t.values[0], 0, ".", ",")), $("#max-price").html(r.currencyFormat(t.values[1], 0, ".", ",")); }, change: function (e, t) { $(document).trigger("RangeSliderBar", [t.values[0], t.values[1]]); }, }); })(), clearInterval(e)); }, 1e3); }), $(document).on("categoryControllers:categoryInfoLoaded", function (e, t, a) { $(".filer-quantity").text(a + " productos"); }), $(document).on("categoryControllers:search_Done", function () { JSON.parse(localStorage.getItem("skus-best-seller")), console.log("search_Done"), $(".product-card:not(.rendered)").each(function () { var e, t, a, r = window.vtxctx, n = $(this); s(n), n.addClass("rendered"), $(".generic-discount").each(function (e, t) { $(t).hasClass("formatted") || ($(t).addClass("formatted"), (t.innerHTML = t.innerHTML.split(",")[0] + "%")); }), !localStorage.getItem("cyber") || (0 < (e = $(".discount-percent , .discount-offer")).length && e.addClass("cyber")), (a = "") == (t = r).searchTerm ? ("" == t.categoryName ? "" != t.departmentName && (a = t.departmentName) : (a = t.categoryName)) : (a = t.searchTerm), $(".filter-title h1").html(a); }); }), (function () { var e = ".filters-options-container"; $("body") .attr("class") .split(" ") .forEach(function (e) { -1 < e.indexOf("H_") && (i = e.replace("H_", "")); }); var a = { structure: '

    {{title}}

    ', selector: l("Longitud Rollo"), path: e }, r = { structure: '

    Rango de precios

    {{selectors}}
    ', selector: l(""), path: e }; t()({ searchCluster: i, categoryTitle: ".catName", selectorsClass: "customFilterSelectorCC", activeSelectorsClass: "active", disableClass: "disabled", notAvailableCombinations: !1, shelf: { productWrapper: "
  • ", itemsNumber: 12, templateId: "c5e500ef-3ad4-4509-b66b-191f5b7881a9", path: ".prateleira ul" }, orderControls: { path: ".orderBy select", structure: "", activeClass: "active", defaultOrder: "OrderByReleaseDateDESC", list: { OrderByPriceASC: !0, OrderByPriceDESC: !0, OrderByBestDiscountDESC: !0, OrderByTopSaleDESC: !0, OrderByReviewRateDESC: !0, OrderByNameASC: !0, OrderByNameDESC: !0, OrderByReleaseDateDESC: !0 }, }, filters: { Marca: { structure: `

    {{title}}

    `, selector: l("filter-group"), path: e }, "Longitud Rollo": { structure: `

    {{title}}

    `, selector: l("filter-group"), path: e }, "Calibre/Espesor": { structure: `

    {{title}}

    `, selector: l("filter-group"), path: e }, Apariencia: { structure: `

    {{title}}

    `, selector: l("filter-group"), path: e }, "Capa de Uso": { structure: `

    {{title}}

    `, selector: l("filter-group"), path: e }, "Para Uso Exterior?": { structure: `

    {{title}}

    `, selector: l("filter-group"), path: e }, Peso: { structure: `

    {{title}}

    `, selector: l("filter-group"), path: e }, Trafico: { structure: `

    {{title}}

    `, selector: l("filter-group"), path: e }, Densidad: { structure: `

    {{title}}

    `, selector: l("filter-group"), path: e }, Dimensiones: { structure: `

    {{title}}

    `, selector: l("filter-group"), path: e } }, specialFilters: { priceRanges: r }, filtersSummary: { structure: '
    {{content}}
    ', wraper: '
    {{value}}
    ', path: ".filters-selected", }, cleanFiltersBtn: !0, }); })(); }); })(); })(); $(document).ready(function() { $('.filter-options-list').hide(); $('.icon-nav').removeClass('rotated'); $('.filter-option-container').removeClass('active'); $(document).on('click', '.filter-option-title', function() { const $container = $(this).closest('.filter-option-container'); const $list = $container.find('.filter-options-list'); const $icon = $(this).find('.icon-nav'); $container.toggleClass('active'); $icon.toggleClass('rotated'); $list.slideToggle(300); $('.filter-option-container').not($container).removeClass('active') .find('.filter-options-list').slideUp(300) .end() .find('.icon-nav').removeClass('rotated'); }); }); $(document).ready(function() { function createFilterHeader() { // Remover header existente si hay uno $('.filters-header').remove(); // Crear el nuevo header const filterHeader = `
    Filtros
    `; // Insertar el header al principio del contenedor de filtros $('.filters-selected').prepend(filterHeader); } function updateFiltersContainerVisibility() { const $container = $('.filters-selected-container'); const hasActiveFilters = $('.filter-selected').length > 0; if (hasActiveFilters) { createFilterHeader(); $container.show().css('display', 'flex'); $('.filters-header').show(); } else { $container.hide(); $('.filters-header').hide(); } } // Observar cambios en los filtros $(document).on('categoryControllers:filters_Rendered', function() { updateFiltersContainerVisibility(); }); $(document).on('categoryControllers:search_Done', function() { updateFiltersContainerVisibility(); }); // Evento para el botón de eliminar filtros $(document).on('click', '.delete-all-filters', function() { $('.filter-selected .ca-icon-close-gray').each(function() { $(this).trigger('click'); }); }); // Inicializar updateFiltersContainerVisibility(); }); var hasScrolledFor500 = false; function handleError500() { if (!hasScrolledFor500) { $('html, body').animate({ scrollTop: $(window).scrollTop() + 5 }, 500); hasScrolledFor500 = true; setTimeout(function() { hasScrolledFor500 = false; }, 2000); } }