1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[185],{8028:function(e,t,r){Promise.resolve().then(r.t.bind(r,7960,23)),Promise.resolve().then(r.bind(r,2611)),Promise.resolve().then(r.bind(r,9556)),Promise.resolve().then(r.t.bind(r,2972,23)),Promise.resolve().then(r.t.bind(r,9073,23)),Promise.resolve().then(r.t.bind(r,7455,23))},2611:function(e,t,r){"use strict";r.d(t,{default:function(){return x}});var s=r(7437),a=r(2265),n=r(7648),o=r(9376),i=r(1391),d=r(2369),l=r(7692),c=r(2489),u=r(6840),m=r(4190),f=r(2869),p=r(9180),h=r(6023);function x(){let e=(0,o.usePathname)(),t=(0,o.useRouter)(),[r,x]=(0,a.useState)(!1),[g,v]=(0,a.useState)(!1),{user:y,loading:b}=(0,p.x)(),N=[{href:"/",label:"Home"},{href:"/feed",label:"Feed"},{href:"/products",label:"Products"},{href:"/analysis",label:"Analysis"},{href:"/chatbot",label:"Chatbot"}];(0,a.useEffect)(()=>{let e=()=>{x(window.scrollY>0)};return window.addEventListener("scroll",e),()=>window.removeEventListener("scroll",e)},[]);let j=()=>{(0,h.kS)(),t.push("/login")};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("nav",{className:"fixed w-full top-0 z-50 transition-all duration-300 ".concat(r?"bg-white/80 backdrop-blur-md dark:bg-gray-900/80 shadow-lg":"bg-white dark:bg-gray-900"),children:(0,s.jsxs)("div",{className:"container mx-auto px-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between h-16",children:[(0,s.jsx)("div",{className:"flex-shrink-0",children:(0,s.jsx)(i.T,{})}),(0,s.jsxs)("div",{className:"hidden md:flex md:items-center md:space-x-1",children:[N.map(t=>(0,s.jsxs)(n.default,{href:t.href,className:"relative px-4 py-2 rounded-md text-sm font-medium transition-all duration-200 \n ".concat(e===t.href?"text-primary bg-primary/10":"text-gray-700 dark:text-gray-200 hover:text-primary hover:bg-primary/5","\n group\n "),children:[t.label,(0,s.jsx)("span",{className:"absolute bottom-0 left-0 w-full h-0.5 bg-primary transform origin-left transition-transform duration-200 \n ".concat(e===t.href?"scale-x-100":"scale-x-0 group-hover:scale-x-100")})]},t.href)),!b&&(0,s.jsx)(s.Fragment,{children:y?(0,s.jsxs)(m.h_,{children:[(0,s.jsx)(m.$F,{asChild:!0,children:(0,s.jsx)(f.z,{variant:"ghost",className:"relative h-8 w-8 rounded-full",children:(0,s.jsx)(d.Z,{className:"h-5 w-5"})})}),(0,s.jsxs)(m.AW,{align:"end",className:"w-56",children:[(0,s.jsx)(m.Xi,{asChild:!0,children:(0,s.jsxs)(n.default,{href:"/profile",className:"flex items-center",children:[(0,s.jsx)(d.Z,{className:"mr-2 h-4 w-4"}),(0,s.jsx)("span",{children:"Profile"})]})}),(0,s.jsxs)(m.Xi,{onClick:j,className:"text-red-600",children:[(0,s.jsx)(l.Z,{className:"mr-2 h-4 w-4"}),(0,s.jsx)("span",{children:"Logout"})]})]})]}):(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(f.z,{asChild:!0,variant:"ghost",children:(0,s.jsx)(n.default,{href:"/login",children:"Login"})}),(0,s.jsx)(f.z,{asChild:!0,children:(0,s.jsx)(n.default,{href:"/register",children:"Join"})})]})})]}),(0,s.jsx)("div",{className:"md:hidden",children:(0,s.jsx)("button",{onClick:()=>v(!g),className:"inline-flex items-center justify-center p-2 rounded-md text-gray-700 dark:text-gray-200 hover:text-primary hover:bg-primary/5 focus:outline-none",children:g?(0,s.jsx)(c.Z,{className:"h-6 w-6"}):(0,s.jsx)(u.Z,{className:"h-6 w-6"})})})]}),(0,s.jsx)("div",{className:"md:hidden transition-all duration-300 ease-in-out ".concat(g?"max-h-screen opacity-100 py-4":"max-h-0 opacity-0 overflow-hidden"),children:(0,s.jsxs)("div",{className:"flex flex-col space-y-2 pb-3",children:[N.map(t=>(0,s.jsx)(n.default,{href:t.href,onClick:()=>v(!1),className:"px-4 py-2 rounded-md text-sm font-medium transition-colors ".concat(e===t.href?"text-primary bg-primary/10":"text-gray-700 dark:text-gray-200 hover:text-primary hover:bg-primary/5"),children:t.label},t.href)),!b&&(0,s.jsx)(s.Fragment,{children:y?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.default,{href:"/profile",onClick:()=>v(!1),className:"px-4 py-2 rounded-md text-sm font-medium text-gray-700 dark:text-gray-200 hover:text-primary hover:bg-primary/5",children:"Profile"}),(0,s.jsx)("button",{onClick:()=>{j(),v(!1)},className:"px-4 py-2 rounded-md text-sm font-medium text-red-600 hover:bg-red-50 text-left w-full",children:"Logout"})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.default,{href:"/login",onClick:()=>v(!1),className:"px-4 py-2 rounded-md text-sm font-medium text-gray-700 dark:text-gray-200 hover:text-primary hover:bg-primary/5",children:"Login"}),(0,s.jsx)(n.default,{href:"/register",onClick:()=>v(!1),className:"px-4 py-2 rounded-md text-sm font-medium text-primary bg-primary/10 hover:bg-primary/20",children:"Join"})]})})]})})]})}),(0,s.jsx)("div",{className:"h-16"})]})}},1391:function(e,t,r){"use strict";r.d(t,{T:function(){return o}});var s=r(7437),a=r(9547),n=r(7648);function o(){return(0,s.jsxs)(n.default,{href:"/",className:"flex items-center gap-2",children:[(0,s.jsx)(a.Z,{className:"h-8 w-8 text-primary"}),(0,s.jsx)("span",{className:"text-xl font-bold text-primary",children:"CropChain"})]})}},2869:function(e,t,r){"use strict";r.d(t,{d:function(){return d},z:function(){return l}});var s=r(7437),a=r(2265),n=r(7053),o=r(535),i=r(4508);let d=(0,o.j)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),l=a.forwardRef((e,t)=>
1{let{className:r,variant:a,size:o,asChild:l=!1,...c}=e,u=l?n.g7:"button";return(0,s.jsx)(u,{className:(0,i.cn)(d({variant:a,size:o,className:r})),ref:t,...c})});l.displayName="Button"},4190:function(e,t,r){"use strict";r.d(t,{$F:function(){return u},AW:function(){return m},Xi:function(){return f},h_:function(){return c}});var s=r(7437),a=r(2265),n=r(3618),o=r(407),i=r(401),d=r(519),l=r(4508);let c=n.fC,u=n.xz;n.ZA,n.Uv,n.Tr,n.Ee,a.forwardRef((e,t)=>{let{className:r,inset:a,children:i,...d}=e;return(0,s.jsxs)(n.fF,{ref:t,className:(0,l.cn)("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",a&&"pl-8",r),...d,children:[i,(0,s.jsx)(o.Z,{className:"ml-auto"})]})}).displayName=n.fF.displayName,a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.tu,{ref:t,className:(0,l.cn)("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",r),...a})}).displayName=n.tu.displayName;let m=a.forwardRef((e,t)=>{let{className:r,sideOffset:a=4,...o}=e;return(0,s.jsx)(n.Uv,{children:(0,s.jsx)(n.VY,{ref:t,sideOffset:a,className:(0,l.cn)("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",r),...o})})});m.displayName=n.VY.displayName;let f=a.forwardRef((e,t)=>{let{className:r,inset:a,...o}=e;return(0,s.jsx)(n.ck,{ref:t,className:(0,l.cn)("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",a&&"pl-8",r),...o})});f.displayName=n.ck.displayName,a.forwardRef((e,t)=>{let{className:r,children:a,checked:o,...d}=e;return(0,s.jsxs)(n.oC,{ref:t,className:(0,l.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r),checked:o,...d,children:[(0,s.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,s.jsx)(n.wU,{children:(0,s.jsx)(i.Z,{className:"h-4 w-4"})})}),a]})}).displayName=n.oC.displayName,a.forwardRef((e,t)=>{let{className:r,children:a,...o}=e;return(0,s.jsxs)(n.Rk,{ref:t,className:(0,l.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r),...o,children:[(0,s.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,s.jsx)(n.wU,{children:(0,s.jsx)(d.Z,{className:"h-2 w-2 fill-current"})})}),a]})}).displayName=n.Rk.displayName,a.forwardRef((e,t)=>{let{className:r,inset:a,...o}=e;return(0,s.jsx)(n.__,{ref:t,className:(0,l.cn)("px-2 py-1.5 text-sm font-semibold",a&&"pl-8",r),...o})}).displayName=n.__.displayName,a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.Z0,{ref:t,className:(0,l.cn)("-mx-1 my-1 h-px bg-muted",r),...a})}).displayName=n.Z0.displayName},9556:function(e,t,r){"use strict";r.d(t,{Toaster:function(){return g}});var s=r(7437),a=r(5153),n=r(2265),o=r(7263),i=r(535),d=r(2489),l=r(4508);let c=o.zt,u=n.forwardRef((e,t)=>
1{let{className:r,...a}=e;return(0,s.jsx)(o.l_,{ref:t,className:(0,l.cn)("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",r),...a})});u.displayName=o.l_.displayName;let m=(0,i.j)("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),f=n.forwardRef((e,t)=>{let{className:r,variant:a,...n}=e;return(0,s.jsx)(o.fC,{ref:t,className:(0,l.cn)(m({variant:a}),r),...n})});f.displayName=o.fC.displayName,n.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(o.aU,{ref:t,className:(0,l.cn)("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",r),...a})}).displayName=o.aU.displayName;let p=n.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(o.x8,{ref:t,className:(0,l.cn)("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",r),"toast-close":"",...a,children:(0,s.jsx)(d.Z,{className:"h-4 w-4"})})});p.displayName=o.x8.displayName;let h=n.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(o.Dx,{ref:t,className:(0,l.cn)("text-sm font-semibold [&+div]:text-xs",r),...a})});h.displayName=o.Dx.displayName;let x=n.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(o.dk,{ref:t,className:(0,l.cn)("text-sm opacity-90",r),...a})});function g(){let{toasts:e}=(0,a.pm)();return(0,s.jsxs)(c,{children:[e.map(function(e){let{id:t,title:r,description:a,action:n,...o}=e;return(0,s.jsxs)(f,{...o,children:[(0,s.jsxs)("div",{className:"grid gap-1",children:[r&&(0,s.jsx)(h,{children:r}),a&&(0,s.jsx)(x,{children:a})]}),n,(0,s.jsx)(p,{})]},t)}),(0,s.jsx)(u,{})]})}x.displayName=o.dk.displayName},9180:function(e,t,r){"use strict";r.d(t,{x:function(){return o}});var s=r(2265),a=r(6023),n=r(9116);let o=()=>
1{let[e,t]=(0,s.useState)(null),[r,o]=(0,s.useState)(!0),[i,d]=(0,s.useState)(null);return(0,s.useEffect)(()=>{(async()=>{try{{let e=(0,a.ts)();if(!e){o(!1);return}if(t(e),e.userId)try{let r=(await n.BG.getById(e.userId)).data;t({...e,...r})}catch(e){console.error("Error fetching complete user data:",e)}}}catch(e){console.error("Error in useCurrentUser hook:",e),d("Failed to load user data")}finally{o(!1)}})()},[]),{user:e,loading:r,error:i,isAuthenticated:(0,a.$8)()}}},5153:function(e,t,r){"use strict";r.d(t,{Am:function(){return u},pm:function(){return m}});var s=r(2265);let a=0,n=new Map,o=e=>{if(n.has(e))return;let t=setTimeout(()=>{n.delete(e),c({type:"REMOVE_TOAST",toastId:e})},1e6);n.set(e,t)},i=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case"DISMISS_TOAST":{let{toastId:r}=t;return r?o(r):e.toasts.forEach(e=>{o(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===r||void 0===r?{...e,open:!1}:e)}}case"REMOVE_TOAST":if(void 0===t.toastId)return{...e,toasts:[]};return{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},d=[],l={toasts:[]};function c(e){l=i(l,e),d.forEach(e=>{e(l)})}function u(e){let{...t}=e,r=(a=(a+1)%Number.MAX_SAFE_INTEGER).toString(),s=()=>c({type:"DISMISS_TOAST",toastId:r});return c({type:"ADD_TOAST",toast:{...t,id:r,open:!0,onOpenChange:e=>{e||s()}}}),{id:r,dismiss:s,update:e=>c({type:"UPDATE_TOAST",toast:{...e,id:r}})}}function m(){let[e,t]=s.useState(l);return s.useEffect(()=>(d.push(t),()=>{let e=d.indexOf(t);e>-1&&d.splice(e,1)}),[e]),{...e,toast:u,dismiss:e=>c({type:"DISMISS_TOAST",toastId:e})}}},9116:function(e,t,r){"use strict";r.d(t,{BG:function(){return a},Fr:function(){return n},kp:function(){return o},zS:function(){return i}});let s=r(3464).Z.create({baseURL:"/api"});s.interceptors.request.use(e=>{let t=localStorage.getItem("auth_token")||sessionStorage.getItem("auth_token");return t&&(e.headers.Authorization="Bearer ".concat(t)),e});let a={getAll:()=>s.get("/users"),getById:e=>s.get("/users/".concat(e)),update:(e,t)=>s.put("/users/".concat(e),t),delete:e=>s.delete("/users/".concat(e))},n={getAll:()=>s.get("/products"),getById:e=>s.get("/products/".concat(e)),create:e=>s.post("/products",e),update:(e,t)=>s.put("/products/".concat(e),t),delete:e=>s.delete("/products/".concat(e)),getByCategory:e=>s.get("/products/category/".concat(e)),getBySeller:e=>s.get("/products/seller/".concat(e))},o={getAll:()=>s.get("/crop-issues"),getById:e=>s.get("/crop-issues/".concat(e)),create:e=>s.post("/crop-issues",e),delete:e=>s.delete("/crop-issues/".concat(e)),like:(e,t)=>s.post("/crop-issues/".concat(e,"/like"),{userId:t}),unlike:(e,t)=>s.delete("/crop-issues/".concat(e,"/like"),{data:{userId:t}}),getComments:e=>s.get("/crop-issues/".concat(e,"/comments")),comment:(e,t)=>s.post("/crop-issues/".concat(e,"/comments"),t),deleteComment:(e,t)=>s.delete("/crop-issues/".concat(e,"/comments/").concat(t))},i={getAll:()=>s.get("/research-posts"),getById:e=>s.get("/research-posts/".concat(e)),create:e=>s.post("/research-posts",e),update:(e,t)=>s.put("/research-posts/".concat(e),t),delete:e=>s.delete("/research-posts/".concat(e)),like:(e,t)=>s.post("/research-posts/".concat(e,"/like"),{userId:t}),unlike:(e,t)=>s.delete("/research-posts/".concat(e,"/like"),{data:{userId:t}}),getComments:e=>s.get("/research-posts/".concat(e,"/comments")),comment:(e,t)=>s.post("/research-posts/".concat(e,"/comments"),t),deleteComment:(e,t)=>s.delete("/research-posts/".concat(e,"/comments/").concat(t))}},6023:function(e,t,r){"use strict";function s(e){localStorage.setItem("auth_token",e);try{let t=o(e);t&&t.userId&&localStorage.setItem("user_id",t.userId.toString())}catch(e){console.error("Error saving user data:",e)}window.location.reload()}r.d(t,{$8:function(){return d},Fr:function(){return s},kS:function(){return l},ts:function(){return i}});let a=()=>localStorage.getItem("auth_token"),n=()=>{{let e=localStorage.getItem("user_id");return e?parseInt(e,10):null}},o=e=>{try{let t=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),r=decodeURIComponent(atob(t).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(r)}catch(e){return console.error("Error decoding token:",e),null}},i=()=>{let e=a();if(!e){let e=n();return e?{userId:e}:null}return o(e)},d=()=>!!(a()||n()),l=()=>{localStorage.removeItem("auth_token"),localStorage.removeItem("user_id"),window.location.reload()}},4508:function(e,t,r){"use strict";r.d(t,{cn:function(){return n}});var s=r(1994),a=r(3335);function n(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,a.m6)((0,s.W)(t))}},7960:function(){}},function(e){e.O(0,[77,203,648,464,142,746,501,302,971,117,744],function(){return e(e.s=8028)}),_N_E=e.O()}]);
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.