1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4812],{3606:function(e,r,n){n.d(r,{fi:function(){return a},gE:function(){return u}}),n(43503);var t=n(99976),a=(0,t.$)("bed9a4867cdadc734d9a6296be80de74d461755d");(0,t.$)("27533766fd4f52fc0c6921f49c7af268f1a0b425"),(0,t.$)("114433065d6379f0b691dafa58d1abfc94e81d48"),(0,t.$)("d1433b7b9b5aa82992af774111002a9c164177ee"),(0,t.$)("a84135c0ca2583fdd7abc357f550059a9a0e6096");var u=(0,t.$)("1a5ef51bd766a214c730bec768696cc171a52dba");(0,t.$)("34a5724bee7db5c54c1f6af30727aed11c003842")},81292:function(e,r,n){n.r(r),n.d(r,{ProductLookup:function(){return x}});var t=n(27573),a=n(47578),u=n(3606),c=n(44992),i=n(7653),s=n(89382),l=n(60127),o=n(85107),d=n(95731),f=n(75721),m=n(29986);function h(e){let{onSearch:r,onSelect:n,renderOption:a,getItemKey:u,placeholder:c="Search...",emptyMessage:h="No results found. Try a different search.",loadingMessage:x="Searching...",minQueryLength:p=2,maxResults:b=5,debounceMs:v=300,disabled:g=!1,className:N,inputClassName:y,dropdownClassName:j}=e,[w,k]=(0,i.useState)(""),[R]=(0,s.Nr)(w,v),[S,E]=(0,i.useState)([]),[C,I]=(0,i.useState)(!1),[D,$]=(0,i.useState)(!1),[F,O]=(0,i.useState)(!1),_=(0,i.useRef)(null);(0,i.useEffect)(()=>{let e=R.trim();if(!e||e.length<p){E([]),O(!1);return}let n=!1;return O(!0),I(!0),r(e).then(e=>{n||(E(Array.isArray(e)?e:[]),I(!1))}).catch(()=>{n||(I(!1),E([]))}),()=>{n=!0}},[R,p,r]),(0,i.useEffect)(()=>{w.trim().length>=p&&$(!0)},[w,p]),(0,i.useEffect)(()=>{function e(e){_.current&&!_.current.contains(e.target)&&$(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let A=(0,i.useCallback)(e=>{n(e),k(""),E([]),O(!1),$(!1)},[n]),T=D&&w.trim().length>=p,Z=F&&!C&&0===S.length,q=S.slice(0,b),L=(0,i.useCallback)(e=>{"Enter"===e.key&&T&&q.length>0&&(e.preventDefault(),A(q[0]))},[T,q,A]);return(0,t.jsxs)("div",{ref:_,className:(0,m.cn)("relative",N),children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(d.Z,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),(0,t.jsx)(l.I,{placeholder:c,value:w,onChange:e=>k(e.target.value),onFocus:()=>w.trim().length>=p&&$(!0),onKeyDown:L,disabled:g,className:(0,m.cn)("pl-9 pr-3",y),"aria-expanded":T,"aria-busy":C})]}),T&&(0,t.jsx)("div",{className:(0,m.cn)("absolute top-full left-0 right-0 z-50 mt-1 overflow-auto rounded-lg border bg-popover shadow-lg","min-h-[2rem]",j),role:"listbox",children:(0,t.jsx)("div",{className:"animate-in fade-in-0 zoom-in-95 duration-200",children:C?(0,t.jsxs)("div",{className:"p-2",role:"status","aria-live":"polite","aria-label":x,children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 px-2 py-2 text-sm text-muted-foreground",children:[(0,t.jsx)(f.Z,{className:"h-4 w-4 shrink-0 animate-spin","aria-hidden":!0}),(0,t.jsx)("span",{children:x})]}),(0,t.jsx)("div",{className:"space-y-2 px-2 pb-2",children:[1,2,3].map(e=>(0,t.jsxs)("div",{className:"flex items-center gap-3 p-3",children:[(0,t.jsx)(o.O,{className:"h-10 w-10 shrink-0 rounded-md"}),(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1.5",children:[(0,t.jsx)(o.O,{className:"h-3.5 w-3/4"}),(0,t.jsx)(o.O,{className:"h-3 w-1/2"})]})]},e))})]}):Z?(0,t.jsx)("div",{className:"p-4 text-center text-sm text-muted-foreground transition-opacity duration-200",children:h}):(0,t.jsx)("div",{className:"transition-opacity duration-200",children:q.map(e=>(0,t.jsx)("button",{type:"button",role:"option",className:"flex w-full items-center gap-3 border-b border-border/50 p-3 text-left transition-colors last:border-0 hover:bg-muted/80",onClick:()=>A(e),children:a(e)},u(e)))})})})]})}function x(e){let{placeholder:r="Search by ID or name...",onSelect:n,className:i,disabled:s,inputClassName:l="h-12",emptyMessage:o="No products found. Try a different ID or name.",maxResults:d=5}=e,f=async e=>{var r;let n=await (0,u.fi)(e);return(0,c.R)(n)?[]:null!==(r=n.data)&&void 0!==r?r:[]};return(0,t.jsx)(h,{onSearch:f,onSelect:n,getItemKey:e=>e.id,placeholder:r,emptyMessage:o,minQueryLength:2,maxResults:d,disabled:s,className:i,inputClassName:l,dropdownClassName:"max-h-[min(45vh,14rem)] sm:max-h-[min(50vh,24rem)]",renderOption:e=>(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"relative h-10 w-10 shrink-0 overflow-hidden rounded-md bg-muted",children:e.thumbnail_image?(0,t.jsx)(a.Z,{src:e.thumbnail_image,alt:e.name,loading:"lazy",className:"h-full w-full object-cover"}):(0,t.jsx)("div",{className:"flex h-full w-full items-center justify-center text-xs text-muted-foreground",children:"â"})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("p",{className:"truncate text-sm font-medium",children:e.name}),(0,t.jsx)("p",{className:"truncate text-xs text-muted-foreground",children:e.productId?"ID: ".concat(e.productId):e.id})]})]})})}},60127:function(e,r,n){n.d(r,{I:function(){return c}});var t=n(27573),a=n(7653),u=n(29986);let c=a.forwardRef((e,r)=>{let{className:n,type:a,...c}=e;return(0,t.jsx)("input",{type:a,className:(0,u.cn)("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",n),ref:r,...c})});c.displayName="Input"},95731:function(e,r,n){n.d(r,{Z:function(){return t}});let t=(0,n(2389).Z)("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]])},89382:function(e,r,n){n.d(r,{Nr:function(){return u}});var t=n(7653);function a(e,r){return e===r}function u(e,r,n){var u=n&&n.equalityFn||a,c=(0,t.useRef)(e),i=(0,t.useState)({})[1],s=function(e,r,n){var a=this,u=(0,t.useRef)(null),c=(0,t.useRef)(0),i=(0,t.useRef)(null),s=(0,t.useRef)([]),l=(0,t.useRef)(),o=(0,t.useRef)(),d=(0,t.useRef)(e),f=(0,t.useRef)(!0);d.current=e;var m="undefined"!=typeof window,h=!r&&0!==r&&m;if("function"!=typeof e)throw TypeError("Expected a function");r=+r||0;var x=!!(n=n||{}).leading,p=!("trailing"in n)||!!n.trailing,b="maxWait"in n,v="debounceOnServer"in n&&!!n.debounceOnServer,g=b?Math.max(+n.maxWait||0,r):null;return(0,t.useEffect)(function(){return f.current=!0,function(){f.current=!1}},[]),(0,t.useMemo)(function(){var e=function(e){var r=s.current,n=l.current;return s.current=l.current=null,c.current=e,o.current=d.current.apply(n,r)},n=function(e,r){h&&cancelAnimationFrame(i.current),i.current=h?requestAnimationFrame(e):setTimeout(e,r)},t=function(e){if(!f.current)return!1;var n=e-u.current;return!u.current||n>=r||n<0||b&&e-c.current>=g},N=function(r){return i.current=null,p&&s.current?e(r):(s.current=l.current=null,o.current)},y=function e(){var a=Date.now();if(t(a))return N(a);if(f.current){var i=r-(a-u.current);n(e,b?Math.min(i,g-(a-c.current)):i)}},j=function(){if(m||v){var d=Date.now(),h=t(d);if(s.current=[].slice.call(arguments),l.current=a,u.current=d,h){if(!i.current&&f.current)return c.current=u.current,n(y,r),x?e(u.current):o.current;if(b)return n(y,r),e(u.current)}return i.current||n(y,r),o.current}};return j.cancel=function(){i.current&&(h?cancelAnimationFrame(i.current):clearTimeout(i.current)),c.current=0,s.current=u.current=l.current=i.current=null},j.isPending=function(){return!!i.current},j.flush=function(){return i.current?N(Date.now()):o.current},j},[x,b,r,g,p,h,m,v])}((0,t.useCallback)(function(e){c.current=e,i({})},[i]),r,n),l=(0,t.useRef)(e);return u(l.current,e)||(s(e),l.current=e),[c.current,s]}}}]);
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.