import{u as ie,X as U,t as ce,r as s,c as n,m as ue,I as de,J as ve,bA as ge,bB as pe,bC as he,h as fe,bD as me,bE as we}from"./index-xnhGKCfe.js";import{u as be}from"./useProtocol-DJp7lFWi.js";const ye={bg:"var(--secondary_color2)",box_shadow:"rgba(112, 170, 220, 0.30)",active:"#8FB6FE",active_box:"linear-gradient(180deg, #90B6FF 70%, #3368CC 100%)",border:"#2E63C7",progress_border:"#1748A4",text:"#4A81E8",progress_bg:"linear-gradient(0deg, #1A366B 0%, #0D2C64 98.5%)"},Se={bg:"var(--secondary_color2)",box_shadow:"rgba(247, 177, 85, 0.30)",active:"#EDC078",active_box:"linear-gradient(180deg, #EDC078 70%, #CC7A33 100%)",border:"#C8700A",progress_border:"#A55A04",text:"#E28409",progress_bg:"linear-gradient(0deg, #593D19 0%, #4E2F0C 98.5%)"},Ae={bg:"var(--secondary_color2)",box_shadow:"rgba(167, 115, 236, 0.30)",active:"#BBA9FB",active_box:"linear-gradient(180deg, #BBA9FB 70%, #5C33CC 100%)",border:"#802CF0",progress_border:"#663CA9",text:"#9A5CEF",progress_bg:"linear-gradient(0deg, #311754 0%, #291347 98.5%)"},Ce={bg:"var(--secondary_color2)",box_shadow:"rgba(234, 110, 112, 0.30)",active:"#FF7878",active_box:"linear-gradient(180deg, #FF7878 70%, #BF222C 100%)",border:"#CE1013",progress_border:"#8D3C3C",text:"#F95959",progress_bg:"linear-gradient(0deg, #5C1D1A 0%, #461919 98.5%)"},W={sliver:ye,gold:Se,diamond:Ae,special:Ce},c=[{icon:"",amount:"111",type:1,name:"Silver Spin",wheel2Name:"Brass Spin",label:"silver",color:W.sliver},{amount:"222",type:2,name:"Gold Spin",wheel2Name:"Silver Spin",label:"gold",icon:"",color:W.gold},{amount:"33",type:3,name:"Diamond Spin",wheel2Name:"Gold Spin",label:"diamond",icon:"",color:W.diamond},{amount:"444",type:4,name:"Special Spin",wheel2Name:"Special Spin",label:"special",icon:"",color:W.special}],i=s({}),f=s(0),_=s(0),d=U({0:"",1:"",2:"",3:"",4:"",5:""}),k=s(!1),T=s({}),M=s([]),F=s([]),B=s(!1),Ee=()=>{const{t:o}=ie(),{onAnalyticsTrigger:G}=fe();d[0]=o("t1213"),d[1]=o("t1214"),d[2]=o("t1208"),d[3]=o("t1209"),d[4]=o("t1210"),d[5]=o("t1211"),c[0].name=o("t1208"),c[0].wheel2Name=o("t1228"),c[1].name=o("t1209"),c[1].wheel2Name=o("t1208"),c[2].name=o("t1210"),c[2].wheel2Name=o("t1209"),c[3].name=o("t1211"),c[3].wheel2Name=o("t1211");const I=s([]),m=s([]),g=U({pageNo:1,pageSize:10}),w=s(!1),y=s(0),L=s([]),R=s(""),p=s(!1),{richText:H,getProtocol:P}=be(5),z=ce(),{getImgVal:O}=ue(),V=n(()=>i.value.isOpen||!1),j=n(()=>i.value.currentValidDate||""),E=n(()=>i.value.rechargeAmount||0),b=n(()=>i.value.silverWheelInfo||{}),S=n(()=>i.value.goldWheelInfo||{}),A=n(()=>i.value.diamondWheelInfo||{}),C=n(()=>i.value.specialWheelInfo||{}),J=n(()=>i.value.isSpecialWheelUnlock||!1),$=n(()=>i.value.rewardUpAmount||0),q=n(()=>i.value.specialWheelUnlockAmount||0),K=n(()=>{var t,r;if(!((t=b.value.rewardList)!=null&&t.length))return 0;let e=((r=b.value.rewardList)==null?void 0:r.map(a=>{if(a.rewardType===1)return a.rewardAmount}).filter(a=>a!==void 0))||[];return e=e.sort((a,u)=>u-a),e[0]||0}),N=n(()=>{var t,r;if(!((t=S.value.rewardList)!=null&&t.length))return 0;let e=((r=S.value.rewardList)==null?void 0:r.map(a=>{if(a.rewardType===1)return a.rewardAmount}).filter(a=>a!==void 0))||[];return e=e.sort((a,u)=>u-a),e[0]||0}),Q=n(()=>{var t,r;if(!((t=A.value.rewardList)!=null&&t.length))return 0;let e=((r=A.value.rewardList)==null?void 0:r.map(a=>{if(a.rewardType===1)return a.rewardAmount}).filter(a=>a!==void 0))||[];return e=e.sort((a,u)=>u-a),e[0]||0}),Y=n(()=>{var t,r;if(!((t=C.value.rewardList)!=null&&t.length))return 0;let e=((r=C.value.rewardList)==null?void 0:r.map(a=>{if(a.rewardType===1)return a.rewardAmount}).filter(a=>a!==void 0))||[];return e=e.sort((a,u)=>u-a),e[0]||0}),v=n(()=>{switch(f.value){case 0:return b.value;case 1:return S.value;case 2:return A.value;case 3:return C.value;default:return b.value}}),Z=n(()=>{var e;return((e=v.value.rewardList)==null?void 0:e.findIndex(t=>t.id===T.value.id))||0}),ee=e=>{f.value=e,_.value=v.value.remainSpinCount||0,D()},ae=async()=>{const{data:e}=await we();if(e){const t=["silverWheelInfo","goldWheelInfo","diamondWheelInfo","specialWheelInfo"],r={silverWheelInfo:"silver",goldWheelInfo:"gold",diamondWheelInfo:"diamond",specialWheelInfo:"special"},a=[];t.forEach(u=>{var X;const h=e[u];(X=h==null?void 0:h.rewardList)!=null&&X.length&&h.rewardList.forEach(l=>{l.rewardType!==1&&(l.rewardType===0?l.rewardText=d[l.rewardType]:l.rewardText=d[l.rewardType]+`
 X`+l.rewardAmount)});const x=c.find(l=>l.label===r[u]);(Object.keys(x||{})||[]).forEach(l=>{x&&x[l]&&(h[l]=x[l])}),a.push(h)}),F.value=a,i.value=e,D()}_.value=v.value.remainSpinCount||0},te=n(()=>F.value[f.value]),re=async()=>{for(const e of c)e.icon=O(`${e.label}_icon`)},ne=async()=>{try{p.value=!0;const{data:e}=await me(g);e?(I.value=[...I.value,...e.list],y.value=e.totalCount,p.value=!1,(e.list.length<g.pageSize||m.value.length>=y.value)&&(w.value=!0),e.list&&e.list.length>0&&++g.pageNo):w.value=!0}catch{}finally{p.value=!1}},oe=async()=>{try{p.value=!0;const{data:e}=await pe(g);e?(m.value=[...m.value,...e.list],y.value=e.totalCount,p.value=!1,(e.list.length<g.pageSize||m.value.length>=y.value)&&(w.value=!0),e.list&&e.list.length>0&&++g.pageNo):w.value=!0}catch{}finally{p.value=!1}},se=async e=>{try{const{data:t}=await he({rechargeWheelType:f.value+1});t&&(T.value=t,G("promo_trigger",{promo_id:"recharge_turntable_reward",reward_value:t.rewardAmount||0}));const r=setTimeout(async()=>{t.rewardType!==0&&(k.value=!0),clearTimeout(r)},e||2800);B.value=!1}finally{B.value=!1}},le=e=>{switch(e){case 1:return K.value;case 2:return N.value;case 3:return Q.value;case 4:return Y.value;default:return 0}},D=()=>{var t;const e=(t=v.value.taskList)==null?void 0:t.length;if(e&&v.value.taskList){L.value=[{amount:0,spinCount:0,width:"0%"}];const r=v.value.taskList[e-1].rechargeAmount||0;R.value=Math.min(E.value/r*100,100).toFixed(2),v.value.taskList.map(a=>{L.value.push({amount:a.rechargeAmount||0,spinCount:a.spinCount||0,width:a.rechargeAmount?Math.min(a.rechargeAmount/r*100,100).toFixed(2)+"%":"0%"})})}};return{currentTab:f,changeTab:ee,getBaseInfo:ae,isOpen:V,getRecordList:ne,recordList:I,wheelBaseInfo:i,handleSpinWheel:se,pageInfo:g,currentValidDate:j,rechargeAmount:E,spinResult:T,silverWheelInfo:b,goldWheelInfo:S,diamondWheelInfo:A,specialWheelInfo:C,isSpecialWheelUnlock:J,currentWheelInfo:v,spinCount:_,rewardIndex:Z,rewardUpAmount:$,getMaxAmount:le,menuList:F,tipDialog:k,depositSpinCount:L,rechargeAmountAsync:R,getSpinRecordList:oe,spinRecordList:m,loading:p,finished:w,menuArr:c,noticeList:M,getNoticeList:async()=>{const{data:e}=await ge();e&&(M.value=e||[])},specialWheelUnlockAmount:q,whellText:d,goldMaxAmount:N,rest:()=>{f.value=0},handleRules:async()=>{await P();const{open:e,close:t}=de({props:{title:o("t230"),maskNotClose:!0,isShowConfirmBtn:!0,onConfirm:()=>t()},slots:{default:()=>ve("div",{innerHTML:H.value||"",class:"rich_div"})}});e()},handleGoHistory:()=>{z.push({name:"rechargeTurntableHistory"})},textFun:e=>{switch(e){case 2:return"Silver Spins X";case 3:return"Gold Spins X";case 4:return"Diamond Spins X";case 5:return"Special Spins X";default:return"Free Spins X"}},wheel2TextFun:e=>{switch(e){case 2:return"Brass Spins X";case 3:return"Silver Spins X";case 4:return"Gold Spins X";case 5:return"Special Spins X";default:return"Free Spins X"}},initImg:re,currentMenu:te,isSpinning:B}};export{Ee as u};
