1import{p as e}from"./playerList-CgLlP83G.js";import t from"./addPlayer-jy5CNZEW.js";import{_ as a,r as l,e as s,g as r,f as i,t as n,n as o,x as d,m as c,q as u,C as y,z as h,Z as v,a0 as p,F as m,v as g,W as S,Q as b,bv as k,S as P,G as f,T as L,ad as E,cn as A,h as w,E as C,R as T,N as _,ah as I,u as j,X as x,Y as R,k as N,aj as U}from"./index-Ce7SucYs.js";import{b as D}from"./addParticipantToEvent-DhvYxTfJ.js";import"./bottomSheet-Bh7cy0dv.js";import"./setCustomClaims-CJhtbm3S.js";import"./imageURLreturn-DlqUkpio.js";import"./croppie-COvZV25I.js";import"./playerCode-BNLNEbLm.js";import"./customInput-D9eG0Iee.js";import"./createPlayer-_kIUfCu0.js";import"./zipcodeInput-CI6rYt2r.js";const V={props:{isLeague:Boolean,leagueID:String,selectedSeason:String,leaguePlayers:Array,leagueType:String,seasonName:String,leagueTitle:String,rules:String,schedule:{type:Array,default:()=>[]}},components:{playerList:e,addPlayer:t},emits:["playersWereAdded","runAutoSchedule"],data(){var e,t,a;return{playerSearch:null!=(a=null==(t=null==(e=this.$route)?void 0:e.query)?void 0:t.q)?a:"",playerAddList:[],type:"Search Players",typeTab:1,alert:!0,errors:[],addedPlayers:!1,bulkPlayers:"",bulkLoader:!1,player:{type:"new"},selectedLeague:"",selectedLeaguePlayers:[],playersWithSubscription:[]}},setup:()=>({venueStore:j(),seasonStore:x(),eventStore:R(),generalStore:N(),chatStore:U()}),computed:{checkPlayersNumber(){return this.leaguePlayers.length+this.playerAddList.length},playersNumberIsLimited(){return"subscription"===this.venueStore.venue.paymentMethod&&this.checkPlayersNumber>+this.venueStore.subscription.metadata.availablePlayers},leaguePlayersRemoved(){let e=this.generalStore.players;if(this.eventStore.selectedEvent.virtual){const t=e.filter(e=>!e.subscription);e=[...this.playersWithSubscription,...t]}return e.filter(e=>!this.leaguePlayers.some(t=>e[".key"]===t[".key"]||e[".key"]===t.id))},selectedPlayersRemoved(){return this.leaguePlayersRemoved.filter(e=>!this.playerAddList.some(t=>e[".key"]===t[".key"]))},leagues(){return this.venueStore.listLeagues.filter(e=>"duals-league"!==e.leagueType).sort((e,t)=>-e[".key"].localeCompare(t[".key"]))}},watch:{selectedLeaguePlayers(){this.bulkPlayers=this.selectedLeaguePlayers.map(e=>e.code).join("\n")}},methods:{sendUpdateToEventChat(e){if(this.eventStore.selectedEvent.chatId){const t=I().format("MMM D, h:mm"),a=this.eventStore.selectedEvent.virtual?"Flex League":"League",l={text:"The schedule has been updated. ".concat(e," joined this ").concat(a," on ").concat(t," â check your schedule to see new games"),type:"text",senderId:"chat_bot"};this.chatStore.sendMessage(this.eventStore.selectedEvent.chatId,l)}},removePlayerHandler(e){this.playerAddList=this.playerAddList.filter(t=>t.code!==e)},createdPlayer(e){S(f("/watl/players/".concat(e))).then(e=>{let t=e.val();t[".key"]=e.key,this.addPlayer(t),this.player={type:"new"}})},playerRemoveFromList(e){this.playerAddList.splice(e,1)},bulkAdd(){this.bulkLoader=!0,this.errors=[],this.playerAddList=[];let e=this.bulkPlayers.toUpperCase().split("\n"),t=[];e.forEach(e=>{t.push(new Promise((t,a)=>{const l=b(f("/watl/players/"),P("code"),T(e.trim()));_(l,l=>{let s=l.val();if(null===s)this.errors.push(e),a();else{let e=Object.keys(s)[0],a=s[e];a[".key"]=e,a.code.length&&this.playerAddList.push(a),t()}},{onlyOnce:!0})}))}),Promise.allSettled(t).then(e=>{this.bulkLoader=!1,this.bulkPlayers=""})},addPlayer(e){this.playerAddList.push(e)},addPlayerToChat(e){this.eventStore.selectedEvent.chatId&&this.eventStore.selectedEvent.chatIsAvailable&&this.chatStore.addChatMember(this.eventStore.selectedEvent.chatId,e[".key"])},addPlayerToEvent(e,t=!1){if(void 0===e.globalrank&&(e.globalrank=0),void 0===e.facebook&&(e.facebook=""),void 0===e.instagram&&(e.instagram=""),this.isLeague)if(this.eventStore.selectedEvent.virtual){const t={title:this.eventStore.selectedEvent.title,date:this.eventStore.selectedEvent.date,time:this.eventStore.selectedEvent.time||this.eventStore.selectedEvent.timeStart,venue:this.venueStore.venue.locationSlug.replaceAll("_"," "),type:this.eventStore.selectedEvent.type,virtual:this.eventStore.selectedEvent.virtual,slug:this.eventStore.selectedEvent.slug};this.sendSignUpNotification(e.email,e.first+" "+e.last,t)}else this.sendEmail(e[".key"],this.venueStore.venue.company+" "+this.venueStore.venue.city,this.venueStore.venue.locationSlug+"/league/"+this.leagueID,this.eventStore.selectedEvent.officialLeague);e.autoCheckIn=t,D(e,"/venues/".concat(this.venueStore.venue.locationSlug,"/league/").concat(this.leagueID,"/").concat(this.selectedSeason));let a=this.isLeague?"league":"tournament",l=(new Date).getTime();const s=this.eventStore.selectedEvent.isOfficial||"sanctioned"===this.eventStore.selectedEvent.sanctioning;
1C(f("/".concat(this.rules,"/players-career/").concat(e[".key"],"/").concat(a,"/").concat(this.leagueID,"-").concat(this.selectedSeason)),{name:this.leagueID,season:this.selectedSeason,venue:this.venueStore.venue.locationSlug,time:l,eventStartTime:this.eventStore.selectedEvent.time||"--:--",type:this.leagueType,...s&&{sanctioning:"sanctioned"},seasonName:this.seasonName,title:this.leagueTitle,schedule:this.schedule,gamePlayRules:this.eventStore.selectedEvent.gamePlayRules,..."custom"!==this.venueStore.venue.type&&{qualificationThrows:"Qualifying Throws"===this.eventStore.selectedEventType}})},save(e=!1){if(this.playersNumberIsLimited)return void w(()=>{},"Action is unavailable on this plan. Please Upgrade your current plan to proceed.","warning","Ok",!0);const t=this.playerAddList.map(e=>e.first+" "+e.last),a=t.length>1?t.join(", "):t[0];this.playerAddList.forEach((l,s)=>{!this.eventStore.selectedEvent.virtual||this.eventStore.selectedEvent.virtual&&l.subscription?(this.addPlayerToEvent(l,e),this.addPlayerToChat(l),s===t.length-1&&this.sendUpdateToEventChat(a)):this.sendPlayerInvitation(l)}),this.close(),this.$emit("playersWereAdded")},sendPlayerInvitation(e){const t="".concat("https://axethrowing.org","/watl/virtual/view/").concat(this.eventStore.selectedEvent.slug);A(e.email,e.first,t)},sendSignUpNotification(e,t,a){},sendEmail(e,t,a,l){if(document.location.host.includes("localhost"))return!1;let s="https://us-central1-forged-7adb7.cloudfunctions.net/emailEvents/playerAdded?playerID="+e+"&venueName="+t+"&linkLeaderboard="+a+"&linkGlobalLeaderboard="+l;E.get(s).then(function(e){console.log(e)})},close(){this.playerAddList=[],this.playerSearch="",this.generalStore.dialogAddPlayer=!1},getPlayers(){this.$databaseBind("selectedLeaguePlayers",L("/venues/".concat(this.venueStore.venue.locationSlug,"/league/").concat(this.selectedLeague.slug,"/").concat(this.selectedLeague.currentSeason,"/standings")))},async getPlayersWithSubscription(){this.playersWithSubscription=await S(b(f("/watl/players/"),P("subscription"),k(""))).then(e=>{const t=Object.fromEntries(Object.entries(e.val()||{}).map(([e,t])=>[e,{...t,".key":e}]));return Object.values(t).filter(e=>e.subscription)})}},mounted(){this.getPlayersWithSubscription()}},B={style:{"background-color":"white",width:"100%"}},W={style:{height:"calc(100vh - 65px)","-webkit-overflow-scrolling":"touch",overflow:"auto"}},O={key:1,class:"invert text-right pa-3"},M={key:3,class:"pa-5"},F=["value"],q={style:{"text-transform":"capitalize"}},z={key:0,class:"mt-5 mb-2"},G={key:1,class:"mb-2"},$={class:"invert",style:{"background-color":"white",width:"100%"}};const H=a(V,[["render",function(e,t,a,S,b,k){const P=l("v-icon"),f=l("v-btn"),L=l("v-tab"),E=l("v-tabs"),A=l("v-spacer"),w=l("v-toolbar"),C=l("addPlayer"),T=l("playerList"),_=l("v-textarea"),I=l("v-dialog");return r(),s("div",B,[i(f,{icon:"",class:"closeAbsolute",onClick:t[0]||(t[0]=e=>k.close())},{default:o(()=>[i(P,null,{default:o(()=>[...t[16]||(t[16]=[d("mdi-close",-1)])]),_:1})]),_:1}),i(w,{tabs:"",style:{"background-color":"var(--theme-background)"}},{default:o(()=>[i(E,{id:"playersTabs","bg-color":"transparent","slider-color":"primary",modelValue:b.typeTab,"onUpdate:modelValue":t[1]||(t[1]=e=>b.typeTab=e),height:"64"},{default:o(()=>[i(L,{disabled:S.eventStore.selectedEvent.virtual},{default:o(()=>[...t[17]||(t[17]=[d("Create New Player",-1)])]),_:1},8,["disabled"]),i(L,null,{default:o(()=>[...t[18]||(t[18]=[d("Search Players",-1)])]),_:1}),i(L,{disabled:S.eventStore.selectedEvent.virtual},{default:o(()=>[...t[19]||(t[19]=[d("Bulk Add players",-1)])]),_:1},8,["disabled"])]),_:1},8,["modelValue"]),i(A)]),_:1}),n("div",W,[0===b.typeTab?(r(),c(C,{key:0,player:b.player,source:"includePlayer",onCreatedPlayer:k.createdPlayer},null,8,["player","onCreatedPlayer"])):u("",!0),1===b.typeTab?(r(),s("div",O,[i(f,{onClick:t[2]||(t[2]=e=>b.addedPlayers=!0)},{default:o(()=>[d("Players added ( "+h(b.playerAddList.length)+" )",1)]),_:1}),i(f,{color:"primary","data-label":"Save",onClick:t[3]||(t[3]=e=>k.save())},{default:o(()=>[...t[20]||(t[20]=[d("Save",-1)])]),_:1}),S.eventStore.selectedEvent.virtual?(r(),c(f,{key:0,color:"primary","data-label":"Save",onClick:t[4]||(t[4]=e=>k.save(!0))},{default:o(()=>[...t[21]||(t[21]=[d("Save & Check In",-1)])]),_:1})):u("",!0),y(n("input",{type:"text","data-label":"Search",placeholder:"Search...",class:"toolbar-select search","onUpdate:modelValue":t[5]||(t[5]=e=>b.playerSearch=e),style:{width:"300px !important"}},null,512),[[v,b.playerSearch]])])):u("",!0),1===b.typeTab?(r(),c(T,{key:2,players:k.selectedPlayersRemoved,playerAddList:b.playerAddList,search:b.playerSearch,"onUpdate:search":[t[6]||(t[6]=e=>b.playerSearch=e),t[7]||(t[7]=e=>b.playerSearch=e)],view:"league",class:"container ma-auto",virtualEvent:S.eventStore.selectedEvent.virtual,eventGamePlayRules:S.eventStore.selectedEvent.gamePlayRules||"",rules:S.eventStore.selectedEvent.rules||"",wktlDivision:S.eventStore.selectedEvent.wktlDivision||"",onSelectedPlayer:k.addPlayer},null,8,["players","playerAddList","search","virtualEvent","eventGamePlayRules","rules","wktlDivision","onSelectedPlayer"])):u("",!0),2===b.typeTab?(r(),s("div",M,[t[28]||(t[28]=n("h3",null,"Copy Players From this League:",-1)),y(n("select",{"onUpdate:modelValue":t[8]||(t[8]=e=>b.selectedLeague=e),onChange:t[9]||(t[9]=e=>k.getPlayers()),class:"leagueSelect mb-6"},[t[22]||(t[22]=n("option",{class:"select__item",selected:"",disabled:"",value:""}," - Select League - ",-1)),(r(!0),s(m,null,g(k.leagues,e=>(r(),s("option",{key:e.id,value:e},[n("span",q,[e.title?(r(),s(m,{key:0},[d(h(e.title)+" ["+h(S.seasonStore.seasonYears[e.currentSeason])+"] ",1)],64)):(r(),s(m,{key:1},[d(h(e.name),1)],64))])],8,F))),128))],544),[[p,b.selectedLeague]]),t[29]||(t[29]=n("h3",null,"Please enter player IDs (one per line)",-1)),i(_,{variant:"outlined",solo:"",class:"mt-2 pa-0 invert",modelValue:b.bulkPlayers,"onUpdate:modelValue":t[10]||(t[10]=e=>b.bulkPlayers=e),placeholder:"ex. \nAB01\nAB04\nAB05"},null,8,["modelValue"]),i(f,{color:"primary",class:"ma-0 mt-6",onClick:t[11]||(t[11]=e=>k.bulkAdd()),loading:b.bulkLoader},{default:o(()=>[...t[23]||(t[23]=[d("Bulk Add",-1)])]),_:1},8,["loading"]),b.playerAddList.length?(r(),s("div",z,[t[25]||(t[25]=n("strong",null,"Players found: ",
1-1)),(r(!0),s(m,null,g(b.playerAddList,(e,a)=>(r(),s("div",{class:"chip",key:a},[d(h(e.first)+" "+h(e.last)+" ("+h(e.code)+") ",1),i(f,{class:"removeBtn",onClick:e=>k.playerRemoveFromList(a)},{default:o(()=>[i(P,{size:"14"},{default:o(()=>[...t[24]||(t[24]=[d("mdi-close",-1)])]),_:1})]),_:1},8,["onClick"])]))),128))])):u("",!0),b.errors.length?(r(),s("div",G,[t[26]||(t[26]=n("strong",null,"Not found: ",-1)),(r(!0),s(m,null,g(b.errors,(e,t)=>(r(),s("div",{class:"chip",key:t},h(e),1))),128))])):u("",!0),b.playerAddList.length?(r(),c(f,{key:2,color:"primary",class:"ma-0",onClick:t[12]||(t[12]=e=>k.save())},{default:o(()=>[...t[27]||(t[27]=[d("Add all",-1)])]),_:1})):u("",!0)])):u("",!0)]),i(I,{fullscreen:"",transition:"dialog-bottom-transition",scrollable:"",modelValue:b.addedPlayers,"onUpdate:modelValue":t[15]||(t[15]=e=>b.addedPlayers=e)},{default:o(()=>[n("div",$,[i(f,{icon:"",class:"closeAbsolute",onClick:t[13]||(t[13]=e=>b.addedPlayers=!1)},{default:o(()=>[i(P,null,{default:o(()=>[...t[30]||(t[30]=[d("mdi-close",-1)])]),_:1})]),_:1}),i(w,{tabs:"",style:{"background-color":"var(--theme-background)"}},{default:o(()=>[t[32]||(t[32]=n("span",null,"Added players",-1)),i(A),i(f,{color:"primary",onClick:t[14]||(t[14]=e=>k.save())},{default:o(()=>[...t[31]||(t[31]=[d("Save and close",-1)])]),_:1}),i(A)]),_:1}),i(T,{playerSelect:!0,players:b.playerAddList,view:"league",virtualEvent:S.eventStore.selectedEvent.virtual,class:"container",managePlayers:"",onRemovePlayer:k.removePlayerHandler},null,8,["players","virtualEvent","onRemovePlayer"])])]),_:1},8,["modelValue"])])}],["__scopeId","data-v-6324dd71"]]);export{H as default};
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.