PageSourceSearch

https://lmk.today/_next/static/chunks/25192-305f19ea85961597.js?dpl=dpl_5Dm4hPFR4YLQe5uHK7Gef5SzQbhA

js lmk.today collected 2026-09-24 12:07:39 UTC 16,312 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[25192],{10283:(e,t,r)=>{r.d(t,{Ay:()=>x,Tw:()=>g,oj:()=>h});var a=r(95155),s=r(12115),n=r(47650),l=r(37648),i=r(74601),o=r(80659),c=r(75074),d=r(6874),u=r.n(d);let m="lmk_recent_searches";function h(){try{return JSON.parse(localStorage.getItem(m)||"[]")}catch(e){return[]}}function g(e){if(e.trim())try{let t=h().filter(t=>t.toLowerCase()!==e.toLowerCase());t.unshift(e.trim()),localStorage.setItem(m,JSON.stringify(t.slice(0,5)))}catch(e){}}function x(e){let{query:t,isOpen:r,onSelect:d,onProductClick:m,onClose:g,portalToBody:x=!1,anchorRef:f}=e,[y,v]=(0,s.useState)(null),[b,w]=(0,s.useState)([]),[j,N]=(0,s.useState)(-1),[k,_]=(0,s.useState)(null),C=(0,s.useRef)(null),S=(0,s.useRef)(null);(0,s.useEffect)(()=>{r&&w(h())},[r]),(0,s.useEffect)(()=>{if(!x||!(null==f?void 0:f.current)||!r)return;let e=()=>{f.current&&_(f.current.getBoundingClientRect())};return e(),window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[x,f,r]),(0,s.useEffect)(()=>{if(!r||t.length<2){v(null),N(-1);return}let e=setTimeout(async()=>{var e;null===(e=S.current)||void 0===e||e.abort();let r=new AbortController;S.current=r;try{let e=await fetch("/api/products/autocomplete?q=".concat(encodeURIComponent(t)),{signal:r.signal});if(e.ok){let t=await e.json();v(t),N(-1)}}catch(e){}},150);return()=>{var t;clearTimeout(e),null===(t=S.current)||void 0===t||t.abort()}},[t,r]),(0,s.useEffect)(()=>{let e=e=>{C.current&&!C.current.contains(e.target)&&g()};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[g]);let E=function(e,t,r){let a=[],s=new Set,n=(e,t)=>{let r=p(e);s.has(r)||(s.add(r),a.push({value:e,slug:t}))};return r.length<2?t.forEach(e=>n(e)):e&&(e.searches.forEach(e=>n(e)),e.products.forEach(e=>n(e.title,e.slug||void 0)),e.brands.forEach(e=>n(e))),a}(y,b,t),A=(0,s.useCallback)(e=>{if(r&&0!==E.length)if("ArrowDown"===e.key)e.preventDefault(),N(e=>(e+1)%E.length);else if("ArrowUp"===e.key)e.preventDefault(),N(e=>e<=0?E.length-1:e-1);else if("Enter"===e.key&&j>=0){e.preventDefault();let t=E[j];t.slug&&m?m(t.slug):d(t.value)}else"Escape"===e.key&&g()},[r,E,j,d,m,g]);if((0,s.useEffect)(()=>(document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)),[A]),!r)return null;let L=t.length<2&&b.length>0,T=t.length>=2&&y;if(!L&&!T)return null;let F=e=>{e.slug&&m?m(e.slug):d(e.title)},R=0,P=(0,a.jsxs)("div",{ref:C,className:x?"fixed z-[9999] bg-white border border-gray-200 rounded-lg shadow-lg overflow-hidden overflow-y-auto":"absolute top-full left-0 right-0 z-50 mt-1 bg-white border border-gray-200 rounded-lg shadow-lg overflow-hidden max-h-[400px] overflow-y-auto",style:x&&k?{top:k.bottom+4,left:window.innerWidth<768?8:k.left,right:window.innerWidth<768?8:void 0,width:window.innerWidth<768?void 0:k.width,maxHeight:window.innerWidth<768?"70vh":400}:void 0,children:[L&&(0,a.jsxs)("div",{className:"p-2",children:[(0,a.jsxs)("div",{className:"px-2 py-1 text-xs font-medium text-gray-500 uppercase tracking-wide flex items-center gap-1",children:[(0,a.jsx)(l.A,{className:"h-3 w-3"})," Recent"]}),b.map((e,t)=>{let r=R++;return(0,a.jsx)("button",{className:"w-full text-left px-3 py-2.5 sm:py-2 text-sm rounded-md transition-colors ".concat(j===r?"bg-gray-100":"hover:bg-gray-50"),onClick:()=>d(e),onMouseEnter:()=>N(r),children:e},"recent-".concat(t))})]}),T&&(0,a.jsxs)(a.Fragment,{children:[y.collections&&y.collections.length>0&&(0,a.jsxs)("div",{className:"m-2 rounded-lg bg-gradient-to-r from-amber-50 to-orange-50 border border-amber-200/60 p-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsxs)("span",{className:"text-xs font-semibold text-amber-800 uppercase tracking-wide flex items-center gap-1",children:[(0,a.jsx)(i.A,{className:"h-3 w-3 text-amber-500"})," Get Inspired"]}),(0,a.jsx)(u(),{href:"/collections/life-events",className:"text-[11px] font-medium text-amber-700 hover:text-amber-900 hover:underline",onClick:g,children:"View All →"})]}),(0,a.jsx)("div",{className:"flex flex-col gap-1",children:y.collections.map((e,t)=>(0,a.jsxs)(u(),{href:e.slug,className:"flex items-center gap-2 px-2.5 py-2 rounded-md bg-white/70 hover:bg-white border border-amber-100 transition-colors",onClick:g,children:[(0,a.jsx)("span",{className:"flex items-center justify-center h-7 w-7 rounded-full bg-amber-100 text-amber-600 flex-shrink-0",children:(0,a.jsx)(i.A,{className:"h-3.5 w-3.5"})}),(0,a.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:e.title})]},"collection-".concat(t)))})]}),(()=>{let e=new Set,t=y.searches.filter(t=>{let r=p(t);return!e.has(r)&&(e.add(r),!0)});return t.length>0?(0,a.jsxs)("div",{className:"p-2 border-b border-gray-100",children:[(0,a.jsxs)("div",{className:"px-2 py-1 text-xs font-medium text-gray-500 uppercase tracking-wide flex items-center gap-1",children:[(0,a.jsx)(o.A,{className:"h-3 w-3"})," Popular Searches"]}),t.map((e,t)=>{let r=R++;return(0,a.jsxs)("button",{className:"w-full text-left px-3 py-2.5 sm:py-2 text-sm rounded-md transition-colors ".concat(j===r?"bg-gray-100":"hover:bg-gray-50"),onClick:()=>d(e),onMouseEnter:()=>N(r),children:[(0,a.jsx)(c.A,{className:"h-3 w-3 inline mr-2 text-gray-400"}),e]},"search-".concat(t))})]}):null})(),y.products.length>0&&(0,a.jsxs)("div",{className:"p-2",children:[(0,a.jsx)("div",{className:"px-2 py-1 text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Products"}),y.products.map((e,t)=>{let r=R++;return(0,a.jsxs)("button",{className:"w-full text-left px-3 py-2.5 sm:py-2 text-sm rounded-md flex items-center gap-3 transition-colors ".concat(j===r?"bg-gray-100":"hover:bg-gray-50"),onClick:()=>F(e),onMouseEnter:()=>N(r),children:[e.image&&(0,a.jsx)("img",{src:e.image,alt:"",className:"h-8 w-8 object-cover rounded flex-shrink-0"}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("div",{className:"truncate",children:e.title}),e.brand&&(0,a.jsx)("div",{className:"text-xs text-gray-500",children:e.brand})]})]},"product-".concat(t))})]}),y.brands.length>0&&(0,a.jsxs)("div",{className:"p-2 border-t border-gray-100",children:[(0,a.jsx)("div",{className:"px-2 py-1 text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Brands"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5 px-2 py-1",children:y.brands.map((e,t)=>{let r=R++;return(0,a.jsx)("button",{className:"px-3 py-1.5 sm:py-1 text-xs rounded-full border transition-colors ".concat(j===r?"bg-primary text-primary-foreground border-primary":"border-gray-200 hover:border-gray-300 text-gray-700"),onClick:()=>d(e),onMouseEnter:()=>N(r),children:e},"brand-".concat(t))})})]})]})]});return x&&"undefined"!=typeof document?(0,n.createPortal)((0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"fixed inset-0 z-[9998]",onClick:g}),P]}),document.body):P}function p(e){return e.normalize("NFKC").replace(/\s+/g," ").trim().toLowerCase()}},25192:(e,t,r)=>{r.d(t,{A:()=>f});var a=r(95155),s=r(12115);r(38225);
1var n=r(35695),l=r(50172),i=r(75074),o=r(10283);function c(e){let{onSubmit:t,placeholder:r="Search For Any Product...",initialQuery:c="",className:d="",autoFocus:u=!1,isLoading:m=!1,error:h,onQueryChange:g}=e,x=(0,n.useRouter)(),[p,f]=(0,s.useState)(c),[y,v]=(0,s.useState)(!1),b=(0,s.useRef)(null);(0,s.useEffect)(()=>{f(c)},[c]);let w=(0,s.useCallback)(e=>{if(e.trim().length>0){var r;(0,o.Tw)(e.trim()),v(!1),t(e),null===(r=b.current)||void 0===r||r.blur()}},[t]);return(0,a.jsxs)("div",{className:"relative w-full",children:[(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{ref:b,type:"text",value:p,onChange:e=>{let t=e.target.value.slice(0,200);f(t),null==g||g(t),v(!0)},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),w(p))},onFocus:()=>v(!0),placeholder:r,className:"w-full px-4 py-3 text-lg border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary focus:border-primary sm:pl-4 sm:pr-4 pl-4 pr-12 ".concat(d),maxLength:200,autoFocus:u,autoComplete:"off"}),(0,a.jsx)("div",{className:"sm:hidden",children:m?(0,a.jsx)("div",{className:"absolute right-3 top-1/2 -translate-y-1/2",children:(0,a.jsx)(l.A,{className:"h-4 w-4 animate-spin text-gray-500"})}):(0,a.jsx)("button",{onClick:()=>{w(p)},className:"absolute right-3 top-1/2 -translate-y-1/2 p-1 hover:bg-gray-100 rounded-full transition-colors",type:"button",children:(0,a.jsx)(i.A,{className:"h-5 w-5 text-gray-400 hover:text-gray-600"})})}),m&&(0,a.jsx)("div",{className:"hidden sm:block absolute right-3 top-1/2 -translate-y-1/2",children:(0,a.jsx)(l.A,{className:"h-4 w-4 animate-spin text-gray-500"})})]}),(0,a.jsx)(o.Ay,{query:p,isOpen:y&&!m,onSelect:e=>{f(e),null==g||g(e),w(e)},onProductClick:e=>{v(!1),x.push("/product/".concat(e))},onClose:()=>v(!1)}),h&&(0,a.jsx)("div",{className:"p-2 text-sm text-red-500",children:h})]})}var d=r(11133),u=r(62395),m=r(94088),h=r(52030);async function g(e,t){if(function(e){if(!e||0===e.trim().length)return!0;let t=e.trim(),r=/[\u4e00-\u9fa5]/.test(t),a=/[\u3040-\u309f\u30a0-\u30ff]/.test(t),s=/[\uac00-\ud7af]/.test(t),n=/[\u0600-\u06ff]/.test(t),l=/[\u0400-\u04ff]/.test(t),i=/[\u0e00-\u0e7f]/.test(t);if(r||a||s||n||l||i)return!1;let o=/[áéíóúüñ¿¡]/i.test(t),c=/[àâçéèêëïîôùûü]/i.test(t),d=/[äöüß]/i.test(t),u=/[ãõ]/i.test(t);if(o||c||d||u){var m;if(/\b(el|la|los|las|de|del|para|con|por|que|como|donde|cuando|cual|quien|porque)\b/i.test(t)||/\b(le|la|les|des|pour|avec|dans|sur|sous|ou|comment|quand|quel)\b/i.test(t))return!1;if(((null===(m=t.match(/[áéíóúüñàâçéèêëïîôùûüäöüßãõ]/gi))||void 0===m?void 0:m.length)||0)/t.length<.15)return!0}return/^[a-z0-9\s\-_.,'":!?()&]+$/i.test(t)}(e))return{translatedQuery:e,originalQuery:e,wasTranslated:!1};try{let r=await fetch("/api/translate/search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:e,locale:t})});if(!r.ok)throw Error("Translation failed");return await r.json()}catch(t){return console.error("Client-side translation failed:",t),{translatedQuery:e,originalQuery:e,wasTranslated:!1}}}var x=r(41927),p=r(30440);function f(e){let{onSelect:t,onSelectMultiple:r,initialQuery:o="",integrationId:f,placeholder:y,multiSelect:v=!1,maxSelections:b=5,className:w="",autoSearch:j=!1,onSearchResults:N,showPagedResults:k=!1,onSubmit:_,isLoading:C=!1,autoFocus:S=!1,locale:E="en"}=e,A=e=>(0,h.sC)(E,e),[L,T]=(0,s.useState)(o);(0,s.useEffect)(()=>{T(o)},[o]);let[F,R]=(0,s.useState)([]),[P,q]=(0,s.useState)([]),[D,I]=(0,s.useState)(null),[Q,z]=(0,s.useState)(null),[M,O]=(0,s.useState)(1),[U,W]=(0,s.useState)(!1),[B,H]=(0,s.use
1State)(!1),[J,K]=(0,s.useState)(1),[G,V]=(0,s.useState)(!1);(0,n.useRouter)();let $=(0,s.useCallback)(async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(e.trim()){I(null),H(!0);try{var r,a;let s=new URLSearchParams({query:e.trim(),page:t.toString(),limit:"24"});f&&s.append("integrationId",f);let n=await fetch("/api/products/search?".concat(s));if(!n.ok){let e=await n.json();throw Error(e.error||"Failed to search products")}let l=await n.json(),i=l.data||l,o=i.products||[];R(e=>1===t?o:[...e,...o]);let c=i.metadata||{};z({totalCount:c.totalCount||i.totalCount||0,timeTaken:c.timeTaken||i.timeTaken||0,source:(null===(r=c.sourcesUsed)||void 0===r?void 0:r.join(", "))||i.source||"unknown",fromCache:c.fromCache||!1}),V(i.hasMore||!1),K(t),N&&1===t&&N(o),1===t&&(0,p.c)(p.l.SEARCH_RESULTS_SHOWN,{results_count:o.length,total_count:c.totalCount||i.totalCount||0,source:(null===(a=c.sourcesUsed)||void 0===a?void 0:a.join(", "))||i.source||"unknown"})}catch(e){I(e instanceof Error?e.message:"Failed to search products"),R([]),z(null),V(!1)}H(!1)}},[f,N]),X=async e=>{let t="string"==typeof e?e:L;if(!t.trim())return;let r=t.trim();_&&_(r);let a=r;try{let e=await g(r,E);a=e.translatedQuery,e.wasTranslated}catch(e){console.error("Translation failed, using original query:",e)}try{(0,m.Ar)({search_string:r,content_category:"product_search"}),(0,x.y)("search")}catch(e){console.error("Error tracking Search event:",e)}(0,p.c)(p.l.SEARCH_STARTED,{query:r,query_length:r.length}),W(!0),O(1),K(1),await $(a,1),T(r)},Y=e=>{let t=P.filter(t=>t.id!==e);q(t),r&&r(t)};return(0,s.useEffect)(()=>{j&&o&&$(o,1)},[j,o,$]),(0,a.jsxs)("div",{className:"space-y-4 ".concat(w),children:[(0,a.jsx)("div",{className:"sm:hidden",children:(0,a.jsx)(c,{onSubmit:X,placeholder:y||A("search.searchPlaceholder"),initialQuery:o,isLoading:B,error:D||void 0,onQueryChange:T,autoFocus:S})}),(0,a.jsxs)("div",{className:"hidden sm:flex gap-2",children:[(0,a.jsx)("div",{className:"flex-1",children:(0,a.jsx)(c,{onSubmit:X,placeholder:y||A("search.searchPlaceholder"),initialQuery:o,isLoading:B,error:D||void 0,onQueryChange:T,autoFocus:S})}),(0,a.jsx)("button",{type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation(),X()},disabled:B,className:"px-6 py-3 bg-primary text-primary-foreground rounded-md hover:bg-primary/90 flex items-center disabled:opacity-50 min-h-[52px] touch-manipulation relative z-10 font-medium text-lg",children:B?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.A,{className:"h-4 w-4 animate-spin mr-2"}),A("search.searching")]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.A,{className:"h-4 w-4 mr-2"}),A("search.search")]})})]}),Q&&F.length>0&&k&&(0,a.jsxs)("div",{className:"text-xs text-gray-500",children:["Found ",Q.totalCount," products in ",Q.timeTaken,"ms"]}),D&&!C&&(0,a.jsxs)("div",{className:"flex items-center text-sm text-red-500",children:[(0,a.jsx)(d.A,{className:"h-4 w-4 mr-1"}),D]}),U&&k&&(0,a.jsxs)("div",{className:"mt-8 space-y-4",children:[(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:F.map(e=>{var t,r,s,n,l,i,o;return(0,a.jsx)(u.ProductCard,{id:e.id,title:e.title,description:e.description||"",price:e.price||0,original_price:null!==(n=e.original_price)&&void 0!==n?n:null,currency_code:(null===(t=e.metadata)||void 0===t?void 0:t.currency_code)||"USD",image_urls:null!==(l=e.image_urls)&&void 0!==l?l:null,rating:void 0!==e.rating?e.rating:null,category:e.category,affiliate_url:e.affiliate_url,direct_url:e.direct_url,integration_type:e.integration_type,external_id:e.external_id,brand:e.brand,status:"published",on_sale:null!==(i=e.on_sale)&&void 0!==i?i:null,sale_discount:null!==(o=e.sale_discount)&&void 0!==o?o:null,review_count:e.review_count,slug:e.slug||"",created_at:e.created_at||new Date().toISOString(),collection_id:(null===(r=e.metadata)||void 0===r?void 0:r.collection_id)||"",collection_title:(null===(s=e.metadata)||void 0===s?void 0:s.collection_title)||"",metadata:{...e.metadata,integration_type:e.integration_type},showBottomActions:!0},e.id)})}),G&&(0,a.jsx)("div",{className:"flex justify-center mt-4",children:(0,a.jsx)("button",{onClick:()=>{!C&&G&&$(L,J+1)},disabled:C||B,className:"px-4 py-2 bg-secondary text-secondary-foreground rounded-md hover:bg-secondary/90 disabled:opacity-50",children:C||B?"Loading...":"Show More Results"})})]}),v&&P.length>0&&(0,a.jsxs)("div",{className:"mt-4",children:[(0,a.jsxs)("h4",{className:"text-sm font-medium mb-2",children:["Selected Products (",P.length,"/",b,")"]}),(0,a.jsx)("ul",{className:"space-y-2",children:P.map(e=>(0,a.jsxs)("li",{className:"flex items-center justify-between p-2 bg-gray-50 rounded-md",children:[(0,a.jsxs)("div",{className:"flex items-center",children:[e.image_urls&&e.image_urls[0]&&(0,a.jsx)("img",{src:e.image_urls[0],alt:e.title,className:"h-8 w-8 object-cover rounded mr-2"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:e.title}),e.brand&&(0,a.jsx)("p",{className:"text-xs text-gray-500",children:e.brand})]})]}),(0,a.jsx)("button",{type:"button",onClick:()=>Y(e.id),className:"text-gray-400 hover:text-red-500",children:(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},e.id))})]})]})}},38225:(e,t,r)=>{r.d(t,{o:()=>a});let a={INTERNAL:"internal",AFFILIATE:"affiliate.com",PA_API:"pa_api"}}}]);

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.