/* Copyright © 2024 Melbet - All Rights Reserved */ import{useT as d,useDateTimeService as O}from"./entry-Bl6dkD65.js";import{groupBy as h}from"./mtVUMO18FXB9.js";const p=(m,a)=>{m.sort((s,r)=>a[s.id]&&!a[r.id]&&!s.isGameOver?-1:a[r.id]&&!a[s.id]&&!r.isGameOver||s.isGameOver&&!r.isGameOver?1:r.isGameOver&&!s.isGameOver?-1:0)},v=(m,a)=>{const s=d(),r=O(),n=Number(Date.now()),o=Number(r.startOfDay(n)),f=r.getShortDateWithNumericMonthByDate(o),y=(t,e)=>t===Number(r.startOfDay(r.addDays(n,-1)))?s("champ_yesterday"):t===o?s("champ_today"):t===Number(r.startOfDay(r.addDays(n,1)))?s("champ_tomorrow"):e,D=t=>a[t.id]&&!t.isGameOver,i=h(m,t=>D(t)?f:t.startShortDateFormatted);return Object.keys(i).map(t=>{const e=i[t][0];let u=0;"startedAt"in e&&e.startedAt&&(u=e.startedAt),"startTimestamp"in e&&e.startTimestamp&&(u=e.startTimestamp);const c=D(e)?o:Number(r.startOfDay(u));return p(i[t],a),{start:c,shortDate:t,dateTitle:y(c,t),games:i[t],count:i[t].length,isPastDay:ct.start-e.start)};export{v as groupGamesByDate,p as sortGames};