1let wishlistItems=[],token=localStorage.getItem("customer_token");async function initWishlist(){localStorage.getItem("lptWishlist")&&(wishlistItems=JSON.parse(localStorage.getItem("lptWishlist"))),await renderWishlistItems(),document.addEventListener("click",t=>{if(t.target.classList.contains("add-to-wishlist")){let e=t.target.getAttribute("data-codename"),i=t.target.getAttribute("data-type");if(t.target.classList.remove("add-to-wishlist"),t.target.classList.add("remove-from-wishlist"),wishlistItems.find(t=>t.codename===e))return;let s={codename:e,subCategory:i};wishlistItems.push(s),wishlistAPI.url&&wishlistAPI.add([s]),localStorage.setItem("lptWishlist",JSON.stringify(wishlistItems));return}if(t.target.classList.contains("remove-from-wishlist")){let e=t.target.getAttribute("data-codename");t.target.classList.remove("remove-from-wishlist"),t.target.classList.add("add-to-wishlist"),wishlistItems=wishlistItems.filter(t=>t.codename!==e),wishlistAPI.url&&wishlistAPI.remove(e),localStorage.setItem("lptWishlist",JSON.stringify(wishlistItems));return}})}function renderNotAddedItems(){document.querySelectorAll(".product-card-wishlist.add-to-wishlist:not(.is-initilized)").forEach(t=>{let e=t.getAttribute("data-codename");wishlistItems.find(t=>t.codename===e)&&(t.classList.remove("add-to-wishlist"),t.classList.add("remove-from-wishlist")),t.classList.add("is-initilized")})}async function renderWishlistItems(){let t=document.getElementById("wishlist-items-container");if(t){let e=await fetch(`/?view=wishlist&type=${Date.now()}&products=${Array.from(wishlistItems,({codename:t})=>t).join(";")}`,{method:"GET",headers:{"Content-Type":"text/html"}});t.innerHTML=await e.text()}renderNotAddedItems()}token?customerApi.userGetInfo(token).then(t=>{wishlistAPI.init(token,t._id),initWishlist()}).catch(t=>{console.error("Init wishlist error:",t),localStorage.removeItem("customer_token"),localStorage.removeItem("lptWishlist"),initWishlist()}):initWishlist();
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.