module.exports=[46893,a=>{"use strict";var b=a.i(87924),c=a.i(97895);function d({className:a,...d}){return(0,b.jsx)("textarea",{"data-slot":"textarea",className:(0,c.cn)("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",a),...d})}a.s(["Textarea",()=>d])},98091,a=>{"use strict";let b=(0,a.i(70106).default)("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);a.s(["default",()=>b])},9804,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(40695),e=a.i(98091),e=e,f=a.i(5784),g=a.i(71630),h=a.i(45404),i=a.i(23292);function j({questionId:a,initialUpvotes:j}){let[k,l]=(0,c.useState)(j),[m,n]=(0,c.useState)(!1),{user:o}=(0,h.useAuth)(),p=async b=>{if(!o)return void i.toast.error("Please log in to vote");n(!0);try{await (0,g.fetchApi)("forum.php",{method:"PUT",body:JSON.stringify({question_id:a,vote_type:b})}),l(a=>"up"===b?a+1:a-1),i.toast.success("Vote recorded")}catch(a){i.toast.error(a.message||"Failed to record vote")}finally{n(!1)}};return(0,b.jsxs)("div",{className:"w-12 sm:w-16 bg-muted/20 flex flex-col items-center py-4 gap-1 border-r",children:[(0,b.jsx)(d.Button,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:text-primary",onClick:()=>p("up"),disabled:m,children:(0,b.jsx)(e.default,{className:"h-6 w-6"})}),(0,b.jsx)("span",{className:"font-bold text-sm",children:k}),(0,b.jsx)(d.Button,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:text-destructive",onClick:()=>p("down"),disabled:m,children:(0,b.jsx)(f.ChevronDown,{className:"h-6 w-6"})})]})}a.s(["VoteButtons",()=>j],9804)},20398,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(95245),e=a.i(59501),f=a.i(99614),g=a.i(40695),h=a.i(46893),i=a.i(71630),j=a.i(45404),k=a.i(23292),l=a.i(50944),m=a.i(38246);let n=f.object({content:f.string().min(10,{message:"Reply must be at least 10 characters."})});function o({questionId:a}){let[f,o]=(0,c.useState)(!1),{user:p}=(0,j.useAuth)(),q=(0,l.useRouter)(),{register:r,handleSubmit:s,reset:t,formState:{errors:u}}=(0,d.useForm)({resolver:(0,e.zodResolver)(n),defaultValues:{content:""}});async function v(b){if(!p){k.toast.error("Please log in to reply"),q.push("/login");return}o(!0);try{await (0,i.fetchApi)("replies.php",{method:"POST",body:JSON.stringify({question_id:a,content:b.content})}),k.toast.success("Reply posted successfully!"),t(),q.refresh()}catch(a){k.toast.error(a.message||"Failed to post reply")}finally{o(!1)}}return(0,b.jsxs)("div",{className:"pt-4",children:[(0,b.jsx)("h3",{className:"text-lg font-bold mb-4",children:"Leave a Reply"}),(0,b.jsxs)("form",{onSubmit:s(v),className:"space-y-4",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(h.Textarea,{placeholder:p?"Share your experience or offer support...":"Please log in to share your experience.",className:"min-h-[150px] bg-background border-none shadow-sm resize-none focus-visible:ring-primary/20",disabled:!p||f,...r("content")}),u.content&&(0,b.jsx)("p",{className:"text-xs font-medium text-destructive",children:u.content.message})]}),(0,b.jsx)(g.Button,{type:"submit",className:"w-full sm:w-auto px-8 font-bold",disabled:!p||f,children:f?"Posting...":"Post Reply"}),!p&&(0,b.jsxs)("div",{className:"flex flex-col items-center gap-3 mt-4 p-6 bg-muted/50 rounded-xl border border-dashed",children:[(0,b.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:"You must be logged in to participate in the discussion."}),(0,b.jsxs)("div",{className:"flex gap-3",children:[(0,b.jsx)(g.Button,{variant:"outline",asChild:!0,size:"sm",children:(0,b.jsx)(m.default,{href:"/login",children:"Log In"})}),(0,b.jsx)(g.Button,{asChild:!0,size:"sm",children:(0,b.jsx)(m.default,{href:"/register",children:"Sign Up"})})]})]})]})]})}a.s(["ReplyForm",()=>o])}];

//# sourceMappingURL=_e493d4f5._.js.map