"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:()=>d});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 d(e){let{className:t,variant:s,asChild:l=!1,...d}=e,o=l?r.DX:"span";return(0,a.jsx)(o,{"data-slot":"badge",className:(0,n.cn)(i({variant:s}),t),...d})}},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:()=>d});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 d(e){let{...t}=e;return(0,a.jsx)(r.l9,{"data-slot":"dialog-trigger",...t})}function o(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,...d}=e;return(0,a.jsxs)(o,{"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),...d,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:d=!1,rtl:o=!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 d&&i?(0,a.jsxs)("div",{className:(0,r.cn)("flex items-center gap-2",o&&"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:()=>J});var a=s(95155),r=s(12115),l=s(51834),n=s(3998),i=s(27937),d=s(90368),o=s(35299),c=s(95740);let x=["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"],m=["تهران","مشهد","اصفهان","شیراز","کرج","تبریز"],u=["یکشنبه","دوشنبه","سه‌شنبه","چهارشنبه","پنج‌شنبه","جمعه","شنبه"],p=[{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 h=s(20063),b=s(36489),g=s(18720),f=s(98373);let j=(0,r.createContext)(null);function v(e){let{children:t,open:s,onOpenChange:l,userCity:n,initialCafeId:i}=e,d=function(e){var t;let{open:s,onOpenChange:a,userCity:l="همه",initialCafeId:n}=e,i=(0,h.useRouter)(),{data:d,status:o}=(0,b.useSession)(),c=(null==d||null==(t=d.user)?void 0:t.city)||("همه"!==l?l:"تهران"),[m,p]=(0,r.useState)(c),[j,v]=(0,r.useState)(1),[N,y]=(0,r.useState)([]),[w,k]=(0,r.useState)(new Set),[T,D]=(0,r.useState)("ALL"),[C,S]=(0,r.useState)(n?"همه بازی‌های این کافه":"همه بازی‌ها"),[A,L]=(0,r.useState)(null),[P,O]=(0,r.useState)([]),[E,I]=(0,r.useState)(""),[R,U]=(0,r.useState)(null),[F,H]=(0,r.useState)(!1),[M,z]=(0,r.useState)(!1),[$,Y]=(0,r.useState)(null),_=(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=u[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,")")}})})(),[]),V=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()}}(),G=+(V>=22),[B,J]=(0,r.useState)(G),[W,Z]=(0,r.useState)(new Set),X=(0,r.useMemo)(()=>{if(0===G){let e=Math.min(Math.max(10,V+1),23);return"".concat(String(e).padStart(2,"0"),":00")}return"17:00"},[V,G]),[q,K]=(0,r.useState)(X),[Q,ee]=(0,r.useState)({}),[et,es]=(0,r.useState)(3),[ea,er]=(0,r.useState)(!0),[el,en]=(0,r.useState)(""),[ei,ed]=(0,r.useState)([]),[eo,ec]=(0,r.useState)(c),[ex,em]=(0,r.useState)(null),[eu,ep]=(0,r.useState)(!1),[eh,eb]=(0,r.useState)(null),[eg,ef]=(0,r.useState)(!1);(0,r.useEffect)(()=>{if(!s)return;let e=!0;return(async()=>{var t,s,a,r,l;let n=null==d||null==(t=d.user)?void 0:t.city;if(n&&""!==n.trim()){e&&(p(n),ec(e=>"همه"===e||"تهران"===e?n:e));return}if("authenticated"===o)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&&(p(i),ec(e=>"همه"===e||"تهران"===e?i:e))}}catch(e){}})(),()=>{e=!1}},[s,d,o]);let ej=(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))}}),Z(e),J(t=>{let s=_[t];if(s&&e.has(s.dateStr)){let s=_.findIndex(t=>!e.has(t.dateStr));return -1!==s?s:t}return t})}}}catch(e){}},[_]),ev=(0,r.useCallback)(async()=>{z(!0),Y(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||"این کافه";L(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}));O(t);let a=(s.data.genres||[]).map(e=>({id:e.id,name:e.name,cleanName:e.cleanName||e.name}));y(a)}else Y(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};em(s),ed([s]),t.city&&ec(t.city),t.name&&L(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}));O(e);let s=(t.data.genres||[]).map(e=>({id:e.id,name:e.name,cleanName:e.cleanName||e.name}));y(s)}else Y(t.error||"خطا در بارگذاری لیست بازی‌ها")}}catch(e){Y("خطا در برقراری ارتباط با سرور کاتالوگ بازی‌ها")}finally{z(!1)}},[n]),eN=(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){}},[]),ey=(0,r.useCallback)(async(e,t,s,a,r)=>{if(!n){ep(!0),eb(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),T&&"ALL"!==T&&"FAVORITES"!==T&&"POPULAR"!==T?n.set("genreId",T):t&&"ALL"!==t&&"همه بازی‌ها"!==t&&"FAVORITES"!==t&&"POPULAR"!==t&&n.set("genre",t),s&&"همه"!==s&&n.set("city",s);let i=a||q;i&&n.set("time",i);let d=r||(null==(l=_[B])?void 0:l.dateStr);d&&n.set("date",d),n.set("includeHeatmap","true");let o=await fetch("/api/cafes/by-game?".concat(n.toString())),c=await o.json();c.success&&Array.isArray(c.data)?(ed(c.data),c.hourlyDiscountsMap&&ee(c.hourlyDiscountsMap),c.data.length>0?em(e=>e&&c.data.some(t=>String(t.id)===String(e.id))?e:c.data[0]):em(null)):eb(c.error||"خطا در دریافت لیست کافه‌ها")}catch(e){eb("خطا در برقراری ارتباط با سرور برای دریافت کافه‌ها")}finally{ep(!1)}}},[n,T,q,B,_]),ew=(0,r.useCallback)(e=>{K(e),ey(R,C,eo,e)},[R,C,eo,ey]);(0,r.useEffect)(()=>{s&&(v(1),D("ALL"),S(n?"همه بازی‌های این کافه":"همه بازی‌ها"),I(""),U(null),H(!1),n||(em(null),L(null)),J(+(V>=22)),K(X),es(3),er(!0),en(""),ev(),eN(),ej())},[s,n,V,X,ev,eN,ej]),(0,r.useEffect)(()=>{(3===j||5===j)&&ey(R,C,eo)},[j,R,C,eo,q,B,ey]),(0,r.useEffect)(()=>{var e;if(!n||!ex)return;let t=null==(e=_[B])?void 0:e.dateStr;if(!t)return;let s=parseInt(q.split(":")[0],10),a=0===B&&s<=V;if(!(0,f.gH)({openTime:ex.openTime,closeTime:ex.closeTime,settings:ex.settings,targetTime:q,targetDate:t,durationHours:1}).isOpen||a){let e=x.find(e=>{let s=parseInt(e.split(":")[0],10);return(0!==B||!(s<=V))&&(0,f.gH)({openTime:ex.openTime,closeTime:ex.closeTime,settings:ex.settings,targetTime:e,targetDate:t,durationHours:1}).isOpen});e&&K(e)}},[n,ex,B,_,V]);let ek=(0,r.useMemo)(()=>P.filter(e=>{let t=!0;if("FAVORITES"===T)t=w.has(e.title);else if("POPULAR"===T)t=!!e.isPopular;else if("ALL"!==T){var s;t=e.genreId===T||e.genre===C||!!(null==(s=e.genreIds)?void 0:s.includes(T))}let a=E.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}),[P,T,C,w,E]),eT=async(e,t)=>{t.stopPropagation();let s=e.title,a=w.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("خطا در حذف از علاقه‌مندی‌ها");g.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("خطا در افزودن به علاقه‌مندی‌ها")}g.o.success("\xab".concat(s,"\xbb به لیست علاقه‌مندی‌های شما افزوده شد ⭐️"))}}catch(e){k(e=>{let t=new Set(e);return a?t.add(s):t.delete(s),t}),g.o.error(e.message||"خطا در بروزرسانی علاقه‌مندی")}},eD=async()=>{if(!R&&!F&&(!C||"ALL"===T)){g.o.error("لطفاً یک بازی یا ژانر مشخص را انتخاب کنید"),v(1);return}if(!ex)return void g.o.error("لطفاً کافه‌گیم مورد نظر خود را انتخاب کنید");let e=_[B];if(!e||!q){g.o.error("لطفاً تاریخ و ساعت معتبر انتخاب کنید"),v(3);return}if(0===B&&parseInt(q.split(":")[0],10)<=V){g.o.error("ساعت انتخابی برای امروز سپری شده است. لطفاً ساعت آینده را انتخاب کنید."),v(3);return}ef(!0);try{let t="".concat(e.dateStr,"T").concat(q,":00+03:30"),s=new Date(t),r={gameTitle:(null==R?void 0:R.title)||void 0,genre:(null==R?void 0:R.genre)||("همه بازی‌ها"!==C?C:"عمومی"),cafeId:ex.id,startTime:s.toISOString(),playersNeeded:et,isPublic:ea},l=await fetch("/api/tables/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),n=await l.json();if(!l.ok||!n.success)throw Error(n.error||"خطا در ثبت میز بازی");let d=n.data;a(!1),"UPCOMING"===d.status?(g.o.success("\uD83C\uDF89 میز بازی شما با موفقیت ثبت و منتشر شد!"),window.dispatchEvent(new CustomEvent("event-updated")),i.push("/events/".concat(d.id))):"PENDING_PAYMENT"===d.status?(g.o.info("میز با موفقیت ایجاد شد. در حال انتقال به درگاه پرداخت..."),i.push("/checkout/table/".concat(d.id))):i.push("/events")}catch(e){g.o.error(e.message||"خطا در برقراری ارتباط با سرور")}finally{ef(!1)}};return{step:j,setStep:v,open:s,onOpenChange:a,initialCafeId:n,genres:N,favoriteGames:w,selectedGenreId:T,selectedGenreName:C,cafeScopeName:A,isLoadingGames:M,gamesError:$,handleSelectGenre:(e,t)=>{D(e),S(t),I(""),U(null),H(!1),v(2)},loadGames:ev,games:P,filteredGames:ek,gameSearch:E,setGameSearch:I,selectedGame:R,isContinuingWithGenre:F,handleSelectGame:e=>{U(e),H(!1),e.maxPlayers&&e.maxPlayers>1&&es(Math.max(1,Math.min(6,e.maxPlayers-1))),v(3)},handleContinueWithGenre:()=>{U(null),H(!0),v(3)},toggleFavorite:eT,dayOptions:_,selectedDayIndex:B,setSelectedDayIndex:J,selectedTime:q,setSelectedTime:K,currentIranHour:V,activeTableDates:W,hourlyDiscountsMap:Q,quickChangeHourAndReload:ew,neededPlayers:et,setNeededPlayers:es,isPublic:ea,setIsPublic:er,description:el,setDescription:en,cafes:ei,selectedCafeCity:eo,setSelectedCafeCity:ec,profileCity:m,selectedCafe:ex,setSelectedCafe:em,isLoadingCafes:eu,cafesError:eh,isSubmitting:eg,loadCafes:ey,handleSubmit:eD}}({open:s,onOpenChange:l,userCity:n,initialCafeId:i});return(0,a.jsx)(j.Provider,{value:d,children:t})}function N(){let e=(0,r.useContext)(j);if(!e)throw Error("useCreateTableContext must be used within a CreateTableProvider");return e}function y(){let{step:e,setStep:t,selectedGenreId:s,selectedGame:r,isContinuingWithGenre:l}=N();return(0,a.jsx)("div",{className:"grid grid-cols-5 gap-1 pt-1 w-full box-border",children:p.map(n=>{let i=e===n.num,d=e>n.num,o=n.num<e||2===n.num&&!!s||3===n.num&&!!(r||l);return(0,a.jsxs)("button",{type:"button",disabled:!o&&!i,onClick:()=>{o&&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":d?"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:d?"✓":n.emoji}),(0,a.jsx)("span",{className:"truncate w-full text-center",children:n.label})]},n.num)})})}var w=s(11647),k=s(16645),T=s(39347),D=s(8198),C=s(89559);function S(){let{initialCafeId:e,cafeScopeName:t,favoriteGames:s,genres:r,isLoadingGames:l,gamesError:i,loadGames:o,handleSelectGenre:x}=N();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)(k.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)(T.A,{className:"w-4 h-4 text-amber-500 fill-amber-500 shrink-0"}),(0,a.jsx)("span",{children:"علاقه‌های من"}),(0,a.jsx)(w.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)(D.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:o,className:"text-xs border-rose-300 text-rose-700 hover:bg-rose-100",children:[(0,a.jsx)(C.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)(d.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 A=s(65142),L=s(5917),P=s(86651),O=s(91169);function E(){let{setStep:e,selectedGenreId:t,selectedGenreName:s,selectedGame:r,favoriteGames:l,filteredGames:i,gameSearch:o,setGameSearch:c,handleSelectGame:x,handleContinueWithGenre:m,toggleFavorite:u}=N();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)(L.A,{className:"w-4 h-4"}),(0,a.jsxs)("span",{children:["ادامه با کل ژانر \xab",s,"\xbb (بدون تعیین بازی خاص)"]})]}),(0,a.jsx)(d.A,{className:"w-4 h-4"})]}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(P.A,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-slate-400 h-4 w-4"}),(0,a.jsx)(A.p,{placeholder:"جستجوی نام بازی (مثلاً Catan, استوژیت)...",value:o,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)(O.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)(T.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)(L.A,{className:"w-3 h-3"})})]})]},e.title)})})]})}var I=s(76444),R=s(10383),U=s(26983);function F(){var e,t,s;let{setStep:r,selectedGame:l,selectedGenreName:i,dayOptions:d,selectedDayIndex:o,setSelectedDayIndex:c,activeTableDates:m,currentIranHour:u,selectedTime:p,setSelectedTime:h,hourlyDiscountsMap:b,initialCafeId:g,selectedCafe:j}=N(),v=null==(e=d[o])?void 0:e.dateStr,y=g&&j?(0,f.gH)({openTime:j.openTime,closeTime:j.closeTime,settings:j.settings,targetDate:v}):null;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:l?l.title:"کل ژانر ".concat(i)})]})]}),(0,a.jsx)(n.$,{variant:"ghost",size:"sm",onClick:()=>r(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)(I.J,{className:"text-xs font-bold text-slate-700 mb-2 block flex items-center gap-1.5",children:[(0,a.jsx)(R.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=o===t,r=m.has(e.dateStr),l=!1;g&&j&&(l=!(0,f.gH)({openTime:j.openTime,closeTime:j.closeTime,settings:j.settings,targetDate:e.dateStr}).isOpen);let n=r||l;return(0,a.jsxs)("button",{type:"button",disabled:n,onClick:()=>c(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=>m.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)(I.J,{className:"text-xs font-bold text-slate-700 flex items-center gap-1.5",children:[(0,a.jsx)(U.A,{className:"w-4 h-4 text-emerald-600"})," ساعت شروع بازی:"]}),y&&(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 ساعت کاری کافه: ",y.openTime," الی ",y.closeTime]})]}),(0,a.jsx)("div",{className:"grid grid-cols-4 sm:grid-cols-7 gap-1.5",children:x.map(e=>{let t=parseInt(e.split(":")[0],10),s=!1;g&&j&&(s=!(0,f.gH)({openTime:j.openTime,closeTime:j.closeTime,settings:j.settings,targetTime:e,targetDate:v,durationHours:1}).isOpen);let r=0===o&&t<=u||s,l=p===e,n=null==b?void 0:b[e],i=n&&n.maxDiscountPercent>0;return(0,a.jsxs)("button",{type:"button",disabled:r,onClick:()=>h(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)})}),g&&j?(0,a.jsx)("p",{className:"text-[10px] text-slate-400 mt-1.5",children:"* ساعت‌های گذشته و ساعت‌های خارج از بازه کاری کافه غیرفعال هستند."}):0===o?(0,a.jsx)("p",{className:"text-[10px] text-slate-400 mt-1.5",children:"* ساعت‌های گذشته برای روز جاری غیرفعال هستند."}):null,g&&j&&((null==y?void 0:y.isOpen)===!1||x.every(e=>{let t=parseInt(e.split(":")[0],10),s=(0,f.gH)({openTime:j.openTime,closeTime:j.closeTime,settings:j.settings,targetTime:e,targetDate:v,durationHours:1});return 0===o&&t<=u||!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==y?void 0:y.isOpen)===!1?"کافه \xab".concat(j.name,"\xbb در روز ").concat(null==(t=d[o])?void 0:t.label," تعطیل است. لطفاً روز دیگری را انتخاب کنید."):"در روز ".concat(null==(s=d[o])?void 0:s.label," هیچ ساعت بازی فعالی برای کافه \xab").concat(j.name,"\xbb در دسترس نیست. لطفاً روز دیگری را انتخاب کنید.")})]})]})]})}var H=s(44846),M=s(39068),z=s(99708);function $(){let{neededPlayers:e,setNeededPlayers:t,isPublic:s,setIsPublic:r,description:l,setDescription:n}=N();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)(I.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)(M.A,{className:"w-5 h-5 text-emerald-600 shrink-0"}):(0,a.jsx)(z.A,{className:"w-5 h-5 text-amber-600 shrink-0"}),(0,a.jsxs)("div",{children:[(0,a.jsx)(I.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)(H.d,{checked:s,onCheckedChange:r,className:"data-[state=checked]:bg-emerald-600"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(I.J,{className:"text-xs font-medium text-slate-600 mb-1.5 block",children:"یادداشت یا توضیحات برای هم‌بازی‌ها (اختیاری):"}),(0,a.jsx)(A.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 Y=s(15239),_=s(21873),V=s(51950);function G(){var e;let{setStep:t,initialCafeId:s,cafeScopeName:r,selectedCafe:l,setSelectedCafe:i,cafes:d,selectedCafeCity:o,setSelectedCafeCity:c,profileCity:x,isLoadingCafes:u,cafesError:p,loadCafes:h,selectedGame:b,selectedGenreName:g,dayOptions:f,selectedDayIndex:j,selectedTime:v,neededPlayers:y,quickChangeHourAndReload:k}=N();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)(w.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)(_.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:o}),":"]})]}),(0,a.jsxs)("select",{value:o,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,")"]}),m.filter(e=>e!==x).map(e=>(0,a.jsx)("option",{value:e,children:e},e)),(0,a.jsx)("option",{value:"همه",children:"همه شهرها"})]})]}),u&&!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))}):p&&!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:p}),(0,a.jsxs)(n.$,{size:"sm",variant:"outline",onClick:()=>h(b,g,o),className:"text-xs border-rose-300 text-rose-700 hover:bg-rose-100",children:[(0,a.jsx)(C.A,{className:"w-3.5 h-3.5 ml-1.5"})," تلاش مجدد"]})]}):0!==d.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]:d).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)(Y.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,V.$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,V.$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,V.$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)(L.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(),k(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(o,"\xbb یافت نشد."):g&&"همه بازی‌ها"!==g?"متأسفانه در ساعت ".concat(v," کافه بازی برای ژانر \xab").concat(g,"\xbb در شهر \xab").concat(o,"\xbb یافت نشد."):"کافه بازی در ساعت ".concat(v," در شهر \xab").concat(o,"\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:[y+1," نفر (",y," هم‌بازی)"]})]})]}),(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,V.$g)(l.hourlyRate)}),(0,a.jsxs)("span",{className:"text-emerald-700 font-bold",children:[(0,V.$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,V.$g)(l.hourlyRate)," تومان"]})})]})]})]})}function B(){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}=N();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)(y,{})]}),(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)(S,{}),2===t&&(0,a.jsx)(E,{}),3===t&&(0,a.jsx)(F,{}),4===t&&(0,a.jsx)($,{}),5===t&&(0,a.jsx)(G,{})]}),(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)(d.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)(o.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 J(e){return(0,a.jsx)(l.lG,{open:e.open,onOpenChange:e.onOpenChange,children:(0,a.jsx)(v,{...e,children:(0,a.jsx)(B,{})})})}},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:()=>o});var a=s(95155),r=s(52619),l=s.n(r),n=s(51834),i=s(3998),d=s(7420);function o(e){let{isOpen:t,onClose:s,title:r="ورود به حساب کاربری",description:o="برای استفاده از این امکانات و حضور در دنیای پلیمو، لطفاً ابتدا وارد حساب کاربری خود شوید یا ثبت‌نام کنید."}=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)(d.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:o})]}),(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:()=>d,Wu:()=>o,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 d(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 o(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,{D7:()=>n,L7:()=>x,gH:()=>m,nM:()=>d});var a=s(72377);let r=/^(([01]\d|2[0-3]):[0-5]\d|24:00)$/,l={0:"sunday",1:"monday",2:"tuesday",3:"wednesday",4:"thursday",5:"friday",6:"saturday"},n={saturday:"شنبه",sunday:"یکشنبه",monday:"دوشنبه",tuesday:"سه‌شنبه",wednesday:"چهارشنبه",thursday:"پنج‌شنبه",friday:"جمعه"},i=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()}),o=a.YO(d).max(20,"حداکثر ۲۰ قانون مجاز است"),c=a.Ik({operatingHours:a.g1(a.Yj(),i).optional(),hourlyDiscounts:o.optional(),pricing:a.g1(a.Yj(),a.bz()).optional()}).passthrough();function x(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 m(e){var t;let{openTime:s,closeTime:a,settings:r,targetTime:n,targetDate:i,durationHours:d=1}=e,o=null;if("string"==typeof r)try{let e=JSON.parse(r),t=c.safeParse(e);o=t.success?t.data:e}catch(e){o=null}else if("object"==typeof r&&null!==r){let e=c.safeParse(r);o=e.success?e.data:r}let m=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 l[new Date(Date.UTC(t,s-1,a,12,0,0)).getUTCDay()]}return l[new Date(("string"==typeof e?new Date(e):e).getTime()+126e5).getUTCDay()]}(i?(i instanceof Date,i):new Date),u=null==o||null==(t=o.operatingHours)?void 0:t[m],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=n;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=x(b);if(isNaN(g))return{isOpen:!1,reason:"فرمت زمان انتخابی نامعتبر است",openTime:p,closeTime:h};let f=x(p),j=x(h);isNaN(f)&&(f=600),isNaN(j)&&(j=1380),0===j&&f>0&&(j=1440);let v=g+Math.round(60*d);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}}}}}]);