(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8634],{11647:(e,s,a)=>{"use strict";a.d(s,{E:()=>c});var t=a(95155);a(12115);var r=a(32467),l=a(83101),n=a(64269);let i=(0,l.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 c(e){let{className:s,variant:a,asChild:l=!1,...c}=e,d=l?r.DX:"span";return(0,t.jsx)(d,{"data-slot":"badge",className:(0,n.cn)(i({variant:a}),s),...c})}},16536:(e,s,a)=>{"use strict";a.d(s,{Tb:()=>l,dM:()=>n});let t={تهران:"Tehran",اصفهان:"Isfahan",مشهد:"Mashhad",شیراز:"Shiraz",تبریز:"Tabriz",کرج:"Karaj",قم:"Qom",اهواز:"Ahvaz"},r={Tehran:"تهران",Isfahan:"اصفهان",Mashhad:"مشهد",Shiraz:"شیراز",Tabriz:"تبریز",Karaj:"کرج",Qom:"قم",Ahvaz:"اهواز"};function l(e){return t[e]||e}function n(e){return r[e]||e}},27790:(e,s,a)=>{Promise.resolve().then(a.bind(a,93676))},51834:(e,s,a)=>{"use strict";a.d(s,{Cf:()=>x,Es:()=>p,L3:()=>h,c7:()=>m,lG:()=>i,rr:()=>g,zM:()=>c});var t=a(95155);a(12115);var r=a(89511),l=a(65229),n=a(64269);function i(e){let{...s}=e;return(0,t.jsx)(r.bL,{"data-slot":"dialog",...s})}function c(e){let{...s}=e;return(0,t.jsx)(r.l9,{"data-slot":"dialog-trigger",...s})}function d(e){let{...s}=e;return(0,t.jsx)(r.ZL,{"data-slot":"dialog-portal",...s})}function o(e){let{className:s,...a}=e;return(0,t.jsx)(r.hJ,{"data-slot":"dialog-overlay",className:(0,n.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",s),...a})}function x(e){let{className:s,children:a,showCloseButton:i=!0,...c}=e;return(0,t.jsxs)(d,{"data-slot":"dialog-portal",children:[(0,t.jsx)(o,{}),(0,t.jsxs)(r.UC,{"data-slot":"dialog-content",className:(0,n.cn)("bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",s),...c,children:[a,i&&(0,t.jsxs)(r.bm,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[(0,t.jsx)(l.A,{}),(0,t.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function m(e){let{className:s,...a}=e;return(0,t.jsx)("div",{"data-slot":"dialog-header",className:(0,n.cn)("flex flex-col gap-2 text-center sm:text-left",s),...a})}function p(e){let{className:s,...a}=e;return(0,t.jsx)("div",{"data-slot":"dialog-footer",className:(0,n.cn)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",s),...a})}function h(e){let{className:s,...a}=e;return(0,t.jsx)(r.hE,{"data-slot":"dialog-title",className:(0,n.cn)("text-lg leading-none font-semibold",s),...a})}function g(e){let{className:s,...a}=e;return(0,t.jsx)(r.VY,{"data-slot":"dialog-description",className:(0,n.cn)("text-muted-foreground text-sm",s),...a})}},51950:(e,s,a)=>{"use strict";function t(e){let s=!(arguments.length>1)||void 0===arguments[1]||arguments[1];var a=(s?e:Math.round(e/10)).toLocaleString("fa-IR");let t=["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"],r=["0","1","2","3","4","5","6","7","8","9"];return String(a).replace(/[0-9]/g,e=>t[r.indexOf(e)])}function r(e){let s=!(arguments.length>1)||void 0===arguments[1]||arguments[1],a=t(e);return s?"".concat(a," تومان"):a}a.d(s,{$g:()=>t,dy:()=>r})},65142:(e,s,a)=>{"use strict";a.d(s,{p:()=>l});var t=a(95155);a(12115);var r=a(64269);function l(e){let{className:s,type:a,...l}=e;return(0,t.jsx)("input",{type:a,"data-slot":"input",className:(0,r.cn)("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","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",s),...l})}},85897:(e,s,a)=>{"use strict";a.d(s,{BK:()=>c,eu:()=>i,q5:()=>d});var t=a(95155),r=a(12115),l=a(46591),n=a(64269);let i=r.forwardRef((e,s)=>{let{className:a,...r}=e;return(0,t.jsx)(l.bL,{ref:s,className:(0,n.cn)("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",a),...r})});i.displayName=l.bL.displayName;let c=r.forwardRef((e,s)=>{let{className:a,...r}=e;return(0,t.jsx)(l._V,{ref:s,className:(0,n.cn)("aspect-square h-full w-full",a),...r})});c.displayName=l._V.displayName;let d=r.forwardRef((e,s)=>{let{className:a,...r}=e;return(0,t.jsx)(l.H4,{ref:s,className:(0,n.cn)("flex h-full w-full items-center justify-center rounded-full bg-muted",a),...r})});d.displayName=l.H4.displayName},93676:(e,s,a)=>{"use strict";a.r(s),a.d(s,{default:()=>G});var t=a(95155),r=a(3998),l=a(86948),n=a(65142),i=a(11647),c=a(12115),d=a(85897),o=a(51834),x=a(12112),m=a(20508),p=a(6613),h=a(39347),g=a(2317),u=a(5937),f=a(18720);function j(e){var s,a;let{isOpen:n,onClose:j,userId:v}=e,[N,b]=(0,c.useState)(null),[y,w]=(0,c.useState)(!1),E=(0,c.useCallback)(async()=>{if(v)try{w(!0);let e=await fetch("/api/user/profile/".concat(v)),s=await e.json();s.success?b(s.data):(f.o.error(s.error||"خطا در دریافت اطلاعات پروفایل"),j())}catch(e){console.error("خطا در دریافت پروفایل:",e),f.o.error("خطا در دریافت اطلاعات"),j()}finally{w(!1)}},[v,j]);return((0,c.useEffect)(()=>{n&&v&&E()},[n,v,E]),y)?(0,t.jsx)(o.lG,{open:n,onOpenChange:j,children:(0,t.jsxs)(o.Cf,{className:"sm:max-w-lg",dir:"rtl",children:[(0,t.jsx)(o.c7,{children:(0,t.jsx)(o.L3,{className:"text-right",children:"پروفایل کاربر"})}),(0,t.jsx)("div",{className:"flex items-center justify-center p-8",children:(0,t.jsx)(x.kt,{size:"lg"})})]})}):N?(0,t.jsx)(o.lG,{open:n,onOpenChange:j,children:(0,t.jsxs)(o.Cf,{className:"sm:max-w-2xl max-h-[90vh] overflow-y-auto",dir:"rtl",children:[(0,t.jsx)(o.c7,{children:(0,t.jsx)(o.L3,{className:"text-right",children:"پروفایل کاربر"})}),(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"flex items-start gap-6 p-6 bg-gradient-to-r from-blue-50 to-purple-50 rounded-lg",children:[(0,t.jsxs)(d.eu,{className:"w-24 h-24",children:[(0,t.jsx)(d.BK,{src:N.avatar?"https://asset.playmo.ir/public".concat(N.avatar):"",alt:N.name||""}),(0,t.jsx)(d.q5,{className:"text-2xl",children:(null==(s=N.name)?void 0:s.slice(0,2).toUpperCase())||"U"})]}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-2",children:[(0,t.jsx)("h2",{className:"text-2xl font-bold text-gray-900",children:N.name}),(0,t.jsx)(i.E,{className:(e=>{switch(e){case"BEGINNER":return"bg-green-100 text-green-800";case"INTERMEDIATE":return"bg-blue-100 text-blue-800";case"ADVANCED":return"bg-purple-100 text-purple-800";case"EXPERT":return"bg-orange-100 text-orange-800";case"MASTER":return"bg-red-100 text-red-800";default:return"bg-gray-100 text-gray-800"}})(N.currentLevel),children:N.currentLevel})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm text-gray-600",children:[N.age&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(m.A,{className:"w-4 h-4"}),(0,t.jsxs)("span",{children:[N.age," ساله"]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(p.A,{className:"w-4 h-4"}),(0,t.jsxs)("span",{children:[N.totalPoints.toLocaleString("fa")," امتیاز"]})]}),N.ranking&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(h.A,{className:"w-4 h-4"}),(0,t.jsxs)("span",{children:["رنک ",N.ranking.position.toLocaleString("fa")]})]})]})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsxs)(r.$,{variant:"default",className:"gap-2",children:[(0,t.jsx)(g.A,{className:"w-4 h-4"}),"دعوت به بازی"]}),(0,t.jsxs)(r.$,{variant:"outline",className:"gap-2",children:[(0,t.jsx)(u.A,{className:"w-4 h-4"}),"پیام"]})]})]}),(0,t.jsxs)(l.Zp,{children:[(0,t.jsx)(l.aR,{children:(0,t.jsxs)(l.ZB,{className:"flex items-center gap-2",children:[(0,t.jsx)(g.A,{className:"w-5 h-5"}),"بازی‌های مورد علاقه"]})}),(0,t.jsx)(l.Wu,{children:N.gamePreferences&&N.gamePreferences.length>0?(0,t.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:N.gamePreferences.map((e,s)=>(0,t.jsxs)("div",{className:"p-3 bg-gray-50 rounded-lg",children:[(0,t.jsx)("h4",{className:"font-semibold text-gray-900",children:e.gameTitle}),(0,t.jsxs)("div",{className:"flex gap-2 mt-1",children:[(0,t.jsx)(i.E,{variant:"secondary",children:e.category}),(0,t.jsx)(i.E,{variant:"outline",children:e.skillLevel})]})]},s))}):(0,t.jsx)("p",{className:"text-gray-500 text-center py-8",children:"علایق گیمینگ ثبت نشده"})})]}),(0,t.jsxs)(l.Zp,{children:[(0,t.jsx)(l.aR,{children:(0,t.jsxs)(l.ZB,{className:"flex items-center gap-2",children:[(0,t.jsx)(p.A,{className:"w-5 h-5"}),"آمار بازیکن"]})}),(0,t.jsx)(l.Wu,{children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"text-center p-4 bg-blue-50 rounded-lg",children:[(0,t.jsx)("div",{className:"text-2xl font-bold text-blue-600",children:N.totalPoints.toLocaleString("fa")}),(0,t.jsx)("div",{className:"text-sm text-gray-600",children:"کل امتیازات"})]}),(0,t.jsxs)("div",{className:"text-center p-4 bg-green-50 rounded-lg",children:[(0,t.jsx)("div",{className:"text-2xl font-bold text-green-600",children:null==(a=N.ranking)?void 0:a.position.toLocaleString("fa")}),(0,t.jsx)("div",{className:"text-sm text-gray-600",children:"رنک کلی"})]})]})})]})]})]})}):null}var v=a(91169),N=a(83457),b=a(57828),y=a(56210);function w(e){let{isOpen:s,onClose:a,eventId:n,eventTitle:x}=e,[m,h]=(0,c.useState)(null),[g,u]=(0,c.useState)(!1),[w,E]=(0,c.useState)({open:!1,userId:""});(0,c.useEffect)(()=>{s&&n&&A()},[s,n]);let A=async()=>{try{u(!0);let e=await fetch("/api/events/".concat(n,"/participants")),s=await e.json();s.success?h(s.data):(f.o.error(s.error||"خطا در دریافت اطلاعات شرکت‌کنندگان"),a())}catch(e){console.error("خطا در دریافت شرکت‌کنندگان:",e),f.o.error("خطا در دریافت اطلاعات"),a()}finally{u(!1)}};return g?(0,t.jsx)(o.lG,{open:s,onOpenChange:a,children:(0,t.jsxs)(o.Cf,{className:"sm:max-w-2xl",dir:"rtl",children:[(0,t.jsx)(o.c7,{children:(0,t.jsx)(o.L3,{className:"text-right",children:"شرکت‌کنندگان"})}),(0,t.jsx)("div",{className:"flex items-center justify-center p-8",children:(0,t.jsx)(y.kt,{size:"lg"})})]})}):m?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.lG,{open:s,onOpenChange:a,children:(0,t.jsxs)(o.Cf,{className:"sm:max-w-3xl max-h-[80vh] overflow-y-auto",dir:"rtl",children:[(0,t.jsx)(o.c7,{children:(0,t.jsxs)(o.L3,{className:"text-right flex items-center gap-2",children:[(0,t.jsx)(v.A,{className:"w-6 h-6"}),"شرکت‌کنندگان ",x]})}),(0,t.jsxs)("div",{className:"flex items-center gap-6 p-4 bg-gradient-to-r from-blue-50 to-purple-50 rounded-lg",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(v.A,{className:"w-5 h-5 text-blue-600"}),(0,t.jsx)("span",{className:"text-sm text-gray-600",children:"کل شرکت‌کنندگان:"}),(0,t.jsx)("span",{className:"font-bold text-blue-600",children:m.total})]}),m.friendsCount>0&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(N.A,{className:"w-5 h-5 text-red-600"}),(0,t.jsx)("span",{className:"text-sm text-gray-600",children:"دوستان شما:"}),(0,t.jsx)("span",{className:"font-bold text-red-600",children:m.friendsCount})]})]}),(0,t.jsx)("div",{className:"space-y-3",children:m.allParticipants.length>0?m.allParticipants.map(e=>{var s;return(0,t.jsx)(l.Zp,{className:"hover:shadow-md transition-shadow",children:(0,t.jsx)(l.Wu,{className:"p-4",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsxs)(d.eu,{className:"w-12 h-12",children:[(0,t.jsx)(d.BK,{src:e.avatar?"https://asset.playmo.ir/public".concat(e.avatar):"",alt:e.name||""}),(0,t.jsx)(d.q5,{children:(null==(s=e.name)?void 0:s.slice(0,2).toUpperCase())||"U"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("h4",{className:"font-semibold text-lg",children:e.name}),e.isFriend&&(0,t.jsx)(N.A,{className:"w-4 h-4 text-red-500"}),e.isExternal&&(0,t.jsx)(i.E,{className:"bg-orange-100 text-orange-800 text-xs",children:"خارجی"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3 mt-1",children:[(0,t.jsx)(i.E,{className:(e=>{switch(e){case"BEGINNER":return"bg-green-100 text-green-800";case"INTERMEDIATE":return"bg-blue-100 text-blue-800";case"ADVANCED":return"bg-purple-100 text-purple-800";case"EXPERT":return"bg-orange-100 text-orange-800";case"MASTER":return"bg-red-100 text-red-800";default:return"bg-gray-100 text-gray-800"}})(e.currentLevel),children:e.currentLevel}),(0,t.jsxs)("div",{className:"flex items-center gap-1 text-sm text-gray-600",children:[(0,t.jsx)(p.A,{className:"w-4 h-4"}),(0,t.jsxs)("span",{children:[e.totalPoints.toLocaleString("fa")," امتیاز"]})]}),e.age&&(0,t.jsx)("div",{className:"flex items-center gap-1 text-sm text-gray-600",children:(0,t.jsxs)("span",{children:[e.age," ساله"]})}),e.isExternal&&e.email&&(0,t.jsx)("div",{className:"flex items-center gap-1 text-sm text-gray-600",children:(0,t.jsx)("span",{children:e.email})})]})]})]}),!e.isExternal&&(0,t.jsxs)(r.$,{onClick:()=>{E({open:!0,userId:e.id})},variant:"outline",size:"sm",className:"gap-2",children:[(0,t.jsx)(b.A,{className:"w-4 h-4"}),"مشاهده پروفایل"]})]})})},e.id)}):(0,t.jsxs)("div",{className:"text-center py-12 text-gray-500",children:[(0,t.jsx)(v.A,{className:"w-16 h-16 mx-auto mb-4 text-gray-300"}),(0,t.jsx)("p",{className:"text-lg",children:"هنوز کسی ثبت نام نکرده"}),(0,t.jsx)("p",{className:"text-sm",children:"اولین نفری باشید که ثبت نام می‌کنید!"})]})})]})}),(0,t.jsx)(j,{isOpen:w.open,onClose:()=>{E({open:!1,userId:""})},userId:w.userId})]}):null}var E=a(6132),A=a(52056),k=a(89559),C=a(65993),L=a(20063);function S(){return{handleError:c.useCallback((e,s)=>{console.error("Error in ".concat(s||"component",":"),e),f.o.error("خطایی رخ داد",{description:e.message||"خطای غیرمنتظره‌ای رخ داده است"})},[])}}c.Component;function P(e){let{eventId:s,eventTitle:a,maxPlayers:l,registeredPlayers:n}=e,[o,x]=(0,c.useState)(null),[m,p]=(0,c.useState)(!1),[h,g]=(0,c.useState)(null),[u,j]=(0,c.useState)(!1),{handleError:b}=S(),{handleAsyncError:y}=function(){let{handleError:e}=S();return{handleAsyncError:c.useCallback(async(s,a)=>{try{return await s()}catch(s){return e(s instanceof Error?s:Error(String(s)),a),null}},[e])}}(),A=(0,c.useCallback)(async()=>{var e;let a=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"در حال پردازش...",s=arguments.length>1?arguments[1]:void 0;return"string"==typeof s?(f.o.loading(e,{id:s}),s):s?f.o.promise(s,{loading:e,success:"عملیات با موفقیت انجام شد",error:"خطا در انجام عملیات"}):f.o.loading(e)}("در حال بارگیری شرکت‌کنندگان..."),t=await y(async()=>{p(!0),g(null);let e=await fetch("/api/events/".concat(s,"/participants"));if(!e.ok)throw Error("HTTP ".concat(e.status,": ").concat(e.statusText));let a=await e.json();if(!a.success){var t;throw Error((null==(t=a.error)?void 0:t.message)||"خطا در دریافت اطلاعات شرکت‌کنندگان")}return a.data},"EventParticipants.fetchParticipants");t?x(t):g("خطا در بارگیری شرکت‌کنندگان"),e=a,f.o.dismiss(e),p(!1)},[s,y]),k=(0,c.useCallback)(()=>{A()},[A]);if((0,c.useEffect)(()=>{A()},[A]),m)return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)("div",{className:"animate-pulse flex gap-1",children:[(0,t.jsx)("div",{className:"w-6 h-6 bg-gray-200 rounded-full"}),(0,t.jsx)("div",{className:"w-6 h-6 bg-gray-200 rounded-full"}),(0,t.jsx)("div",{className:"w-6 h-6 bg-gray-200 rounded-full"})]}),(0,t.jsx)("span",{className:"text-sm text-gray-500",children:"در حال بارگذاری..."})]});if(h)return(0,t.jsxs)("div",{className:"flex items-center gap-2 text-red-500",children:[(0,t.jsx)(E.A,{size:16}),(0,t.jsx)("span",{className:"text-sm",children:h}),(0,t.jsx)(r.$,{variant:"ghost",size:"sm",onClick:k,className:"text-xs",children:"تلاش مجدد"})]});if(!o||0===o.total)return(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[(0,t.jsx)(v.A,{className:"w-4 h-4"}),(0,t.jsxs)("span",{children:["0/",l]})]});let C=Math.min(o.participants.length,3);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsxs)("div",{className:"flex items-center cursor-pointer hover:scale-105 transition-transform",onClick:()=>{j(!0)},children:[o.participants.slice(0,C).map((e,s)=>{var a;return e&&e.id?(0,t.jsxs)(d.eu,{className:"w-8 h-8 border-2 border-white shadow-sm",style:{marginRight:s>0?"-8px":"0"},children:[(0,t.jsx)(d.BK,{src:e.avatar?"https://asset.playmo.ir/public".concat(e.avatar):"",alt:e.name||"کاربر"}),(0,t.jsx)(d.q5,{className:"text-xs",children:(null==(a=e.name)?void 0:a.slice(0,2).toUpperCase())||"U"})]},e.id):(console.warn("Invalid participant data:",e),null)}).filter(Boolean)," "]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,t.jsx)(v.A,{className:"w-4 h-4 text-gray-500"}),(0,t.jsxs)("span",{className:"text-gray-700",children:[null!=n?n:o.total,"/",l]}),o.friendsCount>0&&(0,t.jsxs)(i.E,{variant:"secondary",className:"gap-1 px-2 py-0.5 text-xs",children:[(0,t.jsx)(N.A,{className:"w-3 h-3"}),o.friendsCount," دوست"]})]})]}),(0,t.jsx)(w,{isOpen:u,onClose:()=>{j(!1)},eventId:s,eventTitle:a})]})}var z=a(86651),T=a(16485),I=a(26983),R=a(21873),_=a(52987),M=a(52619),W=a.n(M),D=a(15239),O=a(51950),B=a(57239),F=a(96093),$=a(16536);function G(){let[e,s]=(0,c.useState)(""),[a,d]=(0,c.useState)("همه"),[o,x]=(0,c.useState)("همه"),{data:m,isLoading:p,error:g,refetch:u}=(0,B.iE)(async()=>{var e;let s=await fetch("/api/events"),a=await s.json();if(a.success&&(null==(e=a.data)?void 0:e.events))return a.data.events;throw Error(a.error||"خطا در دریافت ایونت‌ها")},[],{cacheTime:5e3,onError:e=>console.error("خطا در دریافت ایونت‌ها:",e)}),f=m||[];(0,c.useEffect)(()=>{let e=()=>{u()};return window.addEventListener("event-updated",e),()=>window.removeEventListener("event-updated",e)},[u]);let j=f.filter(s=>{var t;let r=s.title.toLowerCase().includes(e.toLowerCase())||s.game.toLowerCase().includes(e.toLowerCase()),l="همه"===a||s.type===a,n="همه"===o?null:(0,$.Tb)(o),i="همه"===o||n&&(null==(t=s.cafe)?void 0:t.city)===n;return r&&l&&i}),N=["همه",...c.useMemo(()=>{let e=new Set;return f.forEach(s=>{var a;(null==(a=s.cafe)?void 0:a.city)&&e.add((0,$.dM)(s.cafe.city))}),Array.from(e).sort()},[f])];return(0,t.jsxs)("div",{className:"min-h-screen bg-gradient-to-br from-playmo-blue-50 via-white to-playmo-purple-50",children:[(0,t.jsx)("div",{className:"fixed top-0 left-0 right-0 z-50 bg-white/50 backdrop-blur-xl shadow-sm border-b border-gray-200/60",children:(0,t.jsx)("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:(0,t.jsxs)("div",{className:"flex items-center justify-between h-16",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-4 space-x-reverse",children:[(0,t.jsxs)(W(),{href:"/",className:"hidden sm:flex items-center gap-2 text-gray-600 hover:text-playmo-purple-600 transition-colors",children:[(0,t.jsx)(C.A,{className:"h-5 w-5"}),(0,t.jsx)("span",{className:"hidden sm:block",children:"خانه"})]}),(0,t.jsx)("span",{className:"hidden sm:inline text-gray-300",children:"/"}),(0,t.jsx)("span",{className:"font-semibold text-playmo-purple-600",children:"رویدادها"})]}),(0,t.jsxs)("div",{className:"text-left hidden sm:block",children:[(0,t.jsx)("h1",{className:"text-2xl font-bold bg-gradient-to-r from-playmo-purple-600 to-playmo-blue-600 bg-clip-text text-transparent",children:"رویدادهای گیمینگ"}),(0,t.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:"بهترین رویدادها را پیدا کنید"})]}),(0,t.jsx)("div",{className:"block sm:hidden relative w-16 h-16",children:(0,t.jsx)(D.default,{src:"/images/red_green_dice_3d.png",alt:"Dice",fill:!0,className:"object-contain drop-shadow-lg",priority:!0})})]})})}),(0,t.jsxs)("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 pb-8 pt-24",children:[(0,t.jsx)("div",{className:"mb-8",children:(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsx)("div",{className:"flex-1",children:(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(z.A,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400 h-5 w-5"}),(0,t.jsx)(n.p,{placeholder:"جستجو در رویدادها و بازی‌ها...",value:e,onChange:e=>s(e.target.value),className:"pr-10 text-right"})]})}),(0,t.jsxs)("div",{className:"flex flex-col lg:flex-row gap-4",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2 text-right",children:"شهر:"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:N.map(e=>(0,t.jsx)(r.$,{variant:o===e?"default":"outline",size:"sm",onClick:()=>x(e),className:o===e?"bg-playmo-blue-600 hover:bg-playmo-blue-700":"",children:e},e))})]}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2 text-right",children:"نوع رویداد:"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:["همه","بازی","تخفیفی","مناسبت","مسابقه","سایر رویدادها"].map(e=>(0,t.jsx)(r.$,{variant:a===e?"default":"outline",size:"sm",onClick:()=>d(e),className:a===e?"bg-playmo-purple-600 hover:bg-playmo-purple-700":"",children:e},e))})]})]})]})}),(0,t.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 px-4 sm:px-0",children:p?Array(6).fill(0).map((e,s)=>(0,t.jsxs)(l.Zp,{className:"animate-pulse",children:[(0,t.jsx)("div",{className:"aspect-video bg-gray-200 rounded-t-lg"}),(0,t.jsxs)(l.Wu,{className:"p-6",children:[(0,t.jsx)("div",{className:"h-4 bg-gray-200 rounded mb-2"}),(0,t.jsx)("div",{className:"h-4 bg-gray-200 rounded mb-4"}),(0,t.jsx)("div",{className:"h-8 bg-gray-200 rounded"})]})]},s)):0===j.length?(0,t.jsxs)("div",{className:"col-span-full text-center py-12",children:[(0,t.jsx)(T.A,{className:"w-16 h-16 mx-auto mb-4 text-gray-300"}),(0,t.jsx)("p",{className:"text-lg text-gray-500",children:"هیچ رویدادی یافت نشد"}),(0,t.jsx)("p",{className:"text-sm text-gray-400 mb-4",children:"لطفاً فیلترهای جستجو را تغییر دهید"}),(0,t.jsx)(r.$,{variant:"outline",onClick:()=>{s(""),d("همه"),x("همه")},children:"پاک کردن فیلترها"})]}):j.map(e=>(0,t.jsxs)(l.Zp,{className:"group hover:shadow-xl transition-all duration-300 hover:-translate-y-1 border-0 shadow-md overflow-hidden pt-0 rounded-3xl mx-2 ".concat(e.isRegistered?"ring-2 ring-green-500/50 ring-offset-2 ring-offset-white":""),children:[(0,t.jsxs)("div",{className:"relative overflow-hidden group aspect-video bg-gradient-to-br from-playmo-purple-500 via-playmo-blue-500 to-playmo-purple-700 rounded-3xl",children:[(()=>{let s=e.mainImage?(0,F.zL)([e.mainImage])[0]:e.images&&e.images.length>0?(0,F.zL)(e.images)[0]:null;return s?(0,t.jsx)(D.default,{src:s,alt:e.title,fill:!0,className:"object-cover group-hover:scale-105 transition-transform duration-300",onError:e=>{e.currentTarget.style.display="none"}}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/10 to-transparent animate-pulse"}),(0,t.jsx)("div",{className:"absolute inset-0 opacity-10",children:(0,t.jsx)("div",{className:"w-full h-full bg-[radial-gradient(circle_at_1px_1px,rgba(255,255,255,0.3)_1px,transparent_0)] bg-[length:20px_20px]"})})]})})(),(0,t.jsx)("div",{className:"absolute inset-0 bg-gradient-to-t from-black/60 via-black/20 to-transparent"}),(0,t.jsx)("div",{className:"absolute bottom-4 left-4 right-4 z-10",children:(0,t.jsxs)("div",{className:"text-white",children:[(0,t.jsx)("div",{className:"text-2xl font-bold mb-1 drop-shadow-lg",children:e.game}),(0,t.jsx)("div",{className:"text-sm opacity-90 bg-white/20 px-3 py-1 rounded-full backdrop-blur-sm inline-block",children:e.difficulty||({BEGINNER:"مبتدی",INTERMEDIATE:"متوسط",ADVANCED:"پیشرفته",PROFESSIONAL:"حرفه‌ای",ALL_LEVELS:"همه سطوح"})[e.skillLevel]||"همه سطوح"})]})}),(0,t.jsxs)("div",{className:"absolute top-3 right-3 flex flex-col gap-2",children:[e.isRegistered&&(0,t.jsx)(i.E,{className:"bg-green-500/90 text-white border-0 shadow-sm",children:"ثبت نام شده"}),e.registeredPlayers>=e.maxPlayers&&(0,t.jsx)(i.E,{variant:"destructive",className:"bg-red-500/90 text-white border-0",children:"تکمیل ظرفیت"})]}),(0,t.jsx)("div",{className:"absolute bottom-3 left-3",children:(0,t.jsxs)("div",{className:"bg-white/90 backdrop-blur-sm px-2 py-1 rounded-full flex items-center gap-1 text-xs font-medium",children:[(0,t.jsx)(v.A,{className:"h-3 w-3 text-playmo-purple-600"}),(0,t.jsxs)("span",{className:"text-gray-700",children:[e.registeredPlayers,"/",e.maxPlayers]})]})})]}),(0,t.jsxs)(l.Wu,{className:"p-6 space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"text-lg font-bold text-gray-900 mb-2 group-hover:text-playmo-purple-600 transition-colors leading-tight",children:e.title}),(0,t.jsx)("p",{className:"text-sm text-gray-600 line-clamp-2 leading-relaxed",children:e.description})]}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2 space-x-reverse",children:[(0,t.jsx)("div",{className:"p-1.5 bg-playmo-blue-50 rounded-lg",children:(0,t.jsx)(T.A,{className:"h-4 w-4 text-playmo-blue-600"})}),(0,t.jsx)("span",{className:"text-gray-700 font-medium",children:e.date})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2 space-x-reverse",children:[(0,t.jsx)("div",{className:"p-1.5 bg-playmo-purple-50 rounded-lg",children:(0,t.jsx)(I.A,{className:"h-4 w-4 text-playmo-purple-600"})}),(0,t.jsx)("span",{className:"text-gray-700 font-medium",children:e.time})]})]}),(0,t.jsx)("div",{className:"flex items-center justify-between",children:(0,t.jsxs)("div",{className:"flex items-center space-x-2 space-x-reverse",children:[(0,t.jsx)("div",{className:"p-1.5 bg-green-50 rounded-lg",children:(0,t.jsx)(R.A,{className:"h-4 w-4 text-green-600"})}),(0,t.jsxs)("div",{className:"flex items-center gap-8",children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900",children:e.cafe.name}),(0,t.jsxs)("span",{className:"text-sm text-gray-600",children:[" . ",(0,$.dM)(e.cafe.city)]})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-1 space-x-reverse ml-4",children:[(0,t.jsx)(h.A,{className:"h-3 w-3 text-yellow-400 fill-current"}),(0,t.jsx)("span",{className:"text-xs text-gray-600 font-medium",children:e.cafe.rating>0?e.cafe.rating:"بدون امتیاز"})]})]})]})})]}),(0,t.jsx)("div",{className:"flex items-center justify-between",children:(0,t.jsx)(P,{eventId:e.id.toString(),eventTitle:e.title,maxPlayers:e.maxPlayers,registeredPlayers:e.registeredPlayers})}),e.tags&&e.tags.length>0&&(0,t.jsxs)("div",{className:"flex flex-wrap gap-1 mb-4",children:[e.tags.slice(0,3).map((e,s)=>(0,t.jsx)(i.E,{variant:"outline",className:"text-xs px-2 py-1 border-gray-200 text-gray-600 hover:border-playmo-purple-300 hover:text-playmo-purple-700 transition-colors",children:e},s)),e.tags.length>3&&(0,t.jsxs)(i.E,{variant:"outline",className:"text-xs px-2 py-1 border-gray-200 text-gray-500",children:["+",e.tags.length-3]})]}),(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(W(),{href:"/events/".concat(e.id),children:(0,t.jsx)(r.$,{className:"w-full group/btn relative overflow-hidden bg-gradient-to-r from-playmo-purple-600 to-playmo-blue-600 hover:from-playmo-purple-700 hover:to-playmo-blue-700 border-0 h-11 rounded-2xl px-6",disabled:e.registeredPlayers>=e.maxPlayers,children:e.registeredPlayers>=e.maxPlayers?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(v.A,{className:"mr-2 h-4 w-4"}),"ظرفیت تکمیل شده"]}):e.isRegistered?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,t.jsx)("span",{className:"font-medium",children:"مشاهده جزئیات"}),(0,t.jsx)(_.A,{className:"h-4 w-4 group-hover/btn:translate-x-1 transition-transform"})]}),(0,t.jsx)("div",{className:"absolute inset-0 -top-0.5 -bottom-0.5 bg-gradient-to-r from-transparent via-white/20 to-transparent translate-x-[-100%] group-hover/btn:translate-x-[100%] transition-transform duration-700"})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,t.jsxs)("span",{className:"font-medium",children:["ثبت نام در رویداد (",0===e.price?"رایگان":"".concat((0,O.$g)(e.price)," تومان"),")"]}),(0,t.jsx)(_.A,{className:"h-4 w-4 group-hover/btn:translate-x-1 transition-transform"})]}),(0,t.jsx)("div",{className:"absolute inset-0 -top-0.5 -bottom-0.5 bg-gradient-to-r from-transparent via-white/20 to-transparent translate-x-[-100%] group-hover/btn:translate-x-[100%] transition-transform duration-700"})]})})})})]})]},e.id))}),!p&&(0,t.jsx)("div",{className:"text-center mt-12 text-gray-500",children:(0,t.jsx)("p",{children:j.length>0?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"font-semibold text-playmo-purple-600",children:j.length})," رویداد یافت شد"]}):null})})]})]})}},96093:(e,s,a)=>{"use strict";function t(e){return e?e.startsWith("http")?e:e.startsWith("/uploads/")?"https://asset.playmo.ir/public".concat(e):"https://asset.playmo.ir/public/uploads/cafes/".concat(e):"/images/cafe-logo-placeholder.svg"}function r(e){return!e||Array.isArray(e)&&0===e.length?["/images/cafe-placeholder.svg"]:(Array.isArray(e)?e:[e]).map(e=>e?e.startsWith("http")?e:e.startsWith("/uploads/")?"https://asset.playmo.ir/public".concat(e):"https://asset.playmo.ir/public/uploads/cafes/".concat(e):"/images/cafe-placeholder.svg")}function l(e){return!e||Array.isArray(e)&&0===e.length?["/images/event-placeholder.svg"]:(Array.isArray(e)?e:[e]).map(e=>e?e.startsWith("http")?e:e.startsWith("/uploads/")?"https://asset.playmo.ir/public".concat(e):"https://asset.playmo.ir/public/uploads/events/".concat(e):"/images/event-placeholder.svg")}a.d(s,{EY:()=>t,Wb:()=>r,zL:()=>l})}},e=>{e.O(0,[4909,7055,3148,8720,1691,5239,9060,2112,2483,7239,4623,7358],()=>e(e.s=27790)),_N_E=e.O()}]);