import{g as E}from"./Notification-15e980db.js";import{I as V}from"./IconDropdown-481fb65d.js";import{L as R}from"./LeagueMixin-b8a9673b.js";import{M as j}from"./ModalMixin-f1c0fe4e.js";import{_ as L,r as k,o as i,e as O,w,a as e,s as m,j as f,d as u,c,t as d,F as b,i as v,b as W,f as _,k as M,v as P,g as S,u as B,O as J,n as A}from"./app-9daf7b25.js";import{F as H}from"./Input-9aaaabcf.js";import{F as U}from"./Button-067cc918.js";import{C as z}from"./CheckIcon-937edc41.js";import{v as X}from"./helper-77b46e57.js";const q={props:["domain_color"],mixins:[j]},Y=e("h1",{class:"text-3xl text-center font-bold uppercase mb-8 font-bebe"}," Criteria and Math Explained ",-1),G=e("p",{class:"mb-8 text-gray text-sm"},[u(" Each season, Overall and Conference standings are calculated using 6 different categories. Each criteria is ranked in priority. Each team will be compared in the category with the highest priority "),e("b",null,"(Win Percentage)"),u(". If a particular set of teams have equal win percentages, the comparison will move to the category next in priority "),e("b",null,"(Total Wins)"),u(" until a difference is found. If two or more teams are tied after all 6 categories are compared, the comparison will move to conference performance (only games between teams in the same conference). This set of calculations will use the same 6 categories. ")],-1),K=e("h2",null,"1. Win Percentage",-1),Q=e("p",{class:"mb-8 text-gray text-sm"}," Wins divided by total games played. Ties (if applicable) are counted as half of a win during calculation. ",-1),Z=e("h2",null,"2. Total Wins",-1),$=e("p",{class:"mb-8 text-gray text-sm"}," Both in and out of conference. ",-1),ee=e("h2",null,"3. Least Total Losses",-1),te=e("p",{class:"mb-8 text-gray text-sm"}," Teams with the least total losses are ranked highest in this category. ",-1),ne=e("h2",null,"4. Head-to-Head",-1),se=e("p",{class:"mb-8 text-gray text-sm"}," Two or more teams that are tied after the first three categories will be compared using the head-to-head method. The top 3 categories (Win Percentage, Total Wins, Least Total Losses) are used again, but only considering games played against each other. The same process is used for 3 or more teams. Games among the group of tied times are used. ",-1),oe=e("h2",null,"5. Power Rating",-1),re=e("p",{class:"mb-8 text-gray text-sm"}," Power Rating is the average win percentage of the opponents a team has beaten. A team with wins over strong opponents (teams with higher win percentage) has a higher power rating than a team with the exact same record, but with wins over weaker opponents (teams with lower win percentages). ",-1),ae=e("h2",null,"6. Least Total Runs Against",-1),ie=e("p",{class:"mb-8 text-gray text-sm"}," This part of the formula takes into account the number of runs scored against the teams during the season. If Team A has 15 runs scored against them and Team B has 20 runs scored against them, then Team A will be ranked higher than Team B. ",-1),le=e("h2",null,"7. Conference Comparison",-1),de=e("p",{class:"mb-8 text-gray text-sm"}," If, after six categories, two or more teams are still tied, the teams will be compared using conference performance. The same six categories are used, but only in-conference games are considered. ",-1);function ce(r,s,t,p,n,l){const g=k("modal");return i(),O(g,{ref:"modal",clickToClose:!1,escToClose:!0},{default:w(()=>[Y,G,K,Q,Z,$,ee,te,ne,se,oe,re,ae,ie,le,de,e("button",{class:m(["button rounded-full text-white py-2 px-6 m-auto block",["bg-"+t.domain_color]]),onClick:s[0]||(s[0]=f((...h)=>r.closeModal&&r.closeModal(...h),["prevent"]))}," Close ",2)]),_:1},512)}const me=L(q,[["render",ce]]),_e={props:["team","leagueTeams"],computed:{activeTeam(){var s,t,p,n,l;let r=this.team;return r.adj_wins=((s=r.team_ranking)==null?void 0:s.games_won)+((t=r.team_ranking)==null?void 0:t.games_tied)*.5,r.games_played=((p=r.team_ranking)==null?void 0:p.games_won)+((n=r.team_ranking)==null?void 0:n.games_tied)+((l=r.team_ranking)==null?void 0:l.games_lost),r}},methods:{chooseTeam(r){this.$emit("chooseTeam",r)}}},he={class:"bg-white border-t border-red"},ge={class:"flex flex-row"},ue={class:"w-full p-4 text-xs"},fe=e("div",{class:"w-full bg-standings-header text-white p-1 text-center"},[e("span",{class:"font-bold"},"Overall Win Percentage")],-1),be={class:"flex flex-row border-b border-standings"},ve={class:"w-1/12 px-2 py-1 border-l border-r border-standings"},pe=e("span",{class:"font-bold text-standings"},"W-L-T",-1),xe=e("br",null,null,-1),we={class:"font-bold text-standings"},ke={class:"w-9/12 px-2 py-1 text-right border-r border-standings"},ye=e("span",{class:"font-bold text-standings"},"Wins + (Ties X 0.5)",-1),Te=e("br",null,null,-1),Ce={class:"font-bold text-standings"},Ie={class:"w-2/12 flex-grow px-2 py-1 text-right border-r border-standings"},Se=e("span",{class:"font-bold text-standings"},"= Adj Wins",-1),Oe=e("br",null,null,-1),Fe={class:"font-bold text-standings"},Le={class:"flex flex-row border-b border-standings"},Me=e("div",{class:"w-1/12 px-2 py-1 border-l border-r border-standings"},null,-1),Pe=e("div",{class:"w-9/12 px-2 py-1 text-right border-r border-standings"},[e("span",{class:"font-normal text-standings"},"Divided by total games played")],-1),Ne={class:"w-2/12 flex-grow px-2 py-1 text-right border-r border-standings"},De={class:"font-normal text-standings"},Ae={class:"flex flex-row border-b border-standings"},Ve=e("div",{class:"w-1/12 px-2 py-1 border-l border-r border-standings"},null,-1),je=e("div",{class:"w-9/12 px-2 py-1 text-right border-r border-standings"},[e("span",{class:"font-bold text-standings"},"X 100 = Win Percentage")],-1),We={class:"w-2/12 flex-grow px-2 py-1 text-right border-r border-standings bg-standings-header"},Ee={class:"font-bold text-white"},Re={class:"flex flex-row"},Be={class:"w-full p-4 pt-0 text-xs"},Je=W('<div class="w-full bg-standings-header text-white p-1 text-center"><span class="font-bold">Overall Power Rating Calculation</span></div><div class="w-full flex flex-row border-b border-standings"><div class="w-5/12 px-2 py-1 border-l border-r border-standings"><span class="font-bold text-standings">Opponent</span></div><div class="w-2/12 px-2 py-1 text-right border-r border-standings"><span class="font-bold text-standings">Opponent Win %</span></div><div class="w-8 px-2 py-1 text-center border-r border-standings"><span class="font-bold text-standings">X</span></div><div class="w-2/12 px-2 py-1 text-right border-r border-standings"><span class="font-bold text-standings">Wins vs</span></div><div class="w-8 px-2 py-1 text-right border-r border-standings"><span class="font-bold text-standings">=</span></div><div class="w-3/12 px-2 py-1 text-right border-r border-standings"><span class="font-bold text-standings">Added Power</span></div></div>',2),He={class:"w-5/12 px-2 py-1 border-l border-r border-standings"},Ue={class:"font-normal text-standings"},ze=["onClick"],Xe={class:"w-2/12 px-2 py-1 text-right border-r border-standings"},qe={class:"font-normal text-standings"},Ye=e("div",{class:"w-8 px-2 py-1 text-center border-r border-standings"},[e("span",{class:"font-normal text-standings"},"X")],-1),Ge={class:"w-2/12 px-2 py-1 text-right border-r border-standings"},Ke={class:"font-normal text-standings"},Qe=e("div",{class:"w-8 px-2 py-1 text-right border-r border-standings"},[e("span",{class:"font-normal text-standings"},"=")],-1),Ze={class:"w-3/12 px-2 py-1 text-right border-r border-standings"},$e={class:"font-normal text-standings"},et={class:"w-full flex flex-row border-b border-standings"},tt=e("div",{class:"w-standings-footer px-2 py-1 text-right border-l border-r border-standings"},[e("span",{class:"font-normal text-standings"},"Total Power Value:")],-1),nt={class:"w-2/12 px-2 py-1 text-right border-r border-standings"},st={class:"font-normal text-standings"},ot={class:"w-full flex flex-row border-b border-standings"},rt=e("div",{class:"w-standings-footer px-2 py-1 text-right border-l border-r border-standings"},[e("span",{class:"font-normal text-standings"},"Divide by total games played:")],-1),at={class:"w-2/12 px-2 py-1 text-right border-r border-standings"},it={class:"font-normal text-standings"},lt={class:"w-full flex flex-row border-b border-standings"},dt=e("div",{class:"w-standings-footer px-2 py-1 text-right border-l border-r border-standings"},[e("span",{class:"font-bold text-standings"},"Power Rating:")],-1),ct={class:"w-2/12 px-2 py-1 bg-standings-header text-right border-r border-standings"},mt={class:"font-bold text-white"};function _t(r,s,t,p,n,l){var g,h,y,a,o,x,T,C,I;return i(),c("div",he,[e("div",ge,[e("div",ue,[fe,e("div",be,[e("div",ve,[pe,xe,e("span",we,d((g=l.activeTeam.team_ranking)==null?void 0:g.games_won)+"-"+d((h=l.activeTeam.team_ranking)==null?void 0:h.games_lost)+"-"+d((y=l.activeTeam.team_ranking)==null?void 0:y.games_tied),1)]),e("div",ke,[ye,Te,e("span",Ce,d((a=l.activeTeam.team_ranking)==null?void 0:a.games_won)+" + ("+d((o=l.activeTeam.team_ranking)==null?void 0:o.games_tied)+" X 0.5)",1)]),e("div",Ie,[Se,Oe,e("span",Fe,d(((x=l.activeTeam.team_ranking)==null?void 0:x.games_won)+((T=l.activeTeam.team_ranking)==null?void 0:T.games_tied)*.5),1)])]),e("div",Le,[Me,Pe,e("div",Ne,[e("span",De,d(l.activeTeam.games_played),1)])]),e("div",Ae,[Ve,je,e("div",We,[e("span",Ee,d((C=l.activeTeam.team_ranking)==null?void 0:C.win_pct),1)])])])]),e("div",Re,[e("div",Be,[Je,(i(!0),c(b,null,v(JSON.parse(((I=l.activeTeam.team_ranking)==null?void 0:I.opponents)??[]),(F,os)=>{var N;return i(),c("div",{key:`opponent-${F.id}-${l.activeTeam.id}`,class:"w-full flex flex-row border-b border-standings"},[e("div",He,[e("span",Ue,[e("a",{href:"",onClick:f(D=>l.chooseTeam(F),["prevent"]),class:"text-red underline"},d(F.name),9,ze)])]),e("div",Xe,[e("span",qe,d((N=t.leagueTeams.find(D=>D.id==F.id).team_ranking)==null?void 0:N.win_pct),1)]),Ye,e("div",Ge,[e("span",Ke,d(F.wins_against_team),1)]),Qe,e("div",Ze,[e("span",$e,d(F.added_power),1)])])}),128)),e("div",et,[tt,e("div",nt,[e("span",st,d(l.activeTeam.power_rating_amount),1)])]),e("div",ot,[rt,e("div",at,[e("span",it,d(l.activeTeam.games_played),1)])]),e("div",lt,[dt,e("div",ct,[e("span",mt,d(l.activeTeam.power_rating),1)])])])])])}const ht=L(_e,[["render",_t]]),gt={name:"team-standings",props:["league","domain_color"],components:{IconDropdown:V,StandingsMathModal:me,TeamRankingDetails:ht},mixins:[R],data(){return{activeTeamId:null,allTeams:[],conferenceList:[],rankedTeams:[],selectedConference:"Overall",standings:{activeTeam:null},standingsLoaded:!1,teamSelected:null}},filters:{uppercase(r){return r.toUpperCase()}},methods:{changeConference(r){this.selectedConference=r,r=="Overall"?this.rankedTeams=this.allTeams:(this.rankedTeams=this.allTeams.filter(function(s){return s.division==r}),this.rankedTeams=this.rankedTeams.sort(function(s,t){return s.conference_rank-t.conference_rank}))},chooseTeam(r){this.activeTeamId=this.activeTeamId==r.id?null:r.id,this.standings.activeTeam?this.activeTeamId!=r.id?this.standings.activeTeam=r:this.standings.activeTeam=null:this.standings.activeTeam=r},getStandings(r){axios.get("/league/"+r.id+"/standings").then(s=>{let t=s.data;this.activity=t.activity,this.allTeams=t.teams,this.rankedTeams=t.teams,this.conferenceList=t.divs,this.standingsLoaded=!0})},openStandingsMathModal(){this.$refs.standingsMathModal.openModal()}},mounted(){this.selectedConference="Overall",this.getStandings(this.league)}},ut={key:0,class:"text-center"},ft=e("span",{class:"font-bold"},"Overall Rank Inspector",-1),bt=[ft],vt={class:"flex flex-row text-left"},pt={class:"w-1/2 p-3"},xt={class:"mb-1"},wt=e("span",{class:"inline-block text-xs text-market-gray"},"Team:",-1),kt={class:"block relative"},yt=e("option",{value:null},"-",-1),Tt=["value"],Ct={key:0},It={key:0},St={class:"block text-xs"},Ot={key:1,class:"block text-xs"},Ft={key:1},Lt={class:"block text-xs"},Mt={key:1,class:"block text-xs"},Pt={class:"font-bold"},Nt=e("span",{class:"mr-2"},"Select Conference:",-1),Dt={class:"hidden md:inline"},At=["value","onClick"],Vt=["value"],jt=W('<div class="flex flex-row"><div class="w-1/12 text-center -ml-1"><span>Rank</span></div><div class="w-8/12 ml-2"><span>Team</span></div><div class="w-3/12 md:w-1/12 text-center -ml-1"><span>Record</span></div><div class="w-1/12 text-center -mr-1 hidden md:inline"><span>Win %</span></div><div class="w-1/12 text-center ml-1 hidden md:inline"><span>Power</span></div></div>',1),Wt=[jt],Et={class:"flex flex-row"},Rt={key:0},Bt={class:"flex flex-row"},Jt={class:"w-auto flex-grow"},Ht={class:"w-auto"},Ut=["onClick"],zt={class:"flex flex-row"},Xt={key:0},qt={class:"flex flex-row"},Yt={class:"w-auto flex-grow"};function Gt(r,s,t,p,n,l){const g=k("icon-dropdown"),h=k("team-ranking-details"),y=k("standings-math-modal");return i(),c("div",null,[n.standingsLoaded?_("",!0):(i(),c("div",ut,[e("span",{class:m(["block text-xs lg:text-2xl font-bold m-4",["text-"+t.domain_color]])},"Loading...",2)])),n.standingsLoaded?(i(),c("div",{key:1,class:m(["w-full border",["border-"+t.domain_color]])},[e("div",{class:m(["w-full text-white p-1 mx-auto text-center",["bg-"+t.domain_color]])},bt,2),e("div",vt,[e("div",pt,[e("div",xt,[wt,e("div",kt,[M(e("select",{"onUpdate:modelValue":s[0]||(s[0]=a=>n.teamSelected=a),class:"inline-block appearance-none w-full bg-white border border-market-gray text-market-gray text-xs py-1 pl-2 pr-6 rounded"},[yt,(i(!0),c(b,null,v(n.rankedTeams,a=>(i(),c("option",{key:`standings-team-one-${a.id}`,value:a},d(a.name),9,Tt))),128))],512),[[P,n.teamSelected]]),S(g)])])]),e("div",{class:m(["w-1/2 p-3 border-l flex flex-col justify-center space-y-2",["border-"+t.domain_color]])},[n.teamSelected?(i(),c("div",Ct,[e("span",{class:m(["block text-xs font-bold",["text-"+t.domain_color]])},"Evaluation",2),n.selectedConference=="Overall"?(i(),c("div",It,[n.teamSelected.overall_rank_reasons!="[]"?(i(!0),c(b,{key:0},v(JSON.parse(n.teamSelected.overall_rank_reasons),a=>(i(),c("span",St,d(a),1))),256)):_("",!0),n.teamSelected.overall_rank_reasons=="[]"?(i(),c("span",Ot,d(n.teamSelected.name)+" is ranked "+d(n.teamSelected.overall_rank)+" due to win percentage. ",1)):_("",!0)])):_("",!0),n.selectedConference!="Overall"?(i(),c("div",Ft,[n.teamSelected.conference_rank_reasons!="[]"?(i(!0),c(b,{key:0},v(JSON.parse(n.teamSelected.conference_rank_reasons),a=>(i(),c("span",Lt,[e("template",null,[u(d(a),1)])]))),256)):_("",!0),n.teamSelected.conference_rank_reasons=="[]"?(i(),c("span",Mt,[e("template",null,[u(d(n.teamSelected.name)+" is ranked "+d(n.teamSelected.conference_rank)+" due to win percentage.",1)])])):_("",!0)])):_("",!0)])):_("",!0),e("button",{class:m(["mx-auto block w-48 h-8 text-white text-xs px-4 rounded-full",["bg-"+t.domain_color]]),onClick:s[1]||(s[1]=f((...a)=>l.openStandingsMathModal&&l.openStandingsMathModal(...a),["prevent"]))},"Criteria and Math Explained",2)],2)])],2)):_("",!0),n.standingsLoaded?(i(),c("div",{key:2,class:m(["w-full border",["border-"+t.domain_color]])},[e("div",{class:m(["w-full text-white p-1 mx-auto text-center",["bg-"+t.domain_color]])},[e("span",Pt,d(t.league.name)+" Standings",1)],2),e("div",{class:m(["w-full bg-white p-2 text-left font-bold text-white text-xs",["text-"+t.domain_color]])},[Nt,e("div",Dt,[e("button",{value:"Overall",class:m([{"text-white":n.selectedConference==="Overall","text-red":t.domain_color=="red"&&n.selectedConference!="Overall","text-pickleball-green":t.domain_color=="pickleball-green"&&n.selectedConference!="Overall","text-cornhole-orange":t.domain_color=="cornhole-orange"&&n.selectedConference!="Overall","bg-white":n.selectedConference!="Overall","bg-red":t.domain_color=="red"&&n.selectedConference==="Overall","bg-pickleball-green":t.domain_color=="pickleball-green"&&n.selectedConference==="Overall","bg-cornhole-orange":t.domain_color=="cornhole-orange"&&n.selectedConference==="Overall"},"cursor-pointer border-red text-white rounded-full py-1 px-6 mr-8"]),onClick:s[2]||(s[2]=f(a=>l.changeConference("Overall"),["prevent"]))},"Overall",2),n.conferenceList.length>1?(i(!0),c(b,{key:0},v(n.conferenceList,(a,o)=>(i(),c("button",{key:`${o}`,value:a,class:m([{"text-white":n.selectedConference===a,"text-red":t.domain_color=="red"&&n.selectedConference==="Overall","text-pickleball-green":t.domain_color=="pickleball-green"&&n.selectedConference==="Overall","text-cornhole-orange":t.domain_color=="cornhole-orange"&&n.selectedConference==="Overall","bg-white":n.selectedConference!=a,"bg-red":t.domain_color=="red"&&n.selectedConference===a,"bg-pickleball-green":t.domain_color=="pickleball-green"&&n.selectedConference===a,"bg-cornhole-orange":t.domain_color=="cornhole-orange"&&n.selectedConference===a},"cursor-pointer border-red rounded-full py-1 px-6 mr-8"]),onClick:f(x=>l.changeConference(a),["prevent"])},d(a),11,At))),128)):_("",!0)]),M(e("select",{"onUpdate:modelValue":s[3]||(s[3]=a=>n.selectedConference=a),onChange:s[4]||(s[4]=a=>l.changeConference(n.selectedConference)),class:"inline md:hidden w-full appearance-none bg-white border border-market-gray text-market-gray px-4 rounded"},[(i(),c("option",{key:0,value:"Overall",class:m([n.selectedConference==="Overall"?"bg-red text-white":"bg-white text-red","rounded-full py-1 px-6 mr-8"])},"Overall",2)),(i(!0),c(b,null,v(n.conferenceList,(a,o)=>(i(),c("option",{key:`${o+1}`,value:a,class:m([n.selectedConference===a?"bg-red text-white":"bg-white text-red","rounded-full py-1 px-6 mr-8"])},d(a),11,Vt))),128))],544),[[P,n.selectedConference]])],2),e("div",{class:m(["w-full text-white p-1 text-left font-bold text-white text-xs",["bg-"+t.domain_color]])},Wt,2),n.selectedConference==="Overall"?(i(!0),c(b,{key:0},v(n.rankedTeams,(a,o)=>{var x,T,C,I;return i(),c("div",{key:`standings-team-${a.id}`,class:m(["w-full text-white text-left font-bold text-market-gray text-xs",{"bg-white":o%2===0,"bg-standings-light":o%2!==0,"border-b":n.rankedTeams.length-1!==o,"border-red":t.domain_color=="red","border-pickleball-green":t.domain_color=="pickleball-green","border-cornhole-orange":t.domain_color=="cornhole-orange"}])},[e("div",Et,[e("div",{class:m(["w-1/12 border-r text-center px-2 py-1",{"font-bold":o===0,"font-normal":o!==0,"border-red":t.domain_color=="red","border-pickleball-green":t.domain_color=="pickleball-green","border-cornhole-orange":t.domain_color=="cornhole-orange"}])},[a.tied_overall?(i(),c("span",Rt,"T-")):_("",!0),u(d(a.overall_rank),1)],2),e("div",{class:m(["w-8/12 border-r px-2 py-1",{"font-bold":o===0,"font-normal":o!==0,"border-red":t.domain_color=="red","border-pickleball-green":t.domain_color=="pickleball-green","border-cornhole-orange":t.domain_color=="cornhole-orange"}])},[e("div",Bt,[e("div",Jt,d(a.name),1),e("div",Ht,[e("button",{class:m(["inline-block text-xxs px-3 rounded-full text-white",{"bg-red":t.domain_color=="red","bg-pickleball-green":t.domain_color=="pickleball-green","bg-cornhole-orange":t.domain_color=="cornhole-orange","border border-red":n.activeTeamId!==a.id&&t.domain_color=="red","border border-pickleball-green":n.activeTeamId!==a.id&&t.domain_color=="pickleball-green","border border-cornhole-orange":n.activeTeamId!==a.id&&t.domain_color=="cornhole-orange"}]),onClick:f(F=>l.chooseTeam(a),["prevent"])},"Details",10,Ut)])])],2),e("div",{class:m(["w-3/12 md:w-1/12 border-r px-2 py-1",{"font-bold":o===0,"font-normal":o!==0,"border-red":t.domain_color=="red","border-pickleball-green":t.domain_color=="pickleball-green","border-cornhole-orange":t.domain_color=="cornhole-orange"}])},d((x=a.team_ranking)==null?void 0:x.games_won)+"-"+d((T=a.team_ranking)==null?void 0:T.games_lost)+"-"+d((C=a.team_ranking)==null?void 0:C.games_tied),3),e("div",{class:m(["w-1/12 border-r px-2 py-1 hidden md:inline",{"font-bold":o===0,"font-normal":o!==0,"border-red":t.domain_color=="red","border-pickleball-green":t.domain_color=="pickleball-green","border-cornhole-orange":t.domain_color=="cornhole-orange"}])},d((I=a.team_ranking)==null?void 0:I.win_pct),3),e("div",{class:m(["w-1/12 px-2 py-1 hidden md:inline",{"font-bold":o===0,"font-normal":o!==0}])},d(a.power_rating),3)]),n.rankedTeams.length&&n.activeTeamId===a.id?M((i(),O(h,{key:0,team:a,leagueTeams:n.rankedTeams,onChooseTeam:l.chooseTeam},null,8,["team","leagueTeams","onChooseTeam"])),[[B,n.activeTeamId===a.id]]):_("",!0)],2)}),128)):_("",!0),n.selectedConference!="Overall"?(i(!0),c(b,{key:1},v(n.rankedTeams,(a,o)=>{var x,T,C,I;return i(),c("div",{key:`standings-team-${a.id}`,class:m(["w-full text-white text-left font-bold text-market-gray text-xs",{"bg-white":o%2===0,"bg-standings-light":o%2!==0,"border-b":n.rankedTeams.length-1!==o,"border-red":t.domain_color=="red"&&n.rankedTeams.length-1!==o,"border-pickleball-green":t.domain_color=="pickleball-green"&&n.rankedTeams.length-1!==o,"border-cornhole-orange":t.domain_color=="cornhole-orange"&&n.rankedTeams.length-1!==o}])},[e("div",zt,[e("div",{class:m(["w-1/12 border-r text-center px-2 py-1",{"font-bold":o===0,"font-normal":o!==0,"border-red":t.domain_color=="red","border-pickleball-green":t.domain_color=="pickleball-green","border-cornhole-orange":t.domain_color=="cornhole-orange"}])},[a.tied_in_conference?(i(),c("span",Xt,"T-")):_("",!0),u(d(a.conference_rank),1)],2),e("div",{class:m(["w-8/12 border-r border-red px-2 py-1",{"font-bold":o===0,"font-normal":o!==0,"border-red":t.domain_color=="red","border-pickleball-green":t.domain_color=="pickleball-green","border-cornhole-orange":t.domain_color=="cornhole-orange"}])},[e("div",qt,[e("div",Yt,d(a.name),1)])],2),e("div",{class:m(["w-3/12 md:w-1/12 border-r px-2 py-1",{"font-bold":o===0,"font-normal":o!==0,"border-red":t.domain_color=="red","border-pickleball-green":t.domain_color=="pickleball-green","border-cornhole-orange":t.domain_color=="cornhole-orange"}])},d((x=a.team_ranking)==null?void 0:x.conference_games_won)+"-"+d((T=a.team_ranking)==null?void 0:T.conference_games_lost)+"-"+d((C=a.team_ranking)==null?void 0:C.conference_games_tied),3),e("div",{class:m(["w-1/12 border-r px-2 py-1 hidden md:inline",{"font-bold":o===0,"font-normal":o!==0,"border-red":t.domain_color=="red","border-pickleball-green":t.domain_color=="pickleball-green","border-cornhole-orange":t.domain_color=="cornhole-orange"}])},d((I=a.team_ranking)==null?void 0:I.conference_win_pct),3),e("div",{class:m(["w-1/12 px-2 py-1 hidden md:inline",{"font-bold":o===0,"font-normal":o!==0}])},d(a.power_rating),3)])],2)}),128)):_("",!0)],2)):_("",!0),n.standingsLoaded?(i(),O(y,{key:3,ref:"standingsMathModal",domain_color:t.domain_color},null,8,["domain_color"])):_("",!0)])}const gs=L(gt,[["render",Gt]]),Kt={props:{domain_color:String,pastLeagues:Array,teamMembers:Array,friends:Array,pendingInvites:Array,team:Object},components:{FormInput:H,FormButton:U,IconDropdown:V,CheckIcon:z},mounted(){this.pendingInvitesData=this.pendingInvites},computed:{selectedFriends(){return this.form.friends},pastTeammates(){let r=this.filters.filter_by_league;return this.friends.filter(s=>r===null?!0:s.league_ids.includes(r))},paginatePastTeamData(){return this.pagination.pages=Math.ceil(this.pastTeammates.length/10),this.pastTeammates.filter((r,s)=>s<this.pagination.currentPage*10&&this.pagination.currentPage*10-10<=s)},disabledNext(){return this.pagination.currentPage===this.pagination.pages},disabledPrev(){return this.pagination.currentPage===1},inviteSentNotJoined(){let r={};return this.teamMembers.forEach(s=>{r[s.email]=!0}),this.pendingInvitesData.forEach(s=>{s.joinStatus=r[s.to_email]?"Joined":"Not Joined"}),this.pendingInvitesData},user(){return E(this.$page.props,"auth.user",null)},invitedFriends(){return this.pendingInvitesData.map(r=>r.to_email)},filteredPastLeagues(){return this.pastLeagues.filter(r=>this.friends.filter(s=>s.league_ids.includes(r.id)).length>0)}},data(){return{form:{friends:[]},processing:!1,inviteForm:{id:null,league_id:null,name:null,email:null},selectedSection:null,filters:{filter_by_league:null},pagination:{pages:0,currentPage:1},errors:{name:"",email:""},pendingInvitesData:[]}},methods:{submitForm(r=!1){this.processing=!0,this.form.team_id=this.team.id,J.post(route("send-team-invite"),{...this.form,sender_id:this.user.id,onFinish:()=>{this.processing=!1}})},selectSection(r){this.selectedSection=r},submitInviteForm(){if(this.validateInputs(),this.errors.name||this.errors.email)return;if(this.pendingInvitesData.find(p=>p.to_email===this.inviteForm.email)){this.errors.email="This email already exists in pending invites";return}const s=this.inviteForm.name.split(" ");let t={first_name:s[0],last_name:s[1]??"",email:this.inviteForm.email};this.addToInviteList(t),this.inviteForm.name=null,this.inviteForm.email=null,this.$toast.open("Invite added"),this.errors={name:"",email:""}},removeFriend(r){let s=this.form.friends.findIndex(t=>t.email===r.email);if(s===-1)return console.error("cannot find friend"),!1;confirm("Are you sure you want to remove this friend?")&&this.$delete(this.form.friends,s)},addToInviteList(r){axios.post("/invite-players/"+this.team.id,{selectedFriends:[{name:r.first_name+" "+r.last_name,email:r.email}]}).then(s=>{this.pendingInvitesData=s.data})},inviteAllFromLeague(){const r=this.pastTeammates.filter(t=>t.league_id===this.filters.filter_by_league);let s=[];for(let t=0;r.length>t;t++)this.pendingInvitesData.find(n=>n.to_email===r[t].email)||s.push({name:r[t].first_name+" "+r[t].last_name,email:r[t].email});axios.post("/invite-players/"+this.team.id,{selectedFriends:s}).then(t=>{this.pendingInvitesData=t.data})},cancelInvite(r){this.pendingInvitesData=this.pendingInvitesData.filter(s=>s.to_email.toLowerCase()!==r.to_email.toLowerCase()),axios.post("/cancel-invite/"+this.team.id,{email:r.to_email}).then(s=>{this.pendingInvitesData=s.data,this.$toast.open({message:"Invite Cancelled",type:"success"})})},validateInputs(){this.inviteForm.name?this.errors.name="":this.errors.name="The name field is required",this.inviteForm.email?X(this.inviteForm.email)?this.inviteForm.email===this.user.email?this.errors.email="You cannot send an invite to yourself.":this.teamMembers.find(r=>r.email.toLowerCase()===this.inviteForm.email.toLowerCase())?this.errors.email="You cannot send an invite to teammates.":this.errors.email="":this.errors.email="The email field must be a valid email address":this.errors.email="The email field is required"}}},Qt={key:0},Zt={class:"w-full striped mb-8 sm_hidden"},$t=e("thead",null,[e("tr",null,[e("th",{class:"p-2 text-center text-gray"},"Name"),e("th",{class:"p-2 text-left text-gray"},"Email"),e("th",{class:"p-2"})])],-1),en={class:"p-2"},tn={class:"p-2 text-gray"},nn={key:0},sn=["onClick"],on=e("span",{class:"text-red underline whitespace-nowrap"},"(Cancel invitation)",-1),rn={key:0},an=e("td",{class:"p-2",colspan:"3"},[e("i",null,"No pending invites yet")],-1),ln=[an],dn={key:2},cn=e("h2",{class:"text-center text-md mb-2 font-bold"},"Invite Past Teammates",-1),mn={id:"past-teammates"},_n={class:"w-full relative mb-2"},hn=e("option",{value:null},"Filter by Past Leagues",-1),gn=["value"],un={class:"w-full striped mb-8 mt-4"},fn={key:0,class:"flex justify-center"},bn=e("th",{class:"p-2 text-gray text-left w-1/4"},null,-1),vn=e("th",{class:"p-2 text-gray text-left w-3/4"},"Name",-1),pn=[bn,vn],xn={class:"flex justify-center"},wn={class:"p-2 w-1/4 flex justify-center"},kn={class:"p-2 text-gray w-3/4"},yn={class:"flex justify-between"},Tn=["disabled"],Cn=["disabled"],In={key:3},Sn=e("h2",{class:"text-center text-md mb-6 font-bold"},"Invite New Teammates",-1),On={class:"flex justify-center mb-8 flex-wrap items-end px-4"},Fn={class:"w-full sm_mr-2 sm_flex-1"},Ln={class:"w-full sm_mr-2 sm_flex-1"},Mn={class:"w-full sm_flex-1"};function Pn(r,s,t,p,n,l){const g=k("form-button"),h=k("icon-dropdown"),y=k("CheckIcon"),a=k("form-input");return i(),c("div",null,[n.selectedSection?_("",!0):(i(),c("div",Qt,[e("table",Zt,[$t,e("tbody",null,[(i(!0),c(b,null,v(l.inviteSentNotJoined,o=>(i(),c("tr",{key:`friend-list-nonmobile-${o.to_email}`},[e("td",en,d(o.to_name),1),e("td",tn,d(o.to_email),1),e("td",null,[o.prepaid_code?(i(),c("p",nn,"Prepaid by "+d(o.invitee_type==="App\\UserRegistration"?o.invitee.user.first_name:o.invitee.first_name)+" "+d(o.invitee_type==="App\\UserRegistration"?o.invitee.user.last_name:o.invitee.last_name),1)):o.joinStatus!=="Joined"?(i(),c("button",{key:1,type:"button",onClick:f(x=>l.cancelInvite(o),["prevent"])},[u(d(o.joinStatus)+" ",1),on],8,sn)):_("",!0)])]))),128)),l.inviteSentNotJoined.length===0?(i(),c("tr",rn,ln)):_("",!0)])])])),n.selectedSection?_("",!0):(i(),c(b,{key:1},[t.pastLeagues.length>0?(i(),O(g,{key:0,onClick:s[0]||(s[0]=f(o=>l.selectSection("past-teammates"),["prevent"])),domain_color:t.domain_color,class:"mb-2"},{default:w(()=>[u(" Invite Past Teammates ")]),_:1},8,["domain_color"])):_("",!0),S(g,{onClick:s[1]||(s[1]=f(o=>l.selectSection("new-teammates"),["prevent"])),domain_color:t.domain_color,class:"mb-2"},{default:w(()=>[u(" Invite New Teammates ")]),_:1},8,["domain_color"])],64)),n.selectedSection==="past-teammates"?(i(),c("div",dn,[cn,e("div",mn,[e("div",_n,[M(e("select",{class:"inline-block appearance-none w-full bg-white border border-market-gray text-market-gray py-2 pl-2 pr-6 rounded","onUpdate:modelValue":s[2]||(s[2]=o=>n.filters.filter_by_league=o),required:""},[hn,(i(!0),c(b,null,v(l.filteredPastLeagues,o=>(i(),c("option",{key:`by-league-${o.id}`,value:o.id},d(o.name),9,gn))),128))],512),[[P,n.filters.filter_by_league]]),S(h)]),n.filters.filter_by_league?(i(),O(g,{key:0,onClick:s[3]||(s[3]=f(o=>l.inviteAllFromLeague(),["prevent"])),domain_color:t.domain_color},{default:w(()=>[u(" Invite All ")]),_:1},8,["domain_color"])):_("",!0),e("table",un,[e("thead",null,[l.paginatePastTeamData.length>0?(i(),c("tr",fn,pn)):_("",!0)]),e("tbody",null,[(i(!0),c(b,null,v(l.paginatePastTeamData,o=>(i(),c("tr",xn,[e("td",wn,[l.invitedFriends.includes(o.email)?(i(),O(y,{key:1,class:m(["text-white w-10 h-10 rounded-full flex-shrink-0",["bg-"+t.domain_color]])},null,8,["class"])):(i(),O(g,{key:0,onClick:f(x=>l.addToInviteList(o),["prevent"]),class:"!w-20 !md:w-32 flex-shrink-0",domain_color:t.domain_color},{default:w(()=>[u(" Invite ")]),_:2},1032,["onClick","domain_color"]))]),e("td",kn,[e("p",null,d(o.name),1),e("p",null,d(o.email),1)])]))),256))])]),e("div",yn,[e("button",{class:m(["text-red px-2 py-1 rounded",{"opacity-50":l.disabledPrev,underline:!l.disabledPrev}]),onClick:s[4]||(s[4]=o=>n.pagination.currentPage--),disabled:l.disabledPrev},"Previous ",10,Tn),e("button",{class:m(["text-red px-2 py-1 rounded",{"opacity-50":l.disabledNext,underline:!l.disabledNext}]),onClick:s[5]||(s[5]=o=>n.pagination.currentPage++),disabled:l.disabledNext},"Next ",10,Cn)]),S(g,{onClick:s[6]||(s[6]=f(o=>n.selectedSection=null,["prevent"])),class:"mt-4",domain_color:t.domain_color},{default:w(()=>[u(" Finished Adding Past Teammates ")]),_:1},8,["domain_color"])])])):_("",!0),n.selectedSection==="new-teammates"?(i(),c("div",In,[Sn,e("div",On,[e("div",Fn,[S(a,{modelValue:n.inviteForm.name,"onUpdate:modelValue":s[7]||(s[7]=o=>n.inviteForm.name=o),label:"Name",error:n.errors.name},null,8,["modelValue","error"])]),e("div",Ln,[S(a,{type:"email",modelValue:n.inviteForm.email,"onUpdate:modelValue":s[8]||(s[8]=o=>n.inviteForm.email=o),label:"Email Address",error:n.errors.email},null,8,["modelValue","error"])]),e("div",Mn,[S(g,{onClick:f(l.submitInviteForm,["prevent"]),domain_color:t.domain_color},{default:w(()=>[u("Add to Invite List ")]),_:1},8,["onClick","domain_color"]),S(g,{onClick:s[9]||(s[9]=f(o=>n.selectedSection=null,["prevent"])),class:"mt-4",domain_color:t.domain_color},{default:w(()=>[u(" Finished Adding New Teammates ")]),_:1},8,["domain_color"])])])])):_("",!0)])}const us=L(Kt,[["render",Pn]]);const Nn={components:{},data(){return{}},props:{opponentTeam:[Array,Object],scheduleMode:{type:Boolean,defaut:!1}},methods:{getFixedHeight(){return window.innerHeight*.9-50+"px"},opponentContact(r,s){return r?s=="phone"?"tel:"+r.mobile_phone:s=="sms"?"sms:+1"+r.mobile_phone:"mailto:"+r.email:""}},mixins:[j]},Dn={key:0,class:"relative min-h-250"},An=e("h2",{class:"text-center text-2xl mb-5 font-semibold"},"Opponent Contact Info",-1),Vn={key:0,class:"font-semibold mb-5"},jn={class:"w-full"},Wn={class:"text-left font-bold",colspan:"2"},En={key:0},Rn=e("td",{class:"w-1/3"},"Email",-1),Bn={class:"text-right text-indigo-500"},Jn=["href"],Hn={class:"truncate w-5/6 float-right"},Un=e("td",null,"Cell Phone",-1),zn={class:"text-right text-indigo-500"},Xn=["href"],qn=e("td",null,"Text Message",-1),Yn={class:"float-right text-indigo-500"},Gn=["href"],Kn=e("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor"},[e("path",{"fill-rule":"evenodd",d:"M18 5v8a2 2 0 01-2 2h-5l-5 4v-4H4a2 2 0 01-2-2V5a2 2 0 012-2h12a2 2 0 012 2zM7 8H5v2h2V8zm2 0h2v2H9V8zm6 0h-2v2h2V8z","clip-rule":"evenodd"})],-1),Qn=[Kn];function Zn(r,s,t,p,n,l){const g=k("modal");return i(),O(g,{ref:"modal",clickToClose:!1,escToClose:!0,width:600,onClosed:s[0]||(s[0]=h=>r.$emit("modalClosed")),"fixed-height":l.getFixedHeight()},{default:w(()=>[t.opponentTeam?(i(),c("div",Dn,[An,t.scheduleMode?(i(),c("p",Vn,"Please enter your available match times on the calender prior to contacting your opponents directly.")):_("",!0),(i(!0),c(b,null,v(t.opponentTeam,(h,y)=>(i(),c("div",{class:"p-2 border-b border-gray-light last:border-none",key:y},[e("table",jn,[e("tr",null,[e("td",Wn,[u(d(h.first_name)+" "+d(h.last_name)+" ",1),h.pivot.is_captain?(i(),c("span",En," - Captain")):_("",!0)])]),e("tr",null,[Rn,e("td",Bn,[e("a",{href:l.opponentContact(h,"email")},[e("p",Hn,d(h.email),1)],8,Jn)])]),e("tr",null,[Un,e("td",zn,[e("a",{href:l.opponentContact(h,"phone")},d(h.mobile_phone),9,Xn)])]),e("tr",null,[qn,e("td",Yn,[e("a",{href:l.opponentContact(h,"sms")},Qn,8,Gn)])])])]))),128))])):_("",!0)]),_:1},8,["fixed-height"])}const fs=L(Nn,[["render",Zn]]),$n={props:["color"]},es={class:"relative w-6 h-6 group mb-1 group"},ts={class:"w-28 rounded-xl bg-white border border-black absolute top-7 left-0 -ml-11 z-20 hidden group-hover:flex flex-col items-center p-2"},ns={class:"text-center font-normal leading-tight"};function ss(r,s,t,p,n,l){return i(),c("div",es,[e("div",{class:"w-6 h-6 rounded-full border border-black cursor-pointer",style:A("background-color:"+t.color.color_picker)},null,4),e("div",ts,[e("div",{class:"w-20 h-20 rounded-full border border-black mb-1",style:A("background-color:"+t.color.color_picker)},null,4),e("p",ns,d(t.color.display_name),1)])])}const bs=L($n,[["render",ss]]);export{bs as C,us as I,fs as O,me as S,gs as T,ht as a};