PageSourceSearch

https://joinhottub.com/_next/static/chunks/50189-7f4239142b93ce7f.js

js joinhottub.com collected 2026-10-09 22:40:00 UTC 46,442 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[50189],{959:(e,t,a)=>{var s=a(83207);a.o(s,"usePathname")&&a.d(t,{usePathname:function(){return s.usePathname}}),a.o(s,"useRouter")&&a.d(t,{useRouter:function(){return s.useRouter}})},36560:(e,t,a)=>{a.d(t,{l:()=>s});function s(){let e=function(){if("undefined"!=typeof document)for(let e of document.cookie.split(";")){let[t,...a]=e.trim().split("=");if("hottub_csrf"===t)return decodeURIComponent(a.join("="))}}();return e?{"x-csrf-token":e}:{}}},80232:(e,t,a)=>{a.d(t,{C:()=>n});var s=a(36029);let n=(0,s.createServerReference)("4013373f054370009250c17dd68145c4c3a45de1ff",s.callServer,void 0,s.findSourceMapURL,"postSoakAskAction")},91339:(e,t,a)=>{a.d(t,{SoakGameTable:()=>f});var s=a(4536),n=a(11092),l=a(36560),i=a(80232);let r=[{term:"Blinded",text:"You can’t see: your attacks are at disadvantage, attacks against you have advantage, and sight-based checks auto-fail."},{term:"Charmed",text:"You can’t attack the charmer, and they have the social upper hand with you."},{term:"Frightened",text:"While you can see the source: disadvantage on attacks and checks, and you can’t willingly move closer to it."},{term:"Grappled",text:"Your speed is 0 until you break free or the grappler lets go (or is removed)."},{term:"Incapacitated",text:"No actions, no reactions. Many worse conditions include this one."},{term:"Invisible",text:"You can’t be seen: your attacks have advantage, attacks against you have disadvantage."},{term:"Paralyzed",text:"Incapacitated and frozen: attacks against you have advantage, and hits from adjacent attackers crit."},{term:"Poisoned",text:"Disadvantage on attack rolls and ability checks while it lasts."},{term:"Prone",text:"Melee attacks against you have advantage; ranged ones have disadvantage. Standing up costs half your movement."},{term:"Restrained",text:"Speed 0; your attacks at disadvantage, attacks against you at advantage; dexterity saves at disadvantage."},{term:"Stunned",text:"Incapacitated, you fail strength and dexterity saves, and attacks against you have advantage."},{term:"Unconscious",text:"Out cold: prone, incapacitated, unaware; adjacent hits crit."}],c=[{term:"Attack",text:"Roll d20 + your attack bonus vs. the target’s defense; meet it or beat it and you roll damage."},{term:"Dash",text:"Trade your action for another full move."},{term:"Disengage",text:"Your movement stops provoking opportunity attacks this turn."},{term:"Dodge",text:"Until your next turn, attacks against you have disadvantage and your dexterity saves have advantage."},{term:"Help",text:"Set up an ally: their next check or attack on the thing you helped with gets advantage."},{term:"Hide",text:"Make a stealth check; on a success, attackers who can’t find you are at disadvantage and your attacks gain advantage."},{term:"Ready",text:"Choose a trigger and an action; when the trigger happens, spend your reaction to act."},{term:"Advantage / Disadvantage",text:"Roll two d20 and keep the higher (advantage) or the lower (disadvantage). They don’t stack, and one of each cancels out."},{term:"Opportunity attack",text:"Leave an enemy’s melee reach without Disengaging and they may spend a reaction to swing at you."},{term:"Cover",text:"Half cover: +2 to defense and dexterity saves. Three-quarters: +5. Total cover: can’t be targeted directly."}];var o=a(97015);let d=["blinded","charmed","frightened","grappled","incapacitated","invisible","paralyzed","poisoned","prone","restrained","stunned","unconscious"],u=e=>{let{children:t}=e;return(0,s.jsx)("svg",{viewBox:"0 0 20 20",width:"20",height:"20",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:t})},p=()=>(0,s.jsxs)(u,{children:[(0,s.jsx)("rect",{x:"3",y:"5",width:"8",height:"11",rx:"1.6",transform:"rotate(-12 7 10.5)",fill:"var(--paper)"}),(0,s.jsx)("rect",{x:"9",y:"5",width:"8",height:"11",rx:"1.6",transform:"rotate(10 13 10.5)",fill:"var(--paper)"})]}),h=()=>(0,s.jsxs)(u,{children:[(0,s.jsx)("path",{d:"M10 2.7 16.3 6.3v7.4L10 17.3 3.7 13.7V6.3z",fill:"var(--paper)"}),(0,s.jsx)("path",{d:"M10 6.2l4.5 6.6h-9z"})]}),m=[{id:"bridge",name:"Bridge",sub:"full contract bridge — real bidding, dummy & scoring \xb7 ~25 min",family:"trick",Icon:p},{id:"tubBridge",name:"tubBridge",sub:"partnership, name a contract \xb7 ~8 min",family:"trick",Icon:p},{id:"tubWhist",name:"tubWhist",sub:"gentlest trick game, no bidding \xb7 ~10 min",family:"trick",Icon:()=>(0,s.jsxs)(u,{children:[(0,s.jsx)("rect",{x:"6",y:"4",width:"8",he
1ight:"12",rx:"1.6",fill:"var(--paper)"}),(0,s.jsx)("path",{d:"M10 8.5v3M8.5 10h3"})]})},{id:"tubSpades",name:"tubSpades",sub:"always trump, name a level \xb7 ~9 min",family:"trick",Icon:()=>(0,s.jsx)(u,{children:(0,s.jsx)("path",{fill:"currentColor",stroke:"none",d:"M10 3C7.4 6 4 7.7 4 10.7c0 1.8 1.5 3 3.2 2.6.8-.2 1.4-.6 1.6-1.1.2 1.3-.3 2.4-1.3 3.3h5c-1-.9-1.5-2-1.3-3.3.2.5.8.9 1.6 1.1 1.7.4 3.2-.8 3.2-2.6C16 7.7 12.6 6 10 3z"})})},{id:"tubHearts",name:"tubHearts",sub:"dodge the hearts, fewest points wins \xb7 ~9 min",family:"trick",Icon:()=>(0,s.jsx)(u,{children:(0,s.jsx)("path",{fill:"currentColor",stroke:"none",d:"M10 16.4S3.8 12.6 3.8 8.6C3.8 6.6 5.4 5.1 7.2 5.1c1.1 0 2.1.6 2.8 1.5.7-.9 1.7-1.5 2.8-1.5 1.8 0 3.4 1.5 3.4 3.5 0 4-6.2 7.8-6.2 7.8z"})})},{id:"tubSame",name:"Same Page",sub:"everyone answers — you score when you MATCH \xb7 3–8 \xb7 ~7 min",family:"talk",Icon:()=>(0,s.jsxs)(u,{children:[(0,s.jsx)("circle",{cx:"8",cy:"10",r:"4.4",fill:"var(--paper)"}),(0,s.jsx)("circle",{cx:"12",cy:"10",r:"4.4",fill:"var(--paper)"})]}),inPerson:!0},{id:"partyTable",name:"Party Table",sub:"run a tabletop RPG session — shared dice, GM screen, initiative \xb7 2–8",family:"table",Icon:h,inPerson:!0}],_=[{label:"Trick-taking",family:"trick"},{label:"Conversation",family:"talk"},{label:"Tabletop",family:"table"}],x=e=>e?m.filter(e=>e.inPerson):m,b={S:"♠",H:"♥",D:"♦",C:"♣"},g={11:"J",12:"Q",13:"K",14:"A"},v={S:0,H:1,C:2,D:3},j=["C","D","H","S","NT"],y={C:"♣",D:"♦",H:"♥",S:"♠",NT:"NT"},N=e=>"H"===e||"D"===e,k=e=>[...e].sort((e,t)=>v[e.suit]-v[t.suit]||t.rank-e.rank);function f(e){var t,a,i;let{soakId:r,soakType:c,autoBots:d=!1,autoStart:u}=e,h="local"===c||"hybrid"===c,[v,j]=(0,n.useState)(null),[y,f]=(0,n.useState)(!1),[T,A]=(0,n.useState)(null),[R,P]=(0,n.useState)(2),[L,D]=(0,n.useState)(!1),G=(0,n.useCallback)(async e=>{let t=await fetch("/api/soaks/".concat(r,"/game"),{cache:"no-store",signal:e});if(!t.ok)return!1;let a=await t.json();return!e.aborted&&(j(a),!0)},[r]),I=(0,o.V)(G,3e3);(0,n.useEffect)(()=>{if(!d)return;let e=setInterval(async()=>{try{let e=await fetch("/api/soaks/".concat(r,"/game/bot"),{method:"POST",headers:{...(0,l.l)()}});(await e.json().catch(()=>({}))).acted&&await I()}catch(e){}},1500);return()=>clearInterval(e)},[d,r,I]);let H=(0,n.useCallback)(async(e,t)=>{f(!0),A(null);try{let s=await fetch(e,{method:"POST",headers:{"content-type":"application/json",...(0,l.l)()},body:t?JSON.stringify(t):void 0}),n=await s.json().catch(()=>({}));if(!s.ok){var a;A(null!=(a=n.error)?a:"Something went wrong.");return}await I()}finally{f(!1)}},[I]),O=(0,n.useRef)(!1);if((0,n.useEffect)(()=>{if(!u||O.current||y||L||!v||!1===v.enabled)return;let e=v.game;e?e.type!==u&&(O.current=!0,H("/api/soaks/".concat(r,"/game"),{type:u,restart:!0})):(O.current=!0,H("/api/soaks/".concat(r,"/game"),{type:u}))},[u,v,y,L,r,H]),(null==v?void 0:v.enabled)===!1)return null;let V=null!=(a=null==v?void 0:v.game)?a:null,Y=(e,t)=>H("/api/soaks/".concat(r,"/game"),{type:e,...t}),W=e=>V&&H("/api/soaks/".concat(r,"/game/move"),{gameId:V.id,move:e}),B=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return(0,s.jsx)("div",{className:"gt__pickgroups",children:_.map(a=>{let n=x(h).filter(e=>e.family===a.family);return 0===n.length?null:(0,s.jsxs)("div",{className:"gt__pickgroup",children:[(0,s.jsx)("div",{className:"gt__pickgroup-label",children:a.label}),(0,s.jsx)("div",{className:"gt__picker",children:n.map(a=>(0,s.jsxs)("button",{className:"gt__pick",disabled:y,onClick:()=>e(a.id),children:[(0,s.jsx)("span",{className:"gt__pick-ico",children:(0,s.jsx)(a.Icon,{})}),(0,s.jsxs)("span",{className:"gt__pick-text",children:[(0,s.jsxs)("strong",{children:[a.name,t]}),(0,s.jsx)("span",{children:a.sub})]})]},a.id))})]},a.family)})})};if(!V)return L?(0,s.jsx)(w,{config:null==v?void 0:v.sameConfig,busy:y,err:T,onCancel:()=>D(!1),onStart:(e,t)=>{D(!1),Y("tubSame",{pack:e,rounds:t})}}):(0,s.jsxs)("div",{className:"gt",children:[(0,s.jsxs)("div",{className:"gt__head",children:[(0,s.jsx)("span",{className:"gt__head-ico","aria-hidden":!0,
1children:(0,s.jsx)(p,{})}),(0,s.jsx)("strong",{children:"Play a game"}),(0,s.jsx)("span",{className:"gt__sub",children:u?"dealing a fresh hand…":h?"a warm little game with the table — answer on your phone, then look up":"a warm little game with the room — make a friend over it"})]}),!u&&B(e=>"tubSame"===e?D(!0):Y(e)),T&&(0,s.jsx)("p",{className:"gt__err",children:T})]});let E=V.state;if(!V.seated&&V.spectator&&(null==E?void 0:E.kind)==="table")return(0,s.jsx)(M,{state:E,busy:!1,err:null,soakId:r,seatNames:V.seatNames,spectator:!0,onMove:()=>void 0,onStart:()=>void 0});if(!V.seated||!E)return(0,s.jsx)("div",{className:"gt",children:(0,s.jsxs)("div",{className:"gt__head",children:[(0,s.jsxs)("strong",{children:[V.type," ♠"]}),(0,s.jsx)("span",{className:"gt__sub",children:"a game is in progress at the table"})]})});if("table"===E.kind)return(0,s.jsx)(M,{state:E,busy:y,err:T,soakId:r,seatNames:V.seatNames,onMove:W,onStart:Y});if("prompt"===E.kind)return(0,s.jsx)(C,{state:E,busy:y,err:T,inPerson:h,seatNames:V.seatNames,onSubmit:e=>W({type:"submit",text:e}),onNext:()=>W({type:"next"}),onStart:Y});let F=e=>E.legalPlays.some(t=>t.suit===e.suit&&t.rank===e.rank),z=V.seatNames,U=e=>{var t;return e===E.yourSeat?"You":null!=(t=null==z?void 0:z[e])?t:"Seat ".concat(e+1)},q=(E.yourSeat+2)%4,J=E.yourSeat%2,X=null!=(i=null==(t=m.find(e=>e.id===E.type))?void 0:t.name)?i:E.type,K=E.declarePrompt,Q=!!E.dummyHand&&null!=E.dummySeat&&E.dummySeat!==E.yourSeat;return(0,s.jsxs)("div",{className:"gt",style:{opacity:y?.5:1,transition:"opacity 0.18s ease"},children:[(0,s.jsxs)("div",{className:"gt__head",children:[(0,s.jsxs)("strong",{children:[X," ♠"]}),(0,s.jsx)("span",{className:"gt__sub",children:E.headline.replace(/Seat (\d+)/g,(e,t)=>U(Number(t)-1))}),(0,s.jsx)("button",{type:"button",className:"gt__restart",disabled:y,onClick:()=>{let e;return e=E.type,Y(null!=u?u:e,{restart:!0})},children:"↻ Restart"})]}),"auction"===E.phase&&E.auction&&(0,s.jsx)(S,{auction:E.auction,seatLabel:U,busy:y,onCall:e=>W({type:"bid",call:e})}),(0,s.jsxs)("div",{className:"gt__table",children:[(0,s.jsxs)("div",{className:"gt__scores",children:[(0,s.jsxs)("span",{className:"gt__score is-you",title:"Your partnership",children:["You & ",U(q)," \xb7 ",E.tricksWon[J]]}),(0,s.jsxs)("span",{className:"gt__score",title:"Opponents",children:[U((E.yourSeat+1)%4)," & ",U((E.yourSeat+3)%4)," \xb7 ",E.tricksWon[+(0===J)]]})]}),(0,s.jsx)("div",{className:"gt__trick",children:0===E.currentTrick.length?(0,s.jsx)("span",{className:"gt__muted",children:"play"===E.phase?"waiting for the lead…":""}):E.currentTrick.map(e=>{var t;return(0,s.jsxs)("span",{className:"gt__play",children:[(0,s.jsxs)("span",{className:"gt__chip ".concat(N(e.card.suit)?"is-red":""),children:[null!=(t=g[e.card.rank])?t:e.card.rank,b[e.card.suit]]}),(0,s.jsx)("em",{children:U(e.seat)})]},e.seat)})})]}),K&&(0,s.jsxs)("div",{className:"gt__declare",children:[(0,s.jsxs)("label",{children:["Level"," ",(0,s.jsx)("select",{value:R,onChange:e=>P(Number(e.target.value)),children:K.levels.map(e=>(0,s.jsxs)("option",{value:e,children:[e," (win ",6+e,")"]},e))})]}),(0,s.jsx)("div",{className:"gt__strains",children:K.strains.map(e=>(0,s.jsx)("button",{className:"gt__strain ".concat("NT"!==e&&N(e)?"is-red":""),disabled:y,onClick:()=>W({type:"declare",strain:e,level:R}),children:"NT"===e?"NT":b[e]},e))})]}),Q&&(0,s.jsxs)("div",{className:"gt__dummy",children:[(0,s.jsxs)("span",{className:"gt__dummylabel",children:["Dummy \xb7 ",U(E.dummySeat),E.yourSeat===E.declarer?" (you play this hand)":""]}),(0,s.jsx)("div",{className:"gt__hand",children:k(E.dummyHand).map(e=>{var t;return(0,s.jsxs)("button",{className:"gt__card ".concat(N(e.suit)?"is-red":""," ").concat(F(e)?"is-legal":""),disabled:!F(e)||y,onClick:()=>W({type:"play",card:e}),children:[(0,s.jsx)("span",{children:null!=(t=g[e.rank])?t:e.rank}),(0,s.jsx)("span",{children:b[e.suit]})]},"d".concat(e.suit).concat(e.rank))})})]}),(0,s.jsx)("div",{className:"gt__hand",children:k(E.yourHand).map(e=>{var t;return(0,s.jsxs)("button",{className:"gt__card ".concat(N(e.suit)?"is-red":""," ").concat(F(e)?"is-legal":"play"!==E.phase?"is-shown":""),disabled:!F(e)||y,onClick:()=>W({type:"play",card:e}),children:[(0,s.jsx)("span",{children:null!=(t=g[e.rank])?t:e.rank}),(0,s.jsx)("span",{children:b[e.suit]})]},"".concat(e.suit).concat(e.rank))})}),"done"===E.phase&&(0,s.jsxs)("div",{className:"gt__done",children:[E.resultText&&(0,s.jsx)("p",{className:"gt__result",children:E.resultText}),B(Y," again")]}),T&&(0,s.jsx)("p",{className:"gt__err",children:T})]})}function S(e){let{auction:t,seatLabel:a,busy:n,onCall:l}=e,i=!!t.legal;return(0,s.jsxs)("div",{className:"gt__auction",children:[(0,s.jsx)("div",{className:"gt__bidhistory",children:0===t.calls.length?(0,s.jsxs)("span",{className:"gt__muted",children:[a(t.dealer)," deals — bidding opens"]}):t.calls.map((e,t)=>{var n;return(0,s.jsxs)("span",{className:"gt__bidcall",children:[(0,s.jsx)("em",{children:a(e.seat)})," ","pass"===(n=e.call).kind?"Pass":"double"===n.kind?"X":"redouble"===n.kind?"XX":"".concat(n.level).concat(y[n.strain])]},t)})}),i?(0,s.jsxs)("div",{className:"gt__bidbox",children:[(0,s.jsxs)("div",{className:"gt__bidcalls",children:[(0,s.jsx)("button",{className:"gt__bidpass",disabled:n,onClick:()=>l({kind:"pass"}),children:"Pass"}),t.legal.canDouble&&(0,s.jsx)("button",{className:"gt__biddbl",disabled:n,onClick:()=>l({kind:"double"}),children:"Double"}),t.legal.canRedouble&&(0,s.jsx)("button",{className:"gt__biddbl",disabled:n,onClick:()=>l({kind:"redouble"}),children:"Redouble"})]}),(0,s.jsx)("div",{className:"gt__bidgrid",children:[1,2,3,4,5,6,7].map(e=>(0,s.jsxs)("div",{className:"gt__bidrow",children:[(0,s.jsx)("span",{className:"gt__bidlevel",children:e}),j.map(a=>{let i=5*e+j.indexOf(a)>t.legal.minBidRank;return(0,s.jsx)("button",{className:"gt__bidcell ".concat("NT"!==a&&N(a)?"is-red":""),disabled:!i||n,onClick:()=>l({kind:"bid",level:e,strain:a}),children:y[a]},a)})]},e))})]}):(0,s.jsxs)("p",{className:"gt__muted",children:["Waiting for ",a(t.turn)," to bid…"]})]})}function w(e){var t,a,l,i,r,c,o;let{config:d,busy:u,err:p,onCancel:h,onStart:m}=e,_=null!=(l=null==d?void 0:d.packs)?l:[],x=null!=(i=null==d?void 0:d.roun
1ds)?i:{min:3,max:5,default:3},[b,g]=(0,n.useState)(null!=(c=null!=(r=null==(t=_.find(e=>"mix"===e.id))?void 0:t.id)?r:null==(a=_[0])?void 0:a.id)?c:"mix"),[v,j]=(0,n.useState)(x.default),y=Array.from({length:x.max-x.min+1},(e,t)=>x.min+t);return(0,s.jsxs)("div",{className:"gt",children:[(0,s.jsxs)("div",{className:"gt__head",children:[(0,s.jsx)("strong",{children:"Same Page ✦"}),(0,s.jsx)("span",{className:"gt__sub",children:"pick a vibe — or set your own. You’re the host."})]}),(0,s.jsx)("div",{className:"gt__picker",children:(null!=(o=null==d?void 0:d.presets)?o:[]).map(e=>(0,s.jsxs)("button",{className:"gt__pick",disabled:u,onClick:()=>m(e.pack,e.rounds),children:[(0,s.jsx)("strong",{children:e.label}),(0,s.jsx)("span",{children:e.sub})]},e.id))}),_.length>0&&(0,s.jsxs)("div",{className:"sp__custom",children:[(0,s.jsx)("span",{className:"sp__custom-h",children:"or set your own"}),(0,s.jsxs)("div",{className:"sp__custom-row",children:[(0,s.jsxs)("label",{children:["Pack"," ",(0,s.jsx)("select",{value:b,onChange:e=>g(e.target.value),disabled:u,children:_.map(e=>(0,s.jsxs)("option",{value:e.id,children:[e.emoji," ",e.label," — ",e.blurb]},e.id))})]}),(0,s.jsxs)("label",{children:["Rounds"," ",(0,s.jsx)("select",{value:v,onChange:e=>j(Number(e.target.value)),disabled:u,children:y.map(e=>(0,s.jsx)("option",{value:e,children:e},e))})]})]})]}),(0,s.jsxs)("div",{className:"sp__setup-actions",children:[(0,s.jsx)("button",{className:"gt__pick sp__send",disabled:u,onClick:()=>m(b,v),children:"Start Same Page"}),(0,s.jsx)("button",{className:"sp__cancel",disabled:u,onClick:h,children:"Back"})]}),p&&(0,s.jsx)("p",{className:"gt__err",children:p})]})}function C(e){let{state:t,busy:a,err:l,inPerson:i,seatNames:r,onSubmit:c,onNext:o,onStart:d}=e,[u,p]=(0,n.useState)(""),h=e=>{var a;return e===t.yourSeat?"You":null!=(a=i?null==r?void 0:r[e]:void 0)?a:"Seat ".concat(e+1)},m=t.round>=t.totalRounds;return(0,s.jsxs)("div",{className:"gt",children:[(0,s.jsxs)("div",{className:"gt__head",children:[(0,s.jsx)("strong",{children:"Same Page ✦"}),(0,s.jsx)("span",{className:"gt__sub",children:t.headline})]}),i&&"collect"===t.phase&&(0,s.jsx)("p",{className:"sp__heads",children:"Heads up — answer on your phone, then look up at the table."}),i&&"reveal"===t.phase&&(0,s.jsx)("p",{className:"sp__lookup",children:"Look up — here’s where the table landed together."}),(0,s.jsxs)("div",{className:"sp__meta",children:[(0,s.jsxs)("span",{className:"sp__round",children:["Round ",t.round," of ",t.totalRounds]}),(0,s.jsxs)("span",{className:"sp__score",title:"Patches of common ground — the table’s score, never a person’s",children:[t.tableScore," common ground"]})]}),(0,s.jsx)("p",{className:"sp__prompt",children:t.prompt}),"collect"===t.phase&&(null==t.yourAnswer?(0,s.jsxs)("form",{className:"sp__form",onSubmit:e=>{e.preventDefault();let t=u.trim();t&&c(t),p("")},children:[(0,s.jsx)("input",{className:"sp__input",value:u,maxLength:40,placeholder:"a couple of words…",onChange:e=>p(e.target.value),disabled:a,autoFocus:!0}),(0,s.jsx)("button",{className:"gt__pick sp__send",type:"submit",disabled:a||!u.trim(),children:"Lock it in"})]}):(0,s.jsxs)("p",{className:"sp__waiting",children:["You said ",(0,s.jsxs)("strong",{children:["“",t.yourAnswer,"”"]})," \xb7 ",t.submittedCount," of ",t.seatCount," in — waiting for the room…"]})),"reveal"===t.phase&&t.reveal&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("ul",{className:"sp__groups",children:t.reveal.groups.map((e,t)=>{let a=e.seats.length>=2;return(0,s.jsxs)("li",{className:"sp__group ".concat(a?"is-match":""),children:[(0,s.jsx)("span",{className:"sp__answer",children:e.text}),(0,s.jsx)("span",{className:"sp__who",children:a?e.seats.map(h).join(" + "):h(e.seats[0])})]},t)})}),(0,s.jsx)("button",{className:"gt__pick sp__next",disabled:a,onClick:o,children:m?"See how you did →":"Next round →"})]}),"done"===t.phase&&(0,s.jsxs)("div",{className:"gt__done",children:[t.resultText&&(0,s.jsx)("p",{className:"gt__result",children:t.resultText}),i&&(0,s.jsx)("p",{className:"sp__afterglow",children:"That common ground is yours to keep — it’s the start of knowing each other."}),(0,s.jsx)("div",{className:"gt__picker",children:x(i).map(e=>(0,s.jsxs)("button",{className:"gt__pick",disabled:a,onClick:()=>d(e.id),children:[(0,s.jsx)("strong",{children:e.id===t.type?"".concat(e.name," again"):e.name}),(0,s.jsx)("span",{children:e.sub})]},e.id))})]}),l&&(0,s.jsx)("p",{className:"gt__err",children:l})]})}let T=[4,6,8,10,12,20,100];function M(e){var t,a;let{state:l,busy:o,err:d,soakId:u,seatNames:p,spectator:_=!1,onMove:x,onStart:b}
1=e,[g,v]=(0,n.useState)(""),[j,y]=(0,n.useState)(""),[N,k]=(0,n.useState)(!1),[f,S]=(0,n.useState)(""),[w,C]=(0,n.useState)(""),[M,P]=(0,n.useState)(!1),[I,H]=(0,n.useState)(!1);(0,n.useEffect)(()=>{try{H("on"===localStorage.getItem("pt-dice-sound"))}catch(e){}},[]);let O=(0,n.useRef)(0);(0,n.useEffect)(()=>{var e,t;let a=null!=(t=null==(e=l.rolls[0])?void 0:e.n)?t:0;0!==O.current&&a>O.current&&I&&function(){try{var e;let t=null!=(e=window.AudioContext)?e:window.webkitAudioContext;if(!t)return;let a=new t,s=a.currentTime;for(let e=0;e<4;e+=1){let t=s+.055*e+.02*Math.random(),n=a.createOscillator();n.type="triangle",n.frequency.value=1700+800*Math.random()-160*e;let l=a.createGain();l.gain.setValueAtTime(1e-4,t),l.gain.exponentialRampToValueAtTime(Math.max(.02,.11-.02*e),t+.004),l.gain.exponentialRampToValueAtTime(1e-4,t+.05),n.connect(l).connect(a.destination),n.start(t),n.stop(t+.06)}setTimeout(()=>{a.close()},600)}catch(e){}}(),O.current=a},[l.rolls,I]);let V=e=>{var t;return e===l.yourSeat?"You":null!=(t=null==p?void 0:p[e])?t:"Seat ".concat(e+1)},Y=(e,t)=>{let a={type:"roll",expression:e},s=j.trim();s&&(a.label=s),l.youAreGm&&N&&(a.hidden=!0),t&&(a.keep=t),x(a),y("")},W=l.initiative,B=V(l.gmSeat);return"done"===l.phase?(0,s.jsxs)("div",{className:"gt",children:[(0,s.jsxs)("div",{className:"gt__head",children:[(0,s.jsx)("span",{className:"gt__head-ico","aria-hidden":!0,children:(0,s.jsx)(h,{})}),(0,s.jsx)("strong",{children:"Party Table"}),(0,s.jsx)("span",{className:"gt__sub",children:"session wrapped"})]}),(0,s.jsxs)("div",{className:"gt__done",children:[l.resultText&&(0,s.jsx)("p",{className:"gt__result",children:l.resultText}),(0,s.jsx)(D,{soakId:u,youAreGm:l.youAreGm}),(0,s.jsx)("p",{className:"pt__journal-link",children:(0,s.jsx)("a",{href:"/campaign/".concat(u),children:"Read the campaign journal — the story so far"})}),(0,s.jsx)("div",{className:"gt__picker",children:m.filter(e=>"table"===e.family).map(e=>(0,s.jsxs)("button",{className:"gt__pick",disabled:o,onClick:()=>b(e.id),children:[(0,s.jsx)("strong",{children:"Set the table again"}),(0,s.jsx)("span",{children:e.sub})]},e.id))})]}),d&&(0,s.jsx)("p",{className:"gt__err",children:d})]}):(0,s.jsxs)("div",{className:"gt",style:{opacity:o?.6:1,transition:"opacity 0.18s ease"},children:[(0,s.jsxs)("div",{className:"gt__head",children:[(0,s.jsx)("span",{className:"gt__head-ico","aria-hidden":!0,children:(0,s.jsx)(h,{})}),(0,s.jsx)("strong",{children:"Party Table"}),(0,s.jsx)("span",{className:"gt__sub",children:l.headline.replace(/Seat (\d+)/g,(e,t)=>V(Number(t)-1))}),!_&&(0,s.jsx)("button",{type:"button",className:"pt__sound",onClick:()=>{H(e=>{let t=!e;try{localStorage.setItem("pt-dice-sound",t?"on":"off")}catch(e){}return t})},title:"Dice sound",children:I?"Dice sound on":"Dice sound off"})]}),(0,s.jsx)("div",{className:"pt__gm-note",children:_?"You’re watching this table. Like what you see? Ask the room for a seat.":l.youAreGm?"You’re running the table (GM).":"".concat(B," is running the table (GM).")}),l.previously&&(0,s.jsxs)("div",{className:"pt__previously",children:[(0,s.jsx)("span",{className:"pt__previously-label",children:"Previously, at this table"}),(0,s.jsx)("p",{children:l.previously})]}),l.call?(0,s.jsxs)("div",{className:"pt__call",children:[(0,s.jsxs)("a",{className:"pt__call-join",href:l.call.url,target:"_blank",rel:"noopener noreferrer",children:["Join the call \xb7 ",null!=(a=l.call.label)?a:"video",l.call.code?" \xb7 ".concat(l.call.code):""]}),l.youAreGm&&(0,s.jsx)("button",{className:"pt__init-btn",disabled:o,onClick:()=>x({type:"set-call",url:""}),children:"Unlink"})]}):l.youAreGm&&(0,s.jsx)(A,{busy:o,onLink:e=>x({type:"set-call",url:e})}),!_&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"pt__dice-row",role:"group","aria-label":"Roll one die",children:[T.map(e=>(0,s.jsxs)("button",{className:"pt__die",disabled:o,onClick:()=>Y("d".concat(e)),children:["d",e]},e)),(0,s.jsx)("button",{className:"pt__die pt__die--edge",disabled:o,onClick:()=>Y("2d20","high"),title:"2d20, keep the higher",children:"Advantage"}),(0,s.jsx)("button",{className:"pt__die pt__die--edge",disabled:o,onClick:()=>Y("2d20","low"),title:"2d20, keep the lower",children:"Disadvantage"})]}),(0,s.jsxs)("form",{className:"pt__form",onSubmit:e=>{e.preventDefault();let t=g.trim();t&&Y(t),v("")},children:[(0,s.jsx)("input",{className:"pt__input",value:g,placeholder:"3d6+2, d20+5…",onChange:e=>v(e.target.value),disabled:o,"aria-label":"Roll expression"}),(0,s.jsx)("input",{className:"pt__input pt__input--label",value:j,maxLength:40,placeholder:"what for? (stealth check)",onChange:e=>y(e.target.value),disabled:o,"aria-label":"What this roll is for"}),(0,s.jsx)("button",{className:"gt__pick pt__roll",type:"submit",disabled:o||!g.trim(),children:"Roll"})]}),l.youAreGm&&(0,s.jsxs)("label",{className:"pt__screen",children:[(0,s.jsx)("input",{type:"checkbox",checked:N,onChange:e=>k(e.target.checked),disabled:o}),(0,s.jsx)("span",{children:"Roll behind the screen (only you see the result until you reveal it)"})]})]}),(0,s.jsxs)("div",{className:"pt__initiative",children:[!W&&l.youAreGm&&(0,s.jsx)("button",{className:"pt__init-btn",disabled:o,onClick:()=>x({type:"initiative-start"}),children:"Call for initiative"}),(null==W?void 0:W.open)&&(0,s.jsxs)("div",{className:"pt__init-open",children:[(0,s.jsx)("div",{className:"pt__init-head",children:"Initiative — rolling in"}),(0,s.jsx)("ul",{className:"pt__init-list",children:W.entries.map((e,t)=>(0,s.jsxs)("li",{children:[(0,s.jsx)("span",{children:null==e.seat?e.label:V(e.seat)}),(0,s.jsx)("strong",{children:e.value})]},t))}),(0,s.jsxs)("div",{className:"pt__init-actions",children:[!_&&(0,s.jsx)("button",{className:"pt__init-btn",disabled:o,onClick:()=>x({type:"initiative-join"}),children:W.entries.some(e=>e.seat===l.yourSeat)?"Re-roll yours":"Roll in (d20)"}),l.youAreGm&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("form",{className:"pt__npc",onSubmit:e=>{e.preventDefault();let t=f.trim();t&&x({type:"initiative-npc",label:t}),S("")},children:[(0,s.jsx)("input",{className:"pt__input",value:f,maxLength:40,placeholder:"add the other side (“goblin archers”)",onChange:e=>S(e.target.value),disabled:o,"aria-label":"NPC name"}),(0,s.jsx)("button",{className:"pt__init-btn",type:"submit",disabled:o||!f.trim(),children:"Add"})]}),(0,s.jsx)("button",{className:"pt__init-btn pt__init-btn--go",disabled:o||0===W.entries.length,onClick:()=>x({type:"initiative-begin"}),children:"Lock the order"})]})]})]}),W&&!W.open&&(0,s.jsxs)("div",{className:"pt__init-run",children:[(0,s.jsxs)("div",{className:"pt__init-head",children:["Initiative — round ",W.round]}),(0,s.jsx)("ol",{className:"pt__init-list",children:W.entries.map((e,t)=>(0,s.jsxs)("li",{className:t===W.turn?"is-turn":"",children:[(0,s.jsx)("span",{children:null==e.seat?e.label:V(e.seat)}),(0,s.jsx)("strong",{children:e.value})]},t))}),(0,s.jsxs)("div",{className:"pt__init-actions",children:[(l.youAreGm||(null==(t=W.entries[W.turn])?void 0:t.seat)===l.yourSeat)&&(0,s.jsx)("button",{className:"pt__init-btn",disabled:o,onClick:()=>x({type:"initiative-next"}),children:"Next turn"}),l.youAreGm&&(0,s.jsx)("button",{className:"pt__init-btn",disabled:o,onClick:()=>x({type:"initiative-end"}),children:"Out of initiative"})]})]})]}),(0,s.jsx)(R,{state:l,busy:o,seatLabel:V,onMove:x,spectator:_}),(0,s.jsx)(L,{state:l,busy:o,seatLabel:V,onMove:x,spectator:_}),(0,s.jsxs)("details",{className:"pt__reference",children:[(0,s.jsx)("summary",{children:"Table reference — conditions and actions"}),(0,s.jsxs)("div",{className:"pt__ref-cols",children:[(0,s.jsx)("dl",{children:r.map(e=>(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{children:e.term}),(0,s.jsx)("dd",{children:e.text})]},e.term))}),(0,s.jsx)("dl",{children:c.map(e=>(0,s.jsxs)("div",{children:[(0,s.jsx)("dt",{children:e.term}),(0,s.jsx)("dd",{children:e.text})]},e.term))})]})]}),(0,s.jsx)("ol",{className:"pt__log","aria-label":"Roll log — newest first",children:l.rolls.map(e=>(0,s.jsx)("li",{className:"pt__roll-row ".concat(e.hidden?"is-hidden":""),children:null==e.expression?(0,s.jsxs)("span",{className:"pt__hidden-note",children:[V(e.seat)," rolled behind the screen…"]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"pt__who",children:V(e.seat)}),(0,s.jsxs)("span",{className:"pt__expr",children:[e.expression,e.label?(0,s.jsxs)("em",{children:[" \xb7 ",e.label]}):null,e.hidden?(0,s.jsx)("em",{children:" \xb7 behind the screen"}):null]}),(0,s.jsxs)("span",{className:"pt__dice",children:[e.dice.map((e,t)=>(0,s.jsx)("span",{className:"pt__chip ".concat(e.dropped?"is-dropped":""),children:e.value},t)),0!==e.modifier&&(0,s.jsx)("span",{className:"pt__chip pt__chip--mod",children:e.modifier>0?"+".concat(e.modifier):e.modifier})]}),(0,s.jsx)("span",{className:"pt__total",children:e.total}
1),l.youAreGm&&e.hidden&&(0,s.jsx)("button",{className:"pt__init-btn",disabled:o,onClick:()=>x({type:"reveal",n:e.n}),children:"Reveal"})]})},e.n))}),l.youAreGm&&(0,s.jsxs)("div",{className:"pt__gm-row",children:[(0,s.jsxs)("form",{action:i.C,className:"pt__ask",children:[(0,s.jsx)("input",{type:"hidden",name:"soakId",value:u}),(0,s.jsx)("input",{type:"hidden",name:"text",value:"Our tabletop party has an open seat — new players welcome, we’ll teach as we go."}),(0,s.jsx)("button",{className:"pt__init-btn",type:"submit",disabled:o,title:"Ask the room for one more player",children:"Open a seat"})]}),(0,s.jsx)(G,{soakId:u,busy:o}),M?(0,s.jsxs)("form",{className:"pt__wrap-form",onSubmit:e=>{e.preventDefault(),x({type:"end-session",recap:w.trim()||void 0})},children:[(0,s.jsx)("textarea",{className:"pt__input pt__recap",value:w,maxLength:600,rows:3,placeholder:"How did tonight end? The party will see this next session: “Previously, at this table…”",onChange:e=>C(e.target.value),disabled:o,"aria-label":"Session recap"}),(0,s.jsxs)("div",{className:"pt__init-actions",children:[(0,s.jsx)("button",{className:"pt__init-btn pt__init-btn--go",type:"submit",disabled:o,children:"Wrap the session"}),(0,s.jsx)("button",{className:"pt__wrap",type:"button",disabled:o,onClick:()=>P(!1),children:"Keep playing"})]})]}):(0,s.jsx)("button",{className:"pt__wrap",disabled:o,onClick:()=>P(!0),children:"Wrap the session"})]}),d&&(0,s.jsx)("p",{className:"gt__err",children:d})]})}function A(e){let{busy:t,onLink:a}=e,[l,i]=(0,n.useState)("");return(0,s.jsxs)("form",{className:"pt__call-form",onSubmit:e=>{e.preventDefault();let t=l.trim();t&&a(t),i("")},children:[(0,s.jsx)("input",{className:"pt__input",value:l,placeholder:"paste your call link (Meet, Zoom, Teams, Discord…)",onChange:e=>i(e.target.value),disabled:t,"aria-label":"Video call link"}),(0,s.jsx)("button",{className:"pt__init-btn",type:"submit",disabled:t||!l.trim(),children:"Link the call"})]})}function R(e){var t,a,l,i,r,c,o,d;let{state:u,busy:p,seatLabel:h,onMove:m,spectator:_=!1}=e,[x,b]=(0,n.useState)(!1),g=u.sheets.find(e=>e.seat===u.yourSeat),[v,j]=(0,n.useState)(null!=(t=null==g?void 0:g.name)?t:""),[y,N]=(0,n.useState)(null!=(a=null==g?void 0:g.concept)?a:""),[k,f]=(0,n.useState)(null!=(l=null==g?void 0:g.system)?l:""),[S,w]=(0,n.useState)(null!=(i=null==g?void 0:g.story)?i:""),[C,T]=(0,n.use
1State)(null!=(r=null==g?void 0:g.checkDie)?r:"d20"),[M,A]=(0,n.useState)(null!=(c=null==g?void 0:g.stats)?c:[]),[R,P]=(0,n.useState)(null!=(o=null==g?void 0:g.notes)?o:""),[L,D]=(0,n.useState)(null!=(d=null==g?void 0:g.macros)?d:[]),G=u.sheets.filter(e=>{var t;return e.name||e.concept||e.system||e.story||(null==(t=e.macros)?void 0:t.length)});return(0,s.jsxs)("section",{className:"pt__sheets",children:[(0,s.jsxs)("div",{className:"pt__section-head",children:[(0,s.jsx)("span",{className:"pt__init-head",children:"The party"}),!_&&(0,s.jsx)("button",{className:"pt__init-btn",disabled:p,onClick:()=>{if(!x){var e,t,a,s,n,l,i,r;j(null!=(e=null==g?void 0:g.name)?e:""),N(null!=(t=null==g?void 0:g.concept)?t:""),f(null!=(a=null==g?void 0:g.system)?a:""),w(null!=(s=null==g?void 0:g.story)?s:""),T(null!=(n=null==g?void 0:g.checkDie)?n:"d20"),A(null!=(l=null==g?void 0:g.stats)?l:[]),P(null!=(i=null==g?void 0:g.notes)?i:""),D(null!=(r=null==g?void 0:g.macros)?r:[])}b(!x)},children:x?"Close":(null==g?void 0:g.name)||(null==g?void 0:g.concept)?"Edit your sheet":"Make your sheet"})]}),G.length>0&&(0,s.jsx)("ul",{className:"pt__party",children:G.map(e=>{var t;return(0,s.jsxs)("li",{className:"pt__member",children:[(0,s.jsx)("strong",{children:null!=(t=e.name)?t:h(e.seat)}),e.concept&&(0,s.jsxs)("span",{children:[" \xb7 ",e.concept]}),e.system&&(0,s.jsxs)("span",{children:[" \xb7 ",e.system]}),(0,s.jsxs)("em",{children:[" (",h(e.seat),")"]}),e.story&&(0,s.jsx)("p",{className:"pt__character-story",children:e.story}),e.stats&&e.stats.length>0&&(0,s.jsx)("span",{className:"pt__stats",children:e.stats.map(t=>{var a;let n=/^[+-]?\d{1,2}$/.test(t.value.trim())?parseInt(t.value,10):null,l=e.seat===u.yourSeat;if(null===n||!l)return(0,s.jsxs)("span",{className:"pt__chip",children:[t.key," ",t.value]},t.key);let i=null!=(a=e.checkDie)?a:"d20",r="".concat(i).concat(n>=0?"+".concat(n):n);return(0,s.jsxs)("button",{type:"button",className:"pt__chip pt__chip--macro",disabled:p,title:"Roll ".concat(r),onClick:()=>{var a;return m({type:"roll",expression:r,label:"".concat(null!=(a=e.name)?a:"you"," \xb7 ").concat(t.key)})},children:[t.key," ",t.value]},t.key)})}),e.macros&&e.macros.length>0&&(0,s.jsx)("span",{className:"pt__stats",children:e.macros.map(t=>e.seat!==u.yourSeat||_?(0,s.jsxs)("span",{className:"pt__chip",children:[t.name," \xb7 ",t.expression]},t.name):(0,s.jsxs)("button",{type:"button",className:"pt__chip pt__chip--macro",disabled:p,title:"Roll ".concat(t.expression),onClick:()=>{var a;return m({type:"roll",expression:t.expression,label:"".concat(null!=(a=e.name)?a:"you"," \xb7 ").concat(t.name)})},children:[t.name," \xb7 ",t.expression]},t.name))})]},e.seat)})}),x&&(0,s.jsxs)("form",{className:"pt__sheet-form",onSubmit:e=>{e.preventDefault(),m({type:"set-sheet",sheet:{name:v,concept:y,system:k,story:S,checkDie:C,stats:M,notes:R,macros:L}}),b(!1)},children:[(0,s.jsxs)("div",{className:"pt__sheet-row",children:[(0,s.jsx)("input",{className:"pt__input",value:v,maxLength:40,placeholder:"character name",onChange:e=>j(e.target.value),"aria-label":"Character name"}),(0,s.jsx)("input",{className:"pt__input",value:y,maxLength:80,placeholder:"concept — “halfling baker turned burglar”",onChange:e=>N(e.target.value),"aria-label":"Character concept"})]}),(0,s.jsxs)("div",{className:"pt__sheet-row",children:[(0,s.jsx)("input",{className:"pt__input",value:k,maxLength:40,placeholder:"game system",onCh
1ange:e=>f(e.target.value),"aria-label":"Game system"}),(0,s.jsx)("select",{className:"pt__input",value:C,onChange:e=>T(e.target.value),"aria-label":"Character check die",children:[4,6,8,10,12,20,100].map(e=>(0,s.jsxs)("option",{value:"d".concat(e),children:["d",e]},e))})]}),(0,s.jsx)("textarea",{className:"pt__input pt__recap",value:S,maxLength:1200,rows:4,placeholder:"shared lifepath, drives, relationships, public ties, and goals",onChange:e=>w(e.target.value),"aria-label":"Shared character story"}),M.map((e,t)=>(0,s.jsxs)("div",{className:"pt__sheet-row",children:[(0,s.jsx)("input",{className:"pt__input pt__input--stat",value:e.key,maxLength:16,placeholder:"stat (STR, AC, HP…)",onChange:e=>A(M.map((a,s)=>s===t?{...a,key:e.target.value}:a)),"aria-label":"Stat name"}),(0,s.jsx)("input",{className:"pt__input pt__input--stat",value:e.value,maxLength:12,placeholder:"value",onChange:e=>A(M.map((a,s)=>s===t?{...a,value:e.target.value}:a)),"aria-label":"Stat value"}),(0,s.jsx)("button",{className:"pt__init-btn",type:"button",onClick:()=>A(M.filter((e,a)=>a!==t)),"aria-label":"Remove stat",children:"Remove"})]},t)),M.length<12&&(0,s.jsx)("button",{className:"pt__init-btn",type:"button",onClick:()=>A([...M,{key:"",value:""}]),children:"Add a stat"}),L.map((e,t)=>(0,s.jsxs)("div",{className:"pt__sheet-row",children:[(0,s.jsx)("input",{className:"pt__input pt__input--stat",value:e.name,maxLength:20,placeholder:"macro (Greataxe)",onChange:e=>D(L.map((a,s)=>s===t?{...a,name:e.target.value}:a)),"aria-label":"Macro name"}),(0,s.jsx)("input",{className:"pt__input pt__input--stat",value:e.expression,maxLength:24,placeholder:"1d12+4",onChange:e=>D(L.map((a,s)=>s===t?{...a,expression:e.target.value}:a)),"aria-label":"Macro roll expression"}),(0,s.jsx)("button",{className:"pt__init-btn",type:"button",onClick:()=>D(L.filter((e,a)=>a!==t)),"aria-label":"Remove macro",children:"Remove"})]},"macro-".concat(t))),L.length<4&&(0,s.jsx)("button",{className:"pt__init-btn",type:"button",onClick:()=>D([...L,{name:"",expression:""}]),children:"Add a roll macro"}),(0,s.jsx)("textarea",{className:"pt__input pt__recap",value:R,maxLength:500,rows:2,placeholder:"private notes — only you and the GM see stats and notes",onChange:e=>P(e.target.value),"aria-label":"Character notes"}),(0,s.jsx)("button",{className:"pt__init-btn pt__init-btn--go",type:"submit",disabled:p,children:"Save sheet"})]})]})}let P=e=>{var t;return null!=(t=({blinded:"BL",charmed:"CH",frightened:"FR",grappled:"GR",incapacitated:"IN",invisible:"IV",paralyzed:"PA",poisoned:"PO",prone:"PR",restrained:"RE",stunned:"ST",unconscious:"UN"})[e])?t:e.slice(0,2).toUpperCase()};function L(e){var t;let{state:a,busy:l,seatLabel:i,onMove:r,spectator:c=!1}
1=e,[o,u]=(0,n.useState)(null),[p,h]=(0,n.useState)(""),[m,_]=(0,n.useState)(""),[x,b]=(0,n.useState)(!1),[g,v]=(0,n.useState)(null),[j,y]=(0,n.useState)(null),N=a.board;if(!N)return a.youAreGm?(0,s.jsxs)("section",{className:"pt__board-setup",children:[(0,s.jsx)("span",{className:"pt__init-head",children:"Battle board"}),(0,s.jsx)("div",{className:"pt__init-actions",children:[{c:8,r:6},{c:12,r:8},{c:16,r:10}].map(e=>{let{c:t,r:a}=e;return(0,s.jsxs)("button",{className:"pt__init-btn",disabled:l,onClick:()=>r({type:"board-set",cols:t,rows:a}),children:[t," \xd7 ",a]},"".concat(t,"x").concat(a))})})]}):null;let k=e=>!c&&(a.youAreGm||e.seat===a.yourSeat),f=null!=(t=N.tokens.find(e=>e.id===o))?t:null,S=(e,t)=>{if(l||c)return;if(g&&a.youAreGm)return j?(r({type:"board-template",kind:g,ax:j[0],ay:j[1],bx:e,by:t}),v(null),void y(null)):void y([e,t]);if(x&&a.youAreGm&&p.trim()){r({type:"token-add",label:p.trim(),seat:""===m?void 0:Number(m),x:e,y:t}),b(!1),h(""),_("");return}let s=N.tokens.find(a=>a.x===e&&a.y===t);if(s)return void u(k(s)?o===s.id?null:s.id:o);f&&k(f)&&(r({type:"token-move",id:f.id,x:e,y:t}),u(null))};return(0,s.jsxs)("section",{className:"pt__board",children:[(0,s.jsxs)("div",{className:"pt__section-head",children:[(0,s.jsxs)("span",{className:"pt__init-head",children:["Battle board \xb7 ",N.cols," \xd7 ",N.rows]}),a.youAreGm&&(0,s.jsxs)("div",{className:"pt__init-actions",children:[f&&(0,s.jsxs)("button",{className:"pt__init-btn",disabled:l,onClick:()=>{r({type:"token-remove",id:f.id}),u(null)},children:["Remove ",f.label]}),["circle","cone","line"].map(e=>(0,s.jsx)("button",{className:"pt__init-btn ".concat(g===e?"pt__init-btn--go":""),disabled:l,title:"Tap the anchor square, then the reach",onClick:()=>{v(g===e?null:e),y(null)},children:e},e)),N.template&&(0,s.jsx)("button",{className:"pt__init-btn",disabled:l,onClick:()=>r({type:"board-template-clear"}),children:"Clear template"}),(0,s.jsx)("button",{className:"pt__init-btn",disabled:l,onClick:()=>r({type:"board-clear"}),children:"Clear board"})]})]}),a.youAreGm&&(0,s.jsxs)("div",{className:"pt__board-add",children:[(0,s.jsx)("input",{className:"pt__input pt__input--stat",value:p,maxLength:16,placeholder:"piece name",onChange:e=>h(e.target.value),"aria-label":"Piece name"}),(0,s.jsxs)("select",{className:"pt__input pt__input--stat",value:m,onChange:e=>_(e.target.value),"aria-label":"Whose piece",children:[(0,s.jsx)("option",{value:"",children:"GM piece"}),Array.from({length:a.seatCount},(e,t)=>(0,s.jsx)("option",{value:t,children:i(t)},t))]}),(0,s.jsx)("button",{className:"pt__init-btn ".concat(x?"pt__init-btn--go":""),type:"button",disabled:l||!p.trim(),onClick:()=>b(!x),children:x?"Tap a square…":"Place piece"})]}),(0,s.jsxs)("svg",{className:"pt__grid",viewBox:"0 0 ".concat(40*N.cols," ").concat(40*N.rows),role:"grid","aria-label":"Battle board",children:[Array.from({length:N.rows},(e,t)=>Array.from({length:N.cols},(e,a)=>(0,s.jsx)("rect",{x:40*a,y:40*t,width:40,height:40,className:"pt__cell ".concat((a+t)%2?"pt__cell--alt":""),onClick:()=>S(a,t)},"".concat(a,"-").concat(t)))),N.template&&(()=>{let e=N.template,t=[(e.ax+.5)*40,(e.ay+.5)*40],a=[(e.bx+.5)*40,(e.by+.5)*40],n=a[0]-t[0],l=a[1]-t[1],i=Math.max(1,Math.hypot(n,l));if("circle"===e.kind)return(0,s.jsx)("circle",{className:"pt__template",cx:t[0],cy:t[1],r:i});if("line"===e.kind)return(0,s.jsx)("line",{className:"pt__template pt__template--line",x1:t[0],y1:t[1],x2:a[0],y2:a[1]});let r=-l/i*(i/2),c=n/i*(i/2);return(0,s.jsx)("polygon",{className:"pt__template",points:"".concat(t[0],",").concat(t[1]," ").concat(a[0]+r,",").concat(a[1]+c," ").concat(a[0]-r,",").concat(a[1]-c)})})(),N.tokens.map(e=>{var t;return(0,s.jsxs)("g",{className:"pt__token ".concat(o===e.id?"is-selected":""," ").concat(k(e)?"is-mine":""),transform:"translate(".concat((e.x+.5)*40,", ").concat((e.y+.5)*40,")"),onClick:()=>S(e.x,e.y),children:[(0,s.jsx)("circle",{r:15.2,fill:e.color}),(0,s.jsx)("text",{textAnchor:"middle",dy:"0.35em",children:e.label.slice(0,2)}),e.conditions&&e.conditions.length>0&&(0,s.jsx)("text",{className:"pt__cond-text",textAnchor:"middle",y:18.400000000000002,children:e.conditions.map(P).join("\xb7")}),(0,s.jsxs)("title",{children:[e.label,null!=e.seat?" (".concat(i(e.seat),")"):" (GM)",(null==(t=e.conditions)?void 0:t.length)?" — ".concat(e.conditions.join(", ")):""]})]},e.id)})]}),g&&(0,s.jsx)("p",{className:"pt__board-hint",children:j?"Now tap the reach.":"Tap the ".concat("circle"===g?"center":"cone"===g?"apex":"start"," square.")}),f&&!g&&(0,s.jsxs)("p",{className:"pt__board-hint",children:[f.label," selected — tap a square to move."]}),f&&k(f)&&(0,s.jsx)("div",{className:"pt__cond-row",children:d.map(e=>{var t,a;let n=null!=(a=null==(t=f.conditions)?void 0:t.includes(e))&&a;return(0,s.jsx)("button",{type:"button",className:"pt__init-btn ".concat(n?"pt__init-btn--go":""),disabled:l,onClick:()=>{var t,a;return r({type:"token-conditions",id:f.id,conditions:n?(null!=(t=f.conditions)?t:[]).filter(t=>t!==e):[...null!=(a=f.conditions)?a:[],e]})},children:e},e)})})]})}function D(e){let{soakId:t,youAreGm:a}
1=e,[i,r]=(0,n.useState)(!1),[c,o]=(0,n.useState)(null),[d,u]=(0,n.useState)(null);if(c){let e=new Date(c.startTime).toLocaleString([],{weekday:"long",hour:"numeric",minute:"2-digit"});return(0,s.jsxs)("p",{className:"pt__next-session",children:["Next session is set — ",(0,s.jsx)("strong",{children:e}),"."," ",(0,s.jsx)("a",{href:c.url,children:"Open it and tap I’m in"})]})}return a?(0,s.jsxs)("div",{className:"pt__next-session",children:[(0,s.jsx)("button",{className:"pt__init-btn pt__init-btn--go",disabled:i,onClick:async()=>{r(!0),u(null);try{var e;let a=await fetch("/api/soaks/".concat(t,"/next-session"),{method:"POST",headers:{...(0,l.l)()}}),s=await a.json().catch(()=>({}));a.ok&&s.url&&s.startTime?o({url:s.url,startTime:s.startTime}):u(null!=(e=s.error)?e:"Could not set the next session.")}finally{r(!1)}},children:"Same time next week?"}),d&&(0,s.jsx)("p",{className:"gt__err",children:d})]}):null}function G(e){let{soakId:t,busy:a}=e,[i,r]=(0,n.useState)(!1),[c,o]=(0,n.useState)(null),[d,u]=(0,n.useState)([]),[p,h]=(0,n.useState)(""),[m,_]=(0,n.useState)(null),x=async()=>{try{var e,a,s;let n=await fetch("/api/soaks/".concat(t,"/game/seat"),{cache:"no-store"}),l=await n.json().catch(()=>({}));o(null!=(a=l.gameId)?a:null),u(null!=(s=l.eligible)?s:[]),_((null==(e=l.eligible)?void 0:e.length)?null:"Nobody new in the room yet — share the Soak link.")}catch(e){_("Could not check the room — try again.")}};return i?(0,s.jsxs)("form",{className:"pt__seat-row",onSubmit:async e=>{var a,s,n;if(e.preventDefault(),!p||!c)return;let i=await fetch("/api/soaks/".concat(t,"/game/seat"),{method:"POST",headers:{"content-type":"application/json",...(0,l.l)()},body:JSON.stringify({gameId:c,userId:p})}),r=await i.json().catch(()=>({}));if(i.ok){let e=null!=(s=null==(a=d.find(e=>e.id===p))?void 0:a.name)?s:"They";_("".concat(e," has a chair — welcome to the party.")),h(""),x()}else _(null!=(n=r.error)?n:"Could not seat them.")},children:[(0,s.jsxs)("select",{className:"pt__input pt__input--stat",value:p,onChange:e=>h(e.target.value),"aria-label":"Who to seat",children:[(0,s.jsx)("option",{value:"",children:"Who’s joining?"}),d.map(e=>(0,s.jsx)("option",{value:e.id,children:e.name},e.id))]}),(0,s.jsx)("button",{className:"pt__init-btn pt__init-btn--go",type:"submit",disabled:a||!p,children:"Pull up a chair"}),(0,s.jsx)("button",{className:"pt__init-btn",type:"button",onClick:()=>r(!1),children:"Close"}),m&&(0,s.jsx)("span",{className:"pt__seat-note",children:m})]}):(0,s.jsx)("button",{className:"pt__init-btn",disabled:a,title:"Pull up a chair for someone in the room",onClick:()=>{r(!0),x()},children:"Seat someone"})}},97015:(e,t,a)=>{a.d(t,{V:()=>n});var s=a(11092);function n(e,t){let a=(0,s.useRef)(null);return(0,s.useEffect)(()=>{let s=new AbortController,n=function(e){let t=!0,a=0,s=null,n=null,l=null,i=()=>{null==n||n(),n=null},r=()=>{if(t||!e.isVisible())return Promise.resolve(!1);if(s)return s;let l=(async()=>{try{return await e.poll()}catch(e){return!1}})();return s=l,l.then(c=>{s===l&&(s=null,a=c?0:Math.min(a+1,8),(()=>{if(i(),t||!e.isVisible())return;let s=function(e){let{failureStreak:t,intervalMs:a,maxDelayMs:s=3e4,jitterFraction:n=.1,random:l=Math.random}=e,i=Math.max(250,Math.floor(a)),r=Math.max(i,Math.floor(s)),c=Math.min(8,Math.max(0,Math.floor(t))),o=Math.min(r,i*2**c),d=Math.min(.5,Math.max(0,n));return Math.min(r,Math.round(o*(1-d+Math.min(1,Math.max(0,l()))*d*2)))}({failureStreak:a,intervalMs:e.intervalMs,maxDelayMs:e.maxDelayMs,jitterFraction:e.jitterFraction,random:e.random});n=e.schedule(()=>{n=null,r()},s)})())}),l},c=async()=>{i();let e=s;return e&&await e,i(),r()},o=()=>{i(),!t&&e.isVisible()&&c()};return{start(){t&&(t=!1,l=e.subscribeVisibility(o),e.isVisible()&&r())},stop(){t||(t=!0,i(),null==l||l(),l=null)},refresh:c}}({poll:()=>e(s.signal),intervalMs:t,isVisible:()=>"visible"===document.visibilityState,subscribeVisibility:e=>(document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)),schedule(e,t){let a=window.setTimeout(e,t);return()=>window.clearTimeout(a)}});return a.current=n,n.start(),()=>{a.current===n&&(a.current=null),n.stop(),s.abort()}},[t,e]),(0,s.useCallback)(()=>{var e,t;return null!=(t=null==(e=a.current)?void 0:e.refresh())?t:Promise.resolve(!1)},[])}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.