"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3574],{2950:(e,t,a)=>{a.d(t,{E:()=>l,PointsNotificationProvider:()=>s});var n=a(95155),r=a(12115);let i=(0,r.createContext)(void 0);function s(e){let{children:t}=e,[a,s]=(0,r.useState)([]),[l]=(0,r.useState)(()=>"undefined"!=typeof Audio?new Audio("/sounds/notification.mp3"):null),o=(0,r.useCallback)(e=>{let t="notification-".concat(Date.now(),"-").concat(Math.random()),a={id:t,points:e};s(e=>[...e,a]),l&&(l.currentTime=0,l.play().catch(e=>console.log("Audio playback failed:",e))),setTimeout(()=>{s(e=>e.filter(e=>e.id!==t))},3200)},[l]),u=(0,r.useCallback)(e=>{s(t=>t.filter(t=>t.id!==e))},[]);return(0,r.useEffect)(()=>{let e=e=>{let t=e.detail;t&&"number"==typeof t.points&&o(t.points)};return window.addEventListener("newPoints",e),()=>window.removeEventListener("newPoints",e)},[o]),(0,n.jsx)(i.Provider,{value:{notifications:a,showPointsNotification:o,dismissNotification:u},children:t})}function l(){let e=(0,r.useContext)(i);if(!e)throw Error("usePointsNotification must be used within PointsNotificationProvider");return e}},16536:(e,t,a)=>{a.d(t,{Fq:()=>n,Tb:()=>s,dM:()=>l});let n=["تهران","اصفهان","مشهد","شیراز","تبریز","کرج","اهواز","قم","کرمانشاه","ارومیه","رشت","زاهدان","یزد","همدان","کرمان","بندرعباس","قزوین","ساری","گرگان","بوشهر","زنجان","سنندج","خرم‌آباد","اراک"],r={تهران:"Tehran",اصفهان:"Isfahan",مشهد:"Mashhad",شیراز:"Shiraz",تبریز:"Tabriz",کرج:"Karaj",قم:"Qom",اهواز:"Ahvaz",کرمانشاه:"Kermanshah",ارومیه:"Urmia",رشت:"Rasht",زاهدان:"Zahedan",یزد:"Yazd",همدان:"Hamedan",کرمان:"Kerman",بندرعباس:"Bandar Abbas",قزوین:"Qazvin",ساری:"Sari",گرگان:"Gorgan",بوشهر:"Bushehr",زنجان:"Zanjan",سنندج:"Sanandaj",خرم‌آباد:"Khorramabad",اراک:"Arak"},i={Tehran:"تهران",Isfahan:"اصفهان",Mashhad:"مشهد",Shiraz:"شیراز",Tabriz:"تبریز",Karaj:"کرج",Qom:"قم",Ahvaz:"اهواز",Kermanshah:"کرمانشاه",Urmia:"ارومیه",Rasht:"رشت",Zahedan:"زاهدان",Yazd:"یزد",Hamedan:"همدان",Kerman:"کرمان","Bandar Abbas":"بندرعباس",Qazvin:"قزوین",Sari:"ساری",Gorgan:"گرگان",Bushehr:"بوشهر",Zanjan:"زنجان",Sanandaj:"سنندج",Khorramabad:"خرم‌آباد",Arak:"اراک"};function s(e){return r[e]||e}function l(e){return i[e]||e}},86600:(e,t,a)=>{a.d(t,{C:()=>s});var n=a(12115);let r={},i={};function s(e,t){var a,s;let l=null!=(a=null==t?void 0:t.staleTime)?a:6e4,o=null==(s=null==t?void 0:t.revalidateOnFocus)||s,u=null==t?void 0:t.refreshInterval,[d,c]=(0,n.useState)(()=>e&&r[e]?r[e].data:null),[f,h]=(0,n.useState)(null),[m,v]=(0,n.useState)(()=>!!e&&!r[e]),[x,w]=(0,n.useState)(!1),b=(0,n.useCallback)(async function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!e)return;let a=r[e],n=!a||Date.now()-a.timestamp>=l;if(!t&&!n)return a.data!==d&&c(a.data),v(!1),a.data;a||v(!0),w(!0);try{i[e]||(i[e]=fetch(e).then(async e=>{if(!e.ok)throw Error("HTTP error! status: ".concat(e.status));return await e.json()}).finally(()=>{delete i[e]}));let t=await i[e];return r[e]={data:t,timestamp:Date.now()},c(t),h(null),t}catch(t){console.error("Error fetching URL: ".concat(e),t),h(t)}finally{v(!1),w(!1)}},[e,l,d]);(0,n.useEffect)(()=>{e&&(r[e]?(c(r[e].data),v(!1)):(c(null),v(!0)),b())},[e,l]),(0,n.useEffect)(()=>{if(!e||!o)return;let t=()=>{b()};return window.addEventListener("focus",t),()=>{window.removeEventListener("focus",t)}},[e,o,b]),(0,n.useEffect)(()=>{if(!e||!u)return;let t=setInterval(()=>{b(!0)},u);return()=>clearInterval(t)},[e,u,b]);let g=(0,n.useCallback)(function(t){let a=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(e){if(void 0!==t){let a="function"==typeof t?t(d):t;r[e]={data:a,timestamp:Date.now()},c(a)}a&&b(!0)}},[e,d,b]);return{data:d,error:f,isLoading:m,isValidating:x,mutate:g}}},99032:(e,t,a)=>{a.d(t,{U:()=>c});var n=a(95155);a(12115);var r=a(52619),i=a.n(r),s=a(36489),l=a(20508),o=a(1733),u=a(2950);function d(e){let{direction:t="down"}=e,{notifications:a}=(0,u.E)();if(0===a.length)return null;let r="down"===t,i=r?"absolute top-12 left-1/2 -translate-x-1/2 z-[100] pointer-events-none":"absolute bottom-10 left-1/2 -translate-x-1/2 z-[100] pointer-events-none",s=r?"animate-float-down-fade":"animate-float-up-fade";return(0,n.jsx)(n.Fragment,{children:a.map((e,t)=>{let{id:a,points:r}=e,l=r>=0,u=(e=>{let t=["۰","۱","۲","۳","۴","۵","۶","۷","۸","۹"];return Math.abs(e).toString().replace(/\d/g,e=>t[parseInt(e)])})(r),d="".concat(u).concat(l?"+":"-");return(0,n.jsx)("div",{className:i,style:{animationDelay:"".concat(150*t,"ms")},children:(0,n.jsxs)("div",{className:"relative w-14 h-14 ".concat(s," overflow-visible"),children:[(0,n.jsx)("div",{className:"absolute inset-0 bg-[#FFA515] rounded-full shadow-[0_4px_15px_rgba(255,165,21,0.4)] border-2 border-white/20"}),(0,n.jsx)("div",{className:"absolute inset-0 flex items-center justify-center p-2.5 overflow-visible",children:(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 57.26 52.41",className:"w-full h-full text-black overflow-visible",children:(0,n.jsxs)(o.P.g,{animate:l?{y:r>=4?[0,0,0,0,-14,0,-8,0]:[0,0,0,0,-6,0,-4,0],rotate:[0,0,0,0,-5,5,-3,0]}:{x:[0,0,0,0,-4,4,-4,4,-2,2,0]},transition:{duration:2.5,times:l?[0,.2,.5,.7,.75,.8,.85,.9]:[0,.2,.5,.7,.73,.76,.79,.82,.85,.88,.9],ease:"easeInOut"},style:{originX:"28.63px",originY:"26.2px"},children:[(0,n.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,n.jsx)(o.P.ellipse,{cx:"19.04",cy:"30.22",rx:"7.44",ry:"2.29",fill:"#ffffff",animate:{rx:[7.44,7.2,7.2,7.2,7.2],ry:[2.29,7.2,7.2,7.2,7.2],x:[0,6,6,0,0],y:[0,-8,-8,0,0]},transition:{duration:2.5,times:[0,.2,.5,.7,1],ease:"easeInOut"},style:{originX:"19.04px",originY:"30.22px"}}),(0,n.jsx)(o.P.rect,{x:"11",y:"22",width:"16",height:"0",fill:"currentColor",animate:r>=4?{height:[0,0,0,12,12,12,12],x:[0,6,6,6,0,0,0],y:[0,-8,7.42,.22,8.22,8.22,8.22]}:l?{height:[0,0,0,0,16,0,0],x:[0,6,6,0,0,0,0],y:[0,-8,-8,0,0,0,0]}:{height:[0,0,0,8,8,8,8],x:[0,6,6,6,0,0,0],y:[0,-8,-8,-8,0,0,0]},transition:{duration:2.5,times:r>=4?[0,.2,.45,.5,.7,.85,1]:l?[0,.2,.5,.7,.75,.85,1]:[0,.2,.45,.5,.7,.85,1],ease:"easeInOut"}}),(0,n.jsx)(o.P.circle,{cx:"39.48",cy:"30.22",r:"6.18",fill:"#ffffff",animate:{r:[6.18,7.2,7.2,7.2,7.2],x:[0,6,6,0,0],y:[0,-8,-8,0,0]},transition:{duration:2.5,times:[0,.2,.5,.7,1],ease:"easeInOut"},style:{originX:"39.48px",originY:"30.22px"}}),(0,n.jsx)(o.P.rect,{x:"32",y:"22",width:"16",height:"0",fill:"currentColor",animate:r>=4?{height:[0,0,0,12,12,12,12],x:[0,6,6,6,0,0,0],y:[0,-8,7.42,.22,8.22,8.22,8.22]}:l?{height:[0,0,0,0,16,0,0],x:[0,6,6,0,0,0,0],y:[0,-8,-8,0,0,0,0]}:{height:[0,0,0,8,8,8,8],x:[0,6,6,6,0,0,0],y:[0,-8,-8,-8,0,0,0]},transition:{duration:2.5,times:r>=4?[0,.2,.45,.5,.7,.85,1]:l?[0,.2,.5,.7,.75,.85,1]:[0,.2,.45,.5,.7,.85,1],ease:"easeInOut"}})]})})}),(0,n.jsx)("div",{className:"absolute -top-5 -right-1.5 bg-white rounded-full px-2 py-1 shadow-md border border-gray-100 min-w-[28px] flex items-center justify-center",children:(0,n.jsx)("span",{className:"text-[20px] font-black leading-none ".concat(l?"text-emerald-600":"text-rose-600"),children:d})}),(0,n.jsx)("div",{className:"absolute inset-0 bg-[#FFA515] rounded-full blur-md opacity-30 -z-10"})]})},a)})})}function c(){var e;let{data:t}=(0,s.useSession)();return(0,n.jsxs)("div",{className:"relative flex items-center",children:[(0,n.jsx)(i(),{href:(()=>{var e;if(!(null==t?void 0:t.user))return"/auth/customer/signin";switch(null==(e=t.user)?void 0:e.role){case"ADMIN":case"SUPER_ADMIN":return"/admin-dashboard";case"CAFE_OWNER":return"/business-dashboard";default:return"/dashboard"}})(),className:"relative flex items-center justify-center w-10 h-10 sm:w-11 sm:h-11 rounded-full bg-gradient-to-tr from-amber-500 via-violet-600 to-indigo-600 p-[2px] shadow-sm hover:shadow-md hover:scale-105 active:scale-95 transition-all duration-200",title:"حساب کاربری",children:(0,n.jsx)("div",{className:"w-full h-full rounded-full bg-white flex items-center justify-center overflow-hidden",children:(null==t||null==(e=t.user)?void 0:e.image)?(0,n.jsx)("img",{src:t.user.image,alt:t.user.name||"آواتار کاربر",className:"w-full h-full object-cover rounded-full"}):(0,n.jsx)("div",{className:"w-full h-full rounded-full bg-violet-50 text-violet-600 flex items-center justify-center",children:(0,n.jsx)(l.A,{className:"w-5 h-5 sm:w-6 sm:h-6"})})})}),(0,n.jsx)(d,{})]})}}}]);