1import{getMarket}from"./utils-markets.js";function getStorageKey(){return`viewed_products_${getMarket().replace(/^\/|\/$/g,"")||"default"}`}function getViewedProducts(){const storageKey=getStorageKey(),handles=JSON.parse(localStorage.getItem(storageKey)||"[]");if(handles.length>12){const trimmedHandles=handles.slice(0,12);return localStorage.setItem(storageKey,JSON.stringify(trimmedHandles)),trimmedHandles}return handles}function addToViewedProducts(handle){try{const storageKey=getStorageKey(),filteredProducts=JSON.parse(localStorage.getItem(storageKey)||"[]").filter(product=>product!==handle);filteredProducts.unshift(handle);const limitedProducts=filteredProducts.slice(0,10);return localStorage.setItem(storageKey,JSON.stringify(limitedProducts)),limitedProducts}catch(error){return console.warn("Failed to save product to recently viewed:",error),[]}}export{addToViewedProducts,getStorageKey,getViewedProducts}; 2//# sourceMappingURL=/cdn/shop/t/1232/assets/utils-recently-viewed-products.js.map
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.