(()=>{var e={};e.id=3439,e.ids=[3439],e.modules={53524:e=>{"use strict";e.exports=require("@prisma/client")},47849:e=>{"use strict";e.exports=require("next/dist/client/components/action-async-storage.external")},72934:e=>{"use strict";e.exports=require("next/dist/client/components/action-async-storage.external.js")},55403:e=>{"use strict";e.exports=require("next/dist/client/components/request-async-storage.external")},54580:e=>{"use strict";e.exports=require("next/dist/client/components/request-async-storage.external.js")},94749:e=>{"use strict";e.exports=require("next/dist/client/components/static-generation-async-storage.external")},45869:e=>{"use strict";e.exports=require("next/dist/client/components/static-generation-async-storage.external.js")},20399:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},50852:e=>{"use strict";e.exports=require("async_hooks")},32081:e=>{"use strict";e.exports=require("child_process")},82361:e=>{"use strict";e.exports=require("events")},57147:e=>{"use strict";e.exports=require("fs")},73292:e=>{"use strict";e.exports=require("fs/promises")},22037:e=>{"use strict";e.exports=require("os")},71017:e=>{"use strict";e.exports=require("path")},76224:e=>{"use strict";e.exports=require("tty")},73837:e=>{"use strict";e.exports=require("util")},33005:(e,t,s)=>{"use strict";s.r(t),s.d(t,{GlobalError:()=>l.ZP,__next_app__:()=>x,originalPathname:()=>c,pages:()=>o,routeModule:()=>m,tree:()=>d});var r=s(50482),a=s(69108),l=s(83543),i=s(68300),n={};for(let e in i)0>["default","tree","pages","GlobalError","originalPathname","__next_app__","routeModule"].indexOf(e)&&(n[e]=()=>i[e]);s.d(t,n);let d=["",{children:["admin",{children:["messages",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(s.bind(s,80387)),"C:\\test2\\pagecraft-ai\\src\\app\\admin\\messages\\page.tsx"]}]},{}]},{layout:[()=>Promise.resolve().then(s.bind(s,82050)),"C:\\test2\\pagecraft-ai\\src\\app\\admin\\layout.tsx"],loading:[()=>Promise.resolve().then(s.bind(s,98338)),"C:\\test2\\pagecraft-ai\\src\\app\\admin\\loading.tsx"]}]},{layout:[()=>Promise.resolve().then(s.bind(s,43625)),"C:\\test2\\pagecraft-ai\\src\\app\\layout.tsx"],error:[()=>Promise.resolve().then(s.bind(s,24117)),"C:\\test2\\pagecraft-ai\\src\\app\\error.tsx"],"not-found":[()=>Promise.resolve().then(s.bind(s,48206)),"C:\\test2\\pagecraft-ai\\src\\app\\not-found.tsx"]}],o=["C:\\test2\\pagecraft-ai\\src\\app\\admin\\messages\\page.tsx"],c="/admin/messages/page",x={require:s,loadChunk:()=>Promise.resolve()},m=new r.AppPageRouteModule({definition:{kind:a.x.APP_PAGE,page:"/admin/messages/page",pathname:"/admin/messages",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:d}})},8835:(e,t,s)=>{Promise.resolve().then(s.bind(s,75192))},88534:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(69224).Z)("Activity",[["path",{d:"M22 12h-4l-3 9L9 3l-3 9H2",key:"d5dnw9"}]])},63024:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(69224).Z)("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},80895:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(69224).Z)("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]])},33037:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(69224).Z)("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]])},55794:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(69224).Z)("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]])},67711:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(69224).Z)("CheckCheck",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]])},7060:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(69224).Z)("CheckCircle",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])},71532:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(69224).Z)("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]])},97751:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(69224).Z)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},85674:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(69224).Z)("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]])},42739:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(69224).Z)("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},38852:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(69224).Z)("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]])},27860:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(69224).Z)("Navigation",[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]])},40626:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(69224).Z)("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]])},36135:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(69224).Z)("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]])},38271:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(69224).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},15366:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(69224).Z)("UserCheck",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]])},28240:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(69224).Z)("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]])},32817:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(69224).Z)("UserX",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]])},89895:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(69224).Z)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]])},73229:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(69224).Z)("XCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},75192:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>Z});var r=s(95344),a=s(3729),l=s(9885),i=s(66543),n=s(7060),d=s(38852),o=s(71206);/**
 * @license lucide-react v0.344.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let c=(0,s(69224).Z)("MailOpen",[["path",{d:"M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z",key:"1jhwl8"}],["path",{d:"m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10",key:"1qfld7"}]]);var x=s(36135),m=s(73229),u=s(28765),h=s(42739),p=s(63024),g=s(40626),y=s(55794),f=s(38271);function b(e,t){return t?e.ar:e.en}let j=e=>fetch(e).then(e=>e.json()),v={title:{en:"Messages",ar:"الرسائل"},search:{en:"Search messages...",ar:"بحث في الرسائل..."},allStatuses:{en:"All Statuses",ar:"جميع الحالات"},allSubjects:{en:"All Subjects",ar:"جميع المواضيع"},new:{en:"New",ar:"جديد"},read:{en:"Read",ar:"مقروء"},replied:{en:"Replied",ar:"تم الرد"},closed:{en:"Closed",ar:"مغلق"},total:{en:"Total",ar:"الإجمالي"},reply:{en:"Send Reply",ar:"إرسال الرد"},close:{en:"Close",ar:"إغلاق"},delete:{en:"Delete",ar:"حذف"},replyPlaceholder:{en:"Type your reply...",ar:"اكتب ردك..."},noMessages:{en:"No messages yet",ar:"لا توجد رسائل بعد"},selectMessage:{en:"Select a message to view",ar:"اختر رسالة لعرضها"},from:{en:"From",ar:"من"},email:{en:"Email",ar:"البريد"},phone:{en:"Phone",ar:"الهاتف"},subject:{en:"Subject",ar:"الموضوع"},date:{en:"Date",ar:"التاريخ"},status:{en:"Status",ar:"الحالة"},repliedBy:{en:"Replied by",ar:"رد بواسطة"},repliedAt:{en:"Replied at",ar:"تاريخ الرد"},confirmDelete:{en:"Are you sure you want to delete this message?",ar:"هل أنت متأكد من حذف هذه الرسالة؟"},support:{en:"Technical Support",ar:"دعم فني"},sales:{en:"Sales",ar:"مبيعات"},partnerships:{en:"Partnerships",ar:"شراكات"},general:{en:"General Inquiry",ar:"استفسار عام"},other:{en:"Other",ar:"أخرى"}},w={NEW:"bg-amber-500",READ:"bg-blue-500",REPLIED:"bg-emerald-500",CLOSED:"bg-gray-500"},N={NEW:"bg-amber-500/10 text-amber-400 border-amber-500/20",READ:"bg-blue-500/10 text-blue-400 border-blue-500/20",REPLIED:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",CLOSED:"bg-gray-500/10 text-gray-400 border-gray-500/20"},k=["support","sales","partnerships","general","other"];function E(e,t){let s=e.toLowerCase();return s in v?b(v[s],t):e}function Z(){var e;let{lang:t}=(0,l.Z)(),s="ar"===t,[Z,S]=(0,a.useState)(""),[C,D]=(0,a.useState)(""),[M,P]=(0,a.useState)(""),[q,L]=(0,a.useState)(null),[_,A]=(0,a.useState)(""),[R,O]=(0,a.useState)(!1),[$,T]=(0,a.useState)(""),[I,z]=(0,a.useState)(!1),G=new URLSearchParams;Z&&G.set("search",Z),C&&G.set("status",C),M&&G.set("subject",M),G.set("limit","50");let{data:H,isLoading:W,mutate:B}=(0,i.ZP)(`/api/admin/messages?${G.toString()}`,j,{refreshInterval:3e4}),U=H?.messages??[],V=H?.stats??{total:0,NEW:0,READ:0,REPLIED:0,CLOSED:0},{data:X,isLoading:J,mutate:F}=(0,i.ZP)(q?`/api/admin/messages/${q}`:null,j);(0,a.useEffect)(()=>{if(q){let e=setTimeout(()=>B(),1e3);return()=>clearTimeout(e)}},[q,B]);let Y=e=>{T(e),setTimeout(()=>T(""),3e3)},K=async()=>{if(q&&_.trim()){O(!0);try{(await fetch(`/api/admin/messages/${q}/reply`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reply:_})})).ok&&(A(""),F(),B(),Y(s?"تم إرسال الرد":"Reply sent"))}finally{O(!1)}}},Q=async()=>{q&&(await fetch(`/api/admin/messages/${q}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"CLOSED"})})).ok&&(F(),B(),Y(s?"تم إغلاق الرسالة":"Message closed"))},ee=async()=>{q&&confirm(b(v.confirmDelete,s))&&(await fetch(`/api/admin/messages/${q}`,{method:"DELETE"})).ok&&(L(null),z(!1),B(),Y(s?"تم حذف الرسالة":"Message deleted"))},et=e=>{L(e),A(""),z(!0)};return(0,r.jsxs)("div",{children:[r.jsx("div",{className:"mb-6",children:r.jsx("h1",{className:"text-2xl font-bold text-white",children:b(v.title,s)})}),$&&(0,r.jsxs)("div",{className:"mb-4 px-4 py-2.5 rounded-lg bg-green-500/10 border border-green-500/20 text-green-400 text-sm flex items-center gap-2",children:[r.jsx(n.Z,{className:"h-4 w-4 shrink-0"}),$]}),(0,r.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-3 mb-6",children:[(0,r.jsxs)("button",{onClick:()=>D(""),className:`rounded-2xl border p-4 text-left transition-colors ${C?"border-white/[0.06] bg-white/[0.02] hover:bg-white/[0.04]":"border-indigo-500/30 bg-indigo-500/5"}`,children:[r.jsx("div",{className:"flex items-center gap-2 mb-2",children:r.jsx("div",{className:"p-1.5 rounded-lg bg-indigo-500/10",children:r.jsx(d.Z,{className:"h-4 w-4 text-indigo-400"})})}),r.jsx("div",{className:"text-2xl font-bold text-white",children:V.total}),r.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:b(v.total,s)})]}),(0,r.jsxs)("button",{onClick:()=>D("NEW"===C?"":"NEW"),className:`rounded-2xl border p-4 text-left transition-colors ${"NEW"===C?"border-amber-500/30 bg-amber-500/5":"border-white/[0.06] bg-white/[0.02] hover:bg-white/[0.04]"}`,children:[r.jsx("div",{className:"flex items-center gap-2 mb-2",children:r.jsx("div",{className:"p-1.5 rounded-lg bg-amber-500/10",children:r.jsx(o.Z,{className:"h-4 w-4 text-amber-400"})})}),r.jsx("div",{className:"text-2xl font-bold text-white",children:V.NEW}),r.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:b(v.new,s)})]}),(0,r.jsxs)("button",{onClick:()=>D("READ"===C?"":"READ"),className:`rounded-2xl border p-4 text-left transition-colors ${"READ"===C?"border-blue-500/30 bg-blue-500/5":"border-white/[0.06] bg-white/[0.02] hover:bg-white/[0.04]"}`,children:[r.jsx("div",{className:"flex items-center gap-2 mb-2",children:r.jsx("div",{className:"p-1.5 rounded-lg bg-blue-500/10",children:r.jsx(c,{className:"h-4 w-4 text-blue-400"})})}),r.jsx("div",{className:"text-2xl font-bold text-white",children:V.READ}),r.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:b(v.read,s)})]}),(0,r.jsxs)("button",{onClick:()=>D("REPLIED"===C?"":"REPLIED"),className:`rounded-2xl border p-4 text-left transition-colors ${"REPLIED"===C?"border-emerald-500/30 bg-emerald-500/5":"border-white/[0.06] bg-white/[0.02] hover:bg-white/[0.04]"}`,children:[r.jsx("div",{className:"flex items-center gap-2 mb-2",children:r.jsx("div",{className:"p-1.5 rounded-lg bg-emerald-500/10",children:r.jsx(x.Z,{className:"h-4 w-4 text-emerald-400"})})}),r.jsx("div",{className:"text-2xl font-bold text-white",children:V.REPLIED}),r.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:b(v.replied,s)})]}),(0,r.jsxs)("button",{onClick:()=>D("CLOSED"===C?"":"CLOSED"),className:`rounded-2xl border p-4 text-left transition-colors ${"CLOSED"===C?"border-gray-500/30 bg-gray-500/5":"border-white/[0.06] bg-white/[0.02] hover:bg-white/[0.04]"}`,children:[r.jsx("div",{className:"flex items-center gap-2 mb-2",children:r.jsx("div",{className:"p-1.5 rounded-lg bg-gray-500/10",children:r.jsx(m.Z,{className:"h-4 w-4 text-gray-400"})})}),r.jsx("div",{className:"text-2xl font-bold text-white",children:V.CLOSED}),r.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:b(v.closed,s)})]})]}),(0,r.jsxs)("div",{className:"flex flex-col md:flex-row gap-3 mb-6",children:[(0,r.jsxs)("div",{className:"relative flex-1",children:[r.jsx(u.Z,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-500"}),r.jsx("input",{type:"text",value:Z,onChange:e=>S(e.target.value),placeholder:b(v.search,s),className:"w-full pl-10 pr-4 py-2.5 rounded-xl bg-white/[0.03] border border-white/[0.06] text-sm text-white placeholder-gray-500 focus:outline-none focus:border-indigo-500/50 transition-colors"})]}),(0,r.jsxs)("select",{value:C,onChange:e=>D(e.target.value),className:"px-4 py-2.5 rounded-xl bg-[#0f0f1a] border border-white/[0.06] text-sm text-gray-300 focus:outline-none focus:border-indigo-500/50 transition-colors [&>option]:bg-[#0f0f1a] [&>option]:text-gray-300",children:[r.jsx("option",{value:"",children:b(v.allStatuses,s)}),r.jsx("option",{value:"NEW",children:b(v.new,s)}),r.jsx("option",{value:"READ",children:b(v.read,s)}),r.jsx("option",{value:"REPLIED",children:b(v.replied,s)}),r.jsx("option",{value:"CLOSED",children:b(v.closed,s)})]}),(0,r.jsxs)("select",{value:M,onChange:e=>P(e.target.value),className:"px-4 py-2.5 rounded-xl bg-[#0f0f1a] border border-white/[0.06] text-sm text-gray-300 focus:outline-none focus:border-indigo-500/50 transition-colors [&>option]:bg-[#0f0f1a] [&>option]:text-gray-300",children:[r.jsx("option",{value:"",children:b(v.allSubjects,s)}),k.map(e=>r.jsx("option",{value:e,children:b(v[e],s)},e))]})]}),W&&r.jsx("div",{className:"flex items-center justify-center py-20",children:r.jsx(h.Z,{className:"h-6 w-6 animate-spin text-gray-500"})}),!W&&0===U.length&&(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center py-20 text-gray-500",children:[r.jsx(d.Z,{className:"h-12 w-12 mb-3 opacity-30"}),r.jsx("p",{className:"text-sm",children:b(v.noMessages,s)})]}),!W&&U.length>0&&(0,r.jsxs)("div",{className:"flex flex-col md:flex-row gap-4 min-h-[600px]",children:[r.jsx("div",{className:`w-full md:w-[35%] rounded-2xl border border-white/[0.06] bg-white/[0.02] overflow-hidden flex flex-col ${I?"hidden md:flex":"flex"}`,children:r.jsx("div",{className:"overflow-y-auto flex-1 divide-y divide-white/[0.04]",children:U.map(e=>r.jsx("button",{onClick:()=>et(e.id),className:`w-full text-left p-4 hover:bg-white/[0.03] transition-colors ${q===e.id?"bg-white/[0.04]":""}`,children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:`w-2.5 h-2.5 rounded-full mt-1.5 shrink-0 ${w[e.status]||"bg-gray-500"}`}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:`text-sm truncate ${"NEW"===e.status?"font-bold text-white":"text-gray-300"}`,children:e.name}),r.jsx("span",{className:"text-xs text-gray-500 shrink-0",children:function(e,t){let s=new Date,r=new Date(e),a=Math.floor((s.getTime()-r.getTime())/6e4),l=Math.floor(a/60),i=Math.floor(l/24);return"ar"===t?a<1?"الآن":a<60?`منذ ${a} دقيقة`:l<24?`منذ ${l} ساعة`:`منذ ${i} يوم`:a<1?"just now":a<60?`${a}m ago`:l<24?`${l}h ago`:`${i}d ago`}(e.createdAt,t)})]}),r.jsx("p",{className:`text-xs truncate mt-0.5 ${"NEW"===e.status?"font-semibold text-gray-300":"text-gray-500"}`,children:E(e.subject,s)}),r.jsx("p",{className:"text-xs text-gray-600 truncate mt-0.5",children:e.message})]})]})},e.id))})}),(0,r.jsxs)("div",{className:`w-full md:w-[65%] rounded-2xl border border-white/[0.06] bg-white/[0.02] overflow-hidden flex flex-col ${I?"flex":"hidden md:flex"}`,children:[!q&&r.jsx("div",{className:"flex-1 flex items-center justify-center text-gray-500",children:(0,r.jsxs)("div",{className:"text-center",children:[r.jsx(c,{className:"h-12 w-12 mx-auto mb-3 opacity-30"}),r.jsx("p",{className:"text-sm",children:b(v.selectMessage,s)})]})}),q&&J&&r.jsx("div",{className:"flex-1 flex items-center justify-center",children:r.jsx(h.Z,{className:"h-6 w-6 animate-spin text-gray-500"})}),q&&X&&!J&&(0,r.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[r.jsx("div",{className:"md:hidden p-3 border-b border-white/[0.06]",children:(0,r.jsxs)("button",{onClick:()=>{z(!1)},className:"flex items-center gap-2 text-sm text-gray-400 hover:text-white transition-colors",children:[r.jsx(p.Z,{className:"h-4 w-4"}),r.jsx("span",{children:s?"رجوع":"Back"})]})}),(0,r.jsxs)("div",{className:"p-5 border-b border-white/[0.06]",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[r.jsx("h2",{className:"text-lg font-semibold text-white truncate",children:X.name}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-x-4 gap-y-1 mt-2 text-sm",children:[(0,r.jsxs)("span",{className:"flex items-center gap-1.5 text-gray-400",children:[r.jsx(o.Z,{className:"h-3.5 w-3.5"}),X.email]}),X.phone&&(0,r.jsxs)("span",{className:"flex items-center gap-1.5 text-gray-400",children:[r.jsx(g.Z,{className:"h-3.5 w-3.5"}),X.phone]}),(0,r.jsxs)("span",{className:"flex items-center gap-1.5 text-gray-400",children:[r.jsx(y.Z,{className:"h-3.5 w-3.5"}),new Date(X.createdAt).toLocaleDateString(s?"ar":"en",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})]})]})]}),r.jsx("div",{className:"flex items-center gap-2 shrink-0",children:r.jsx("span",{className:`px-2.5 py-1 rounded-full text-xs font-medium border ${N[X.status]||"bg-gray-500/10 text-gray-400 border-gray-500/20"}`,children:(e=X.status,b({NEW:v.new,READ:v.read,REPLIED:v.replied,CLOSED:v.closed}[e]||{en:e,ar:e},s))})})]}),r.jsx("div",{className:"mt-3",children:r.jsx("span",{className:"px-2.5 py-1 rounded-full text-xs font-medium bg-indigo-500/10 text-indigo-400 border border-indigo-500/20",children:E(X.subject,s)})})]}),r.jsx("div",{className:"p-5 border-b border-white/[0.06]",children:r.jsx("p",{className:"text-sm text-gray-300 whitespace-pre-wrap leading-relaxed",children:X.message})}),(0,r.jsxs)("div",{className:"p-5",children:[X.reply?(0,r.jsxs)("div",{className:"rounded-xl bg-emerald-500/5 border border-emerald-500/10 p-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(x.Z,{className:"h-3.5 w-3.5 text-emerald-400"}),(0,r.jsxs)("span",{className:"text-xs font-medium text-emerald-400",children:[b(v.repliedBy,s),": ",X.replier?.name||X.repliedBy||"—"]}),X.repliedAt&&(0,r.jsxs)("span",{className:"text-xs text-gray-500",children:["\xb7 ",new Date(X.repliedAt).toLocaleDateString(s?"ar":"en",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})]})]}),r.jsx("p",{className:"text-sm text-gray-300 whitespace-pre-wrap",children:X.reply})]}):"CLOSED"!==X.status&&(0,r.jsxs)("div",{children:[r.jsx("textarea",{value:_,onChange:e=>A(e.target.value),placeholder:b(v.replyPlaceholder,s),rows:4,className:"w-full px-4 py-3 rounded-xl bg-white/[0.03] border border-white/[0.06] text-sm text-white placeholder-gray-500 focus:outline-none focus:border-indigo-500/50 resize-none transition-colors"}),r.jsx("div",{className:"flex justify-end mt-3",children:(0,r.jsxs)("button",{onClick:K,disabled:R||!_.trim(),className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-indigo-500 hover:bg-indigo-600 text-white text-sm font-medium disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:[R?r.jsx(h.Z,{className:"h-4 w-4 animate-spin"}):r.jsx(x.Z,{className:"h-4 w-4"}),b(v.reply,s)]})})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3 mt-4 pt-4 border-t border-white/[0.06]",children:["CLOSED"!==X.status&&(0,r.jsxs)("button",{onClick:Q,className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm text-gray-400 hover:text-white hover:bg-white/[0.06] border border-white/[0.06] transition-colors",children:[r.jsx(m.Z,{className:"h-4 w-4"}),b(v.close,s)]}),(0,r.jsxs)("button",{onClick:ee,className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm text-red-400 hover:text-red-300 hover:bg-red-500/[0.06] border border-red-500/10 transition-colors",children:[r.jsx(f.Z,{className:"h-4 w-4"}),b(v.delete,s)]})]})]})]})]})]})]})}},48096:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var s in t)Object.defineProperty(e,s,{enumerable:!0,get:t[s]})}(t,{DynamicServerError:function(){return r},isDynamicServerError:function(){return a}});let s="DYNAMIC_SERVER_USAGE";class r extends Error{constructor(e){super("Dynamic server usage: "+e),this.description=e,this.digest=s}}function a(e){return"object"==typeof e&&null!==e&&"digest"in e&&"string"==typeof e.digest&&e.digest===s}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},72973:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var s in t)Object.defineProperty(e,s,{enumerable:!0,get:t[s]})}(t,{isStaticGenBailoutError:function(){return n},staticGenerationBailout:function(){return o}});let r=s(48096),a=s(45869),l="NEXT_STATIC_GEN_BAILOUT";class i extends Error{constructor(...e){super(...e),this.code=l}}function n(e){return"object"==typeof e&&null!==e&&"code"in e&&e.code===l}function d(e,t){let{dynamic:s,link:r}=t||{};return"Page"+(s?' with `dynamic = "'+s+'"`':"")+" couldn't be rendered statically because it used `"+e+"`."+(r?" See more info here: "+r:"")}let o=(e,t)=>{let{dynamic:s,link:l}=void 0===t?{}:t,n=a.staticGenerationAsyncStorage.getStore();if(!n)return!1;if(n.forceStatic)return!0;if(n.dynamicShouldError)throw new i(d(e,{link:l,dynamic:null!=s?s:"error"}));let o=d(e,{dynamic:s,link:"https://nextjs.org/docs/messages/dynamic-server-error"});if(null==n.postpone||n.postpone.call(n,e),n.revalidate=0,n.isStaticGeneration){let t=new r.DynamicServerError(o);throw n.dynamicUsageDescription=e,n.dynamicUsageStack=t.stack,t}return!1};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},80387:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>d});var r=s(25036);let a=(0,s(86843).createProxy)(String.raw`C:\test2\pagecraft-ai\src\components\admin\messages\MessagesDashboard.tsx`),{__esModule:l,$$typeof:i}=a,n=a.default;function d(){return r.jsx(n,{})}}};var t=require("../../../webpack-runtime.js");t.C(e);var s=e=>t(t.s=e),r=t.X(0,[1638,5312,6632,3910,9043],()=>s(33005));module.exports=r})();