"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6552],{7420:(e,t,s)=>{s.d(t,{W:()=>r});var a=s(95155);function r(e){let{className:t,variant:s="short",...r}=e;return"full"===s?(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 169.26 53.85",className:t,...r,children:(0,a.jsx)("g",{id:"Layer_2","data-name":"Layer 2",children:(0,a.jsxs)("g",{id:"Layer_1-2","data-name":"Layer 1",children:[(0,a.jsx)("path",{d:"M0,26.2V9.62A9.32,9.32,0,0,1,14,1.55L28.34,9.84l14.37,8.29a9.32,9.32,0,0,1,0,16.14l-14.37,8.3L14,50.86A9.32,9.32,0,0,1,0,42.79Z",fill:"currentColor"}),(0,a.jsx)("circle",{cx:"143.34",cy:"27.93",r:"25.92",fill:"currentColor"}),(0,a.jsx)("path",{d:"M111,7.61v37.2a7.6,7.6,0,0,1-7.6,7.6H61.36a7.61,7.61,0,0,1-7.6-7.6V7.66A7.6,7.6,0,0,1,64.86.91l14,7.23a7.59,7.59,0,0,0,7,0L99.94.85A7.6,7.6,0,0,1,111,7.61Z",fill:"currentColor"}),(0,a.jsx)("ellipse",{cx:"72.81",cy:"30.22",rx:"7.44",ry:"2.29",fill:"#ffffff"}),(0,a.jsx)("circle",{cx:"93.25",cy:"30.22",r:"6.18",fill:"#ffffff"})]})})}):(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 57.26 52.41",className:t,...r,children:(0,a.jsx)("g",{id:"Layer_2","data-name":"Layer 2",children:(0,a.jsxs)("g",{id:"Layer_1-2","data-name":"Layer 1",children:[(0,a.jsx)("path",{d:"M57.26,7.61v37.2a7.6,7.6,0,0,1-7.6,7.6H7.6A7.6,7.6,0,0,1,0,44.81V7.66A7.6,7.6,0,0,1,11.09.91l14,7.23a7.61,7.61,0,0,0,7,0L46.18.85A7.6,7.6,0,0,1,57.26,7.61Z",fill:"currentColor"}),(0,a.jsx)("ellipse",{cx:"19.04",cy:"30.22",rx:"7.44",ry:"2.29",fill:"#ffffff"}),(0,a.jsx)("circle",{cx:"39.48",cy:"30.22",r:"6.18",fill:"#ffffff"})]})})})}s(12115)},11647:(e,t,s)=>{s.d(t,{E:()=>o});var a=s(95155);s(12115);var r=s(32467),l=s(83101),n=s(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 o(e){let{className:t,variant:s,asChild:l=!1,...o}=e,d=l?r.DX:"span";return(0,a.jsx)(d,{"data-slot":"badge",className:(0,n.cn)(i({variant:s}),t),...o})}},44254:(e,t,s)=>{s.d(t,{oT:()=>r,u5:()=>a});let a={xs:12,sm:16,md:24,lg:32,xl:48},r={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"}},44846:(e,t,s)=>{s.d(t,{d:()=>n});var a=s(95155);s(12115);var r=s(27599),l=s(64269);function n(e){let{className:t,...s}=e;return(0,a.jsx)(r.bL,{"data-slot":"switch",className:(0,l.cn)("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors outline-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-gray-200 dark:data-[state=unchecked]:bg-gray-700",t),...s,children:(0,a.jsx)(r.zi,{"data-slot":"switch-thumb",className:(0,l.cn)("pointer-events-none block h-5 w-5 rounded-full bg-white shadow-md ring-0 transition-transform data-[state=unchecked]:translate-x-0 data-[state=checked]:translate-x-5 rtl:data-[state=checked]:-translate-x-5")})})}},51834:(e,t,s)=>{s.d(t,{Cf:()=>x,Es:()=>u,L3:()=>p,c7:()=>m,lG:()=>i,rr:()=>h,zM:()=>o});var a=s(95155);s(12115);var r=s(89511),l=s(65229),n=s(64269);function i(e){let{...t}=e;return(0,a.jsx)(r.bL,{"data-slot":"dialog",...t})}function o(e){let{...t}=e;return(0,a.jsx)(r.l9,{"data-slot":"dialog-trigger",...t})}function d(e){let{...t}=e;return(0,a.jsx)(r.ZL,{"data-slot":"dialog-portal",...t})}function c(e){let{className:t,...s}=e;return(0,a.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/60 backdrop-blur-sm",t),...s})}function x(e){let{className:t,children:s,showCloseButton:i=!0,...o}=e;return(0,a.jsxs)(d,{"data-slot":"dialog-portal",children:[(0,a.jsx)(c,{}),(0,a.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-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...o,children:[s,i&&(0,a.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 left-4 rtl:left-4 rtl:right-auto ltr:right-4 ltr:left-auto 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,a.jsx)(l.A,{}),(0,a.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function m(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"dialog-header",className:(0,n.cn)("flex flex-col gap-2 text-center sm:text-left",t),...s})}function u(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"dialog-footer",className:(0,n.cn)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...s})}function p(e){let{className:t,...s}=e;return(0,a.jsx)(r.hE,{"data-slot":"dialog-title",className:(0,n.cn)("text-lg leading-none font-semibold",t),...s})}function h(e){let{className:t,...s}=e;return(0,a.jsx)(r.VY,{"data-slot":"dialog-description",className:(0,n.cn)("text-muted-foreground text-sm",t),...s})}},51950:(e,t,s)=>{function a(e){let t=["۰","۱","۲","۳","۴","۵","۶","۷","۸","۹"],s=["0","1","2","3","4","5","6","7","8","9"];return String(e).replace(/[0-9]/g,e=>t[s.indexOf(e)]).replace(/[٠١٢٣٤٥٦٧٨٩]/g,e=>t[["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"].indexOf(e)])}function r(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return a((t?e:Math.round(e/10)).toLocaleString("fa-IR"))}function l(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],s=r(e);return t?"".concat(s," تومان"):s}s.d(t,{$g:()=>r,dy:()=>l,ub:()=>a})},56210:(e,t,s)=>{s.d(t,{LoadingSpinner:()=>n});var a=s(95155),r=s(64269),l=s(44254);function n(e){let{size:t="md",type:s="spinner",color:n,message:i,showMessage:o=!1,rtl:d=!0,className:c,show:x=!0,...m}=e;if(!x)return null;let u=l.u5[t],p=(0,a.jsx)("div",{className:(0,r.cn)(l.oT[s],"inline-block flex-shrink-0",n&&"text-".concat(n),c),style:{width:u,height:u,..."spinner"===s&&{borderWidth:"xs"===t?1:2}},...m});return o&&i?(0,a.jsxs)("div",{className:(0,r.cn)("flex items-center gap-2",d&&"flex-row-reverse"),children:[p,(0,a.jsx)("span",{className:"text-sm text-gray-600",children:i})]}):p}},58036:(e,t,s)=>{s.d(t,{k:()=>W});var a=s(95155),r=s(12115),l=s(51834),n=s(3998),i=s(27937),o=s(90368),d=s(35299),c=s(95740),x=s(98373);let m=x.AA;function u(e,t){if(!e||!t)return m;let s=(0,x.L7)(e),a=(0,x.L7)(t);if(isNaN(s)||isNaN(a))return m;0===a&&(a=1440);let r=60*Math.ceil(s/60),l=[];if(s<a)for(let e=r;e+60<=a;e+=60){let t=Math.floor(e/60);l.push("".concat(String(t).padStart(2,"0"),":00"))}else if(s>a){for(let e=r;e<1440;e+=60){let t=Math.floor(e/60);l.push("".concat(String(t).padStart(2,"0"),":00"))}for(let e=0;e+60<=a;e+=60){let t=Math.floor(e/60);l.push("".concat(String(t).padStart(2,"0"),":00"))}}return l}function p(e,t,s,a){let r=parseInt(e.split(":")[0],10);if(isNaN(r))return!1;if(!s||!a)return(r<6?r+24:r)<=(t<6?t+24:t);let l=(0,x.L7)(s),n=(0,x.L7)(a);if(isNaN(l)||isNaN(n))return(r<6?r+24:r)<=(t<6?t+24:t);if(0===n&&(n=1440),l<=n)return r<=t;let i=Math.floor(l/60);return(r<i?r+24:r)<=(t<i?t+24:t)}let h=["تهران","مشهد","اصفهان","شیراز","کرج","تبریز"],b=["یکشنبه","دوشنبه","سه‌شنبه","چهارشنبه","پنج‌شنبه","جمعه","شنبه"],g=[{num:1,label:"ژانر",emoji:"\uD83E\uDDE9"},{num:2,label:"بازی",emoji:"\uD83C\uDFB2"},{num:3,label:"زمان",emoji:"⏰"},{num:4,label:"هم‌بازی",emoji:"\uD83D\uDC65"},{num:5,label:"کافه",emoji:"☕"}];var f=s(20063),j=s(36489),v=s(18720);let N=(0,r.createContext)(null);function y(e){let{children:t,open:s,onOpenChange:l,userCity:n,initialCafeId:i}=e,o=function(e){var t;let{open:s,onOpenChange:a,userCity:l="همه",initialCafeId:n}=e,i=(0,f.useRouter)(),{data:o,status:d}=(0,j.useSession)(),c=(null==o||null==(t=o.user)?void 0:t.city)||("همه"!==l?l:"تهران"),[m,h]=(0,r.useState)(c),[g,N]=(0,r.useState)(1),[y,w]=(0,r.useState)([]),[T,k]=(0,r.useState)(new Set),[D,S]=(0,r.useState)("ALL"),[C,A]=(0,r.useState)(n?"همه بازی‌های این کافه":"همه بازی‌ها"),[L,P]=(0,r.useState)(null),[O,E]=(0,r.useState)([]),[I,R]=(0,r.useState)(""),[M,U]=(0,r.useState)(null),[F,H]=(0,r.useState)(!1),[z,$]=(0,r.useState)(!1),[Y,_]=(0,r.useState)(null),V=(0,r.useMemo)(()=>(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,t=new Date(e.getTime()+126e5);return[{label:"امروز",offsetDays:0,emoji:"⚡"},{label:"فردا",offsetDays:1,emoji:"\uD83D\uDCC5"},{label:"پس‌فردا",offsetDays:2,emoji:"\uD83D\uDCC6"}].map(e=>{let s=new Date(t.getTime()+24*e.offsetDays*36e5),a=b[s.getUTCDay()],r=s.getUTCFullYear(),l=String(s.getUTCMonth()+1).padStart(2,"0"),n=String(s.getUTCDate()).padStart(2,"0"),i="".concat(r,"-").concat(l,"-").concat(n);return{...e,dateStr:i,weekdayName:a,displayLabel:"".concat(e.label," (").concat(a,")")}})})(),[]),G=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date;try{let t=new Intl.DateTimeFormat("en-US",{timeZone:"Asia/Tehran",hour:"numeric",hourCycle:"h23"});return parseInt(t.format(e),10)}catch(t){return new Date(e.getTime()+126e5).getUTCHours()}}(),B=+(G>=22),[J,Z]=(0,r.useState)(B),[W,X]=(0,r.useState)(new Set),q=(0,r.useMemo)(()=>{if(0===B){let e=Math.min(Math.max(10,G+1),23);return"".concat(String(e).padStart(2,"0"),":00")}return"17:00"},[G,B]),[K,Q]=(0,r.useState)(q),[ee,et]=(0,r.useState)({}),[es,ea]=(0,r.useState)(3),[er,el]=(0,r.useState)(!0),[en,ei]=(0,r.useState)(""),[eo,ed]=(0,r.useState)([]),[ec,ex]=(0,r.useState)(c),[em,eu]=(0,r.useState)(null),[ep,eh]=(0,r.useState)(!1),[eb,eg]=(0,r.useState)(null),[ef,ej]=(0,r.useState)(!1);(0,r.useEffect)(()=>{if(!s)return;let e=!0;return(async()=>{var t,s,a,r,l;let n=null==o||null==(t=o.user)?void 0:t.city;if(n&&""!==n.trim()){e&&(h(n),ex(e=>"همه"===e||"تهران"===e?n:e));return}if("authenticated"===d)try{let t=await fetch("/api/user/profile");if(t.ok){let n=await t.json(),i=(null==n||null==(a=n.data)||null==(s=a.user)?void 0:s.city)||(null==n||null==(l=n.profile)||null==(r=l.user)?void 0:r.city);i&&""!==i.trim()&&e&&(h(i),ex(e=>"همه"===e||"تهران"===e?i:e))}}catch(e){}})(),()=>{e=!1}},[s,o,d]);let ev=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/user/tables");if(e.ok){let t=await e.json();if(t.success&&t.data&&Array.isArray(t.data.hosted)){let e=new Set;t.data.hosted.forEach(t=>{if(t.startTime&&"UPCOMING"===t.status){let s=new Date(new Date(t.startTime).getTime()+126e5),a=s.getUTCFullYear(),r=String(s.getUTCMonth()+1).padStart(2,"0"),l=String(s.getUTCDate()).padStart(2,"0");e.add("".concat(a,"-").concat(r,"-").concat(l))}}),X(e),Z(t=>{let s=V[t];if(s&&e.has(s.dateStr)){let s=V.findIndex(t=>!e.has(t.dateStr));return -1!==s?s:t}return t})}}}catch(e){}},[V]),eN=(0,r.useCallback)(async()=>{$(!0),_(null);try{if(n){let[e,t]=await Promise.all([fetch("/api/cafes/".concat(n,"/games")),fetch("/api/cafes/".concat(n))]),s=await e.json();if(s.success&&s.data){let e=s.data.cafeName||"این کافه";P(e);let t=(s.data.games||[]).map(e=>({id:e.id,title:e.nameFa||e.name,englishTitle:e.name!==e.nameFa?e.name:void 0,genre:e.genre||(e.genres&&e.genres.length>0?e.genres[0].name:void 0),genreId:e.genreId||(e.genres&&e.genres.length>0?e.genres[0].id:e.genreIds&&e.genreIds[0]),genreIds:e.genreIds||(e.genres?e.genres.map(e=>e.id):[]),minPlayers:e.minPlayers||2,maxPlayers:e.maxPlayers||6,isPopular:!!e.isPopular,imageUrl:e.imageUrl}));E(t);let a=(s.data.genres||[]).map(e=>({id:e.id,name:e.name,cleanName:e.cleanName||e.name}));w(a)}else _(s.error||"خطا در دریافت لیست بازی‌های کافه");if(t.ok){let e=await t.json();if(e.success&&e.data){let t=e.data,s={id:t.id,name:t.name,address:t.address,city:t.city,district:t.district,hourlyRate:t.hourlyRate||0,isFree:0===t.hourlyRate||"FREE"===t.pricingType,pricingType:t.pricingType,logo:t.logo,images:t.images,openTime:t.openTime,closeTime:t.closeTime,settings:t.settings};eu(s),ed([s]),t.city&&ex(t.city),t.name&&P(t.name)}}}else{let e=await fetch("/api/games"),t=await e.json();if(t.success&&t.data){let e=(t.data.games||[]).map(e=>({id:e.id,title:e.nameFa||e.name,englishTitle:e.name!==e.nameFa?e.name:void 0,genre:e.genre||(e.genres&&e.genres.length>0?e.genres[0].name:void 0),genreId:e.genreId||(e.genres&&e.genres.length>0?e.genres[0].id:e.genreIds&&e.genreIds[0]),genreIds:e.genreIds||(e.genres?e.genres.map(e=>e.id):[]),minPlayers:e.minPlayers||2,maxPlayers:e.maxPlayers||6,isPopular:!!e.isPopular,imageUrl:e.imageUrl}));E(e);let s=(t.data.genres||[]).map(e=>({id:e.id,name:e.name,cleanName:e.cleanName||e.name}));w(s)}else _(t.error||"خطا در بارگذاری لیست بازی‌ها")}}catch(e){_("خطا در برقراری ارتباط با سرور کاتالوگ بازی‌ها")}finally{$(!1)}},[n]),ey=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/user/game-preferences");if(e.ok){let t=await e.json();if(t.success&&Array.isArray(t.data)){let e=new Set(t.data.map(e=>e.gameTitle));k(e)}}}catch(e){}},[]),ew=(0,r.useCallback)(async(e,t,s,a,r)=>{if(!n){eh(!0),eg(null);try{var l;let n=new URLSearchParams;(null==e?void 0:e.id)?n.set("gameId",e.id):(null==e?void 0:e.title)&&n.set("game",e.title),D&&"ALL"!==D&&"FAVORITES"!==D&&"POPULAR"!==D?n.set("genreId",D):t&&"ALL"!==t&&"همه بازی‌ها"!==t&&"FAVORITES"!==t&&"POPULAR"!==t&&n.set("genre",t),s&&"همه"!==s&&n.set("city",s);let i=a||K;i&&n.set("time",i);let o=r||(null==(l=V[J])?void 0:l.dateStr);o&&n.set("date",o),n.set("includeHeatmap","true");let d=await fetch("/api/cafes/by-game?".concat(n.toString())),c=await d.json();c.success&&Array.isArray(c.data)?(ed(c.data),c.hourlyDiscountsMap&&et(c.hourlyDiscountsMap),c.data.length>0?eu(e=>e&&c.data.some(t=>String(t.id)===String(e.id))?e:c.data[0]):eu(null)):eg(c.error||"خطا در دریافت لیست کافه‌ها")}catch(e){eg("خطا در برقراری ارتباط با سرور برای دریافت کافه‌ها")}finally{eh(!1)}}},[n,D,K,J,V]),eT=(0,r.useCallback)(e=>{Q(e),ew(M,C,ec,e)},[M,C,ec,ew]);(0,r.useEffect)(()=>{s&&(N(1),S("ALL"),A(n?"همه بازی‌های این کافه":"همه بازی‌ها"),R(""),U(null),H(!1),n||(eu(null),P(null)),Z(+(G>=22)),Q(q),ea(3),el(!0),ei(""),eN(),ey(),ev())},[s,n,G,q,eN,ey,ev]),(0,r.useEffect)(()=>{(3===g||5===g)&&ew(M,C,ec)},[g,M,C,ec,K,J,ew]),(0,r.useEffect)(()=>{var e;if(!n||!em)return;let t=null==(e=V[J])?void 0:e.dateStr;if(!t)return;let s=(0,x.gH)({openTime:em.openTime,closeTime:em.closeTime,settings:em.settings,targetTime:K,targetDate:t,durationHours:1}),a=0===J&&p(K,G,s.openTime||em.openTime,s.closeTime||em.closeTime),r=u(s.openTime||em.openTime,s.closeTime||em.closeTime);if(!r.includes(K)||!s.isOpen||a){let e=r.find(e=>!(0===J&&p(e,G,s.openTime||em.openTime,s.closeTime||em.closeTime))&&(0,x.gH)({openTime:em.openTime,closeTime:em.closeTime,settings:em.settings,targetTime:e,targetDate:t,durationHours:1}).isOpen);e&&Q(e)}},[n,em,J,V,G,K]);let ek=(0,r.useMemo)(()=>O.filter(e=>{let t=!0;if("FAVORITES"===D)t=T.has(e.title);else if("POPULAR"===D)t=!!e.isPopular;else if("ALL"!==D){var s;t=e.genreId===D||e.genre===C||!!(null==(s=e.genreIds)?void 0:s.includes(D))}let a=I.trim().toLowerCase(),r=!a||e.title.toLowerCase().includes(a)||e.englishTitle&&e.englishTitle.toLowerCase().includes(a)||e.genre&&e.genre.toLowerCase().includes(a);return t&&r}),[O,D,C,T,I]),eD=async(e,t)=>{t.stopPropagation();let s=e.title,a=T.has(s);k(e=>{let t=new Set(e);return a?t.delete(s):t.add(s),t});try{if(a){if(!(await fetch("/api/user/game-preferences?gameTitle=".concat(encodeURIComponent(s)),{method:"DELETE"})).ok)throw Error("خطا در حذف از علاقه‌مندی‌ها");v.o.success("\xab".concat(s,"\xbb از لیست علاقه‌مندی‌های شما حذف شد"))}else{let t=await fetch("/api/user/game-preferences",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gameTitle:s,category:function(e){if(!e)return"STRATEGY";let t=e.toLowerCase();return t.includes("استراتژیک")||t.includes("strategy")?"STRATEGY":t.includes("خانوادگی")||t.includes("family")?"FAMILY":t.includes("مخفی")||t.includes("استنتاجی")||t.includes("deduction")?"DEDUCTION":t.includes("مهمانی")||t.includes("پارتی")||t.includes("دورهمی")||t.includes("party")?"PARTY":t.includes("جنگی")||t.includes("war")?"WAR":t.includes("دو نفره")||t.includes("دونفره")||t.includes("duel")?"DUEL":t.includes("کارتی")||t.includes("card")?"CARD":t.includes("اقتصادی")||t.includes("مدیریتی")||t.includes("economic")?"ECONOMIC":t.includes("ماجراجویی")||t.includes("تعاونی")||t.includes("همکاری")||t.includes("adventure")?"ADVENTURE":t.includes("انتزاعی")||t.includes("فکری")||t.includes("abstract")?"ABSTRACT":"STRATEGY"}(e.genre),skillLevel:"ALL_LEVELS"})});if(!t.ok){if(401===t.status)throw Error("برای ذخیره بازی‌های موردعلاقه لطفاً ابتدا وارد حساب کاربری شوید");throw Error("خطا در افزودن به علاقه‌مندی‌ها")}v.o.success("\xab".concat(s,"\xbb به لیست علاقه‌مندی‌های شما افزوده شد ⭐️"))}}catch(e){k(e=>{let t=new Set(e);return a?t.add(s):t.delete(s),t}),v.o.error(e.message||"خطا در بروزرسانی علاقه‌مندی")}},eS=async()=>{if(!M&&!F&&(!C||"ALL"===D)){v.o.error("لطفاً یک بازی یا ژانر مشخص را انتخاب کنید"),N(1);return}if(!em)return void v.o.error("لطفاً کافه‌گیم مورد نظر خود را انتخاب کنید");let e=V[J];if(!e||!K){v.o.error("لطفاً تاریخ و ساعت معتبر انتخاب کنید"),N(3);return}if(0===J&&p(K,G,null==em?void 0:em.openTime,null==em?void 0:em.closeTime)){v.o.error("ساعت انتخابی برای امروز سپری شده است. لطفاً ساعت آینده را انتخاب کنید."),N(3);return}ej(!0);try{let t=e.dateStr;if(5>parseInt(K.split(":")[0],10)){let s=new Date(new Date("".concat(e.dateStr,"T12:00:00Z")).getTime()+864e5),a=s.getUTCFullYear(),r=String(s.getUTCMonth()+1).padStart(2,"0"),l=String(s.getUTCDate()).padStart(2,"0");t="".concat(a,"-").concat(r,"-").concat(l)}let s="".concat(t,"T").concat(K,":00+03:30"),r=new Date(s),l={gameTitle:(null==M?void 0:M.title)||void 0,genre:(null==M?void 0:M.genre)||("همه بازی‌ها"!==C?C:"عمومی"),cafeId:em.id,startTime:r.toISOString(),playersNeeded:es,isPublic:er},n=await fetch("/api/tables/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)}),o=await n.json();if(!n.ok||!o.success)throw Error(o.error||"خطا در ثبت میز بازی");let d=o.data;a(!1),"UPCOMING"===d.status?(v.o.success("\uD83C\uDF89 میز بازی شما با موفقیت ثبت و منتشر شد!"),window.dispatchEvent(new CustomEvent("event-updated")),i.push("/events/".concat(d.id))):"PENDING_PAYMENT"===d.status?(v.o.info("میز با موفقیت ایجاد شد. در حال انتقال به درگاه پرداخت..."),i.push("/checkout/table/".concat(d.id))):i.push("/events")}catch(e){v.o.error(e.message||"خطا در برقراری ارتباط با سرور")}finally{ej(!1)}};return{step:g,setStep:N,open:s,onOpenChange:a,initialCafeId:n,genres:y,favoriteGames:T,selectedGenreId:D,selectedGenreName:C,cafeScopeName:L,isLoadingGames:z,gamesError:Y,handleSelectGenre:(e,t)=>{S(e),A(t),R(""),U(null),H(!1),N(2)},loadGames:eN,games:O,filteredGames:ek,gameSearch:I,setGameSearch:R,selectedGame:M,isContinuingWithGenre:F,handleSelectGame:e=>{U(e),H(!1),e.maxPlayers&&e.maxPlayers>1&&ea(Math.max(1,Math.min(6,e.maxPlayers-1))),N(3)},handleContinueWithGenre:()=>{U(null),H(!0),N(3)},toggleFavorite:eD,dayOptions:V,selectedDayIndex:J,setSelectedDayIndex:Z,selectedTime:K,setSelectedTime:Q,currentIranHour:G,activeTableDates:W,hourlyDiscountsMap:ee,quickChangeHourAndReload:eT,neededPlayers:es,setNeededPlayers:ea,isPublic:er,setIsPublic:el,description:en,setDescription:ei,cafes:eo,selectedCafeCity:ec,setSelectedCafeCity:ex,profileCity:m,selectedCafe:em,setSelectedCafe:eu,isLoadingCafes:ep,cafesError:eb,isSubmitting:ef,loadCafes:ew,handleSubmit:eS}}({open:s,onOpenChange:l,userCity:n,initialCafeId:i});return(0,a.jsx)(N.Provider,{value:o,children:t})}function w(){let e=(0,r.useContext)(N);if(!e)throw Error("useCreateTableContext must be used within a CreateTableProvider");return e}function T(){let{step:e,setStep:t,selectedGenreId:s,selectedGame:r,isContinuingWithGenre:l}=w();return(0,a.jsx)("div",{className:"grid grid-cols-5 gap-1 pt-1 w-full box-border",children:g.map(n=>{let i=e===n.num,o=e>n.num,d=n.num<e||2===n.num&&!!s||3===n.num&&!!(r||l);return(0,a.jsxs)("button",{type:"button",disabled:!d&&!i,onClick:()=>{d&&t(n.num)},className:"flex flex-col items-center justify-center py-1.5 px-0.5 sm:px-1 rounded-xl text-[10px] sm:text-[11px] font-bold transition-all min-w-0 ".concat(i?"bg-emerald-600 text-white shadow-sm shadow-emerald-600/30":o?"bg-emerald-50 text-emerald-700 hover:bg-emerald-100 border border-emerald-200":"bg-slate-100 text-slate-400 opacity-60"),children:[(0,a.jsx)("span",{className:"text-xs leading-none mb-0.5",children:o?"✓":n.emoji}),(0,a.jsx)("span",{className:"truncate w-full text-center",children:n.label})]},n.num)})})}var k=s(11647),D=s(16645),S=s(39347),C=s(8198),A=s(89559);function L(){let{initialCafeId:e,cafeScopeName:t,favoriteGames:s,genres:r,isLoadingGames:l,gamesError:i,loadGames:d,handleSelectGenre:x}=w();return(0,a.jsxs)("div",{className:"space-y-4",children:[e&&(0,a.jsxs)("div",{className:"flex items-center gap-2 p-2.5 rounded-2xl bg-purple-50/80 border border-purple-200/80 text-purple-900 text-xs font-semibold",children:[(0,a.jsx)("span",{className:"text-base",children:"☕"}),(0,a.jsxs)("span",{className:"truncate",children:["نمایش بازی‌ها و ژانرهای موجود در کافه ",(0,a.jsx)("strong",{className:"font-black text-purple-950",children:t||"انتخابی"})]})]}),(0,a.jsx)("div",{className:"flex items-center",children:(0,a.jsxs)("span",{className:"text-xs font-bold text-slate-700 flex items-center gap-1.5",children:[(0,a.jsx)(D.A,{className:"w-4 h-4 text-purple-600"})," سبک یا ژانر بازی را مشخص کن:"]})}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>x("FAVORITES","علاقه‌های من"),className:"flex items-center justify-center gap-2 p-3 rounded-2xl border border-amber-200 bg-amber-50/70 hover:bg-amber-100/80 text-amber-900 font-bold text-xs transition-all text-center shadow-sm",children:[(0,a.jsx)(S.A,{className:"w-4 h-4 text-amber-500 fill-amber-500 shrink-0"}),(0,a.jsx)("span",{children:"علاقه‌های من"}),(0,a.jsx)(k.E,{variant:"outline",className:"bg-white/80 border-amber-300 text-amber-800 text-[10px] px-1.5 py-0 font-mono",children:s.size})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>x("POPULAR","محبوب‌ترین‌ها"),className:"flex items-center justify-center gap-2 p-3 rounded-2xl border border-rose-200 bg-rose-50/70 hover:bg-rose-100/80 text-rose-900 font-bold text-xs transition-all text-center shadow-sm",children:[(0,a.jsx)(C.A,{className:"w-4 h-4 text-rose-500 fill-rose-500 shrink-0"}),(0,a.jsx)("span",{children:"محبوب‌ترین‌ها"})]})]}),(0,a.jsxs)("div",{className:"pt-2 border-t border-slate-100 space-y-2.5",children:[(0,a.jsx)("span",{className:"text-[11px] font-semibold text-slate-500 block",children:e?"ژانرهای موجود در این کافه:":"دسته‌بندی‌ها و ژانرهای بردگیم:"}),l?(0,a.jsx)("div",{className:"grid grid-cols-2 gap-2",children:Array.from({length:6}).map((e,t)=>(0,a.jsx)("div",{className:"h-11 bg-slate-100 rounded-xl animate-pulse"},t))}):i?(0,a.jsxs)("div",{className:"p-4 bg-rose-50 border border-rose-200 rounded-2xl text-center space-y-2",children:[(0,a.jsx)("p",{className:"text-xs text-rose-700",children:i}),(0,a.jsxs)(n.$,{size:"sm",variant:"outline",onClick:d,className:"text-xs border-rose-300 text-rose-700 hover:bg-rose-100",children:[(0,a.jsx)(A.A,{className:"w-3.5 h-3.5 ml-1.5"})," تلاش دوباره"]})]}):0===r.length?(0,a.jsxs)("div",{className:"p-4 bg-slate-50 border border-slate-200 rounded-2xl text-center space-y-1.5",children:[(0,a.jsx)("p",{className:"text-xs font-bold text-slate-700",children:"ژانری برای این کافه ثبت نشده است"}),(0,a.jsx)("p",{className:"text-[11px] text-slate-500",children:"می‌توانید کاتالوگ را به صورت مستقیم مشاهده کنید."})]}):(0,a.jsx)("div",{className:"grid grid-cols-2 gap-2 max-h-[260px] overflow-y-auto px-1 py-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:r.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>x(e.id,e.name),className:"flex items-center justify-between p-3 rounded-2xl border border-slate-200 bg-white hover:bg-emerald-50 hover:border-emerald-300 text-slate-800 font-semibold text-xs transition-all text-right shadow-sm group",children:[(0,a.jsx)("span",{className:"truncate group-hover:text-emerald-700",children:e.name}),(0,a.jsx)(o.A,{className:"w-3.5 h-3.5 text-slate-400 group-hover:text-emerald-600 shrink-0"})]},e.id))}),(0,a.jsxs)("button",{type:"button",onClick:()=>x("ALL",e?"همه بازی‌های این کافه":"همه بازی‌ها"),className:"w-full flex items-center justify-center gap-2 p-2.5 rounded-2xl border border-slate-200 bg-slate-50/80 hover:bg-emerald-50 hover:border-emerald-300 text-slate-800 font-bold text-xs transition-all text-center shadow-sm",children:[(0,a.jsx)(c.A,{className:"w-4 h-4 text-emerald-600"}),(0,a.jsx)("span",{children:e?"نمایش همه بازی‌های این کافه بدون فیلتر ژانر":"نمایش کاتالوگ همه بازی‌ها بدون فیلتر ژانر"})]})]})]})}var P=s(65142),O=s(5917),E=s(86651),I=s(91169);function R(){let{setStep:e,selectedGenreId:t,selectedGenreName:s,selectedGame:r,favoriteGames:l,filteredGames:i,gameSearch:d,setGameSearch:c,handleSelectGame:x,handleContinueWithGenre:m,toggleFavorite:u}=w();return(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between bg-emerald-50/80 border border-emerald-200 rounded-2xl p-2.5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm",children:"\uD83E\uDDE9"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-[10px] text-emerald-600 font-semibold block",children:"ژانر انتخابی:"}),(0,a.jsx)("span",{className:"text-xs font-bold text-emerald-900",children:s})]})]}),(0,a.jsx)(n.$,{variant:"ghost",size:"sm",onClick:()=>e(1),className:"h-8 text-xs text-emerald-700 hover:bg-emerald-100 rounded-xl px-2.5 font-bold",children:"تغییر ژانر"})]}),"ALL"!==t&&"FAVORITES"!==t&&"POPULAR"!==t&&(0,a.jsxs)("button",{type:"button",onClick:m,className:"w-full flex items-center justify-between p-3 rounded-2xl bg-gradient-to-r from-purple-600 to-indigo-600 hover:from-purple-700 hover:to-indigo-700 text-white font-bold text-xs shadow-md shadow-purple-600/20 transition-all",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(O.A,{className:"w-4 h-4"}),(0,a.jsxs)("span",{children:["ادامه با کل ژانر \xab",s,"\xbb (بدون تعیین بازی خاص)"]})]}),(0,a.jsx)(o.A,{className:"w-4 h-4"})]}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(E.A,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-slate-400 h-4 w-4"}),(0,a.jsx)(P.p,{placeholder:"جستجوی نام بازی (مثلاً Catan, استوژیت)...",value:d,onChange:e=>c(e.target.value),className:"pr-9 bg-slate-50 border-slate-200 text-slate-900 text-xs h-10 rounded-xl focus:border-emerald-500 focus:bg-white"})]}),0===i.length?(0,a.jsxs)("div",{className:"p-8 text-center bg-slate-50 border border-slate-200 rounded-2xl space-y-2",children:[(0,a.jsx)("p",{className:"text-xs font-bold text-slate-600",children:"FAVORITES"===t?"هنوز بازی‌ای به لیست علاقه‌مندی‌های خود اضافه نکرده‌اید.":"بازی‌ای با این نام در این بخش یافت نشد."}),(0,a.jsx)("p",{className:"text-[11px] text-slate-400",children:"FAVORITES"===t?"می‌توانید با کلیک روی ستاره ⭐️ در کنار هر بازی، آن را به علایق خود اضافه کنید.":"می‌توانید عبارت جستجو را تغییر دهید یا به ژانر دیگری بروید."})]}):(0,a.jsx)("div",{className:"space-y-2 max-h-[320px] overflow-y-auto pr-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:i.map(e=>{let t=(null==r?void 0:r.title)===e.title,s=l.has(e.title);return(0,a.jsxs)("div",{onClick:()=>x(e),className:"flex items-center justify-between p-3 rounded-2xl border transition-all cursor-pointer ".concat(t?"bg-emerald-50/80 border-emerald-500 ring-2 ring-emerald-500/20 text-emerald-950 shadow-sm":"bg-slate-50/70 hover:bg-emerald-50/30 border-slate-200 hover:border-emerald-200"),children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0 pr-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h4",{className:"font-bold text-xs text-slate-900 truncate",children:e.title}),e.englishTitle&&(0,a.jsxs)("span",{className:"text-[10px] text-slate-400 font-mono truncate dir-ltr text-right",children:["(",e.englishTitle,")"]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[e.genre&&(0,a.jsx)("span",{className:"text-[10px] bg-slate-200/80 text-slate-700 px-1.5 py-0.2 rounded-md font-medium",children:e.genre}),(0,a.jsxs)("span",{className:"text-[10px] text-slate-500 flex items-center gap-0.5",children:[(0,a.jsx)(I.A,{className:"w-3 h-3 text-slate-400"}),e.minPlayers||2,"-",e.maxPlayers||6," نفر"]})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 shrink-0 mr-2",children:[(0,a.jsx)("button",{type:"button",title:s?"حذف از علاقه‌مندی‌ها":"افزودن به علاقه‌مندی‌ها",onClick:t=>u(e,t),className:"p-1.5 rounded-lg hover:bg-slate-200/60 transition-colors",children:(0,a.jsx)(S.A,{className:"w-4 h-4 transition-colors ".concat(s?"text-amber-500 fill-amber-500":"text-slate-300 hover:text-amber-400")})}),(0,a.jsx)("div",{className:"w-5 h-5 rounded-full border flex items-center justify-center transition-all ".concat(t?"bg-emerald-600 border-emerald-600 text-white":"border-slate-300 text-transparent"),children:(0,a.jsx)(O.A,{className:"w-3 h-3"})})]})]},e.title)})})]})}var M=s(76444),U=s(10383),F=s(26983);function H(){var e,t,s;let{setStep:l,selectedGame:i,selectedGenreName:o,dayOptions:d,selectedDayIndex:c,setSelectedDayIndex:h,activeTableDates:b,currentIranHour:g,selectedTime:f,setSelectedTime:j,hourlyDiscountsMap:v,initialCafeId:N,selectedCafe:y}=w(),T=null==(e=d[c])?void 0:e.dateStr,k=N&&y?(0,x.gH)({openTime:y.openTime,closeTime:y.closeTime,settings:y.settings,targetDate:T}):null,D=(0,r.useMemo)(()=>N&&y?k&&!1===k.isOpen?[]:u((null==k?void 0:k.openTime)||y.openTime,(null==k?void 0:k.closeTime)||y.closeTime):m,[N,y,k]);return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between bg-emerald-50/80 border border-emerald-200 rounded-2xl p-2.5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm",children:"\uD83C\uDFB2"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-[10px] text-emerald-600 font-semibold block",children:"بازی تعیین‌شده:"}),(0,a.jsx)("span",{className:"text-xs font-bold text-emerald-900",children:i?i.title:"کل ژانر ".concat(o)})]})]}),(0,a.jsx)(n.$,{variant:"ghost",size:"sm",onClick:()=>l(2),className:"h-8 text-xs text-emerald-700 hover:bg-emerald-100 rounded-xl px-2.5 font-bold",children:"تغییر بازی"})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)(M.J,{className:"text-xs font-bold text-slate-700 mb-2 block flex items-center gap-1.5",children:[(0,a.jsx)(U.A,{className:"w-4 h-4 text-emerald-600"})," روز برگزاری میز:"]}),(0,a.jsx)("div",{className:"grid grid-cols-3 gap-2",children:d.map((e,t)=>{let s=c===t,r=b.has(e.dateStr),l=!1;N&&y&&(l=!(0,x.gH)({openTime:y.openTime,closeTime:y.closeTime,settings:y.settings,targetDate:e.dateStr}).isOpen);let n=r||l;return(0,a.jsxs)("button",{type:"button",disabled:n,onClick:()=>h(t),className:"py-2 px-1.5 rounded-2xl text-xs font-bold transition-all text-center border flex flex-col items-center justify-center min-h-[56px] ".concat(n?"bg-slate-100/90 text-slate-400 border-slate-200 cursor-not-allowed opacity-60":s?"bg-emerald-600 border-emerald-600 text-white shadow-md shadow-emerald-600/20 ring-2 ring-emerald-500/20":"bg-slate-50 hover:bg-emerald-50/50 hover:border-emerald-200 border-slate-200 text-slate-700"),children:[(0,a.jsx)("span",{className:"text-xs font-bold ".concat(n?"line-through opacity-80":""),children:e.label}),(0,a.jsxs)("span",{className:"text-[11px] ".concat(s&&!n?"text-emerald-100 font-semibold":"text-slate-500 font-medium"," mt-0.5"),children:["(",e.weekdayName,")"]}),r?(0,a.jsx)("span",{className:"text-[9px] text-rose-500 font-bold mt-0.5 whitespace-nowrap",children:"میز فعال دارید"}):l?(0,a.jsx)("span",{className:"text-[9px] text-amber-600 font-bold mt-0.5 whitespace-nowrap",children:"کافه تعطیل است"}):null]},e.dateStr)})}),d.every(e=>b.has(e.dateStr))&&(0,a.jsxs)("div",{className:"mt-2.5 p-3 rounded-2xl bg-amber-50 border border-amber-200 text-amber-900 text-xs flex items-start gap-2",children:[(0,a.jsx)("span",{className:"text-base leading-none",children:"⚠️"}),(0,a.jsx)("span",{children:"شما در تمامی روزهای مجاز (امروز، فردا و پس‌فردا) میز فعال دارید. طبق قوانین، امکان ایجاد بیش از یک میز فعال در یک روز وجود ندارد."})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-1.5 mb-2",children:[(0,a.jsxs)(M.J,{className:"text-xs font-bold text-slate-700 flex items-center gap-1.5",children:[(0,a.jsx)(F.A,{className:"w-4 h-4 text-emerald-600"})," ساعت شروع بازی:"]}),k&&(0,a.jsxs)("span",{className:"text-[10px] sm:text-[11px] font-bold text-emerald-800 bg-emerald-50 border border-emerald-200 px-2 py-0.5 rounded-lg flex items-center gap-1",children:["\uD83D\uDD52 ساعت کاری کافه: ",k.openTime," الی ",k.closeTime]})]}),(0,a.jsx)("div",{className:"grid grid-cols-4 sm:grid-cols-6 md:grid-cols-8 gap-1.5",children:D.map(e=>{let t=0===c&&p(e,g,(null==k?void 0:k.openTime)||(null==y?void 0:y.openTime),(null==k?void 0:k.closeTime)||(null==y?void 0:y.closeTime)),s=!1;N&&y&&(s=!(0,x.gH)({openTime:y.openTime,closeTime:y.closeTime,settings:y.settings,targetTime:e,targetDate:T,durationHours:1}).isOpen);let r=t||s,l=f===e,n=null==v?void 0:v[e],i=n&&n.maxDiscountPercent>0;return(0,a.jsxs)("button",{type:"button",disabled:r,onClick:()=>j(e),className:"py-2 px-1 rounded-xl text-xs font-mono font-bold transition-all border flex flex-col items-center justify-center min-h-[48px] ".concat(r?"bg-slate-100 text-slate-300 border-slate-200 cursor-not-allowed opacity-50":l?"bg-emerald-600 border-emerald-600 text-white shadow-sm ring-2 ring-emerald-500/20":"bg-slate-50 hover:bg-emerald-50/50 hover:border-emerald-200 border-slate-200 text-slate-700"),children:[(0,a.jsx)("span",{children:e}),!r&&i&&(0,a.jsxs)("span",{className:"text-[9px] font-black px-1 rounded-md mt-0.5 whitespace-nowrap animate-pulse ".concat(l?"bg-emerald-800/90 text-emerald-100":"bg-emerald-100 text-emerald-800"),children:["\uD83D\uDD25 تا ",n.maxDiscountPercent,"٪"]})]},e)})}),N&&y?(0,a.jsx)("p",{className:"text-[10px] text-slate-400 mt-1.5",children:"* ساعت‌های گذشته غیرفعال هستند."}):0===c?(0,a.jsx)("p",{className:"text-[10px] text-slate-400 mt-1.5",children:"* ساعت‌های گذشته برای روز جاری غیرفعال هستند."}):null,N&&y&&((null==k?void 0:k.isOpen)===!1||0===D.length||D.every(e=>{let t=0===c&&p(e,g,(null==k?void 0:k.openTime)||(null==y?void 0:y.openTime),(null==k?void 0:k.closeTime)||(null==y?void 0:y.closeTime)),s=(0,x.gH)({openTime:y.openTime,closeTime:y.closeTime,settings:y.settings,targetTime:e,targetDate:T,durationHours:1});return t||!s.isOpen}))&&(0,a.jsxs)("div",{className:"mt-2.5 p-3 rounded-2xl bg-amber-50 border border-amber-200 text-amber-900 text-xs flex items-start gap-2",children:[(0,a.jsx)("span",{className:"text-base leading-none",children:"⚠️"}),(0,a.jsx)("span",{children:(null==k?void 0:k.isOpen)===!1?"کافه \xab".concat(y.name,"\xbb در روز ").concat(null==(t=d[c])?void 0:t.label," تعطیل است. لطفاً روز دیگری را انتخاب کنید."):"در روز ".concat(null==(s=d[c])?void 0:s.label," هیچ ساعت بازی فعالی برای کافه \xab").concat(y.name,"\xbb در دسترس نیست. لطفاً روز دیگری را انتخاب کنید.")})]})]})]})}var z=s(44846),$=s(39068),Y=s(99708);function _(){let{neededPlayers:e,setNeededPlayers:t,isPublic:s,setIsPublic:r,description:l,setDescription:n}=w();return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("div",{className:"bg-slate-50 border border-slate-200 rounded-2xl p-4",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(M.J,{className:"text-xs font-bold text-slate-800 block",children:"\uD83D\uDC65 چند نفر هم‌بازی نیاز داری؟ (غیر از خودت)"}),(0,a.jsxs)("span",{className:"text-[11px] text-slate-500 mt-0.5 block",children:["ظرفیت کل میز:"," ",(0,a.jsxs)("span",{className:"font-bold text-emerald-700",children:[e+1," نفر"]})," (شما + ",e," هم‌بازی)"]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 bg-white px-2 py-1 rounded-xl border border-slate-200 shadow-sm",children:[(0,a.jsx)("button",{type:"button",onClick:()=>t(e=>Math.min(10,e+1)),className:"w-8 h-8 rounded-lg bg-slate-100 hover:bg-slate-200 text-slate-700 font-black text-base flex items-center justify-center transition-colors disabled:opacity-40",disabled:e>=10,title:"افزایش هم‌بازی",children:"+"}),(0,a.jsx)("span",{className:"w-8 text-center font-bold text-base text-emerald-700 font-mono",children:e}),(0,a.jsx)("button",{type:"button",onClick:()=>t(e=>Math.max(1,e-1)),className:"w-8 h-8 rounded-lg bg-slate-100 hover:bg-slate-200 text-slate-700 font-black text-base flex items-center justify-center transition-colors disabled:opacity-40",disabled:e<=1,title:"کاهش هم‌بازی",children:"-"})]})]})}),(0,a.jsxs)("div",{className:"flex items-center justify-between bg-slate-50 border border-slate-200 rounded-2xl p-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2.5",children:[s?(0,a.jsx)($.A,{className:"w-5 h-5 text-emerald-600 shrink-0"}):(0,a.jsx)(Y.A,{className:"w-5 h-5 text-amber-600 shrink-0"}),(0,a.jsxs)("div",{children:[(0,a.jsx)(M.J,{className:"text-xs font-bold text-slate-800 block",children:s?"میز عمومی (نمایش برای همه کاربران)":"میز خصوصی (فقط با لینک اختصاصی)"}),(0,a.jsx)("span",{className:"text-[10px] text-slate-500",children:s?"تمام بازیکنان پلیمو می‌توانند میز شما را در لیست ببینند و ملحق شوند.":"فقط افرادی که لینک میز را دارند امکان مشاهده و عضویت دارند."})]})]}),(0,a.jsx)(z.d,{checked:s,onCheckedChange:r,className:"data-[state=checked]:bg-emerald-600"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(M.J,{className:"text-xs font-medium text-slate-600 mb-1.5 block",children:"یادداشت یا توضیحات برای هم‌بازی‌ها (اختیاری):"}),(0,a.jsx)(P.p,{placeholder:"مثال: بازی رو آموزش میدم، لطفاً سر وقت بیاید...",value:l,onChange:e=>n(e.target.value),maxLength:150,className:"bg-slate-50 border-slate-200 text-xs text-slate-900 rounded-xl focus:border-emerald-500 focus:bg-white"})]})]})}var V=s(15239),G=s(21873),B=s(51950);function J(){var e;let{setStep:t,initialCafeId:s,cafeScopeName:r,selectedCafe:l,setSelectedCafe:i,cafes:o,selectedCafeCity:d,setSelectedCafeCity:c,profileCity:x,isLoadingCafes:m,cafesError:u,loadCafes:p,selectedGame:b,selectedGenreName:g,dayOptions:f,selectedDayIndex:j,selectedTime:v,neededPlayers:N,quickChangeHourAndReload:y}=w();return(0,a.jsxs)("div",{className:"space-y-3.5 w-full box-border",children:[s?(0,a.jsxs)("div",{className:"flex items-center justify-between bg-emerald-50/80 border border-emerald-200 rounded-2xl p-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-base",children:"\uD83D\uDD12"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-[10px] text-emerald-600 font-semibold block",children:"مکان برگزاری (قفل‌شده روی کافه انتخابی):"}),(0,a.jsx)("span",{className:"text-xs font-bold text-emerald-900",children:(null==l?void 0:l.name)||r})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:[(null==l?void 0:l.openTime)&&(null==l?void 0:l.closeTime)&&(0,a.jsxs)("span",{className:"text-[10px] bg-emerald-100/90 text-emerald-800 border border-emerald-300/50 px-2 py-0.5 rounded-lg font-bold",children:["\uD83D\uDD52 ",l.openTime," الی ",l.closeTime]}),(0,a.jsx)(k.E,{className:"bg-emerald-600 text-white border-0 text-[10px] px-2.5 py-1 rounded-xl font-bold",children:"کافه انتخاب‌شده"})]})]}):(0,a.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-2 bg-emerald-50/60 border border-emerald-100 rounded-2xl p-2.5 w-full box-border",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-xs font-bold text-slate-800 min-w-0",children:[(0,a.jsx)(G.A,{className:"w-3.5 h-3.5 text-emerald-600 shrink-0"}),(0,a.jsxs)("span",{className:"truncate",children:["کافه‌های شهر ",(0,a.jsx)("span",{className:"text-emerald-700 font-black",children:d}),":"]})]}),(0,a.jsxs)("select",{value:d,onChange:e=>c(e.target.value),className:"text-[11px] font-semibold bg-white border border-emerald-200 text-emerald-900 rounded-xl px-2.5 py-1 focus:outline-none focus:ring-1 focus:ring-emerald-500 cursor-pointer shadow-sm shrink-0",children:[(0,a.jsxs)("option",{value:x,children:["شهر من (",x,")"]}),h.filter(e=>e!==x).map(e=>(0,a.jsx)("option",{value:e,children:e},e)),(0,a.jsx)("option",{value:"همه",children:"همه شهرها"})]})]}),m&&!l?(0,a.jsx)("div",{className:"space-y-2 py-2 w-full box-border",children:Array.from({length:3}).map((e,t)=>(0,a.jsx)("div",{className:"h-16 bg-slate-100 rounded-2xl animate-pulse w-full"},t))}):u&&!l?(0,a.jsxs)("div",{className:"p-4 bg-rose-50 border border-rose-200 rounded-2xl text-center space-y-2 w-full box-border",children:[(0,a.jsx)("p",{className:"text-xs text-rose-700",children:u}),(0,a.jsxs)(n.$,{size:"sm",variant:"outline",onClick:()=>p(b,g,d),className:"text-xs border-rose-300 text-rose-700 hover:bg-rose-100",children:[(0,a.jsx)(A.A,{className:"w-3.5 h-3.5 ml-1.5"})," تلاش مجدد"]})]}):0!==o.length||l?(0,a.jsx)("div",{className:"space-y-2.5 max-h-[260px] overflow-y-auto px-1 py-1 w-full box-border [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:(s&&l?[l]:o).map(e=>{let t=(null==l?void 0:l.id)===e.id,r=0===e.hourlyRate||e.isFree;return(0,a.jsxs)("div",{onClick:()=>!s&&i(e),className:"rounded-2xl border p-2.5 sm:p-3 transition-all flex flex-col gap-2 w-full box-border ".concat(s?"bg-emerald-50/80 border-emerald-500 ring-2 ring-emerald-500/20 text-emerald-950 shadow-sm cursor-default":t?"bg-emerald-50/80 border-emerald-500 ring-2 ring-emerald-500/20 text-emerald-950 shadow-sm cursor-pointer":"bg-slate-50/70 hover:bg-emerald-50/30 border-slate-200 hover:border-emerald-200 cursor-pointer"),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 w-full",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2.5 flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"w-9 h-9 sm:w-10 sm:h-10 rounded-xl bg-white border border-slate-200 flex items-center justify-center text-lg shrink-0 overflow-hidden relative shadow-sm",children:e.logo?(0,a.jsx)(V.default,{src:e.logo,alt:e.name,fill:!0,className:"object-cover",sizes:"40px"}):"☕"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 flex-wrap",children:[(0,a.jsx)("h4",{className:"font-bold text-xs text-slate-900 truncate",children:e.name}),e.city&&(0,a.jsx)("span",{className:"text-[9px] bg-slate-200 text-slate-700 px-1.5 py-0.2 rounded shrink-0",children:e.city}),e.openTime&&e.closeTime&&(0,a.jsxs)("span",{className:"text-[9px] bg-slate-100 text-slate-600 px-1.5 py-0.5 rounded-md shrink-0 flex items-center gap-0.5 border border-slate-200",children:["\uD83D\uDD52 ",e.openTime," الی ",e.closeTime]})]}),(0,a.jsx)("p",{className:"text-[10px] sm:text-[11px] text-slate-400 truncate mt-0.5",children:e.address||"آدرس ثبت نشده"})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[r?(0,a.jsx)("span",{className:"bg-emerald-50 text-emerald-700 border border-emerald-200 text-[10px] font-bold px-2 py-0.5 rounded-lg whitespace-nowrap",children:"\uD83D\uDFE2 رایگان"}):e.hasDiscount?(0,a.jsxs)("div",{className:"flex flex-col items-end",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"line-through text-slate-400 text-[10px]",children:(0,B.$g)(e.hourlyRate)}),(0,a.jsxs)("span",{className:"bg-emerald-50 text-emerald-800 border border-emerald-300 text-[10px] font-black px-1.5 py-0.5 rounded-lg whitespace-nowrap",children:["\uD83D\uDD25 ",(0,B.$g)(e.effectiveRate||e.hourlyRate)," ت"]})]}),(0,a.jsxs)("span",{className:"text-[9px] text-emerald-600 font-bold mt-0.5",children:[e.discountPercent,"٪ تخفیف"]})]}):(0,a.jsxs)("span",{className:"bg-purple-50 text-purple-700 border border-purple-200 text-[10px] font-bold px-2 py-0.5 rounded-lg whitespace-nowrap",children:["\uD83D\uDCB0 ",(0,B.$g)(e.hourlyRate)," ت/ساعت"]}),(0,a.jsx)("div",{className:"w-5 h-5 rounded-full border flex items-center justify-center shrink-0 transition-all ".concat(t||s?"bg-emerald-600 border-emerald-600 text-white":"border-slate-300 text-transparent"),children:(0,a.jsx)(O.A,{className:"w-3 h-3"})})]})]}),!r&&!e.hasDiscount&&e.alternativeDiscountSlot&&(0,a.jsxs)("div",{className:"p-2 rounded-xl bg-amber-50/90 border border-amber-200/90 text-[11px] flex items-center justify-between gap-2",children:[(0,a.jsxs)("span",{className:"text-amber-900 font-medium leading-relaxed",children:["\uD83D\uDCA1 این کافه در ساعت ",(0,a.jsx)("strong",{className:"font-bold",children:e.alternativeDiscountSlot.hour})," دارای"," ",(0,a.jsxs)("strong",{className:"text-emerald-700 font-bold",children:[e.alternativeDiscountSlot.discountPercent,"٪ تخفیف"]})," است!"]}),(0,a.jsxs)(n.$,{type:"button",size:"sm",onClick:t=>{t.stopPropagation(),y(e.alternativeDiscountSlot.hour)},className:"h-6 px-2.5 text-[10px] bg-amber-600 hover:bg-amber-700 text-white rounded-lg font-bold shrink-0 shadow-sm",children:["تغییر به ",e.alternativeDiscountSlot.hour]})]})]},e.id)})}):(0,a.jsxs)("div",{className:"p-5 bg-amber-50/70 border border-amber-200 rounded-2xl text-center space-y-3 w-full box-border",children:[(0,a.jsx)("div",{className:"w-10 h-10 mx-auto rounded-full bg-amber-100 flex items-center justify-center text-xl",children:"\uD83C\uDFB2"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs font-bold text-amber-900 leading-relaxed",children:b?"متأسفانه در ساعت ".concat(v," کافه بازی برای \xab").concat(b.title,"\xbb در شهر \xab").concat(d,"\xbb یافت نشد."):g&&"همه بازی‌ها"!==g?"متأسفانه در ساعت ".concat(v," کافه بازی برای ژانر \xab").concat(g,"\xbb در شهر \xab").concat(d,"\xbb یافت نشد."):"کافه بازی در ساعت ".concat(v," در شهر \xab").concat(d,"\xbb یافت نشد.")}),(0,a.jsx)("p",{className:"text-[11px] text-amber-700 mt-1",children:"می‌توانید ساعت یا تاریخ بازی را تغییر دهید، یا شهر دیگری را انتخاب کنید."})]}),(0,a.jsxs)("div",{className:"flex items-center justify-center flex-wrap gap-2 pt-1",children:[(0,a.jsx)(n.$,{type:"button",size:"sm",variant:"outline",onClick:()=>t(3),className:"text-xs border-amber-300 text-amber-900 hover:bg-amber-100 rounded-xl h-8 px-3 font-bold",children:"⏰ تغییر ساعت یا روز"}),(0,a.jsxs)(n.$,{type:"button",size:"sm",variant:"outline",onClick:()=>t(b?2:1),className:"text-xs border-amber-300 text-amber-900 hover:bg-amber-100 rounded-xl h-8 px-3 font-bold",children:["\uD83D\uDD04 تغییر ",b?"بازی":"ژانر"]}),(0,a.jsx)(n.$,{type:"button",size:"sm",variant:"outline",onClick:()=>c("همه"),className:"text-xs border-amber-300 text-amber-900 hover:bg-amber-100 rounded-xl h-8 px-3 font-bold",children:"\uD83C\uDF0D همه شهرها"})]})]}),l&&(0,a.jsxs)("div",{className:"bg-emerald-50/70 border border-emerald-200 rounded-2xl p-3 space-y-2 text-xs w-full box-border",children:[(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-2 text-slate-700",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("span",{className:"text-slate-400 text-[10px] block",children:"بازی:"}),(0,a.jsx)("span",{className:"font-bold text-slate-900 truncate block",children:b?b.title:"ژانر ".concat(g)})]}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("span",{className:"text-slate-400 text-[10px] block",children:"زمان:"}),(0,a.jsxs)("span",{className:"font-bold text-slate-900 truncate block",children:[null==(e=f[j])?void 0:e.label," - ساعت ",v]})]}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("span",{className:"text-slate-400 text-[10px] block",children:"کافه:"}),(0,a.jsx)("span",{className:"font-bold text-slate-900 truncate block",children:l.name})]}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("span",{className:"text-slate-400 text-[10px] block",children:"ظرفیت:"}),(0,a.jsxs)("span",{className:"font-bold text-slate-900 truncate block",children:[N+1," نفر (",N," هم‌بازی)"]})]})]}),(0,a.jsxs)("div",{className:"pt-2 border-t border-emerald-200/60 flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-slate-600 font-medium",children:"هزینه انتشار میز:"}),(0,a.jsx)("span",{className:"font-black text-sm",children:0===l.hourlyRate||l.isFree?(0,a.jsx)("span",{className:"text-emerald-700",children:"رایگان"}):l.hasDiscount?(0,a.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"line-through text-slate-400 text-xs",children:(0,B.$g)(l.hourlyRate)}),(0,a.jsxs)("span",{className:"text-emerald-700 font-bold",children:[(0,B.$g)(l.effectiveRate||l.hourlyRate)," تومان"]}),(0,a.jsxs)("span",{className:"text-[10px] bg-emerald-100 text-emerald-800 font-bold px-1.5 py-0.5 rounded-md",children:["(",l.discountPercent,"٪ تخفیف)"]})]}):(0,a.jsxs)("span",{className:"text-emerald-700 font-bold",children:[(0,B.$g)(l.hourlyRate)," تومان"]})})]})]})]})}function Z(){var e;let{step:t,setStep:s,onOpenChange:r,selectedGame:x,isContinuingWithGenre:m,selectedTime:u,activeTableDates:p,dayOptions:h,selectedDayIndex:b,isSubmitting:g,selectedCafe:f,handleSubmit:j}=w();return(0,a.jsxs)(l.Cf,{className:"w-[calc(100vw-2rem)] sm:w-full sm:max-w-lg max-h-[88vh] flex flex-col bg-white/95 backdrop-blur-xl border border-slate-100/90 text-slate-900 rounded-3xl shadow-2xl p-0 gap-0 overflow-hidden box-border [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",dir:"rtl",showCloseButton:!0,children:[(0,a.jsxs)("div",{className:"p-4 sm:p-5 pb-3 border-b border-slate-100 bg-gradient-to-b from-purple-50/50 via-white to-white shrink-0 w-full box-border",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-2.5",children:[(0,a.jsx)("div",{className:"w-9 h-9 sm:w-10 sm:h-10 rounded-2xl bg-purple-600 text-white flex items-center justify-center text-lg sm:text-xl shadow-md shadow-purple-600/20 shrink-0",children:"\uD83D\uDC51"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)(l.L3,{className:"text-sm sm:text-base font-black text-slate-900 truncate",children:"ایجاد میز بازی جدید"}),(0,a.jsxs)(l.rr,{className:"text-[11px] sm:text-xs font-bold text-purple-600 mt-0.5 truncate",children:[1===t&&"انتخاب ژانر یا سبک بازی",2===t&&"انتخاب عنوان بازی یا کل ژانر",3===t&&"تعیین روز و ساعت شروع بازی",4===t&&"تعداد هم‌بازی و حریم خصوصی میز",5===t&&"انتخاب کافه‌گیم و انتشار نهایی"]})]})]}),(0,a.jsx)(T,{})]}),(0,a.jsxs)("div",{className:"p-4 sm:p-5 overflow-y-auto flex-1 w-full box-border [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[1===t&&(0,a.jsx)(L,{}),2===t&&(0,a.jsx)(R,{}),3===t&&(0,a.jsx)(H,{}),4===t&&(0,a.jsx)(_,{}),5===t&&(0,a.jsx)(J,{})]}),(0,a.jsxs)("div",{className:"p-4 border-t border-slate-100 bg-slate-50/90 backdrop-blur-sm flex items-center justify-between shrink-0",children:[t>1?(0,a.jsxs)(n.$,{variant:"ghost",size:"sm",onClick:()=>s(t-1),className:"text-xs text-slate-600 hover:text-slate-900 rounded-xl flex items-center gap-1",children:[(0,a.jsx)(i.A,{className:"w-4 h-4"}),"مرحله قبل"]}):(0,a.jsx)(n.$,{variant:"ghost",size:"sm",onClick:()=>r(!1),className:"text-xs text-slate-500 hover:text-slate-800 rounded-xl",children:"انصراف"}),t<5?(0,a.jsxs)(n.$,{size:"sm",disabled:2===t&&!x&&!m||3===t&&(!u||p.has(null==(e=h[b])?void 0:e.dateStr)),onClick:()=>s(t+1),className:"bg-gradient-to-r from-purple-600 to-indigo-600 hover:from-purple-700 hover:to-indigo-700 text-white font-bold text-xs px-5 py-2 rounded-xl shadow-md shadow-purple-600/20 flex items-center gap-1.5 disabled:opacity-50",children:["ادامه",(0,a.jsx)(o.A,{className:"w-4 h-4"})]}):(0,a.jsx)(n.$,{size:"sm",disabled:g||!f,onClick:j,className:"bg-gradient-to-r from-purple-600 to-indigo-600 hover:from-purple-700 hover:to-indigo-700 text-white font-black text-xs px-6 py-2.5 rounded-xl shadow-lg shadow-purple-600/30 flex items-center gap-2 disabled:opacity-50 active:scale-95 transition-transform",children:g?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.A,{className:"w-4 h-4 animate-spin"}),"در حال ثبت میز..."]}):(null==f?void 0:f.hourlyRate)===0||(null==f?void 0:f.isFree)?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(c.A,{className:"w-4 h-4"}),"\uD83D\uDE80 انتشار رایگان میز بازی"]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{children:"\uD83D\uDCB3"}),"تایید و پرداخت هزینه انتشار"]})})]})]})}function W(e){return(0,a.jsx)(l.lG,{open:e.open,onOpenChange:e.onOpenChange,children:(0,a.jsx)(y,{...e,children:(0,a.jsx)(Z,{})})})}},65142:(e,t,s)=>{s.d(t,{p:()=>l});var a=s(95155);s(12115);var r=s(64269);function l(e){let{className:t,type:s,...l}=e;return(0,a.jsx)("input",{type:s,"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",t),...l})}},76444:(e,t,s)=>{s.d(t,{J:()=>n});var a=s(95155);s(12115);var r=s(10489),l=s(64269);function n(e){let{className:t,...s}=e;return(0,a.jsx)(r.b,{"data-slot":"label",className:(0,l.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...s})}},81703:(e,t,s)=>{s.d(t,{G:()=>d});var a=s(95155),r=s(52619),l=s.n(r),n=s(51834),i=s(3998),o=s(7420);function d(e){let{isOpen:t,onClose:s,title:r="ورود به حساب کاربری",description:d="برای استفاده از این امکانات و حضور در دنیای پلیمو، لطفاً ابتدا وارد حساب کاربری خود شوید یا ثبت‌نام کنید."}=e;return(0,a.jsx)(n.lG,{open:t,onOpenChange:e=>!e&&s(),children:(0,a.jsx)(n.Cf,{className:"sm:max-w-md w-[95%] rounded-3xl p-6 sm:p-8 bg-white",dir:"rtl",showCloseButton:!1,children:(0,a.jsxs)("div",{className:"text-center space-y-6",children:[(0,a.jsxs)("div",{className:"flex flex-col items-center",children:[(0,a.jsx)("div",{className:"p-4 rounded-2xl shadow-md",style:{backgroundColor:"#ffa515"},children:(0,a.jsx)(o.W,{className:"h-10 w-auto text-black"})}),(0,a.jsx)("div",{className:"text-[10px] font-bold text-gray-400 mt-2 uppercase tracking-wider",children:"Playmo.ir"})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("h3",{className:"text-lg sm:text-xl font-bold text-playmo-purple-700",children:r}),(0,a.jsx)("p",{className:"text-gray-600 text-xs sm:text-sm leading-relaxed px-2",children:d})]}),(0,a.jsxs)("div",{className:"grid gap-3 pt-2",children:[(0,a.jsx)(l(),{href:"/auth/customer/signin",className:"w-full",children:(0,a.jsx)(i.$,{className:"w-full h-11.5 py-2.5 text-sm sm:text-base font-medium bg-playmo-purple-600 hover:bg-playmo-purple-700 text-white rounded-2xl shadow-lg transition-all flex items-center justify-center gap-2",children:(0,a.jsx)("span",{children:"ورود به حساب کاربری"})})}),(0,a.jsx)(l(),{href:"/auth/customer/signup",className:"w-full",children:(0,a.jsx)(i.$,{variant:"outline",className:"w-full h-11.5 py-2.5 text-sm sm:text-base font-bold border-amber-300 text-amber-500 hover:bg-amber-50 hover:text-amber-600 hover:border-amber-400 rounded-2xl transition-all flex items-center justify-center gap-2",children:(0,a.jsx)("span",{children:"ثبت‌نام در پلیمو"})})}),(0,a.jsx)(i.$,{variant:"ghost",onClick:s,className:"w-full h-10 text-xs sm:text-sm text-playmo-purple-600 hover:text-playmo-purple-700 hover:bg-transparent mt-1",children:"بازگشت"})]})]})})})}},86948:(e,t,s)=>{s.d(t,{BT:()=>o,Wu:()=>d,ZB:()=>i,Zp:()=>l,aR:()=>n});var a=s(95155);s(12115);var r=s(64269);function l(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card",className:(0,r.cn)("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",t),...s})}function n(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card-header",className:(0,r.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),...s})}function i(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card-title",className:(0,r.cn)("leading-none font-semibold",t),...s})}function o(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card-description",className:(0,r.cn)("text-muted-foreground text-sm",t),...s})}function d(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card-content",className:(0,r.cn)("px-6",t),...s})}},98373:(e,t,s)=>{s.d(t,{AA:()=>l,D7:()=>i,L7:()=>m,gH:()=>u,nM:()=>d});var a=s(72377);let r=/^(([01]\d|2[0-3]):[0-5]\d|24:00)$/,l=["06:00","07:00","08:00","09:00","10:00","11:00","12:00","13:00","14:00","15:00","16:00","17:00","18:00","19:00","20:00","21:00","22:00","23:00","00:00","01:00","02:00","03:00","04:00","05:00"],n={0:"sunday",1:"monday",2:"tuesday",3:"wednesday",4:"thursday",5:"friday",6:"saturday"},i={saturday:"شنبه",sunday:"یکشنبه",monday:"دوشنبه",tuesday:"سه‌شنبه",wednesday:"چهارشنبه",thursday:"پنج‌شنبه",friday:"جمعه"},o=a.Ik({isOpen:a.zM().default(!0),openTime:a.Yj().regex(r,"فرمت زمان بازگشایی نامعتبر است (HH:mm)"),closeTime:a.Yj().regex(r,"فرمت زمان بسته‌شدن نامعتبر است (HH:mm)")}),d=a.Ik({id:a.Yj().min(1),title:a.Yj().max(50).optional(),daysOfWeek:a.YO(a.k5(["saturday","sunday","monday","tuesday","wednesday","thursday","friday"])).min(1,"حداقل انتخاب یک روز الزامی است"),startHour:a.Yj().regex(r,"فرمت ساعت شروع باید HH:mm باشد"),endHour:a.Yj().regex(r,"فرمت ساعت پایان باید HH:mm باشد"),discountPercent:a.ai().int().min(1,"حداقل تخفیف ۱٪ است").max(90,"حداکثر تخفیف ۹۰٪ است"),isActive:a.zM().default(!0),createdAt:a.Yj().optional()}),c=a.YO(d).max(20,"حداکثر ۲۰ قانون مجاز است"),x=a.Ik({operatingHours:a.g1(a.Yj(),o).optional(),hourlyDiscounts:c.optional(),pricing:a.g1(a.Yj(),a.bz()).optional()}).passthrough();function m(e){if(!e||"string"!=typeof e)return NaN;let t=e.trim();if(/^\d:[0-5]\d$/.test(t)&&(t="0"+t),!r.test(t))return NaN;let[s,a]=t.split(":");return 60*parseInt(s,10)+parseInt(a,10)}function u(e){var t;let{openTime:s,closeTime:a,settings:r,targetTime:l,targetDate:i,durationHours:o=1}=e,d=null;if("string"==typeof r)try{let e=JSON.parse(r),t=x.safeParse(e);d=t.success?t.data:e}catch(e){d=null}else if("object"==typeof r&&null!==r){let e=x.safeParse(r);d=e.success?e.data:r}let c=function(e){if("string"==typeof e&&/^\d{4}-\d{2}-\d{2}$/.test(e.trim())){let[t,s,a]=e.trim().split("-").map(Number);return n[new Date(Date.UTC(t,s-1,a,12,0,0)).getUTCDay()]}return n[new Date(("string"==typeof e?new Date(e):e).getTime()+126e5).getUTCDay()]}(i?(i instanceof Date,i):new Date),u=null==d||null==(t=d.operatingHours)?void 0:t[c],p=(null==u?void 0:u.openTime)||s||"10:00",h=(null==u?void 0:u.closeTime)||a||"23:00";if(u&&!1===u.isOpen)return{isOpen:!1,reason:"کافه در این روز تعطیل است",openTime:p,closeTime:h};let b=l;if(!b&&i instanceof Date){let e=new Date(i.getTime()+126e5),t=String(e.getUTCHours()).padStart(2,"0"),s=String(e.getUTCMinutes()).padStart(2,"0");b="".concat(t,":").concat(s)}if(!b)return{isOpen:!0,openTime:p,closeTime:h};let g=m(b);if(isNaN(g))return{isOpen:!1,reason:"فرمت زمان انتخابی نامعتبر است",openTime:p,closeTime:h};let f=m(p),j=m(h);isNaN(f)&&(f=600),isNaN(j)&&(j=1380),0===j&&f>0&&(j=1440);let v=g+Math.round(60*o);if(f<j)return g>=f&&v<=j?{isOpen:!0,openTime:p,closeTime:h}:{isOpen:!1,reason:"کافه در این ساعت باز نیست (ساعات کاری: ".concat(p," الی ").concat(h,")"),openTime:p,closeTime:h};if(!(f>j))return{isOpen:!0,openTime:p,closeTime:h};{let e=g>=f&&v<=j+1440,t=g<f&&v<=j;return e||t?{isOpen:!0,openTime:p,closeTime:h}:{isOpen:!1,reason:"کافه در این ساعت باز نیست (ساعات کاری: ".concat(p," الی ").concat(h,")"),openTime:p,closeTime:h}}}}}]);