1import{_ as be}from"./BU39HjjK.js";import{E as he}from"./CIf3jNmk.js";import{E as ye,a as Ae}from"./BqK22eZm.js";import{E as Ce}from"./ukz5vQAd.js";import{E as we,a as Ie}from"./QSOktryP.js";import{E as Te}from"./BRWwJqKy.js";import{d as le,b as xe,c as Le,u as ne,R as ke,a as Z,e as ee,q as _,s as We,D as Ne,z as Ee,v as te,f as w,o as h,m as Fe,U as oe,k as T,i as ae,w as v,l,g as d,h as s,t as r,F as Me,r as Be,N as Pe,K as Ve,x,ab as De,M as Se,_ as Re}from"./Y4ICXCuc.js";import"./yhRu0ssi.js";import"./CUrE0vbu.js";import"./DP0-JWAl.js";import{v as Ue}from"./BPzcK7w0.js";import{d as $e}from"./C6Bxth9v.js";import{_ as Oe}from"./lH8SSuXv.js";import{u as qe}from"./dJZm3NNg.js";import"./aMyN3jB5.js";import"./CailpaEi.js";import"./BE20p1dL.js";import"./BH9nULxh.js";import"./Ca1OSTWz.js";import"./anKvzuH2.js";import"./NVAjB_Yf.js";import"./vMIVouA4.js";import"./B_Rx9Gzo.js";import"./DbDwZyaJ.js";import"./CGgbl_zB.js";import"./_z8bWJjN.js";import"./CgkIKYBN.js";import"./DbdTMwVV.js";import"./D2-BrpQ8.js";import"./DK5zXFld.js";import"./JffoND0l.js";import"./DkH_gNP6.js";import"./BDO9QEQJ.js";import"./DVzYJwT5.js";import"./Ds-VHX1L.js";const Ge={key:0,class:"loading-data"},je={class:"flex"},ze={class:"transfer-select"},Ke={key:0},Ye={class:"transfer-select"},He={key:0},Je={key:0,class:"promotion-condition"},Qe={class:"border-bottom"},Xe={key:0},Ze={class:"border-bottom game-types"},et=["title"],tt=le({__name:"index",props:{pageClass:{},theme:{}},setup(re){const E=xe(),R=Le(),{t:n}=ne(),I=ke(),b=Z(),F=ee(()=>b.brand=="MTOWN88"),se=_(null),f=_([]),c=_([]),L=_(!1),k=_(!1),m=_({}),M=_(""),U=_(!1),ue=We(),t=_({fromAccount:"",fromAccountType:"",toAccount:"",toAccountType:"",amount:null,promotionCard:"",promotionId:""}),ie={turn:n("transfer.turnover"),win:n("transfer.winover"),winLoss:n("transfer.winLoss")},B=ee(()=>ue.currentRegionLang.languageCode||"my-en"),W=_({}),$=(o,e)=>{for(let a=0;a<e.length;a++)if(e[a].providerId==o){t.value.toAccount=e[a].type+"~"+e[a].providerId+"~"+e[a].code;break}else e[a].children&&e[a].children.length&&$(o,e[a].children)};Ne(()=>I.query,(o,e)=>{var a;o.id!==e.id&&(t.value.fromAccount=(a=f.value.filter(u=>u.type=="mainWallet")[0])==null?void 0:a.value,c.value=y(t.value.fromAccount,c.value),o.id&&($(Number(o.id),c.value),P(t.value.toAccount))),Number(o.allIn)&&(t.value.amount=o.allIn)});const ce=()=>{L.value=!0;const o=t.value.fromAccount?t.value.fromAccount.split("~"):[],e=t.value.toAccount?t.value.toAccount.split("~"):[],a=[o[1],e[1]].filter(u=>Number(u)!==-1).join(",");Z().setPromotionWarning({visible:!0,type:"transfer",status:1,apiParams:{providerId:a},onConfirm:me,onClose:()=>{L.value=!1}})},me=$e(async()=>
1{try{L.value=!0;const o=t.value.fromAccount?t.value.fromAccount.split("~"):[],e=t.value.toAccount?t.value.toAccount.split("~"):[];await De("/player/provider/transferAccounts",{...t.value,fromAccount:Number(o[1]),fromAccountType:o[0],toAccount:Number(e[1]),toAccountType:e[0],amount:t.value.amount||0}),Se.success(n("common.successful")),_e(),t.value.promotionCard||t.value.promotionId?E.push(R("/account/history?type=promotionApply")):E.push(R("/account/history?type=historyTransfer"))}finally{L.value=!1}},500),pe=o=>{M.value="",c.value=y(o,c.value)},P=async o=>{M.value="",t.value.promotionId="",m.value={},f.value=y(o,f.value),K()},K=async()=>{if(t.value.toAccount){let o=await x(`/player/transaction/getMemberPromotion?providerCode=${t.value.toAccount.split("~")[2]}&languageCode=${B.value}&amount=${t.value.amount||0}`);V.value=o}},de=()=>{K(),O()},ve=o=>{let e=(o==null?void 0:o.split(","))||[],a="";return e.map(u=>{let A=W.value?W.value[B.value][u]:"";A&&(a+=(a?", ":"")+A)}),a},O=async()=>{if(t.value.promotionId&&(t.value.promotionCard=""),t.value.promotionId||t.value.promotionCard)try{U.value=!0;const o={amount:t.value.amount||0,providerId:t.value.toAccount.split("~")[1]};t.value.promotionId?o.id=t.value.promotionId:t.value.promotionCard&&(o.code=t.value.promotionCard),await x("/player/transaction/calculatePromotion",o).then(e=>{var a,u;m.value={wallet:e.wallet,bonusAmount:e.bonusAmount?e.bonusAmount.toFixed(2):"-",targetAmount:e.completedAmount?e.completedAmount.toFixed(2):"-",totalTransferAmount:((a=e.totalTransferAmount)==null?void 0:a.toFixed(2))||"0.00",minDeposit:((u=e==null?void 0:e.minDeposit)==null?void 0:u.toFixed(2))||"0.00",maxBonus:e.maxBonus?e.maxBonus.toFixed(2):"-",targetMultiplier:e.targetMultiplier,targetType:ie[e.targetType],eligibleGameTypes:ve(e.eligibleGameTypes),percent:e.completed?e.completed+"%":"-",type:e.percent}})}finally{U.value=!1}},fe={bonusWallet:n("transfer.bonusWallet"),mainWallet:n("transfer.mainWalletBalance"),providerWalletList:n("transfer.providerWalletList"),seamlessWallet:n("transfer.seamlessWallet")},Y=o=>{const e=[];let a=0;return o.forEach(u=>{const[A,p]=u;A==="providerWalletList"&&Array.isArray(p)&&p.length>0?p.forEach(g=>{var D,S;e.push({id:a++,...g,value:g.typeName+"~"+g.typeCode,label:g.typeName,amount:g.totalBalance,flag:!0,showCurrency:!0,translation:!0,disabled:!((D=g.list)!=null&&D.length),children:(S=g.list)==null?void 0:S.map(C=>({...C,value:C.type+"~"+C.providerId+"~"+C.code,label:C.providerName,translation:!1,amount:C.walletBalance}))})}):p&&!(p instanceof Array)&&e.push({id:a++,...p,value:p.type+"~"+p.providerId+"~"+p.code,label:fe[p.providerName],amount:p.walletBalance,showCurrency:!0,translation:!1})}),e},y=(o,e)=>e.map(a=>a.value===o?{...a,disabled:!0}:a.children&&a.children.length?{...a,children:y(o,a.children)}:{...a,disabled:a.flag?a.disabled:!1}),V=_([]),ge=async()=>{var e,a;if(await te(),!((e=b.userInfo)!=null&&e.loginId))return;const{loginId:o}=b.userInfo;try{k.value=!0;const u=await x("/player/game/getGameTypeLanguages");W.value=u,console.log(u,999999);const A=await x("/player/provider/selectRegisteredWallet",{loginId:o}),p=await x("/player/provider/selectAllWallet",{loginId:o});b.setUserAllWallet(p),f.value=Y(Object.entries(A)),c.value=Y(Object.entries(p)),console.log(c.value),t.value.fromAccount=(a=f.value.filter(g=>g.type=="mainWallet")[0])==null?void 0:a.value,c.value=y(t.value.fromAccount,c.value),I.query.id&&($(Number(I.query.id),c.value),P(t.value.toAccount)),Number(I.query.allIn)&&(t.value.amount=I.query.allIn)}finally{k.value=!1}},q=(o,e)=>{let a=!1;return e.forEach(u=>{(u.value==o||u.children&&u.children.length&&q(o,u.children))&&(a=!0)}),a},H=()=>{let o=t.value.fromAccount||M.value,e=t.value.toAccount;t.value.fromAccount="",t.value.toAccount="",f.value=y("",f.value),c.value=y("",c.value),o&&q(o,c.value)&&(t.value.toAccount=o,f.value=y(t.value.toAccount,f.value),P(t.value.toAccount)),e&&q(e,f.value)?(t.value.fromAccount=e,c.value=y(t.value.fromAccount,c.value)):M.value=e},_e=async()=>{const{loginId:o}=b.userInfo,e=await x("/player/provider/selectAllWallet",{loginId:o});b.setUserAllWallet(e)},J=(o,e)=>o?e.label.toLowerCase().includes(o.toLowerCase()):!0;return Ee(async()=>{await te(),ge()}),(o,e)=>{const a=he,u=ye,A=Ce,p=Ie,g=we,D=Te,S=Pe,C=Ae,Q=Ue;return h(),w("div",{class:Fe(`transfer-common transfer-${o.pageClass}`)},[k.value?oe((h(),w("div",Ge,null,512)),[[Q,k.value]]):T("",!0),k.value?T("",!0):(h(),ae(C,{key:1,model:t.value,ref_key:"transferFormRef",ref:se,"label-position":"top",class:"transfer-form",size:"large"},{default:v(()=>{var X;return[l("div",je,[d(u,{label:s(n)("transfer.transferFrom"),class:"transfer-input"},{default:v(()=>[d(a,{modelValue:t.value.fromAccount,"onUpdate:modelValue":e[0]||(e[0]=i=>t.value.fromAccount=i),data:f.value,"render-after-expand":!1,onChange:pe,style:{background:"white","border-radius":"10px"},placeholder:s(n)("common.select"),"popper-class":`transfer-tree-select-${o.pageClass}`,"filter-node-method":J,filterable:!(s(b).isMobile&&s(F))},{default:v(({data:{label:i,typeCode:G,showCurrency:j,amount:N,currency:z}})=>[l("div",ze,[l("span",null,r(W.value[s(B)][G]||i),1),N!=="-1"?(h(),w("span",Ke,r(j?z+" ":"")+r(N),1)):T("",!0)])]),_:1},8,["modelValue","data","placeholder","popper-class","filterable"])]),_:1},8,["label"]),l("div",{onClick:H,class:"transfer-icon"}),l("div",{onClick:H,class:"transfer-icon-sort"}),d(u,{label:s(n)("transfer.transferTo"),class:"transfer-input input-right"},{default:v(()=>[d(a,{modelValue:t.value.toAccount,"onUpdate:modelValue":e[1]||(e[1]=i=>t.value.toAccount=i),data:c.value,"node-key":"value","default-expanded-keys":["providerWalletList~providerWalletList"],onChange:P,style:{background:"white","border-radius":"10px"},placeholder:s(n)("common.select"),"popper-class":`transfer-tree-select-${o.pageClass}`,"filter-node-method":J,filterable:!(s(b).isMobile&&s(F))},{default:v(({data:{label:i,typeCode:G,showCurrency:j,amount:N,currency:z}})=>[l("div",Ye,[l("span",null,r(W.value[s(B)][G]||i),1),N!=="-1"?(h(),w("span",He,r(j?z+" ":"")+r(N),1)):T("",!0)])]),_:1},8,["modelValue","data","placeholder","popper-class","filterable"])]),_:1},8,["label"])]),d(u,{label:s(n)("transfer.amount")},{default:v(()=>[d(A,{class:"transfer-amount",style:{width:"100%","text-align":"left"},modelValue:t.value.amount,"onUpdate:modelValue":e[2]||(e[2]=i=>t.value.amount=i),modelModifiers:{number:!0},"controls-position":"right",controls:!1,precision:2,onChange:de,placeholder:"0.00",min:0},null,8,["modelValue"])]),_:1},8,["label"]),d(u,{label:s(n)("transfer.promotion")},{default:v(()=>[d(g,{modelValue:t.value.promotionId,"onUpdate:modelValue":e[3]||(e[3]=i=>t.value.promotionId=i),onChange:O,clearable:"",placeholder:V.value&&V.value.length?s(n)("common.chooseYourPromotion"):s(n)("transfer.noPromotionClaim")},{default:v(()=>[(h(!0),w(Me,null,Be(V.value,i=>(h(),ae(p,{key:i.id,label:i.title,value:i.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),d(u,{label:s(n)("deposit.promotionCode")},{default:v(()=>[d(D,{disabled:!!t.value.promotionId,modelValue:t.value.promotionCard,"onUpdate:modelValue":e[4]||(e[4]=i=>t.value.promotionCard=i),placeholder:s(n)("common.enterPromotionCodeOptional"),onInput:O},null,8,["disabled","modelValue","placeholder"])]),_:1},8,["label"]),d(u,null,{default:v(()=>[d(S,{type:"primary",disabled:!(t.value.fromAccount&&t.value.toAccount),class:"submit-button",onClick:ce,loading:L.value},{default:v(()=>[Ve(r(s(n)("common.submit")),1)]),_:1},8,["disabled","loading"])]),_:1}),t.value.promotionId||t.value.promotionCard?oe((h(),w("div",Je,[l("div",null,[l("span",null,r(s(n)("promotion.providerCurrentBalance")+":"),1),l("span",null,r((+m.value.wallet).toFixed(2)),1)]),l("div",null,[l("span",null,r(s(n)("promotion.minDeposit")+":"),1),l("span",null,r((+m.value.minDeposit).toFixed(2)),1)]),l("div",Qe,[l("span",null,r(s(n)("promotion.transferAmount")+":"),1),l("span",null,r(((X=t.value.amount)==null?void 0:X.toFixed(2))||"0.00"),1)]),m.value.percent&&m.value.type==="PERCENT"?(h(),w("div",Xe,[l("span",null,r(s(n)("promotion.bonusPercentage")+":"),1),l("span",null,r(m.value.percent),1)])):T("",!0),l("div",null,[l("span",null,r(s(n)("promotion.bonusAmount")+":"),1),l("span",null,r(m.value.bonusAmount),1)]),l("div",null,[l("span",null,r(s(n)("promotion.maxBonus")+":"),1),l("span",null,r(m.value.maxBonus),1)]),l("div",null,[l("span",null,r(s(n)("promotion.totalTransferAmount")+":"),1),l("span",null,r(m.value.totalTransferAmount),1)]),l("div",Ze,[l("span",null,r(s(n)("promotion.eligibleGameTypes")+":"),1),l("span",{title:m.value.eligibleGameTypes},r(m.value.eligibleGameTypes||"-"),9,et)]),l("div",null,[l("span",null,r(s(n)("promotion.targetType")+":"),1),l("span",null,r(m.value.targetType||"-"),1)]),l("div",null,[l("span",null,r(s(n)("promotion.targetMultiplier")+":"),1),l("span",null,r(m.value.targetMultiplier>=0?m.value.targetMultiplier:"-"),1)]),l("div",null,[l("span",null,r(s(n)("promotion.targetAmount")+":"),1),l("span",null,r(m.value.targetAmount),1)])])),[[Q,U.value]]):T("",!0)]}),_:1},8,["model"]))],2)}}}),ot=Re(tt,[["__scopeId","data-v-9110cac1"]]),Rt=le({__name:"transfer",setup(re){const{t:E}=ne();return qe("account-transfer"),(R,n)=>{const I=be,b=ot,F=Oe;return h(),w("div",null,[d(F,{themeStyle:"mtown"},{title:v(()=>[d(I,{theme:"mtown",pageTitle:s(E)("transfer.transfer"),type:"text"},null,8,["pageTitle"])]),form:v(()=>[d(b,{pageClass:"mtown"})]),_:1})])}}});
1export{Rt as default};
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.