PageSourceSearch

https://lmk.today/_next/static/chunks/7204-29e58b8e21f91812.js?dpl=dpl_5Dm4hPFR4YLQe5uHK7Gef5SzQbhA

js lmk.today collected 2026-09-24 12:07:40 UTC 57,246 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7204],{5891:(e,t,r)=>{r.d(t,{Ef:()=>o,GZ:()=>n,Gj:()=>i,jE:()=>l,qP:()=>s});let a={birthday:"birthday",wedding:"wedding_love",engagement:"wedding_love",bridal_shower:"wedding_love",anniversary:"wedding_love",baby_shower:"baby_shower",christmas:"christmas",hanukkah:"hanukkah",graduation:"graduation",housewarming:"housewarming",mothers_day:"mothers_day",fathers_day:"fathers_day",valentines_day:"valentines_day",halloween:"halloween",other_holiday:"all",other_event:"back_to_school"};function s(e){return e?"/products?wishlist=".concat(encodeURIComponent(e)):"/products"}function n(e){let t=e?a[e]:void 0;return t&&"all"!==t?"/wishlists/browse?event_type=".concat(encodeURIComponent(t)):"/wishlists/browse"}function i(e){let t=e.toLowerCase();return/\bbirthday\b/.test(t)?"birthday":/\b(wedding|bridal|engagement|anniversary)\b/.test(t)?"wedding_love":/\bbaby\s*shower\b/.test(t)||/\bbaby\b/.test(t)&&/\bgift/.test(t)?"baby_shower":/\bchristmas\b|\bholiday\b/.test(t)?"christmas":/\bhanukkah\b/.test(t)?"hanukkah":/\bgraduation\b/.test(t)?"graduation":/\bhousewarming\b/.test(t)?"housewarming":/\bmother'?s?\s*day\b/.test(t)?"mothers_day":/\bfather'?s?\s*day\b/.test(t)?"fathers_day":/\bvalentine/.test(t)?"valentines_day":/\bhalloween\b/.test(t)?"halloween":null}function l(e){let t=e.toLowerCase();return/\bgift(s)?\b|\bpresent(s)?\b/.test(t)||/\b(birthday|anniversary|christmas|valentine|graduation|wedding|housewarming|bridal|baby shower|hanukkah|halloween)\b/.test(t)}let o="/bot-shopper"},7204:(e,t,r)=>{r.d(t,{ProductsContent:()=>J});var a=r(95155),s=r(76766),n=r(94251),i=r(12115),l=r(47650),o=r(35695),c=r(52643),d=r(62395),u=r(52030);let m=[{labelKey:"sort.relevance",value:"relevance"},{labelKey:"sort.newest",value:"newest"},{labelKey:"sort.priceLowHigh",value:"price_asc"},{labelKey:"sort.priceHighLow",value:"price_desc"},{labelKey:"sort.nameAZ",value:"alphabetical"},{labelKey:"sort.nameZA",value:"alphabetical_desc"},{labelKey:"sort.bestDiscount",value:"sale_discount_desc"},{labelKey:"sort.byMerchant",value:"merchant"}];function h(e){let{value:t="relevance",onChange:r,locale:s="en"}=e,n=e=>(0,u.sC)(s,e);return(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("span",{className:"text-sm text-muted-foreground",children:[n("search.sortBy"),":"]}),(0,a.jsx)("select",{className:"rounded-md border-input bg-background px-3 py-1 text-sm",value:t,onChange:e=>r(e.target.value),children:m.map(e=>(0,a.jsx)("option",{value:e.value,children:n(e.labelKey)},e.value))})]})}function p(e){let{minPrice:t,maxPrice:r,onPriceChange:s}=e,[n,l]=(0,i.useState)(t),[o,c]=(0,i.useState)(r);return(0,i.useEffect)(()=>
1{l(t),c(r)},[t,r]),(0,a.jsxs)("form",{onSubmit:e=>{e.preventDefault(),s(n?parseFloat(n):void 0,o?parseFloat(o):void 0)},className:"space-y-4",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Price Range"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:"min-price",className:"block text-sm text-gray-600 mb-1",children:"Min ($)"}),(0,a.jsx)("input",{type:"number",id:"min-price",value:n,onChange:e=>l(e.target.value),placeholder:"0",min:"0",step:"0.01",className:"w-full p-2 border rounded-md"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:"max-price",className:"block text-sm text-gray-600 mb-1",children:"Max ($)"}),(0,a.jsx)("input",{type:"number",id:"max-price",value:o,onChange:e=>c(e.target.value),placeholder:"1000",min:"0",step:"0.01",className:"w-full p-2 border rounded-md"})]})]}),(0,a.jsx)("button",{type:"submit",className:"w-full bg-brand text-white py-2 rounded-md hover:bg-brand-hover transition-colors",children:"Apply"})]})}var g=r(25192),x=r(38225),f=r(68098),b=r(18046),y=r(9572),w=r(25318),v=r(75074),j=r(50172),_=r(50392),N=r(84050),k=r(21868),C=r(6874),S=r.n(C),A=r(30285),E=r(84354),P=r(46102),I=r(95705),L=r(59434),R=r(10518);function F(e){var t;let{options:r,values:s,onChange:n,placeholder:l="Select...",className:o="",label:c,maxSelections:d,popularOptions:u=[]}=e,[m,h]=(0,i.useState)(!1),[p,g]=(0,i.useState)(""),x=(0,i.useRef)(null);(0,i.useEffect)(()=>{function e(e){x.current&&!x.current.contains(e.target)&&h(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let f=r.filter(e=>e.label.toLowerCase().includes(p.toLowerCase())),b=u.filter(e=>e.label.toLowerCase().includes(p.toLowerCase())),y=f.filter(e=>!u.some(t=>t.value===e.value)),j=r.filter(e=>s.includes(e.value)),_=e=>{s.includes(e)?n(s.filter(t=>t!==e)):(!d||s.length<d)&&n([...s,e])};return(0,a.jsxs)("div",{className:"relative ".concat(o),ref:x,children:[c&&(0,a.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:c}),(0,a.jsx)("button",{type:"button",className:"w-full px-3 py-2 text-left bg-white border border-gray-200 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-brand focus:border-brand",onClick:()=>h(!m),children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:0===s.length?"text-gray-400":"text-gray-900",children:0===s.length?l:1===s.length?(null===(t=j[0])||void 0===t?void 0:t.label)||l:"".concat(s.length," selected")}),(0,a.jsx)("svg",{className:"w-5 h-5 text-gray-400 transition-transform ".concat(m?"rotate-180":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})}),s.length>0&&(0,a.jsxs)("div",{className:"mt-2 flex flex-wrap gap-1",children:[j.map(e=>(0,a.jsxs)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-primary/10 text-primary",children:[e.label,(0,a.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),_(e.value)},className:"ml-1 text-primary hover:text-primary/80",children:(0,a.jsx)(w.A,{className:"w-3 h-3"})})]},e.value)),s.length>1&&(0,a.jsx)("button",{type:"button",onClick:()=>{n([])},className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-red-100 text-red-800 hover:bg-red-200",children:"Clear all"})]}),m&&(0,a.jsxs)("div",{className:"absolute z-[9999] w-full mt-1 bg-white rounded-md shadow-lg border border-gray-200",children:[(0,a.jsx)("div",{className:"p-2",children:(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(v.A,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),(0,a.jsx)("input",{type:"search",className:"w-full pl-9 pr-3 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-brand focus:border-brand",placeholder:"Search merchants...",value:p,onChange:e=>g(e.target.value),onClick:e=>e.stopPropagation(),autoComplete:"off",autoCorrect:"off",spellCheck:!1,"data-1p-ignore":!0,"data-lpignore":"true",name:"merchant-filter-search",autoF
1ocus:!0})]})}),(0,a.jsx)("div",{className:"max-h-60 overflow-auto py-1",children:0===b.length&&0===y.length?(0,a.jsx)("div",{className:"px-3 py-2 text-gray-500 text-sm",children:"No merchants found"}):(0,a.jsxs)(a.Fragment,{children:[b.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"px-3 py-1 text-xs font-semibold text-gray-500 uppercase tracking-wide border-b border-gray-100 mb-1",children:"Popular Merchants"}),b.map(e=>{let t=s.includes(e.value),r=!t&&d&&s.length>=d;return(0,a.jsxs)("button",{type:"button",className:"w-full text-left px-3 py-2 hover:bg-gray-100 flex items-center justify-between ".concat(t?"bg-primary/10":""," ").concat(r?"opacity-50 cursor-not-allowed":""),onClick:t=>{t.stopPropagation(),r||_(e.value)},disabled:r||!1,children:[(0,a.jsx)("span",{className:t?"font-medium text-primary":"font-medium",children:e.label}),t&&(0,a.jsx)(R.A,{className:"w-4 h-4 text-primary"})]},"popular-".concat(e.value))}),y.length>0&&(0,a.jsx)("div",{className:"border-b border-gray-100 my-1"})]}),y.length>0&&(0,a.jsxs)(a.Fragment,{children:[b.length>0&&(0,a.jsx)("div",{className:"px-3 py-1 text-xs font-semibold text-gray-500 uppercase tracking-wide mb-1",children:"All Merchants"}),y.map(e=>{let t=s.includes(e.value),r=!t&&d&&s.length>=d;return(0,a.jsxs)("button",{type:"button",className:"w-full text-left px-3 py-2 hover:bg-gray-100 flex items-center justify-between ".concat(t?"bg-primary/10":""," ").concat(r?"opacity-50 cursor-not-allowed":""),onClick:t=>{t.stopPropagation(),r||_(e.value)},disabled:r||!1,children:[(0,a.jsx)("span",{className:t?"font-medium text-primary":"",children:e.label}),t&&(0,a.jsx)(R.A,{className:"w-4 h-4 text-primary"})]},e.value)})]})]})})]})]})}var q=r(94088),T=r(10283),D=r(30440),O=r(60502),U=r(66766),M=r(17003);let z=["Searching across 500+ stores…","Finding the best prices…","Checking Amazon, Target, Walmart…","Comparing deals for you…","Scanning for discounts…","Almost there…"],W=[{name:"Amazon",domain:"amazon.com"},{name:"Target",domain:"target.com"},{name:"Walmart",domain:"walmart.com"},{name:"Best Buy",domain:"bestbuy.com"},{name:"Nike",domain:"nike.com"},{name:"Nordstrom",domain:"nordstrom.com"},{name:"Apple",domain:"apple.com"},{name:"Adidas",domain:"adidas.com"},{name:"Home Depot",domain:"homedepot.com"},{name:"Macy's",domain:"macys.com"},{name:"Sephora",domain:"sephora.com"},{name:"Costco",domain:"costco.com"}];function B(e){let{query:t,className:r,merchantNames:s}=e,n=!!s&&s.length>0,l=n?function(e){let t=1===e.length?e[0]:"".concat(e.length," stores");return["Searching ".concat(t,"…"),"Finding the best prices at ".concat(t,"…"),"Scanning for discounts…","Almost there…"]}(s):z,[o,c]=(0,i.useState)(0),[d,u]=(0,i.useState)(0),m=(0,i.useRef)(null);return(0,i.useEffect)(()=>{c(0);let e=setInterval(()=>{c(e=>(e+1)%l.length)},2500);return()=>clearInterval(e)},[l.length]),(0,i.useEffect)(()=>{if(!n)return u(0),m.current=setInterval(()=>{u(e=>e>=W.length?(m.current&&clearInterval(m.current),e):e+1)},300),()=>{m.current&&clearInterval(m.current)}},[n]),(0,a.jsxs)("div",{className:(0,L.cn)("flex flex-col items-center py-12 px-4",r),children:[(0,a.jsx)("div",{className:"w-full max-w-md mb-6",children:(0,a.jsx)("div",{className:"h-1 rounded-full bg-gray-100 overflow-hidden",children:(0,a.jsx)("div",{className:"h-full bg-gradient-to-r from-brand via-brand-hover to-brand rounded-full animate-progress-bar"})})}),t&&(0,a.jsxs)("p",{className:"text-lg font-medium text-gray-800 mb-1 text-center",children:["Searching for “",t,"”"]}),(0,a.jsx)("p",{className:"text-sm text-gray-500 mb-8 text-center animate-fade-in",children:l[o]},o),(0,a.jsx)("div",{className:"flex flex-wrap justify-center gap-2 max-w-lg",children:n?s.map(e=>(0,a.jsxs)("div",{className:"flex items-center gap-1.5 px-2.5 py-1 bg-white rounded-full border border-gray-100 shadow-sm animate-fade-in-up",children:[(0,a.jsx)(M.A,{className:"w-3.5 h-3.5 text-brand"}),(0,a.jsx)("span",{className:"text-[11px] font-medium text-gray-600",children:e})]},e)):W.slice(0,d).map((e,t)=>{var r;return(0,a.jsxs)("div",{className:"flex items-center gap-1.5 px-2.5 py-1 bg-white rounded-full border border-gray-100 shadow-sm animate-fade-in-up",style:{animationDelay:"".concat(50*t,"ms")},children:[(0,a.jsx)(U.default,{src:(r=e.domain,"https://www.google.com/s2/favicons?domain=".concat(r,"&sz=32")),alt:e.name,width:16,height:16,className:"rounded-sm",unoptimized:!0}),(0,a.jsx)("span",{className:"text-[11px] font-medium text-gray-600",children:e.name})]},e.name)})})]})}var $=r(33055),K=r(46204),G=r(38746);function Z(e){let{query:t}=e,{user:r,isLoading:s}=(0,k.A)(),[n,l]=(0,i.useState)(!1),[o,c]=(0,i.useState)("chrome"),d=(0,i.useRef)(!1);return((0,i.useEffect)(()=>{c(function(){let e=navigator.userAgent;return e.includes("Edg/")||e.includes("Edge/")?"edge":e.includes("Chrome/")&&!e.includes("Chromium/")?"chrome":"other"}())},[]),(0,i.useEffect)(()=>
1{if(s||!r||!(window.innerWidth>=768)||!(0,G.zC)()||(0,K.hL)()){l(!1);return}let e=!1;return async function(){try{let r=await (0,G._6)();if(e||r){l(!1);return}l(!0),(0,K.w5)(),d.current||(d.current=!0,(0,$.Fg)("extension_search_no_results_prompt_shown",{query:t}))}catch(e){l(!1)}}(),()=>{e=!0}},[s,r,t]),n)?(0,a.jsx)("div",{className:"mt-6 mx-auto max-w-lg rounded-xl border border-brand/25 bg-white p-5 text-left shadow-sm",children:(0,a.jsxs)("div",{className:"flex items-start gap-4",children:[(0,a.jsx)(U.default,{src:"/images/logos/LMK.only.png",alt:"LMK.today",width:40,height:40,className:"rounded-lg flex-shrink-0 mt-0.5"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-gray-900",children:"Couldn't find it?"}),(0,a.jsx)("p",{className:"mt-1 text-sm text-gray-600 leading-relaxed",children:"Remember — you can add products directly from any store with our free browser extension."}),(0,a.jsx)("a",{href:(0,G.Un)(),target:"_blank",rel:"noopener noreferrer",onClick:()=>{(0,$.Fg)("extension_search_no_results_prompt_closed",{action:"install",query:t})},className:"mt-4 inline-flex items-center justify-center rounded-full bg-brand hover:bg-brand-hover text-white text-sm font-semibold py-2.5 px-5 transition-colors",children:"edge"===o?"Add to Edge — It's Free":"Add to Chrome — It's Free"})]})]})}):null}var H=r(74601),V=r(5891);function Y(e){let{query:t,intent:r,resultCount:s}=e,n="gift"===r||(0,V.jE)(t),l=(0,i.useRef)(!1),o=n&&s<8,c=(0,V.Gj)(t),d=c?"/wishlists/browse?event_type=".concat(encodeURIComponent(c)):(0,V.GZ)(null);if((0,i.useEffect)(()=>{o&&!l.current&&(l.current=!0,(0,$.Fg)("search_inspiration_cta_shown",{query:t,intent:r||null,result_count:s,href:d}))},[o,t,r,s,d]),!o)return null;let u=c?c.replace(/_/g," "):null;return(0,a.jsx)("div",{className:"mt-6 mx-auto max-w-lg rounded-xl border border-amber-200 bg-gradient-to-br from-amber-50 to-white p-5 text-left shadow-sm",children:(0,a.jsxs)("div",{className:"flex items-start gap-4",children:[(0,a.jsx)("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-amber-100 text-amber-600",children:(0,a.jsx)(H.A,{className:"h-5 w-5","aria-hidden":!0})}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-gray-900",children:0===s?"Looking for gift ideas?":"Want more inspiration?"}),(0,a.jsxs)("p",{className:"mt-1 text-sm text-gray-600 leading-relaxed",children:["Browse real ",u?"".concat(u," "):"","wishlists from the community — people have already curated great picks."]}),(0,a.jsx)(S(),{href:d,onClick:()=>{(0,$.Fg)("search_inspiration_cta_clicked",{query:t,intent:r||null,result_count:s,href:d})},className:"mt-4 inline-flex items-center justify-center rounded-full bg-brand hover:bg-brand-hover text-white text-sm font-semibold py-2.5 px-5 transition-colors",children:"Browse inspiration lists"})]})]})})}function Q(e){let{value:t,duration:r=400}=e,[s,n]=(0,i.useState)(t),l=(0,i.useRef)(t);return(0,i.useEffect)(()=>{let e,a=l.current;if(l.current=t,a===t)return;let s=performance.now(),i=l=>{let o=Math.min((l-s)/r,1);n(Math.round(a+(t-a)*(1-Math.pow(1-o,3)))),o<1&&(e=requestAnimationFrame(i))};return e=requestAnimationFrame(i),()=>cancelAnimationFrame(e)},[t,r]),(0,a.jsx)(a.Fragment,{children:s})}function J(e){var t,r;let{categories:m,brands:C,initialProducts:R=[],initialCount:U=R.length,initialSearchParams:M,locale:z="en"}=e,W=(0,o.useSearchParams)(),$=(0,o.useRouter)(),{user:G}=(0,k.A)(),{observeRef:H}=(0,O.z)("products"),V=e=>(0,u.sC)(z,e),[J,X]=(0,i.useState)(R),[ee,et]=(0,i.useState)(U),[er,ea]=(0,i.useState)(null),[es,en]=(0,i.useState)(!1),[ei,el]=(0,i.useState)(null),[eo,ec]=(0,i.useState)(!1),ed=(0,i.useRef)(!1);(0,i.useEffect)(()=>{ed.current||(ed.current=!0,(0,D.c)(D.l.PAGE_VIEW_SEARCH,{initial_count:U,has_query:!!((null==M?void 0:M.q)||(null==M?void 0:M.query)||(null==M?void 0:M.search))}))},[]),(0,i.useEffect)(()=>{let e=e=>{ec(e.detail.isOpen)};return window.addEventListener("mobileMenuToggle",e),()=>{window.removeEventListener("mobileMenuToggle",e)}},[]);let eu=e=>{let t=new Set,r=(e.length,e.filter(e=>!t.has(e.id)&&(t.add(e.id),!0)));return r.length,r},[em,eh]=(0,i.useState)([]),[ep,eg]=(0,i.useState)(!1),[ex,ef]=(0,i.useState)([]),[eb,ey]=(0,i.useState)(!1),[ew,ev]=(0,i.useState)(!1),[ej,e_]=(0,i.useState)(1),[eN,ek]=(0,i.useState)(!1),[eC,eS]=(0,i.useState)([]),[eA,eE]=(0,i.useState)(null),[eP,eI]=(0,i.useState)(),[eL,eR]=(0,i.useState)("trending"),[eF,eq]=(0,i.useState)([]),[eT,eD]=(0,i.useState)(!1),[eO,eU]=(0,i.useState)(0);(0,i.useEffect)(()=>{"recent"===eL&&eq((0,T.oj)())},[eL]),(0,i.useEffect)(()=>{},[ep,em]);let[eM,ez]=(0,i.useState)(!1),[eW,eB]=(0,i.useState)(!1),[e$,eK]=(0,i.useState)(!1),[eG,eZ]=(0,i.useState)([]),[eH,eV]=(0,i.useState)([]);(0,i.useEffect)(()=>
1{!async function(){try{let e=await fetch("/api/merchants/options");if(e.ok){let t=await e.json();eZ(t.data.merchantOptions||[]),eV(t.data.popularMerchants||[])}}catch(e){console.error("Failed to fetch merchant options:",e)}}()},[]);let eY=W.get("query")||W.get("q")||"",eQ=W.get("category")||M.category||"",eJ=W.get("minPrice")||M.minPrice||"",eX=W.get("maxPrice")||M.maxPrice||"",e0=W.get("sort")||M.sort||"newest",e1=W.get("page")||M.page||"1",e2=W.get("onSale")||"",e5=W.get("brand")||M.brand||"",e3=W.get("merchant")||"",e4=W.get("merchants")||W.get("merchant_ids")||"",e6=W.get("watchableOnly")||"",e8=W.get("wishlistedOnly")||"",e9=W.get("currency")||"USD",e7=W.get("wishlistId")||"",te=(0,i.useMemo)(()=>e4?e4.split(",").filter(Boolean).map(e=>{var t;return null===(t=eG.find(t=>t.value===e))||void 0===t?void 0:t.label}).filter(e=>!!e):[],[e4,eG]);(0,i.useEffect)(()=>{G&&(async()=>{try{ey(!0);let e=(0,c.createClient)(),{data:t,error:r}=await e.from("wishlists").select("id, title").eq("user_id",G.id).order("title",{ascending:!0});if(r)throw r;ef(t||[])}catch(e){console.error("Error fetching user wishlists:",e)}finally{ey(!1)}})()},[null==G?void 0:G.id]);let tt=e=>{if(e)return e.startsWith("/")?e:e.startsWith("http://")?e.replace("http://","https://"):e.startsWith("//")?"https:".concat(e):e.startsWith("https://")?e:"https://".concat(e)},tr=async e=>{if(!e.length)return e;try{let t=(0,c.createClient)(),r=e.filter(e=>e.external_id).map(e=>e.external_id);if(!r.length)return e;let{data:a,error:s}=await t.from("products").select("external_id, slug, id").in("external_id",r);if(s)return console.error("Error checking for internal products:",s),e;let n=new Map((null==a?void 0:a.map(e=>[e.external_id,{slug:e.slug,id:e.id}]))||[]);return e.map(e=>{if(e.external_id&&n.has(e.external_id)){let t=n.get(e.external_id);return{...e,slug:null==t?void 0:t.slug,id:(null==t?void 0:t.id)||e.id,integration_type:x.o.INTERNAL,is_external:!1,needs_import:!1}}return e})}catch(t){return console.error("Error enhancing search results:",t),e}},ta=async(e,t,r)=>{let a=eQ||eJ||eX||e5||e3||"true"===e2;if(e.trim()||t||a){if(e.trim())try{(0,q.Ar)({search_string:e.trim(),content_category:eQ||"all_products"})}catch(e){console.error("Error tracking Search event:",e)}r||(X([]),to([]),et(0),e_(1),ev(!1),eD(!1),eU(0),window.scrollTo({top:0,behavior:"smooth"})),en(!0),eg(!0),ea(null),el(null);try{var s;let a=r?e1:"1",n=new URLSearchParams({query:e.trim(),page:a,limit:"100"});if(eQ&&n.append("category",eQ),eJ&&n.append("minPrice",eJ),eX&&n.append("maxPrice",eX),e5&&n.append("brand",e5),e3&&n.append("merchant",e3),e4&&n.append("merchants",e4),"true"===e2&&n.append("onSale","true"),e0&&n.append("sort",e0),e7&&n.append("wishlistId",e7),"true"===e8&&n.append("wishlistedOnly","true"),"true"===e6&&n.append("watchableOnly","true"),"USD"!==e9&&n.append("currency",e9),r||ts({query:e.trim(),page:"1"}),el({step:"searching",message:"Searching products..."}),t&&t.length>0){let r=(0,c.createClient)().from("products").select("\n            id,\n            title,\n            description,\n            brand,\n            price,\n            currency,\n            image_urls,\n            affiliate_url,\n            direct_url,\n            rating,\n            review_count,\n            metadata,\n            original_price,\n            on_sale,\n            sale_discount,\n            availability,\n            slug,\n            status,\n            integration_type,\n            merchant_id,\n            created_at,\n            last_sync,\n            last_price_check,\n            external_id\n          ").in("id",t).in("status",["published","wishlist_only"]);eJ&&r.gte("price",parseFloat(eJ)),eX&&r.lte("price",parseFloat(eX)),e5&&r.eq("brand",e5),"true"===e2&&r.eq("on_sale",!0),e.trim()&&r.textSearch("title",e.trim(),{type:"websearch",config:"english"});let{data:a,error:s}=await r;if(s)throw s;let n=(a||[]).map(e=>({...e,currency:e.currency||"USD",category_id:void 0,last_price_check:null,status:e.status||"published",categories:null,affiliate_url:tt(e.affiliate_url),integration_type:e.integration_type||x.o.INT
1ERNAL})).filter(e=>0!==e.price);X(n),et(n.length);return}let i="/api/products/search?".concat(n).concat("");{let e="/api/products/search?".concat(n,"&fast=true"),t=e=>e.filter(e=>0!==e.price).map(e=>{var t;return{...e,currency:(null===(t=e.metadata)||void 0===t?void 0:t.currency_code)||"USD",category_id:void 0,last_price_check:null,status:"published",categories:null,affiliate_url:tt(e.affiliate_url),merchant_id:void 0}}),o=new Set;eU(0);try{let s=await fetch(e);if(s.ok){let e=(await s.json()).data||{},n=t(e.products||[]),i=await tr(n);i.length>0&&(o=new Set(i.map(e=>e.id)),(0,l.flushSync)(()=>{r&&parseInt(a)>1?(X(e=>eu([...e,...i])),et(e=>e+i.length)):(X(i),et(i.length)),en(!1),eD(!0),el(null)}))}}catch(e){}let c=await fetch(i);if(!c.ok)throw Error("Failed to fetch search results");let d=await c.json(),u=d.data||d;eS(u.suggestions||[]),eE((null===(s=u.metadata)||void 0===s?void 0:s.intent)||u.intent||null),u.searchQueryId&&eI(u.searchQueryId),ev(u.hasMore||!1),e_(parseInt(a));let m=t(u.products||[]),h=await tr(m),p=0;if(r&&parseInt(a)>1)X(e=>eu([...e,...h])),et(e=>e+h.length);else if(o.size>0){let e=h.filter(e=>!o.has(e.id));p=e.length,e.length>0&&X(t=>{let r=eu([...t,...e]);return et(r.length),r})}else X(h),et(h.length);eD(!1),p>0&&(eU(p),setTimeout(()=>eU(0),4e3)),el(null)}}catch(e){console.error("Error searching products:",e),ea(e instanceof Error?e.message:"An error occurred"),el(null)}finally{en(!1),eD(!1)}}},ts=e=>{let t=new URL(window.location.href);Object.entries(e).forEach(e=>{let[r,a]=e;a?t.searchParams.set(r,a):t.searchParams.delete(r)}),"query"in e&&t.searchParams.delete("q"),$.push(t.toString())},tn=e=>{let t=e.trim();if((0,l.flushSync)(()=>{X([]),to([]),en(!0),eD(!1),eU(0),el(null)}),t===eY&&"1"===(e1||"1")){ta(t,void 0,!1);return}ts({query:t,page:"1"})},ti=async()=>{if(eY&&!eN&&ew){ek(!0);try{ts({...Object.fromEntries(W.entries()),page:(ej+1).toString()}),await ta(eY,void 0,!0)}catch(e){console.error("Error loading more results:",e),ea("Failed to load more results")}finally{ek(!1)}}};(0,i.useEffect)(()=>{(async function(){en(!0),ea(null);try{let e=(0,c.createClient)();try{let t=e.auth.getUser(),r=new Promise((e,t)=>setTimeout(()=>t(Error("Auth check timeout")),5e3)),{data:a,error:s}=await Promise.race([t,r]);null==a||a.user}catch(e){}try{let{data:t,error:r}=await e.from("search_queries").select("*").order("click_count",{ascending:!1}).limit(25);if(r&&console.error("❌ ProductsContent: Search query error details:",{error:r,code:r.code,message:r.message,details:r.details}),t&&t.length>0){let e=(0,_.W5)(t);eh(e)}}catch(e){console.error("❌ ProductsContent: Failed to fetch recent searches:",{error:e,message:e instanceof Error?e.message:"Unknown error",stack:e instanceof Error?e.stack:void 0})}if(eY||eQ||eJ||eX||e5||e3||"true"===e2||e7){if(e7&&G){let{data:t,error:r}=await e.from("wishlists").select("*").eq("id",e7).single();if(r)throw Error("Wishlist not found or you do not have access to it");if(t.user_id!==G.id&&"private"===t.visibility)throw Error("You do not have access to this wishlist");let{data:a,error:s}=await e.from("wishlist_products").select("product_id").eq("wishlist_id",e7);if(s)throw s;if(a&&a.length>0){let t=a.map(e=>e.product_id);if(eY)await ta(eY,t);else{let{data:r,error:a}=await e.from("products").select("\n                    id,\n                    title,\n                    description,\n                    brand,\n                    price,\n                    currency,\n                    image_urls,\n                    affiliate_url,\n                    direct_url,\n                    rating,\n                    review_count,\n                    metadata,\n                    original_price,\n                    on_sale,\n                    sale_discount,\n                    availability,\n                    slug,\n                    status,\n                    integration_type,\n                    merchant_id,\n                    created_at,\n                    last_sync,\n                    last_price_check,\n                    external_id\n                  ").in("id",t).in("status",["published","wishlist_only"]).neq("price",0);if(a)throw a;let s=(r||[]).map(e=>({...e,currency:e.currency||"USD",category_id:void 0,last_price_check:null,status:e.status||"published",categories:null,affiliate_url:tt(e.affiliate_url),integration_type:e.integration_type||x.o.INT
1ERNAL}));X(s),et(s.length),eg(!1)}return}X([]),et(0),eg(!1),en(!1);return}let t=!!(e1&&parseInt(e1)>1);await ta(eY,void 0,t)}else try{let e=await fetch("/api/products/top-wishlisted");if(!e.ok)throw Error("HTTP ".concat(e.status,": ").concat(e.statusText));let t=((await e.json()).products||[]).map(e=>({...e,currency:e.currency||"USD",category_id:void 0,last_price_check:null,status:e.status||"published",categories:null,affiliate_url:tt(e.affiliate_url),integration_type:e.integration_type||x.o.INTERNAL})).filter(e=>0!==e.price);X(eu(t)),et(t.length),eg(!1)}catch(n){console.error("❌ ProductsContent: Error fetching trending products:",n);let t=e.from("products").select("\n                id,\n                title,\n                description,\n                brand,\n                price,\n                currency,\n                image_urls,\n                affiliate_url,\n                direct_url,\n                rating,\n                review_count,\n                metadata,\n                original_price,\n                on_sale,\n                sale_discount,\n                availability,\n                slug,\n                status,\n                integration_type,\n                merchant_id,\n                created_at,\n                last_sync,\n                last_price_check,\n                external_id\n              ").eq("status","published").neq("price",0).not("external_id","is",null).order("created_at",{ascending:!1}).limit(36),{data:r,error:a}=await t;if(a)throw a;let s=(r||[]).map(e=>({...e,currency:e.currency||"USD",category_id:void 0,last_price_check:null,status:e.status||"published",categories:null,affiliate_url:tt(e.affiliate_url),integration_type:e.integration_type||x.o.INT
1ERNAL})).filter(e=>0!==e.price).filter(e=>!function(e){if(!e)return!1;let t=e.toLowerCase();return[/\bgift\s+card\b/i,/\begift\s+card\b/i,/\bgiftcard\b/i,/\bgift\s+certificate\b/i,/\bdigital\s+gift\b/i,/\$\d+\s+gift\s+card/i,/gift\s+card\s+\$\d+/i].some(e=>e.test(t))}(e.title));X(eu(s)),et(s.length),eg(!1)}}catch(e){console.error("❌ ProductsContent: Error loading data:",e),ea(e instanceof Error?e.message:"An error occurred")}finally{en(!1)}})()},[eY,eQ,eJ,eX,e5,e3,e4,e2,e1,e7,e6,null==G?void 0:G.id]),(0,i.useEffect)(()=>{X(e=>{let t=[...e];switch(e0){case"price_asc":t.sort((e,t)=>(e.price||0)-(t.price||0));break;case"price_desc":t.sort((e,t)=>(t.price||0)-(e.price||0));break;case"rating_desc":t.sort((e,t)=>(t.rating||0)-(e.rating||0));break;case"alphabetical":t.sort((e,t)=>e.title.localeCompare(t.title));break;case"alphabetical_desc":t.sort((e,t)=>t.title.localeCompare(e.title));break;case"sale_discount_desc":t.sort((e,t)=>(t.sale_discount||0)-(e.sale_discount||0));break;case"merchant":t.sort((e,t)=>(e.merchant||"").localeCompare(t.merchant||""));break;case"oldest":t.sort((e,t)=>new Date(e.created_at||0).getTime()-new Date(t.created_at||0).getTime());break;default:t.sort((e,t)=>new Date(t.created_at||0).getTime()-new Date(e.created_at||0).getTime())}return t})},[e0]);let[tl,to]=(0,i.useState)(R);(0,i.useEffect)(()=>{to(J)},[J]);let tc=(0,i.useMemo)(()=>{let e="true"===e6?tl.filter(e=>(0,I.Vd)({id:e.id,external_id:e.external_id,integration_type:e.integration_type,metadata:e.metadata,title:e.title,price:e.price,image_urls:e.image_urls}).isEligible):tl,t=new Set;return e.filter(e=>!t.has(e.id)&&(t.add(e.id),!0))},[tl,e6]);(0,i.useEffect)(()=>{let e=ep&&!es&&0===tc.length&&!!eY.trim();window.dispatchEvent(new CustomEvent(K.In,{detail:{active:e}}))},[ep,es,tc.length,eY]);let td=()=>{ts({category:"",minPrice:"",maxPrice:"",brand:"",merchant:"",merchants:"",currency:"USD",onSale:"",watchableOnly:"",wishlistedOnly:"",page:"1"})},tu=eQ||eJ||eX||e5||e3||e4||"USD"!==e9||"true"===e2||"true"===e6||"true"===e8||e7,tm=()=>{if(!G){$.push("/auth/login?next="+encodeURIComponent("/products"));return}ez(!0)},th=()=>(0,a.jsxs)(a.Fragment,{children:[tu&&(0,a.jsx)("div",{className:"pb-4 border-b border-gray-200",children:(0,a.jsxs)("button",{onClick:td,className:"w-full px-4 py-2 text-sm font-medium text-white bg-red-600 hover:bg-red-700 rounded-md transition-colors flex items-center justify-center gap-2",children:[(0,a.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),V("filters.clearAll")]})}),(0,a.jsx)("div",{children:(0,a.jsx)(N.A,{label:V("filters.category"),options:m.map(e=>({value:e.slug,label:e.title})),value:eQ,onChange:e=>ts({category:e}),placeholder:V("filters.allCategories")})}),(0,a.jsx)("div",{children:(0,a.jsx)(F,{label:V("filters.merchants"),options:eG,popularOptions:[],values:e4?e4.split(",").filter(Boolean):[],onChange:e=>ts({merchants:e.join(","),merchant:"",page:"1"}),placeholder:V("filters.allMerchants")})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-lg font-semibold mb-2",children:V("search.sortBy")}),(0,a.jsx)(h,{value:e0,onChange:e=>ts({sort:e}),locale:z})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center mb-2",children:[(0,a.jsx)(f.A,{className:"w-4 h-4 mr-2 text-red-500"}),(0,a.jsx)("h3",{className:"text-lg font-semibold",children:V("nav.wishlists")})]}),G?ex.length>0?(0,a.jsx)("div",{children:(0,a.jsxs)("select",{value:e7,onChange:e=>ts({wishlistId:e.target.value}),className:"w-full p-2 border rounded-md",children:[(0,a.jsx)("option",{value:"",children:V("filters.allProducts")}),ex.map(e=>(0,a.jsx)("option",{value:e.id,children:e.title},e.id))]})}):(0,a.jsxs)("p",{className:"text-sm text-gray-500 mb-2",children:["You don't have any wishlists yet.",(0,a.jsx)(S(),{href:"/dashboard",className:"text-brand hover:text-brand-hover ml-1",children:"Create one"})]}):(0,a.jsx)("div",{className:"bg-brand-light p-3 rounded-lg",children:(0,a.jsxs)("p",{className:"text-sm text-primary",children:[(0,a.jsx)(S(),{href:"/auth/login",className:"text-brand hover:text-brand-hover font-medium",children:"Sign in"})," ","to filter by your wishlists"]})})]}),(0,a.jsx)(p,{minPrice:eJ,maxPrice:eX,onPriceChange:(e,t)=>
1ts({minPrice:(null==e?void 0:e.toString())||"",maxPrice:(null==t?void 0:t.toString())||""})}),!1,(0,a.jsx)("div",{children:(0,a.jsx)(N.A,{label:V("filters.currency"),options:[{value:"USD",label:"USD ($)"},{value:"EUR",label:"EUR (€)"},{value:"GBP",label:"GBP (\xa3)"},{value:"CAD",label:"CAD ($)"},{value:"AUD",label:"AUD ($)"}],value:e9,onChange:e=>ts({currency:e}),placeholder:V("filters.currency")})}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("label",{className:"flex items-center space-x-2",children:[(0,a.jsx)("input",{type:"checkbox",checked:"true"===e2,onChange:e=>ts({onSale:e.target.checked?"true":""}),className:"rounded border-gray-300"}),(0,a.jsx)("span",{children:V("filters.onSale")})]}),(0,a.jsxs)("label",{className:"flex items-center space-x-2",children:[(0,a.jsx)("input",{type:"checkbox",checked:"true"===e6,onChange:e=>ts({watchableOnly:e.target.checked?"true":""}),className:"rounded border-gray-300"}),(0,a.jsx)("span",{children:V("filters.watchableOnly")})]}),(0,a.jsxs)("label",{className:"flex items-center space-x-2",children:[(0,a.jsx)("input",{type:"checkbox",checked:"true"===W.get("wishlistedOnly"),onChange:e=>ts({wishlistedOnly:e.target.checked?"true":""}),className:"rounded border-gray-300"}),(0,a.jsx)("span",{children:V("filters.wishlistedByOthers")})]})]}),G&&(0,a.jsxs)("div",{className:"bg-brand-light border border-brand rounded-lg p-4",children:[(0,a.jsx)("h3",{className:"font-semibold text-gray-900 mb-2",children:"Can't find what you're looking for?"}),(0,a.jsx)("p",{className:"text-sm text-gray-600 mb-3",children:"Add your own custom items like services, experiences, or products from any store."}),(0,a.jsx)(P.m,{content:"Add your own item",preferredPosition:"top",children:(0,a.jsxs)(A.$,{onClick:tm,className:"w-full bg-orange-500 hover:bg-orange-600 text-white",disabled:eb,children:[(0,a.jsx)(b.A,{className:"w-4 h-4 mr-2"}),"Add My Own"]})})]})]});return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:(0,L.cn)("bg-white border-b border-gray-200 py-3 -mx-4 px-4 space-y-2 sm:space-y-3",!eo&&"sticky top-16 z-50 bg-white/95 backdrop-blur-sm"),children:[(0,a.jsxs)("div",{className:"sm:hidden space-y-2 px-1",children:[(0,a.jsx)("div",{children:(0,a.jsx)(g.A,{onSubmit:tn,initialQuery:eY,isLoading:es,autoFocus:!eY,locale:z})}),(0,a.jsx)("div",{className:"flex gap-2",children:(0,a.jsxs)("button",{onClick:()=>eB(!0),className:"flex items-center gap-2 px-4 py-2 border border-gray-300 rounded-md hover:bg-gray-50 transition-colors w-full justify-center",children:[(0,a.jsx)(y.A,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:V("search.filters")}),tu&&(0,a.jsx)("span",{className:"bg-primary text-primary-foreground text-xs px-2 py-1 rounded-full",children:[eJ||eX,e5,e3,e4,"true"===e2,e7,"true"===e6,"true"===e8,"USD"!==e9].filter(Boolean).length})]})})]}),(0,a.jsxs)("div",{className:"hidden sm:flex gap-3 items-center",children:[(0,a.jsx)("div",{className:"flex-1",children:(0,a.jsx)(g.A,{onSubmit:tn,initialQuery:eY,isLoading:es,autoFocus:!eY,className:"!space-y-0",locale:z})}),(0,a.jsxs)("button",{onClick:()=>eK(!0),className:"flex items-center gap-2 px-6 py-3 border border-gray-300 rounded-md hover:bg-gray-50 transition-colors min-h-[52px] font-medium text-lg",children:[(0,a.jsx)(y.A,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:V("search.filters")}),tu&&(0,a.jsx)("span",{className:"bg-primary text-primary-foreground text-xs px-2 py-1 rounded-full",children:[eJ||eX,e5,e3,e4,"true"===e2,e7,"true"===e6,"true"===e8,"USD"!==e9].filter(Boolean).length})]})]}),tu&&(0,a.jsxs)("div",{className:"bg-gray-50 p-3 rounded-md",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-2",children:[(0,a.jsxs)("span",{className:"text-sm font-medium text-gray-700",children:[V("filters.filterBy"),":"]}),(0,a.jsx)("button",{onClick:td,className:"text-sm text-red-600 hover:text-red-800 font-medium",children:V("filters.clearAll")})]}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(eJ||eX)&&(0,a.jsxs)("button",{onClick:()=>ts({minPrice:"",maxPrice:""}),className:"px-3 py-1 rounded-full bg-primary/10 hover:bg-primary/20 text-primary text-sm transition-colors flex items-center",children:["$",eJ||"0"," - $",eX||"∞",(0,a.jsx)(w.A,{className:"ml-1 w-3 h-3"})]}),e5&&(0,a.jsxs)("button",{onClick:()=>ts({brand:""}),className:"px-3 py-1 rounded-full bg-primary/10 hover:bg-primary/20 text-primary text-sm transition-colors flex items-center",children:[e5,(0,a.jsx)(w.A,{className:"ml-1 w-3 h-3"})]}),e4&&(0,a.jsxs)("button",{onClick:()=>ts({merchants:""}),className:"px-3 py-1 rounded-full bg-primary/10 hover:bg-primary/20 text-primary text-sm transition-colors flex items-center",children:[1===e4.split(",").length?(null===(t=eG.find(e=>e.value===e4))||void 0===t?void 0:t.label)||e4:"".concat(e4.split(",").length," merchants"),(0,a.jsx)(w.A,{className:"ml-1 w-3 h-3"})]}),"true"===e2&&(0,a.jsxs)("button",{onClick:()=>ts({onSale:""}),className:"px-3 py-1 rounded-full bg-primary/10 hover:bg-primary/20 text-primary text-sm transition-colors flex items-center",children:["On Sale",(0,a.jsx)(w.A,{className:"ml-1 w-3 h-3"})]}),"true"===e6&&(0,a.jsxs)("button",{onClick:()=>
1ts({watchableOnly:""}),className:"px-3 py-1 rounded-full bg-primary/10 hover:bg-primary/20 text-primary text-sm transition-colors flex items-center",children:["Watchable Only",(0,a.jsx)(w.A,{className:"ml-1 w-3 h-3"})]}),"true"===e8&&(0,a.jsxs)("button",{onClick:()=>ts({wishlistedOnly:""}),className:"px-3 py-1 rounded-full bg-primary/10 hover:bg-primary/20 text-primary text-sm transition-colors flex items-center",children:["Wishlisted Only",(0,a.jsx)(w.A,{className:"ml-1 w-3 h-3"})]}),e7&&(0,a.jsxs)("button",{onClick:()=>ts({wishlistId:""}),className:"px-3 py-1 rounded-full bg-primary/10 hover:bg-primary/20 text-primary text-sm transition-colors flex items-center",children:[null===(r=ex.find(e=>e.id===e7))||void 0===r?void 0:r.title,(0,a.jsx)(w.A,{className:"ml-1 w-3 h-3"})]}),"USD"!==e9&&(0,a.jsxs)("button",{onClick:()=>ts({currency:"USD"}),className:"px-3 py-1 rounded-full bg-primary/10 hover:bg-primary/20 text-primary text-sm transition-colors flex items-center",children:[e9,(0,a.jsx)(w.A,{className:"ml-1 w-3 h-3"})]})]})]}),es?(0,a.jsx)("div",{className:"text-lg font-medium text-gray-600",children:V("search.searchingProducts")}):ep?(0,a.jsxs)("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[(0,a.jsxs)("span",{className:"text-lg font-medium text-gray-900",children:[(0,a.jsx)(Q,{value:ee})," ",1===ee?"product":"products",eY&&(0,a.jsxs)(a.Fragment,{children:[" for “",eY,"”"]})]}),eT&&(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-sm text-blue-600 whitespace-nowrap",children:[(0,a.jsxs)("span",{className:"relative flex h-2 w-2",children:[(0,a.jsx)("span",{className:"absolute inline-flex h-full w-full rounded-full bg-blue-400 opacity-75 animate-ping"}),(0,a.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-blue-500"})]}),"searching more…"]}),!eT&&eO>0&&(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-sm text-green-600 animate-fade-in whitespace-nowrap",children:["+",eO," more found"]})]}):(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[(0,a.jsx)("button",{onClick:()=>eR("trending"),className:"text-sm font-medium pb-1 border-b-2 transition-colors ".concat("trending"===eL?"border-primary text-primary":"border-transparent text-gray-400 hover:text-gray-600"),children:"Trending"}),(0,a.jsx)("button",{onClick:()=>eR("recent"),className:"text-sm font-medium pb-1 border-b-2 transition-colors ".concat("recent"===eL?"border-primary text-primary":"border-transparent text-gray-400 hover:text-gray-600"),children:"Recent"})]}),(0,a.jsx)("div",{className:"flex overflow-x-auto pb-2 scrollbar-hide -mx-1",children:(0,a.jsxs)("div",{className:"flex gap-2 px-1 min-w-max",children:["trending"===eL&&em.length>0&&em.slice(0,25).map(e=>(0,a.jsxs)("button",{onClick:()=>ts({query:e.query}),className:"px-3 py-1.5 rounded-full bg-brand-light hover:bg-brand-muted text-brand text-sm transition-colors flex items-center max-w-[200px] whitespace-nowrap",children:[(0,a.jsx)(v.A,{className:"h-3 w-3 mr-1.5 flex-shrink-0"}),(0,a.jsx)("span",{className:"truncate",children:e.query})]},e.id)),"recent"===eL&&eF.length>0&&eF.slice(0,10).map((e,t)=>(0,a.jsxs)("button",{onClick:()=>ts({query:e}),className:"px-3 py-1.5 rounded-full bg-gray-100 hover:bg-gray-200 text-gray-700 text-sm transition-colors flex items-center max-w-[200px] whitespace-nowrap",children:[(0,a.jsx)(v.A,{className:"h-3 w-3 mr-1.5 flex-shrink-0"}),(0,a.jsx)("span",{className:"truncate",children:e})]},"personal-".concat(t))),"recent"===eL&&0===eF.length&&(0,a.jsx)("span",{className:"text-sm text-gray-400 py-1",children:"No recent searches yet"})]})})]})]}),(0,a.jsx)("div",{children:er?(0,a.jsxs)("div",{className:"text-red-500 p-4 bg-red-50 rounded-md",children:[(0,a.jsx)("p",{children:er}),er.includes("auth")||er.includes("JWT")?(0,a.jsx)("button",{onClick:async()=>{let e=(0,c.createClient)();await e.auth.signOut(),window.location.reload()},className:"mt-2 px-4 py-2 bg-brand text-white rounded-lg hover:bg-brand-hover",children:"Clear Session & Reload"}):null]}):es&&0===tc.length?(0,a.jsx)(B,{query:eY||void 0,merchantNames:te}):(0,a.jsx)(a.Fragment,{children:tc.length>0?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-2 lg:grid-cols-4 gap-6",children:tc.map((e,t)=>{var r,i,l,o,c,u,m,h,p,g,f,b;return(0,a.jsx)("div",{ref:H,...(0,O.Y)({product_id:e.id,position:t,pool_type:e._pool_type}
1),children:(0,a.jsx)(d.ProductCard,{id:e.id,title:e.title,description:e.description||"",price:e.price||0,original_price:null!==(l=e.original_price)&&void 0!==l?l:null,image_urls:e.image_urls||null,currency_code:e.currency_code||void 0,rating:null!==(o=e.rating)&&void 0!==o?o:null,category:null!==(c=e.category)&&void 0!==c?c:null,affiliate_url:null!==(u=e.affiliate_url)&&void 0!==u?u:void 0,direct_url:null!==(m=e.direct_url)&&void 0!==m?m:void 0,external_id:null!==(h=e.external_id)&&void 0!==h?h:void 0,brand:null!==(p=e.brand)&&void 0!==p?p:null,slug:e.slug||"",integration_type:e.integration_type||x.o.INTERNAL,status:e.status||null,on_sale:null!==(g=e.on_sale)&&void 0!==g?g:null,sale_discount:null!==(f=e.sale_discount)&&void 0!==f?f:null,review_count:null!==(b=e.review_count)&&void 0!==b?b:null,merchant_id:e.merchant_id,metadata:e.metadata,created_at:e.created_at||new Date().toISOString(),last_sync:e.last_sync||void 0,last_price_check:e.last_price_check||void 0,collection_id:(null===(r=e.metadata)||void 0===r?void 0:r.collection_id)||"",collection_title:(null===(i=e.metadata)||void 0===i?void 0:i.collection_title)||"",showBottomActions:!0,buyingOptions:e.buyingOptions,productLink:e.slug?"/product/".concat(e.slug):void 0,searchContext:ep&&eY?{query:eY,position:t+1,queryId:eP}:void 0,onViewDeal:()=>{if(e.affiliate_url){let r=ep&&eY?{query:eY,position:t+1,queryId:eP}:void 0,a=(0,s.R)(e,r);(0,n.BY)()?window.location.href=a:window.open(a,"_blank")}else e.slug&&$.push("/product/".concat(e.slug))}})},"".concat(e.id,"-").concat(t))})}),ep&&eY&&tc.length>0&&tc.length<8&&(0,a.jsx)(Y,{query:eY,intent:eA,resultCount:tc.length}),ep&&tc.length>0&&(0,a.jsx)("div",{className:"mt-8 flex flex-col items-center gap-4",children:ew?(0,a.jsx)("button",{onClick:ti,disabled:eN,className:"px-6 py-3 bg-brand text-white rounded-lg hover:bg-brand-hover disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:eN?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(j.A,{className:"h-4 w-4 animate-spin"}),"Loading more..."]}):"Load More Results"}):(0,a.jsxs)("div",{className:"text-center py-4",children:[(0,a.jsx)("p",{className:"text-gray-600 mb-2",children:"No more results found."}),(0,a.jsx)("p",{className:"text-sm text-gray-500",children:"Try refining your filters or search terms to find what you're looking for."})]})})]}):(0,a.jsxs)("div",{className:"text-center py-12 bg-gray-50 rounded-lg",children:[(0,a.jsx)("p",{className:"text-gray-500",children:ep?"No products found matching your criteria. Try adjusting your search or filters.":"No products available yet. Check back soon!"}),ep&&eY&&(0,a.jsx)(Y,{query:eY,intent:eA,resultCount:0}),ep&&eY&&(0,a.jsx)(Z,{query:eY}),ep&&eC.length>0&&(0,a.jsxs)("div",{className:"mt-4",children:[(0,a.jsx)("p",{className:"text-sm text-gray-400 mb-2",children:"Try searching for:"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2 justify-center",children:eC.map(e=>(0,a.jsx)("button",{onClick:()=>{let t=new URLSearchParams(W.toString());t.set("query",e),t.delete("page"),$.push("/products?".concat(t.toString()))},className:"px-3 py-1.5 text-sm rounded-full border border-gray-300 text-gray-600 hover:bg-white hover:border-primary hover:text-primary transition-colors",children:e},e))})]}),ep&&(0,a.jsx)("button",{onClick:()=>{eg(!1),$.push("/products")},className:"mt-4 text-brand hover:underline",children:"Clear search and show trending products"})]})})}),eW&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 z-[9999] lg:hidden",onClick:()=>eB(!1),style:{top:0,left:0,right:0,bottom:0}}),(0,a.jsxs)("div",{className:"fixed inset-y-0 right-0 w-80 max-w-[85vw] bg-white z-[10000] lg:hidden transform transition-transform duration-300 ease-in-out overflow-y-auto",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 sticky top-0 bg-white z-10",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Filters"}),(0,a.jsx)("button",{onClick:()=>eB(!1),className:"p-2 hover:bg-gray-100 rounded-full transition-colors",children:(0,a.jsx)(w.A,{className:"w-5 h-5"})})]}),(0,a.jsx)("div",{className:"p-4 space-y-6",children:(0,a.jsx)(th,{})}),(0,a.jsx)("div",{className:"sticky bottom-0 bg-white border-t border-gray-200 p-4",children:(0,a.jsxs)("button",{onClick:()=>eB(!1),className:"w-full bg-primary text-primary-foreground py-3 rounded-md font-medium hover:bg-primary/90 transition-colors",children:[V("filters.showResults")," (",ee,")"]})})]})]}),e$&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"fixed bg-black bg-opacity-50 z-[60] hidden lg:block",style:{to
1p:"-16px",left:0,right:0,bottom:0},onClick:()=>eK(!1)}),(0,a.jsxs)("div",{className:"fixed right-0 w-96 max-w-[85vw] bg-white z-[70] hidden lg:block transform transition-transform duration-300 ease-in-out overflow-y-auto shadow-2xl",style:{top:"-16px",bottom:0},children:[(0,a.jsxs)("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 sticky top-0 bg-white z-10",children:[(0,a.jsx)("h2",{className:"text-xl font-semibold",children:"Filters"}),(0,a.jsx)("button",{onClick:()=>eK(!1),className:"p-2 hover:bg-gray-100 rounded-full transition-colors",children:(0,a.jsx)(w.A,{className:"w-5 h-5"})})]}),(0,a.jsx)("div",{className:"p-6 space-y-6",children:(0,a.jsx)(th,{})}),(0,a.jsx)("div",{className:"sticky bottom-0 bg-white border-t border-gray-200 p-6",children:(0,a.jsxs)("button",{onClick:()=>eK(!1),className:"w-full bg-primary text-primary-foreground py-3 rounded-md font-medium hover:bg-primary/90 transition-colors text-lg",children:[V("filters.showResults")," (",ee,")"]})})]})]}),(0,a.jsx)(E.N,{isOpen:eM,onClose:()=>ez(!1)})]})}},38746:(e,t,r)=>{async function a(){try{return new Promise(e=>{var t,r;let a=setTimeout(()=>{e(!1)},1e3);(null===(r=window.chrome)||void 0===r?void 0:null===(t=r.runtime)||void 0===t?void 0:t.sendMessage)?window.chrome.runtime.sendMessage("pblnafjfacmpbembieollfipijgfhapg",{type:"PING"},t=>{clearTimeout(a),e(!!t)}):(clearTimeout(a),e(!1))})}catch(e){return!1}}function s(){return"https://chromewebstore.google.com/detail/lmktoday-wishlist-builder/pblnafjfacmpbembieollfipijgfhapg"}function n(){return"https://chromewebstore.google.com/detail/lmktoday-wishlist-builder/pblnafjfacmpbembieollfipijgfhapg/reviews"}function i(){return!/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)&&!!(window.chrome&&window.chrome.runtime)}r.d(t,{Hj:()=>n,Un:()=>s,_6:()=>a,zC:()=>i})},46204:(e,t,r)=>{r.d(t,{In:()=>s,hL:()=>i,w5:()=>n});let a="lmk_extension_search_prompt_session",s="extensionSearchZeroResults";function n(){sessionStorage.setItem(a,"1")}function i(){return"1"===sessionStorage.getItem(a)}},50392:(e,t,r)=>{r.d(t,{I5:()=>n,W5:()=>i});let a=new(r(86726)).d,s=["sex","porn","xxx","adult","erotic","nude","naked","sex doll","sex toy","adult toy","lingerie","masturbator","masturbation","vibrator","dildo","pornography","pornographic","explicit","nsfw","fetish","bdsm","kink","orgasm","p0rn","p0rno","s3x","s3xy","xxx","x-rated","adult entertainment","adult content","adult video","onlyfans","only fans","cam girl","webcam","hookup","hook up","one night stand","threesome","orgy","gangbang","milf","cougar","sugar daddy","sugar baby","breast","boob","boobs","butt","ass","asshole","penis","dick","cock","vagina","pussy","clit","nipple","nipples","tits","titties","titty","buttocks","anus","anal","oral","blowjob","cum","sperm","semen","ejaculation","strip","stripper","escort","prostitute","hooker","nudity","naked","bare","topless","bottomless","nude","nudist","naturist","sexy","horny","lust","desire","sex toy","adult toy","pleasure toy","intimate toy","masturbator","masturbation","fleshlight","pocket pussy","vibrator","dildo","butt plug","anal plug","cock ring","penis ring","chastity","bondage","whip","collar","gag","restraint","lubricant","lube","condom","contraceptive","bong","bongs","water pipe","smoking pipe","grinder","rolling papers","vaporizer","dab rig","cannabis","marijuana","weed","hemp","cocaine","heroin","meth","methamphetamine","crack","lsd","mushroom","psychedelic","hallucinogen","mdma","ecstasy","molly","ketamine","opioid","fentanyl","oxy","oxycodone","adderall","xanax","dabs","wax","shatter","thc","cbd","smoke","smoking","joint","blunt","spliff","gun","rifle","pistol","firearm","ammunition","ammo","bullet","holster","tactical","knife","blade","dagger","machete","scope","gun part","AR-15","AK-47","shotgun","revolver","sword","katana","nunchaku","brass knuckles","handgun","revolver","glock","beretta","crossbow","bow","arrow","quiver","bomb","explosive","grenade","firework","pepper spray","mace","taser","stun gun","suicide","self harm","cutting","razor blade","murder","kill","killing","assassination","torture","torture device","breeding","dog breeding","animal breeding","taxidermy","hunting trophy","snuff","gore","extreme violence","poker chip","casino","slot machine","roulette","blackjack","poker","texas holdem","craps","baccarat","lottery","scratch off","betting","sportsbook","hate","racist","nazi","kkk","klan","white supremacy","supremacist","extremist","counterfeit","fake","replica","knockoff","stolen","theft","burglary","illegal","contraband","pyramid scheme","ponzi","scam","fraud","fake id","fake passport","fake driver license"];function n(e){return!!e&&a.isProfane(e.toLowerCase())}function i(e){return e&&Array.isArray(e)?e.filter(e=>!function(e){if(!e)return!1;let t=e.toLowerCase();return!!n(t)||s.some(e=>RegExp("\\b".concat(e,"\\b"),"i").test(t))}(e.query)):[]}},60502:(e,t,r)=>{r.d(t,{Y:()=>i,z:()=>n});var a=r(12115),s=r(30440);function n(e){let t=(0,a.useRef)(null),r=(0,a.useRef)(new Set);return(0,a.useEffect)(()=>
1(t.current=new IntersectionObserver(t=>{for(let a of t){if(!a.isIntersecting)continue;let t=a.target,n=t.dataset.impressionProductId;!n||r.current.has(n)||(r.current.add(n),(0,s.c)(s.l.PRODUCT_IMPRESSION,{product_id:n,surface:e,position:parseInt(t.dataset.impressionPosition||"0",10),pool_type:t.dataset.impressionPoolType||void 0}))}},{threshold:.5}),()=>{var e;null===(e=t.current)||void 0===e||e.disconnect()}),[e]),{observeRef:(0,a.useCallback)(e=>{e&&t.current&&t.current.observe(e)},[])}}function i(e){return{"data-impression-product-id":e.product_id,"data-impression-position":String(e.position),"data-impression-pool-type":e.pool_type||""}}},84354:(e,t,r)=>{r.d(t,{N:()=>f});var a=r(95155),s=r(12115),n=r(35695),i=r(54165),l=r(30285),o=r(62523),c=r(18046),d=r(2160),u=r(75074),m=r(87374),h=r(56671),p=r(21868),g=r(36608),x=r(52643);function f(e){let{isOpen:t,onClose:r,mode:f="item"}=e,{user:b}=(0,p.A)(),y=(0,n.useRouter)(),[w,v]=(0,s.useState)([]),[j,_]=(0,s.useState)(!0),[N,k]=(0,s.useState)(""),[C,S]=(0,s.useState)(""),[A,E]=(0,s.useState)(!1),[P,I]=(0,s.use
1State)(""),[L,R]=(0,s.useState)(!1),[F,q]=(0,s.useState)("");(0,s.useEffect)(()=>{t&&b&&(async()=>{_(!0);try{let e=(0,x.createClient)(),{data:t,error:r}=await e.from("wishlists").select("id, slug, title, is_public").eq("user_id",b.id).order("created_at",{ascending:!1});if(r)throw r;let a=await Promise.all((t||[]).map(async t=>{let{count:r}=await e.from("wishlist_products").select("*",{count:"exact",head:!0}).eq("wishlist_id",t.id);return{...t,product_count:r||0}}));v(a)}catch(e){console.error("Error fetching wishlists:",e),h.toast.error("Failed to load your wishlists")}finally{_(!1)}})()},[t,b]),(0,s.useEffect)(()=>{t||(k(""),S(""),E(!1),I(""),q(""))},[t]);let T=e=>{if("registry"===f||"cashfund"===f){r(),y.push("/wishlists/".concat(e.slug,"?add=").concat("registry"===f?"registry":"cashfund"));return}k(e.id),S(e.title),E(!0)},D=async()=>{if(!P.trim()){h.toast.error("Please enter a wishlist title");return}R(!0);try{let e=(0,x.createClient)(),{data:{session:t}}=await e.auth.getSession();if(!t){h.toast.error("Please sign in to create a wishlist");return}let a=await fetch("/api/wishlists",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(t.access_token),...t.refresh_token&&{"X-Refresh-Token":t.refresh_token}},body:JSON.stringify({title:P.trim(),is_public:!1})});if(!a.ok)throw Error("Failed to create wishlist");let s=await a.json();if(("registry"===f||"cashfund"===f)&&s.slug){h.toast.success("Wishlist created!"),r(),y.push("/wishlists/".concat(s.slug,"?add=").concat("registry"===f?"registry":"cashfund"));return}let n={id:s.id,slug:s.slug,title:s.title,product_count:0,is_public:s.is_public};v(e=>
1[n,...e]),k(s.id),S(s.title),E(!0),h.toast.success("Wishlist created successfully!")}catch(e){console.error("Error creating wishlist:",e),h.toast.error("Failed to create wishlist")}finally{R(!1)}},O=()=>{E(!1),r()},U=w.filter(e=>e.title.toLowerCase().includes(F.toLowerCase()));return A&&N?(0,a.jsx)(g.m,{isOpen:A,onClose:O,wishlistId:N,wishlistTitle:C,onChangeWishlist:()=>{E(!1)},onItemAdded:()=>{h.toast.success("Item added to wishlist!"),O()}}):(0,a.jsx)(i.lG,{open:t,onOpenChange:r,children:(0,a.jsxs)(i.Cf,{className:"max-w-md",children:[(0,a.jsx)(i.c7,{children:(0,a.jsxs)(i.L3,{className:"flex items-center gap-2",children:["item"===f?(0,a.jsx)(c.A,{className:"w-5 h-5"}):(0,a.jsx)(d.A,{className:"w-5 h-5"}),"registry"===f?"Add a cash registry":"cashfund"===f?"Add a cash fund":"Choose a Wishlist"]})}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("p",{className:"text-sm text-gray-600",children:"registry"===f?"Pick the list where gifts should add up toward one goal:":"cashfund"===f?"Pick the list to add your payment handles (Venmo, PayPal, CashApp, Zelle):":"Select which wishlist to add your custom item to:"}),w.length>3&&(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(u.A,{className:"w-4 h-4 absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400"}),(0,a.jsx)(o.p,{type:"text",placeholder:"Search wishlists...",value:F,onChange:e=>q(e.target.value),className:"pl-10"})]}),j?(0,a.jsx)("div",{className:"space-y-2",children:[void 0,void 0,void 0].map((e,t)=>(0,a.jsx)("div",{className:"animate-pulse",children:(0,a.jsx)("div",{className:"h-12 bg-gray-200 rounded-lg"})},t))}):U.length>0?(0,a.jsx)("div",{className:"space-y-2 max-h-60 overflow-y-auto",children:U.map(e=>(0,a.jsx)("button",{onClick:()=>T(e),className:"w-full p-3 text-left border border-gray-200 rounded-lg hover:border-brand hover:bg-brand-light transition-colors",children:(0,a.jsx)("div",{className:"flex items-center justify-between",children:(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"font-medium text-gray-900",children:e.title}),(0,a.jsxs)("div",{className:"text-sm text-gray-500 flex items-center gap-2",children:[(0,a.jsx)(m.A,{className:"w-3 h-3"}),e.product_count," items",e.is_public&&(0,a.jsx)("span",{className:"text-xs bg-green-100 text-green-700 px-1 rounded",children:"Public"})]})]})})},e.id))}):(0,a.jsx)("div",{className:"text-center py-4 text-gray-500",children:F?"No wishlists match your search":"No wishlists found"}),(0,a.jsx)("div",{className:"border-t pt-4",children:(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(o.p,{type:"text",placeholder:"Create new wishlist...",value:P,onChange:e=>I(e.target.value),onKeyDown:e=>{"Enter"===e.key&&P.trim()&&D()},maxLength:64}),(0,a.jsx)(l.$,{onClick:D,disabled:!P.trim()||L,className:"w-full",variant:"outline",children:L?"Creating...":"registry"===f?"Create & Add Registry":"cashfund"===f?"Create & Add Cash Fund":"Create & Add Item"})]})})]})]})})}},95705:(e,t,r)=>{function a(e){return e.external_id?function(e){return!!e&&"string"==typeof e&&/^[B0-9][0-9A-Z]{9}$/i.test(e.trim())}(e.external_id)||/^\d{19}$/.test(e.external_id)||"affiliate.com"===e.integration_type||function(e){return!!(/^\d{8,14}$/.test(e)||/^[A-Z0-9\-_]{3,50}$/i.test(e))}(e.external_id)?{isEligible:!0,reason:"Product with valid external ID - using internal watch system for reliable monitoring",watchType:"internal",external_id:e.external_id,watchSystem:"internal_watch"}:{isEligible:!1,reason:"Product external ID cannot be resolved by available watch systems",watchType:null,external_id:null,watchSystem:null}:{isEligible:!1,reason:"Product does not have an external ID required for price monitoring",watchType:null,external_id:null,watchSystem:null}}r.d(t,{Vd:()=>a})}}]);

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.