1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2715],{55837:(e,t,a)=>{a.d(t,{A:()=>b});var l=a(95155),s=a(12115),i=a(47650),n=a(28633),r=a(11054),o=a(76046),c=a(27825),d=a(14505),x=a(46967),m=a(30098),p=a(42874),h=a(8449),u=a(2730);function b(e){let{isOpen:t,onClose:a,onSendGift:b,receiverName:f="à¸à¸¹à¹à¹à¸à¹"}=e,{userData:g}=(0,h.A)(),y=(0,o.useRouter)(),[w,v]=(0,s.useState)(null),[j,k]=(0,s.useState)(!1),[N,z]=(0,s.useState)(!1),[C,P]=(0,s.useState)(!1),[S,A]=(0,s.useState)(!1),[E,I]=(0,s.useState)(0),{data:_}=(0,u.Ay)(t?"/api/users/me/balance":null,e=>fetch(e).then(e=>e.json()));(0,s.useEffect)(()=>{_&&I(_.balance||0)},[_]);let T=async()=>{if(w){z(!0);try{await b(w),A(!0)}catch(e){e.message&&e.message.includes("INSUFFICIENT_COINS")&&P(!0)}finally{z(!1)}}};return((0,s.useEffect)(()=>{k(!0)},[]),(0,s.useEffect)(()=>(t?document.body.style.overflow="hidden":(setTimeout(()=>{document.body.style.overflow=""},300),t||(P(!1),z(!1),A(!1),v(null))),()=>{document.body.style.overflow=""}),[t]),j)?(0,i.createPortal)((0,l.jsx)(n.N,{children:t&&(0,l.jsxs)("div",{className:"fixed inset-0 z-[999999] flex items-end sm:items-center justify-center pointer-events-none",children:[(0,l.jsx)(r.P.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:"absolute inset-0 bg-black/60 backdrop-blur-sm pointer-events-auto",onClick:a}),(0,l.jsxs)(r.P.div,{initial:{y:"100%",opacity:0},animate:{y:0,opacity:1},exit:{y:"100%",opacity:0},transition:{type:"spring",damping:25,stiffness:300,mass:.8},className:"relative w-full max-w-md bg-white dark:bg-zinc-900 rounded-t-[32px] sm:rounded-[32px] overflow-hidden shadow-2xl pointer-events-auto flex flex-col max-h-[600px] md:max-h-[800px]",onClick:e=>e.stopPropagation(),children:[(0,l.jsx)("div",{className:"w-full flex justify-center pt-3 pb-1 sm:hidden shrink-0 cursor-pointer pointer-events-auto",onClick:a,children:(0,l.jsx)("div",{className:"w-12 h-1.5 bg-gray-300 dark:bg-zinc-700 rounded-full"})}),(0,l.jsxs)("div",{className:"p-5 border-b border-gray-100 dark:border-zinc-800 flex justify-between items-center relative overflow-hidden shrink-0",children:[(0,l.jsx)("div",{className:"absolute inset-0 bg-gradient-to-r from-pink-500/10 to-purple-500/10 z-0 pointer-events-none"}),(0,l.jsxs)("div",{className:"relative z-10 flex-1",children:[(0,l.jsx)("h2",{className:"text-xl font-bold bg-gradient-to-r from-pink-500 to-purple-500 bg-clip-text text-transparent",children:"สà¹à¸à¸à¸à¸à¸à¸§à¸±à¸"}),(0,l.jsx)("div",{className:"flex items-center gap-2 mt-1",children:(0,l.jsxs)("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:["à¹à¸«à¹à¸à¸³à¸¥à¸±à¸à¹à¸ ",f]})})]}),(0,l.jsxs)("div",{className:"relative z-10 flex flex-col items-end gap-2",children:[(0,l.jsx)("button",{onClick:a,className:"w-8 h-8 flex items-center justify-center rounded-full bg-gray-100 dark:bg-zinc-800 hover:bg-gray-200 dark:hover:bg-zinc-700 transition",children:"â"}),void 0!==g&&(0,l.jsxs)("div",{className:"flex items-center gap-1.5 bg-yellow-100/50 dark:bg-yellow-900/20 px-3 py-1 rounded-full border border-yellow-200/50 dark:border-yellow-700/30 w-fit",children:[(0,l.jsx)(c.A,{className:"w-3.5 h-3.5 text-yellow-500"}),(0,l.jsx)("span",{className:"text-sm font-bold text-yellow-600 dark:text-yellow-500",children:E.toLocaleString()})]})]})]}),(0,l.jsx)("div",{className:"p-4 overflow-y-auto max-h-[400px] md:max-h-[500px]",children:(0,l.jsx)("div",{className:"grid grid-cols-4 gap-3",children:p.a.map(e=>(0,l.jsxs)("button",{onClick:()=>v(e),className:"flex flex-col items-center justify-between p-2 rounded-2xl border-2 transition-all relative overflow-hidden group\n ".concat((null==w?void 0:w.id)===e.id?"border-pink-500 bg-pink-50 dark:bg-pink-500/10 shadow-sm":"border-transparent hover:bg-gray-50 dark:hover:bg-zinc-800"),children:[(null==w?void 0:w.id)===e.id&&(0,l.jsx)("div",{className:"absolute top-1 right-1 w-2 h-2 rounded-full bg-pink-500"}),(0,l.jsx)("div",{className:"w-12 h-12 relative flex items-center justify-center group-hover:scale-110 transition-transform",children:(0,l.jsx)("img",{src:e.image,alt:e.name,className:"w-full h-full object-contain drop-shadow-sm"})}),(0,l.jsx)("span",{className:"text-[10px] text-gray-500 dark:text-gray-400 font-medium truncate w-full text-center mt-2 mb-1",children:e.name}),(0,l.jsx)("div",{className:"flex items-center justify-center bg-yellow-100 dark:bg-yellow-900/30 text-yellow-600 dark:text-yellow-500 px-3 py-0.5 rounded-full",children:(0,l.jsx)("span",{className:"text-xs font-bold",children:e.price})})]},e.id))})}),(0,l.jsx)("div",{className:"p-4 sm:p-5 border-t border-gray-100 dark:border-zinc-800 bg-gray-50 dark:bg-zinc-900/50 pb-8 sm:pb-5 shrink-0",children:(0,l.jsx)("button",{disabled:!w||N,onClick:T,className:"w-full py-3.5 rounded-2xl font-bold text-white shadow-lg transition-all flex items-center justify-center gap-2\n ".concat(w&&!N?"bg-gradient-to-r from-pink-500 to-purple-500 hover:from-pink-600 hover:to-purple-600 hover:scale-[1.02] active:scale-95":"bg-gray-300 dark:bg-zinc-700 text-gray-400 cursor-not-allowed shadow-none"),children:N?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(d.A,{className:"w-5 h-5 animate-spin"}),"à¸à¸³à¸¥à¸±à¸à¸ªà¹à¸..."]}):w?"สà¹à¸à¸à¸à¸à¸à¸§à¸±à¸ ".concat(w.price):"à¹à¸¥à¸·à¸à¸à¸à¸à¸à¸à¸§à¸±à¸"})})]}),(0,l.jsx)(n.N,{children:C&&(0,l.jsx)(r.P.div,{initial:{opacity:0,scale:.95}
1,animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"absolute inset-0 z-50 flex items-center justify-center p-4 bg-black/60 backdrop-blur-sm pointer-events-auto",onClick:()=>P(!1),children:(0,l.jsxs)(r.P.div,{initial:{y:20},animate:{y:0},className:"bg-white dark:bg-zinc-900 w-full max-w-sm rounded-[28px] overflow-hidden shadow-2xl p-6 text-center",onClick:e=>e.stopPropagation(),children:[(0,l.jsx)("div",{className:"w-20 h-20 bg-yellow-100 dark:bg-yellow-900/30 rounded-full flex items-center justify-center mx-auto mb-5 shadow-inner",children:(0,l.jsx)(c.A,{className:"w-10 h-10 text-yellow-500"})}),(0,l.jsx)("h3",{className:"text-2xl font-black text-slate-800 dark:text-white mb-2",children:"à¹à¸«à¸£à¸µà¸¢à¸à¹à¸¡à¹à¸à¸!"}),(0,l.jsxs)("p",{className:"text-slate-500 dark:text-slate-400 mb-6 text-[15px] leading-relaxed",children:["à¸à¸¸à¸à¸¡à¸µà¹à¸«à¸£à¸µà¸¢à¸à¹à¸¡à¹à¸à¸à¸ªà¸³à¸«à¸£à¸±à¸à¸ªà¹à¸ ",(0,l.jsx)("strong",{className:"text-pink-500",children:null==w?void 0:w.name})," ราà¸à¸² ",null==w?void 0:w.price," à¹à¸«à¸£à¸µà¸¢à¸ à¸à¸£à¸¸à¸à¸²à¹à¸à¸´à¸¡à¹à¸«à¸£à¸µà¸¢à¸à¹à¸à¸´à¹à¸¡à¹à¸à¸·à¹à¸à¹à¸à¸¢à¹à¸à¹à¸"]}),(0,l.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,l.jsxs)("button",{onClick:()=>{a(),y.push("/topup")},className:"w-full bg-gradient-to-r from-yellow-400 to-amber-500 hover:from-yellow-500 hover:to-amber-600 text-white font-bold py-3.5 px-6 rounded-2xl transition-all flex items-center justify-center gap-2 shadow-lg shadow-yellow-500/30 hover:scale-[1.02] active:scale-95",children:["à¹à¸à¸´à¸¡à¹à¸«à¸£à¸µà¸¢à¸à¹à¸¥à¸¢",(0,l.jsx)(x.A,{className:"w-5 h-5"})]}),(0,l.jsx)("button",{onClick:()=>P(!1),className:"w-full bg-slate-100 dark:bg-zinc-800 hover:bg-slate-200 dark:hover:bg-zinc-700 text-slate-700 dark:text-slate-300 font-bold py-3.5 px-6 rounded-2xl transition-colors",children:"ยà¸à¹à¸¥à¸´à¸"})]})]})})}),(0,l.jsx)(n.N,{children:S&&w&&(0,l.jsx)(r.P.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"absolute inset-0 z-[60] flex items-center justify-center p-4 bg-black/60 backdrop-blur-sm pointer-events-auto",onClick:()=>{A(!1),a()},children:(0,l.jsxs)(r.P.div,{initial:{y:20},animate:{y:0},className:"bg-white dark:bg-zinc-900 w-full max-w-sm rounded-[28px] overflow-hidden shadow-2xl p-8 text-center",onClick:e=>e.stopPropagation(),children:[(0,l.jsxs)("div",{className:"w-24 h-24 mx-auto mb-6 relative hover:scale-110 transition-transform duration-500 hover:rotate-6",children:[(0,l.jsx)("img",{src:w.image,alt:w.name,className:"w-full h-full object-contain drop-shadow-xl animate-bounce"}),(0,l.jsx)("div",{className:"absolute -top-2 -right-2 bg-pink-500 rounded-full p-1.5 shadow-lg shadow-pink-500/50",children:(0,l.jsx)(m.A,{className:"w-5 h-5 text-white"})})]}),(0,l.jsx)("h3",{className:"text-2xl font-black bg-gradient-to-r from-pink-500 to-purple-500 bg-clip-text text-transparent mb-2",children:"สà¹à¸à¸à¸à¸à¸à¸§à¸±à¸à¸ªà¸³à¹à¸£à¹à¸!"}),(0,l.jsxs)("p",{className:"text-slate-500 dark:text-zinc-400 mb-6 text-[15px] leading-relaxed",children:["à¸à¸¸à¸à¹à¸à¹à¸ªà¹à¸ ",(0,l.jsx)("strong",{className:"text-pink-500",children:w.name}),(0,l.jsx)("br",{}),"à¹à¸à¸·à¹à¸à¹à¸à¸¢à¹à¹à¸«à¹à¸à¸±à¸ ",(0,l.jsx)("strong",{className:"text-foreground",children:f})," à¹à¸£à¸µà¸¢à¸à¸£à¹à¸à¸¢à¹à¸¥à¹à¸§"]}),(0,l.jsx)("button",{onClick:()=>{A(!1),a()},className:"w-full bg-gradient-to-r from-pink-500 to-purple-500 hover:from-pink-600 hover:to-purple-600 text-white font-bold py-3.5 px-6 rounded-2xl transition-all shadow-lg shadow-pink-500/30 active:scale-95",children:"à¸à¸´à¸à¸«à¸à¹à¸²à¸à¹à¸²à¸"})]})})})]})}),document.body):null}},93063:(e,t,a)=>{a.d(t,{U:()=>l});let l=async e=>{if(e.recipientId!==e.senderId)try{await fetch("/api/notifications",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(e)})}catch(e){console.error("Error creating notification:",e)}}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.