"use strict";(globalThis.webpackChunkinfinity_hitab_client=globalThis.webpackChunkinfinity_hitab_client||[]).push([[1587],{21587:(t,e,a)=>{a.r(e),a.d(e,{useWorldcupStore:()=>p});var s=a(74003),r=a(84522),c=a(10435),n=a(79664);var d=a(80661),i=a.n(d),h=a(94119),u=a(24581);const l=i()(),o=i()(`${l.year()}-${l.month()+1}-${l.date()}`);function m(t,e){return t.date()===o.date()?s.sM?"今天":"Today":t.date()===o.add(1,"day").date()?s.sM?"明天":"Tomorrow":s.sM?e?`${t.month()+1}月${t.date()}日`:t.format("MM-DD"):e?t.format("MMMM DD"):t.format("MMM DD")}function _(t){return s.sM?t.match_type_des?`${t.group_name}组 第${t.match_type_des}轮`:t.match_type_name:t.match_type_des?`Group ${t.group_name} Round ${t.match_type_des}`:t.match_type_name}const p=(0,c.Q_)(r.BU.worldcup,{syncStorage:{watch:["scheduleList","rankList"]},state:()=>({modalShow:!1,scheduleList:[],rankList:[],curIndex:-1,modalTab:0}),getters:{currentHomeData(){return this.scheduleList[this.curIndex]}},actions:{setModal(t){h.G.setStatus(u.R.worldcup,t),this.modalShow=t},async getWprldCupSchedule(){const[t,e]=await(async()=>{try{const t=await n.hj.get(`${s.H}worldcup/schedule`,void 0,{_delay:0});if(0===t.code&&t.data.length>0)return[null,t.data];throw t}catch(t){return["catch error"]}})();if(t||!e)return;const a=[];e.forEach((t=>{const e=new Date(t.schedule_date_utc),r=i()(`${e.getFullYear()}-${e.getMonth()+1}-${e.getDate()}`),c={title:m(r),listTitle:m(r,!0),date:r,diff:r.diff(o),list:t.schedule_list.map((t=>{return{...t,match_status:(e=t.match_status,{1:s.sM?"未开赛":"Not started",2:s.sM?"进行中":"In progress",3:s.sM?"已完赛":"Completed"}[e]),date_time:i()(t.date_time_utc).format("HH:mm"),match_type_des:_(t)};var e}))};a.push(c)})),this.scheduleList=a,this.calcCurrentIndex()},async getWorldcupRankList(){const[t,e]=await(async()=>{try{const t=await n.hj.get(`${s.H}worldcup/rank`,void 0,{_delay:0});if(0===t.code&&t.data.length>0)return[null,t.data];throw t}catch(t){return["catch error"]}})();!t&&e&&(this.rankList=e)},calcCurrentIndex(){const t=this.scheduleList.filter((t=>t.diff>=0));t.length>0?this.curIndex=this.scheduleList.findIndex((e=>e.title===t[0].title)):this.curIndex=this.scheduleList.length-1},nextDay(){this.curIndex!==this.scheduleList.length-1&&(this.curIndex=this.curIndex+1)},preDay(){0!==this.curIndex&&(this.curIndex=this.curIndex-1)},setTab(t){this.modalTab=t}}}),y=p();y.getWprldCupSchedule(),y.getWorldcupRankList(),y.calcCurrentIndex()}}]);