1import{Y as e,Z as t,m as i}from"./index-M5qy_4Wm.js";const a={first:"Axe",last:"Bot",alias:"Axe Bot",email:"[email protected]",pic:"https://firebasestorage.googleapis.com/v0/b/watl-staging.appspot.com/o/global%2Fwatl%2Fplayers%2Faxe_bot%2F1756814140743_photo_5312388428324796402_y.jpg?alt=media&token=17cd2040-afdd-4358-a5c5-68f58385fd35",division:"recreational",id:"axe_bot"},s={mounted(){},setup:()=>({seasonStore:e(),eventStore:t(),generalStore:i()}),methods:{opponentList(e,t){let i=[];t.forEach(t=>{this.schedule&&void 0!==this.schedule[e.id]&&void 0!==this.schedule[e.id][t.id]&&e.id!==t.id?i[t.id]={gp:this.schedule[e.id][t.id],totalGP:t.gs+t.gp+t.autoGP}:e.id!==t.id&&(i[t.id]={gp:0,totalGP:t.gs+t.gp+t.autoGP})});let a=[];for(let s in i)a.push({opponent:s,gp:i[s].gp,totalGP:i[s].totalGP});return a.sort(function(e,t){return e.gp-t.gp||e.totalGP-t.totalGP})},opponentListTeam(e){let t=[];this.weekPlayers.filter(e=>!0===e.checkedin).forEach(i=>{void 0===this.schedule[e.id]||void 0===this.schedule[e.id][i.id]||e.id===i.id||this.checkSameTeam(e,i)?e.id===i.id||this.checkSameTeam(e,i)||(t[i.id]={gp:0,totalGP:i.gs+i.gp+i.autoGP}):t[i.id]={gp:this.schedule[e.id][i.id],totalGP:i.gs+i.gp+i.autoGP}});let i=[];for(let a in t)i.push({opponent:a,gp:t[a].gp,totalGP:t[a].totalGP});return i.sort(function(e,t){return e.gp-t.gp||e.totalGP-t.totalGP})},findPlayer(e,t){if(void 0!==e){return t.find(t=>e.opponent===t.id)}},gamesQueued(e,t){let i=0;return t.forEach(t=>{t.player2?(t.player1.playerid==e.id&&"Completed"!=t.status||t.player2.playerid==e.id&&"Completed"!=t.status)&&i++:t.player1.playerid==e.id&&"Completed"!=t.status&&i++}),i},isUnderMaxGames:(e,t)=>e.gp+e.gs+e.autoGP<t&&e.autoGP<=7,isUnderMaxGamesTeam(e,t,i){let a=e.gp+e.gs+e.autoGP,s=e.autoGP+t.autoGP;return a<=i&&s<=7},playersSameTeam(e,t){let i=null;for(let a in e)if(e[a].team.name===t.team.name&&e[a].id!==t.id)return i=e[a],i;return i},checkDuplicates(e,t,i,a){let s=[e.id,t.id,i.id,a.id];return new Set(s).size!==s.length},checkSameTeam(e,t){let i=[e.team.name,t.team.name];return new Set(i).size!==i.length},standardRR(){var e,t,i;const s=(null==(e=this.generalStore)?void 0:e.botPlayer)||a;let o=[],r=0;if(void 0===this.rrWeek)return;if(r=4*this.rrWeek.slice(-1),!this.showNextUp&&"classic"===this.$route.name)return;if("Playoffs"===(null==(i=null==(t=this.seasonStore)?void 0:t.hostWeek)?void 0:i.type))return[];let l=this.getCheckedInList.slice().sort((e,t)=>e.gs+e.gp-(t.gs+t.gp)).map(e=>({...e,autoGP:0}));return this.weekGames.filter(e=>"Completed"!==e.status).forEach(e=>{let t=l.find(t=>{var i,a;return t.id===(null==(i=e.player1)?void 0:i.playerid)||t.id===(null==(a=e.team1)?void 0:a.teamid)}),i=l.find(t=>{var i,a;return t.id===(null==(i=e.player2)?void 0:i.playerid)||t.id===(null==(a=e.team2)?void 0:a.teamid)});t&&l.find(e=>e.id===t.id).autoGP++,i&&l.find(e=>e.id===i.id).autoGP++}),this.eventStore.selectedEvent.virtual&&this.getLockedNotPlayedGames.length>0&&(o=this.getLockedNotPlayedGames,this.getLockedNotPlayedGames.forEach(e=>{let t=l.find(t=>{var i;return t.id===(null==(i=e.player1)?void 0:i.playerid)}),i=l.find(t=>{var i;return t.id===(null==(i=e.player2)?void 0:i.playerid)});t&&(t.autoGP+=1),i&&(i.autoGP+=1)}),l.sort((e,t)=>e.gs+e.gp-(t.gs+t.gp))),l.forEach(e=>{let t=this.opponentList(e,l);for(let i=0;this.isUnderMaxGames(e,r)&&i<=t.length-1;i++){let a=this.findPlayer(t[i],l);if(void 0!==a&&a.id!==e.id&&this.isUnderMaxGames(a,r)){const{leagueType:t}=this.eventStore.selectedEvent;let i;if("duals-league"==t)i={sort:e.autoGP-a.autoGP,team1:{id:e.id,pic:e.pic,teamid:e.id,facebook:e.facebook,instagram:e.instagram,name:e.name,players:e.players},team2:{id:a.id,pic:a.pic,teamid:a.id,facebook:a.facebook,instagram:a.instagram,name:a.name,players:a.players}};else{let t=[e.id,a.id].sort((e,t)=>e.localeCompare(t));const s="direct_".concat(t[0],"_").concat(t[1]),r="".concat(t[0],"_").concat(t[1],"_").concat(o.length+1);i={sort:e.autoGP-a.autoGP,...this.eventStore.selectedEvent.virtual&&{gameChatId:s,_id:r}||{},player1:{id:e.id,pic:e.pic,playerid:e.id,facebook:e.facebook||"",instagram:e.instagram||"",alias:e.alias,first:e.first,last:e.last,division:e.division||"amateur",wktlDivision:"wktl"===this.eventStore.selectedEvent.rules&&e.wktlDivision||"recreational"},player2:{id:a.id,pic:a.pic,playerid:a.id,facebook:a.facebook||"",instagram:a.instagram||"",alias:a.alias,first:a.first,last:a.last,division:a.division||"amateur",wktlDivision:"wktl"===this.eventStore.selectedEvent.rules&&a.wktlDivision||"recreational"}}}o.push(i),e.autoGP++,a.autoGP++}}}
1),this.eventStore.selectedEvent.virtual&&l.forEach(e=>{const t=e.gp+e.gs+e.autoGP,i=r-t;if(i>0){let t=l.filter(t=>t.id!==e.id&&t.gp+t.gs+t.autoGP<r);t.sort((e,t)=>{const i=r-(e.gp+e.gs+e.autoGP);return r-(t.gp+t.gs+t.autoGP)-i});for(let a=0;a<i;a++){let i;if(0===t.length)i=s;else if(i=t[a%t.length],i.gp+i.gs+i.autoGP>=r){t=t.filter(e=>e.id!==i.id),a--;continue}const{leagueType:l}=this.eventStore.selectedEvent;let d;if("duals-league"==l)d={sort:e.autoGP-i.autoGP,team1:{id:e.id,pic:e.pic,teamid:e.id,facebook:e.facebook,instagram:e.instagram,name:e.name,players:e.players},team2:{id:i.id,pic:i.pic,teamid:i.id,facebook:i.facebook,instagram:i.instagram,name:i.name,players:i.players}};else{let t=[e.id,i.id].sort((e,t)=>e.localeCompare(t));const a="direct_".concat(t[0],"_").concat(t[1]),s="".concat(t[0],"_").concat(t[1],"_").concat(o.length+1);d={sort:e.autoGP-(i.autoGP||0),gameChatId:a,_id:s,player1:{id:e.id,pic:e.pic,playerid:e.id,facebook:e.facebook||"",instagram:e.instagram||"",alias:e.alias,first:e.first,last:e.last,division:e.division||"amateur",wktlDivision:"wktl"===this.eventStore.selectedEvent.rules&&e.wktlDivision||"recreational"},player2:{id:i.id,pic:i.pic,playerid:i.id,facebook:i.facebook||"",instagram:i.instagram||"",alias:i.alias,first:i.first,last:i.last,division:i.division||"amateur",wktlDivision:"wktl"===this.eventStore.selectedEvent.rules&&i.wktlDivision||"recreational"}}}o.push(d),e.autoGP++,i.id!==s.id&&i.autoGP++,i.id!==s.id&&i.gp+i.gs+i.autoGP>=r&&(t=t.filter(e=>e.id!==i.id))}}}),o.sort(function(e,t){return e.sort-t.sort})},generateAutoGames(){return this.standardRR()}},computed:{getLockedNotPlayedGames(){return Array.isArray(this.autoschedule)?this.autoschedule.filter(e=>{var t,i;return(null==(t=e.locked)?void 0:t.player1)&&(null==(i=e.locked)?void 0:i.player2)&&!e.played}):[]},getCheckedInList(){return this.weekPlayers.filter(e=>!0===e.checkedin).map(e=>({...e,id:e.id}))},rrWeek(){return void 0!==this.weekID?this.weekID:this.selectedWeek&&this.selectedWeek.name?this.selectedWeek.name:"Week 1"},newRR(){return this.standardRR()}}};export{s as r};
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.