PageSourceSearch

https://www.gemphere.com/assets/RoomsView-BRvuHI8A.js

js gemphere.com collected 2026-09-24 14:43:47 UTC 114,174 bytes, 4 lines download raw bytes

1import{dj as Kt,ds as Jt,r as a,u as Je,j as e,cP as Qt}from"./index-BVpny5eT.js";import{l as Xt,a as Zt,b as en,g as tn,c as nn,d as sn,i as an,s as rn,e as on,m as ln,r as cn,f as dn,h as un,j as hn,k as mn,n as gn,o as pn,w as fn,p as vn,q as yn,t as xn,u as jn,v as kn,x as wn,y as bn,z as Nn,A as Sn,B as In,C as Cn,D as En,E as Tn,F as $n,G as An,H as Rn,I as Ln,J as Mn,K as Dn,L as Fn,M as On,N as Un,O as Pn,P as Vn,Q as Wn,R as _n,S as Gn,T as Bn,U as qn,V as zn,W as Hn,X as Et}from"./api-CQKVmx9j.js";import{H as Tt,r as Yn,s as Kn}from"./api-BgvIx3to.js";import{C as Jn,I as $t,E as Me,L as Ge,O as Be,t as Qn,a as it,b as lt,c as Ie,d as $e,W as Xn,U as ht,e as mt,f as At,g as Zn,M as Rt,R as es,h as Lt,D as gt,i as ts,K as ns,j as ss,A as as,k as pt,l as Ye,w as rs,m as os,n as ft,o as tt,p as is,q as ls,r as cs,s as ds,u as vt,P as qe,v as yt,x as us,y as hs}from"./attendee-csv-BI9gJ9Mv.js";import{Q as ms}from"./QrSheet-BOgOeQtQ.js";import{P as gs}from"./ProfilePopup-DRRBndnd.js";import{S as Qe,F as ve,L as de,B as q,E as ie,a as ps,R as ye,b as ue,N,U as ct,C as X,c as ge,d as te,P as Mt,e as ne,f as se,g as Dt,D as fs,h as Ae,i as Ke}from"./rooms-CIt7vEoI.js";import{N as vs,R as ys}from"./GemAI-D96-3JBK.js";import{O as xs}from"./OfferIntroModal-ZNidNxrZ.js";import{u as js}from"./useConnectorOfferIntro-Bc-ohsVX.js";import{Q as ks}from"./QrCode-D4QiR-9n.js";import"./accounts-Dp-x2CHJ.js";import"./index-CryiGmSX.js";import"./Combination-Dr9KM_H-.js";import"./briefcase-BmKdoUWU.js";import"./external-link-D8whGH5x.js";import"./ProfileNameTrigger-BwlTTwP1.js";import"./InviteContactModal-1V0C4a3t.js";import"./index-u7baw35J.js";import"./chevron-right-boUotD-7.js";import"./IntegrationsModal-CmDwjz79.js";import"./use-resolved-title-company-D550X39m.js";const ws={hunt:[],seeking:"",targets:[]};function xt(t){return t.hunt.length>0||!!t.seeking.trim()||t.targets.length>0}const jt=new Set(["company","investor"]);async function bs(t){var h,i;const n=await Kt(t),s=n.goals??[],o=new Set(Object.values(Tt)),r=((i=(h=s.find(g=>o.has(g.goalType)&&(g.icp||"").trim()))==null?void 0:h.icp)==null?void 0:i.trim())||"",d=n.targets??[];return{intent:{hunt:Yn(n),seeking:r,targets:d.filter(g=>jt.has(g.kind)).map(g=>g.value)},keep:d.filter(g=>!jt.has(g.kind)).map(g=>({kind:g.kind,value:g.value})),wasComplete:n.isComplete}}async function Ns(t,n){await Kn(t,{hunt:n.intent.hunt,seeking:n.intent.seeking,targets:n.intent.targets,viewerUserId:n.viewerUserId,keepTargets:n.read.keep}),n.read.wasComplete&&await Jt(t)}function kt(){try{const t=new URLSearchParams(window.location.search).get("tab");return t==="leagues"?"leagues":t==="voted"?"voted":"events"}catch{return"events"}}const wt={tab:"events",checkedIn:[],picked:[],invited:[],invitesSent:!1,scanned:[],actioned:[],link:"",linkParsed:!1,named:0,matched:!1,poster:0,caption:0,captionText:""};function Ss(t){return{getEvent:n=>nn(t,n),checkIn:(n,s)=>sn(t,n,s),inviteSuggestions:n=>an(t,n),sendInvites:(n,s)=>rn(t,n,s),scan:(n,s)=>on(t,n,s),myCode:()=>ln(t),redeemCode:n=>cn(t,n),askGem:n=>dn(t,n),getDrop:n=>un(t,n),getAfter:n=>hn(t,n),setMet:(n,s)=>mn(t,n,s),saveWants:(n,s)=>gn(t,n,s),getDoors:n=>pn(t,n),walkDoor:n=>fn(t,n),createLeague:n=>vn(t,n),leagueCandidates:()=>yn(t),getLeague:n=>xn(t,n),addLeagueMembers:(n,s,o=[])=>jn(t,n,s,o),createLeagueContact:n=>kn(t,n),inviteLeagueMember:(n,s)=>wn(t,n,s),joinLeague:n=>bn(t,n),getScore:n=>Nn(t,n),parseLink:n=>Sn(t,n),searchTechweek:n=>In(t,n),calendarCandidates:n=>Cn(t,n),createEvent:n=>En(t,n),getWants:n=>Tn(t,n),getEventGuests:n=>$n(t,n),claimListing:(n,s)=>An(t,n,s),inviteGuest:(n,s,o=!1)=>Rn(t,n,s,o),addEventGuests:(n,s)=>Ln(t,n,s),getRoom:n=>Mn(t,n),setEventDropAt:(n,s)=>Dn(t,n,s),matchRoom:n=>Fn(t,n),getPoster:n=>On(t,n),weekSuggestions:()=>Un(t),syncWeekRooms:n=>Pn(t,n),readIntent:()=>bs(t),saveIntent:n=>Ns(t,n),upvotePerson:n=>Vn(t,n),getUpvoteLeaderboard:()=>Wn(t),getScopeUpvotes:(n,s)=>_n(t,n,s)}}const Ft=a.createContext(null),Ot=a.createContext(null),Is=Jn.filter(t=>t.picked).map(t=>t.person.id),Cs=$t.filter(t=>t.picked).map(t=>t.person.id),Es=[{id:"maya",targetIdentifier:"maya",name:"Maya Chen",role:"Co-founder, Halden · fintech",mark:"MC",tone:"a",totalVotes:7,userVoted:!1,scopeTitle:"Founders Circle"}
1,{id:"rahul",targetIdentifier:"rahul",name:"Rahul Joshi",role:"Co-founder & CEO, Ledgerline",mark:"RJ",tone:"f",totalVotes:5,userVoted:!1,scopeTitle:"AI & Infra Dinner"},{id:"elena",targetIdentifier:"elena",name:"Elena Vance",role:"Head of Product, Vantage",mark:"EV",tone:"d",totalVotes:4,userVoted:!1,scopeTitle:"Growth League"},{id:"sarah",targetIdentifier:"sarah",name:"Sarah Lin",role:"Partner, Horizon Capital",mark:"SL",tone:"c",totalVotes:3,userVoted:!1,scopeTitle:"Seed Series Salon"}];function Ts({children:t}){const{user:n}=Je(),s=(n==null?void 0:n.accessToken)||null,o=s?"live":"demo",[r,d]=a.useState(()=>s?{...wt,tab:kt()}:{...wt,tab:kt(),picked:Is,invited:Cs,named:62}),[h,i]=a.useState([{screen:"home",focus:{eventId:"",leagueId:"",personId:""}}]),[g,p]=a.useState("fwd"),[l,f]=a.useState(0),[k,v]=a.useState(()=>Date.now()),[m,j]=a.useState(null),[E,c]=a.useState(0),[S,w]=a.useState(s?[]:Me),[y,u]=a.useState(s?[]:Ge),[b,I]=a.useState(s?[]:Be),[M,F]=a.useState(!!s),[O,x]=a.useState(!!s),[U,T]=a.useState(null),[_,R]=a.useState("attendee"),[K,$]=a.useState(!0),[B,Z]=a.useState(!s),[W,ee]=a.useState(()=>{if(s)return{};try{const A=localStorage.getItem("gp_rooms_upvotes_v2");if(A)return JSON.parse(A)}catch{}return{maya:{count:7,userVoted:!1},rahul:{count:5,userVoted:!1},elena:{count:4,userVoted:!1},sarah:{count:3,userVoted:!1},marcus:{count:2,userVoted:!1}}}),[le,he]=a.useState(()=>{if(s)return[];try{const A=localStorage.getItem("gp_rooms_leaderboard_v2");if(A)return JSON.parse(A)}catch{}return Es}),oe=a.useRef(null),me=a.useMemo(()=>s?Ss(s):null,[s]),Ne=a.useMemo(()=>{const A=(n==null?void 0:n.fullName)||"You",P=A.replace(/\s+/g," ").trim().split(" ").filter(Boolean),z=P.length>=2?(P[0][0]+P[P.length-1][0]).toUpperCase():(A.slice(0,2)||"?").toUpperCase();return{id:"you",apiUserId:(n==null?void 0:n.userId)??null,name:"You",mark:z,tone:"you"}},[n==null?void 0:n.fullName,n==null?void 0:n.userId]);a.useEffect(()=>{if(m===null)return;const A=window.setInterval(()=>v(Date.now()),1e3);return()=>window.clearInterval(A)},[m]);const L=a.useCallback(async()=>{if(!s)return;T(null),F(!0),x(!0);const A=J=>T(J instanceof Error?J.message:"Could not load your rooms"),P=Xt(s).then(J=>w(J.events.map(Ee=>Qn(Ee)))).catch(A).finally(()=>F(!1)),z=Zt(s).then(J=>u(J.leagues.map(it))).catch(A).finally(()=>x(!1)),re=en(s).then(J=>I(J.events.map(lt))).catch(()=>{});await Promise.all([P,z,re]),c(J=>J+1)},[s]);a.useEffect(()=>{L()},[L]),a.useEffect(()=>{if(!s){R("attendee"),Z(!0);return}let A=!0;return Z(!1),tn(s).then(P=>{A&&(R(P.role==="organizer"?"organizer":"attendee"),$(P.canCreateLeagues!==!1))}).catch(()=>{A&&(R("attendee"),$(!0))}).finally(()=>{A&&Z(!0)}),()=>{A=!1}},[s]),a.useEffect(()=>{if(o!=="live")return;const A=S.filter(P=>P.checkedIn).map(P=>P.id);d(P=>A.length===P.checkedIn.length&&A.every(z=>P.checkedIn.includes(z))?P:{...P,checkedIn:A})},[S,o]);const Y=a.useCallback((A,P)=>{d(z=>({...z,[A]:P}))},[]),ce=a.useCallback(A=>{d(P=>({...P,...A}))},[]),D=a.useCallback((A,P)=>{d(z=>{const re=z[A];return{...z,[A]:re.includes(P)?re.filter(J=>J!==P):[...re,P]}})},[]),G=a.useCallback((A,P)=>r[A].includes(P),[r]),V=a.useCallback(()=>{let A=oe.current;for(;A;){if(A.scrollHeight>A.clientHeight+1&&A.scrollTop>0){A.scrollTop=0;return}A=A.parentElement}typeof window<"u"&&window.scrollTo({top:0,behavior:"auto"})},[]),Ce=a.useCallback((A,P)=>{p("fwd"),f(z=>z+1),i(z=>{const re=z[z.length-1];return[...z,{screen:A,focus:{...re.focus,...P}}]}),V()},[V]),Re=a.useCallback((A,P)=>{p("fwd"),f(z=>z+1),i(z=>{const re=z[z.length-1];return[...z.slice(0,-1),{screen:A,focus:{...re.focus,...P}}]}),V()},[V]),Ue=a.useCallback(()=>{p("back"),f(A=>A+1),i(A=>A.length>1?A.slice(0,-1):A),V()},[V]),Pe=o==="demo"||_==="organizer",Ve=o==="demo"||K,De=a.useCallback(()=>{p("back"),f(A=>A+1),i([{screen:"home",focus:{eventId:"",leagueId:"",personId:""}}]),V()},[V]);a.useEffect(()=>{if(!s||!me)return;let A=!0;return me.getUpvoteLeaderboard().then(P=>{!A||!(P!=null&&P.leaderboard)||(he(P.leaderboard),ee(z=>{const re={...z};for(const J of P.leaderboard)re[J.id]={count:J.totalVotes,userVoted:!!J.userVoted},J.targetIdentifier&&(re[J.targetIdentifier]={count:J.totalVotes,userVoted:!!J.userVoted});return re}))}).catch(()=>{}),()=>{A=!1}},[s,me,E]);const Se=a.useCallback(A=>W[A]||{count:0,userVoted:!1},[W]),pe=a.useCallback(async(A,P)=>{if(A.state==="invited")return{success:!1,error:"Only people who have joined can be voted for."};const z=A.apiUserId?`u:${A.apiUserId}`:A.id,re=W[z]||W[A.id]||{count:0,userVoted:!1},J=!re.userVoted,Ee=Math.max(0,re.count+(J?1:-1)),We={count:Ee,userVoted:J};let C=null,H=null;if(ee(Q=>{C=Q;const fe={...Q,[z]:We,[A.id]:We};try{s||localStorage.setItem("gp_rooms_upvotes_v2",JSON.stringify(fe))}catch{}return fe}),he(Q=>{H=Q;let fe=!1;const _e=Q.map(Te=>Te.id===z||Te.id===A.id?(fe=!0,{...Te,totalVotes:Ee,userVoted:J}):Te);!fe&&J&&_e.push({id:A.id,targetIdentifier:z,name:A.name,role:A.role||null,mark:A.mark,tone:A.tone||"e",totalVotes:Ee,userVoted:J,scopeTitle:P.title});const ut=_e.filter(Te=>Te.totalVotes>0).sort((Te,Yt)=>Yt.totalVotes-Te.totalVotes);try{s||localStorage.setItem("gp_rooms_leaderboard_v2",JSON.stringify(ut))}catch{}return ut}),s&&me)try{await me.upvotePerson({targetUserId:A.apiUserId||null,targetGuestId:A.apiGuestId??null,targetIdentifier:z,targetName:A.name,targetRole:A.role||null,targetMark:A.mark,targetTone:A.tone||"e",scopeType:P.type,scopeId:P.
1id||null})}catch(Q){return C&&ee(C),H&&he(H),console.warn("Upvote API sync:",Q),{success:!1,error:Q instanceof Error?Q.message:"That vote did not save."}}return{success:!0}},[W,s,me]),xe=h[h.length-1],je=a.useMemo(()=>({s:r,set:Y,patch:ce,toggle:D,has:G,screen:xe.screen,focus:xe.focus,go:Ce,swap:Re,back:Ue,canGoBack:h.length>1,home:De,dir:g,seq:l,now:k,dropEndsAt:m,setDropEndsAt:j,mode:o,viewer:Ne,viewerRole:_,canCreate:Pe,canCreateLeagues:Ve,roleReady:B,loading:M||O,loadingEvents:M,loadingLeagues:O,error:U,events:S,leagues:y,orgEvents:b,refresh:L,version:E,client:me,upvoteMap:W,leaderboard:le,toggleUpvote:pe,getPersonUpvote:Se}),[r,Y,ce,D,G,xe,Ce,Re,Ue,h.length,De,g,l,k,m,o,Ne,_,Pe,Ve,B,M,O,U,S,y,b,L,E,me,W,le,pe,Se]);return e.jsx(Ft.Provider,{value:je,children:e.jsx(Ot.Provider,{value:oe,children:t})})}function ae(){const t=a.useContext(Ft);if(!t)throw new Error("useRooms must be used inside <RoomsProvider>");return t}function Xe(){const{focus:t,events:n,orgEvents:s}=ae();if(!t.eventId)return null;const o=n.find(r=>r.id===t.eventId)??s.find(r=>r.id===t.eventId);return(o==null?void 0:o.apiId)??null}
1function be(t,n,s){const[o,r]=a.useState(n),[d,h]=a.useState(!!t),[i,g]=a.useState(null),[p,l]=a.useState(0),f=a.useRef(n);return f.current=n,a.useEffect(()=>{if(!t){r(f.current),h(!1),g(null);return}let k=!0;return h(!0),g(null),t().then(v=>{k&&r(v)}).catch(v=>{k&&g(v instanceof Error?v.message:"Something went wrong")}).finally(()=>{k&&h(!1)}),()=>{k=!1}},[...s,p]),{data:o,loading:d,error:i,reload:()=>l(k=>k+1)}}function $s(){const{s:t,set:n,go:s,events:o,orgEvents:r,leagues:d,loadingEvents:h,loadingLeagues:i,error:g,refresh:p,mode:l,canCreate:f,leaderboard:k}=ae();return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"rm-greet",children:[e.jsx("small",{children:As(d)}),"Good evening"]}),e.jsx(Qe,{value:t.tab,onChange:v=>n("tab",v),options:[{id:"events",label:"Events",count:o.length+r.length},{id:"leagues",label:"Leagues",count:d.length},{id:"voted",label:"Top Voted",count:k.length}]}),g?e.jsx(ve,{error:g,onRetry:()=>void p()}):t.tab==="events"?h?e.jsx(de,{what:"Scoring the rooms you are in"}):e.jsx(Rs,{}):t.tab==="leagues"?i?e.jsx(de,{what:"Counting the doors"}):e.jsx(Ls,{}):e.jsx(Ms,{}),l==="demo"&&e.jsxs("p",{className:"rm-demo",children:[e.jsx("b",{children:"Demo"})," — the design with sample data. Sign in to see your own rooms."]}),f&&e.jsxs("div",{className:"rm-orgstrip",children:[e.jsxs("div",{className:"rm-hostline",children:[e.jsx("span",{children:"Hosting something yourself?"}),e.jsx(q,{variant:"out",onClick:()=>s("org-new"),children:"Start a room"}),e.jsx(q,{variant:"out",onClick:()=>s("org-invite"),children:"Your code"})]}),t.tab==="events"&&e.jsxs("div",{className:"rm-hostline rm-hostline--go",children:[e.jsx("span",{children:"Going to things yourself?"}),e.jsx(q,{variant:"out",onClick:()=>s("org-intent"),children:"Events for you"})]})]})]})}function As(t){const n=new Date().toLocaleDateString("en-US",{weekday:"long"}).toLowerCase(),s=t.reduce((o,r)=>o+(r.open||0),0);return s>0?`${n} · ${s} door${s===1?"":"s"} open`:n}function Rs(){const{go:t,events:n,orgEvents:s,canCreate:o}=ae();return!n.length&&!s.length?e.jsx(ie,{title:"No rooms yet.",line:o?"Add an event and we'll tell you who in it is worth ten minutes.":"Rooms show up here when a host adds you, or when you open a link somebody sent you.",action:o?"Add an event":void 0,onAction:o?()=>t("org-new"):void 0}):e.jsxs(e.Fragment,{children:[s.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"rm-secthead",children:[e.jsx("span",{children:"You are hosting"}),e.jsx("button",{type:"button",className:"rm-secthead-act",onClick:()=>t("org-invite"),children:"Your code"})]}),e.jsx("div",{className:"rm-grid rm-grid--cards",children:s.map(r=>e.jsxs("button",{type:"button",className:"rm-ev",onClick:()=>t(r.state==="live"?"org-room":"org-wants",{eventId:r.id}),children:[e.jsx("span",{className:"rm-tag rm-tag--in",children:"hosting"}),e.jsx("div",{className:"rm-ev-title",children:r.title}),e.jsxs("div",{className:"rm-ev-meta",children:[r.when," · ",r.where,r.techweek&&" · SF Tech Week"]}),e.jsxs("div",{className:"rm-ev-line",children:[e.jsx("b",{className:"rm-mark",children:r.invited})," ",r.invited===1?"person is":"people are"," on the list",r.named>0?`, ${r.named} said who they want to meet`:""]})]},`host-${r.id}`))})]}),n.length>0&&s.length>0&&e.jsxs("div",{className:"rm-secthead",children:[e.jsx("span",{children:"You are going to"}),e.jsx("span",{className:"rm-secthead-n",children:n.length})]}),e.jsxs("div",{className:"rm-grid rm-grid--cards",children:[n.map(r=>e.jsxs("button",{type:"button",className:`rm-ev${r.faded?" rm-ev--faded":""}`,onClick:()=>t("event",{eventId:r.id}),children:[r.best&&e.jsx("span",{className:"rm-tag rm-tag--o",children:"best for you"}),r.checkedIn&&e.jsx("span",{className:"rm-tag rm-tag--in",children:"checked in"}),e.jsx("div",{className:"rm-ev-title",children:r.title}),e.jsx("div",{className:"rm-ev-meta",children:r.meta}
1),r.faces.length>0&&e.jsx("div",{className:"rm-ev-faces",children:e.jsx(ps,{people:r.faces,size:"sm"})}),e.jsx("div",{className:"rm-ev-line",children:r.emphasis?e.jsxs(e.Fragment,{children:[e.jsx("b",{className:"rm-mark",children:r.emphasis})," ",r.line]}):r.line})]},r.id)),o&&e.jsx(ye,{className:"rm-row--add",lead:e.jsx("span",{className:"rm-dashav",children:"+"}),name:"Add an event",sub:"Find it on the programme, paste its link, or name it yourself",right:e.jsx("span",{className:"rm-arrow",children:"›"}),onClick:()=>t("org-new")})]})]})}function Ls(){const{go:t,leagues:n,canCreateLeagues:s}=ae();return n.length?e.jsxs(e.Fragment,{children:[n.map(o=>e.jsx(ye,{className:"rm-row--lg",lead:e.jsx(ue,{mark:o.mark,tone:o.tone,size:"sm"}),name:o.name,sub:o.line,right:e.jsx("span",{className:"rm-arrow",children:"›"}),onClick:()=>t("league-reach",{leagueId:o.id})},o.id)),e.jsx(ye,{className:"rm-row--lg",lead:e.jsx("span",{className:"rm-dashav",children:"+"}),name:s?"Start or join a league":"Join a league",sub:s?`Opens at ${$e}, caps at ${Ie}`:"With the code you were sent",right:e.jsx("span",{className:"rm-arrow",children:"›"}),onClick:()=>t("league-new")}),e.jsxs(N,{className:"rm-explain",children:["Up to ",Ie," people, you included. You each keep a private target list, and only the person who can reach something is ever told."]})]}):e.jsx(ie,{title:"No league yet.",line:s?`${Ie} people you pick — you are one of them — who make introductions for each other. It opens at ${$e}.`:`${Ie} people who make introductions for each other. Join one with the code you were sent.`,action:s?"Start a league":"Join with a code",onAction:()=>t("league-new")})}function Ms(){const{leaderboard:t,toggleUpvote:n,getPersonUpvote:s,go:o}=ae(),{user:r}=Je(),d=[...t].sort((l,f)=>f.totalVotes-l.totalVotes),[h,i]=a.useState(null),g=l=>{if(l.targetUserId)return Number(l.targetUserId);const f=/^u:(\d+)$/.exec(l.targetIdentifier||l.id);return f?Number(f[1]):null},p=l=>{g(l)?i(l):o("person",{personId:l.id,eventId:"",leagueId:""})};return d.length?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"rm-secthead",children:[e.jsx("span",{children:"Ranked by votes"}),e.jsx("span",{className:"rm-secthead-n",children:d.length})]}),e.jsx("div",{className:"rm-list",children:d.map((l,f)=>{const k=f+1,v=s(l.targetIdentifier||l.id),m=v.count||l.totalVotes;return e.jsx(ye,{lead:e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:"10px"},children:[e.jsxs("span",{className:k<=3?`rm-rank-badge rm-rank-badge--${k}`:"rm-rank-badge",children:["#",k]}),e.jsx(ue,{mark:l.mark,tone:l.tone,size:"sm"})]}),name:l.name,sub:l.role||l.scopeTitle||l.sub||void 0,right:e.jsxs("span",{className:"rm-voted-count",children:[e.jsxs("span",{className:"rm-voted-pill",children:[m," ",m===1?"vote":"votes"]}),e.jsx(ct,{size:"sm",count:m,voted:v.userVoted,onClick:()=>void n({id:l.id,name:l.name,role:l.role||void 0,mark:l.mark,tone:l.tone,state:"joined"},{type:"league",title:l.scopeTitle})})]}),onClick:()=>p(l)},l.id)})}),e.jsx(N,{className:"rm-explain",children:"Ranked by total upvotes from members across your leagues and events."}),e.jsx(gs,{open:!!h,onOpenChange:l=>{l||i(null)},userId:h?g(h)??0:0,accessToken:(r==null?void 0:r.accessToken)||"",initialName:h==null?void 0:h.name})]}):e.jsx(ie,{title:"No votes yet.",line:"Upvote members inside your leagues and events using the arrow button to rank them here."})}function Ds(t){return t<ht?{target:ht,lead:"Names unlock in"}:t<mt?{target:mt,lead:"Doors open in"}:null}function Fs(t){const n=Math.max(0,t);return[{value:Math.floor(n/864e5),label:"days",pad:!1},{value:Math.floor(n/36e5)%24,label:"hrs",pad:!0},{value:Math.floor(n/6e4)%60,label:"min",pad:!0},{value:Math.floor(n/1e3)%60,label:"sec",pad:!0}]}function Os({value:t,label:n,pad:s}){const o=s?String(t).padStart(2,"0"):String(t),[r,d]=a.useState(!1),h=a.useRef(o);return a.useEffect(()=>{if(h.current===o)return;h.current=o,d(!1);const i=window.requestAnimationFrame(()=>d(!0));return()=>window.cancelAnimationFrame(i)},[o]),e.jsxs("span",{className:"rm-wk-t",children:[e.jsx("b",{className:r?"tick":void 0,children:o}),e.jsx("span",{children:n})]})}function Us({named:t,invited:n}
1){const[s,o]=a.useState(()=>Date.now()),r=Ds(s),d=!!r;a.useEffect(()=>{if(!d)return;const i=window.setInterval(()=>o(Date.now()),1e3);return()=>window.clearInterval(i)},[d]);const h=e.jsxs(e.Fragment,{children:[t," of ",n," have said who they want. Matches need that to work from — it fills up as they answer."]});return r?e.jsxs(X,{dark:!0,className:"rm-wk",children:[e.jsxs("div",{className:"rm-wk-head",children:[e.jsx("span",{className:"rm-wk-tag",children:"SF Tech Week"}),e.jsx("span",{className:"rm-wk-when",children:Xn})]}),e.jsx("div",{className:"rm-wk-lead",children:r.lead}),e.jsx("div",{className:"rm-wk-grid",children:Fs(r.target-s).map(i=>e.jsx(Os,{value:i.value,label:i.label,pad:i.pad},i.label))}),e.jsx("div",{className:"rm-wk-foot",children:e.jsx(N,{dark:!0,children:h})})]}):e.jsxs(X,{className:"rm-empty",children:[e.jsx(ge,{children:"No matches yet."}),e.jsx(N,{children:h})]})}function Ps(){const{focus:t,go:n,client:s,mode:o,events:r,version:d,refresh:h,setDropEndsAt:i,has:g,toggle:p}=ae(),l=r.find(T=>T.id===t.eventId)??r[0],f=l==null?void 0:l.apiId,[k,v]=a.useState(!1),m=Me.find(T=>T.id===t.eventId)??Me[0],{data:j,loading:E,error:c,reload:S}=be(s&&f?async()=>{const T=await s.getEvent(f);return At(T.event,T.matches,T.lockedCount,T.room??[])}:null,l??m,[s,f,d]),w=a.useCallback(T=>{const _=T.connected?"drop":"person";n(_,{personId:T.id,eventId:t.eventId,leagueId:""})},[n,t.eventId]),y=a.useCallback(async()=>{if(!s||!f){p("checkedIn",t.eventId);return}v(!0);try{await s.checkIn(f),await h(),S()}finally{v(!1)}},[s,f,h,S,p,t.eventId]),u=a.useCallback(async()=>{if(s&&f){const T=await s.getDrop(f).catch(()=>null);T!=null&&T.match&&i(new Date(T.match.expiresAt).getTime())}else i(Date.now()+10*60*1e3);n("drop",{eventId:t.eventId})},[s,f,i,n,t.eventId]);if(c)return e.jsx(ve,{error:c,onRetry:S});if(E&&!j)return e.jsx(de,{what:"Opening the room"});if(!j)return e.jsx(ie,{title:"That room is gone.",line:"It may have been cancelled."});const b=o==="live"?!!j.checkedIn:g("checkedIn",j.id),I=o==="live"?j.matches:b?[...j.matches,...j.locked]:j.matches,M=o==="live"?j.lockedCount??0:j.locked.length,F=(j.room??[]).filter(T=>T.state!=="invited"&&T.state!=="declined").length,O=new Map(I.map(T=>[T.id,T])),x=j.room??[],U=[...x.map(T=>({person:O.get(T.id)??T,match:O.get(T.id)??null})),...I.filter(T=>!x.some(_=>_.id===T.id)).map(T=>({person:T,match:T}))].sort((T,_)=>+!!_.match-+!!T.match);return e.jsxs(e.Fragment,{children:[e.jsx(te,{kicker:j.meta.toLowerCase(),title:j.title}),e.jsxs("div",{className:"rm-hostrow",children:[e.jsx(ue,{mark:j.host.mark,tone:j.host.tone,size:"sm"}),e.jsxs("div",{className:"rm-hostrow-g",children:[e.jsx("div",{className:"rm-hostrow-n",children:j.host.name}),e.jsx(N,{children:j.hostLine})]}),j.seatsLeft>0&&e.jsx(q,{variant:"out",onClick:()=>n("event-invite",{eventId:t.eventId}),children:"Invite"})]}),I.length===0&&e.jsx(Us,{named:j.named,invited:j.invited}),e.jsx(Mt,{label:I.length?`in this room · ${F} of ${U.length} joined · ${b?`all ${I.length} matched to you`:`${I.length} match you`}`:`in this room · ${F} of ${U.length} joined`,people:U.map(({person:T,match:_})=>({id:T.id,name:T.name,mark:T.mark,tone:T.tone,sub:((_==null?void 0:_.where)??T.where)||T.role||void 0,state:T.state})),onSelect:T=>{var _;return w(((_=U.find(R=>R.person.id===T.id))==null?void 0:_.person)??{id:T.id})}}),!b&&I.length>0&&e.jsxs(X,{dark:!0,className:"rm-checkin",children:[e.jsx(ge,{children:M>0?`${I.length===1?"One":I.length} is all you get from here.`:"Check in when you arrive."}),e.jsx(N,{dark:!0,children:M>0?`Check in at the venue for the other ${M}, and where everyone is standing.`:"It opens the room and tells you where everyone is standing."}),e.jsx(q,{variant:"pale",disabled:k,onClick:y,children:k?"Checking in…":"Check in"})]}),b&&e.jsxs(X,{dark:!0,className:"rm-checkin",children:[e.jsx(ge,{children:j.drop?`At ${j.drop}, everyone gets one person at the same second.`:"Everyone gets one person at the same second."}),e.jsx(N,{dark:!0,children:"You are checked in. The host fires it from the door."}),e.jsx(q,{variant:"pale",onClick:u,children:"See your match"})]}),e.jsx("div",{className:"rm-afterlink",children:e.jsx(q,{variant:"out",onClick:()=>n("after",{eventId:t.eventId}),children:"See who you met"})})]})}function Vs(){const{focus:t,s:n,set:s,toggle:o,has:r,back:d,client:h,events:i,mode:g}=ae(),p=i.find(u=>u.id===t.eventId),l=p==null?void 0:p.apiId,f=Me.find(u=>u.id===t.eventId)??Me[0],[k,v]=a.useState(!1),{data:m,loading:j,error:E,reload:c}=be(h&&l?async()=>{const u=await h.inviteSuggestions(l);return{seatsLeft:u.seatsLeft,suggestions:u.suggestions.map((b,I)=>Zn(b,I<2))}}:null,{seatsLeft:f.seatsLeft,suggestions:$t},[h,l]),S=(p==null?void 0:p.title)??f.title,w=m.suggestions.filter(u=>r("invited",u.person.id)),y=async()=>
1{if(!h||!l){s("invitesSent",!0);return}v(!0);try{await h.sendInvites(l,w.map(u=>({name:u.person.name,email:u.email??void 0}))),s("invitesSent",!0)}finally{v(!1)}};return e.jsxs(e.Fragment,{children:[e.jsx(te,{kicker:`${S.toLowerCase()} · tonight`,title:"Invite your people",action:"+5 each"}),E?e.jsx(ve,{error:E,onRetry:c}):j?e.jsx(de,{what:"Working out what the room is short of"}):e.jsxs(e.Fragment,{children:[e.jsxs(N,{className:"rm-lede",children:[m.seatsLeft>0?`${m.seatsLeft} seat${m.seatsLeft===1?"":"s"} left. `:"",m.suggestions.length?"These are what the room is short of.":"Nothing obvious is missing — invite whoever you like."]}),m.suggestions.length===0?e.jsx(ie,{title:"No suggestions yet.",line:"Once more guests say what they are after, we can tell you who the room is missing."}):e.jsxs("div",{className:"rm-list",children:[m.suggestions.map(u=>{const b=r("invited",u.person.id);return e.jsx(ye,{lead:e.jsx(ue,{mark:u.person.mark,tone:u.person.tone,size:"sm"}),name:u.person.name,sub:u.why,right:e.jsx(ne,{filled:b,children:b?"✓":"Add"}),onClick:()=>o("invited",u.person.id)},u.person.id)}),e.jsx(ye,{className:"rm-row--ghost",lead:e.jsx("span",{className:"rm-face rm-face--sm rm-face--ghost",children:"+"}),name:e.jsx("span",{className:"rm-dim",children:"Someone else"}),sub:"Search your contacts",right:e.jsx("span",{className:"rm-arrow",children:"›"})})]}),e.jsx("div",{className:"rm-foot",children:n.invitesSent?e.jsxs(e.Fragment,{children:[e.jsx(q,{variant:"pale",onClick:d,children:"Sent — back to the room"}),e.jsxs(N,{className:"rm-center",children:[w.length," on their way. Five points each when they turn up."]})]}):e.jsxs(e.Fragment,{children:[e.jsx(q,{variant:"ochre",disabled:w.length===0||k,onClick:y,children:k?"Sending…":w.length===0?"Pick someone":w.length===1?"Send it":`Send all ${w.length}`}),e.jsx(N,{className:"rm-center",children:"Five points each when they turn up, nothing if they do not."})]})})]})]})}function Ws(){const{focus:t,go:n,has:s,toggle:o,client:r,version:d,refresh:h}=ae(),i=Xe(),[g,p]=a.useState(!1),[l,f]=a.useState(!1),[k,v]=a.useState(null),m=Me.find(M=>M.id===t.eventId)??Me[0],{data:j,loading:E}=be(r&&i?async()=>{const M=await r.getEvent(i);return At(M.event,M.matches,M.lockedCount,M.room??[])}:null,m,[r,i,d]),c=[...j.matches,...j.locked,...j.room??[]].find(M=>M.id===t.personId)??(r?null:Rt),S=a.useCallback(()=>{c&&n("doors",{personId:c.id,eventId:t.eventId,leagueId:""})},[n,c,t.eventId]),w=a.useCallback(()=>{c&&(o("scanned",c.id),S())},[c,o,S]),y=a.useCallback(async()=>{if(!(c!=null&&c.apiUserId)||!r){f(!0);return}p(!0),v(null);try{if((await r.askGem({userId:c.apiUserId,eventId:i??null})).alreadyOpen){h(),S();return}f(!0)}catch(M){v(M instanceof Error?M.message:"Could not send that introduction.")}finally{p(!1)}},[r,c,i,h,S]);if(E)return e.jsx(de,{what:"Reading the room"});if(!c)return e.jsxs(e.Fragment,{children:[e.jsx(te,{kicker:"here tonight",title:"Not found"}),e.jsx(ie,{title:"That person is not in this room."})]});const u=c.name.split(" ")[0],b=r?!!c.connected:s("scanned",c.id),I=l||c.gemIntro==="asked";return e.jsxs(e.Fragment,{children:[e.jsx(te,{kicker:"here tonight",title:c.name}),e.jsxs("div",{className:"rm-person",children:[e.jsx(ue,{mark:c.mark,tone:c.tone,size:"xl"}),e.jsx("div",{className:"rm-person-name",children:c.name}),c.role&&e.jsx("div",{className:"rm-person-role",children:c.role}),c.where&&e.jsx("div",{className:"rm-person-where",children:c.where})]}),b?e.jsx(q,{onClick:S,children:"See what you two can open"}):e.jsxs(e.Fragment,{children:[e.jsxs(X,{dark:!0,className:"rm-scanpitch",children:[e.jsxs(ge,{children:["Scan ",u,"'s code to see the intros you can offer and ask for."]}),e.jsx(N,{dark:!0,children:"Nothing opens until you are standing in front of each other."})]}),r?e.jsxs(N,{children:["Tap the code button in the top corner to scan ",u,"'s code."]}):e.jsxs(q,{onClick:w,children:["Scan ",u,"'s code"]}),I?e.jsxs(X,{className:"rm-mt9",children:[e.jsxs(ge,{children:["Asked. Waiting on ",u,"."]}),e.jsxs(N,{children:["Gem has sent the introduction. The moment ",u," accepts, the two of you are connectors and whatever you can open for each other appears here."]})]}):e.jsx(q,{variant:"out",className:"rm-mt9",disabled:g,onClick:()=>void y(),children:g?"Asking Gem…":"Ask Gem for an intro instead"}),k&&e.jsx(N,{children:k}),e.jsxs(N,{children:["Gem sends this one itself — there is no connector in the middle, so only ",u," has to say yes."]})]})]})}const bt=10*60*1e3;function _s(){const{focus:t,now:n,dropEndsAt:s,setDropEndsAt:o,go:r,client:d,events:h,mode:i,has:g}=ae(),p=h.find(R=>R.id===t.eventId),l=p==null?void 0:p.apiId,f=(p==null?void 0:p.drop)||"",k=t.personId&&Number(t.personId.replace(/\D/g,""))||null,v=!!k,m=!!t.eventId,j=i==="live"?!!(p!=null&&p.checkedIn):g("checkedIn",t.eventId),E=m&&!j,c=a.useMemo(()=>Date.now(),[]),[S,w]=a.useState(0),{data:y,loading:u,error:b,reload:I}=be(d&&(v||l)?async()=>{var K,$;if(v){const B=await d.getDoors({userId:k,eventId:l??null,leagueId:null});return{person:null,accounts:[...B.asks,...B.offers].filter(W=>W.target).map(W=>({target:W.target,mark:Gs(W.target),role:W.industry??void 0})),reason:null,alsoMatched:0,via:((K=B.person)==null?void 0:K.name)??null}}const R=await d.getDrop(l);return R.match&&o(new Date(R.match.expiresAt).getTime()),{person:R.match?Lt(R.match,{where:R.match.where??void 0}):null,accounts:[],reason:(($=R.match)==null?void 0:$.reason)??null,alsoMatched:R.alsoMatched,via:null}}:null,{person:es,accounts:[],reason:"He is after Series A. You are after healthcare.",alsoMatched:70,via:null},[d,l,k,v]);if(b)return e.jsx(ve,{error:b,onRetry:I});if(u)return e.jsx(de,{what:v?"Opening what they hold":"Finding your person"});const M=v?y.accounts[S%Math.max(1,y.accounts.length)]:null;if(v?!y.accounts.length:!y.person)return e.jsxs(e.Fragment,{children:[e.jsx(te,{kicker:v?"what they opened":f||"the drop",title:"Your match",dark:!0}),e.jsx(ie,{title:E?"Check in first.":v?"Nothing open, this time.":"Not yet.",line:E?"You will not see any suggestions in this room until you have checked in at the venue. Check in on the room screen and come back.":v?"Neither of you is near what the other is after. Add more target accounts and this fills in.":"The host fires it from the door, and everyone gets their person at the same second."})]});const O=v?c+bt:s,x=O===null?bt:O-n,U=x<=0,T=y.person,_=y.accounts.length>1;return e.jsxs(e.Fragment,{children:[e.jsx(te,{kicker:v?"someone here can open this":f?`${f} · everyone at once`:"everyone at once",title:"Your match",dark:!0}),e.jsxs("div",{className:"rm-person rm-person--dark",children:[e.jsx(ue,{mark:M?M.mark:T.mark,tone:M?"a":T.tone,size:"xl"}),e.jsx("div",{className:"rm-person-name",children:M?M.target:T.name}),(M?M.role:T.role)&&e.jsx("div",{className:"rm-person-role",children:M?M.role:T.role}),!M&&e.jsxs("div",{className:"rm-person-chips",children:[T.linkedin&&e.jsxs(ne,{dark:!0,children:[e.jsx("span",{className:"rm-li","aria-hidden":!0,
1children:"in"}),"LinkedIn"]}),T.where&&e.jsx(ne,{dark:!0,children:T.where})]})]}),_&&e.jsxs("div",{className:"rm-deck-top rm-deck-top--dark",children:[e.jsxs(se,{children:[S%y.accounts.length+1," of ",y.accounts.length," they can open"]}),e.jsx("button",{type:"button",className:"rm-another",onClick:()=>w(R=>R+1),children:"⤫ Show another"})]}),(M||y.reason)&&e.jsxs(X,{dark:!0,children:[e.jsx(ge,{children:M?`${M.target} is on your list.`:y.reason}),e.jsx(N,{dark:!0,children:v?"Somebody in this room is two steps from it. The next screen says who.":"Each of you is near what the other wants. Ten minutes decides it."})]}),e.jsx("div",{className:`rm-clock${U?" rm-clock--out":""}`,children:U?"00:00":Dt(x)}),e.jsx(N,{dark:!0,className:"rm-clock-note",children:U?v?"Still open — the clock is only a nudge.":"Time is up. The room moves on to the next pairing.":v?"Ten minutes is all it takes to ask.":y.alsoMatched>0?`${y.alsoMatched} other ${y.alsoMatched===1?"person":"people"} just got this screen.`:"You are the only pair in this round."}),E&&e.jsxs(X,{dark:!0,className:"rm-checkin",children:[e.jsx(ge,{children:"Check in first — or you will not see any of this."}),e.jsx(N,{dark:!0,children:M?`Who is two steps from ${M.target} — and every other suggestion in this room — stays shut until you have checked in at the venue. Check in on the room screen and come back; it is one tap.`:`What ${T.name.split(" ")[0]} can open for you — and every other suggestion in this room — stays shut until you have checked in at the venue. Check in on the room screen and come back; it is one tap.`}),e.jsx(q,{variant:"pale",onClick:()=>r("event",{eventId:t.eventId}),children:"Go check in"})]}),(!U||v)&&e.jsx(q,{variant:"pale",disabled:E,onClick:()=>E?void 0:r("doors",{personId:v?t.personId:T.id,eventId:t.eventId,leagueId:""}),children:M?"See who can open it":`Find ${T.name.split(" ")[0]}`})]})}function Gs(t){const n=String(t||"?").replace(/\s+/g," ").trim().split(" ").filter(Boolean);return n.length>=2?(n[0][0]+n[n.length-1][0]).toUpperCase():(t.slice(0,2)||"?").toUpperCase()}function Bs(){var Ee,We;const{focus:t,go:n,has:s,toggle:o,client:r,viewer:d,leagues:h,mode:i}=ae(),g=Xe(),p=((Ee=h.find(C=>C.id===t.leagueId))==null?void 0:Ee.apiId)??null,l=Number(t.personId.replace(/\D/g,""))||null,[f,k]=a.useState(null),[v,m]=a.useState(null),[j,E]=a.useState(!1),[c,S]=a.useState(null),{user:w}=Je(),y=(w==null?void 0:w.accessToken)||null,u=(w==null?void 0:w.userId)??null,b=a.useRef(null),I=js({onSent:()=>{var C;return(C=b.current)==null?void 0:C.call(b)}}),M=gt[t.personId]?t.personId:"maya",F=M==="kemal"?ns:Rt,O=gt[M]??ss,{data:x,loading:U,error:T,reload:_}=be(r&&l?async()=>{const C=await r.getDoors({userId:l,eventId:g,leagueId:p});return ts(C,d)}:null,{person:F,doors:O,consent:!0},[r,l,g,p]);b.current=_;const R=x.person,K=x.relationshipId??null,$=a.useMemo(()=>x.doors.filter(C=>C.kind==="ask"),[x.doors]),B=a.useMemo(()=>x.doors.filter(C=>C.kind==="offer"),[x.doors]),[Z,W]=a.useState(null),[ee,le]=a.useState(null),[he,oe]=a.useState(null),me=a.useCallback(C=>{oe({name:C.name||"",fullname:C.name||"",title:C.title||"",companyName:C.companyName||"",linkedinUrl:C.linkedinUrl||null,isNonGem:!0,source:C.linkedinUrl?"linkedin":"import"})},[]),Ne=a.useMemo(()=>({onOpenWebProfile:me}),[me]),L=a.useCallback((C,H)=>{if(!r||!l||!R){o("actioned",C.id);return}const Q=H?{...C,endpoint:H.name,endpointEmail:H.email,endpointRole:H.role}:C;if(C.kind==="offer"){if(!K||!Q.apiTargetId){le(K?"This door has no target account id — reload and try again.":`You and ${R.name.split(" ")[0]} have no active connector link yet, so there is nothing to offer through. Reload the league; if it persists the seating never linked you two.`);return}le(null),I.openOfferIntro(qs(Q,H),zs(R,K));return}m(Q)},[r,l,R,o,K,I]),Y=a.useCallback(async C=>{if(!(!v||!y||!u||!l||!R)){E(!0),S(null);try{await Qt(y,{fromUserID:u,connectorUserID:l,connectorEmail:C.connectorEmail||R.email||void 0,toUserID:0,toName:v.endpoint,toEmail:C.targetEmail||v.endpointEmail||void 0,note:C.message2.trim()||v.target,connectorMessage:C.message1.trim()||void 0,blurb:C.message2.trim()||void 0,connectorSubject:C.subject1.trim()||void 0,blurbSubject:C.subject2.trim()||void 0}),await r.walkDoor({kind:v.kind,viaUserId:l,eventId:g,leagueId:p,targetAccountId:v.apiTargetId??null,targetName:v.target}),k(null),m(null),_()}catch(H){S(H instanceof Error?H.message:"Could not send that intro")}finally{E(!1)}}},[v,y,u,l,R,r,g,p,_]),ce=a.useMemo(()=>[...$,...B],[$,B]),D=a.useMemo(()=>[{kind:"ask",label:"Ask",doors:$},{kind:"offer",label:"Offer",doors:B}].filter(C=>C.doors.length>0),[$,B]),[G,V]=a.useState(null),Ce=D.some(C=>C.kind===G)?G:((We=D[0])==null?void 0:We.kind)??"ask",Re=Ce==="ask"?$:B,[Ue,Pe]=a.useState(""),Ve=Re.length>=5,De=Ve?Ue.trim().toLowerCase():"",Se=a.useMemo(()=>De?Re.filter(C=>C.target.toLowerCase().includes(De)):Re,[Re,De]),pe=Se.length,xe=Math.max(0,Se.findIndex(C=>C.id===Z)),je=pe?Se[xe]:null,A=ce.length>1,P=a.useCallback(C=>{if(pe<2)return;const H=(xe+C+pe)%pe;W(Se[H].id)},[xe,Se,pe]),z=Hs(()=>P(1),()=>P(-1)),re=a.useRef(null),J=a.useCallback(C=>{var fe,_e;const H=C.key==="ArrowRight"||C.key==="ArrowDown"?1:C.key==="ArrowLeft"||C.key==="ArrowUp"?-1:0;if(!H)return;C.preventDefault(),P(H);const Q=(xe+H+pe)%pe;(_e=(fe=re.current)==null?void 0:fe.querySelectorAll(".rm-prow")[Q])==null||_e.focus()},[xe,pe,P]);if(a.useEffect(()=>{var H,Q;const C=(H=re.current)==null?void 0:H.querySelectorAll(".rm-prow");(Q=C==null?void 0:C[xe])==null||Q.scrollIntoView({block:"nearest",inline:"nearest"})},[xe]),T)return e.jsx(ve,{error:T,onRetry:_});if(U)return e.jsx(de,{what:"Opening what you two share"});if(!R)return e.jsxs(e.Fragment,{children:[e.jsx(te,{title:"Nothing open",size:"lg"}),e.jsx(ie,{title:"No door here.",line:"We could not find that person in this room."})]});if(!x.consent){const C=x.blocked==="league_not_open",H=x.seats??0,Q=x.minMembers??0,fe=Math.max(0,Q-H);return e.jsxs(e.Fragment,{children:[e.jsx(te,{title:R.name,size:"lg"}),e.jsx(ie,{title:C?`${H} of ${Q} in.`:"Nothing is open yet.",line:C?`Nothing is shared until ${Q} are in — ${fe} more and everyone's targets go live to each other.`:"Scan each other's codes and whatever you two can open for one another appears here. Nothing opens until you are both standing in front of each other.",action:C?"Add people":void 0,onAction:C?()=>n("league-new",{leagueId:t.leagueId}):void 0})]})}return x.doors.length?e.jsxs(e.Fragment,{children:[e.jsx(te,{title:R.name,size:"lg"}),e.jsx("div",{className:"rm-deck-top",children:e.jsxs(se,{children:[$.length," to ask · ",B.length," to offer",pe>1?` · ${xe+1} of ${pe}`:""]})}),D.length>1&&e.jsx("div",{className:"rm-sides",role:"tablist","aria-label":"Asks and offers",children:D.map(C=>{const H=C.kind===Ce;return e.jsxs("button",{type:"button",role:"tab","aria-selected":H,"aria-controls":"rm-pane-list",tabIndex:H?0:-1,className:`rm-side${H?" rm-side--on":""}`,onClick:()=>{var Q;V(C.kind),Pe(""),W(((Q=C.doors[0])==null?void 0:Q.id)??null)},children:[e.jsx("span",{className:`rm-side-dot${C.kind==="offer"?" rm-side-dot--offer":""}`,"aria-hidden":!0}),e.jsx("span",{className:"rm-side-name",children:C.label}),e.jsxs("span",{className:"rm-side-meta",children:[C.doors.length," ",C.doors.length===1?"company":"companies"]})]},C.kind)})}),ee?e.jsx("div",{className:"rm-deck-err",children:ee}):null,e.jsxs("div",{className:`rm-pane${A?"":" rm-pane--solo"}`,...z,children:[A&&e.jsxs("div",{className:"rm-pane-side",id:"rm-pane-list",role:"tabpanel","aria-label":Ce==="ask"?"Companies you can ask for":"Companies you can offer",children:[e.jsxs("div",{className:"rm-pane-head",children:[e.jsx("h3",{className:"rm-pane-title",children:Ce==="ask"?"Ask from":"Offer from"}),e.jsxs("p",{className:"rm-pane-sub",children:["Select a company to ",Ce==="ask"?"ask":"offer"," ",R.name.split(" ")[0]]})]}),Ve&&e.jsxs("label",{className:"rm-pane-search",children:[e.jsx("span",{className:"rm-pane-search-ico","aria-hidden":!0,
1children:"⌕"}),e.jsx("input",{type:"search",value:Ue,onChange:C=>Pe(C.target.value),placeholder:"Search companies…","aria-label":"Search companies"})]}),e.jsx("div",{className:"rm-pane-rows",role:"tablist","aria-label":"Target companies",ref:re,onKeyDown:J,children:Se.map((C,H)=>{const Q=C.done||s("actioned",C.id),fe=H===xe;return e.jsxs("button",{type:"button",role:"tab",id:`rm-tab-${C.id}`,"aria-selected":fe,"aria-controls":`rm-panel-${C.id}`,tabIndex:fe?0:-1,className:`rm-prow${fe?" rm-prow--on":""}${Q?" rm-prow--done":""}`,onClick:()=>W(C.id),children:[e.jsx("span",{className:`rm-prow-dot${C.kind==="offer"?" rm-prow-dot--offer":""}`,"aria-hidden":!0}),e.jsx("span",{className:"rm-prow-name",children:C.target}),e.jsx("span",{className:"rm-prow-meta",children:Q?C.kind==="ask"?"Asked ✓":"Offered ✓":C.kind}),e.jsx("span",{className:"rm-prow-go","aria-hidden":!0,children:"›"})]},C.id)})}),!Se.length&&e.jsx("p",{className:"rm-pane-none",children:"No company by that name on this side."})]}),e.jsx("div",{className:"rm-pane-card",children:je&&e.jsx("div",{role:"tabpanel",id:`rm-panel-${je.id}`,"aria-labelledby":`rm-tab-${je.id}`,children:e.jsx(fs,{door:je,personName:R.name,done:je.done||s("actioned",je.id),busy:f===je.id,onAsk:()=>void L(je),onAskPath:C=>void L(je,C),openers:Ne},je.id)})})]}),pe>1&&e.jsx("div",{className:"rm-deck-hint",children:"Swipe between targets"}),he&&e.jsx(vs,{profile:he,onClose:()=>oe(null),onInvite:()=>oe(null)}),I.offerIntro?e.jsx(xs,{state:I.offerIntro,onChange:I.setOfferIntro,viewerFullName:(w==null?void 0:w.fullName)||"You",sending:I.offerIntroSending,onClose:()=>!I.offerIntroSending&&I.setOfferIntro(null),onSend:()=>void I.sendOfferIntro()}):null,v&&R&&e.jsx(ys,{open:!0,variant:v.kind==="ask"?"request":"offer",connectorName:R.name,connectorUserId:l,connectorEmail:R.email??null,targetName:v.endpoint,targetEmail:v.endpointEmail??null,targetRole:v.endpointRole??null,targetCompany:v.target,viewerFullName:(w==null?void 0:w.fullName)||"You",viewerEmail:(w==null?void 0:w.email)??null,viewerUserId:u,viewerToken:y,reasoning:v.strength||null,onClose:()=>{m(null),S(null)},onSend:Y,sending:j,error:c})]}):e.jsxs(e.Fragment,{children:[e.jsx(te,{title:R.name,size:"lg"}),e.jsx(ie,{title:"No overlap, this time.",line:"Neither of you is near what the other is after. Add more target accounts and this fills in."})]})}function qs(t,n){const s=(n==null?void 0:n.tier)||t.tier||"strong";return{id:t.apiTargetId,ownerUserId:0,kind:"company",targetUserId:null,companyName:t.target,companyUrl:null,industry:null,targetContactName:t.endpoint||null,targetRole:t.endpointRole||null,source:null,createdAt:null,path:{tier:s,strength:s,via:null,contact:{contactId:(n==null?void 0:n.contactId)??0,name:t.endpoint||t.target,title:t.endpointRole||null,company:t.target,email:t.endpointEmail??null,linkedinUrl:null,connectedUserId:null,tier:s},alternates:[]}}}function zs(t,n){return{id:n,status:"active",direction:"outgoing",classification:"connector",role:t.role??null,isRequester:!0,userId:t.apiUserId??null,name:t.name,email:t.email??null,profilePhoto:null,company:null,note:null,sharingEnabled:!0,createdAt:null,acceptedAt:null,lastRequestedAt:null,canReRequest:!1}}function Hs(t,n){const[s,o]=a.useState(null);return{onTouchStart:r=>{const d=r.touches[0];o({x:d.clientX,y:d.clientY})},onTouchEnd:r=>{if(!s)return;const d=r.changedTouches[0],h=d.clientX-s.x,i=d.clientY-s.y;Math.abs(h)>60&&Math.abs(h)>Math.abs(i)&&(h<0?t:n)(),o(null)}}}function Ys(){var I,M,F,O;const{client:t,events:n,orgEvents:s,toggleUpvote:o,getPersonUpvote:r}=ae(),d=Xe()??((I=n[0])==null?void 0:I.apiId)??((M=s[0])==null?void 0:M.apiId)??null,h=((F=n.find(x=>x.apiId===d))==null?void 0:F.title)??((O=s.find(x=>x.apiId===d))==null?void 0:O.title),{data:i,loading:g,error:p,reload:l}=be(t&&d?async()=>(await t.getAfter(d)).people.map(U=>({id:U.id,name:U.name,mark:U.mark,tone:U.tone,sub:U.host?[U.role,"Host"].filter(Boolean).join(" · "):U.role??void 0,userId:U.userId,guestId:U.guestId??null,met:U.met})):null,Ks,[t,d]),[f,k]=a.useState(""),[v,m]=a.useState({}),[j,E]=a.useState(null),c=a.useMemo(()=>i.map(x=>({...x,met:v[x.id]??x.met})),[i,v]),S=c.filter(x=>x.met).length,w=f.trim().toLowerCase(),y=w?c.filter(x=>`${x.name} ${x.sub??""}`.toLowerCase().includes(w)):c,u=a.useCallback(async x=>{const U=!x.met;if(m(T=>({...T,[x.id]:U})),E(null),!(!t||!d))try{await t.setMet(d,{userId:x.userId,guestId:x.guestId,met:U})}catch(T){m(_=>({..._,[x.id]:!U})),E(T instanceof Error?T.message:"That did not save.")}},[t,d]),b=x=>r(x.userId?`u:${x.userId}`:x.id);return p?e.jsx(ve,{error:p,onRetry:l}):g?e.jsx(de,{what:"Gathering the night"}):e.jsxs(e.Fragment,{children:[e.jsx(te,{kicker:"the night after",title:"See who you met"}),i.length===0?e.jsx(ie,{title:"Nobody on this list yet.",line:"The room fills up as the host adds people — whoever was here will be here."}):e.jsxs(e.Fragment,{children:[e.jsx("input",{className:"rm-input rm-metsearch",value:f,onChange:x=>k(x.target.value),placeholder:"Search everyone who was there","aria-label":"Search everyone who was there",autoComplete:"off"}),e.jsx(N,{className:"rm-metcount",children:S===0?`${c.length} ${c.length===1?"person was":"people were"} in this room. Mark the ones you met.`:`${S} of ${c.length} marked as met.`}),j&&e.jsx(N,{className:"rm-metfail",children:j}),y.length===0?e.jsx(N,{className:"rm-metnone",children:"Nobody on the list by that name."}):e.jsx("div",{className:"rm-list",children:y.map(x=>e.jsx(ye,{className:x.met?"rm-met--on":"",lead:e.jsx(ue,{mark:x.mark,tone:x.tone,size:"sm"}),name:x.name,sub:x.sub,right:e.jsxs("span",{className:"rm-metrow-right",children:[e.jsx(ne,{filled:x.met,children:x.met?"Met ✓":"I met them"}),e.jsx(ct,{size:"sm",count:b(x).count,voted:b(x).userVoted,onClick:()=>void o({id:x.id,name:x.name,role:x.sub,mark:x.mark,tone:x.tone,apiUserId:x.userId,apiGuestId:x.guestId,state:"joined"},{type:"event",id:d,title:h})})]}),onClick:()=>u(x)},x.id))})]})]})}const Ks=as.map(({person:t,met:n})=>({id:t.id,name:t.name,mark:t.mark,tone:t.tone,sub:t.role,userId:null,guestId:null,met:n})),Js=/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/;function Qs(t,n){var o;if(!n)return`${t} is in.`;if(n.failed)return`${t} is in, but the invitation did not go: ${n.failed}`;if(n.sent>0)return`${t} is in · invitation sent.`;
1const s=(o=n.skipped[0])==null?void 0:o.reason;return s?`${t} is in, but no invitation went out: ${s}`:`${t} is in. No invitation went out.`}function Ut({client:t,picked:n=[],onChange:s,onAdd:o,sendingId:r=null,sentIds:d}){const[h,i]=a.useState("network"),g=a.useCallback(l=>s==null?void 0:s(n.filter(f=>f.contactId!==l)),[n,s]),p=a.useCallback(l=>{if(o)return void o(l);n.some(f=>f.contactId===l.contactId)||s==null||s([...n,l])},[n,s,o]);return e.jsxs(e.Fragment,{children:[e.jsx(Qe,{value:h,onChange:l=>i(l),options:[{id:"network",label:"My network"},{id:"hand",label:"Name and email"}]}),h==="network"?e.jsx(Zs,{client:t,picked:n,onPick:p,onDrop:g,sendingId:r,sentIds:d}):e.jsx(ea,{client:t,sends:!!o,onAdded:async l=>{if(o)return await o(l);p(l),i("network")}}),!o&&n.length>0&&e.jsx("div",{className:"rm-list rm-guests-list",children:n.map(l=>e.jsx(ye,{lead:e.jsx(ue,{mark:l.mark,tone:l.tone,size:"sm"}),name:l.name,sub:l.email||l.why,right:e.jsx("button",{type:"button",className:"rm-guests-x",onClick:()=>g(l.contactId),"aria-label":`Remove ${l.name}`,children:"×"})},l.contactId))})]})}function Xs({client:t,leagueId:n,room:s,onSeated:o}){const[r,d]=a.useState(null),[h,i]=a.useState(()=>new Set),[g,p]=a.useState(""),[l,f]=a.useState(""),k=s<=0,v=a.useCallback(async m=>{if(!(!t||r!==null)){if(!n){p("This league has not finished loading — reopen it and try again.");return}d(m.contactId),p(""),f("");try{const j=await t.addLeagueMembers(n,[],[m.contactId]);i(E=>new Set(E).add(m.contactId)),f(Qs(m.name,j.invites)),o()}catch(j){p(`${m.name}: ${j instanceof Error?j.message:"could not be added to the league"}`)}finally{d(null)}}},[t,n,r,o]);return e.jsxs(X,{className:"rm-guests",children:[e.jsxs("div",{className:"rm-guests-top",children:[e.jsxs("div",{className:"rm-guests-g",children:[e.jsx(se,{children:"add people"}),e.jsx("div",{className:"rm-guests-n",children:k?"Every seat is taken.":`${s} seat${s===1?"":"s"} still open`})]}),h.size>0&&e.jsx(ne,{filled:!0,children:h.size})]}),k?e.jsx(N,{children:"Nobody else fits — give a seat back first and this opens up again."}):e.jsx(Ut,{client:t,onAdd:v,sendingId:r,sentIds:h}),g&&e.jsx(N,{className:"rm-guests-err",children:g}),l&&e.jsx(N,{children:l}),e.jsx(N,{children:"Adding somebody takes their seat and invites them on the spot — they are emailed the invitation that also makes the two of you connectors."})]})}function Zs({client:t,picked:n,onPick:s,onDrop:o,sendingId:r,sentIds:d}){const[h,i]=a.useState(""),[g,p]=a.useState([]),[l,f]=a.useState(0),[k,v]=a.useState(!!t),[m,j]=a.useState(null),E=a.useRef(0);return a.useEffect(()=>{if(!t){v(!1);return}const c=++E.current;v(!0);const S=window.setTimeout(()=>{t.calendarCandidates({search:h.trim()||void 0,limit:40}).then(w=>{E.current===c&&(p(w.candidates),f(w.total),j(null))}).catch(w=>{E.current===c&&j(w instanceof Error?w.message:"Could not read your network")}).finally(()=>{E.current===c&&v(!1)})},h?280:0);return()=>window.clearTimeout(S)},[t,h]),t?e.jsxs(e.Fragment,{children:[e.jsx("input",{className:"rm-input",value:h,placeholder:"Search the people you meet with",autoComplete:"off","aria-label":"Search your network",onChange:c=>i(c.target.value)}),m?e.jsx(N,{className:"rm-guests-err",children:m}):k?e.jsx(de,{what:"Reading your network"}):g.length?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"rm-list rm-guests-pick",children:g.map(c=>{const S=n.some(I=>I.contactId===c.contactId),w=r===c.contactId,y=(d==null?void 0:d.has(c.contactId))??!1,u=c.inLeague&&!S&&!y,b=u||w||y;return e.jsx(ye,{className:u?"rm-row--off":"",lead:e.jsx(ue,{mark:c.mark,tone:c.tone,size:"sm"}),name:c.name,sub:c.email||c.why,right:e.jsx(ne,{filled:S||y,children:w?"Sending…":y?"Invited ✓":S?"✓":u?"In a league":"Add"}),onClick:b?void 0:()=>S?o(c.contactId):s(c)},c.contactId)})}),l>g.length&&e.jsxs(N,{children:[l," people on your calendar — search to find the ones you want."]})]}):e.jsx(ie,{title:h.trim()?"Nobody matches that.":"Nobody on your calendar yet.",line:h.trim()?"Try a company, or part of an address.":"Connect a calendar and the people you already meet with land here. Until then, write them down by name and email."})]}):e.jsx(N,{children:"Sign in and the people you already meet with show up here, with their addresses — nothing to retype."})}function ea({client:t,onAdded:n,sends:s}
1){const[o,r]=a.useState(""),[d,h]=a.useState(""),[i,g]=a.useState(""),[p,l]=a.useState(!1),[f,k]=a.useState(""),v=a.useCallback(async()=>{if(!t)return;const m=o.trim(),j=d.trim();if(!m){k("A name — the seat has to be somebody's.");return}if(!Js.test(j)){k("An email address. That is how the seat reaches them.");return}l(!0),k("");try{const E=await t.createLeagueContact({name:m,email:j,...i.trim()?{company:i.trim()}:{}});await n(E.candidate),r(""),h(""),g("")}catch(E){k(E instanceof Error?E.message:"Could not add them")}finally{l(!1)}},[t,o,d,i,n]);return t?e.jsxs(e.Fragment,{children:[e.jsx("input",{className:"rm-input",value:o,placeholder:"Their name","aria-label":"Their name",onChange:m=>{r(m.target.value),k("")}}),e.jsx("input",{className:"rm-input",type:"email",value:d,placeholder:"[email protected]","aria-label":"Their email",autoComplete:"off",onChange:m=>{h(m.target.value),k("")},onKeyDown:m=>{m.key==="Enter"&&v()}}),e.jsx("input",{className:"rm-input",value:i,placeholder:"Company — optional","aria-label":"Their company",onChange:m=>g(m.target.value)}),f&&e.jsx(N,{className:"rm-guests-err",children:f}),e.jsx(q,{variant:"out",disabled:p,onClick:()=>void v(),children:p?"Adding…":"Add them"}),e.jsx(N,{children:s?"They become a contact of yours — that is what the seat is taken against — and the invitation goes out on this button.":"They become a contact of yours, which is what the seat is taken against."})]}):e.jsx(N,{children:"Sign in to write somebody down — the seat needs an address to reach them at."})}function ta(){const{home:t,client:n,refresh:s,viewer:o,canCreateLeagues:r}
1=ae(),[d,h]=a.useState(!1),[i,g]=a.useState(!1),[p,l]=a.useState(null),[f,k]=a.useState(""),[v,m]=a.useState([]),[j,E]=a.useState(null),[c,S]=a.useState(""),[w,y]=a.useState(null),u=v.length+1,b=u>=$e,I=Array.from({length:Ie},(x,U)=>U),M=a.useCallback(async()=>{if(!n){l({name:f||"New league",code:pt});return}g(!0),E(null);try{const x=await n.createLeague({name:f.trim()||"New league",memberContactIds:v.map(U=>U.contactId),seasonEndsAt:new Date(Date.now()+7776e6).toISOString()});l({name:x.league.name,code:x.league.inviteCode,already:x.already}),await s()}catch(x){E(x instanceof Error?x.message:"Could not start that league")}finally{g(!1)}},[n,f,v,s]),F=a.useCallback(async()=>{if(!(!n||!c.trim())){g(!0),y(null);try{await n.joinLeague(c.trim()),await s(),t()}catch(x){y(x instanceof Error?x.message:"That code did not work")}finally{g(!1)}}},[n,c,s,t]),O=(p==null?void 0:p.code)??pt;return e.jsxs(e.Fragment,{children:[e.jsx(te,{kicker:r?`new league · ${Ie} max`:"join a league",title:p?p.name:r?"Pick your people":"Got a code?",action:p?"Done":void 0,onAction:()=>t()}),p?e.jsxs(X,{children:[e.jsx(se,{children:p.already?"you already had this one — send the code":"it's live — send the code"}),e.jsx("div",{className:"rm-code",children:O}),e.jsx(N,{children:p.already?"Whoever you just picked has been seated in it, rather than a second league being made.":b?`${u} in. Everyone's targets are live to each other.`:`${u} in. ${$e-u} more and it opens.`}),e.jsxs("div",{className:"rm-code-acts",children:[e.jsx(ne,{onClick:()=>{Ye(Gn(O)).then(h)},children:d?"Copied ✓":"Copy link"}),e.jsx(ne,{filled:!0,onClick:()=>t(),children:"Back to your leagues"})]})]}):e.jsxs(e.Fragment,{children:[r&&e.jsxs(e.Fragment,{children:[e.jsx("input",{className:"rm-input",value:f,placeholder:"Name it — The Mission Ten",onChange:x=>k(x.target.value)}),e.jsx(Ut,{client:n,picked:v,onChange:m}),e.jsxs("div",{className:"rm-ring",children:[e.jsx("span",{className:"rm-seat rm-seat--full rm-tone-you",children:o.mark}),I.slice(1).map(x=>{const U=v[x-1];return U?e.jsx("span",{className:`rm-seat rm-seat--full rm-tone-${U.tone}`,children:U.mark},x):e.jsx("span",{className:"rm-seat",children:x+1},x)})]}),e.jsxs("div",{className:"rm-ringcount",children:[e.jsx(Ae,{className:"rm-ringcount-n",children:u}),e.jsx("span",{children:b?"in. It opens the moment you send it.":`in. ${$e-u} more and it opens.`})]}),j&&e.jsx(N,{className:"rm-guests-err",children:j}),e.jsx(q,{disabled:i||u>Ie,onClick:M,children:i?"Starting…":u>Ie?`A league holds ${Ie}, you included`:u>1?`Start it with ${u}`:"Start it"})]}),e.jsxs(X,{children:[e.jsx(se,{children:r?"or join one with a code":"join one with a code"}),e.jsx("input",{className:"rm-input",value:c,placeholder:"MSN-4KQ",onChange:x=>{S(x.target.value.toUpperCase()),y(null)},onKeyDown:x=>{x.key==="Enter"&&F()}}),w&&e.jsx(N,{children:w}),e.jsx("div",{className:"rm-code-acts",children:e.jsx(ne,{filled:!0,onClick:()=>void F(),children:"Join"})})]}),e.jsx(N,{children:r?`Nothing works until ${$e} are in. Every name after that is more the others can reach.`:`Anyone can join a league with its code — nothing works until ${$e} are in.`})]})]})}const na=2600;function sa(){const{focus:t,go:n,client:s,leagues:o,version:r,refresh:d,toggleUpvote:h,getPersonUpvote:i}=ae(),g=o.find($=>$.id===t.leagueId)??o[0],p=g==null?void 0:g.apiId,l=Ge.find($=>$.id===t.leagueId)??Ge[0],[f,k]=a.useState(!1),[v,m]=a.useState({}),[j,E]=a.useState(null),[c,S]=a.useState(""),w=a.useRef([]);a.useEffect(()=>()=>{for(const $ of w.current)window.clearTimeout($)},[]);const{data:y,loading:u,error:b,reload:I}=be(s&&p?async()=>{const $=await s.getLeague(p);return{league:rs(it($.league),$.reach),yourReach:$.yourReach,unasked:$.unasked}}:null,{league:g??l,yourReach:50,unasked:31},[s,p,r]),M=a.useCallback(async($,B,Z,W)=>{if(!(!s||!p)){E($),S("");try{await s.inviteLeagueMember(p,{...B.userId?{userId:B.userId}:{},...B.contactId?{contactId:B.contactId}:{},resend:W}),m(ee=>({...ee,[$]:!0})),w.current.push(window.setTimeout(()=>m(ee=>{const le={...ee};return delete le[$],le}),na))}catch(ee){S(`${Z}: ${ee instanceof Error?ee.message:"that invitation could not be sent."}`)}finally{E(null)}}},[s,p]),F=a.useCallback(()=>{I(),d()},[I,d]);if(b)return e.jsx(ve,{error:b,onRetry:I});if(u)return e.jsx(de,{what:"Counting the doors"});const O=y.league,x=[...O.members].sort(($,B)=>B.reach-$.reach),U=Math.max(1,...x.map($=>$.reach)),T=O.isOpen===!1,_=x.filter($=>$.person.state!=="invited").length,R=Math.max(0,(O.maxMembers??x.length)-x.length),K=e.jsx(Xs,{client:s,leagueId:p??null,room:R,onSeated:F});return e.jsxs(e.Fragment,{children:[e.jsx(te,{kicker:"everyone sees this",title:"Who can open what"}),T?e.jsx(ie,{title:`${O.seats} in. ${(O.minMembers??6)-O.seats} more and it opens.`,line:`Nothing is shared until ${$e} are in. Every name after that is more the others can reach.`,action:f?void 0:"Add people",onAction:f?void 0:()=>k(!0)}):e.jsxs(X,{dark:!0,className:"rm-reachhero",children:[e.jsxs("div",{className:"rm-reachhero-head",children:[e.jsx(Ae,{className:"rm-reachhero-n",children:y.yourReach}),e.jsxs("span",{children:["door",y.yourReach===1?"":"s"," you can open",e.jsx("br",{}),"for the other ",Math.max(0,O.seats-1),"."]})]}),y.unasked>0&&e.jsxs(N,{dark:!0,children:["Nobody has asked for ",y.unasked," of them. They can see the number — they're being polite."]})]}),e.jsxs(se,{className:"rm-listlabel",children:["in this league · ",_," of ",x.length," joined · doors each can open"]}),e.jsx("div",{className:"rm-lgseats",children:x.map($=>{const B=$.person.id,Z=$.person.state==="invited",W=!Z,ee=!!v[B],le=$.reach===U&&U>0,he=$.apiUserId?`u:${$.apiUserId}`:B,oe=i(he);return e.jsxs("div",{className:`rm-lgseat${$.reach===0?" rm-lgseat--quiet":""}`,children:[e.jsx("button",{type:"button",className:"rm-lgseat-hit","aria-label":`What ${$.you?"you":$.person.name} can open`,onClick:()=>n("doors",{personId:B,leagueId:O.id,eventId:""})}),e.jsxs("span",{className:"rm-lgseat-row",children:[e.jsx(ue,{mark:$.person.mark,tone:$.person.tone,size:"sm"}),e.jsxs("span",{className:"rm-lgseat-g",children:[e.jsxs("span",{className:"rm-lgseat-head",children:[e.jsxs("span",{className:"rm-lgseat-name",children:[$.you?"You":$.person.name,$.person.role&&e.jsx("span",{className:"rm-lgseat-sub",children:$.person.role})]}),e.jsxs("span",{className:"rm-lgseat-act",children:[$.person.state&&e.jsx("span",{className:`rm-state rm-state--${$.person.state.replace(/\s+/g,"-")}`,children:$.person.state}),W&&e.jsx(ct,{size:"sm",count:oe.count,voted:oe.userVoted,onClick:()=>void h({id:$.person.id,name:$.person.name,role:$.person.role,mark:$.person.mark,tone:$.person.tone,apiUserId:$.apiUserId,state:$.person.state},{type:"league",id:p||O.id,title:O.name})}),!$.you&&Z&&e.jsx(ne,{filled:!$.invited&&!ee,disabled:$.canInvite===!1||j===B,onClick:$.canInvite===!1?void 0:()=>void M(B,{userId:$.apiUserId,contactId:$.apiContactId},$.person.name,!!$.invited),children:$.canInvite===!1?"No email":j===B?"Sending…":ee?"Sent ✓":$.invited?"Invite again":"Invite"})]}),e.jsx(Ae,{className:`rm-lgseat-n${le?" rm-lgseat-n--top":""}`,children:$.reach})]}),e.jsx(Ke,{pct:$.reach/U*100,ochre:le})]})]})]},B)})}),c&&e.jsx(N,{className:"rm-guests-err",children:c}),f?e.jsxs(e.Fragment,{children:[K,e.jsx("div",{className:"rm-code-acts",children:e.jsx(ne,{onClick:()=>k(!1),children:"Done adding"})})]}):e.jsx(ye,{className:"rm-row--add",lead:e.jsx("span",{className:"rm-dashav",children:"+"}),name:R>0?"Add people":"Every seat is taken",sub:R>0?`${R} seat${R===1?"":"s"} open · from your network, or by name and email`:`A league holds ${O.maxMembers??x.length}, you included`,right:R>0?e.jsx("span",{className:"rm-arrow",children:"›"}):void 0,onClick:R>0?()=>k(!0):void 0}),e.jsx(N,{children:"Counts doors into what this league is asking for, never network size. A number moves the moment someone adds a target that person can reach."}),e.jsx("div",{className:"rm-foot",children:e.jsx(q,{variant:"out",onClick:()=>n("league-score",{leagueId:O.id}),children:"The season score"})})]})}function aa(){const{focus:t,client:n,leagues:s,version:o}
1=ae(),r=s.find(y=>y.id===t.leagueId)??s[0],d=r==null?void 0:r.apiId,h=Ge.find(y=>y.id===t.leagueId)??Ge[0],{data:i,loading:g,error:p,reload:l}=be(n&&d?async()=>{const y=await n.getScore(d);return os(r??it({...y.league}),y)}:null,r??h,[n,d,o]);if(p)return e.jsx(ve,{error:p,onRetry:l});if(g)return e.jsx(de,{what:"Adding it up"});const{met:f,target:k,days:v,rival:m,rivalScore:j}=i.season,E=Math.max(0,k-f),c=E>0?Math.max(1,Math.round(E/10)):0,S=[...i.members].sort((y,u)=>u.met-y.met),w=f-j;return e.jsxs(e.Fragment,{children:[e.jsx(te,{kicker:v>0?`season 1 · ${v} days left`:"season 1",title:"The score",action:"Share",dark:!0}),e.jsxs("div",{className:"rm-score",children:[e.jsx(Ae,{className:"rm-score-n",children:f}),e.jsxs("div",{className:"rm-score-copy",children:[f===1?"person":"people"," met by the ",i.seats," of you."]}),e.jsx(Ke,{pct:k?f/k*100:0,ochre:!0,dark:!0}),e.jsx(N,{dark:!0,children:E>0?`${E} short of ${k}. That's ${c} night${c===1?"":"s"} out between ${i.seats} people.`:`Past ${k}. The target moves next season.`})]}),S.length===0?e.jsx(ie,{title:"No numbers yet.",line:"They start the first time somebody scans someone."}):e.jsx("div",{className:"rm-scorelist",children:S.map(y=>e.jsxs("div",{className:"rm-scorerow",children:[e.jsx(ue,{mark:y.person.mark,tone:y.person.tone,size:"sm"}),e.jsxs("div",{className:"rm-scorerow-g",children:[e.jsx("div",{className:"rm-scorerow-n",children:y.you?"You":y.person.name.split(" ")[0]}),e.jsxs(N,{dark:!0,children:[y.met," met · ",y.intros," intros · ",y.events," events"]})]}),e.jsx(Ae,{className:`rm-scorerow-v${y===S[0]?" rm-scorerow-v--top":""}`,children:y.met})]},y.person.id))}),m&&e.jsxs(X,{dark:!0,children:[e.jsx(ge,{children:w>0?`Beat ${m} by ${w}.`:`${m} are ${-w} ahead.`}),e.jsxs(N,{dark:!0,children:["They're at ",j," with the same days left."]})]})]})}function ra(t){const n=new Date(t).getTime();if(Number.isNaN(n))return"";const s=Math.round((Date.now()-n)/6e4);if(s<1)return"just now";if(s<60)return`${s} min ago`;const o=Math.round(s/60);return o<24?`${o}h ago`:`${Math.round(o/24)}d ago`}function oa(){const{refresh:t}=ae(),{user:n}=Je(),s=(n==null?void 0:n.accessToken)??null,[o,r]=a.useState(null),[d,h]=a.use
1State([]),[i,g]=a.useState(!0),[p,l]=a.useState(null),[f,k]=a.useState([]),[v,m]=a.useState(!1),j=a.useCallback(async()=>{if(!s){g(!1);return}g(!0),l(null);try{const[u,b]=await Promise.all([Bn(s),qn(s)]);r(u.code),h(b.requests)}catch(u){l(u instanceof Error?u.message:"Could not read your code")}finally{g(!1)}},[s]);a.useEffect(()=>{j()},[j]);const E=a.useCallback(async(u,b)=>{if(s){k(I=>[...I,u]),l(null);try{const I=await zn(s,u,b);h(M=>M.map(F=>F.id===u?{...F,state:I.request.state}:F)),b==="approve"&&t()}catch(I){l(I instanceof Error?I.message:"Could not act on that")}finally{k(I=>I.filter(M=>M!==u))}}},[s,t]),c=o?Hn(o):null,S=a.useCallback(()=>{var u;c&&((u=navigator.clipboard)==null||u.writeText(c).then(()=>{m(!0),window.setTimeout(()=>m(!1),1800)},()=>l("Could not copy — the link is in the box above.")))},[c]),w=d.filter(u=>u.state==="pending"),y=d.filter(u=>u.state!=="pending");return i?e.jsx(de,{what:"Reading your code"}):e.jsxs(e.Fragment,{children:[e.jsx(te,{kicker:"your code",title:"One code for every room you run.",size:"lg"}),p&&e.jsx(ve,{error:p,onRetry:()=>void j()}),c&&e.jsxs("div",{className:"rm-org-invite",children:[e.jsx(ks,{value:c,size:188,alt:"Your Gemphere organizer code"}),e.jsxs("div",{className:"rm-org-invite-side",children:[e.jsx(N,{children:"Hold this up at the door or put it on your invitation. Whoever scans it sees everything you run and asks for the rooms they want — and nobody is in until you say so, below."}),e.jsx("div",{className:"rm-org-invite-code",children:o}),e.jsx("input",{className:"rm-org-invite-url",value:c,readOnly:!0,"aria-label":"Your organizer link",onFocus:u=>u.currentTarget.select()}),e.jsxs("div",{className:"rm-org-invite-acts",children:[e.jsx(q,{variant:"out",onClick:S,children:v?"Copied":"Copy link"}),e.jsx("a",{className:"rm-btn rm-btn--out",href:c,target:"_blank",rel:"noopener noreferrer",children:"See what they see"})]})]})]}),e.jsx(te,{kicker:w.length?`${w.length} waiting on you`:"the queue",title:"Who has asked to come in",action:"Refresh",onAction:()=>void j()}),w.length===0&&y.length===0?e.jsx(ie,{title:"Nobody has asked yet.",line:"Requests land here the moment somebody scans your code and picks a room."}):e.jsxs("div",{className:"rm-list",children:[w.map(u=>e.jsxs("div",{className:"rm-req",children:[e.jsx(ue,{mark:u.person.mark,tone:u.person.tone,size:"sm"}),e.jsxs("div",{className:"rm-req-who",children:[e.jsx("b",{children:u.person.name}),e.jsx("span",{children:u.person.role||u.email||"No title on their profile yet"}),e.jsxs("span",{children:["wants into ",e.jsx("b",{children:u.room})," · ",ra(u.askedAt)]})]}),e.jsxs("div",{className:"rm-req-acts",children:[e.jsx(q,{variant:"solid",disabled:f.includes(u.id),onClick:()=>void E(u.id,"approve"),children:"Let in"}),e.jsx(q,{variant:"ghost",disabled:f.includes(u.id),onClick:()=>void E(u.id,"decline"),children:"Not this time"})]})]},u.id)),y.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"rm-secthead",children:[e.jsx("span",{children:"Already decided"}),e.jsx("span",{className:"rm-secthead-n",children:y.length})]}),y.map(u=>e.jsxs("div",{className:"rm-req rm-req--done",children:[e.jsx(ue,{mark:u.person.mark,tone:u.person.tone,size:"sm"}),e.jsxs("div",{className:"rm-req-who",children:[e.jsx("b",{children:u.person.name}),e.jsx("span",{children:u.room})]}),e.jsx("span",{className:`rm-tag rm-tag--${u.state==="approved"?"in":"quiet"}`,children:u.state==="approved"?"let in":"not this time"})]},u.id))]})]}),e.jsx(N,{className:"rm-explain",children:"Letting somebody in does exactly what your event link does: they go on the guest list, or take a seat in the league, and the two of you become connectors. It never ties them to anybody else in the room."})]})}const ia={way:"search",picked:null,parsed:null,link:"",title:"",date:"",time:"",dropTime:"",venue:"",seats:""};function la(t,n){if(!t.trim())return;const s=new Date(`${t}T${(n||"00:00").slice(0,5)}`);if(!Number.isNaN(s.getTime()))return s.toISOString()}function Pt(t,n){const s=/^(\d{1,2}):(\d{2})/.exec(n.trim());if(!s)return;const o=Number(s[1]),r=Number(s[2]);if(o>23||r>59)return;const d=new Date(t);if(Number.isNaN(d.getTime()))return;const h=new Date(d);return h.setHours(o,r,0,0),h.getTime()<d.getTime()&&h.setDate(h.getDate()+1),h.toISOString()}function ca(t){if(!t)return"";const n=new Date(t);return Number.isNaN(n.getTime())?"":`${String(n.getHours()).padStart(2,"0")}
1:${String(n.getMinutes()).padStart(2,"0")}`}function Vt(t){const n=t.trim();if(n)return/^https?:\/\//i.test(n)?n:`https://${n}`}function Ze(t){var n;return t.picked?t.picked.name:t.title.trim()||((n=t.parsed)!=null&&n.ok?(t.parsed.title||"").trim():"")}function dt(t){var n;return t.picked?t.picked.startsAt??void 0:t.way==="link"&&((n=t.parsed)!=null&&n.ok)&&t.parsed.startsAt?t.parsed.startsAt:la(t.date,t.time)}function da(t){if(!t.dropTime.trim())return;const n=dt(t);if(n)return Pt(n,t.dropTime)}function Wt(t){var n;return t.picked?[t.picked.neighborhood,t.picked.city].filter(Boolean).join(", ")||void 0:t.way==="link"&&((n=t.parsed)!=null&&n.ok)&&t.parsed.venue?t.parsed.venue:t.venue.trim()||void 0}function ua(t){const n=dt(t);if(!n)return"";const s=new Date(n);return Number.isNaN(s.getTime())?"":s.toLocaleString(void 0,{weekday:"short",day:"numeric",month:"short",hour:"numeric",minute:"2-digit"})}function ha(t){return!!t.picked||!!Ze(t)}function ma(t){var p;const n=parseInt(t.seats,10),s=Number.isFinite(n)&&n>0?{seatsLeft:n}:{},o=da(t),r=o?{dropAt:o}:{};if(t.picked)return{techweekEventId:t.picked.id,...r,...s};const d=dt(t),h=Wt(t),i=t.way==="link"&&((p=t.parsed)!=null&&p.ok)?t.parsed:null,g=(i==null?void 0:i.url)||Vt(t.link);return i!=null&&i.techweek?{techweekEventId:i.techweek.id,...i.source?{source:i.source}:{},...g?{sourceUrl:g}:{},...r,...s}:{title:Ze(t)||"New event",...d?{startsAt:d}:{},...h?{venue:h}:{},source:(i==null?void 0:i.source)||"manual",...g?{sourceUrl:g}:{},...r,...s}}function ga({client:t,draft:n,onChange:s}){const o=a.useCallback(r=>s({...n,...r}),[n,s]);return e.jsxs(e.Fragment,{children:[e.jsx(Qe,{value:n.way,onChange:r=>o({way:r,...r==="search"?{}:{picked:null},...r==="link"?{}:{parsed:null}}),options:[{id:"search",label:"Find it"},{id:"link",label:"Paste a link"},{id:"hand",label:"By hand"}]}),n.way==="search"&&e.jsx(pa,{client:t,picked:n.picked,onPick:r=>o({picked:r,title:"",parsed:null}),onClear:()=>o({picked:null}),onByHand:()=>o({way:"hand",picked:null})}),n.way==="link"&&e.jsx(fa,{client:t,draft:n,patch:o}),n.way==="hand"&&e.jsx(va,{draft:n,patch:o})]})}function pa({client:t,picked:n,onPick:s,onClear:o,onByHand:r}
1){const[d,h]=a.useState(""),[i,g]=a.useState({kind:"idle"}),[p,l]=a.useState(!1),[f,k]=a.useState(!1),[v,m]=a.useState(0),j=a.useRef(null),E=a.useRef(null);a.useEffect(()=>{if(!t||n)return;let u=!0;l(!0),g(I=>I.kind==="ready"?I:{kind:"searching"});const b=window.setTimeout(()=>{t.searchTechweek({query:d.trim(),limit:8}).then(I=>{u&&(g({kind:"ready",events:I.events,total:I.total}),m(0),l(!1))}).catch(I=>{u&&(g({kind:"failed",message:I instanceof Error?I.message:"Could not reach the programme"}),l(!1))})},250);return()=>{u=!1,window.clearTimeout(b)}},[t,d,n]),a.useEffect(()=>{var b,I;if(!f)return;const u=(b=E.current)==null?void 0:b.querySelector(`[data-row="${v}"]`);(I=u==null?void 0:u.scrollIntoView)==null||I.call(u,{block:"nearest"})},[v,f]),a.useEffect(()=>{if(!f)return;const u=b=>{j.current&&!j.current.contains(b.target)&&k(!1)};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[f]);const c=i.kind==="ready"?i.events:[],S=a.useCallback(u=>{s(u),k(!1),h("")},[s]),w=u=>{if(u.key==="Escape"){k(!1);return}c.length&&(u.key==="ArrowDown"?(u.preventDefault(),k(!0),m(b=>(b+1)%c.length)):u.key==="ArrowUp"?(u.preventDefault(),m(b=>(b-1+c.length)%c.length)):u.key==="Enter"&&f&&(u.preventDefault(),S(c[Math.min(v,c.length-1)])))};if(n)return e.jsxs(X,{className:"rm-picked",children:[e.jsxs("div",{className:"rm-picked-top",children:[e.jsxs("div",{className:"rm-picked-g",children:[e.jsx(se,{children:"off the programme"}),e.jsx("div",{className:"rm-picked-t",children:n.name}),e.jsx(N,{children:ft(n)||"Time and place to be confirmed"}),tt(n)&&e.jsxs(N,{children:["Hosted by ",tt(n)]})]}),e.jsx(ne,{onClick:o,children:"Change"})]}),e.jsxs("div",{className:"rm-picked-tags",children:[n.featured&&e.jsx("span",{className:"rm-tag rm-tag--o",children:"featured"}),n.inviteOnly&&e.jsx("span",{className:"rm-tag rm-tag--quiet",children:"invite only"}),n.registrationStatus==="closed"&&e.jsx("span",{className:"rm-tag rm-tag--quiet",children:"registration closed"}),n.url&&e.jsx("a",{className:"rm-picked-link",href:n.url,target:"_blank",rel:"noopener noreferrer",children:"See the listing ↗"})]})]});if(!t)return e.jsxs(X,{className:"rm-pulled",children:[e.jsx(se,{children:"the programme"}),e.jsx(N,{children:"Sign in and the whole SF Tech Week programme opens up here — type two words of your event's name and pick it out of the list."})]});const y=p?"Looking through the programme…":i.kind==="failed"?i.message:i.kind==="searching"?"Looking through the programme…":i.kind==="ready"&&d.trim()&&!c.length?"Nothing in the programme matches that.":i.kind==="ready"&&i.total>c.length?`${i.total} events match — keep typing to narrow it down.`:"Search by name, by who is hosting, or by neighbourhood.";return e.jsxs("div",{className:"rm-find",ref:j,children:[e.jsxs("div",{className:"rm-find-field",children:[e.jsx("input",{className:"rm-input",value:d,onChange:u=>{h(u.target.value),k(!0)},onFocus:()=>k(!0),onKeyDown:w,placeholder:"AI Founders Dinner, Sequoia, SOMA…",autoComplete:"off",role:"combobox","aria-expanded":f,"aria-controls":"rm-find-results","aria-autocomplete":"list","aria-label":"Find your event on the programme"}),f&&e.jsxs("div",{className:"rm-find-results",id:"rm-find-results",role:"listbox",ref:E,"aria-busy":p,children:[c.map((u,b)=>e.jsxs("button",{type:"button",role:"option","data-row":b,"aria-selected":b===v,className:`rm-find-result${b===v?" on":""}`,onMouseEnter:()=>m(b),onClick:()=>S(u),children:[e.jsx("span",{className:"rm-find-name",children:u.name}),e.jsx("span",{className:"rm-find-meta",children:[ft(u),tt(u)].filter(Boolean).join(" — ")})]},u.id)),!p&&i.kind==="ready"&&!c.length&&e.jsxs("div",{className:"rm-find-result rm-find-result--none",children:[e.jsxs("span",{className:"rm-find-name",children:["Nothing matches “",d.trim(),"”."]}),e.jsx("span",{className:"rm-find-meta",children:"Not on the programme? Add it by hand — it takes a name, a night and a venue."}),e.jsx("button",{type:"button",className:"rm-find-hand",onClick:r,children:"Add it by hand"})]}),p&&!c.length&&e.jsx("div",{className:"rm-find-result rm-find-result--none",children:e.jsx("span",{className:"rm-find-meta",children:"Looking through the programme…"})})]})]}),e.jsx(N,{children:y})]})}function fa({client:t,draft:n,patch:s}
1){var p;const[o,r]=a.useState(!1),[d,h]=a.useState(null),i=a.useCallback(async()=>{const l=Vt(n.link);if(!(!l||!t)){r(!0),h(null);try{const f=await t.parseLink(l);s({parsed:f,...f.ok&&f.title?{title:f.title}:{}}),f.ok||h(f.error||"We could not read that link.")}catch(f){h(f instanceof Error?f.message:"Could not read that link")}finally{r(!1)}}},[t,n.link,s]),g=(p=n.parsed)!=null&&p.ok?n.parsed:null;return e.jsxs(e.Fragment,{children:[e.jsx(se,{children:"your luma or partiful link"}),e.jsxs("div",{className:"rm-linkrow",children:[e.jsx("input",{className:"rm-input",value:n.link,placeholder:"lu.ma/ai-founders-dinner",autoComplete:"off","aria-label":"Your event link",onChange:l=>s({link:l.target.value,parsed:null}),onBlur:()=>void i(),onKeyDown:l=>{l.key==="Enter"&&i()}}),e.jsx(q,{variant:"out",disabled:o||!n.link.trim()||!t,onClick:()=>void i(),children:o?"Reading…":"Read it"})]}),d&&e.jsx(N,{children:d}),g?e.jsxs(X,{className:"rm-pulled",children:[e.jsx(se,{children:"pulled from the link"}),e.jsx("input",{className:"rm-input rm-input--title",value:Ze(n),onChange:l=>s({title:l.target.value}),"aria-label":"Event name"}),e.jsx(N,{children:[g.startsAt?new Date(g.startsAt).toLocaleString():null,g.venue,g.hosts.length?`hosted by ${g.hosts.join(" & ")}`:null].filter(Boolean).join(" · ")||"No date or venue on the page"}),g.guestCount?e.jsxs(N,{children:[g.guestCount," on their list"]}):null,g.techweek?e.jsxs(N,{children:["On the programme as “",g.techweek.name,"” — anyone with this on their SF Tech Week calendar joins this room."]}):null,e.jsx(N,{children:g.guestList.reason})]}):e.jsx(X,{className:"rm-pulled",children:e.jsx(N,{children:t?o?"Reading it…":"Press enter and we will read the title, time and venue off it.":"Sign in and we will read the title, time and venue straight off the page."})})]})}function va({draft:t,patch:n}){return e.jsxs(e.Fragment,{children:[e.jsx(se,{children:"what is it called"}),e.jsx("input",{className:"rm-input",value:t.title,placeholder:"AI Founders Dinner",autoComplete:"off","aria-label":"Event name",onChange:s=>n({title:s.target.value})}),e.jsxs("div",{className:"rm-fieldrow",children:[e.jsxs("label",{className:"rm-field",children:[e.jsx("span",{className:"rm-field-l",children:"Date"}),e.jsx("input",{className:"rm-input",type:"date",value:t.date,onChange:s=>n({date:s.target.value})})]}),e.jsxs("label",{className:"rm-field",children:[e.jsx("span",{className:"rm-field-l",children:"Starts"}),e.jsx("input",{className:"rm-input",type:"time",value:t.time,onChange:s=>n({time:s.target.value})})]})]}),e.jsx(se,{children:"where"}),e.jsx("input",{className:"rm-input",value:t.venue,placeholder:"Fort Mason, Gallery 308",autoComplete:"off","aria-label":"Venue",onChange:s=>n({venue:s.target.value})}),e.jsx(se,{children:"existing event page — optional"}),e.jsx("input",{className:"rm-input",value:t.link,placeholder:"lu.ma/ai-founders-dinner",autoComplete:"off","aria-label":"Existing event page",onChange:s=>n({link:s.target.value})}),e.jsx(N,{children:"Kept alongside your event so you can still point people at it."})]})}function et(t){const n=String(t).replace(/\s+/g," ").trim().split(" ").filter(Boolean);return n.length>=2?(n[0][0]+n[n.length-1][0]).toUpperCase():(String(t).slice(0,2)||"?").toUpperCase()}const ya=t=>!!(t.email.trim()||t.name.trim()||t.userId);function Oe(t){const n=t.email.trim().toLowerCase();return n?`e:${n}`:t.userId?`u:${t.userId}`:t.contactId?`c:${t.contactId}`:`n:${t.name.trim().toLowerCase()}`}let xa=0;const _t=t=>`${t}-${xa+=1}`;function ja(t,n){const s=new Set(t.map(Oe)),o=[];let r=0;for(const d of n){if(!ya(d))continue;const h=Oe(d);if(s.has(h)){r+=1;continue}s.add(h),o.push(d)}return{guests:[...t,...o],added:o.length,duplicates:r}}function ka(t){return{key:_t("csv"),name:t.name,email:t.email,company:t.company,...t.title?{title:t.title}:{},...t.linkedin?{linkedin:t.linkedin}:{},mark:et(t.name||t.email),from:"csv"}}function nt(t){return{key:`network-${t.contactId}`,name:t.name,email:t.email||"",company:"",...t.role?{title:t.role}:{},...t.userId?{userId:t.userId}:{},contactId:t.contactId,mark:t.mark||et(t.name),tone:t.tone,from:"network",why:t.why}}function wa(t){return{key:`saved-${t.id}`,name:t.name,email:t.email||"",company:"",...t.role?{title:t.role}:{},...t.userId?{userId:t.userId}:{},mark:t.mark||et(t.name),tone:t.tone,from:"network"}}function ba(t){const n=[`${t.rows.length} attendee${t.rows.length===1?"":"s"} read`];return t.skipped&&n.push(`${t.skipped} with no name or email`),t.duplicates&&n.push(`${t.duplicates} duplicate${t.duplicates===1?"":"s"}`),n.join(" · ")}function Gt(t){var n,s;return{...t.name.trim()?{name:t.name.trim()}:{},...t.email.trim()?{email:t.email.trim()}:{}
1,...t.company.trim()?{company:t.company.trim()}:{},...(n=t.title)!=null&&n.trim()?{title:t.title.trim()}:{},...(s=t.linkedin)!=null&&s.trim()?{linkedinUrl:t.linkedin.trim()}:{},...t.userId?{userId:t.userId}:{}}}function Na(t){return t.email.trim()?t.email.trim():t.why?t.why:t.title?t.title:t.company?t.company:"No email — they go on the list by name"}const Nt=/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/,St=6;function Bt({client:t,guests:n,onChange:s,onAdd:o}){const[r,d]=a.useState("network"),[h,i]=a.useState(null),[g,p]=a.useState(null),[l,f]=a.useState(!1),[k,v]=a.useState(()=>new Set),m=a.useCallback(async(c,S)=>{const{guests:w,added:y,duplicates:u}=ja(n,c);if(p(null),!o)return s==null||s(w),i(S(y,u)),!0;if(!y)return i(S(0,u)),!0;const b=w.slice(n.length);v(new Set(b.map(Oe))),i(null);try{const I=await o(b);return i(I||S(y,u)),!0}catch(I){return p(I instanceof Error?I.message:"Could not add them to the list"),!1}finally{v(new Set)}},[n,s,o]),j=a.useCallback(c=>s==null?void 0:s(n.filter(S=>S.key!==c)),[n,s]),E=l?n:n.slice(0,St);return e.jsxs(X,{className:"rm-guests",children:[e.jsxs("div",{className:"rm-guests-top",children:[e.jsxs("div",{className:"rm-guests-g",children:[e.jsx(se,{children:o?"add people":"the guest list"}),e.jsx("div",{className:"rm-guests-n",children:n.length?`${n.length} on the list`:"Who is coming?"})]}),n.length>0&&e.jsx(ne,{filled:!0,children:n.length})]}),e.jsx(Qe,{value:r,onChange:c=>d(c),options:[{id:"network",label:"My network"},{id:"csv",label:"Upload CSV"},{id:"typed",label:"Type them in"}]}),r==="network"&&e.jsx(Sa,{client:t,guests:n,onAdd:m,onDrop:o?void 0:j,busy:k}),r==="csv"&&e.jsx(Ia,{onAdd:m,onError:c=>{p(c),i(null)}}),r==="typed"&&e.jsx(Ca,{onAdd:m,sends:!!o}),h&&e.jsx(N,{children:h}),g&&e.jsx(N,{className:"rm-guests-err",children:g}),!o&&n.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"rm-list rm-guests-list",children:E.map(c=>e.jsx(ye,{lead:e.jsx(ue,{mark:c.mark,tone:c.tone??"e",size:"sm"}),name:c.name||c.email,sub:Na(c),right:e.jsx("button",{type:"button",className:"rm-guests-x",onClick:()=>j(c.key),"aria-label":`Remove ${c.name||c.email}`,children:"×"})},c.key))}),n.length>St&&e.jsx("button",{type:"button",className:"rm-guests-more",onClick:()=>f(c=>!c),children:l?"Show fewer":`Show all ${n.length}`})]}),e.jsx(N,{children:o?"Nobody is emailed here. Picking somebody puts them on the list, and you send their invitations from the room one at a time — so you can see who you are about to write to.":"Nobody is emailed here. They go on the list, and you send their invitations from the room one at a time — so you can see who you are about to write to."})]})}function Sa({client:t,guests:n,onAdd:s,onDrop:o,busy:r}
1){const[d,h]=a.useState(""),[i,g]=a.useState([]),[p,l]=a.useState(0),[f,k]=a.useState(!!t),[v,m]=a.useState(null),j=a.useRef(0);a.useEffect(()=>{if(!t){k(!1);return}const c=++j.current;k(!0);const S=window.setTimeout(()=>{t.calendarCandidates({search:d.trim()||void 0,limit:40}).then(w=>{j.current===c&&(g(w.candidates),l(w.total),m(null))}).catch(w=>{j.current===c&&m(w instanceof Error?w.message:"Could not read your network")}).finally(()=>{j.current===c&&k(!1)})},d?280:0);return()=>window.clearTimeout(S)},[t,d]);const E=a.useCallback(c=>{const S=Oe(nt(c));return n.find(w=>Oe(w)===S)??null},[n]);return t?e.jsxs(e.Fragment,{children:[e.jsx("input",{className:"rm-input",value:d,placeholder:"Search the people you meet with",autoComplete:"off","aria-label":"Search your network",onChange:c=>h(c.target.value)}),v?e.jsx(N,{className:"rm-guests-err",children:v}):f?e.jsx(de,{what:"Reading your network"}):i.length?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"rm-list rm-guests-pick",children:i.map(c=>{const S=E(c),w=r.has(Oe(nt(c))),y=w||!!S&&!o;return e.jsx(ye,{className:S&&!o?"rm-row--off":"",lead:e.jsx(ue,{mark:c.mark,tone:c.tone,size:"sm"}),name:c.name,sub:c.email||c.why,right:e.jsx(ne,{filled:!!S,disabled:y,children:w?"Adding…":S?o?"✓":"On the list ✓":"Add"}),onClick:y?void 0:()=>S&&o?o(S.key):void s([nt(c)],u=>u?`${c.name} is on the list.`:`${c.name} was already on it.`)},c.contactId)})}),p>i.length&&e.jsxs(N,{children:[p," people on your calendar — search to find the ones who are coming."]})]}):e.jsx(ie,{title:d.trim()?"Nobody matches that.":"Nobody on your calendar yet.",line:d.trim()?"Try a company, or part of an address.":"Connect a calendar and the people you already meet with land here. Until then, a CSV or a pasted list is the way in."})]}):e.jsx(N,{children:"Sign in and the people you already meet with show up here, with their addresses — nothing to retype."})}function Ia({onAdd:t,onError:n}){const s=a.useRef(null),o=async r=>{var h;const d=(h=r.target.files)==null?void 0:h[0];if(r.target.value="",!!d)try{const i=is(await d.text());if(!i.rows.length){n(i.read?`Read ${i.read} rows but found nobody — the file needs a name or an email per person.`:"That file has no rows in it.");return}await t(i.rows.map(ka),(g,p)=>[`${d.name} · ${ba(i)}`,p>0?`${p} already on the list`:null].filter(Boolean).join(" · "))}catch{n("Could not read that file. A .csv export is what this wants.")}};return e.jsxs(e.Fragment,{children:[e.jsx("input",{ref:s,type:"file",accept:".csv,text/csv",onChange:r=>void o(r),style:{display:"none"},"aria-label":"Upload your attendee CSV"}),e.jsx(q,{variant:"out",onClick:()=>{var r;return(r=s.current)==null?void 0:r.click()},children:"Choose a CSV"}),e.jsx(N,{children:"The attendee export from wherever your event lives — Luma, Partiful, Eventbrite, a spreadsheet. Names and emails are read; the columns can be called anything."})]})}function Ca({onAdd:t,sends:n}){const[s,o]=a.useState(""),[r,d]=a.useState(""),[h,i]=a.useState(""),[g,p]=a.useState(!1),[l,f]=a.useState(""),k=a.useCallback(async()=>{var E;const m=s.trim(),j=r.trim();if(!m&&!j){f("A name, or an address — the row has to be somebody.");return}if(j&&!Nt.test(j)){f("That address is not one. Leave it blank if you do not have it.");return}if(!j&&/\S+@\S+\.\S+/.test(m)){const c=((E=m.match(/\S+@\S+\.\S+/))==null?void 0:E[0])??"",S=m.replace(c,"").replace(/\s+/g," ").trim();if(Nt.test(c)){d(c),o(S),f(S?"That looks like an address — moved to the email box.":"That looks like an address — moved to the email box. Add their name if you have it.");return}}p(!0);try{if(!await t([{key:_t("typed"),name:m,email:j,company:h.trim(),mark:et(m||j),from:"typed"}],S=>S?`${m||j} added`:`${m||j} is already on the list`))return;o(""),d(""),i(""),f("")}finally{p(!1)}},[s,r,h,t]),v=m=>{m.key==="Enter"&&k()};return e.jsxs(e.Fragment,{children:[e.jsx("input",{className:"rm-input",value:s,placeholder:"Their name","aria-label":"Their name",onChange:m=>{o(m.target.value),f("")},onKeyDown:v}),e.jsx("input",{className:"rm-input",type:"email",value:r,placeholder:"[email protected]","aria-label":"Their email",autoComplete:"off",onChange:m=>{d(m.target.value),f("")},onKeyDown:v}),e.jsx("input",{className:"rm-input",value:h,placeholder:"Company — optional","aria-label":"Their company",onChange:m=>i(m.target.value),onKeyDown:v}),l&&e.jsx(N,{className:"rm-guests-err",children:l}),e.jsx(q,{variant:"out",disabled:g||!s.trim()&&!r.trim(),onClick:()=>void k(),children:g?"Adding…":"Add them"}),e.jsx(N,{children:n?"One at a time, straight onto the list. A whole list at once is the CSV tab — it reads the same three columns.":"One at a time. A whole list at once is the CSV tab — it reads the same three columns."})]})}function Ea(){const{s:t,patch:n,go:s,client:o,refresh:r}
1=ae(),[d,h]=a.useState(()=>({...ia,link:t.link})),[i,g]=a.useState([]),[p,l]=a.useState(!1),[f,k]=a.useState(null),v=a.useCallback(y=>{var u;h(y),y.link!==t.link&&n({link:y.link,linkParsed:!!((u=y.parsed)!=null&&u.ok)})},[t.link,n]),m=Ze(d),j=ua(d),E=Wt(d),c=ha(d),S=a.useCallback(async()=>{if(!o){s("org-wants",{eventId:"ai-founders"});return}if(!c){k("Find your event, paste its link, or name it — then it can have a room.");return}l(!0),k(null);try{const y=await o.createEvent({...ma(d),guests:i.map(Gt),notify:!1});s("org-wants",{eventId:String(y.event.id)}),r()}catch(y){k(y instanceof Error?y.message:"Could not set that up")}finally{l(!1)}},[o,c,d,i,s,r]),w=a.useMemo(()=>d.picked?"Named off the programme — the night and the neighbourhood come with it.":d.way==="link"?"Paste the page and we read the title, time and venue off it.":d.way==="hand"?"Not on the programme and not on Luma? Name it here.":"Find yours on the SF Tech Week programme — two words of the name is usually enough.",[d.picked,d.way]);return e.jsxs(e.Fragment,{children:[e.jsx(te,{kicker:"hosting",title:"New event"}),e.jsx(N,{className:"rm-lede",children:w}),e.jsx(ga,{client:o,draft:d,onChange:v}),e.jsxs(X,{className:"rm-pulled",children:[e.jsx(se,{children:"what your guests will see"}),e.jsx(ge,{className:"rm-pulled-t",children:m||"Your event"}),e.jsx(N,{children:[j,E].filter(Boolean).join(" · ")||(d.picked?"Time and place to be confirmed":"A date and a venue show up here")}),e.jsx(N,{children:i.length?`${i.length} on the list before it even opens.`:"Anyone who opens your link can add themselves — they do not need an account first."})]}),e.jsx(Bt,{client:o,guests:i,onChange:g}),f&&e.jsx(N,{className:"rm-guests-err",children:f}),e.jsx(q,{disabled:p||!!o&&!c,onClick:()=>void S(),children:p?"Setting it up…":!c&&o?"Find it or name it first":i.length?`Set it up with ${i.length}`:"Set it up"}),e.jsx(N,{className:"rm-center",children:"Two minutes. You keep sending invites where you already do."})]})}const Ta=2600;function $a(){var Ne;const{focus:t,go:n,client:s,orgEvents:o,version:r,refresh:d}=ae(),h=o.find(L=>L.id===t.eventId)??o[0],i=h==null?void 0:h.apiId,g=Be.find(L=>L.id===t.eventId)??Be[0],[p,l]=a.useState(!1),[f,k]=a.useState({}),[v,m]=a.useState(null),[j,E]=a.useState(""),c=a.useRef([]),[S,w]=a.useState(!1),[y,u]=a.useState(null);a.useEffect(()=>()=>{for(const L of c.current)window.clearTimeout(L)},[]);const{data:b,loading:I,error:M,reload:F}=be(s&&i?async()=>{const L=await s.getWants(i),Y=await s.getEventGuests(i).catch(()=>({guests:[],programme:void 0}));return{event:lt(L.event),wants:L.wants,silent:L.silent,guests:Y.guests,programme:Y.programme}}:null,{event:h??g,wants:ls.map(L=>({...L,covering:0,gap:L.count})),silent:Math.max(0,g.invited-g.named),guests:[],programme:void 0},[s,i,r]);a.useEffect(()=>u(null),[b]);const O=async(L,Y,ce,D)=>{if(!(!s||!i)){m(Y),E("");try{await s.inviteGuest(i,L,D),k(G=>({...G,[Y]:!0})),c.current.push(window.setTimeout(()=>k(G=>{const V={...G};return delete V[Y],V}),Ta)),u(G=>(G??b.guests).map(V=>V.id===Y?{...V,invited:!0}:V))}catch(G){E(`${ce}: ${G instanceof Error?G.message:"that invitation could not be sent."}`)}finally{m(null)}}},x=a.useCallback(async L=>{if(!s||!i||!L.length)throw new Error("This room has not finished loading — reopen it and try again.");const Y=await s.addEventGuests(i,L.map(Gt));u(Y.guests),d();const ce=L.length===1?L[0]:null;return Y.added===L.length?ce?`${ce.name||ce.email} is on the list. Invite them when you are ready.`:`${Y.added} added. Invite them when you are ready.`:`${Y.added} added · ${L.length-Y.added} already on the list.`},[s,i,d]),[U,T]=a.useState(!1),[_,R]=a.useState(""),[K,$]=a.useState(null),B=a.useCallback(async()=>{var L;if(!(!s||!i)){T(!0),R("");try{const Y=await s.claimListing(i,(L=b.programme)==null?void 0:L.techweekEventId);$(Y.moved??0),F(),d()}catch(Y){R(Y instanceof Error?Y.message:"Could not claim that listing.")}finally{T(!1)}}},[s,i,b.programme,F,d]);if(M)return e.jsx(ve,{error:M,onRetry:F});if(I)return e.jsx(de,{what:"Reading the room"});const Z=((Ne=b.programme)==null?void 0:Ne.waiting)??0,W=b.event,ee=y??b.guests,le=Math.max(1,...b.w
1ants.map(L=>L.count)),he=W.invited?Math.round((W.invited-b.silent)/W.invited*100):0,oe=b.wants.find(L=>L.gap>0),me=ee.filter(L=>L.checkedIn||L.rsvp==="going").length;return e.jsxs(e.Fragment,{children:[e.jsx(te,{kicker:W.stateLabel,title:"What the room wants"}),Z>0&&K===null&&e.jsxs(X,{className:"rm-pulled",children:[e.jsx(se,{children:"on the programme, not on your list"}),e.jsxs(N,{children:[Z===1?"1 person has this event on their SF Tech Week calendar.":`${Z} people have this event on their SF Tech Week calendar.`," ","They are in the listing's own room, not this one. Claim the listing and they join your guest list."]}),e.jsx(q,{variant:"out",disabled:U||!s,onClick:()=>void B(),children:U?"Claiming…":"Claim this listing"}),_&&e.jsx(N,{className:"rm-guests-err",children:_})]}),K!==null&&e.jsx(N,{children:K===1?"1 person from the programme joined your guest list.":`${K} people from the programme joined your guest list.`}),e.jsx(Mt,{label:`your guest list · ${me} joined of ${ee.length} invited`,people:ee.map(L=>{const Y=!!f[L.id],ce=L.invited,D=L.checkedIn||L.rsvp==="going"||L.rsvp==="declined";return{id:L.id,name:L.name,mark:L.mark,tone:L.tone,sub:L.role||L.email||void 0,state:D?cs(L.rsvp,L.checkedIn):void 0,action:e.jsx(ne,{filled:!ce&&!Y,disabled:!L.canInvite||v===L.id,onClick:!L.canInvite||!L.guestId?void 0:()=>void O(String(L.guestId),L.id,L.name,ce),children:L.canInvite?v===L.id?"Sending…":Y?"Sent ✓":ce?"Invite again":"Invite":"No email"})}}),onSelect:L=>n("person",{personId:L.id,eventId:W.id,leagueId:""}),empty:e.jsxs(X,{className:"rm-empty",children:[e.jsx(ge,{children:"Nobody on the list yet."}),e.jsx(N,{children:"Add them below, or share the link and whoever opens it lands on your list."})]})}),j&&e.jsx(N,{className:"rm-guests-err",children:j}),S?e.jsxs(e.Fragment,{children:[e.jsx(Bt,{client:s,guests:ee.map(wa),onAdd:x}),e.jsx("div",{className:"rm-code-acts",children:e.jsx(ne,{onClick:()=>w(!1),children:"Done adding"})})]}):e.jsx(ye,{className:"rm-row--add",lead:e.jsx("span",{className:"rm-dashav",children:"+"}),name:"Add more people",sub:"From the people you meet with, a CSV, or typed in by name and email",right:e.jsx("span",{className:"rm-arrow",children:"›"}),onClick:()=>w(!0)}),e.jsxs(X,{children:[e.jsx(se,{children:"share the room"}),e.jsx(N,{children:"Send this and whoever opens it can put themselves on the list. They see the night and who is hosting — never the guest list."}),e.jsx("div",{className:"rm-code-acts",children:e.jsx(ne,{filled:!0,onClick:()=>{i&&Ye(Et(i)).then(l)},children:p?"Copied ✓":i?"Copy the link":"Save the event first"})})]}),b.wants.length===0?e.jsx(ie,{title:"Nobody has said yet.",line:"Ask your guests what they are after and this fills in — it is what makes the night worth anything to them."}):e.jsx(X,{children:b.wants.map(L=>e.jsxs("div",{className:"rm-want",children:[e.jsxs("div",{className:"rm-want-top",children:[e.jsx("span",{children:L.label}),e.jsx(Ae,{className:"rm-want-n",children:L.count})]}),e.jsx(Ke,{pct:L.count/le*100})]},L.label))}),e.jsxs(X,{dark:!0,children:[e.jsx(ge,{children:"The more you know about what they want, the more your room is worth."}),e.jsxs(N,{dark:!0,children:[W.invited-b.silent," of ",W.invited," have told you."," ",b.silent>0?`Those ${b.silent} answers are the difference between a dinner and a room where everyone leaves with something.`:"Everyone has answered. Every guest in there has a match waiting."]}),e.jsx(Ke,{pct:he,ochre:!0,dark:!0}),b.silent>0&&e.jsxs("div",{className:"rm-silent",children:[e.jsxs("span",{className:"rm-faces",children:[e.jsx("span",{className:"rm-face rm-face--xs rm-face--ghost rm-face--onink",children:"?"}),e.jsx("span",{className:"rm-face rm-face--xs rm-face--ghost rm-face--onink",children:"?"}),b.silent>2&&e.jsxs("span",{className:"rm-face rm-face--xs rm-face--rest rm-face--onink",children:["+",b.silent-2]})]}),e.jsx("span",{className:"rm-silent-copy",children:"Each answer adds matches for everyone else too"})]})]}),oe&&e.jsxs(X,{children:[e.jsx(ge,{children:oe.covering===0?`Nobody here covers ${oe.label.toLowerCase()}. ${oe.count} want it.`:`You invited ${oe.covering} for ${oe.label.toLowerCase()}. ${oe.count} want them.`}),e.jsx(N,{children:"Your guests know people you do not."})]}),e.jsxs("div",{className:"rm-foot",children:[e.jsx(q,{variant:"out",onClick:()=>n("org-room",{eventId:W.id}),children:"Open the doors"}),e.jsx(q,{variant:"out",onClick:()=>n("after",{eventId:W.id}),children:"See who you met"})]})]})}function Aa(){const{focus:t,go:n,client:s,orgEvents:o,version:r,now:d,dropEndsAt:h,setDropEndsAt:i,refresh:g}=ae(),p=o.find(R=>R.id===t.eventId)??o[0],l=p==null?void 0:p.apiId,f=Be.find(R=>R.id===t.eventId)??Be[0],[k,v]=a.useState(!1),[m,j]=a.useState(null),[E,c]=a.useState(!1),[S,w]=a.useState(null),{data:y,loading:u,error:b,reload:I}=be(s&&l?async()=>{const R=await s.getRoom(l);return{event:lt(R.event),here:R.here.map(K=>Lt(K)),missing:R.missing,matched:R.matched}}:null,{event:p??f,here:ds.map((R,K)=>({id:`g${K}`,name:R.mark,mark:R.mark,tone:R.tone})),missing:f.noShows,matched:!1},[s,l,r]),M=a.useCallback(async()=>
1{if(!s||!l){i(Date.now()+10*60*1e3);return}v(!0);try{const R=await s.matchRoom(l);i(new Date(R.expiresAt).getTime()),I()}finally{v(!1)}},[s,l,i,I]),F=a.useCallback(async(R,K)=>{const $=R||new Date(new Date().setHours(0,0,0,0)).toISOString(),B=K.trim()?Pt($,K)??null:null;c(!0);try{if(s&&l){const Z=await s.setEventDropAt(l,B);w(vt(Z.event.dropAt)),I(),g()}else w(vt(B));j(null)}finally{c(!1)}},[s,l,I,g]);if(b)return e.jsx(ve,{error:b,onRetry:I});if(u)return e.jsx(de,{what:"Counting the room"});const O=y.event,x=y.here,U=y.matched||h!==null,T=h===null?0:Math.max(0,h-d),_=S??O.drop??"";return e.jsxs(e.Fragment,{children:[e.jsx(te,{kicker:"doors open",title:"The room",dark:!0}),x.length===0?e.jsx(ie,{title:"Nobody has checked in.",line:"The room opens as guests arrive and check in at the door."}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"rm-roomgrid",children:[x.map(R=>e.jsx(ue,{mark:R.mark,tone:R.tone,size:"tiny",title:R.name,onClick:()=>n("person",{personId:R.id,eventId:O.id,leagueId:""})},R.id)),Array.from({length:Math.min(4,y.missing)},(R,K)=>e.jsx("span",{className:"rm-face rm-face--tiny rm-face--ghost rm-face--onink rm-face--off",children:"?"},`q${K}`))]}),e.jsxs(X,{dark:!0,children:[e.jsxs(ge,{children:[x.length," checked in."," ",y.missing>0?`${y.missing} didn't come.`:"Everyone came."]}),y.missing>0&&e.jsxs(N,{dark:!0,children:["Each of the ",y.missing," had matches waiting."]})]})]}),e.jsxs(X,{dark:!0,children:[e.jsx(ge,{children:U?`All ${x.length} have their person.`:_?`At ${_}, everyone gets one person at the same second.`:"Everyone gets one person at the same second."}),e.jsx(N,{dark:!0,children:U?T>0?`${Dt(T)} left on the clock. Say a sentence, then get out of the way.`:"That round is over. Run it again whenever you like.":"You say a sentence, then get out of the way."}),!U&&(m===null?e.jsx("button",{type:"button",className:"rm-movedrop",onClick:()=>j(ca(O.dropAt)),children:_?"Move the drop":"Set the time"}):e.jsxs("div",{className:"rm-linkrow rm-droprow",children:[e.jsx("input",{className:"rm-input",type:"time",value:m,"aria-label":"When the room gets matched",onChange:R=>j(R.target.value)}),e.jsx(q,{variant:"out",disabled:E,onClick:()=>void F(O.startsAt,m),children:E?"Saving…":"Save"})]}))]}),U?e.jsxs(e.Fragment,{children:[e.jsx(q,{variant:"pale",onClick:()=>n("drop",{eventId:t.eventId}),children:"See what a guest sees"}),e.jsx(q,{variant:"out",className:"rm-mt9",onClick:()=>n("org-post",{eventId:O.id}),children:"Post the night"})]}):e.jsx(q,{variant:"rust",disabled:x.length<2||k,onClick:M,children:k?"Matching…":x.length<2?"Two people have to be in the room":`Match all ${x.length} now`}),e.jsxs("div",{className:"rm-foot",children:[e.jsx(q,{variant:"out",onClick:()=>n("org-wants",{eventId:O.id}),children:"The guest list"}),e.jsx(q,{variant:"out",onClick:()=>n("after",{eventId:O.id}),children:"See who you met"})]})]})}const Le=520,we=20,rt=22,st=Le-we*2,Ra=1080,ze='"Instrument Serif", Georgia, serif',He='"Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',La="#b57c22",Ma="#f2efe5",qt="#15170f",Da="#faf8f2",It={a:"#7c6a4e",b:"#4e6b62",c:"#8a5b46",d:"#5a6480",e:"#6e7d54",f:"#7a5c6b",g:"#55705c",h:"#84644b",you:qt,ghost:"#6e7d54"};function Fa(t){const n=t==="light";return{light:n,from:n?"#faf8f2":"#222c25",to:n?"#ece8db":"#141a16",fg:n?qt:Ma,dim:n?"rgba(21, 23, 15, 0.38)":"rgba(242, 239, 229, 0.45)",dimmer:n?"rgba(21, 23, 15, 0.38)":"rgba(242, 239, 229, 0.42)",rule:n?"rgba(21, 23, 15, 0.26)":"rgba(242, 239, 229, 0.2)",dot:n?"rgba(21, 23, 15, 0.07)":"rgba(242, 239, 229, 0.06)"}}function Ct(t,n,s,o,r){let d=s;for(const h of n)t.fillText(h,d,o),d+=t.measureText(h).width+r}async function Oa(){document.fonts&&await Promise.all([document.fonts.load('82px "Instrument Serif"'),document.fonts.load('22px "Instrument Serif"'),document.fonts.load('13px "Instrument Sans"'),document.fonts.load('500 13px "Instrument Sans"')]).catch(()=>{})}function Ua(t,n,s,o){const r=n*Math.PI/180,d=Math.sin(r),h=-Math.cos(r),i=Math.abs(s*Math.sin(r))+Math.abs(o*Math.cos(r));return t.createLinearGradient(s/2-d*i/2,o/2-h*i/2,s/2+d*i/2,o/2+h*i/2)}const ot=62,zt=40,Fe=30;function Ht(){let t=28+ot;return t+=35+zt,t+=33+Fe,t}function Pa(t,n,s,o){const r=Fa(n.style),d=Ua(t,165,s,o);d.addColorStop(0,r.from),d.addColorStop(1,r.to),t.fillStyle=d,t.fillRect(0,0,s,o),t.fillStyle=r.dot;for(let m=7.5;m<o;m+=15)for(let j=7.5;j<s;j+=15)t.beginPath(),t.arc(j,m,1,0,Math.PI*2),t.fill();const h=Ht();let i=rt+Math.max(0,(o-rt*2-h)/2);t.textBaseline="alphabetic",t.font=`500 9px ${He}
1`,t.fillStyle=r.dim,Ct(t,n.kicker.toUpperCase(),we,i+9,9*.17),i+=28,t.font=`82px ${ze}`,t.fillStyle=La;const g=String(n.intros);t.fillText(g,we,i+58);const p=t.measureText(g).width;t.font=`22px ${ze}`,t.fillStyle=r.fg;const l=we+p+14,f=i+ot-6;t.fillText(`introduction${n.intros===1?"":"s"}`,l,f-5-25),t.fillText("in one evening.",l,f-5),i+=ot,i+=20,t.fillStyle=r.rule,t.fillRect(we,i,st,1),i+=15;const k=st/3;n.stats.forEach((m,j)=>{const E=we+k*j;t.font=`21px ${ze}`,t.fillStyle=r.fg,t.fillText(m.k,E,i+19),t.font=`500 8.5px ${He}`,t.fillStyle=r.dimmer,Ct(t,m.v.toUpperCase(),E,i+25+4+8,8.5*.14)}),i+=zt,i+=18,t.fillStyle=r.rule,t.fillRect(we,i,st,1),i+=15;const v=i+Fe/2;t.beginPath(),t.arc(we+Fe/2,v,Fe/2,0,Math.PI*2),t.fillStyle=It[n.hostTone]??It.e,t.fill(),t.fillStyle=Da,t.font=`500 11px ${He}`,t.textAlign="center",t.textBaseline="middle",t.fillText(n.hostMark,we+Fe/2,v+.5),t.textAlign="left",t.textBaseline="alphabetic",t.font=`12.5px ${He}`,t.fillStyle=r.fg,t.fillText(n.host??"",we+Fe+11,v+4.5),t.textAlign="right",t.font=`15px ${ze}`,t.fillStyle=r.light?"rgba(21, 23, 15, 0.38)":"rgba(242, 239, 229, 0.5)",t.fillText("gemphere",Le-we,v+5),t.textAlign="left"}function Va(t){return t.style==="square"?{w:Le,h:Le}:t.style==="story"?{w:Le,h:Math.round(Le*14/9)}:{w:Le,h:Ht()+rt*2}}async function Wa(t){await Oa();const{w:n,h:s}=Va(t),o=Ra/n,r=document.createElement("canvas");r.width=Math.round(n*o),r.height=Math.round(s*o);const d=r.getContext("2d");return d?(d.scale(o,o),Pa(d,t,n,s),new Promise(h=>r.toBlob(i=>h(i),"image/png"))):null}function _a(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,48)||"night"}async function Ga(t){const n=await Wa(t);if(!n)return!1;const s=URL.createObjectURL(n),o=document.createElement("a");return o.href=s,o.download=`gemphere-${_a(t.kicker)}-${t.style}.png`,document.body.appendChild(o),o.click(),o.remove(),setTimeout(()=>URL.revokeObjectURL(s),1e4),!0}const at=[{label:"Dark",id:"dark"},{label:"Light",id:"light"},{label:"Square",id:"square"},{label:"Story",id:"story"}];function Ba(){var M;const{s:t,patch:n,focus:s,client:o,orgEvents:r,version:d}=ae(),h=((M=r.find(F=>F.id===s.eventId))==null?void 0:M.apiId)??null,i=at[t.poster]??at[0],[g,p]=a.useState(!1),[l,f]=a.useState(!1),[k,v]=a.useState(null),{data:m,loading:j,error:E,reload:c}=be(o&&h?async()=>{var O,x;const F=await o.getPoster(h);return{kicker:F.title,intros:F.intros,stats:[{k:String(F.guests),v:"guests"},{k:String(F.intros),v:"introductions"},{k:`${F.metSomeoneNewPct}%`,v:"met someone new"}],host:F.host?`Hosted by ${F.host.name}`:null,hostMark:((O=F.host)==null?void 0:O.mark)??"??",hostTone:((x=F.host)==null?void 0:x.tone)??"e",captions:[F.caption,...yt]}}:null,{kicker:qe.kicker,intros:qe.headline,stats:qe.stats,host:qe.host,hostMark:"NP",hostTone:"e",captions:yt},[o,h,d]);if(E)return e.jsx(ve,{error:E,onRetry:c});if(j)return e.jsx(de,{what:"Adding up the night"});const S=m.captions[t.caption%m.captions.length]??"",w=t.captionText||S,y=h?Et(h):null,u={style:i.id,kicker:m.kicker,intros:m.intros,stats:m.stats,host:m.host,hostMark:m.hostMark,hostTone:m.hostTone},b=async()=>{v({what:"dl",how:"Drawing…"});const F=await Ga(u).catch(()=>!1);v({what:"dl",how:F?"Saved ✓":"Could not draw it"}),setTimeout(()=>v(null),2600)},I=()=>{const F=y?`${w}
2
3${y}`:w,O=Ye(F);us(hs(F,y)),O.then(x=>{v({what:"li",how:x?"Caption copied — paste it in":"Opened LinkedIn"}),setTimeout(()=>v(null),4e3)})};return e.jsxs(e.Fragment,{children:[e.jsx(te,{kicker:"ended",title:"Post the night",action:l?"Done":"Edit",onAction:()=>f(F=>!F)}),e.jsxs("div",{className:`rm-poster rm-poster--${i.id}`,children:[e.jsx("span",{className:"rm-poster-dots","aria-hidden":!0}),e.jsxs("div",{className:"rm-poster-in",children:[e.jsx("div",{className:"rm-poster-kicker",children:m.kicker}),e.jsxs("div",{className:"rm-poster-head",children:[e.jsx(Ae,{className:"rm-poster-n",children:m.intros}),e.jsxs("div",{className:"rm-poster-copy",children:["introduction",m.intros===1?"":"s",e.jsx("br",{}),"in one evening."]})]}),e.jsx("div",{className:"rm-poster-stats",children:m.stats.map(F=>e.jsxs("div",{children:[e.jsx(Ae,{className:"rm-poster-stat",children:F.k}),e.jsx("div",{className:"rm-poster-statlbl",children:F.v})]},F.v))}),m.host&&e.jsxs("div",{className:"rm-poster-foot",children:[e.jsx(ue,{mark:m.hostMark,tone:m.hostTone,size:"xs"}),e.jsx("div",{className:"rm-poster-host",children:m.host}),e.jsx("div",{className:"rm-poster-brand",children:"gemphere"})]})]})]}),e.jsx("div",{className:"rm-styles",children:at.map((F,O)=>e.jsx(ne,{filled:O===t.poster,onClick:()=>n({poster:O}),children:F.label}
3,F.id))}),e.jsxs("div",{className:"rm-card rm-caption",children:[e.jsxs("div",{className:"rm-caption-top",children:[e.jsx(se,{className:"rm-caption-lbl",children:"Caption"}),e.jsx(ne,{onClick:()=>n({caption:(t.caption+1)%m.captions.length,captionText:""}),children:"Rewrite"})]}),l?e.jsx("textarea",{className:"rm-input rm-caption-edit",value:w,rows:5,autoFocus:!0,"aria-label":"Caption",onChange:F=>n({captionText:F.target.value})}):e.jsx("div",{className:"rm-caption-body",children:w})]}),e.jsxs("button",{type:"button",className:"rm-btn rm-btn--linkedin",onClick:I,children:[e.jsx("span",{className:"rm-li","aria-hidden":!0,children:"in"}),(k==null?void 0:k.what)==="li"?k.how:"Post to LinkedIn"]}),e.jsxs("div",{className:"rm-poster-acts",children:[e.jsx("button",{type:"button",className:"rm-btn rm-btn--out",onClick:()=>void b(),children:(k==null?void 0:k.what)==="dl"?k.how:"Download"}),e.jsx("button",{type:"button",className:"rm-btn rm-btn--out",disabled:!y,onClick:()=>{y&&Ye(y).then(p)},children:g?"Copied ✓":"Copy link"})]}),e.jsx(N,{className:"rm-center",children:"No names, no companies, no targets. Nothing here identifies a guest."})]})}const qa={Customers:"People who could buy what you sell",Investors:"People who could fund the next round",Partners:"People whose product sits next to yours",Talent:"People you would hire tomorrow"},za=Object.keys(Tt),Ha=["Raising? Stage, amount, funds you have talked to.","Selling? Company size, who signs, who you beat.","Hiring? The role, the level, what they have done.","Partnering? What sits next to your product."].join(`
4`),Ya=[["MON","Monday"],["TUE","Tuesday"],["WED","Wednesday"],["THU","Thursday"],["FRI","Friday"],["SAT","Saturday"],["SUN","Sunday"]];function Ka(t){const n=Math.floor(t),s=Math.round((t-n)*60),o=n>=12?"pm":"am";return`${n%12===0?12:n%12}${s?`:${String(s).padStart(2,"0")}`:""}${o}`}function Ja(){const{client:t,viewer:n,events:s,refresh:o,go:r,canCreate:d}=ae(),[h,i]=a.useState(null),[g,p]=a.useState(ws),[l,f]=a.useState(!!t),[k,v]=a.useState(null),[m,j]=a.useState(""),E=a.useRef(null),[c,S]=a.useState(!1),[w,y]=a.useState(""),[u,b]=a.useState(!1),[I,M]=a.useState(null),[F,O]=a.useState(!1),[x,U]=a.useState(""),[T,_]=a.useState(null),[R,K]=a.useState(""),$=a.useCallback(async()=>{if(t){f(!0),v(null);try{const D=await t.readIntent();i(D),p(D.intent)}catch(D){v(D instanceof Error?D.message:"Could not read what you have saved")}finally{f(!1)}}},[t]);a.useEffect(()=>{$()},[$]);const B=a.useRef(!1),Z=a.useCallback(async()=>{if(t){B.current=!0,O(!0),U("");try{const D=await t.weekSuggestions();M(D.hasHunt?D.days:{})}catch(D){U(D instanceof Error?D.message:"Could not rank the programme")}finally{O(!1)}}},[t]),W=!!h&&xt(h.intent);a.useEffect(()=>{W&&!B.current&&Z()},[W,Z]);const ee=a.useCallback(async()=>{if(!xt(g)){y("Pick what you are hunting, or say it in your own words.");return}if(!t||!h){y("Sign in to save this. It is what your week gets ranked against.");return}S(!0),y("");try{await t.saveIntent({intent:g,viewerUserId:n.apiUserId,read:h}),i({...h,intent:g}),b(!0),await Z()}catch(D){y(D instanceof Error?D.message:"Could not save what you are hunting")}finally{S(!1)}},[t,h,g,n.apiUserId,Z]),le=a.useMemo(()=>s.map(D=>D.techweekEventId).filter(D=>typeof D=="number"&&D>0),[s]),he=a.useMemo(()=>new Set(le),[le]),oe=a.useCallback(async D=>{if(!(!t||he.has(D))){_(D),K("");try{await t.syncWeekRooms([...new Set([...le,D])]),await o()}catch(G){K(G instanceof Error?G.message:"Could not add that room")}finally{_(null)}}},[t,le,he,o]),me=D=>p(G=>({...G,hunt:G.hunt.includes(D)?G.hunt.filter(V=>V!==D):[...G.hunt,D]})),Ne=()=>{var G;const D=m.trim();D&&(p(V=>V.targets.includes(D)?V:{...V,targets:[...V.targets,D]}),j(""),(G=E.current)==null||G.focus())};if(k)return e.jsx(ve,{error:k,onRetry:()=>void $()});if(l)return e.jsx(de,{what:"Reading what you are after"});const L=Ya.filter(([D])=>((I==null?void 0:I[D])||[]).length>0),Y=Object.values(I||{}).reduce((D,G)=>D+G.length,0),ce=!!h&&JSON.stringify(h.intent)!==JSON.stringify(g);return e.jsxs(e.Fragment,{children:[e.jsx(te,{kicker:"going, not just hosting",title:W?"What you are hunting":"What are you hunting?"}),e.jsx(N,{className:"rm-lede",children:W?"The programme is ranked against this. Change it and the week below is ranked again.":"You run rooms. This is the other half — what you want out of the ones you walk into. It ranks every room on the programme against all of it."}),e.jsx(se,{children:"pick what you are after"}),e.jsx("div",{className:"rm-picks",children:za.map(D=>{const G=g.hunt.includes(D);return e.jsxs("button",{type:"button",className:`rm-pick${G?" rm-pick--on":""}`,"aria-pressed":G,onClick:()=>me(D),children:[e.jsx("span",{className:"rm-pick-n",children:D}),e.jsx("span",{className:"rm-pick-d",children:qa[D]})]},D)})}),e.jsx(se,{children:"in your own words"}),e.jsx("textarea",{className:"rm-input rm-brief",rows:6,value:g.seeking,placeholder:Ha,"aria-label":"Who you want to meet, in your own words",onChange:D=>p(G=>({...G,seeking:D.target.value}))}),e.jsx(N,{children:"Never shown to your guests. It is the part that decides which rooms come back."}),e.jsx(se,{children:"anyone specific — optional"}),e.jsxs("div",{className:"rm-addrow",children:[e.jsx("input",{ref:E,className:"rm-input",value:m,placeholder:"Stripe · Sarah at Sequoia",autoComplete:"off","aria-label":"Add a company or a person",onChange:D=>j(D.target.value),onKeyDown:D=>{D.key==="Enter"&&(D.preventDefault(),Ne())}}),e.jsx(q,{variant:"out",onClick:Ne,children:"Add"})]}),e.jsx("div",{className:"rm-chiprow",children:g.targets.length?g.targets.map(D=>e.jsxs(ne,{onClick:()=>p(G=>({...G,targets:G.targets.filter(V=>V!==D)}
4)),children:[D," ",e.jsx("span",{"aria-hidden":!0,children:"×"}),e.jsxs("span",{className:"rm-sr",children:["Remove ",D]})]},D)):e.jsx(N,{children:"Nothing yet. Named companies also go on your Accounts list, with warm paths."})}),w&&e.jsx(N,{className:"rm-guests-err",children:w}),e.jsx(q,{disabled:c||W&&!ce,onClick:()=>void ee(),children:c?"Saving…":W?ce?"Save and rank again":"Saved":"Save and rank my week"}),u&&!ce&&e.jsx(N,{className:"rm-center",children:"Saved. Your Accounts list has the names too."}),(W||u)&&e.jsxs(e.Fragment,{children:[e.jsx(te,{kicker:Y?`${Y} rooms`:void 0,title:"Events for you"}),x?e.jsx(ve,{error:x,onRetry:()=>void Z()}):F?e.jsx(de,{what:"Ranking the programme against your hunt"}):L.length===0?e.jsx(ie,{title:"Nothing ranked yet.",line:"The programme is scored against your own words, so the more of them there are the better this gets. Add a line above and save again.",action:d?"Or add an event yourself":void 0,onAction:d?()=>r("org-new"):void 0}):e.jsxs(e.Fragment,{children:[R&&e.jsx(N,{className:"rm-guests-err",children:R}),L.map(([D,G])=>e.jsxs("div",{className:"rm-daygroup",children:[e.jsxs("div",{className:"rm-secthead",children:[e.jsx("span",{children:G}),e.jsx("span",{className:"rm-secthead-n",children:I[D].length})]}),I[D].map(V=>e.jsx(ye,{className:"rm-row--sug",lead:e.jsx("span",{className:"rm-fit",children:V.score}),name:V.t,sub:[Ka(V.s),V.hood,V.host].filter(Boolean).join(" · "),onClick:V.url?()=>window.open(V.url,"_blank","noopener"):void 0,act:typeof V.id=="number"?e.jsxs(ne,{filled:he.has(V.id),disabled:he.has(V.id)||T===V.id,onClick:()=>void oe(V.id),children:[he.has(V.id)?"On your list":T===V.id?"Adding…":"Add",e.jsxs("span",{className:"rm-sr",children:[" ",V.t," to your week"]})]}):void 0},`${D}-${V.id??V.t}`))]},D)),e.jsxs(X,{children:[e.jsx(ge,{children:"The ones you add show up on Home."}),e.jsx(N,{children:'Under "You are going to", with the people in them scored against this same answer — the same room an attendee gets.'})]})]})]})]})}const Qa={home:$s,event:Ps,"event-invite":Vs,person:Ws,drop:_s,doors:Bs,after:Ys,"league-new":ta,"league-reach":sa,"league-score":aa,"org-invite":oa,"org-new":Ea,"org-wants":$a,"org-room":Aa,"org-post":Ba,"org-intent":Ja},Xa=["drop","league-score","org-room"],ke=[{id:"attendee-event",who:"attendee × event",role:"attendee",steps:["home","event","event-invite","person","drop","doors","after"]},{id:"attendee-league",who:"attendee × permanent",role:"attendee",steps:["home","league-new","league-reach","doors","league-score"]},{id:"organizer-event",who:"organizer × event",role:"organizer",steps:["org-new","org-invite","org-wants","org-room","org-post"]},{id:"organizer-attending",who:"organizer × attending",role:"organizer",steps:["org-intent"]}];function Za(t,n){if(ke[3].steps.includes(t))return ke[3];if(ke[2].steps.includes(t))return ke[2];if(t==="home")return n==="leagues"?ke[1]:ke[0];const s=ke[1].steps.includes(t),o=ke[0].steps.includes(t);return s&&o?n==="leagues"?ke[1]:ke[0]:s?ke[1]:ke[0]}const er="https://fonts.googleapis.com/css2?family=Instrument+Sans:wght@400;500;600&family=Instrument+Serif:ital@0;1&display=swap";function tr(){a.useEffect(()=>{if(document.querySelector("link[data-rooms-fonts]"))return;const t=document.createElement("link");t.rel="stylesheet",t.href=er,t.setAttribute("data-rooms-fonts",""),document.head.appendChild(t)},[])}function nr(){return e.jsx("svg",{viewBox:"0 0 24 24",width:"18",height:"18",fill:"none","aria-hidden":!0,focusable:"false",children:e.jsx("path",{d:"M4 4h6v6H4V4Zm10 0h6v6h-6V4ZM4 14h6v6H4v-6Zm10 3h3v3h-3v-3Zm3-3h3v3h-3v-3Z",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"})})}function sr({standalone:t}){var I;const{screen:n,s,back:o,canGoBack:r,home:d,dir:h,seq:i,client:g,refresh:p,focus:l,leagues:f}=ae(),k=a.useContext(Ot),v=Qa[n],m=Xa.includes(n),j=a.useMemo(()=>Za(n,s.tab),[n,s.tab]);tr();const[E,c]=a.useState(null),[S,w]=a.useState(null),y=Xe(),u=((I=f.find(M=>M.id===l.leagueId))==null?void 0:I.apiId)??null;a.useEffect(()=>{if(!E||S||!g)return;let M=!1;return g.myCode().then(F=>{M||w({token:F.token,url:F.url})}).catch(()=>{}),()=>{M=!0}},[E,S,g]);const b=n==="home";return e.jsxs("div",{className:`rooms${m?" rooms--dark":""}${t?" rooms--standalone":""}`,"data-screen":n,children:[e.jsx("div",{className:"rooms-stage",children:e.jsxs("main",{className:"rooms-screen-wrap",ref:M=>{k&&(k.current=M)},children:[e.jsxs("div",{className:"rooms-bar",children:[r&&!b?e.jsxs("button",{type:"button",className:"rooms-back",onClick:o,children:[e.jsx("span",{"aria-hidden":!0,
4children:"←"})," Back"]}):e.jsx("span",{className:"rooms-bar-who",children:j.who}),e.jsxs("div",{className:"rooms-bar-right",children:[!b&&e.jsx("button",{type:"button",className:"rooms-bar-role",onClick:d,children:"Home"}),e.jsx("button",{type:"button",className:"rooms-bar-qr",onClick:()=>c("show"),"aria-label":"Show my code, or scan someone else's",title:"My code",children:e.jsx(nr,{})})]})]}),e.jsx("div",{className:`rooms-screen rooms-screen--${h}`,children:e.jsx(v,{})},i)]})}),e.jsx(ms,{open:E!==null,side:E??"show",onClose:()=>c(null),myCode:S,onScan:async M=>{if(!g)return{linked:!1,reason:"Sign in first.",person:null};const F=s.tab==="events"?y:null,O=await g.redeemCode({token:M,eventId:F,leagueId:s.tab==="events"?null:u});return{linked:O.linked,reason:O.reason,person:O.person}},onLinked:()=>{p()}})]})}function Ir({standalone:t=!1}){return e.jsx(Ts,{children:e.jsx(sr,{standalone:t})})}export{Ir as default};

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