import{C as e,Dt as t,I as n,It as r,Q as i,bt as a,j as o}from"./_plugin-vue_export-helper-BVhEvvHC.js";import{r as s}from"./events-Bc6cZn5G.js";import{n as c,t as l}from"./columns-BK4aO6Fq.js";import{t as u}from"./axios-DSyjHw-i.js";import{n as d}from"./index-rH1PXH0A.js";n(),a();var f=o({__name:`DataTeams`,setup(n){let a=d(),o=t([]),f=t(!1),p=t([]),m=t(0),h=t(void 0),g=t(!1);async function _(){try{return(await u.get(`teams/summary`,{params:{includeInactive:f.value,seasonId:h.value,onlyInSeason:g.value}})).data}catch(e){return console.error(e),[]}}async function v(){let e=await _();o.value=e,a.setTeams(e.filter(e=>e.isActive))}async function y(){try{let[e,t]=await Promise.all([u.get(`season`),u.get(`season/current/id`)]);p.value=e.data??[],m.value=t.data,h.value??=t.data}catch(e){console.error(`Could not load seasons`,e)}}function b(e){f.value=e,v()}function x(e){h.value=e,v()}function S(e){g.value=e,v()}async function C(){await y(),await v()}return C(),s({"ws:database-reloaded":()=>{C()}}),(t,n)=>(i(),e(c,{columns:r(l),data:o.value,"show-archived":f.value,seasons:p.value,"selected-season-id":h.value,"current-season-id":m.value,"only-in-season":g.value,"onUpdate:showArchived":b,"onUpdate:selectedSeasonId":x,"onUpdate:onlyInSeason":S,onRefresh:v,class:`w-full`},null,8,[`columns`,`data`,`show-archived`,`seasons`,`selected-season-id`,`current-season-id`,`only-in-season`]))}});export{f as default};