(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{5555:function(e,t,a){Promise.resolve().then(a.bind(a,5877)),Promise.resolve().then(a.bind(a,3815)),Promise.resolve().then(a.bind(a,6421)),Promise.resolve().then(a.bind(a,4250)),Promise.resolve().then(a.bind(a,4407)),Promise.resolve().then(a.bind(a,1909)),Promise.resolve().then(a.bind(a,8703))},5877:function(e,t,a){"use strict";a.r(t),a.d(t,{MainContent:function(){return MainContent}});var n=a(7437),l=a(2265),r=a(9018),s=a(6034),o=a(6817),i=a(6651);function JoinLobbyForm(){let e=(0,r.Y)(e=>e.MemberId),t=(0,r.Y)(e=>e.SetMemberId),a=(0,r.Y)(e=>e.UpdateLobbyDetails),l=(0,i.Xo)(e=>e.setDetails),c=(0,i.Xo)(e=>e.setVisible),d=(0,s.f)(e=>e.MuteNotifications),u=(0,s.f)(e=>e.ShouldShowIntro),m=!1;return(0,n.jsxs)("div",{className:"join-game-container inline-flex",children:[(0,n.jsx)("div",{className:"wood-sign"}),(0,n.jsxs)("div",{className:"wood-sign-form",children:[(0,n.jsx)("h2",{className:"no-wrap text-center",children:"Enter Lobby Code"}),(0,n.jsx)("input",{autoFocus:!0,onChange:n=>{if(null!=e)return;let r=n.currentTarget.value;6==r.length&&(m||(m=!0,(0,o.L4)({lobby_code:parseInt(r),display_name:"NoName"}).then(e=>{m=!1,(0,o.Vs)(e.data.token),t(e.data.member_id),a(e.data.lobby),e.data.should_mute&&d(!0),e.data.hide_intro&&u(!1)}).catch(function(e){var t;m=!1,l({Message:null!==(t=e.response.data.Message)&&void 0!==t?t:"Unable to join lobby",Title:"Error Joining Lobby",Type:i.j_.Error,AutoHide:!0}),c(!0)})))},id:"lobby-code-input",type:"password",pattern:"[0-9]*",inputMode:"numeric",className:"text-base font-medium bg-transparent text-white inline-flex items-center focus:outline-0 ",placeholder:"000000",maxLength:6})]})]})}var c=a(4407);function PlayerStatus(e){let t=(0,r.Y)(e=>e.LobbyDetails),a=(0,r.Y)(e=>e.GameDetails),l=(0,r.Y)(e=>e.MemberId);if(null==t||null==l)return(0,c.Empty)();let s=t.active_members[e.playerNumber-1];if(null==s)return(0,c.Empty)();function GetUpdatedStatus(){if(null==t)return;if(null==t.active_game)return null;if(null==a||null==a.MemberStatus)return(0,n.jsx)("div",{className:"inline-flex",children:(0,n.jsx)("span",{className:"text-blue-700 stroke-1 stroke-black",children:"Alive"})});let e=a.MemberStatus[s.id];if(null==e)return;let UpdatePlayerStatus=e=>{if(e.preventDefault(),null==t.active_game)return;let a=e.currentTarget.getAttribute("data-member-key");null!=a&&(0,o.uJ)(t.active_game.id,parseInt(a)).then(e=>{})};return(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"inline-flex",children:e.is_dead?(0,n.jsx)("span",{className:"text-red-700 stroke-1 stroke-black",children:"Dead"}):(0,n.jsx)("span",{className:"text-blue-700 stroke-1 stroke-black",children:"Alive"})}),e.is_dead?(0,n.jsx)("button",{onClick:UpdatePlayerStatus,"data-member-key":e.member_id,className:"player-action-button bg-transparent hover:text-blue-300 text-white text-shadow font-creepster pl-1 pr-1 ml-2 items-center",children:"Revive"}):(0,n.jsx)("button",{onClick:UpdatePlayerStatus,"data-member-key":e.member_id,className:"player-action-button bg-transparent hover:text-red-300 text-white text-shadow font-creepster pl-1 pr-1 ml-2 items-center",children:"Died"})]})}return(0,n.jsxs)("div",{className:"grid grid-cols-6 h-full items-center ",children:[(0,n.jsx)("div",{className:"player-image-margins w-full h-full col-span-2",children:(0,n.jsx)("div",{className:"polaroid",children:(0,n.jsx)("div",{className:"image-container "+s.character_image})})}),(0,n.jsxs)("div",{className:"player-status-text w-full h-full col-span-3 mt-10",children:[(0,n.jsx)("div",{className:"w-full font-medium",children:s.display_name}),(0,n.jsx)(GetUpdatedStatus,{})]})]})}let GetMemberBounties=(e,t,a)=>null==t||null==a?null:a.filter(a=>a.member_id==t&&a.bounty_number==e)[0],GetBountyTitle=e=>{let t="One Game Only";if(e.task.challenge_length>1){let a=e.task.challenge_length,n=e.games.length;t=n==a?"Last Chance!":n+" of "+a}return t},LeaveLobby=(e,t,a,l)=>{a({Message:"Do you want to leave the lobby?",Title:"Leave Lobby?",Type:i.j_.Confirmation,AutoHide:!1,Icon:(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"w-6 h-6",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.636 5.636a9 9 0 1012.728 0M12 3v9"})}),Buttons:{ConfirmButtonType:i.iB.Warning,ConfirmButtonText:"Logout",ConfirmButtonCallback:()=>{(0,o.Z4)().then(e=>{window.location.reload()})}}}),l(!0)},HandleStartGameButton=(e,t)=>{e({Message:"Ready to start the next game?",Title:"Start Game",Type:i.j_.Confirmation,AutoHide:!1,Icon:(0,n.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6",children:[(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}),(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.91 11.672a.375.375 0 010 .656l-5.603 3.113a.375.375 0 01-.557-.328V8.887c0-.286.307-.466.557-.327l5.603 3.112z"})]}),Buttons:{ConfirmButtonType:i.iB.Success,ConfirmButtonText:"Start Game",ConfirmButtonCallback:()=>{(0,o.mV)().then(e=>{t(!1)})}}}),t(!0)},HandleEndGameButton=(e,t,a)=>{t({Message:"End the current game?",Title:"End Game",Type:i.j_.Confirmation,AutoHide:!1,Icon:(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12l8.954-8.955c.44-.439 1.152-.439 1.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25"})}),Buttons:{ConfirmButtonType:i.iB.Warning,ConfirmButtonText:"End Game",ConfirmButtonCallback:()=>{null!=e.active_game&&(0,o.kI)(e.active_game.id).then(e=>{a(!1)})}}}),a(!0)},ActivateMapButton=e=>{setTimeout(()=>{var t;null!=document.querySelector("button[data-map-name='"+e+"']")&&(null!=document.getElementsByClassName("active-button")[0]&&document.getElementsByClassName("active-button")[0].classList.remove("active-button"),null===(t=document.querySelector("button[data-map-name='"+e+"']"))||void 0===t||t.classList.add("active-button"))},1e3)},ChangeMap=(e,t)=>{null!=document.getElementsByClassName("active-button")[0]&&document.getElementsByClassName("active-button")[0].classList.remove("active-button"),e.currentTarget.classList.add("active-button");let a=e.currentTarget.getAttribute("data-map-name");null!=a&&(0,o.uf)({selected_map:a,bounty_one:t.bounty_one,bounty_two:t.bounty_two,bounty_three:t.bounty_three}).then(e=>{})},UpdateBountyForm=(e,t)=>{e.preventDefault();let a=e.currentTarget.getAttribute("data-bounty-number"),n=e.currentTarget.value;if(null!=a&&null!=t){switch(a){case"1":t.bounty_one=n;break;case"2":t.bounty_two=n;break;case"3":t.bounty_three=n}(0,o.uf)({selected_map:t.selected_map,bounty_one:t.bounty_one,bounty_two:t.bounty_two,bounty_three:t.bounty_three}).then(e=>{})}},UnexpectedConditionRefresh=()=>(console.log("Unexpected condition in state. Refreshing"),window.location.reload(),(0,n.jsx)(n.Fragment,{}));function MuteButton(){let e=(0,s.f)(e=>e.Muted),t=(0,s.f)(e=>e.MuteNotifications),UpdateMute=a=>{a.preventDefault();let n=!e;t(n),(0,o.xK)({muted:n}).then(e=>{})};return e?(0,n.jsxs)("button",{onClick:UpdateMute,className:"w-full inline-flex items-center text-white text-shadow ",children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17.25 9.75L19.5 12m0 0l2.25 2.25M19.5 12l2.25-2.25M19.5 12l-2.25 2.25m-10.5-6l4.72-4.72a.75.75 0 011.28.531V19.94a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.506-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.395C2.806 8.757 3.63 8.25 4.51 8.25H6.75z"})}),"Unmute"]}):(0,n.jsxs)("button",{onClick:UpdateMute,className:"w-full inline-flex items-center text-white text-shadow ",children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.114 5.636a9 9 0 010 12.728M16.463 8.288a5.25 5.25 0 010 7.424M6.75 8.25l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z"})}),"Mute"]})}function NotificationAlert(){let e=(0,s.f)(e=>e.Muted);if(e)return(0,n.jsx)(c.Empty,{});let t=new Audio("/notification.wav");return t.load(),t.volume.toPrecision(10),t.play().then(e=>{console.log(e)}).catch(e=>{console.log(e)}),(0,n.jsx)(c.Empty,{})}function PlayerBoard(){let e=(0,i.Xo)(e=>e.setDetails),t=(0,i.Xo)(e=>e.setVisible),a=(0,r.Y)(e=>e.LobbyDetails),l=(0,r.Y)(e=>e.UpdateLobbyDetails),s=(0,r.Y)(e=>e.SetMemberId),o=(0,r.Y)(e=>e.UpdateEditPlayer);if(null==a)return;let c="lobby-player-sign font-metal text-shadow text-white",d="lobby-top-display font-metal items-center text-center";return null!=a.active_game&&(c="in-game-player-sign font-finger-paint text-shadow text-white",d="in-game-top-display font-spray-paint text-shadow text-white items-center text-center"),(0,n.jsxs)("div",{className:"hanging-sign-group",children:[(0,n.jsxs)("div",{className:d+" relative z-50",children:[(0,n.jsxs)("button",{onClick:a=>{a.preventDefault(),LeaveLobby(s,l,e,t)},className:"w-full text-white text-shadow inline-flex items-center no-wrap",children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 9V5.25A2.25 2.25 0 0013.5 3h-6a2.25 2.25 0 00-2.25 2.25v13.5A2.25 2.25 0 007.5 21h6a2.25 2.25 0 002.25-2.25V15m3 0l3-3m0 0l-3-3m3 3H9"})}),"Leave Lobby"]}),(0,n.jsxs)("button",{onClick:()=>{o(!0)},className:"w-full text-white text-shadow inline-flex items-center no-wrap",children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6 text-shadow",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 6h9.75M10.5 6a1.5 1.5 0 11-3 0m3 0a1.5 1.5 0 10-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 01-3 0m3 0a1.5 1.5 0 00-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 01-3 0m3 0a1.5 1.5 0 00-3 0m-9.75 0h9.75"})}),"Edit Player"]}),(0,n.jsx)(MuteButton,{}),(0,n.jsx)("div",{className:"w-full font-creepster text-red-700 block text-shadow",children:"Missing Persons"})]}),(0,n.jsx)("div",{className:c+" first-player-sign relative z-40 ml-1",children:(0,n.jsx)(PlayerStatus,{playerNumber:1})}),(0,n.jsx)("div",{className:c+" relative z-30 ml-1",children:(0,n.jsx)(PlayerStatus,{playerNumber:2})}),(0,n.jsx)("div",{className:c+" relative z-20 ml-1",children:(0,n.jsx)(PlayerStatus,{playerNumber:3})}),(0,n.jsx)("div",{className:c+" relative ml-1",children:(0,n.jsx)(PlayerStatus,{playerNumber:4})})]})}function BulletinBoard(){let e=(0,r.Y)(e=>e.LobbyDetails);if(null!=e)return null==e.active_game?(0,n.jsx)(LobbyBoard,{}):(0,n.jsx)(InGameBoard,{})}function InGameBoard(){let e=(0,r.Y)(e=>e.LobbyDetails);if(null!=e)return(0,n.jsxs)("div",{className:"bulletin-board in-game-board items-center justify-center",children:[(0,n.jsx)(MapName,{map_name:e.selected_map,classList:" text-gray-200 text-2xl font-spray-paint text-shadow"}),(0,n.jsx)("a",{href:"#",onClick:MapSizeToggle,children:(0,n.jsx)("div",{className:"map-container "+e.selected_map})})]})}function LobbyBoard(){let e=(0,r.Y)(e=>e.LobbyDetails);if(null!=e)return ActivateMapButton(e.selected_map),(0,n.jsx)("div",{className:"bulletin-board lobby-board relative",children:(0,n.jsxs)("div",{className:"grid grid-cols-5 gap-10 lobby-board-text-container text-gray-100 text-shadow font-permanent-marker ",children:[(0,n.jsxs)("div",{className:"col-span-2 flex-wrap w-full",children:[(0,n.jsx)("h2",{className:"capitalize no-wrap text-shadow border-b-2 border-b-gray-400 text-center",children:"Map Choices"}),(0,n.jsx)("button",{onClick:t=>ChangeMap(t,e),"data-map-name":"tanglewood",className:"type-button text-shadow hover:text-purple-200 hover-text-shadow no-wrap",children:"Tanglewood Drive"}),(0,n.jsx)("button",{onClick:t=>ChangeMap(t,e),"data-map-name":"ridgeview",className:"type-button text-shadow hover:text-red-200 hover-text-shadow no-wrap",children:"Ridgeview Court"}),(0,n.jsx)("button",{onClick:t=>ChangeMap(t,e),"data-map-name":"willow",className:"type-button text-shadow hover:text-green-200 hover-text-shadow no-wrap",children:"Willow Street"}),(0,n.jsx)("button",{onClick:t=>ChangeMap(t,e),"data-map-name":"edgefield",className:"type-button text-shadow hover:text-blue-200 hover-text-shadow no-wrap",children:"Edgefield Road"}),(0,n.jsx)("button",{onClick:t=>ChangeMap(t,e),"data-map-name":"bleasdale",className:"type-button text-shadow hover:text-teal-200 hover-text-shadow no-wrap",children:"Bleasdale Farmhouse"}),(0,n.jsx)("button",{onClick:t=>ChangeMap(t,e),"data-map-name":"woodwind",className:"type-button text-shadow hover:text-pink-200 hover-text-shadow no-wrap",children:"Camp Woodwind"}),(0,n.jsx)("button",{onClick:t=>ChangeMap(t,e),"data-map-name":"maple",className:"type-button text-shadow hover:text-cyan-200 hover-text-shadow no-wrap",children:"Maple Lodge Campsite"}),(0,n.jsx)("button",{onClick:t=>ChangeMap(t,e),"data-map-name":"grafton",className:"type-button text-shadow hover:text-orange-200 hover-text-shadow no-wrap",children:"Grafton Farmhouse"}),(0,n.jsx)("button",{onClick:t=>ChangeMap(t,e),"data-map-name":"sunny_meadows",className:"type-button text-shadow hover:text-amber-200 hover-text-shadow no-wrap",children:"Sunny Meadows"}),(0,n.jsx)("button",{onClick:t=>ChangeMap(t,e),"data-map-name":"highschool",className:"type-button text-shadow hover:text-emerald-200 hover-text-shadow no-wrap",children:"High School"}),(0,n.jsx)("br",{}),(0,n.jsx)("button",{onClick:t=>ChangeMap(t,e),"data-map-name":"prison",className:"type-button text-shadow hover:text-amber-200 hover-text-shadow no-wrap",children:"Prison"})]}),(0,n.jsxs)("div",{className:"col-span-3",children:[(0,n.jsx)(MapName,{map_name:e.selected_map,classList:"capitalize text-gray-100 text-shadow font-permanent-marker no-wrap border-b-2 border-b-gray-400 mb-5 text-center"}),(0,n.jsx)("a",{href:"#",onClick:MapSizeToggle,children:(0,n.jsx)("div",{className:"map-container "+e.selected_map})})]})]})})}function MapSizeToggle(){let e=document.getElementsByClassName("map-container")[0];console.log(e),null!=e&&(e.classList.contains("map-larger")?e.classList.remove("map-larger"):e.classList.add("map-larger"))}function MapName(e){let t;switch(e.map_name){default:t="6 Tanglewood Drive";break;case"ridgeview":t="10 Ridgeview Court";break;case"willow":t="13 Willow Street";break;case"edgefield":t="42 Edgefield Road.";break;case"bleasdale":t="Bleasdale Farmhouse";break;case"woodwind":t="Camp Woodwind";break;case"maple":t="Maple Lodge Campsite";break;case"grafton":t="Grafton Farmhouse";break;case"sunny_meadows":t="Sunny Meadows";break;case"highschool":t="High School";break;case"prison":t="Prison"}return(0,n.jsx)("h2",{id:"map-text-name",className:e.classList,children:t})}function EndGameForm(){let e=(0,r.Y)(e=>e.LobbyDetails),t=(0,i.Xo)(e=>e.setDetails),a=(0,i.Xo)(e=>e.setVisible);if(null!=e)return(0,n.jsx)("div",{className:"in-game-end-sign text-center",children:(0,n.jsx)("button",{onClick:n=>{n.preventDefault(),HandleEndGameButton(e,t,a)},className:"font-spray-paint text-shadow text-gray-300 hover:text-blue-200 hover-text-shadow no-wrap",children:"End Game"})})}let SelectOptionsText=()=>(0,n.jsx)("span",{className:"text-gray-400 font-overpass",children:"Enable A Bounty"});function StartGameForm(){let e=(0,r.Y)(e=>e.LobbyDetails),t=(0,i.Xo)(e=>e.setDetails),a=(0,i.Xo)(e=>e.setVisible);if(null!=e)return"off"==e.bounty_one&&"off"==e.bounty_two&&"off"==e.bounty_three?(0,n.jsx)(SelectOptionsText,{}):(0,n.jsxs)("button",{onClick:e=>{e.preventDefault(),HandleStartGameButton(t,a)},className:"text-gray-900 hover-text-shadow hover:text-green-200 inline-flex no-wrap items-center font-finger-paint",children:["Start Game",(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6 mt-0.5",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.25 4.5l7.5 7.5-7.5 7.5m-6-15l7.5 7.5-7.5 7.5"})})]})}function LobbyBountyForm(){return(0,n.jsxs)("div",{className:"lobby-bounty-sign",children:[(0,n.jsx)(Bounty,{bountyNumber:1}),(0,n.jsx)(Bounty,{bountyNumber:2}),(0,n.jsx)(Bounty,{bountyNumber:3}),(0,n.jsx)("div",{className:"bounty-sign-option",children:(0,n.jsx)(StartGameForm,{})})]})}function Bounty(e){let t=(0,r.Y)(e=>e.LobbyDetails),a="off";if((0,l.useEffect)(()=>{let a="off";if(null!=t){switch(e.bountyNumber){case 1:a=t.bounty_one;break;case 2:a=t.bounty_two;break;case 3:a=t.bounty_three;break;default:a="off"}setTimeout(()=>{let t=document.getElementById("bounty-select-"+e.bountyNumber);null!=t&&(t.value=a)},100)}},[t,e.bountyNumber]),null!=t){switch(e.bountyNumber){case 1:a=t.bounty_one;break;case 2:a=t.bounty_two;break;case 3:a=t.bounty_three}return(0,n.jsxs)("div",{className:"font-spray-paint no-wrap font-normal w-full text-gray-800 bounty-sign-option",children:["Challenge #",e.bountyNumber,(0,n.jsx)("br",{}),(0,n.jsxs)("select",{id:"bounty-select-"+e.bountyNumber,onChange:e=>{UpdateBountyForm(e,t)},"data-bounty-number":e.bountyNumber,className:"bounty-select font-flower capitalize bg-transparent",defaultValue:a,children:[(0,n.jsx)("option",{value:"off",children:"Off"}),(0,n.jsx)("option",{value:"one-game",children:"One Game"}),(0,n.jsx)("option",{value:"short",children:"Short"}),(0,n.jsx)("option",{value:"medium",children:"Medium"}),(0,n.jsx)("option",{value:"long",children:"Long"})]})]})}}function BountyBoard(){return(0,n.jsx)("div",{className:"w-full flex justify-center ml-20",children:(0,n.jsxs)("div",{className:"pointer-events-auto bounty-container grid grid-cols-3",children:[(0,n.jsx)(DisplayBounty,{bountyNumber:1}),(0,n.jsx)(DisplayBounty,{bountyNumber:2}),(0,n.jsx)(DisplayBounty,{bountyNumber:3})]})})}function DisplayBounty(e){let t=(0,r.Y)(e=>e.MemberId),a=(0,r.Y)(e=>e.LobbyDetails),l=(0,r.Y)(e=>e.ChallengeDetails),o=(0,r.Y)(e=>e.ChallengesToIntroduce),i=(0,s.f)(e=>e.SimpleLayout);if(null==a||null==t||null==l)return;let d=l.filter(a=>a.member_id==t&&a.bounty_number==e.bountyNumber)[0];if(null==d||!i&&null!=o&&o.filter(e=>e.id==d.id).length>0)return(0,c.Empty)();let u="One Game Only";if(d.task.challenge_length>1){let e=d.task.challenge_length,t=d.games.length;u=t==e?"Last Chance!":t+" of "+e}return(0,n.jsx)("a",{href:"#",onClick:e=>{e.preventDefault();let t=e.currentTarget;if(t.classList.contains("large-bounty")){t.classList.remove("large-bounty");return}t.classList.add("large-bounty")},children:(0,n.jsx)("div",{className:"in-game-bounty-wood col-span-1 items-center justify-center align-middle flex",children:(0,n.jsxs)("div",{className:"in-game-bounty-display drop-shadow-2xl font-rye text-white text-center",children:[(0,n.jsx)("h2",{className:"text-shadow",children:u}),(0,n.jsx)("p",{className:"overflow-hidden text-left font-flower text-gray-700",children:d.phrase}),(0,n.jsx)(BountyActionButtons,{thisBounty:d}),(0,n.jsx)(BountyResult,{was_completed:d.was_completed,was_failed:d.was_failed})]})})})}function BountyResult(e){let t=(0,s.f)(e=>e.SimpleLayout);if(t){if(e.was_completed)return(0,n.jsx)("div",{className:"w-full text-white justify-center text-center bg-green-700 border-b-4 border-green-800 p-2 font-finger-paint text-xl",children:"Completed!"});if(e.was_failed)return(0,n.jsx)("div",{className:"w-full text-white justify-center text-center bg-orange-700 border-b-4 border-orange-800 p-2 font-finger-paint text-xl",children:"Failed!"})}return e.was_completed?(0,n.jsx)("div",{className:"challenge-status w-full text-green-400 text-shadow justify-center text-center",children:"Completed!"}):e.was_failed?(0,n.jsx)("div",{className:"challenge-status w-full text-red-400 text-shadow justify-center text-center",children:"Failed!"}):void 0}function BountyActionButtons(e){let t=(0,s.f)(e=>e.SimpleLayout),a=!1,l=e.thisBounty;if("incremental"==l.task.challenge_type&&l.increment_counter{e.preventDefault();let t=e.currentTarget.getAttribute("data-challenge-key");null!=t&&(0,o.db)(parseInt(t)).then(e=>{console.log(e)})},IncrementBounty=e=>{e.preventDefault();let t=e.currentTarget.getAttribute("data-challenge-key");null!=t&&(0,o.K_)(parseInt(t)).then(e=>{console.log(e)})},FailBounty=e=>{e.preventDefault();let t=e.currentTarget.getAttribute("data-challenge-key");null!=t&&(0,o.lo)(parseInt(t)).then(e=>{})};return t?(0,n.jsxs)("div",{className:"w-full grid grid-cols-2 gap-0 text-white font-permanent-marker text-xl ",children:[(0,n.jsxs)("button",{"data-challenge-key":l.id,onClick:FailBounty,className:"bg-red-800 border-b-4 border-red-900 flex items-center justify-center",children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6 mr-2 mt-1 ",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"Fail Task"]}),a?(0,n.jsxs)("button",{"data-challenge-key":l.id,onClick:IncrementBounty,className:"p-2 bg-cyan-800 border-b-4 border-cyan-900 flex items-center justify-center",children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6 mr-2 mt-1 ",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v6m3-3H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Increment (",l.increment_counter,"/",l.task.counter_goal,")"]}):(0,n.jsxs)("button",{"data-challenge-key":l.id,onClick:CompleteBounty,className:"p-2 bg-green-800 border-b-4 border-green-900 flex items-center justify-center",children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6 mr-2 mt-1",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),"Complete"]})]}):(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-0 button-container items-center",children:[(0,n.jsxs)("button",{"data-challenge-key":l.id,onClick:FailBounty,className:"col-span-1 bg-transparent text-shadow hover-text-shadow hover:text-red-900 p-2 items-center inline-flex text-red-300 justify-end mr-2",children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6 text-red-900",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),"Fail Task"]}),a?(0,n.jsxs)("button",{"data-challenge-key":l.id,onClick:IncrementBounty,className:"col-span-1 bg-transparent items-center text-shadow hover-text-shadow hover:text-blue-800 p-2 inline-flex text-blue-300 justify-start",children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6 text-blue-800",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v6m3-3H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Increment"]}):(0,n.jsxs)("button",{"data-challenge-key":l.id,onClick:CompleteBounty,className:"col-span-1 bg-transparent items-center text-shadow hover-text-shadow hover:text-green-800 p-2 inline-flex text-green-300 justify-start",children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6 text-green-900",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),"Complete"]})]})}var d=a(1909);function MemberList(){let e=(0,r.Y)(e=>e.LobbyDetails);return null==e?UnexpectedConditionRefresh():(0,n.jsxs)("div",{className:"text-white",children:[(0,n.jsx)("div",{className:"w-full simple-layout-members p-2 bg-cyan-700 border-b-4 border-cyan-800 font-flower text-2xl",children:(0,n.jsx)(PlayerStatus,{playerNumber:1})}),e.active_members.length>1?(0,n.jsx)("div",{className:"w-full simple-layout-members p-2 bg-orange-700 border-b-4 border-orange-800 font-flower text-2xl items-end",children:(0,n.jsx)(PlayerStatus,{playerNumber:2})}):null,e.active_members.length>2?(0,n.jsx)("div",{className:"w-full simple-layout-members p-2 bg-emerald-700 border-b-4 border-emerald-800 font-flower text-2xl items-end",children:(0,n.jsx)(PlayerStatus,{playerNumber:3})}):null,e.active_members.length>3?(0,n.jsx)("div",{className:"w-full simple-layout-members p-2 bg-pink-700 border-b-4 border-pink-800 font-flower text-2xl items-end",children:(0,n.jsx)(PlayerStatus,{playerNumber:4})}):null]})}function BountySettings(){return(0,n.jsxs)("div",{children:[(0,n.jsx)(BountySettings_Bounty,{bountyNumber:1}),(0,n.jsx)(BountySettings_Bounty,{bountyNumber:2}),(0,n.jsx)(BountySettings_Bounty,{bountyNumber:3})]})}function BountySettings_Bounty(e){let t=(0,r.Y)(e=>e.LobbyDetails),a="off";if((0,l.useEffect)(()=>{let a="off";if(null!=t){switch(e.bountyNumber){case 1:a=t.bounty_one;break;case 2:a=t.bounty_two;break;case 3:a=t.bounty_three;break;default:a="off"}setTimeout(()=>{let t=document.getElementById("bounty-select-"+e.bountyNumber);null!=t&&(t.value=a)},100)}},[t,e.bountyNumber]),null==t)return;let s="border-cyan-800 bg-cyan-700";switch(e.bountyNumber){case 1:a=t.bounty_one;break;case 2:a=t.bounty_two,s="border-orange-800 bg-orange-700";break;case 3:a=t.bounty_three,s="border-yellow-800 bg-yellow-700"}return(0,n.jsxs)("div",{className:"w-full",children:[(0,n.jsxs)("h3",{className:"w-full p-2 border-b-4 text-gray-200 text-center text-2xl font-creepster "+s,children:["Bounty #",e.bountyNumber]}),(0,n.jsx)("div",{className:"w-full m-auto text-2xl p-4 text-gray-900 bg-white border-b-4 border-gray-200 justify-center flex",children:null==t.active_game?(0,n.jsxs)("select",{id:"bounty-select-"+e.bountyNumber,"data-bounty-number":e.bountyNumber,onChange:e=>{UpdateBountyForm(e,t)},className:"w-1/2 font-flower capitalize bg-transparent text-center",defaultValue:a,children:[(0,n.jsx)("option",{className:"text-gray-900",value:"off",children:"Off"}),(0,n.jsx)("option",{className:"text-gray-900",value:"one-game",children:"One Game"}),(0,n.jsx)("option",{className:"text-gray-900",value:"short",children:"Short"}),(0,n.jsx)("option",{className:"text-gray-900",value:"medium",children:"Medium"}),(0,n.jsx)("option",{className:"text-gray-900",value:"long",children:"Long"})]}):(0,n.jsx)("div",{className:"w-full font-flower capitalize bg-transparent text-center",children:a})})]})}function MapSettings(){let e=(0,r.Y)(e=>e.LobbyDetails);return null==e?UnexpectedConditionRefresh():(ActivateMapButton(e.selected_map),(0,n.jsxs)("div",{className:"simple-layout-map-settings",children:[(0,n.jsx)("h2",{className:"capitalize p-1 font-permanent-marker text-2xl bg-gray-600 text-left",children:(0,n.jsxs)("div",{className:"w-full flex items-center justify-center text-green-300",children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6 mr-2",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 6.75V15m6-6v8.25m.503 3.498l4.875-2.437c.381-.19.622-.58.622-1.006V4.82c0-.836-.88-1.38-1.628-1.006l-3.869 1.934c-.317.159-.69.159-1.006 0L9.503 3.252a1.125 1.125 0 00-1.006 0L3.622 5.689C3.24 5.88 3 6.27 3 6.695V19.18c0 .836.88 1.38 1.628 1.006l3.869-1.934c.317-.159.69-.159 1.006 0l4.994 2.497c.317.158.69.158 1.006 0z"})}),(0,n.jsx)(MapName,{map_name:e.selected_map})]})}),(0,n.jsxs)("button",{onClick:t=>ChangeMap(t,e),"data-map-name":"tanglewood",className:"w-full bg-emerald-100 hover:text-emerald-200 hover:bg-emerald-600 p-2 grid grid-cols-5",children:[(0,n.jsx)("div",{className:"col-span-1 w-full"}),(0,n.jsx)("div",{className:"col-span-3 w-full text-left",children:"Tanglewood Drive"}),(0,n.jsx)("div",{className:"col-span-1"})]}),(0,n.jsxs)("button",{onClick:t=>ChangeMap(t,e),"data-map-name":"ridgeview",className:"w-full bg-rose-100 hover:text-rose-200 hover:bg-rose-600 p-2 grid grid-cols-5",children:[(0,n.jsx)("div",{className:"col-span-1 w-full"}),(0,n.jsx)("div",{className:"col-span-3 w-full text-left",children:"Ridgeview Court"}),(0,n.jsx)("div",{className:"col-span-1"})]}),(0,n.jsxs)("button",{onClick:t=>ChangeMap(t,e),"data-map-name":"willow",className:"w-full bg-teal-100 hover:text-teal-200 hover:bg-teal-600 p-2 grid grid-cols-5",children:[(0,n.jsx)("div",{className:"col-span-1 w-full"}),(0,n.jsx)("div",{className:"col-span-3 w-full text-left",children:"Willow Street"}),(0,n.jsx)("div",{className:"col-span-1"})]}),(0,n.jsxs)("button",{onClick:t=>ChangeMap(t,e),"data-map-name":"edgefield",className:"w-full bg-pink-100 hover:text-pink-200 hover:bg-pink-600 p-2 grid grid-cols-5",children:[(0,n.jsx)("div",{className:"col-span-1 w-full"}),(0,n.jsx)("div",{className:"col-span-3 w-full text-left",children:"Edgefield Road"}),(0,n.jsx)("div",{className:"col-span-1"})]}),(0,n.jsxs)("button",{onClick:t=>ChangeMap(t,e),"data-map-name":"bleasdale",className:"w-full bg-purple-100 hover:text-purple-200 hover:bg-purple-600 p-2 grid grid-cols-5",children:[(0,n.jsx)("div",{className:"col-span-1 w-full"}),(0,n.jsx)("div",{className:"col-span-3 w-full text-left",children:"Bleasdale Farmhouse"}),(0,n.jsx)("div",{className:"col-span-1"})]}),(0,n.jsxs)("button",{onClick:t=>ChangeMap(t,e),"data-map-name":"woodwind",className:"w-full bg-red-100 hover:text-red-200 hover:bg-red-600 p-2 grid grid-cols-5",children:[(0,n.jsx)("div",{className:"col-span-1 w-full"}),(0,n.jsx)("div",{className:"col-span-3 w-full text-left",children:"Camp Woodwind"}),(0,n.jsx)("div",{className:"col-span-1"})]}),(0,n.jsxs)("button",{onClick:t=>ChangeMap(t,e),"data-map-name":"maple",className:"w-full bg-cyan-100 hover:text-cyan-200 hover:bg-cyan-600 p-2 grid grid-cols-5",children:[(0,n.jsx)("div",{className:"col-span-1 w-full"}),(0,n.jsx)("div",{className:"col-span-3 w-full text-left",children:"Maple Lodge Campsite"}),(0,n.jsx)("div",{className:"col-span-1"})]}),(0,n.jsxs)("button",{onClick:t=>ChangeMap(t,e),"data-map-name":"grafton",className:"w-full bg-purple-100 hover:text-purple-200 hover:bg-purple-600 p-2 grid grid-cols-5",children:[(0,n.jsx)("div",{className:"col-span-1 w-full"}),(0,n.jsx)("div",{className:"col-span-3 w-full text-left",children:"Grafton Farmhouse"}),(0,n.jsx)("div",{className:"col-span-1"})]}),(0,n.jsxs)("button",{onClick:t=>ChangeMap(t,e),"data-map-name":"sunny_meadows",className:"w-full bg-orange-100 hover:text-orange-200 hover:bg-orange-600 p-2 grid grid-cols-5",children:[(0,n.jsx)("div",{className:"col-span-1 w-full"}),(0,n.jsx)("div",{className:"col-span-3 w-full text-left",children:"Sunny Meadows"}),(0,n.jsx)("div",{className:"col-span-1"})]}),(0,n.jsxs)("button",{onClick:t=>ChangeMap(t,e),"data-map-name":"highschool",className:"w-full bg-green-100 hover:text-green-200 hover:bg-green-600 p-2 grid grid-cols-5",children:[(0,n.jsx)("div",{className:"col-span-1 w-full"}),(0,n.jsx)("div",{className:"col-span-3 w-full text-left",children:"High School"}),(0,n.jsx)("div",{className:"col-span-1"})]}),(0,n.jsxs)("button",{onClick:t=>ChangeMap(t,e),"data-map-name":"prison",className:"w-full bg-blue-100 hover:text-blue-200 hover:bg-blue-600 p-2 grid grid-cols-5",children:[(0,n.jsx)("div",{className:"col-span-1 w-full"}),(0,n.jsx)("div",{className:"col-span-3 w-full text-left",children:"Prison"}),(0,n.jsx)("div",{className:"col-span-1"})]})]}))}function Challenges(){let e=(0,r.Y)(e=>e.MemberId),t=(0,r.Y)(e=>e.LobbyDetails),a=(0,r.Y)(e=>e.ChallengeDetails);return(console.log(null==a?void 0:a.filter(t=>t.member_id==e)),null==t||null==e||null==a||0==a.filter(t=>t.member_id==e).length)?(0,n.jsx)(NoActiveBounty,{}):(0,n.jsxs)("div",{className:"overflow-y-scroll pb-4",children:[(0,n.jsx)(GetMemberBounty,{bountyNumber:1}),(0,n.jsx)(GetMemberBounty,{bountyNumber:2}),(0,n.jsx)(GetMemberBounty,{bountyNumber:3})]})}function NoActiveBounty(){return(0,n.jsx)("div",{className:"w-full p-5 h-1/2 text-center font-flower text-white text-3xl",children:"No Active Bounty"})}function GetMemberBounty(e){let t=(0,r.Y)(e=>e.MemberId),a=(0,r.Y)(e=>e.LobbyDetails),l=(0,r.Y)(e=>e.ChallengeDetails);if(null==a||null==t||null==l)return(0,c.Empty)();let s=GetMemberBounties(e.bountyNumber,t,l);if(null==s)return(0,c.Empty)();let o=GetBountyTitle(s),i="border-cyan-800 bg-cyan-700";switch(e.bountyNumber){case 1:a.bounty_one;break;case 2:a.bounty_two,i="border-orange-800 bg-orange-700";break;case 3:a.bounty_three,i="border-yellow-800 bg-yellow-700"}return(0,n.jsxs)("div",{className:"w-full",children:[(0,n.jsx)("h3",{className:"w-full p-2 border-b-4 text-gray-200 text-center text-2xl font-permanent-marker "+i,children:o}),(0,n.jsx)("div",{className:"w-full m-auto text-2xl p-4 text-gray-900 bg-white justify-center flex font-flower border-b-4 border-gray-200",children:s.phrase}),(0,n.jsx)(BountyActionButtons,{thisBounty:s}),(0,n.jsx)(BountyResult,{was_completed:s.was_completed,was_failed:s.was_failed})]})}function Section(e){let t=(0,s.f)(e=>e.SimpleLayoutPage);return t!=e.ThisPage?(0,n.jsx)(SectionContentHeader,{ThisPage:e.ThisPage}):(0,c.Empty)()}function SectionContent(){let e=(0,s.f)(e=>e.SimpleLayoutPage);if(null==e)return(0,c.Empty)();switch(e){case s.b.BountySettings:return(0,n.jsx)(BountySettings,{});case s.b.MapSettings:return(0,n.jsx)(MapSettings,{});case s.b.Challenges:return(0,n.jsx)(Challenges,{});case s.b.MemberList:return(0,n.jsx)(MemberList,{})}}function SectionContentHeader(e){let t=(0,s.f)(e=>e.SimpleLayoutPage),a=(0,s.f)(e=>e.SetSimpleLayoutPage);if(null!=t)return(0,c.Empty)();let l=(0,n.jsx)(n.Fragment,{}),r="";switch(e.ThisPage){case s.b.BountySettings:l=(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10"})}),r="bg-yellow-800 border-yellow-900";break;case s.b.MapSettings:l=(0,n.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6",children:[(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 10.5a3 3 0 11-6 0 3 3 0 016 0z"}),(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 10.5c0 7.142-7.5 11.25-7.5 11.25S4.5 17.642 4.5 10.5a7.5 7.5 0 1115 0z"})]}),r="bg-cyan-800 border-cyan-900";break;case s.b.Challenges:l=(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6 mr-2",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19.128a9.38 9.38 0 002.625.372 9.337 9.337 0 004.121-.952 4.125 4.125 0 00-7.533-2.493M15 19.128v-.003c0-1.113-.285-2.16-.786-3.07M15 19.128v.106A12.318 12.318 0 018.624 21c-2.331 0-4.512-.645-6.374-1.766l-.001-.109a6.375 6.375 0 0111.964-3.07M12 6.375a3.375 3.375 0 11-6.75 0 3.375 3.375 0 016.75 0zm8.25 2.25a2.625 2.625 0 11-5.25 0 2.625 2.625 0 015.25 0z"})}),r="bg-orange-800 border-orange-900";break;case s.b.MemberList:l=(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6 mr-2",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19.128a9.38 9.38 0 002.625.372 9.337 9.337 0 004.121-.952 4.125 4.125 0 00-7.533-2.493M15 19.128v-.003c0-1.113-.285-2.16-.786-3.07M15 19.128v.106A12.318 12.318 0 018.624 21c-2.331 0-4.512-.645-6.374-1.766l-.001-.109a6.375 6.375 0 0111.964-3.07M12 6.375a3.375 3.375 0 11-6.75 0 3.375 3.375 0 016.75 0zm8.25 2.25a2.625 2.625 0 11-5.25 0 2.625 2.625 0 015.25 0z"})}),r="bg-purple-800 border-purple-900"}return(0,n.jsxs)("button",{onClick:n=>{n.preventDefault(),t!=e.ThisPage&&a(e.ThisPage)},className:"w-full p-2 text-white font-finger-paint text-shadow text-xl grid grid-cols-5 border-b-4 "+r,children:[(0,n.jsx)("div",{className:"col-span-1 items-center flex justify-center",children:l}),(0,n.jsx)("div",{className:"items-center col-span-3 w-full flex text-left text-xl no-wrap",children:(0,n.jsx)("h3",{children:e.ThisPage})}),(0,n.jsx)("div",{className:"items-center col-span-1 w-full flex justify-end",children:(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"})})})]})}function Header(){let e=(0,s.f)(e=>e.SimpleLayoutPage),t=(0,s.f)(e=>e.SimpleLayoutTitle);return(0,n.jsxs)("div",{className:"w-full bg-gray-700 p-2 text-white items-center grid grid-cols-5 border-gray-800 border-b-4",children:[(0,n.jsx)("div",{className:"items-center col-span-1 w-full flex justify-center",children:(0,n.jsx)(BackButton,{})}),(0,n.jsx)("div",{className:"items-center col-span-3 w-full flex justify-center",children:(0,n.jsx)("h3",{className:"font-finger-paint text-shadow text-2xl",children:t})}),(0,n.jsx)("div",{className:"items-center col-span-1 w-full flex justify-end",children:null!=e?(0,n.jsx)(CloseButton,{}):null})]})}function Footer(){let e=(0,r.Y)(e=>e.MemberId),t=(0,r.Y)(e=>e.LobbyDetails);if(null==t||null==e)return;let a=t.active_members.filter(t=>t.id==e).pop();if(null!=a)return(0,n.jsxs)("div",{className:"absolute bottom-0 w-full",children:[(0,n.jsx)(StartGame,{}),(0,n.jsx)(EndGame,{}),(0,n.jsxs)("div",{className:"w-full bg-gray-700 p-2 text-white items-center grid grid-cols-5 border-t-4 border-gray-800",children:[(0,n.jsx)("div",{className:"col-span-1"}),(0,n.jsx)("div",{className:"col-span-3 w-full flex text-2xl font-flower items-center justify-end pt-2",children:(0,n.jsx)("h3",{children:a.display_name})}),(0,n.jsx)("div",{className:"items-center col-span-1 w-full flex justify-end",children:(0,n.jsx)(ProfileArea,{LobbyMember:a})})]})]})}let Components_SelectOptionsText=()=>(0,n.jsx)("div",{className:"w-full flex justify-center text-xl bg-pink-700 p-2 text-gray-300 border-pink-800 border-t-4",children:(0,n.jsx)("h3",{children:"Select A Bounty To Begin"})});function StartGame(){let e=(0,r.Y)(e=>e.LobbyDetails),t=(0,i.Xo)(e=>e.setDetails),a=(0,i.Xo)(e=>e.setVisible);return null==e||null!=e.active_game?(0,c.Empty)():"off"==e.bounty_one&&"off"==e.bounty_two&&"off"==e.bounty_three?(0,n.jsx)(Components_SelectOptionsText,{}):(0,n.jsxs)("button",{onClick:e=>{e.preventDefault(),HandleStartGameButton(t,a)},className:"w-full flex justify-center text-xl bg-green-700 p-2 text-gray-100 border-t-4 border-green-800",children:[(0,n.jsx)("h3",{children:"Start Game"}),(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6 mt-0.5",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.25 4.5l7.5 7.5-7.5 7.5m-6-15l7.5 7.5-7.5 7.5"})})]})}function EndGame(){let e=(0,r.Y)(e=>e.LobbyDetails),t=(0,i.Xo)(e=>e.setDetails),a=(0,i.Xo)(e=>e.setVisible);return null==e||null==e.active_game?(0,c.Empty)():(0,n.jsxs)("button",{onClick:n=>{n.preventDefault(),HandleEndGameButton(e,t,a)},className:"w-full flex justify-center text-2xl items-center bg-red-700 text-gray-300 p-2 font-permanent-marker border-t-4 border-red-800",children:[(0,n.jsx)("h3",{children:"End Game"}),(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6 ml-2",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12l8.954-8.955c.44-.439 1.152-.439 1.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25"})})]})}function ProfileArea(e){let t=(0,r.Y)(e=>e.UpdateEditPlayer),a=e.LobbyMember;return(0,n.jsx)("button",{onClick:()=>{t(!0)},type:"button",className:"text-white bg-transparent text-sm w-8 h-8 inline-flex items-center col-span-1",children:(0,n.jsx)("div",{className:"border-2 border-white w-8 h-8 p-2 rounded-full "+a.character_image})})}function BackButton(){let e=(0,i.Xo)(e=>e.setVisible),t=(0,i.Xo)(e=>e.setDetails),a=(0,r.Y)(e=>e.UpdateLobbyDetails),l=(0,r.Y)(e=>e.SetMemberId);return(0,n.jsxs)("button",{onClick:n=>{n.preventDefault(),LeaveLobby(l,a,t,e)},type:"button",className:"text-white bg-transparent hover:text-blue-200 text-sm w-8 h-8 inline-flex items-center col-span-1",children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 9V5.25A2.25 2.25 0 0013.5 3h-6a2.25 2.25 0 00-2.25 2.25v13.5A2.25 2.25 0 007.5 21h6a2.25 2.25 0 002.25-2.25V15M12 9l-3 3m0 0l3 3m-3-3h12.75"})}),(0,n.jsx)("span",{className:"sr-only",children:"Go Back"})]})}function CloseButton(){let e=(0,s.f)(e=>e.SetSimpleLayoutPage);return(0,n.jsxs)("button",{onClick:t=>{t.preventDefault(),e(null)},type:"button",className:"bg-transparent text-gray-200 hover:text-white text-sm w-8 h-8 inline-flex items-center",children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),(0,n.jsx)("span",{className:"sr-only",children:"Close modal"})]})}function DisplaySimpleLayout(){let e=(0,s.f)(e=>e.SetSimpleLayoutTitle),t=(0,s.f)(e=>e.SimpleLayoutPage),a=(0,r.Y)(e=>e.LobbyDetails);return(0,l.useEffect)(()=>{if(null!=a){if(null!=t){e(t);return}if(null!=a.active_game){e("In Game");return}e("Lobby")}},[e,a,t]),(0,n.jsxs)("div",{className:"w-full h-full overflow-hidden bg-gray-900",children:[(0,n.jsx)(Header,{}),(0,n.jsxs)("div",{className:"simple-body",children:[(0,n.jsx)(SectionContent,{}),(0,n.jsx)(Section,{ThisPage:s.b.Challenges}),(0,n.jsx)(Section,{ThisPage:s.b.BountySettings}),(0,n.jsx)(Section,{ThisPage:s.b.MapSettings}),(0,n.jsx)(Section,{ThisPage:s.b.MemberList})]}),(0,n.jsx)(Footer,{})]})}let u={Bounty1:null,Bounty2:null,Bounty3:null};function UpdateTracker(e,t){switch(e){case 1:u.Bounty1=t;break;case 2:u.Bounty2=t;break;case 3:u.Bounty3=t}}function ChallengeHandler(){(0,s.f)(e=>e.Muted);let e=(0,s.f)(e=>e.SimpleLayout),t=(0,s.f)(e=>e.SetSimpleLayoutPage);(0,i.Xo)(e=>e.setVisible),(0,i.Xo)(e=>e.setDetails);let a=(0,r.Y)(e=>e.LobbyDetails),l=(0,r.Y)(e=>e.UpdateChallengeDetails),m=(0,r.Y)(e=>e.ChallengesToIntroduce),h=(0,r.Y)(e=>e.UpdateChallengesToIntroduce);if(null!=a)return((0,d.StartListening)("lobby."+a.id,".lobby.challenges",e=>{console.log("Could not listen to challenge WS."),console.log(e)},a=>{(0,o.IY)().then(a=>{var n,r,o;let i=a.data.assigned_tasks,c=null!=m?m:[],d=ProcessBountyChange(1,null!==(n=i.filter(e=>e.member_id&&1==e.bounty_number)[0])&&void 0!==n?n:null);null!=d&&c.push(d);let u=ProcessBountyChange(2,null!==(r=i.filter(e=>e.member_id&&2==e.bounty_number)[0])&&void 0!==r?r:null);null!=u&&c.push(u);let x=ProcessBountyChange(3,null!==(o=i.filter(e=>e.member_id&&3==e.bounty_number)[0])&&void 0!==o?o:null);null!=x&&c.push(x),l(i),h(c),e&&c.length>0&&t(s.b.Challenges)}).catch(e=>{console.log(e)})}),null!==m&&m.length>0)?(0,n.jsx)(ChallengeIntro,{}):(0,n.jsx)(c.Empty,{});function ProcessBountyChange(e,t){let a=u.Bounty1;return(2==e&&(a=u.Bounty2),3==e&&(a=u.Bounty3),null==t&&null!=a)?(UpdateTracker(e,null),null):null==t||a==t.id?null:(UpdateTracker(e,t.id),null!=m&&m.filter(e=>e.id==t.id).length>0)?null:t}}function ChallengeIntro(){let e=(0,r.Y)(e=>e.ChallengesToIntroduce),t=(0,r.Y)(e=>e.UpdateChallengesToIntroduce);if(null!=e)return(0,n.jsxs)("div",{className:"w-full h-full relative overflow-hidden",children:[(0,n.jsx)(NotificationAlert,{}),(0,n.jsx)("div",{className:"intro-bg w-full h-full absolute top-0 left-0 z-30"}),(0,n.jsxs)("button",{onClick:e=>{e.preventDefault(),t(null)},className:"w-full h-full absolute top-0 left-0 z-50",children:[(0,n.jsx)("div",{className:"intro-text text-center justify-center flex text-white text-shadow font-finger-paint items-center text-5xl",children:(0,n.jsxs)("div",{children:["Your new ",e.length>1?"challenges await":"challenge awaits"]})}),(0,n.jsx)("div",{className:"intro-reveal text-center justify-center flex items-center text-3xl font-flower text-white capitalize text-shadow",children:"Click here to reveal..."})]})]})}function LobbyHome(){let e=(0,r.Y)(e=>e.LobbyDetails),t=(0,r.Y)(e=>e.MemberId),a=(0,s.f)(e=>e.SimpleLayout),l=(0,s.f)(e=>e.SetPreloaderActive),o=(0,r.Y)(e=>e.UpdateLobbyDetails);(0,r.Y)(e=>e.UpdateChallengeDetails);let i=(0,r.Y)(e=>e.UpdateGameDetails);return((0,r.Y)(e=>e.SetMemberId),null==e||null==t)?UnexpectedConditionRefresh():((0,d.TrackPresence)(t,()=>{console.log("Leaving Presence Channel")}),(0,d.StartListening)("lobby."+e.id,".lobby.updated",e=>{console.log(e)},e=>{if(o(e),null==e.active_game){i(null);return}null!=e.active_game.details&&(i(JSON.parse(e.active_game.details)),l(!1))}),a)?(0,n.jsx)(RenderSimpleLayout,{}):(0,n.jsxs)("div",{className:"w-full h-full",children:[(0,n.jsx)(ChallengeHandler,{}),(0,n.jsx)(BountyBoard,{}),(0,n.jsx)(PlayerBoard,{}),(0,n.jsx)(BulletinBoard,{}),(null==e?void 0:e.active_game)==null?(0,n.jsx)(LobbyBountyForm,{}):(0,n.jsx)(EndGameForm,{})]})}function RenderSimpleLayout(){return(0,n.jsxs)("div",{className:"w-full h-full",children:[(0,n.jsx)(ChallengeHandler,{}),(0,n.jsx)(DisplaySimpleLayout,{})]})}function MainContent(){let e=(0,r.Y)(e=>e.MemberId),t=(0,r.Y)(e=>e.SetMemberId),a=(0,r.Y)(e=>e.UpdateLobbyDetails),i=(0,r.Y)(e=>e.UpdateGameDetails),c=(0,s.f)(e=>e.SetPreloaderActive),u=(0,r.Y)(e=>e.UpdateChallengeDetails);return(0,l.useEffect)(()=>{let UpdateState=(e,n)=>{var l,r,s,o,d,m,h;t(e),a(n),null!=n.assigned_tasks&&n.assigned_tasks.length>0&&(UpdateTracker(1,null!==(o=null===(l=n.assigned_tasks.filter(e=>e.member_id&&1==e.bounty_number)[0])||void 0===l?void 0:l.id)&&void 0!==o?o:null),UpdateTracker(2,null!==(d=null===(r=n.assigned_tasks.filter(e=>e.member_id&&2==e.bounty_number)[0])||void 0===r?void 0:r.id)&&void 0!==d?d:null),UpdateTracker(3,null!==(m=null===(s=n.assigned_tasks.filter(e=>e.member_id&&3==e.bounty_number)[0])||void 0===s?void 0:s.id)&&void 0!==m?m:null)),u(null!==(h=n.assigned_tasks)&&void 0!==h?h:null),null==n.active_game||null==n.active_game.details?i(null):i(JSON.parse(n.active_game.details)),c(!1)},ClearActiveSession=()=>{(0,o.eq)(),(0,d.DisconnectNotification)(),t(null),a(null),c(!1)};null==(0,o.YT)()&&ClearActiveSession(),(0,o.iF)().then(e=>{if(console.log(e.data),!e.data.auth_status||null==e.data.member_id||null==e.data.lobby)return ClearActiveSession();UpdateState(e.data.member_id,e.data.lobby)}).catch(()=>{console.log("Unexpect error fetching status")})},[t,c,u,i,a]),null==e?(0,n.jsx)(JoinLobbyForm,{}):(0,n.jsx)(LobbyHome,{})}},3815:function(e,t,a){"use strict";a.r(t),a.d(t,{EditPlayerForm:function(){return EditPlayerForm}});var n=a(7437);a(2265);var l=a(9018),r=a(6817);function EditPlayerForm(){let e=(0,l.Y)(e=>e.EditPlayerVisible),t=(0,l.Y)(e=>e.UpdateEditPlayer),a=(0,l.Y)(e=>e.MemberId),s=(0,l.Y)(e=>e.LobbyDetails);if(null==s||null==a)return;let UpdateCharacter=e=>{e.preventDefault();let t=e.currentTarget.getAttribute("data-character-name");null!=t&&(0,r._t)({character_image:t}).then(e=>{})},o=s.active_members.filter(e=>e.id==a)[0];if(null!=o&&(setTimeout(()=>{s.active_members.forEach(e=>{let t=document.getElementsByClassName(e.character_image)[0];null!=t&&(t.setAttribute("disabled","true"),a==e.id&&t.classList.add("active-player"))})},1e3),e))return(0,n.jsx)("div",{className:"justify-center mt-20 flex overflow-x-hidden overflow-y-auto fixed inset-0 z-50 outline-none focus:outline-none",children:(0,n.jsx)("div",{className:"relative w-auto mx-auto max-w-4xl",children:(0,n.jsxs)("div",{className:"border-0 shadow-lg relative flex flex-col w-full bg-white outline-none focus:outline-none",children:[(0,n.jsxs)("div",{className:"justify-between inline-flex border-b border-solid border-blueGray-200 bg-blue-600 items-center text-gray-100 font-medium font-overpass p-1",children:["Edit Player Information",(0,n.jsxs)("button",{type:"button",className:"text-gray-100 bg-transparent hover:text-gray-900 text-sm ml-auto inline-flex ",onClick:()=>{t(!1)},children:[(0,n.jsx)("svg",{className:"w-3 h-3 mr-1 mb-1","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 14 14",children:(0,n.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"})}),(0,n.jsx)("span",{className:"sr-only",children:"Close modal"})]})]}),(0,n.jsxs)("div",{id:"modal-content",children:[(0,n.jsxs)("form",{onSubmit:e=>{e.preventDefault();let t=new FormData(e.currentTarget),a=t.get("display-name");null!=a&&(0,r._t)({display_name:a.toString()}).then(e=>{})},className:"p-2 inline-flex",children:[(0,n.jsx)("input",{defaultValue:o.display_name,name:"display-name",placeholder:"Display Name",className:" bg-gray-100 border-gray-300 text-gray-900 text-sm block focus:bg-white w-full eading-tight p-1"}),(0,n.jsx)("button",{type:"submit",className:"bg-green-500 w-8 h-full p-1 text-gray-100 hover:bg-green-800 hover:text-gray-300 display-name-update",children:(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.348a1.125 1.125 0 010 1.971l-11.54 6.347a1.125 1.125 0 01-1.667-.985V5.653z"})})})]}),(0,n.jsx)("div",{className:"w-full",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"block text-gray-700 text-sm ml-2 font-overpass",children:"Select Your Character"}),(0,n.jsxs)("div",{className:"grid grid-cols-4 gap-2 p-2 items-center align-middle justify-center",children:[(0,n.jsx)("button",{onClick:UpdateCharacter,"data-character-name":"dude-one",className:"dude-one edit-player-character border-2 border-gray-800 hover:border-green-300"}),(0,n.jsx)("button",{onClick:UpdateCharacter,"data-character-name":"dude-two",className:"dude-two edit-player-character border-2 border-gray-800 hover:border-green-300"}),(0,n.jsx)("button",{onClick:UpdateCharacter,"data-character-name":"dude-three",className:"dude-three edit-player-character border-2 border-gray-800 hover:border-green-300"}),(0,n.jsx)("button",{onClick:UpdateCharacter,"data-character-name":"dude-four",className:"dude-four edit-player-character border-2 border-gray-800 hover:border-green-300"}),(0,n.jsx)("button",{onClick:UpdateCharacter,"data-character-name":"women-one",className:"women-one edit-player-character border-2 border-gray-800 hover:border-green-300"}),(0,n.jsx)("button",{onClick:UpdateCharacter,"data-character-name":"women-two",className:"women-two edit-player-character border-2 border-gray-800 hover:border-green-300"}),(0,n.jsx)("button",{onClick:UpdateCharacter,"data-character-name":"women-three",className:"women-three edit-player-character border-2 border-gray-800 hover:border-green-300"}),(0,n.jsx)("button",{onClick:UpdateCharacter,"data-character-name":"women-four",className:"women-four edit-player-character border-2 border-gray-800 hover:border-green-300"})]})]})})]})]})})})}},6421:function(e,t,a){"use strict";a.r(t),a.d(t,{Preloader:function(){return Preloader}});var n=a(7437),l=a(6034);function Preloader(){let e=(0,l.f)(e=>e.PreLoaderActive);if(e)return(0,n.jsx)("div",{id:"preloader-bg",className:"w-full h-full absolute z-50 left-0 top-0 bg-gray-900",children:(0,n.jsxs)("div",{className:"w-full h-full justify-center grid grid-cols-1 gap-0 items-end",children:[(0,n.jsx)("div",{className:"w-full h-1/2 p-5 preloader-icon justify-start"}),(0,n.jsx)("div",{className:"w-full font-flower text-4xl text-white text-center justify-start h-full",children:"Please Wait."})]})})}a(2265)},4250:function(e,t,a){"use strict";a.r(t),a.d(t,{SimpleLayoutContainer:function(){return SimpleLayoutContainer}});var n=a(7437),l=a(9018),r=a(6034),s=a(2265),o=a(4407);function SimpleLayoutContainer(){let e;let t=(0,l.Y)(e=>e.LobbyDetails),a=(0,r.f)(e=>e.SimpleLayout),i=(0,r.f)(e=>e.SetSimpleLayout);e=window.innerWidth,(0,s.useEffect)(()=>{e<=800&&sessionStorage.setItem("PhasGameLayout","simple"),"simple"==sessionStorage.getItem("PhasGameLayout")?i(!0):i(!1)},[i,e]);let ToggleSimpleLayout=()=>{null!=t&&(a?sessionStorage.setItem("PhasGameLayout","default"):sessionStorage.setItem("PhasGameLayout","simple"),window.location.reload())};return null==t?(0,o.Empty)():e<=800?void 0:a?(0,n.jsx)("a",{onClick:ToggleSimpleLayout,href:"#",className:"absolute left-2 bottom-2 text-sm text-white font-overpass hover:text-blue-300 hover-text-shadow",children:"Default Layout"}):(0,n.jsx)("a",{onClick:ToggleSimpleLayout,href:"#",className:"absolute left-2 bottom-2 text-sm text-white font-overpass hover:text-blue-300 hover-text-shadow",children:"Simple Layout"})}},4407:function(e,t,a){"use strict";a.r(t),a.d(t,{Background:function(){return Background},BackgroundOptions:function(){return l},Empty:function(){return Empty},Footer:function(){return Footer}});var n,l,r=a(7437),s=a(2265),o=a(8703),i=a(9018),c=a(6034);function Footer(){let e=(0,c.f)(e=>e.SimpleLayout);return(0,r.jsx)("footer",{children:e?null:(0,r.jsx)("div",{className:"footer-pull-right text-center",children:(0,r.jsx)(o.ModalButton,{})})})}function SetBackground(e){document.body.classList.contains(e)||(console.log("Setting background to "+e),document.body.classList.value="",document.body.classList.add(e))}function Background(){let e=(0,i.Y)(e=>e.LobbyDetails),t=(0,c.f)(e=>e.SimpleLayout);return(0,s.useEffect)(()=>{if(null==e){SetBackground("homepage-background");return}if(t){SetBackground("simple-layout-background");return}if(null==e.active_game){SetBackground("lobby-background");return}SetBackground("in-game-background")},[e,t]),Empty()}function Empty(){return(0,r.jsx)(r.Fragment,{})}(n=l||(l={})).Lobby="lobby-background",n.InGame="in-game-background",n.HomeScreen="homepage-background",n.SimpleLayout="simple-layout-background"},6034:function(e,t,a){"use strict";a.d(t,{b:function(){return l},f:function(){return s}});var n,l,r=a(4660);let s=(0,r.Ue)()(e=>({PreLoaderActive:!0,SimpleLayout:!1,Muted:!1,ShowIntro:!1,SimpleLayoutPage:null,SimpleLayoutTitle:"",SetPreloaderActive:t=>e(()=>({PreLoaderActive:t})),MuteNotifications:t=>e(()=>({Muted:t})),ShouldShowIntro:t=>e(()=>({ShowIntro:t})),SetSimpleLayout:t=>e(()=>({SimpleLayout:t})),SetSimpleLayoutTitle:t=>e(()=>({SimpleLayoutTitle:t})),SetSimpleLayoutPage:t=>e(()=>({SimpleLayoutPage:t}))}));(n=l||(l={})).MemberList="Member List",n.BountySettings="Bounty Settings",n.MapSettings="Map Settings",n.Challenges="Your Bounties"},9018:function(e,t,a){"use strict";a.d(t,{Y:function(){return l}});var n=a(4660);let l=(0,n.Ue)()(e=>({LobbyDetails:null,ChallengeDetails:null,ChallengesToIntroduce:null,MemberId:null,SelectedMap:null,EditPlayerVisible:!1,GameDetails:null,UpdateEditPlayer:t=>e(()=>({EditPlayerVisible:t})),SetMemberId:t=>e(()=>({MemberId:t})),UpdateLobbyDetails:t=>e(()=>({LobbyDetails:t})),UpdateChallengeDetails:t=>e(()=>({ChallengeDetails:t})),UpdateChallengesToIntroduce:t=>e(()=>({ChallengesToIntroduce:t})),SetMap:t=>e(()=>({SelectedMap:t})),UpdateGameDetails:t=>e(()=>({GameDetails:t}))}))},6651:function(e,t,a){"use strict";a.d(t,{Xo:function(){return i},iB:function(){return s},j_:function(){return r}});var n,l,r,s,o=a(4660);a(2265);let i=(0,o.Ue)()(e=>({visible:!1,details:null,setVisible:t=>e(()=>({visible:t})),setDetails:t=>e(()=>({details:t}))}));(n=r||(r={}))[n.Confirmation=0]="Confirmation",n[n.Success=1]="Success",n[n.Error=2]="Error",(l=s||(s={}))[l.Success=0]="Success",l[l.Warning=1]="Warning"},6817:function(e,t,a){"use strict";a.d(t,{IY:function(){return FetchChallenges},K_:function(){return IncrementChallengeRequest},L4:function(){return JoinLobbyRequest},Vs:function(){return UpdateTokenCache},YT:function(){return GetToken},Z4:function(){return LeaveLobbyRequest},_t:function(){return UpdateMemberData},db:function(){return CompleteChallengeRequest},eq:function(){return DestroyToken},iF:function(){return FetchStatus},kI:function(){return EndGameRequest},lo:function(){return FailChallengeRequest},mV:function(){return StartGameRequest},uJ:function(){return UpdatePlayerRequest},uf:function(){return UpdateLobbyRequest},xK:function(){return UpdateMuteStatus}});var n=a(9222);let l=null,DestroyToken=()=>{"undefined"!=typeof sessionStorage&&(sessionStorage.removeItem("PhasLobbyToken"),l=null)},UpdateTokenCache=e=>{"undefined"!=typeof sessionStorage&&(sessionStorage.setItem("PhasLobbyToken",e),l=e)},GetToken=()=>"undefined"==typeof sessionStorage?l:l=sessionStorage.getItem("PhasLobbyToken"),API=()=>n.Z.create({baseURL:"https://phasapi.networkglitch.com",withCredentials:!0,headers:{Authorization:"Bearer "+GetToken()}}),FetchCSRFToken=async()=>await API().get("/sanctum/csrf-cookie"),FetchStatus=async()=>(await FetchCSRFToken(),await API().get("/status")),FetchChallenges=async()=>(await FetchCSRFToken(),await API().get("/challenges")),UpdateMuteStatus=async e=>(await FetchCSRFToken(),await API().post("/member/mute",e)),JoinLobbyRequest=async e=>(await FetchCSRFToken(),await API().post("/lobby/join",e)),LeaveLobbyRequest=async()=>(await FetchCSRFToken(),await API().post("/lobby/leave")),UpdateLobbyRequest=async e=>(await FetchCSRFToken(),await API().post("/lobby",e)),UpdatePlayerRequest=async(e,t)=>(await FetchCSRFToken(),await API().post("/game/"+e+"/dead/"+t)),UpdateMemberData=async e=>(await FetchCSRFToken(),await API().post("/lobby/member",e)),StartGameRequest=async()=>(await FetchCSRFToken(),await API().post("/game")),EndGameRequest=async e=>(await FetchCSRFToken(),await API().post("/game/"+e,{end_game:!0})),IncrementChallengeRequest=async e=>(await FetchCSRFToken(),await API().post("/challenge/"+e+"/increment")),CompleteChallengeRequest=async e=>(await FetchCSRFToken(),await API().post("/challenge/"+e+"/complete")),FailChallengeRequest=async e=>(await FetchCSRFToken(),await API().post("/challenge/"+e+"/fail"))},1909:function(e,t,a){"use strict";a.r(t),a.d(t,{DisconnectNotification:function(){return DisconnectNotification},NotificationProvider:function(){return NotificationProvider},ResetWSClient:function(){return ResetWSClient},StartListening:function(){return StartListening},StopListening:function(){return StopListening},TrackPresence:function(){return TrackPresence}});var n=a(7437);a(2265);var l=a(6651);function BaseNotification(){let e=(0,l.Xo)(e=>e.details);if(null==e)return;let t=(0,l.Xo)(e=>e.setDetails),a=(0,l.Xo)(e=>e.setVisible),CloseNotification=()=>{t(null),a(!1)};switch(e.AutoHide&&setTimeout(()=>{t(null),a(!1)},3e3),e.Type){case l.j_.Confirmation:return Confirmation(e);case l.j_.Error:return Error(e);case l.j_.Success:return Success(e)}function Confirmation(e){var t,a,r,s,o;let i="inline-flex justify-center w-full px-2 py-1.5 text-xs font-medium text-center text-white bg-blue-600 rounded-lg hover:bg-blue-900 focus:ring-4 focus:outline-none focus:ring-blue-300";switch(null===(t=e.Buttons)||void 0===t?void 0:t.ConfirmButtonType){case l.iB.Warning:i="inline-flex justify-center w-full px-2 py-1.5 text-xs font-medium text-center text-white bg-red-600 rounded-lg hover:bg-red-900 focus:ring-4 focus:outline-none focus:ring-red-300";break;case l.iB.Success:i="inline-flex justify-center w-full px-2 py-1.5 text-xs font-medium text-center text-white bg-green-600 rounded-lg hover:bg-green-900 focus:ring-4 focus:outline-none focus:ring-green-300"}return(0,n.jsx)("div",{className:"justify-center h-fit mt-20 flex overflow-x-hidden overflow-y-auto fixed inset-0 z-50",children:(0,n.jsx)("div",{id:"toast-interactive",className:"w-full max-w-xs p-4 text-gray-500 bg-white rounded-lg shadow dark:bg-gray-800 dark:text-gray-400",role:"alert",children:(0,n.jsxs)("div",{className:"flex",children:[null==e.Icon?"":(0,n.jsx)("div",{className:"inline-flex items-center justify-center flex-shrink-0 w-8 h-8",children:e.Icon}),(0,n.jsxs)("div",{className:"ml-3 text-sm font-normal",children:[(0,n.jsx)("span",{className:"mb-1 text-sm font-semibold text-gray-900 dark:text-white",children:e.Title}),(0,n.jsx)("div",{className:"mb-2 text-sm font-normal no-wrap",children:e.Message}),(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,n.jsx)("div",{children:(0,n.jsx)("a",{href:"#",onClick:t=>{if(null==e.Buttons){CloseNotification();return}void 0!=e.Buttons.CancelButtonCallback?e.Buttons.CancelButtonCallback()&&CloseNotification():CloseNotification()},className:"inline-flex justify-center w-full px-2 py-1.5 text-xs font-medium text-center text-gray-900 bg-white border border-gray-300 rounded-lg hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-200 dark:bg-gray-600 dark:text-white dark:border-gray-600 dark:hover:bg-gray-700 dark:hover:border-gray-700 dark:focus:ring-gray-700",children:null!==(s=null===(a=e.Buttons)||void 0===a?void 0:a.CancelButtonText)&&void 0!==s?s:"Cancel"})}),(0,n.jsx)("div",{children:(0,n.jsx)("a",{href:"#",onClick:t=>{CloseNotification(),null!=e.Buttons&&void 0!=e.Buttons.ConfirmButtonCallback&&e.Buttons.ConfirmButtonCallback()},className:i,children:null!==(o=null===(r=e.Buttons)||void 0===r?void 0:r.ConfirmButtonText)&&void 0!==o?o:"Continue"})})]})]}),(0,n.jsxs)("button",{onClick:CloseNotification,type:"button",className:"ml-auto -mx-1.5 -my-1.5 bg-white justify-center items-center flex-shrink-0 text-gray-400 hover:text-gray-900 rounded-lg focus:ring-2 focus:ring-gray-300 p-1.5 hover:bg-gray-100 inline-flex h-8 w-8 dark:text-gray-500 dark:hover:text-white dark:bg-gray-800 dark:hover:bg-gray-700","data-dismiss-target":"#toast-message-cta","aria-label":"Close",children:[(0,n.jsx)("span",{className:"sr-only",children:"Close"}),(0,n.jsx)("svg",{className:"w-3 h-3","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 14 14",children:(0,n.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"})})]})]})})})}function Error(e){return(0,n.jsxs)("div",{id:"toast-warning",className:"flex items-center w-full max-w-xs p-4 text-gray-500 bg-white rounded-lg shadow dark:text-gray-400 dark:bg-gray-800 toast-message",role:"alert",children:[(0,n.jsxs)("div",{className:"inline-flex items-center justify-center flex-shrink-0 w-8 h-8 text-orange-500 bg-orange-100 rounded-lg dark:bg-orange-700 dark:text-orange-200",children:[(0,n.jsx)("svg",{className:"w-5 h-5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 20 20",children:(0,n.jsx)("path",{d:"M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM10 15a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm1-4a1 1 0 0 1-2 0V6a1 1 0 0 1 2 0v5Z"})}),(0,n.jsx)("span",{className:"sr-only",children:"Warning icon"})]}),(0,n.jsxs)("div",{className:"ml-3 text-sm font-normal",children:[e.Title,(0,n.jsx)("br",{}),(0,n.jsx)("span",{className:"text-gray-300 font-sm no-wrap",children:e.Message})]}),(0,n.jsxs)("button",{onClick:CloseNotification,type:"button",className:"ml-auto -mx-1.5 -my-1.5 bg-white text-gray-400 hover:text-gray-900 rounded-lg focus:ring-2 focus:ring-gray-300 p-1.5 hover:bg-gray-100 inline-flex items-center justify-center h-8 w-8 dark:text-gray-500 dark:hover:text-white dark:bg-gray-800 dark:hover:bg-gray-700","data-dismiss-target":"#toast-warning","aria-label":"Close",children:[(0,n.jsx)("span",{className:"sr-only",children:"Close"}),(0,n.jsx)("svg",{className:"w-3 h-3","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 14 14",children:(0,n.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"})})]})]})}function Success(e){return(0,n.jsxs)("div",{id:"toast-success",className:"flex items-center w-full max-w-xs p-4 mb-4 text-gray-500 bg-white rounded-lg shadow dark:text-gray-400 dark:bg-gray-800 toast-message",role:"alert",children:[(0,n.jsxs)("div",{className:"inline-flex items-center justify-center flex-shrink-0 w-8 h-8 text-green-500 bg-green-100 rounded-lg dark:bg-green-800 dark:text-green-200",children:[(0,n.jsx)("svg",{className:"w-5 h-5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 20 20",children:(0,n.jsx)("path",{d:"M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5Zm3.707 8.207-4 4a1 1 0 0 1-1.414 0l-2-2a1 1 0 0 1 1.414-1.414L9 10.586l3.293-3.293a1 1 0 0 1 1.414 1.414Z"})}),(0,n.jsx)("span",{className:"sr-only",children:"Check icon"})]}),(0,n.jsxs)("div",{className:"ml-3 text-sm font-normal",children:[e.Title,(0,n.jsx)("br",{}),(0,n.jsx)("span",{className:"text-gray-300 font-sm no-wrap",children:e.Message})]}),(0,n.jsxs)("button",{type:"button",className:"text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 ml-auto inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white",onClick:CloseNotification,children:[(0,n.jsx)("svg",{className:"w-3 h-3","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 14 14",children:(0,n.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"})}),(0,n.jsx)("span",{className:"sr-only",children:"Close modal"})]})]})}}var r=a(7318),s=a(6817),o=a(7965),i=a.n(o);function NotificationProvider(){let e=(0,l.Xo)(e=>e.visible);return e?(0,n.jsx)(BaseNotification,{}):null}let c=null;function ResetWSClient(){null==c||c.leaveAllChannels(),null==c||c.disconnect(),c=null,d=[]}function GetEchoClient(){let e={broadcaster:"pusher",key:"f17cfd80679e9714df4a",cluster:"us2",forceTLS:!0,encrypted:!0,authEndpoint:"https://phasapi.networkglitch.com/broadcasting/auth",auth:{headers:{Authorization:"Bearer "+(0,s.YT)(),Accept:"application/json"}},client:i().instances[0]};return null==c&&(c=new r.ZP(e)),c}let GetChannel=e=>GetEchoClient().private(e),d=[];function StartListening(e,t,a,n){d.filter(a=>a.ChannelName==e&&a.EventName==t).length>0||(GetChannel(e).listen(t,n).error(a),console.log("WS Listening on "+e+" for "+t),d.push({ChannelName:e,EventName:t}))}function StopListening(e,t){d.filter(a=>a.ChannelName==e&&a.EventName==t).pop(),GetChannel(e).stopListening(t)}function TrackPresence(e,t){let a=GetEchoClient().join("member."+e).joining(()=>{console.log("Joining channel for presence")}).here(()=>{console.log("In channel for presence")});a.error(e=>{console.log(e)}),a.leaving(t)}function DisconnectNotification(){null==c||c.disconnect()}},8703:function(e,t,a){"use strict";a.r(t),a.d(t,{LoginForm:function(){return LoginForm},ModalButton:function(){return ModalButton},TaskManager:function(){return TaskManager}});var n=a(7437);a(2265);var l=a(9222);let DestroyTaskManagerToken=()=>{sessionStorage.removeItem("PhasTaskManagerToken")},UpdateTaskManagerToken=e=>{sessionStorage.setItem("PhasTaskManagerToken",e)},GetTaskManagerToken=()=>sessionStorage.getItem("PhasTaskManagerToken"),TaskManagerAPI=()=>l.Z.create({baseURL:"https://phasapi.networkglitch.com",withCredentials:!0,headers:{Authorization:"Bearer "+GetTaskManagerToken()}}),FetchCSRFToken=async()=>await TaskManagerAPI().get("/sanctum/csrf-cookie"),LoginTaskManager=async e=>(await FetchCSRFToken(),await TaskManagerAPI().post("/task/manager",{passphrase:e})),FetchTaskData=async()=>TaskManagerAPI().get("/tasks"),RequestTaskDelete=async e=>(await FetchCSRFToken(),await TaskManagerAPI().post("/task/"+e+"/delete",{task_id:e})),FetchTaskDetails=async e=>await TaskManagerAPI().get("/task/"+e),CreateTask=async e=>(await FetchCSRFToken(),await TaskManagerAPI().post("/task/",e)),UpdateTask=async e=>(await FetchCSRFToken(),await TaskManagerAPI().post("/task/"+e.id,e)),CreateVariable=async(e,t)=>(await FetchCSRFToken(),await TaskManagerAPI().post("/task/"+e+"/variable",t)),UpdateVariable=async(e,t,a)=>(await FetchCSRFToken(),await TaskManagerAPI().post("/task/"+e+"/variable/"+t,a)),DeleteVariableRequest=async(e,t)=>(await FetchCSRFToken(),await TaskManagerAPI().post("/task/"+e+"/variable/"+t+"/delete"));var r=a(4660);let s=(0,r.Ue)()(e=>({taskList:[],visible:!1,requireTaskListUpdate:!1,validSession:!1,setVisible:t=>e(()=>({visible:t})),updateSession:t=>e(()=>({validSession:t})),updateTaskList:t=>e(()=>({taskList:t})),setTaskListUpdateRequired:t=>e(()=>({requireTaskListUpdate:t}))}));var o=a(6651);let i=(0,r.Ue)()(e=>({EditorActive:!1,TaskID:null,TaskDetails:null,SetTaskID:t=>e(()=>({TaskID:t})),SetTaskDetails:t=>e(()=>({TaskDetails:t})),SetEditorActive:t=>e(()=>({EditorActive:t})),VariablePanelVisible:!1,VariableCache:null,SetVariablePanelVisible:t=>e(()=>({VariablePanelVisible:t})),SetVariableCache:t=>e(()=>({VariableCache:t}))}));function isEven(e){return e%2==0}function TaskTable(){let e=s(e=>e.taskList),t=s(e=>e.setTaskListUpdateRequired),a=(0,o.Xo)(e=>e.setDetails),l=(0,o.Xo)(e=>e.setVisible),r=i(e=>e.SetTaskID),c=i(e=>e.SetTaskDetails),d=i(e=>e.SetEditorActive),EditTask=e=>{e.preventDefault();let t=e.currentTarget.attributes.getNamedItem("data-key");null!=t&&FetchTaskDetails(parseInt(t.value)).then(e=>{r(e.data.task.id),c(e.data.task),d(!0)})},DeleteTask=e=>{e.preventDefault();let r=e.currentTarget.attributes.getNamedItem("data-key");null!=r&&(a({Message:"Do you really wanna delete this?",Title:"Delete Task?",Type:o.j_.Confirmation,AutoHide:!1,Icon:(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6 text-red-400",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0"})}),Buttons:{ConfirmButtonType:o.iB.Warning,ConfirmButtonText:"Delete",ConfirmButtonCallback:()=>{null!=r&&RequestTaskDelete(parseInt(r.value)).then(e=>(a({Message:"The task was successfully deleted",Title:"Task Deleted",Type:o.j_.Success,AutoHide:!0}),t(!0),!0))}}}),l(!0))};return(0,n.jsxs)("table",{className:"table-auto modal-table border p-2",children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{className:"border text-center bg-purple-900 border-purple-900 border-solid",children:"Name"}),(0,n.jsx)("th",{className:"border text-center bg-purple-900 border-purple-900 border-solid",children:"Challenge Length"}),(0,n.jsx)("th",{className:"border text-center bg-purple-900 border-purple-900 border-solid",children:"Challenge Type"}),(0,n.jsx)("th",{className:"border text-center bg-purple-900 border-purple-900 border-solid",children:"Probability"}),(0,n.jsx)("th",{className:"border text-center bg-purple-900 border-purple-900 border-solid",children:"Min Player(s) Req"}),(0,n.jsx)("th",{className:"border text-center bg-purple-900 border-purple-900 border-solid",children:"Player(s) Included"}),(0,n.jsx)("th",{className:"bg-purple-900 border-purple-900 border-solid"})]})}),(0,n.jsx)("tbody",{children:e.map((e,t)=>{var a;let l="odd";return isEven(t)&&(l="even"),(0,n.jsxs)("tr",{className:l,children:[(0,n.jsx)("td",{className:"border text-left",children:e.FriendlyName}),(0,n.jsxs)("td",{className:"border text-center",children:[e.ChallengeLength," Round(s)"]}),(0,n.jsxs)("td",{className:"border text-center",children:[e.ChallengeType,"incremental"==e.ChallengeType?(0,n.jsxs)("p",{className:"text-xs font-normal",children:[" ",e.CounterGoal," times"]}):(0,n.jsx)("p",{})]}),(0,n.jsxs)("td",{className:"border text-center",children:[null!==(a=e.Probability)&&void 0!==a?a:500," ",(0,n.jsx)("br",{}),(0,n.jsx)("span",{className:"text-gray-600 text-xs",children:"Range of 1-1000"})," "]}),(0,n.jsx)("td",{className:"border text-center",children:e.MinPlayerCount}),(0,n.jsx)("td",{className:"border text-center",children:e.InvolvedPlayerCount}),(0,n.jsxs)("td",{className:"border text-right",children:[(0,n.jsx)("button",{"data-key":e.ID,onClick:EditTask,children:(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"w-4 h-4 hover:text-purple-600 m-t-1",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10"})})}),(0,n.jsx)("button",{"data-key":e.ID,onClick:DeleteTask,children:(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"w-4 h-4 hover:text-red-600 m-t-1",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0"})})})]})]},t)})})]})}function VariableContainer(){let e=i(e=>e.TaskID),t=i(e=>e.VariablePanelVisible);if(null!=e)return(0,n.jsxs)("div",{className:"relative col-span-1 m-0",children:[(0,n.jsx)("div",{className:"inline-flex items-center bg-gray-700 border-b-gray-800 border-b-2 text-white text-normal p-2 w-full m-0",children:(0,n.jsxs)("div",{className:"m-auto inline-flex items-center",children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.745 3A23.933 23.933 0 003 12c0 3.183.62 6.22 1.745 9M19.5 3c.967 2.78 1.5 5.817 1.5 9s-.533 6.22-1.5 9M8.25 8.885l1.444-.89a.75.75 0 011.105.402l2.402 7.206a.75.75 0 001.104.401l1.445-.889m-8.25.75l.213.09a1.687 1.687 0 002.062-.617l4.45-6.676a1.688 1.688 0 012.062-.618l.213.09"})}),"Variables"]})}),(0,n.jsx)("div",{className:"task-editor-sidebar-scroller",children:(0,n.jsx)("div",{className:"m-0 p-0",children:(0,n.jsx)(VariableList,{})})}),t?null:(0,n.jsx)(AddVariableButton,{})]})}function AddVariableButton(){let e=i(e=>e.SetVariablePanelVisible),t=i(e=>e.SetVariableCache),a=i(e=>e.TaskID);return(0,n.jsx)("button",{onClick:n=>{n.preventDefault(),null!=document.getElementsByClassName("active-variable")[0]&&document.getElementsByClassName("active-variable")[0].classList.remove("active-variable"),null!=a&&(t({task_id:a,name:"",text:""}),e(!0))},className:"inline-flex absolute bottom-0 w-full p-2 text-sm m-0 height-3vh bg-green-800 hover:bg-green-600 text-white text-normal",children:(0,n.jsxs)("div",{className:"m-auto inline-flex items-center",children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6 mr-1",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v6m3-3H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Add Variable"]})})}function VariableList(){let e=i(e=>e.SetVariablePanelVisible),t=i(e=>e.SetVariableCache),a=i(e=>e.TaskDetails),LoadVariablePanel=n=>{if(n.preventDefault(),null==a||null==a.id||null==a.variables)return;let l=n.currentTarget.attributes.getNamedItem("data-id");if(null==l)return;let r=parseInt(l.value),s=a.variables.filter(e=>e.id==r);null!=s&&(null!=document.getElementById("task-variable-form")&&document.getElementById("task-variable-form").reset(),t(s[0]),e(!0),null!=document.getElementsByClassName("active-variable")[0]&&document.getElementsByClassName("active-variable")[0].classList.remove("active-variable"),n.currentTarget.classList.add("active-variable"))};return null==a||null==a.variables||0==a.variables.length?(0,n.jsx)("div",{className:"text-center text-sm text-gray-800 mt-2 font-medium",children:"No Variables Defined"}):a.variables.map((e,t)=>(0,n.jsx)("button",{"data-id":e.id,onClick:LoadVariablePanel,className:"relative w-full px-4 py-2 text-sm font-medium border-gray-200 text-white bg-gray-700 hover:bg-gray-600",children:e.name},t))}function CreateTaskForm(){let e=(0,o.Xo)(e=>e.setDetails),t=(0,o.Xo)(e=>e.setVisible),a=s(e=>e.updateSession),l=s(e=>e.setTaskListUpdateRequired),r=i(e=>e.SetTaskID),c=i(e=>e.SetTaskDetails);return(0,n.jsxs)("form",{id:"task-basic-form",onSubmit:n=>{var s,i,d,u,m,h,x,g,p,b,f,v,y,w;n.preventDefault();let j=new FormData(n.currentTarget),k=j.get("task-name");if(null==k||0==k.toString().length){e({Message:"You must provide a name for the task.",Title:"Task Name Required",Type:o.j_.Error,AutoHide:!0}),t(!0);return}CreateTask({id:0,challenge_type:null!==(g=null===(s=j.get("task-type"))||void 0===s?void 0:s.toString())&&void 0!==g?g:"",challenge_length:parseInt(null!==(p=null===(i=j.get("task-length"))||void 0===i?void 0:i.toString())&&void 0!==p?p:"1"),friendly_name:null!==(b=null===(d=j.get("task-name"))||void 0===d?void 0:d.toString())&&void 0!==b?b:"no name",probability:parseInt(null!==(f=null===(u=j.get("task-probability"))||void 0===u?void 0:u.toString())&&void 0!==f?f:"500"),counter_goal:parseInt(null!==(v=null===(m=j.get("task-counter"))||void 0===m?void 0:m.toString())&&void 0!==v?v:"1"),involved_player_count:parseInt(null!==(y=null===(h=j.get("task-involved-player-count"))||void 0===h?void 0:h.toString())&&void 0!==y?y:"1"),min_player_count:parseInt(null!==(w=null===(x=j.get("task-minimum-player-required"))||void 0===x?void 0:x.toString())&&void 0!==w?w:"1")}).then(a=>{200==a.status&&(e({Message:"Successfully created the new task!",Title:"Task Created!",Type:o.j_.Success,AutoHide:!0}),null!=document.getElementById("task-basic-form")&&document.getElementById("task-basic-form").reset(),t(!0),r(a.data.task.id),c(a.data.task),l(!0))}).catch(function(n){switch(console.log(n),n.response.status){case 401:case 403:a(!1);return;case 422:var l;e({Message:null!==(l=n.response.data.message)&&void 0!==l?l:"An unexpected error has occurred!",Title:"Error Creating Task!",Type:o.j_.Error,AutoHide:!0}),t(!0);return;default:e({Message:"An unexpected error has occurred!",Title:"An error occurred!",Type:o.j_.Error,AutoHide:!0}),t(!0);return}})},children:[(0,n.jsx)(BasicTaskForm,{}),(0,n.jsx)("button",{type:"submit",className:"p-2 text-white bg-green-700 hover:bg-green-900 text-sm w-full hover:font-medium",children:(0,n.jsxs)("div",{className:"m-auto inline-flex items-center",children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6 mr-2",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v6m3-3H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Create Task"]})})]})}function BasicTaskForm(){let e=i(e=>e.TaskDetails),t=i(e=>e.SetTaskDetails);return(0,n.jsxs)("div",{className:"col-span-3 w-full",children:[(0,n.jsx)("div",{className:"p-2",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"block text-gray-700 text-sm",children:"Task Name"}),(0,n.jsx)("input",{name:"task-name",placeholder:"A friendly task name!",className:"bg-gray-100 border border-gray-300 text-gray-900 text-sm block focus:bg-white w-full eading-tight p-2",defaultValue:null==e?void 0:e.friendly_name})]})}),(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-3 p-2",children:[(0,n.jsxs)("div",{className:"w-full group",children:[(0,n.jsx)("label",{className:"block text-gray-700 text-sm",children:"Task Length"}),(0,n.jsxs)("select",{name:"task-length",className:"bg-gray-100 border border-gray-300 text-gray-900 text-sm block focus:bg-white w-full eading-tight p-2",defaultValue:null==e?void 0:e.challenge_length,children:[(0,n.jsx)("option",{value:1,children:"1 Round"}),(0,n.jsx)("option",{value:2,children:"2 Round"}),(0,n.jsx)("option",{value:3,children:"3 Round"}),(0,n.jsx)("option",{value:4,children:"4 Round"}),(0,n.jsx)("option",{value:5,children:"5 Round"})]}),(0,n.jsx)("p",{className:"text-xs",children:"A round is one game map"})]}),(0,n.jsxs)("div",{className:"w-full group",children:[(0,n.jsx)("label",{className:"block text-gray-700 text-sm",children:"Probability (1-1000)"}),(0,n.jsx)("input",{name:"task-probability",type:"number",placeholder:"500",className:"bg-gray-100 border border-gray-300 text-gray-900 text-sm block focus:bg-white w-full eading-tight p-2",defaultValue:null==e?void 0:e.probability}),(0,n.jsx)("p",{className:"text-xs",children:"How often should this task be given out"})]}),(0,n.jsxs)("div",{className:"w-full group",children:[(0,n.jsx)("label",{className:"block text-gray-700 text-sm",children:"Task Type"}),(0,n.jsxs)("select",{onChange:a=>{if(null==e)return;e.challenge_type=a.currentTarget.value,t(e);let n=document.getElementById("task-counter-select");if(null!=n){if("incremental"==e.challenge_type){n.removeAttribute("disabled");return}n.setAttribute("disabled","disabled")}},name:"task-type",className:"bg-gray-100 border border-gray-300 text-gray-900 text-sm block focus:bg-white w-full eading-tight p-2",defaultValue:null==e?void 0:e.challenge_type,children:[(0,n.jsx)("option",{value:"makeithappen",children:"Make It Happen!"}),(0,n.jsx)("option",{value:"vocabulary",children:"Vocabulary"}),(0,n.jsx)("option",{value:"incremental",children:"Incremental"}),(0,n.jsx)("option",{value:"improv",children:"Improv"}),(0,n.jsx)("option",{value:"chaos",children:"Chaos"})]}),(0,n.jsx)("p",{className:"text-xs",children:"Limits based on the type to ensure they are diverse"})]}),(0,n.jsx)("div",{className:"w-full group",children:(0,n.jsxs)("div",{id:"task-incremental-counter",children:[(0,n.jsx)("label",{className:"block text-gray-700 text-sm",children:"Task Counter (1-5)"}),(0,n.jsxs)("select",{id:"task-counter-select",name:"task-counter",className:"bg-gray-100 border border-gray-300 text-gray-900 text-sm block focus:bg-white w-full eading-tight p-2",defaultValue:null==e?void 0:e.counter_goal,disabled:(null==e?void 0:e.challenge_type)!="incremental",children:[(0,n.jsx)("option",{value:1,children:"1 Time"}),(0,n.jsx)("option",{value:2,children:"2 Times"}),(0,n.jsx)("option",{value:3,children:"3 Times"}),(0,n.jsx)("option",{value:4,children:"4 Times"}),(0,n.jsx)("option",{value:5,children:"5 Times"})]}),(0,n.jsx)("p",{className:"text-xs",children:"Amount of times the task must be completed"})]})}),(0,n.jsxs)("div",{className:"w-full group",children:[(0,n.jsx)("label",{className:"block text-gray-700 text-sm",children:"Minimum Players Required"}),(0,n.jsxs)("select",{name:"task-minimum-player-required",className:"bg-gray-100 border border-gray-300 text-gray-900 text-sm block focus:bg-white w-full eading-tight p-2",defaultValue:null==e?void 0:e.min_player_count,children:[(0,n.jsx)("option",{value:1,children:"1 Player"}),(0,n.jsx)("option",{value:2,children:"2 Players"}),(0,n.jsx)("option",{value:3,children:"3 Players"}),(0,n.jsx)("option",{value:4,children:"4 Players"})]}),(0,n.jsx)("p",{className:"text-xs",children:"How many players in the lobby for the task to be given"})]}),(0,n.jsxs)("div",{className:"w-full group",children:[(0,n.jsx)("label",{className:"block text-gray-700 text-sm",children:"Players Involved"}),(0,n.jsxs)("select",{name:"task-involved-player-count",className:"bg-gray-100 border border-gray-300 text-gray-900 text-sm block focus:bg-white w-full eading-tight p-2",defaultValue:null==e?void 0:e.involved_player_count,children:[(0,n.jsx)("option",{value:1,children:"1 Player"}),(0,n.jsx)("option",{value:2,children:"2 Players"}),(0,n.jsx)("option",{value:3,children:"3 Players"}),(0,n.jsx)("option",{value:4,children:"4 Players"})]}),(0,n.jsx)("p",{className:"text-xs",children:"How many players are involved in this task"})]})]})]})}function VariableForm(){let e=s(e=>e.updateSession),t=i(e=>e.SetVariableCache),a=i(e=>e.SetTaskDetails),l=i(e=>e.VariableCache),r=i(e=>e.SetVariablePanelVisible),c=(0,o.Xo)(e=>e.setDetails),d=(0,o.Xo)(e=>e.setVisible),u=i(e=>e.VariablePanelVisible);if(u)return(0,n.jsx)("form",{id:"task-variable-form",onSubmit:(null==l?void 0:l.id)==null?n=>{if(n.preventDefault(),null==l)return;let r=new FormData(n.currentTarget),s=r.get("variable-name");if(null==s||0==s.toString().length){c({Message:"You must provide a name for the variable.",Title:"Variable Name Required",Type:o.j_.Error,AutoHide:!0}),d(!0);return}let i=r.get("variable-data");if(null==i||0==i.toString().length){c({Message:"You must provide data for the variable.",Title:"Variable Data Required",Type:o.j_.Error,AutoHide:!0}),d(!0);return}CreateVariable(l.task_id,{variable_name:s.toString(),variable_data:i.toString()}).then(e=>{200==e.status&&(c({Message:"Successfully created the new variable!",Title:"Variable Created!",Type:o.j_.Success,AutoHide:!0}),d(!0),t({task_id:e.data.task.id,id:e.data.variable_id,name:s.toString(),text:i.toString()}),a(e.data.task))}).catch(function(t){switch(console.log(t),t.response.status){case 401:case 403:e(!1);return;case 422:var a;c({Message:null!==(a=t.response.data.message)&&void 0!==a?a:"An unexpected error has occurred!",Title:"Error Creating Variable!",Type:o.j_.Error,AutoHide:!0}),d(!0);return;default:c({Message:"An unexpected error has occurred!",Title:"An error occurred!",Type:o.j_.Error,AutoHide:!0}),d(!0);return}})}:n=>{if(n.preventDefault(),null==l)return;let r=new FormData(n.currentTarget),s=r.get("variable-name");if(null==s||0==s.toString().length){c({Message:"You must provide a name for the variable.",Title:"Variable Name Required",Type:o.j_.Error,AutoHide:!0}),d(!0);return}let i=r.get("variable-data");if(null==i||0==i.toString().length){c({Message:"You must provide data for the variable.",Title:"Variable Data Required",Type:o.j_.Error,AutoHide:!0}),d(!0);return}null!=l.id&&UpdateVariable(l.task_id,l.id,{variable_name:s.toString(),variable_data:i.toString()}).then(e=>{200==e.status&&(c({Message:"Successfully update the variable!",Title:"Variable Updated!",Type:o.j_.Success,AutoHide:!0}),d(!0),t({task_id:e.data.task.id,id:l.id,name:s.toString(),text:i.toString()}),a(e.data.task))}).catch(function(t){switch(console.log(t),t.response.status){case 401:case 403:e(!1);return;case 422:var a;c({Message:null!==(a=t.response.data.message)&&void 0!==a?a:"An unexpected error has occurred!",Title:"Error Updating Variable!",Type:o.j_.Error,AutoHide:!0}),d(!0);return;default:c({Message:"An unexpected error has occurred!",Title:"An error occurred!",Type:o.j_.Error,AutoHide:!0}),d(!0);return}})},children:(0,n.jsxs)("div",{className:"task-variable-form bg-gray-600 p-2",children:[(0,n.jsxs)("button",{type:"button",onClick:()=>{null!=document.getElementsByClassName("active-variable")[0]&&document.getElementsByClassName("active-variable")[0].classList.remove("active-variable"),r(!1)},className:"close-button text-gray-400 bg-gray-600 rounded-lg hover:bg-gray-200 hover:text-gray-900 text-sm w-8 h-8 ml-auto inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white",children:[(0,n.jsx)("svg",{className:"w-3 h-3","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 14 14",children:(0,n.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"})}),(0,n.jsx)("span",{className:"sr-only",children:"Close modal"})]}),(0,n.jsx)("input",{name:"variable-name",type:"text",placeholder:"variable-name",defaultValue:null==l?void 0:l.name}),(0,n.jsx)("span",{className:"instructions text-gray-200",children:"No spaces in name"}),(0,n.jsx)("textarea",{className:"mt-2 p-1",name:"variable-data",placeholder:"Apples,Oranges,Bananas,Pears...",defaultValue:null==l?void 0:l.text}),(0,n.jsx)("span",{className:"instructions text-gray-200",children:"Comma seperated list of variable options"}),(0,n.jsx)("div",{className:"w-full absolute bottom-0 left-0 task-variable-form-buttons",children:(null==l?void 0:l.id)==null?(0,n.jsx)("div",{className:"m-0",children:(0,n.jsx)("button",{type:"submit",className:"inline-flex absolute bottom-0 w-full p-2 text-sm m-0 height-3vh bg-green-800 hover:bg-green-700 text-white text-normal",children:(0,n.jsxs)("div",{className:"m-auto inline-flex items-center",children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6 mr-1",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v6m3-3H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Add Variable"]})})}):(0,n.jsxs)("div",{className:"grid grid-cols-2 w-full absolute bottom-0 left-0 task-variable-form-buttons",children:[(0,n.jsx)("div",{className:"m-0",children:(0,n.jsxs)("button",{onClick:e=>{c({Message:"Do you really wanna delete this?",Title:"Delete Variable?",Type:o.j_.Confirmation,AutoHide:!1,Icon:(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6 text-red-400",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0"})}),Buttons:{ConfirmButtonType:o.iB.Warning,ConfirmButtonText:"Delete",ConfirmButtonCallback:()=>{null!=l&&null!=l.id&&DeleteVariableRequest(l.task_id,l.id).then(e=>{a(e.data.task),t(null),r(!1),c({Message:"The variable was successfully deleted",Title:"Variable Deleted",Type:o.j_.Success,AutoHide:!0}),null!=document.getElementsByClassName("active-variable")[0]&&document.getElementsByClassName("active-variable")[0].classList.remove("active-variable")})}}}),d(!0)},className:"inline-flex items-center bg-red-800 hover:bg-red-600 text-white text-normal p-2 gap-1 w-full",children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0"})}),(0,n.jsx)("h3",{children:"Delete"})]})}),(0,n.jsx)("div",{className:"m-0",children:(0,n.jsxs)("button",{type:"submit",className:"inline-flex items-center bg-green-800 hover:bg-green-600 text-white text-normal p-2 gap-1 w-full",children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),(0,n.jsx)("h3",{children:"Update"})]})})]})})]})})}function TaskPhraseForm(){var e,t,a,l,r,s,o,c,d,u;let m=i(e=>e.TaskDetails);if(null==m)return;let h=null!==(s=null===(e=m.phrases)||void 0===e?void 0:e.filter(e=>1==e.player_number)[0].id)&&void 0!==s?s:0,x=null!==(o=null===(t=m.phrases)||void 0===t?void 0:t.filter(e=>1==e.player_number)[0].text)&&void 0!==o?o:0,g=null!==(c=null===(a=m.phrases)||void 0===a?void 0:a.filter(e=>2==e.player_number)[0])&&void 0!==c?c:null,p=null==g?0:g.id,b=null==g?0:g.text,f=null!==(d=null===(l=m.phrases)||void 0===l?void 0:l.filter(e=>3==e.player_number)[0])&&void 0!==d?d:null,v=null==f?0:f.id,y=null==f?0:f.text,w=null!==(u=null===(r=m.phrases)||void 0===r?void 0:r.filter(e=>4==e.player_number)[0])&&void 0!==u?u:null,j=null==w?0:w.id,k=null==w?0:w.text;return(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"bg-gray-100 p-2 font-medium text-gray-800 text-sm",children:["Task Details :",(0,n.jsx)("span",{className:"text-xs ml-1",children:"What does the player have to do. Use variables [variable-name] to make it more dynamic!"})]}),(0,n.jsxs)("div",{className:"p-2 border-b-2 border-gray-100",children:[(0,n.jsx)("label",{className:"block text-gray-700 text-sm mb-1",children:"Player 1"}),(0,n.jsx)("input",{type:"hidden",value:h,name:"player-1-phrase-id"}),(0,n.jsx)("textarea",{name:"player-1-phrase-text",defaultValue:x,className:"bg-gray-100 border border-gray-300 text-gray-900 text-sm block focus:bg-white w-full eading-tight p-2",placeholder:"Save all the cat photos in the house"})]}),null==g?null:(0,n.jsxs)("div",{className:"p-2 border-b-2 border-gray-100",children:[(0,n.jsx)("label",{className:"block text-gray-700 text-sm mb-1",children:"Player 2"}),(0,n.jsx)("input",{type:"hidden",value:p,name:"player-2-phrase-id"}),(0,n.jsx)("textarea",{name:"player-2-phrase-text",defaultValue:b,className:"bg-gray-100 border border-gray-300 text-gray-900 text-sm block focus:bg-white w-full eading-tight p-2",placeholder:"Save all the cat photos in the house"})]}),null==f?null:(0,n.jsxs)("div",{className:"p-2 border-b-2 border-gray-100 ",children:[(0,n.jsx)("label",{className:"block text-gray-700 text-sm mb-1",children:"Player 3"}),(0,n.jsx)("input",{type:"hidden",value:v,name:"player-3-phrase-id"}),(0,n.jsx)("textarea",{name:"player-3-phrase-text",defaultValue:y,className:"bg-gray-100 border border-gray-300 text-gray-900 text-sm block focus:bg-white w-full eading-tight p-2",placeholder:"Save all the cat photos in the house"})]}),null==w?null:(0,n.jsxs)("div",{className:"p-2",children:[(0,n.jsx)("label",{className:"block text-gray-700 text-sm mb-1",children:"Player 4"}),(0,n.jsx)("input",{type:"hidden",value:j,name:"player-4-phrase-id"}),(0,n.jsx)("textarea",{name:"player-4-phrase-text",defaultValue:k,className:"bg-gray-100 border border-gray-300 text-gray-900 text-sm block focus:bg-white w-full eading-tight p-2",placeholder:"Save all the cat photos in the house"})]})]})}function TaskEditor(){let e=i(e=>e.TaskID),t=s(e=>e.setTaskListUpdateRequired),a=(0,o.Xo)(e=>e.setDetails),l=(0,o.Xo)(e=>e.setVisible),r=s(e=>e.updateSession),c=i(e=>e.SetTaskID),d=i(e=>e.SetTaskDetails);return null==e?(0,n.jsx)(CreateTaskForm,{}):(0,n.jsxs)("div",{className:"grid grid-cols-4 task-editor bg-white relative",children:[(0,n.jsx)("div",{className:"col-span-3 w-full",children:(0,n.jsxs)("form",{onSubmit:n=>{var s,i,u,m,h,x,g,p,b,f,v,y,w,j,k,N,C,T,L,S,M,B,_,D,A,P,I,E,V,F,U,R;n.preventDefault();let H=new FormData(n.currentTarget);console.log(H);let G=parseInt(null!==(v=null===(s=H.get("task-involved-player-count"))||void 0===s?void 0:s.toString())&&void 0!==v?v:"1"),Y=[];Y[0]={id:parseInt(null!==(y=null===(i=H.get("player-1-phrase-id"))||void 0===i?void 0:i.toString())&&void 0!==y?y:"1"),player_number:1,task_id:e,text:null!==(w=null===(u=H.get("player-1-phrase-text"))||void 0===u?void 0:u.toString())&&void 0!==w?w:""},G>1&&(Y[1]={id:parseInt(null!==(N=null===(j=H.get("player-2-phrase-id"))||void 0===j?void 0:j.toString())&&void 0!==N?N:"1"),player_number:2,task_id:e,text:null!==(C=null===(k=H.get("player-2-phrase-text"))||void 0===k?void 0:k.toString())&&void 0!==C?C:""}),G>2&&(Y[2]={id:parseInt(null!==(S=null===(T=H.get("player-3-phrase-id"))||void 0===T?void 0:T.toString())&&void 0!==S?S:"1"),player_number:3,task_id:e,text:null!==(M=null===(L=H.get("player-3-phrase-text"))||void 0===L?void 0:L.toString())&&void 0!==M?M:""}),G>3&&(Y[3]={id:parseInt(null!==(D=null===(B=H.get("player-4-phrase-id"))||void 0===B?void 0:B.toString())&&void 0!==D?D:"1"),player_number:4,task_id:e,text:null!==(A=null===(_=H.get("player-4-phrase-text"))||void 0===_?void 0:_.toString())&&void 0!==A?A:""}),UpdateTask({id:e,challenge_type:null!==(P=null===(m=H.get("task-type"))||void 0===m?void 0:m.toString())&&void 0!==P?P:"",challenge_length:parseInt(null!==(I=null===(h=H.get("task-length"))||void 0===h?void 0:h.toString())&&void 0!==I?I:"1"),friendly_name:null!==(E=null===(x=H.get("task-name"))||void 0===x?void 0:x.toString())&&void 0!==E?E:"no name",probability:parseInt(null!==(V=null===(g=H.get("task-probability"))||void 0===g?void 0:g.toString())&&void 0!==V?V:"500"),counter_goal:parseInt(null!==(F=null===(p=H.get("task-counter"))||void 0===p?void 0:p.toString())&&void 0!==F?F:"1"),involved_player_count:parseInt(null!==(U=null===(b=H.get("task-involved-player-count"))||void 0===b?void 0:b.toString())&&void 0!==U?U:"1"),min_player_count:parseInt(null!==(R=null===(f=H.get("task-minimum-player-required"))||void 0===f?void 0:f.toString())&&void 0!==R?R:"1"),phrases:Y}).then(e=>{200==e.status&&(a({Message:"Successfully updated the task",Title:"Task Updated!",Type:o.j_.Success,AutoHide:!0}),null!=document.getElementById("task-basic-form")&&document.getElementById("task-basic-form").reset(),t(!0),l(!0),c(e.data.task.id),d(e.data.task))}).catch(function(e){switch(console.log(e),e.response.status){case 401:case 403:r(!1);return;case 422:var t;a({Message:null!==(t=e.response.data.message)&&void 0!==t?t:"An unexpected error has occurred!",Title:"Error Updating Task!",Type:o.j_.Error,AutoHide:!0}),l(!0);return;default:a({Message:"An unexpected error has occurred!",Title:"An error occurred!",Type:o.j_.Error,AutoHide:!0}),l(!0);return}})},children:[(0,n.jsx)(BasicTaskForm,{}),(0,n.jsx)(TaskPhraseForm,{}),(0,n.jsx)(SaveTaskButton,{})]})}),(0,n.jsx)(VariableContainer,{}),(0,n.jsx)(VariableForm,{})]})}function SaveTaskButton(){return(0,n.jsx)("button",{type:"submit",className:"w-full text-sm m-0 bg-gray-100 text-white font-medium ",children:(0,n.jsxs)("div",{className:"inline-flex bg-purple-700 text-gray-100 items-center hover:bg-purple-800 p-2.5",children:[(0,n.jsx)("svg",{fill:"currentColor",version:"1.1",id:"Capa_1",xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4 mr-2 ",viewBox:"0 0 407.096 407.096",children:(0,n.jsx)("g",{children:(0,n.jsxs)("g",{children:[(0,n.jsx)("path",{d:"M402.115,84.008L323.088,4.981C319.899,1.792,315.574,0,311.063,0H17.005C7.613,0,0,7.614,0,17.005v373.086 c0,9.392,7.613,17.005,17.005,17.005h373.086c9.392,0,17.005-7.613,17.005-17.005V96.032 C407.096,91.523,405.305,87.197,402.115,84.008z M300.664,163.567H67.129V38.862h233.535V163.567z"}),(0,n.jsx)("path",{d:"M214.051,148.16h43.08c3.131,0,5.668-2.538,5.668-5.669V59.584c0-3.13-2.537-5.668-5.668-5.668h-43.08 c-3.131,0-5.668,2.538-5.668,5.668v82.907C208.383,145.622,210.92,148.16,214.051,148.16z"})]})})}),"Update Task"]})})}function TaskManagerDashboard(){i(e=>e.TaskID);let e=i(e=>e.EditorActive);return e?(0,n.jsx)(TaskEditor,{}):(0,n.jsx)(TaskTable,{})}function TaskManagerTitle(){let e=i(e=>e.TaskID),t=i(e=>e.EditorActive);return t?null==e?(0,n.jsx)(NewTaskTitle,{}):(0,n.jsx)(TaskDetailsTitle,{}):(0,n.jsx)(BaseTitle,{})}function BaseTitle(){let e=i(e=>e.SetTaskID),t=i(e=>e.SetTaskDetails),a=i(e=>e.SetEditorActive);return(0,n.jsx)("nav",{className:"flex p-2","aria-label":"Breadcrumb",children:(0,n.jsx)("ol",{className:"inline-flex",children:(0,n.jsxs)("li",{className:"inline-flex items-center items font-medium text-gray-900 text-sm",children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"text-purple-900 font-medium w-4 h-4",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 6.878V6a2.25 2.25 0 012.25-2.25h7.5A2.25 2.25 0 0118 6v.878m-12 0c.235-.083.487-.128.75-.128h10.5c.263 0 .515.045.75.128m-12 0A2.25 2.25 0 004.5 9v.878m13.5-3A2.25 2.25 0 0119.5 9v.878m0 0a2.246 2.246 0 00-.75-.128H5.25c-.263 0-.515.045-.75.128m15 0A2.25 2.25 0 0121 12v6a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 18v-6c0-.98.626-1.813 1.5-2.122"})}),"Task Manager",(0,n.jsxs)("button",{type:"button",className:"ml-2 text-green-600 bg-transparent hover:text-green-900 rounded-lg text-sm w-8 h-8 inline-flex justify-center items-center",onClick:()=>{e(null),t({friendly_name:"",challenge_length:0,challenge_type:"MakeItHappen",counter_goal:0,probability:500,involved_player_count:1,min_player_count:1}),a(!0)},children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v6m3-3H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,n.jsx)("span",{className:"sr-only",children:"Add Task"})]})]})})})}function NewTaskTitle(){let e=i(e=>e.SetTaskID),t=i(e=>e.SetTaskDetails),a=i(e=>e.SetEditorActive);return(0,n.jsx)("nav",{className:"flex p-2","aria-label":"Breadcrumb",children:(0,n.jsxs)("ol",{className:"inline-flex p-0 m-0",children:[(0,n.jsx)("li",{className:"p-0 m-0",children:(0,n.jsxs)("button",{className:"inline-flex items-center items font-medium text-gray-900 hover:text-purple-900 text-sm",onClick:()=>{e(null),t(null),a(!1)},children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"font-medium w-4 h-4",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 6.878V6a2.25 2.25 0 012.25-2.25h7.5A2.25 2.25 0 0118 6v.878m-12 0c.235-.083.487-.128.75-.128h10.5c.263 0 .515.045.75.128m-12 0A2.25 2.25 0 004.5 9v.878m13.5-3A2.25 2.25 0 0119.5 9v.878m0 0a2.246 2.246 0 00-.75-.128H5.25c-.263 0-.515.045-.75.128m15 0A2.25 2.25 0 0121 12v6a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 18v-6c0-.98.626-1.813 1.5-2.122"})}),"Task Manager"]})}),(0,n.jsx)("li",{children:(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)("svg",{className:"w-3 h-3 text-gray-800 text-sm mx-1","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 6 10",children:(0,n.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 9 4-4-4-4"})}),(0,n.jsx)("span",{className:"text-sm text-purple-900 font-medium",children:"New Task"})]})})]})})}function TaskDetailsTitle(){let e=i(e=>e.SetTaskID),t=i(e=>e.SetTaskDetails),a=i(e=>e.TaskDetails);i(e=>e.EditorActive);let l=i(e=>e.SetEditorActive);return(0,n.jsx)("nav",{className:"flex p-2","aria-label":"Breadcrumb",children:(0,n.jsxs)("ol",{className:"inline-flex p-0 m-0",children:[(0,n.jsx)("li",{className:"p-0 m-0",children:(0,n.jsxs)("button",{className:"inline-flex items-center items font-medium text-gray-900 hover:text-purple-900 text-sm",onClick:()=>{e(null),t(null),l(!1)},children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"font-medium w-4 h-4",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 6.878V6a2.25 2.25 0 012.25-2.25h7.5A2.25 2.25 0 0118 6v.878m-12 0c.235-.083.487-.128.75-.128h10.5c.263 0 .515.045.75.128m-12 0A2.25 2.25 0 004.5 9v.878m13.5-3A2.25 2.25 0 0119.5 9v.878m0 0a2.246 2.246 0 00-.75-.128H5.25c-.263 0-.515.045-.75.128m15 0A2.25 2.25 0 0121 12v6a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 18v-6c0-.98.626-1.813 1.5-2.122"})}),"Task Manager"]})}),(0,n.jsx)("li",{children:(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)("svg",{className:"w-3 h-3 text-gray-800 text-sm mx-1","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 6 10",children:(0,n.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 9 4-4-4-4"})}),(0,n.jsx)("span",{className:"text-sm text-gray-900 font-medium",children:"Task Details:\xa0"})," ",(0,n.jsx)("span",{className:"text-purple-900 text-sm",children:null==a?void 0:a.friendly_name})]})})]})})}let c=(0,n.jsx)("nav",{className:"flex","aria-label":"Breadcrumb",children:(0,n.jsx)("ol",{className:"inline-flex p-0 m-0",children:(0,n.jsx)("li",{className:"p-0 m-0",children:(0,n.jsxs)("div",{className:"inline-flex items-center items font-medium text-gray-900 hover:text-purple-900",children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"w-6 h-6 text-red-800 ml-2 mb-1",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 10.5V6.75a4.5 4.5 0 10-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 002.25-2.25v-6.75a2.25 2.25 0 00-2.25-2.25H6.75a2.25 2.25 0 00-2.25 2.25v6.75a2.25 2.25 0 002.25 2.25z"})}),"Login Required"]})})})});function BaseModal(){let e=s(e=>e.setVisible),t=s(e=>e.validSession),a=t?(0,n.jsx)(TaskManagerTitle,{}):c,l=t?(0,n.jsx)(TaskManagerDashboard,{}):(0,n.jsx)(LoginForm,{}),r=i(e=>e.EditorActive),o=i(e=>e.SetEditorActive);return(0,n.jsx)("div",{className:"justify-center mt-20 flex fixed inset-0 z-50 outline-none focus:outline-none",children:(0,n.jsx)("div",{className:"relative w-auto mx-auto",children:(0,n.jsxs)("div",{className:"border-0 shadow-lg relative flex flex-col w-full bg-white outline-none focus:outline-none",children:[(0,n.jsxs)("div",{className:"items-start justify-between inline-flex border-b border-solid border-blueGray-200",id:"modal-title",children:[a,(0,n.jsxs)("button",{type:"button",className:"text-gray-400 bg-transparent hover:text-gray-900 text-sm w-8 h-8 ml-auto inline-flex justify-center items-center",onClick:()=>{if(r){o(!1);return}e(!1)},children:[(0,n.jsx)("svg",{className:"w-3 h-3","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 14 14",children:(0,n.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"})}),(0,n.jsx)("span",{className:"sr-only",children:"Close modal"})]})]}),(0,n.jsx)("div",{id:"modal-content",className:"modal-content",children:l})]})})})}function TaskManager(){let e=s(e=>e.visible),t=s(e=>e.updateSession),a=s(e=>e.updateTaskList),l=s(e=>e.requireTaskListUpdate),r=s(e=>e.setTaskListUpdateRequired);return(null!=GetTaskManagerToken()&&l&&FetchTaskData().then(e=>{if(200!=e.status){t(!1);return}t(!0);let n=[];e.data.tasks.map(e=>{n.push({ID:e.id,ChallengeDetails:"",ChallengeLength:e.challenge_length,Probability:e.probability,ChallengeType:e.challenge_type,FriendlyName:e.friendly_name,InvolvedPlayerCount:e.involved_player_count,MinPlayerCount:e.min_player_count,CounterGoal:e.counter_goal})}),a(n),r(!1)}).catch(e=>{console.log(e),(401==e.status||403==e.status)&&(t(!1),r(!1),DestroyTaskManagerToken())}),e)?(0,n.jsx)(BaseModal,{}):null}function LoginForm(){let e=s(e=>e.updateSession),t=s(e=>e.setTaskListUpdateRequired),a=(0,o.Xo)(e=>e.setDetails);return(0,o.Xo)(e=>e.setVisible),(0,n.jsx)("form",{onSubmit:l=>{l.preventDefault();let r=new FormData(l.currentTarget),s=r.get("form-password");null!=s&&LoginTaskManager(s.toString()).then(a=>{UpdateTaskManagerToken(a.data.token),e(!0),t(!0)}).catch(t=>{e(!1),a({Message:"Could not log you in, please try again.",Title:"Unable to login.",Type:o.j_.Error,AutoHide:!1,Icon:(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6 text-red-400",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0"})})})})},children:(0,n.jsxs)("div",{className:"login-form p-2",children:[(0,n.jsx)("p",{className:"no-wrap",children:"Editing & adding tasks requires a password."}),(0,n.jsxs)("div",{className:"inline-flex items-center justify-center m-t-1",children:[(0,n.jsx)("input",{type:"password",name:"form-password",className:"ppx-6 py-3.5 text-base font-medium text-black bg-gray-500 border-solid-1 border-gray-800 inline-flex items-center",placeholder:"********"}),(0,n.jsx)("button",{type:"submit",className:"px-6 py-3.5 text-base font-medium text-white inline-flex items-center text-center bg-purple-700 hover:bg-purple-800 focus:outline-none focus:ring-4 focus:ring-purple-300",children:"Login"})]})]})})}function ModalButton(){let e=s(e=>e.setVisible);return(0,n.jsx)("button",{className:"text-white font-bold uppercase text-sm px-2 py-1 mr-1 mb-1",type:"button",onClick:()=>e(!0),children:"Task Manager"})}}},function(e){e.O(0,[923,971,472,744],function(){return e(e.s=5555)}),_N_E=e.O()}]);