try{!function(){var e="u">typeof window?window:"u">typeof global?global:"u">typeof globalThis?globalThis:"u">typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="4cc01211-e970-45ec-a1db-43c953fe3dc2",e._sentryDebugIdIdentifier="sentry-dbid-4cc01211-e970-45ec-a1db-43c953fe3dc2")}()}catch(e){}"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6688],{17546:(e,t,r)=>{r.d(t,{_:()=>n});var a=r(37780);class s extends a.W{async listByPortal(e){return this.typedGet(`/portals/${e.portalId}/tiers`,{},"Failed to get portal tiers",{requireAuth:!1})}async getTierProgress(e){return this.typedGet("/tiers/progress",e,"Failed to get tier progress")}async listPortalTiers(e){return this.typedGet(`/portals/admin/${e}/tiers`,{},"Failed to list portal tiers")}async addPortalTier(e){let{portalId:t,...r}=e;return this.typedPost(`/portals/admin/${t}/tiers`,r,"Failed to add portal tier")}async updatePortalTier(e){let{portalId:t,tierName:r,...a}=e;return this.typedPut(`/portals/admin/${t}/tiers/${r}`,a,"Failed to update portal tier")}async removePortalTier(e){let{portalId:t,tierName:r}=e;return this.typedDelete(`/portals/admin/${t}/tiers/${r}`,"Failed to remove portal tier")}async listBrandTierOverrides(e){let{portalId:t,brandId:r}=e;return this.typedGet(`/portals/admin/${t}/tiers/brands/${r}`,{},"Failed to list brand tier overrides")}async getBrandOverrideSummary(e){return this.typedGet(`/portals/admin/${e.portalId}/tiers/brands/summary`,{},"Failed to get brand override summary")}async upsertBrandTierOverride(e){let{portalId:t,brandId:r,tierName:a,...s}=e;return this.typedPut(`/portals/admin/${t}/tiers/brands/${r}/${a}`,s,"Failed to upsert brand tier override")}async deleteBrandTierOverride(e){let{portalId:t,brandId:r,tierName:a}=e;return this.typedDelete(`/portals/admin/${t}/tiers/brands/${r}/${a}`,"Failed to delete brand tier override")}}let n=new s},26842:(e,t,r)=>{r.d(t,{H:()=>o});var a=r(95155);r(12115);var s=r(52115),n=r(59319),i=r(85410),l=r(24168);function o({balance:e,onClick:t,loading:r=!1,label:o,...d}){let{t:c}=(0,i.ok)(),{checkUserAccess:u}=(0,n.A)(),m=u({requiredPermissions:[l.JjK.ACCOUNTING.CREATE_PAYMENT_REQUEST]});return(0,a.jsx)(s.$n,{variant:"filled",color:"brand",onClick:t,disabled:r||!m||!(e>0),...d,children:o||c("dashboard.withdraw.title","Withdraw")})}},47014:(e,t,r)=>{r.d(t,{P:()=>n});var a=r(37780);class s extends a.W{async create(e){return this.typedPost("/accounting/payment-methods/create",e,"Failed to create payment method")}async list(e){return this.typedPost("/accounting/payment-methods/list",e,"Failed to list payment methods")}async deletePaymentMethod(e){return this.typedPost("/accounting/payment-methods/delete",e,"Failed to delete payment method")}async updateDefault(e){return this.typedPost("/accounting/payment-methods/update-default",e,"Failed to update default payment method")}async createPaymentRequest(e){return this.typedPost("/accounting/payment-requests/create",e,"Failed to create payment request")}async createPaymentRequestWithOtp(e,t){return this.typedPost("/accounting/payment-requests/create",e,"Failed to create payment request",{headers:{"X-OTP-Code":t}})}}let n=new s},47601:(e,t,r)=>{r.d(t,{A:()=>j});var a=r(95155),s=r(6296),n=r(5772),i=r(12115),l=r(52115),o=r(92289),d=r(97114),c=r(49789);function u({open:e,onOpenChange:t,email:r,expiresInSeconds:n,onSubmit:l,onResend:u,operation:m,loading:h=!1,error:p=null}){let[y,x]=(0,i.useState)(""),[f,b]=(0,i.useState)(!1),[g,v]=(0,i.useState)(n),w=(0,i.useRef)(null),j=(0,i.useRef)(0),N=function(e){let[t,r]=e.split("@");if(!t||!r)return e;let a=t.slice(0,2);return`${a}${"*".repeat(Math.max(t.length-2,4))}@${r}`}(r),F=(0,i.useCallback)(e=>{v(e),w.current&&clearInterval(w.current),w.current=setInterval(()=>{v(e=>e<=1?(w.current&&clearInterval(w.current),w.current=null,0):e-1)},1e3)},[]);(0,i.useEffect)(()=>(e&&F(n),()=>{w.current&&clearInterval(w.current)}),[e,n,F]),(0,i.useEffect)(()=>{!e&&(x(""),b(!1),w.current&&(clearInterval(w.current),w.current=null))},[e]);let P=async e=>{e.preventDefault(),6!==y.length||h||await l(y)},S=(0,i.useCallback)(e=>{let t=j.current<=1&&6===e.length;j.current=e.length,x(e),t&&l(e)},[l]),C=(0,i.useCallback)(async()=>{b(!0);try{let e=await u();x(""),F(e.expiresInSeconds)}catch{}finally{b(!1)}},[u,F]);return(0,a.jsx)(c.RF,{open:e,onOpenChange:t,title:"Verification Required",variant:"fixed-width",preventClose:!0,hideCloseButton:!0,children:(0,a.jsxs)("form",{onSubmit:P,className:"flex flex-col items-center pt-4",children:[(0,a.jsx)("div",{className:"flex h-12 w-12 items-center justify-center rounded-full bg-sys-bg-brand-secondary mb-4",children:(0,a.jsx)(o.A,{className:"h-6 w-6 text-sys-text-brand-primary"})}),(0,a.jsxs)("p",{className:"text-sm text-sys-text-default-secondary text-center mb-6",children:["We've sent a verification code to"," ",(0,a.jsx)("span",{className:"font-medium text-sys-text-default-primary",children:N}),".",(0,a.jsx)("br",{}),"Enter it below to confirm your ",m,"."]}),(0,a.jsx)("div",{className:"mb-6",children:(0,a.jsx)(d.P,{length:6,value:y,onChange:S,autoFocus:!0})}),p&&(0,a.jsx)("div",{className:"w-full mb-4",children:(0,a.jsx)(c.Fc,{variant:"warning",children:(0,a.jsx)(c.TN,{children:p})})}),(0,a.jsxs)("div",{className:"w-full flex flex-col gap-2",children:[(0,a.jsx)(c.$n,{type:"submit",variant:"filled",color:"brand",className:"w-full",disabled:6!==y.length||h,children:h?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(s.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Verifying..."]}):"Verify & Submit"}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)(c.$n,{type:"button",variant:"plain",size:"sm",onClick:C,disabled:f||g>0||h,children:f?"Resending...":g>0?`Resend code in ${g}s`:"Resend code"}),(0,a.jsx)(c.$n,{type:"button",variant:"plain",size:"sm",color:"neutral",onClick:()=>t(!1),disabled:h,children:"Cancel"})]})]})]})})}var m=r(71572),h=r(430),p=r(59319),y=r(37780);class x extends y.W{async checkRequired(e){return this.typedPost("/auth/identity/otp/check",e,"Failed to check OTP requirement")}async initiate(e){return this.typedPost("/auth/identity/otp/initiate",e,"Failed to initiate OTP")}}let f=new x;var b=r(47014);function g(e,t){return e instanceof Error?e.message:t}var v=r(71730),w=r(85410);let j=({show:e,onHide:t,availableBalance:r,currency:o,onSuccess:d})=>{let{t:c}=(0,w.ok)(),{user:x,org:j}=(0,p.A)(),{success:N}=(0,h.d)(),{currency:F,convert:P,formatWithSymbol:S}=(0,m.H2)(),C=j?.id||null,{paymentMethods:$,loading:k,error:T,refreshPaymentMethods:R}=(0,v.m)(C),A=(0,i.useRef)({onHide:t,onSuccess:d,refreshPaymentMethods:R});A.current={onHide:t,onSuccess:d,refreshPaymentMethods:R};let{submitWithdrawal:I,submitWithOtp:E,resendOtp:D,cancelOtp:M,showOtpDialog:U,expiresInSeconds:q,loading:B,error:L,clearError:_}=function({onSuccess:e}){let[t,r]=(0,i.useState)(!1),a=function({operation:e}){let[t,r]=(0,i.useState)(!1),[a,s]=(0,i.useState)(0),[n,l]=(0,i.useState)(null),o=(0,i.useRef)(e);o.current=e;let d=(0,i.useCallback)(()=>l(null),[]),c=(0,i.useCallback)(async()=>{l(null);let e=await f.initiate({operation:o.current});return(s(e.resendCooldownSeconds),e.sent)?(r(!0),!0):(l(`Verification code already sent. Please wait ${e.resendCooldownSeconds}s before trying again.`),!1)},[]),u=(0,i.useCallback)(async()=>{l(null);let e=await f.initiate({operation:o.current});return s(e.resendCooldownSeconds),e.sent||l(`Code already sent. Please wait ${e.resendCooldownSeconds}s before requesting a new one.`),{expiresInSeconds:e.resendCooldownSeconds}},[]);return{initiate:c,resend:u,cancel:(0,i.useCallback)(()=>{r(!1),l(null)},[]),closeDialog:(0,i.useCallback)(()=>{r(!1)},[]),showDialog:t,expiresInSeconds:a,error:n,setError:l,clearError:d}}({operation:"withdrawal"}),{initiate:s,clearError:n,setError:l,cancel:o,closeDialog:d}=a,c=(0,i.useRef)(null),u=(0,i.useCallback)(async t=>{r(!0),n();try{let{required:r}=await f.checkRequired({operation:"withdrawal",orgId:t.orgId});if(!r){let r=await b.P.createPaymentRequest(t);e(r);return}c.current=t,await s()}catch(e){if(e instanceof y.V&&"OTP_REQUIRED"===e.errorCode){c.current=t;try{await s()}catch(e){l(g(e,"Failed to initiate verification"))}return}l(g(e,"An unexpected error occurred"))}finally{r(!1)}},[e,s,n,l]),m=(0,i.useCallback)(async t=>{let a=c.current;if(a){r(!0),n();try{let r=await b.P.createPaymentRequestWithOtp(a,t);c.current=null,o(),e(r)}catch(e){if(e instanceof y.V){if("OTP_INVALID"===e.errorCode)return void l("Invalid verification code. Please try again.");if("OTP_MAX_ATTEMPTS"===e.errorCode){l("Maximum attempts exceeded. Please request a new code."),c.current=null,d();return}l(e.message);return}l(g(e,"An unexpected error occurred"))}finally{r(!1)}}},[e,n,l,o,d]),h=(0,i.useCallback)(()=>{o(),c.current=null},[o]);return{submitWithdrawal:u,submitWithOtp:m,resendOtp:a.resend,cancelOtp:h,showOtpDialog:a.showDialog,expiresInSeconds:a.expiresInSeconds,loading:t,error:a.error,clearError:a.clearError}}({onSuccess:e=>{z(""),G(""),Z({}),A.current.onHide(),A.current.refreshPaymentMethods?.(),A.current.onSuccess?.(),N("Payment request created successfully!",{description:`Request ID: ${e.id}`,position:"top-right",duration:3e3})}}),[O,z]=(0,i.useState)(""),[W,G]=(0,i.useState)(""),[V,Z]=(0,i.useState)({}),[H,K]=(0,i.useState)(!1),Y=$.find(e=>e.id===W),X=Y?.limits??null,J=parseFloat(r)||0,Q=X?.minAmountUsd!=null?Math.max(10,X.minAmountUsd):10,ee=X?.maxAmountUsd??null,et=null!=ee?Math.min(ee,J):J,er=(0,i.useRef)(()=>{}),ea=(0,i.useCallback)(()=>{z(""),G(""),Z({}),K(!1),_(),M()},[_,M]);(0,i.useEffect)(()=>{e||ea()},[e,ea]),er.current=async e=>{let t,r,a;if(e.preventDefault(),t={},r=!1,a=parseFloat(O),!O||a<=0?t.amount=c("user.dashboard.sections.withdraw.modal.errors.invalidAmount","Please enter a valid amount"):a10?t.amount=c("user.dashboard.sections.withdraw.modal.errors.belowMethodMin",`Minimum for this payment method is $${Q.toFixed(2)}`):r=!0:null!=ee&&a>ee?t.amount=c("user.dashboard.sections.withdraw.modal.errors.aboveMethodMax",`Maximum for this payment method is $${ee.toFixed(2)}`):a>J&&(t.amount=c("user.dashboard.sections.withdraw.modal.errors.insufficientBalance","Amount exceeds available balance")),W||(t.paymentMethod=c("user.dashboard.sections.withdraw.modal.errors.selectMethod","Please select a payment method")),Z(t),K(r),0!==Object.keys(t).length||r||!C)return;let s=parseFloat(O);s<=0||s>et||(_(),await I({orgId:C,amount:s,currency:"USD",paymentMethodId:W}))};let es=i.useMemo(()=>(0,a.jsx)(a.Fragment,{children:k?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-8",children:[(0,a.jsx)(s.A,{className:"h-8 w-8 animate-spin text-sys-color-primary"}),(0,a.jsx)("p",{className:"mt-2 text-sm text-sys-color-on-surface-variant",children:"Loading payment methods..."})]}):(0,a.jsxs)("div",{children:[T&&(0,a.jsx)(l.Fc,{variant:"warning",children:(0,a.jsx)(l.TN,{className:"text-sm",children:T})}),L&&(0,a.jsx)(l.Fc,{variant:"warning",children:(0,a.jsxs)(l.TN,{className:"text-sm",children:[(0,a.jsx)("strong",{children:"Error:"})," ",L]})}),k||0!==$.length?(0,a.jsxs)("form",{onSubmit:e=>er.current(e),children:[(0,a.jsxs)("div",{className:"py-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(l.JU,{htmlFor:"payment-method",children:c("user.dashboard.sections.withdraw.modal.paymentMethod","Payment Method")}),(0,a.jsxs)(l.l6,{value:W,onValueChange:G,disabled:B,children:[(0,a.jsx)(l.bq,{id:"payment-method",className:V.paymentMethod?"border-sys-color-error":"",children:(0,a.jsx)(l.yv,{placeholder:c("common.select","Select")})}),(0,a.jsx)(l.gC,{className:"z-[100001]",children:$.map(e=>{let t=e.providerConfig||{},r="";if("crypto"===e.methodType){let e=t.wallet_address;"string"==typeof e&&e.length>=10&&(r=`${e.slice(0,6)}...${e.slice(-4)}`)}else if("bank_transfer"===e.methodType){let e=t.account_number;"string"==typeof e&&e.length>=4&&(r=`****${e.slice(-4)}`)}else if("payment_apps"===e.methodType){let e=(t.accountDetails||{}).phoneNumber;"string"==typeof e&&e.length>=4&&(r=`****${e.slice(-4)}`)}return(0,a.jsxs)(l.eb,{value:e.id,children:[e.methodName," ",e.isDefault?`(${c("payments.paymentMethods.default","Default")})`:""," ",r&&`- ${r}`]},e.id)})})]}),V.paymentMethod&&(0,a.jsx)("p",{className:"text-sm text-sys-color-error",children:V.paymentMethod}),Y&&!Y.hasBeenUsed&&(0,a.jsx)(l.Fc,{variant:"warning",className:"mt-3",children:(0,a.jsx)(l.TN,{className:"text-sm",children:c("payments.withdraw.unusedMethodWarning","This is the first transfer using this payment method. We recommend transferring a small amount first to verify your payment details are correct.")})})]}),(0,a.jsxs)("div",{className:"mt-4 flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)(l.JU,{htmlFor:"amount",className:"text-sm font-medium",children:c("user.dashboard.sections.withdraw.modal.amount","Amount")}),(0,a.jsx)(l.$n,{variant:"plain",size:"xs",color:"brand",type:"button",onClick:()=>z(String(et)),children:c("common.max","Max")})]}),(0,a.jsx)(l.pd,{id:"amount",type:"text",inputMode:"decimal",value:O,onChange:e=>z(e.target.value),placeholder:c("payments.withdraw.enterAmountUsd","Enter amount in USD"),disabled:B,className:`text-base placeholder:text-sys-text-default-tertiary ${V.amount?"border-sys-color-error":""}`}),(0,a.jsxs)("p",{className:"text-xs font-medium text-sys-text-default-tertiary",children:[c("user.dashboard.sections.withdraw.modal.available","Available to withdraw"),": ",o,r]}),"USD"!==F&&(0,a.jsxs)("p",{className:"text-xs text-sys-text-default-quaternary",children:["≈ ",S(P(parseFloat(r),"USD"))]}),(0,a.jsxs)("div",{className:"flex gap-3 text-xs text-sys-text-default-tertiary",children:[(0,a.jsxs)("span",{children:[c("payments.withdraw.min","Min"),": $",Q.toFixed(2)]}),(0,a.jsxs)("span",{children:[c("payments.withdraw.max","Max"),": $",et.toFixed(2)]})]}),H&&(0,a.jsx)(l.Fc,{variant:"warning",children:(0,a.jsx)(l.TN,{className:"text-sm",children:c("user.dashboard.sections.withdraw.modal.errors.minimumAmount","Minimum withdrawal is $10.00, Please ensure your payments information is correct.")})}),V.amount&&(0,a.jsx)("p",{className:"text-sm text-sys-color-error",children:V.amount})]})]}),(0,a.jsx)("div",{className:"pt-4 border-t border-sys-border-default-secondary -mx-4 px-4",children:(0,a.jsx)(l.$n,{type:"submit",className:"w-full",size:"md",color:"brand",variant:"filled",disabled:B,children:B?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(s.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Processing..."]}):c("user.dashboard.sections.withdraw.modal.withdraw","Withdraw")})})]}):(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-6 text-center",children:[(0,a.jsx)(n.default,{src:"/assets/images/icons/wallet-remove.svg",alt:"No payment methods",width:48,height:48,className:"mb-3"}),(0,a.jsx)("p",{className:"text-base font-medium text-sys-color-on-surface",children:c("payments.paymentMethods.noPaymentMethods","No payment methods added")}),(0,a.jsx)("p",{className:"mt-1 text-sm text-sys-color-on-surface-variant",children:c("payments.paymentMethods.addYourFirst","Add your first payment method to enable withdrawals")})]})]})}),[k,T,L,$,W,Y,Q,et,B,O,r,o,F,P,S,H,V,c]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.RF,{open:e,onOpenChange:e=>!e&&void(ea(),t()),title:c("user.dashboard.sections.withdraw.modal.title","Withdraw Funds"),variant:"fixed-width",children:es}),(0,a.jsx)(u,{open:U,onOpenChange:e=>{e||M()},email:x?.email||"",expiresInSeconds:q,onSubmit:E,onResend:D,operation:"withdrawal",loading:B,error:L})]})}},52115:(e,t,r)=>{r.d(t,{nD:()=>a.nD,ub:()=>a.ub,As:()=>a.As,$m:()=>a.$m,Fc:()=>a.Fc,TN:()=>a.TN,eu:()=>a.eu,BK:()=>a.BK,Ex:()=>a.Ex,$n:()=>l,Zp:()=>a.Zp,FN:()=>a.FN,Wk:()=>a.Wk,ZZ:()=>a.ZZ,A7:()=>a.A7,at:()=>a.at,II:()=>a.II,Sc:()=>a.Sc,ph:()=>a.ph,lG:()=>a.lG,R4:()=>a.R4,HM:()=>a.HM,Cf:()=>a.Cf,rr:()=>a.rr,Es:()=>a.Es,c7:()=>a.c7,L3:()=>a.L3,zM:()=>a.zM,_s:()=>a._s,cp:()=>a.cp,zj:()=>a.zj,BE:()=>a.BE,Uz:()=>a.Uz,rI:()=>a.rI,SQ:()=>a.SQ,_2:()=>a._2,ty:()=>a.ty,z7:()=>a.z7,jf:()=>a.jf,pd:()=>a.pd,JU:()=>a.JU,KF:()=>a.KF,LR:()=>a.LR,ke:()=>a.ke,z6:()=>a.z6,CU:()=>a.CU,RF:()=>a.RF,xj:()=>a.xj,FK:()=>a.FK,$H:()=>a.$H,Y4:()=>a.Y4,Iz:()=>a.Iz,l6:()=>a.l6,gC:()=>a.gC,s3:()=>a.s3,eb:()=>a.eb,TR:()=>a.TR,mi:()=>a.mi,bq:()=>a.bq,yv:()=>a.yv,wv:()=>a.wv,cj:()=>a.cj,h:()=>a.h,Fm:()=>a.Fm,qp:()=>a.qp,Ap:()=>a.Ap,dO:()=>a.dO,XI:()=>a.XI,BF:()=>a.BF,nA:()=>a.nA,nd:()=>a.nd,A0:()=>a.A0,Hj:()=>a.Hj,tU:()=>a.tU,av:()=>a.av,j7:()=>a.j7,Xi:()=>a.Xi,vw:()=>a.vw,TM:()=>a.TM,GM:()=>a.GM,a1:()=>a.a1,wd:()=>a.wd,l$:()=>a.l$,lM:()=>a.lM,OY:()=>a.OY,dz:()=>a.dz,m_:()=>a.m_,ZI:()=>a.ZI,Bc:()=>a.Bc,k$:()=>a.k$,Zh:()=>a.Zh,dj:()=>a.dj});var a=r(49789),s=r(95155),n=r(96488),i=r(92093);function l({size:e="md",className:t,...r}){return(0,s.jsx)(n.$,{size:e,className:(0,i.cn)(t),...r})}},58440:(e,t,r)=>{r.d(t,{c:()=>y});var a=r(95155),s=r(68822),n=r(12115),i=r(2834);let l=({percentage:e,radius:t,strokeWidth:r,progressColor:s,backgroundColor:n,textColor:i,textColor2:l,currentValue:o,totalValue:d})=>{let c=2*Math.PI*t,u=2*t+r,m=t+r/2,h=o.length>9?"16px":"18px";return(0,a.jsxs)("svg",{width:u,height:u,viewBox:`0 0 ${u} ${u}`,children:[(0,a.jsx)("circle",{stroke:n,fill:"transparent",strokeWidth:r,r:t,cx:m,cy:m,strokeLinejoin:"round"}),(0,a.jsx)("circle",{stroke:s,fill:"transparent",strokeWidth:r,r:t,cx:52,cy:m,strokeDasharray:c,strokeDashoffset:c-e/100*c,strokeLinecap:"round",strokeLinejoin:"round",transform:`rotate(-90 ${t} ${t})`,className:"circular-progress-transition"}),(0,a.jsx)("text",{x:"50%",y:"50%",dominantBaseline:"middle",textAnchor:"middle",fill:i,fontSize:h,fontWeight:"semibold",children:o}),(0,a.jsx)("text",{x:"50%",y:"65%",dominantBaseline:"middle",textAnchor:"middle",fill:l,fontSize:"12px",fontWeight:"medium",children:d})]})};var o=r(52115),d=r(17546),c=r(24168),u=r(71572),m=r(64469),h=r(85410),p=r(92093);let y=({className:e})=>{let{t}=(0,h.ok)(),{convert:r,formatWithSymbol:y}=(0,u.H2)(),x=(0,i.d4)(m.nH),{responseType:f,tierProgress:b,contracts:g,loading:v,error:w}=function(e){let[t,r]=(0,n.useState)(null),[a,s]=(0,n.useState)(null),[i,l]=(0,n.useState)(null),[o,u]=(0,n.useState)(!0),[m,h]=(0,n.useState)(null),p=async()=>{if(!e){u(!1),h("Organization ID is required");return}try{u(!0),h(null);let t=await d._.getTierProgress({orgId:e});t.success?(r(t.responseType),t.responseType===c.f7d.TierProgress?(s(t.data),l(null)):t.responseType===c.f7d.CustomContracts&&(s(null),l(t.contracts))):(r(null),s(null),l(null))}catch(e){console.error("Failed to fetch tier progress:",e),h(e instanceof Error?e.message:"Failed to fetch tier progress"),r(null),s(null),l(null)}finally{u(!1)}};return(0,n.useEffect)(()=>{p()},[e]),{responseType:t,tierProgress:a,contracts:i,loading:o,error:m,refetch:p}}(x?.id),j=e=>e?({bronze:t("dashboard.withdraw.tiers.bronze","Bronze"),silver:t("dashboard.withdraw.tiers.silver","Silver"),gold:t("dashboard.withdraw.tiers.gold","Gold"),platinum:t("dashboard.withdraw.tiers.platinum","Platinum"),diamond:t("dashboard.withdraw.tiers.diamond","Diamond"),obsidian:t("dashboard.withdraw.tiers.obsidian","Obsidian")})[e.toLowerCase()]||e:"";if(w)return(0,a.jsx)(o.Zp,{className:(0,p.cn)("overflow-hidden",e),children:(0,a.jsx)("div",{className:"p-4 text-center",children:(0,a.jsx)("p",{className:"text-sys-text-negative-primary text-sm",children:t("dashboard.withdraw.tierError","Failed to load tier information")})})});if(f===c.f7d.CustomContracts)return(0,a.jsx)(o.Zp,{className:(0,p.cn)("overflow-hidden",e),children:(0,a.jsxs)("div",{className:"p-4",children:[(0,a.jsx)("h5",{className:"text-sm font-medium text-sys-text-default-primary mb-3",children:t("dashboard.withdraw.your_revshare","Your Rev share")}),v?(0,a.jsx)("div",{className:"space-y-2",children:[1,2,3].map(e=>(0,a.jsx)("div",{className:"h-10 bg-sys-bg-default-tertiary animate-pulse rounded"},e))}):g&&g.length>0?(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full text-sm",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"border-b border-sys-border-default-secondary",children:[(0,a.jsx)("th",{className:"text-start py-2 font-medium text-sys-text-default-tertiary",children:t("dashboard.withdraw.brand","Brand")}),(0,a.jsx)("th",{className:"text-end py-2 font-medium text-sys-text-default-tertiary",children:t("dashboard.withdraw.revshare","RevShare")})]})}),(0,a.jsx)("tbody",{children:g.map(e=>(0,a.jsxs)("tr",{className:"border-b border-sys-border-default-secondary last:border-b-0",children:[(0,a.jsx)("td",{className:"py-2 text-sys-text-default-primary",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[e.brandLogo?(0,a.jsx)("img",{src:e.brandLogo,alt:e.brandLabel||e.brandKey,className:"w-6 h-6 rounded object-contain"}):(0,a.jsx)("div",{className:"w-6 h-6 rounded bg-sys-bg-default-tertiary flex items-center justify-center",children:(0,a.jsxs)("svg",{className:"w-3.5 h-3.5 text-sys-text-default-tertiary",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),(0,a.jsx)("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}),(0,a.jsx)("span",{children:e.brandLabel||e.brandKey})]})}),(0,a.jsxs)("td",{className:"py-2 text-end text-sys-text-default-primary",children:[e.revsharePercentage,"%"]})]},e.brandKey))})]})}):(0,a.jsx)("p",{className:"text-sm text-sys-text-default-tertiary",children:t("dashboard.withdraw.noContracts","No contracts available")})]})});let N=b?{current:y(r(b.totalRevshare,"USD")),target:b.nextTierThreshold?y(r(b.nextTierThreshold,"USD")):"MAX"}:{current:y(0),target:y(0)};return(0,a.jsx)(o.Bc,{children:(0,a.jsx)(o.Zp,{className:(0,p.cn)("overflow-hidden",e),children:(0,a.jsxs)("div",{className:"p-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,a.jsx)("div",{children:(0,a.jsxs)("div",{children:[(0,a.jsxs)("h5",{className:"flex items-center gap-1 text-sm font-medium text-sys-text-default-primary mb-1",children:[t("dashboard.withdraw.your_tier","Your tier"),(0,a.jsxs)(o.m_,{children:[(0,a.jsx)(o.k$,{asChild:!0,children:(0,a.jsx)("span",{className:"inline-flex cursor-help shrink-0",children:(0,a.jsx)(s.A,{className:"h-3.5 w-3.5 text-sys-text-default-tertiary"})})}),(0,a.jsx)(o.ZI,{className:"max-w-xs",children:(0,a.jsx)("p",{children:t("dashboard.withdraw.tierTooltip","Your level increases automatically based on your total lifetime Player Revenue Share. As you move up, you permanently earn a higher Player RevShare (up to 40%) and a higher Affiliate Bonus (up to 20%).")})})]})]}),(0,a.jsx)("h2",{className:"mb-3 text-3xl font-semibold text-sys-text-default-primary",children:v||!b?(0,a.jsx)("span",{className:"inline-block h-9 w-32 bg-sys-bg-default-tertiary animate-pulse rounded"}):j(b.currentTier)}),(0,a.jsx)("p",{className:"text-sm font-medium text-sys-text-default-tertiary m-0",children:v||!b?(0,a.jsx)("span",{className:"inline-block h-5 w-48 bg-sys-bg-default-tertiary animate-pulse rounded"}):(()=>{if(!b)return"";let e=b.currentTier?.toLowerCase();if(!e)return"";let r=Math.floor(b.progressPercentage);return t(`dashboard.withdraw.motivation.general.${r}`,b.nextTier?`${r}% progress to ${j(b.nextTier)}`:`${e.charAt(0).toUpperCase()+e.slice(1)} tier achieved`,{currentTier:j(e),nextTier:b.nextTier?j(b.nextTier):"Maximum",revShare:b.currentTierRevshare})})()})]})}),(0,a.jsx)("div",{children:(0,a.jsx)("div",{children:(0,a.jsx)(l,{percentage:v||!b?0:b.progressPercentage,radius:56,strokeWidth:8,progressColor:"#6353E9",backgroundColor:"#313139",textColor:"#F8F9FB",textColor2:"#9EA0B0",currentValue:v?y(0):N.current,totalValue:v?y(0):N.target},`progress-${b?.currentTier||"loading"}-${b?.totalRevshare||0}`)})})]}),(0,a.jsxs)("div",{className:"-mx-4 -mb-4 px-4 mt-4 grid grid-cols-2 items-center border-t border-sys-border-default-secondary",children:[(0,a.jsx)("div",{className:"py-3 pe-4 border-e border-sys-border-default-secondary",children:(0,a.jsxs)("p",{className:"text-sm font-medium text-sys-text-default-primary",children:[v||!b?(0,a.jsx)("span",{className:"inline-block h-5 w-16 bg-sys-bg-default-tertiary animate-pulse rounded"}):`${b.currentTierRevshare}%`," ",t("dashboard.withdraw.revshare","RevShare")]})}),(0,a.jsx)("div",{className:"py-3 ps-4",children:(0,a.jsxs)("p",{className:"text-sm font-medium text-sys-text-default-primary",children:[v||!b?(0,a.jsx)("span",{className:"inline-block h-5 w-16 bg-sys-bg-default-tertiary animate-pulse rounded"}):`${b.currentTierAffiliateBonus}%`," ",t("dashboard.withdraw.affiliateBonus","Affiliate Bonus")]})})]})]})})})}},65148:(e,t,r)=>{r.d(t,{y:()=>n});var a=r(37780);class s extends a.W{async listReports(){return this.typedGet("/reports",{},"Failed to list reports")}async getReportSchema(e){return this.typedGet(`/reports/${encodeURIComponent(e)}/schema`,{},`Failed to get schema for report: ${e}`)}async queryReport(e){return this.typedPost("/reports/query",e,`Failed to query report: ${e.report}`,{timeout:6e4})}async exportReport(e){return this.typedPost("/reports/export",e,`Failed to export report: ${e.report}`,{timeout:12e4})}async getExportStatus(e){return this.typedGet(`/reports/export-status/${encodeURIComponent(e)}`,{},`Failed to get export status: ${e}`)}async executeReport(e,t,r){return this.queryReport({report:e,filters:t,options:r})}}let n=new s},68729:(e,t,r)=>{r.d(t,{A:()=>l});var a=r(12115),s=r(2834),n=r(64469),i=r(88752);function l(){let e=(0,s.d4)(n.nH),[t,r]=(0,a.useState)(null),[l,o]=(0,a.useState)(!0),[d,c]=(0,a.useState)(null),u=(0,a.useCallback)(async()=>{if(!e?.id)return void o(!0);try{o(!0),c(null);let t=await i.q.getBalance({orgId:e.id});r(t)}catch(e){console.error("Error fetching balance:",e),c(e instanceof Error?e.message:"Failed to fetch balance")}finally{o(!1)}},[e?.id]);return(0,a.useEffect)(()=>{u()},[u]),{balance:t?.balance??0,inProcess:t?.inProcess??0,accumulating:t?.accumulating??0,withdrawal:t?.withdrawal??0,updatedAt:t?.updatedAt??null,isLoading:l,error:d,refetch:u}}},71053:(e,t,r)=>{r.d(t,{S:()=>p});var a=r(95155),s=r(76498),n=r(84980),i=r(44071),l=r(52484);r(12115);var o=r(52115),d=r(71572),c=r(85410),u=r(92093),m=r(68822);let h=({card:e,formattedValue:t,secondaryValue:r,isLoading:s})=>{let n=e.icon;return(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("h3",{className:"text-sys-text-default-primary text-xl font-semibold",children:s?(0,a.jsx)("span",{className:"inline-block h-6 w-24 bg-sys-bg-default-tertiary animate-pulse rounded"}):t}),r&&!s&&(0,a.jsx)("span",{className:"text-xs text-sys-text-default-tertiary",children:r})]}),(0,a.jsx)("span",{className:(0,u.cn)("flex items-center justify-center",e.iconColor||"text-sys-text-default-secondary"),children:(0,a.jsx)(n,{className:"h-7 w-7"})})]}),(0,a.jsxs)("span",{className:"text-sys-text-default-secondary text-xs font-medium flex items-center gap-1",children:[e.label,e.tooltip&&(0,a.jsxs)(o.m_,{children:[(0,a.jsx)(o.k$,{asChild:!0,children:(0,a.jsx)("span",{className:"inline-flex cursor-help shrink-0",children:(0,a.jsx)(m.A,{className:"h-3.5 w-3.5 text-sys-text-default-tertiary"})})}),(0,a.jsx)(o.ZI,{className:"max-w-xs",children:(0,a.jsx)("p",{children:e.tooltip})})]})]})]})},p=({balance:e,inProcess:t,accumulating:r,withdrawal:m,isLoading:p=!1,error:y=null,enableCurrencyConversion:x=!0,className:f})=>{let{t:b}=(0,c.ok)(),{convert:g,formatWithSymbol:v,currency:w}=(0,d.H2)(),j=e=>x?v(g(e,"USD")):new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(e),N=e=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(e),F=x&&"USD"!==w,P=[{id:"balance",label:b("user.dashboard.balance.available","Available Balance"),value:e,icon:s.A,iconColor:"text-sys-text-positive-primary",tooltip:b("user.dashboard.balance.availableTooltip","Funds that have passed the validation period and are ready for withdrawal. You can request a payout once this balance is $10 or more.")},{id:"inProcess",label:b("user.dashboard.balance.inProcess","In Process"),value:t,icon:n.A,iconColor:"text-sys-text-warning-primary",tooltip:b("user.dashboard.balance.inProcessTooltip","Earnings from the previous month that are currently in a validation and hold period. This hold lasts up to 20 days to handle fraud checks and chargebacks before the funds become Available.")},{id:"accumulating",label:b("user.dashboard.balance.accumulating","Accumulating"),value:r,icon:i.A,iconColor:"text-sys-text-brand-primary",tooltip:b("user.dashboard.balance.accumulatingTooltip","Your earnings building up during the current calendar month, which update in near real-time. At the end of the month, these funds will move to 'In Process' for validation.")},{id:"withdrawal",label:b("user.dashboard.balance.withdrawn","Total Withdrawn"),value:m,icon:l.A,iconColor:"text-sys-text-positive-primary",tooltip:b("user.dashboard.balance.withdrawnTooltip","The amount of your recent withdrawals.")}];return y?(0,a.jsx)(o.Zp,{className:(0,u.cn)("overflow-hidden",f),children:(0,a.jsx)("div",{className:"p-4 text-center",children:(0,a.jsx)("p",{className:"text-sys-text-negative-primary text-sm",children:b("user.dashboard.balance.error","Failed to load balance information")})})}):(0,a.jsx)(o.Bc,{children:(0,a.jsx)(o.Zp,{className:(0,u.cn)("overflow-hidden h-fit",f),children:(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsxs)("div",{className:"grid grid-cols-1 laptop:grid-cols-[2fr_2fr]",children:[(0,a.jsx)("div",{className:"p-4 border-b laptop:border-b laptop:border-r border-sys-border-default-secondary",children:(0,a.jsx)(h,{card:P[0],formattedValue:j(P[0].value),secondaryValue:F?N(P[0].value):void 0,isLoading:p})}),(0,a.jsx)("div",{className:"p-4 border-b laptop:border-b border-sys-border-default-secondary",children:(0,a.jsx)(h,{card:P[1],formattedValue:j(P[1].value),secondaryValue:F?N(P[1].value):void 0,isLoading:p})})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 laptop:grid-cols-2",children:[(0,a.jsx)("div",{className:"p-4 border-b laptop:border-b-0 laptop:border-r border-sys-border-default-secondary",children:(0,a.jsx)(h,{card:P[2],formattedValue:j(P[2].value),secondaryValue:F?N(P[2].value):void 0,isLoading:p})}),(0,a.jsx)("div",{className:"p-4",children:(0,a.jsx)(h,{card:P[3],formattedValue:j(P[3].value),secondaryValue:F?N(P[3].value):void 0,isLoading:p})})]})]})})})}},71730:(e,t,r)=>{r.d(t,{m:()=>l});var a=r(12115),s=r(2834),n=r(64469),i=r(47014);let l=e=>{let[t,r]=(0,a.useState)([]),[l,o]=(0,a.useState)(!0),[d,c]=(0,a.useState)(null),[u,m]=(0,a.useState)(!1),h=(0,a.useRef)(null),p=(0,s.d4)(n.H$),y=(0,a.useCallback)(async(t=!1)=>{if((h.current&&(clearTimeout(h.current),h.current=null),!p&&e)&&!u){o(!0),c(null);try{let t=await i.P.list({orgId:e||""});t?.methods?r(t.methods):r([])}catch(e){console.error("Error fetching payment methods:",e),c(e instanceof Error?e.message:"An unexpected error occurred"),r([])}finally{o(!1)}}},[e,p,u]),x=(0,a.useCallback)(async t=>{if(!e)return c("Organization ID is required"),!1;if(u)return console.warn("createPaymentMethod: Another operation is in progress"),!1;try{return m(!0),c(null),await i.P.create({orgId:e,...t}),h.current=setTimeout(()=>{y(!0)},500),!0}catch(e){return console.error("Error creating payment method:",e),c(e instanceof Error?e.message:"An unexpected error occurred"),!1}finally{m(!1)}},[e,y,u]),f=(0,a.useCallback)(async t=>{if(!e)return console.error("deletePaymentMethod: No orgId provided"),c("Organization ID is required"),!1;if(u)return console.warn("deletePaymentMethod: Another operation is in progress"),!1;try{return m(!0),c(null),r(e=>e.filter(e=>e.id!==t)),await i.P.deletePaymentMethod({orgId:e,paymentMethodId:t}),h.current=setTimeout(()=>{y(!0)},500),!0}catch(e){return console.error("Delete payment method error:",e),await y(!0),c(e instanceof Error?e.message:"An unexpected error occurred"),!1}finally{m(!1)}},[e,y,u]),b=(0,a.useCallback)(async t=>{if(!e)return console.error("setDefaultPaymentMethod: No orgId provided"),c("Organization ID is required"),!1;if(u)return console.warn("setDefaultPaymentMethod: Another operation is in progress"),!1;try{return m(!0),c(null),r(e=>e.map(e=>({...e,isDefault:e.id===t}))),await i.P.updateDefault({orgId:e,paymentMethodId:t}),h.current=setTimeout(()=>{y(!0)},500),!0}catch(e){return console.error("Set default payment method error:",e),await y(!0),c(e instanceof Error?e.message:"An unexpected error occurred"),!1}finally{m(!1)}},[e,y,u]),g=(0,a.useCallback)(async()=>{h.current=setTimeout(()=>{y(!0)},300)},[y]);return(0,a.useEffect)(()=>{p||y()},[p,y]),(0,a.useEffect)(()=>()=>{h.current&&clearTimeout(h.current)},[]),{paymentMethods:t,loading:l||u,error:d,refetch:y,createPaymentMethod:x,refreshPaymentMethods:g,deletePaymentMethod:f,setDefaultPaymentMethod:b}}},81518:(e,t,r)=>{r.d(t,{A:()=>a});function a({title:e}){return null}},86051:(e,t,r)=>{r.d(t,{td:()=>i,vv:()=>n});let a={USD:"$",EUR:"€",GBP:"\xa3",JPY:"\xa5",TRY:"₺",BRL:"R$",INR:"₹",IDR:"Rp",CAD:"C$",AUD:"A$",CHF:"CHF",CNY:"\xa5",KRW:"₩",SEK:"kr",NOK:"kr",DKK:"kr",PLN:"zł",CZK:"Kč",HUF:"Ft",RUB:"₽"},s={USD:1,EUR:.85,GBP:.73,TRY:32.5,BRL:5.2,INR:83.25,IDR:15800};function n(e,t,r={}){var i;let{showSymbol:l=!0,showCode:o=!1,decimals:d=2,convertTo:c,locale:u="en-US"}=r,m=e,h=t;c&&c!==t&&(m=function(e,t,r="USD"){return e/(s[(t||"USD").toUpperCase()]||1)*(s[(r||"USD").toUpperCase()]||1)}(e,t,c),h=c);let p=a[(i=h).toUpperCase()]||i,y=m.toLocaleString(u,{minimumFractionDigits:d,maximumFractionDigits:d}),x="";return x=l?`${p}${y}`:y,o&&(x+=` ${h}`),x}let i=e=>Math.round(100*(("string"==typeof e?parseFloat(e):e)||0))/100},88752:(e,t,r)=>{r.d(t,{q:()=>l});var a=r(85705),s=r(37780),n=r(69226);class i extends s.W{async getBalance(e){return this.typedPost("/accounting/balance/get",e,"Failed to fetch balance")}async approvePaymentRequest(e){return this.typedPost("/accounting/payment-requests/approve",e,"Failed to approve payment request")}async rejectPaymentRequest(e){return this.typedPost("/accounting/payment-requests/reject",e,"Failed to reject payment request")}async forceRejectPaymentRequest(e){return this.typedPost("/accounting/payment-requests/force-reject",e,"Failed to force reject payment request")}async markAsPaid(e){return this.typedPost("/accounting/payment-requests/mark-as-paid",e,"Failed to mark payment request as paid")}async processPaymentExport(e){return this.typedPost("/accounting/payments/export",e,"Failed to export payments")}async getInvoiceSettings(e){return this.typedGet("/accounting/invoices/settings",e||{},"Failed to fetch invoice settings")}async updateInvoiceSettings(e){return this.typedPut("/accounting/invoices/settings",e,"Failed to update invoice settings")}async downloadInvoice(e,t){let r=(0,a.h)(),{paymentRequestId:s,orgId:i}=e,l=new URLSearchParams({orgId:i}),o=`${r}/accounting/invoices/${s}/download?${l}`,d=n.b.getAccessToken(),c=await fetch(o,{method:"GET",headers:{...d?{Authorization:`Bearer ${d}`}:{}}});if(!c.ok){let e=c.headers.get("content-type");if(e?.includes("application/json"))throw Error((await c.json()).error||"Failed to download invoice");throw Error(`Failed to download invoice: ${c.statusText}`)}let u=await c.blob(),m=URL.createObjectURL(u),h=document.createElement("a");h.href=m,h.download=`Invoice-${t}.pdf`,h.click(),URL.revokeObjectURL(m)}async sendInvoiceEmail(e){let{paymentRequestId:t,...r}=e;return this.typedPost(`/accounting/invoices/${t}/email`,r,"Failed to send invoice email")}async createInvoice(e){return this.typedPost("/accounting/invoices",e,"Failed to create invoice")}async getPaymentRequestDetails(e){return this.typedPost("/accounting/payment-requests/details",e,"Failed to fetch payment request details")}}let l=new i},89273:(e,t,r)=>{r.d(t,{A:()=>c});var a=r(95155),s=r(12115),n=r(59319),i=r(85410),l=r(20232),o=r(92136);let d=s.memo(({tutorialName:e,videoUrl:t,title:r,autoShow:d=!0,onClose:c,show:u,forceShow:m=!1})=>{let[h,p]=(0,s.useState)(!1),[y,x]=(0,s.useState)(!0),[f,b]=(0,s.useState)(!1),{user:g}=(0,n.A)(),{t:v}=(0,i.ok)(),w=(0,s.useRef)(!1),j=(0,s.useRef)(!1);(0,s.useRef)(null);let N=(0,s.useRef)(null),F=(0,s.useRef)(""),P=g?.id,S=void 0!==u?u:h,C=!0===window.__TUTORIAL_DEBUG__;(0,s.useEffect)(()=>{let e=()=>{let t=document.querySelector('.loader, .app-loader, [class*="loader"]');!t||t&&"none"===window.getComputedStyle(t).display?setTimeout(()=>{b(!0)},300):setTimeout(e,100)};setTimeout(e,500);let t=()=>{"visible"===document.visibilityState&&e()};return document.addEventListener("visibilitychange",t),()=>{document.removeEventListener("visibilitychange",t)}},[]),(0,s.useEffect)(()=>{{let e=window.location.pathname;if(F.current!==e){F.current=e,w.current=!1,b(!1);let t=()=>{let e=document.querySelector('.loader, .app-loader, [class*="loader"]');!e||e&&"none"===window.getComputedStyle(e).display?setTimeout(()=>{b(!0)},300):setTimeout(t,100)};setTimeout(t,500)}}},[e]),(0,s.useEffect)(()=>{null===N.current&&P&&(w.current=!1),N.current=P||null},[P,e]),(0,s.useEffect)(()=>{(async()=>{if(void 0!==u||m){x(!1),m&&void 0===u&&p(!0);return}if(!P||!f||w.current||!d)return x(!1);w.current=!0,x(!0);try{(C||0)&&setTimeout(()=>{p(!0)},100)}catch(e){console.error("Error checking tutorial status:",e)}finally{x(!1)}})()},[P,e,d,u,m,C,!1,f]);let $=(0,s.useCallback)(async e=>{if(e&&(e.preventDefault(),e.stopPropagation()),!j.current){j.current=!0;void 0===u&&p(!1),c?requestAnimationFrame(()=>{j.current=!1,c()}):j.current=!1}},[P,e,c,u,m,C]);return((0,s.useEffect)(()=>{let e=e=>{"Escape"===e.key&&S&&$()};return S&&document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[S,$]),!y&&S&&f)?(0,a.jsx)(o.lG,{open:S,onOpenChange:e=>!e&&$(),children:(0,a.jsxs)(o.Cf,{showCloseButton:!0,children:[(0,a.jsx)(o.c7,{className:"p-6 pb-0",children:(0,a.jsxs)("div",{className:"flex items-center gap-2 justify-center",children:[(0,a.jsx)(l.A,{className:"text-sys-text-brand-primary w-5 h-5"}),(0,a.jsx)(o.L3,{className:"text-sys-text-default-primary",children:v("common.tutorial","Tutorial")})]})}),(0,a.jsx)("div",{className:"flex-1 p-6 pt-4",children:t?(0,a.jsx)("iframe",{src:t,title:e,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,loading:"lazy",className:"w-full h-full border-0 rounded-lg"}):(0,a.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,a.jsx)("p",{className:"text-sys-text-default-secondary",children:v("common.noVideoUrl","No video URL provided")})})})]})}):null}),c=s.memo(({tutorialName:e,videoUrl:t,title:r,autoShow:l=!0,tutorials:o})=>{let{user:c,loading:u}=(0,n.A)(),{t:m}=(0,i.ok)(),h=c?.id,p=(0,s.useCallback)(()=>{},[e]),y=(0,s.useMemo)(()=>t||(o&&o[e]?.link?o[e].link:void 0),[t,o,e]);if(u||!h||!y)return null;let x=`${e}-tutorial-modal-${h}`;return(0,a.jsx)(d,{tutorialName:e,videoUrl:y,title:r||m(`tutorial.welcome.${e}`,`Welcome to ${e}`),autoShow:l,onClose:p},x)})}}]);