"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4088],{3998:(e,t,r)=>{r.d(t,{$:()=>l});var n=r(95155);r(12115);var s=r(32467),a=r(83101),o=r(64269);let i=(0,a.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function l(e){let{className:t,variant:r,size:a,asChild:l=!1,...c}=e,d=l?s.DX:"button";return(0,n.jsx)(d,{"data-slot":"button",className:(0,o.cn)(i({variant:r,size:a,className:t})),...c})}},11647:(e,t,r)=>{r.d(t,{E:()=>l});var n=r(95155);r(12115);var s=r(32467),a=r(83101),o=r(64269);let i=(0,a.F)("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function l(e){let{className:t,variant:r,asChild:a=!1,...l}=e,c=a?s.DX:"span";return(0,n.jsx)(c,{"data-slot":"badge",className:(0,o.cn)(i({variant:r}),t),...l})}},13406:(e,t,r)=>{r.d(t,{Xi:()=>l,av:()=>c,j7:()=>i,tU:()=>o});var n=r(95155);r(12115);var s=r(60574),a=r(64269);function o(e){let{className:t,...r}=e;return(0,n.jsx)(s.bL,{"data-slot":"tabs",className:(0,a.cn)("flex flex-col gap-2",t),...r})}function i(e){let{className:t,...r}=e;return(0,n.jsx)(s.B8,{"data-slot":"tabs-list",className:(0,a.cn)("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",t),...r})}function l(e){let{className:t,...r}=e;return(0,n.jsx)(s.l9,{"data-slot":"tabs-trigger",className:(0,a.cn)("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...r})}function c(e){let{className:t,...r}=e;return(0,n.jsx)(s.UC,{"data-slot":"tabs-content",className:(0,a.cn)("flex-1 outline-none",t),...r})}},14734:(e,t,r)=>{r.d(t,{F:()=>i});var n=r(12115),s=r(9829),a=r(36489),o=r(95704);function i(){var e;let{data:t}=(0,a.useSession)(),[r,i]=(0,n.useState)(null),[l,c]=(0,n.useState)(!1),[d,u]=(0,n.useState)(null),m=(0,n.useRef)(null);return(0,n.useEffect)(()=>{(async()=>{try{var e;let t=await fetch("/api/settings/socket-status"),r=await t.json();u(null==(e=r.socketEnabled)||e),console.log("\uD83D\uDD0C Socket enabled status:",r.socketEnabled)}catch(e){console.error("Error checking socket status:",e),u(!0)}})()},[]),(0,n.useEffect)(()=>{if(!(null==t?void 0:t.user)||null===d)return;if(!1===d)return void console.log("\uD83D\uDD0C Socket.IO disabled by admin - SSE will be used instead");let e=window.location.hostname.includes("app.github.dev")||window.location.hostname.includes("github.dev"),n=window.location.origin;console.log("\uD83D\uDD0C Socket URL Detection:"),console.log("  - isCodespace:",e),console.log("  - NODE_ENV:","production"),console.log("  - NEXT_PUBLIC_SITE_URL:",o.env.NEXT_PUBLIC_SITE_URL),console.log("  - window.location.origin:",window.location.origin),console.log("  - window.location.hostname:",window.location.hostname),console.log("  - Final socketUrl:",n);let a=(0,s.io)(n,{path:"/api/socket/io",addTrailingSlash:!1,transports:["polling","websocket"],timeout:1e4,reconnection:!0,reconnectionAttempts:3,reconnectionDelay:5e3,reconnectionDelayMax:1e4,randomizationFactor:0,forceNew:!0});return a.on("connect",()=>{console.log("✅ Socket connected:",a.id),c(!0),t.user.id&&a.emit("joinUserRoom",t.user.id)}),a.on("disconnect",e=>{console.log("❌ Socket disconnected:",e),c(!1),"io server disconnect"===e&&(m.current=setTimeout(()=>{a.connect()},5e3))}),a.on("connect_error",e=>{console.error("\uD83D\uDD25 Socket connection error:",e.message),c(!1)}),a.io.on("reconnect_failed",()=>{console.log("❌ Socket reconnection failed after all attempts. Stopping socket."),c(!1)}),i(a),()=>{m.current&&clearTimeout(m.current),null==r||r.disconnect()}},[null==t||null==(e=t.user)?void 0:e.id,d]),{socket:r,isConnected:l,joinUserRoom:()=>{r&&(null==t?void 0:t.user.id)&&r.emit("joinUserRoom",t.user.id)},leaveUserRoom:()=>{r&&(null==t?void 0:t.user.id)&&r.emit("leaveUserRoom",t.user.id)},joinCafeRoom:e=>{r&&r.emit("joinCafeRoom",e)},leaveCafeRoom:e=>{r&&r.emit("leaveCafeRoom",e)},joinEventRoom:e=>{r&&r.emit("joinEventRoom",e)},leaveEventRoom:e=>{r&&r.emit("leaveEventRoom",e)}}}},25112:(e,t,r)=>{r.d(t,{h:()=>a});var n=r(12115),s=r(36489);function a(){var e;let{data:t}=(0,s.useSession)(),[r,a]=(0,n.useState)(!1),[o,i]=(0,n.useState)(null),[l,c]=(0,n.useState)(null),d=(0,n.useRef)(null);return(0,n.useEffect)(()=>{var e;if(!(null==t||null==(e=t.user)?void 0:e.id))return;console.log("\uD83D\uDCE1 Setting up SSE connection for user:",t.user.id);let r=new EventSource("/api/notifications/sse");return d.current=r,r.onopen=()=>{console.log("✅ SSE connection established"),a(!0),c(null)},r.onmessage=e=>{try{let t=JSON.parse(e.data);console.log("\uD83D\uDD14 SSE notification received:",t),i(t),"notification"===t.type&&window.dispatchEvent(new CustomEvent("newNotification",{detail:t})),"points"===t.type&&window.dispatchEvent(new CustomEvent("newPoints",{detail:t}))}catch(e){console.error("❌ Error parsing SSE message:",e)}},r.onerror=e=>{console.error("❌ SSE connection error:",e),a(!1),c("اتصال real-time قطع شد")},()=>{console.log("\uD83E\uDDF9 Cleaning up SSE connection"),r.close(),a(!1)}},[null==t||null==(e=t.user)?void 0:e.id]),{isConnected:r,lastNotification:o,connectionError:l}}},44254:(e,t,r)=>{r.d(t,{oT:()=>s,u5:()=>n});let n={xs:12,sm:16,md:24,lg:32,xl:48},s={spinner:"animate-spin rounded-full border-2 border-current border-t-transparent",pulse:"animate-pulse bg-gray-200 rounded",skeleton:"animate-pulse bg-gray-200 rounded",dots:"flex space-x-1"}},56210:(e,t,r)=>{r.d(t,{LoadingSpinner:()=>o});var n=r(95155),s=r(64269),a=r(44254);function o(e){let{size:t="md",type:r="spinner",color:o,message:i,showMessage:l=!1,rtl:c=!0,className:d,show:u=!0,...m}=e;if(!u)return null;let x=a.u5[t],f=(0,n.jsx)("div",{className:(0,s.cn)(a.oT[r],"inline-block flex-shrink-0",o&&"text-".concat(o),d),style:{width:x,height:x,..."spinner"===r&&{borderWidth:"xs"===t?1:2}},...m});return l&&i?(0,n.jsxs)("div",{className:(0,s.cn)("flex items-center gap-2",c&&"flex-row-reverse"),children:[f,(0,n.jsx)("span",{className:"text-sm text-gray-600",children:i})]}):f}},64269:(e,t,r)=>{r.d(t,{cn:()=>a});var n=r(2821),s=r(75889);function a(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,s.QP)((0,n.$)(t))}},86948:(e,t,r)=>{r.d(t,{BT:()=>l,Wu:()=>c,ZB:()=>i,Zp:()=>a,aR:()=>o});var n=r(95155);r(12115);var s=r(64269);function a(e){let{className:t,...r}=e;return(0,n.jsx)("div",{"data-slot":"card",className:(0,s.cn)("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",t),...r})}function o(e){let{className:t,...r}=e;return(0,n.jsx)("div",{"data-slot":"card-header",className:(0,s.cn)("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",t),...r})}function i(e){let{className:t,...r}=e;return(0,n.jsx)("div",{"data-slot":"card-title",className:(0,s.cn)("leading-none font-semibold",t),...r})}function l(e){let{className:t,...r}=e;return(0,n.jsx)("div",{"data-slot":"card-description",className:(0,s.cn)("text-muted-foreground text-sm",t),...r})}function c(e){let{className:t,...r}=e;return(0,n.jsx)("div",{"data-slot":"card-content",className:(0,s.cn)("px-6",t),...r})}},94088:(e,t,r)=>{r.d(t,{NotificationPanel:()=>U});var n=r(95155),s=r(12115),a=r(86948),o=r(3998),i=r(11647),l=r(13406),c=r(78519),d=r(16485),u=r(91169),m=r(6132),x=r(16645),f=r(95740),g=r(85998),v=r(13492),h=r(61362),p=r(65229),b=r(5917),w=r(20017),N=r(71360),j=r(56210),y=r(14734),E=r(25112),k=r(18720),S=r(20063),T=r(64269);let R=s.createContext(null),A=e=>{let{children:t}=e,[r,a]=s.useState(!1),o=s.useMemo(()=>({open:r,setOpen:a}),[r]);return s.useEffect(()=>{let e=e=>{r&&e.target instanceof Element&&(e.target.closest("[data-dropdown]")||a(!1))};if(r)return document.addEventListener("click",e,!0),()=>document.removeEventListener("click",e,!0)},[r]),(0,n.jsx)(R.Provider,{value:o,children:(0,n.jsx)("div",{className:"relative inline-block","data-dropdown":!0,children:t})})},I=()=>{let e=s.useContext(R);if(!e)throw Error("useDropdownMenu must be used within DropdownMenu");return e},C=s.forwardRef((e,t)=>{let{className:r,children:s,onClick:a,...o}=e,{open:i,setOpen:l}=I();return(0,n.jsx)("button",{ref:t,className:(0,T.cn)("inline-flex items-center justify-center",r),onClick:e=>{e.preventDefault(),e.stopPropagation(),l(!i),null==a||a(e)},"aria-expanded":i,...o,children:s})});C.displayName="DropdownMenuTrigger";let D=s.forwardRef((e,t)=>{let{className:r,align:s="center",...a}=e,{open:o}=I();return o?(0,n.jsx)("div",{ref:t,className:(0,T.cn)("absolute top-full mt-1 w-56 rounded-md border bg-popover p-1 text-popover-foreground shadow-lg z-50","end"===s&&"right-0","start"===s&&"left-0","center"===s&&"left-1/2 -translate-x-1/2",r),...a}):null});D.displayName="DropdownMenuContent";let _=s.forwardRef((e,t)=>{let{className:r,onClick:s,...a}=e,{setOpen:o}=I();return(0,n.jsx)("div",{ref:t,className:(0,T.cn)("relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground",r),onClick:e=>{null==s||s(e),o(!1)},...a})});function U(e){let{userId:t,className:r,onNotificationRead:R,onClose:I,showCloseButton:U=!1}=e,[L,z]=(0,s.useState)([]),[P,O]=(0,s.useState)(0),[B,V]=(0,s.useState)(!1),[M,F]=(0,s.useState)("new"),[X,$]=(0,s.useState)(null),G=(0,S.useRouter)(),{socket:W,isConnected:Z}=(0,y.F)(),{isConnected:J}=(0,E.h)(),Y=(0,s.useRef)(null),Q=Z||J,q=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];V(!0);try{let t=new URLSearchParams;e&&t.append("unread","true");let r=await fetch("/api/notifications?".concat(t)),n=await r.json();n.success&&(e?O(n.data.unreadCount):z(n.data.notifications))}catch(e){console.error("Error loading notifications:",e),k.o.error("خطا در بارگذاری اعلان‌ها")}finally{V(!1)}},K=async e=>{try{(await fetch("/api/notifications/".concat(e),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"mark-read"})})).ok&&(z(t=>t.map(t=>t.id===e?{...t,isRead:!0}:t)),O(e=>Math.max(0,e-1)),null==R||R())}catch(e){console.error("Error marking as read:",e),k.o.error("خطا در علامت‌گذاری اعلان")}},H=async(e,t,r)=>{$(e);try{let l=await fetch("/api/invite/respond",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({invitationId:e,action:t})}),c=await l.json();if(c.success)if(await K(r),window.dispatchEvent(new CustomEvent("playmo:refresh-globe")),"ACCEPT"===t){var n,s,a,o,i;(null==(n=c.data)?void 0:n.isFree)?(k.o.success("دعوتنامه پذیرفته شد! شما به میز بازی اضافه شدید \uD83C\uDF89"),I&&I(),G.push("/checkout/invite-success?tableId=".concat((null==(a=c.data)?void 0:a.bookingId)||""))):(null==(s=c.data)?void 0:s.requiresPayment)&&(k.o.info(c.message||"دعوتنامه پذیرفته شد. لطفاً هزینه ورودی را پرداخت نمایید."),(null==(o=c.data)?void 0:o.payer)==="GUEST"&&(I&&I(),G.push("/checkout/event/".concat((null==(i=c.data)?void 0:i.bookingId)||""))))}else k.o.info("دعوتنامه رد شد.");else k.o.error(c.error||c.message||"خطا در پردازش پاسخ دعوتنامه")}catch(e){console.error("Error responding to invitation:",e),k.o.error("خطای ارتباط با سرور در پاسخ به دعوتنامه")}finally{$(null)}},ee=async e=>{try{(await fetch("/api/notifications/".concat(e),{method:"DELETE"})).ok&&(z(t=>t.filter(t=>t.id!==e)),k.o.success("اعلان حذف شد"))}catch(e){console.error("Error deleting notification:",e),k.o.error("خطا در حذف اعلان")}},et=async()=>{try{(await fetch("/api/notifications/mark-all-read",{method:"PUT"})).ok&&(z(e=>e.map(e=>({...e,isRead:!0}))),O(0),null==R||R(),k.o.success("تمام اعلان‌ها به عنوان خوانده شده علامت‌گذاری شدند"))}catch(e){console.error("Error marking all as read:",e),k.o.error("خطا در علامت‌گذاری همه اعلان‌ها")}};(0,s.useEffect)(()=>{if(!W||!Z)return;W.emit("joinUserRoom",t);let e=e=>{let t={id:e.id,userId:e.userId,type:e.type,title:e.title,message:e.message,data:e.data,isRead:!1,createdAt:e.createdAt,updatedAt:e.createdAt};z(e=>[t,...e]),O(e=>e+1)};return W.on("notification",e),()=>{W.off("notification",e)}},[W,Z,t]),(0,s.useEffect)(()=>{let e=e=>{let r=e.detail;if(r&&"notification"===r.type){let e={id:r.id||"sse-".concat(Date.now()),userId:r.userId||t,type:r.notificationType||"SYSTEM",title:r.title,message:r.message,data:r.data,isRead:!1,createdAt:r.timestamp||new Date().toISOString(),updatedAt:r.timestamp||new Date().toISOString()};z(t=>[e,...t]),O(e=>e+1),console.log("\uD83D\uDCE1 SSE notification added to panel")}};return window.addEventListener("newNotification",e),()=>{window.removeEventListener("newNotification",e)}},[t]),(0,s.useEffect)(()=>{let e=Y.current;if(!e)return;let t=t=>{t.stopPropagation(),t.preventDefault();let r=e.querySelector(".scrollable-content");r&&(r.scrollTop+=.5*t.deltaY)};return e.addEventListener("wheel",t,{passive:!1}),()=>{e.removeEventListener("wheel",t)}},[]),(0,s.useEffect)(()=>{q(),q(!0)},[]);let er=e=>"new"===M?e.filter(e=>!e.isRead).sort((e,t)=>new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime()):e.sort((e,t)=>new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime());return(0,n.jsxs)(a.Zp,{ref:Y,className:(0,T.cn)("flex flex-col overflow-hidden max-h-[32rem]",r),style:{overscrollBehavior:"contain",height:"auto"},children:[(0,n.jsx)(a.aR,{className:"pb-3 flex-shrink-0",children:(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)(a.ZB,{className:"flex items-center gap-2 text-right",children:[P>0?(0,n.jsx)(v.A,{className:"h-5 w-5 text-blue-600"}):(0,n.jsx)(g.A,{className:"h-5 w-5"}),"اعلان‌ها",P>0&&(0,n.jsx)(i.E,{variant:"destructive",className:"text-xs",children:P})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,n.jsx)("div",{className:"w-2 h-2 rounded-full ".concat(Q?"bg-green-500":"bg-red-500")}),Q?"آنلاین":"آفلاین",!Z&&J&&(0,n.jsx)(i.E,{variant:"secondary",className:"text-[10px] px-1 py-0 h-4 bg-blue-100 text-blue-700",children:"SSE"})]}),P>0&&(0,n.jsxs)(o.$,{variant:"outline",size:"sm",onClick:et,className:"text-xs",children:[(0,n.jsx)(h.A,{className:"h-3 w-3 mr-1"}),"همه خوانده شد"]}),U&&I&&(0,n.jsx)(o.$,{variant:"ghost",size:"sm",onClick:I,className:"text-xs p-1 h-6 w-6",children:(0,n.jsx)(p.A,{className:"h-3 w-3"})})]})]})}),(0,n.jsx)(a.Wu,{className:"flex-1 flex flex-col min-h-0",children:(0,n.jsxs)(l.tU,{value:M,onValueChange:F,className:"w-full h-full flex flex-col",children:[(0,n.jsxs)(l.j7,{className:"grid w-full grid-cols-2 flex-shrink-0",dir:"rtl",children:[(0,n.jsxs)(l.Xi,{value:"new",children:["جدید (",P,")"]}),(0,n.jsxs)(l.Xi,{value:"all",children:["همه اعلان‌ها (",L.length,")"]})]}),(0,n.jsx)(l.av,{value:M,className:"mt-4 flex-1 flex flex-col min-h-0",children:(0,n.jsx)("div",{className:"flex-1 overflow-y-auto scrollable-content max-h-[60vh] sm:max-h-[22rem]",style:{overscrollBehavior:"contain"},children:B?(0,n.jsxs)("div",{className:"flex justify-center items-center py-8",children:[(0,n.jsx)(j.LoadingSpinner,{size:"md",className:"ml-2"}),(0,n.jsx)("span",{className:"mr-2",children:"در حال بارگذاری..."})]}):(0,n.jsxs)("div",{className:"space-y-3",children:[er(L).map(e=>(0,n.jsx)("div",{className:"p-3 rounded-lg border ".concat(e.isRead?"bg-muted/30 border-muted":"bg-card border-border shadow-sm"," transition-all hover:shadow-md"),children:(0,n.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,n.jsx)("div",{className:"p-2 rounded-full ".concat((e=>{switch(e){case"BOOKING":return"text-green-600 bg-green-50";case"EVENT":return"text-blue-600 bg-blue-50";case"FRIEND_REQUEST":return"text-purple-600 bg-purple-50";case"PAYMENT":return"text-orange-600 bg-orange-50";case"REVIEW":return"text-yellow-600 bg-yellow-50";case"TABLE_INVITATION":return"text-purple-600 bg-purple-100";case"NUDGE":return"text-pink-600 bg-pink-50";default:return"text-gray-600 bg-gray-50"}})(e.type)),children:(e=>{switch(e){case"BOOKING":case"PAYMENT":return(0,n.jsx)(c.A,{className:"h-4 w-4"});case"EVENT":return(0,n.jsx)(d.A,{className:"h-4 w-4"});case"FRIEND_REQUEST":return(0,n.jsx)(u.A,{className:"h-4 w-4"});case"REVIEW":return(0,n.jsx)(m.A,{className:"h-4 w-4"});case"TABLE_INVITATION":return(0,n.jsx)(x.A,{className:"h-4 w-4"});case"NUDGE":return(0,n.jsx)(f.A,{className:"h-4 w-4"});default:return(0,n.jsx)(g.A,{className:"h-4 w-4"})}})(e.type)}),(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,n.jsx)("h4",{className:"font-medium text-sm truncate",children:e.title}),!e.isRead&&(0,n.jsx)("div",{className:"w-2 h-2 bg-blue-600 rounded-full flex-shrink-0"})]}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground line-clamp-2",children:e.message}),(0,n.jsxs)("div",{className:"flex items-center justify-between mt-2",children:[(0,n.jsx)(i.E,{variant:"secondary",className:"text-xs",children:"TABLE_INVITATION"===e.type?"دعوت به میز":"NUDGE"===e.type?"تلنگر":e.type}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:new Date(e.createdAt).toLocaleString("fa-IR",{timeZone:"Asia/Tehran"})})]}),"TABLE_INVITATION"===e.type&&e.relatedId&&!e.isRead&&(0,n.jsxs)("div",{className:"flex items-center gap-2 mt-3 pt-2 border-t border-purple-100/70",children:[(0,n.jsx)(o.$,{size:"sm",onClick:()=>H(e.relatedId,"ACCEPT",e.id),disabled:X===e.relatedId,className:"text-xs h-7 rounded-lg bg-emerald-600 hover:bg-emerald-700 text-white flex-1 shadow-xs",children:X===e.relatedId?(0,n.jsx)(j.LoadingSpinner,{size:"xs"}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(b.A,{className:"h-3.5 w-3.5 ml-1"}),"قبول دعوت"]})}),(0,n.jsxs)(o.$,{size:"sm",variant:"outline",onClick:()=>H(e.relatedId,"REJECT",e.id),disabled:X===e.relatedId,className:"text-xs h-7 rounded-lg text-gray-700 hover:bg-red-50 hover:text-red-600 hover:border-red-200 flex-1",children:[(0,n.jsx)(p.A,{className:"h-3.5 w-3.5 ml-1"}),"رد کردن"]})]})]}),(0,n.jsxs)(A,{children:[(0,n.jsx)(C,{asChild:!0,children:(0,n.jsx)(o.$,{variant:"ghost",size:"sm",children:(0,n.jsx)(w.A,{className:"h-4 w-4"})})}),(0,n.jsxs)(D,{align:"end",dir:"rtl",children:[!e.isRead&&(0,n.jsxs)(_,{onClick:()=>K(e.id),children:[(0,n.jsx)(b.A,{className:"h-4 w-4 mr-2"}),"علامت‌گذاری به عنوان خوانده شده"]}),(0,n.jsxs)(_,{onClick:()=>ee(e.id),className:"text-red-600 hover:text-red-700",children:[(0,n.jsx)(N.A,{className:"h-4 w-4 mr-2"}),"حذف اعلان"]})]})]})]})},e.id)),0===er(L).length&&(0,n.jsxs)("div",{className:"text-center py-8 text-muted-foreground",children:[(0,n.jsx)(g.A,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),(0,n.jsx)("p",{children:"اعلانی وجود ندارد"})]})]})})})]})})]})}_.displayName="DropdownMenuItem"}}]);