1try{let e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e9181c41-2573-4abb-8967-3a1d7cac7018",e._sentryDebugIdIdentifier="sentry-dbid-e9181c41-2573-4abb-8967-3a1d7cac7018")}catch(e){}"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5022],{62112:function(e,t,a){a.d(t,{Z:function(){return l}});var s=a(91373);/** 2 * @license lucide-react v0.436.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */let l=(0,s.Z)("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]])},45077:function(e,t,a){a.d(t,{Z:function(){return l}});var s=a(91373);/** 7 * @license lucide-react v0.436.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */let l=(0,s.Z)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},58621:function(e,t,a){a.d(t,{Z:function(){return l}});var s=a(91373);/** 12 * @license lucide-react v0.436.0 - ISC 13 * 14 * This source code is licensed under the ISC license. 15 * See the LICENSE file in the root directory of this source tree. 16 */let l=(0,s.Z)("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]])},13766:function(e,t,a){a.d(t,{Z:function(){return l}});var s=a(91373);/** 17 * @license lucide-react v0.436.0 - ISC 18 * 19 * This source code is licensed under the ISC license. 20 * See the LICENSE file in the root directory of this source tree. 21 */let l=(0,s.Z)("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]])},76383:function(e,t,a){a.d(t,{Z:function(){return l}});var s=a(91373);/** 22 * @license lucide-react v0.436.0 - ISC 23 * 24 * This source code is licensed under the ISC license. 25 * See the LICENSE file in the root directory of this source tree. 26 */let l=(0,s.Z)("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]])},40116:function(e,t,a){a.d(t,{Z:function(){return l}});var s=a(91373);/** 27 * @license lucide-react v0.436.0 - ISC 28 * 29 * This source code is licensed under the ISC license. 30 * See the LICENSE file in the root directory of this source tree. 31 */let l=(0,s.Z)("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},12414:function(e,t,a){var s=a(85893),l=a(96916),r=a(67294),n=a(47516),i=a(11871),d=a(11163),c=a(5434),o=a(96225);let x=e=>{let{title:t,onScanMutation:a,isOpen:x,setIsOpen:m}=e;(0,d.useRouter)();let u=(0,r.useRef)(!0),h=(0,r.useRef)(null),g=(0,r.useRef)(null),[f,y]=(0,r.useState)(null),[p,b]=(0,r.useState)(null),v=async()=>{u.current=!0,g.current=null;let e=!1,t=new l.t2("reader");b(null),y(t),await t.start({facingMode:"environment"},{fps:10},async s=>{if(u.current&&g.current!==s){u.current=!1,g.current=s;try{let t=await a(s);("This QR or stamp has been redeemed"===t||"Stamp not exists"===t||"QR code expired, please ask for a new one"===t)&&(b(t),e=!1),("Successfully Redeemed"===t||"Payment details loaded"===t)&&(b("Payment details loaded"===t?"Ready to pay!":t),e=!0)}catch(t){b("Something went wrong, please try again"),e=!1}finally{e?h.current=setTimeout(async()=>{b(null),await t.pause(!0),await t.stop().then(()=>{u.current=!0,m(!1)})},3e3):setTimeout(()=>{b(null),u.current=!0},3e3)}}},async e=>{}).catch(e=>{b("Something went wrong, please try again")})},j=async()=>{h.current&&clearTimeout(h.current),u.current=!1,g.current=null,f&&(await f.pause(!0),await f.stop().then(()=>{}).catch(e=>{}),b(null),y(null),m(!1))};return(0,r.useEffect)(()=>{x&&v()},[x]),(0,s.jsxs)(s.Fragment,{children:[x?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"fixed left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 mx-auto bg-black/70 backdrop-blur-md z-[99999] w-full h-full shadow-lg",onClick:()=>j()}),(0,s.jsxs)("div",{className:"fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 z-[99999] w-full max-w-[320px] sm:max-w-[440px] md:max-w-[600px] shadow-lg overflow-hidden",children:[t?(0,s.jsxs)("div",{className:"flex items-center justify-center gap-3",children:[(0,s.jsx)(c.qdw,{color:"white",size:40}),(0,s.jsx)("div",{className:"text-xl font-bold tracking-wide text-center text-white md:text-2xl",children:t})]}):null,(0,s.jsxs)("div",{className:"mt-8 border-2 border-baby-yellow-900",children:[(0,s.jsx)("div",{id:"reader"}),(0,s.jsx)("div",{className:"p-3 bg-black",children:(0,s.jsx)(i.default,{label:"Stop Scanning",color:"yellow",fullWidth:!0,onClick:()=>j()})})]})]})]}):null,(()=>{let e="fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 z-[99999] w-full max-w-[320px] sm:max-w-[400px] md:max-w-[560px] shadow-lg rounded-md overflow-hidden z-[999999]";return p?"Successfully Redeemed"===p||"Ready to pay!"===p?(0,s.jsx)("div",{className:e,children:(0,s.jsxs)("div",{className:"flex items-center justify-center gap-2 p-3 font-bold text-center text-green-800 bg-green-500 border-2 border-green-200 bg-opacity-60 backdrop-blur-md",children:[(0,s.jsx)(n.wRn,{size:30,color:"green"}),(0,s.jsx)("span",{className:"leading-0",children:p})]})}):(0,s.jsx)("div",{className:e,children:(0,s.jsxs)("div",{className:"flex items-center justify-center gap-2 p-3 font-bold text-center text-white bg-red-500 bg-opacity-50 border-2 border-red-400 backdrop-blur-md",children:[(0,s.jsx)(o.HgG,{size:30,color:"white"}),(0,s.jsx)("span",{className:"leading-0",children:p})]})}):null})()]})};t.Z=x},79814:function(e,t,a){var s=a(85893);a(67294);var l=a(29238),r=a.n(l);let n=e=>{let{children:t,className:a}=e;if(!t)return null;let l=r().sanitize(t);return(0,s.jsx)("div",{className:a,dangerouslySetInnerHTML:{__html:l}})};t.Z=n},95022:function(e,t,a){a.r(t),a.d(t,{GiftCardEmptyState:function(){return I},GiftCardSkeleton:function(){return G},default:function(){return R}});var s=a(85893),l=a(67294),r=a(11163),n=a(61897),i=a(36408),d=a(97719),c=a(70241),o=a(33145),x=a(52168),m=a(39802),u=a(79814),h=a(63750),g=a(91373);/** 32 * @license lucide-react v0.436.0 - ISC 33 * 34 * This source code is licensed under the ISC license. 35 * See the LICENSE file in the root directory of this source tree. 36 */let f=(0,g.Z)("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),y=(0,g.Z)("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);var p=a(58621),b=a(76383),v=a(57307),j=a(40116),N=a(45077),w=a(62112),C=a(13766),k=a(76915),S=a(11871),P=a(12414),M=a(68258),T=a(71268);let Z=e=>{if("string"!=typeof e)return!1;let t=e.replace(/<[^>]+>/g,"").trim();return t.length>0},A="/account/gift-cards/pay",B=e=>{let t=null==e?void 0:e.trim();if(!t)return"";let a=t.includes(A)||t.includes(A.replace(/^\//,""));if(!a)return t;let s=(t.split("?")[1]||"").split("#")[0],l=s.split("&").find(e=>{let t=e.indexOf("="),a=t>
36=0?e.slice(0,t):e;return"payload"===decodeURIComponent(a||"")});if(!l)return"";let r=l.indexOf("=");return r<0?"":decodeURIComponent(l.slice(r+1))},V=e=>{let t=e.vouchersToReceive||[];return t.map(e=>{let t,a;let s=e.title||e.name||e.voucherName||"Voucher",l=e.discountType||"fixed",r=e.discountValue||0,n=e.quantity||1;"percentage"===l?(t="".concat(r,"%"),a=r):(t=r.toString(),a=r);let i=e.subTitle||e.description||"Digital voucher";return{name:s,value:a,quantity:n,description:i,discountType:l,formattedValue:t}})},Y=e=>{var t,a,g,A;let{giftCard:Y,onTransfer:G,onConvert:I,onViewTransactions:R}=e,_=(0,r.useRouter)(),[z,F]=(0,l.useState)(!1),[E,K]=(0,l.useState)(!1),[L,U]=(0,l.useState)(null),[W,D]=(0,l.useState)(!1),[O,q]=(0,l.useState)(!1),[X,Q]=(0,l.useState)(!1),[H,$]=(0,l.useState)(""),[J,ee]=(0,l.useState)(!1),[et,ea]=(0,l.useState)(!1),[es,el]=(0,l.useState)(null),[er,en]=(0,l.useState)(null),[ei,ed]=(0,l.useState)(null),[ec,eo]=(0,l.useState)(null),[ex,em]=(0,l.useState)(!1),[eu,eh]=(0,l.useState)(null),[eg,ef]=(0,l.useState)(!1),[ey,ep]=(0,l.useState)(Y.status),eb="pending_transfer"===ey||"pending_transfer"===Y.status,ev=V(Y),ej="active"===ey&&Y.currentBalance>0,eN="inactive"===ey,ew="depleted"===ey||"active"===ey&&Y.currentBalance<=0,eC="expired"===ey,ek=!!Y.digitalProductStatus&&"active"!==Y.digitalProductStatus,eS=ej||!ek&&(eN&&Y.termsAndConditions&&Z(Y.termsAndConditions)||ew&&Y.termsAndConditions&&Z(Y.termsAndConditions)||eC&&Y.termsAndConditions&&Z(Y.termsAndConditions)),{showAlert:eP}=(0,m.$)(),eM=()=>{if(ek){eP("This card is archived and cannot be used.","error");return}q(!0)},eT=d.SX.useUtils(),eZ=d.SX.giftCards.confirmPayment.useMutation({onSuccess:e=>{eo(null),Q(!1),q(!1),(null==ei?void 0:ei.kind)==="dynamic"&&ei.intentId&&_.push("/account/gift-cards/transaction/".concat(ei.intentId))},onError:e=>{eo(e.message||"Failed to confirm payment")}}),eA=d.SX.giftCards.startStaticQRPayment.useMutation({onSuccess:e=>{eo(null),ed(t=>({...t,...e,merchantName:(null==e?void 0:e.merchantName)||(null==t?void 0:t.merchantName)||(null==t?void 0:t.companyName),brandName:(null==t?void 0:t.brandName)||(null==t?void 0:t.brandNameSnapshot)||(null==e?void 0:e.brandNameSnapshot)}))},onError:e=>{eo(e.message||"Failed to prepare payment")}}),eB=d.SX.digitalVouchers.vouchers.getAvailableYhelloCardWithdrawalVouchers.useQuery(void 0,{enabled:J}),eV=d.SX.exhibitions.expo.listExpos.useQuery(void 0,{enabled:J}),eY=d.SX.digitalVouchers.vouchers.canWithdrawYhelloCardToVoucher.useMutation(),eG=d.SX.digitalVouchers.vouchers.withdrawYhelloCardToVoucher.useMutation({onSuccess:async()=>{eP("Voucher converted successfully!","success"),await Promise.all([eT.giftCards.getUserGiftCards.invalidate({limit:50,includeInactive:!0}),eT.digitalVouchers.vouchers.getAvailableYhelloCardWithdrawalVouchers.invalidate(),eT.digitalVouchers.vouchers.getAvailableVouchersByUserId.invalidate()]),ee(!1),el(null),en(null),_.push("/account/vouchers")},onError:e=>{eP((null==e?void 0:e.message)||"Failed to convert voucher","error")}}),eI=d.SX.giftCards.activateGiftCard.useMutation({onSuccess:()=>{ep(0===Y.currentBalance?"depleted":"active"),D(!1),eT.giftCards.getUserGiftCards.invalidate()},onError:e=>{}}),eR=d.SX.giftCards.createShareLink.useMutation({onSuccess:e=>{eh(e),ep("pending_transfer"),em(!0),eP("Gift link created!","success"),eT.giftCards.getUserGiftCards.invalidate({limit:50,includeInactive:!0})},onError:e=>{eP(e.message||"Failed to create gift link","error")}}),e_=d.SX.giftCards.revokeShareLink.useMutation({onSuccess:()=>{eh(null),ep("inactive"),em(!1),ef(!1),eP("Gift cancelled successfully","success"),eT.giftCards.getUserGiftCards.invalidate({limit:50,includeInactive:!0})},onError:e=>{eP(e.message||"Failed to cancel gift","error")}}),ez=d.SX.giftCards.getActiveShareLink.useQuery({giftCardId:Y._id},{enabled:eb,retry:!1});(0,l.useEffect)(()=>{ez.data&&eh(ez.data)},[ez.data]),(0,l.useEffect)(()=>{ep(Y.status)},[Y.status]);let eF=()=>{eb&&eu?em(!0):eR.mutate({giftCardId:Y._id})},eE=async()=>{if(null==eu?void 0:eu.shareUrl)try{await (0,T.vQ)(eu.shareUrl),eP("Link copied to clipboard!","success")}catch(e){eP("Failed to copy link","error")}},eK=async()=>
36{if((null==eu?void 0:eu.shareUrl)&&(0,T.zf)())try{let e=(0,T.cG)(Y.initialAmount);await navigator.share({title:"Yhello Gift Card",text:e,url:eu.shareUrl})}catch(e){}},eL=()=>{(null==eu?void 0:eu.shareToken)&&e_.mutate({shareToken:eu.shareToken})},eU=d.SX.giftCards.verifyQR.useMutation(),eW=(0,l.useMemo)(()=>{let e=eB.data||[];return e.filter(e=>(e.discountValue||0)<=Y.currentBalance).sort((e,t)=>(e.discountValue||0)-(t.discountValue||0))},[eB.data,Y.currentBalance]),eD=(null===(t=eV.data)||void 0===t?void 0:t.upcoming)||[],eO=eW.find(e=>e.code===es),eq=eD.find(e=>{var t;return(null===(t=e._id)||void 0===t?void 0:t.toString())===er}),eX=(0,l.useCallback)(()=>{if(I){I(Y._id);return}el(null),en(null),ee(!0)},[Y._id,I]),eQ=(0,l.useCallback)(async()=>{if(!es){eP("Please select a voucher amount.","error");return}if(!er){eP("Please select an expo.","error");return}ee(!1),ea(!0)},[er,es,eP]),eH=(0,l.useCallback)(async()=>{if(!es||!er){ea(!1),eP("Please select a voucher amount and expo.","error");return}try{let e=await eY.mutateAsync({voucherCode:es,expoId:er,giftCardId:Y._id});if(!(null==e?void 0:e.canPurchase)){eP((null==e?void 0:e.reason)||"You are not eligible to convert this voucher.","error");return}await eG.mutateAsync({voucherCode:es,expoId:er,giftCardId:Y._id})}catch(e){eP((null==e?void 0:e.message)||"Failed to convert voucher.","error")}finally{ea(!1)}},[eY,Y._id,er,es,eP,eG]),e$=(0,l.useCallback)(e=>{if(!e)return null;let t=(0,o.W)(e.billTotal),a=Y.currentBalance;return{billTotal:t,amountToPayFromCard:t,currentBalance:a,remainingBalance:a-t,hasSufficientBalance:a>=t}},[Y.currentBalance]),eJ=(0,l.useCallback)(e=>{e&&!eS||(F(e),e||U(null))},[eS]),e0=(0,l.useCallback)(()=>{eN&&!ek&&D(!0)},[eN,ek]),e1=async e=>{try{let t=B(e);if(!t)throw Error("Invalid QR");let a=await eU.mutateAsync({signedPayload:t});if("static"===a.kind)return $(""),ed({...a,merchantName:a.companyName||null}),q(!1),"Payment details loaded";let s=null;try{let e=await d.dN.businesses.companies.getCompanyById.query({id:a.merchantId});s=(null==e?void 0:e.legalName)||null}catch(e){}return ed({...a,merchantName:s}),q(!1),"Payment details loaded"}catch(e){return"QR code expired, please ask for a new one"}},e2=()=>{let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",t="";for(let a=0;a<24;a++)t+=e[Math.floor(Math.random()*e.length)];return t},e4=e=>{let t=e.replace(/[^0-9.]/g,""),a=Number.parseFloat(t);return Number.isNaN(a)||a<=0?0:Math.round(100*a)},e3=(0,l.useCallback)(()=>{if(ei){if(eo(null),"static"===ei.kind){let e=e4(H);if(!e){eo("Please enter a valid payment amount");return}eA.mutate({signedPayload:ei.signedPayload,billTotal:e,idempotencyKey:e2()});return}eZ.mutate({intentId:ei.intentId,giftCardId:Y._id,voucherIds:[],useGiftCard:!0,idempotencyKey:e2(),scanToken:ei.scanToken})}},[ei,H,eZ,Y._id,eA]);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:(0,i.cn)("relative w-full transition-all duration-200 select-none"),children:[(0,s.jsxs)("div",{className:(0,i.cn)("overflow-hidden relative rounded-2xl shadow-lg aspect-[1.586/1] border border-baby-yellow-900/50",!ej&&"opacity-60",eS&&"cursor-pointer"),style:{backgroundImage:(null===(a=Y.backgroundImage)||void 0===a?void 0:null===(g=a.url)||void 0===g?void 0:g.m)?"url(".concat(Y.backgroundImage.url.m,")"):"linear-gradient(to bottom right, rgba(245, 158, 11, 0.3), rgba(245, 158, 11, 0.4), rgba(245, 158, 11, 0.6))",backgroundSize:"cover",backgroundPosition:"center",backgroundRepeat:"no-repeat"},onClick:eS?()=>{ej?eM():F(!0)}:void 0,children:[(0,s.jsxs)("div",{className:"overflow-hidden absolute inset-0",children:[(0,s.jsx)("div",{className:"absolute inset-0 bg-gradient-to-br opacity-10 from-black/80 via-black/70 to-black/80"}),ej&&(0,s.jsx)("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent to-transparent -skew-x-12 via-white/10 animate-shimmer"}),(0,s.jsx)("div",{className:"absolute top-0 right-0 w-20 h-20 bg-gradient-to-bl to-transparent rounded-full blur-2xl from-white/20"})]}),(0,s.jsxs)("div",{className:"flex relative flex-col justify-between p-3 h-full sm:p-5",children:[(0,s.jsxs)("div",{className:"flex relative z-10 justify-between items-start",children:[(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsxs)("div",{className:"flex gap-2 items-center mb-2 sm:gap-3 sm:mb-3",children:[(0,s.jsx)("div",{className:"flex flex-shrink-0 justify-center items-center w-8 h-8 bg-white rounded-full border-2 border-gray-300 shadow-xl sm:w-10 sm:h-10",children:(0,s.jsx)("span",{className:"text-xs font-black sm:text-sm text-slate-900",style:{textShadow:"0 1px 1px rgba(255,255,255,0.6), 0 0 2px rgba(255,255,255,0.4)"},children:"TCE"})}),(0,s.jsx)("div",{className:"min-w-0",children:(0,s.jsx)("h3",{className:"text-sm font-bold tracking-wide text-white sm:text-base",style:{textShadow:"0 1px 2px rgba(0,0,0,0.7), 0 0 4px rgba(0,0,0,0.5)"},children:Y.name||"YHELLO CARD"})})]}),(0,s.jsxs)("div",{className:"flex gap-1 items-center sm:gap-2",children:[(0,s.jsx)("p",{className:"font-mono text-xs tracking-wide text-white truncate sm:tracking-widest",style:{textShadow:"0 1px 2px rgba(0,0,0,0.6), 0 0 3px rgba(0,0,0,0.4)"},children:E?Y.cardNumber.replace(/(.{4})/g,"$1 ").trim():"â¢â¢â¢â¢ â¢â¢â¢â¢ â¢â¢â¢â¢ ".concat(Y.cardNumber.slice(-4))}),(0,s.jsx)("button",{onClick:e=>{e.stopPropagation(),K(!E)},className:"flex-shrink-0 p-1 rounded-full transition-colors hover:bg-white/20",children:E?(0,s.jsx)(f,{className:"w-3 h-3 text-white sm:w-4 sm:h-4",style:{filter:"drop-shadow(0 1px 1px rgba(0,0,0,0.4))"}}):(0,s.jsx)(y,{className:"w-3 h-3 text-white sm:w-4 sm:h-4",style:{filter:"drop-shadow(0 1px 1px rgba(0,0,0,0.4))"}})})]})]}),(0,s.jsx)("div",{className:"flex-shrink-0 text-right",children:(0,s.jsx)(p.Z,{className:"mb-1 w-5 h-5 text-white sm:w-6 sm:h-6",style:{filter:"drop-shadow(0 1px 2px rgba(0,0,0,0.5))"}})})]}),(0,s.jsxs)("div",{className:"relative z-10 py-1 text-center sm:py-2",children:[(0,s.jsx)("p",{className:"md:mb-1 text-[9px] md:text-xs font-medium md:tracking-wide text-white uppercase",style:{textShadow:"0 1px 2px rgba(0,0,0,0.6), 0 0 3px rgba(0,0,0,0.4)"},children:"Your Yhello Card Balance"}),(0,s.jsx)("p",{className:"text-lg font-bold tracking-tight text-white sm:text-xl",style:{textShadow:"0 1px 3px rgba(0,0,0,0.7), 0 0 6px rgba(0,0,0,0.5)"},children:(0,c.BK)(Y.currency,Y.currentBalance)})]}),(0,s.jsxs)("div",{className:"flex relative z-10 justify-between items-end",children:[(0,s.jsx)("div",{children:Y.expiryDate?(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs tracking-wide text-white uppercase",style:{textShadow:"0 1px 1px rgba(0,0,0,0.5), 0 0 2px rgba(0,0,0,0.3)"},children:"Valid Until"}),(0,s.jsx)("p",{className:"font-mono text-sm text-white",style:{textShadow:"0 1px 2px rgba(0,0,0,0.6), 0 0 3px rgba(0,0,0,0.4)"},children:new Date(Y.expiryDate).toLocaleDateString("en-US",{month:"2-digit",year:"2-digit"})})]}):(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs tracking-wide text-white uppercase",style:{textShadow:"0 1px 1px rgba(0,0,0,0.5), 0 0 2px rgba(0,0,0,0.3)"},children:"Validity"}),(0,s.jsx)("p",{className:"text-sm text-white",style:{textShadow:"0 1px 2px rgba(0,0,0,0.6), 0 0 3px rgba(0,0,0,0.4)"},children:"No Expiry"})]})}),ej&&(0,s.jsxs)("button",{type:"button",className:"flex gap-1 sm:gap-2 items-center px-2 sm:px-3 py-1.5 sm:py-2 text-xs font-bold rounded-lg bg-white/80 shadow-lg",onClick:e=>{e.stopPropagation(),eM()},children:[(0,s.jsx)(b.Z,{className:"w-3 h-3 sm:w-4 sm:h-4"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:"TAP TO USE"}),(0,s.jsx)("span",{className:"sm:hidden",children:"USE"})]})]})]})]}
36),eN&&!ek?(0,s.jsxs)("div",{className:"mt-4 space-y-3",children:[(0,s.jsx)(S.default,{label:eI.isPending?"Activating...":"Activate",onClick:e0,disabled:eI.isPending||ek,color:"yellow",fullWidth:!0}),!eb&&!Y.isGiftedCard&&!ek&&(0,s.jsxs)("button",{type:"button",className:"flex gap-2 justify-center items-center px-4 py-3 w-full text-sm font-medium rounded-xl border shadow-sm transition-all text-baby-yellow-700 bg-baby-yellow-50 border-baby-yellow-300 hover:bg-baby-yellow-100 hover:border-baby-yellow-400",onClick:eF,disabled:eR.isPending,children:[(0,s.jsx)(v.Z,{className:"w-4 h-4"}),eR.isPending?"Creating...":"Gift This Card"]}),eb&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex gap-2 items-center p-3 bg-amber-50 rounded-lg",children:[(0,s.jsx)(j.Z,{className:"flex-shrink-0 w-5 h-5 text-amber-600"}),(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsx)("div",{className:"text-sm font-semibold text-amber-800",children:"Card Gifted - Pending Claim"}),(0,s.jsx)("div",{className:"text-xs text-amber-700",children:"Waiting for recipient to claim this gift"})]})]}),(0,s.jsxs)("button",{type:"button",className:"flex gap-2 justify-center items-center px-4 py-3 w-full text-sm font-medium rounded-xl border shadow-sm transition-all text-baby-yellow-700 bg-baby-yellow-50 border-baby-yellow-300 hover:bg-baby-yellow-100 hover:border-baby-yellow-400",onClick:eF,children:[(0,s.jsx)(v.Z,{className:"w-4 h-4"}),"Manage Gift"]})]})]}):(0,s.jsxs)(s.Fragment,{children:[eb&&(0,s.jsxs)("div",{className:"flex gap-2 items-center p-3 mt-4 bg-amber-50 rounded-lg",children:[(0,s.jsx)(j.Z,{className:"flex-shrink-0 w-5 h-5 text-amber-600"}),(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsx)("div",{className:"text-sm font-semibold text-amber-800",children:"Card Gifted - Pending Claim"}),(0,s.jsx)("div",{className:"text-xs text-amber-700",children:"Waiting for recipient to claim this gift"})]})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-3 mt-4",children:[R&&!eb&&(0,s.jsxs)("button",{type:"button",className:"flex flex-1 gap-2 justify-center items-center px-4 py-3 text-sm font-medium text-gray-700 bg-white rounded-xl border border-gray-200 shadow-sm transition-all hover:bg-gray-50 hover:border-gray-300",onClick:()=>R(Y._id),children:[(0,s.jsx)(N.Z,{className:"w-4 h-4"}),"History"]}),G&&Y.currentBalance>0&&!eb&&(0,s.jsxs)("button",{type:"button",disabled:ek,className:(0,i.cn)("flex flex-1 gap-2 justify-center items-center px-4 py-3 text-sm font-medium rounded-xl border shadow-sm transition-all",ek||!1===Y.allowTransferOut?"text-gray-400 bg-gray-100 border-gray-200 cursor-not-allowed opacity-60":"text-gray-700 bg-white border-gray-200 hover:bg-gray-50 hover:border-gray-300"),onClick:e=>{if(e.stopPropagation(),e.preventDefault(),!ek){if(!1===Y.allowTransferOut){eP("This card does not support transfer credit out.","error");return}G(Y._id)}},children:[(0,s.jsx)(w.Z,{className:"w-4 h-4"}),"Transfer"]}),Y.currentBalance>0&&!eb&&(0,s.jsxs)("button",{type:"button",disabled:ek,className:(0,i.cn)("flex flex-1 gap-2 justify-center items-center px-4 py-3 text-sm font-medium rounded-xl border shadow-sm transition-all",ek||!1===Y.allowConvertToVoucher?"text-gray-400 bg-gray-100 border-gray-200 cursor-not-allowed opacity-60":"text-baby-yellow-700 bg-baby-yellow-50 border-baby-yellow-300 hover:bg-baby-yellow-100 hover:border-baby-yellow-400"),onClick:e=>{if(e.stopPropagation(),e.preventDefault(),!ek){if(!1===Y.allowConvertToVoucher){eP("This card does not support convert to voucher.","error");return}eX()}},children:[(0,s.jsx)(w.Z,{className:"w-4 h-4"}),"Convert"]}),eN&&!eb&&!Y.isGiftedCard&&!ek&&(0,s.jsxs)("button",{className:"flex flex-1 gap-2 justify-center items-center px-4 py-3 text-sm font-medium rounded-xl border shadow-sm transition-all text-baby-yellow-700 bg-baby-yellow-50 border-baby-yellow-300 hover:bg-baby-yellow-100 hover:border-baby-yellow-400",onClick:eF,disabled:eR.isPending,children:[(0,s.jsx)(v.Z,{className:"w-4 h-4"}),eR.isPending?"Creating...":"Gift"]}),eb&&(0,s.jsxs)("button",{className:"flex flex-1 gap-2 justify-center items-center px-4 py-3 text-sm font-medium rounded-xl border shadow-sm transition-all text-baby-yellow-700 bg-baby-yellow-50 border-baby-yellow-300 hover:bg-baby-yellow-100 hover:border-baby-yellow-400",onClick:eF,children:[(0,s.jsx)(v.Z,{className:"w-4 h-4"}),"Manage Gift"]}),Y.termsAndConditions&&Z(Y.termsAndConditions)&&!eb&&(0,s.jsxs)("button",{className:"flex flex-1 gap-2 justify-center items-center px-4 py-3 text-sm font-medium text-gray-700 bg-white rounded-xl border border-gray-200 shadow-sm transition-all hover:bg-gray-50 hover:border-gray-300",onClick:()=>F(!0),children:[(0,s.jsx)(C.Z,{className:"w-4 h-4"}),"View Terms"]})]})]})]}),(0,s.jsx)(n.Vq,{open:z,onOpenChange:eJ,children:(0,s.jsxs)(n.cZ,{className:"flex flex-col max-w-xl max-h-[95vh] p-0",children:[(0,s.jsx)("div",{className:"overflow-y-auto flex-1",children:(0,s.jsxs)("div",{className:"p-4 sm:p-6",children:[(0,s.jsxs)(n.fK,{className:"mb-4",children:[(0,s.jsxs)(n.$N,{className:"text-xl font-bold drop-shadow-sm",children:[eN?"Activate":"Card Details"," ",Y.name||"Yhello Card"]}),(0,s.jsx)("p",{className:"mt-1 text-sm text-gray-600",children:eN?"Review the terms and conditions before activating your ".concat((null===(A=Y.name)||void 0===A?void 0:A.toLowerCase())||"yhello card"):ew?"This Yhello Card has no remaining balance":eC?"This Yhello Card has expired":"Review the terms and conditions"})]}),(0,s.jsx)("div",{className:(0,i.cn)("flex flex-col gap-4",Y.termsAndConditions&&Z(Y.termsAndConditions)?"sm:flex-row sm:gap-6":""),children:Y.termsAndConditions&&Z(Y.termsAndConditions)&&(0,s.jsxs)("div",{className:"flex flex-col flex-1",children:[(0,s.jsxs)("div",{className:"flex gap-2 items-center mb-2",children:[(0,s.jsx)(C.Z,{className:"w-5 h-5"}),(0,s.jsx)("h3",{className:"font-semibold text-gray-900",children:"Terms & Conditions"})]}),(0,s.jsx)("div",{className:"overflow-y-auto pr-4 h-[160px] sm:h-[300px]",children:(0,s.jsx)("div",{className:"max-w-none text-sm text-gray-600 prose prose-sm",children:(0,s.jsx)(u.Z,{children:Y.termsAndConditions})})})]})}),(0,s.jsxs)("div",{className:"flex gap-2 items-center mt-4 text-xs text-gray-500",children:[(0,s.jsx)(N.Z,{className:"w-4 h-4"}),Y.expiryDate?"Expires: ".concat(new Date(Y.expiryDate).toLocaleDateString("en-MY")):"No expiry date"]})]})}),(0,s.jsx)("div",{className:"flex-shrink-0 p-4 mt-0 bg-white border-t",children:eN&&!ek?(0,s.jsxs)("div",{className:"flex gap-3",children:[(0,s.jsx)(n.GG,{asChild:!0,children:(0,s.jsx)(S.default,{label:"Close",color:"white",size:"small",className:"flex-1",onClick:()=>F(!1)})}),(0,s.jsx)(S.default,{label:eI.isPending?"Activating...":"Activate",color:"yellow",size:"small",className:"flex-1",onClick:()=>{F(!1),D(!0)},disabled:eI.isPending})]}):null})]})}),(0,s.jsx)(n.Vq,{open:J,onOpenChange:e=>{ee(e),e||(el(null),en(null))},children:(0,s.jsxs)(n.cZ,{className:"max-w-lg",children:[(0,s.jsx)(n.fK,{children:(0,s.jsx)(n.$N,{children:"Convert Yhello Card to Expo Voucher"})}),(0,s.jsxs)("div",{className:"space-y-5",children:[(0,s.jsxs)("div",{className:"p-4 bg-gray-50 rounded-xl border",children:[(0,s.jsx)("div",{className:"text-sm text-gray-600",children:"Selected Card"}),(0,s.jsx)("div",{className:"mt-1 font-semibold text-gray-900",children:Y.name||"Yhello Card"}),(0,s.jsxs)("div",{className:"mt-1 text-sm text-gray-600",children:["Available balance: ",(0,c.BK)(Y.currency,Y.currentBalance)]})]}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("div",{className:"text-sm font-semibold text-gray-900",children:"1. Select voucher amount"}),eB.isLoading?(0,s.jsx)("div",{className:"text-sm text-gray-500",children:"Loading voucher amountsâ¦"}):0===eW.length?(0,s.jsx)("div",{className:"p-4 text-sm text-gray-500 bg-gray-50 rounded-xl border",children:"No voucher amount is available for this card balance."}):(0,s.jsxs)("select",{value:es||"",onChange:e=>el(e.target.value||null),className:"w-full rounded-xl border border-gray-200 bg-white px-4 py-3 text-sm text-gray-900 outline-none transition-all focus:border-baby-yellow-500 focus:ring-2 focus:ring-baby-yellow-200",children:[(0,s.jsx)("option",{value:"",children:"Select voucher amount"}),eW.map(e=>(0,s.jsx)("option",{value:e.code,children:(0,c.BK)("MYR",e.discountValue||0)},e.code))]})]}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("div",{className:"text-sm font-semibold text-gray-900",children:"2. Select expo"}),eV.isLoading?(0,s.jsx)("div",{className:"text-sm text-gray-500",children:"Loading exposâ¦"}):0===eD.length?(0,s.jsx)("div",{className:"p-4 text-sm text-gray-500 bg-gray-50 rounded-xl border",children:"No upcoming expo found."}):(0,s.jsx)("div",{className:"space-y-2",children:eD.map(e=>{var t,a;let l=er===(null===(t=e._id)||void 0===t?void 0:t.toString());return(0,s.jsxs)("button",{className:(0,i.cn)("w-full rounded-xl border px-4 py-3 text-left transition-all",l?"border-baby-yellow-500 bg-baby-yellow-50 text-baby-yellow-900":"border-gray-200 bg-white hover:border-gray-300 hover:bg-gray-50"),onClick:()=>{var t;return en(null===(t=e._id)||void 0===t?void 0:t.toString())},children:[(0,s.jsx)("div",{className:"font-semibold",children:e.name}),(0,s.jsx)("div",{className:"text-xs text-gray-600",children:e.venueName})]},null===(a=e._id)||void 0===a?void 0:a.toString())})})]}),eO&&eq&&(0,s.jsxs)("div",{className:"p-4 text-sm bg-gray-50 rounded-xl border",children:[(0,s.jsx)("div",{className:"font-semibold text-gray-900",children:"Confirmation"}),(0,s.jsxs)("div",{className:"mt-2 text-gray-700",children:["Convert ",(0,c.BK)("MYR",eO.discountValue||0)," from this Yhello Card into an expo voucher for ",(0,s.jsx)("span",{className:"font-medium",children:eq.name}),"."]})]})]}),(0,s.jsxs)(n.cN,{className:"gap-2",children:[(0,s.jsx)(n.GG,{asChild:!0,children:(0,s.jsx)(S.default,{label:"Cancel",color:"white"})}),(0,s.jsx)(S.default,{label:"Confirm",color:"yellow",disabled:!es||!er||eY.isPending||eG.isPending,onClick:eQ})]})]})}),(0,s.jsx)(n.Vq,{open:et,onOpenChange:e=>{eY.isPending||eG.isPending||ea(e)},children:(0,s.jsxs)(n.cZ,{children:[(0,s.jsx)(n.fK,{children:(0,s.jsx)(n.$N,{children:"Confirm conversion"})}),(0,s.jsx)("div",{className:"space-y-4 text-sm text-gray-700",children:(0,s.jsxs)("div",{className:"p-4 bg-gray-50 rounded-lg",children:[(0,s.jsx)("div",{className:"font-semibold text-gray-900",children:(null==eO?void 0:eO.title)||"Expo Voucher"}),(0,s.jsxs)("div",{className:"mt-2",children:["Convert ",(0,c.BK)("MYR",(null==eO?void 0:eO.discountValue)||0)," from your Yhello Card ",Y.cardNumber?"****".concat(Y.cardNumber.slice(-4)):""," into an expo voucher for"," ",(0,s.jsx)("span",{className:"font-medium",children:(null==eq?void 0:eq.name)||"the selected expo"}),"?"]}),(0,s.jsx)("div",{className:"mt-2 text-gray-600",children:"This action cannot be undone."})]})}),(0,s.jsxs)(n.cN,{children:[(0,s.jsx)(S.default,{label:"Cancel",color:"white",onClick:()=>{ea(!1),ee(!0)},disabled:eY.isPending||eG.isPending}),(0,s.jsx)(S.default,{label:eG.isPending?"":"Confirm conversion",color:"yellow",onClick:eH,disabled:eY.isPending||eG.isPending,children:(eY.isPending||eG.isPending)&&(0,s.jsx)(x.Z,{message:"Processing...",isLoading:!0,className:"ml-2",iconClassName:"w-4 h-4"})})]})]})}),(0,s.jsx)(n.Vq,{open:X,onOpenChange:e=>{Q(e),e||(eo(null),ed(null),$(""))},children:(0,s.jsxs)(n.cZ,{className:"max-w-md max-h-[90vh] flex flex-col",children:[(0,s.jsx)(n.fK,{className:"flex-shrink-0",children:(0,s.jsx)(n.$N,{children:"Confirm your payment"})}),(0,s.jsx)("div",{className:"overflow-y-auto flex-1 min-h-0",children:ei?(0,s.jsxs)("div",{className:"pr-4 space-y-3",children:[ec&&(0,s.jsxs)("div",{className:"flex items-center p-2 text-sm text-red-700 bg-red-100 rounded",children:[(0,s.jsx)(h.o86,{className:"mr-2 w-4 h-4"})," ",ec]}),"static"===ei.kind?(0,s.jsxs)("div",{className:"p-3 bg-gray-50 rounded border space-y-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-sm text-gray-600",children:"Merchant"}),(0,s.jsx)("div",{className:"break-all",children:ei.merchantName||ei.companyName}),ei.brandName?(0,s.jsx)("div",{className:"mt-1 text-sm text-gray-500",children:ei.brandName}):null,ei.expoName?(0,s.jsx)("div",{className:"mt-1 text-xs text-gray-500",children:ei.expoName}):null]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"mb-2 text-sm text-gray-600",children:"Enter amount"}),(0,s.jsxs)("div",{className:"flex items-center px-3 py-3 bg-white rounded border",children:[(0,s.jsx)("span",{className:"mr-3 text-lg font-semibold text-gray-900",children:"RM"}),(0,s.jsx)("input",{type:"number",min:"0",step:"0.01",inputMode:"decimal",value:H,onChange:e=>$(e.target.value),placeholder:"0.00",className:"w-full text-2xl font-bold bg-transparent outline-none"})]})]})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"p-3 bg-gray-50 rounded border",children:[(0,s.jsx)("div",{className:"text-sm text-gray-600",children:"Merchant"}),(0,s.jsx)("div",{className:"break-all",children:ei.merchantName||ei.merchantId}),(0,s.jsx)("div",{className:"mt-2 text-sm text-gray-600",children:"Amount"}),(0,s.jsx)("div",{className:"text-xl font-bold",children:(0,c.BK)(ei.currency,(0,o.W)(ei.billTotal))})]}),(()=>{let e=e$(ei);return e?(0,s.jsxs)("div",{className:"p-3 bg-white rounded border",children:[(0,s.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,s.jsxs)("div",{className:"flex justify-between",children:[(0,s.jsx)("span",{className:"text-gray-600",children:"Bill amount:"}),(0,s.jsx)("span",{className:"font-medium",children:(0,c.BK)(Y.currency,e.billTotal)})]}),(0,s.jsxs)("div",{className:"flex justify-between pt-2 font-semibold border-t border-gray-300",children:[(0,s.jsx)("span",{children:"Pay with Yhello Card:"}),(0,s.jsx)("span",{children:(0,c.BK)(Y.currency,e.amountToPayFromCard)})]}),(0,s.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,s.jsx)("span",{className:"text-gray-600",children:"Your balance:"}),(0,s.jsx)("span",{children:(0,c.BK)(Y.currency,e.currentBalance)})]}),(0,s.jsxs)("div",{className:"flex justify-between text-sm font-medium",children:[(0,s.jsx)("span",{className:e.remainingBalance>=0?"text-gray-600":"text-red-600",children:"Remaining balance:"}),(0,s.jsx)("span",{className:e.remainingBalance>=0?"text-gray-900":"text-red-600",children:(0,c.BK)(Y.currency,e.remainingBalance)})]})]}),!e.hasSufficientBalance&&(0,s.jsx)("div",{className:"p-3 mt-3 bg-orange-50 rounded border border-orange-200",children:(0,s.jsxs)("div",{className:"flex gap-2 items-start",children:[(0,s.jsx)(h.o86,{className:"w-4 h-4 text-orange-600 mt-0.5 flex-shrink-0"}),(0,s.jsxs)("div",{className:"text-sm text-orange-800",children:[(0,s.jsx)("div",{className:"font-semibold",children:"Partial payment with Yhello Card"}),(0,s.jsxs)("div",{className:"mt-1",children:["Your Yhello Card balance (",(0,c.BK)(Y.currency,e.currentBalance),") will cover"," ",(0,c.BK)(Y.currency,e.currentBalance)," of the"," ",(0,c.BK)(Y.currency,e.amountToPayFromCard)," needed.",(0,s.jsx)("br",{}),(0,s.jsxs)("strong",{children:["You'll need to pay the remaining"," ",(0,c.BK)(Y.currency,e.amountToPayFromCard-e.currentBalance)," ","with card, e-wallet, or cash to the seller."]})]})]})]})})]}):null})()]})]}):null}),ei&&(0,s.jsx)("div",{className:"flex-shrink-0 pt-4 border-t",children:"static"===ei.kind?(0,s.jsx)(S.default,{label:eA.isPending?"Preparing payment...":"Continue",onClick:e3,disabled:eA.isPending,color:"yellow",fullWidth:!0}):(0,s.jsx)(S.default,{label:eZ.isPending?"Processing your payment...":"Confirm Payment",onClick:e3,disabled:eZ.isPending,color:"yellow",fullWidth:!0})})]})}),(0,s.jsx)(n.Vq,{open:W,onOpenChange:D,children:(0,s.jsxs)(n.cZ,{className:"max-w-md",children:[(0,s.jsx)(n.fK,{children:(0,s.jsx)(n.$N,{children:"Activate your Yhello Card?"})}),(0,s.jsxs)("div",{className:"space-y-4",children:[!Y.isGiftedCard&&(0,s.jsx)("div",{className:"p-4 bg-red-50 rounded-lg border border-red-200",children:(0,s.jsxs)("div",{className:"flex gap-3 items-start",children:[(0,s.jsx)("div",{className:"flex flex-shrink-0 justify-center items-center w-6 h-6 bg-red-100 rounded-full",children:(0,s.jsx)("svg",{className:"w-4 h-4 text-red-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidt
36h:"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.732-.833-2.5 0L4.314 16.5c-.77.833.192 2.5 1.732 2.5z"})})}),(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsx)("h4",{className:"mb-1 text-sm font-semibold text-red-900",children:"Important Warning"}),(0,s.jsxs)("p",{className:"text-sm leading-relaxed text-red-800",children:["Activating your Yhello Card means you"," ",(0,s.jsx)("strong",{children:"cannot gift it to your friends or family later"}),". Once activated, it will be linked to your account for personal use only and cannot be transferred.",ev.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("br",{}),(0,s.jsx)("strong",{children:"Note:"})," Your Yhello Card comes with voucher",ev.length>1?"s":"",". Once activated, the vouchers will be added to your account."]})]})]})]})}),ev.length>0&&(0,s.jsx)("div",{className:"p-4 rounded-lg border bg-baby-yellow-900/10 border-baby-yellow-900",children:(0,s.jsxs)("div",{className:"flex gap-3 items-start",children:[(0,s.jsx)("div",{className:"flex flex-shrink-0 justify-center items-center w-6 h-6 rounded-full bg-baby-yellow-900/30",children:(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1"})})}),(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsx)("h4",{className:"mb-2 text-sm font-semibold",children:"You will receive these vouchers:"}),(0,s.jsx)("div",{className:"space-y-1",children:ev.map((e,t)=>(0,s.jsxs)("div",{className:"text-sm",children:[(0,s.jsx)("span",{className:"font-medium",children:e.name}),e.quantity>1&&(0,s.jsxs)("span",{children:[" (x",e.quantity,")"]}),(0,s.jsxs)("span",{children:[" ","-"," ","percentage"===e.discountType?e.formattedValue:"RM".concat(e.formattedValue)]})]},t))}),(0,s.jsx)("p",{className:"mt-2 text-xs",children:ev.some(e=>"percentage"===e.discountType)?"Vouchers include percentage discounts and fixed amount vouchers":"Total voucher value: RM".concat(ev.reduce((e,t)=>e+t.value*t.quantity,0))})]})]})})]}),(0,s.jsxs)(n.cN,{className:"flex flex-col gap-3",children:[(0,s.jsx)(S.default,{label:eI.isPending?"Activating your card...":"Confirm Activate",color:"yellow",fullWidth:!0,onClick:()=>eI.mutate({giftCardId:Y._id})}),(0,s.jsx)(S.default,{label:"Cancel",color:"white",fullWidth:!0,onClick:()=>D(!1)})]})]})}),(0,s.jsx)(P.Z,{title:"Scan QR code to pay",onScanMutation:async e=>{let t=await e1(e);return"Payment details loaded"===t&&Q(!0),t},isOpen:O,setIsOpen:q}),(0,s.jsx)(n.Vq,{open:ex,onOpenChange:em,children:(0,s.jsxs)(n.cZ,{className:"max-w-lg max-h-[90vh] overflow-hidden flex flex-col",children:[(0,s.jsx)(n.fK,{className:"flex-shrink-0",children:(0,s.jsx)(n.$N,{children:"Gift Your Yhello Card"})}),(0,s.jsxs)("div",{className:"overflow-y-auto flex-1 pr-1 space-y-4",children:[(0,s.jsx)("div",{className:"p-4 bg-gradient-to-br rounded-lg border-2 shadow-sm from-baby-yellow-50 to-baby-yellow-100 border-baby-yellow-300",children:(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"mb-1 text-xs text-gray-600",children:"Card Value"}),(0,s.jsx)("div",{className:"text-2xl font-bold text-baby-yellow-700",children:(0,c.BK)(Y.currency,Y.initialAmount)})]}),(0,s.jsx)("div",{className:"p-3 bg-white rounded-lg shadow-sm",children:(0,s.jsx)(p.Z,{className:"w-8 h-8 text-baby-yellow-600"})})]})}),eu&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"p-3 bg-gray-50 rounded-lg",children:(0,s.jsxs)("div",{className:"flex gap-2 items-start",children:[(0,s.jsx)(N.Z,{className:"w-4 h-4 text-gray-500 mt-0.5 flex-shrink-0"}),(0,s.jsxs)("div",{className:"text-sm",children:[(0,s.jsx)("div",{className:"font-medium text-gray-900",children:"This link will expire in"}),(0,s.jsx)("div",{className:"text-gray-600",children:(0,T.Zo)(new Date(eu.expiresAt))})]})]})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h4",{className:"mb-3 text-sm font-semibold text-gray-900",children:"Send Gift via Messaging App"}),(0,s.jsxs)("div",{className:"flex gap-4 justify-center",children:[(0,s.jsxs)(M.N0,{url:eu.shareUrl,title:(0,T.cG)(Y.initialAmount),className:"flex flex-col gap-2 items-center p-3 rounded-lg transition-all hover:bg-gray-50",children:[(0,s.jsx)(M.ud,{size:48,round:!0}),(0,s.jsx)("span",{className:"text-xs font-medium text-gray-700",children:"WhatsApp"})]}),(0,s.jsxs)(M.tq,{url:eu.shareUrl,title:(0,T.cG)(Y.initialAmount),className:"flex flex-col gap-2 items-center p-3 rounded-lg transition-all hover:bg-gray-50",children:[(0,s.jsx)(M.YG,{size:48,round:!0}),(0,s.jsx)("span",{className:"text-xs font-medium text-gray-700",children:"Telegram"})]}),(0,s.jsxs)(M.Zh,{url:eu.shareUrl,appId:"",className:"flex flex-col gap-2 items-center p-3 rounded-lg transition-all hover:bg-gray-50",children:[(0,s.jsx)(M.v2,{size:48,round:!0}),(0,s.jsx)("span",{className:"text-xs font-medium text-gray-700",children:"Messenger"})]})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("h4",{className:"text-sm font-semibold text-gray-900",children:"Other Options"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsxs)("button",{onClick:eE,className:"flex flex-1 gap-2 justify-center items-center px-4 py-3 text-sm font-medium text-gray-700 bg-white rounded-lg border border-gray-300 transition-all hover:bg-gray-50",children:[(0,s.jsx)(k.Z,{className:"w-4 h-4"}),"Copy Link"]}),(0,T.zf)()&&(0,s.jsxs)("button",{onClick:eK,className:"flex flex-1 gap-2 justify-center items-center px-4 py-3 text-sm font-medium text-gray-700 bg-white rounded-lg border border-gray-300 transition-all hover:bg-gray-50",children:[(0,s.jsx)(v.Z,{className:"w-4 h-4"}),"More"]})]})]}),(0,s.jsxs)("div",{className:"p-4 bg-white rounded-lg border",children:[(0,s.jsx)("h4",{className:"mb-3 text-sm font-semibold text-gray-900",children:"How to Gift This Card"}),(0,s.jsxs)("ol",{className:"space-y-2 text-sm text-gray-700",children:[(0,s.jsxs)("li",{className:"flex gap-2",children:[(0,s.jsx)("span",{className:"font-semibold text-gray-900",children:"1."}),(0,s.jsx)("span",{children:"Choose your messaging app (WhatsApp, Telegram, etc.)"})]}),(0,s.jsxs)("li",{className:"flex gap-2",children:[(0,s.jsx)("span",{className:"font-semibold text-gray-900",children:"2."}),(0,s.jsx)("span",{children:"Select the person you want to gift this card to"})]}),(0,s.jsxs)("li",{className:"flex gap-2",children:[(0,s.jsx)("span",{className:"font-semibold text-gray-900",children:"3."}),(0,s.jsx)("span",{children:"They must sign in/sign up to claim their gift"})]})]}),(0,s.jsx)("div",{className:"pt-3 mt-3 border-t border-gray-200",children:(0,s.jsxs)("p",{className:"text-xs text-gray-600",children:[(0,s.jsx)("strong",{children:"Note:"})," Gift link expires in 48 hours"]})})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-2 pt-2 w-full",children:[(0,s.jsx)(S.default,{color:"red",label:e_.isPending?"Cancelling...":"Cancel Gift",disabled:e_.isPending,fullWidth:!0,onClick:()=>ef(!0)}),(0,s.jsx)(S.default,{color:"white",label:"Close",fullWidth:!0,onClick:()=>em(!1)})]})]})]})]})}),(0,s.jsx)(n.Vq,{open:eg,onOpenChange:ef,children:(0,s.jsxs)(n.cZ,{className:"max-w-md max-h-[90vh] overflow-hidden",children:[(0,s.jsx)(n.fK,{children:(0,s.jsx)(n.$N,{children:"Cancel This Gift?"})}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)("p",{className:"text-sm text-gray-600",children:"Are you sure you want to cancel this gift? The recipient will no longer be able to claim this card."}),(0,s.jsxs)("div",{className:"flex gap-3",children:[(0,s.jsx)(S.default,{label:e_.isPending?"Cancelling...":"Cancel Gift",color:"red",fullWidth:!0,onClick:eL,disabled:e_.isPending}),(0,s.jsx)(S.default,{label:"Keep Gift",color:"white",fullWidth:!0,onClick:()=>ef(!1)})]})]})]})})]})},G=()=>(0,s.jsxs)("div",{className:"relative w-full animate-pulse",children:[(0,s.jsxs)("div",{className:"overflow-hidden relative aspect-[1.586/1] bg-gradient-to-br from-gray-300 to-gray-400 rounded-2xl shadow-xl",children:[(0,s.jsx)("div",{className:"absolute top-3 right-3 z-10",children:(0,s.jsx)("div",{className:"w-16 h-6 bg-gray-500 rounded-full"})}),(0,s.jsxs)("div",{className:"flex flex-col justify-between p-6 h-full",children:[(0,s.jsxs)("div",{className:"flex justify-between items-start",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex gap-2 items-center mb-2",children:[(0,s.jsx)("div",{className:"w-8 h-8 bg-gray-500 rounded-full"}),(0,s.jsx)("div",{className:"w-24 h-5 bg-gray-500 rounded"})]}),(0,s.jsx)("div",{className:"w-32 h-4 bg-gray-500 rounded"})]}),(0,s.jsxs)("div",{className:"text-right",children:[(0,s.jsx)("div",{className:"mb-2 w-12 h-8 bg-gray-500 rounded-md"}),(0,s.jsx)("div",{className:"w-16 h-3 bg-gray-500 rounded"})]})]}),(0,s.jsxs)("div",{className:"py-2 text-center",children:[(0,s.jsx)("div",{className:"mx-auto mb-2 w-24 h-3 bg-gray-500 rounded"}),(0,s.jsx)("div",{className:"mx-auto mb-1 w-32 h-8 bg-gray-500 rounded"}),(0,s.jsx)("div",{className:"mx-auto w-20 h-3 bg-gray-500 rounded"})]}),(0,s.jsxs)("div",{className:"flex justify-between items-end",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"mb-1 w-16 h-3 bg-gray-500 rounded"}),(0,s.jsx)("div",{className:"w-12 h-4 bg-gray-500 rounded"})]}),(0,s.jsx)("div",{className:"w-20 h-8 bg-gray-500 rounded"})]})]})]}),(0,s.jsxs)("div",{className:"flex gap-2 mt-4",children:[(0,s.jsx)("div",{className:"flex-1 h-8 bg-gray-200 rounded"}),(0,s.jsx)("div",{className:"flex-1 h-8 bg-gray-200 rounded"})]})]}),I=e=>{let{title:t,description:a,actionText:l,onAction:r}=e;return(0,s.jsxs)("div",{className:"flex flex-col justify-center items-center py-12 text-center",children:[(0,s.jsx)("div",{className:"flex justify-center items-center mb-4 w-16 h-16 bg-gray-100 rounded-full",children:(0,s.jsx)(p.Z,{className:"w-8 h-8 text-gray-400"})}),(0,s.jsx)("h3",{className:"mb-2 text-lg font-semibold text-gray-900",children:t}),(0,s.jsx)("p",{className:"mb-6 max-w-md text-gray-600",children:a}),l&&r&&(0,s.jsx)(S.default,{label:l,color:"black",onClick:r})]})};var R=Y},71268:function(e,t,a){a.d(t,{W4:function(){return d},Zo:function(){return l},cG:function(){return n},vQ:function(){return i},zf:function(){return r}});var s=a(70241);let l=e=>{let t=new Date,a=e.getTime()-t.getTime();if(a<=0)return"Expired";let s=Math.floor(a/36e5),l=Math.floor(a%36e5/6e4);return s>1?"".concat(s," hours remaining"):1===s?"1 hour remaining":l>1?"".concat(l," minutes remaining"):1===l?"1 minute remaining":"Less than a minute remaining"},r=()=>"undefined"!=typeof navigator&&!!navigator.share,n=e=>{let t=(0,s.BK)("MYR",e);return"I've sent you a Yhello Card worth ".concat(t,"! Click to claim it:")},i=async e=>{try{await navigator.clipboard.writeText(e)}catch(a){let t=document.createElement("input");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}},d=e=>{if(!e||e.length<8)return e;let t=e.slice(0,4),a=e.slice(-4);return"".concat(t," **** **** ").concat(a)}},33145:function(e,t,a){a.d(t,{W:function(){return s}});let s=e=>null!=e&&Number.isFinite(e)?e/100:0},70241:function(e,t,a){a.d(t,{BK:function(){return r},_6:function(){return c},__:function(){return i},eo:function(){return n},uf:function(){return d}});var s=a(92077),l=a.n(s);let r=(e,t,a)=>{var s,l;let r=null!==(l=null==e?void 0:e.toUpperCase())&&void 0!==l?l:"MYR";if(isNaN(t))return"".concat(r," 0.00");let n=Number(t.toFixed(2)),i=new Intl.NumberFormat("en-MY",{style:"currency",currency:r,minimumFractionDigits:2,maximumFractionDigits:2}),d=i.formatToParts(0),c=(null===(s=d.find(e=>"currency"===e.type))||void 0===s?void 0:s.value)||r;if(null==a?void 0:a.mask){let e=Math.trunc(Math.abs(n)).toString().length;return"".concat(c," ").concat("X".repeat(e),".XX")}try{return i.format(n)}catch(t){let e=new Intl.NumberFormat("en-MY",{style:"decimal",minimumFractionDigits:2,maximumFractionDigits:2}).format(n);return"".concat(c," ").concat(e)}},n=e=>{if(!e||!e.address)return"";let{line1:t,line2:a,city:s,state:l,postcode:r,country:n}=e.address,i=[];return t&&i.push(t.trim()),a&&i.push(a.trim()),s&&i.push(s.trim()),l&&i.push(l.trim()),r&&i.push(r.trim()),n&&i.push(n.trim()),i.length>0?i.join(", "):"Address not available"},i=e=>e.replace(/([A-Z])/g," $1").replace(/^./,e=>e.toUpperCase()).split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" "),d=e=>{if(null==e||isNaN(e))return"0";if(e<1e3)return e.toString();
36let t=l()(e).format("0.[00]a").toUpperCase();return t},c=(e,t,a)=>e<=1?t:a}}]);
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.